Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

OW32::CListener Class Reference

socket listener object More...

#include <Listener.h>

Inheritance diagram for OW32::CListener:

OW32::CIoCompletionListener OW32::CMessageListener List of all members.

Public Member Functions

 CListener (CListenerCallback *pCallback)
 Construct a listener object with the given callback.
virtual ~CListener ()=0
 Tidy up the listener object.
virtual void Cancel ()
 Cancel listening.
virtual bool Cancelled ()
 See if listening was cancelled.
CListenerCallbackGetCallback () const
 Return the callback object.
int GetPort () const
 Return the port that this object is listening on.
virtual BOOL Listen (int port)
 Start listening on the given port.
virtual int Accept ()=0
 Accept the next connection.
virtual int ListenAndAccept (int port)
 combines Listen and Accept
virtual int GetAddresses (sockaddr_in **local_address, sockaddr_in **remote_address)=0
 Get the addresses following an onAcceptCompletion notification.
virtual int GetRemoteAddress (sockaddr_in **remote_address)
 Get the remote address following an onAcceptCompletion notification.
virtual int GetLocalAddress (sockaddr_in **local_address)
 Get the local address following an onAcceptCompletion notification.
virtual SOCKET DetachAcceptedSocket ()
 Detach and return the accepted socket handle.

Protected Attributes

int m_port
 The port that we are listening on.
CSocket m_sListen
 The socket used by the listener.
XSOCKET m_sAccepted
 The recently accepted socket.
CListenerCallbackm_pCallback
 The accept notification callback object.

Detailed Description

socket listener object


Constructor & Destructor Documentation

OW32::CListener::CListener CListenerCallback pCallback  )  [inline]
 

Construct a listener object with the given callback.

Parameters:
pCallback the object to receive notification of accept events


Member Function Documentation

virtual int OW32::CListener::GetAddresses sockaddr_in **  local_address,
sockaddr_in **  remote_address
[pure virtual]
 

Get the addresses following an onAcceptCompletion notification.

Parameters:
local_address returns a pointer to the local address
remote_address returns a pointer to the remote address

Implemented in OW32::CIoCompletionListener, and OW32::CMessageListener.

virtual int OW32::CListener::GetLocalAddress sockaddr_in **  local_address  )  [inline, virtual]
 

Get the local address following an onAcceptCompletion notification.

Parameters:
local_address Returns a pointer to the local address

virtual int OW32::CListener::GetRemoteAddress sockaddr_in **  remote_address  )  [inline, virtual]
 

Get the remote address following an onAcceptCompletion notification.

Parameters:
remote_address Returns a pointer the remote address

virtual BOOL OW32::CListener::Listen int  port  )  [inline, virtual]
 

Start listening on the given port.

Parameters:
port The port to listen on

Reimplemented in OW32::CIoCompletionListener.

virtual int OW32::CListener::ListenAndAccept int  port  )  [inline, virtual]
 

combines Listen and Accept

Parameters:
port The port to listen on


The documentation for this class was generated from the following file:
Generated on Sun Jun 5 01:29:25 2005 for OW32 by  doxygen 1.3.9.1