lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] re assembly problems


From: Kieran Mansley
Subject: Re: [lwip-users] re assembly problems
Date: Mon, 25 Oct 2010 14:59:38 +0100

On Mon, 2010-10-25 at 15:30 +0200, address@hidden wrote:
> 
> On Mon, 25 Oct 2010 13:59:29 +0100, Kieran Mansley <address@hidden>
> 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 




reply via email to

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