(0) exportieren Drucken
Alle erweitern
EN
Dieser Inhalt ist in Ihrer Sprache leider nicht verfügbar. Im Folgenden finden Sie die englische Version.

GetBestInterface function

The GetBestInterface function retrieves the index of the interface that has the best route to the specified IPv4 address.

Syntax


DWORD GetBestInterface(
  _In_   IPAddr dwDestAddr,
  _Out_  PDWORD pdwBestIfIndex
);

Parameters

dwDestAddr [in]

The destination IPv4 address for which to retrieve the interface that has the best route, in the form of an IPAddr structure.

pdwBestIfIndex [out]

A pointer to a DWORD variable that receives the index of the interface that has the best route to the IPv4 address specified by dwDestAddr.

Return value

If the function succeeds, the return value is NO_ERROR.

If the function fails, the return value is one of the following error codes.

Return codeDescription
ERROR_CAN_NOT_COMPLETE

The operation could not be completed.

ERROR_INVALID_PARAMETER

An invalid parameter was passed to the function. This error is returned if a NULL pointer is passed in the pdwBestIfIndex parameter or if the pdwBestIfIndex points to memory that cannot be written.

ERROR_NOT_SUPPORTED

The request is not supported. This error is returned if no IPv4 stack is on the local computer.

Other

Use the FormatMessage function to obtain the message string for the returned error.

 

Remarks

The GetBestInterface function only works with IPv4 addresses. For use with IPv6 addresses, the GetBestInterfaceEx must be used.

For information about the IPAddr data type, see Windows Data Types. To convert an IP address between dotted decimal notation and IPAddr format, use the inet_addr and inet_ntoa functions.

On Windows Vista and later, the pdwBestIfIndex parameter is treated internally by IP Helper as a pointer to a NET_IFINDEX datatype.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Iphlpapi.h

Library

Iphlpapi.lib

DLL

Iphlpapi.dll

See also

IP Helper Start Page
IP Helper Function Reference
IPAddr
GetBestRoute
GetBestInterfaceEx
MIB_BEST_IF
Windows Data Types

 

 

Community-Beiträge

HINZUFÜGEN
Anzeigen:
© 2014 Microsoft