ReplicaNet and RNLobby
1
|
#include <NATDetectServer.h>
Public Types | |
enum | Reply { kReply_Pending = 0, kReply_Success, kReply_Timeout } |
enum | { kDefaultPort = 4004, kDefaultPortOther = 4005 } |
Public Types inherited from MutexClass | |
enum | { kNoOwnerThread = -1 } |
Public Member Functions | |
bool | Start (const XPAddress &address=XPAddress(kDefaultPort), const XPAddress &addressOther=XPAddress(kDefaultPortOther)) |
virtual void | CallbackGotNATDetectProbe (const XPAddress &address) const |
Public Member Functions inherited from BaseServer | |
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 bool | CallbackPoll (void) |
Public Member Functions inherited from ThreadClass | |
ThreadClass () | |
virtual | ~ThreadClass () |
void | Sleep (int milliseconds) |
Public Member Functions inherited from MutexClass | |
MutexClass () | |
virtual | ~MutexClass () |
void | Lock (void) |
void | UnLock (void) |
Public Member Functions inherited from Thread | |
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 Public Member Functions inherited from BaseServer | |
static SysTimeType | FloatTime (void) |
Static Public Member Functions inherited from Thread | |
static int | CallThreadEntry (ThreadClass *thread_class) |
static int | GetCurrentProcessorNumber (void) |
static size_t | GetNumAllocated (void) |
static size_t | GetNumActive (void) |
Protected Member Functions inherited from BaseServer | |
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) |
Protected Member Functions inherited from ThreadClass | |
void | DoQuitNow (const int returnCode) |
void | CheckQuit (void) |
Static Protected Member Functions inherited from ThreadClass | |
static size_t | GetNumAllocated (void) |
Protected Attributes inherited from BaseServer | |
t_XPSocket * | mSocket |
bool | mAllowDelete |
int | mNOnce |
A stateless server that responds to query packets with the encoded public IP address of the source. Two instances of this server should be run each on their own separate IP address (in total four IP address:port pairs are used) to allow the NATDetectClient to deduce the NAT type. Assuming a setup with two IP addresses 88.208.234.187 and 88.208.234.188:
A multihomed machine with two or more public IP addresses could use: RLSrvNATDetect.exe /i /s -addr 88.208.234.187:3003 -addr2 88.208.234.187:3004 -addr 88.208.234.188:3003 -addr2 88.208.234.188:3004
A setup with one public IP address for each machine would need to use two machines: RLSrvNATDetect.exe /i /s -addr 88.208.234.187:3003 -addr2 88.208.234.187:3004
RLSrvNATDetect.exe /i /s -addr 88.208.234.188:3003 -addr2 88.208.234.188:3004