SOCKET GetActiveClient(); |
Return the socket handle for the active client session.
Parameters
None.
Return Value
If the method succeeds, the return value is the socket handle for
the active client session. If the method fails, the return value is
INVALID_SOCKET. To get extended error information, call the
GetLastError method.
Remarks
The GetActiveClient method returns a handle to the client
socket for the active client session. The active session is determined
by the session thread that is currently executing, and therefore is
only meaningful within the context of a server event handler such as
OnConnect or OnRead. The value returned by the his
method is the same as the client socket handle that is passed to the
event handler.
This method will fail within an OnAccept event handler
because at that point the connection has not yet been accepted,
therefore there is no active client session. It will also fail if
called outside of an event handler. To obtain the socket handle
associated with a particular session thread, use the
GetThreadClient method.
Requirements
Minimum Desktop Platform: Windows 7 (Service Pack 1)
Minimum Server Platform: Windows Server 2008 R2 (Service Pack 1)
Header: Include cswsock10.h
Import Library: cswskv10.lib
See Also
GetClientHandle,
GetClientThreadId,
GetThreadClient
|