lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] How to correctly receive data


From: JM
Subject: [lwip-users] How to correctly receive data
Date: Tue, 28 Jul 2009 19:00:36 -0700 (PDT)

I'm having some problems receiving streaming data.  In many cases, lwIP doesn't ACK and the remote retransmits data.  My only guess at this point is that I'm not dealing with chained pbufs correctly.

Below is a callback function for tcp_recv().  It's sort of a test function; it's purpose is to simply throw away all incoming data and keep the stream going.  Am I doing these tasks in the correct order?  Or, am I destroying something prematurely?  Does pbuf_free() destroy the pbufs chained to it?

err_t newdata(void *arg, struct tcp_pcb *pcb, struct pbuf *buf, err_t err)
{
    struct pbuf *current_pbuf, *next_pbuf;
    int data;

    current_pbuf = buf;
    data = "">
    while(data > 0)
    {
        data = "" - (int)current_pbuf->len;
        tcp_recved(pcb, current_pbuf->len);
        next_pbuf = current_pbuf->next;
        pbuf_free(current_pbuf);
        current_pbuf = next_pbuf;
    }
    return 0;
}




reply via email to

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