#include <ace/Asynch_Acceptor.h>
template<class HANDLER> class ACE_Asynch_Acceptor : public ACE_Handler {
public:
ACE_Asynch_Acceptor (void);
~ACE_Asynch_Acceptor (void);
int open ( const ACE_INET_Addr &address, size_t bytes_to_read = 0, int pass_addresses = 0, int backlog = 5, int reuse_addr = 1, ACE_Proactor *proactor = 0 );
virtual int accept (size_t bytes_to_read = 0);
static size_t address_size (void);
int cancel (void);
protected:
virtual void handle_accept ( const ACE_Asynch_Accept::Result &result );
ACE_HANDLE handle (void) const;
void parse_address ( ACE_Message_Block &message_block, ACE_INET_Addr &remote_address, ACE_INET_Addr &local_address );
virtual HANDLER *make_handler (void);
int bytes_to_read (void) const;
private:
ACE_HANDLE listen_handle_;
ACE_Asynch_Accept asynch_accept_;
int pass_addresses_;
int bytes_to_read_;
};
ACE_Acceptor
, however, this class is designed to
be used asynchronously.
ACE_Asynch_Acceptor (void);
~ACE_Asynch_Acceptor (void);
int open (
const ACE_INET_Addr &address,
size_t bytes_to_read = 0,
int pass_addresses = 0,
int backlog = 5,
int reuse_addr = 1,
ACE_Proactor *proactor = 0
);
address
. ACE_Asynch_Acceptor initiates the AcceptEx calls with
bytes_to_read
. The buffer for the initial data will be created
by ACE_Asynch_Acceptor. This buffer will be passed to the
handler in the ACE_Service_Handler::open
callback. If this
buffer is required past the open
callback, the
ACE_Service_Handler must copy the data. If the pass_addresses
flag is set, ACE_Asynch_Acceptor will call
ACE_Service_Handler::addresses
before calling
ACE_Service_Handler::open
. The backlog
parameter specifies
the listen backlog and the outstanding AcceptEx calls.
virtual int accept (size_t bytes_to_read = 0);
AcceptEx
call.
static size_t address_size (void);
int cancel (void);
virtual void handle_accept (const ACE_Asynch_Accept::Result &result);
ACE_HANDLE handle (void) const;
void parse_address (
ACE_Message_Block &message_block,
ACE_INET_Addr &remote_address,
ACE_INET_Addr &local_address
);
virtual HANDLER *make_handler (void);
int bytes_to_read (void) const;
accept
call.
ACE_HANDLE listen_handle_;
ACE_Asynch_Accept asynch_accept_;
Asynch_Accept
used to make life easier :-)
int pass_addresses_;
int bytes_to_read_;
accept
call.