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: Monitoring whether an IP device is connected or not
From: David Michel <[email protected]>
To: "J. Lewis Muir" <[email protected]>
Cc: [email protected]
Date: Tue, 25 Feb 2014 17:20:21 +0000
>Depending on what platform your IOC is running, you could potentially
>execute the platform's ping program from your C function.  This would
>allow you to ping without running your IOC as root.

That's exactly what I was doing. On Linux (Ubuntu).

> if you can make a small change to your black box, is
>to run a simple server on your black box that listens on a TCP or UDP
>port.  You could then use asyn or StreamDevice on your IOC to send a
>tiny request to that server.

Yes, that could be an option - Similarly, I was thinking I could perhaps run an "dummy" IOC with a "dummy" record that is queried from the other IOC. This way, I can use the builtin PVExistTest routine that will notify the IOC and my OPI rather quickly and without much development effort.

What I'm not sure of with this approach is how to turn the "disconnected" information into say a bi record with 1 for connected and 0 for disconnected ??

David














---
Dr. David Michel
Address: 8 Viking Drive, Didcot, OX11 9RD, Oxfordshire
Mobile: 0789 670 98 01 - Home: 0123 581 46 93


On 25 February 2014 17:03, J. Lewis Muir <[email protected]> wrote:
On 2/25/14, 6:22 AM, David Michel wrote:
> Hi All,
>
> I have a device with an IP (i.e. a computer on the network which then
> talks to other devices, but we'd like to treat it as a black box)
> and I'd like to be able to do a "pulse check" from an IOC running on
> another machine to detect whether it's still running or not.
>
> Just as a quick test, I wrote a quick C function that performs a
> 'ping' and hooked that up to an aSub record. That works fine but, as
> you can imagine, it's obviously very slow and keeps the device busy
> responding to ping calls all the time, so it's not very practical at
> all.... there must be a better way!

Hi, David.

What exactly does your "ping" C function do?

A traditional network ping is quite simple: An ICMP echo request is sent
to an IP address and the node at that IP address sends an ICMP echo
reply.  This should definitely not keep your device busy; this is a very
small amount of network traffic.

On most UNIX systems, a raw socket is required to send the ICMP request.
This usually requires special privileges (i.e. root).  Hence, most
systems will have a ping program that is setuid root.  This would be a
problem for your IOC unless you're OK running it as root.  (On Mac OS X
10.9 Mavericks, it's possible to open ICMP sockets with the SOCK_DGRAM
socket type without root privileges.  This is why the ping program on
Mac OS X 10.9 Mavericks is not setuid root.  I don't know when this was
introduced on Mac OS X.  Something similar might be available on newer
Linux OSes too; I don't know.)

Depending on what platform your IOC is running, you could potentially
execute the platform's ping program from your C function.  This would
allow you to ping without running your IOC as root.

I don't know what's required to do a ping on VxWorks.  Maybe there's no
privilege issue with raw sockets there?

Another option, if you can make a small change to your black box, is
to run a simple server on your black box that listens on a TCP or UDP
port.  You could then use asyn or StreamDevice on your IOC to send a
tiny request to that server.  If it replies as expected, you can assume
it's available.

Lewis


Replies:
Re: Monitoring whether an IP device is connected or not J. Lewis Muir
References:
Monitoring whether an IP device is connected or not David Michel
Re: Monitoring whether an IP device is connected or not J. Lewis Muir

Navigate by Date:
Prev: RE: Waveform record I/O interrupt. asyn Hill, Jeff
Next: RE: Store long strings in EPICS record. David Michel
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: Monitoring whether an IP device is connected or not J. Lewis Muir
Next: Re: Monitoring whether an IP device is connected or not 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 
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 ·