RakNet  4.0
Public Member Functions | List of all members
RakNet::UDPForwarder Class Reference

Forwards UDP datagrams. Independent of RakNet's protocol. More...

#include <UDPForwarder.h>

Public Member Functions

void Startup (void)
 
void Shutdown (void)
 Stops the system, and frees all sockets.
 
void SetMaxForwardEntries (unsigned short maxEntries)
 
int GetMaxForwardEntries (void) const
 
int GetUsedForwardEntries (void) const
 
UDPForwarderResult StartForwarding (SystemAddress source, SystemAddress destination, RakNet::TimeMS timeoutOnNoDataMS, const char *forceHostAddress, unsigned short socketFamily, unsigned short *forwardingPort, __UDPSOCKET__ *forwardingSocket)
 
void StopForwarding (SystemAddress source, SystemAddress destination)
 

Detailed Description

Forwards UDP datagrams. Independent of RakNet's protocol.

Member Function Documentation

int RakNet::UDPForwarder::GetMaxForwardEntries ( void  ) const
Returns
The maxEntries parameter passed to SetMaxForwardEntries(), or the default if it was never called
int RakNet::UDPForwarder::GetUsedForwardEntries ( void  ) const
Returns
How many entries have been used
void RakNet::UDPForwarder::SetMaxForwardEntries ( unsigned short  maxEntries)

Sets the maximum number of forwarding entries allowed Set according to your available bandwidth and the estimated average bandwidth per forwarded address.

Parameters
[in]maxEntriesThe maximum number of simultaneous forwarding entries. Defaults to 64 (32 connections)
UDPForwarderResult RakNet::UDPForwarder::StartForwarding ( SystemAddress  source,
SystemAddress  destination,
RakNet::TimeMS  timeoutOnNoDataMS,
const char *  forceHostAddress,
unsigned short  socketFamily,
unsigned short *  forwardingPort,
__UDPSOCKET__ *  forwardingSocket 
)

Forwards datagrams from source to destination, and vice-versa Does nothing if this forward entry already exists via a previous call

Precondition
Call Startup()
Note
RakNet's protocol will ensure a message is sent at least every 15 seconds, so if routing RakNet messages, it is a reasonable value for timeoutOnNoDataMS, plus an some extra seconds for latency
Parameters
[in]sourceThe source IP and port
[in]destinationWhere to forward to (and vice-versa)
[in]timeoutOnNoDataMSIf no messages are forwarded for this many MS, then automatically remove this entry.
[in]forceHostAddressForce binding on a particular address. 0 to use any.
[in]socketFamilyIP version: For IPV4, use AF_INET (default). For IPV6, use AF_INET6. To autoselect, use AF_UNSPEC.
[out]forwardingPortNew opened port for forwarding
[out]forwardingSocketNew opened socket for forwarding
Returns
UDPForwarderResult
void RakNet::UDPForwarder::Startup ( void  )

Starts the system. Required to call before StartForwarding

void RakNet::UDPForwarder::StopForwarding ( SystemAddress  source,
SystemAddress  destination 
)

No longer forward datagrams from source to destination

Parameters
[in]sourceThe source IP and port
[in]destinationWhere to forward to

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