| Previous | Next |
| ECONNABORTED | ECONNRESET |
ECONNREFUSED
ECONNREFUSED means the attempted connection reached a point where the target service was not accepting it. It is stronger evidence than a timeout: the network path may be working, but no listener, policy, or service instance accepted the endpoint at that time.
For Winsock, preserve the native WSAECONNREFUSED returned by WSAGetLastError(). A POSIX-style wrapper may map that status to ECONNREFUSED, but the mapping must not hide whether the failure happened during synchronous connect, asynchronous completion, or a proxy's separate connection attempt.
Checks that distinguish service absence from a bad target
- Record DNS result, final numeric destination, port, address family, proxy path, and the time of the attempt.
- Verify that the service listens on the exact address family and interface, not merely that a process is running.
- Compare direct and proxied paths; a proxy can refuse its own outbound connection while the client never contacted the target.
- Retry only with backoff and only when the protocol permits creating a new connection. A refusal is not repaired by resending data on the failed socket.
References
Looking for a different code? Search another status or error code.