CHttpServer::GetClientThreadId Method  
 
DWORD GetClientThreadId(
  UINT nClientId  
);

Returns the thread ID associated with the specified client session.

Parameters

nClientId
An unsigned integer which uniquely identifies the client session.

Return Value

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

Remarks

The GetClientThreadId method returns a thread ID that can be used to identify the thread that is managing the client session. The thread ID can be used with other Windows API functions such as OpenThread. Exercise caution when using thread-related functions, interfering with the normal operation of the thread can have unexpected results. You should never use this method to obtain a thread handle and then call the TerminateThread function to terminate a client session. This will prevent the thread from releasing the resources that were allocated for the session and can leave the server in an unstable state. To terminate a client session, use the DisconnectClient method.

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

See Also