ni.com is currently experiencing slowness/issues due to ongoing maintenance.
Support teams are actively working on the soonest resolution.
ni.com is currently experiencing slowness/issues due to ongoing maintenance.
Support teams are actively working on the soonest resolution.
Overview
These examples utilize the built-in Windows OS Ping feature to perform a "Ping" using LabVIEW. Examples are included with and without .NET calls.
Description
In real world network-based applications it is important to know if a link is up and running, as well as cable and connector statuses (checking for damage, water intrusion and such...). To obtain such feedback, we can use the built-in Windows OS ping feature. After a successful ping session, users can execute more complicated network tests. The most important step in executing ping commands is to not generate too many requests and to not upset the Network Managing team, especially if the ping command would be part of automated routing inside a complex application.
Steps to Implement or Execute Code
Requirements to Run
Software
Hardware
1. N/A
Additional Images
Block Diagram
2013/04/25 Update:
Memory leak detected!
Ping timing information can be obtain from WMI query
Example attached.
-Artur
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
System command was giving me some troubles with SoftMon.exe under LANDesk managment...
-Artur
Is there a way to send ping command from cRIO platform, using .NET?
Thanks,
Tim
Hi Tim,
Probably not, but if you can create proper environment to run .net on you target device... well just for ping command - sounds silly.
What you can do, is to create a workaround by opening a TCP port with timeout and data payload if you need one.
-Artur
Thanks,
I have an application running on a crio which needs to connect to a database which does not have a static IP address. I just want to ping the Hostname to get the IP address, to open the DB connection. Any thoughts, on the best way to do it?
Data Communications -> Protocols -> TCP -> "string to IP" and "IP to string"
-Artur
P.S. And by the way you should be able to open port with name not just IP, and later convert to IP...
excellent i'll sorted.. an oversight on my part.
Hi all,
Having a bit of a problem implementing this code, I seem to always get a `0` value (Sucess) from the Ping commmand even when I`m disconnected. ( Both LAN and WiFi) I`ve double checked in command line and ping fails. Any ideas where I`ve gone wrong ?
Thanks in advance,
Works fine, try to increase payload -> pings timer resolution is 1ms at fast networks you might be below 1ms on round trips...
-Artur
Thanks Artur,
I tried Ping from the CLI, it would appear my initial Ping speed is sub 1 ms and the following 3 are > 1 ms.
I have put in a check to look at the `Roundtrip speed` too, seems to work. Not sure why but If I leave the IP address blank and disconnect the network I still get a valid connection. Any idea why ?
Ah ok, I see.
I`ll have to be careful that I don`t pass a blank string in then. (I`m using the Ping to check for network availability.)
Thanks for your help Artur.
I have created a Community Example Program which may be a great extension to yours (it also uses Windows OS functionalities, namely netsh). It performs the scanning of WiFi hotspots nearby, lists them in a ring, shows available network profiles and connects to a chosen hotspot (kudos welcome) :
WiFi Network Scanning and Connecting with LabVIEW - Discussion Forums - National Instruments
https://forums.ni.com/t5/Example-Program-Drafts/WiFi-Network-Scanning-and-Connecting-with-LabVIEW/ta...
Hi, I am having trouble running this code. Most of the time this runs fine, but occasionally I get this horrible invoke node error "Exception has been thrown by the targer of an invocation". Does anyone know what this means or how to avoid it? I have put a while looop around this code, but when this exception happens, it continues to happen. Any ideas?
Many thanks, Alec