Wishing I could PING
ericmedley
Posts: 4,177
Just sayin...
I wish we had a PING (ICMP) that is...
I can jury rig one by telneting into myself and sending the command there. But, that's just a janky way of doing it.
I wish we had a PING (ICMP) that is...
I can jury rig one by telneting into myself and sending the command there. But, that's just a janky way of doing it.
0
Comments
http://www.amxforums.com/showthread.php?6488-Ping_URL_n_GET_IP
Thanks Vinning. But, I already can do this in spades.
I'm wanting to do a good ole fashioned ICMP message (Ping)
I want to ping an IP device from the Netlinx master in code.
We cannot do this in Netlinx. (as far as I know) attempting to do so results in nothing we can process in our sandbox.
Jeff
On my office master NI-3100 (I believe) which is loaded with a bunch of unorganized code from years of testing crap so I don't know what is really running in the background or what define program code/FB there might be I still get pretty decent results using the telnet through code method.
If I use Diagnostics "Control Device" to send to my virtual device "'PING_IP:192.168.1.33" which is my router and then 'PING_IP:yahoo.com'" to test a ping on the WAN side. From the virtual receiving the command it then opens a socket with the master's telnet port and gives it the ping command with the desired IP or name.
Both tests took only 2 seconds from receiving the commnand to closing the socket and getting my offline event, again on a system running alot of crappy code.
To Router (192.168.1.33)
To Yahoo.com through the router above which is behind another router that acts as the gateway:
Here's an example of the string with the additional command to notify a device so that the ping result will be sent to a specified device's string event handler so you can use the results in the code that needs it.
Based on my meagre readings on the subject, Java doesn't provide access to the ICMP protocol. According to its documentation Java 5.0's InetAddress.isRecahable() function seems to use the underlying OS's ICMP implementation but we do not have access to Java 5.0 in Duet.
Most people who need to implement this functionality in Java seem to be using another active port on the target devices (such as the echo service on port 7) to perform pseudo-pings instead of relying on the ICMP ping mechanism.
The following returns a java.lang.SecurityException: Not supported by platform
Which pretty much only leaves us with using JNI to run native code to access raw socket functionality (which I think requires that vxWorks on the control system is up to a certain version, which I don't believe it is).
Telnetting into the master and pinging a device from the console seems to be the easiest and onlyiest way to go for the time being
briefly
I feel like I must be causing some kind of infinite loop of send_strings, but I don't get exactly how. I do see the command going twice actually:
Vining,
Does having this connection open to 127.0.0.1 preclude anyone else opening one on the AN IP? In other words, do you lock some out by being on the internal IP?
E
nah, don't do that. I'm not crippled. I can hobble over and do it myself. I was just hoping you knew it in your brain. Thanks!
e
I honestly didn't expect you to do that but truthfully I knew you would. You're too inquisitive to resist.
Thank you kind sir!
E