# RakNet::Lobby2Client Class Reference

`#include <Lobby2Client.h>`

Inheritance diagram for RakNet::Lobby2Client:

List of all members.

## Public Member Functions
void | SetServerAddress (SystemAddress addr)
| Set the address of the server. When you call SendMsg() the packet will be sent to this address.
virtual void | SendMsg (Lobby2Message *msg)
## Protected Member Functions
PluginReceiveResult | OnReceive (RakPeerInterface *peer, Packet *packet)
void | OnCloseConnection (RakPeerInterface *peer, SystemAddress systemAddress)
void | OnShutdown (RakPeerInterface *peer)

## Detailed Description

The lobby system works by sending implementations of Lobby2Message from Lobby2Client to Lobby2Server, and getting the results via Lobby2Client::SetCallbackInterface() The client itself is a thin shell that does little more than call Serialize on the messages. To use: 1. Call Lobby2Client::SetServerAddress() after connecting to the system running Lobby2Server. 2. Instantiate an instance of RakNet::Lobby2MessageFactory and register it with RakNet::Lobby2Plugin::SetMessageFactory() (the base class of Lobby2Client) 3. Call messageFactory.Alloc(command); where command is one of the Lobby2MessageID enumerations. 4. Instantiate a (probably derived) instance of Lobby2Callbacks and register it with Lobby2Client::SetCallbackInterface() 5. Cast the returned structure, fill in the input parameters, and call Lobby2Client::SendMsg() to send this command to the server. 6. Wait for the result of the operation to be sent to your callback. The message will contain the original input parameters, possibly output parameters, and Lobby2Message::resultCode will be filled in.

## Member Function Documentation

void Lobby2Client::OnCloseConnection | ( | RakPeerInterface * | peer,
|  | SystemAddress | systemAddress |
| ) |  |  | `[protected, virtual]`

Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system

Parameters:

  `[in]` | peer | the instance of RakPeer that is calling Receive
  `[in]` | systemAddress | The system whose connection was closed

Reimplemented from PluginInterface.

PluginReceiveResult Lobby2Client::OnReceive | ( | RakPeerInterface * | peer,
|  | Packet * | packet |
| ) |  |  | `[protected, virtual]`

OnReceive is called for every packet.

Parameters:

  `[in]` | peer | the instance of RakPeer that is calling Receive
  `[in]` | packet | the packet that is being returned to the user

Returns:
  True to allow the game and other plugins to get this message, false to absorb it

Reimplemented from PluginInterface.

void Lobby2Client::OnShutdown | ( | RakPeerInterface * | peer | ) | `[protected, virtual]`

Called when RakPeer is shutdown

Parameters:

  `[in]` | peer | the instance of RakPeer that is calling Receive

Reimplemented from PluginInterface.

void Lobby2Client::SendMsg | ( | Lobby2Message * | msg | ) | `[virtual]`

Send a command to the server

Parameters:

  `[in]` | msg | The message that represents the command
  `[in]` | callbackId | Which callback, registered with SetCallbackInterface() or AddCallbackInterface(), should process the result. -1 for all

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

- C:/RakNet/DependentExtensions/Lobby2/Lobby2Client.h
- C:/RakNet/DependentExtensions/Lobby2/Lobby2Client.cpp