#include <cxxtools/net/tcpserver.h>

Inheritance diagram for cxxtools::net::TcpServer:
cxxtools::Selectable

Public Types

enum  { INHERIT = 1, DEFER_ACCEPT = 2, REUSEADDR = 4 }
- Public Types inherited from cxxtools::Selectable
enum  State { Disabled = 0, Idle = 1, Busy = 2, Avail = 3 }

Public Member Functions

 TcpServer ()
 TcpServer (const std::string &ipaddr, unsigned short int port, int backlog=5, unsigned flags=REUSEADDR)
 Creates a server socket and listens on an address.
 ~TcpServer ()
void listen (const std::string &ipaddr, unsigned short int port, int backlog=5, unsigned flags=REUSEADDR)
virtual SelectableImpl & simpl ()
void terminateAccept ()
 Stops a blocking accept The stopAccept method can be called from a thread to break a blocking accept call in another thread.
TcpServerImpl & impl () const
- Public Member Functions inherited from cxxtools::Selectable
virtual ~Selectable ()
 Destructor.
void setSelector (SelectorBase *parent)
SelectorBaseselector () const
void close ()
 Closes the I/O device.
bool wait (Milliseconds msecs=WaitInfinite)
bool enabled () const
 Test if the I/O device object is enabled.
bool idle () const
bool busy () const
bool avail () const

Public Attributes

Signal< TcpServer & > connectionPending

Protected Member Functions

virtual void onClose ()
 Closes the Selector.
virtual bool onWait (Timespan timeout)
virtual void onAttach (SelectorBase &)
virtual void onDetach (SelectorBase &)
- Protected Member Functions inherited from cxxtools::Selectable
 Selectable ()
 Default Constructor.
void setEnabled (bool isEnabled)
 Sets or unsets the device enabled.
void setState (State state)

Additional Inherited Members

- Static Public Attributes inherited from cxxtools::Selectable
static const std::size_t WaitInfinite = Selector::WaitInfinite

Member Enumeration Documentation

anonymous enum
Enumerator:
INHERIT 
DEFER_ACCEPT 
REUSEADDR 

Constructor & Destructor Documentation

cxxtools::net::TcpServer::TcpServer ( )
cxxtools::net::TcpServer::TcpServer ( const std::string &  ipaddr,
unsigned short int  port,
int  backlog = 5,
unsigned  flags = REUSEADDR 
)

Creates a server socket and listens on an address.

cxxtools::net::TcpServer::~TcpServer ( )

Member Function Documentation

TcpServerImpl& cxxtools::net::TcpServer::impl ( ) const
void cxxtools::net::TcpServer::listen ( const std::string &  ipaddr,
unsigned short int  port,
int  backlog = 5,
unsigned  flags = REUSEADDR 
)
virtual void cxxtools::net::TcpServer::onAttach ( SelectorBase )
protectedvirtual

Implements cxxtools::Selectable.

virtual void cxxtools::net::TcpServer::onClose ( )
protectedvirtual

Closes the Selector.

Implements cxxtools::Selectable.

virtual void cxxtools::net::TcpServer::onDetach ( SelectorBase )
protectedvirtual

Implements cxxtools::Selectable.

virtual bool cxxtools::net::TcpServer::onWait ( Timespan  timeout)
protectedvirtual

Implements cxxtools::Selectable.

virtual SelectableImpl& cxxtools::net::TcpServer::simpl ( )
virtual

Implements cxxtools::Selectable.

void cxxtools::net::TcpServer::terminateAccept ( )

Stops a blocking accept The stopAccept method can be called from a thread to break a blocking accept call in another thread.

The call to accept is terminated by a AcceptTerminated exception.

Member Data Documentation

Signal<TcpServer&> cxxtools::net::TcpServer::connectionPending

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