Template Class datagram_socket¶
Defined in File dgram_socket.hpp
Inheritance Relationships¶
Base Type¶
public stream_client::base_socket< boost::asio::basic_datagram_socket< Protocol > >
(Template Class base_socket)
Class Documentation¶
-
template<typename
Protocol
>
classstream_client
::
datagram_socket
: public stream_client::base_socket<boost::asio::basic_datagram_socket<Protocol>>¶ Stream socket client for arbitrary plain (no encryption) protocol.
This class wraps boost::asio::basic_datagram_socket to make it timeout-blocked: all read/write operations has timeout/deadline option.
Note
Not thread-safe, multi-thread rw access may mess up your data stream and/or timeout handling.
- tparam Protocol
Type of protocol to use, see boost::asio::basic_datagram_socket.
Public Functions
-
datagram_socket
(const datagram_socket<Protocol> &other) = delete¶ Copy constructor is not permitted.
-
datagram_socket<Protocol> &
operator=
(const datagram_socket<Protocol> &other) = delete¶ Copy assignment is not permitted.
-
datagram_socket
(datagram_socket<Protocol> &&other) = default¶ Move constructor.
-
datagram_socket<Protocol> &
operator=
(datagram_socket<Protocol> &&other) = default¶ Move assignment.
-
virtual
~datagram_socket
() = default¶ Destructor.
-
template<typename
ConstBufferSequence
, typenameTime
>
std::size_tsend
(const ConstBufferSequence &buffers, boost::system::error_code &ec, const Time &timeout_or_deadline)¶ Send data through the stream.
The call will block until one of the following conditions is true:
All of the data in the supplied buffers has been written.
An error or timeout occurred.
- Template Parameters
ConstBufferSequence – Type of buffers, see boost::asio::buffer.
Time – Type of
timeout_or_deadline
, either time_duration_type or time_point_type.
- Parameters
[in] buffers – One or more buffers containing the data to be written.
[in] timeout_or_deadline – Expiration time-point or duration.
[out] ec – Set to indicate what error occurred, if any.
- Returns
The number of bytes transferred.
-
template<typename
ConstBufferSequence
, typenameTime
>
std::size_tsend
(const ConstBufferSequence &buffers, const Time &timeout_or_deadline)¶ Send data through the stream.
The call will block until one of the following conditions is true:
All of the data in the supplied buffers has been written.
An error or timeout occurred.
- Template Parameters
ConstBufferSequence – Type of buffers, see boost::asio::buffer.
Time – Type of
timeout_or_deadline
, either time_duration_type or time_point_type.
- Parameters
[in] buffers – One or more buffers containing the data to be written.
[in] timeout_or_deadline – Expiration time-point or duration.
- Throws
boost::system::system_error – Thrown on failure.
- Returns
The number of bytes transferred.
-
template<typename
ConstBufferSequence
>
inline std::size_tsend
(const ConstBufferSequence &buffers, boost::system::error_code &ec)¶ Alias to send() using current I/O timeout value.
-
template<typename
ConstBufferSequence
>
inline std::size_tsend
(const ConstBufferSequence &buffers)¶ Alias to send() using current I/O timeout value.
-
template<typename
MutableBufferSequence
, typenameTime
>
std::size_treceive
(const MutableBufferSequence &buffers, boost::system::error_code &ec, const Time &timeout_or_deadline)¶ Receive data through the stream.
The call will block until one of the following conditions is true:
The supplied buffers are full.
An error or timeout occurred.
- Template Parameters
MutableBufferSequence – Type of buffers, see boost::asio::buffer.
Time – Type of
timeout_or_deadline
, either time_duration_type or time_point_type.
- Parameters
[in] buffers – One or more buffers into which the data will be received.
[in] timeout_or_deadline – Expiration time-point or duration.
[out] ec – Set to indicate what error occurred, if any.
- Returns
The number of bytes received.
-
template<typename
MutableBufferSequence
, typenameTime
>
std::size_treceive
(const MutableBufferSequence &buffers, const Time &timeout_or_deadline)¶ Receive data through the stream.
The call will block until one of the following conditions is true:
The supplied buffers are full.
An error or timeout occurred.
- Template Parameters
MutableBufferSequence – Type of buffers, see boost::asio::buffer.
Time – Type of
timeout_or_deadline
, either time_duration_type or time_point_type.
- Parameters
[in] buffers – One or more buffers into which the data will be received.
[in] timeout_or_deadline – Expiration time-point or duration.
- Throws
boost::system::system_error – Thrown on failure.
- Returns
The number of bytes received.
-
template<typename
MutableBufferSequence
>
inline std::size_treceive
(const MutableBufferSequence &buffers, boost::system::error_code &ec)¶ Alias to receive() using current I/O timeout value.
-
template<typename
MutableBufferSequence
>
inline std::size_treceive
(const MutableBufferSequence &buffers)¶ Alias to receive() using current I/O timeout value.