1833771 Members
2227 Online
110063 Solutions
New Discussion

Port number in use

 
SOLVED
Go to solution
Ed Hon
Regular Advisor

Port number in use

I have a problem starting an app, because of error "port number already in use". How can I see a list of port numbers allocated and in use? Thanks.
4 REPLIES 4
Rita C Workman
Honored Contributor

Re: Port number in use

Try using lsof utility for something like this. You can download from:

http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/lsof-4.51/

/rcw
John Bolene
Honored Contributor

Re: Port number in use

You can also use netstat -a|grep xxx
where xxx is the port in question.
It is always a good day when you are launching rockets! http://tripolioklahoma.org, Mostly Missiles http://mostlymissiles.com
rick jones
Honored Contributor

Re: Port number in use

I will _guess_ that you will find old connections from the last instantiation o fthe app - stuff in TIME_WAIT, FIN_WAIT_2, perhaps other states. So long as there is nothing for that port number in the LISTEN state it implies there is a bug in the app - it is not setting SO_REUSEADDR before attempting to bind() to its well-known port number.
there is no rest for the wicked yet the virtuous have no pillows
Philip Chan_1
Respected Contributor
Solution

Re: Port number in use

netstat -a|grep EST, would give you the connection couples that were established.

The lsof command (optional) should be able to tell you which process have these ports open.

~Philip