ReplicaNet and RNLobby
1
|
#include <NATDetectClient.h>
Public Types | |
enum | NATType { kOpen = 0, kModerate, kStrict } |
![]() | |
enum | { kNoOwnerThread = -1 } |
Public Member Functions | |
bool | Start (const int channel=TransportAnyGameChannel) |
void | SetServers (const XPAddress &address1, const XPAddress &address2) |
Sets the address and port of the servers. The default for the instance of the class is localhost and port NATDetectServer::kDefaultPort and NATDetectServer::kDefaultPort+1 or the address resolved by a successful BackendClient::Start(). | |
bool | GetCompleted (void) |
NATDetectServer::Reply | GetReply (void) |
NATType | GetNATType (void) const |
If GetReply() == NATDetectServer::kReply_Success this returns the type of NAT calculated by this class. | |
XPAddress | GetPublicAddress (void) const |
Returns the public internet address of this computer as seen by the NATDetectServer. | |
virtual void | CallbackCompleted (void) |
A virtual callback that is triggered when the NATDetect calculation is complete. GetReply(), GetNATType() and GetPublicAddress() can be used during this callback or at any time after completion. | |
void | GetAddressReplies (XPAddress &addr1, XPAddress &addr2) |
Gets the two addresses as seen by the NATDetectServer. | |
![]() | |
virtual bool | StartWithSocket (t_XPSocket *socket, const bool allowDelete=true) |
virtual bool | Stop (void) |
void | SetEncryptionKey (const void *data, const int length) |
virtual void | CallbackDataReceived (DynamicMessageHelper &message, XPAddress &address) |
virtual void | CallbackDataSend (DynamicMessageHelper &message, XPAddress &address) |
virtual void | CallbackQueryReplyTime (const float seconds) |
virtual void | CallbackTidy (void) |
![]() | |
ThreadClass () | |
virtual | ~ThreadClass () |
void | Sleep (int milliseconds) |
![]() | |
MutexClass () | |
virtual | ~MutexClass () |
void | Lock (void) |
void | UnLock (void) |
![]() | |
Thread () | |
virtual | ~Thread () |
void | Begin (ThreadClass *threaded_class) |
void | Terminate (void) |
bool | GetTerminated (void) |
bool | GetEverTerminated (void) |
bool | GetIsRunning (void) const |
void | SetPreferredProcessor (int processor=kReplicaNetPreferredProcessorOSChoice) |
int | GetPreferredProcessor (void) |
Additional Inherited Members | |
![]() | |
static SysTimeType | FloatTime (void) |
![]() | |
static int | CallThreadEntry (ThreadClass *thread_class) |
static int | GetCurrentProcessorNumber (void) |
static size_t | GetNumAllocated (void) |
static size_t | GetNumActive (void) |
![]() | |
virtual bool | PackageAndSendData (t_XPSocket *socket, const DynamicMessageHelper &message, const XPAddress &address) |
virtual bool | CallbackParsePacketData (t_XPSocket *socket, const XPAddress &addr, void *data, size_t &length, DynamicMessageHelper &result) |
int | ThreadEntry (void) |
![]() | |
void | DoQuitNow (const int returnCode) |
void | CheckQuit (void) |
![]() | |
static size_t | GetNumAllocated (void) |
![]() | |
t_XPSocket * | mSocket |
bool | mAllowDelete |
int | mNOnce |
This class interrogates the network connection of a machine to determine the if there is any NAT implemented to known external machines.
bool GetCompleted | ( | void | ) |
Tests the completion state of the last query. When the query completes the result can be retrieved by using GetReply()
NATDetectServer::Reply GetReply | ( | void | ) |
Returns the last reply from a completed query.
bool Start | ( | const int | channel = TransportAnyGameChannel | ) |
If using a specific game channel for ReplicaNet/XPSession then remember to stop the NATDetectClient service before calling ReplicaNet::SessionCreate()/XPSession::Create() so the game channel is free for ReplicaNet/XPSession to use.