Search the Community
Showing results for tags 'networking'.
Found 2 results
-
Sometimes it can be hard to tell if a failure to communicate with a device is caused by a networking issue (cut cable, no power to remote device) or something else (protocol error, etc.) In these cases, the first thing we tend to do is ping the device. A successful ping at least tells us that the device is powered up and the IP is accessible from this computer. It doesn't tell us if the device will allow us to connect to it, a firewall is blocking the desired ports (say 502 for Modbus), or other issues, but it does eliminate some possible problems. There are many times when we wish to do this automatically. So, here is a simple script we'd like to share that you can use to ping a device from script: function checkPing(string ip, string path) system.ShellExecute("cmd","","/C ping " + ip + " > " + path, "", "hide") delay(5) private h = file.Open(path,1,0,0,0) private string data = file.Read(h, file.GetLength(h)) file.Close(h) return(find(data,"TTL=",0) != -1) It does this by triggering the command line ping, just like you would type it, and then piping the result to a file. Then it opens the file and looks for "TTL=" which really only appears if a ping is successful. The delay(5) is to give the ping command time to execute as there is no way us to know. ShellExecute() is a non-blocking function, meaning it will trigger the command but then immediately return. Because we are using command line piping we have to have shellExecute() run "CMD" not "Ping" directly. We pass the /C flag to CMD to tell it to run the Ping command then quit. The design of this function is to allow you to, in script, check the network status on many devices. Simply call this function with the ip and a path to the file you'd like ping to create with the result. You'll want to make sure if you are calling this function from multiple threads for multiple IPs that you pass a different path. Note also that this function will take at least 5 seconds to run, so don't call it from the command line or a button press. Make sure and call it from a sequence running in a background thread.
- 16 replies
-
- ping
- networking
-
(and 1 more)
Tagged with:
-
Daqfactory Version Supporting Networking?
planetcooler posted a topic in Networking: web, email, FTP etc.
I am trying to use the HTTP.Get function. Tripped over the following in the Userguide: 12.11 Web Service Calls You can programmatically perform a web service call to your favorite web service provider to retrieve information such as weather, stock prices, or whatever data you may need. This is only available through script and only available on the versions of DAQFactory that support networking. How do I know whether I have a version of DaqFactory that supports networking? According to my About message - I am running DaqFactory Express Release 5.87b Build 2048. Perhaps Express doesn't support this function ?- 1 reply
-
- Networking
- HTTP
-
(and 1 more)
Tagged with: