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 pointer to 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

Client: Requires Windows 7, Windows Vista or Windows XP.
Server: Requires Windows Server 2008 or Windows Server 2003.
Header: Include cstools7.h.
Library: Use csdnsav7.lib.
Unicode: Implemented as Unicode and ANSI versions.

See Also

GetServerAddress, GetServerPort, UnregisterServer