NSpMessageHandlerProcPtr
You can define a function of this type for NetSprocket to call asynchronously when a message arrives.
typedef pascal Boolean (*NSpMessageHandlerProcPtr) ( NSpGameReference inGame, NSpMessageHeader *inMessage, void* inContext);
inGame
- An opaque reference to the game object that received the message.
inMessage
- A pointer to the message.
inContext
- The context pointer you passed in when you installed the handler.
DESCRIPTION
Your function must handle the message and return as quickly as possible. You should not free the message, as it will be automatically freed when your function returns. If you returntrue
, then NetSprocket will put the message back into the incoming message queue. When you call theNSpMessage_Get
function you will receive the message again. If you returnfalse
, the message will be deleted when your function returns. As an example, if you receive a message and you want to change part of the message or add to it, you can make a note in the message and then receive it again with the note added to the message. You can also use this as a mechanism for time stamping messages and only act on the latest messages.You do not need to define a function of this type if you use NetSprocket in the normal event-loop mode.
Your handler must obey all the rules of interrupt-safe functions.