/// \brief Specializes RakPeer to act as a client.
///
/// \remarks This file originated from my first game, where I only had a server and a client. Now that I have RakPeer, it's depreciated although in such wide use I can't delete it.
///
/// This file is part of RakNet Copyright 2003 Kevin Jenkins.
///
/// Usage of RakNet is subject to the appropriate license agreement.
///Call this to connect the client to the specified host (ip or domain name) and server port.
/// 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_REQUEST_ACCEPTED.
/// \param[in] host Dotted IP or a domain name
/// \param[in] serverPort The port on which to connect to \a host
/// \param[in] clientPort The port to use localy
/// \param[in] depreciated Ignore this
/// \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))
/// \return true on successful initiation, false otherwise
/// Stops the client, stops synchronized data, and resets all internal data.
/// Does nothing if the client is not connected to begin wit
/// \param[in] blockDuration how long you should wait for all remaining packets to go outIf you set it to 0 then the disconnection notification probably won't arrive
/// \param[in] orderingChannel If blockDuration > 0, the disconnect packet will be sent on this channel
/// Set the password to use when connecting to a server. The password persists between connections.
/// \param[in] _password The password to use to connect to a server, or 0 for none.
voidSetPassword(constchar*_password);
/// Returns true if a password was set, false otherwise
/// \return true if a password has previously been set using SetPassword
boolHasPassword(void)const;
/// Sends a block of data to the specified system that you are connected to.
/// This function only works while the connected (Use the Connect function).
/// \param[in] data The block of data to send
/// \param[in] length The size in bytes of the data 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.- Packets are only ordered relative to other packets on the same stream
/// \return False if we are not connected to the specified recipient. True otherwise
/// Sends a block of data to the specified system that you are connected to.
/// This function only works while the connected (Use the Connect function).
/// \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.- Packets are only ordered relative to other packets on the same stream
/// \return False if we are not connected to the specified recipient. True otherwise
/// 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] 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] 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
/// 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
voidSetTrackFrequencyTable(boolb);
/// 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
floatGetCompressionRatio(void)const;
///Returns the decompression ratio. A high decompression ratio is good. Decompression is for incoming data
/// \return The decompression ratio
floatGetDecompressionRatio(void)const;
/// 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
voidAttachPlugin(PluginInterface*messageHandler);
///Detaches a Plugin interface to run code automatically on message receipt
/// \param[in] messageHandler Pointer to a message handler to detach
voidDetachPlugin(PluginInterface*messageHandler);
/// The server internally maintains a data struct that is
/// automatically sent to clients when the connect. This is useful
/// to contain data such as the server name or message of the day.
/// Access that struct with this function. The data is entered as an
/// array and stored and returned as a BitStream. Everytime you call
/// GetStaticServerData it resets the read pointer to the start of
/// the bitstream. To do multiple reads without reseting the pointer
/// Maintain a pointer copy to the bitstream as in RakNet::BitStream *copy = ...->GetStaticServerData(...);
/// To store a bitstream, use the GetData() and GetNumberOfBytesUsed() methods
/// of the bitstream for the 2nd and 3rd parameters
/// Note that the server may change at any time the
/// data contents and/or its length!
/// \return a bitstream containing static server data
RakNet::BitStream*GetStaticServerData(void);
/// The server internally maintains a data struct that is
/// automatically sent to clients when the connect. This is useful
/// to contain data such as the server name or message of the day.
/// Access that struct with this function. The data is entered as an
/// array and stored and returned as a BitStream. Everytime you call
/// GetStaticServerData it resets the read pointer to the start of
/// the bitstream. To do multiple reads without reseting the pointer
/// Maintain a pointer copy to the bitstream as in RakNet::BitStream *copy = ...->GetStaticServerData(...);
/// To store a bitstream, use the GetData() and GetNumberOfBytesUsed() methods
/// of the bitstream for the 2nd and 3rd parameters
/// Note that the server may change at any time the
/// Send the static server data to the server 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 the connected clients don't need to know the new
/// data you don't need to update them, so it's up to you The server
/// must be active for this to have meaning
voidSendStaticClientDataToServer(void);
/// Return the player number of the server.
/// \return the server playerID
PlayerIDGetServerID(void)const;
/// Return the player number the server has assigned to you.
/// \return our player ID
/// \note that unlike in previous versions, this is a struct and is not sequential
PlayerIDGetPlayerID(void)const;
///Return the unique address identifier that represents you on the the network and is based on your local IP / portNote that unlike in previous versions, this is a struct and is not sequential
PlayerIDGetInternalID(void)const;
/// Returns the dotted IP address for the specified playerId
/// \param[in] playerId Any player ID other than UNASSIGNED_PLAYER_ID, even if that player is not currently connected
/// \return a dotted notation string representation of the address of playerId.
/// 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 delayed
/// \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 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.
/// \param[in] timeMS Time, in MS
voidSetTimeoutTime(RakNetTimetimeMS);
/// 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
boolSetMTUSize(intsize);
/// Returns the current MTU size
/// \return The current MTU size
intGetMTUSize(void)const;
///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.
/// \param[in] allow - True to allow this behavior, false to not allow. Defaults to false. Value persists between connections
/// 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 The maximum window size for the windowing algorithm before 100% packetloss. The chance of each packet being lost is RakNetStatisticsStruct::windowSize / maxSendBPS . Recommended you set this between 100 and 1000 with lower numbers corresponding to greater packetloss. This approximates the real condition where the more data you send the more likely you are to lose data. Call with 0 to disable.
/// \param[in] minExtraPing The minimum time to delay sends.
/// \param[in] extraPingVariance The additional random time to delay sends.