|
The Internet Control Message Protocol (ICMP) control enables
your application to send and receive ICMP echo datagrams. These are
a special type of IP datagram which can be used to determine if a
remote host is reachable, as well as determine the amount of time
it takes for data to be exchanged with the local system. The ICMP
control can also be used to trace the route that data takes from
the local system to the remote host, which can be useful in
determining why a connection to a particular system may be
experiencing higher latency than normal.
The following properties, methods and events are available for
use by your application:
Initialize
Initialize the control and load the Windows Sockets library for the
current process. This method is normally not used if the control is
placed on a form in languages such as Visual Basic. However, if the
control is being created dynamically using a function similar to
CreateObject, then the application must call this method to
initialize the component before setting any properties or calling
any other methods in the control.
Uninitialize
Unload the Windows Sockets library and release any resources that
have been allocated for the current process. This is the last
method call that the application should make prior to terminating.
This is only necessary if the application has previously called the
Initialize method.
Ping and TraceRoute
To determine if a remote host is reachable, your application can
send ICMP echo datagrams. You can also map the route between the
local system and the remote host by sending a series of echo
datagrams to each intermediate host. This is what the ping.exe and
tracert.exe command line utilities do, and you can emulate that
functionality in your own applications.
Echo
This is the simplest method you can use to send ICMP echo
datagrams. Specify the remote host, the size of the ICMP datagram
you want to send and the number of times you want to send it. The
method will return if the operation was successful along with
information such as the average number of milliseconds it took for
the datagram to be returned by the remote host.
TraceRoute
This method will map the route that data packets take from your
local system to a remote host. Whenever you send data over the
Internet, that data is routed from one computer system to another
until it reaches its destination. This method returns statistical
information about each system that the data is routed through, and
the latency between that system and the local host. For each
intermediate host in the route to the destination server, the
OnTrace event will fire.
OnTrace
This event is generated when the TraceRoute method is called. The
event will fire for each intermediate host in the route from the
local system and the remote host.
|