GetBestRoute function (iphlpapi.h)
The GetBestRoute function retrieves the best route to the specified destination IP address.
Syntax
IPHLPAPI_DLL_LINKAGE DWORD GetBestRoute(
[in] DWORD dwDestAddr,
[in] DWORD dwSourceAddr,
[out] PMIB_IPFORWARDROW pBestRoute
);
Parameters
[in] dwDestAddr
Destination IP address for which to obtain the best route.
[in] dwSourceAddr
Source IP address. This IP address corresponds to an interface on the local computer. If multiple best routes to the destination address exist, the function selects the route that uses this interface.
This parameter is optional. The caller may specify zero for this parameter.
[out] pBestRoute
Pointer to a MIB_IPFORWARDROW structure containing the best route for the IP address specified by dwDestAddr.
Return value
If the function succeeds, the return value is NO_ERROR.
If the function fails, use FormatMessage to obtain the message string for the returned error.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | iphlpapi.h |
Library | Iphlpapi.lib |
DLL | Iphlpapi.dll |