| Previous | Next |
| ELOOP | EMSGSIZE |
EINPROGRESS
EINPROGRESS is the expected intermediate result of many nonblocking connection attempts. It means the kernel accepted the request to establish a connection but cannot report the final outcome synchronously. It is not the same as a refused connection, a timeout, or a successful connection.
For a nonblocking connect(), register interest in writable status. When the descriptor becomes writable, obtain SO_ERROR with getsockopt(): zero means the connection completed; a nonzero value identifies the actual failure, such as ECONNREFUSED or ETIMEDOUT. Do not send application data merely because the socket became writable without checking that result.
The connection attempt remains associated with that socket. A later connect() before completion normally produces EALREADY; after successful completion, it can produce EISCONN.
Useful diagnostics
- Log the resolved address, address family, port, and the completion error from
SO_ERROR. - Use a monotonic application deadline; kernel connect timing can be longer than the product-level timeout you want.
- Make cancellation explicit by closing the socket or using the event framework's cancellation model.
POSIX connect() · Linux connect(2) · getsockopt(2) and SO_ERROR
Looking for a different code? Search another status or error code.
