BWYServerGetClient Function

Overview

Retrieve the client handle based on its index.

Declaration

HANDLE WINAPI BWYServerGetClient(HANDLE hServer, UINT nIndex);

Parameters

  • hServer
    The server handle of the I/O completion ports TCP/IP server.
  • nIndex
    The index of the client handle to be returned. This zero based unsigned index can be a value from zero to BWYServerGetClientCount.

Return Value

If the index is a valid number less than the entire count of clients then this function will succeed by returning a valid client handle. If the function fails it returns NULL.

Remarks

This function would generally be used for looping through all of the client handles.

Be aware that this function is not thread safe and should always be wrapped inside BWYServerLockClients and BWYServerUnlockClients.

Example

The following example will authenticate all clients.
BWYServerLockClients(hServer);
UINT nClients = BWYServerGetClientCount(hServer);
for(UINT i = 0; i < nClients; i++)
{
	HANDLE hClient = BWYServerGetClient(hServer, i);
	if(hClient == NULL)
		continue;
	BWYServerAuthenticate(hClient);
}
BWYServerUnlockClients(hServer);

Windows Requirements

HeaderBWYSystemsServer.h
LibraryBWYSystemsServer.lib
DLLBWYSystemsServer.dll

Linux Requirements

HeaderBWYSystemsServer.h
Shared LibrarylibBWYSystemsServer.so