RakNet
4.0
|
Communicates with UDPProxyCoordinator, in order to find a UDPProxyServer to forward our datagrams. More...
#include <UDPProxyClient.h>
Public Member Functions | |
void | SetResultHandler (UDPProxyClientResultHandler *rh) |
bool | RequestForwarding (SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddressAsSeenFromCoordinator, RakNet::TimeMS timeoutOnNoDataMS, RakNet::BitStream *serverSelectionBitstream=0) |
bool | RequestForwarding (SystemAddress proxyCoordinator, SystemAddress sourceAddress, RakNetGUID targetGuid, RakNet::TimeMS timeoutOnNoDataMS, RakNet::BitStream *serverSelectionBitstream=0) |
virtual void | Update (void) |
Update is called every time a packet is checked for . | |
virtual PluginReceiveResult | OnReceive (Packet *packet) |
virtual void | OnRakPeerShutdown (void) |
Called when RakPeer is shutdown. | |
![]() | |
virtual void | OnAttach (void) |
Called when the interface is attached. | |
virtual void | OnDetach (void) |
Called when the interface is detached. | |
virtual void | OnRakPeerStartup (void) |
Called when RakPeer is initialized. | |
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason) |
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming) |
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason) |
virtual bool | UsesReliabilityLayer (void) const |
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress) |
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress) |
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError) |
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, RakNet::TimeMS time, int isSend) |
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, RakNet::TimeMS time) |
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress) |
Communicates with UDPProxyCoordinator, in order to find a UDPProxyServer to forward our datagrams.
When NAT Punchthrough fails, it is possible to use a non-NAT system to forward messages from us to the recipient, and vice-versa.
The class to forward messages is UDPForwarder, and it is triggered over the network via the UDPProxyServer plugin.
The UDPProxyClient connects to UDPProxyCoordinator to get a list of servers running UDPProxyServer, and the coordinator will relay our forwarding request
|
virtual |
OnReceive is called for every packet.
[in] | packet | the packet that is being returned to the user |
Reimplemented from RakNet::PluginInterface2.
bool RakNet::UDPProxyClient::RequestForwarding | ( | SystemAddress | proxyCoordinator, |
SystemAddress | sourceAddress, | ||
SystemAddress | targetAddressAsSeenFromCoordinator, | ||
RakNet::TimeMS | timeoutOnNoDataMS, | ||
RakNet::BitStream * | serverSelectionBitstream = 0 |
||
) |
Sends a request to proxyCoordinator to find a server and have that server setup UDPForwarder::StartForwarding() on our address to targetAddressAsSeenFromCoordinator The forwarded datagrams can be from any UDP source, not just RakNet
[in] | proxyCoordinator | System we are connected to that is running the UDPProxyCoordinator plugin |
[in] | sourceAddress | External IP address of the system we want to forward messages from. This does not have to be our own system. To specify our own system, you can pass UNASSIGNED_SYSTEM_ADDRESS which the coordinator will treat as our external IP address. |
[in] | targetAddressAsSeenFromCoordinator | External IP address of the system we want to forward messages to. If this system is connected to UDPProxyCoordinator at this address using RakNet, that system will ping the server and thus open the router for incoming communication. In any other case, you are responsible for doing your own network communication to have that system ping the server. See also targetGuid in the other version of RequestForwarding(), to avoid the need to know the IP address to the coordinator of the destination. |
[in] | timeoutOnNoData | If no data is sent by the forwarded systems, how long before removing the forward entry from UDPForwarder? UDP_FORWARDER_MAXIMUM_TIMEOUT is the maximum value. Recommended 10 seconds. |
[in] | serverSelectionBitstream | If you want to send data to UDPProxyCoordinator::GetBestServer(), write it here |
bool RakNet::UDPProxyClient::RequestForwarding | ( | SystemAddress | proxyCoordinator, |
SystemAddress | sourceAddress, | ||
RakNetGUID | targetGuid, | ||
RakNet::TimeMS | timeoutOnNoDataMS, | ||
RakNet::BitStream * | serverSelectionBitstream = 0 |
||
) |
Same as above, but specify the target with a GUID, in case you don't know what its address is to the coordinator If requesting forwarding to a RakNet enabled system, then it is easier to use targetGuid instead of targetAddressAsSeenFromCoordinator
void RakNet::UDPProxyClient::SetResultHandler | ( | UDPProxyClientResultHandler * | rh | ) |
Receives the results of calling RequestForwarding() Set before calling RequestForwarding or you won't know what happened
[in] | resultHandler |