Error Codes Wiki

Linux Address Already in Use

Warningnetwork

Overview

Linux "Address already in use" (EADDRINUSE) means another process is already listening on the requested port.

Key Details

  • errno 98 — bind() failed because port is occupied
  • Common when restarting services quickly
  • TIME_WAIT state can also block port reuse
  • Only one process can bind to a specific port

Common Causes

  • Previous instance of the service still running
  • Another service using the same port
  • Port in TIME_WAIT state after recent connection
  • Zombie process holding the port

Steps

  1. 1Find what is using the port: ss -tlnp | grep :port
  2. 2Kill the process using the port: kill PID
  3. 3Use SO_REUSEADDR socket option in your code
  4. 4Wait for TIME_WAIT to expire (usually 60 seconds)

Tags

linuxnetworkaddress already in usetroubleshootingfix

More in Network

Frequently Asked Questions

Run: ss -tlnp | grep :80 or lsof -i :80 to see the process.