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

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

# RakNetTransport Class Reference

Use RakNetTransport if you need a secure connection between the client and the console server. RakNetTransport automatically initializes security for the system. Use the project CommandConsoleClient to connect To the ConsoleServer if you use RakNetTransport. More...

`#include <RakNetTransport.h>`

Inheritance diagram for RakNetTransport:

List of all members.

## Public Member Functions
bool | Start (unsigned short port, bool serverMode)
void | Stop (void)
| Stop the transport provider. You can clear memory and shutdown threads here.
void | Send (PlayerID playerId, const char *data,...)
Packet * | Receive (void)
void | DeallocatePacket (Packet *packet)
void | CloseConnection (PlayerID playerId)
PlayerID | HasNewConnection (void)
PlayerID | HasLostConnection (void)
void | SetIncomingPassword (const char *password)
char * | GetIncomingPassword (void)
CommandParserInterface * | GetCommandParser (void)
| Returns RakNetTransportCommandParser so the console admin can change the password.
## Protected Member Functions
void | AutoAllocate (void)
## Protected Attributes
RakPeerInterface * | rakPeer
DataStructures::Queue< PlayerID > | newConnections
DataStructures::Queue< PlayerID > | lostConnections
RakNetTransportCommandParser | rakNetTransportCommandParser

## Detailed Description

Use RakNetTransport if you need a secure connection between the client and the console server. RakNetTransport automatically initializes security for the system. Use the project CommandConsoleClient to connect To the ConsoleServer if you use RakNetTransport.

## Member Function Documentation

void RakNetTransport::CloseConnection | ( | PlayerID | playerId | ) | `[virtual]`

  | Disconnect playerId . The binary address and port defines the PlayerID structure. Parameters:
  `[in]` | playerId | The player/address to disconnect
Implements TransportInterface.

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

  | Deallocate the Packet structure returned by Receive Parameters:
  `[in]` | The | packet to deallocate
Implements TransportInterface.

char * RakNetTransport::GetIncomingPassword | ( | void |  | ) |

| Returns the password set by SetIncomingPassword(). Returns: The password set by SetIncomingPassword()

PlayerID RakNetTransport::HasLostConnection | ( | void |  | ) | `[virtual]`

| If a system loses the connection, you should queue that event and return the playerId/address of that player in this function. Returns: The PlayerID/address of the system Implements TransportInterface.

PlayerID RakNetTransport::HasNewConnection | ( | void |  | ) | `[virtual]`

| If a new system connects to you, you should queue that event and return the playerId/address of that player in this function. Returns: The PlayerID/address of the system Implements TransportInterface.

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

| Return a string. The string should be allocated and written to Packet::data . The byte length should be written to Packet::length . The player/address should be written to Packet::playerid If your transport protocol adds special formatting to the data stream you should parse it out before returning it in the packet and thus only return a string in Packet::data Returns: The packet structure containing the result of Receive, or 0 if no data is available Implements TransportInterface.

void RakNetTransport::Send | ( | PlayerID | playerId,
|  | const char * | data,
|  |  | ...
| ) | `[virtual]`

  | Send a null-terminated string to playerId If your transport method requires particular formatting of the outgoing data (e.g. you don't just send strings) you can do it here and parse it out in Receive(). Parameters:
  `[in]` | playerId | The player to send the string to
  `[in]` | data | format specifier - same as printf
  `[in]` | ... | format specification arguments - same as printf
Implements TransportInterface.

void RakNetTransport::SetIncomingPassword | ( | const char * | password | ) |

  | Sets the password which incoming connections must match. While not required, it is highly recommended you set this in a real game environment or anyone can login and control your server. Don't set it to a fixed value, but instead require that the server admin sets it when you start the application server Parameters:
  `[in]` | password | Null-terminated string to use as a password.

bool RakNetTransport::Start | ( | unsigned short | port,
|  | bool | serverMode
| ) | `[virtual]`

  | Start the transport provider on the indicated port. Parameters:
  `[in]` | port | The port to start the transport provider on
  `[in]` | serverMode | If true, you should allow incoming connections (I don't actually use this anywhere)
Returns: Return true on success, false on failure. Implements TransportInterface.

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

- C:/RakNet 2.518/Include/RakNetTransport.h
- C:/RakNet 2.518/Source/RakNetTransport.cpp