#include <transports.h>
Inheritance diagram for OpalListenerUDP:
Public Member Functions | |
Construction | |
OpalListenerUDP (OpalEndPoint &endpoint, PIPSocket::Address binding=PIPSocket::GetDefaultIpAny(), WORD port=0, BOOL exclusive=TRUE) | |
~OpalListenerUDP () | |
Overrides from OpalListener | |
virtual BOOL | Open (const PNotifier &acceptHandler, BOOL singleThread=TRUE) |
virtual BOOL | IsOpen () |
virtual void | Close () |
virtual OpalTransport * | Accept (const PTimeInterval &timeout) |
Protected Member Functions | |
virtual const char * | GetProtoPrefix () const |
BOOL | OpenOneSocket (const PIPSocket::Address &address) |
Protected Attributes | |
PSocketList | listeners |
OpalListenerUDP::OpalListenerUDP | ( | OpalEndPoint & | endpoint, | |
PIPSocket::Address | binding = PIPSocket::GetDefaultIpAny() , |
|||
WORD | port = 0 , |
|||
BOOL | exclusive = TRUE | |||
) |
Create a new listener.
endpoint | Endpoint listener is used for |
binding | Local interface to listen on |
port | TCP port to listen for connections |
OpalListenerUDP::~OpalListenerUDP | ( | ) |
Destroy the listener thread.
virtual OpalTransport* OpalListenerUDP::Accept | ( | const PTimeInterval & | timeout | ) | [virtual] |
Accept a new incoming transport.
timeout | Time to wait for incoming connection |
Implements OpalListener.
virtual void OpalListenerUDP::Close | ( | ) | [virtual] |
Stop the listener thread and no longer accept incoming connections.
Implements OpalListener.
virtual const char* OpalListenerUDP::GetProtoPrefix | ( | ) | const [protected, virtual] |
Implements OpalListenerIP.
virtual BOOL OpalListenerUDP::IsOpen | ( | ) | [virtual] |
Indicate if the listener is open.
Implements OpalListener.
virtual BOOL OpalListenerUDP::Open | ( | const PNotifier & | acceptHandler, | |
BOOL | singleThread = TRUE | |||
) | [virtual] |
Open the listener. Listen for an incoming connection and create a OpalTransport of the appropriate subclass.
If notifier function acceptHandler is non-NULL a thread is spawned to listen for incoming connections. The acceptHandler is called when a new connection is created. The INT parameter to the acceptHandler is a pointer to the new OpalTransport instance created by the listener.
If singleThread is FALSE the acceptHandler function is called in the context of a new thread and the continues to listen for more connections. If TRUE, then the acceptHandler function is called from within the listener threads context and no more connections are created. That is only a single connection is ever created by this listener.
If acceptHandler is NULL, then no thread is started and it is assumed that the caller is responsible for calling Accept() and waiting for the new connection.
acceptHandler | Handler function for new connections |
singleThread | If handler function called in this thread |
Implements OpalListener.
BOOL OpalListenerUDP::OpenOneSocket | ( | const PIPSocket::Address & | address | ) | [protected] |
PSocketList OpalListenerUDP::listeners [protected] |