test
This commit is contained in:
@@ -37,7 +37,7 @@ void ClientModule::startClient(SteamNetworkingIPAddr& serverAddr) {
|
||||
// Start connecting
|
||||
char szAddr[ SteamNetworkingIPAddr::k_cchMaxString ];
|
||||
serverAddr.ToString( szAddr, sizeof(szAddr), true );
|
||||
//Printf( "Connecting to chat server at %s", szAddr );
|
||||
std::cerr << "Connecting to chat server at " << szAddr << std::endl;
|
||||
SteamNetworkingConfigValue_t opt;
|
||||
opt.SetPtr( k_ESteamNetworkingConfig_Callback_ConnectionStatusChanged, (void*)SteamNetConnectionStatusChangedCallback );
|
||||
connection = interface->ConnectByIPAddress( serverAddr, 1, &opt );
|
||||
@@ -125,17 +125,19 @@ bool ClientModule::onEvent(const Archimedes::Event& event) {
|
||||
|
||||
void ClientModule::pollIncomingData() {
|
||||
|
||||
while ( running )
|
||||
{
|
||||
int numMsgs;
|
||||
do {
|
||||
ISteamNetworkingMessage *pIncomingMsg = nullptr;
|
||||
int numMsgs = interface->ReceiveMessagesOnConnection( connection, &pIncomingMsg, 1 );
|
||||
numMsgs = interface->ReceiveMessagesOnConnection( connection, &pIncomingMsg, 1 );
|
||||
if ( numMsgs == 0 )
|
||||
break;
|
||||
return;
|
||||
if ( numMsgs < 0 )
|
||||
std::cerr << "Error checking for messages" << std::endl;
|
||||
assert( numMsgs == 1 && pIncomingMsg );
|
||||
assert( pIncomingMsg->m_conn == connection );
|
||||
|
||||
app->emitEvent(new CMEvent::DataRecievedEvent(pIncomingMsg));
|
||||
}
|
||||
//numMsgs--;
|
||||
return;
|
||||
} while (numMsgs > 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user