BALL  1.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Protected Attributes | List of all members
BALL::TCPServer Class Reference

#include <BALL/SYSTEM/networking.h>

Inheritance diagram for BALL::TCPServer:
BALL::TCPServerThread BALL::VIEW::ServerWidget::BALLViewServer

Public Member Functions

 TCPServer (Size port, bool restart=true)
 
virtual ~TCPServer ()
 
virtual void activate ()
 
virtual void deactivate ()
 
virtual void startAccepting ()
 
virtual void handleConnection ()
 
virtual void connectionRequested ()
 
void setPort (Size port)
 
Size getPort () const
 

Protected Attributes

Size port_
 
bool restart_
 
TCPIOStream connected_stream_
 
BALL_ASIO_NAMESPACE::io_service io_service_
 
BALL_ASIO_NAMESPACE::ip::tcp::acceptor acceptor_
 

Detailed Description

This class provides a base for very simple TCP-based servers.

By default, the server handles only one connection. The first request is accepted and converted into a TCPIOStream. If restart_ is set to true (default), the server listens again after the connection has been terminated.

Note that the server is not automatically started but rather waits for a call to "run".

Definition at line 64 of file networking.h.

Constructor & Destructor Documentation

BALL::TCPServer::TCPServer ( Size  port,
bool  restart = true 
)
inline

Definition at line 67 of file networking.h.

virtual BALL::TCPServer::~TCPServer ( )
virtual

Member Function Documentation

virtual void BALL::TCPServer::activate ( )
virtual
virtual void BALL::TCPServer::connectionRequested ( )
virtual
virtual void BALL::TCPServer::deactivate ( )
virtual

Reimplemented in BALL::TCPServerThread.

Size BALL::TCPServer::getPort ( ) const
virtual void BALL::TCPServer::handleConnection ( )
virtual
void BALL::TCPServer::setPort ( Size  port)
virtual void BALL::TCPServer::startAccepting ( )
virtual

Member Data Documentation

BALL_ASIO_NAMESPACE::ip::tcp::acceptor BALL::TCPServer::acceptor_
protected

Definition at line 95 of file networking.h.

TCPIOStream BALL::TCPServer::connected_stream_
protected

Definition at line 91 of file networking.h.

BALL_ASIO_NAMESPACE::io_service BALL::TCPServer::io_service_
protected

Definition at line 93 of file networking.h.

Size BALL::TCPServer::port_
protected

Definition at line 88 of file networking.h.

bool BALL::TCPServer::restart_
protected

Definition at line 89 of file networking.h.