#include <basic_raw_socket.hpp>

Public Types | |
| typedef RawSocketService::native_type | native_type |
| The native representation of a socket. | |
| typedef Protocol | protocol_type |
| The protocol type. | |
| typedef Protocol::endpoint | endpoint_type |
| The endpoint type. | |
Public Member Functions | |
| basic_raw_socket (asio::io_service &io_service) | |
| Construct a basic_raw_socket without opening it. | |
| basic_raw_socket (asio::io_service &io_service, const protocol_type &protocol) | |
| Construct and open a basic_raw_socket. | |
| basic_raw_socket (asio::io_service &io_service, const endpoint_type &endpoint) | |
| basic_raw_socket (asio::io_service &io_service, const protocol_type &protocol, const native_type &native_socket) | |
| Construct a basic_raw_socket on an existing native socket. | |
| template<typename ConstBufferSequence> | |
| std::size_t | send (const ConstBufferSequence &buffers) |
| Send some data on a connected socket. | |
| template<typename ConstBufferSequence> | |
| std::size_t | send (const ConstBufferSequence &buffers, socket_base::message_flags flags) |
| Send some data on a connected socket. | |
| template<typename ConstBufferSequence> | |
| std::size_t | send (const ConstBufferSequence &buffers, socket_base::message_flags flags, asio::error_code &ec) |
| Send some data on a connected socket. | |
| template<typename ConstBufferSequence, typename WriteHandler> | |
| void | async_send (const ConstBufferSequence &buffers, WriteHandler handler) |
| Start an asynchronous send on a connected socket. | |
| template<typename ConstBufferSequence, typename WriteHandler> | |
| void | async_send (const ConstBufferSequence &buffers, socket_base::message_flags flags, WriteHandler handler) |
| Start an asynchronous send on a connected socket. | |
| template<typename ConstBufferSequence> | |
| std::size_t | send_to (const ConstBufferSequence &buffers, const endpoint_type &destination) |
| Send raw data to the specified endpoint. | |
| template<typename ConstBufferSequence> | |
| std::size_t | send_to (const ConstBufferSequence &buffers, const endpoint_type &destination, socket_base::message_flags flags) |
| Send raw data to the specified endpoint. | |
| template<typename ConstBufferSequence> | |
| std::size_t | send_to (const ConstBufferSequence &buffers, const endpoint_type &destination, socket_base::message_flags flags, asio::error_code &ec) |
| Send raw data to the specified endpoint. | |
| template<typename ConstBufferSequence, typename WriteHandler> | |
| void | async_send_to (const ConstBufferSequence &buffers, const endpoint_type &destination, WriteHandler handler) |
| Start an asynchronous send. | |
| template<typename ConstBufferSequence, typename WriteHandler> | |
| void | async_send_to (const ConstBufferSequence &buffers, const endpoint_type &destination, socket_base::message_flags flags, WriteHandler handler) |
| Start an asynchronous send. | |
| template<typename MutableBufferSequence> | |
| std::size_t | receive (const MutableBufferSequence &buffers) |
| Receive some data on a connected socket. | |
| template<typename MutableBufferSequence> | |
| std::size_t | receive (const MutableBufferSequence &buffers, socket_base::message_flags flags) |
| Receive some data on a connected socket. | |
| template<typename MutableBufferSequence> | |
| std::size_t | receive (const MutableBufferSequence &buffers, socket_base::message_flags flags, asio::error_code &ec) |
| Receive some data on a connected socket. | |
| template<typename MutableBufferSequence, typename ReadHandler> | |
| void | async_receive (const MutableBufferSequence &buffers, ReadHandler handler) |
| Start an asynchronous receive on a connected socket. | |
| template<typename MutableBufferSequence, typename ReadHandler> | |
| void | async_receive (const MutableBufferSequence &buffers, socket_base::message_flags flags, ReadHandler handler) |
| Start an asynchronous receive on a connected socket. | |
| template<typename MutableBufferSequence> | |
| std::size_t | receive_from (const MutableBufferSequence &buffers, endpoint_type &sender_endpoint) |
| Receive raw data with the endpoint of the sender. | |
| template<typename MutableBufferSequence> | |
| std::size_t | receive_from (const MutableBufferSequence &buffers, endpoint_type &sender_endpoint, socket_base::message_flags flags) |
| Receive raw data with the endpoint of the sender. | |
| template<typename MutableBufferSequence> | |
| std::size_t | receive_from (const MutableBufferSequence &buffers, endpoint_type &sender_endpoint, socket_base::message_flags flags, asio::error_code &ec) |
| Receive raw data with the endpoint of the sender. | |
| template<typename MutableBufferSequence, typename ReadHandler> | |
| void | async_receive_from (const MutableBufferSequence &buffers, endpoint_type &sender_endpoint, ReadHandler handler) |
| Start an asynchronous receive. | |
| template<typename MutableBufferSequence, typename ReadHandler> | |
| void | async_receive_from (const MutableBufferSequence &buffers, endpoint_type &sender_endpoint, socket_base::message_flags flags, ReadHandler handler) |
| Start an asynchronous receive. | |
The basic_raw_socket class template provides asynchronous and blocking raw-oriented socket functionality.
| typedef RawSocketService::native_type asio::basic_raw_socket< Protocol, RawSocketService >::native_type |
The native representation of a socket.
Reimplemented from asio::basic_socket< Protocol, RawSocketService >.
| typedef Protocol asio::basic_raw_socket< Protocol, RawSocketService >::protocol_type |
| typedef Protocol::endpoint asio::basic_raw_socket< Protocol, RawSocketService >::endpoint_type |
| asio::basic_raw_socket< Protocol, RawSocketService >::basic_raw_socket | ( | asio::io_service & | io_service | ) | [inline, explicit] |
Construct a basic_raw_socket without opening it.
This constructor creates a raw socket without opening it. The open() function must be called before data can be sent or received on the socket.
| io_service | The io_service object that the raw socket will use to dispatch handlers for any asynchronous operations performed on the socket. |
| asio::basic_raw_socket< Protocol, RawSocketService >::basic_raw_socket | ( | asio::io_service & | io_service, | |
| const protocol_type & | protocol | |||
| ) | [inline] |
Construct and open a basic_raw_socket.
This constructor creates and opens a raw socket.
| io_service | The io_service object that the raw socket will use to dispatch handlers for any asynchronous operations performed on the socket. | |
| protocol | An object specifying protocol parameters to be used. |
| asio::system_error | Thrown on failure. |
| asio::basic_raw_socket< Protocol, RawSocketService >::basic_raw_socket | ( | asio::io_service & | io_service, | |
| const endpoint_type & | endpoint | |||
| ) | [inline] |
Construct a basic_raw_socket, opening it and binding it to the given local endpoint. This constructor creates a raw socket and automatically opens it bound to the specified endpoint on the local machine. The protocol used is the protocol associated with the given endpoint.
| io_service | The io_service object that the raw socket will use to dispatch handlers for any asynchronous operations performed on the socket. | |
| endpoint | An endpoint on the local machine to which the raw socket will be bound. |
| asio::system_error | Thrown on failure. |
| asio::basic_raw_socket< Protocol, RawSocketService >::basic_raw_socket | ( | asio::io_service & | io_service, | |
| const protocol_type & | protocol, | |||
| const native_type & | native_socket | |||
| ) | [inline] |
Construct a basic_raw_socket on an existing native socket.
This constructor creates a raw socket object to hold an existing native socket.
| io_service | The io_service object that the raw socket will use to dispatch handlers for any asynchronous operations performed on the socket. | |
| protocol | An object specifying protocol parameters to be used. | |
| native_socket | The new underlying socket implementation. |
| asio::system_error | Thrown on failure. |
| std::size_t asio::basic_raw_socket< Protocol, RawSocketService >::send | ( | const ConstBufferSequence & | buffers | ) | [inline] |
Send some data on a connected socket.
This function is used to send data on the raw socket. The function call will block until the data has been sent successfully or an error occurs.
| buffers | One ore more data buffers to be sent on the socket. |
| asio::system_error | Thrown on failure. |
socket.send(asio::buffer(data, size));
| std::size_t asio::basic_raw_socket< Protocol, RawSocketService >::send | ( | const ConstBufferSequence & | buffers, | |
| socket_base::message_flags | flags | |||
| ) | [inline] |
Send some data on a connected socket.
This function is used to send data on the raw socket. The function call will block until the data has been sent successfully or an error occurs.
| buffers | One ore more data buffers to be sent on the socket. | |
| flags | Flags specifying how the send call is to be made. |
| asio::system_error | Thrown on failure. |
| std::size_t asio::basic_raw_socket< Protocol, RawSocketService >::send | ( | const ConstBufferSequence & | buffers, | |
| socket_base::message_flags | flags, | |||
| asio::error_code & | ec | |||
| ) | [inline] |
Send some data on a connected socket.
This function is used to send data on the raw socket. The function call will block until the data has been sent successfully or an error occurs.
| buffers | One or more data buffers to be sent on the socket. | |
| flags | Flags specifying how the send call is to be made. | |
| ec | Set to indicate what error occurred, if any. |
| void asio::basic_raw_socket< Protocol, RawSocketService >::async_send | ( | const ConstBufferSequence & | buffers, | |
| WriteHandler | handler | |||
| ) | [inline] |
Start an asynchronous send on a connected socket.
This function is used to send data on the raw socket. The function call will block until the data has been sent successfully or an error occurs.
| buffers | One or more data buffers to be sent on the socket. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called. | |
| handler | The handler to be called when the send operation completes. Copies will be made of the handler as required. The function signature of the handler must be: void handler( const asio::error_code& error, // Result of operation. std::size_t bytes_transferred // Number of bytes sent. ); |
socket.async_send(asio::buffer(data, size), handler);
| void asio::basic_raw_socket< Protocol, RawSocketService >::async_send | ( | const ConstBufferSequence & | buffers, | |
| socket_base::message_flags | flags, | |||
| WriteHandler | handler | |||
| ) | [inline] |
Start an asynchronous send on a connected socket.
This function is used to send data on the raw socket. The function call will block until the data has been sent successfully or an error occurs.
| buffers | One or more data buffers to be sent on the socket. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called. | |
| flags | Flags specifying how the send call is to be made. | |
| handler | The handler to be called when the send operation completes. Copies will be made of the handler as required. The function signature of the handler must be: void handler( const asio::error_code& error, // Result of operation. std::size_t bytes_transferred // Number of bytes sent. ); |
| std::size_t asio::basic_raw_socket< Protocol, RawSocketService >::send_to | ( | const ConstBufferSequence & | buffers, | |
| const endpoint_type & | destination | |||
| ) | [inline] |
Send raw data to the specified endpoint.
This function is used to send raw data to the specified remote endpoint. The function call will block until the data has been sent successfully or an error occurs.
| buffers | One or more data buffers to be sent to the remote endpoint. | |
| destination | The remote endpoint to which the data will be sent. |
| asio::system_error | Thrown on failure. |
asio::ip::udp::endpoint destination( asio::ip::address::from_string("1.2.3.4"), 12345); socket.send_to(asio::buffer(data, size), destination);
| std::size_t asio::basic_raw_socket< Protocol, RawSocketService >::send_to | ( | const ConstBufferSequence & | buffers, | |
| const endpoint_type & | destination, | |||
| socket_base::message_flags | flags | |||
| ) | [inline] |
Send raw data to the specified endpoint.
This function is used to send raw data to the specified remote endpoint. The function call will block until the data has been sent successfully or an error occurs.
| buffers | One or more data buffers to be sent to the remote endpoint. | |
| destination | The remote endpoint to which the data will be sent. | |
| flags | Flags specifying how the send call is to be made. |
| asio::system_error | Thrown on failure. |
| std::size_t asio::basic_raw_socket< Protocol, RawSocketService >::send_to | ( | const ConstBufferSequence & | buffers, | |
| const endpoint_type & | destination, | |||
| socket_base::message_flags | flags, | |||
| asio::error_code & | ec | |||
| ) | [inline] |
Send raw data to the specified endpoint.
This function is used to send raw data to the specified remote endpoint. The function call will block until the data has been sent successfully or an error occurs.
| buffers | One or more data buffers to be sent to the remote endpoint. | |
| destination | The remote endpoint to which the data will be sent. | |
| flags | Flags specifying how the send call is to be made. | |
| ec | Set to indicate what error occurred, if any. |
| void asio::basic_raw_socket< Protocol, RawSocketService >::async_send_to | ( | const ConstBufferSequence & | buffers, | |
| const endpoint_type & | destination, | |||
| WriteHandler | handler | |||
| ) | [inline] |
Start an asynchronous send.
This function is used to asynchronously send raw data to the specified remote endpoint. The function call always returns immediately.
| buffers | One or more data buffers to be sent to the remote endpoint. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called. | |
| destination | The remote endpoint to which the data will be sent. Copies will be made of the endpoint as required. | |
| handler | The handler to be called when the send operation completes. Copies will be made of the handler as required. The function signature of the handler must be: void handler( const asio::error_code& error, // Result of operation. std::size_t bytes_transferred // Number of bytes sent. ); |
asio::ip::udp::endpoint destination( asio::ip::address::from_string("1.2.3.4"), 12345); socket.async_send_to( asio::buffer(data, size), destination, handler);
| void asio::basic_raw_socket< Protocol, RawSocketService >::async_send_to | ( | const ConstBufferSequence & | buffers, | |
| const endpoint_type & | destination, | |||
| socket_base::message_flags | flags, | |||
| WriteHandler | handler | |||
| ) | [inline] |
Start an asynchronous send.
This function is used to asynchronously send raw data to the specified remote endpoint. The function call always returns immediately.
| buffers | One or more data buffers to be sent to the remote endpoint. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called. | |
| flags | Flags specifying how the send call is to be made. | |
| destination | The remote endpoint to which the data will be sent. Copies will be made of the endpoint as required. | |
| handler | The handler to be called when the send operation completes. Copies will be made of the handler as required. The function signature of the handler must be: void handler( const asio::error_code& error, // Result of operation. std::size_t bytes_transferred // Number of bytes sent. ); |
| std::size_t asio::basic_raw_socket< Protocol, RawSocketService >::receive | ( | const MutableBufferSequence & | buffers | ) | [inline] |
Receive some data on a connected socket.
This function is used to receive data on the raw socket. The function call will block until data has been received successfully or an error occurs.
| buffers | One or more buffers into which the data will be received. |
| asio::system_error | Thrown on failure. |
socket.receive(asio::buffer(data, size));
| std::size_t asio::basic_raw_socket< Protocol, RawSocketService >::receive | ( | const MutableBufferSequence & | buffers, | |
| socket_base::message_flags | flags | |||
| ) | [inline] |
Receive some data on a connected socket.
This function is used to receive data on the raw socket. The function call will block until data has been received successfully or an error occurs.
| buffers | One or more buffers into which the data will be received. | |
| flags | Flags specifying how the receive call is to be made. |
| asio::system_error | Thrown on failure. |
| std::size_t asio::basic_raw_socket< Protocol, RawSocketService >::receive | ( | const MutableBufferSequence & | buffers, | |
| socket_base::message_flags | flags, | |||
| asio::error_code & | ec | |||
| ) | [inline] |
Receive some data on a connected socket.
This function is used to receive data on the raw socket. The function call will block until data has been received successfully or an error occurs.
| buffers | One or more buffers into which the data will be received. | |
| flags | Flags specifying how the receive call is to be made. | |
| ec | Set to indicate what error occurred, if any. |
| void asio::basic_raw_socket< Protocol, RawSocketService >::async_receive | ( | const MutableBufferSequence & | buffers, | |
| ReadHandler | handler | |||
| ) | [inline] |
Start an asynchronous receive on a connected socket.
This function is used to asynchronously receive data from the raw socket. The function call always returns immediately.
| buffers | One or more buffers into which the data will be received. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called. | |
| handler | The handler to be called when the receive operation completes. Copies will be made of the handler as required. The function signature of the handler must be: void handler( const asio::error_code& error, // Result of operation. std::size_t bytes_transferred // Number of bytes received. ); |
socket.async_receive(asio::buffer(data, size), handler);
| void asio::basic_raw_socket< Protocol, RawSocketService >::async_receive | ( | const MutableBufferSequence & | buffers, | |
| socket_base::message_flags | flags, | |||
| ReadHandler | handler | |||
| ) | [inline] |
Start an asynchronous receive on a connected socket.
This function is used to asynchronously receive data from the raw socket. The function call always returns immediately.
| buffers | One or more buffers into which the data will be received. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called. | |
| flags | Flags specifying how the receive call is to be made. | |
| handler | The handler to be called when the receive operation completes. Copies will be made of the handler as required. The function signature of the handler must be: void handler( const asio::error_code& error, // Result of operation. std::size_t bytes_transferred // Number of bytes received. ); |
| std::size_t asio::basic_raw_socket< Protocol, RawSocketService >::receive_from | ( | const MutableBufferSequence & | buffers, | |
| endpoint_type & | sender_endpoint | |||
| ) | [inline] |
Receive raw data with the endpoint of the sender.
This function is used to receive raw data. The function call will block until data has been received successfully or an error occurs.
| buffers | One or more buffers into which the data will be received. | |
| sender_endpoint | An endpoint object that receives the endpoint of the remote sender of the data. |
| asio::system_error | Thrown on failure. |
asio::ip::udp::endpoint sender_endpoint; socket.receive_from( asio::buffer(data, size), sender_endpoint);
| std::size_t asio::basic_raw_socket< Protocol, RawSocketService >::receive_from | ( | const MutableBufferSequence & | buffers, | |
| endpoint_type & | sender_endpoint, | |||
| socket_base::message_flags | flags | |||
| ) | [inline] |
Receive raw data with the endpoint of the sender.
This function is used to receive raw data. The function call will block until data has been received successfully or an error occurs.
| buffers | One or more buffers into which the data will be received. | |
| sender_endpoint | An endpoint object that receives the endpoint of the remote sender of the data. | |
| flags | Flags specifying how the receive call is to be made. |
| asio::system_error | Thrown on failure. |
| std::size_t asio::basic_raw_socket< Protocol, RawSocketService >::receive_from | ( | const MutableBufferSequence & | buffers, | |
| endpoint_type & | sender_endpoint, | |||
| socket_base::message_flags | flags, | |||
| asio::error_code & | ec | |||
| ) | [inline] |
Receive raw data with the endpoint of the sender.
This function is used to receive raw data. The function call will block until data has been received successfully or an error occurs.
| buffers | One or more buffers into which the data will be received. | |
| sender_endpoint | An endpoint object that receives the endpoint of the remote sender of the data. | |
| flags | Flags specifying how the receive call is to be made. | |
| ec | Set to indicate what error occurred, if any. |
| void asio::basic_raw_socket< Protocol, RawSocketService >::async_receive_from | ( | const MutableBufferSequence & | buffers, | |
| endpoint_type & | sender_endpoint, | |||
| ReadHandler | handler | |||
| ) | [inline] |
Start an asynchronous receive.
This function is used to asynchronously receive raw data. The function call always returns immediately.
| buffers | One or more buffers into which the data will be received. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called. | |
| sender_endpoint | An endpoint object that receives the endpoint of the remote sender of the data. Ownership of the sender_endpoint object is retained by the caller, which must guarantee that it is valid until the handler is called. | |
| handler | The handler to be called when the receive operation completes. Copies will be made of the handler as required. The function signature of the handler must be: void handler( const asio::error_code& error, // Result of operation. std::size_t bytes_transferred // Number of bytes received. ); |
socket.async_receive_from( asio::buffer(data, size), 0, sender_endpoint, handler);
| void asio::basic_raw_socket< Protocol, RawSocketService >::async_receive_from | ( | const MutableBufferSequence & | buffers, | |
| endpoint_type & | sender_endpoint, | |||
| socket_base::message_flags | flags, | |||
| ReadHandler | handler | |||
| ) | [inline] |
Start an asynchronous receive.
This function is used to asynchronously receive raw data. The function call always returns immediately.
| buffers | One or more buffers into which the data will be received. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called. | |
| sender_endpoint | An endpoint object that receives the endpoint of the remote sender of the data. Ownership of the sender_endpoint object is retained by the caller, which must guarantee that it is valid until the handler is called. | |
| flags | Flags specifying how the receive call is to be made. | |
| handler | The handler to be called when the receive operation completes. Copies will be made of the handler as required. The function signature of the handler must be: void handler( const asio::error_code& error, // Result of operation. std::size_t bytes_transferred // Number of bytes received. ); |
1.5.4