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 David Michel
- References:
- Monitoring whether an IP device is connected or not David Michel
- Navigate by Date:
- Prev:
RE: Store long strings in EPICS record. Mark Rivers
- Next:
RE: Waveform record I/O interrupt. asyn Hill, Jeff
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
<2014>
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: Monitoring whether an IP device is connected or not Jack
- Next:
Re: Monitoring whether an IP device is connected or not David Michel
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
<2014>
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|