#include <RakPeerInterface.h>
Public Member Functions | |
virtual | ~RakPeerInterface () |
Destructor. | |
virtual bool | Startup (unsigned short maxConnections, int _threadSleepTimer, SocketDescriptor *socketDescriptors, unsigned socketDescriptorCount)=0 |
Starts the network threads, opens the listen port. You must call this before calling Connect(). Multiple calls while already active are ignored. To call this function again with different settings, you must first call Shutdown(). | |
virtual void | InitializeSecurity (const char *pubKeyE, const char *pubKeyN, const char *privKeyP, const char *privKeyQ)=0 |
virtual void | DisableSecurity (void)=0 |
virtual void | SetMaximumIncomingConnections (unsigned short numberAllowed)=0 |
virtual unsigned short | GetMaximumIncomingConnections (void) const =0 |
virtual unsigned short | NumberOfConnections (void) const =0 |
virtual void | SetIncomingPassword (const char *passwordData, int passwordDataLength)=0 |
virtual void | GetIncomingPassword (char *passwordData, int *passwordDataLength)=0 |
virtual bool | Connect (const char *host, unsigned short remotePort, const char *passwordData, int passwordDataLength, unsigned connectionSocketIndex=0)=0 |
Connect to the specified host (ip or domain name) and server port. Calling Connect and not calling SetMaximumIncomingConnections acts as a dedicated client. Calling both acts as a true peer. This is a non-blocking connection. You know the connection is successful when IsConnected() returns true or Receive() gets a message with the type identifier ID_CONNECTION_ACCEPTED. If the connection is not successful, such as a rejected connection or no response then neither of these things will happen. | |
virtual void | Shutdown (unsigned int blockDuration, unsigned char orderingChannel=0)=0 |
Connect to the specified network ID (Platform specific console function) Does built-in NAt traversal. | |
virtual bool | IsActive (void) const =0 |
virtual bool | GetConnectionList (SystemAddress *remoteSystems, unsigned short *numberOfSystems) const =0 |
virtual bool | Send (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, SystemAddress systemAddress, bool broadcast)=0 |
virtual bool | Send (const RakNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, SystemAddress systemAddress, bool broadcast)=0 |
virtual Packet * | Receive (void)=0 |
virtual void | DeallocatePacket (Packet *packet)=0 |
virtual unsigned short | GetMaximumNumberOfPeers (void) const =0 |
Return the total number of connections we are allowed. | |
virtual void | RegisterAsRemoteProcedureCall (const char *uniqueID, void(*functionPointer)(RPCParameters *rpcParms))=0 |
virtual void | RegisterClassMemberRPC (const char *uniqueID, void *functionPointer)=0 |
virtual void | UnregisterAsRemoteProcedureCall (const char *uniqueID)=0 |
virtual void | SetNetworkIDManager (NetworkIDManager *manager)=0 |
virtual NetworkIDManager * | GetNetworkIDManager (void) const =0 |
| |
virtual bool | RPC (const char *uniqueID, const char *data, unsigned int bitLength, PacketPriority priority, PacketReliability reliability, char orderingChannel, SystemAddress systemAddress, bool broadcast, RakNetTime *includedTimestamp, NetworkID networkID, RakNet::BitStream *replyFromTarget)=0 |
virtual bool | RPC (const char *uniqueID, const RakNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, SystemAddress systemAddress, bool broadcast, RakNetTime *includedTimestamp, NetworkID networkID, RakNet::BitStream *replyFromTarget)=0 |
virtual void | CloseConnection (const SystemAddress target, bool sendDisconnectionNotification, unsigned char orderingChannel=0)=0 |
virtual bool | IsConnected (const SystemAddress systemAddress, bool includeInProgress=false)=0 |
virtual int | GetIndexFromSystemAddress (const SystemAddress systemAddress)=0 |
virtual SystemAddress | GetSystemAddressFromIndex (int index)=0 |
virtual void | AddToBanList (const char *IP, RakNetTime milliseconds=0)=0 |
virtual void | RemoveFromBanList (const char *IP)=0 |
virtual void | ClearBanList (void)=0 |
Allows all previously banned IPs to connect. | |
virtual bool | IsBanned (const char *IP)=0 |
virtual void | Ping (const SystemAddress target)=0 |
virtual void | Ping (const char *host, unsigned short remotePort, bool onlyReplyOnAcceptingConnections, unsigned connectionSocketIndex=0)=0 |
virtual int | GetAveragePing (const SystemAddress systemAddress)=0 |
virtual int | GetLastPing (const SystemAddress systemAddress) const =0 |
virtual int | GetLowestPing (const SystemAddress systemAddress) const =0 |
virtual void | SetOccasionalPing (bool doPing)=0 |
virtual void | SetOfflinePingResponse (const char *data, const unsigned int length)=0 |
virtual void | GetOfflinePingResponse (char **data, unsigned int *length)=0 |
virtual SystemAddress | GetInternalID (const SystemAddress systemAddress=UNASSIGNED_SYSTEM_ADDRESS) const =0 |
virtual SystemAddress | GetExternalID (const SystemAddress target) const =0 |
virtual void | SetTimeoutTime (RakNetTime timeMS, const SystemAddress target)=0 |
virtual bool | SetMTUSize (int size)=0 |
virtual int | GetMTUSize (const SystemAddress target) const =0 |
virtual unsigned | GetNumberOfAddresses (void)=0 |
Returns the number of IP addresses this system has internally. Get the actual addresses from GetLocalIP(). | |
virtual const char * | GetLocalIP (unsigned int index)=0 |
Returns an IP address at index 0 to GetNumberOfAddresses-1. | |
virtual void | AllowConnectionResponseIPMigration (bool allow)=0 |
virtual bool | AdvertiseSystem (const char *host, unsigned short remotePort, const char *data, int dataLength, unsigned connectionSocketIndex=0)=0 |
virtual void | SetSplitMessageProgressInterval (int interval)=0 |
virtual void | SetUnreliableTimeout (RakNetTime timeoutMS)=0 |
virtual void | SendTTL2 (const char *host, unsigned short remotePort, unsigned connectionSocketIndex=0)=0 |
virtual void | SetCompileFrequencyTable (bool doCompile)=0 |
virtual bool | GetOutgoingFrequencyTable (unsigned int outputFrequencyTable[256])=0 |
virtual bool | GenerateCompressionLayer (unsigned int inputFrequencyTable[256], bool inputLayer)=0 |
virtual bool | DeleteCompressionLayer (bool inputLayer)=0 |
virtual float | GetCompressionRatio (void) const =0 |
virtual float | GetDecompressionRatio (void) const =0 |
virtual void | AttachPlugin (PluginInterface *plugin)=0 |
virtual void | DetachPlugin (PluginInterface *messageHandler)=0 |
virtual void | PushBackPacket (Packet *packet, bool pushAtHead)=0 |
virtual void | SetRouterInterface (RouterInterface *routerInterface)=0 |
virtual void | RemoveRouterInterface (RouterInterface *routerInterface)=0 |
virtual Packet * | AllocatePacket (unsigned dataSize)=0 |
virtual void | ApplyNetworkSimulator (double maxSendBPS, unsigned short minExtraPing, unsigned short extraPingVariance)=0 |
virtual void | SetPerConnectionOutgoingBandwidthLimit (unsigned maxBitsPerSecond)=0 |
virtual bool | IsNetworkSimulatorActive (void)=0 |
virtual RakNetStatistics *const | GetStatistics (const SystemAddress systemAddress)=0 |
The primary interface for RakNet, RakPeer contains all major functions for the library. See the individual functions for what the class can do.
virtual bool RakPeerInterface::Startup | ( | unsigned short | maxConnections, | |
int | _threadSleepTimer, | |||
SocketDescriptor * | socketDescriptors, | |||
unsigned | socketDescriptorCount | |||
) | [pure virtual] |
Starts the network threads, opens the listen port. You must call this before calling Connect(). Multiple calls while already active are ignored. To call this function again with different settings, you must first call Shutdown().
Set _RAKNET_THREADSAFE in RakNetDefines.h if you want to call RakNet functions from multiple threads (not recommended, as it is much slower and RakNet is already asynchronous).
[in] | maxConnections | The maximum number of connections between this instance of RakPeer and another instance of RakPeer. Required so the network can preallocate and for thread safety. A pure client would set this to 1. A pure server would set it to the number of allowed clients.- A hybrid would set it to the sum of both types of connections |
[in] | localPort | The port to listen for connections on. |
[in] | _threadSleepTimer | How many ms to Sleep each internal update cycle (30 to give the game priority, 0 for regular (recommended) |
[in] | socketDescriptors | An array of SocketDescriptor structures to force RakNet to listen on a particular IP address or port (or both). Each SocketDescriptor will represent one unique socket. Do not pass redundant structures. To listen on a specific port, you can pass SocketDescriptor(myPort,0); such as for a server. For a client, it is usually OK to just pass SocketDescriptor(); |
[in] | socketDescriptorCount | The size of the socketDescriptors array. Pass 1 if you are not sure what to pass. |
Implemented in RakPeer.
virtual void RakPeerInterface::InitializeSecurity | ( | const char * | pubKeyE, | |
const char * | pubKeyN, | |||
const char * | privKeyP, | |||
const char * | privKeyQ | |||
) | [pure virtual] |
Secures connections though a combination of SHA1, AES128, SYN Cookies, and RSA to prevent connection spoofing, replay attacks, data eavesdropping, packet tampering, and MitM attacks. There is a significant amount of processing and a slight amount of bandwidth overhead for this feature. If you accept connections, you must call this or else secure connections will not be enabled for incoming connections. If you are connecting to another system, you can call this with values for the (e and p,q) public keys before connecting to prevent MitM
[in] | pubKeyE | A pointer to the public keys from the RSACrypt class. |
[in] | pubKeyN | A pointer to the public keys from the RSACrypt class. |
[in] | privKeyP | Public key generated from the RSACrypt class. |
[in] | privKeyQ | Public key generated from the RSACrypt class. If the private keys are 0, then a new key will be generated when this function is called |
Implemented in RakPeer.
virtual void RakPeerInterface::DisableSecurity | ( | void | ) | [pure virtual] |
virtual void RakPeerInterface::SetMaximumIncomingConnections | ( | unsigned short | numberAllowed | ) | [pure virtual] |
Sets how many incoming connections are allowed. If this is less than the number of players currently connected, no more players will be allowed to connect. If this is greater than the maximum number of peers allowed, it will be reduced to the maximum number of peers allowed. Defaults to 0.
[in] | numberAllowed | Maximum number of incoming connections allowed. |
Implemented in RakPeer.
virtual unsigned short RakPeerInterface::GetMaximumIncomingConnections | ( | void | ) | const [pure virtual] |
Returns the value passed to SetMaximumIncomingConnections()
Implemented in RakPeer.
virtual unsigned short RakPeerInterface::NumberOfConnections | ( | void | ) | const [pure virtual] |
Returns how many open connections there are at this time
Implemented in RakPeer.
virtual void RakPeerInterface::SetIncomingPassword | ( | const char * | passwordData, | |
int | passwordDataLength | |||
) | [pure virtual] |
Sets the password incoming connections must match in the call to Connect (defaults to none). Pass 0 to passwordData to specify no password This is a way to set a low level password for all incoming connections. To selectively reject connections, implement your own scheme using CloseConnection() to remove unwanted connections
[in] | passwordData | A data block that incoming connections must match. This can be just a password, or can be a stream of data. Specify 0 for no password data |
[in] | passwordDataLength | The length in bytes of passwordData |
Implemented in RakPeer.
virtual void RakPeerInterface::GetIncomingPassword | ( | char * | passwordData, | |
int * | passwordDataLength | |||
) | [pure virtual] |
Gets the password passed to SetIncomingPassword
[out] | passwordData | Should point to a block large enough to hold the password data you passed to SetIncomingPassword() |
[in,out] | passwordDataLength | Maximum size of the array passwordData. Modified to hold the number of bytes actually written |
Implemented in RakPeer.
virtual bool RakPeerInterface::Connect | ( | const char * | host, | |
unsigned short | remotePort, | |||
const char * | passwordData, | |||
int | passwordDataLength, | |||
unsigned | connectionSocketIndex = 0 | |||
) | [pure virtual] |
Connect to the specified host (ip or domain name) and server port. Calling Connect and not calling SetMaximumIncomingConnections acts as a dedicated client. Calling both acts as a true peer. This is a non-blocking connection. You know the connection is successful when IsConnected() returns true or Receive() gets a message with the type identifier ID_CONNECTION_ACCEPTED. If the connection is not successful, such as a rejected connection or no response then neither of these things will happen.
[in] | host | Either a dotted IP address or a domain name |
[in] | remotePort | Which port to connect to on the remote machine. |
[in] | passwordData | A data block that must match the data block on the server passed to SetIncomingPassword. This can be a string or can be a stream of data. Use 0 for no password. |
[in] | passwordDataLength | The length in bytes of passwordData |
[in] | connectionSocketIndex | Index into the array of socket descriptors passed to socketDescriptors in RakPeer::Startup() to send on. |
Implemented in RakPeer.
virtual void RakPeerInterface::Shutdown | ( | unsigned int | blockDuration, | |
unsigned char | orderingChannel = 0 | |||
) | [pure virtual] |
Connect to the specified network ID (Platform specific console function) Does built-in NAt traversal.
[in] | passwordData | A data block that must match the data block on the server passed to SetIncomingPassword. This can be a string or can be a stream of data. Use 0 for no password. |
[in] | passwordDataLength | The length in bytes of passwordData Stops the network threads and closes all connections. |
[in] | blockDuration | How long, in milliseconds, you should wait for all remaining messages to go out, including ID_DISCONNECTION_NOTIFICATION. If 0, it doesn't wait at all. |
[in] | orderingChannel | If blockDuration > 0, ID_DISCONNECTION_NOTIFICATION will be sent on this channel If you set it to 0 then the disconnection notification won't be sent |
Implemented in RakPeer.
virtual bool RakPeerInterface::IsActive | ( | void | ) | const [pure virtual] |
Returns if the network thread is running
Implemented in RakPeer.
virtual bool RakPeerInterface::GetConnectionList | ( | SystemAddress * | remoteSystems, | |
unsigned short * | numberOfSystems | |||
) | const [pure virtual] |
Fills the array remoteSystems with the SystemAddress of all the systems we are connected to
[out] | remoteSystems | An array of SystemAddress structures to be filled with the SystemAddresss of the systems we are connected to. Pass 0 to remoteSystems to only get the number of systems we are connected to |
[in,out] | numberOfSystems | As input, the size of remoteSystems array. As output, the number of elements put into the array |
Implemented in RakPeer.
virtual bool RakPeerInterface::Send | ( | const char * | data, | |
const int | length, | |||
PacketPriority | priority, | |||
PacketReliability | reliability, | |||
char | orderingChannel, | |||
SystemAddress | systemAddress, | |||
bool | broadcast | |||
) | [pure virtual] |
Sends a block of data to the specified system that you are connected to. This function only works while the connected
[in] | data | The block of data to send |
[in] | length | The size in bytes of the data to send |
[in] | priority | What priority level to send on. See PacketPriority.h |
[in] | reliability | How reliability to send this data. See PacketPriority.h |
[in] | orderingChannel | When using ordered or sequenced messages, what channel to order these on. Messages are only ordered relative to other messages on the same stream |
[in] | systemAddress | Who to send this packet to, or in the case of broadcasting who not to send it to. Use UNASSIGNED_SYSTEM_ADDRESS to specify none |
[in] | broadcast | True to send this packet to all connected systems. If true, then systemAddress specifies who not to send the packet to. |
Implemented in RakPeer.
virtual bool RakPeerInterface::Send | ( | const RakNet::BitStream * | bitStream, | |
PacketPriority | priority, | |||
PacketReliability | reliability, | |||
char | orderingChannel, | |||
SystemAddress | systemAddress, | |||
bool | broadcast | |||
) | [pure virtual] |
Sends a block of data to the specified system that you are connected to. Same as the above version, but takes a BitStream as input.
[in] | bitStream | The bitstream to send |
[in] | priority | What priority level to send on. See PacketPriority.h |
[in] | reliability | How reliability to send this data. See PacketPriority.h |
[in] | orderingChannel | When using ordered or sequenced messages, what channel to order these on. Messages are only ordered relative to other messages on the same stream |
[in] | systemAddress | Who to send this packet to, or in the case of broadcasting who not to send it to. Use UNASSIGNED_SYSTEM_ADDRESS to specify none |
[in] | broadcast | True to send this packet to all connected systems. If true, then systemAddress specifies who not to send the packet to. |
Implemented in RakPeer.
virtual Packet* RakPeerInterface::Receive | ( | void | ) | [pure virtual] |
Gets a message from the incoming message queue. Use DeallocatePacket() to deallocate the message after you are done with it. User-thread functions, such as RPC calls and the plugin function PluginInterface::Update occur here.
Implemented in RakPeer.
virtual void RakPeerInterface::DeallocatePacket | ( | Packet * | packet | ) | [pure virtual] |
virtual void RakPeerInterface::CloseConnection | ( | const SystemAddress | target, | |
bool | sendDisconnectionNotification, | |||
unsigned char | orderingChannel = 0 | |||
) | [pure virtual] |
Close the connection to another host (if we initiated the connection it will disconnect, if they did it will kick them out).
[in] | target | Which system to close the connection to. |
[in] | sendDisconnectionNotification | True to send ID_DISCONNECTION_NOTIFICATION to the recipient. False to close it silently. |
[in] | channel | Which ordering channel to send the disconnection notification on, if any |
Implemented in RakPeer.
virtual bool RakPeerInterface::IsConnected | ( | const SystemAddress | systemAddress, | |
bool | includeInProgress = false | |||
) | [pure virtual] |
Returns if a particular systemAddress is connected to us (this also returns true if we are in the process of connecting)
[in] | systemAddress | The SystemAddress we are referring to |
[in] | includeInProgress | If true, also return true for connections that are in progress but haven't completed |
Implemented in RakPeer.
virtual int RakPeerInterface::GetIndexFromSystemAddress | ( | const SystemAddress | systemAddress | ) | [pure virtual] |
Given a systemAddress, returns an index from 0 to the maximum number of players allowed - 1.
[in] | systemAddress | The SystemAddress we are referring to |
Implemented in RakPeer.
virtual SystemAddress RakPeerInterface::GetSystemAddressFromIndex | ( | int | index | ) | [pure virtual] |
This function is only useful for looping through all systems Given an index, will return a SystemAddress.
[in] | index | Index should range between 0 and the maximum number of players allowed - 1. |
Implemented in RakPeer.
virtual void RakPeerInterface::AddToBanList | ( | const char * | IP, | |
RakNetTime | milliseconds = 0 | |||
) | [pure virtual] |
Bans an IP from connecting. Banned IPs persist between connections but are not saved on shutdown nor loaded on startup. param[in] IP Dotted IP address. Can use * as a wildcard, such as 128.0.0.* will ban all IP addresses starting with 128.0.0
[in] | milliseconds | how many ms for a temporary ban. Use 0 for a permanent ban |
Implemented in RakPeer.
virtual void RakPeerInterface::RemoveFromBanList | ( | const char * | IP | ) | [pure virtual] |
Allows a previously banned IP to connect. param[in] Dotted IP address. Can use * as a wildcard, such as 128.0.0.* will banAll IP addresses starting with 128.0.0
Implemented in RakPeer.
virtual bool RakPeerInterface::IsBanned | ( | const char * | IP | ) | [pure virtual] |
Returns true or false indicating if a particular IP is banned.
[in] | IP | - Dotted IP address. |
Implemented in RakPeer.
virtual void RakPeerInterface::Ping | ( | const SystemAddress | target | ) | [pure virtual] |
virtual void RakPeerInterface::Ping | ( | const char * | host, | |
unsigned short | remotePort, | |||
bool | onlyReplyOnAcceptingConnections, | |||
unsigned | connectionSocketIndex = 0 | |||
) | [pure virtual] |
Send a ping to the specified unconnected system. The remote system, if it is Initialized, will respond with ID_PONG followed by sizeof(RakNetTime) containing the system time the ping was sent.(Default is 4 bytes - See __GET_TIME_64BIT in RakNetTypes.h
[in] | host | Either a dotted IP address or a domain name. Can be 255.255.255.255 for LAN broadcast. |
[in] | remotePort | Which port to connect to on the remote machine. |
[in] | onlyReplyOnAcceptingConnections | Only request a reply if the remote system is accepting connections |
[in] | connectionSocketIndex | Index into the array of socket descriptors passed to socketDescriptors in RakPeer::Startup() to send on. |
Implemented in RakPeer.
virtual int RakPeerInterface::GetAveragePing | ( | const SystemAddress | systemAddress | ) | [pure virtual] |
Returns the average of all ping times read for the specific system or -1 if none read yet
[in] | systemAddress | Which system we are referring to |
Implemented in RakPeer.
virtual int RakPeerInterface::GetLastPing | ( | const SystemAddress | systemAddress | ) | const [pure virtual] |
Returns the last ping time read for the specific system or -1 if none read yet
[in] | systemAddress | Which system we are referring to |
Implemented in RakPeer.
virtual int RakPeerInterface::GetLowestPing | ( | const SystemAddress | systemAddress | ) | const [pure virtual] |
Returns the lowest ping time read or -1 if none read yet
[in] | systemAddress | Which system we are referring to |
Implemented in RakPeer.
virtual void RakPeerInterface::SetOccasionalPing | ( | bool | doPing | ) | [pure virtual] |
Ping the remote systems every so often, or not. This is off by default. Can be called anytime.
[in] | doPing | True to start occasional pings. False to stop them. |
Implemented in RakPeer.
virtual void RakPeerInterface::SetOfflinePingResponse | ( | const char * | data, | |
const unsigned int | length | |||
) | [pure virtual] |
Sets the data to send along with a LAN server discovery or offline ping reply. length should be under 400 bytes, as a security measure against flood attacks
[in] | data | a block of data to store, or 0 for none |
[in] | length | The length of data in bytes, or 0 for none |
Implemented in RakPeer.
virtual void RakPeerInterface::GetOfflinePingResponse | ( | char ** | data, | |
unsigned int * | length | |||
) | [pure virtual] |
Returns pointers to a copy of the data passed to SetOfflinePingResponse
[out] | data | A pointer to a copy of the data passed to SetOfflinePingResponse() |
[out] | length | A pointer filled in with the length parameter passed to SetOfflinePingResponse() |
Implemented in RakPeer.
virtual SystemAddress RakPeerInterface::GetInternalID | ( | const SystemAddress | systemAddress = UNASSIGNED_SYSTEM_ADDRESS |
) | const [pure virtual] |
Return the unique address identifier that represents you on the the network and is based on your local IP / port.
Implemented in RakPeer.
virtual SystemAddress RakPeerInterface::GetExternalID | ( | const SystemAddress | target | ) | const [pure virtual] |
Return the unique address identifier that represents you on the the network and is based on your externalIP / port (the IP / port the specified player uses to communicate with you)
[in] | target | Which remote system you are referring to for your external ID. Usually the same for all systems, unless you have two or more network cards. |
Implemented in RakPeer.
virtual void RakPeerInterface::SetTimeoutTime | ( | RakNetTime | timeMS, | |
const SystemAddress | target | |||
) | [pure virtual] |
Set the time, in MS, to use before considering ourselves disconnected after not being able to deliver a reliable message. Default time is 10,000 or 10 seconds in release and 30,000 or 30 seconds in debug.
[in] | timeMS | Time, in MS |
[in] | target | Which system to do this for. Pass UNASSIGNED_SYSTEM_ADDRESS for all systems. |
Implemented in RakPeer.
virtual bool RakPeerInterface::SetMTUSize | ( | int | size | ) | [pure virtual] |
Set the MTU per datagram. It's important to set this correctly - otherwise packets will be needlessly split, decreasing performance and throughput. Maximum allowed size is MAXIMUM_MTU_SIZE. Too high of a value will cause packets not to arrive at worst and be fragmented at best. Too low of a value will split packets unnecessarily. Recommended size is 1500 sa MTUSize.h
[in] | size | The MTU size |
Implemented in RakPeer.
virtual int RakPeerInterface::GetMTUSize | ( | const SystemAddress | target | ) | const [pure virtual] |
Returns the current MTU size
[in] | target | Which system to get this for. UNASSIGNED_SYSTEM_ADDRESS to get the default |
Implemented in RakPeer.
virtual void RakPeerInterface::AllowConnectionResponseIPMigration | ( | bool | allow | ) | [pure virtual] |
Allow or disallow connection responses from any IP. Normally this should be false, but may be necessary when connecting to servers with multiple IP addresses.
[in] | allow | - True to allow this behavior, false to not allow. Defaults to false. Value persists between connections |
Implemented in RakPeer.
virtual bool RakPeerInterface::AdvertiseSystem | ( | const char * | host, | |
unsigned short | remotePort, | |||
const char * | data, | |||
int | dataLength, | |||
unsigned | connectionSocketIndex = 0 | |||
) | [pure virtual] |
Sends a one byte message ID_ADVERTISE_SYSTEM to the remote unconnected system. This will tell the remote system our external IP outside the LAN along with some user data.
[in] | host | Either a dotted IP address or a domain name |
[in] | remotePort | Which port to connect to on the remote machine. |
[in] | data | Optional data to append to the packet. |
[in] | dataLength | length of data in bytes. Use 0 if no data. |
[in] | connectionSocketIndex | Index into the array of socket descriptors passed to socketDescriptors in RakPeer::Startup() to send on. |
Implemented in RakPeer.
virtual void RakPeerInterface::SetSplitMessageProgressInterval | ( | int | interval | ) | [pure virtual] |
Controls how often to return ID_DOWNLOAD_PROGRESS for large message downloads. ID_DOWNLOAD_PROGRESS is returned to indicate a new partial message chunk, roughly the MTU size, has arrived As it can be slow or cumbersome to get this notification for every chunk, you can set the interval at which it is returned. Defaults to 0 (never return this notification)
[in] | interval | How many messages to use as an interval |
Implemented in RakPeer.
virtual void RakPeerInterface::SetUnreliableTimeout | ( | RakNetTime | timeoutMS | ) | [pure virtual] |
Set how long to wait before giving up on sending an unreliable message Useful if the network is clogged up. Set to 0 or less to never timeout. Defaults to 0.
[in] | timeoutMS | How many ms to wait before simply not sending an unreliable message. |
Implemented in RakPeer.
virtual void RakPeerInterface::SendTTL2 | ( | const char * | host, | |
unsigned short | remotePort, | |||
unsigned | connectionSocketIndex = 0 | |||
) | [pure virtual] |
Send a message to host, with the IP socket option TTL set to 3 This message will not reach the host, but will open the router. Used for NAT-Punchthrough
Implemented in RakPeer.
virtual void RakPeerInterface::SetCompileFrequencyTable | ( | bool | doCompile | ) | [pure virtual] |
Enables or disables frequency table tracking. This is required to get a frequency table, which is used in GenerateCompressionLayer() This value persists between connect calls and defaults to false (no frequency tracking)
[in] | doCompile | True to enable tracking |
Implemented in RakPeer.
virtual bool RakPeerInterface::GetOutgoingFrequencyTable | ( | unsigned int | outputFrequencyTable[256] | ) | [pure virtual] |
Returns the frequency of outgoing bytes into output frequency table The purpose is to save to file as either a master frequency table from a sample game session for passing to GenerateCompressionLayer()
[out] | outputFrequencyTable | The frequency of each corresponding byte |
Implemented in RakPeer.
virtual bool RakPeerInterface::GenerateCompressionLayer | ( | unsigned int | inputFrequencyTable[256], | |
bool | inputLayer | |||
) | [pure virtual] |
This is an optional function to generate the compression layer based on the input frequency table. If you want to use it you should call this twice - once with inputLayer as true and once as false. The frequency table passed here with inputLayer=true should match the frequency table on the recipient with inputLayer=false. Likewise, the frequency table passed here with inputLayer=false should match the frequency table on the recipient with inputLayer=true. Calling this function when there is an existing layer will overwrite the old layer.
[in] | inputFrequencyTable | A frequency table for your data |
[in] | inputLayer | Is this the input layer? |
Implemented in RakPeer.
virtual bool RakPeerInterface::DeleteCompressionLayer | ( | bool | inputLayer | ) | [pure virtual] |
Delete the output or input layer as specified. This is not necessary to call and is only valuable for freeing memory.
[in] | inputLayer | True to mean the inputLayer, false to mean the output layer |
Implemented in RakPeer.
virtual float RakPeerInterface::GetCompressionRatio | ( | void | ) | const [pure virtual] |
Returns the compression ratio. A low compression ratio is good. Compression is for outgoing data
Implemented in RakPeer.
virtual float RakPeerInterface::GetDecompressionRatio | ( | void | ) | const [pure virtual] |
Returns the decompression ratio. A high decompression ratio is good. Decompression is for incoming data
Implemented in RakPeer.
virtual void RakPeerInterface::AttachPlugin | ( | PluginInterface * | plugin | ) | [pure virtual] |
Attatches a Plugin interface to run code automatically on message receipt in the Receive call
[in] | messageHandler | Pointer to a plugin to attach |
Implemented in RakPeer.
virtual void RakPeerInterface::DetachPlugin | ( | PluginInterface * | messageHandler | ) | [pure virtual] |
Detaches a Plugin interface to run code automatically on message receipt
[in] | messageHandler | Pointer to a plugin to detach |
Implemented in RakPeer.
virtual void RakPeerInterface::PushBackPacket | ( | Packet * | packet, | |
bool | pushAtHead | |||
) | [pure virtual] |
Put a message back at the end of the receive queue in case you don't want to deal with it immediately
[in] | packet | The packet you want to push back. |
[in] | pushAtHead | True to push the packet so that the next receive call returns it. False to push it at the end of the queue (obviously pushing it at the end makes the packets out of order) |
Implemented in RakPeer.
virtual Packet* RakPeerInterface::AllocatePacket | ( | unsigned | dataSize | ) | [pure virtual] |
virtual void RakPeerInterface::ApplyNetworkSimulator | ( | double | maxSendBPS, | |
unsigned short | minExtraPing, | |||
unsigned short | extraPingVariance | |||
) | [pure virtual] |
Adds simulated ping and packet loss to the outgoing data flow. To simulate bi-directional ping and packet loss, you should call this on both the sender and the recipient, with half the total ping and maxSendBPS value on each. You can exclude network simulator code with the _RELEASE define to decrease code size
[in] | maxSendBPS | Maximum bits per second to send. Packetloss grows linearly. 0 to disable. (CURRENTLY BROKEN - ALWAYS DISABLED) |
[in] | minExtraPing | The minimum time to delay sends. |
Implemented in RakPeer.
virtual void RakPeerInterface::SetPerConnectionOutgoingBandwidthLimit | ( | unsigned | maxBitsPerSecond | ) | [pure virtual] |
Limits how much outgoing bandwidth can be sent per-connection. This limit does not apply to the sum of all connections! Exceeding the limit queues up outgoing traffic
[in] | maxBitsPerSecond | Maximum bits per second to send. Use 0 for unlimited (default). Once set, it takes effect immedately and persists until called again. |
Implemented in RakPeer.
virtual bool RakPeerInterface::IsNetworkSimulatorActive | ( | void | ) | [pure virtual] |
Returns if you previously called ApplyNetworkSimulator
Implemented in RakPeer.
virtual RakNetStatistics* const RakPeerInterface::GetStatistics | ( | const SystemAddress | systemAddress | ) | [pure virtual] |
Returns a structure containing a large set of network statistics for the specified system. You can map this data to a string using the C style StatisticsToString() function
[in] | systemAddress,: | Which connected system to get statistics for |
Implemented in RakPeer.