#include <TransportConfig.h>
This class provides low-level access methods for the Transport mechanism. These values must not be changed once XPURL (or XPSession or ReplicaNet) start to send packets.
static bool GetEnablePacketSelect |
( |
void |
| ) |
|
|
static |
static std::string GetExternalIP |
( |
void |
| ) |
|
|
static |
static bool GetExtraPacketSecurity |
( |
void |
| ) |
|
|
static |
static std::string GetInfoString |
( |
void |
| ) |
|
|
static |
static bool GetPacketBufferEnable |
( |
void |
| ) |
|
|
static |
static float GetPacketBufferTime |
( |
void |
| ) |
|
|
static |
Allow the packet buffer time to be read.
- Returns
- The current packet buffer time.
static int GetPacketMTU |
( |
void |
| ) |
|
|
static |
static void GetResendTimes |
( |
int * |
numberOfTimes, |
|
|
float * |
retryTimes |
|
) |
| |
|
static |
Allows the resend time delays to be read.
- Parameters
-
numberOfTimes | A pointer to an int to contain the number of times a packet is resent. |
retryTimes | If not null an array of floats large enough to accept the resend times. |
static size_t GetTransparentPacketCompressionBytesSaved |
( |
const bool |
reset = false | ) |
|
|
static |
Returns the numbers of bytes saved.
- Parameters
-
reset | If true then the counter is reset |
static void PacketBufferBeginCaptureWindow |
( |
void |
| ) |
|
|
static |
This allows the packet buffer time window to be fine tuned by allowing the application to start buffering all sent packets, regardless of the time specified by SetPacketBufferTime(). Packets will only be sent when the buffers become full. A matching call to PacketBufferEndCapture() must be made to signify when normal packet buffering configured by SetPacketBufferTime() is resumed.
static void PacketBufferEndCaptureWindow |
( |
const bool |
kickBuffer = true | ) |
|
|
static |
This is the matching call to PacketBufferBeginCapture() and signifies the end of the packet buffer window.
- Parameters
-
kickBuffer | If true the currently buffered packets will be sent by this function call. If false the currently buffered packets will wait until the time configured by SetPacketBufferTime() |
static void SetEnablePacketSelect |
( |
const bool |
enable = false | ) |
|
|
static |
Allows the packet select code to be configured. If enabled with true then the packet update loop will be optimised to use packet selects, which will wait for packet data to arrive. Only enable this if the XPURL::Poll() method is set to automatuic poll and is never called from outside the XPURL update thread.
- Parameters
-
enable | The default is false which will disable the packet select code. |
static void SetExternalIP |
( |
const std::string |
address = "" | ) |
|
|
static |
Sets the external IP address of this machine for machines that have a LAN IP and also external IP so that the UDP Transport will report the external IP instead of the internal IP.
- Parameters
-
address | The text IP address to set, for example "1.2.3.4". The default is "" meaning that the machine's real IP address will be reported. |
static void SetExtraPacketSecurity |
( |
const bool |
enable = true | ) |
|
|
static |
Allows the packet security to be enabled or disabled. Versions of RNXPURL prior to 6000 (ReplicaNet 6200, RNLobby 0700) do not use this extra security. To allow later versions to connect to earlier versions use SetExtraPacketSecurity(false). All old clients will still be able to connect to new servers. Security will be disabled for those connections.
- Parameters
-
enable | The default is true which will enable the extra packet security. |
static void SetInfoString |
( |
const std::string |
info = "" | ) |
|
|
static |
If the info string is set any UDP or NATUDP listen connection will respond with a server info packet if a "0xff0xff0xff0xffgetinfo" packet is received. The info string is limited to 512 characters.
- Parameters
-
info | The default is "" which will disable the server response. |
static void SetIPv4Detected |
( |
const bool |
enable = true | ) |
|
|
static |
Sets if IPv4 capability over the internet has been detected.
static void SetIPv4Detection |
( |
const bool |
enable = true | ) |
|
|
static |
Enables or disables detection of IPv4 capability over the internet. By default IPv4 detection is enabled.
static void SetIPv6Detected |
( |
const bool |
enable = false | ) |
|
|
static |
Sets if IPv6 capability over the internet has been detected.
static void SetIPv6Detection |
( |
const bool |
enable = false | ) |
|
|
static |
Enables or disables detection of IPv6 capability over the internet. By default IPv6 detection is enabled.
static void SetPacketBufferEnable |
( |
const bool |
enable = true | ) |
|
|
static |
This can override all other packet buffering settings. If all packet buffering is disabled then this will save memory allocated for potential packet buffers in the future. This is because the PacketBufferBeginCaptureWindow() could be used at any point in the application and to allow this mechanism to work the transport needs to be warned about there being possible buffered packets. This function must not be used when the network has been started. The default is to enable packet buffering and allocate memory for potential packet buffers. SetPacketBufferEnable(true) should be used if any packet buffers are configured for potential use. This configuration option remains in force for the lifetime of the application until a new function call is made.
- Parameters
-
disable | If true the memory for packet buffers is allocated. If false memory for packet buffering is not allocated. |
static void SetPacketBufferTime |
( |
const float |
maxTime = 0.01f | ) |
|
|
static |
This allow the packet buffer time to be configured for each Transport. The larger the buffer time the more individual packets can be merged into one larger packet before sending. The default value is 0.01f which means this feature is enabled. This configuration option remains in force for the lifetime of the application until a new function call is made.
For example:
RNReplicaNet::TransportConfig::SetPacketBufferTime(1.0f / 100.0f);
RNReplicaNet::TransportConfig::SetPacketBufferEnable(true);
- Parameters
-
maxTime | The time for the packet buffer. The default value is 0.01f which is 1.0f / 100.0f. |
static void SetPacketMTU |
( |
const int |
bytes = 1306 | ) |
|
|
static |
Allows the MTU of packets to be set when using packet buffering. ReplicaNet V5.4 and earlier used an MTU of 554 bytes (512 bytes plus kUDPIPHeaderBytes). To improve performance in the majority of cases the MTU has been increased to 1306, which results in a payload of 1264 bytes plus kUDPIPHeaderBytes. This reduces the number of separate packets being sent over the wire. The value of 1264 has been derived as the lowest common denominator used by various games consoles and operating systems.
- Parameters
-
bytes | The number of bytes on the wire to use as an MTU. The minimum value is 554 (TransportMinimumPacketSize plus kUDPIPHeaderBytes). In most cases the maximum value should not be greater than 1500 minus kUDPIPHeaderBytes. |
static void SetResendTimes |
( |
const int |
numberOfTimes, |
|
|
const float * |
retryTimes |
|
) |
| |
|
static |
This allows the delay between reliable packets being resent due to failed ACKs to be altered. These options are provided for advanced users to tweak. Changing these settings can make your XPURL derived network connection unstable, care must be taken. This configuration option remains in force for the lifetime of the application until a new function call is made.
- Parameters
-
numberOfTimes | The number of times a packet is resent before finally being given up as lost. The maximum number of times that can be configured is 60. |
retryTimes | The interval in seconds between each resend of a packet. |