Elm
2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
#include <elm/net/ServerSocket.h>
Public Member Functions | |
Server (void) | |
Server (int port) | |
virtual | ~Server (void) |
int | port (void) const |
void | open (void) |
void | manage (void) |
void | close (void) |
Protected Member Functions | |
virtual void | onConnection (Connection &connection)=0 |
This class provides a way to listen on a port for connection as server. For each connection, a dedicated object is created and the method onConnection() is called: this lets an inheriting class to specialize the processing of this connection.
Server | ( | int | port | ) |
Build a server on the given port.
port | Port to use. |
References Server::close().
Close the connection and stop the managing of the server (end of function manage()).
Referenced by Server::~Server().
Manage the server, that is, get the incoming connections until it is requested to close.
Exception | Thrown if there is an error during the open. |
References ServerSocket::listen(), and Server::onConnection().
|
protectedpure virtual |
Called each time a connection arises. The current connection (with input and output streams) is passed to let the application to process it.
connection | Created connection. |
Referenced by Server::manage().
Open the server.
References ServerSocket::make(), and ServerSocket::open().
|
inline |
References ServerSocket::port().