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

OW32::CAsyncIoCompletionSocket Class Reference

Asynchronous socket io completion support. More...

#include <AsyncSocket.h>

Inheritance diagram for OW32::CAsyncIoCompletionSocket:

OW32::CIoCompletion OW32::CAsyncSocketBase OW32::CIoTimeoutCallback List of all members.

Public Member Functions

 CAsyncIoCompletionSocket (CAsyncSocketCallback *pCallback, SOCKET s)
 Construct a new IOCP socket.
 CAsyncIoCompletionSocket (CAsyncSocketCallback *pCallback)
 Construct a new uninitialised IOCP socket.
virtual ~CAsyncIoCompletionSocket ()
 Destructor cleaning up.
bool associateWithIoCompletionPort (HANDLE hCompletionPort)
 Associate the socket with the given IOCP.
virtual int close ()
 Close the encapsulated socket handle.
virtual int connect (const struct sockaddr *name, int namelen)
 Connect to a remote server (stream) or set a default outgoing address for send (datagram).
virtual int connect (CSockAddrIn &sockaddr_in)
 Connect to a remote server (stream) or set a default outgoing address for send (datagram).
virtual int shutdown (int how)
 Shutdown the socket.
virtual void setTimeout (DWORD timeout)
 Set the timeout for the socket.
virtual int recv (char *buf, int len)
 Asynchronous recv.
virtual int send (const char *buf, int len)
 Asynchronous send.
virtual int sendv (WSABUF *bufs, DWORD nbufs)
 Asynchronous vector send.
virtual int transmitFile (HANDLE hFile, DWORD nNumberOfBytesToWrite, DWORD nNumberOfBytesPerSend, LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers, DWORD dwFlags)
 Asynchronous transmitFile.
void expectNotification ()
 Add an outstanding notification.
void receivedNotification ()
 Notify the socket of a completed notification.

Friends

LRESULT CALLBACK SocketNotifyWndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)

Detailed Description

Asynchronous socket io completion support.


Constructor & Destructor Documentation

OW32::CAsyncIoCompletionSocket::CAsyncIoCompletionSocket CAsyncSocketCallback pCallback,
SOCKET  s
[inline]
 

Construct a new IOCP socket.

Parameters:
pCallback The callback for notifications
s An existing socket to take ownership of

OW32::CAsyncIoCompletionSocket::CAsyncIoCompletionSocket CAsyncSocketCallback pCallback  )  [inline]
 

Construct a new uninitialised IOCP socket.

Parameters:
pCallback The callback for notifications


Member Function Documentation

bool OW32::CAsyncIoCompletionSocket::associateWithIoCompletionPort HANDLE  hCompletionPort  )  [inline]
 

Associate the socket with the given IOCP.

Parameters:
hCompletionPort The IOCP to associate with

virtual int OW32::CAsyncIoCompletionSocket::close  )  [virtual]
 

Close the encapsulated socket handle.

Reimplemented from OW32::CAsyncSocketBase.

virtual int OW32::CAsyncIoCompletionSocket::connect CSockAddrIn sockaddr_in  )  [inline, virtual]
 

Connect to a remote server (stream) or set a default outgoing address for send (datagram).

Parameters:
sockaddr_in The address to bind to

Reimplemented from OW32::CAsyncSocketBase.

virtual int OW32::CAsyncIoCompletionSocket::connect const struct sockaddr *  name,
int  namelen
[virtual]
 

Connect to a remote server (stream) or set a default outgoing address for send (datagram).

Parameters:
name The address to connect to
namelen The length of the address

Reimplemented from OW32::CAsyncSocketBase.

void OW32::CAsyncIoCompletionSocket::expectNotification  )  [inline]
 

Add an outstanding notification.

May be used for piggybacking the lifetime of other operations on the socket.

virtual int OW32::CAsyncIoCompletionSocket::recv char *  buf,
int  len
[virtual]
 

Asynchronous recv.

onReadCompletion will be called when the read completes.

Parameters:
buf The buffer for data
len The amount of data to try to read
Returns:
SOCKET_ERROR for any errors, or 0 for success. If the function returns SOCKET_ERROR the callback will not be invoked.

Implements OW32::CAsyncSocketBase.

virtual int OW32::CAsyncIoCompletionSocket::send const char *  buf,
int  len
[virtual]
 

Asynchronous send.

onSendCompletion will be called when the send completes.

Parameters:
buf The buffer for data
len The amount of data to try to send
Returns:
SOCKET_ERROR for any errors, or 0 for success. If the function returns SOCKET_ERROR the callback will not be invoked.

Implements OW32::CAsyncSocketBase.

virtual int OW32::CAsyncIoCompletionSocket::sendv WSABUF *  bufs,
DWORD  nbufs
[virtual]
 

Asynchronous vector send.

onSendCompletion will be called when the send completes.

Parameters:
bufs The data buffers
nbufs The number of data buffers
Returns:
SOCKET_ERROR for any errors, or 0 for success. If the function returns SOCKET_ERROR the callback will not be invoked.

Reimplemented from OW32::CAsyncSocketBase.

virtual void OW32::CAsyncIoCompletionSocket::setTimeout DWORD  timeout  )  [virtual]
 

Set the timeout for the socket.

Parameters:
timeout The timeout, in ms

Reimplemented from OW32::CAsyncSocketBase.

virtual int OW32::CAsyncIoCompletionSocket::shutdown int  how  )  [virtual]
 

Shutdown the socket.

Parameters:
how How to shutdown (usually SD_SEND)

Reimplemented from OW32::CAsyncSocketBase.

virtual int OW32::CAsyncIoCompletionSocket::transmitFile HANDLE  hFile,
DWORD  nNumberOfBytesToWrite,
DWORD  nNumberOfBytesPerSend,
LPTRANSMIT_FILE_BUFFERS  lpTransmitBuffers,
DWORD  dwFlags
[virtual]
 

Asynchronous transmitFile.

onTransmitFileCompletion will be called when the send completes.

Parameters:
hFile The file to transmit, may be NULL.
nNumberOfBytesToWrite The number of bytes of the file to transmit
nNumberOfBytesPerSend May be 0 for a default
lpTransmitBuffers Extra head and tail data if required
dwFlags See API documentation

Reimplemented from OW32::CAsyncSocketBase.


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