orxonox::Server Class Reference

#include <src/network/Server.h>

Inheritance diagram for orxonox::Server:

orxonox::Host orxonox::ServerConnection orxonox::GamestateManager orxonox::Connection orxonox::GamestateHandler

List of all members.

Public Member Functions

void close ()
double getPacketLoss (unsigned int clientID)
 : return packet loss ratio to client (scales from 0 to 1)
unsigned int getPing (unsigned int clientID)
 : returns ping time to client in milliseconds
void open ()
bool processChat (const std::string &message, unsigned int playerID)
bool queuePacket (ENetPacket *packet, int clientID)
 Server (int port, const std::string &bindAddress)
 Server (int port)
 Server ()
void update (const Clock &time)
 ~Server ()
 Destructor.

Protected Member Functions

void updateGamestate ()

Private Member Functions

void addClient (ENetEvent *event)
virtual bool broadcast (const std::string &message)
virtual bool chat (const std::string &message)
bool createClient (int clientID)
void disconnectClient (ClientInformation *client)
virtual bool isServer_ ()
unsigned int playerID ()
bool processPacket (ENetPacket *packet, ENetPeer *peer)
bool sendChat (const std::string &message, unsigned int clientID)
bool sendGameState ()
bool sendObjectDeletes ()
unsigned int shipID ()
void syncClassid (unsigned int clientID)

Private Attributes

float timeSinceLastUpdate_


Detailed Description

This class is the root class of the network module for a server. It implements all functions necessary for a Server

Constructor & Destructor Documentation

orxonox::Server::Server (  ) 

Constructor for default values (bindaddress is set to ENET_HOST_ANY

References timeSinceLastUpdate_.

orxonox::Server::Server ( int  port  ) 

orxonox::Server::Server ( int  port,
const std::string bindAddress 
)

Constructor

Parameters:
port Port to listen on
bindAddress Address to listen on

References orxonox::ServerConnection::setBindAddress(), orxonox::ServerConnection::setPort(), and timeSinceLastUpdate_.

orxonox::Server::~Server (  ) 

Destructor.


Member Function Documentation

void orxonox::Server::addClient ( ENetEvent event  )  [private, virtual]

bool orxonox::Server::broadcast ( const std::string message  )  [private, virtual]

Implements orxonox::Host.

References orxonox::CLIENTID_UNKNOWN, and sendChat().

bool orxonox::Server::chat ( const std::string message  )  [private, virtual]

Implements orxonox::Host.

References orxonox::Host::getPlayerID(), and sendChat().

Referenced by processChat(), and sendChat().

void orxonox::Server::close (  ) 

bool orxonox::Server::createClient ( int  clientID  )  [private]

void orxonox::Server::disconnectClient ( ClientInformation client  )  [private, virtual]

double orxonox::Server::getPacketLoss ( unsigned int  clientID  ) 

: return packet loss ratio to client (scales from 0 to 1)

References orxonox::ClientInformation::findClient(), and orxonox::ClientInformation::getPacketLoss().

unsigned int orxonox::Server::getPing ( unsigned int  clientID  ) 

: returns ping time to client in milliseconds

References orxonox::ClientInformation::findClient(), and orxonox::ClientInformation::getRTT().

virtual bool orxonox::Server::isServer_ (  )  [inline, private, virtual]

Implements orxonox::Host.

void orxonox::Server::open (  ) 

This function opens the server by creating the listener thread

References COUT, and orxonox::ServerConnection::openListener().

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

unsigned int orxonox::Server::playerID (  )  [inline, private]

bool orxonox::Server::processChat ( const std::string message,
unsigned int  playerID 
) [virtual]

bool orxonox::Server::processPacket ( ENetPacket packet,
ENetPeer peer 
) [private]

bool orxonox::Server::queuePacket ( ENetPacket packet,
int  clientID 
) [virtual]

bool orxonox::Server::sendChat ( const std::string message,
unsigned int  clientID 
) [private]

bool orxonox::Server::sendGameState (  )  [private]

sends the gamestate

References orxonox::GamestateManager::sendGamestates().

Referenced by updateGamestate().

bool orxonox::Server::sendObjectDeletes (  )  [private]

unsigned int orxonox::Server::shipID (  )  [inline, private]

void orxonox::Server::syncClassid ( unsigned int  clientID  )  [private]

void orxonox::Server::update ( const Clock time  ) 

void orxonox::Server::updateGamestate (  )  [protected]

takes a new snapshot of the gamestate and sends it to the clients

References COUT, orxonox::ClientInformation::getBegin(), sendGameState(), sendObjectDeletes(), and orxonox::GamestateManager::update().

Referenced by update().


Member Data Documentation

Referenced by Server(), and update().


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

Generated on Tue Jul 28 16:23:02 2009 for Orxonox by  doxygen 1.5.6