SLikeNet 0.1.3

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

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | List of all members
SLNet::RakPeerInterface Class Referenceabstract

The main interface for network communications. More...

`#include <slikenet/peerinterface.h>`

Inheritance diagram for SLNet::RakPeerInterface:

## Public Member Functions

virtual | ~RakPeerInterface ()
| Destructor.
virtual StartupResult | Startup (unsigned int maxConnections, SocketDescriptor *socketDescriptors, unsigned socketDescriptorCount, int threadPriority=-99999)=0
| Starts the network threads, opens the listen port.
virtual bool | InitializeSecurity (const char *publicKey, const char *privateKey, bool bRequireClientKey=false)=0
virtual void | DisableSecurity (void)=0
virtual void | AddToSecurityExceptionList (const char *ip)=0
virtual void | RemoveFromSecurityExceptionList (const char *ip)=0
virtual bool | IsInSecurityExceptionList (const char *ip)=0
virtual void | SetMaximumIncomingConnections (unsigned short numberAllowed)=0
virtual unsigned int | GetMaximumIncomingConnections (void) const =0
virtual unsigned short | NumberOfConnections (void) const =0
virtual void | SetIncomingPassword (const char *passwordData, int passwordDataLength)=0
virtual void | GetIncomingPassword (char *passwordData, int *passwordDataLength)=0
virtual ConnectionAttemptResult | Connect (const char *host, unsigned short remotePort, const char *passwordData, int passwordDataLength, PublicKey *publicKey=0, unsigned connectionSocketIndex=0, unsigned sendConnectionAttemptCount=12, unsigned timeBetweenSendConnectionAttemptsMS=500, SLNet::TimeMS timeoutTime=0)=0

Connect to the specified host (ip or domain name) and server port. Calling Connect and not calling SetMaximumIncomingConnections acts as a dedicated client. Calling both acts as a true peer. This is a non-blocking connection. You know the connection is successful when GetConnectionState() returns IS_CONNECTED or Receive() gets a message with the type identifier ID_CONNECTION_REQUEST_ACCEPTED. If the connection is not successful, such as a rejected connection or no response then neither of these things will happen.

virtual ConnectionAttemptResult | ConnectWithSocket (const char *host, unsigned short remotePort, const char *passwordData, int passwordDataLength, RakNetSocket2 *socket, PublicKey *publicKey=0, unsigned sendConnectionAttemptCount=12, unsigned timeBetweenSendConnectionAttemptsMS=500, SLNet::TimeMS timeoutTime=0)=0
| Connect to the specified host (ip or domain name) and server port, using a shared socket from another instance of RakNet.
virtual void | Shutdown (unsigned int blockDuration, unsigned char orderingChannel=0, PacketPriority disconnectionNotificationPriority=LOW_PRIORITY)=0
| Connect to the specified network ID (Platform specific console function)
virtual bool | IsActive (void) const =0
virtual bool | GetConnectionList (SystemAddress *remoteSystems, unsigned short *numberOfSystems) const =0
virtual uint32_t | GetNextSendReceipt (void)=0
virtual uint32_t | IncrementNextSendReceipt (void)=0
virtual uint32_t | Send (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast, uint32_t forceReceiptNumber=0)=0
virtual void | SendLoopback (const char *data, const int length)=0
virtual uint32_t | Send (const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast, uint32_t forceReceiptNumber=0)=0
virtual uint32_t | SendList (const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast, uint32_t forceReceiptNumber=0)=0
virtual Packet * | Receive (void)=0
virtual void | DeallocatePacket (Packet *packet)=0
virtual unsigned int | GetMaximumNumberOfPeers (void) const =0
| Return the total number of connections we are allowed.
virtual void | CloseConnection (const AddressOrGUID target, bool sendDisconnectionNotification, unsigned char orderingChannel=0, PacketPriority disconnectionNotificationPriority=LOW_PRIORITY)=0
virtual ConnectionState | GetConnectionState (const AddressOrGUID systemIdentifier)=0
virtual void | CancelConnectionAttempt (const SystemAddress target)=0
virtual int | GetIndexFromSystemAddress (const SystemAddress systemAddress) const =0
virtual SystemAddress | GetSystemAddressFromIndex (unsigned int index)=0
virtual RakNetGUID | GetGUIDFromIndex (unsigned int index)=0
virtual void | GetSystemList (DataStructures::List< SystemAddress > &addresses, DataStructures::List< RakNetGUID > &guids) const =0
virtual void | AddToBanList (const char *IP, SLNet::TimeMS milliseconds=0)=0
virtual void | RemoveFromBanList (const char *IP)=0
virtual void | ClearBanList (void)=0
| Allows all previously banned IPs to connect.
virtual bool | IsBanned (const char *IP)=0
virtual void | SetLimitIPConnectionFrequency (bool b)=0
virtual void | Ping (const SystemAddress target)=0
virtual bool | Ping (const char *host, unsigned short remotePort, bool onlyReplyOnAcceptingConnections, unsigned connectionSocketIndex=0)=0
virtual int | GetAveragePing (const AddressOrGUID systemIdentifier)=0
virtual int | GetLastPing (const AddressOrGUID systemIdentifier) const =0
virtual int | GetLowestPing (const AddressOrGUID systemIdentifier) const =0
virtual void | SetOccasionalPing (bool doPing)=0
virtual SLNet::Time | GetClockDifferential (const AddressOrGUID systemIdentifier)=0
virtual void | SetOfflinePingResponse (const char *data, const unsigned int length)=0
virtual void | GetOfflinePingResponse (char **data, unsigned int *length)=0
virtual SystemAddress | GetInternalID (const SystemAddress systemAddress=UNASSIGNED_SYSTEM_ADDRESS, const int index=0) const =0
virtual void | SetInternalID (SystemAddress systemAddress, int index=0)=0
| Sets your internal IP address, for platforms that do not support reading it, or to override a value.
virtual SystemAddress | GetExternalID (const SystemAddress target) const =0
virtual const RakNetGUID | GetMyGUID (void) const =0
| Return my own GUID.
virtual SystemAddress | GetMyBoundAddress (const int socketIndex=0)=0
| Return the address bound to a socket at the specified index.
virtual const RakNetGUID & | GetGuidFromSystemAddress (const SystemAddress input) const =0
virtual SystemAddress | GetSystemAddressFromGuid (const RakNetGUID input) const =0
virtual bool | GetClientPublicKeyFromSystemAddress (const SystemAddress input, char *client_public_key) const =0
virtual void | SetTimeoutTime (SLNet::TimeMS timeMS, const SystemAddress target)=0
virtual SLNet::TimeMS | GetTimeoutTime (const SystemAddress target)=0
virtual int | GetMTUSize (const SystemAddress target) const =0
virtual unsigned | GetNumberOfAddresses (void)=0
| Returns the number of IP addresses this system has internally. Get the actual addresses from GetLocalIP()
virtual const char * | GetLocalIP (unsigned int index)=0
virtual bool | IsLocalIP (const char *ip)=0
virtual void | AllowConnectionResponseIPMigration (bool allow)=0
virtual bool | AdvertiseSystem (const char *host, unsigned short remotePort, const char *data, int dataLength, unsigned connectionSocketIndex=0)=0
virtual void | SetSplitMessageProgressInterval (int interval)=0
virtual int | GetSplitMessageProgressInterval (void) const =0
virtual void | SetUnreliableTimeout (SLNet::TimeMS timeoutMS)=0
virtual void | SendTTL (const char *host, unsigned short remotePort, int ttl, unsigned connectionSocketIndex=0)=0
virtual void | AttachPlugin (PluginInterface2 *plugin)=0
| Attaches a Plugin interface to an instance of the base class (RakPeer or PacketizedTCP) to run code automatically on message receipt in the Receive call. If the plugin returns false from PluginInterface::UsesReliabilityLayer(), which is the case for all plugins except PacketLogger, you can call AttachPlugin() and DetachPlugin() for this plugin while RakPeer is active.
virtual void | DetachPlugin (PluginInterface2 *messageHandler)=0
| Detaches a Plugin interface from the instance of the base class (RakPeer or PacketizedTCP) it is attached to.
virtual void | PushBackPacket (Packet *packet, bool pushAtHead)=0
virtual void | ChangeSystemAddress (RakNetGUID guid, const SystemAddress &systemAddress)=0
virtual Packet * | AllocatePacket (unsigned dataSize)=0
virtual RakNetSocket2 * | GetSocket (const SystemAddress target)=0
virtual void | GetSockets (DataStructures::List< RakNetSocket2 * > &sockets)=0
virtual void | ReleaseSockets (DataStructures::List< RakNetSocket2 * > &sockets)=0
virtual void | WriteOutOfBandHeader (SLNet::BitStream *bitStream)=0
virtual void | SetUserUpdateThread (void(*_userUpdateThreadPtr)(RakPeerInterface *, void *), void *_userUpdateThreadData)=0
virtual void | SetIncomingDatagramEventHandler (bool(*_incomingDatagramEventHandler)(RNS2RecvStruct *))=0
virtual void | ApplyNetworkSimulator (float packetloss, unsigned short minExtraPing, unsigned short extraPingVariance)=0
virtual void | SetPerConnectionOutgoingBandwidthLimit (unsigned maxBitsPerSecond)=0
virtual bool | IsNetworkSimulatorActive (void)=0
virtual RakNetStatistics * | GetStatistics (const SystemAddress systemAddress, RakNetStatistics *rns=0)=0
virtual bool | GetStatistics (const unsigned int index, RakNetStatistics *rns)=0
| Returns the network statistics of the system at the given index in the remoteSystemList.
virtual void | GetStatisticsList (DataStructures::List< SystemAddress > &addresses, DataStructures::List< RakNetGUID > &guids, DataStructures::List< RakNetStatistics > &statistics)=0
| Returns the list of systems, and statistics for each of those systems Each system has one entry in each of the lists, in the same order.
virtual unsigned int | GetReceiveBufferSize (void)=0
| how many messages are waiting when you call Receive()
virtual bool | RunUpdateCycle (BitStream &updateBitStream)=0
virtual bool | SendOutOfBand (const char *host, unsigned short remotePort, const char *data, BitSize_t dataLength, unsigned connectionSocketIndex=0)=0

## Static Public Member Functions

static uint64_t | Get64BitUniqueRandomNumber (void)
| Get a random number (to generate a GUID)

## Detailed Description

The main interface for network communications.

The primary interface for RakNet, RakPeer contains all major functions for the library. See the individual functions for what the class can do.

Definition at line 47 of file peerinterface.h.

## Constructor & Destructor Documentation

virtual SLNet::RakPeerInterface::~RakPeerInterface | ( |  | ) |

inlinevirtual

Destructor.

Definition at line 54 of file peerinterface.h.

## Member Function Documentation

virtual void SLNet::RakPeerInterface::AddToBanList | ( | const char * | IP,
|  | SLNet::TimeMS | milliseconds = `0`
| ) |  |

pure virtual

Bans an IP from connecting. Banned IPs persist between connections but are not saved on shutdown nor loaded on startup. param[in] IP Dotted IP address. Can use * as a wildcard, such as 128.0.0.* will ban all IP addresses starting with 128.0.0

Parameters

  [in] | milliseconds | how many ms for a temporary ban. Use 0 for a permanent ban

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::AddToSecurityExceptionList | ( | const char * | ip | ) |

pure virtual

If secure connections are on, do not use secure connections for a specific IP address. This is useful if you have a fixed-address internal server behind a LAN.

Note
  Secure connections are determined by the recipient of an incoming connection. This has no effect if called on the system attempting to connect.

Parameters

  [in] | ip | IP address to add. * wildcards are supported.

Implemented in SLNet::RakPeer.

virtual bool SLNet::RakPeerInterface::AdvertiseSystem | ( | const char * | host,
|  | unsigned short | remotePort,
|  | const char * | data,
|  | int | dataLength,
|  | unsigned | connectionSocketIndex = `0`
| ) |  |

pure virtual

Sends a one byte message ID_ADVERTISE_SYSTEM to the remote unconnected system. This will tell the remote system our external IP outside the LAN along with some user data.

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

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 | Optional data to append to the packet.
  [in] | dataLength | length of data in bytes. Use 0 if no data.
  [in] | connectionSocketIndex | Index into the array of socket descriptors passed to socketDescriptors in RakPeer::Startup() to send on.

Returns
  false if IsActive()==false or the host is unresolvable. True otherwise

Implemented in SLNet::RakPeer.

virtual Packet* SLNet::RakPeerInterface::AllocatePacket | ( | unsigned | dataSize | ) |

pure virtual

Returns
  a packet for you to write to if you want to create a Packet for some reason. You can add it to the receive buffer with PushBackPacket

Parameters

  [in] | dataSize | How many bytes to allocate for the buffer

Returns
  A packet you can write to

Implemented in SLNet::RakPeer.

Referenced by SLNet::PluginInterface2::AllocatePacketUnified().

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

pure virtual

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

Parameters

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

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::ApplyNetworkSimulator | ( | float | packetloss,
|  | 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 packetloss value on each. You can exclude network simulator code with the _RELEASE #define to decrease code size

Deprecated:
  Use http://www.jenkinssoftware.com/forum/index.php?topic=1671.0 instead.

Note
  Doesn't work past version 3.6201

Parameters

  [in] | packetloss | Chance to lose a packet. Ranges from 0 to 1.
  [in] | minExtraPing | The minimum time to delay sends.
  [in] | extraPingVariance | The additional random time to delay sends.

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::AttachPlugin | ( | PluginInterface2 * | plugin | ) |

pure virtual

Attaches a Plugin interface to an instance of the base class (RakPeer or PacketizedTCP) to run code automatically on message receipt in the Receive call. If the plugin returns false from PluginInterface::UsesReliabilityLayer(), which is the case for all plugins except PacketLogger, you can call AttachPlugin() and DetachPlugin() for this plugin while RakPeer is active.

Parameters

  [in] | messageHandler | Pointer to the plugin to attach.

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::CancelConnectionAttempt | ( | const SystemAddress | target | ) |

pure virtual

Cancel a pending connection attempt If we are already connected, the connection stays open

Parameters

  [in] | target | Which system to cancel

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::ChangeSystemAddress | ( | RakNetGUID | guid,
|  | const SystemAddress & | systemAddress
| ) |  |

pure virtual

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::ClearBanList | ( | void |  | ) |

pure virtual

Allows all previously banned IPs to connect.

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::CloseConnection | ( | const AddressOrGUID | target,
|  | bool | sendDisconnectionNotification,
|  | unsigned char | orderingChannel = `0`,
|  | PacketPriority | disconnectionNotificationPriority = `LOW_PRIORITY`
| ) |  |

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

  [in] | target | Which system to close the connection to.
  [in] | sendDisconnectionNotification | True to send ID_DISCONNECTION_NOTIFICATION to the recipient. False to close it silently.
  [in] | channel | Which ordering channel to send the disconnection notification on, if any
  [in] | disconnectionNotificationPriority | Priority to send ID_DISCONNECTION_NOTIFICATION on.

Implemented in SLNet::RakPeer.

virtual ConnectionAttemptResult SLNet::RakPeerInterface::Connect | ( | const char * | host,
|  | unsigned short | remotePort,
|  | const char * | passwordData,
|  | int | passwordDataLength,
|  | PublicKey * | publicKey = `0`,
|  | unsigned | connectionSocketIndex = `0`,
|  | unsigned | sendConnectionAttemptCount = `12`,
|  | unsigned | timeBetweenSendConnectionAttemptsMS = `500`,
|  | SLNet::TimeMS | timeoutTime = `0`
| ) |  |

pure virtual

Connect to the specified host (ip or domain name) and server port. Calling Connect and not calling SetMaximumIncomingConnections acts as a dedicated client. Calling both acts as a true peer. This is a non-blocking connection. You know the connection is successful when GetConnectionState() returns IS_CONNECTED or Receive() gets a message with the type identifier ID_CONNECTION_REQUEST_ACCEPTED. If the connection is not successful, such as a rejected connection or no response then neither of these things will happen.

Precondition
  Requires that you first call Startup()

Parameters

  [in] | host | Either a dotted IP address or a domain name
  [in] | remotePort | Which port to connect to on the remote machine.
  [in] | passwordData | A data block that must match the data block on the server passed to SetIncomingPassword. This can be a string or can be a stream of data. Use 0 for no password.
  [in] | passwordDataLength | The length in bytes of passwordData
  [in] | publicKey | The public key the server is using. If 0, the server is not using security. If non-zero, the publicKeyMode member determines how to connect
  [in] | connectionSocketIndex | Index into the array of socket descriptors passed to socketDescriptors in RakPeer::Startup() to send on.
  [in] | sendConnectionAttemptCount | How many datagrams to send to the other system to try to connect.

  [in]

  timeBetweenSendConnectionAttemptsMS

  Time to elapse before a datagram is sent to the other system to try to connect. After sendConnectionAttemptCount number of attempts, ID_CONNECTION_ATTEMPT_FAILED is returned. Under low bandwidth conditions with multiple simultaneous outgoing connections, this value should be raised to 1000 or higher, or else the MTU detection can overrun the available bandwidth.

  [in] | timeoutTime | How long to keep the connection alive before dropping it on unable to send a reliable message. 0 to use the default from SetTimeoutTime(UNASSIGNED_SYSTEM_ADDRESS);

Returns
  CONNECTION_ATTEMPT_STARTED on successful initiation. Otherwise, an appropriate enumeration indicating failure.

Note
  CONNECTION_ATTEMPT_STARTED does not mean you are already connected!
  It is possible to immediately get back ID_CONNECTION_ATTEMPT_FAILED if you exceed the maxConnections parameter passed to Startup(). This could happen if you call CloseConnection() with sendDisconnectionNotificaiton true, then immediately call Connect() before the connection has closed.

Implemented in SLNet::RakPeer.

virtual ConnectionAttemptResult SLNet::RakPeerInterface::ConnectWithSocket | ( | const char * | host,
|  | unsigned short | remotePort,
|  | const char * | passwordData,
|  | int | passwordDataLength,
|  | RakNetSocket2 * | socket,
|  | PublicKey * | publicKey = `0`,
|  | unsigned | sendConnectionAttemptCount = `12`,
|  | unsigned | timeBetweenSendConnectionAttemptsMS = `500`,
|  | SLNet::TimeMS | timeoutTime = `0`
| ) |  |

pure virtual

Connect to the specified host (ip or domain name) and server port, using a shared socket from another instance of RakNet.

Parameters

  [in] | host | Either a dotted IP address or a domain name
  [in] | remotePort | Which port to connect to on the remote machine.
  [in] | passwordData | A data block that must match the data block on the server passed to SetIncomingPassword. This can be a string or can be a stream of data. Use 0 for no password.
  [in] | passwordDataLength | The length in bytes of passwordData
  [in] | socket | A bound socket returned by another instance of RakPeerInterface
  [in] | sendConnectionAttemptCount | How many datagrams to send to the other system to try to connect.

  [in]

  timeBetweenSendConnectionAttemptsMS

  Time to elapse before a datagram is sent to the other system to try to connect. After sendConnectionAttemptCount number of attempts, ID_CONNECTION_ATTEMPT_FAILED is returned. Under low bandwidth conditions with multiple simultaneous outgoing connections, this value should be raised to 1000 or higher, or else the MTU detection can overrun the available bandwidth.

  [in] | timeoutTime | How long to keep the connection alive before dropping it on unable to send a reliable message. 0 to use the default from SetTimeoutTime(UNASSIGNED_SYSTEM_ADDRESS);

Returns
  CONNECTION_ATTEMPT_STARTED on successful initiation. Otherwise, an appropriate enumeration indicating failure.

Note
  CONNECTION_ATTEMPT_STARTED does not mean you are already connected!

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::DeallocatePacket | ( | Packet * | packet | ) |

pure virtual

Call this to deallocate a message returned by Receive() when you are done handling it.

Parameters

  [in] | packet | The message to deallocate.

Implemented in SLNet::RakPeer.

Referenced by SLNet::PluginInterface2::DeallocPacketUnified().

virtual void SLNet::RakPeerInterface::DetachPlugin | ( | PluginInterface2 * | messageHandler | ) |

pure virtual

Detaches a Plugin interface from the instance of the base class (RakPeer or PacketizedTCP) it is attached to.

This method disables the plugin code from running automatically on base class's updates or message receipt. If the plugin returns false from PluginInterface::UsesReliabilityLayer(), which is the case for all plugins except PacketLogger, you can call AttachPlugin() and DetachPlugin() for this plugin while RakPeer is active.

Parameters

  [in] | messageHandler | Pointer to a plugin to detach.

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::DisableSecurity | ( | void |  | ) |

pure virtual

Disables security for incoming connections.

Note
  Must be called while offline

Implemented in SLNet::RakPeer.

uint64_t RakPeerInterface::Get64BitUniqueRandomNumber | ( | void |  | ) |

static

Get a random number (to generate a GUID)

Definition at line 4449 of file RakPeer.cpp.

References SLNet::GetTimeUS(), and RakSleep().

Referenced by SLNet::RakPeer::GenerateGUID(), and SLNet::NetworkIDManager::NetworkIDManager().

virtual int SLNet::RakPeerInterface::GetAveragePing | ( | const AddressOrGUID | systemIdentifier | ) |

pure virtual

Returns the average of all ping times read for the specific system or -1 if none read yet

Parameters

  [in] | systemAddress | Which system we are referring to

Returns
  The ping time for this system, or -1

Implemented in SLNet::RakPeer.

virtual bool SLNet::RakPeerInterface::GetClientPublicKeyFromSystemAddress | ( | const SystemAddress | input,
|  | char * | client_public_key
| ) |  | const

pure virtual

Given the SystemAddress of a connected system, get the public key they provided as an identity Returns false if system address was not found or client public key is not known

Parameters

  [in] | input | The RakNetGUID of the system
  [in] | client_public_key | The connected client's public key is copied to this address. Buffer must be cat::EasyHandshake::PUBLIC_KEY_BYTES bytes in length.

Implemented in SLNet::RakPeer.

virtual SLNet::Time SLNet::RakPeerInterface::GetClockDifferential | ( | const AddressOrGUID | systemIdentifier | ) |

pure virtual

Return the clock difference between your system and the specified system Subtract GetClockDifferential() from a time returned by the remote system to get that time relative to your own system Returns 0 if the system is unknown

Parameters

  [in] | systemIdentifier | Which system we are referring to

Implemented in SLNet::RakPeer.

virtual bool SLNet::RakPeerInterface::GetConnectionList | ( | SystemAddress * | remoteSystems,
|  | unsigned short * | numberOfSystems
| ) |  | const

pure virtual

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

Parameters

  [out] | remoteSystems | An array of SystemAddress structures to be filled with the SystemAddresss of the systems we are connected to. Pass 0 to remoteSystems to only get the number of systems we are connected to
  [in,out] | numberOfSystems | As input, the size of remoteSystems array. As output, the number of elements put into the array

Implemented in SLNet::RakPeer.

virtual ConnectionState SLNet::RakPeerInterface::GetConnectionState | ( | const AddressOrGUID | systemIdentifier | ) |

pure virtual

Returns if a system is connected, disconnected, connecting in progress, or various other states

Parameters

  [in] | systemIdentifier | The system we are referring to

Note
  This locks a mutex, do not call too frequently during connection attempts or the attempt will take longer and possibly even timeout

Returns
  What state the remote system is in

Implemented in SLNet::RakPeer.

virtual SystemAddress SLNet::RakPeerInterface::GetExternalID | ( | const SystemAddress | target | ) | const

pure virtual

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

Parameters

  [in] | target | Which remote system you are referring to for your external ID. Usually the same for all systems, unless you have two or more network cards.

Implemented in SLNet::RakPeer.

virtual RakNetGUID SLNet::RakPeerInterface::GetGUIDFromIndex | ( | unsigned int | index | ) |

pure virtual

Same as GetSystemAddressFromIndex but returns RakNetGUID

Parameters

  [in] | index | Index should range between 0 and the maximum number of players allowed - 1.

Returns
  The RakNetGUID

Implemented in SLNet::RakPeer.

virtual const RakNetGUID& SLNet::RakPeerInterface::GetGuidFromSystemAddress | ( | const SystemAddress | input | ) | const

pure virtual

Given a connected system, give us the unique GUID representing that instance of RakPeer. This will be the same on all systems connected to that instance of RakPeer, even if the external system addresses are different Currently O(log(n)), but this may be improved in the future. If you use this frequently, you may want to cache the value as it won't change. Returns UNASSIGNED_RAKNET_GUID if system address can't be found. If input is UNASSIGNED_SYSTEM_ADDRESS, will return your own GUID

Precondition
  Call Startup() first, or the function will return UNASSIGNED_RAKNET_GUID

Parameters

  [in] | input | The system address of the system we are connected to

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::GetIncomingPassword | ( | char * | passwordData,
|  | int * | passwordDataLength
| ) |  |

pure virtual

Gets the password passed to SetIncomingPassword

Parameters

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

Implemented in SLNet::RakPeer.

virtual int SLNet::RakPeerInterface::GetIndexFromSystemAddress | ( | const SystemAddress | systemAddress | ) | const

pure virtual

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

Parameters

  [in] | systemAddress | The SystemAddress we are referring to

Returns
  The index of this SystemAddress or -1 on system not found.

Implemented in SLNet::RakPeer.

virtual SystemAddress SLNet::RakPeerInterface::GetInternalID | ( | const SystemAddress | systemAddress = `UNASSIGNED_SYSTEM_ADDRESS`,
|  | const int | index = `0`
| ) |  | const

pure virtual

Return the unique address identifier that represents you or another system on the the network and is based on your local IP / port.

Note
  Not supported by the XBOX

Parameters

  [in] | systemAddress | Use UNASSIGNED_SYSTEM_ADDRESS to get your behind-LAN address. Use a connected system to get their behind-LAN address
  [in] | index | When you have multiple internal IDs, which index to return? Currently limited to MAXIMUM_NUMBER_OF_INTERNAL_IDS (so the maximum value of this variable is MAXIMUM_NUMBER_OF_INTERNAL_IDS-1)

Returns
  the identifier of your system internally, which may not be how other systems see if you if you are behind a NAT or proxy

Implemented in SLNet::RakPeer.

virtual int SLNet::RakPeerInterface::GetLastPing | ( | const AddressOrGUID | systemIdentifier | ) | const

pure virtual

Returns the last ping time read for the specific system or -1 if none read yet

Parameters

  [in] | systemAddress | Which system we are referring to

Returns
  The last ping time for this system, or -1

Implemented in SLNet::RakPeer.

virtual const char* SLNet::RakPeerInterface::GetLocalIP | ( | unsigned int | index | ) |

pure virtual

Returns an IP address at index 0 to GetNumberOfAddresses-1

Parameters

  [in] | index | index into the list of IP addresses

Returns
  The local IP address at this index

Implemented in SLNet::RakPeer.

virtual int SLNet::RakPeerInterface::GetLowestPing | ( | const AddressOrGUID | systemIdentifier | ) | const

pure virtual

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

Parameters

  [in] | systemAddress | Which system we are referring to

Returns
  The lowest ping time for this system, or -1

Implemented in SLNet::RakPeer.

virtual unsigned int SLNet::RakPeerInterface::GetMaximumIncomingConnections | ( | void |  | ) | const

pure virtual

Returns the value passed to SetMaximumIncomingConnections()

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

Implemented in SLNet::RakPeer.

virtual unsigned int SLNet::RakPeerInterface::GetMaximumNumberOfPeers | ( | void |  | ) | const

pure virtual

Return the total number of connections we are allowed.

Implemented in SLNet::RakPeer.

virtual int SLNet::RakPeerInterface::GetMTUSize | ( | const SystemAddress | target | ) | const

pure virtual

Returns the current MTU size

Parameters

  [in] | target | Which system to get this for. UNASSIGNED_SYSTEM_ADDRESS to get the default

Returns
  The current MTU size

Implemented in SLNet::RakPeer.

virtual SystemAddress SLNet::RakPeerInterface::GetMyBoundAddress | ( | const int | socketIndex = `0` | ) |

pure virtual

Return the address bound to a socket at the specified index.

Implemented in SLNet::RakPeer.

virtual const RakNetGUID SLNet::RakPeerInterface::GetMyGUID | ( | void |  | ) | const

pure virtual

Return my own GUID.

Implemented in SLNet::RakPeer.

Referenced by SLNet::PluginInterface2::GetMyGUIDUnified().

virtual uint32_t SLNet::RakPeerInterface::GetNextSendReceipt | ( | void |  | ) |

pure virtual

Returns the next uint32_t that Send() will return

Note
  If using RakPeer from multiple threads, this may not be accurate for your thread. Use IncrementNextSendReceipt() in that case.

Returns
  The next uint32_t that Send() or SendList will return

Implemented in SLNet::RakPeer.

virtual unsigned SLNet::RakPeerInterface::GetNumberOfAddresses | ( | void |  | ) |

pure virtual

Returns the number of IP addresses this system has internally. Get the actual addresses from GetLocalIP()

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::GetOfflinePingResponse | ( | char ** | data,
|  | unsigned int * | length
| ) |  |

pure virtual

Returns pointers to a copy of the data passed to SetOfflinePingResponse

Parameters

  [out] | data | A pointer to a copy of the data passed to SetOfflinePingResponse()
  [out] | length | A pointer filled in with the length parameter passed to SetOfflinePingResponse()

See Also
  SetOfflinePingResponse

Implemented in SLNet::RakPeer.

virtual unsigned int SLNet::RakPeerInterface::GetReceiveBufferSize | ( | void |  | ) |

pure virtual

how many messages are waiting when you call Receive()

Implemented in SLNet::RakPeer.

virtual RakNetSocket2* SLNet::RakPeerInterface::GetSocket | ( | const SystemAddress | target | ) |

pure virtual

Get the socket used with a particular active connection The smart pointer reference counts the RakNetSocket2 object, so the socket will remain active as long as the smart pointer does, even if RakNet were to shutdown or close the connection.

Note
  This sends a query to the thread and blocks on the return value for up to one second. In practice it should only take a millisecond or so.

Parameters

  [in] | target | Which system

Returns
  A smart pointer object containing the socket information about the socket. Be sure to check IsNull() which is returned if the update thread is unresponsive, shutting down, or if this system is not connected

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::GetSockets | ( | DataStructures::List< RakNetSocket2 * > & | sockets | ) |

pure virtual

Get all sockets in use

Note
  This sends a query to the thread and blocks on the return value for up to one second. In practice it should only take a millisecond or so.

Parameters

  [out] | sockets | List of RakNetSocket2 structures in use. Sockets will not be closed until sockets goes out of scope

Implemented in SLNet::RakPeer.

virtual int SLNet::RakPeerInterface::GetSplitMessageProgressInterval | ( | void |  | ) | const

pure virtual

Returns what was passed to SetSplitMessageProgressInterval()

Returns
  What was passed to SetSplitMessageProgressInterval(). Default to 0.

Implemented in SLNet::RakPeer.

virtual RakNetStatistics* SLNet::RakPeerInterface::GetStatistics | ( | const SystemAddress | systemAddress,
|  | RakNetStatistics * | rns = `0`
| ) |  |

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] | systemAddress,: | Which connected system to get statistics for
  [in] | rns | If you supply this structure, it will be written to it. Otherwise it will use a static struct, which is not threadsafe

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

See Also
  statistics.h

Implemented in SLNet::RakPeer.

virtual bool SLNet::RakPeerInterface::GetStatistics | ( | const unsigned int | index,
|  | RakNetStatistics * | rns
| ) |  |

pure virtual

Returns the network statistics of the system at the given index in the remoteSystemList.

Returns
  True if the index is less than the maximum number of peers allowed and the system is active. False otherwise.

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::GetStatisticsList | ( | DataStructures::List< SystemAddress > & | addresses,
|  | DataStructures::List< RakNetGUID > & | guids,
|  | DataStructures::List< RakNetStatistics > & | statistics
| ) |  |

pure virtual

Returns the list of systems, and statistics for each of those systems Each system has one entry in each of the lists, in the same order.

Parameters

  [out] | addresses | SystemAddress for each connected system
  [out] | guids | RakNetGUID for each connected system
  [out] | statistics | Calculated RakNetStatistics for each connected system

Implemented in SLNet::RakPeer.

virtual SystemAddress SLNet::RakPeerInterface::GetSystemAddressFromGuid | ( | const RakNetGUID | input | ) | const

pure virtual

Given the GUID of a connected system, give us the system address of that system. The GUID will be the same on all systems connected to that instance of RakPeer, even if the external system addresses are different Currently O(log(n)), but this may be improved in the future. If you use this frequently, you may want to cache the value as it won't change. If input is UNASSIGNED_RAKNET_GUID, will return UNASSIGNED_SYSTEM_ADDRESS

Parameters

  [in] | input | The RakNetGUID of the system we are checking to see if we are connected to

Implemented in SLNet::RakPeer.

virtual SystemAddress SLNet::RakPeerInterface::GetSystemAddressFromIndex | ( | unsigned int | index | ) |

pure virtual

This function is only useful for looping through all systems Given an index, will return a SystemAddress.

Parameters

  [in] | index | Index should range between 0 and the maximum number of players allowed - 1.

Returns
  The SystemAddress

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::GetSystemList | ( | DataStructures::List< SystemAddress > & | addresses,
|  | DataStructures::List< RakNetGUID > & | guids
| ) |  | const

pure virtual

Same as calling GetSystemAddressFromIndex and GetGUIDFromIndex for all systems, but more efficient Indices match each other, so addresses[0] and guids[0] refer to the same system

Parameters

  [out] | addresses | All system addresses. Size of the list is the number of connections. Size of the list will match the size of the guids list.
  [out] | guids | All guids. Size of the list is the number of connections. Size of the list will match the size of the addresses list.

Implemented in SLNet::RakPeer.

virtual SLNet::TimeMS SLNet::RakPeerInterface::GetTimeoutTime | ( | const SystemAddress | target | ) |

pure virtual

Parameters

  [in] | target | Which system to do this for. Pass UNASSIGNED_SYSTEM_ADDRESS to get the default value

Returns
  timeoutTime for a given system.

Implemented in SLNet::RakPeer.

virtual uint32_t SLNet::RakPeerInterface::IncrementNextSendReceipt | ( | void |  | ) |

pure virtual

Returns the next uint32_t that Send() will return, and increments the value by one

Note
  If using RakPeer from multiple threads, pass this to forceReceipt in the send function

Returns
  The next uint32_t that Send() or SendList will return

Implemented in SLNet::RakPeer.

virtual bool SLNet::RakPeerInterface::InitializeSecurity | ( | const char * | publicKey,
|  | const char * | privateKey,
|  | bool | bRequireClientKey = `false`
| ) |  |

pure virtual

If you accept connections, you must call this or else security will not be enabled for incoming connections. This feature requires more round trips, bandwidth, and CPU time for the connection handshake x64 builds require under 25% of the CPU time of other builds See the Encryption sample for example usage

Precondition
  Must be called while offline
  LIBCAT_SECURITY must be defined to 1 in NativeFeatureIncludes.h for this function to have any effect

Parameters

  [in] | publicKey | A pointer to the public key for accepting new connections
  [in] | privateKey | A pointer to the private key for accepting new connections
  [in] | bRequireClientKey,: | Should be set to false for most servers. Allows the server to accept a public key from connecting clients as a proof of identity but eats twice as much CPU time as a normal connection

Implemented in SLNet::RakPeer.

virtual bool SLNet::RakPeerInterface::IsActive | ( | void |  | ) | const

pure virtual

Returns if the network thread is running

Returns
  true if the network thread is running, false otherwise

Implemented in SLNet::RakPeer.

virtual bool SLNet::RakPeerInterface::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 SLNet::RakPeer.

virtual bool SLNet::RakPeerInterface::IsInSecurityExceptionList | ( | const char * | ip | ) |

pure virtual

Checks to see if a given IP is in the security exception list

Parameters

  [in] | IP | address to check.

Implemented in SLNet::RakPeer.

virtual bool SLNet::RakPeerInterface::IsLocalIP | ( | const char * | ip | ) |

pure virtual

Is this a local IP?

Parameters

  [in] | An | IP address to check, excluding the port

Returns
  True if this is one of the IP addresses returned by GetLocalIP

Implemented in SLNet::RakPeer.

virtual bool SLNet::RakPeerInterface::IsNetworkSimulatorActive | ( | void |  | ) |

pure virtual

Returns if you previously called ApplyNetworkSimulator

Returns
  If you previously called ApplyNetworkSimulator

Implemented in SLNet::RakPeer.

virtual unsigned short SLNet::RakPeerInterface::NumberOfConnections | ( | void |  | ) | const

pure virtual

Returns how many open connections there are at this time

Returns
  the number of open connections

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::Ping | ( | const SystemAddress | target | ) |

pure virtual

Send a ping to the specified connected system.

Precondition
  The sender and recipient must already be started via a successful call to Startup()

Parameters

  [in] | target | Which system to ping

Implemented in SLNet::RakPeer.

virtual bool SLNet::RakPeerInterface::Ping | ( | const char * | host,
|  | unsigned short | remotePort,
|  | bool | onlyReplyOnAcceptingConnections,
|  | unsigned | connectionSocketIndex = `0`
| ) |  |

pure virtual

Send a ping to the specified unconnected system. The remote system, if it is Initialized, will respond with ID_PONG followed by sizeof(SLNet::TimeMS) containing the system time the ping was sent.(Default is 4 bytes - See __GET_TIME_64BIT in types.h System should reply with ID_PONG if it is active

Parameters

  [in] | host | Either a dotted IP address or a domain name. Can be 255.255.255.255 for LAN broadcast.
  [in] | remotePort | Which port to connect to on the remote machine.
  [in] | onlyReplyOnAcceptingConnections | Only request a reply if the remote system is accepting connections
  [in] | connectionSocketIndex | Index into the array of socket descriptors passed to socketDescriptors in RakPeer::Startup() to send on.

Returns
  true on success, false on failure (unknown hostname)

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::PushBackPacket | ( | Packet * | packet,
|  | bool | pushAtHead
| ) |  |

pure virtual

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

Parameters

  [in] | packet | The packet you want to push back.
  [in] | pushAtHead | True to push the packet so that the next receive call returns it. False to push it at the end of the queue (obviously pushing it at the end makes the packets out of order)

Implemented in SLNet::RakPeer.

Referenced by SLNet::PluginInterface2::PushBackPacketUnified().

virtual Packet* SLNet::RakPeerInterface::Receive | ( | void |  | ) |

pure virtual

Gets a message from the incoming message queue. Use DeallocatePacket() to deallocate the message after you are done with it. User-thread functions, such as RPC calls and the plugin function PluginInterface::Update occur here.

Returns
  0 if no packets are waiting to be handled, otherwise a pointer to a packet.

Note
  COMMON MISTAKE: Be sure to call this in a loop, once per game tick, until it returns 0. If you only process one packet per game tick they will buffer up. sa types.h contains struct Packet

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::ReleaseSockets | ( | DataStructures::List< RakNetSocket2 * > & | sockets | ) |

pure virtual

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::RemoveFromBanList | ( | const char * | IP | ) |

pure virtual

Allows a previously banned IP to connect. param[in] Dotted IP address. Can use * as a wildcard, such as 128.0.0.* will banAll IP addresses starting with 128.0.0

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::RemoveFromSecurityExceptionList | ( | const char * | ip | ) |

pure virtual

Remove a specific connection previously added via AddToSecurityExceptionList

Parameters

  [in] | ip | IP address to remove. Pass 0 to remove all IP addresses. * wildcards are supported.

Implemented in SLNet::RakPeer.

virtual bool SLNet::RakPeerInterface::RunUpdateCycle | ( | BitStream & | updateBitStream | ) |

pure virtual

Implemented in SLNet::RakPeer.

virtual uint32_t SLNet::RakPeerInterface::Send | ( | const char * | data,
|  | const int | length,
|  | PacketPriority | priority,
|  | PacketReliability | reliability,
|  | char | orderingChannel,
|  | const AddressOrGUID | systemIdentifier,
|  | bool | broadcast,
|  | uint32_t | forceReceiptNumber = `0`
| ) |  |

pure virtual

Sends a block of data to the specified system that you are connected to. This function only works while connected The first byte should be a message identifier starting at ID_USER_PACKET_ENUM

Parameters

  [in] | data | The block of data to send
  [in] | length | The size in bytes of the data to send
  [in] | priority | What priority level to send on. See PacketPriority.h
  [in] | reliability | How reliability to send this data. See PacketPriority.h
  [in] | orderingChannel | When using ordered or sequenced messages, what channel to order these on. Messages are only ordered relative to other messages on the same stream
  [in] | systemIdentifier | Who to send this packet to, or in the case of broadcasting who not to send it to. Pass either a SystemAddress structure or a RakNetGUID structure. Use UNASSIGNED_SYSTEM_ADDRESS or to specify none
  [in] | broadcast | True to send this packet to all connected systems. If true, then systemAddress specifies who not to send the packet to.
  [in] | forceReceipt | If 0, will automatically determine the receipt number to return. If non-zero, will return what you give it.

Returns
  0 on bad input. Otherwise a number that identifies this message. If reliability is a type that returns a receipt, on a later call to Receive() you will get ID_SND_RECEIPT_ACKED or ID_SND_RECEIPT_LOSS with bytes 1-4 inclusive containing this number

Implemented in SLNet::RakPeer.

Referenced by SLNet::PluginInterface2::SendUnified().

virtual uint32_t SLNet::RakPeerInterface::Send | ( | const SLNet::BitStream * | bitStream,
|  | PacketPriority | priority,
|  | PacketReliability | reliability,
|  | char | orderingChannel,
|  | const AddressOrGUID | systemIdentifier,
|  | bool | broadcast,
|  | uint32_t | forceReceiptNumber = `0`
| ) |  |

pure virtual

Sends a block of data to the specified system that you are connected to. Same as the above version, but takes a BitStream as input.

Parameters

  [in] | bitStream | The bitstream to send
  [in] | priority | What priority level to send on. See PacketPriority.h
  [in] | reliability | How reliability to send this data. See PacketPriority.h
  [in] | orderingChannel | When using ordered or sequenced messages, what channel to order these on. Messages are only ordered relative to other messages on the same stream
  [in] | systemIdentifier | Who to send this packet to, or in the case of broadcasting who not to send it to. Pass either a SystemAddress structure or a RakNetGUID structure. Use UNASSIGNED_SYSTEM_ADDRESS or to specify none
  [in] | broadcast | True to send this packet to all connected systems. If true, then systemAddress specifies who not to send the packet to.
  [in] | forceReceipt | If 0, will automatically determine the receipt number to return. If non-zero, will return what you give it.

Returns
  0 on bad input. Otherwise a number that identifies this message. If reliability is a type that returns a receipt, on a later call to Receive() you will get ID_SND_RECEIPT_ACKED or ID_SND_RECEIPT_LOSS with bytes 1-4 inclusive containing this number

Note
  COMMON MISTAKE: When writing the first byte, bitStream->Write((unsigned char) ID_MY_TYPE) be sure it is casted to a byte, and you are not writing a 4 byte enumeration.

Implemented in SLNet::RakPeer.

virtual uint32_t SLNet::RakPeerInterface::SendList | ( | const char ** | data,
|  | const int * | lengths,
|  | const int | numParameters,
|  | PacketPriority | priority,
|  | PacketReliability | reliability,
|  | char | orderingChannel,
|  | const AddressOrGUID | systemIdentifier,
|  | bool | broadcast,
|  | uint32_t | forceReceiptNumber = `0`
| ) |  |

pure virtual

Sends multiple blocks of data, concatenating them automatically.

This is equivalent to: SLNet::BitStream bs; bs.WriteAlignedBytes(block1, blockLength1); bs.WriteAlignedBytes(block2, blockLength2); bs.WriteAlignedBytes(block3, blockLength3); Send(&bs, ...)

This function only works while connected

Parameters

  [in] | data | An array of pointers to blocks of data
  [in] | lengths | An array of integers indicating the length of each block of data
  [in] | numParameters | Length of the arrays data and lengths
  [in] | priority | What priority level to send on. See PacketPriority.h
  [in] | reliability | How reliability to send this data. See PacketPriority.h
  [in] | orderingChannel | When using ordered or sequenced messages, what channel to order these on. Messages are only ordered relative to other messages on the same stream
  [in] | systemIdentifier | Who to send this packet to, or in the case of broadcasting who not to send it to. Pass either a SystemAddress structure or a RakNetGUID structure. Use UNASSIGNED_SYSTEM_ADDRESS or to specify none
  [in] | broadcast | True to send this packet to all connected systems. If true, then systemAddress specifies who not to send the packet to.
  [in] | forceReceipt | If 0, will automatically determine the receipt number to return. If non-zero, will return what you give it.

Returns
  0 on bad input. Otherwise a number that identifies this message. If reliability is a type that returns a receipt, on a later call to Receive() you will get ID_SND_RECEIPT_ACKED or ID_SND_RECEIPT_LOSS with bytes 1-4 inclusive containing this number

Implemented in SLNet::RakPeer.

Referenced by SLNet::PluginInterface2::SendListUnified().

virtual void SLNet::RakPeerInterface::SendLoopback | ( | const char * | data,
|  | const int | length
| ) |  |

pure virtual

"Send" to yourself rather than a remote system. The message will be processed through the plugins and returned to the game as usual This function works anytime The first byte should be a message identifier starting at ID_USER_PACKET_ENUM

Parameters

  [in] | data | The block of data to send
  [in] | length | The size in bytes of the data to send

Implemented in SLNet::RakPeer.

virtual bool SLNet::RakPeerInterface::SendOutOfBand | ( | const char * | host,
|  | unsigned short | remotePort,
|  | const char * | data,
|  | BitSize_t | dataLength,
|  | unsigned | connectionSocketIndex = `0`
| ) |  |

pure virtual

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::SendTTL | ( | const char * | host,
|  | unsigned short | remotePort,
|  | int | ttl,
|  | unsigned | connectionSocketIndex = `0`
| ) |  |

pure virtual

Send a message to host, with the IP socket option TTL set to 3 This message will not reach the host, but will open the router. Used for NAT-Punchthrough

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::SetIncomingDatagramEventHandler | ( | bool(*)(RNS2RecvStruct *) | _incomingDatagramEventHandler | ) |

pure virtual

Set a C callback to be called whenever a datagram arrives Return true from the callback to have RakPeer handle the datagram. Return false and RakPeer will ignore the datagram. This can be used to filter incoming datagrams by system, or to share a recvfrom socket with RakPeer RNS2RecvStruct will only remain valid for the duration of the call If the incoming datagram is not from your game at all, it is a RakNet packet. If the incoming datagram has an IP address that matches a known address from your game, then check the first byte of data. For RakNet connected systems, the first bit is always 1. So for your own game packets, make sure the first bit is always 0.

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::SetIncomingPassword | ( | const char * | passwordData,
|  | int | passwordDataLength
| ) |  |

pure virtual

Sets the password incoming connections must match in the call to Connect (defaults to none). Pass 0 to passwordData to specify no password This is a way to set a low level password for all incoming connections. To selectively reject connections, implement your own scheme using CloseConnection() to remove unwanted connections

Parameters

  [in] | passwordData | A data block that incoming connections must match. This can be just a password, or can be a stream of data. Specify 0 for no password data
  [in] | passwordDataLength | The length in bytes of passwordData

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::SetInternalID | ( | SystemAddress | systemAddress,
|  | int | index = `0`
| ) |  |

pure virtual

Sets your internal IP address, for platforms that do not support reading it, or to override a value.

Parameters

  [in] | systemAddress. | The address to set. Use SystemAddress::FromString() if you want to use a dotted string
  [in] | index | When you have multiple internal IDs, which index to set?

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::SetLimitIPConnectionFrequency | ( | bool | b | ) |

pure virtual

Enable or disable allowing frequent connections from the same IP adderss This is a security measure which is disabled by default, but can be set to true to prevent attackers from using up all connection slots

Parameters

  [in] | b | True to limit connections from the same ip to at most 1 per 100 milliseconds.

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::SetMaximumIncomingConnections | ( | unsigned short | numberAllowed | ) |

pure virtual

Sets how many incoming connections are allowed. If this is less than the number of players currently connected, no more players will be allowed to connect. If this is greater than the maximum number of peers allowed, it will be reduced to the maximum number of peers allowed. Defaults to 0, meaning by default, nobody can connect to you

Parameters

  [in] | numberAllowed | Maximum number of incoming connections allowed.

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::SetOccasionalPing | ( | bool | doPing | ) |

pure virtual

Ping the remote systems every so often, or not. Can be called anytime. By default this is true. Recommended to leave on, because congestion control uses it to determine how often to resend lost packets. It would be true by default to prevent timestamp drift, since in the event of a clock spike, the timestamp deltas would no longer be accurate

Parameters

  [in] | doPing | True to start occasional pings. False to stop them.

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::SetOfflinePingResponse | ( | const char * | data,
|  | const unsigned int | length
| ) |  |

pure virtual

Sets the data to send along with a LAN server discovery or offline ping reply. length should be under 400 bytes, as a security measure against flood attacks

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 SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::SetPerConnectionOutgoingBandwidthLimit | ( | unsigned | maxBitsPerSecond | ) |

pure virtual

Limits how much outgoing bandwidth can be sent per-connection. This limit does not apply to the sum of all connections! Exceeding the limit queues up outgoing traffic

Parameters

  [in] | maxBitsPerSecond | Maximum bits per second to send. Use 0 for unlimited (default). Once set, it takes effect immedately and persists until called again.

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::SetSplitMessageProgressInterval | ( | int | interval | ) |

pure virtual

Controls how often to return ID_DOWNLOAD_PROGRESS for large message downloads. ID_DOWNLOAD_PROGRESS is returned to indicate a new partial message chunk, roughly the MTU size, has arrived As it can be slow or cumbersome to get this notification for every chunk, you can set the interval at which it is returned. Defaults to 0 (never return this notification)

Parameters

  [in] | interval | How many messages to use as an interval

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::SetTimeoutTime | ( | SLNet::TimeMS | timeMS,
|  | const SystemAddress | target
| ) |  |

pure virtual

Set the time, in MS, to use before considering ourselves disconnected after not being able to deliver a reliable message. Default time is 10,000 or 10 seconds in release and 30,000 or 30 seconds in debug. Do not set different values for different computers that are connected to each other, or you won't be able to reconnect after ID_CONNECTION_LOST

Parameters

  [in] | timeMS | Time, in MS
  [in] | target | Which system to do this for. Pass UNASSIGNED_SYSTEM_ADDRESS for all systems.

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::SetUnreliableTimeout | ( | SLNet::TimeMS | timeoutMS | ) |

pure virtual

Set how long to wait before giving up on sending an unreliable message Useful if the network is clogged up. Set to 0 or less to never timeout. Defaults to 0.

Parameters

  [in] | timeoutMS | How many ms to wait before simply not sending an unreliable message.

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::SetUserUpdateThread | ( | void(*)(RakPeerInterface *, void *) | _userUpdateThreadPtr,
|  | void * | _userUpdateThreadData
| ) |  |

pure virtual

If you need code to run in the same thread as RakNet's update thread, this function can be used for that

Parameters

  [in] | _userUpdateThreadPtr | C callback function
  [in] | _userUpdateThreadData | Passed to C callback function

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::Shutdown | ( | unsigned int | blockDuration,
|  | unsigned char | orderingChannel = `0`,
|  | PacketPriority | disconnectionNotificationPriority = `LOW_PRIORITY`
| ) |  |

pure virtual

Connect to the specified network ID (Platform specific console function)

Does built-in NAt traversal

Parameters

  [in] | passwordData | A data block that must match the data block on the server passed to SetIncomingPassword. This can be a string or can be a stream of data. Use 0 for no password.
  [in] | passwordDataLength | The length in bytes of passwordData Stops the network threads and closes all connections.
  [in] | blockDuration | How long, in milliseconds, you should wait for all remaining messages to go out, including ID_DISCONNECTION_NOTIFICATION. If 0, it doesn't wait at all.
  [in] | orderingChannel | If blockDuration > 0, ID_DISCONNECTION_NOTIFICATION will be sent on this channel
  [in] | disconnectionNotificationPriority | Priority to send ID_DISCONNECTION_NOTIFICATION on. If you set it to 0 then the disconnection notification won't be sent

Implemented in SLNet::RakPeer.

virtual StartupResult SLNet::RakPeerInterface::Startup | ( | unsigned int | maxConnections,
|  | SocketDescriptor * | socketDescriptors,
|  | unsigned | socketDescriptorCount,
|  | int | threadPriority = `-99999`
| ) |  |

pure virtual

Starts the network threads, opens the listen port.

You must call this before calling Connect().

Precondition
  On the PS3, call Startup() after Client_Login()
  On Android, add the necessary permission to your application's androidmanifest.xml: <uses-permission android:name="android.permission.INTERNET" /> Multiple calls while already active are ignored. To call this function again with different settings, you must first call Shutdown().

Note
  Call SetMaximumIncomingConnections if you want to accept incoming connections

Parameters

  [in] | maxConnections | The maximum number of connections between this instance of RakPeer and another instance of RakPeer. Required so the network can preallocate and for thread safety. A pure client would set this to 1. A pure server would set it to the number of allowed clients.- A hybrid would set it to the sum of both types of connections
  [in] | localPort | The port to listen for connections on. On linux the system may be set up so thast ports under 1024 are restricted for everything but the root user. Use a higher port for maximum compatibility.

  [in]

  socketDescriptors

  An array of SocketDescriptor structures to force RakNet to listen on a particular IP address or port (or both). Each SocketDescriptor will represent one unique socket. Do not pass redundant structures. To listen on a specific port, you can pass SocketDescriptor(myPort,0); such as for a server. For a client, it is usually OK to just pass SocketDescriptor(); However, on the XBOX be sure to use IPPROTO_VDP

  [in] | socketDescriptorCount | The size of the socketDescriptors array. Pass 1 if you are not sure what to pass.
  [in] | threadPriority | Passed to the thread creation routine. Use THREAD_PRIORITY_NORMAL for Windows. For Linux based systems, you MUST pass something reasonable based on the thread priorities for your application.

Returns
  RAKNET_STARTED on success, otherwise appropriate failure enumeration.

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::WriteOutOfBandHeader | ( | SLNet::BitStream * | bitStream | ) |

pure virtual

Implemented in SLNet::RakPeer.

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

- Source/include/slikenet/peerinterface.h
- Source/src/RakPeer.cpp