[ prev | next | up ]

Address already in use

> What does the message "Address already in use" mean?
The OS only allows a single process to bind to a given address (e.g. port 7654) of a given family (e.g. AF_INET) on each host. The error "Address already in use" indicates that another process is currently bound to the address you have specified. Remember, only the receiver (server) of a client-server TCP pair needs to bind the socket to an address.

One additional note to keep in mind: if you kill a process that has bound a socket, the binding will not be released automatically. Your program should explicitly close the socket before terminating. However, the OS does clean up eventually, so you may find that the port suddenly becomes available several minutes later...

- Jeremy