TcpServer Class Reference

#include <Pt/Net/TcpServer.h>

TCP server socket.

Inherits Selectable.

Public Member Functions

 TcpServer ()
 Default Constructor.
 
 TcpServer (System::EventLoop &loop)
 Construct with event loop.
 
 TcpServer (const Endpoint &ep)
 Creates a server socket and listens on an address.
 
 ~TcpServer ()
 Destructor.
 
void beginAccept ()
 Begin accepting a connection.
 
void cancel ()
 Cancels all operations.
 
void close ()
 Close the server and stop listening and accepting.
 
Signal< TcpServer & > & connectionPending ()
 Notifies that a connection was accepted. More...
 
void detach ()
 Remove from event loop and cancels outstanding operations.
 
void listen (const Endpoint &ep)
 Listen at local endpoint.
 
void listen (const Endpoint &ep, const TcpServerOptions &options)
 Listen at local endpoint.
 
System::EventLooploop () const
 Returns the parent event loop.
 
bool run ()
 Run operation if it is ready.
 
void setActive (EventLoop &parent)
 Sets the parent loop, so that operations can be run.
 

Protected Member Functions

virtual void onAttach (System::EventLoop &loop)
 Attached to loop.
 
virtual void onCancel ()
 Blocks until operation has cancelled.
 
virtual void onDetach (System::EventLoop &loop)
 Detached from loop.
 
virtual bool onRun ()
 Check if ready and run.
 

Member Function Documentation

Signal<TcpServer&>& connectionPending ( )

This signal is send when the TcpServer is monitored in an EventLoop and a connection was accepted.