TraceRoute Method

Send a series of ICMP echo datagrams to trace the route taken from the local system to the remote host.

Syntax

object.TraceRoute( [RemoteHost], [MaxHops], [Timeout] )

Remarks

The TraceRoute method sends a series of ICMP echo datagrams to the specified host, adjusting the time-to-live value to determine the intermediate hosts that route the packet. This method will always block until the trace completes, regardless of how the Blocking property is set. The OnTrace event will fire for each intermediate host along the route. The following arguments may be passed to this method:

RemoteHost
An optional string which specifies the host name or IP address which the ICMP echo datagram will be sent to. If this argument is omitted, the value of the HostAddress property will be used. If the HostAddress property has not been set, then the value of the HostName property will be used as the default value.
MaxHops
An optional integer value which specifies the maximum number of routers the datagram will be forwarded through (the number of hops) to the remote host. The minimum value is 1 and the maximum value is 255. It is recommended that most applications specify a value of at least 30. If this argument is omitted, the default value of 30 will be used.
Timeout
An optional integer value which specifies the number of milliseconds until a blocking operation fails and the control returns an error. A value of zero indicates that the blocking operation should wait indefinitely. If this argument is omitted, the value of the Timeout property will be used as the default value.

It is important to note that the failure of an intermediate host to respond to an ICMP echo datagram may not indicate a problem with the remote system. Systems can be configured to specifically ignore ICMP echo datagrams and not respond to them; this is often a security measure to prevent certain kinds of Denial of Service attacks.

Return Value

The method returns the total number of hops from the local system to the remote host. If the method fails, it will return a value of -1. Check the value of the LastError property to determine the cause of the failure.

See Also

HostAddress Property, HostName Property, Timeout Property, Echo Method, OnTrace Event


Copyright © 2008 Catalyst Development Corporation. All rights reserved.