What does errno 98 (EADDRINUSE) mean?

 
Could be also:
ConstantTypeOS
ENOSRerrnoMac
EPROTOTYPEerrnoSolaris
OBJECT1_INITIALIZATION_FAILEDBugCheck CodeWindows
Previous Next
EMSGSIZE ENOSR

EADDRINUSE

EADDRINUSE is reported when the local endpoint requested by bind() cannot be reserved. For an Internet socket, the endpoint is the address-and-port combination; for a UNIX-domain socket, the conflicting object can be the pathname used for the socket. It does not identify the owning process by itself.

The usual cause for a server is another listener already using the port. A rapid restart can also encounter an address that remains unavailable during TCP shutdown. Linux documents that a previously bound TCP local address can stay unavailable after close unless reuse behavior is deliberately configured. That behavior is platform-specific, so copying a SO_REUSEADDR fix from another operating system can change safety and takeover semantics.

What to investigate

  • List listeners and processes for the exact address family, address, and port; IPv4 and IPv6 bindings may differ.
  • Check service managers and socket activation, which may own the listening socket before the application starts.
  • For UNIX sockets, determine whether a stale filesystem entry is blocking the bind before removing anything.
  • Verify that a restart strategy closes inherited descriptors and waits for the old process to exit.

POSIX bind() · Linux IP sockets and address reuse · UNIX-domain socket errors


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