LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I programically get the results from a ping? Is there an SDK method/class that does this?

I need to programically ping different devices to see if they are alive. I don't need to set up a session with them, or exchange any data. Does anyone know of an easy way to have the results of a ping returned to the LabWindows program? Or of a SDK method/class that will allow me to do this?

many thanks,
Lorrie Smith
0 Kudos
Message 1 of 10
(4,646 Views)
Lorrie...

After writing this below, I then found the ping source code (Its attached), but left the main message anyway, hope this helps.
-----------------------------


It all depends on what you are trying to ping on the other end.

The SDK does include a class for Ping (on XP only), but there maybe easier ways to do it. (From Aug 2001 SDK onwards, do a Topic Search for PING, there is only one result)

The PING Application is only sending a ICMP6_ECHO_REQUEST datagram to elicit an ICMP6_ECHO_REPLY from a host or gateway (I stole that without shame from one of the links below).

In the links below, you should find some more information on how to achieve this, failing that, the old way of piping the result of a ping into a file and verifying th
at from within CVI (old dirty way),

but using the source code from these links, it should be easy to construct your own 'ping'. (But as I mentioned above, it does rely on whats on the other end of the ping).

As a sad note, the first link is to the site of the guy (Mike Muuss), who sadly died in a car crash in 2000. I never really knew that much about the history or details of ping before you asked your question. It got me thinking, anyway, I hope there is some useful information on the following links,

I have an easier solution on the tip of my tongue and if it comes to me, I shall post again,

Chris

http://ftp.arl.mil/~mike/ping.html


http://www.ping127001.com/pingpage.htm

http://www.freebsd.org/cgi/man.cgi?query=ping6&sektion=8&apropos=0&manpath=FreeBSD+4.3-RELEASE

Attached samples were obtained from here:

http://www.sockaddr.com/ExampleSourceCode.html
Download All
Message 2 of 10
(4,646 Views)
Hi Chris,
Thanks for the info. I read the pages about Mike Muuss, the author of ping. It was really interesting, didn't know so much about him. Really sad that he died when only 42 in a car crash.

I have one more question. I put the examples you gave me into LabWindows, and I got the usual link errors from stuff in winsock.h. Is there a particular order I need to put the .h files? I know I'm missing something really basic here, but could you help me?

many thanks,
Lorrie
0 Kudos
Message 3 of 10
(4,646 Views)
Lorrie...

I think that they will compile fine enough, but you may need to add the Lib file, since it will probably make references to the WinSock DLL. I did see afterwards that this is for WinSock 1.1 so I would have to check about to build this into another project.

I will have a look later on,

if I forget, email me at chris.a.wright@motorola.com and ping me !!!

Regards

Chris
0 Kudos
Message 4 of 10
(4,646 Views)
Ok...

I had a quick check...

Do a search for winsock.lib or winsock32.lib and add that to your project. It should build without the link errors.

( I am assuming that you have link errors and not build errors, if you have build errors, then you are right in that its an ordering of the headers, and seeing as I don't know what else you have, I can't help you on that one, so I would just play around with them). Even if it is Build errors, you will have link errors anyway, when you try to build it, so the above will help anyway.

Chris
0 Kudos
Message 5 of 10
(4,646 Views)
Hi Chris,

You're absolutely right. I added the libraries and it compiles and links just fine. Thanks for everything, you've been a big help.

many thanks,
Lorrie
0 Kudos
Message 6 of 10
(4,646 Views)
The attached code was posted to this group a while ago. It uses SDK calls to do
a ping. It works well for me under LW CVI 6.0 on Win98SE.
Nick

"lorries323" wrote in message
news:506500000008000000984F0000-1023576873000@exchange.ni.com...
> I need to programically ping different devices to see if they are
> alive. I don't need to set up a session with them, or exchange any
> data. Does anyone know of an easy way to have the results of a ping
> returned to the LabWindows program? Or of a SDK method/class that
> will allow me to do this?
>
> many thanks,
> Lorrie Smith



[Attachment Pinger.h, see below]


[Attachment ping.prj, see below]


[Attachment ping.c, see below]


[Attachment Pinger.uir, see below]


[See first reply for additional
information]
Download All
0 Kudos
Message 7 of 10
(4,646 Views)
[Additional attachment(s)]
0 Kudos
Message 8 of 10
(4,646 Views)
Hi,

I've got the same problem. But where did you find the *.lib ??

I try to build them from my winsock.h and my winsock.dll but I obtain
a message telling me the dll is corrupted !!!!

Regards,
0 Kudos
Message 9 of 10
(4,646 Views)
Hi,
I had previously downloaded the Windows SDK from Microsoft. I found the .lib file in the lib files there. It might also be in the Windows SDK that comes with the full devevelopment system with LabWindows. I'm not sure about that.

Lorrie
0 Kudos
Message 10 of 10
(4,646 Views)