Code/ServerApp/Source/ServerNetworking.cpp
//=================================================================================================
// Send the updates to RemoteClient
// Ends with a Ping Command (signal a end of commands)
//=================================================================================================
Send the updates to RemoteClient
Ends with a Ping Command (signal a end of commands)
Send the updates to RemoteClient Ends with a Ping Command ( signal a end of commands )
bool Communications_Outgoing(SOCKET Socket, ClientRemote* pClient)
{
	bool bSuccess(true);
	NetImgui::Internal::CmdInput* pInputCmd = pClient->CreateInputCommand();
	if( pInputCmd )
	{
		int result	= send(Socket, reinterpret_cast<const char*>(pInputCmd), static_cast<int>(pInputCmd->mHeader.mSize), 0);
		bSuccess	= (result == static_cast<int>(pInputCmd->mHeader.mSize));
		NetImgui::Internal::netImguiDeleteSafe(pInputCmd);
	}
	if( pClient->mbPendingDisconnect )
	{
		NetImgui::Internal::CmdDisconnect cmdDisconnect;
		int result	= send(Socket, reinterpret_cast<const char*>(&cmdDisconnect), static_cast<int>(cmdDisconnect.mHeader.mSize), 0);
		bSuccess	&= (result == static_cast<int>(cmdDisconnect.mHeader.mSize));
	}
	{
		NetImgui::Internal::CmdPing cmdPing;
		int result	= send(Socket, reinterpret_cast<const char*>(&cmdPing), static_cast<int>(cmdPing.mHeader.mSize), 0);
		bSuccess	&= (result == static_cast<int>(cmdPing.mHeader.mSize));
	}
	return bSuccess;
}
bool Communications_Outgoing ( SOCKET Socket , ClientRemote * pClient ) { bool bSuccess ( true ) ; NetImgui :: Internal :: CmdInput * pInputCmd = pClient -> CreateInputCommand ( ) ; if ( pInputCmd ) { int result = send ( Socket , reinterpret_cast < const char * > ( pInputCmd ) , static_cast < int > ( pInputCmd -> mHeader . mSize ) , 0 ) ; bSuccess = ( result == static_cast < int > ( pInputCmd -> mHeader . mSize ) ) ; NetImgui :: Internal :: netImguiDeleteSafe ( pInputCmd ) ; } if ( pClient -> mbPendingDisconnect ) { NetImgui :: Internal :: CmdDisconnect cmdDisconnect ; int result = send ( Socket , reinterpret_cast < const char * > ( & cmdDisconnect ) , static_cast < int > ( cmdDisconnect . mHeader . mSize ) , 0 ) ; bSuccess &= ( result == static_cast < int > ( cmdDisconnect . mHeader . mSize ) ) ; } { NetImgui :: Internal :: CmdPing cmdPing ; int result = send ( Socket , reinterpret_cast < const char * > ( & cmdPing ) , static_cast < int > ( cmdPing . mHeader . mSize ) , 0 ) ; bSuccess &= ( result == static_cast < int > ( cmdPing . mHeader . mSize ) ) ; } return bSuccess ; }
Send the updates to RemoteClient
Ends with a Ping Command (signal a end of commands)
Send the updates to RemoteClient Ends with a Ping Command ( signal a end of commands )
// Always finish with a ping