- Main Page
- Modules
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# RakServerInterface Class Reference

Defines the functions used by a game server. More...

`#include <RakServerInterface.h>`

Inheritance diagram for RakServerInterface:

List of all members.

## Public Member Functions
virtual | ~RakServerInterface ()
| Destructor.
virtual bool | Start (unsigned short AllowedPlayers, unsigned int depreciated, int threadSleepTimer, unsigned short port, const char *forceHostAddress=0)=0
virtual void | InitializeSecurity (const char *privateKeyE, const char *privateKeyN)=0
virtual void | DisableSecurity (void)=0
virtual void | SetPassword (const char *_password)=0
virtual bool | HasPassword (void)=0
| Returns if non-zero was passed to SetPassword().
virtual void | Disconnect (unsigned int blockDuration, unsigned char orderingChannel=0)=0
virtual bool | Send (const char *data, const int 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 | Kick (const PlayerID playerId)=0
virtual void | DeallocatePacket (Packet *packet)=0
virtual void | SetAllowedPlayers (unsigned short AllowedPlayers)=0
virtual unsigned short | GetAllowedPlayers (void) const =0
virtual unsigned short | GetConnectedPlayers (void)=0
virtual void | GetPlayerIPFromID (const PlayerID playerId, char returnValue[22], unsigned short *port)=0
virtual void | PingPlayer (const PlayerID playerId)=0
virtual int | GetAveragePing (const PlayerID playerId)=0
virtual int | GetLastPing (const PlayerID playerId)=0
virtual int | GetLowestPing (const PlayerID playerId)=0
virtual void | StartOccasionalPing (void)=0
virtual void | StopOccasionalPing (void)=0
| Stop pinging players every so often. Players are pinged by default. In games where you don't care about ping you can call this to save the bandwidthThis will work anytime.
virtual bool | IsActive (void) const =0
| Returns true if the server is currently active.
virtual unsigned int | GetSynchronizedRandomInteger (void) const =0
virtual void | StartSynchronizedRandomInteger (void)=0
| Start or restart the synchronized random integer. This is on by default. Call StopSynchronizedRandomIntegerto stop it keeping the number in synch.
virtual void | StopSynchronizedRandomInteger (void)=0
| Stop the synchronized random integer. Call StartSynchronizedRandomInteger to start it again.
virtual bool | GenerateCompressionLayer (unsigned int inputFrequencyTable[256], bool inputLayer)=0
virtual bool | DeleteCompressionLayer (bool inputLayer)=0
virtual void | RegisterAsRemoteProcedureCall (char *uniqueID, void(*functionPointer)(RPCParameters *rpcParms))=0
virtual void | RegisterClassMemberRPC (char *uniqueID, void *functionPointer)=0
virtual void | UnregisterAsRemoteProcedureCall (char *uniqueID)=0
virtual bool | RPC (char *uniqueID, const char *data, unsigned int bitLength, PacketPriority priority, PacketReliability reliability, char orderingChannel, PlayerID playerId, bool broadcast, bool shiftTimestamp, NetworkID networkID, RakNet::BitStream *replyFromTarget)=0
virtual bool | RPC (char *uniqueID, RakNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, PlayerID playerId, bool broadcast, bool shiftTimestamp, NetworkID networkID, RakNet::BitStream *replyFromTarget)=0
virtual void | SetTrackFrequencyTable (bool b)=0
virtual bool | GetSendFrequencyTable (unsigned int outputFrequencyTable[256])=0
virtual float | GetCompressionRatio (void) const =0
virtual float | GetDecompressionRatio (void) const =0
virtual void | AttachPlugin (PluginInterface *messageHandler)=0
virtual void | DetachPlugin (PluginInterface *messageHandler)=0
virtual RakNet::BitStream * | GetStaticServerData (void)=0
virtual void | SetStaticServerData (const char *data, const int length)=0
virtual void | SetRelayStaticClientData (bool b)=0
virtual void | SendStaticServerDataToClient (const PlayerID playerId)=0
virtual void | SetOfflinePingResponse (const char *data, const unsigned int length)=0
virtual RakNet::BitStream * | GetStaticClientData (const PlayerID playerId)=0
virtual void | SetStaticClientData (const PlayerID playerId, const char *data, const int length)=0
virtual void | ChangeStaticClientData (const PlayerID playerChangedId, PlayerID playerToSendToId)=0
virtual unsigned int | GetNumberOfAddresses (void)=0
virtual const char * | GetLocalIP (unsigned int index)=0
virtual PlayerID | GetInternalID (void) const =0
virtual void | PushBackPacket (Packet *packet, bool pushAtHead)=0
virtual void | SetRouterInterface (RouterInterface *routerInterface)=0
| For internal use only.
virtual void | RemoveRouterInterface (RouterInterface *routerInterface)=0
| For internal use only.
virtual int | GetIndexFromPlayerID (const 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
| Allows all previously banned IPs to connect.
virtual bool | IsBanned (const char *IP)=0
virtual bool | IsActivePlayerID (const PlayerID playerId)=0
virtual void | SetTimeoutTime (RakNetTime timeMS, const PlayerID target)=0
virtual bool | SetMTUSize (int size)=0
virtual int | GetMTUSize (void) const =0
virtual void | AdvertiseSystem (const char *host, unsigned short remotePort, const char *data, int dataLength)=0
virtual RakNetStatisticsStruct *const | GetStatistics (const PlayerID playerId)=0
virtual void | ApplyNetworkSimulator (double maxSendBPS, unsigned short minExtraPing, unsigned short extraPingVariance)=0
virtual bool | IsNetworkSimulatorActive (void)=0

## Detailed Description

Defines the functions used by a game server.

This is a user-interface class to act as a game server. All it does is implement some functionality on top of RakPeer. See the individual functions for what the class can do.

## Member Function Documentation

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

| Bans an IP from connecting. Banned IPs persist between connections. param[in] IP Dotted IP address. Can use * as a wildcard, such as 128.0.0.* will banAll IP addresses starting with 128.0.0 Implemented in RakServer.

virtual void RakServerInterface::AdvertiseSystem | ( | const char * | host,
|  | unsigned short | remotePort,
|  | const char * | data,
|  | int | dataLength
| ) | `[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.. Parameters:
  `[in]` | host | Either a dotted IP address or a domain name
  `[in]` | remotePort | Which port to connect to on the remote machine.
  `[in]` | data | to send along with ID_ADVERTISE_SYSTEM
  `[in]` | dataLength | The length of data
Implemented in RakServer.

virtual void RakServerInterface::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 Parameters:
  `[in]` | maxSendBPS | Maximum bits per second to send. Packetloss grows linearly. 0 to disable.
  `[in]` | minExtraPing | The minimum time to delay sends.
  `[in]` | extraPingVariance | The additional random time to delay sends.
Implemented in RakServer.

virtual void RakServerInterface::AttachPlugin | ( | PluginInterface * | messageHandler | ) | `[pure virtual]`

  | Attatches a Plugin interface to run code automatically on message receipt in the Receive call Note: If plugins have dependencies on each other then the order does matter - for example the router plugin should go first because it might route messages for other plugins Parameters:
  `[in]` | messageHandler | Pointer to a message handler to attach
Implemented in RakServer.

virtual void RakServerInterface::ChangeStaticClientData | ( | const PlayerID | playerChangedId,
|  | PlayerID | playerToSendToId
| ) | `[pure virtual]`

  | This function is used to update the information on connected clients when the server effects a change of static client data. Note that a client that gets this new information for himself will update the data for his playerID but not his local data (which is the user's copy) i.e. player 5 would have the data returned by GetStaticClientData(5) changed but his local information returned byGetStaticClientData(UNASSIGNED_PLAYER_ID) would remain the same as it was previously. Parameters:
  `[in]` | playerChangedId | The playerId of the player whose data was changed. This is the parameter passed toGetStaticClientData to get a pointer to that player's information.
  `[in]` | playerToSendToId | The player you want to update with the new information. This will almost always be everybody, in which case you should pass UNASSIGNED_PLAYER_ID.
Precondition: The server must be active for this to have meaning Implemented in RakServer.

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

  | Call this to deallocate a packet returned by Receive when you are done handling it. Parameters:
  `[in]` | packet | The packet to deallocate.
Implemented in RakServer.

virtual bool RakServerInterface::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. Precondition: You should only call this when disconnected Parameters:
  `[in]` | inputLayer | True to mean the inputLayer, false to mean the output layer
Returns: false (failure) if connected. Otherwise true (success) Implemented in RakServer.

virtual void RakServerInterface::DetachPlugin | ( | PluginInterface * | messageHandler | ) | `[pure virtual]`

  | Detaches a Plugin interface to run code automatically on message receipt Parameters:
  `[in]` | messageHandler | Pointer to a message handler to detach
Implemented in RakServer.

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

| Disables all security. Precondition: Must be called while offline Implemented in RakServer.

virtual void RakServerInterface::Disconnect | ( | unsigned int | blockDuration,
|  | unsigned char | orderingChannel = `0`
| ) | `[pure virtual]`

  | Stops the server, stops synchronized data, and resets all internal data. This will drop all players currently connected, howeversince the server is stopped packet reliability is not enforced so the Kick network message may not actuallyarrive. Those players will disconnect due to timeout. If you want to end the server more gracefully, youcan manually Kick each player first. Does nothing if the server is not running to begin with Parameters:
  `[in]` | blockDuration | The maximum amount of time to wait for all remaining packets to go out, including the disconnection notification. If you set it to 0 then the disconnection notifications probably won't arrive
  `[in]` | orderingChannel | If blockDuration > 0, the disconnect packet will be sent on this channel
Implemented in RakServer.

virtual bool RakServerInterface::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. Precondition: You should only call this when disconnected Parameters:
  `[in]` | inputFrequencyTable | A frequency table for your data
  `[in]` | inputLayer | Is this the input layer?
Returns: false (failure) if connected. Otherwise true (success) See also: Compression.cpp Implemented in RakServer.

virtual unsigned short RakServerInterface::GetAllowedPlayers | ( | void |  | ) | const`[pure virtual]`

| Return how many players are allowed to connect. This value was set either from Start or from SetAllowedPlayers. Precondition: The server must be active for this to have meaning Returns: The number of allowed players Implemented in RakServer.

virtual int RakServerInterface::GetAveragePing | ( | const PlayerID | playerId | ) | `[pure virtual]`

  | Returns the average of all ping times read for the specific player or -1 if none read yet Parameters:
  `[in]` | playerId | Which player we are referring to
Returns: The ping time for this player, or -1 Implemented in RakServer.

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

| Returns the compression ratio. A low compression ratio is good. Compression is for outgoing data Returns: The compression ratio Implemented in RakServer.

virtual unsigned short RakServerInterface::GetConnectedPlayers | ( | void |  | ) | `[pure virtual]`

| Return how many players are currently connected to the server. Precondition: The server must be active for this to have meaning Returns: The number of connected players. Implemented in RakServer.

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

| Returns the decompression ratio. A high decompression ratio is good. Decompression is for incoming data Returns: The decompression ratio Implemented in RakServer.

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

  | Given a playerID, returns an index from 0 to the maximum number of players allowed - 1. Parameters:
  `[in]` | playerId | The PlayerID we are referring to
Returns: The index of this PlayerID Implemented in RakServer.

virtual PlayerID RakServerInterface::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: Unlike in previous versions, PlayerID is a struct and is not sequential Implemented in RakServer.

virtual int RakServerInterface::GetLastPing | ( | const PlayerID | playerId | ) | `[pure virtual]`

  | Returns the last ping time read for the specific player or -1 if none read yet Parameters:
  `[in]` | playerId | Which player we are referring to
Returns: The last ping time for this player, or -1 Implemented in RakServer.

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

| Call this function where 0 <= index < x where x is the value returned by GetNumberOfAddresses() Returns a static string filled with the server IP of the specified index. Strings returned in no particular order. You'll have to check every index see which string you want. Returns: 0 on invalid input, otherwise an dotted IP Implemented in RakServer.

virtual int RakServerInterface::GetLowestPing | ( | const PlayerID | playerId | ) | `[pure virtual]`

  | Returns the lowest ping time read or -1 if none read yet Parameters:
  `[in]` | playerId | Which player we are referring to
Returns: The lowest ping time for this player, or -1 Implemented in RakServer.

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

| Returns the current MTU size Returns: The current MTU size Implemented in RakServer.

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

| Internally store the IP address(es) for the server and return how many it has. This can easily be more than one, for example a system on both a LAN and with a net connection. The server does not have to be active for this to work Implemented in RakServer.

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

  | This function is only useful for looping through all players. Given an index, will return a PlayerID. Parameters:
  `[in]` | index | Index should range between 0 and the maximum number of players allowed - 1.
Implemented in RakServer.

virtual void RakServerInterface::GetPlayerIPFromID | ( | const PlayerID | playerId,
|  | char | returnValue[22],
|  | unsigned short * | port
| ) | `[pure virtual]`

  | Returns a static string pointer containing the IP of the specified connected player. Also returns the client port. This changes between calls so be sure to copy what is returned if you need to retain it. Useful for creating and maintaining ban lists. Precondition: The server must be active for this to have meaning If the specified id does not represent an active player the results are undefined (most likely returns 0) Parameters:
  `[in]` | playerId | Which player we are referring to
  `[out]` | returnValue | The IP of this player we are referring to
  `[out]` | port | The port of the player we are referring to.
Implemented in RakServer.

virtual bool RakServerInterface::GetSendFrequencyTable | ( | unsigned int | outputFrequencyTable[256] | ) | `[pure virtual]`

  | Returns the frequency of outgoing bytes into outputFrequencyTable. This is required to get a frequency table, which is used in GenerateCompressionLayer() The purpose is to save to file as either a master frequency table from a sample game session. Precondition: You should only call this when disconnected Requires that you first enable data frequency tracking by calling SetTrackFrequencyTable(true) Parameters:
  `[out]` | outputFrequencyTable | The Frequency Table used in the compression layer
Returns: false (failure) if connected or if frequency table tracking is not enabled. Otherwise true (success) Implemented in RakServer.

virtual RakNet::BitStream* RakServerInterface::GetStaticClientData | ( | const PlayerID | playerId | ) | `[pure virtual]`

  | Returns a pointer to an attached client's static data specified by the playerId. Returns 0 if no such player is connected. Note: that you can modify the client data here. Changes won't be reflected on clients unless you force them to update by calling ChangeStaticClientData() Precondition: The server must be active for this to have meaning Parameters:
  `[in]` | playerId | The ID of the client
Returns: A bitstream containing the static client data Implemented in RakServer.

virtual RakNet::BitStream* RakServerInterface::GetStaticServerData | ( | void |  | ) | `[pure virtual]`

| The server internally maintains a data struct that is automatically sent to clients when they connect. This is useful to contain data such as the server name or message of the day. Access that struct with thisfunction. Note: If you change any data in the struct remote clients won't reflect this change unless you manually update themDo so by calling SendStaticServerDataToClient(UNASSIGNED_PLAYER_ID) Returns: The static server data, stored in a bitstream Implemented in RakServer.

virtual RakNetStatisticsStruct* const RakServerInterface::GetStatistics | ( | const 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:
  `[in]` | 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. See also: RakNetStatistics.h Implemented in RakServer.

virtual unsigned int RakServerInterface::GetSynchronizedRandomInteger | ( | void |  | ) | const`[pure virtual]`

| Returns a number automatically synchronized between the server and client which randomly changes every 9 seconds. The time it changes is accurate to within a few ms and is best used to seed random number generators that you want to usually return the same output on all systems. Keep in mind thisisn't perfectly accurate as there is always a very small chance the numbers will by out of synch. You should should confine its use to visual effects or functionality that has a backup method to maintain synchronization. If you don't need this functionality and want to save the bandwidth callStopSynchronizedRandomInteger after starting the server Returns: A number, which is probably synchronized among all clients and the server. Implemented in RakServer.

virtual void RakServerInterface::InitializeSecurity | ( | const char * | privateKeyE,
|  | const char * | privateKeyN
| ) | `[pure virtual]`

  | Must be called while offlineSecures connections though a combination of SHA1, AES128, SYN Cookies, and RSA to preventconnection spoofing, replay attacks, data eavesdropping, packet tampering, and MitM attacks.There is a significant amount of processing and a slight amount of bandwidthoverhead for this feature.If you accept connections, you must call this or else secure connections will not be enabledfor incoming connections. If the private keys are 0, then a new key will be generated when this function is called See also: the Encryption sample Parameters:
  `[in]` | privateKeyE | A pointer to the public keys from the RSACrypt class.
  `[in]` | privateKeyN | A pointer to the public keys from the RSACrypt class.
Implemented in RakServer.

virtual bool RakServerInterface::IsActivePlayerID | ( | const PlayerID | playerId | ) | `[pure virtual]`

  | Returns true if that player ID is currently active Parameters:
  `[in]` | playerId | Which playerId we are referring to
Returns: true or false, as noted Implemented in RakServer.

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

  | Returns true or false indicating if a particular IP is banned. Parameters:
  `[in]` | IP | - Dotted IP address.
Returns: true if IP matches any IPs in the ban list, accounting for any wildcards. false otherwise. Implemented in RakServer.

virtual bool RakServerInterface::IsNetworkSimulatorActive | ( | void |  | ) | `[pure virtual]`

| Returns if you previously called ApplyNetworkSimulator Returns: If you previously called ApplyNetworkSimulator Implemented in RakServer.

virtual void RakServerInterface::Kick | ( | const PlayerID | playerId | ) | `[pure virtual]`

  | Kick out the specified player. Parameters:
  `[in]` | playerId | The playerId of the player to kcik.
Implemented in RakServer.

virtual void RakServerInterface::PingPlayer | ( | const PlayerID | playerId | ) | `[pure virtual]`

  | Send a ping request to the specified player Parameters:
  `[in]` | playerId | Which player we are referring to
Implemented in RakServer.

virtual void RakServerInterface::PushBackPacket | ( | Packet * | packet,
|  | bool | pushAtHead
| ) | `[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:
  `[in]` | packet | The packet to push
  `[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 RakServer.

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

| Gets a packet from the incoming packet queue. Use DeallocatePacket() to deallocate the packet after you are done with it. User-thread functions, such as RPC calls and the plugin function PluginInterface::Update occur here. Returns: 0 if no packets are waiting to be handled, otherwise a pointer to a packet. Implemented in RakServer.

virtual void RakServerInterface::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 RakServer.

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

  | /pre The server must be active. Send the data stream of length length to whichever playerId you specify. Parameters:
  `[in]` | bitStream | The bitstream to send.
  `[in]` | priority | See PacketPriority
  `[in]` | reliability | See PacketReliabilty
  `[in]` | orderingChannel | The ordering channel to use, from 0 to 31. Ordered or sequenced packets sent on the channel arrive ordered or sequence in relation to each other. See the manual for more details on this.
  `[in]` | playerId | Who to send to. Specify UNASSIGNED_PLAYER_ID to designate all connected systems.
  `[in]` | broadcast | Whether to send to everyone or not. If true, then the meaning of playerId changes to mean who NOT to send to.
Returns: Returns false on failure, true on success Implemented in RakServer.

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

  | /pre The server must be active. Send the data stream of length length to whichever playerId you specify. Parameters:
  `[in]` | data | The data to send
  `[in]` | length | The length, in bytes, of data
  `[in]` | priority | See PacketPriority
  `[in]` | reliability | See PacketReliabilty
  `[in]` | orderingChannel | The ordering channel to use, from 0 to 31. Ordered or sequenced packets sent on the channel arrive ordered or sequence in relation to each other. See the manual for more details on this.
  `[in]` | playerId | Who to send to. Specify UNASSIGNED_PLAYER_ID to designate all connected systems.
  `[in]` | broadcast | Whether to send to everyone or not. If true, then the meaning of playerId changes to mean who NOT to send to.
Returns: Returns false on failure, true on success Implemented in RakServer.

virtual void RakServerInterface::SendStaticServerDataToClient | ( | const PlayerID | playerId | ) | `[pure virtual]`

  | Send the static server data to the specified player. Pass UNASSIGNED_PLAYER_ID to broadcast to all players. The only time you need to call this function is to update clients that are already connected when you change the static server data by calling GetStaticServerData() and directly modifying the object pointed to. Obviously if theconnected clients don't need to know the new data you don't need to update them, so it's up to you. Precondition: The server must be active for this to have meaning Parameters:
  `[in]` | playerId | The playerId we are referring to
Implemented in RakServer.

virtual void RakServerInterface::SetAllowedPlayers | ( | unsigned short | AllowedPlayers | ) | `[pure virtual]`

  | Set how many players are allowed on the server. If more players are currently connected then are allowed then no more players will be allowed to join until the number of players is less than the number of allowed players. Precondition: The server must be active for this to have meaning Parameters:
  `[in]` | AllowedPlayers | The number of players to allow
Implemented in RakServer.

virtual bool RakServerInterface::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. sa MTUSize.h Precondition: Can only be called when not connected. Returns: false on failure (we are connected), else true Implemented in RakServer.

virtual void RakServerInterface::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 Parameters:
  `[in]` | data | a block of data to store, or 0 for none
  `[in]` | length | The length of data in bytes, or 0 for none
See also: Ping.cpp Implemented in RakServer.

virtual void RakServerInterface::SetPassword | ( | const char * | _password | ) | `[pure virtual]`

  | Set the password clients have to use to connect to this server. The password persists between connections. Pass 0 for no password. You can call this anytime Parameters:
  `[in]` | _password | The password string, or 0 for none.
Implemented in RakServer.

virtual void RakServerInterface::SetRelayStaticClientData | ( | bool | b | ) | `[pure virtual]`

  | This sets to true or false whether we want to support relaying of static client data to other connected clients. If set to false it saves some bandwdith, however other clients won't know the static client data and attempting to read that data will return garbage. Default is false. This only works for up to 32 players. Games supporting more than 32 players will have this shut off automatically upon server start and must have it forced back on with this function if you do indeed want it. Precondition: This should be called after the server is started in case you want to override when it shuts off at 32 players Parameters:
  `[in]` | b | true or false, as you wish to set the function
Implemented in RakServer.

virtual void RakServerInterface::SetStaticClientData | ( | const PlayerID | playerId,
|  | const char * | data,
|  | const int | length
| ) | `[pure virtual]`

  | Set the stait client data for a particular player Parameters:
  `[in]` | playerId | The ID of the client
  `[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 RakServer.

virtual void RakServerInterface::SetStaticServerData | ( | const char * | data,
|  | const int | length
| ) | `[pure virtual]`

  | The server internally maintains a data struct that is automatically sent to clients when they connect. This function will set that data. Parameters:
  `[in]` | data | The data to use as the static server data
  `[in]` | length | The length, in bytes, of data
Implemented in RakServer.

virtual void RakServerInterface::SetTimeoutTime | ( | RakNetTime | timeMS,
|  | const PlayerID | target
| ) | `[pure virtual]`

  | Set the time, in MS, to use before considering ourselves disconnected after not being able to deliver a reliable packet Default time is 10,000 or 10 seconds in release and 30,000 or 30 seconds in debug. Parameters:
  `[in]` | timeMS | Time, in MS
  `[in]` | target | Which system to do this for
Implemented in RakServer.

virtual void RakServerInterface::SetTrackFrequencyTable | ( | bool | b | ) | `[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) Precondition: You can call this at any time - however you SHOULD only call it when disconnected. Otherwise you will only trackpart of the values sent over the network. Parameters:
  `[in]` | b | True to enable tracking
Implemented in RakServer.

virtual bool RakServerInterface::Start | ( | unsigned short | AllowedPlayers,
|  | unsigned int | depreciated,
|  | int | threadSleepTimer,
|  | unsigned short | port,
|  | const char * | forceHostAddress = `0`
| ) | `[pure virtual]`

  | Call this to initiate the server with the number of players you want to be allowed connected at once Parameters:
  `[in]` | AllowedPlayers | Current maximum number of allowed players is 65535
  `[in]` | depreciated | is for legacy purposes and is unused
  `[in]` | threadSleepTimer | How many ms to Sleep each internal update cycle (30 to give the game priority, 0 for regular (recommended), -1 to not Sleep() (may be slower))
  `[in]` | port | is the port you want the server to read and write onMake sure this port is open for UDP
  `[in]` | forceHostAddress | Can force RakNet to use a particular IP to host on. Pass 0 to automatically pick an IP
Returns: true on successful initiation, false otherwise Implemented in RakServer.

virtual void RakServerInterface::StartOccasionalPing | ( | void |  | ) | `[pure virtual]`

| Ping all players every so often. This is on by default. In games where you don't care about ping you can callStopOccasionalPing to save the bandwidth. This can be called anytime. Implemented in RakServer.

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

- C:/RakNet 2.518/Include/RakServerInterface.h