Yagl::ListeningConnection Class Reference

#include <listeningconnection.h>

Inheritance diagram for Yagl::ListeningConnection:

Yagl::Thread List of all members.

Public Member Functions

 ListeningConnection ()
 Constructor.
virtual ~ListeningConnection ()
 Destructor.
bool isAlive ()
 returns wheter the conenction is still open
void setLocalPort (unsigned short port)
 sets the local port
unsigned short getLocalPort ()
 returns the port the connection listens on
void registerBiDirectionalConnectionReceiver (BiDirectionalConnectionReceiver *receiver)
 registers a BiDirectional connection receiver
void unregisterBiDirectionalConnectionReceiver (BiDirectionalConnectionReceiver *receiver)
 unregisters a bidirectional connection receiver
bool startListening ()
 starts the listening thread
void stopListening ()
 stops the listening thread
void listening ()
 the listening thread implementation
void * run ()
 internal use only ( threading )

Protected Member Functions

 ListeningConnection (const ListeningConnection &connection)

Protected Attributes

int socket_
 socket descriptor

Detailed Description

SockListeningConnection this is a full implementation of the abstract ListeningConnection interface. it provides the user with mechanisms to wait and accept incoming BiDirectionalConnections and pass them to registered BiDirectionalConnectionReceivers.


Constructor & Destructor Documentation

Yagl::ListeningConnection::ListeningConnection const ListeningConnection connection  )  [protected]
 

copy constructor hidden

Yagl::ListeningConnection::ListeningConnection  )  [inline]
 

Constructor.

sets up members

virtual Yagl::ListeningConnection::~ListeningConnection  )  [virtual]
 

Destructor.

disconnects and closes the listening thread


Member Function Documentation

unsigned short Yagl::ListeningConnection::getLocalPort  ) 
 

returns the port the connection listens on

Returns:
returns the local listening port

bool Yagl::ListeningConnection::isAlive  ) 
 

returns wheter the conenction is still open

Returns:
true in case the connection is still listening, false in the oposite case

void Yagl::ListeningConnection::registerBiDirectionalConnectionReceiver BiDirectionalConnectionReceiver receiver  ) 
 

registers a BiDirectional connection receiver

this method will register a bidirectional connection receiver. if an incoming connection is accepted in the listening thread it will be passed to all registered receivers. call this before starting to listen.

void Yagl::ListeningConnection::setLocalPort unsigned short  port  ) 
 

sets the local port

this should be called prior to a call to startListening. it will define what port the connection should listen on. calls to this method while the connection is listening are ignored

Parameters:
port the port the connection should listen on

bool Yagl::ListeningConnection::startListening  ) 
 

starts the listening thread

this will start the listening thread that is waiting for incoming connections. as long as no connection receiver is registered the thread will not accept any incoming connections.

void Yagl::ListeningConnection::stopListening  ) 
 

stops the listening thread

this will stop the listening thread and close the connection

void Yagl::ListeningConnection::unregisterBiDirectionalConnectionReceiver BiDirectionalConnectionReceiver receiver  ) 
 

unregisters a bidirectional connection receiver

this will delete the given receiver from the receivers list. the receiver will not receive any incoming connections anymore


The documentation for this class was generated from the following file:
Generated on Tue Jan 10 15:42:38 2006 for YAGL - yet another gameprogramming library by  doxygen 1.4.5