Operating System - HP-UX
1833847 Members
1849 Online
110063 Solutions
New Discussion

Re: HP supported tool to map bound sockets to the invoking process

 
SOLVED
Go to solution
Jim Small
Occasional Contributor

HP supported tool to map bound sockets to the invoking process

Hi,

I need an HP supported tool that maps bound sockets to the calling process. In other words, if I do a netstat -anf inet and see that port 419 is listening/open, I want to know which process (ie from ps -ef) is listening on that port. There is a tool called lsof that does this, but as far as I know it's not officially supported by HP. Unfortunately in my corporate environment, I can only use tools officially supported by HP.

In Solaris you can use the proc tools to see if a process has any sockets associated with it. Is there something like this for HP-UX or another way that I don't know of?

Any suggestions would be appreciated!

Thanks,
<> Jim
"Try not! Do or do not. There is no try." - Yoda
5 REPLIES 5
Kevin Wright
Honored Contributor

Re: HP supported tool to map bound sockets to the invoking process

I don't think there is. other than lsof..fuser does not show processes by port numbers like lsof does, although this may help you alittle. you may have to do some convicing that lsof is almost supported...I don't know why it isn't.
MANOJ SRIVASTAVA
Honored Contributor

Re: HP supported tool to map bound sockets to the invoking process

Hi Jim

lsof is the third party tool which tell what port is bound to which process . Compiled binaries are avialable at ftp://vic.cc.purdue.edu/pub/tools/unix/lsof

for both 32 bit and 64 bits which work , incase you have troubleuntar it let me know I will forward you the same.

Manoj Srivastava

A. Clay Stephenson
Acclaimed Contributor

Re: HP supported tool to map bound sockets to the invoking process

Sorry Jim, lsof is as close as it gets.

If it ain't broke, I can fix that.
rick jones
Honored Contributor

Re: HP supported tool to map bound sockets to the invoking process

as an individual i would heartily encourage you to petition your hp support channels (ie file defects against the os) for an officially supported lsof or its like on hp-ux.

meantime, you might be able to use glance to walk all the processes looking at their open files. from time to time, glance shows more than just "tcp" and the control block address
there is no rest for the wicked yet the virtuous have no pillows
Mladen Despic
Honored Contributor
Solution

Re: HP supported tool to map bound sockets to the invoking process

Jim,

You can use Glance as follows:

1. Save the following to a file (I'll call it sock.syntax) in your current directory:

PRINT gbl_system_id, " ", gbl_stattime, " "
PRINT "--------------------------------------------------"
PRINT "Process Name PID SOCKET"
PRINT " -------------------------------------------------"
PROCESS LOOP
{
PROC_FILE LOOP
{
if proc_file_type == "socket" then
PRINT proc_proc_name|12, " ", proc_proc_id, " ",
proc_file_name, " "
}
}

2. Run:

glance -adviser_only -syntax sock.syntax -j60 | tee sockets.list

You can also modify the syntax file to specify any of the following types of open files:

block Block special device
chr Character device
dir Directory
fifo FIFO
file Simple file
link Symbolic File link
network Network channel device
other An unknown file type
pipe Named pipe (FIFO)
reg Regular file
socket Socket
streams Streams

HTH