lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] netbuf_data() netconnwrite() problem


From: address@hidden
Subject: Re: [lwip-users] netbuf_data() netconnwrite() problem
Date: Tue, 17 Feb 2009 20:04:32 +0100
User-agent: Thunderbird 2.0.0.19 (Macintosh/20081209)

Francois Bouchard wrote:
The other thing that makes me slightly nervous is the use of
NETCONN_NOCOPY.  How/when are you freeing inbuf?

    I'm doing a netbuf_delete after each receive. Grosso modo:

          inbuf = netconn_recv(conn);
               if (no errors)
                    netconn_write()
               else
                    netconn_close()
          netbuf_delete(inbuf);
In that case, using the NETCONN_NOCOPY flag with netconn_write() is wrong. With _NOCOPY, you have to make sure the data is *not changed* until it is completely sent and acked by the remote side. Especially regarding retransmission, this can be a long time. In contrast to that, you *free* the data you passe with _NOCOPY right after executing the write, which may mean it is not even sent, let alone acked.

I don't know if that's your problem, but you should not use _NOCOPY there. In fact, there are very few scenarios where _NOCOPY can really be used!

Simon




reply via email to

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