CIcmpClient::GetFirstHost Method  
 
BOOL GetFirstHost(
  ICMPTRACE& icmpTrace  
);

The GetFirstHost method returns information about the first host between the local system and the remote host specified in the call to the TraceRoute method.

Parameters

icmpTrace
An ICMPTRACE structure which contains information about the intermediate host.

Return Value

If the method succeeds, the return value is non-zero. If the return value is zero, this indicates that no host information is available. To get extended error information, call GetLastError.

Remarks

The GetFirstHost method is used in conjunction with the GetNextHost method to enumerate all of the intermediate hosts between the local system and the remote host specified when the TraceRoute method was called.

Example

BOOL bResult = pClient->TraceRoute(strAddress);
if (bResult)
{
    ICMPTRACE icmpTrace;

    bResult = pClient->GetFirstHost(icmpTrace);
    while (bResult)
    {
        // The icmpTrace structure contains information about the
        // intermediate host in the traceroute
        CString strHostName;
        pClient->ResolveAddress(icmpTrace.dwHostAddress, strHostName);

        bResult = pClient->GetNextHost(icmpTrace);
    }
}

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools11.h
Import Library: csicmv11.lib
Unicode: Implemented as Unicode and ANSI versions

See Also

GetNextHost, ResolveAddress, TraceRoute