lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Re: [lwip] sockets.c bug


From: Kieran Mansley
Subject: [lwip-users] Re: [lwip] sockets.c bug
Date: Wed, 08 Jan 2003 23:41:46 -0000

On Thu, 4 Apr 2002, Jani Monoses wrote:

> Hi
>
> in the BSD socket implementation in lwip_recvfrom()
> the line
>   sock->lastoffset = buflen - copylen;
> should read
>   sock->lastoffset = copylen;
>
> otherwise when the application requests a read() with len smaller than
> what has been already acked by the stack the address of the next byte to
> read is not adjusted correctly.

I'm not sure.  buflen is the amount of data remaining in the buffer that
hasn't been read before.  copylen is the amount that was read this time.
Therefore, sock->lastoffset should be increased by copylen, not set to
copylen.  ie.  If the buffer is 1000 long and you've read 100 before,
buflen is 900 and lastoffset is 100.  If you read 200, lastoffset should
be set to 300 (lastoffset + copylen), not 200.

It should read
   sock->lastoffset += copylen.

Kieran


[This message was sent through the lwip discussion list.]




reply via email to

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