On 11 August 2011 21:52, Kieran Mansley <[email protected]> wrote: > On Thu, 2011-08-11 at 21:47 +0800, narke wrote: >> For the 2nd question, if I called tcp_write 3 times, each time with a >> 100 bytes pbuf, and I when I got the first call of sent callback with >> a len argument equals to 100, should I prepare myself to resent the >> last two 100 bytes pbuf again? > > No, you should never need to resend anything; lwIP will deal with the > retransmission if necessary. You just have to retain the data you've > sent until lwIP tells you (using the sent callback) that is has finished > with it. You can then overwrite it or free it or do whatever you like. > When you get the first callback with len=100 that tells you that you can > release the first 100 bytes, but that the remaining 200 bytes must still > be preserved. >
Thanks, understood. If I used the TCP_WRITE_FLAG_COPY option, will the situation change? >> In above example, is that possible I got a sent callback with a len >> that is not a multiple of 100? > > Yes, and this is actually quite likely once you have more data in > flight. > > Kieran > > > _______________________________________________ > lwip-users mailing list > [email protected] > https://lists.nongnu.org/mailman/listinfo/lwip-users > -- Life is the only flaw in an otherwise perfect nonexistence -- Schopenhauer narke public key at http://subkeys.pgp.net:11371 ([email protected]) _______________________________________________ lwip-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/lwip-users
