Orxonox: orxonox::Client Class Reference

# orxonox::Client Class Reference

`#include <src/network/Client.h>`

Inheritance diagram for orxonox::Client:

List of all members.

## Public Member Functions

virtual bool | broadcast (const std::string &message)
virtual bool | chat (const std::string &message)
| Client (const std::string &address, int port)
| Client ()
bool | closeConnection ()
bool | establishConnection ()
bool | processChat (const std::string &message, unsigned int playerID)
bool | queuePacket (ENetPacket *packet, int clientID)
void | update (const Clock &time)
| ~Client ()

## Private Member Functions

| Client (const Client &copy)
virtual bool | isServer_ ()

## Private Attributes

GamestateClient | gamestate
bool | gameStateFailure_
bool | isSynched_
float | timeSinceLastUpdate_

## Detailed Description

Client *client; The network/Client class This class implements all necessary function for the network communication It is the root class of the network module

## Constructor & Destructor Documentation

orxonox::Client::Client | ( |  | ) |

Constructor for the Client class initializes the address and the port to default localhost:NETWORK_PORT

orxonox::Client::Client | ( | const std::string & | address,
|  | int | port |
| ) |  |  |

Constructor for the Client class

Parameters:

  | address | the server address
  | port | port of the application on the server

References orxonox::ClientConnection::setPort(), and orxonox::ClientConnection::setServerAddress().

orxonox::Client::~Client | ( |  | ) |

References closeConnection(), and orxonox::ClientConnection::isConnected().

orxonox::Client::Client | ( | const Client & | copy | ) | `[private]`

## Member Function Documentation

virtual bool orxonox::Client::broadcast | ( | const std::string & | message | ) | `[inline, virtual]`

Implements orxonox::Host.

bool orxonox::Client::chat | ( | const std::string & | message | ) | `[virtual]`

This function implements the method of sending a chat message to the server

Parameters:

  | message | message to be sent

Returns:
  result(true/false)

Implements orxonox::Host.

References orxonox::packet::Type::Chat, orxonox::Host::getPlayerID(), and orxonox::packet::Packet::send().

bool orxonox::Client::closeConnection | ( |  | ) | `[virtual]`

closes the Connection to the Server

Returns:
  true/false

Reimplemented from orxonox::ClientConnection.

References orxonox::ClientConnection::closeConnection().

Referenced by orxonox::GSClient::deactivate(), and ~Client().

bool orxonox::Client::establishConnection | ( |  | ) | `[virtual]`

Establish the Connection to the Server

Returns:
  true/false

Reimplemented from orxonox::ClientConnection.

References orxonox::ClientConnection::establishConnection(), and orxonox::Synchronisable::setClient().

Referenced by orxonox::GSClient::activate().

virtual bool orxonox::Client::isServer_ | ( |  | ) | `[inline, private, virtual]`

Implements orxonox::Host.

bool orxonox::Client::processChat | ( | const std::string & | message,
|  | unsigned int | playerID |
| ) |  |  | `[virtual]`

Implements orxonox::Host.

bool orxonox::Client::queuePacket | ( | ENetPacket * | packet,
|  | int | clientID |
| ) |  |  | `[virtual]`

Implements orxonox::Host.

References orxonox::ClientConnection::addPacket().

void orxonox::Client::update | ( | const Clock & | time | ) |

Processes incoming packets, sends a gamestate to the server and does the cleanup

Parameters:

  | time |

References orxonox::GamestateClient::cleanup(), COUT, gamestate, orxonox::Clock::getDeltaTime(), orxonox::GamestateClient::getGamestate(), orxonox::ClientConnection::isConnected(), isSynched_, orxonox::NETWORK_PERIOD, orxonox::GamestateClient::processGamestates(), orxonox::Connection::processQueue(), orxonox::packet::Packet::send(), orxonox::FunctionCallManager::sendCalls(), orxonox::Connection::sendPackets(), and timeSinceLastUpdate_.

Referenced by orxonox::GSClient::activate(), and orxonox::GSClient::update().

## Member Data Documentation

GamestateClient orxonox::Client::gamestate`[private]`

Referenced by update().

bool orxonox::Client::gameStateFailure_`[private]`

bool orxonox::Client::isSynched_`[private]`

Referenced by update().

float orxonox::Client::timeSinceLastUpdate_`[private]`

Referenced by update().

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

- src/network/Client.h
- src/network/Client.cc