IRTCClient::get_NetworkAddresses

The get_NetworkAddresses property retrieves the local machine IP addresses and ports the Client is listening on. They can be local machine addresses or addresses of the external edges of the Network Address Translator (NAT) boxes the Client is behind.

This method can be used by Clients that have out-of-band channels for communicating the local IP addresses and ports to remote callers.

HRESULT get_NetworkAddresses(VARIANT_BOOLfTCP,
VARIANT_BOOLfExternal,
VARIANT*pvAddresses);

Parameters

  • fTCP
    [in] If VARIANT_TRUE, the method returns the IP port addresses used by TCP. If VARIANT_FALSE, it returns the UDP addresses.
  • fExternal
    [in] If VARIANT_TRUE, the method returns the addresses of the external edges of the NAT boxes. If VARIANT_FALSE, the local addresses are returned.
  • pvAddresses
    [out] Pointer to a variant containing the address of a safearray of BSTRs. Each BSTR is in the format xxx.xxx.xxx.xxx:nnnnn. The caller is responsible for freeing the variant.

Return Values

RTC methods may return an RTC_E_ constant.

Value Meaning
RTC_E_CLIENT_NOT_INITIALIZED The client has not been initialized.

Remarks

In general, the following algorithm should be used when calling get_NetworkAddresses:

  1. Call get_NetworkAddresses with fExternal set to TRUE. If this returns an address, communicate this address and port out of band to the called party. If more than one address is returned, the user is responsible for choosing the right address based on the destination.
  2. If step 1 did not return any addresses, call get_NetworkAddresses with fExternal set to FALSE and do the same.

For more information, see the Firewalls and NATs section.

Requirements

Client: Requires Windows XP.
Server: Requires Windows Server 2003.
Redistributable: Requires Rtcdll.dll on Windows 2000, and Windows Me/98.
Header: Declared in Rtccore.h.
Library: Included as a resource in Rtcdll.dll.
GUID: IID_IRTCClient is defined as 07829e45-9a34-408e-a011-bddf13487cd1.

See Also

IRTCClient