Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_Asynch_Read_Dgram Class Reference

This class is a factory for starting off asynchronous reads on a UDP socket. This class forwards all methods to its implementation class. More...

#include <Asynch_IO.h>

Inheritance diagram for ACE_Asynch_Read_Dgram:

Inheritance graph
Collaboration diagram for ACE_Asynch_Read_Dgram:

Collaboration graph
List of all members.

Public Methods

 ACE_Asynch_Read_Dgram (void)
 A do nothing constructor. More...

virtual ~ACE_Asynch_Read_Dgram (void)
 Destructor. More...

int open (ACE_Handler &handler, ACE_HANDLE handle=ACE_INVALID_HANDLE, const void *completion_key=0, ACE_Proactor *proactor=0)
ssize_t recv (ACE_Message_Block *message_block, size_t &number_of_bytes_recvd, int flags, int protocol_family=PF_INET, const void *act=0, int priority=0, int signal_number=ACE_SIGRTMIN)
ACE_Asynch_Read_Dgram_Implimplementation (void) const
 Return the underlying implementation class. More...

Protected Methods

void implementation (ACE_Asynch_Read_Dgram_Impl *implementation)
 Set the implementation class. More...

Protected Attributes

 Implementation class that all methods will be forwarded to. More...

Detailed Description

This class is a factory for starting off asynchronous reads on a UDP socket. This class forwards all methods to its implementation class.

Once <open> is called, multiple asynchronous <read>s can be started using this class. An ACE_Asynch_Read_Dgram::Result will be passed back to the <handler> when the asynchronous reads completes through the <ACE_Handler::handle_read_dgram> callback.

Definition at line 1212 of file Asynch_IO.h.

Constructor & Destructor Documentation

ACE_Asynch_Read_Dgram::ACE_Asynch_Read_Dgram void   

A do nothing constructor.

Definition at line 1220 of file Asynch_IO.cpp.

01221   : implementation_ (0)
01222 {
01223 }

ACE_Asynch_Read_Dgram::~ACE_Asynch_Read_Dgram void    [virtual]


Definition at line 1225 of file Asynch_IO.cpp.

01226 {
01227 }

Member Function Documentation

void ACE_Asynch_Read_Dgram::implementation ACE_Asynch_Read_Dgram_Impl   implementation [protected]

Set the implementation class.

Definition at line 1282 of file Asynch_IO.cpp.

References ACE_Asynch_Operation::implementation, and implementation_.

01283 {
01284   this->implementation_ = implementation;
01286   // Init the bas class' implementation also.
01287   ACE_Asynch_Operation::implementation(this->implementation_);
01288 }

ACE_Asynch_Read_Dgram_Impl * ACE_Asynch_Read_Dgram::implementation void    const

Return the underlying implementation class.

Reimplemented from ACE_Asynch_Operation.

Definition at line 1276 of file Asynch_IO.cpp.

References implementation_.

Referenced by open, recv, and ACE_Asynch_Read_Dgram::Result::Result.

01277 {
01278   return implementation_;
01279 }

int ACE_Asynch_Read_Dgram::open ACE_Handler   handler,
const void *    completion_key = 0,
ACE_Proactor   proactor = 0

Initializes the factory with information which will be used with each asynchronous call. If (<handle> == ACE_INVALID_HANDLE), <ACE_Handler::handle> will be called on the <handler> to get the correct handle.

Reimplemented from ACE_Asynch_Operation.

Definition at line 1230 of file Asynch_IO.cpp.

References ACE_Proactor::create_asynch_read_dgram, ACE_Asynch_Operation::get_proactor, implementation, implementation_, and ACE_Asynch_Operation::open.

01234 {
01235   // Get a proactor for/from the user.
01236   proactor = this->get_proactor (proactor, handler);
01238   // Delete the old implementation.
01239   delete this->implementation_;
01240   this->implementation_ = 0;
01242   // Now let us get the implementation initialized.
01243   ACE_Asynch_Read_Dgram_Impl *implementation = proactor->create_asynch_read_dgram ();
01244   if (implementation == 0)
01245     return -1;
01247   // Set the implementation class
01248   this->implementation (implementation);
01250   // Call the <open> method of the base class. 
01251   return ACE_Asynch_Operation::open (handler,
01252                                      handle,
01253                                      completion_key,
01254                                      proactor);
01255 }

ssize_t ACE_Asynch_Read_Dgram::recv ACE_Message_Block   message_block,
size_t &    number_of_bytes_recvd,
int    flags,
int    protocol_family = PF_INET,
const void *    act = 0,
int    priority = 0,
int    signal_number = ACE_SIGRTMIN

This starts off an asynchronous read. Upto <message_block->total_size()> will be read and stored in the <message_block>. <message_block>'s <wr_ptr> will be updated to reflect the added bytes if the read operation is successfully completed. Return code of 1 means immediate success and <number_of_bytes_recvd> will contain number of bytes read. The <ACE_Handler::handle_read_dgram> method will still be called. Return code of 0 means the IO will complete proactively. Return code of -1 means there was an error, use errno to get the error code.

Scatter/gather is supported on WIN32 by using the <message_block->cont()> method. Up to ACE_IOV_MAX <message_block>'s are supported. Upto <message_block->size()> bytes will be read into each <message block> for a total of <message_block->total_size()> bytes. All <message_block>'s <wr_ptr>'s will be updated to reflect the added bytes for each <message_block>

Priority of the operation is specified by <priority>. On POSIX4-Unix, this is supported. Works like <nice> in Unix. Negative values are not allowed. 0 means priority of the operation same as the process priority. 1 means priority of the operation is one less than process. And so forth. On Win32, <priority> is a no-op. <signal_number> is the POSIX4 real-time signal number to be used for the operation. <signal_number> ranges from ACE_SIGRTMIN to ACE_SIGRTMAX. This argument is a no-op on non-POSIX4 systems.

Definition at line 1258 of file Asynch_IO.cpp.

References implementation, and ACE_Asynch_Read_Dgram_Impl::recv.

01265 {
01266   return this->implementation ()->recv (message_block,
01267                                         number_of_bytes_recvd,
01268                                         flags,
01269                                         protocol_family,
01270                                         act,
01271                                         priority,
01272                                         signal_number);
01273 }

Member Data Documentation

ACE_Asynch_Read_Dgram_Impl* ACE_Asynch_Read_Dgram::implementation_ [protected]

Implementation class that all methods will be forwarded to.

Reimplemented from ACE_Asynch_Operation.

Definition at line 1275 of file Asynch_IO.h.

Referenced by ACE_Asynch_Write_Dgram::ACE_Asynch_Write_Dgram, implementation, open, and ACE_Asynch_Read_Dgram::Result::Result.

The documentation for this class was generated from the following files:
Generated on Mon Jun 16 12:45:19 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002