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 RakNet::UDPForwarder::GetMaxForwardEntries |
( |
void |
|
) |
const |
int RakNet::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 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. 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) |
UDPForwarderResult RakNet::UDPForwarder::StartForwarding |
( |
SystemAddress |
source, |
|
|
SystemAddress |
destination, |
|
|
RakNetTimeMS |
timeoutOnNoDataMS, |
|
|
const char * |
forceHostAddress, |
|
|
unsigned short * |
forwardingPort, |
|
|
SOCKET * |
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] | 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) |
[in] | forceHostAddress | Force binding on a particular address. 0 to use any. |
[out] | forwardingPort | New opened port for forwarding |
[out] | forwardingSocket | New opened socket for forwarding |
- Returns:
- UDPForwarderResult
void RakNet::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 |
void RakNet::UDPForwarder::Update |
( |
void |
|
) |
|
Call on a regular basis, unless using UDP_FORWARDER_EXECUTE_THREADED. Will call select() on all sockets and forward messages.
The documentation for this class was generated from the following file: