InetGetClientId Function  
 
UINT WINAPI InetGetClientId(
  SOCKET hClient  
);

The InetGetClientId function returns the unique ID number assigned to the specified client session.

Parameters

hClient
Handle to the client socket.

Return Value

If the function succeeds, the return value is an unsigned integer value which uniquely identifies the client session. If the function fails, the return value is zero. To get extended error information, call InetGetLastError.

Remarks

Each client connection that is accepted by the server is assigned a unique numeric value. This value can be obtained by calling the InetGetClientId function and used by the application to identify that client session. The InetGetClientHandle function 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.

The socket handle for the client must be one that was created as part of the SocketWrench server interface, and cannot be a socket that was created using the InetConnect or InetAccept functions.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cswsock11.h
Import Library: cswskv11.lib

See Also

InetGetClientHandle, InetGetClientMoniker, InetSetClientMoniker, InetGetServerClient