Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12608 Discussions

possible missmatch between rcvevent and pbuf

Altera_Forum
Honored Contributor II
1,025 Views

Hi everybody, 

 

I am using lwip with uc/os ii and the socket api to establish an udp connection. During program execution it might happen, that the pbuf fills up. Trying to empty it, I have recognized that recvfrom() blocks even though I am using the flag MSG_DONTWAIT. Using select() to see if data is pending or lwip_ioctl() to check how many bytes are available will not work. 

 

My only explanation for this behavior would be that even though no more data can be stored in pbuf, rcvevent and recv_avail are incremented, and therefore recvfrom(), select and lwip_ioctl() are awaiting pbuf to hold mor data than there is available. 

 

Any ideas for a work around? 

--wolf
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
328 Views

found out that this problem only occurs if the number of pbuffer is greater than 10.

0 Kudos
Altera_Forum
Honored Contributor II
328 Views

Hi pfab, 

 

you should also use pbuf_free(nameOfPbuf); else you run out of pbufs.... 

 

cheers, 

 

Danny
0 Kudos
Altera_Forum
Honored Contributor II
328 Views

Well, yes I do run out of pbufs, but that is not the point here, because a call to recvfrom() will release the pbuf it just read from. 

The point is, that if I ran out of pbufs (wich is intended) and start reading/releasing them with recvfrom(), the function will block after getting about ten data packages, even though it is used in non blocking mode. Both select() and lwip_ioctl() indicate that there is data left, what is absolutely understandable, because more than ten pbufs are specified in the projects properties. 

 

Now I would like to know if this could be a bug in lwip or if I have to adjust some of the lwip properties (currently I am using the default values) or if there is any other plausible explanation for this behavior. 

 

Thanks in advance for all helpful info you can give! 

--wolf
0 Kudos
Reply