
VB Ping Control or DLL Call for TCP/IP Network
Quote:
>I want to ping a computer by IP adres at an interval set by the timer in
>Visual Basic. Does anyone know how i can make the ping and recieve
>information back about the ping.
>The most wanted solution is the direct method, by calling a DLL.
>If you know a solution for this, Please react.
You have a couple of options here. One would be to use Microsoft's ICMP library,
but there are a couple of catches. The API is kind of clumsy in Visual Basic (it
involves passing data structures around), only permits synchronous pings, and
requires that your end-user be running Windows 95 or NT (you don't mention which
platform you're developing for, so this may or may not be a problem). Assuming
that you don't want to start from scratch, I'd recommend grabbing a sample which
shows you how to do this. As I recall, Dolphin Systems (www.dolphinsys.com) has
one posted on their samples page.
If you want to go the control route, then download a free evaluation copy of
SocketTools from our site (www.catalyst.com), which includes a 'ping' control.
One of the advantages of the control, over the direct ICMP function calls, is
that we automatically determine if your TCP/IP software is capable of creating
raw sockets -- and if it is, then we generate the ICMP ECHO datagrams directly,
bypassing the ICMP.DLL altogether. We also include a 'thunking layer' that
allows even a 16-bit control to be able to use either the Windows Sockets
library or the ICMP.DLL under Windows 95 and NT. And if you need to support for
Windows 3.1 with a 3rd party stack like Trumpet, the ping control will work
(where the ICMP.DLL approach won't).
-Mike