RakNet::UDPForwarder Class Reference
[NatPunchthrough]
Forwards UDP datagrams. Independent of RakNet's protocol.
More...
#include <UDPForwarder.h>
List of all members.
Detailed Description
Forwards UDP datagrams. Independent of RakNet's protocol.
Member Function Documentation
int UDPForwarder::GetMaxForwardEntries |
( |
void |
|
) |
const |
int UDPForwarder::GetUsedForwardEntries |
( |
void |
|
) |
const |
- Note:
- Each call to StartForwarding uses up two forwarding entries, since communications are bidirectional
- Returns:
- How many entries have been used
void 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. A single connection requires 2 entries, as connections are bi-directional.
- Parameters:
-
[in] | maxEntries | The maximum number of simultaneous forwarding entries. Defaults to 64 (32 connections) |
bool UDPForwarder::StartForwarding |
( |
SystemAddress |
source, |
|
|
SystemAddress |
destination, |
|
|
RakNetTimeMS |
timeoutOnNoDataMS, |
|
|
unsigned short * |
srcToDestPort, |
|
|
unsigned short * |
destToSourcePort | |
|
) |
| | |
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 5 seconds, so if routing RakNet messages, it is a reasonable value for timeoutOnNoDataMS, plus an extra few seconds for latency
- Parameters:
-
[in] | source | The source IP and port |
[in] | destination | Where to forward to (and vice-versa) |
[in] | timeoutOnNoDataMS | If no messages are forwarded for this many MS, then automatically remove this entry. Currently hardcoded to UDP_FORWARDER_MAXIMUM_TIMEOUT (else the call fails) |
[out] | srcToDestPort | Port to go from source to destination |
[out] | destToSourcePort | Port to go from destination to source |
- Returns:
- false on failure (can't bind the sockets). True otherwise, with srcToDestPortOut and destToSourcePortOut written
void UDPForwarder::Startup |
( |
void |
|
) |
|
Starts the system. Required to call before StartForwarding
No longer forward datagrams from source to destination
- Parameters:
-
[in] | source | The source IP and port |
[in] | destination | Where to forward to |
The documentation for this class was generated from the following files: