RakNet::NatPunchthroughClient Class Reference
[NatPunchthrough]

Client code for NATPunchthrough. More...

#include <NatPunchthroughClient.h>

Inheritance diagram for RakNet::NatPunchthroughClient:

RakNet::PluginInterface2

List of all members.

Public Member Functions

bool OpenNAT (RakNetGUID destination, const SystemAddress &facilitator)
bool OpenNATGroup (DataStructures::List< RakNetGUID > destinationSystems, const SystemAddress &facilitator)
PunchthroughConfiguration * GetPunchthroughConfiguration (void)
void SetDebugInterface (NatPunchthroughDebugInterface *i)
void GetUPNPPortMappings (char *externalPort, char *internalPort, const SystemAddress &natPunchthroughServerAddress)
 Get the port mappings you should pass to UPNP (for miniupnpc-1.5, for the function UPNP_AddPortMapping).
virtual void Update (void)
 Update is called every time a packet is checked for .
virtual PluginReceiveResult OnReceive (Packet *packet)
virtual void OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual void OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void OnAttach (void)
 Called when the interface is attached.
virtual void OnDetach (void)
 Called when the interface is detached.
virtual void OnRakPeerShutdown (void)
 Called when RakPeer is shutdown.


Detailed Description

Client code for NATPunchthrough.

Maintain connection to NatPunchthroughServer to process incoming connection attempts through NatPunchthroughClient
Client will send datagrams to port to estimate next port
Will simultaneously connect with another client once ports are estimated.

See also:
NatTypeDetectionClient See also http://www.jenkinssoftware.com/raknet/manual/natpunchthrough.html

Member Function Documentation

PunchthroughConfiguration* RakNet::NatPunchthroughClient::GetPunchthroughConfiguration ( void   ) 

Modify the system configuration if desired Don't modify the variables in the structure while punchthrough is in progress

virtual void RakNet::NatPunchthroughClient::OnClosedConnection ( const SystemAddress systemAddress,
RakNetGUID  rakNetGUID,
PI2_LostConnectionReason  lostConnectionReason 
) [virtual]

Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system

Parameters:
[in] systemAddress The system whose connection was closed
[in] rakNetGuid The guid of the specified system
[in] lostConnectionReason How the connection was closed: manually, connection lost, or notification of disconnection

Reimplemented from RakNet::PluginInterface2.

virtual void RakNet::NatPunchthroughClient::OnNewConnection ( const SystemAddress systemAddress,
RakNetGUID  rakNetGUID,
bool  isIncoming 
) [virtual]

Called when we got a new connection

Parameters:
[in] systemAddress Address of the new connection
[in] rakNetGuid The guid of the specified system
[in] isIncoming If true, this is ID_NEW_INCOMING_CONNECTION, or the equivalent

Reimplemented from RakNet::PluginInterface2.

virtual PluginReceiveResult RakNet::NatPunchthroughClient::OnReceive ( Packet packet  )  [virtual]

OnReceive is called for every packet.

Parameters:
[in] packet the packet that is being returned to the user
Returns:
True to allow the game and other plugins to get this message, false to absorb it

Reimplemented from RakNet::PluginInterface2.

bool RakNet::NatPunchthroughClient::OpenNAT ( RakNetGUID  destination,
const SystemAddress facilitator 
)

Punchthrough a NAT. Doesn't connect, just tries to setup the routing table

Parameters:
[in] destination The system to punch. Must already be connected to facilitator
[in] facilitator A system we are already connected to running the NatPunchthroughServer plugin
See also:
OpenNATGroup() You will get ID_NAT_PUNCHTHROUGH_SUCCEEDED on success You will get ID_NAT_TARGET_NOT_CONNECTED, ID_NAT_TARGET_UNRESPONSIVE, ID_NAT_CONNECTION_TO_TARGET_LOST, ID_NAT_ALREADY_IN_PROGRESS, or ID_NAT_PUNCHTHROUGH_FAILED on failures of various types However, if you lose connection to the facilitator, you may not necessarily get above

bool RakNet::NatPunchthroughClient::OpenNATGroup ( DataStructures::List< RakNetGUID destinationSystems,
const SystemAddress facilitator 
)

Same as calling OpenNAT for a list of systems, but reply is delayed until all systems pass. This is useful for peer to peer games where you want to connect to every system in the remote session, not just one particular system

Note:
For cloud computing, all systems in the group must be connected to the same facilitator since we're only specifying one You will get ID_NAT_GROUP_PUNCH_SUCCEEDED on success You will get ID_NAT_TARGET_NOT_CONNECTED, ID_NAT_ALREADY_IN_PROGRESS, or ID_NAT_GROUP_PUNCH_FAILED on failures of various types However, if you lose connection to the facilitator, you may not necessarily get above

void RakNet::NatPunchthroughClient::SetDebugInterface ( NatPunchthroughDebugInterface *  i  ) 

Sets a callback to be called with debug messages

Parameters:
[in] i Pointer to an interface. The pointer is stored, so don't delete it while in progress. Pass 0 to clear.


The documentation for this class was generated from the following file:

Generated on Wed Feb 1 13:33:47 2012 for RakNet by  doxygen 1.5.7.1