1847314 Members
2493 Online
110264 Solutions
New Discussion

Port already use

 
Gordon_3
Regular Advisor

Port already use

Hi all,

I just want to know if somehow a tcp port is used by any problem, what command can I use to check it out? netstat? Also any command to terminate the session if I found by suggested command?

Bgds,
Gordon
Gordon
6 REPLIES 6
Deepak Extross
Honored Contributor

Re: Port already use

Yes, you can use netstat:
netstat | grep

You could also try
grep /etc/services

If you want to stop the process using the port, you can try a 'kill '. Avoid using 'kill -9 ', as it will most likely terminate the process without releasing the port.
Deepak Extross
Honored Contributor

Re: Port already use

Yes, you can use netstat:
netstat | grep

You could also try
grep /etc/services

If you want to stop the process using the port, you can try a 'kill '. Avoid using 'kill -9 ', as it will most likely terminate the process without allowing it to release the port first.
Wodisch
Honored Contributor

Re: Port already use

Hi,

get the free tool "lsof" and then use
lsof -i tcp:1234
or
lsof -i udp:1234

where "1234" would be the port number you are interested in...

HTH,
Wodisch
Gordon_3
Regular Advisor

Re: Port already use

HI all,

Many thx for your advice, btw, Wodisch, where can I get the free tools lsof? Many thx.

Bgds,
Gordon
Gordon
Steven Sim Kok Leong
Honored Contributor

Re: Port already use

Hi,

You can get lsof from:

http://hpux.connect.org.uk/hppd/hpux/Sysadmin/lsof-4.61/

Terminating TCP sockets is not encouraged because it may cause unstability. But, if you really wish to do so, use the instructions at this thread:

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x9a3eec08252fd611abd50090277a778c,00.html

Hope this helps. Regards.

Steven Sim Kok Leong
Doug Kratky
Frequent Advisor

Re: Port already use


A better place to get lsof is: ftp://ftp.cerias.purdue.edu/pub/tools/unix/sysutils/lsof/ There are binaries there that will work on both 11.00 and 11.11, 32 and 64 bit.

The binary at the HP-UX Porting and Archive Center is a couple of releases behind and won't work on all architectures.