On Mon, 2010-10-25 at 15:30 +0200, [email protected] wrote:
> 
> On Mon, 25 Oct 2010 13:59:29 +0100, Kieran Mansley <[email protected]>
> wrote:
> > TCP or UDP?  The two handle fragmentation rather differently.
> > 
> 
> Hi,
> 
> Using TCP only. We don't try UDP.

OK, that's easy then: it's up to the application to deal with
fragmentation.  TCP delivers a stream of bytes with no guarantees about
the block size that the stream will be delivered in at the receiver.  It
could pass you one byte at a time if it wished (although that would be
very inefficient of course!).  Or it could combine many writes into a
single big block at the receiver.

In your case I would structure the app something like this:

1) read 2 bytes to find the size of message.

2a) try to read message-size-bytes.
2b) if you get less than message-size-bytes loop to read the rest of the
message until you've got all you want.  

Kieran 


_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to