lwip-users
[Top][All Lists]
Advanced

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

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


From: Francesco Sacchi
Subject: Re: [lwip-users] Non-blocking I/O in lwip
Date: Mon, 25 Jul 2011 16:44:14 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110617 Thunderbird/3.1.11

Il 22/07/2011 18:54, Simon Goldschmidt ha scritto:
Francesco Sacchi<address@hidden>  wrote:

Il 22/07/2011 12:36, Simon Goldschmidt ha scritto:

Francesco Sacchi<address@hidden>   wrote:
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?

Yes, 1.4.0 should work for you: if no buffers are available, a non-blocking 
send returns EWOULDBLOCK (which a blocking send waits indefinitly for memory to 
become available).

Ok, but if I close a blocked socket, will the memory allocated by the socket 
itself be freed?

No, you can't close a blocked socket: lwIP's socket implementation does not 
allow a socket to be used from more than one thread at once, so calling close() 
from one thread while another thread is blocked in send() wont work.


However, you might want to control the amount of data buffered on the listening 
connection so that the out-of-memory condition doesn't happen at all?

Could you be more specific? What listenig connection do you refer to? If you 
are talking about the server side connection, that is not accessible to us 
because resides on a PC and the software is not editable by us.

Ok, in that case I misunderstood you. I thought the server that blocks would 
run on the same lwIP device. Being like that, non-blocking send is the way to 
go.

Hi Simon, thank for your reply.

While we are waiting to upgrade to 1.4, is there anything we can do in order to limit the memory occupation of a sending socket?

I played with TCP_MSS, TCP_SND_BUF and TCP_SND_QUEUELEN options without luck.

How can I manage the amount of memory allocated by a socket?

--
  |/ 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]