| Previous | Next |
| EAFNOSUPPORT | EBADMSG |
EALREADY
EALREADY means the caller attempted to start an operation that has not reached a terminal state from an earlier attempt. It is especially relevant to nonblocking connection establishment, but the core diagnostic question is generic: which operation owns the state transition, and what completion or cancellation rule has not yet been observed?
For a native nonblocking Winsock connection, the corresponding status is normally WSAEALREADY, retrieved with WSAGetLastError(). Do not translate it into “the connection succeeded.” A successful connection, a pending connection, and a failed connection need distinct states and distinct evidence.
State-machine evidence
- Record the socket identifier, connection attempt sequence number, destination, and the first call that moved the object into a pending state.
- Wait for the documented completion indication, then retrieve the final socket error instead of issuing another
connectblindly. - Ensure timeout and cancellation code remove or supersede the pending attempt exactly once.
- When pooling sockets, prevent two callers from initiating the same connection on the same object concurrently.
References
Looking for a different code? Search another status or error code.