Archived

This topic is now archived and is closed to further replies.

RedGenie

Direct Play

Recommended Posts

I am wanting to send multiple messages to the same client from the server. They are NEW_PLAYER messages. The NEW_PLAYER message works fine and the new player is created on the client. The problem arises when I try to send more than one message to the client. Only the first message ever seems to arrive. The server code looks like this (simplified):
  
// Send NEW_PLAYER_MESSAGE to requesting client for each connected player

int players=0;
for(int playerCount=maxNumberOfPlayers;playerCount>=0;playerCount--) {
	if (playerList[playerCount].isConnected() && playerList[playerCount].GetDPNID()!=requestConnectedPlayersMessage->requestingPlayerID) {
	SendNewPlayerMessage(requestConnectedPlayersMessage->requestingPlayerID, playerList[playerCount].GetDPNID(), &playerList[playerCount]);
	}
}



void SendNewPlayerMessage(DPNID dpnidDestination, DPNID newPlayerDPNID, CCharacter* newPlayerData) {

	// Cast data into appropriate structure (NOT INCLUDED HERE)


	// Send message

	g_pDPServer->SendTo(dpnidDestination,&dpbd,1,0,NULL,&hAsync, DPNSEND_NOLOOPBACK | DPNSEND_COMPLETEONPROCESS | DPNSEND_GUARANTEED);
}
  
I have some logging inside the SendNewPlayerMessage() function and it does send the message the appropriate number of times. Here is the client code that should receive all the messages:
  
case MSG_NEW_PLAYER: {
	Debugger.appendLog("NEW_PLAYER MESSAGE");

	// Cast the message into the appropriate game message structure (not included)


	// Create the new player locally (not included)


}
  
I haven''t included some of the code for simplicities sake, I know it works because it works if only one message is sent. The first player is received correctly and the new player is created, any other NEW_PLAYER messages are not received (it doesn''t even write the ("NEW_PLAYER MESSAGE") entry into the logfile. Is this because the client was busy processing the previous NEW_PLAYER message and so it missed any subsequent ones (I would have thought it would buffer/queue incoming messages). Or am I totally wrong. Any help would be greatly appreciated.

Share this post


Link to post
Share on other sites