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
signature.asc
Description: Digital signature
_______________________________________________ lwip-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/lwip-users
