Public Member Functions | Protected Member Functions

fawkes::NetworkAcceptorThread Class Reference
[Fawkes Network Communication]

Network Acceptor Thread. More...

#include <>>

Inheritance diagram for fawkes::NetworkAcceptorThread:
Inheritance graph
[legend]

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

Definition at line 34 of file acceptor_thread.h.


Constructor & Destructor Documentation

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

Constructor.

Parameters:
handler Connection handler for newly accepted incoming connections.
port port to listen on for incoming connections
thread_name name of the thread
Exceptions:
SocketException as thrown by StreamSocket connstructor, bind and listen.

Definition at line 45 of file acceptor_thread.cpp.

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

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

Constructor.

Parameters:
handler Connection handler for newly accepted incoming connections.
socket socket, must already be bound to the desired port. Socket::listen() will be called by the acceptor thread.
thread_name name of the thread
Exceptions:
SocketException as thrown by StreamSocket connstructor, bind and listen.

Definition at line 72 of file acceptor_thread.cpp.

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

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: