$search

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 >:
Inheritance graph
[legend]

List of all members.

Public Types

typedef Protocol::endpoint endpoint_type
 The endpoint type.
typedef
DatagramSocketService::native_type 
native_type
 The native representation of a socket.
typedef Protocol protocol_type
 The protocol type.

Public Member Functions

template<typename MutableBufferSequence , typename ReadHandler >
void async_receive (const MutableBufferSequence &buffers, socket_base::message_flags flags, ReadHandler handler)
 Start an asynchronous receive on a connected socket.
template<typename MutableBufferSequence , typename ReadHandler >
void async_receive (const MutableBufferSequence &buffers, ReadHandler handler)
 Start an asynchronous receive on a connected socket.
template<typename MutableBufferSequence , typename ReadHandler >
void async_receive_from (const MutableBufferSequence &buffers, endpoint_type &sender_endpoint, socket_base::message_flags flags, ReadHandler handler)
 Start an asynchronous receive.
template<typename MutableBufferSequence , typename ReadHandler >
void async_receive_from (const MutableBufferSequence &buffers, endpoint_type &sender_endpoint, ReadHandler handler)
 Start an asynchronous receive.
template<typename ConstBufferSequence , typename WriteHandler >
void async_send (const ConstBufferSequence &buffers, socket_base::message_flags flags, WriteHandler handler)
 Start an asynchronous send on a connected socket.
template<typename ConstBufferSequence , typename WriteHandler >
void async_send (const ConstBufferSequence &buffers, WriteHandler handler)
 Start an asynchronous send on a connected socket.
template<typename ConstBufferSequence , typename WriteHandler >
void async_send_to (const ConstBufferSequence &buffers, const endpoint_type &destination, socket_base::message_flags flags, WriteHandler handler)
 Start an asynchronous send.
template<typename ConstBufferSequence , typename WriteHandler >
void async_send_to (const ConstBufferSequence &buffers, const endpoint_type &destination, WriteHandler handler)
 Start an asynchronous send.
 basic_datagram_socket (asio::io_service &io_service, const protocol_type &protocol, const native_type &native_socket)
 Construct a basic_datagram_socket on an existing native socket.
 basic_datagram_socket (asio::io_service &io_service, const endpoint_type &endpoint)
 basic_datagram_socket (asio::io_service &io_service, const protocol_type &protocol)
 Construct and open a basic_datagram_socket.
 basic_datagram_socket (asio::io_service &io_service)
 Construct a basic_datagram_socket without opening it.
template<typename MutableBufferSequence >
std::size_t receive (const MutableBufferSequence &buffers, socket_base::message_flags flags, asio::error_code &ec)
 Receive some data on a connected socket.
template<typename MutableBufferSequence >
std::size_t receive (const MutableBufferSequence &buffers, socket_base::message_flags flags)
 Receive some data on a connected socket.
template<typename MutableBufferSequence >
std::size_t receive (const MutableBufferSequence &buffers)
 Receive some data on a connected socket.
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.
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.
template<typename MutableBufferSequence >
std::size_t receive_from (const MutableBufferSequence &buffers, endpoint_type &sender_endpoint)
 Receive a datagram with the endpoint of the sender.
template<typename ConstBufferSequence >
std::size_t send (const ConstBufferSequence &buffers, socket_base::message_flags flags, asio::error_code &ec)
 Send some data on a connected socket.
template<typename ConstBufferSequence >
std::size_t send (const ConstBufferSequence &buffers, socket_base::message_flags flags)
 Send some data on a connected socket.
template<typename ConstBufferSequence >
std::size_t send (const ConstBufferSequence &buffers)
 Send some data on a connected socket.
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.
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.
template<typename ConstBufferSequence >
std::size_t send_to (const ConstBufferSequence &buffers, const endpoint_type &destination)
 Send a datagram to the specified endpoint.

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 43 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.

Reimplemented from asio::basic_socket< Protocol, DatagramSocketService >.

Definition at line 54 of file basic_datagram_socket.hpp.

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

The native representation of a socket.

Reimplemented from asio::basic_socket< Protocol, DatagramSocketService >.

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.

Reimplemented from asio::basic_socket< Protocol, DatagramSocketService >.

Definition at line 51 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  )  [inline, explicit]

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_service The io_service object that the datagram socket will use to dispatch handlers for any asynchronous operations performed on the socket.

Definition at line 65 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_service The io_service object that the datagram socket will use to dispatch handlers for any asynchronous operations performed on the socket.
protocol An object specifying protocol parameters to be used.
Exceptions:
asio::system_error Thrown on failure.

Definition at line 82 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_service The io_service object that the datagram socket will use to dispatch handlers for any asynchronous operations performed on the socket.
endpoint An endpoint on the local machine to which the datagram socket will be bound.
Exceptions:
asio::system_error Thrown on failure.

Definition at line 104 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_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_service The io_service object that the datagram 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.
Exceptions:
asio::system_error Thrown on failure.

Definition at line 125 of file basic_datagram_socket.hpp.


Member Function Documentation

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
template<typename MutableBufferSequence , typename ReadHandler >
void asio::basic_datagram_socket< Protocol, DatagramSocketService >::async_receive ( const MutableBufferSequence &  buffers,
socket_base::message_flags  flags,
ReadHandler  handler 
) [inline]

Start an asynchronous receive on a connected socket.

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

Parameters:
buffers One or more buffers into which the data will be received. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.
flags Flags specifying how the receive call is to be made.
handler The handler to be called when the receive operation completes. Copies will be made of the handler as required. The function signature of the handler must be:

 void handler(
   const asio::error_code& error, // Result of operation.
   std::size_t bytes_transferred           // Number of bytes received.
 ); 

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.

Definition at line 621 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
template<typename MutableBufferSequence , typename ReadHandler >
void asio::basic_datagram_socket< Protocol, DatagramSocketService >::async_receive ( const MutableBufferSequence &  buffers,
ReadHandler  handler 
) [inline]

Start an asynchronous receive on a connected socket.

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

Parameters:
buffers One or more buffers into which the data will be received. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.
handler The handler to be called when the receive operation completes. Copies will be made of the handler as required. The function signature of the handler must be:

 void handler(
   const asio::error_code& error, // Result of operation.
   std::size_t bytes_transferred           // Number of bytes received.
 ); 

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.

Definition at line 587 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
template<typename MutableBufferSequence , typename ReadHandler >
void asio::basic_datagram_socket< Protocol, DatagramSocketService >::async_receive_from ( const MutableBufferSequence &  buffers,
endpoint_type sender_endpoint,
socket_base::message_flags  flags,
ReadHandler  handler 
) [inline]

Start an asynchronous receive.

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

Parameters:
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 datagram. Ownership of the sender_endpoint object is retained by the caller, which must guarantee that it is valid until the handler is called.
flags Flags specifying how the receive call is to be made.
handler The handler to be called when the receive operation completes. Copies will be made of the handler as required. The function signature of the handler must be:

 void handler(
   const asio::error_code& error, // Result of operation.
   std::size_t bytes_transferred           // Number of bytes received.
 ); 

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().

Definition at line 790 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
template<typename MutableBufferSequence , typename ReadHandler >
void asio::basic_datagram_socket< Protocol, DatagramSocketService >::async_receive_from ( const MutableBufferSequence &  buffers,
endpoint_type sender_endpoint,
ReadHandler  handler 
) [inline]

Start an asynchronous receive.

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

Parameters:
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 datagram. Ownership of the sender_endpoint object is retained by the caller, which must guarantee that it is valid until the handler is called.
handler The handler to be called when the receive operation completes. Copies will be made of the handler as required. The function signature of the handler must be:

 void handler(
   const asio::error_code& error, // Result of operation.
   std::size_t bytes_transferred           // Number of bytes received.
 ); 

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), 0, 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.

Definition at line 753 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
template<typename ConstBufferSequence , typename WriteHandler >
void asio::basic_datagram_socket< Protocol, DatagramSocketService >::async_send ( const ConstBufferSequence &  buffers,
socket_base::message_flags  flags,
WriteHandler  handler 
) [inline]

Start an asynchronous send on a connected socket.

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

Parameters:
buffers One or more data buffers to be sent on the socket. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.
flags Flags specifying how the send call is to be made.
handler The handler to be called when the send operation completes. Copies will be made of the handler as required. The function signature of the handler must be:

 void handler(
   const asio::error_code& error, // Result of operation.
   std::size_t bytes_transferred           // Number of bytes sent.
 ); 

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.

Definition at line 287 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
template<typename ConstBufferSequence , typename WriteHandler >
void asio::basic_datagram_socket< Protocol, DatagramSocketService >::async_send ( const ConstBufferSequence &  buffers,
WriteHandler  handler 
) [inline]

Start an asynchronous send on a connected socket.

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

Parameters:
buffers One or more data buffers to be sent on the socket. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.
handler The handler to be called when the send operation completes. Copies will be made of the handler as required. The function signature of the handler must be:

 void handler(
   const asio::error_code& error, // Result of operation.
   std::size_t bytes_transferred           // Number of bytes sent.
 ); 

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.

Definition at line 252 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
template<typename ConstBufferSequence , typename WriteHandler >
void asio::basic_datagram_socket< Protocol, DatagramSocketService >::async_send_to ( const ConstBufferSequence &  buffers,
const endpoint_type destination,
socket_base::message_flags  flags,
WriteHandler  handler 
) [inline]

Start an asynchronous send.

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

Parameters:
buffers One or more data buffers to be sent to the remote endpoint. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.
flags Flags specifying how the send call is to be made.
destination The remote endpoint to which the data will be sent. Copies will be made of the endpoint as required.
handler The handler to be called when the send operation completes. Copies will be made of the handler as required. The function signature of the handler must be:

 void handler(
   const asio::error_code& error, // Result of operation.
   std::size_t bytes_transferred           // Number of bytes sent.
 ); 

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().

Definition at line 454 of file basic_datagram_socket.hpp.

template<typename Protocol , typename DatagramSocketService = datagram_socket_service<Protocol>>
template<typename ConstBufferSequence , typename WriteHandler >
void asio::basic_datagram_socket< Protocol, DatagramSocketService >::async_send_to ( const ConstBufferSequence &  buffers,
const endpoint_type destination,
WriteHandler  handler 
) [inline]

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:
buffers One or more data buffers to be sent to the remote endpoint. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.
destination The remote endpoint to which the data will be sent. Copies will be made of the endpoint as required.
handler The handler to be called when the send operation completes. Copies will be made of the handler as required. The function signature of the handler must be:

 void handler(
   const asio::error_code& error, // Result of operation.
   std::size_t bytes_transferred           // Number of bytes sent.
 ); 

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::udp::endpoint destination(
     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.

Definition at line 419 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:
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.
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 544 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:
buffers One or more buffers into which the data will be received.
flags Flags specifying how the receive call is to be made.
Returns:
The number of bytes received.
Exceptions:
asio::system_error Thrown 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 515 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:
buffers One or more buffers into which the data will be received.
Returns:
The number of bytes received.
Exceptions:
asio::system_error Thrown 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 487 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:
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 datagram.
flags Flags specifying how the receive call is to be made.
ec Set to indicate what error occurred, if any.
Returns:
The number of bytes received.

Definition at line 708 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:
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 datagram.
flags Flags specifying how the receive call is to be made.
Returns:
The number of bytes received.
Exceptions:
asio::system_error Thrown on failure.

Definition at line 681 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:
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 datagram.
Returns:
The number of bytes received.
Exceptions:
asio::system_error Thrown on failure.
Example
To receive into a single data buffer use the asio::buffer function as follows:
 asio::ip::udp::endpoint sender_endpoint;
 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 654 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:
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.
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 209 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:
buffers One ore more data buffers to be sent on the socket.
flags Flags specifying how the send call is to be made.
Returns:
The number of bytes sent.
Exceptions:
asio::system_error Thrown 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 181 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:
buffers One ore more data buffers to be sent on the socket.
Returns:
The number of bytes sent.
Exceptions:
asio::system_error Thrown 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 155 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:
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.
Returns:
The number of bytes sent.

Definition at line 373 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:
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.
Returns:
The number of bytes sent.
Exceptions:
asio::system_error Thrown on failure.

Definition at line 346 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:
buffers One or more data buffers to be sent to the remote endpoint.
destination The remote endpoint to which the data will be sent.
Returns:
The number of bytes sent.
Exceptions:
asio::system_error Thrown on failure.
Example
To send a single data buffer use the asio::buffer function as follows:
 asio::ip::udp::endpoint destination(
     asio::ip::address::from_string("1.2.3.4"), 12345);
 socket.send_to(asio::buffer(data, size), destination);
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 319 of file basic_datagram_socket.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


Castor
Author(s): Carpe Noctem
autogenerated on Fri Mar 1 14:41:40 2013