[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] pbuf and recvevent/recv_avail out of sync
From: |
Wolfgang Pfab |
Subject: |
[lwip-users] pbuf and recvevent/recv_avail out of sync |
Date: |
Thu, 02 Feb 2006 14:00:01 +0100 |
Hi everybody,
-- First a short explanation in wich case I encounter a problem:
I am using lwip with uc/os ii in an embedded system runing on a nios 2 cpu. A
simple tftp server was implemented with the socket API.
After receiving the last package of a file, I am waiting for the system to
store the file in flash memory before sending the ACK.
Sending large files it might happen that I run out of pbufs waiting for the
file to be stored, because the client resends the last block. So far this is
not a big deal, because I am only handling one connection at a time and do not
send any data while waiting.
Before sending the last ACK I use lwip_ioctl() to check for pending data in the
pbufs and recvfrom() in non blocking mode to read the data and release the
buffer.
-- Here it comes:
When I ran out of pbufs and read/release them, recvfrom() (in non blocking
mode) will block on the tenth package. Both lwip_select() and lwip_ioctl()
indicate that there is more data left, what is absolutely understandable,
because more than ten pbufs are specified.
When recvfrom() blocks and I send another datapackage to the server this
package will be received.
The problem will not occur if I set the number of pbufs to 9 or less.
It seems to me, that rcvevent and recv_avail are incremented but no pbuf is
allocated after the ninth one. I am not that familiar with the structure of
lwip, but I am sure there is some kind of error checking that would prevent
this from happening.
I will appreciate any hint that could bring some light to this issue!
Thanks in advance,
--Wolfgang
- [lwip-users] pbuf and recvevent/recv_avail out of sync,
Wolfgang Pfab <=