lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] lwip_close() doesn't work when lwip_write() hangs


From: Sylvain Rochet
Subject: Re: [lwip-users] lwip_close() doesn't work when lwip_write() hangs
Date: Mon, 12 Oct 2015 21:19:04 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Hi Joel,

On Mon, Oct 12, 2015 at 07:10:39PM +0000, Joel Cunningham wrote:
> You can use SO_SNDTIMEOUT, which should work on LwIP 1.4.1.  I have used it 
> in my port with LwIP 1.4.1, so possibly there's a problem with your port´╗┐?
> 
> I've also written applications that used non-blocking sockets and 
> select to achieve a similar behavior of having blocking I/O that can 
> be canceled.  The trick here is adding a second socket to the read FD 
> set in select and then set select to block until your write or read is 
> ready.  This second socket is bound to the loopback address.  When you 
> want to cancel the blocking select from another thread, simply send a 
> datagram to the additional socket, which will return the select call.  
> Then you can detect that a cancel/wakeup happened because the second 
> socket is marked as ready.

I really like this trick. It remembers myself of the well known wake up 
pipe I explained here[1], but using the loopback to do so in lwIP is 
very very clever :-)

Sylvain

[1] http://lists.gnu.org/archive/html/lwip-devel/2015-09/msg00028.html

Attachment: signature.asc
Description: Digital signature


reply via email to

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