NSpMessage_Get
You can use theNSpMessage_Get
function to receive messages that have been delivered to your game. You can use this function to retrieve and process messages whether you are a player in the game or you are hosting a game.
NSpMessageHeader *NSpMessage_Get ( NSpGameReference inGame);
inGame
- An opaque reference to your game object.
- function result
- A pointer to your incoming message data structure.
DESCRIPTION
Once game play has begun, you will probably want to call this function each time you pass through your game loop to process all network messages as quickly and efficiently as possible.
NSpMessage_Get
returnsNULL
if there are no messages pending. If a message has been received, NetSprocket will return a pointer to a message structure.
NSpMessage_Get
returns a pointer to anNSpMessageHeader
-based structure that is allocated by NetSprocket. You should callNSpMessage_Release
to release the memory back to NetSprocket when you're done with the message. Failure to release memory in a timely fashion will limit NetSprocket's ability to handle more incoming messages.NSpMessage_Get
andNSpMessage_Release
are a more efficient method of message processing than the time-consuming process of copying incoming messages from NetSprocket into your application's message buffer.Error messages such as
kNSpError
may also be returned by NetSprocket.You should call
NSpMessage_Get
as frequently as you can to get messages that have been sent to your player.