CHttpServer::SetName Method  
 
BOOL SetName(
  UINT nClientId,  
  LPCTSTR lpszHostName  
);

Change the host name assigned to the specified server or client session.

Parameters

nClientId
An unsigned integer which uniquely identifies the client session. This value may be zero.
lpszHostName
A null-terminated string that specifies the new host name assigned to the server or client session. If this value is NULL or points to an empty string, the current host name will be changed to use the default host name.

Return Value

If the method succeeds, the return value is non-zero. If the client ID is invalid, or the buffer is not large enough to store the complete hostname, the method will return a value of zero.

Remarks

This method will change the host name assigned to the specified client session. If the nClientId parameter has a value of zero, the method will change default host name that was assigned to the server as part of the server configuration. If the nClientId parameter specifies a valid client session and the lpszHostName parameter is NULL, the host name associated with the client session will be changed to the current host name assigned to the server.

When a client connects to the server, it can specify the host name that it used to establish the connection by sending the HOST command. This is typically used with virtual hosting, where one server may accept client connections for multiple domains. The GetName method will return the host name specified by the client, and SetName can be used by the application to either explicitly assign a different host name to the client session, or override the host name provided by the client.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools12.h
Import Library: cshtsv12.lib
Unicode: Implemented as Unicode and ANSI versions

See Also