3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>basic_stream_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_socket_streambuf/_basic_socket_streambuf.html" title="basic_socket_streambuf::~basic_socket_streambuf">
10 <link rel="next" href="basic_stream_socket/assign.html" title="basic_stream_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_socket_streambuf/_basic_socket_streambuf.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_stream_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_stream_socket"></a><a class="link" href="basic_stream_socket.html" title="basic_stream_socket">basic_stream_socket</a>
28 </h3></div></div></div>
30 Provides stream-oriented 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="StreamSocketService.html" title="Stream socket service requirements">StreamSocketService</a> <span class="special">=</span> <span class="identifier">stream_socket_service</span><span class="special"><</span><span class="identifier">Protocol</span><span class="special">>></span>
35 <span class="keyword">class</span> <span class="identifier">basic_stream_socket</span> <span class="special">:</span>
36 <span class="keyword">public</span> <span class="identifier">basic_socket</span><span class="special"><</span> <span class="identifier">Protocol</span><span class="special">,</span> <span class="identifier">StreamSocketService</span> <span class="special">></span>
39 <a name="boost_asio.reference.basic_stream_socket.h0"></a>
40 <span class="phrase"><a name="boost_asio.reference.basic_stream_socket.types"></a></span><a class="link" href="basic_stream_socket.html#boost_asio.reference.basic_stream_socket.types">Types</a>
42 <div class="informaltable"><table class="table">
63 <a class="link" href="basic_stream_socket/broadcast.html" title="basic_stream_socket::broadcast"><span class="bold"><strong>broadcast</strong></span></a>
68 Socket option to permit sending of broadcast messages.
75 <a class="link" href="basic_stream_socket/bytes_readable.html" title="basic_stream_socket::bytes_readable"><span class="bold"><strong>bytes_readable</strong></span></a>
80 IO control command to get the amount of data that can be read without
88 <a class="link" href="basic_stream_socket/debug.html" title="basic_stream_socket::debug"><span class="bold"><strong>debug</strong></span></a>
93 Socket option to enable socket-level debugging.
100 <a class="link" href="basic_stream_socket/do_not_route.html" title="basic_stream_socket::do_not_route"><span class="bold"><strong>do_not_route</strong></span></a>
105 Socket option to prevent routing, use local interfaces only.
112 <a class="link" href="basic_stream_socket/enable_connection_aborted.html" title="basic_stream_socket::enable_connection_aborted"><span class="bold"><strong>enable_connection_aborted</strong></span></a>
117 Socket option to report aborted connections on accept.
124 <a class="link" href="basic_stream_socket/endpoint_type.html" title="basic_stream_socket::endpoint_type"><span class="bold"><strong>endpoint_type</strong></span></a>
136 <a class="link" href="basic_stream_socket/implementation_type.html" title="basic_stream_socket::implementation_type"><span class="bold"><strong>implementation_type</strong></span></a>
141 The underlying implementation type of I/O object.
148 <a class="link" href="basic_stream_socket/keep_alive.html" title="basic_stream_socket::keep_alive"><span class="bold"><strong>keep_alive</strong></span></a>
153 Socket option to send keep-alives.
160 <a class="link" href="basic_stream_socket/linger.html" title="basic_stream_socket::linger"><span class="bold"><strong>linger</strong></span></a>
165 Socket option to specify whether the socket lingers on close if
166 unsent data is present.
173 <a class="link" href="basic_stream_socket/lowest_layer_type.html" title="basic_stream_socket::lowest_layer_type"><span class="bold"><strong>lowest_layer_type</strong></span></a>
178 A basic_socket is always the lowest layer.
185 <a class="link" href="basic_stream_socket/message_flags.html" title="basic_stream_socket::message_flags"><span class="bold"><strong>message_flags</strong></span></a>
190 Bitmask type for flags that can be passed to send and receive operations.
197 <a class="link" href="basic_stream_socket/native_handle_type.html" title="basic_stream_socket::native_handle_type"><span class="bold"><strong>native_handle_type</strong></span></a>
202 The native representation of a socket.
209 <a class="link" href="basic_stream_socket/native_type.html" title="basic_stream_socket::native_type"><span class="bold"><strong>native_type</strong></span></a>
214 (Deprecated: Use native_handle_type.) The native representation
222 <a class="link" href="basic_stream_socket/non_blocking_io.html" title="basic_stream_socket::non_blocking_io"><span class="bold"><strong>non_blocking_io</strong></span></a>
227 (Deprecated: Use non_blocking().) IO control command to set the
228 blocking mode of the socket.
235 <a class="link" href="basic_stream_socket/protocol_type.html" title="basic_stream_socket::protocol_type"><span class="bold"><strong>protocol_type</strong></span></a>
247 <a class="link" href="basic_stream_socket/receive_buffer_size.html" title="basic_stream_socket::receive_buffer_size"><span class="bold"><strong>receive_buffer_size</strong></span></a>
252 Socket option for the receive buffer size of a socket.
259 <a class="link" href="basic_stream_socket/receive_low_watermark.html" title="basic_stream_socket::receive_low_watermark"><span class="bold"><strong>receive_low_watermark</strong></span></a>
264 Socket option for the receive low watermark.
271 <a class="link" href="basic_stream_socket/reuse_address.html" title="basic_stream_socket::reuse_address"><span class="bold"><strong>reuse_address</strong></span></a>
276 Socket option to allow the socket to be bound to an address that
284 <a class="link" href="basic_stream_socket/send_buffer_size.html" title="basic_stream_socket::send_buffer_size"><span class="bold"><strong>send_buffer_size</strong></span></a>
289 Socket option for the send buffer size of a socket.
296 <a class="link" href="basic_stream_socket/send_low_watermark.html" title="basic_stream_socket::send_low_watermark"><span class="bold"><strong>send_low_watermark</strong></span></a>
301 Socket option for the send low watermark.
308 <a class="link" href="basic_stream_socket/service_type.html" title="basic_stream_socket::service_type"><span class="bold"><strong>service_type</strong></span></a>
313 The type of the service that will be used to provide I/O operations.
320 <a class="link" href="basic_stream_socket/shutdown_type.html" title="basic_stream_socket::shutdown_type"><span class="bold"><strong>shutdown_type</strong></span></a>
325 Different ways a socket may be shutdown.
332 <a name="boost_asio.reference.basic_stream_socket.h1"></a>
333 <span class="phrase"><a name="boost_asio.reference.basic_stream_socket.member_functions"></a></span><a class="link" href="basic_stream_socket.html#boost_asio.reference.basic_stream_socket.member_functions">Member
336 <div class="informaltable"><table class="table">
357 <a class="link" href="basic_stream_socket/assign.html" title="basic_stream_socket::assign"><span class="bold"><strong>assign</strong></span></a>
362 Assign an existing native socket to the socket.
369 <a class="link" href="basic_stream_socket/async_connect.html" title="basic_stream_socket::async_connect"><span class="bold"><strong>async_connect</strong></span></a>
374 Start an asynchronous connect.
381 <a class="link" href="basic_stream_socket/async_read_some.html" title="basic_stream_socket::async_read_some"><span class="bold"><strong>async_read_some</strong></span></a>
386 Start an asynchronous read.
393 <a class="link" href="basic_stream_socket/async_receive.html" title="basic_stream_socket::async_receive"><span class="bold"><strong>async_receive</strong></span></a>
398 Start an asynchronous receive.
405 <a class="link" href="basic_stream_socket/async_send.html" title="basic_stream_socket::async_send"><span class="bold"><strong>async_send</strong></span></a>
410 Start an asynchronous send.
417 <a class="link" href="basic_stream_socket/async_write_some.html" title="basic_stream_socket::async_write_some"><span class="bold"><strong>async_write_some</strong></span></a>
422 Start an asynchronous write.
429 <a class="link" href="basic_stream_socket/at_mark.html" title="basic_stream_socket::at_mark"><span class="bold"><strong>at_mark</strong></span></a>
434 Determine whether the socket is at the out-of-band data mark.
441 <a class="link" href="basic_stream_socket/available.html" title="basic_stream_socket::available"><span class="bold"><strong>available</strong></span></a>
446 Determine the number of bytes available for reading.
453 <a class="link" href="basic_stream_socket/basic_stream_socket.html" title="basic_stream_socket::basic_stream_socket"><span class="bold"><strong>basic_stream_socket</strong></span></a>
458 Construct a basic_stream_socket without opening it.
461 Construct and open a basic_stream_socket.
464 Construct a basic_stream_socket, opening it and binding it to the
465 given local endpoint.
468 Construct a basic_stream_socket on an existing native socket.
471 Move-construct a basic_stream_socket from another.
474 Move-construct a basic_stream_socket from a socket of another protocol
482 <a class="link" href="basic_stream_socket/bind.html" title="basic_stream_socket::bind"><span class="bold"><strong>bind</strong></span></a>
487 Bind the socket to the given local endpoint.
494 <a class="link" href="basic_stream_socket/cancel.html" title="basic_stream_socket::cancel"><span class="bold"><strong>cancel</strong></span></a>
499 Cancel all asynchronous operations associated with the socket.
506 <a class="link" href="basic_stream_socket/close.html" title="basic_stream_socket::close"><span class="bold"><strong>close</strong></span></a>
518 <a class="link" href="basic_stream_socket/connect.html" title="basic_stream_socket::connect"><span class="bold"><strong>connect</strong></span></a>
523 Connect the socket to the specified endpoint.
530 <a class="link" href="basic_stream_socket/get_io_service.html" title="basic_stream_socket::get_io_service"><span class="bold"><strong>get_io_service</strong></span></a>
535 Get the io_service associated with the object.
542 <a class="link" href="basic_stream_socket/get_option.html" title="basic_stream_socket::get_option"><span class="bold"><strong>get_option</strong></span></a>
547 Get an option from the socket.
554 <a class="link" href="basic_stream_socket/io_control.html" title="basic_stream_socket::io_control"><span class="bold"><strong>io_control</strong></span></a>
559 Perform an IO control command on the socket.
566 <a class="link" href="basic_stream_socket/is_open.html" title="basic_stream_socket::is_open"><span class="bold"><strong>is_open</strong></span></a>
571 Determine whether the socket is open.
578 <a class="link" href="basic_stream_socket/local_endpoint.html" title="basic_stream_socket::local_endpoint"><span class="bold"><strong>local_endpoint</strong></span></a>
583 Get the local endpoint of the socket.
590 <a class="link" href="basic_stream_socket/lowest_layer.html" title="basic_stream_socket::lowest_layer"><span class="bold"><strong>lowest_layer</strong></span></a>
595 Get a reference to the lowest layer.
598 Get a const reference to the lowest layer.
605 <a class="link" href="basic_stream_socket/native.html" title="basic_stream_socket::native"><span class="bold"><strong>native</strong></span></a>
610 (Deprecated: Use native_handle().) Get the native socket representation.
617 <a class="link" href="basic_stream_socket/native_handle.html" title="basic_stream_socket::native_handle"><span class="bold"><strong>native_handle</strong></span></a>
622 Get the native socket representation.
629 <a class="link" href="basic_stream_socket/native_non_blocking.html" title="basic_stream_socket::native_non_blocking"><span class="bold"><strong>native_non_blocking</strong></span></a>
634 Gets the non-blocking mode of the native socket implementation.
637 Sets the non-blocking mode of the native socket implementation.
644 <a class="link" href="basic_stream_socket/non_blocking.html" title="basic_stream_socket::non_blocking"><span class="bold"><strong>non_blocking</strong></span></a>
649 Gets the non-blocking mode of the socket.
652 Sets the non-blocking mode of the socket.
659 <a class="link" href="basic_stream_socket/open.html" title="basic_stream_socket::open"><span class="bold"><strong>open</strong></span></a>
664 Open the socket using the specified protocol.
671 <a class="link" href="basic_stream_socket/operator_eq_.html" title="basic_stream_socket::operator="><span class="bold"><strong>operator=</strong></span></a>
676 Move-assign a basic_stream_socket from another.
679 Move-assign a basic_stream_socket from a socket of another protocol
687 <a class="link" href="basic_stream_socket/read_some.html" title="basic_stream_socket::read_some"><span class="bold"><strong>read_some</strong></span></a>
692 Read some data from the socket.
699 <a class="link" href="basic_stream_socket/receive.html" title="basic_stream_socket::receive"><span class="bold"><strong>receive</strong></span></a>
704 Receive some data on the socket.
707 Receive some data on a connected socket.
714 <a class="link" href="basic_stream_socket/remote_endpoint.html" title="basic_stream_socket::remote_endpoint"><span class="bold"><strong>remote_endpoint</strong></span></a>
719 Get the remote endpoint of the socket.
726 <a class="link" href="basic_stream_socket/send.html" title="basic_stream_socket::send"><span class="bold"><strong>send</strong></span></a>
731 Send some data on the socket.
738 <a class="link" href="basic_stream_socket/set_option.html" title="basic_stream_socket::set_option"><span class="bold"><strong>set_option</strong></span></a>
743 Set an option on the socket.
750 <a class="link" href="basic_stream_socket/shutdown.html" title="basic_stream_socket::shutdown"><span class="bold"><strong>shutdown</strong></span></a>
755 Disable sends or receives on the socket.
762 <a class="link" href="basic_stream_socket/write_some.html" title="basic_stream_socket::write_some"><span class="bold"><strong>write_some</strong></span></a>
767 Write some data to the socket.
774 <a name="boost_asio.reference.basic_stream_socket.h2"></a>
775 <span class="phrase"><a name="boost_asio.reference.basic_stream_socket.protected_member_functions"></a></span><a class="link" href="basic_stream_socket.html#boost_asio.reference.basic_stream_socket.protected_member_functions">Protected
778 <div class="informaltable"><table class="table">
799 <a class="link" href="basic_stream_socket/get_implementation.html" title="basic_stream_socket::get_implementation"><span class="bold"><strong>get_implementation</strong></span></a>
804 Get the underlying implementation of the I/O object.
811 <a class="link" href="basic_stream_socket/get_service.html" title="basic_stream_socket::get_service"><span class="bold"><strong>get_service</strong></span></a>
816 Get the service associated with the I/O object.
823 <a name="boost_asio.reference.basic_stream_socket.h3"></a>
824 <span class="phrase"><a name="boost_asio.reference.basic_stream_socket.data_members"></a></span><a class="link" href="basic_stream_socket.html#boost_asio.reference.basic_stream_socket.data_members">Data Members</a>
826 <div class="informaltable"><table class="table">
847 <a class="link" href="basic_stream_socket/max_connections.html" title="basic_stream_socket::max_connections"><span class="bold"><strong>max_connections</strong></span></a>
852 The maximum length of the queue of pending incoming connections.
859 <a class="link" href="basic_stream_socket/message_do_not_route.html" title="basic_stream_socket::message_do_not_route"><span class="bold"><strong>message_do_not_route</strong></span></a>
864 Specify that the data should not be subject to routing.
871 <a class="link" href="basic_stream_socket/message_end_of_record.html" title="basic_stream_socket::message_end_of_record"><span class="bold"><strong>message_end_of_record</strong></span></a>
876 Specifies that the data marks the end of a record.
883 <a class="link" href="basic_stream_socket/message_out_of_band.html" title="basic_stream_socket::message_out_of_band"><span class="bold"><strong>message_out_of_band</strong></span></a>
888 Process out-of-band data.
895 <a class="link" href="basic_stream_socket/message_peek.html" title="basic_stream_socket::message_peek"><span class="bold"><strong>message_peek</strong></span></a>
900 Peek at incoming data without removing it from the input queue.
907 <a name="boost_asio.reference.basic_stream_socket.h4"></a>
908 <span class="phrase"><a name="boost_asio.reference.basic_stream_socket.protected_data_members"></a></span><a class="link" href="basic_stream_socket.html#boost_asio.reference.basic_stream_socket.protected_data_members">Protected
911 <div class="informaltable"><table class="table">
932 <a class="link" href="basic_stream_socket/implementation.html" title="basic_stream_socket::implementation"><span class="bold"><strong>implementation</strong></span></a>
937 (Deprecated: Use get_implementation().) The underlying implementation
945 <a class="link" href="basic_stream_socket/service.html" title="basic_stream_socket::service"><span class="bold"><strong>service</strong></span></a>
950 (Deprecated: Use get_service().) The service associated with the
958 The <a class="link" href="basic_stream_socket.html" title="basic_stream_socket"><code class="computeroutput"><span class="identifier">basic_stream_socket</span></code></a> class template
959 provides asynchronous and blocking stream-oriented socket functionality.
962 <a name="boost_asio.reference.basic_stream_socket.h5"></a>
963 <span class="phrase"><a name="boost_asio.reference.basic_stream_socket.thread_safety"></a></span><a class="link" href="basic_stream_socket.html#boost_asio.reference.basic_stream_socket.thread_safety">Thread Safety</a>
966 <span class="emphasis"><em>Distinct</em></span> <span class="emphasis"><em>objects:</em></span> Safe.
969 <span class="emphasis"><em>Shared</em></span> <span class="emphasis"><em>objects:</em></span> Unsafe.
972 <a name="boost_asio.reference.basic_stream_socket.h6"></a>
973 <span class="phrase"><a name="boost_asio.reference.basic_stream_socket.requirements"></a></span><a class="link" href="basic_stream_socket.html#boost_asio.reference.basic_stream_socket.requirements">Requirements</a>
976 <span class="emphasis"><em>Header: </em></span><code class="literal">boost/asio/basic_stream_socket.hpp</code>
979 <span class="emphasis"><em>Convenience header: </em></span><code class="literal">boost/asio.hpp</code>
982 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
983 <td align="left"></td>
984 <td align="right"><div class="copyright-footer">Copyright © 2003-2017 Christopher M. Kohlhoff<p>
985 Distributed under the Boost Software License, Version 1.0. (See accompanying
986 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>)
991 <div class="spirit-nav">
992 <a accesskey="p" href="basic_socket_streambuf/_basic_socket_streambuf.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_stream_socket/assign.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>