From: David Kirkby on
I wish to know of a system has a server running at port 8000, and if
so what its called if possible. I know I can do

$ telnet localhost 8000

but that hangs and one neds to use a control-C, Also, in general, it
gives no information about that server, though there are exceptions.

I suspect lsof can do this, but that is not a standard part of
Solaris. (I want to get the information from a script which could be
run on arbitrary Solairs/OpenSolairs hardware.

Dave
From: Chris Ridd on
On 2010-07-24 05:17:52 +0100, David Kirkby said:

> I wish to know of a system has a server running at port 8000, and if
> so what its called if possible. I know I can do
>
> $ telnet localhost 8000
>
> but that hangs and one neds to use a control-C, Also, in general, it
> gives no information about that server, though there are exceptions.
>
> I suspect lsof can do this, but that is not a standard part of
> Solaris. (I want to get the information from a script which could be
> run on arbitrary Solairs/OpenSolairs hardware.

Use "netstat -n", grep the output for "LISTEN" and then your 8000. If
the port been opened "on all interfaces", it'll look like "*.8000" in
the output. If it is just open on one interface (eg 1.2.3.4), it'll
look like 1.2.3.4:8000 instead.

I can't think of an easy way to work out what process has it open. The
pfiles command can tell you if a given process is listening to a port,
but you'd need to run it on each running pid...

--
Chris