Freigeben über


CmGetFirstIpAddr (Compact 2013)

3/26/2014

This function gets the first address associated with the specified destination host.

Syntax

CM_RESULT CmGetFirstIpAddr(
    __in CM_CONNECTION_HANDLE hConnection,
    __in const WCHAR* pszHost,
    __in ADDRESS_FAMILY AddrFamily,
    __in USHORT SrcPort,
    __in USHORT DstPort,
    __inout_bcount(*pcbAddressPair) CM_ADDRESS_PAIR* pAddressPair,
      __inout DWORD* pcbAddressPair
);

Parameters

  • pszHost
    [in] A pointer to a string value specifying the destination host name or IP address.

    Delimit a name with quotes. For example: "www.microsoft.com". A "*" in the leftmost label of the name will match all FQDN names in the domain. For example: "*.microsoft.com" matches "www.microsoft.com" and "msdn.microsoft.com".

    Delimit an IP address with quotes and square brackets. For example: "[207.46.19.254]". A "/" and a prefix length is used to define a CIDR block of addresses. For example: "[207.46.19.0/24]" or "[2001:0db8:1234::/48]".

  • AddrFamily
    [in] An ADDRESS_FAMILY value in host byte order. These values are found in the Ws2def.h header file.
  • SrcPort
    [in] The port number of the source of the connection.
  • DstPort
    [in] The port number of the destination of the connection.
  • pAddressPair
    [in] A pointer to a storage area to place the output.

    [out] A pointer to a set of CM_ADDRESS_PAIR structures.

  • pcbAddressPair
    [in] A pointer to a storage area to place the output.

    [out] A pointer to the count of structures in pAddressPair.

Return Value

Value

Description

CMRE_SUCCESS

The operation completed successfully.

CMRE_INVALID_CONNECTION

hConnection is not valid.

CMRE_CONNECTION_NOT_ACQUIRED

The connection could not been established.

CMRE_NO_HOST_ADDRESSES

The host name could not be resolved using the connection.

CMRE_INSUFFICIENT_BUFFER

The pAddressPair output buffer is too small to contain the address pair. The required output buffer size is returned in pcbAddressPair.

CMRE_NOT_SUPPORTED

The AddrFamily is not supported

CMRE_OUT_OF_MEMORY

Memory can not be allocated to complete the operation.

CMRE_INVALID_VERSION

The pAddressPair version is not supported.

CMRE_UNEXPECTED

An unexpected failure occurred.

Requirements

Header

cmnet.h

Library

cmnet.lib

See Also

Reference

Connection Manager Connectivity Functions
CM_ADDRESS_PAIR
CM_CONNECTION_HANDLE