NSpMessage_Send
You can use theNSpMessage_Send
function to deliver a message to other players in the game.
OSStatus NSpMessage_Send ( NSpGameReference inGame, NSpMessageHeader *inMessage, NSpFlags inFlags);
inGame
- An opaque reference to your game object.
inMessage
- A pointer to the message you want to deliver. This structure can contain any data your game requires, provided that it begins with a
NSpMessageHeader
. The header must contain valid information about the intended recipient and the size of the message.- Note
- To impose a reasonable amount of type-safety, you must pass
&myStruct.header
to ensure the structure contains anNSpMessageHeader
as its first element.inFlags
- Flags that specify how the message should be sent, as specified in the message header structure.
- function result
- A result code of
noErr
, or a NetSprocket or Open Transport result code.DESCRIPTION
Although there is no restriction on the size of your message, extremely large messages (about 50 percent of the memory allocated to NetSprocket at initialization) may not be delivered if the receiver lacks the memory to process your message.NetSprocket will return an error if it was unable to deliver your message.
- Note
NSpMessage_Send
may returnNoErr
, even though the intended recipient did not receive the message. Depending on the options you have chosen and other network conditions beyond the knowledge or control of the application, the message may not have been received by its intended recipients.