/// Call this to initiate the server with the number of players you want to be allowed connected at once
/// \param[in] AllowedPlayers Current maximum number of allowed players is 65535
/// \param[in] depreciated is for legacy purposes and is unused
/// \param[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))
/// \param[in] port is the port you want the server to read and write onMake sure this port is open for UDP
/// \param[in] forceHostAddress Can force RakNet to use a particular IP to host on. Pass 0 to automatically pick an IP
/// \return true on successful initiation, false otherwise
/// 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 the Encryption sample
/// \param[in] privateKeyE A pointer to the public keys from the RSACrypt class.
/// \param[in] privateKeyN A pointer to the public keys from the RSACrypt class.
/// 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
/// \param[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
/// \param[in] orderingChannel If blockDuration > 0, the disconnect packet will be sent on this channel
/// Send the data stream of length \a length to whichever \a playerId you specify.
/// \param[in] data The data to send
/// \param[in] length The length, in bytes, of \a data
/// \param[in] priority See PacketPriority
/// \param[in] reliability See PacketReliabilty
/// \param[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.
/// \param[in] playerId Who to send to. Specify UNASSIGNED_PLAYER_ID to designate all connected systems.
/// \param[in] broadcast Whether to send to everyone or not. If true, then the meaning of \a playerId changes to mean who NOT to send to.
/// \return Returns false on failure, true on success
/// Send the data stream of length \a length to whichever \a playerId you specify.
/// \param[in] bitStream The bitstream to send.
/// \param[in] priority See PacketPriority
/// \param[in] reliability See PacketReliabilty
/// \param[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.
/// \param[in] playerId Who to send to. Specify UNASSIGNED_PLAYER_ID to designate all connected systems.
/// \param[in] broadcast Whether to send to everyone or not. If true, then the meaning of \a playerId changes to mean who NOT to send to.
/// \return Returns false on failure, true on success
/// 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.
/// \pre The server must be active for this to have meaning
/// \param[in] AllowedPlayers The number of players to allow
/// Returns the last ping time read for the specific player or -1 if none read yet
/// \param[in] playerId Which player we are referring to
/// \return The last ping time for this player, or -1
virtualintGetLastPing(constPlayerIDplayerId)=0;
/// Returns the lowest ping time read or -1 if none read yet
/// \param[in] playerId Which player we are referring to
/// \return The lowest ping time for this player, or -1
virtualintGetLowestPing(constPlayerIDplayerId)=0;
/// 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.
virtualvoidStartOccasionalPing(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
virtualvoidStopOccasionalPing(void)=0;
/// Returns true if the server is currently active
virtualboolIsActive(void)const=0;
/// 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
/// \return A number, which is probably synchronized among all clients and the server.
/// Register a C or static member function as available for calling as a remote procedure call
/// \param[in] uniqueID: A null-terminated unique string to identify this procedure. Recommended you use the macro CLASS_MEMBER_ID for class member functions
/// \param[in] functionPointer The name of the function to be used as a function pointer. This can be called whether active or not, and registered functions stay registered unless unregistered
/// Register a C++ member function as available for calling as a remote procedure call.
/// \param[in] uniqueID: A null terminated string to identify this procedure.Recommended you use the macro REGISTER_CLASS_MEMBER_RPC
/// \param[in] functionPointer: The name of the function to be used as a function pointer. This can be called whether active or not, and registered functions stay registered unless unregistered with UnregisterAsRemoteProcedureCall
/// Unregisters a C function as available for calling as a remote procedure call that was formerly registeredwith RegisterAsRemoteProcedureCallOnly call offline
/// \param[in] uniqueID A string of only letters to identify this procedure. Recommended you use the macro CLASS_MEMBER_ID for class member functions. Must match the parameterpassed to RegisterAsRemoteProcedureCall
/// Calls a C function on the remote system that was already registered using RegisterAsRemoteProcedureCall.
/// If you want that function to return data you should call RPC from that system in the same wayReturns true on a successful packet
/// send (this does not indicate the recipient performed the call), false on failure
/// \param[in] uniqueID A NULL terimianted string to this procedure. Recommended you use the macro CLASS_MEMBER_ID for class member functions. Must match the parameter
/// \param[in] data The data to send
/// \param[in] bitLength The number of bits of \a data
/// \param[in] priority What priority level to send on.
/// \param[in] reliability How reliability to send this data
/// \param[in] orderingChannel When using ordered or sequenced packets, what channel to order these on.
/// \param[in] 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
/// \param[in] broadcast True to send this packet to all connected systems. If true, then playerId specifies who not to send the packet to.
/// \param[in] shiftTimestamp True to add a timestamp to your data, such that the first byte is ID_TIMESTAMP and the next sizeof(RakNetTime) is the timestamp.
/// \param[in] networkID For static functions, pass UNASSIGNED_NETWORK_ID. For member functions, you must derive from NetworkIDGenerator and pass the value returned by NetworkIDGenerator::GetNetworkID for that object.
/// \param[in] replyFromTarget If 0, this function is non-blocking. Otherwise it will block while waiting for a reply from the target procedure, which is remtely written to RPCParameters::replyToSender and copied to replyFromTarget. The block will return early on disconnect or if the sent packet is unreliable and more than 3X the ping has elapsed.
/// \return True on a successful packet send (this does not indicate the recipient performed the call), false on failure\note This is part of the Remote Procedure Call Subsystem
/// Calls a C function on the remote system that was already registered using RegisterAsRemoteProcedureCall.
/// If you want that function to return data you should call RPC from that system in the same wayReturns true on a successful packet
/// send (this does not indicate the recipient performed the call), false on failure
/// \param[in] uniqueID A NULL terimianted string to this procedure. Recommended you use the macro CLASS_MEMBER_ID for class member functions. Must match the parameter
/// \param[in] bitStream The bitstream to send
/// \param[in] priority What priority level to send on.
/// \param[in] reliability How reliability to send this data
/// \param[in] orderingChannel When using ordered or sequenced packets, what channel to order these on.
/// \param[in] 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
/// \param[in] broadcast True to send this packet to all connected systems. If true, then playerId specifies who not to send the packet to.
/// \param[in] shiftTimestamp True to add a timestamp to your data, such that the first byte is ID_TIMESTAMP and the next sizeof(RakNetTime) is the timestamp.
/// \param[in] networkID For static functions, pass UNASSIGNED_NETWORK_ID. For member functions, you must derive from NetworkIDGenerator and pass the value returned by NetworkIDGenerator::GetNetworkID for that object.
/// \param[in] replyFromTarget If 0, this function is non-blocking. Otherwise it will block while waiting for a reply from the target procedure, which is remtely written to RPCParameters::replyToSender and copied to replyFromTarget. The block will return early on disconnect or if the sent packet is unreliable and more than 3X the ping has elapsed.
/// \return True on a successful packet send (this does not indicate the recipient performed the call), false on failure
/// 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)
/// \pre 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.
/// \param[in] b True to enable tracking
virtualvoidSetTrackFrequencyTable(boolb)=0;
/// 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.
/// \pre You should only call this when disconnected
/// \pre Requires that you first enable data frequency tracking by calling SetTrackFrequencyTable(true)
/// \param[out] outputFrequencyTable The Frequency Table used in the compression layer
/// \return false (failure) if connected or if frequency table tracking is not enabled. Otherwise true (success)
/// Returns the compression ratio. A low compression ratio is good. Compression is for outgoing data
/// \return The compression ratio
virtualfloatGetCompressionRatio(void)const=0;
///Returns the decompression ratio. A high decompression ratio is good. Decompression is for incoming data
/// \return The decompression ratio
virtualfloatGetDecompressionRatio(void)const=0;
/// 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
/// \param[in] messageHandler Pointer to a message handler to attach
///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)
/// \return The static server data, stored in a bitstream
/// 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.
/// \pre This should be called after the server is started in case you want to override when it shuts off at 32 players
/// \param[in] b true or false, as you wish to set the function
virtualvoidSetRelayStaticClientData(boolb)=0;
/// 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.
/// \pre The server must be active for this to have meaning
/// \param[in] playerId The playerId we are referring to
/// 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()
/// \pre The server must be active for this to have meaning
/// \param[in] playerId The ID of the client
/// \return A bitstream containing the static client data
/// 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.
/// \param[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.
/// \param[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.
/// \pre The server must be active for this to have meaning
/// 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
virtualunsignedintGetNumberOfAddresses(void)=0;
/// 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.
/// \return 0 on invalid input, otherwise an dotted IP
virtualconstchar*GetLocalIP(unsignedintindex)=0;
/// 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
virtualPlayerIDGetInternalID(void)const=0;
/// Put a packet back at the end of the receive queue in case you don't want to deal with it immediately.
/// \param[in] packet The packet to push
/// \param[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)
/// 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
/// \pre Can only be called when not connected.
/// \return false on failure (we are connected), else true
virtualboolSetMTUSize(intsize)=0;
/// Returns the current MTU size
/// \return The current MTU size
virtualintGetMTUSize(void)const=0;
/// 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..
/// \param[in] host Either a dotted IP address or a domain name
/// \param[in] remotePort Which port to connect to on the remote machine.
/// \param[in] data to send along with ID_ADVERTISE_SYSTEM
/// 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
/// \param[in] maxSendBPS Maximum bits per second to send. Packetloss grows linearly. 0 to disable.
/// \param[in] minExtraPing The minimum time to delay sends.
/// \param[in] extraPingVariance The additional random time to delay sends.