#include <ace/Asynch_Acceptor.h>
template<class HANDLER> class ACE_Asynch_Acceptor : public ACE_Handler {
public:ACE_Asynch_Acceptor (void);virtual ~ACE_Asynch_Acceptor (void);virtual int open ( const ACE_INET_Addr &address, size_t bytes_to_read = 0, int pass_addresses = 0, int backlog = ACE_DEFAULT_BACKLOG, int reuse_addr = 1, ACE_Proactor *proactor = 0, int validate_new_connection = 0, int reissue_accept = 1, int number_of_initial_accepts = -1 );virtual ACE_HANDLE get_handle (void) const;virtual void set_handle (ACE_HANDLE handle);virtual int accept ( size_t bytes_to_read = 0, const void *act = 0 );virtual int cancel (void);virtual int validate_new_connection ( const ACE_INET_Addr &remote_address );virtual int should_reissue_accept (void);virtual int pass_addresses (void) const;virtual void pass_addresses (int new_value);virtual int validate_new_connection (void) const;virtual void validate_new_connection (int new_value);virtual int reissue_accept (void) const;virtual void reissue_accept (int new_value);virtual int bytes_to_read (void) const;virtual void bytes_to_read (int new_value);static size_t address_size (void);protected:virtual void handle_accept ( const ACE_Asynch_Accept::Result &result );ACE_HANDLE handle (void) const;void parse_address ( const ACE_Asynch_Accept::Result &result, ACE_INET_Addr &remote_address, ACE_INET_Addr &local_address );virtual HANDLER *make_handler (void);private:ACE_HANDLE listen_handle_;ACE_Asynch_Accept asynch_accept_;int pass_addresses_;int validate_new_connection_;int reissue_accept_;int bytes_to_read_;};
ACE_Acceptor, however, this class is designed to
be used asynchronously.
ACE_Asynch_Acceptor (void);
virtual ~ACE_Asynch_Acceptor (void);
virtual int open (
const ACE_INET_Addr &address,
size_t bytes_to_read = 0,
int pass_addresses = 0,
int backlog = ACE_DEFAULT_BACKLOG,
int reuse_addr = 1,
ACE_Proactor *proactor = 0,
int validate_new_connection = 0,
int reissue_accept = 1,
int number_of_initial_accepts = -1
);
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.
number_of_initial_accepts is the number of asynchronous accepts
that are started at the end of open. If
number_of_initial_accepts is -1, then
number_of_initial_accepts is set to backlog and hence
backlog number of asynchronous accepts are started.
virtual ACE_HANDLE get_handle (void) const;
virtual void set_handle (ACE_HANDLE handle);
virtual int accept (size_t bytes_to_read = 0, const void *act = 0);
AcceptEx
call.
virtual int cancel (void);
virtual int validate_new_connection (
const ACE_INET_Addr &remote_address
);
Default implemenation always validates the remote address.
virtual int should_reissue_accept (void);
Default implemenation always returns this-reissue_accept_.
virtual int pass_addresses (void) const;
virtual void pass_addresses (int new_value);
virtual int validate_new_connection (void) const;
virtual void validate_new_connection (int new_value);
virtual int reissue_accept (void) const;
virtual void reissue_accept (int new_value);
virtual int bytes_to_read (void) const;
virtual void bytes_to_read (int new_value);
accept call.
static size_t address_size (void);
virtual void handle_accept (const ACE_Asynch_Accept::Result &result);
ACE_HANDLE handle (void) const;
void parse_address (
const ACE_Asynch_Accept::Result &result,
ACE_INET_Addr &remote_address,
ACE_INET_Addr &local_address
);
virtual HANDLER *make_handler (void);
ACE_HANDLE listen_handle_;
ACE_Asynch_Accept asynch_accept_;
Asynch_Accept used to make life easier :-)
int pass_addresses_;
int validate_new_connection_;
int reissue_accept_;
int bytes_to_read_;
accept call.