3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>basic_socket</title>
5 <link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7 <link rel="home" href="../../boost_asio.html" title="Boost.Asio">
8 <link rel="up" href="../reference.html" title="Reference">
9 <link rel="prev" href="basic_signal_set__rebind_executor/other.html" title="basic_signal_set::rebind_executor::other">
10 <link rel="next" href="basic_socket/assign.html" title="basic_socket::assign">
12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13 <table cellpadding="2" width="100%"><tr>
14 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
15 <td align="center"><a href="../../../../index.html">Home</a></td>
16 <td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
17 <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18 <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19 <td align="center"><a href="../../../../more/index.htm">More</a></td>
22 <div class="spirit-nav">
23 <a accesskey="p" href="basic_signal_set__rebind_executor/other.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../boost_asio.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="basic_socket/assign.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
26 <div class="titlepage"><div><div><h3 class="title">
27 <a name="boost_asio.reference.basic_socket"></a><a class="link" href="basic_socket.html" title="basic_socket">basic_socket</a>
28 </h3></div></div></div>
30 Provides socket functionality.
32 <pre class="programlisting">template<
33 typename <a class="link" href="Protocol.html" title="Protocol requirements">Protocol</a>,
34 typename <a class="link" href="Executor1.html" title="Executor requirements">Executor</a>>
39 <a name="boost_asio.reference.basic_socket.h0"></a>
40 <span class="phrase"><a name="boost_asio.reference.basic_socket.types"></a></span><a class="link" href="basic_socket.html#boost_asio.reference.basic_socket.types">Types</a>
42 <div class="informaltable"><table class="table">
63 <a class="link" href="basic_socket__rebind_executor.html" title="basic_socket::rebind_executor"><span class="bold"><strong>rebind_executor</strong></span></a>
68 Rebinds the socket type to another executor.
75 <a class="link" href="basic_socket/broadcast.html" title="basic_socket::broadcast"><span class="bold"><strong>broadcast</strong></span></a>
80 Socket option to permit sending of broadcast messages.
87 <a class="link" href="basic_socket/bytes_readable.html" title="basic_socket::bytes_readable"><span class="bold"><strong>bytes_readable</strong></span></a>
92 IO control command to get the amount of data that can be read without
100 <a class="link" href="basic_socket/debug.html" title="basic_socket::debug"><span class="bold"><strong>debug</strong></span></a>
105 Socket option to enable socket-level debugging.
112 <a class="link" href="basic_socket/do_not_route.html" title="basic_socket::do_not_route"><span class="bold"><strong>do_not_route</strong></span></a>
117 Socket option to prevent routing, use local interfaces only.
124 <a class="link" href="basic_socket/enable_connection_aborted.html" title="basic_socket::enable_connection_aborted"><span class="bold"><strong>enable_connection_aborted</strong></span></a>
129 Socket option to report aborted connections on accept.
136 <a class="link" href="basic_socket/endpoint_type.html" title="basic_socket::endpoint_type"><span class="bold"><strong>endpoint_type</strong></span></a>
148 <a class="link" href="basic_socket/executor_type.html" title="basic_socket::executor_type"><span class="bold"><strong>executor_type</strong></span></a>
153 The type of the executor associated with the object.
160 <a class="link" href="basic_socket/keep_alive.html" title="basic_socket::keep_alive"><span class="bold"><strong>keep_alive</strong></span></a>
165 Socket option to send keep-alives.
172 <a class="link" href="basic_socket/linger.html" title="basic_socket::linger"><span class="bold"><strong>linger</strong></span></a>
177 Socket option to specify whether the socket lingers on close if
178 unsent data is present.
185 <a class="link" href="basic_socket/lowest_layer_type.html" title="basic_socket::lowest_layer_type"><span class="bold"><strong>lowest_layer_type</strong></span></a>
190 A basic_socket is always the lowest layer.
197 <a class="link" href="basic_socket/message_flags.html" title="basic_socket::message_flags"><span class="bold"><strong>message_flags</strong></span></a>
202 Bitmask type for flags that can be passed to send and receive operations.
209 <a class="link" href="basic_socket/native_handle_type.html" title="basic_socket::native_handle_type"><span class="bold"><strong>native_handle_type</strong></span></a>
214 The native representation of a socket.
221 <a class="link" href="basic_socket/out_of_band_inline.html" title="basic_socket::out_of_band_inline"><span class="bold"><strong>out_of_band_inline</strong></span></a>
226 Socket option for putting received out-of-band data inline.
233 <a class="link" href="basic_socket/protocol_type.html" title="basic_socket::protocol_type"><span class="bold"><strong>protocol_type</strong></span></a>
245 <a class="link" href="basic_socket/receive_buffer_size.html" title="basic_socket::receive_buffer_size"><span class="bold"><strong>receive_buffer_size</strong></span></a>
250 Socket option for the receive buffer size of a socket.
257 <a class="link" href="basic_socket/receive_low_watermark.html" title="basic_socket::receive_low_watermark"><span class="bold"><strong>receive_low_watermark</strong></span></a>
262 Socket option for the receive low watermark.
269 <a class="link" href="basic_socket/reuse_address.html" title="basic_socket::reuse_address"><span class="bold"><strong>reuse_address</strong></span></a>
274 Socket option to allow the socket to be bound to an address that
282 <a class="link" href="basic_socket/send_buffer_size.html" title="basic_socket::send_buffer_size"><span class="bold"><strong>send_buffer_size</strong></span></a>
287 Socket option for the send buffer size of a socket.
294 <a class="link" href="basic_socket/send_low_watermark.html" title="basic_socket::send_low_watermark"><span class="bold"><strong>send_low_watermark</strong></span></a>
299 Socket option for the send low watermark.
306 <a class="link" href="basic_socket/shutdown_type.html" title="basic_socket::shutdown_type"><span class="bold"><strong>shutdown_type</strong></span></a>
311 Different ways a socket may be shutdown.
318 <a class="link" href="basic_socket/wait_type.html" title="basic_socket::wait_type"><span class="bold"><strong>wait_type</strong></span></a>
330 <a name="boost_asio.reference.basic_socket.h1"></a>
331 <span class="phrase"><a name="boost_asio.reference.basic_socket.member_functions"></a></span><a class="link" href="basic_socket.html#boost_asio.reference.basic_socket.member_functions">Member
334 <div class="informaltable"><table class="table">
355 <a class="link" href="basic_socket/assign.html" title="basic_socket::assign"><span class="bold"><strong>assign</strong></span></a>
360 Assign an existing native socket to the socket.
367 <a class="link" href="basic_socket/async_connect.html" title="basic_socket::async_connect"><span class="bold"><strong>async_connect</strong></span></a>
372 Start an asynchronous connect.
379 <a class="link" href="basic_socket/async_wait.html" title="basic_socket::async_wait"><span class="bold"><strong>async_wait</strong></span></a>
384 Asynchronously wait for the socket to become ready to read, ready
385 to write, or to have pending error conditions.
392 <a class="link" href="basic_socket/at_mark.html" title="basic_socket::at_mark"><span class="bold"><strong>at_mark</strong></span></a>
397 Determine whether the socket is at the out-of-band data mark.
404 <a class="link" href="basic_socket/available.html" title="basic_socket::available"><span class="bold"><strong>available</strong></span></a>
409 Determine the number of bytes available for reading.
416 <a class="link" href="basic_socket/basic_socket.html" title="basic_socket::basic_socket"><span class="bold"><strong>basic_socket</strong></span></a>
421 Construct a basic_socket without opening it. <br> <span class="silver"> —</span><br> Construct
422 and open a basic_socket. <br> <span class="silver"> —</span><br> Construct a basic_socket,
423 opening it and binding it to the given local endpoint. <br> <span class="silver"> —</span>
424 <br> Construct a basic_socket on an existing native socket.
425 <br> <span class="silver"> —</span><br> Move-construct a basic_socket from another. <br>
426 <span class="silver"> —</span><br> Move-construct a basic_socket from a socket of another protocol
434 <a class="link" href="basic_socket/bind.html" title="basic_socket::bind"><span class="bold"><strong>bind</strong></span></a>
439 Bind the socket to the given local endpoint.
446 <a class="link" href="basic_socket/cancel.html" title="basic_socket::cancel"><span class="bold"><strong>cancel</strong></span></a>
451 Cancel all asynchronous operations associated with the socket.
458 <a class="link" href="basic_socket/close.html" title="basic_socket::close"><span class="bold"><strong>close</strong></span></a>
470 <a class="link" href="basic_socket/connect.html" title="basic_socket::connect"><span class="bold"><strong>connect</strong></span></a>
475 Connect the socket to the specified endpoint.
482 <a class="link" href="basic_socket/get_executor.html" title="basic_socket::get_executor"><span class="bold"><strong>get_executor</strong></span></a>
487 Get the executor associated with the object.
494 <a class="link" href="basic_socket/get_option.html" title="basic_socket::get_option"><span class="bold"><strong>get_option</strong></span></a>
499 Get an option from the socket.
506 <a class="link" href="basic_socket/io_control.html" title="basic_socket::io_control"><span class="bold"><strong>io_control</strong></span></a>
511 Perform an IO control command on the socket.
518 <a class="link" href="basic_socket/is_open.html" title="basic_socket::is_open"><span class="bold"><strong>is_open</strong></span></a>
523 Determine whether the socket is open.
530 <a class="link" href="basic_socket/local_endpoint.html" title="basic_socket::local_endpoint"><span class="bold"><strong>local_endpoint</strong></span></a>
535 Get the local endpoint of the socket.
542 <a class="link" href="basic_socket/lowest_layer.html" title="basic_socket::lowest_layer"><span class="bold"><strong>lowest_layer</strong></span></a>
547 Get a reference to the lowest layer. <br> <span class="silver"> —</span><br> Get a const
548 reference to the lowest layer.
555 <a class="link" href="basic_socket/native_handle.html" title="basic_socket::native_handle"><span class="bold"><strong>native_handle</strong></span></a>
560 Get the native socket representation.
567 <a class="link" href="basic_socket/native_non_blocking.html" title="basic_socket::native_non_blocking"><span class="bold"><strong>native_non_blocking</strong></span></a>
572 Gets the non-blocking mode of the native socket implementation.
573 <br> <span class="silver"> —</span><br> Sets the non-blocking mode of the native socket implementation.
580 <a class="link" href="basic_socket/non_blocking.html" title="basic_socket::non_blocking"><span class="bold"><strong>non_blocking</strong></span></a>
585 Gets the non-blocking mode of the socket. <br> <span class="silver"> —</span><br> Sets the
586 non-blocking mode of the socket.
593 <a class="link" href="basic_socket/open.html" title="basic_socket::open"><span class="bold"><strong>open</strong></span></a>
598 Open the socket using the specified protocol.
605 <a class="link" href="basic_socket/operator_eq_.html" title="basic_socket::operator="><span class="bold"><strong>operator=</strong></span></a>
610 Move-assign a basic_socket from another. <br> <span class="silver"> —</span><br> Move-assign
611 a basic_socket from a socket of another protocol type.
618 <a class="link" href="basic_socket/release.html" title="basic_socket::release"><span class="bold"><strong>release</strong></span></a>
623 Release ownership of the underlying native socket.
630 <a class="link" href="basic_socket/remote_endpoint.html" title="basic_socket::remote_endpoint"><span class="bold"><strong>remote_endpoint</strong></span></a>
635 Get the remote endpoint of the socket.
642 <a class="link" href="basic_socket/set_option.html" title="basic_socket::set_option"><span class="bold"><strong>set_option</strong></span></a>
647 Set an option on the socket.
654 <a class="link" href="basic_socket/shutdown.html" title="basic_socket::shutdown"><span class="bold"><strong>shutdown</strong></span></a>
659 Disable sends or receives on the socket.
666 <a class="link" href="basic_socket/wait.html" title="basic_socket::wait"><span class="bold"><strong>wait</strong></span></a>
671 Wait for the socket to become ready to read, ready to write, or
672 to have pending error conditions.
679 <a name="boost_asio.reference.basic_socket.h2"></a>
680 <span class="phrase"><a name="boost_asio.reference.basic_socket.protected_member_functions"></a></span><a class="link" href="basic_socket.html#boost_asio.reference.basic_socket.protected_member_functions">Protected
683 <div class="informaltable"><table class="table">
703 <a class="link" href="basic_socket/_basic_socket.html" title="basic_socket::~basic_socket"><span class="bold"><strong>~basic_socket</strong></span></a>
708 Protected destructor to prevent deletion through this type.
714 <a name="boost_asio.reference.basic_socket.h3"></a>
715 <span class="phrase"><a name="boost_asio.reference.basic_socket.data_members"></a></span><a class="link" href="basic_socket.html#boost_asio.reference.basic_socket.data_members">Data
718 <div class="informaltable"><table class="table">
739 <a class="link" href="basic_socket/max_connections.html" title="basic_socket::max_connections"><span class="bold"><strong>max_connections</strong></span></a>
744 (Deprecated: Use max_listen_connections.) The maximum length of
745 the queue of pending incoming connections.
752 <a class="link" href="basic_socket/max_listen_connections.html" title="basic_socket::max_listen_connections"><span class="bold"><strong>max_listen_connections</strong></span></a>
757 The maximum length of the queue of pending incoming connections.
764 <a class="link" href="basic_socket/message_do_not_route.html" title="basic_socket::message_do_not_route"><span class="bold"><strong>message_do_not_route</strong></span></a>
769 Specify that the data should not be subject to routing.
776 <a class="link" href="basic_socket/message_end_of_record.html" title="basic_socket::message_end_of_record"><span class="bold"><strong>message_end_of_record</strong></span></a>
781 Specifies that the data marks the end of a record.
788 <a class="link" href="basic_socket/message_out_of_band.html" title="basic_socket::message_out_of_band"><span class="bold"><strong>message_out_of_band</strong></span></a>
793 Process out-of-band data.
800 <a class="link" href="basic_socket/message_peek.html" title="basic_socket::message_peek"><span class="bold"><strong>message_peek</strong></span></a>
805 Peek at incoming data without removing it from the input queue.
812 <a name="boost_asio.reference.basic_socket.h4"></a>
813 <span class="phrase"><a name="boost_asio.reference.basic_socket.protected_data_members"></a></span><a class="link" href="basic_socket.html#boost_asio.reference.basic_socket.protected_data_members">Protected
816 <div class="informaltable"><table class="table">
836 <a class="link" href="basic_socket/impl_.html" title="basic_socket::impl_"><span class="bold"><strong>impl_</strong></span></a>
844 The <a class="link" href="basic_socket.html" title="basic_socket"><code class="computeroutput">basic_socket</code></a>
845 class template provides functionality that is common to both stream-oriented
846 and datagram-oriented sockets.
849 <a name="boost_asio.reference.basic_socket.h5"></a>
850 <span class="phrase"><a name="boost_asio.reference.basic_socket.thread_safety"></a></span><a class="link" href="basic_socket.html#boost_asio.reference.basic_socket.thread_safety">Thread
854 <span class="emphasis"><em>Distinct</em></span> <span class="emphasis"><em>objects:</em></span> Safe.
857 <span class="emphasis"><em>Shared</em></span> <span class="emphasis"><em>objects:</em></span> Unsafe.
860 <a name="boost_asio.reference.basic_socket.h6"></a>
861 <span class="phrase"><a name="boost_asio.reference.basic_socket.requirements"></a></span><a class="link" href="basic_socket.html#boost_asio.reference.basic_socket.requirements">Requirements</a>
864 <span class="emphasis"><em>Header: </em></span><code class="literal">boost/asio/basic_socket.hpp</code>
867 <span class="emphasis"><em>Convenience header: </em></span><code class="literal">boost/asio.hpp</code>
870 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
871 <td align="left"></td>
872 <td align="right"><div class="copyright-footer">Copyright © 2003-2019 Christopher M. Kohlhoff<p>
873 Distributed under the Boost Software License, Version 1.0. (See accompanying
874 file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
879 <div class="spirit-nav">
880 <a accesskey="p" href="basic_signal_set__rebind_executor/other.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../boost_asio.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="basic_socket/assign.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>