[Info-vax] How to tell if TCP/IP port is in use

jbriggs444 jbriggs444 at gmail.com
Wed Jan 4 13:34:06 EST 2012


On Jan 4, 12:20 pm, moro... at world.std.spaamtrap.com (Michael Moroney)
wrote:
> JF Mezei <jfmezei.spam... at vaxination.ca> writes:
> >Michael Moroney wrote:
> >> I really want to know if something is listening on port 1234.
> >netstat -a  if I remember correctly. It will give you a list of ports
> >being lisnened to and active connections. You can then scan for
> >"LISTEN"  AND 1234
>
> Thanks, all.  It appears the following sets $STATUS to different values
> depending on whether the port has a listener or not.
> "netstat" is also a builtin command of the tcpip command.
>
> $ pipe tcpip netstat -an | search sys$input "*.1234","LISTEN"/mat=and

Of course, this would give a false positive if something is listening
on port 12345.  You might get some improvement by changing
"*.1234" to "*.1234 ".

Of course, this also misses those endpoints which are listening for
port 1234 on a specific IP rather than on the wildcard IP.  So you
might want to change to ".1234 "



More information about the Info-vax mailing list