[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] lwip_accept() blocks for non-blocking sockets ?
From: |
Jonathan Larmour |
Subject: |
Re: [lwip-users] lwip_accept() blocks for non-blocking sockets ? |
Date: |
Tue, 30 Sep 2008 17:52:30 +0100 |
User-agent: |
Thunderbird 1.5.0.12 (X11/20070530) |
Tamas Somogyi wrote:
> Hi,
>
> It seems that lwip_accept() blocks the calling thread even if the
> listening socket is set to non-blocking mode - see sample code below.
> Is it the normal behaviour or a bug?
Normal behaviour. Only non-blocking reads are implemented in lwip.
However lwIP does have receive timeouts, which also affect accepts. Perhaps
that might be useful. Enable LWIP_SO_RCVTIMEO in lwipopts.h, and do a call
to lwip_setsockopt, e.g.:
int timeout = 1000; /* 1000 msecs */
err = lwip_setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout));
Jifl
--
eCosCentric Limited http://www.eCosCentric.com/ The eCos experts
Barnwell House, Barnwell Drive, Cambridge, UK. Tel: +44 1223 245571
Registered in England and Wales: Reg No 4422071.
------["Si fractum non sit, noli id reficere"]------ Opinions==mine
>>>> Visit us on stand 905 at the Embedded Systems Show 2008 <<<<
>>>> Oct 1-2, NEC, Birmingham, UK http://www.embedded.co.uk <<<<