peerConnect
Connect to the chat server.
- void peerConnect(
- PEER peer,
- const gsi_char * nick,
- int profileID,
- peerNickErrorCallback nickErrorCallback,
- peerConnectCallback connectCallback,
- void * param,
- PEERBool blocking );
Routine | Required Header | Distribution |
---|---|---|
peerConnect | <peer.h> | SDKZIP |
Parameters
- peer
- [in] Initialized peer object.
- nick
- [in] Chat nickname.
- profileID
- [in] Profile ID of the local client, or 0.
- nickErrorCallback
- [in] Callback function is called if the nickname is invalid or is already being used.
- connectCallback
- [in] Callback function is called when the connect operation is completed.
- param
- [in] Pointer to user data. This is optional and will be passed unmodified to the callback function.
- blocking
- [in] When set to PEERTrue this function will not return until the operation has completed.
Remarks
The peerConnect function opens a connection to the chat server. The connection can be ended at any time by called peerDisconnect() (peerShutdown() will also close the connection). If the connection gets disconnected for any other reason (such as an intermediate router going down), the peerDisconnectedCallback() callback will be called. This function will fail if the Peer object is already connected.
Once connected to the backend chat server, Peer is fully enabled, and the user can join rooms, create rooms, list games, message other players, etc. Typically at this point the user would be joined up to the game’s title room with peerJoinTitleRoom().
Unicode Mappings
Routine | GSI_UNICODE Not Defined | GSI_UNICODE Defined |
---|---|---|
peerConnect | peerConnectA | peerConnectW |
peerConnectW and peerConnectA are UNICODE and ANSI mapped versions of peerConnect. The arguments of peerConnectA are ANSI strings; those of peerConnectW are wide-character strings.
Section Reference: Gamespy Peer SDK