EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Command to print out dynamically assigned TCP port
From: Andrew Johnson <[email protected]>
To: Emmanuel Mayssat <[email protected]>, "Shankar, Murali" <[email protected]>, EPICS mailing list <[email protected]>
Date: Thu, 30 Jan 2014 13:34:50 -0600
On 01/30/2014 12:49 PM, Emmanuel Mayssat wrote:
> Why do you want a display in the IOC shell?
> netstat -u -p
> can do the job.

I hadn't come across the -p option to netstat before, but unfortunately
that gives the wrong port number:

> tux% softIoc -x anj2
> Starting iocInit
> ############################################################################
> ## EPICS R3.14.12.4-DEV $$Date$$
> ## EPICS Base built Jan  8 2014
> ############################################################################
> cas warning: Configured TCP port was unavailable.
> cas warning: Using dynamically assigned TCP port 35248,
> cas warning: but now two or more servers share the same UDP port.
> cas warning: Depending on your IP kernel this server may not be
> cas warning: reachable with UDP unicast (a host's IP in EPICS_CA_ADDR_LIST)
> iocRun: All initialization complete
> epics>

Murali want's something that gives him the above TCP port number 35248.

> tux% netstat -u -p
> (Not all processes could be identified, non-owned process info
>  will not be shown, you would have to be root to see it all.)
> Active Internet connections (w/o servers)
> Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
> udp        0      0 tux.aps.anl.gov:46605       164.54.11.255:ca-2          ESTABLISHED 24126/softIoc       
> udp        0      0 tux.aps.anl.gov:35266       164.54.11.255:ca-2          ESTABLISHED 24106/softIoc       


"netstat -u -p" prints UDP port numbers, not TCP, and the above ports
appear to be the sockets used to broadcast the CA beacons. I tried
"netstat -t -p" but neither of my softIoc programs show up in that
output, nor does the number 35248. That's because the above TCP server
port is not connected but is listening for connections. The command
"netstat -l -p -t" does give the right answer though, along with a few
other programs. It can only show the program name if you're root, or if
you're running as the same user as the IOC though.

> tux% netstat -lpt
> (Not all processes could be identified, non-owned process info
>  will not be shown, you would have to be root to see it all.)
> Active Internet connections (only servers)
> Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
> tcp        0      0 *:sunrpc                    *:*                         LISTEN      -                   
> tcp        0      0 *:35248                     *:*                         LISTEN      24126/softIoc       
> tcp        0      0 *:x11                       *:*                         LISTEN      -                   
> tcp        0      0 *:ftp                       *:*                         LISTEN      -                   
> tcp        0      0 *:ssh                       *:*                         LISTEN      -                   
> tcp        0      0 localhost:ipp               *:*                         LISTEN      -                   
> tcp        0      0 *:afs3-callback             *:*                         LISTEN      -                   
> tcp        0      0 localhost:smtp              *:*                         LISTEN      -                   
> tcp        0      0 localhost:x11-ssh-offset    *:*                         LISTEN      -                   
> tcp        0      0 localhost:6011              *:*                         LISTEN      -                   
> tcp        0      0 *:36955                     *:*                         LISTEN      -                   
> tcp        0      0 *:5666                      *:*                         LISTEN      -                   
> tcp        0      0 *:48578                     *:*                         LISTEN      -                   
> tcp        0      0 *:wrs_registry              *:*                         LISTEN      6541/wtxregd.ex     
> tcp        0      0 *:ca-1                      *:*                         LISTEN      24106/softIoc       

- Andrew
-- 
Advertising may be described as the science of arresting the human
intelligence long enough to get money from it. -- Stephen Leacock

References:
Command to print out dynamically assigned TCP port Shankar, Murali
RE: Command to print out dynamically assigned TCP port Emmanuel Mayssat

Navigate by Date:
Prev: RE: Command to print out dynamically assigned TCP port Emmanuel Mayssat
Next: Re: caget.c patch for dynamic array sizing J. Lewis Muir
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: Command to print out dynamically assigned TCP port Emmanuel Mayssat
Next: Cross compilation for linux-arm on target SBC (TS-7300) Azra Jabeen
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 17 Dec 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·