Elm  1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
elm::net::Server Class Referenceabstract

#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
 

Detailed Description

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.

Constructor & Destructor Documentation

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.

Parameters
portPort to use.
elm::net::Server::~Server ( void  )
virtual

References close().

Member Function Documentation

void elm::net::Server::close ( void  )

Close the connection and stop the managing of the server (end of function manage()).

Referenced by ~Server().

void elm::net::Server::manage ( void  )
throw (Exception
)

Manage the server, that is, get the incoming connections until it is requested to close.

Exceptions
ExceptionThrown if there is an error during the open.

References elm::net::ServerSocket::listen(), and onConnection().

void elm::net::Server::onConnection ( Connection connection)
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.

Parameters
connectionCreated connection.

Referenced by manage().

void elm::net::Server::open ( void  )
throw (Exception
)
int elm::net::Server::port ( void  ) const

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