CDnsClient::RegisterServer Method  
 
INT RegisterServer(
  INT nServer,  
  LPCTSTR lpszHostAddress,  
  INT nPort  
);

The RegisterServer method registers a nameserver with the current client session. The nameserver is used to resolve queries issued by the client, such as returning the IP address for a given host name. At least one nameserver must be registered by the client before queries are issued.

Parameters

nServer
The index into the client nameserver table. This index, starting at 0, is used to specify which slot in the client's nameserver table will be used to store the nameserver information.
lpszHostAddress
A null-terminated string that specifies the IP address of the nameserver to be registered. Note that hostnames cannot be specified.
nPort
The port number that the specified nameserver is accepting queries on. This value may be set to zero, in which case it will use the default port value.

Return Value

If the method succeeds, the return value is zero. If the method fails, the return value is DNS_ERROR. To get extended error information, call GetLastError.

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: csdnsv11.lib
Unicode: Implemented as Unicode and ANSI versions

See Also

GetServerAddress, GetServerPort, UnregisterServer