Contact Info

Crumbtrail » Network Component » Network Component Objects » ICMP

ActiveXperts Network Component Icmp Object

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)

Icmp Sample code

VBScript sample: ping a remote host

' Constants: Some Error codes 
Set icmpObj = CreateObject("AxNetwork.Icmp")
 strHost = inputbox( "Enter host", "Input", "" )
Loop until strHost <> ""
icmpObj.Ping strHost, 2000 ' Timeout 2000 ms
If( icmpObj.LastError = 0 ) Then
  WScript.Echo "Duration:" & icmpObj.LastDuration & "ms"
  Script.Echo "Error " & icmpObj.LastError
End If
WScript.Echo "Ready."

Visual Basic .NET sample: ping a remote host

' 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 = ""
        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
       End Sub
   End Module

On, you can find a lot of Network Component samples. These samples are also part of the Network Component installation. Visit