Hi,
I have the following configuration:
H/W
ATMEL SAM4E ARM Cortex-M4 with KSZ8081MNXRNB Ethernet
phy.
LWIP:
1.4.1
Config (extract. See attached file for full
config):
#define
NO_SYS 1
#define
MEMP_NUM_TCP_PCB 2
#define
MEMP_NUM_TCP_PCB_LISTEN 1
#define
MEMP_NUM_TCP_SEG 8
Problem:
I am sending HTTP/1.1 packets to server and receiving
replies as expected. But it seems that the server keeps
sending re-transmissions as local hardware doesn't seem to
send an ACK back (3-way handshake?). After some time the
server resets the connection and my next http request get's
blocked. Should LWIP layer send an ACK back as the app has
received the packet?
pcap capture is attatched.
Here is the code snippet when packets is received:
err_t tcp_tx_resp_cb(void *arg,
struct tcp_pcb *tpcb, struct pbuf *p, err_t err)
{
struct pbuf* temp_p;
eth_ctx_t* ctx = (eth_ctx_t*)arg;
uint16_t len;
if(err < 0)
{
DBG_W(EINVAL, "Ignoring response err '%d'. err");
return err;
}
len = 0;
/* retrieve data */
if ((err == ERR_OK) && (p != NULL)) {
/* get response status value */
ctx->status = http_get_status(p->payload);
while (p != NULL) {
if (ctx->recv_buf != NULL) {
memcpy(&ctx->recv_buf[len],
p->payload, p->len);
}
temp_p = p->next;
len += p->len;
pbuf_free(p);
p = temp_p;
}
/* Terminate it for parsing it more easily */
ctx->recv_buf[len] = 0;
if (ctx->recv_buf != NULL) {
ctx->recv_size =
http_get_data(ctx->recv_buf, ctx->recv_buf);
}
DBG_I("TCP RESPONSE: status:%03d. data_size: %d
bytes. err: %d.",
ctx->status, ctx->recv_size, err);
}
return ERR_OK;
}
Tanks in advance,
Inderjit