|
duncan
Mom and Dad were wrong!
|
#include <server.h>


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 () |
The main server class.
Maintain a list of connected clients and a collection of worlds.
see LICENSE
| Server::Server | ( | ) |
Initialise the connection, and set this object to be the listener.
| std::runtime_error | if all worlds cannot be loaded |
| void Server::message | ( | const std::string & | str | ) |
Handle any messages entered into the server's console.
| str | string entered into console |
| void Server::on_connect | ( | net::index_t | peer | ) | [virtual] |
Handle a new connection.
| peer | newly connected peer |
Reimplemented from net::PacketListener.
| void Server::on_disconnect | ( | net::index_t | peer | ) | [virtual] |
Handle the disconnection of a client.
| peer | disconnected 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.
| buf | packet data |
| size | size (in bytes) of the packet |
| peer | peer 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.
1.7.4