Elm
1.0
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) throw (Exception) |
void | manage (void) throw (Exception) |
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.
elm::net::Server::Server | ( | void | ) |
Build a server on non-predefined port.
elm::net::Server::Server | ( | int | port | ) |
Build a server on the given port.
port | Port to use. |
|
virtual |
References close().
void elm::net::Server::close | ( | void | ) |
void elm::net::Server::manage | ( | void | ) | ||
throw | ( | Exception | |||
) |
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 elm::net::ServerSocket::listen(), and 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 manage().
void elm::net::Server::open | ( | void | ) | ||
throw | ( | Exception | |||
) |
Open the server.
References elm::net::ServerSocket::make(), and elm::net::ServerSocket::open().
int elm::net::Server::port | ( | void | ) | const |
References elm::net::ServerSocket::port().