[Top][All Lists]

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

[lwip-devel] [bug #38121] error in connect() with O_NONBLOCK

From: hanhui
Subject: [lwip-devel] [bug #38121] error in connect() with O_NONBLOCK
Date: Sun, 20 Jan 2013 06:12:01 +0000
User-agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17


                 Summary: error in connect() with O_NONBLOCK
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: hanhui03
            Submitted on: Sun Jan 20 06:12:00 2013
                Category: sockets/netconn
                Severity: 3 - Normal
              Item Group: Faulty Behaviour
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: 
            lwIP version: CVS Head



The socket is non-blocking and the connection can not be completed
immediately. It is possible to select() for completion by selecting the 
socket  for  writing.  After select indicates writability, use getsockopt() to
read the SO_ERROR option at level SOL_SOCKET to determine whether connect
completed successfully  (SO_ERROR is zero) or unsuccessfully (SO_ERROR is not

Lwip in normal conditions does the same way, but if the server responds very
quickly, for example, the server is, in this case, Lwip will get

Because netconn_connect() call lwip_netconn_do_connect() in tcpip thread, then
lwip_netconn_do_connect() will set [msg->err = ERR_INPROGRESS;], so
netconn_connect() will use NETCONN_SET_SAFE_ERR() set netconn error, and
return is to user. If server responds very quickly, and completed the
connection operation between call lwip_netconn_do_connect() and
NETCONN_SET_SAFE_ERR() in netconn_connect() function, use getsockopt() to read
the SO_ERROR will get ERR_INPROGRESS value not zero in a already connected


Reply to this item at:


  Message sent via/by Savannah

reply via email to

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