NegotiateCompletedFunc

GameSpy SDK

NegotiateCompletedFunc

The callback that gets executed from NNBeginNegotiation when negotiation is complete.

typedef void (*NegotiateCompletedFunc)(
NegotiateResult result,
SOCKET gamesocket,
struct sockaddr_in * remoteaddr,
void * userdata );
RoutineRequired HeaderDistribution
NegotiateCompletedFunc<natneg.h>SDKZIP

Parameters

result
[in] Indicates the result of the negotiation attempt.
gamesocket
[in] The socket you should use to continue communications with the client.
remoteaddr
[in] The remote address and port you should use to communicate with the new client.
userdata
[in] Data for your own use.

Remarks

Once your completed function is called, you can begin sending data to the other client immediately using the socket and address provided.

Possible values for the value of the result parameter are:
nr_success
Successful negotiation, an open channel has now been established.
nr_deadbeatpartner
Partner did not register with the NAT Negotiation Server.
nr_inittimeout
Unable to communicate with NAT Negotiation Server
nr_pingtimeout
Unable to communicate directly with partner
nr_unknownerror
NAT Negotiation server indicated an unknown error condition

If you used NNBeginNegotiationWithSocket then the socket parameter will be the socket you passed in originally. Otherwise it will be a new socket allocated by the NAT Negotiation SDK.

Make sure you copy the remoteaddr structure before the callback returns.

Section Reference: Gamespy NAT Negotiation SDK

See Also: NNBeginNegotiation