Skip to content

asio::basic_datagram_socket

Provides datagram-oriented socket functionality.

詳細情報

メンバー

flags

socket_base::message_flags asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::flags

destination

const endpoint_type & asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::destination

flags

const endpoint_type socket_base::message_flags asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::flags

sender_endpoint

endpoint_type & asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::sender_endpoint

flags

endpoint_type socket_base::message_flags asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::flags

basic_datagram_socket()

Construct a without opening it.

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

asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::basic_datagram_socket(asio::io_context &io_context)

引数

  • asio::io_context& io_context

basic_datagram_socket()

Construct and open a .

This constructor creates and opens a datagram socket.

asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::basic_datagram_socket(asio::io_context &io_context, const protocol_type &protocol)

引数

  • asio::io_context& io_context
  • const& protocol An object specifying protocol parameters to be used.

basic_datagram_socket()

Construct a , 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.

asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::basic_datagram_socket(asio::io_context &io_context, const endpoint_type &endpoint)

引数

  • asio::io_context& io_context
  • const& endpoint An endpoint on the local machine to which the datagram socket will be bound.

basic_datagram_socket()

Construct a on an existing native socket.

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

asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::basic_datagram_socket(asio::io_context &io_context, const protocol_type &protocol, const native_handle_type &native_socket)

引数

  • asio::io_context& io_context
  • const& protocol An object specifying protocol parameters to be used.
  • const& native_socket The new underlying socket implementation.

~basic_datagram_socket()

Destroys the socket.

This function destroys the socket, cancelling any outstanding asynchronous operations associated with the socket as if by calling .

asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::~basic_datagram_socket()

send()

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.

std::size_t asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::send(const ConstBufferSequence &buffers)

引数

  • constConstBufferSequence & buffers One ore more data buffers to be sent on the socket.

戻り値

std::size_t

send()

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.

std::size_t asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::send(const ConstBufferSequence &buffers, socket_base::message_flags flags)

引数

  • constConstBufferSequence & buffers One ore more data buffers to be sent on the socket.
  • socket_base::message_flags flags Flags specifying how the send call is to be made.

戻り値

std::size_t

send()

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.

std::size_t asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::send(const ConstBufferSequence &buffers, socket_base::message_flags flags, asio::error_code &ec)

引数

  • constConstBufferSequence & buffers One or more data buffers to be sent on the socket.
  • socket_base::message_flags flags Flags specifying how the send call is to be made.
  • asio::error_code& ec Set to indicate what error occurred, if any.

戻り値

std::size_t

ASIO_INITFN_RESULT_TYPE()

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.

asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::ASIO_INITFN_RESULT_TYPE(WriteHandler, void(asio::error_code, std::size_t)) async_send(const ConstBufferSequence &buffers

引数

  • asio::error_codevoid(, std::size_t) ``

ASIO_MOVE_ARG()

asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::ASIO_MOVE_ARG(WriteHandler) handler)

引数

  • WriteHandler ``

ASIO_INITFN_RESULT_TYPE()

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.

asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::ASIO_INITFN_RESULT_TYPE(WriteHandler, void(asio::error_code, std::size_t)) async_send(const ConstBufferSequence &buffers

引数

  • asio::error_codevoid(, std::size_t) ``

ASIO_MOVE_ARG()

socket_base::message_flags asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::ASIO_MOVE_ARG(WriteHandler) handler)

引数

  • WriteHandler ``

戻り値

socket_base::message_flags

send_to()

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.

std::size_t asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::send_to(const ConstBufferSequence &buffers, const endpoint_type &destination)

引数

  • constConstBufferSequence & buffers One or more data buffers to be sent to the remote endpoint.
  • const& destination The remote endpoint to which the data will be sent.

戻り値

std::size_t

send_to()

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.

std::size_t asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::send_to(const ConstBufferSequence &buffers, const endpoint_type &destination, socket_base::message_flags flags)

引数

  • constConstBufferSequence & buffers One or more data buffers to be sent to the remote endpoint.
  • const& destination The remote endpoint to which the data will be sent.
  • socket_base::message_flags flags Flags specifying how the send call is to be made.

戻り値

std::size_t

send_to()

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.

std::size_t asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::send_to(const ConstBufferSequence &buffers, const endpoint_type &destination, socket_base::message_flags flags, asio::error_code &ec)

引数

  • constConstBufferSequence & buffers One or more data buffers to be sent to the remote endpoint.
  • const& destination The remote endpoint to which the data will be sent.
  • socket_base::message_flags flags Flags specifying how the send call is to be made.
  • asio::error_code& ec Set to indicate what error occurred, if any.

戻り値

std::size_t

ASIO_INITFN_RESULT_TYPE()

Start an asynchronous send.

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

asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::ASIO_INITFN_RESULT_TYPE(WriteHandler, void(asio::error_code, std::size_t)) async_send_to(const ConstBufferSequence &buffers

引数

  • asio::error_codevoid(, std::size_t) ``

ASIO_MOVE_ARG()

const endpoint_type asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::ASIO_MOVE_ARG(WriteHandler) handler)

引数

  • WriteHandler ``

戻り値

const

ASIO_INITFN_RESULT_TYPE()

Start an asynchronous send.

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

asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::ASIO_INITFN_RESULT_TYPE(WriteHandler, void(asio::error_code, std::size_t)) async_send_to(const ConstBufferSequence &buffers

引数

  • asio::error_codevoid(, std::size_t) ``

ASIO_MOVE_ARG()

const endpoint_type socket_base::message_flags asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::ASIO_MOVE_ARG(WriteHandler) handler)

引数

  • WriteHandler ``

戻り値

const

receive()

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.

std::size_t asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::receive(const MutableBufferSequence &buffers)

引数

  • constMutableBufferSequence & buffers One or more buffers into which the data will be received.

戻り値

std::size_t

receive()

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.

std::size_t asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::receive(const MutableBufferSequence &buffers, socket_base::message_flags flags)

引数

  • constMutableBufferSequence & buffers One or more buffers into which the data will be received.
  • socket_base::message_flags flags Flags specifying how the receive call is to be made.

戻り値

std::size_t

receive()

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.

std::size_t asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::receive(const MutableBufferSequence &buffers, socket_base::message_flags flags, asio::error_code &ec)

引数

  • constMutableBufferSequence & buffers One or more buffers into which the data will be received.
  • socket_base::message_flags flags Flags specifying how the receive call is to be made.
  • asio::error_code& ec Set to indicate what error occurred, if any.

戻り値

std::size_t

ASIO_INITFN_RESULT_TYPE()

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.

asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::ASIO_INITFN_RESULT_TYPE(ReadHandler, void(asio::error_code, std::size_t)) async_receive(const MutableBufferSequence &buffers

引数

  • asio::error_codevoid(, std::size_t) ``

ASIO_MOVE_ARG()

asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::ASIO_MOVE_ARG(ReadHandler) handler)

引数

  • ReadHandler ``

ASIO_INITFN_RESULT_TYPE()

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.

asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::ASIO_INITFN_RESULT_TYPE(ReadHandler, void(asio::error_code, std::size_t)) async_receive(const MutableBufferSequence &buffers

引数

  • asio::error_codevoid(, std::size_t) ``

ASIO_MOVE_ARG()

socket_base::message_flags asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::ASIO_MOVE_ARG(ReadHandler) handler)

引数

  • ReadHandler ``

戻り値

socket_base::message_flags

receive_from()

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.

std::size_t asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::receive_from(const MutableBufferSequence &buffers, endpoint_type &sender_endpoint)

引数

  • constMutableBufferSequence & buffers One or more buffers into which the data will be received.
  • endpoint_type& sender_endpoint An endpoint object that receives the endpoint of the remote sender of the datagram.

戻り値

std::size_t

receive_from()

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.

std::size_t asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::receive_from(const MutableBufferSequence &buffers, endpoint_type &sender_endpoint, socket_base::message_flags flags)

引数

  • constMutableBufferSequence & buffers One or more buffers into which the data will be received.
  • endpoint_type& sender_endpoint An endpoint object that receives the endpoint of the remote sender of the datagram.
  • socket_base::message_flags flags Flags specifying how the receive call is to be made.

戻り値

std::size_t

receive_from()

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.

std::size_t asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::receive_from(const MutableBufferSequence &buffers, endpoint_type &sender_endpoint, socket_base::message_flags flags, asio::error_code &ec)

引数

  • constMutableBufferSequence & buffers One or more buffers into which the data will be received.
  • endpoint_type& sender_endpoint An endpoint object that receives the endpoint of the remote sender of the datagram.
  • socket_base::message_flags flags Flags specifying how the receive call is to be made.
  • asio::error_code& ec Set to indicate what error occurred, if any.

戻り値

std::size_t

ASIO_INITFN_RESULT_TYPE()

Start an asynchronous receive.

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

asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::ASIO_INITFN_RESULT_TYPE(ReadHandler, void(asio::error_code, std::size_t)) async_receive_from(const MutableBufferSequence &buffers

引数

  • asio::error_codevoid(, std::size_t) ``

ASIO_MOVE_ARG()

endpoint_type asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::ASIO_MOVE_ARG(ReadHandler) handler)

引数

  • ReadHandler ``

戻り値

endpoint_type

ASIO_INITFN_RESULT_TYPE()

Start an asynchronous receive.

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

asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::ASIO_INITFN_RESULT_TYPE(ReadHandler, void(asio::error_code, std::size_t)) async_receive_from(const MutableBufferSequence &buffers

引数

  • asio::error_codevoid(, std::size_t) ``

ASIO_MOVE_ARG()

endpoint_type socket_base::message_flags asio::basic_datagram_socket< ASIO_SVC_TPARAM_DEF1 >::ASIO_MOVE_ARG(ReadHandler) handler)

引数

  • ReadHandler ``

戻り値

endpoint_type