LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

A ping function

Is there a library function to ping a device?
0 Kudos
Message 1 of 9
(6,607 Views)
There is no ping function in CVI or the Windows SDK. Ping is a system-level command that is provided by the OS. The best way to do a ping in CVI, is to use LaunchExecutable to run ping and redirect the output of ping to a file. You can do this by building a batch file with something like:

ping.exe 172.16.19.60 > data.txt

Then call LaunchExecutable on the batch file. Then you can open the data.txt file to find the results of the ping.

Best Regards,

Chris Matthews
Measurement Studio Support Manager
0 Kudos
Message 2 of 9
(6,607 Views)
I can do this in dos, but when I try doing this command in cvi ping.exe 10.1.1.2 > data.txt,it doesnt work any ideas? I think it does not like the >
0 Kudos
Message 3 of 9
(6,607 Views)
Try Status = LaunchExecutable (" ping.exe 10.1.1.2 > data.txt");

Luis Villa
"truc" wrote in message
news:506500000005000000CB1E0000-984882144000@quiq.com...
> I can do this in dos, but when I try doing this command in cvi
> ping.exe 10.1.1.2 > data.txt,it doesnt work any ideas? I think it
> does not like the >
Message 4 of 9
(6,607 Views)
On Fri, 23 Mar 2001 16:11:22 -0600, "Luis Villa" wrote:

>Try Status = LaunchExecutable (" ping.exe 10.1.1.2 > data.txt");
>

File redirection is provided by the command interpreter so use the following:

Status = LaunchExecutable ("command /C ping.exe 10.1.1.2 > data.txt");

Michael Harrison
NI
Message 5 of 9
(6,607 Views)
Hi
Did you manage to get the ping function using cvi to work? Please mail me the solution if yo where successfll.
Thank You
Arik
arikl@gilat.com
0 Kudos
Message 6 of 9
(6,606 Views)
I built my ping function adapting some sample code provided by Microsoft to use it in a CVI proejct. The code is in the source file attached: to use it you must also include in your project the library WS2_32.LIB (found in \sdk\lib directory).

I've used it in a CVI 5.5 project on a Windows98 machine and it worked well. I tried to transfer it to a Win95 machine, but had to download the winsock2 utility from Microsoft site: after that all worked well too.

To use it simply call the Ping (hostname) function: it returns 1 if the host was found, 0 if not.

Hope this helps.
Roberto


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 7 of 9
(6,606 Views)

Let's try :

 

      int InetPing (const char *address, int *available, unsigned int timeout);

 

as suggested in CVI Help menu

 

Regards, David

0 Kudos
Message 8 of 9
(3,761 Views)

You're right, a lot of things have changed in the 17 years passed from my last post in this discussion! Smiley Wink



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 9 of 9
(3,756 Views)