1855196 Members
5704 Online
104109 Solutions
New Discussion

Re: HTTP port listener?

 
SOLVED
Go to solution
Chamitha Wijesekera
Frequent Advisor

HTTP port listener?

Hi, is there a product or command I can use where I can watch the port usage of a particular HP-UX machine real time? I need to see the creation of some HTTP listeners an application of mine creates. Thanks!
8 REPLIES 8
James R. Ferguson
Acclaimed Contributor
Solution

Re: HTTP port listener?

Hi:

Probably your best bet is to use 'lsof':

# lsof -i tcp:80

# # lsof -p

You can get a version here:

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

If you need to compile a 64-bit version, I suggest this site:

ftp://coast.cs.purdue.edu/pub/tools/unix/sysutils/

Regards!

...JRF...
Jeff Schussele
Honored Contributor

Re: HTTP port listener?

Hi Chamitha,

You could do the following

I=1
while (( I < 100 ))
do
netstat -an | grep -i listen | grep -e "port#" -e "port#" # include all relevant port #s
sleep 5 # or whatever wait value you need
(( I = I +1 ))
done

This will give you a hundred iterations & look only for the LISTEN on the port #s you designate. If the ports are in a range, you could use the range in the 2nd grep...

OR.....write the following script

I=1
while (( I < 10000 ))
do netstat -an | grep -i listen | grep -e "port#" -e "port#" > /path/to/listen.log
sleep 1
(( I = I + 1 ))
done

Then run the script in the background & do
tail -f /path/to/listen.log
to watch it real-time.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Arockia Jegan
Trusted Contributor

Re: HTTP port listener?

lsof is the nice command for that. use "lsof -i -p" and grep for the specific pattern.
harry d brown jr
Honored Contributor

Re: HTTP port listener?

lsof

Don't monitor without it :-)

lsof is available on many platforms and is blessed by HP.


live free or die
harry
Live Free or Die
Chamitha Wijesekera
Frequent Advisor

Re: HTTP port listener?

Where can i download lsof? It doesnt seem to exist on my HP-UX machine!
Sanjay_6
Honored Contributor

Re: HTTP port listener?

Hi,

you can download lsof from the link provided by James,

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

Hope this helps.

Regds
James R. Ferguson
Acclaimed Contributor

Re: HTTP port listener?

Hi (again):

If you follow the link(s) I provided in my original reply, above, you can download a pre-compiled version of 'lsof':

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

...or for a more up-to-date version:

ftp://coast.cs.purdue.edu/pub/tools/unix/sysutils/

The ports from the hpux porting center install in /opt/ via 'swinstall'.

If you need a 64-bit version, use the purdue site. A makefile allows you to compile your own version and put it in the directory of your choice (albeit not by 'swinstall').

Regards!

...JRF...

Chamitha Wijesekera
Frequent Advisor

Re: HTTP port listener?

thanks everyone! appreciate it!