duncan
Mom and Dad were wrong!
Public Member Functions
server::Server Class Reference

#include <server.h>

Inheritance diagram for server::Server:
Inheritance graph
[legend]
Collaboration diagram for server::Server:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Server ()
void on_packet (net::data_t *buf, size_t size, net::index_t peer)
void on_connect (net::index_t peer)
void on_disconnect (net::index_t peer)
void message (const std::string &str)
bool update ()

Detailed Description

The main server class.

Maintain a list of connected clients and a collection of worlds.

Author:
Harry Slatyer
Malcolm Gill

see LICENSE


Constructor & Destructor Documentation

Server::Server ( )

Initialise the connection, and set this object to be the listener.

Exceptions:
std::runtime_errorif all worlds cannot be loaded

Member Function Documentation

void Server::message ( const std::string &  str)

Handle any messages entered into the server's console.

Parameters:
strstring entered into console
void Server::on_connect ( net::index_t  peer) [virtual]

Handle a new connection.

Parameters:
peernewly connected peer

Reimplemented from net::PacketListener.

void Server::on_disconnect ( net::index_t  peer) [virtual]

Handle the disconnection of a client.

Parameters:
peerdisconnected peer

Reimplemented from net::PacketListener.

void Server::on_packet ( net::data_t buf,
size_t  size,
net::index_t  peer 
) [virtual]

Receive a packet from a client.

Parameters:
bufpacket data
sizesize (in bytes) of the packet
peerpeer from whom the packet was sent

Reimplemented from net::PacketListener.

bool Server::update ( )

Updates the connection and all worlds. Sends any data to clients; per-frame data limit is set by net::kMaxFrameSize and if this is exceeded before all worlds have had a chance to send their data, the next frame will pick up where the last one left off.

Returns:
whether or not the server should continue to run

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations