connect() to localhost non-blocking.
Hallo all,
I wrote a little test program to do some poll() benchmarks. I changed the host address to localhost and observed that connect() always returns EINPROGRESS when used with non-blocking sockets.
Quoted 1 line
From the man page:
EINPROGRESS
The socket is non-blocking and the connection cannot be completed immediately. It is possible to select(2) or poll(2) for completion by selecting the socket for writing.
So my question is:
What is meant by 'cannot be completed immediately' ? I thought that connections to localhost would complete without any delay when the application listens ?
thanks for your answers,
Patrick
Quoted 12 lines · Patrick Mau
I wrote a little test program to do some
poll()benchmarks. I changed the host address to localhost and observed thatconnect()always returns EINPROGRESS when used with non-blocking sockets.Quoted 1 line
From the man page:
EINPROGRESS
The socket is non-blocking and the connection cannot be completed immediately. It is possible to select(2) or poll(2) for completion by selecting the socket for writing.
Quoted 5 lines
So my question is:
What is meant by 'cannot be completed immediately' ? I thought that connections to localhost would complete without any delay when the application listens ?
Probably the accept()ing process hasn't been scheduled yet. EINPROGRESS is a perfectly reasonable response in such a case.
-Doug
Signature · 2 lines
Let us cross over the river, and rest under the shade of the trees. --T. J. Jackson, 1863