Code/ServerApp/Source/ServerNetworking.cpp
//=================================================================================================
// Keep sending/receiving commands to Remote Client, until disconnection occurs
//=================================================================================================
Keep sending/receiving commands to Remote Client, until disconnection occurs
Keep sending / receiving commands to Remote Client until disconnection occurs
void Communications_ClientExchangeLoop(SOCKET Socket, ClientRemote* pClient)
{	
	bool bConnected(true);
	gActiveClientThreadCount++;
	ClientConfig::SetProperty_Connected(pClient->mClientConfigID, true);
	while (bConnected && pClient->mbIsConnected && !pClient->mbPendingDisconnect && !gbShutdown)
	{		
		bConnected =	Communications_Outgoing(Socket, pClient) && 
						Communications_Incoming(Socket, pClient);
		std::this_thread::sleep_for(std::chrono::milliseconds(8));
	}
	ClientConfig::SetProperty_Connected(pClient->mClientConfigID, false);
	closesocket(Socket);
	pClient->mInfoName[0]				= 0;
	pClient->mInfoImguiVerName[0]		= 0;
	pClient->mInfoNetImguiVerName[0]	= 0;
	pClient->mInfoImguiVerID			= 0;
	pClient->mInfoNetImguiVerID			= 0;
	pClient->mbPendingDisconnect		= false;
	pClient->mbIsConnected				= false;
	pClient->mbIsFree					= true;
	gActiveClientThreadCount--;
}
void Communications_ClientExchangeLoop ( SOCKET Socket , ClientRemote * pClient ) { bool bConnected ( true ) ; gActiveClientThreadCount ++ ; ClientConfig :: SetProperty_Connected ( pClient -> mClientConfigID , true ) ; while ( bConnected && pClient -> mbIsConnected && ! pClient -> mbPendingDisconnect && ! gbShutdown ) { bConnected = Communications_Outgoing ( Socket , pClient ) && Communications_Incoming ( Socket , pClient ) ; std :: this_thread :: sleep_for ( std :: chrono :: milliseconds ( 8 ) ) ; } ClientConfig :: SetProperty_Connected ( pClient -> mClientConfigID , false ) ; closesocket ( Socket ) ; pClient -> mInfoName [ 0 ] = 0 ; pClient -> mInfoImguiVerName [ 0 ] = 0 ; pClient -> mInfoNetImguiVerName [ 0 ] = 0 ; pClient -> mInfoImguiVerID = 0 ; pClient -> mInfoNetImguiVerID = 0 ; pClient -> mbPendingDisconnect = false ; pClient -> mbIsConnected = false ; pClient -> mbIsFree = true ; gActiveClientThreadCount -- ; }
Keep sending/receiving commands to Remote Client, until disconnection occurs
Keep sending / receiving commands to Remote Client until disconnection occurs