lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Non-blocking I/O in lwip


From: Francesco Sacchi
Subject: [lwip-users] Non-blocking I/O in lwip
Date: Fri, 22 Jul 2011 12:21:01 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110617 Thunderbird/3.1.11

Hello,
we are currently using lwip 1.3.2 and we are aware that non-blocking IO while *sending* tcp data is not supported in that version.

We have integrated lwip in our operating system (bertos.org) for now usign only the cooperative kernel.

Here is the scenario:
our application has a listening tcp socket, used by the user in order to send telnet commands, and, in another process, the application sends data to a remote tcp server.

Sometimes this server crashes in a manner that connection stalls. The socket is still open on the server side, but the server application does not read from it. This server is not under our control, so we have to handle this case on our side.

Lwip tries to buffer the data, but at some point the memory finishes and the lwip_send() function blocks indefinitely; and worse, since there is no more memory, the listening telnet socket cannot handle requests anymore.

We tried to close the blocked socket with lwip_close() from another process, but lwip_send() did not return nor the memory allocated was freed.

We see that non-blocking sending has been implemented in lwip-1.4, and here is our question: if we upgrade will this issue be solved?

In other words, if I open a socket in non-blocking mode, I suppose that the lwip_send() will return an error in case it would block (EWOULDBLOCK), but then, if I close the socket, will the memory allocated be freed correctly?



--
  |/ Francesco Sacchi - Develer S.r.l.
 -|  http://www.develer.com/ - http://www.bertos.org/
  |\ Tel: +39 055 3984627 ext 208



reply via email to

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