DWORD GetClientThreadId( |
|
SOCKET hSocket |
|
); |
DWORD GetClientThreadId(); |
Returns the thread ID associated with the specified client.
Parameters
- hSocket
- An optional parameter that specifies the handle to the client socket.
If this parameter is omitted, the socket handle for the active
client session will be used. If this method is called outside of a
server event handler, the socket handle must be specified.
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
Disconnect method.
Requirements
Minimum Desktop Platform: Windows 7 (Service Pack 1)
Minimum Server Platform: Windows Server 2008 R2 (Service Pack 1)
Header File: cswsock10.h
Import Library: cswskv10.lib
See Also
EnumClients,
GetActiveClient
|