asio C++ library

PrevUpHomeNext
basic_seq_packet_socket::send (1 of 2 overloads)

Send some data on the socket.

template<
    typename ConstBufferSequence>
std::size_t send(
    const ConstBufferSequence & buffers,
    socket_base::message_flags flags);

This function is used to send data on the sequenced packet socket. The function call will block until the data has been sent successfully, or an until 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.

Return Value

The number of bytes sent.

Exceptions

asio::system_error

Thrown on failure.

Example

To send a single data buffer use the buffer function as follows:

socket.send(asio::buffer(data, size), 0);

See the buffer documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.


PrevUpHomeNext