Phil for Humanity Phil for Humanity
A Guide for the Survival of Humankind and Helping the World, Society, and Yourself.

UNIX Support: Bind Address Already in Use Error Message

Have you ever got this error message?

 bind: Address already in use
This error basically means that the program that you are using is trying to lock or bind a port that is already locked or binded by another program or process, and therefore your program can not lock and bind this port. Thus, your program is not able to use this port at all, and your program stops working.

If you know what port number that your program is using, then you can query the operating system to see who has the port locked or binded. Let us assume that the port number that you are trying to use is port 45078. So, this command will display the status of this port:

 netstat  -a  |  grep  45078
If the status of the port is available or free, then it is "LISTENING" and it should look like this:

 tcp        0      0  *.45078                *.*                     LISTEN
If the status of the port is not free, thus binded, then it will be either "CLOSED" or "WAITING" and it should look like this:

 tcp        0      0  MACHINE_NAME.45078       IP_ADDRESS.PROCESS_ID    CLOSE_WAIT
Please notice that both the IP address and process id of whatever has the port locked is listed above.

First, try running this netstat command several times to see if the port becomes free automatically.

Otherwise with this information, you have three possible solutions to resolve this problem. First, kill the process id if it is still an active process. Second, using the IP address, find the machine that is locking the port on your machine. You can either terminate the process that is keeping this port locked on this other machine or you can reboot this other machine. Finally, of course, you can always reboot your machine to severe this port connection too.

I hoped this helped.

by Phil for Humanity
on 04/29/2009

Related Articles
 » Windows Support: Opening a DOS Prompt
 » The Types of Managers
 » The Pros and Cons of Affirmative Action