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

OW32::CIoCompletionListener Class Reference

A listener based on the io completion model. More...

#include <IoCompletionListener.h>

Inheritance diagram for OW32::CIoCompletionListener:

OW32::CListener OW32::CIoCompletion List of all members.

Public Member Functions

 CIoCompletionListener (CIoCompletionListenerCallback *callback)
 Construct the listener with the given callback.
void cancel ()
 Cancel listening.
bool cancelled ()
 See if listening was cancelled.
int listen (int port, HANDLE hCompletionPort)
 Listen on the given port.
int postAccept ()
 Post an accept.
 CIoCompletionListener (CListenerCallback *pCallback)
 Construct the listener with the given callback.
virtual void Cancel ()
 Cancel listening.
virtual bool Cancelled ()
 See if listening was cancelled.
void onAcceptCompletion (BOOL bRet, DWORD cbTransferred, LPOVERLAPPED)
 callback from CIoCompletion, or from an APC model if you want that
virtual int Listen (int port)
 Listen on the given port.
virtual int Accept ()
 Begin accepting connections.
int ListenAndAcceptWithPort (int Port, HANDLE hCompletionPort)
 Listen and accept on a particular io completion port.
virtual int GetAddresses (sockaddr_in **local_address, sockaddr_in **remote_address)
 Get the addresses following an onAcceptCompletion notification.
BOOL associateWithIoCompletionPort (HANDLE hCompletionPort)
 Associate the listener with a given io completion port.
 operator SOCKET ()
 extractor for the listening socket

Detailed Description

A listener based on the io completion model.


Constructor & Destructor Documentation

OW32::CIoCompletionListener::CIoCompletionListener CIoCompletionListenerCallback callback  )  [inline]
 

Construct the listener with the given callback.

Parameters:
callback The callback object to receive AcceptEx notifications

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

Construct the listener with the given callback.

Parameters:
pCallback The callback object to receive accept notifications


Member Function Documentation

BOOL OW32::CIoCompletionListener::associateWithIoCompletionPort HANDLE  hCompletionPort  )  [inline]
 

Associate the listener with a given io completion port.

Parameters:
hCompletionPort the completion port to associate with
Returns:
TRUE if successful, FALSE otherwise

virtual int OW32::CIoCompletionListener::GetAddresses sockaddr_in **  local_address,
sockaddr_in **  remote_address
[inline, 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

Implements OW32::CListener.

virtual int OW32::CIoCompletionListener::Listen int  port  )  [inline, virtual]
 

Listen on the given port.

Parameters:
port The port to listen on

Reimplemented from OW32::CListener.

int OW32::CIoCompletionListener::listen int  port,
HANDLE  hCompletionPort
[inline]
 

Listen on the given port.

Parameters:
port The port to listen on
hCompletionPort The IOCP to use
Returns:
0 on success, SOCKET_ERROR on failure

int OW32::CIoCompletionListener::postAccept  )  [inline]
 

Post an accept.

Call repeatedly for handling higher connection rates. Once an accept completes, it is not reposted. You can post another one if desired (or post the same one again), and keep a limit on the number of outstanding AcceptEx calls.

Returns:
0 on success, SOCKET_ERROR on failure


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