| Previous | Next |
| ENOBUFS | ENOTCONN |
EISCONN
The peer association already exists
EISCONN means the socket is already connected. A second connect() does not create another connection, and a send operation that supplies a destination can also be invalid or ignored when the socket already has a peer association.
This is not a reachability result. The local socket's state is the relevant fact. Inspecting DNS, routes, or a remote service cannot explain why the caller tried to attach a second peer to an object that already has one.
State checks that prevent the mistake
- Track socket ownership and connection state in one place; do not let two asynchronous completion paths independently start connection setup.
- For datagram sockets, decide whether the application uses a connected peer or per-message destinations, then keep that mode consistent.
- Log the prior successful or pending connect, current peer address, and the API that made the duplicate request.
Different from pending and absent states
EALREADY means a previous operation is still pending. ENOTCONN means no required peer exists. EISCONN means the connection state already exists and the caller must use it or replace it deliberately.
References
Looking for a different code? Search another status or error code.