Fawkes API  Fawkes Development Version
fawkes::NetworkAcceptorThread Class Reference

Network Acceptor Thread. More...

#include <>>

Inheritance diagram for fawkes::NetworkAcceptorThread:

List of all members.

Public Member Functions

 NetworkAcceptorThread (NetworkIncomingConnectionHandler *handler, unsigned short int port, const char *thread_name="NetworkAcceptorThread")
 Constructor.
 NetworkAcceptorThread (NetworkIncomingConnectionHandler *handler, StreamSocket *socket, const char *thread_name="NetworkAcceptorThread")
 Constructor.
 ~NetworkAcceptorThread ()
 Destructor.
virtual void loop ()
 Thread loop.

Protected Member Functions

virtual void run ()
 Stub to see name in backtrace for easier debugging.

Detailed Description

Network Acceptor Thread.

Opens and maintains a server socket and waits for incoming connections. If that happens NetworkConnectionHandler::add_connection() is called.

Author:
Tim Niemueller

Constructor & Destructor Documentation

fawkes::NetworkAcceptorThread::NetworkAcceptorThread ( NetworkIncomingConnectionHandler handler,
unsigned short int  port,
const char *  thread_name = "NetworkAcceptorThread" 
)

Constructor.

Parameters:
handlerConnection handler for newly accepted incoming connections.
portport to listen on for incoming connections
thread_namename of the thread
Exceptions:
SocketExceptionas thrown by StreamSocket connstructor, bind and listen.

Definition at line 45 of file acceptor_thread.cpp.

References fawkes::Thread::set_prepfin_conc_loop(), fawkes::Socket::bind(), and fawkes::Socket::listen().

fawkes::NetworkAcceptorThread::NetworkAcceptorThread ( NetworkIncomingConnectionHandler handler,
StreamSocket socket,
const char *  thread_name = "NetworkAcceptorThread" 
)

Constructor.

Parameters:
handlerConnection handler for newly accepted incoming connections.
socketsocket, must already be bound to the desired port. Socket::listen() will be called by the acceptor thread.
thread_namename of the thread
Exceptions:
SocketExceptionas thrown by StreamSocket connstructor, bind and listen.

Definition at line 72 of file acceptor_thread.cpp.

References fawkes::Thread::set_prepfin_conc_loop(), and fawkes::Socket::listen().

fawkes::NetworkAcceptorThread::~NetworkAcceptorThread ( )

Destructor.

Definition at line 92 of file acceptor_thread.cpp.


Member Function Documentation

void fawkes::NetworkAcceptorThread::loop ( ) [virtual]

Thread loop.

Waits on a socket for an incoming connection (blocking accept). If a new connection has been established it is reported to the handler.

Reimplemented from fawkes::Thread.

Definition at line 103 of file acceptor_thread.cpp.

References fawkes::Socket::accept(), and fawkes::NetworkIncomingConnectionHandler::add_connection().

virtual void fawkes::NetworkAcceptorThread::run ( ) [inline, protected, virtual]

Stub to see name in backtrace for easier debugging.

See also:
Thread::run()

Reimplemented from fawkes::Thread.

Definition at line 48 of file acceptor_thread.h.


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