ActiveSocket

 Product Overview

 ActiveSocket Objects:
 
 How to use

 Online Samples

 Download (.exe)

 Brochure (.pdf)

 Manual (.htm)

 Release Notes


Support

 Knowledge Base

 Forum

 Contact Support


Purchase

 Licensing

 Pricing

 Order now


Related documents

 Tutorials

 Tools


  Download ActiveSocket Network Communications Toolkit 4.0  (5239 KB - .exe file)
  Download Manual  (505 KB - .htm file)

ActiveSocket - 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:
  • Access
  • - You can use Ping to see if you can reach another computer. If you can't ping a site at all, but you can ping other sites, then it's a pretty good sign that your network is fine and that site is down. On the other hand, if you can't ping any site, then likely your entire network connection is down - try rebooting;
  • Time & distance. You can use Ping to determine how long it takes to bounce a packet off of another site, which tells you its distance in network terms. For example, a site hosted on your neighbor's computer next door with a different Internet service provider might go through more routers and be farther away in network distance than a site on the other side of the ocean with a direct connection to the Internet backbone. If a site seems slow, you can compare ping distances to other sites to determine whether it is the site, the network, or your system that is slow. You can also compare ping times to get an idea of which sites have the fastest network access and would be most efficient for downloading, chat, and other applications;
  • Domain IP address. You can ping either a domain name or an IP address. If you ping a domain name, it will helpfully display the corresponding IP address in the response;
  • TTL (time-to-live) - TTL prevents circular routing: the condition where an ICMP packet bounces in an infinite loop among intermediate hosts. The mechanism counts intermediate hosts along the route from source to destination.
The ActiveSocket Icmp object enables you to add Icmp/Ping functionality to your program, and features the following:
  • Supports RFC-792;
  • Support for timeout and time-to-live (also called TTL);
  • Ping computers with error control messages;
  • Object oriented design;
  • Microsoft .NET compatible;
  • Samples for VBScript, Visual Basic, Visual C++, Visual Basic .NET, Visual C# .NET, ASP and ASP .NET

The Icmp object is part of the ActiveSocket component. Overview of all ActiveSocket objects:
      » Icmp
      » Http
      » Ftp & FtpFile
      » DnsServer & DnsRecord
      » Ntp
      » Ssh
      » Rsh
      » SnmpManager
      » SnmpTrapManager
      » SnmpMibBrowser
      » Tcp
      » Udp
      » IPtoCountry
      » Wake-on-LAN


Icmp Sample code

     VBScript sample: ping a remote host
   ' Constants: Some Error codes 
   Const asERR_SUCCESS=0
  
   Set icmpObj = CreateObject("ActiveXperts.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."


     Visual Basic .NET sample: ping a remote host
   ' Constants: Some Error codes 
   Imports ASOCKETLib

   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 ActiveSocket samples. These samples are also part of the ActiveSocket installation.
» Visit ftp.activexperts-labs.com




Copyright ©1999-2007 ActiveXperts Software. All rights reserved.