[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] Nonblocking sockets problem
From: |
Simon Goldschmidt |
Subject: |
Re: [lwip-users] Nonblocking sockets problem |
Date: |
Wed, 14 Mar 2012 09:59:30 +0100 |
"Åke Forslund" <address@hidden> wrote:
> Hi again, this is not the original code but a implementation of the
> problem in our simple telnet-server for debug. Code below. In our original
> code
> we use ioctlsocket() to set non-blocking but using lwip_ fcntl() makes no
> difference.
The code you sent works for me with one slight modification: you have to check
the return value of lwip_accept() to be >= 0 to enter the first while(1) loop.
Better yet, use select to see if accept will succeed (put lSocketRecv on the
readset).
You don't check the return value of lwip_accept() although calling it on a
nonblocking socket: unless there's actually a new connection pending -1 will be
returned. Then of course, the inner while(1) loop is never exited because you
will never receive 'q' without a client (lwip_read() always returns -1 as
new_fd is -1).
Simon
--
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de