CHttpServer::GetName Method  
 
INT GetName(
  UINT nClientId,  
  LPTSTR lpszHostName,  
  INT nMaxLength  
);
INT GetName(
  UINT nClientId,  
  CString& strHostName  
);

Return the host name assigned to the specified server.

Parameters

nClientId
An unsigned integer which uniquely identifies the client session. This value may be zero.
lpszHostName
A null-terminated string buffer that will contain the server host name, terminated with a null character. It is recommended that this buffer be at least 64 characters in length. This parameter cannot be NULL. An alternate version of this method accepts a CString object if it is available.
nMaxLength
An integer value that specifies the maximum number of characters can be copied into the string buffer, including the terminating null character. This value must be greater than zero. If the buffer size is too small, the method will fail.

Return Value

If the method succeeds, the return value is the number of characters copied into the string buffer, not including the terminating null character. 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 return the host name assigned to the specified server. If the nClientId parameter has a value of zero, the method will return the default host name that was specified as part of the server configuration. If no host name was explicitly assigned to the server, then it will return the local system name. If the nClientId parameter specifies a client session, then it this method will return the host name that the client used to establish the connection.

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

See Also

GetAddress