ICMP/Ping is one of the most commonly used utilities on the Internet by people and programs, with untold millions of pings flashing every second back and forth between computers. The original PING utility stood for "Packet Internet Groper", and was a package of diagnostic utilities used by DARPA personnel to test the performance of the ARPANET. Almost every operating system includes a Ping program. It has become one of the most versatile and widely used diagnostic tools on the Internet.
ICMP/Ping sends a small packet of information containing an ICMP ECHO_REQUEST to a specified computer, which then sends an ECHO_REPLY packet in return.
You can use Ping to perform several useful network diagnostics, such as the following:
The Network Component Icmp object enables you to add Icmp/Ping functionality to your program, and features the following:
The Icmp object is part of the Network Component. Overview of all Network Component objects:
DnsServer & DnsRecord - Ftp & FtpFile - Http - Icmp - IPtoCountry - Msn - Ntp - Radius - Rsh - Scp - SFtp - Ssh - SnmpManager - SnmpTrapManager - SnmpMibBrowser - Tcp - Tftp - TraceRoute - Udp - Xen - Wake-on-LAN - Xen (Citrix)
' Constants: Some Error codes Const asERR_SUCCESS=0 Set icmpObj = CreateObject("AxNetwork.Icmp") Do strHost = inputbox( "Enter host", "Input", "192.168.1.10" ) Loop until strHost <> "" icmpObj.Ping strHost, 2000 ' Timeout 2000 ms If( icmpObj.LastError = 0 ) Then WScript.Echo "Duration:" & icmpObj.LastDuration & "ms" Else Script.Echo "Error " & icmpObj.LastError End If WScript.Echo "Ready."
' Constants: Some Error codes Imports AxNetwork Module Module1 Sub Main() Dim objIcmp As IcmpClass = New Icmp Dim objConstants As SocketConstants = New SocketConstants Dim i As System.Int16 Dim strHost As String = "www.activexperts.com" For i = 1 To 4 Console.WriteLine("Pinging " & strHost & " ...") objIcmp.Ping(strHost, 2000) If (objIcmp.LastError = 0) Then Console.WriteLine(" Reply from " & strHost) Console.WriteLine(" Time=" & objIcmp.LastDuration.ToString()) End If System.Threading.Thread.Sleep(1000) Next Console.WriteLine("Ready.") End Sub End Module
On ftp.activexperts-labs.com, you can find a lot of Network Component samples. These samples are also part of the Network Component installation./p> Visit ftp.activexperts-labs.com