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/service_type.html" title="basic_signal_set::service_type">
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/service_type.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"><span class="keyword">template</span><span class="special"><</span>
33 <span class="keyword">typename</span> <a class="link" href="Protocol.html" title="Protocol requirements">Protocol</a><span class="special">,</span>
34 <span class="keyword">typename</span> <a class="link" href="SocketService.html" title="Socket service requirements">SocketService</a><span class="special">></span>
35 <span class="keyword">class</span> <span class="identifier">basic_socket</span> <span class="special">:</span>
36 <span class="keyword">public</span> <span class="identifier">basic_io_object</span><span class="special"><</span> <span class="identifier">SocketService</span> <span class="special">>,</span>
37 <span class="keyword">public</span> <span class="identifier">socket_base</span>
40 <a name="boost_asio.reference.basic_socket.h0"></a>
41 <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>
43 <div class="informaltable"><table class="table">
64 <a class="link" href="basic_socket/broadcast.html" title="basic_socket::broadcast"><span class="bold"><strong>broadcast</strong></span></a>
69 Socket option to permit sending of broadcast messages.
76 <a class="link" href="basic_socket/bytes_readable.html" title="basic_socket::bytes_readable"><span class="bold"><strong>bytes_readable</strong></span></a>
81 IO control command to get the amount of data that can be read without
89 <a class="link" href="basic_socket/debug.html" title="basic_socket::debug"><span class="bold"><strong>debug</strong></span></a>
94 Socket option to enable socket-level debugging.
101 <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>
106 Socket option to prevent routing, use local interfaces only.
113 <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>
118 Socket option to report aborted connections on accept.
125 <a class="link" href="basic_socket/endpoint_type.html" title="basic_socket::endpoint_type"><span class="bold"><strong>endpoint_type</strong></span></a>
137 <a class="link" href="basic_socket/implementation_type.html" title="basic_socket::implementation_type"><span class="bold"><strong>implementation_type</strong></span></a>
142 The underlying implementation type of I/O object.
149 <a class="link" href="basic_socket/keep_alive.html" title="basic_socket::keep_alive"><span class="bold"><strong>keep_alive</strong></span></a>
154 Socket option to send keep-alives.
161 <a class="link" href="basic_socket/linger.html" title="basic_socket::linger"><span class="bold"><strong>linger</strong></span></a>
166 Socket option to specify whether the socket lingers on close if
167 unsent data is present.
174 <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>
179 A basic_socket is always the lowest layer.
186 <a class="link" href="basic_socket/message_flags.html" title="basic_socket::message_flags"><span class="bold"><strong>message_flags</strong></span></a>
191 Bitmask type for flags that can be passed to send and receive operations.
198 <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>
203 The native representation of a socket.
210 <a class="link" href="basic_socket/native_type.html" title="basic_socket::native_type"><span class="bold"><strong>native_type</strong></span></a>
215 (Deprecated: Use native_handle_type.) The native representation
223 <a class="link" href="basic_socket/non_blocking_io.html" title="basic_socket::non_blocking_io"><span class="bold"><strong>non_blocking_io</strong></span></a>
228 (Deprecated: Use non_blocking().) IO control command to set the
229 blocking mode of the socket.
236 <a class="link" href="basic_socket/protocol_type.html" title="basic_socket::protocol_type"><span class="bold"><strong>protocol_type</strong></span></a>
248 <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>
253 Socket option for the receive buffer size of a socket.
260 <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>
265 Socket option for the receive low watermark.
272 <a class="link" href="basic_socket/reuse_address.html" title="basic_socket::reuse_address"><span class="bold"><strong>reuse_address</strong></span></a>
277 Socket option to allow the socket to be bound to an address that
285 <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>
290 Socket option for the send buffer size of a socket.
297 <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>
302 Socket option for the send low watermark.
309 <a class="link" href="basic_socket/service_type.html" title="basic_socket::service_type"><span class="bold"><strong>service_type</strong></span></a>
314 The type of the service that will be used to provide I/O operations.
321 <a class="link" href="basic_socket/shutdown_type.html" title="basic_socket::shutdown_type"><span class="bold"><strong>shutdown_type</strong></span></a>
326 Different ways a socket may be shutdown.
333 <a name="boost_asio.reference.basic_socket.h1"></a>
334 <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
337 <div class="informaltable"><table class="table">
358 <a class="link" href="basic_socket/assign.html" title="basic_socket::assign"><span class="bold"><strong>assign</strong></span></a>
363 Assign an existing native socket to the socket.
370 <a class="link" href="basic_socket/async_connect.html" title="basic_socket::async_connect"><span class="bold"><strong>async_connect</strong></span></a>
375 Start an asynchronous connect.
382 <a class="link" href="basic_socket/at_mark.html" title="basic_socket::at_mark"><span class="bold"><strong>at_mark</strong></span></a>
387 Determine whether the socket is at the out-of-band data mark.
394 <a class="link" href="basic_socket/available.html" title="basic_socket::available"><span class="bold"><strong>available</strong></span></a>
399 Determine the number of bytes available for reading.
406 <a class="link" href="basic_socket/basic_socket.html" title="basic_socket::basic_socket"><span class="bold"><strong>basic_socket</strong></span></a>
411 Construct a basic_socket without opening it.
414 Construct and open a basic_socket.
417 Construct a basic_socket, opening it and binding it to the given
421 Construct a basic_socket on an existing native socket.
424 Move-construct a basic_socket from another.
427 Move-construct a basic_socket from a socket of another protocol
435 <a class="link" href="basic_socket/bind.html" title="basic_socket::bind"><span class="bold"><strong>bind</strong></span></a>
440 Bind the socket to the given local endpoint.
447 <a class="link" href="basic_socket/cancel.html" title="basic_socket::cancel"><span class="bold"><strong>cancel</strong></span></a>
452 Cancel all asynchronous operations associated with the socket.
459 <a class="link" href="basic_socket/close.html" title="basic_socket::close"><span class="bold"><strong>close</strong></span></a>
471 <a class="link" href="basic_socket/connect.html" title="basic_socket::connect"><span class="bold"><strong>connect</strong></span></a>
476 Connect the socket to the specified endpoint.
483 <a class="link" href="basic_socket/get_io_service.html" title="basic_socket::get_io_service"><span class="bold"><strong>get_io_service</strong></span></a>
488 Get the io_service associated with the object.
495 <a class="link" href="basic_socket/get_option.html" title="basic_socket::get_option"><span class="bold"><strong>get_option</strong></span></a>
500 Get an option from the socket.
507 <a class="link" href="basic_socket/io_control.html" title="basic_socket::io_control"><span class="bold"><strong>io_control</strong></span></a>
512 Perform an IO control command on the socket.
519 <a class="link" href="basic_socket/is_open.html" title="basic_socket::is_open"><span class="bold"><strong>is_open</strong></span></a>
524 Determine whether the socket is open.
531 <a class="link" href="basic_socket/local_endpoint.html" title="basic_socket::local_endpoint"><span class="bold"><strong>local_endpoint</strong></span></a>
536 Get the local endpoint of the socket.
543 <a class="link" href="basic_socket/lowest_layer.html" title="basic_socket::lowest_layer"><span class="bold"><strong>lowest_layer</strong></span></a>
548 Get a reference to the lowest layer.
551 Get a const reference to the lowest layer.
558 <a class="link" href="basic_socket/native.html" title="basic_socket::native"><span class="bold"><strong>native</strong></span></a>
563 (Deprecated: Use native_handle().) Get the native socket representation.
570 <a class="link" href="basic_socket/native_handle.html" title="basic_socket::native_handle"><span class="bold"><strong>native_handle</strong></span></a>
575 Get the native socket representation.
582 <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>
587 Gets the non-blocking mode of the native socket implementation.
590 Sets the non-blocking mode of the native socket implementation.
597 <a class="link" href="basic_socket/non_blocking.html" title="basic_socket::non_blocking"><span class="bold"><strong>non_blocking</strong></span></a>
602 Gets the non-blocking mode of the socket.
605 Sets the non-blocking mode of the socket.
612 <a class="link" href="basic_socket/open.html" title="basic_socket::open"><span class="bold"><strong>open</strong></span></a>
617 Open the socket using the specified protocol.
624 <a class="link" href="basic_socket/operator_eq_.html" title="basic_socket::operator="><span class="bold"><strong>operator=</strong></span></a>
629 Move-assign a basic_socket from another.
632 Move-assign a basic_socket from a socket of another protocol type.
639 <a class="link" href="basic_socket/remote_endpoint.html" title="basic_socket::remote_endpoint"><span class="bold"><strong>remote_endpoint</strong></span></a>
644 Get the remote endpoint of the socket.
651 <a class="link" href="basic_socket/set_option.html" title="basic_socket::set_option"><span class="bold"><strong>set_option</strong></span></a>
656 Set an option on the socket.
663 <a class="link" href="basic_socket/shutdown.html" title="basic_socket::shutdown"><span class="bold"><strong>shutdown</strong></span></a>
668 Disable sends or receives on the socket.
675 <a name="boost_asio.reference.basic_socket.h2"></a>
676 <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
679 <div class="informaltable"><table class="table">
700 <a class="link" href="basic_socket/get_implementation.html" title="basic_socket::get_implementation"><span class="bold"><strong>get_implementation</strong></span></a>
705 Get the underlying implementation of the I/O object.
712 <a class="link" href="basic_socket/get_service.html" title="basic_socket::get_service"><span class="bold"><strong>get_service</strong></span></a>
717 Get the service associated with the I/O object.
724 <a class="link" href="basic_socket/_basic_socket.html" title="basic_socket::~basic_socket"><span class="bold"><strong>~basic_socket</strong></span></a>
729 Protected destructor to prevent deletion through this type.
736 <a name="boost_asio.reference.basic_socket.h3"></a>
737 <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
740 <div class="informaltable"><table class="table">
761 <a class="link" href="basic_socket/max_connections.html" title="basic_socket::max_connections"><span class="bold"><strong>max_connections</strong></span></a>
766 The maximum length of the queue of pending incoming connections.
773 <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>
778 Specify that the data should not be subject to routing.
785 <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>
790 Specifies that the data marks the end of a record.
797 <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>
802 Process out-of-band data.
809 <a class="link" href="basic_socket/message_peek.html" title="basic_socket::message_peek"><span class="bold"><strong>message_peek</strong></span></a>
814 Peek at incoming data without removing it from the input queue.
821 <a name="boost_asio.reference.basic_socket.h4"></a>
822 <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
825 <div class="informaltable"><table class="table">
846 <a class="link" href="basic_socket/implementation.html" title="basic_socket::implementation"><span class="bold"><strong>implementation</strong></span></a>
851 (Deprecated: Use get_implementation().) The underlying implementation
859 <a class="link" href="basic_socket/service.html" title="basic_socket::service"><span class="bold"><strong>service</strong></span></a>
864 (Deprecated: Use get_service().) The service associated with the
872 The <a class="link" href="basic_socket.html" title="basic_socket"><code class="computeroutput"><span class="identifier">basic_socket</span></code></a>
873 class template provides functionality that is common to both stream-oriented
874 and datagram-oriented sockets.
877 <a name="boost_asio.reference.basic_socket.h5"></a>
878 <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
882 <span class="emphasis"><em>Distinct</em></span> <span class="emphasis"><em>objects:</em></span> Safe.
885 <span class="emphasis"><em>Shared</em></span> <span class="emphasis"><em>objects:</em></span> Unsafe.
888 <a name="boost_asio.reference.basic_socket.h6"></a>
889 <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>
892 <span class="emphasis"><em>Header: </em></span><code class="literal">boost/asio/basic_socket.hpp</code>
895 <span class="emphasis"><em>Convenience header: </em></span><code class="literal">boost/asio.hpp</code>
898 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
899 <td align="left"></td>
900 <td align="right"><div class="copyright-footer">Copyright © 2003-2017 Christopher M. Kohlhoff<p>
901 Distributed under the Boost Software License, Version 1.0. (See accompanying
902 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>)
907 <div class="spirit-nav">
908 <a accesskey="p" href="basic_signal_set/service_type.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>