What are possible reason for socket error EINPROGRESS
in Solaris?
How we can check the root cause?
tcp api is : connect
You have a non-blocking socket and you are calling connect()
in it. Since connect()
needs the 3-way handshake to happen (so a network roundtrip), it either blocks waiting for the SYN-ACK in blocking sockets, or gives you some indication that it hasn't succeded yet in non-blocking sockets. Normally, non-blocking sockets return EAGAIN/EWOULDBLOCK to tell you that they couldn't progress and you should try again: this is not exactly your case, connect()
returns EAGAIN/EWOULDBLOCK when there are no free ephemeral ports to tell you that you should try again later; so there is another error for non-blocking connect: EINPROGRESS, which tells you that the operation is in progress and you should check its status later.
To check the status later, the socket will become ready for writability, so you can use select()
/poll()/...
to test for that, after which you'll have to getsockopt(...SO_ERROR...)
to get the success/failure status of your connect() operation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With