NSpInstallJoinRequestHandler
You can use theNSpInstallJoinRequestHandler
function to install a special function to process join requests for your game object. When your custom function is installed, NetSprocket will call this function when a join request comes in, rather than using theNSpGame_Join
function. You do not need to develop and install custom join request handlers if the NetSprocket functions meet your requirements.
OSStatus NSpInstallJoinRequestHandler ( NSpJoinRequestHandlerProcPtr inHandler, void *inContext);
inHandler
- A pointer to your join request function.
inContext
- A pointer that will be passed to your handler when it is called by NetSprocket.
- function result
- A result code of
noErr
, or a NetSprocket result code.DESCRIPTION
You can install a custom join request handler to override the standard authentication method of NetSprocket. By default, when a NetSprocket host receives a join request, it will first make sure that the maximum number of players has not been exceeded. Then, it will check the prospective player's password (if required) and admit the player if the password matches.When you override this behavior, your join request function is called and passed the
NSpJoinRequestMessage
. You must decide whether or not to allow the player to join, based on whatever criteria you desire. Your function must return a Boolean telling NetSprocket whether or not to allow the player to join the game.After your custom join request handler has been installed, any subsequent join requests will be passed to this function for processing.
NetSprocket returns an error if there was a problem installing the handler.
- Note
- Since the maximum round-trip time is specified when hosting a game, requests from prospective players who do not meet the maximum criterion will not be passed to your game.