Realistic 3D camera system
3D camera system components
Public Types | Public Member Functions | Public Attributes | List of all members
asio::basic_datagram_socket< Protocol, DatagramSocketService > Class Template Reference

Provides datagram-oriented socket functionality. More...

#include <basic_datagram_socket.hpp>

Inheritance diagram for asio::basic_datagram_socket< Protocol, DatagramSocketService >:
asio::basic_socket< Protocol, DatagramSocketService > asio::basic_io_object< DatagramSocketService > asio::socket_base

Public Types

typedef DatagramSocketService::native_handle_type native_type
 
typedef DatagramSocketService::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...
 
- Public Types inherited from asio::basic_socket< Protocol, DatagramSocketService >
typedef DatagramSocketService::native_handle_type native_type
 
typedef DatagramSocketService::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, DatagramSocketService > lowest_layer_type
 A basic_socket is always the lowest layer. More...
 
- Public Types inherited from asio::basic_io_object< DatagramSocketService >
typedef DatagramSocketService 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...
 
- Public Types inherited from asio::socket_base
enum  shutdown_type { shutdown_receive = ASIO_OS_DEF(SHUT_RD), shutdown_send = ASIO_OS_DEF(SHUT_WR), shutdown_both = 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 asio::detail::socket_option::boolean< ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_BROADCAST)> broadcast
 Socket option to permit sending of broadcast messages. More...
 
typedef asio::detail::socket_option::boolean< ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_DEBUG)> debug
 Socket option to enable socket-level debugging. More...
 
typedef asio::detail::socket_option::boolean< ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_DONTROUTE)> do_not_route
 Socket option to prevent routing, use local interfaces only. More...
 
typedef asio::detail::socket_option::boolean< ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_KEEPALIVE)> keep_alive
 Socket option to send keep-alives. More...
 
typedef asio::detail::socket_option::integer< ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_SNDBUF)> send_buffer_size
 Socket option for the send buffer size of a socket. More...
 
typedef asio::detail::socket_option::integer< ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_SNDLOWAT)> send_low_watermark
 Socket option for the send low watermark. More...
 
typedef asio::detail::socket_option::integer< ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_RCVBUF)> receive_buffer_size
 Socket option for the receive buffer size of a socket. More...
 
typedef asio::detail::socket_option::integer< ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_RCVLOWAT)> receive_low_watermark
 Socket option for the receive low watermark. More...
 
typedef asio::detail::socket_option::boolean< ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_REUSEADDR)> reuse_address
 
typedef asio::detail::socket_option::linger< ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_LINGER)> linger
 
typedef asio::detail::socket_option::boolean< asio::detail::custom_socket_option_level, asio::detail::enable_connection_aborted_optionenable_connection_aborted
 Socket option to report aborted connections on accept. More...
 
typedef asio::detail::io_control::non_blocking_io non_blocking_io
 
typedef asio::detail::io_control::bytes_readable bytes_readable
 

Public Member Functions

 basic_datagram_socket (asio::io_service &io_service)
 Construct a basic_datagram_socket without opening it. More...
 
 basic_datagram_socket (asio::io_service &io_service, const protocol_type &protocol)
 Construct and open a basic_datagram_socket. More...
 
 basic_datagram_socket (asio::io_service &io_service, const endpoint_type &endpoint)
 
 basic_datagram_socket (asio::io_service &io_service, const protocol_type &protocol, const native_handle_type &native_socket)
 Construct a basic_datagram_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, asio::error_code &ec)
 Send some data on a connected socket. More...
 
template<typename ConstBufferSequence , typename WriteHandler >
 ASIO_INITFN_RESULT_TYPE (WriteHandler, void(asio::error_code, std::size_t)) async_send(const ConstBufferSequence &buffers
 Start an asynchronous send on a connected socket. More...
 
 ASIO_MOVE_ARG (WriteHandler) handler)
 
template<typename ConstBufferSequence , typename WriteHandler >
 ASIO_INITFN_RESULT_TYPE (WriteHandler, void(asio::error_code, std::size_t)) async_send(const ConstBufferSequence &buffers
 Start an asynchronous send on a connected socket. More...
 
socket_base::message_flags ASIO_MOVE_ARG (WriteHandler) handler)
 
template<typename ConstBufferSequence >
std::size_t send_to (const ConstBufferSequence &buffers, const endpoint_type &destination)
 Send a datagram 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 a datagram 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, asio::error_code &ec)
 Send a datagram to the specified endpoint. More...
 
template<typename ConstBufferSequence , typename WriteHandler >
 ASIO_INITFN_RESULT_TYPE (WriteHandler, void(asio::error_code, std::size_t)) async_send_to(const ConstBufferSequence &buffers
 Start an asynchronous send. More...
 
const endpoint_type ASIO_MOVE_ARG (WriteHandler) handler)
 
template<typename ConstBufferSequence , typename WriteHandler >
 ASIO_INITFN_RESULT_TYPE (WriteHandler, void(asio::error_code, std::size_t)) async_send_to(const ConstBufferSequence &buffers
 Start an asynchronous send. More...
 
const endpoint_type socket_base::message_flags 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, asio::error_code &ec)
 Receive some data on a connected socket. More...
 
template<typename MutableBufferSequence , typename ReadHandler >
 ASIO_INITFN_RESULT_TYPE (ReadHandler, void(asio::error_code, std::size_t)) async_receive(const MutableBufferSequence &buffers
 Start an asynchronous receive on a connected socket. More...
 
 ASIO_MOVE_ARG (ReadHandler) handler)
 
template<typename MutableBufferSequence , typename ReadHandler >
 ASIO_INITFN_RESULT_TYPE (ReadHandler, void(asio::error_code, std::size_t)) async_receive(const MutableBufferSequence &buffers
 Start an asynchronous receive on a connected socket. More...
 
socket_base::message_flags ASIO_MOVE_ARG (ReadHandler) handler)
 
template<typename MutableBufferSequence >
std::size_t receive_from (const MutableBufferSequence &buffers, endpoint_type &sender_endpoint)
 Receive a datagram 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 a datagram 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, asio::error_code &ec)
 Receive a datagram with the endpoint of the sender. More...
 
template<typename MutableBufferSequence , typename ReadHandler >
 ASIO_INITFN_RESULT_TYPE (ReadHandler, void(asio::error_code, std::size_t)) async_receive_from(const MutableBufferSequence &buffers
 Start an asynchronous receive. More...
 
endpoint_type ASIO_MOVE_ARG (ReadHandler) handler)
 
template<typename MutableBufferSequence , typename ReadHandler >
 ASIO_INITFN_RESULT_TYPE (ReadHandler, void(asio::error_code, std::size_t)) async_receive_from(const MutableBufferSequence &buffers
 Start an asynchronous receive. More...
 
endpoint_type socket_base::message_flags ASIO_MOVE_ARG (ReadHandler) handler)
 
- Public Member Functions inherited from asio::basic_socket< Protocol, DatagramSocketService >
 basic_socket (asio::io_service &io_service)
 Construct a basic_socket without opening it. More...
 
 basic_socket (asio::io_service &io_service, const protocol_type &protocol)
 Construct and open a basic_socket. More...
 
 basic_socket (asio::io_service &io_service, const endpoint_type &endpoint)
 
 basic_socket (asio::io_service &io_service, const protocol_type &protocol, const native_handle_type &native_socket)
 Construct a basic_socket on an existing native socket. More...
 
lowest_layer_typelowest_layer ()
 Get a reference to the lowest layer. More...
 
const lowest_layer_typelowest_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...
 
asio::error_code open (const protocol_type &protocol, asio::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...
 
asio::error_code assign (const protocol_type &protocol, const native_handle_type &native_socket, asio::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...
 
asio::error_code close (asio::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...
 
asio::error_code cancel (asio::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 (asio::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 (asio::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...
 
asio::error_code bind (const endpoint_type &endpoint, asio::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...
 
asio::error_code connect (const endpoint_type &peer_endpoint, asio::error_code &ec)
 Connect the socket to the specified endpoint. More...
 
 ASIO_INITFN_RESULT_TYPE (ConnectHandler, void(asio::error_code)) async_connect(const endpoint_type &peer_endpoint
 Start an asynchronous connect. More...
 
 ASIO_MOVE_ARG (ConnectHandler) handler)
 
void set_option (const SettableSocketOption &option)
 Set an option on the socket. More...
 
asio::error_code set_option (const SettableSocketOption &option, asio::error_code &ec)
 Set an option on the socket. More...
 
void get_option (GettableSocketOption &option) const
 Get an option from the socket. More...
 
asio::error_code get_option (GettableSocketOption &option, asio::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...
 
asio::error_code io_control (IoControlCommand &command, asio::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...
 
asio::error_code non_blocking (bool mode, asio::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...
 
asio::error_code native_non_blocking (bool mode, asio::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 (asio::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 (asio::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...
 
asio::error_code shutdown (shutdown_type what, asio::error_code &ec)
 Disable sends or receives on the socket. More...
 
- Public Member Functions inherited from asio::basic_io_object< DatagramSocketService >
asio::io_serviceget_io_service ()
 Get the io_service associated with the object. More...
 
- Public Member Functions inherited from asio::socket_base
 ASIO_STATIC_CONSTANT (int, message_peek=ASIO_OS_DEF(MSG_PEEK))
 
 ASIO_STATIC_CONSTANT (int, message_out_of_band=ASIO_OS_DEF(MSG_OOB))
 
 ASIO_STATIC_CONSTANT (int, message_do_not_route=ASIO_OS_DEF(MSG_DONTROUTE))
 
 ASIO_STATIC_CONSTANT (int, message_end_of_record=ASIO_OS_DEF(MSG_EOR))
 
 ASIO_STATIC_CONSTANT (int, max_connections=ASIO_OS_DEF(SOMAXCONN))
 The maximum length of the queue of pending incoming connections. More...
 

Public Attributes

socket_base::message_flags flags
 
const endpoint_typedestination
 
const endpoint_type socket_base::message_flags flags
 
endpoint_typesender_endpoint
 
endpoint_type socket_base::message_flags flags
 

Additional Inherited Members

- Protected Member Functions inherited from asio::basic_socket< Protocol, DatagramSocketService >
 ~basic_socket ()
 Protected destructor to prevent deletion through this type. More...
 
- Protected Member Functions inherited from asio::basic_io_object< DatagramSocketService >
 basic_io_object (asio::io_service &io_service)
 Construct a basic_io_object. More...
 
 ~basic_io_object ()
 Protected destructor to prevent deletion through this type. More...
 
service_typeget_service ()
 Get the service associated with the I/O object. More...
 
const service_typeget_service () const
 Get the service associated with the I/O object. More...
 
implementation_typeget_implementation ()
 Get the underlying implementation of the I/O object. More...
 
const implementation_typeget_implementation () const
 Get the underlying implementation of the I/O object. More...
 
- Protected Member Functions inherited from asio::socket_base
 ~socket_base ()
 Protected destructor to prevent deletion through this type. More...
 
- Protected Attributes inherited from asio::basic_io_object< DatagramSocketService >
service_typeservice
 
implementation_type implementation
 

Detailed Description

template<typename Protocol, typename DatagramSocketService = datagram_socket_service<Protocol>>
class asio::basic_datagram_socket< Protocol, DatagramSocketService >

Provides datagram-oriented socket functionality.

The basic_datagram_socket class template provides asynchronous and blocking datagram-oriented socket functionality.

Thread Safety
Distinct objects: Safe.
Shared objects: Unsafe.

Definition at line 42 of file basic_datagram_socket.hpp.

Member Typedef Documentation

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
typedef Protocol::endpoint asio::basic_datagram_socket< Protocol, DatagramSocketService >::endpoint_type

The endpoint type.

Definition at line 57 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
typedef DatagramSocketService::native_handle_type asio::basic_datagram_socket< Protocol, DatagramSocketService >::native_handle_type

The native representation of a socket.

Definition at line 51 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
typedef DatagramSocketService::native_handle_type asio::basic_datagram_socket< Protocol, DatagramSocketService >::native_type

(Deprecated: Use native_handle_type.) The native representation of a socket.

Definition at line 48 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
typedef Protocol asio::basic_datagram_socket< Protocol, DatagramSocketService >::protocol_type

The protocol type.

Definition at line 54 of file basic_datagram_socket.hpp.

Constructor & Destructor Documentation

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
asio::basic_datagram_socket< Protocol, DatagramSocketService >::basic_datagram_socket ( asio::io_service io_service)
inlineexplicit

Construct a basic_datagram_socket without opening it.

This constructor creates a datagram socket without opening it. The open() function must be called before data can be sent or received on the socket.

Parameters
io_serviceThe io_service object that the datagram socket will use to dispatch handlers for any asynchronous operations performed on the socket.

Definition at line 68 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
asio::basic_datagram_socket< Protocol, DatagramSocketService >::basic_datagram_socket ( asio::io_service io_service,
const protocol_type protocol 
)
inline

Construct and open a basic_datagram_socket.

This constructor creates and opens a datagram socket.

Parameters
io_serviceThe io_service object that the datagram socket will use to dispatch handlers for any asynchronous operations performed on the socket.
protocolAn object specifying protocol parameters to be used.
Exceptions
asio::system_errorThrown on failure.

Definition at line 85 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
asio::basic_datagram_socket< Protocol, DatagramSocketService >::basic_datagram_socket ( asio::io_service io_service,
const endpoint_type endpoint 
)
inline

Construct a basic_datagram_socket, opening it and binding it to the given local endpoint. This constructor creates a datagram 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.

Parameters
io_serviceThe io_service object that the datagram socket will use to dispatch handlers for any asynchronous operations performed on the socket.
endpointAn endpoint on the local machine to which the datagram socket will be bound.
Exceptions
asio::system_errorThrown on failure.

Definition at line 107 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
asio::basic_datagram_socket< Protocol, DatagramSocketService >::basic_datagram_socket ( asio::io_service io_service,
const protocol_type protocol,
const native_handle_type native_socket 
)
inline

Construct a basic_datagram_socket on an existing native socket.

This constructor creates a datagram socket object to hold an existing native socket.

Parameters
io_serviceThe io_service object that the datagram socket will use to dispatch handlers for any asynchronous operations performed on the socket.
protocolAn object specifying protocol parameters to be used.
native_socketThe new underlying socket implementation.
Exceptions
asio::system_errorThrown on failure.

Definition at line 128 of file basic_datagram_socket.hpp.

Member Function Documentation

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
template<typename ConstBufferSequence , typename WriteHandler >
asio::basic_datagram_socket< Protocol, DatagramSocketService >::ASIO_INITFN_RESULT_TYPE ( WriteHandler  ,
void(asio::error_code, std::size_t)   
) const

Start an asynchronous send on a connected socket.

This function is used to asynchronously send data on the datagram socket. The function call always returns immediately.

Parameters
buffersOne 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.
handlerThe 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.
);
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 asio::io_service::post().
Note
The async_send operation can only be used with a connected socket. Use the async_send_to function to send data on an unconnected datagram socket.
Example
To send a single data buffer use the asio::buffer function as follows:
socket.async_send(asio::buffer(data, size), handler);
See the asio::buffer documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
template<typename ConstBufferSequence , typename WriteHandler >
asio::basic_datagram_socket< Protocol, DatagramSocketService >::ASIO_INITFN_RESULT_TYPE ( WriteHandler  ,
void(asio::error_code, std::size_t)   
) const

Start an asynchronous send on a connected socket.

This function is used to asynchronously send data on the datagram socket. The function call always returns immediately.

Parameters
buffersOne 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.
flagsFlags specifying how the send call is to be made.
handlerThe 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.
);
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 asio::io_service::post().
Note
The async_send operation can only be used with a connected socket. Use the async_send_to function to send data on an unconnected datagram socket.
template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
template<typename ConstBufferSequence , typename WriteHandler >
asio::basic_datagram_socket< Protocol, DatagramSocketService >::ASIO_INITFN_RESULT_TYPE ( WriteHandler  ,
void(asio::error_code, std::size_t)   
) const

Start an asynchronous send.

This function is used to asynchronously send a datagram to the specified remote endpoint. The function call always returns immediately.

Parameters
buffersOne 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.
destinationThe remote endpoint to which the data will be sent. Copies will be made of the endpoint as required.
handlerThe 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.
);
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 asio::io_service::post().
Example
To send a single data buffer use the asio::buffer function as follows:
asio::ip::address::from_string("1.2.3.4"), 12345);
socket.async_send_to(
asio::buffer(data, size), destination, handler);
See the asio::buffer documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
template<typename ConstBufferSequence , typename WriteHandler >
asio::basic_datagram_socket< Protocol, DatagramSocketService >::ASIO_INITFN_RESULT_TYPE ( WriteHandler  ,
void(asio::error_code, std::size_t)   
) const

Start an asynchronous send.

This function is used to asynchronously send a datagram to the specified remote endpoint. The function call always returns immediately.

Parameters
buffersOne 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.
flagsFlags specifying how the send call is to be made.
destinationThe remote endpoint to which the data will be sent. Copies will be made of the endpoint as required.
handlerThe 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.
);
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 asio::io_service::post().
template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
template<typename MutableBufferSequence , typename ReadHandler >
asio::basic_datagram_socket< Protocol, DatagramSocketService >::ASIO_INITFN_RESULT_TYPE ( ReadHandler  ,
void(asio::error_code, std::size_t)   
) const

Start an asynchronous receive on a connected socket.

This function is used to asynchronously receive data from the datagram socket. The function call always returns immediately.

Parameters
buffersOne 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.
handlerThe 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.
);
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 asio::io_service::post().
Note
The async_receive operation can only be used with a connected socket. Use the async_receive_from function to receive data on an unconnected datagram socket.
Example
To receive into a single data buffer use the asio::buffer function as follows:
socket.async_receive(asio::buffer(data, size), handler);
See the asio::buffer documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
template<typename MutableBufferSequence , typename ReadHandler >
asio::basic_datagram_socket< Protocol, DatagramSocketService >::ASIO_INITFN_RESULT_TYPE ( ReadHandler  ,
void(asio::error_code, std::size_t)   
) const

Start an asynchronous receive on a connected socket.

This function is used to asynchronously receive data from the datagram socket. The function call always returns immediately.

Parameters
buffersOne 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.
flagsFlags specifying how the receive call is to be made.
handlerThe 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.
);
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 asio::io_service::post().
Note
The async_receive operation can only be used with a connected socket. Use the async_receive_from function to receive data on an unconnected datagram socket.
template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
template<typename MutableBufferSequence , typename ReadHandler >
asio::basic_datagram_socket< Protocol, DatagramSocketService >::ASIO_INITFN_RESULT_TYPE ( ReadHandler  ,
void(asio::error_code, std::size_t)   
) const

Start an asynchronous receive.

This function is used to asynchronously receive a datagram. The function call always returns immediately.

Parameters
buffersOne 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_endpointAn endpoint object that receives the endpoint of the remote sender of the datagram. Ownership of the sender_endpoint object is retained by the caller, which must guarantee that it is valid until the handler is called.
handlerThe 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.
);
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 asio::io_service::post().
Example
To receive into a single data buffer use the asio::buffer function as follows:
socket.async_receive_from(
asio::buffer(data, size), sender_endpoint, handler);
See the asio::buffer documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
template<typename MutableBufferSequence , typename ReadHandler >
asio::basic_datagram_socket< Protocol, DatagramSocketService >::ASIO_INITFN_RESULT_TYPE ( ReadHandler  ,
void(asio::error_code, std::size_t)   
) const

Start an asynchronous receive.

This function is used to asynchronously receive a datagram. The function call always returns immediately.

Parameters
buffersOne 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_endpointAn endpoint object that receives the endpoint of the remote sender of the datagram. Ownership of the sender_endpoint object is retained by the caller, which must guarantee that it is valid until the handler is called.
flagsFlags specifying how the receive call is to be made.
handlerThe 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.
);
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 asio::io_service::post().
template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
asio::basic_datagram_socket< Protocol, DatagramSocketService >::ASIO_MOVE_ARG ( WriteHandler  )
inline

Definition at line 339 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
socket_base::message_flags asio::basic_datagram_socket< Protocol, DatagramSocketService >::ASIO_MOVE_ARG ( WriteHandler  )
inline

Definition at line 382 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
const endpoint_type asio::basic_datagram_socket< Protocol, DatagramSocketService >::ASIO_MOVE_ARG ( WriteHandler  )
inline

Definition at line 522 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
const endpoint_type socket_base::message_flags asio::basic_datagram_socket< Protocol, DatagramSocketService >::ASIO_MOVE_ARG ( WriteHandler  )
inline

Definition at line 565 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
asio::basic_datagram_socket< Protocol, DatagramSocketService >::ASIO_MOVE_ARG ( ReadHandler  )
inline

Definition at line 705 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
socket_base::message_flags asio::basic_datagram_socket< Protocol, DatagramSocketService >::ASIO_MOVE_ARG ( ReadHandler  )
inline

Definition at line 748 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
endpoint_type asio::basic_datagram_socket< Protocol, DatagramSocketService >::ASIO_MOVE_ARG ( ReadHandler  )
inline

Definition at line 888 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
endpoint_type socket_base::message_flags asio::basic_datagram_socket< Protocol, DatagramSocketService >::ASIO_MOVE_ARG ( ReadHandler  )
inline

Definition at line 933 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
template<typename MutableBufferSequence >
std::size_t asio::basic_datagram_socket< Protocol, DatagramSocketService >::receive ( const MutableBufferSequence &  buffers)
inline

Receive some data on a connected socket.

This function is used to receive data on the datagram socket. The function call will block until data has been received successfully or an error occurs.

Parameters
buffersOne or more buffers into which the data will be received.
Returns
The number of bytes received.
Exceptions
asio::system_errorThrown on failure.
Note
The receive operation can only be used with a connected socket. Use the receive_from function to receive data on an unconnected datagram socket.
Example
To receive into a single data buffer use the asio::buffer function as follows:
socket.receive(asio::buffer(data, size));
See the asio::buffer documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.

Definition at line 601 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
template<typename MutableBufferSequence >
std::size_t asio::basic_datagram_socket< Protocol, DatagramSocketService >::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 datagram socket. The function call will block until data has been received successfully or an error occurs.

Parameters
buffersOne or more buffers into which the data will be received.
flagsFlags specifying how the receive call is to be made.
Returns
The number of bytes received.
Exceptions
asio::system_errorThrown on failure.
Note
The receive operation can only be used with a connected socket. Use the receive_from function to receive data on an unconnected datagram socket.

Definition at line 629 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
template<typename MutableBufferSequence >
std::size_t asio::basic_datagram_socket< Protocol, DatagramSocketService >::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 datagram socket. The function call will block until data has been received successfully or an error occurs.

Parameters
buffersOne or more buffers into which the data will be received.
flagsFlags specifying how the receive call is to be made.
ecSet to indicate what error occurred, if any.
Returns
The number of bytes received.
Note
The receive operation can only be used with a connected socket. Use the receive_from function to receive data on an unconnected datagram socket.

Definition at line 658 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
template<typename MutableBufferSequence >
std::size_t asio::basic_datagram_socket< Protocol, DatagramSocketService >::receive_from ( const MutableBufferSequence &  buffers,
endpoint_type sender_endpoint 
)
inline

Receive a datagram with the endpoint of the sender.

This function is used to receive a datagram. The function call will block until data has been received successfully or an error occurs.

Parameters
buffersOne or more buffers into which the data will be received.
sender_endpointAn endpoint object that receives the endpoint of the remote sender of the datagram.
Returns
The number of bytes received.
Exceptions
asio::system_errorThrown on failure.
Example
To receive into a single data buffer use the asio::buffer function as follows:
socket.receive_from(
asio::buffer(data, size), sender_endpoint);
See the asio::buffer documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.

Definition at line 785 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
template<typename MutableBufferSequence >
std::size_t asio::basic_datagram_socket< Protocol, DatagramSocketService >::receive_from ( const MutableBufferSequence &  buffers,
endpoint_type sender_endpoint,
socket_base::message_flags  flags 
)
inline

Receive a datagram with the endpoint of the sender.

This function is used to receive a datagram. The function call will block until data has been received successfully or an error occurs.

Parameters
buffersOne or more buffers into which the data will be received.
sender_endpointAn endpoint object that receives the endpoint of the remote sender of the datagram.
flagsFlags specifying how the receive call is to be made.
Returns
The number of bytes received.
Exceptions
asio::system_errorThrown on failure.

Definition at line 812 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
template<typename MutableBufferSequence >
std::size_t asio::basic_datagram_socket< Protocol, DatagramSocketService >::receive_from ( const MutableBufferSequence &  buffers,
endpoint_type sender_endpoint,
socket_base::message_flags  flags,
asio::error_code ec 
)
inline

Receive a datagram with the endpoint of the sender.

This function is used to receive a datagram. The function call will block until data has been received successfully or an error occurs.

Parameters
buffersOne or more buffers into which the data will be received.
sender_endpointAn endpoint object that receives the endpoint of the remote sender of the datagram.
flagsFlags specifying how the receive call is to be made.
ecSet to indicate what error occurred, if any.
Returns
The number of bytes received.

Definition at line 839 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
template<typename ConstBufferSequence >
std::size_t asio::basic_datagram_socket< Protocol, DatagramSocketService >::send ( const ConstBufferSequence &  buffers)
inline

Send some data on a connected socket.

This function is used to send data on the datagram socket. The function call will block until the data has been sent successfully or an error occurs.

Parameters
buffersOne ore more data buffers to be sent on the socket.
Returns
The number of bytes sent.
Exceptions
asio::system_errorThrown on failure.
Note
The send operation can only be used with a connected socket. Use the send_to function to send data on an unconnected datagram socket.
Example
To send a single data buffer use the asio::buffer function as follows:
socket.send(asio::buffer(data, size));
See the asio::buffer documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.

Definition at line 238 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
template<typename ConstBufferSequence >
std::size_t asio::basic_datagram_socket< Protocol, DatagramSocketService >::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 datagram socket. The function call will block until the data has been sent successfully or an error occurs.

Parameters
buffersOne ore more data buffers to be sent on the socket.
flagsFlags specifying how the send call is to be made.
Returns
The number of bytes sent.
Exceptions
asio::system_errorThrown on failure.
Note
The send operation can only be used with a connected socket. Use the send_to function to send data on an unconnected datagram socket.

Definition at line 265 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
template<typename ConstBufferSequence >
std::size_t asio::basic_datagram_socket< Protocol, DatagramSocketService >::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 datagram socket. The function call will block until the data has been sent successfully or an error occurs.

Parameters
buffersOne or more data buffers to be sent on the socket.
flagsFlags specifying how the send call is to be made.
ecSet to indicate what error occurred, if any.
Returns
The number of bytes sent.
Note
The send operation can only be used with a connected socket. Use the send_to function to send data on an unconnected datagram socket.

Definition at line 293 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
template<typename ConstBufferSequence >
std::size_t asio::basic_datagram_socket< Protocol, DatagramSocketService >::send_to ( const ConstBufferSequence &  buffers,
const endpoint_type destination 
)
inline

Send a datagram to the specified endpoint.

This function is used to send a datagram to the specified remote endpoint. The function call will block until the data has been sent successfully or an error occurs.

Parameters
buffersOne or more data buffers to be sent to the remote endpoint.
destinationThe remote endpoint to which the data will be sent.
Returns
The number of bytes sent.
Exceptions
asio::system_errorThrown on failure.
Example
To send a single data buffer use the asio::buffer function as follows: See the asio::buffer documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.

Definition at line 418 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
template<typename ConstBufferSequence >
std::size_t asio::basic_datagram_socket< Protocol, DatagramSocketService >::send_to ( const ConstBufferSequence &  buffers,
const endpoint_type destination,
socket_base::message_flags  flags 
)
inline

Send a datagram to the specified endpoint.

This function is used to send a datagram to the specified remote endpoint. The function call will block until the data has been sent successfully or an error occurs.

Parameters
buffersOne or more data buffers to be sent to the remote endpoint.
destinationThe remote endpoint to which the data will be sent.
flagsFlags specifying how the send call is to be made.
Returns
The number of bytes sent.
Exceptions
asio::system_errorThrown on failure.

Definition at line 445 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
template<typename ConstBufferSequence >
std::size_t asio::basic_datagram_socket< Protocol, DatagramSocketService >::send_to ( const ConstBufferSequence &  buffers,
const endpoint_type destination,
socket_base::message_flags  flags,
asio::error_code ec 
)
inline

Send a datagram to the specified endpoint.

This function is used to send a datagram to the specified remote endpoint. The function call will block until the data has been sent successfully or an error occurs.

Parameters
buffersOne or more data buffers to be sent to the remote endpoint.
destinationThe remote endpoint to which the data will be sent.
flagsFlags specifying how the send call is to be made.
ecSet to indicate what error occurred, if any.
Returns
The number of bytes sent.

Definition at line 472 of file basic_datagram_socket.hpp.

Member Data Documentation

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
const endpoint_type & asio::basic_datagram_socket< Protocol, DatagramSocketService >::destination

Definition at line 521 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
socket_base::message_flags asio::basic_datagram_socket< Protocol, DatagramSocketService >::flags

Definition at line 381 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
const endpoint_type socket_base::message_flags asio::basic_datagram_socket< Protocol, DatagramSocketService >::flags

Definition at line 564 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
endpoint_type socket_base::message_flags asio::basic_datagram_socket< Protocol, DatagramSocketService >::flags

Definition at line 932 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
endpoint_type & asio::basic_datagram_socket< Protocol, DatagramSocketService >::sender_endpoint

Definition at line 887 of file basic_datagram_socket.hpp.


The documentation for this class was generated from the following file: