[Home]BoostSocket/AsynchDatasocketConcept

BOOST WIKI | BoostSocket | RecentChanges | Preferences | Page List | Links List

Difference (from prior major revision) (no other diffs)

Changed: 1,68c1,51
Suggestion for a asynch_data_socket interface, taking a asynch_socket_base and a multiplexor as argument.

template <typename SocketBase?=asynch_socket_base<> , typename Multiplexor>
class asynch_data_socket
: public data_socket<SocketBase?>
{
public:
typedef SocketBase? socket_base_t;
typedef Multiplexor multiplexor_t;

typedef typename socket_base_t::socket_t socket_t;
typedef typename socket_base_t::error_policy error_policy;

typedef boost::function2<void, socket_errno, unsigned int> completion_callback_t;

asynch_data_socket(multiplexor_t& multiplexor)
explicit asynch_data_socket(socket_t socket, multiplexor_t& multiplexor)

//! Asynchronous receive
socket_errno asynch_recv(void* data, int len, completion_callback_t completionRoutine);
//! Asynchronous receive
socket_errno asynch_send(const void* data, int len, completion_callback_t completionRoutine);

~asynch_data_socket()

void reset(socket_t socket = socket_t());

template <typename SocketOption?>
socket_errno ioctl(SocketOption?& option);

template <typename SocketOption?>
socket_errno getsockopt(SocketOption?& option);

template <typename SocketOption?>
socket_errno setsockopt(const SocketOption?& option);

socket_errno close(Direction how=Both);
bool is_open() const;
socket_t socket();
socket_base_t& base();
bool operator<(const data_socket& socket) const;
bool operator==(const data_socket& socket) const;
bool operator!=(const data_socket& socket) const;
private:
socket_base_t m_socket;


}

If a proactor and asynch base socket is used the operations is queued directly to the lower levels, if a reactor is used the operations is queued in the acceptor until an accept notification is received.


Suggestion for a asynch_data_socket interface, taking a asynch_socket_base and a multiplexor as argument.

  template <typename SocketBase?=asynch_socket_base<> , typename Multiplexor>
        class asynch_data_socket
            : public data_socket<SocketBase?>
        {
        public:
            typedef SocketBase? socket_base_t;
            typedef Multiplexor multiplexor_t;

            typedef typename socket_base_t::socket_t socket_t;
            typedef typename socket_base_t::error_policy error_policy;

            typedef boost::function2<void, socket_errno, unsigned  int> completion_callback_t;

            asynch_data_socket(multiplexor_t& multiplexor)
            explicit asynch_data_socket(socket_t socket, multiplexor_t& multiplexor)

            //! Asynchronous receive
            socket_errno asynch_recv(void* data, int len, completion_callback_t completionRoutine);
            //! Asynchronous receive
            socket_errno asynch_send(const void* data, int len, completion_callback_t completionRoutine);

            ~asynch_data_socket()

            void reset(socket_t socket = socket_t());

            template <typename SocketOption?>
            socket_errno ioctl(SocketOption?& option);

            template <typename SocketOption?>
            socket_errno getsockopt(SocketOption?& option);

            template <typename SocketOption?>
            socket_errno setsockopt(const SocketOption?& option);

            socket_errno close(Direction how=Both);
            bool is_open() const;
            socket_t socket();
            socket_base_t& base();
            bool operator<(const data_socket& socket) const;
            bool operator==(const data_socket& socket) const;
            bool operator!=(const data_socket& socket) const;
        private:
            socket_base_t m_socket;

        }

If a proactor and asynch base socket is used the operations is queued directly to the lower levels, if a reactor is used the operations is queued in the acceptor until an accept notification is received.


BOOST WIKI | BoostSocket | RecentChanges | Preferences | Page List | Links List
Edit text of this page | View other revisions
Last edited December 18, 2004 12:31 pm (diff)
Search:
Disclaimer: This site not officially maintained by Boost Developers