Provides raw-oriented socket functionality. More...
#include <basic_raw_socket.hpp>
Public Types | |
typedef RawSocketService::native_handle_type | native_type |
(Deprecated: Use native_handle_type.) The native representation of a socket. More... | |
typedef RawSocketService::native_handle_type | native_handle_type |
The native representation of a socket. More... | |
typedef Protocol | protocol_type |
The protocol type. More... | |
typedef Protocol::endpoint | endpoint_type |
The endpoint type. More... | |
typedef basic_socket< Protocol, RawSocketService > | lowest_layer_type |
A basic_socket is always the lowest layer. More... | |
typedef RawSocketService | service_type |
The type of the service that will be used to provide I/O operations. More... | |
typedef service_type::implementation_type | implementation_type |
The underlying implementation type of I/O object. More... | |
enum | shutdown_type { shutdown_receive = BOOST_ASIO_OS_DEF(SHUT_RD), shutdown_send = BOOST_ASIO_OS_DEF(SHUT_WR), shutdown_both = BOOST_ASIO_OS_DEF(SHUT_RDWR) } |
Different ways a socket may be shutdown. More... | |
typedef int | message_flags |
Bitmask type for flags that can be passed to send and receive operations. More... | |
typedef boost::asio::detail::socket_option::boolean < BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_BROADCAST)> | broadcast |
Socket option to permit sending of broadcast messages. More... | |
typedef boost::asio::detail::socket_option::boolean < BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_DEBUG)> | debug |
Socket option to enable socket-level debugging. More... | |
typedef boost::asio::detail::socket_option::boolean < BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_DONTROUTE)> | do_not_route |
Socket option to prevent routing, use local interfaces only. More... | |
typedef boost::asio::detail::socket_option::boolean < BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_KEEPALIVE)> | keep_alive |
Socket option to send keep-alives. More... | |
typedef boost::asio::detail::socket_option::integer < BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_SNDBUF)> | send_buffer_size |
Socket option for the send buffer size of a socket. More... | |
typedef boost::asio::detail::socket_option::integer < BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_SNDLOWAT)> | send_low_watermark |
Socket option for the send low watermark. More... | |
typedef boost::asio::detail::socket_option::integer < BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_RCVBUF)> | receive_buffer_size |
Socket option for the receive buffer size of a socket. More... | |
typedef boost::asio::detail::socket_option::integer < BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_RCVLOWAT)> | receive_low_watermark |
Socket option for the receive low watermark. More... | |
typedef boost::asio::detail::socket_option::boolean < BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_REUSEADDR)> | reuse_address |
Socket option to allow the socket to be bound to an address that is already in use. More... | |
typedef boost::asio::detail::socket_option::linger < BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_LINGER)> | linger |
Socket option to specify whether the socket lingers on close if unsent data is present. More... | |
typedef boost::asio::detail::socket_option::boolean < boost::asio::detail::custom_socket_option_level, boost::asio::detail::enable_connection_aborted_option > | enable_connection_aborted |
Socket option to report aborted connections on accept. More... | |
typedef boost::asio::detail::io_control::non_blocking_io | non_blocking_io |
(Deprecated: Use non_blocking().) IO control command to set the blocking mode of the socket. More... | |
typedef boost::asio::detail::io_control::bytes_readable | bytes_readable |
IO control command to get the amount of data that can be read without blocking. More... | |
Public Member Functions | |
basic_raw_socket (boost::asio::io_service &io_service) | |
Construct a basic_raw_socket without opening it. More... | |
basic_raw_socket (boost::asio::io_service &io_service, const protocol_type &protocol) | |
Construct and open a basic_raw_socket. More... | |
basic_raw_socket (boost::asio::io_service &io_service, const endpoint_type &endpoint) | |
Construct a basic_raw_socket, opening it and binding it to the given local endpoint. More... | |
basic_raw_socket (boost::asio::io_service &io_service, const protocol_type &protocol, const native_handle_type &native_socket) | |
Construct a basic_raw_socket on an existing native socket. More... | |
template<typename ConstBufferSequence > | |
std::size_t | send (const ConstBufferSequence &buffers) |
Send some data on a connected socket. More... | |
template<typename ConstBufferSequence > | |
std::size_t | send (const ConstBufferSequence &buffers, socket_base::message_flags flags) |
Send some data on a connected socket. More... | |
template<typename ConstBufferSequence > | |
std::size_t | send (const ConstBufferSequence &buffers, socket_base::message_flags flags, boost::system::error_code &ec) |
Send some data on a connected socket. More... | |
template<typename ConstBufferSequence , typename WriteHandler > | |
BOOST_ASIO_INITFN_RESULT_TYPE (WriteHandler, void(boost::system::error_code, std::size_t)) async_send(const ConstBufferSequence &buffers | |
Start an asynchronous send on a connected socket. More... | |
BOOST_ASIO_MOVE_ARG (WriteHandler) handler) | |
template<typename ConstBufferSequence , typename WriteHandler > | |
BOOST_ASIO_INITFN_RESULT_TYPE (WriteHandler, void(boost::system::error_code, std::size_t)) async_send(const ConstBufferSequence &buffers | |
Start an asynchronous send on a connected socket. More... | |
socket_base::message_flags | BOOST_ASIO_MOVE_ARG (WriteHandler) handler) |
template<typename ConstBufferSequence > | |
std::size_t | send_to (const ConstBufferSequence &buffers, const endpoint_type &destination) |
Send raw data to the specified endpoint. More... | |
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. More... | |
template<typename ConstBufferSequence > | |
std::size_t | send_to (const ConstBufferSequence &buffers, const endpoint_type &destination, socket_base::message_flags flags, boost::system::error_code &ec) |
Send raw data to the specified endpoint. More... | |
template<typename ConstBufferSequence , typename WriteHandler > | |
BOOST_ASIO_INITFN_RESULT_TYPE (WriteHandler, void(boost::system::error_code, std::size_t)) async_send_to(const ConstBufferSequence &buffers | |
Start an asynchronous send. More... | |
const endpoint_type | BOOST_ASIO_MOVE_ARG (WriteHandler) handler) |
template<typename ConstBufferSequence , typename WriteHandler > | |
BOOST_ASIO_INITFN_RESULT_TYPE (WriteHandler, void(boost::system::error_code, std::size_t)) async_send_to(const ConstBufferSequence &buffers | |
Start an asynchronous send. More... | |
const endpoint_type socket_base::message_flags | BOOST_ASIO_MOVE_ARG (WriteHandler) handler) |
template<typename MutableBufferSequence > | |
std::size_t | receive (const MutableBufferSequence &buffers) |
Receive some data on a connected socket. More... | |
template<typename MutableBufferSequence > | |
std::size_t | receive (const MutableBufferSequence &buffers, socket_base::message_flags flags) |
Receive some data on a connected socket. More... | |
template<typename MutableBufferSequence > | |
std::size_t | receive (const MutableBufferSequence &buffers, socket_base::message_flags flags, boost::system::error_code &ec) |
Receive some data on a connected socket. More... | |
template<typename MutableBufferSequence , typename ReadHandler > | |
BOOST_ASIO_INITFN_RESULT_TYPE (ReadHandler, void(boost::system::error_code, std::size_t)) async_receive(const MutableBufferSequence &buffers | |
Start an asynchronous receive on a connected socket. More... | |
BOOST_ASIO_MOVE_ARG (ReadHandler) handler) | |
template<typename MutableBufferSequence , typename ReadHandler > | |
BOOST_ASIO_INITFN_RESULT_TYPE (ReadHandler, void(boost::system::error_code, std::size_t)) async_receive(const MutableBufferSequence &buffers | |
Start an asynchronous receive on a connected socket. More... | |
socket_base::message_flags | BOOST_ASIO_MOVE_ARG (ReadHandler) handler) |
template<typename MutableBufferSequence > | |
std::size_t | receive_from (const MutableBufferSequence &buffers, endpoint_type &sender_endpoint) |
Receive raw data with the endpoint of the sender. More... | |
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. More... | |
template<typename MutableBufferSequence > | |
std::size_t | receive_from (const MutableBufferSequence &buffers, endpoint_type &sender_endpoint, socket_base::message_flags flags, boost::system::error_code &ec) |
Receive raw data with the endpoint of the sender. More... | |
template<typename MutableBufferSequence , typename ReadHandler > | |
BOOST_ASIO_INITFN_RESULT_TYPE (ReadHandler, void(boost::system::error_code, std::size_t)) async_receive_from(const MutableBufferSequence &buffers | |
Start an asynchronous receive. More... | |
endpoint_type | BOOST_ASIO_MOVE_ARG (ReadHandler) handler) |
template<typename MutableBufferSequence , typename ReadHandler > | |
BOOST_ASIO_INITFN_RESULT_TYPE (ReadHandler, void(boost::system::error_code, std::size_t)) async_receive_from(const MutableBufferSequence &buffers | |
Start an asynchronous receive. More... | |
endpoint_type socket_base::message_flags | BOOST_ASIO_MOVE_ARG (ReadHandler) handler) |
lowest_layer_type & | lowest_layer () |
Get a reference to the lowest layer. More... | |
const lowest_layer_type & | lowest_layer () const |
Get a const reference to the lowest layer. More... | |
void | open (const protocol_type &protocol=protocol_type()) |
Open the socket using the specified protocol. More... | |
boost::system::error_code | open (const protocol_type &protocol, boost::system::error_code &ec) |
Open the socket using the specified protocol. More... | |
void | assign (const protocol_type &protocol, const native_handle_type &native_socket) |
Assign an existing native socket to the socket. More... | |
boost::system::error_code | assign (const protocol_type &protocol, const native_handle_type &native_socket, boost::system::error_code &ec) |
Assign an existing native socket to the socket. More... | |
bool | is_open () const |
Determine whether the socket is open. More... | |
void | close () |
Close the socket. More... | |
boost::system::error_code | close (boost::system::error_code &ec) |
Close the socket. More... | |
native_type | native () |
(Deprecated: Use native_handle().) Get the native socket representation. More... | |
native_handle_type | native_handle () |
Get the native socket representation. More... | |
void | cancel () |
Cancel all asynchronous operations associated with the socket. More... | |
boost::system::error_code | cancel (boost::system::error_code &ec) |
Cancel all asynchronous operations associated with the socket. More... | |
bool | at_mark () const |
Determine whether the socket is at the out-of-band data mark. More... | |
bool | at_mark (boost::system::error_code &ec) const |
Determine whether the socket is at the out-of-band data mark. More... | |
std::size_t | available () const |
Determine the number of bytes available for reading. More... | |
std::size_t | available (boost::system::error_code &ec) const |
Determine the number of bytes available for reading. More... | |
void | bind (const endpoint_type &endpoint) |
Bind the socket to the given local endpoint. More... | |
boost::system::error_code | bind (const endpoint_type &endpoint, boost::system::error_code &ec) |
Bind the socket to the given local endpoint. More... | |
void | connect (const endpoint_type &peer_endpoint) |
Connect the socket to the specified endpoint. More... | |
boost::system::error_code | connect (const endpoint_type &peer_endpoint, boost::system::error_code &ec) |
Connect the socket to the specified endpoint. More... | |
BOOST_ASIO_INITFN_RESULT_TYPE (ConnectHandler, void(boost::system::error_code)) async_connect(const endpoint_type &peer_endpoint | |
Start an asynchronous connect. More... | |
BOOST_ASIO_MOVE_ARG (ConnectHandler) handler) | |
void | set_option (const SettableSocketOption &option) |
Set an option on the socket. More... | |
boost::system::error_code | set_option (const SettableSocketOption &option, boost::system::error_code &ec) |
Set an option on the socket. More... | |
void | get_option (GettableSocketOption &option) const |
Get an option from the socket. More... | |
boost::system::error_code | get_option (GettableSocketOption &option, boost::system::error_code &ec) const |
Get an option from the socket. More... | |
void | io_control (IoControlCommand &command) |
Perform an IO control command on the socket. More... | |
boost::system::error_code | io_control (IoControlCommand &command, boost::system::error_code &ec) |
Perform an IO control command on the socket. More... | |
bool | non_blocking () const |
Gets the non-blocking mode of the socket. More... | |
void | non_blocking (bool mode) |
Sets the non-blocking mode of the socket. More... | |
boost::system::error_code | non_blocking (bool mode, boost::system::error_code &ec) |
Sets the non-blocking mode of the socket. More... | |
bool | native_non_blocking () const |
Gets the non-blocking mode of the native socket implementation. More... | |
void | native_non_blocking (bool mode) |
Sets the non-blocking mode of the native socket implementation. More... | |
boost::system::error_code | native_non_blocking (bool mode, boost::system::error_code &ec) |
Sets the non-blocking mode of the native socket implementation. More... | |
endpoint_type | local_endpoint () const |
Get the local endpoint of the socket. More... | |
endpoint_type | local_endpoint (boost::system::error_code &ec) const |
Get the local endpoint of the socket. More... | |
endpoint_type | remote_endpoint () const |
Get the remote endpoint of the socket. More... | |
endpoint_type | remote_endpoint (boost::system::error_code &ec) const |
Get the remote endpoint of the socket. More... | |
void | shutdown (shutdown_type what) |
Disable sends or receives on the socket. More... | |
boost::system::error_code | shutdown (shutdown_type what, boost::system::error_code &ec) |
Disable sends or receives on the socket. More... | |
boost::asio::io_service & | get_io_service () |
Get the io_service associated with the object. More... | |
BOOST_ASIO_STATIC_CONSTANT (int, message_peek=BOOST_ASIO_OS_DEF(MSG_PEEK)) | |
BOOST_ASIO_STATIC_CONSTANT (int, message_out_of_band=BOOST_ASIO_OS_DEF(MSG_OOB)) | |
BOOST_ASIO_STATIC_CONSTANT (int, message_do_not_route=BOOST_ASIO_OS_DEF(MSG_DONTROUTE)) | |
BOOST_ASIO_STATIC_CONSTANT (int, message_end_of_record=BOOST_ASIO_OS_DEF(MSG_EOR)) | |
BOOST_ASIO_STATIC_CONSTANT (int, max_connections=BOOST_ASIO_OS_DEF(SOMAXCONN)) | |
The maximum length of the queue of pending incoming connections. More... | |
Public Attributes | |
socket_base::message_flags | flags |
const endpoint_type & | destination |
const endpoint_type socket_base::message_flags | flags |
endpoint_type & | sender_endpoint |
endpoint_type socket_base::message_flags | flags |
Protected Member Functions | |
service_type & | get_service () |
Get the service associated with the I/O object. More... | |
const service_type & | get_service () const |
Get the service associated with the I/O object. More... | |
implementation_type & | get_implementation () |
Get the underlying implementation of the I/O object. More... | |
const implementation_type & | get_implementation () const |
Get the underlying implementation of the I/O object. More... | |
Protected Attributes | |
service_type & | service |
(Deprecated: Use get_service().) The service associated with the I/O object. More... | |
implementation_type | implementation |
(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. More... | |
Provides raw-oriented socket functionality.
The basic_raw_socket class template provides asynchronous and blocking raw-oriented socket functionality.
|
inherited |
Socket option to permit sending of broadcast messages.
Implements the SOL_SOCKET/SO_BROADCAST socket option.
|
inherited |
IO control command to get the amount of data that can be read without blocking.
Implements the FIONREAD IO control command.
|
inherited |
Socket option to enable socket-level debugging.
Implements the SOL_SOCKET/SO_DEBUG socket option.
|
inherited |
Socket option to prevent routing, use local interfaces only.
Implements the SOL_SOCKET/SO_DONTROUTE socket option.
|
inherited |
Socket option to report aborted connections on accept.
Implements a custom socket option that determines whether or not an accept operation is permitted to fail with boost::asio::error::connection_aborted. By default the option is false.
typedef Protocol::endpoint boost::asio::basic_raw_socket< Protocol, RawSocketService >::endpoint_type |
The endpoint type.
|
inherited |
The underlying implementation type of I/O object.
|
inherited |
Socket option to send keep-alives.
Implements the SOL_SOCKET/SO_KEEPALIVE socket option.
|
inherited |
Socket option to specify whether the socket lingers on close if unsent data is present.
Implements the SOL_SOCKET/SO_LINGER socket option.
|
inherited |
A basic_socket is always the lowest layer.
|
inherited |
Bitmask type for flags that can be passed to send and receive operations.
typedef RawSocketService::native_handle_type boost::asio::basic_raw_socket< Protocol, RawSocketService >::native_handle_type |
The native representation of a socket.
typedef RawSocketService::native_handle_type boost::asio::basic_raw_socket< Protocol, RawSocketService >::native_type |
(Deprecated: Use native_handle_type.) The native representation of a socket.
|
inherited |
(Deprecated: Use non_blocking().) IO control command to set the blocking mode of the socket.
Implements the FIONBIO IO control command.
typedef Protocol boost::asio::basic_raw_socket< Protocol, RawSocketService >::protocol_type |
The protocol type.
|
inherited |
Socket option for the receive buffer size of a socket.
Implements the SOL_SOCKET/SO_RCVBUF socket option.
|
inherited |
Socket option for the receive low watermark.
Implements the SOL_SOCKET/SO_RCVLOWAT socket option.
|
inherited |
Socket option to allow the socket to be bound to an address that is already in use.
Implements the SOL_SOCKET/SO_REUSEADDR socket option.
|
inherited |
Socket option for the send buffer size of a socket.
Implements the SOL_SOCKET/SO_SNDBUF socket option.
|
inherited |
Socket option for the send low watermark.
Implements the SOL_SOCKET/SO_SNDLOWAT socket option.
|
inherited |
The type of the service that will be used to provide I/O operations.
|
inherited |
|
inlineexplicit |
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. |
|
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. |
boost::system::system_error | Thrown on failure. |
|
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. |
boost::system::system_error | Thrown on failure. |
|
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. |
boost::system::system_error | Thrown on failure. |
|
inlineinherited |
Assign an existing native socket to the socket.
|
inlineinherited |
Assign an existing native socket to the socket.
|
inlineinherited |
Determine whether the socket is at the out-of-band data mark.
This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
boost::system::system_error | Thrown on failure. |
|
inlineinherited |
Determine whether the socket is at the out-of-band data mark.
This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
ec | Set to indicate what error occurred, if any. |
|
inlineinherited |
Determine the number of bytes available for reading.
This function is used to determine the number of bytes that may be read without blocking.
boost::system::system_error | Thrown on failure. |
|
inlineinherited |
Determine the number of bytes available for reading.
This function is used to determine the number of bytes that may be read without blocking.
ec | Set to indicate what error occurred, if any. |
|
inlineinherited |
Bind the socket to the given local endpoint.
This function binds the socket to the specified endpoint on the local machine.
endpoint | An endpoint on the local machine to which the socket will be bound. |
boost::system::system_error | Thrown on failure. |
|
inlineinherited |
Bind the socket to the given local endpoint.
This function binds the socket to the specified endpoint on the local machine.
endpoint | An endpoint on the local machine to which the socket will be bound. |
ec | Set to indicate what error occurred, if any. |
boost::asio::basic_raw_socket< Protocol, RawSocketService >::BOOST_ASIO_INITFN_RESULT_TYPE | ( | WriteHandler | , |
void(boost::system::error_code, std::size_t) | |||
) | const |
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(
std::size_t bytes_transferred // Number of bytes sent.
);
|
boost::asio::basic_raw_socket< Protocol, RawSocketService >::BOOST_ASIO_INITFN_RESULT_TYPE | ( | WriteHandler | , |
void(boost::system::error_code, std::size_t) | |||
) | const |
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(
std::size_t bytes_transferred // Number of bytes sent.
);
|
boost::asio::basic_raw_socket< Protocol, RawSocketService >::BOOST_ASIO_INITFN_RESULT_TYPE | ( | WriteHandler | , |
void(boost::system::error_code, std::size_t) | |||
) | const |
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(
std::size_t bytes_transferred // Number of bytes sent.
);
|
boost::asio::basic_raw_socket< Protocol, RawSocketService >::BOOST_ASIO_INITFN_RESULT_TYPE | ( | WriteHandler | , |
void(boost::system::error_code, std::size_t) | |||
) | const |
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(
std::size_t bytes_transferred // Number of bytes sent.
);
|
boost::asio::basic_raw_socket< Protocol, RawSocketService >::BOOST_ASIO_INITFN_RESULT_TYPE | ( | ReadHandler | , |
void(boost::system::error_code, std::size_t) | |||
) | const |
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(
std::size_t bytes_transferred // Number of bytes received.
);
|
boost::asio::basic_raw_socket< Protocol, RawSocketService >::BOOST_ASIO_INITFN_RESULT_TYPE | ( | ReadHandler | , |
void(boost::system::error_code, std::size_t) | |||
) | const |
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(
std::size_t bytes_transferred // Number of bytes received.
);
|
|
inherited |
Start an asynchronous connect.
This function is used to asynchronously connect a socket to the specified remote endpoint. The function call always returns immediately.
The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
peer_endpoint | The remote endpoint to which the socket will be connected. Copies will be made of the endpoint object as required. |
handler | The handler to be called when the connection operation completes. Copies will be made of the handler as required. The function signature of the handler must be: Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using boost::asio::io_service::post(). |
boost::asio::basic_raw_socket< Protocol, RawSocketService >::BOOST_ASIO_INITFN_RESULT_TYPE | ( | ReadHandler | , |
void(boost::system::error_code, std::size_t) | |||
) | const |
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(
std::size_t bytes_transferred // Number of bytes received.
);
|
boost::asio::basic_raw_socket< Protocol, RawSocketService >::BOOST_ASIO_INITFN_RESULT_TYPE | ( | ReadHandler | , |
void(boost::system::error_code, std::size_t) | |||
) | const |
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(
std::size_t bytes_transferred // Number of bytes received.
);
|
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineinherited |
|
inline |
|
inline |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
The maximum length of the queue of pending incoming connections.
|
inlineinherited |
Cancel all asynchronous operations associated with the socket.
This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the boost::asio::error::operation_aborted error.
boost::system::system_error | Thrown on failure. |
For portable cancellation, consider using one of the following alternatives:
When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above.
|
inlineinherited |
Cancel all asynchronous operations associated with the socket.
This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the boost::asio::error::operation_aborted error.
ec | Set to indicate what error occurred, if any. |
For portable cancellation, consider using one of the following alternatives:
When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above.
|
inlineinherited |
Close the socket.
This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the boost::asio::error::operation_aborted error.
boost::system::system_error | Thrown on failure. Note that, even if the function indicates an error, the underlying descriptor is closed. |
|
inlineinherited |
Close the socket.
This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the boost::asio::error::operation_aborted error.
ec | Set to indicate what error occurred, if any. Note that, even if the function indicates an error, the underlying descriptor is closed. |
|
inlineinherited |
Connect the socket to the specified endpoint.
This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs.
The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
peer_endpoint | The remote endpoint to which the socket will be connected. |
boost::system::system_error | Thrown on failure. |
|
inlineinherited |
Connect the socket to the specified endpoint.
This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs.
The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
peer_endpoint | The remote endpoint to which the socket will be connected. |
ec | Set to indicate what error occurred, if any. |
|
inlineprotectedinherited |
Get the underlying implementation of the I/O object.
Referenced by boost::asio::basic_raw_socket< Protocol, RawSocketService >::BOOST_ASIO_MOVE_ARG(), boost::asio::basic_raw_socket< Protocol, RawSocketService >::receive(), boost::asio::basic_raw_socket< Protocol, RawSocketService >::receive_from(), boost::asio::basic_raw_socket< Protocol, RawSocketService >::send(), and boost::asio::basic_raw_socket< Protocol, RawSocketService >::send_to().
|
inlineprotectedinherited |
Get the underlying implementation of the I/O object.
|
inlineinherited |
Get the io_service associated with the object.
This function may be used to obtain the io_service object that the I/O object uses to dispatch handlers for asynchronous operations.
|
inlineinherited |
Get an option from the socket.
This function is used to get the current value of an option on the socket.
option | The option value to be obtained from the socket. |
boost::system::system_error | Thrown on failure. |
|
inlineinherited |
Get an option from the socket.
This function is used to get the current value of an option on the socket.
option | The option value to be obtained from the socket. |
ec | Set to indicate what error occurred, if any. |
|
inlineprotectedinherited |
Get the service associated with the I/O object.
Referenced by boost::asio::basic_raw_socket< Protocol, RawSocketService >::BOOST_ASIO_MOVE_ARG(), boost::asio::basic_raw_socket< Protocol, RawSocketService >::receive(), boost::asio::basic_raw_socket< Protocol, RawSocketService >::receive_from(), boost::asio::basic_raw_socket< Protocol, RawSocketService >::send(), and boost::asio::basic_raw_socket< Protocol, RawSocketService >::send_to().
|
inlineprotectedinherited |
Get the service associated with the I/O object.
|
inlineinherited |
Perform an IO control command on the socket.
This function is used to execute an IO control command on the socket.
command | The IO control command to be performed on the socket. |
boost::system::system_error | Thrown on failure. |
|
inlineinherited |
Perform an IO control command on the socket.
This function is used to execute an IO control command on the socket.
command | The IO control command to be performed on the socket. |
ec | Set to indicate what error occurred, if any. |
|
inlineinherited |
Determine whether the socket is open.
|
inlineinherited |
Get the local endpoint of the socket.
This function is used to obtain the locally bound endpoint of the socket.
boost::system::system_error | Thrown on failure. |
|
inlineinherited |
Get the local endpoint of the socket.
This function is used to obtain the locally bound endpoint of the socket.
ec | Set to indicate what error occurred, if any. |
|
inlineinherited |
Get a reference to the lowest layer.
This function returns a reference to the lowest layer in a stack of layers. Since a basic_socket cannot contain any further layers, it simply returns a reference to itself.
|
inlineinherited |
Get a const reference to the lowest layer.
This function returns a const reference to the lowest layer in a stack of layers. Since a basic_socket cannot contain any further layers, it simply returns a reference to itself.
|
inlineinherited |
(Deprecated: Use native_handle().) Get the native socket representation.
This function may be used to obtain the underlying representation of the socket. This is intended to allow access to native socket functionality that is not otherwise provided.
|
inlineinherited |
Get the native socket representation.
This function may be used to obtain the underlying representation of the socket. This is intended to allow access to native socket functionality that is not otherwise provided.
|
inlineinherited |
Gets the non-blocking mode of the native socket implementation.
This function is used to retrieve the non-blocking mode of the underlying native socket. This mode has no effect on the behaviour of the socket object's synchronous operations.
true
if the underlying socket is in non-blocking mode and direct system calls may fail with boost::asio::error::would_block (or the equivalent system error).sendfile
system call might be encapsulated:
|
inlineinherited |
Sets the non-blocking mode of the native socket implementation.
This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations.
mode | If true , the underlying socket is put into non-blocking mode and direct system calls may fail with boost::asio::error::would_block (or the equivalent system error). |
boost::system::system_error | Thrown on failure. If the mode is false , but the current value of non_blocking() is true , this function fails with boost::asio::error::invalid_argument, as the combination does not make sense. |
sendfile
system call might be encapsulated:
|
inlineinherited |
Sets the non-blocking mode of the native socket implementation.
This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations.
mode | If true , the underlying socket is put into non-blocking mode and direct system calls may fail with boost::asio::error::would_block (or the equivalent system error). |
ec | Set to indicate what error occurred, if any. If the mode is false , but the current value of non_blocking() is true , this function fails with boost::asio::error::invalid_argument, as the combination does not make sense. |
sendfile
system call might be encapsulated:
|
inlineinherited |
Gets the non-blocking mode of the socket.
true
if the socket's synchronous operations will fail with boost::asio::error::would_block if they are unable to perform the requested operation immediately. If false
, synchronous operations will block until complete.
|
inlineinherited |
Sets the non-blocking mode of the socket.
mode | If true , the socket's synchronous operations will fail with boost::asio::error::would_block if they are unable to perform the requested operation immediately. If false , synchronous operations will block until complete. |
boost::system::system_error | Thrown on failure. |
|
inlineinherited |
Sets the non-blocking mode of the socket.
mode | If true , the socket's synchronous operations will fail with boost::asio::error::would_block if they are unable to perform the requested operation immediately. If false , synchronous operations will block until complete. |
ec | Set to indicate what error occurred, if any. |
|
inlineinherited |
Open the socket using the specified protocol.
This function opens the socket so that it will use the specified protocol.
protocol | An object specifying protocol parameters to be used. |
boost::system::system_error | Thrown on failure. |
|
inlineinherited |
Open the socket using the specified protocol.
This function opens the socket so that it will use the specified protocol.
protocol | An object specifying which protocol is to be used. |
ec | Set to indicate what error occurred, if any. |
|
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. |
boost::system::system_error | Thrown on failure. |
References boost::asio::basic_io_object< RawSocketService >::get_implementation(), boost::asio::basic_io_object< RawSocketService >::get_service(), and boost::asio::s.
|
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. |
boost::system::system_error | Thrown on failure. |
References boost::asio::basic_io_object< RawSocketService >::get_implementation(), boost::asio::basic_io_object< RawSocketService >::get_service(), and boost::asio::s.
|
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. |
References boost::asio::basic_io_object< RawSocketService >::get_implementation(), and boost::asio::basic_io_object< RawSocketService >::get_service().
|
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. |
boost::system::system_error | Thrown on failure. |
References boost::asio::basic_io_object< RawSocketService >::get_implementation(), boost::asio::basic_io_object< RawSocketService >::get_service(), and boost::asio::s.
|
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. |
boost::system::system_error | Thrown on failure. |
References boost::asio::basic_io_object< RawSocketService >::get_implementation(), boost::asio::basic_io_object< RawSocketService >::get_service(), and boost::asio::s.
|
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. |
References boost::asio::basic_io_object< RawSocketService >::get_implementation(), and boost::asio::basic_io_object< RawSocketService >::get_service().
|
inlineinherited |
Get the remote endpoint of the socket.
This function is used to obtain the remote endpoint of the socket.
boost::system::system_error | Thrown on failure. |
|
inlineinherited |
Get the remote endpoint of the socket.
This function is used to obtain the remote endpoint of the socket.
ec | Set to indicate what error occurred, if any. |
|
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. |
boost::system::system_error | Thrown on failure. |
References boost::asio::basic_io_object< RawSocketService >::get_implementation(), boost::asio::basic_io_object< RawSocketService >::get_service(), and boost::asio::s.
|
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. |
boost::system::system_error | Thrown on failure. |
References boost::asio::basic_io_object< RawSocketService >::get_implementation(), boost::asio::basic_io_object< RawSocketService >::get_service(), and boost::asio::s.
|
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. |
References boost::asio::basic_io_object< RawSocketService >::get_implementation(), and boost::asio::basic_io_object< RawSocketService >::get_service().
|
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. |
boost::system::system_error | Thrown on failure. |
References boost::asio::basic_io_object< RawSocketService >::get_implementation(), boost::asio::basic_io_object< RawSocketService >::get_service(), and boost::asio::s.
|
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. |
boost::system::system_error | Thrown on failure. |
References boost::asio::basic_io_object< RawSocketService >::get_implementation(), boost::asio::basic_io_object< RawSocketService >::get_service(), and boost::asio::s.
|
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. |
References boost::asio::basic_io_object< RawSocketService >::get_implementation(), and boost::asio::basic_io_object< RawSocketService >::get_service().
|
inlineinherited |
Set an option on the socket.
This function is used to set an option on the socket.
option | The new option value to be set on the socket. |
boost::system::system_error | Thrown on failure. |
|
inlineinherited |
Set an option on the socket.
This function is used to set an option on the socket.
option | The new option value to be set on the socket. |
ec | Set to indicate what error occurred, if any. |
|
inlineinherited |
Disable sends or receives on the socket.
This function is used to disable send operations, receive operations, or both.
what | Determines what types of operation will no longer be allowed. |
boost::system::system_error | Thrown on failure. |
|
inlineinherited |
Disable sends or receives on the socket.
This function is used to disable send operations, receive operations, or both.
what | Determines what types of operation will no longer be allowed. |
ec | Set to indicate what error occurred, if any. |
const endpoint_type & boost::asio::basic_raw_socket< Protocol, RawSocketService >::destination |
socket_base::message_flags boost::asio::basic_raw_socket< Protocol, RawSocketService >::flags |
const endpoint_type socket_base::message_flags boost::asio::basic_raw_socket< Protocol, RawSocketService >::flags |
endpoint_type socket_base::message_flags boost::asio::basic_raw_socket< Protocol, RawSocketService >::flags |
|
protectedinherited |
(Deprecated: Use get_implementation().) The underlying implementation of the I/O object.
endpoint_type & boost::asio::basic_raw_socket< Protocol, RawSocketService >::sender_endpoint |
|
protectedinherited |
(Deprecated: Use get_service().) The service associated with the I/O object.