lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] TCP retransmissions although packet has been recieved


From: Jens Nielsen
Subject: Re: [lwip-users] TCP retransmissions although packet has been recieved
Date: Tue, 2 Oct 2018 18:38:51 +0200
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

Hi

I'll answer the standard reply to this question :)  You're saying that "the app has received the packet" but are you really sure about that? A typical cause for this problem is that the driver stops receiving and/or forwarding packets to lwip properly, lwip can't ack what lwip doesn't receive.

And 1.4.1 is pretty old, you should upgrade...

Best regards
Jens

On 2018-10-02 11:45, Inderjit Singh wrote:
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


_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users


reply via email to

[Prev in Thread] Current Thread [Next in Thread]