What does Windows error code 10056 (WSAEISCONN) mean?

 
Previous Next
WSAENOBUFS WSAENOTCONN

WSAEISCONN

WSAEISCONN is a socket lifecycle error: the application attempted to connect a socket that already has a peer association. It does not mean that the existing connection is healthy or that the server rejected a second request; it means the API contract does not permit another connect on that socket in its current state.

Typical causes

Common causes include calling a connection routine twice after a successful asynchronous completion, reusing an object whose previous connection was never closed, or treating a datagram socket that was deliberately connected to a default peer as if it were still unconnected. In concurrent code, two connection attempts can race unless the transition from “connecting” to “connected” is owned by one state machine.

What to do

  • Keep explicit states such as created, connecting, connected, closing, and closed.
  • Before reconnecting after an error, close and replace a broken socket instead of calling connect again on an uncertain object.
  • Log the original peer address and the call that established the first association.

Microsoft: connect · Microsoft: socket creation · The Open Group: socket lifecycle


Looking for a different code? Search another status or error code.