# RakPeerInterface Class Reference

Define the user view of a RakPeer instance. More...

`#include <RakPeerInterface.h>`

Inheritance diagram for RakPeerInterface:

List of all members.

## Public Member Functions

virtual | ~RakPeerInterface ()
virtual bool | Initialize (unsigned short MaximumNumberOfPeers, unsigned short localPort, int _threadSleepTimer)=0
virtual void | InitializeSecurity (char *pubKeyP, char *pubKeyQ, char *privKeyE, char *privKeyN)=0
virtual void | DisableSecurity (void)=0
virtual void | SetMaximumIncomingConnections (unsigned short numberAllowed)=0
virtual unsigned short | GetMaximumIncomingConnections (void) const =0
virtual void | SetIncomingPassword (char *passwordData, int passwordDataLength)=0
RakNet::BitStream * | GetIncomingPassword (void)
virtual bool | Connect (char *host, unsigned short remotePort, char *passwordData, int passwordDataLength)=0
virtual void | Disconnect (unsigned long blockDuration)=0
virtual bool | IsActive (void) const =0
virtual bool | GetConnectionList (PlayerID *remoteSystems, unsigned short *numberOfSystems) const =0
virtual bool | Send (char *data, const long length, PacketPriority priority, PacketReliability reliability, char orderingChannel, PlayerID playerId, bool broadcast)=0
virtual bool | Send (RakNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, PlayerID playerId, bool broadcast)=0
virtual Packet * | Receive (void)=0
virtual void | DeallocatePacket (Packet *packet)=0
virtual unsigned short | GetMaximumNumberOfPeers (void) const =0
virtual void | RegisterAsRemoteProcedureCall (char *uniqueID, void(*functionName)(char *input, int numberOfBitsOfData, PlayerID sender))=0
virtual void | UnregisterAsRemoteProcedureCall (char *uniqueID)=0
virtual bool | RPC (char *uniqueID, char *data, unsigned long bitLength, PacketPriority priority, PacketReliability reliability, char orderingChannel, PlayerID playerId, bool broadcast, bool shiftTimestamp)=0
virtual bool | RPC (char *uniqueID, RakNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, PlayerID playerId, bool broadcast, bool shiftTimestamp)=0
virtual void | CloseConnection (PlayerID target, bool sendDisconnectionNotification, unsigned long blockDuration)=0
virtual int | GetIndexFromPlayerID (PlayerID playerId)=0
virtual PlayerID | GetPlayerIDFromIndex (int index)=0
virtual void | AddToBanList (const char *IP)=0
virtual void | RemoveFromBanList (const char *IP)=0
virtual void | ClearBanList (void)=0
virtual bool | IsBanned (const char *IP)=0
virtual void | Ping (PlayerID target)=0
virtual void | Ping (char *host, unsigned short remotePort, bool onlyReplyOnAcceptingConnections)=0
virtual int | GetAveragePing (PlayerID target)=0
virtual int | GetLastPing (PlayerID target) const =0
virtual int | GetLowestPing (PlayerID target) const =0
virtual void | SetOccasionalPing (bool doPing)=0
virtual RakNet::BitStream * | GetRemoteStaticData (PlayerID playerId)=0
virtual void | SetRemoteStaticData (PlayerID playerId, char *data, const long length)=0
virtual void | SendStaticData (PlayerID target)=0
virtual void | SetOfflinePingResponse (char *data, const unsigned long length)=0
virtual PlayerID | GetInternalID (void) const =0
virtual PlayerID | GetExternalID (PlayerID target) const =0
virtual bool | SetMTUSize (int size)=0
virtual int | GetMTUSize (void) const =0
virtual unsigned | GetNumberOfAddresses (void)=0
virtual const char * | PlayerIDToDottedIP (PlayerID playerId) const =0
virtual void | IPToPlayerID (const char *host, unsigned short remotePort, PlayerID *playerId)=0
virtual const char * | GetLocalIP (unsigned int index)=0
void | AllowConnectionResponseIPMigration (bool allow)
virtual void | AdvertiseSystem (char *host, unsigned short remotePort)=0
virtual void | SetCompileFrequencyTable (bool doCompile)=0
virtual bool | GetOutgoingFrequencyTable (unsigned long outputFrequencyTable[256])=0
virtual bool | GenerateCompressionLayer (unsigned long 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 | GetPasswordData (char *passwordData, int *passwordDataLength)=0
virtual void | PushBackPacket (Packet *packet)=0
virtual RakNetStatisticsStruct *const | GetStatistics (PlayerID playerId)=0

## Detailed Description

Define the user view of a RakPeer instance.

This class define the user point of view of a RakPeer instance.

## Constructor & Destructor Documentation

virtual RakPeerInterface::~RakPeerInterface | ( |  | ) | `[inline, virtual]`

| Destructor

## Member Function Documentation

virtual void RakPeerInterface::AddToBanList | ( | const char * | IP | ) | `[pure virtual]`

Bans an IP from connecting. Banned IPs persist between connections.

Parameters:

  | IP | Dotted IP address. Can use * as a wildcard, such as 128.0.0.* will ban All IP addresses starting with 128.0.0

Implemented in RakPeer, and RakServer.

virtual void RakPeerInterface::AdvertiseSystem | ( | char * | host,
|  | unsigned short | remotePort
| ) | `[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, and can be used for NAT punch through

Requires: The sender and recipient must already be started via a successful call to Initialize

Parameters:

  | host | Either a dotted IP address or a domain name
  | remotePort | Which port to connect to on the remote machine.

Implemented in RakClient, RakPeer, and RakServer.

void RakPeerInterface::AllowConnectionResponseIPMigration | ( | bool | allow | ) |

Allow or disallow connection responses from any IP. Normally this should be false, but may be necessary when connection to servers with multiple IP addresses.

Parameters:

  | allow | - True to allow this behavior, false to not allow. Defaults to false. Value persists between connections

Reimplemented in RakClient, and RakPeer.

virtual void RakPeerInterface::ClearBanList | ( | void |  | ) | `[pure virtual]`

| Allows all previously banned IPs to connect. Implemented in RakPeer, and RakServer.

virtual void RakPeerInterface::CloseConnection | ( | PlayerID | target,
|  | bool | sendDisconnectionNotification,
|  | unsigned long | blockDuration
| ) | `[pure virtual]`

Close the connection to another host (if we initiated the connection it will disconnect, if they did it will kick them out).

Parameters:

  | target | Which connection to close
  | sendDisconnectionNotification | True to send ID_DISCONNECTION_NOTIFICATION to the recipient. False to close it silently.
  | blockDuration | How long you should wait for all remaining packets to go out, per connected system If you set it to 0 then the disconnection notification probably won't arrive

Implemented in RakPeer.

virtual bool RakPeerInterface::Connect | ( | char * | host,
|  | unsigned short | remotePort,
|  | char * | passwordData,
|  | int | passwordDataLength
| ) | `[pure virtual]`

Call this to 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 packet with the type identifier ID_CONNECTION_ACCEPTED. If the connection is not successful, such as rejected connection or no response then neither of these things will happen. Requires that you first call Initialize

Parameters:

  | host | Either a dotted IP address or a domain name
  | remotePort | Which port to connect to on the remote machine.
  | passwordData | A data block that must match the data block on the server. This can be just a password, or can be a stream of data
  | passwordDataLength | The length in bytes of passwordData

Returns:
  True on successful initiation. False on incorrect parameters, internal error, or too many existing peers

Implemented in RakPeer.

virtual void RakPeerInterface::DeallocatePacket | ( | Packet * | packet | ) | `[pure virtual]`

Call this to deallocate a packet returned by Receive when you are done handling it.

Parameters:

  | packet | A packet to free

Implemented in RakClient, RakPeer, and RakServer.

virtual bool RakPeerInterface::DeleteCompressionLayer | ( | bool | inputLayer | ) | `[pure virtual]`

Deletes the output or input layer as specified. This is not necessary to call and is only valuable for freeing memory You should only call this when disconnected

Parameters:

  | inputLayer | Specifies the corresponding compression layer generated by GenerateCompressionLayer.

Returns:
  False on failure (we are connected). True otherwise

Implemented in RakClient, RakPeer, and RakServer.

virtual void RakPeerInterface::DisableSecurity | ( | void |  | ) | `[pure virtual]`

Disables all security.

Note:
  Must be called while offline

Implemented in RakPeer, and RakServer.

virtual void RakPeerInterface::Disconnect | ( | unsigned long | blockDuration | ) | `[pure virtual]`

Stops the network threads and close all connections. Multiple calls are ok.

Parameters:

  | blockDuration | How long you should wait for all remaining packets to go out, per connected system If you set it to 0 then the disconnection notification probably won't arrive

Implemented in RakClient, RakPeer, and RakServer.

virtual bool RakPeerInterface::GenerateCompressionLayer | ( | unsigned long | inputFrequencyTable[256],
|  | bool | inputLayer
| ) | `[pure virtual]`

Generates the compression layer from the input frequency table. 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 You should only call this when disconnected

Parameters:

  | inputFrequencyTable | The frequency table returned from GetSendFrequencyTable(...);
  | inputLayer | Whether inputFrequencyTable represents incoming data from other systems (true) or outgoing data from this system (false)

Returns:
  False on failure (we are connected). True otherwise

Implemented in RakClient, RakPeer, and RakServer.

virtual int RakPeerInterface::GetAveragePing | ( | PlayerID | target | ) | `[pure virtual]`

Gets the average of all ping times read for a specified target

Parameters:

  | target | whose time to read

Returns:
  The average of all ping times read for a specified target.

Implemented in RakPeer, and RakServer.

virtual float RakPeerInterface::GetCompressionRatio | ( | void |  | ) | const`[pure virtual]`

Get the compression ratio. A low compression ratio is good. Compression is for outgoing data

Returns:
  The compression ratio.

Implemented in RakClient, RakPeer, and RakServer.

virtual bool RakPeerInterface::GetConnectionList | ( | PlayerID * | remoteSystems,
|  | unsigned short * | numberOfSystems
| ) | const`[pure virtual]`

Fills the array remoteSystems with the playerID of all the systems we are connected to

Parameters:

  `[out]`

  remoteSystems

  An array of PlayerID structures to be filled with the PlayerIDs of the systems we are connected to
  - pass 0 to remoteSystems to only get the number of systems we are connected to

  | numberOfSystems | As input, the size of remoteSystems array. As output, the number of elements put into the array

Implemented in RakPeer.

virtual float RakPeerInterface::GetDecompressionRatio | ( | void |  | ) | const`[pure virtual]`

Get the decompression ratio. A high decompression ratio is good. Decompression is for incoming data

Returns:
  The decompression ratio.

Implemented in RakClient, RakPeer, and RakServer.

virtual PlayerID RakPeerInterface::GetExternalID | ( | PlayerID | target | ) | const`[pure virtual]`

Return the unique address identifier that represents you on the the network and is based on your external IP / port (the IP / port the specified player uses to communicate with you)

Note:
  that unlike in previous versions, this is a struct and is not sequential

Parameters:

  | target | Which remote system you are referring to for your external ID

Implemented in RakPeer.

RakNet::BitStream* RakPeerInterface::GetIncomingPassword | ( | void |  | ) |

Get the password set by SetIncomingPassword in a BitStream

Returns:
  The password in a BitStream.

Reimplemented in RakPeer.

virtual int RakPeerInterface::GetIndexFromPlayerID | ( | PlayerID | playerId | ) | `[pure virtual]`

Given a playerID, returns an index from 0 to the maximum number of players allowed - 1.

Parameters:

  | playerId | The playerID to search for

Returns:
  An integer from 0 to the maximum number of peers -1, or -1 if that player is not found

Implemented in RakPeer, and RakServer.

virtual PlayerID RakPeerInterface::GetInternalID | ( | void |  | ) | const`[pure virtual]`

| Return the unique address identifier that represents you on the the network and is based on your local IP / port Note that unlike in previous versions, this is a struct and is not sequential Implemented in RakPeer.

virtual int RakPeerInterface::GetLastPing | ( | PlayerID | target | ) | const`[pure virtual]`

Gets the last ping time read for the specific player or -1 if none read yet

Parameters:

  | target | whose time to read

Returns:
  Just the last ping

Implemented in RakPeer.

virtual const char* RakPeerInterface::GetLocalIP | ( | unsigned int | index | ) | `[pure virtual]`

| Returns an IP address at index 0 to GetNumberOfAddresses-1 Implemented in RakPeer, and RakServer.

virtual int RakPeerInterface::GetLowestPing | ( | PlayerID | target | ) | const`[pure virtual]`

Gets the lowest ping time read or -1 if none read yet

Parameters:

  | target | whose time to read

Returns:
  the lowest ping time

Implemented in RakPeer.

virtual unsigned short RakPeerInterface::GetMaximumIncomingConnections | ( | void |  | ) | const`[pure virtual]`

Get the number of maximum incomming connection.

Returns:
  the maximum number of incoming connections, which is always <= MaximumNumberOfPeers

Implemented in RakPeer.

virtual unsigned short RakPeerInterface::GetMaximumNumberOfPeers | ( | void |  | ) | const`[pure virtual]`

| Return the total number of connections we are allowed Implemented in RakPeer.

virtual int RakPeerInterface::GetMTUSize | ( | void |  | ) | const`[pure virtual]`

Returns the current MTU size

Returns:
  The MTU sized specified in SetMTUSize

Implemented in RakClient, RakPeer, and RakServer.

virtual unsigned RakPeerInterface::GetNumberOfAddresses | ( | void |  | ) | `[pure virtual]`

| Returns the number of IP addresses we have Implemented in RakPeer, and RakServer.

virtual bool RakPeerInterface::GetOutgoingFrequencyTable | ( | unsigned long | outputFrequencyTable[256] | ) | `[pure virtual]`

Returns the frequency of outgoing bytes into outputFrequencyTable The purpose is to save to file as either a master frequency table from a sample game session for passing to GenerateCompressionLayer(false); You should only call this when disconnected. Requires that you first enable data frequency tracking by calling SetCompileFrequencyTable(true)

Parameters:

  `[out]` | outputFrequencyTable | The frequency of each corresponding byte

Returns:
  False (failure) if connected or if frequency table tracking is not enabled. Otherwise true (success)

Implemented in RakPeer.

virtual void RakPeerInterface::GetPasswordData | ( | char * | passwordData,
|  | int * | passwordDataLength
| ) | `[pure virtual]`

Retrieves the data you passed to the passwordData parameter in Connect

Parameters:

  `[out]` | passwordData | Should point to a block large enough to hold the password data you passed to Connect
  | passwordDataLength | Maximum size of the array passwordData. Modified to hold the number of bytes actually written

Implemented in RakPeer.

virtual PlayerID RakPeerInterface::GetPlayerIDFromIndex | ( | int | index | ) | `[pure virtual]`

This function is only useful for looping through all players.

Parameters:

  | index | an integer between 0 and the maximum number of players allowed - 1.

Returns:
  A valid playerID or UNASSIGNED_PLAYER_ID if no such player at that index

Implemented in RakPeer, and RakServer.

virtual RakNet::BitStream* RakPeerInterface::GetRemoteStaticData | ( | PlayerID | playerId | ) | `[pure virtual]`

All systems have a block of data associated with them, for user use. This block of data can be used to easily specify typical system data that you want to know on connection, such as the player's name.

Parameters:

  | playerId | Which system you are referring to. Pass the value returned by GetInternalID to refer to yourself

Returns:
  The data passed to SetRemoteStaticData stored as a bitstream

Implemented in RakPeer.

virtual RakNetStatisticsStruct* const RakPeerInterface::GetStatistics | ( | PlayerID | playerId | ) | `[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

Parameters:

  | playerId | Which connected system to get statistics for

Returns:
  0 on can't find the specified system. A pointer to a set of data otherwise.

Implemented in RakPeer, and RakServer.

virtual bool RakPeerInterface::Initialize | ( | unsigned short | MaximumNumberOfPeers,
|  | unsigned short | localPort,
|  | int | _threadSleepTimer
| ) | `[pure virtual]`

Starts the network threads, opens the listen port You must call this before calling SetMaximumIncomingConnections or Connect Multiple calls while already active are ignored. To call this function again with different settings, you must first call Disconnect() To accept incoming connections, use SetMaximumIncomingConnections

Parameters:

Parameters:

  MaximumNumberOfPeers

  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

  | localPort | The port to listen for connections on.
  | _threadSleepTimer | >=0 for how many ms to Sleep each internal update cycle (recommended 30 for low performance, 0 for regular)

Returns:
  False on failure (can't create socket or thread), true on success.

Implemented in RakPeer.

virtual void RakPeerInterface::InitializeSecurity | ( | char * | pubKeyP,
|  | char * | pubKeyQ,
|  | char * | privKeyE,
|  | char * | privKeyN
| ) | `[pure virtual]`

Must be called while offline 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

Parameters:

  | pubKeyP | Public key generated from the RSACrypt class.
  | pubKeyQ | Public key generated from the RSACrypt class.
  | privKeyE | A pointer to the private keys from the RSACrypt class.
  | privKeyN | A pointer to the private keys from the RSACrypt class. If the private keys are 0, then a new key will be generated when this function is called

See also:
  the Encryption sample

Implemented in RakPeer.

virtual void RakPeerInterface::IPToPlayerID | ( | const char * | host,
|  | unsigned short | remotePort,
|  | PlayerID * | playerId
| ) | `[pure virtual]`

Converts a dotted IP to a playerId

Parameters:

  `[in]` | host | Either a dotted IP address or a domain name
  `[in]` | remotePort | Which port to connect to on the remote machine.
  `[out]` | playerId | The result of this operation

Implemented in RakPeer.

virtual bool RakPeerInterface::IsActive | ( | void |  | ) | const`[pure virtual]`

| Returns true if the network threads are running Implemented in RakPeer, and RakServer.

virtual bool RakPeerInterface::IsBanned | ( | const char * | IP | ) | `[pure virtual]`

Determines if a particular IP is banned.

Parameters:

  | IP | Complete dotted IP address

Returns:
  - True if IP matches any IPs in the ban list, accounting for any wildcards.
  - False otherwise.

Implemented in RakPeer, and RakServer.

virtual void RakPeerInterface::Ping | ( | char * | host,
|  | unsigned short | remotePort,
|  | bool | onlyReplyOnAcceptingConnections
| ) | `[pure virtual]`

Send a ping to the specified unconnected system. The remote system, if it is Initialized, will respond with ID_PONG. The final ping time will be encoded in the following 4 bytes (2-5) as an unsigned long

Requires: The sender and recipient must already be started via a successful call to Initialize

Parameters:

  | host | Either a dotted IP address or a domain name. Can be 255.255.255.255 for LAN broadcast.
  | remotePort | Which port to connect to on the remote machine.
  | onlyReplyOnAcceptingConnections | Only request a reply if the remote system is accepting connections

Implemented in RakPeer.

virtual void RakPeerInterface::Ping | ( | PlayerID | target | ) | `[pure virtual]`

Send a ping to the specified connected system.

Parameters:

  | target | who to ping

Implemented in RakPeer.

virtual const char* RakPeerInterface::PlayerIDToDottedIP | ( | PlayerID | playerId | ) | const`[pure virtual]`

Returns the dotted IP address for the specified playerId

Parameters:

  | playerId | Any player ID other than UNASSIGNED_PLAYER_ID, even if that player is not currently connected

Implemented in RakClient, and RakPeer.

virtual void RakPeerInterface::PushBackPacket | ( | Packet * | packet | ) | `[pure virtual]`

Put a packet back at the end of the receive queue in case you don't want to deal with it immediately

Parameters:

  | packet | The packet you want to push back.

Implemented in RakClient, RakPeer, and RakServer.

virtual Packet* RakPeerInterface::Receive | ( | void |  | ) | `[pure virtual]`

Gets a packet from the incoming packet queue. Use DeallocatePacket to deallocate the packet after you are done with it. Check the Packet struct at the top of CoreNetworkStructures.h for the format of the struct

Returns:
  0 if no packets are waiting to be handled, otherwise an allocated packet If the client is not active this will also return 0, as all waiting packets are flushed when the client is Disconnected This also updates all memory blocks associated with synchronized memory and distributed objects

Implemented in RakClient, RakPeer, and RakServer.

virtual void RakPeerInterface::RemoveFromBanList | ( | const char * | IP | ) | `[pure virtual]`

Bans an IP from connecting. Banned IPs persist between connections.

Parameters:

  | IP | Dotted IP address. Can use * as a wildcard, such as 128.0.0.* will ban All IP addresses starting with 128.0.0

Implemented in RakPeer, and RakServer.

virtual bool RakPeerInterface::Send | ( | RakNet::BitStream * | bitStream,
|  | PacketPriority | priority,
|  | PacketReliability | reliability,
|  | char | orderingChannel,
|  | PlayerID | playerId,
|  | bool | broadcast
| ) | `[pure virtual]`

Sends a block of data to the specified system that you are connected to. This function only works while the client is connected (Use the Connect function).

Parameters:

  | bitStream | The bitstream to send
  | priority | What priority level to send on.
  | reliability | How reliability to send this data

  orderingChannel

  When using ordered or sequenced packets, what channel to order these on.
  - Packets are only ordered relative to other packets on the same stream

  | playerId | Who to send this packet to, or in the case of broadcasting who not to send it to. Use UNASSIGNED_PLAYER_ID to specify none
  | broadcast | True to send this packet to all connected systems. If true, then playerId specifies who not to send the packet to.

Returns:
  False if we are not connected to the specified recipient. True otherwise

Implemented in RakPeer, and RakServer.

virtual bool RakPeerInterface::Send | ( | char * | data,
|  | const long | length,
|  | PacketPriority | priority,
|  | PacketReliability | reliability,
|  | char | orderingChannel,
|  | PlayerID | playerId,
|  | bool | broadcast
| ) | `[pure virtual]`

Sends a block of data to the specified system that you are connected to. This function only works while the client is connected (Use the Connect function).

Parameters:

  | data | The block of data to send
  | length | The size in bytes of the data to send
  | priority | What priority level to send on.
  | reliability | How reliability to send this data

  orderingChannel

  When using ordered or sequenced packets, what channel to order these on.
  - Packets are only ordered relative to other packets on the same stream

  | playerId | Who to send this packet to, or in the case of broadcasting who not to send it to. Use UNASSIGNED_PLAYER_ID to specify none
  | broadcast | True to send this packet to all connected systems. If true, then playerId specifies who not to send the packet to.

Returns:
  False if we are not connected to the specified recipient. True otherwise

Implemented in RakPeer, and RakServer.

virtual void RakPeerInterface::SendStaticData | ( | PlayerID | target | ) | `[pure virtual]`

Sends your static data to the specified system. This is automatically done on connection. You should call this when you change your static data. To send the static data of another system (such as relaying their data) you should do this normally with Send

Parameters:

  | target | Who to send your static data to. Specify UNASSIGNED_PLAYER_ID to broadcast to all

Implemented in RakPeer.

virtual void RakPeerInterface::SetCompileFrequencyTable | ( | bool | doCompile | ) | `[pure virtual]`

Enables or disables our tracking of bytes input to and output from the network. This is required to get a frequency table, which is used to generate a new compression layer. You can call this at any time - however you SHOULD only call it when disconnected. Otherwise you will only track part of the values sent over the network. This value persists between connect calls and defaults to false (no frequency tracking)

Parameters:

  | doCompile | - true to track bytes. Defaults to false

Implemented in RakPeer.

virtual void RakPeerInterface::SetIncomingPassword | ( | 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

Parameters:

  | 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
  | passwordDataLength | The length in bytes of passwordData

Implemented in RakPeer.

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.

Parameters:

  | numberAllowed | Maximum number of incoming connections allowed.

Implemented in RakPeer.

virtual bool RakPeerInterface::SetMTUSize | ( | int | size | ) | `[pure virtual]`

Change the MTU size in order to improve performance when sending large packets This can only be called when not connected. A too high of value will cause packets not to arrive at worst and be fragmented at best. A too low of value will split packets unnecessarily.

Parameters:

Parameters:

  size,:

  Set according to the following table:
  - 1500. The largest Ethernet packet size; it is also the default value. This is the typical setting for non-PPPoE, non-VPN connections. The default value for NETGEAR routers, adapters and switches.
  - 1492. The size PPPoE prefers.
  - 1472. Maximum size to use for pinging. (Bigger packets are fragmented.)
  - 1468. The size DHCP prefers.
  - 1460. Usable by AOL if you don't have large email attachments, etc.
  - 1430. The size VPN and PPTP prefer.
  - 1400. Maximum size for AOL DSL.
  - 576. Typical value to connect to dial-up ISPs. (Default)

Returns:
  False on failure (we are connected). True on success. Maximum allowed size is MAXIMUM_MTU_SIZE

Implemented in RakClient, RakPeer, and RakServer.

virtual void RakPeerInterface::SetOccasionalPing | ( | bool | doPing | ) | `[pure virtual]`

Ping the remote systems every so often. This is off by default This will work anytime

Parameters:

  | doPing | True to start occasional pings. False to stop them.

Implemented in RakPeer.

virtual void RakPeerInterface::SetOfflinePingResponse | ( | char * | data,
|  | const unsigned long | length
| ) | `[pure virtual]`

Sets the data to send with an (LAN server discovery) /(offline ping) response See the Ping sample project for how this is used.

Parameters:

  | data | a block of data to store, or 0 for none
  | length | The length of data in bytes, or 0 for none

Implemented in RakPeer, and RakServer.

virtual void RakPeerInterface::SetRemoteStaticData | ( | PlayerID | playerId,
|  | char * | data,
|  | const long | length
| ) | `[pure virtual]`

All systems have a block of data associated with them, for user use. This block of data can be used to easily specify typical system data that you want to know on connection, such as the player's name.

Parameters:

  | playerId | Whose static data to change. Use your own playerId to change your own static data
  | data | a block of data to store
  | length | The length of data in bytes

Implemented in RakPeer.

The documentation for this class was generated from the following file:

- Projects/raknet/include/raknet/RakPeerInterface.h