Ken Posted September 22, 2009 Share Posted September 22, 2009 Is it possible to ping from within Daqfactory? or would it just be easier to use the extern() function and call a batch file? The need for the ping is to have DF basically be a "keep alive" for the vpn tunnel. With this particular setup ( dynamic to static ), the end device on the dynamic side , needs to reinit the tunnel if for any reason the tunnel goes down. Even a simple ping to the static device will re-establish the tunnel. Link to comment Share on other sites More sharing options...
AzeoTech Posted September 22, 2009 Share Posted September 22, 2009 You could ping by creating an ethernet device and just occasionally sending traffic through it. I don't know the specifics of the actual PING protocol, but I'm sure its simple and you could duplicate it. That said, it'd probably be easier just to use system.shellexecute() to call the windows command prompt ping. You don't want extern() because you don't need to load a DLL. Link to comment Share on other sites More sharing options...
Ken Posted September 22, 2009 Author Share Posted September 22, 2009 LOL... yes right..sorry shellexecute option was what I meant, the extern was from a different reply I read of yours for something else.... Obv in need of more coffee... Yes, I will probably just time a sequence to run calling the shellexecute for a single ping to the end device for now, and test the Ethernet device option at a better suited time. As always thanks for the time and support. Link to comment Share on other sites More sharing options...
polilies Posted January 30, 2013 Share Posted January 30, 2013 hi, i need something like that too. i need to use one ping frame to reduce the timeout interval. this is because of i'm using a RTU which communicates via GSM. i see when ping the RTU allways the first response is more long then the nexts. if you confuse this pic helps i'm trying but didn't succeed yet. can you tell me how must be the script? system.shellexecute("cmd.exe","ping"," ","127.0.0.1","normal") // will this work? should i see the command prompt? can u suggest something please. Link to comment Share on other sites More sharing options...
AzeoTech Posted January 30, 2013 Share Posted January 30, 2013 Wrong syntax: system.shellExecute("ping","open","127.0.0.1","") You'll see a window appear for the ping that will close when done. Do: system.shellExecute("ping","open","127.0.0.1","", "hide") if you don't want a window to appear. Link to comment Share on other sites More sharing options...
SteveMyres Posted January 30, 2013 Share Posted January 30, 2013 Is there a way to get the command prompt text returned to DAQ Factory? I've never been able to manage it. And if these guys are pinging because they want to see if the destination can be reached, it's not going to do them any good unless they can see the result of the ping, is it? Link to comment Share on other sites More sharing options...
AzeoTech Posted January 30, 2013 Share Posted January 30, 2013 I think they are pinging to wake up the GSM, not to determine if they have connectivity. If you want to check connectivity, and port 80 is available on the device you want to check, you can just use http.get(). But, that said, you might be able to capture the command prompt text by directly the output to a text file and then reading the text file. I've never tried it. You may not be able to do it directly the way I described above, but you probably can if you created a batch file that included the output redirect and then having shellExecute() call cmd, passing in the batch file as a parameter. Link to comment Share on other sites More sharing options...
SteveMyres Posted January 31, 2013 Share Posted January 31, 2013 I think they are pinging to wake up the GSM, not to determine if they have connectivity. Ah, OK, that makes sense. Yeah, I've actually done the thing you're suggesting to retrieve output from the command line. Can't remember if you could do it directly or if it needed to be in a BAT file as you mentioned, but it does work. I was just wondering if there was a way to get it to stream in directly, but if not using the file approach is fine. Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.