UINT GetClientId( |
|
SOCKET hSocket |
|
); |
Returns the unique ID number assigned to the specified client
session.
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 an unsigned integer
value which uniquely identifies the client session. If the method
fails, the return value is zero. To get extended error information,
call GetLastError.
Remarks
Each client connection that is accepted by the server is assigned
a unique numeric value. This value can be obtained by calling the
GetClientId method and used by the application to
identify that client session. The GetClientHandle method
can then be used to used to obtain the client socket handle for the
session, based on that client ID. It is important to note that the
actual value of the client ID should be considered opaque. It is only
guaranteed that the value will be greater than zero, and that it will
be unique to the client session.
While it is possible for a client socket handle to be reused by
the operating system, client IDs are unique throughout the life of
the server session and are never duplicated.
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,
GetClientMoniker,
SetClientMoniker
|