Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / asio / doc / reference.qbk
1 [/
2  / Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
3  /
4  / Distributed under the Boost Software License, Version 1.0. (See accompanying
5  / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6  /]
7
8 [section:reference Reference]
9
10 [xinclude quickref.xml]
11
12 [include requirements/asynchronous_operations.qbk]
13 [include requirements/read_write_operations.qbk]
14 [include requirements/synchronous_socket_operations.qbk]
15 [include requirements/asynchronous_socket_operations.qbk]
16 [include requirements/AcceptableProtocol.qbk]
17 [include requirements/AcceptHandler.qbk]
18 [include requirements/AsyncRandomAccessReadDevice.qbk]
19 [include requirements/AsyncRandomAccessWriteDevice.qbk]
20 [include requirements/AsyncReadStream.qbk]
21 [include requirements/AsyncWriteStream.qbk]
22 [include requirements/BufferedHandshakeHandler.qbk]
23 [include requirements/CompletionCondition.qbk]
24 [include requirements/CompletionHandler.qbk]
25 [include requirements/ConnectCondition.qbk]
26 [include requirements/ConnectHandler.qbk]
27 [include requirements/ConstBufferSequence.qbk]
28 [include requirements/DynamicBuffer.qbk]
29 [include requirements/DynamicBuffer_v1.qbk]
30 [include requirements/DynamicBuffer_v2.qbk]
31 [include requirements/Endpoint.qbk]
32 [include requirements/EndpointSequence.qbk]
33 [include requirements/ExecutionContext.qbk]
34 [include requirements/Executor.qbk]
35 [include requirements/GettableSerialPortOption.qbk]
36 [include requirements/GettableSocketOption.qbk]
37 [include requirements/Handler.qbk]
38 [include requirements/HandshakeHandler.qbk]
39 [include requirements/InternetProtocol.qbk]
40 [include requirements/IoControlCommand.qbk]
41 [include requirements/IoObjectService.qbk]
42 [include requirements/IteratorConnectHandler.qbk]
43 [include requirements/LegacyCompletionHandler.qbk]
44 [include requirements/MoveAcceptHandler.qbk]
45 [include requirements/MutableBufferSequence.qbk]
46 [include requirements/ProtoAllocator.qbk]
47 [include requirements/Protocol.qbk]
48 [include requirements/RangeConnectHandler.qbk]
49 [include requirements/ReadHandler.qbk]
50 [include requirements/ResolveHandler.qbk]
51 [include requirements/Service.qbk]
52 [include requirements/SettableSerialPortOption.qbk]
53 [include requirements/SettableSocketOption.qbk]
54 [include requirements/ShutdownHandler.qbk]
55 [include requirements/SignalHandler.qbk]
56 [include requirements/SyncRandomAccessReadDevice.qbk]
57 [include requirements/SyncRandomAccessWriteDevice.qbk]
58 [include requirements/SyncReadStream.qbk]
59 [include requirements/SyncWriteStream.qbk]
60 [include requirements/TimeTraits.qbk]
61 [include requirements/WaitHandler.qbk]
62 [include requirements/WaitTraits.qbk]
63 [include requirements/WriteHandler.qbk]
64
65
66
67 [section:asio_handler_allocate asio_handler_allocate]
68
69 [indexterm1 boost_asio.indexterm.asio_handler_allocate..asio_handler_allocate] 
70 Default allocation function for handlers. 
71
72
73   void * asio_handler_allocate(
74       std::size_t size,
75       ... );
76
77
78 Asynchronous operations may need to allocate temporary objects. Since asynchronous operations have a handler function object, these temporary objects can be said to be associated with the handler.
79
80 Implement asio\_handler\_allocate and asio\_handler\_deallocate for your own handlers to provide custom allocation for these temporary objects.
81
82 The default implementation of these allocation hooks uses `operator new` and `operator delete`.
83
84
85 [heading Remarks]
86       
87 All temporary objects associated with a handler will be deallocated before the upcall to the handler is performed. This allows the same memory to be reused for a subsequent asynchronous operation initiated by the handler.
88
89
90 [heading Example]
91   
92
93
94    class my_handler;
95
96    void* asio_handler_allocate(std::size_t size, my_handler* context)
97    {
98      return ::operator new(size);
99    }
100
101    void asio_handler_deallocate(void* pointer, std::size_t size,
102        my_handler* context)
103    {
104      ::operator delete(pointer);
105    }
106
107
108
109
110
111
112 [heading Requirements]
113
114 ['Header: ][^boost/asio/handler_alloc_hook.hpp]
115
116 ['Convenience header: ][^boost/asio.hpp]
117
118
119 [endsect]
120
121
122
123 [section:asio_handler_deallocate asio_handler_deallocate]
124
125 [indexterm1 boost_asio.indexterm.asio_handler_deallocate..asio_handler_deallocate] 
126 Default deallocation function for handlers. 
127
128
129   void asio_handler_deallocate(
130       void * pointer,
131       std::size_t size,
132       ... );
133
134
135 Implement asio\_handler\_allocate and asio\_handler\_deallocate for your own handlers to provide custom allocation for the associated temporary objects.
136
137 The default implementation of these allocation hooks uses `operator new` and `operator delete`.
138
139
140
141
142 [heading Requirements]
143
144 ['Header: ][^boost/asio/handler_alloc_hook.hpp]
145
146 ['Convenience header: ][^boost/asio.hpp]
147
148
149 [endsect]
150
151
152 [section:asio_handler_invoke asio_handler_invoke]
153
154 [indexterm1 boost_asio.indexterm.asio_handler_invoke..asio_handler_invoke] 
155 Default invoke function for handlers. 
156
157
158 Default handler invocation hook used for non-const function objects. 
159
160   template<
161       typename Function>
162   void ``[link boost_asio.reference.asio_handler_invoke.overload1 asio_handler_invoke]``(
163       Function & function,
164       ... );
165   ``  [''''&raquo;''' [link boost_asio.reference.asio_handler_invoke.overload1 more...]]``
166
167 Default handler invocation hook used for const function objects. 
168
169   template<
170       typename Function>
171   void ``[link boost_asio.reference.asio_handler_invoke.overload2 asio_handler_invoke]``(
172       const Function & function,
173       ... );
174   ``  [''''&raquo;''' [link boost_asio.reference.asio_handler_invoke.overload2 more...]]``
175
176 Completion handlers for asynchronous operations are invoked by the [link boost_asio.reference.io_context `io_context`] associated with the corresponding object (e.g. a socket or deadline\_timer). Certain guarantees are made on when the handler may be invoked, in particular that a handler can only be invoked from a thread that is currently calling `run()` on the corresponding [link boost_asio.reference.io_context `io_context`] object. Handlers may subsequently be invoked through other objects (such as [link boost_asio.reference.io_context__strand `io_context::strand`] objects) that provide additional guarantees.
177
178 When asynchronous operations are composed from other asynchronous operations, all intermediate handlers should be invoked using the same method as the final handler. This is required to ensure that user-defined objects are not accessed in a way that may violate the guarantees. This hooking function ensures that the invoked method used for the final handler is accessible at each intermediate step.
179
180 Implement asio\_handler\_invoke for your own handlers to specify a custom invocation strategy.
181
182 This default implementation invokes the function object like so: 
183
184    function(); 
185
186
187 If necessary, the default implementation makes a copy of the function object so that the non-const operator() can be used.
188
189
190 [heading Example]
191   
192
193
194    class my_handler;
195
196    template <typename Function>
197    void asio_handler_invoke(Function function, my_handler* context)
198    {
199      context->strand_.dispatch(function);
200    }
201
202
203
204
205
206
207 [heading Requirements]
208
209 ['Header: ][^boost/asio/handler_invoke_hook.hpp]
210
211 ['Convenience header: ][^boost/asio.hpp]
212
213
214 [section:overload1 asio_handler_invoke (1 of 2 overloads)]
215
216
217 Default handler invocation hook used for non-const function objects. 
218
219
220   template<
221       typename Function>
222   void asio_handler_invoke(
223       Function & function,
224       ... );
225
226
227
228 [endsect]
229
230
231
232 [section:overload2 asio_handler_invoke (2 of 2 overloads)]
233
234
235 Default handler invocation hook used for const function objects. 
236
237
238   template<
239       typename Function>
240   void asio_handler_invoke(
241       const Function & function,
242       ... );
243
244
245
246 [endsect]
247
248
249 [endsect]
250
251
252 [section:asio_handler_is_continuation asio_handler_is_continuation]
253
254 [indexterm1 boost_asio.indexterm.asio_handler_is_continuation..asio_handler_is_continuation] 
255 Default continuation function for handlers. 
256
257
258   bool asio_handler_is_continuation(
259       ... );
260
261
262 Asynchronous operations may represent a continuation of the asynchronous control flow associated with the current handler. The implementation can use this knowledge to optimise scheduling of the handler.
263
264 Implement asio\_handler\_is\_continuation for your own handlers to indicate when a handler represents a continuation.
265
266 The default implementation of the continuation hook returns `false`.
267
268
269 [heading Example]
270   
271
272
273    class my_handler;
274
275    bool asio_handler_is_continuation(my_handler* context)
276    {
277      return true;
278    }
279
280
281
282
283
284
285 [heading Requirements]
286
287 ['Header: ][^boost/asio/handler_continuation_hook.hpp]
288
289 ['Convenience header: ][^boost/asio.hpp]
290
291
292 [endsect]
293
294
295 [section:associated_allocator associated_allocator]
296
297
298 Traits type used to obtain the allocator associated with an object. 
299
300
301   template<
302       typename T,
303       typename Allocator = std::allocator<void>>
304   struct associated_allocator
305
306
307 [heading Types]
308 [table
309   [[Name][Description]]
310
311   [
312
313     [[link boost_asio.reference.associated_allocator.type [*type]]]
314     [If T has a nested type allocator_type, T::allocator_type. Otherwise Allocator. ]
315   
316   ]
317
318 ]
319
320 [heading Member Functions]
321 [table
322   [[Name][Description]]
323
324   [
325     [[link boost_asio.reference.associated_allocator.get [*get]]]
326     [If T has a nested type allocator_type, returns t.get_allocator(). Otherwise returns a. ]
327   ]
328   
329 ]
330
331 A program may specialise this traits type if the `T` template parameter in the specialisation is a user-defined type. The template parameter `Allocator` shall be a type meeting the Allocator requirements.
332
333 Specialisations shall meet the following requirements, where `t` is a const reference to an object of type `T`, and `a` is an object of type `Allocator`.
334
335
336 * Provide a nested typedef `type` that identifies a type meeting the Allocator requirements.
337
338
339 * Provide a noexcept static member function named `get`, callable as `get(t)` and with return type `type`.
340
341
342 * Provide a noexcept static member function named `get`, callable as `get(t,a)` and with return type `type`. 
343
344
345
346 [heading Requirements]
347
348 ['Header: ][^boost/asio/associated_allocator.hpp]
349
350 ['Convenience header: ][^boost/asio.hpp]
351
352
353 [section:get associated_allocator::get]
354
355 [indexterm2 boost_asio.indexterm.associated_allocator.get..get..associated_allocator] 
356 If `T` has a nested type `allocator_type`, returns `t.get_allocator()`. Otherwise returns `a`. 
357
358
359   static type get(
360       const T & t,
361       const Allocator & a = Allocator());
362
363
364
365 [endsect]
366
367
368
369 [section:type associated_allocator::type]
370
371 [indexterm2 boost_asio.indexterm.associated_allocator.type..type..associated_allocator] 
372 If `T` has a nested type `allocator_type`, `T::allocator_type`. Otherwise `Allocator`. 
373
374
375   typedef see_below type;
376
377
378
379 [heading Requirements]
380
381 ['Header: ][^boost/asio/associated_allocator.hpp]
382
383 ['Convenience header: ][^boost/asio.hpp]
384
385
386 [endsect]
387
388
389
390 [endsect]
391
392 [section:associated_executor associated_executor]
393
394
395 Traits type used to obtain the executor associated with an object. 
396
397
398   template<
399       typename T,
400       typename ``[link boost_asio.reference.Executor1 Executor]`` = system_executor>
401   struct associated_executor
402
403
404 [heading Types]
405 [table
406   [[Name][Description]]
407
408   [
409
410     [[link boost_asio.reference.associated_executor.type [*type]]]
411     [If T has a nested type executor_type, T::executor_type. Otherwise Executor. ]
412   
413   ]
414
415 ]
416
417 [heading Member Functions]
418 [table
419   [[Name][Description]]
420
421   [
422     [[link boost_asio.reference.associated_executor.get [*get]]]
423     [If T has a nested type executor_type, returns t.get_executor(). Otherwise returns ex. ]
424   ]
425   
426 ]
427
428 A program may specialise this traits type if the `T` template parameter in the specialisation is a user-defined type. The template parameter `Executor` shall be a type meeting the Executor requirements.
429
430 Specialisations shall meet the following requirements, where `t` is a const reference to an object of type `T`, and `e` is an object of type `Executor`.
431
432
433 * Provide a nested typedef `type` that identifies a type meeting the Executor requirements.
434
435
436 * Provide a noexcept static member function named `get`, callable as `get(t)` and with return type `type`.
437
438
439 * Provide a noexcept static member function named `get`, callable as `get(t,e)` and with return type `type`. 
440
441
442
443 [heading Requirements]
444
445 ['Header: ][^boost/asio/associated_executor.hpp]
446
447 ['Convenience header: ][^boost/asio.hpp]
448
449
450 [section:get associated_executor::get]
451
452 [indexterm2 boost_asio.indexterm.associated_executor.get..get..associated_executor] 
453 If `T` has a nested type `executor_type`, returns `t.get_executor()`. Otherwise returns `ex`. 
454
455
456   static type get(
457       const T & t,
458       const Executor & ex = Executor());
459
460
461
462 [endsect]
463
464
465
466 [section:type associated_executor::type]
467
468 [indexterm2 boost_asio.indexterm.associated_executor.type..type..associated_executor] 
469 If `T` has a nested type `executor_type`, `T::executor_type`. Otherwise `Executor`. 
470
471
472   typedef see_below type;
473
474
475
476 [heading Requirements]
477
478 ['Header: ][^boost/asio/associated_executor.hpp]
479
480 ['Convenience header: ][^boost/asio.hpp]
481
482
483 [endsect]
484
485
486
487 [endsect]
488
489 [section:async_completion async_completion]
490
491
492 Helper template to deduce the handler type from a CompletionToken, capture a local copy of the handler, and then create an [link boost_asio.reference.async_result `async_result`] for the handler. 
493
494
495   template<
496       typename CompletionToken,
497       typename Signature>
498   struct async_completion
499
500
501 [heading Types]
502 [table
503   [[Name][Description]]
504
505   [
506
507     [[link boost_asio.reference.async_completion.completion_handler_type [*completion_handler_type]]]
508     [The real handler type to be used for the asynchronous operation. ]
509   
510   ]
511
512 ]
513
514 [heading Member Functions]
515 [table
516   [[Name][Description]]
517
518   [
519     [[link boost_asio.reference.async_completion.async_completion [*async_completion]]]
520     [Constructor. ]
521   ]
522   
523 ]
524
525 [heading Data Members]
526 [table
527   [[Name][Description]]
528
529   [
530     [[link boost_asio.reference.async_completion.completion_handler [*completion_handler]]]
531     [A copy of, or reference to, a real handler object. ]
532   ]
533
534   [
535     [[link boost_asio.reference.async_completion.result [*result]]]
536     [The result of the asynchronous operation's initiating function. ]
537   ]
538
539 ]
540
541 [heading Requirements]
542
543 ['Header: ][^boost/asio/async_result.hpp]
544
545 ['Convenience header: ][^boost/asio.hpp]
546
547
548 [section:async_completion async_completion::async_completion]
549
550 [indexterm2 boost_asio.indexterm.async_completion.async_completion..async_completion..async_completion] 
551 Constructor. 
552
553
554   async_completion(
555       CompletionToken & token);
556
557
558 The constructor creates the concrete completion handler and makes the link between the handler and the asynchronous result. 
559
560
561 [endsect]
562
563
564
565 [section:completion_handler async_completion::completion_handler]
566
567 [indexterm2 boost_asio.indexterm.async_completion.completion_handler..completion_handler..async_completion] 
568 A copy of, or reference to, a real handler object. 
569
570
571   conditional< is_same< CompletionToken, completion_handler_type >::value, completion_handler_type &, completion_handler_type >::type completion_handler;
572
573
574
575 [endsect]
576
577
578
579 [section:completion_handler_type async_completion::completion_handler_type]
580
581 [indexterm2 boost_asio.indexterm.async_completion.completion_handler_type..completion_handler_type..async_completion] 
582 The real handler type to be used for the asynchronous operation. 
583
584
585   typedef boost::asio::async_result< typename decay< CompletionToken >::type, Signature >::completion_handler_type completion_handler_type;
586
587
588 [heading Types]
589 [table
590   [[Name][Description]]
591
592   [
593
594     [[link boost_asio.reference.async_result.completion_handler_type [*completion_handler_type]]]
595     [The concrete completion handler type for the specific signature. ]
596   
597   ]
598
599   [
600
601     [[link boost_asio.reference.async_result.return_type [*return_type]]]
602     [The return type of the initiating function. ]
603   
604   ]
605
606 ]
607
608 [heading Member Functions]
609 [table
610   [[Name][Description]]
611
612   [
613     [[link boost_asio.reference.async_result.async_result [*async_result]]]
614     [Construct an async result from a given handler. ]
615   ]
616   
617   [
618     [[link boost_asio.reference.async_result.get [*get]]]
619     [Obtain the value to be returned from the initiating function. ]
620   ]
621   
622   [
623     [[link boost_asio.reference.async_result.initiate [*initiate]]]
624     [Initiate the asynchronous operation that will produce the result, and obtain the value to be returned from the initiating function. ]
625   ]
626   
627 ]
628
629 The [link boost_asio.reference.async_result `async_result`] traits class is used for determining:
630
631
632 * the concrete completion handler type to be called at the end of the asynchronous operation;
633
634
635 * the initiating function return type; and
636
637
638 * how the return value of the initiating function is obtained.
639
640 The trait allows the handler and return types to be determined at the point where the specific completion handler signature is known.
641
642 This template may be specialised for user-defined completion token types. The primary template assumes that the CompletionToken is the completion handler. 
643
644
645 [heading Requirements]
646
647 ['Header: ][^boost/asio/async_result.hpp]
648
649 ['Convenience header: ][^boost/asio.hpp]
650
651
652 [endsect]
653
654
655
656 [section:result async_completion::result]
657
658 [indexterm2 boost_asio.indexterm.async_completion.result..result..async_completion] 
659 The result of the asynchronous operation's initiating function. 
660
661
662   async_result< typename decay< CompletionToken >::type, Signature > result;
663
664
665
666 [endsect]
667
668
669
670 [endsect]
671
672
673 [section:async_compose async_compose]
674
675 [indexterm1 boost_asio.indexterm.async_compose..async_compose] 
676 Launch an asynchronous operation with a stateful implementation. 
677
678
679   template<
680       typename CompletionToken,
681       typename Signature,
682       typename Implementation,
683       typename... IoObjectsOrExecutors>
684   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_compose(
685       Implementation && implementation,
686       CompletionToken & token,
687       IoObjectsOrExecutors &&... io_objects_or_executors);
688
689
690 The async\_compose function simplifies the implementation of composed asynchronous operations automatically wrapping a stateful function object with a conforming intermediate completion handler.
691
692
693 [heading Parameters]
694     
695
696 [variablelist
697   
698 [[implementation][A function object that contains the implementation of the composed asynchronous operation. The first argument to the function object is a non-const reference to the enclosing intermediate completion handler. The remaining arguments are any arguments that originate from the completion handlers of any asynchronous operations performed by the implementation.]]
699
700 [[token][The completion token.]]
701
702 [[io_objects_or_executors][Zero or more I/O objects or I/O executors for which outstanding work must be maintained.]]
703
704 ]
705
706
707 [heading Example:]
708   
709
710
711
712
713    struct async_echo_implementation
714    {
715      tcp::socket& socket_;
716      boost::asio::mutable_buffer buffer_;
717      enum { starting, reading, writing } state_;
718
719      template <typename Self>
720      void operator()(Self& self,
721          boost::system::error_code error = {},
722          std::size_t n = 0)
723      {
724        switch (state_)
725        {
726        case starting:
727          state_ = reading;
728          socket_.async_read_some(
729              buffer_, std::move(self));
730          break;
731        case reading:
732          if (error)
733          {
734            self.complete(error, 0);
735          }
736          else
737          {
738            state_ = writing;
739            boost::asio::async_write(socket_, buffer_,
740                boost::asio::transfer_exactly(n),
741                std::move(self));
742          }
743          break;
744        case writing:
745          self.complete(error, n);
746          break;
747        }
748      }
749    };
750
751    template <typename CompletionToken>
752    auto async_echo(tcp::socket& socket,
753        boost::asio::mutable_buffer buffer,
754        CompletionToken&& token) ->
755      typename boost::asio::async_result<
756        typename std::decay<CompletionToken>::type,
757          void(boost::system::error_code, std::size_t)>::return_type
758    {
759      return boost::asio::async_compose<CompletionToken,
760        void(boost::system::error_code, std::size_t)>(
761          async_echo_implementation{socket, buffer,
762            async_echo_implementation::starting},
763          token, socket);
764    } 
765
766
767
768
769 [heading Requirements]
770
771 ['Header: ][^boost/asio/compose.hpp]
772
773 ['Convenience header: ][^boost/asio.hpp]
774
775
776 [endsect]
777
778
779 [section:async_connect async_connect]
780
781 [indexterm1 boost_asio.indexterm.async_connect..async_connect] 
782 The `async_connect` function is a composed asynchronous operation that establishes a socket connection by trying each endpoint in a sequence. 
783
784
785 Asynchronously establishes a socket connection by trying each endpoint in a sequence. 
786
787   template<
788       typename ``[link boost_asio.reference.Protocol Protocol]``,
789       typename ``[link boost_asio.reference.Executor1 Executor]``,
790       typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``,
791       typename ``[link boost_asio.reference.RangeConnectHandler RangeConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
792   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_connect.overload1 async_connect]``(
793       basic_socket< Protocol, Executor > & s,
794       const EndpointSequence & endpoints,
795       RangeConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
796       typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type *  = 0);
797   ``  [''''&raquo;''' [link boost_asio.reference.async_connect.overload1 more...]]``
798
799 (Deprecated: Use range overload.) Asynchronously establishes a socket connection by trying each endpoint in a sequence. 
800
801   template<
802       typename ``[link boost_asio.reference.Protocol Protocol]``,
803       typename ``[link boost_asio.reference.Executor1 Executor]``,
804       typename Iterator,
805       typename ``[link boost_asio.reference.IteratorConnectHandler IteratorConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
806   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_connect.overload2 async_connect]``(
807       basic_socket< Protocol, Executor > & s,
808       Iterator begin,
809       IteratorConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
810       typename enable_if<!is_endpoint_sequence< Iterator >::value >::type *  = 0);
811   ``  [''''&raquo;''' [link boost_asio.reference.async_connect.overload2 more...]]``
812
813 Asynchronously establishes a socket connection by trying each endpoint in a sequence. 
814
815   template<
816       typename ``[link boost_asio.reference.Protocol Protocol]``,
817       typename ``[link boost_asio.reference.Executor1 Executor]``,
818       typename Iterator,
819       typename ``[link boost_asio.reference.IteratorConnectHandler IteratorConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
820   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_connect.overload3 async_connect]``(
821       basic_socket< Protocol, Executor > & s,
822       Iterator begin,
823       Iterator end,
824       IteratorConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
825   ``  [''''&raquo;''' [link boost_asio.reference.async_connect.overload3 more...]]``
826
827   template<
828       typename ``[link boost_asio.reference.Protocol Protocol]``,
829       typename ``[link boost_asio.reference.Executor1 Executor]``,
830       typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``,
831       typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``,
832       typename ``[link boost_asio.reference.RangeConnectHandler RangeConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
833   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_connect.overload4 async_connect]``(
834       basic_socket< Protocol, Executor > & s,
835       const EndpointSequence & endpoints,
836       ConnectCondition connect_condition,
837       RangeConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
838       typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type *  = 0);
839   ``  [''''&raquo;''' [link boost_asio.reference.async_connect.overload4 more...]]``
840
841 (Deprecated: Use range overload.) Asynchronously establishes a socket connection by trying each endpoint in a sequence. 
842
843   template<
844       typename ``[link boost_asio.reference.Protocol Protocol]``,
845       typename ``[link boost_asio.reference.Executor1 Executor]``,
846       typename Iterator,
847       typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``,
848       typename ``[link boost_asio.reference.IteratorConnectHandler IteratorConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
849   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_connect.overload5 async_connect]``(
850       basic_socket< Protocol, Executor > & s,
851       Iterator begin,
852       ConnectCondition connect_condition,
853       IteratorConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
854       typename enable_if<!is_endpoint_sequence< Iterator >::value >::type *  = 0);
855   ``  [''''&raquo;''' [link boost_asio.reference.async_connect.overload5 more...]]``
856
857 Asynchronously establishes a socket connection by trying each endpoint in a sequence. 
858
859   template<
860       typename ``[link boost_asio.reference.Protocol Protocol]``,
861       typename ``[link boost_asio.reference.Executor1 Executor]``,
862       typename Iterator,
863       typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``,
864       typename ``[link boost_asio.reference.IteratorConnectHandler IteratorConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
865   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_connect.overload6 async_connect]``(
866       basic_socket< Protocol, Executor > & s,
867       Iterator begin,
868       Iterator end,
869       ConnectCondition connect_condition,
870       IteratorConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
871   ``  [''''&raquo;''' [link boost_asio.reference.async_connect.overload6 more...]]``
872
873 [heading Requirements]
874
875 ['Header: ][^boost/asio/connect.hpp]
876
877 ['Convenience header: ][^boost/asio.hpp]
878
879
880 [section:overload1 async_connect (1 of 6 overloads)]
881
882
883 Asynchronously establishes a socket connection by trying each endpoint in a sequence. 
884
885
886   template<
887       typename ``[link boost_asio.reference.Protocol Protocol]``,
888       typename ``[link boost_asio.reference.Executor1 Executor]``,
889       typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``,
890       typename ``[link boost_asio.reference.RangeConnectHandler RangeConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
891   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect(
892       basic_socket< Protocol, Executor > & s,
893       const EndpointSequence & endpoints,
894       RangeConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
895       typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type *  = 0);
896
897
898 This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `async_connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
899
900
901 [heading Parameters]
902     
903
904 [variablelist
905   
906 [[s][The socket to be connected. If the socket is already open, it will be closed.]]
907
908 [[endpoints][A sequence of endpoints.]]
909
910 [[handler][The handler to be called when the connect operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
911 ``
912    void handler(
913      // Result of operation. if the sequence is empty, set to
914      // boost::asio::error::not_found. Otherwise, contains the
915      // error from the last connection attempt.
916      const boost::system::error_code& error,
917
918      // On success, the successfully connected endpoint.
919      // Otherwise, a default-constructed endpoint.
920      const typename Protocol::endpoint& endpoint
921    ); 
922 ``
923 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
924
925 ]
926
927
928 [heading Example]
929   
930
931
932    tcp::resolver r(my_context);
933    tcp::resolver::query q("host", "service");
934    tcp::socket s(my_context);
935
936    // ...
937
938    r.async_resolve(q, resolve_handler);
939
940    // ...
941
942    void resolve_handler(
943        const boost::system::error_code& ec,
944        tcp::resolver::results_type results)
945    {
946      if (!ec)
947      {
948        boost::asio::async_connect(s, results, connect_handler);
949      }
950    }
951
952    // ...
953
954    void connect_handler(
955        const boost::system::error_code& ec,
956        const tcp::endpoint& endpoint)
957    {
958      // ...
959    } 
960
961
962
963
964
965
966
967 [endsect]
968
969
970
971 [section:overload2 async_connect (2 of 6 overloads)]
972
973
974 (Deprecated: Use range overload.) Asynchronously establishes a socket connection by trying each endpoint in a sequence. 
975
976
977   template<
978       typename ``[link boost_asio.reference.Protocol Protocol]``,
979       typename ``[link boost_asio.reference.Executor1 Executor]``,
980       typename Iterator,
981       typename ``[link boost_asio.reference.IteratorConnectHandler IteratorConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
982   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect(
983       basic_socket< Protocol, Executor > & s,
984       Iterator begin,
985       IteratorConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
986       typename enable_if<!is_endpoint_sequence< Iterator >::value >::type *  = 0);
987
988
989 This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `async_connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
990
991
992 [heading Parameters]
993     
994
995 [variablelist
996   
997 [[s][The socket to be connected. If the socket is already open, it will be closed.]]
998
999 [[begin][An iterator pointing to the start of a sequence of endpoints.]]
1000
1001 [[handler][The handler to be called when the connect operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
1002 ``
1003    void handler(
1004      // Result of operation. if the sequence is empty, set to
1005      // boost::asio::error::not_found. Otherwise, contains the
1006      // error from the last connection attempt.
1007      const boost::system::error_code& error,
1008
1009      // On success, an iterator denoting the successfully
1010      // connected endpoint. Otherwise, the end iterator.
1011      Iterator iterator
1012    ); 
1013 ``
1014 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
1015
1016 ]
1017
1018
1019 [heading Remarks]
1020       
1021 This overload assumes that a default constructed object of type `Iterator` represents the end of the sequence. This is a valid assumption for iterator types such as `boost::asio::ip::tcp::resolver::iterator`. 
1022
1023
1024
1025
1026 [endsect]
1027
1028
1029
1030 [section:overload3 async_connect (3 of 6 overloads)]
1031
1032
1033 Asynchronously establishes a socket connection by trying each endpoint in a sequence. 
1034
1035
1036   template<
1037       typename ``[link boost_asio.reference.Protocol Protocol]``,
1038       typename ``[link boost_asio.reference.Executor1 Executor]``,
1039       typename Iterator,
1040       typename ``[link boost_asio.reference.IteratorConnectHandler IteratorConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
1041   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect(
1042       basic_socket< Protocol, Executor > & s,
1043       Iterator begin,
1044       Iterator end,
1045       IteratorConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
1046
1047
1048 This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `async_connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
1049
1050
1051 [heading Parameters]
1052     
1053
1054 [variablelist
1055   
1056 [[s][The socket to be connected. If the socket is already open, it will be closed.]]
1057
1058 [[begin][An iterator pointing to the start of a sequence of endpoints.]]
1059
1060 [[end][An iterator pointing to the end of a sequence of endpoints.]]
1061
1062 [[handler][The handler to be called when the connect operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
1063 ``
1064    void handler(
1065      // Result of operation. if the sequence is empty, set to
1066      // boost::asio::error::not_found. Otherwise, contains the
1067      // error from the last connection attempt.
1068      const boost::system::error_code& error,
1069
1070      // On success, an iterator denoting the successfully
1071      // connected endpoint. Otherwise, the end iterator.
1072      Iterator iterator
1073    ); 
1074 ``
1075 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
1076
1077 ]
1078
1079
1080 [heading Example]
1081   
1082
1083
1084    std::vector<tcp::endpoint> endpoints = ...;
1085    tcp::socket s(my_context);
1086    boost::asio::async_connect(s,
1087        endpoints.begin(), endpoints.end(),
1088        connect_handler);
1089
1090    // ...
1091
1092    void connect_handler(
1093        const boost::system::error_code& ec,
1094        std::vector<tcp::endpoint>::iterator i)
1095    {
1096      // ...
1097    } 
1098
1099
1100
1101
1102
1103
1104
1105 [endsect]
1106
1107
1108
1109 [section:overload4 async_connect (4 of 6 overloads)]
1110
1111
1112 Asynchronously establishes a socket connection by trying each endpoint in a sequence. 
1113
1114
1115   template<
1116       typename ``[link boost_asio.reference.Protocol Protocol]``,
1117       typename ``[link boost_asio.reference.Executor1 Executor]``,
1118       typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``,
1119       typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``,
1120       typename ``[link boost_asio.reference.RangeConnectHandler RangeConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
1121   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect(
1122       basic_socket< Protocol, Executor > & s,
1123       const EndpointSequence & endpoints,
1124       ConnectCondition connect_condition,
1125       RangeConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
1126       typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type *  = 0);
1127
1128
1129 This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `async_connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
1130
1131
1132 [heading Parameters]
1133     
1134
1135 [variablelist
1136   
1137 [[s][The socket to be connected. If the socket is already open, it will be closed.]]
1138
1139 [[endpoints][A sequence of endpoints.]]
1140
1141 [[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be: 
1142 ``
1143    bool connect_condition(
1144        const boost::system::error_code& ec,
1145        const typename Protocol::endpoint& next); 
1146 ``
1147 The `ec` parameter contains the result from the most recent connect operation. Before the first connection attempt, `ec` is always set to indicate success. The `next` parameter is the next endpoint to be tried. The function object should return true if the next endpoint should be tried, and false if it should be skipped.]]
1148
1149 [[handler][The handler to be called when the connect operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
1150 ``
1151    void handler(
1152      // Result of operation. if the sequence is empty, set to
1153      // boost::asio::error::not_found. Otherwise, contains the
1154      // error from the last connection attempt.
1155      const boost::system::error_code& error,
1156
1157      // On success, an iterator denoting the successfully
1158      // connected endpoint. Otherwise, the end iterator.
1159      Iterator iterator
1160    ); 
1161 ``
1162 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
1163
1164 ]
1165
1166
1167 [heading Example]
1168   
1169 The following connect condition function object can be used to output information about the individual connection attempts: 
1170
1171    struct my_connect_condition
1172    {
1173      bool operator()(
1174          const boost::system::error_code& ec,
1175          const::tcp::endpoint& next)
1176      {
1177        if (ec) std::cout << "Error: " << ec.message() << std::endl;
1178        std::cout << "Trying: " << next << std::endl;
1179        return true;
1180      }
1181    }; 
1182
1183
1184 It would be used with the `boost::asio::connect` function as follows: 
1185
1186    tcp::resolver r(my_context);
1187    tcp::resolver::query q("host", "service");
1188    tcp::socket s(my_context);
1189
1190    // ...
1191
1192    r.async_resolve(q, resolve_handler);
1193
1194    // ...
1195
1196    void resolve_handler(
1197        const boost::system::error_code& ec,
1198        tcp::resolver::results_type results)
1199    {
1200      if (!ec)
1201      {
1202        boost::asio::async_connect(s, results,
1203            my_connect_condition(),
1204            connect_handler);
1205      }
1206    }
1207
1208    // ...
1209
1210    void connect_handler(
1211        const boost::system::error_code& ec,
1212        const tcp::endpoint& endpoint)
1213    {
1214      if (ec)
1215      {
1216        // An error occurred.
1217      }
1218      else
1219      {
1220        std::cout << "Connected to: " << endpoint << std::endl;
1221      }
1222    } 
1223
1224
1225
1226
1227
1228
1229
1230 [endsect]
1231
1232
1233
1234 [section:overload5 async_connect (5 of 6 overloads)]
1235
1236
1237 (Deprecated: Use range overload.) Asynchronously establishes a socket connection by trying each endpoint in a sequence. 
1238
1239
1240   template<
1241       typename ``[link boost_asio.reference.Protocol Protocol]``,
1242       typename ``[link boost_asio.reference.Executor1 Executor]``,
1243       typename Iterator,
1244       typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``,
1245       typename ``[link boost_asio.reference.IteratorConnectHandler IteratorConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
1246   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect(
1247       basic_socket< Protocol, Executor > & s,
1248       Iterator begin,
1249       ConnectCondition connect_condition,
1250       IteratorConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
1251       typename enable_if<!is_endpoint_sequence< Iterator >::value >::type *  = 0);
1252
1253
1254 This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `async_connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
1255
1256
1257 [heading Parameters]
1258     
1259
1260 [variablelist
1261   
1262 [[s][The socket to be connected. If the socket is already open, it will be closed.]]
1263
1264 [[begin][An iterator pointing to the start of a sequence of endpoints.]]
1265
1266 [[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be: 
1267 ``
1268    bool connect_condition(
1269        const boost::system::error_code& ec,
1270        const typename Protocol::endpoint& next); 
1271 ``
1272 The `ec` parameter contains the result from the most recent connect operation. Before the first connection attempt, `ec` is always set to indicate success. The `next` parameter is the next endpoint to be tried. The function object should return true if the next endpoint should be tried, and false if it should be skipped.]]
1273
1274 [[handler][The handler to be called when the connect operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
1275 ``
1276    void handler(
1277      // Result of operation. if the sequence is empty, set to
1278      // boost::asio::error::not_found. Otherwise, contains the
1279      // error from the last connection attempt.
1280      const boost::system::error_code& error,
1281
1282      // On success, an iterator denoting the successfully
1283      // connected endpoint. Otherwise, the end iterator.
1284      Iterator iterator
1285    ); 
1286 ``
1287 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
1288
1289 ]
1290
1291
1292 [heading Remarks]
1293       
1294 This overload assumes that a default constructed object of type `Iterator` represents the end of the sequence. This is a valid assumption for iterator types such as `boost::asio::ip::tcp::resolver::iterator`. 
1295
1296
1297
1298
1299 [endsect]
1300
1301
1302
1303 [section:overload6 async_connect (6 of 6 overloads)]
1304
1305
1306 Asynchronously establishes a socket connection by trying each endpoint in a sequence. 
1307
1308
1309   template<
1310       typename ``[link boost_asio.reference.Protocol Protocol]``,
1311       typename ``[link boost_asio.reference.Executor1 Executor]``,
1312       typename Iterator,
1313       typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``,
1314       typename ``[link boost_asio.reference.IteratorConnectHandler IteratorConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
1315   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect(
1316       basic_socket< Protocol, Executor > & s,
1317       Iterator begin,
1318       Iterator end,
1319       ConnectCondition connect_condition,
1320       IteratorConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
1321
1322
1323 This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `async_connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
1324
1325
1326 [heading Parameters]
1327     
1328
1329 [variablelist
1330   
1331 [[s][The socket to be connected. If the socket is already open, it will be closed.]]
1332
1333 [[begin][An iterator pointing to the start of a sequence of endpoints.]]
1334
1335 [[end][An iterator pointing to the end of a sequence of endpoints.]]
1336
1337 [[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be: 
1338 ``
1339    bool connect_condition(
1340        const boost::system::error_code& ec,
1341        const typename Protocol::endpoint& next); 
1342 ``
1343 The `ec` parameter contains the result from the most recent connect operation. Before the first connection attempt, `ec` is always set to indicate success. The `next` parameter is the next endpoint to be tried. The function object should return true if the next endpoint should be tried, and false if it should be skipped.]]
1344
1345 [[handler][The handler to be called when the connect operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
1346 ``
1347    void handler(
1348      // Result of operation. if the sequence is empty, set to
1349      // boost::asio::error::not_found. Otherwise, contains the
1350      // error from the last connection attempt.
1351      const boost::system::error_code& error,
1352
1353      // On success, an iterator denoting the successfully
1354      // connected endpoint. Otherwise, the end iterator.
1355      Iterator iterator
1356    ); 
1357 ``
1358 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
1359
1360 ]
1361
1362
1363 [heading Example]
1364   
1365 The following connect condition function object can be used to output information about the individual connection attempts: 
1366
1367    struct my_connect_condition
1368    {
1369      bool operator()(
1370          const boost::system::error_code& ec,
1371          const::tcp::endpoint& next)
1372      {
1373        if (ec) std::cout << "Error: " << ec.message() << std::endl;
1374        std::cout << "Trying: " << next << std::endl;
1375        return true;
1376      }
1377    }; 
1378
1379
1380 It would be used with the `boost::asio::connect` function as follows: 
1381
1382    tcp::resolver r(my_context);
1383    tcp::resolver::query q("host", "service");
1384    tcp::socket s(my_context);
1385
1386    // ...
1387
1388    r.async_resolve(q, resolve_handler);
1389
1390    // ...
1391
1392    void resolve_handler(
1393        const boost::system::error_code& ec,
1394        tcp::resolver::iterator i)
1395    {
1396      if (!ec)
1397      {
1398        tcp::resolver::iterator end;
1399        boost::asio::async_connect(s, i, end,
1400            my_connect_condition(),
1401            connect_handler);
1402      }
1403    }
1404
1405    // ...
1406
1407    void connect_handler(
1408        const boost::system::error_code& ec,
1409        tcp::resolver::iterator i)
1410    {
1411      if (ec)
1412      {
1413        // An error occurred.
1414      }
1415      else
1416      {
1417        std::cout << "Connected to: " << i->endpoint() << std::endl;
1418      }
1419    } 
1420
1421
1422
1423
1424
1425
1426
1427 [endsect]
1428
1429
1430 [endsect]
1431
1432
1433 [section:async_initiate async_initiate]
1434
1435 [indexterm1 boost_asio.indexterm.async_initiate..async_initiate] 
1436
1437   template<
1438       typename CompletionToken,
1439       completion_signature Signature,
1440       typename Initiation,
1441       typename... Args>
1442   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_initiate(
1443       Initiation && initiation,
1444       CompletionToken & ,
1445       Args &&... args);
1446
1447
1448 [heading Requirements]
1449
1450 ['Header: ][^boost/asio/async_result.hpp]
1451
1452 ['Convenience header: ][^boost/asio.hpp]
1453
1454
1455 [endsect]
1456
1457
1458 [section:async_read async_read]
1459
1460 [indexterm1 boost_asio.indexterm.async_read..async_read] 
1461 The `async_read` function is a composed asynchronous operation that reads a certain amount of data from a stream before completion. 
1462
1463
1464 Start an asynchronous operation to read a certain amount of data from a stream. 
1465
1466   template<
1467       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
1468       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
1469       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
1470   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read.overload1 async_read]``(
1471       AsyncReadStream & s,
1472       const MutableBufferSequence & buffers,
1473       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
1474       typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type *  = 0);
1475   ``  [''''&raquo;''' [link boost_asio.reference.async_read.overload1 more...]]``
1476
1477   template<
1478       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
1479       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
1480       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
1481       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
1482   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read.overload2 async_read]``(
1483       AsyncReadStream & s,
1484       const MutableBufferSequence & buffers,
1485       CompletionCondition completion_condition,
1486       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
1487       typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type *  = 0);
1488   ``  [''''&raquo;''' [link boost_asio.reference.async_read.overload2 more...]]``
1489
1490   template<
1491       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
1492       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
1493       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
1494   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read.overload3 async_read]``(
1495       AsyncReadStream & s,
1496       DynamicBuffer_v1 && buffers,
1497       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
1498       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
1499   ``  [''''&raquo;''' [link boost_asio.reference.async_read.overload3 more...]]``
1500
1501   template<
1502       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
1503       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
1504       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
1505       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
1506   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read.overload4 async_read]``(
1507       AsyncReadStream & s,
1508       DynamicBuffer_v1 && buffers,
1509       CompletionCondition completion_condition,
1510       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
1511       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
1512   ``  [''''&raquo;''' [link boost_asio.reference.async_read.overload4 more...]]``
1513
1514   template<
1515       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
1516       typename Allocator,
1517       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
1518   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read.overload5 async_read]``(
1519       AsyncReadStream & s,
1520       basic_streambuf< Allocator > & b,
1521       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
1522   ``  [''''&raquo;''' [link boost_asio.reference.async_read.overload5 more...]]``
1523
1524   template<
1525       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
1526       typename Allocator,
1527       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
1528       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
1529   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read.overload6 async_read]``(
1530       AsyncReadStream & s,
1531       basic_streambuf< Allocator > & b,
1532       CompletionCondition completion_condition,
1533       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
1534   ``  [''''&raquo;''' [link boost_asio.reference.async_read.overload6 more...]]``
1535
1536   template<
1537       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
1538       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
1539       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
1540   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read.overload7 async_read]``(
1541       AsyncReadStream & s,
1542       DynamicBuffer_v2 buffers,
1543       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
1544       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
1545   ``  [''''&raquo;''' [link boost_asio.reference.async_read.overload7 more...]]``
1546
1547   template<
1548       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
1549       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
1550       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
1551       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
1552   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read.overload8 async_read]``(
1553       AsyncReadStream & s,
1554       DynamicBuffer_v2 buffers,
1555       CompletionCondition completion_condition,
1556       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
1557       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
1558   ``  [''''&raquo;''' [link boost_asio.reference.async_read.overload8 more...]]``
1559
1560 [heading Requirements]
1561
1562 ['Header: ][^boost/asio/read.hpp]
1563
1564 ['Convenience header: ][^boost/asio.hpp]
1565
1566
1567 [section:overload1 async_read (1 of 8 overloads)]
1568
1569
1570 Start an asynchronous operation to read a certain amount of data from a stream. 
1571
1572
1573   template<
1574       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
1575       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
1576       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
1577   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read(
1578       AsyncReadStream & s,
1579       const MutableBufferSequence & buffers,
1580       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
1581       typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type *  = 0);
1582
1583
1584 This function is used to asynchronously read a certain number of bytes of data from a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
1585
1586
1587 * The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
1588
1589
1590 * An error occurred.
1591
1592 This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other read operations (such as async\_read, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
1593
1594
1595 [heading Parameters]
1596     
1597
1598 [variablelist
1599   
1600 [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
1601
1602 [[buffers][One or more buffers into which the data will be read. The sum of the buffer sizes indicates the maximum number of bytes to read from the stream. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
1603
1604 [[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
1605 ``
1606    void handler(
1607      const boost::system::error_code& error, // Result of operation.
1608
1609      std::size_t bytes_transferred           // Number of bytes copied into the
1610                                              // buffers. If an error occurred,
1611                                              // this will be the  number of
1612                                              // bytes successfully transferred
1613                                              // prior to the error.
1614    ); 
1615 ``
1616 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
1617
1618 ]
1619
1620
1621 [heading Example]
1622   
1623 To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
1624
1625    boost::asio::async_read(s, boost::asio::buffer(data, size), handler);
1626
1627
1628 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
1629
1630
1631 [heading Remarks]
1632       
1633 This overload is equivalent to calling: 
1634
1635    boost::asio::async_read(
1636        s, buffers,
1637        boost::asio::transfer_all(),
1638        handler); 
1639
1640
1641
1642
1643
1644
1645
1646 [endsect]
1647
1648
1649
1650 [section:overload2 async_read (2 of 8 overloads)]
1651
1652
1653 Start an asynchronous operation to read a certain amount of data from a stream. 
1654
1655
1656   template<
1657       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
1658       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
1659       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
1660       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
1661   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read(
1662       AsyncReadStream & s,
1663       const MutableBufferSequence & buffers,
1664       CompletionCondition completion_condition,
1665       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
1666       typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type *  = 0);
1667
1668
1669 This function is used to asynchronously read a certain number of bytes of data from a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
1670
1671
1672 * The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
1673
1674
1675 * The completion\_condition function object returns 0.
1676
1677
1678 [heading Parameters]
1679     
1680
1681 [variablelist
1682   
1683 [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
1684
1685 [[buffers][One or more buffers into which the data will be read. The sum of the buffer sizes indicates the maximum number of bytes to read from the stream. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
1686
1687 [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 
1688 ``
1689    std::size_t completion_condition(
1690      // Result of latest async_read_some operation.
1691      const boost::system::error_code& error,
1692
1693      // Number of bytes transferred so far.
1694      std::size_t bytes_transferred
1695    ); 
1696 ``
1697 A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's async\_read\_some function.]]
1698
1699 [[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
1700 ``
1701    void handler(
1702      const boost::system::error_code& error, // Result of operation.
1703
1704      std::size_t bytes_transferred           // Number of bytes copied into the
1705                                              // buffers. If an error occurred,
1706                                              // this will be the  number of
1707                                              // bytes successfully transferred
1708                                              // prior to the error.
1709    ); 
1710 ``
1711 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
1712
1713 ]
1714
1715
1716 [heading Example]
1717   
1718 To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
1719
1720    boost::asio::async_read(s,
1721        boost::asio::buffer(data, size),
1722        boost::asio::transfer_at_least(32),
1723        handler); 
1724
1725
1726 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
1727
1728
1729
1730
1731 [endsect]
1732
1733
1734
1735 [section:overload3 async_read (3 of 8 overloads)]
1736
1737
1738 Start an asynchronous operation to read a certain amount of data from a stream. 
1739
1740
1741   template<
1742       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
1743       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
1744       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
1745   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read(
1746       AsyncReadStream & s,
1747       DynamicBuffer_v1 && buffers,
1748       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
1749       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
1750
1751
1752 This function is used to asynchronously read a certain number of bytes of data from a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
1753
1754
1755 * The specified dynamic buffer sequence is full (that is, it has reached maximum size).
1756
1757
1758 * An error occurred.
1759
1760 This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other read operations (such as async\_read, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
1761
1762
1763 [heading Parameters]
1764     
1765
1766 [variablelist
1767   
1768 [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
1769
1770 [[buffers][The dynamic buffer sequence into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
1771
1772 [[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
1773 ``
1774    void handler(
1775      const boost::system::error_code& error, // Result of operation.
1776
1777      std::size_t bytes_transferred           // Number of bytes copied into the
1778                                              // buffers. If an error occurred,
1779                                              // this will be the  number of
1780                                              // bytes successfully transferred
1781                                              // prior to the error.
1782    ); 
1783 ``
1784 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
1785
1786 ]
1787
1788
1789 [heading Remarks]
1790       
1791 This overload is equivalent to calling: 
1792
1793    boost::asio::async_read(
1794        s, buffers,
1795        boost::asio::transfer_all(),
1796        handler); 
1797
1798
1799
1800
1801
1802
1803
1804 [endsect]
1805
1806
1807
1808 [section:overload4 async_read (4 of 8 overloads)]
1809
1810
1811 Start an asynchronous operation to read a certain amount of data from a stream. 
1812
1813
1814   template<
1815       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
1816       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
1817       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
1818       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
1819   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read(
1820       AsyncReadStream & s,
1821       DynamicBuffer_v1 && buffers,
1822       CompletionCondition completion_condition,
1823       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
1824       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
1825
1826
1827 This function is used to asynchronously read a certain number of bytes of data from a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
1828
1829
1830 * The specified dynamic buffer sequence is full (that is, it has reached maximum size).
1831
1832
1833 * The completion\_condition function object returns 0.
1834
1835 This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other read operations (such as async\_read, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
1836
1837
1838 [heading Parameters]
1839     
1840
1841 [variablelist
1842   
1843 [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
1844
1845 [[buffers][The dynamic buffer sequence into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
1846
1847 [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 
1848 ``
1849    std::size_t completion_condition(
1850      // Result of latest async_read_some operation.
1851      const boost::system::error_code& error,
1852
1853      // Number of bytes transferred so far.
1854      std::size_t bytes_transferred
1855    ); 
1856 ``
1857 A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's async\_read\_some function.]]
1858
1859 [[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
1860 ``
1861    void handler(
1862      const boost::system::error_code& error, // Result of operation.
1863
1864      std::size_t bytes_transferred           // Number of bytes copied into the
1865                                              // buffers. If an error occurred,
1866                                              // this will be the  number of
1867                                              // bytes successfully transferred
1868                                              // prior to the error.
1869    ); 
1870 ``
1871 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
1872
1873 ]
1874
1875
1876
1877
1878 [endsect]
1879
1880
1881
1882 [section:overload5 async_read (5 of 8 overloads)]
1883
1884
1885 Start an asynchronous operation to read a certain amount of data from a stream. 
1886
1887
1888   template<
1889       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
1890       typename Allocator,
1891       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
1892   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read(
1893       AsyncReadStream & s,
1894       basic_streambuf< Allocator > & b,
1895       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
1896
1897
1898 This function is used to asynchronously read a certain number of bytes of data from a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
1899
1900
1901 * The supplied buffer is full (that is, it has reached maximum size).
1902
1903
1904 * An error occurred.
1905
1906 This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other read operations (such as async\_read, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
1907
1908
1909 [heading Parameters]
1910     
1911
1912 [variablelist
1913   
1914 [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
1915
1916 [[b][A [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read. Ownership of the streambuf is retained by the caller, which must guarantee that it remains valid until the handler is called.]]
1917
1918 [[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
1919 ``
1920    void handler(
1921      const boost::system::error_code& error, // Result of operation.
1922
1923      std::size_t bytes_transferred           // Number of bytes copied into the
1924                                              // buffers. If an error occurred,
1925                                              // this will be the  number of
1926                                              // bytes successfully transferred
1927                                              // prior to the error.
1928    ); 
1929 ``
1930 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
1931
1932 ]
1933
1934
1935 [heading Remarks]
1936       
1937 This overload is equivalent to calling: 
1938
1939    boost::asio::async_read(
1940        s, b,
1941        boost::asio::transfer_all(),
1942        handler); 
1943
1944
1945
1946
1947
1948
1949
1950 [endsect]
1951
1952
1953
1954 [section:overload6 async_read (6 of 8 overloads)]
1955
1956
1957 Start an asynchronous operation to read a certain amount of data from a stream. 
1958
1959
1960   template<
1961       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
1962       typename Allocator,
1963       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
1964       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
1965   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read(
1966       AsyncReadStream & s,
1967       basic_streambuf< Allocator > & b,
1968       CompletionCondition completion_condition,
1969       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
1970
1971
1972 This function is used to asynchronously read a certain number of bytes of data from a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
1973
1974
1975 * The supplied buffer is full (that is, it has reached maximum size).
1976
1977
1978 * The completion\_condition function object returns 0.
1979
1980 This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other read operations (such as async\_read, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
1981
1982
1983 [heading Parameters]
1984     
1985
1986 [variablelist
1987   
1988 [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
1989
1990 [[b][A [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read. Ownership of the streambuf is retained by the caller, which must guarantee that it remains valid until the handler is called.]]
1991
1992 [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 
1993 ``
1994    std::size_t completion_condition(
1995      // Result of latest async_read_some operation.
1996      const boost::system::error_code& error,
1997
1998      // Number of bytes transferred so far.
1999      std::size_t bytes_transferred
2000    ); 
2001 ``
2002 A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's async\_read\_some function.]]
2003
2004 [[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
2005 ``
2006    void handler(
2007      const boost::system::error_code& error, // Result of operation.
2008
2009      std::size_t bytes_transferred           // Number of bytes copied into the
2010                                              // buffers. If an error occurred,
2011                                              // this will be the  number of
2012                                              // bytes successfully transferred
2013                                              // prior to the error.
2014    ); 
2015 ``
2016 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
2017
2018 ]
2019
2020
2021
2022
2023 [endsect]
2024
2025
2026
2027 [section:overload7 async_read (7 of 8 overloads)]
2028
2029
2030 Start an asynchronous operation to read a certain amount of data from a stream. 
2031
2032
2033   template<
2034       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
2035       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
2036       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
2037   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read(
2038       AsyncReadStream & s,
2039       DynamicBuffer_v2 buffers,
2040       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
2041       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
2042
2043
2044 This function is used to asynchronously read a certain number of bytes of data from a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
2045
2046
2047 * The specified dynamic buffer sequence is full (that is, it has reached maximum size).
2048
2049
2050 * An error occurred.
2051
2052 This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other read operations (such as async\_read, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
2053
2054
2055 [heading Parameters]
2056     
2057
2058 [variablelist
2059   
2060 [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
2061
2062 [[buffers][The dynamic buffer sequence into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
2063
2064 [[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
2065 ``
2066    void handler(
2067      const boost::system::error_code& error, // Result of operation.
2068
2069      std::size_t bytes_transferred           // Number of bytes copied into the
2070                                              // buffers. If an error occurred,
2071                                              // this will be the  number of
2072                                              // bytes successfully transferred
2073                                              // prior to the error.
2074    ); 
2075 ``
2076 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
2077
2078 ]
2079
2080
2081 [heading Remarks]
2082       
2083 This overload is equivalent to calling: 
2084
2085    boost::asio::async_read(
2086        s, buffers,
2087        boost::asio::transfer_all(),
2088        handler); 
2089
2090
2091
2092
2093
2094
2095
2096 [endsect]
2097
2098
2099
2100 [section:overload8 async_read (8 of 8 overloads)]
2101
2102
2103 Start an asynchronous operation to read a certain amount of data from a stream. 
2104
2105
2106   template<
2107       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
2108       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
2109       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
2110       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
2111   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read(
2112       AsyncReadStream & s,
2113       DynamicBuffer_v2 buffers,
2114       CompletionCondition completion_condition,
2115       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
2116       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
2117
2118
2119 This function is used to asynchronously read a certain number of bytes of data from a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
2120
2121
2122 * The specified dynamic buffer sequence is full (that is, it has reached maximum size).
2123
2124
2125 * The completion\_condition function object returns 0.
2126
2127 This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other read operations (such as async\_read, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
2128
2129
2130 [heading Parameters]
2131     
2132
2133 [variablelist
2134   
2135 [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
2136
2137 [[buffers][The dynamic buffer sequence into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
2138
2139 [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 
2140 ``
2141    std::size_t completion_condition(
2142      // Result of latest async_read_some operation.
2143      const boost::system::error_code& error,
2144
2145      // Number of bytes transferred so far.
2146      std::size_t bytes_transferred
2147    ); 
2148 ``
2149 A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's async\_read\_some function.]]
2150
2151 [[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
2152 ``
2153    void handler(
2154      const boost::system::error_code& error, // Result of operation.
2155
2156      std::size_t bytes_transferred           // Number of bytes copied into the
2157                                              // buffers. If an error occurred,
2158                                              // this will be the  number of
2159                                              // bytes successfully transferred
2160                                              // prior to the error.
2161    ); 
2162 ``
2163 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
2164
2165 ]
2166
2167
2168
2169
2170 [endsect]
2171
2172
2173 [endsect]
2174
2175 [section:async_read_at async_read_at]
2176
2177 [indexterm1 boost_asio.indexterm.async_read_at..async_read_at] 
2178 The `async_read_at` function is a composed asynchronous operation that reads a certain amount of data at the specified offset. 
2179
2180
2181 Start an asynchronous operation to read a certain amount of data at the specified offset. 
2182
2183   template<
2184       typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``,
2185       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
2186       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
2187   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read_at.overload1 async_read_at]``(
2188       AsyncRandomAccessReadDevice & d,
2189       uint64_t offset,
2190       const MutableBufferSequence & buffers,
2191       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
2192   ``  [''''&raquo;''' [link boost_asio.reference.async_read_at.overload1 more...]]``
2193
2194   template<
2195       typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``,
2196       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
2197       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
2198       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
2199   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read_at.overload2 async_read_at]``(
2200       AsyncRandomAccessReadDevice & d,
2201       uint64_t offset,
2202       const MutableBufferSequence & buffers,
2203       CompletionCondition completion_condition,
2204       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
2205   ``  [''''&raquo;''' [link boost_asio.reference.async_read_at.overload2 more...]]``
2206
2207   template<
2208       typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``,
2209       typename Allocator,
2210       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
2211   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read_at.overload3 async_read_at]``(
2212       AsyncRandomAccessReadDevice & d,
2213       uint64_t offset,
2214       basic_streambuf< Allocator > & b,
2215       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
2216   ``  [''''&raquo;''' [link boost_asio.reference.async_read_at.overload3 more...]]``
2217
2218   template<
2219       typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``,
2220       typename Allocator,
2221       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
2222       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
2223   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read_at.overload4 async_read_at]``(
2224       AsyncRandomAccessReadDevice & d,
2225       uint64_t offset,
2226       basic_streambuf< Allocator > & b,
2227       CompletionCondition completion_condition,
2228       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
2229   ``  [''''&raquo;''' [link boost_asio.reference.async_read_at.overload4 more...]]``
2230
2231 [heading Requirements]
2232
2233 ['Header: ][^boost/asio/read_at.hpp]
2234
2235 ['Convenience header: ][^boost/asio.hpp]
2236
2237
2238 [section:overload1 async_read_at (1 of 4 overloads)]
2239
2240
2241 Start an asynchronous operation to read a certain amount of data at the specified offset. 
2242
2243
2244   template<
2245       typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``,
2246       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
2247       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
2248   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_at(
2249       AsyncRandomAccessReadDevice & d,
2250       uint64_t offset,
2251       const MutableBufferSequence & buffers,
2252       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
2253
2254
2255 This function is used to asynchronously read a certain number of bytes of data from a random access device at the specified offset. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
2256
2257
2258 * The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
2259
2260
2261 * An error occurred.
2262
2263 This operation is implemented in terms of zero or more calls to the device's async\_read\_some\_at function.
2264
2265
2266 [heading Parameters]
2267     
2268
2269 [variablelist
2270   
2271 [[d][The device from which the data is to be read. The type must support the AsyncRandomAccessReadDevice concept.]]
2272
2273 [[offset][The offset at which the data will be read.]]
2274
2275 [[buffers][One or more buffers into which the data will be read. The sum of the buffer sizes indicates the maximum number of bytes to read from the device. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
2276
2277 [[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
2278 ``
2279    void handler(
2280      // Result of operation.
2281      const boost::system::error_code& error,
2282
2283      // Number of bytes copied into the buffers. If an error
2284      // occurred, this will be the number of bytes successfully
2285      // transferred prior to the error.
2286      std::size_t bytes_transferred
2287    ); 
2288 ``
2289 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
2290
2291 ]
2292
2293
2294 [heading Example]
2295   
2296 To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
2297
2298    boost::asio::async_read_at(d, 42, boost::asio::buffer(data, size), handler);
2299
2300
2301 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
2302
2303
2304 [heading Remarks]
2305       
2306 This overload is equivalent to calling: 
2307
2308    boost::asio::async_read_at(
2309        d, 42, buffers,
2310        boost::asio::transfer_all(),
2311        handler); 
2312
2313
2314
2315
2316
2317
2318
2319 [endsect]
2320
2321
2322
2323 [section:overload2 async_read_at (2 of 4 overloads)]
2324
2325
2326 Start an asynchronous operation to read a certain amount of data at the specified offset. 
2327
2328
2329   template<
2330       typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``,
2331       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
2332       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
2333       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
2334   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_at(
2335       AsyncRandomAccessReadDevice & d,
2336       uint64_t offset,
2337       const MutableBufferSequence & buffers,
2338       CompletionCondition completion_condition,
2339       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
2340
2341
2342 This function is used to asynchronously read a certain number of bytes of data from a random access device at the specified offset. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
2343
2344
2345 * The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
2346
2347
2348 * The completion\_condition function object returns 0.
2349
2350
2351 [heading Parameters]
2352     
2353
2354 [variablelist
2355   
2356 [[d][The device from which the data is to be read. The type must support the AsyncRandomAccessReadDevice concept.]]
2357
2358 [[offset][The offset at which the data will be read.]]
2359
2360 [[buffers][One or more buffers into which the data will be read. The sum of the buffer sizes indicates the maximum number of bytes to read from the device. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
2361
2362 [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 
2363 ``
2364    std::size_t completion_condition(
2365      // Result of latest async_read_some_at operation.
2366      const boost::system::error_code& error,
2367
2368      // Number of bytes transferred so far.
2369      std::size_t bytes_transferred
2370    ); 
2371 ``
2372 A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the device's async\_read\_some\_at function.]]
2373
2374 [[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
2375 ``
2376    void handler(
2377      // Result of operation.
2378      const boost::system::error_code& error,
2379
2380      // Number of bytes copied into the buffers. If an error
2381      // occurred, this will be the number of bytes successfully
2382      // transferred prior to the error.
2383      std::size_t bytes_transferred
2384    ); 
2385 ``
2386 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
2387
2388 ]
2389
2390
2391 [heading Example]
2392   
2393 To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
2394
2395    boost::asio::async_read_at(d, 42,
2396        boost::asio::buffer(data, size),
2397        boost::asio::transfer_at_least(32),
2398        handler); 
2399
2400
2401 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
2402
2403
2404
2405
2406 [endsect]
2407
2408
2409
2410 [section:overload3 async_read_at (3 of 4 overloads)]
2411
2412
2413 Start an asynchronous operation to read a certain amount of data at the specified offset. 
2414
2415
2416   template<
2417       typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``,
2418       typename Allocator,
2419       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
2420   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_at(
2421       AsyncRandomAccessReadDevice & d,
2422       uint64_t offset,
2423       basic_streambuf< Allocator > & b,
2424       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
2425
2426
2427 This function is used to asynchronously read a certain number of bytes of data from a random access device at the specified offset. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
2428
2429
2430 * An error occurred.
2431
2432 This operation is implemented in terms of zero or more calls to the device's async\_read\_some\_at function.
2433
2434
2435 [heading Parameters]
2436     
2437
2438 [variablelist
2439   
2440 [[d][The device from which the data is to be read. The type must support the AsyncRandomAccessReadDevice concept.]]
2441
2442 [[offset][The offset at which the data will be read.]]
2443
2444 [[b][A [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read. Ownership of the streambuf is retained by the caller, which must guarantee that it remains valid until the handler is called.]]
2445
2446 [[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
2447 ``
2448    void handler(
2449      // Result of operation.
2450      const boost::system::error_code& error,
2451
2452      // Number of bytes copied into the buffers. If an error
2453      // occurred, this will be the number of bytes successfully
2454      // transferred prior to the error.
2455      std::size_t bytes_transferred
2456    ); 
2457 ``
2458 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
2459
2460 ]
2461
2462
2463 [heading Remarks]
2464       
2465 This overload is equivalent to calling: 
2466
2467    boost::asio::async_read_at(
2468        d, 42, b,
2469        boost::asio::transfer_all(),
2470        handler); 
2471
2472
2473
2474
2475
2476
2477
2478 [endsect]
2479
2480
2481
2482 [section:overload4 async_read_at (4 of 4 overloads)]
2483
2484
2485 Start an asynchronous operation to read a certain amount of data at the specified offset. 
2486
2487
2488   template<
2489       typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``,
2490       typename Allocator,
2491       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
2492       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
2493   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_at(
2494       AsyncRandomAccessReadDevice & d,
2495       uint64_t offset,
2496       basic_streambuf< Allocator > & b,
2497       CompletionCondition completion_condition,
2498       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
2499
2500
2501 This function is used to asynchronously read a certain number of bytes of data from a random access device at the specified offset. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
2502
2503
2504 * The completion\_condition function object returns 0.
2505
2506 This operation is implemented in terms of zero or more calls to the device's async\_read\_some\_at function.
2507
2508
2509 [heading Parameters]
2510     
2511
2512 [variablelist
2513   
2514 [[d][The device from which the data is to be read. The type must support the AsyncRandomAccessReadDevice concept.]]
2515
2516 [[offset][The offset at which the data will be read.]]
2517
2518 [[b][A [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read. Ownership of the streambuf is retained by the caller, which must guarantee that it remains valid until the handler is called.]]
2519
2520 [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 
2521 ``
2522    std::size_t completion_condition(
2523      // Result of latest async_read_some_at operation.
2524      const boost::system::error_code& error,
2525
2526      // Number of bytes transferred so far.
2527      std::size_t bytes_transferred
2528    ); 
2529 ``
2530 A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the device's async\_read\_some\_at function.]]
2531
2532 [[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
2533 ``
2534    void handler(
2535      // Result of operation.
2536      const boost::system::error_code& error,
2537
2538      // Number of bytes copied into the buffers. If an error
2539      // occurred, this will be the number of bytes successfully
2540      // transferred prior to the error.
2541      std::size_t bytes_transferred
2542    ); 
2543 ``
2544 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
2545
2546 ]
2547
2548
2549
2550
2551 [endsect]
2552
2553
2554 [endsect]
2555
2556 [section:async_read_until async_read_until]
2557
2558 [indexterm1 boost_asio.indexterm.async_read_until..async_read_until] 
2559 The `async_read_until` function is a composed asynchronous operation that reads data into a dynamic buffer sequence, or into a streambuf, until it contains a delimiter, matches a regular expression, or a function object indicates a match. 
2560
2561
2562 Start an asynchronous operation to read data into a dynamic buffer sequence until it contains a specified delimiter. 
2563
2564   template<
2565       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
2566       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
2567       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
2568   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read_until.overload1 async_read_until]``(
2569       AsyncReadStream & s,
2570       DynamicBuffer_v1 && buffers,
2571       char delim,
2572       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
2573       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
2574   ``  [''''&raquo;''' [link boost_asio.reference.async_read_until.overload1 more...]]``
2575
2576   template<
2577       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
2578       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
2579       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
2580   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read_until.overload2 async_read_until]``(
2581       AsyncReadStream & s,
2582       DynamicBuffer_v1 && buffers,
2583       string_view delim,
2584       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
2585       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
2586   ``  [''''&raquo;''' [link boost_asio.reference.async_read_until.overload2 more...]]``
2587
2588 Start an asynchronous operation to read data into a dynamic buffer sequence until some part of its data matches a regular expression. 
2589
2590   template<
2591       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
2592       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
2593       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
2594   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read_until.overload3 async_read_until]``(
2595       AsyncReadStream & s,
2596       DynamicBuffer_v1 && buffers,
2597       const boost::regex & expr,
2598       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
2599       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
2600   ``  [''''&raquo;''' [link boost_asio.reference.async_read_until.overload3 more...]]``
2601
2602 Start an asynchronous operation to read data into a dynamic buffer sequence until a function object indicates a match. 
2603
2604   template<
2605       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
2606       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
2607       typename MatchCondition,
2608       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
2609   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read_until.overload4 async_read_until]``(
2610       AsyncReadStream & s,
2611       DynamicBuffer_v1 && buffers,
2612       MatchCondition match_condition,
2613       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
2614       typename enable_if< is_match_condition< MatchCondition >::value &&is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
2615   ``  [''''&raquo;''' [link boost_asio.reference.async_read_until.overload4 more...]]``
2616
2617 Start an asynchronous operation to read data into a streambuf until it contains a specified delimiter. 
2618
2619   template<
2620       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
2621       typename Allocator,
2622       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
2623   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read_until.overload5 async_read_until]``(
2624       AsyncReadStream & s,
2625       boost::asio::basic_streambuf< Allocator > & b,
2626       char delim,
2627       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
2628   ``  [''''&raquo;''' [link boost_asio.reference.async_read_until.overload5 more...]]``
2629
2630   template<
2631       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
2632       typename Allocator,
2633       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
2634   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read_until.overload6 async_read_until]``(
2635       AsyncReadStream & s,
2636       boost::asio::basic_streambuf< Allocator > & b,
2637       string_view delim,
2638       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
2639   ``  [''''&raquo;''' [link boost_asio.reference.async_read_until.overload6 more...]]``
2640
2641 Start an asynchronous operation to read data into a streambuf until some part of its data matches a regular expression. 
2642
2643   template<
2644       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
2645       typename Allocator,
2646       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
2647   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read_until.overload7 async_read_until]``(
2648       AsyncReadStream & s,
2649       boost::asio::basic_streambuf< Allocator > & b,
2650       const boost::regex & expr,
2651       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
2652   ``  [''''&raquo;''' [link boost_asio.reference.async_read_until.overload7 more...]]``
2653
2654 Start an asynchronous operation to read data into a streambuf until a function object indicates a match. 
2655
2656   template<
2657       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
2658       typename Allocator,
2659       typename MatchCondition,
2660       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
2661   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read_until.overload8 async_read_until]``(
2662       AsyncReadStream & s,
2663       boost::asio::basic_streambuf< Allocator > & b,
2664       MatchCondition match_condition,
2665       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
2666       typename enable_if< is_match_condition< MatchCondition >::value >::type *  = 0);
2667   ``  [''''&raquo;''' [link boost_asio.reference.async_read_until.overload8 more...]]``
2668
2669 Start an asynchronous operation to read data into a dynamic buffer sequence until it contains a specified delimiter. 
2670
2671   template<
2672       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
2673       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
2674       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
2675   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read_until.overload9 async_read_until]``(
2676       AsyncReadStream & s,
2677       DynamicBuffer_v2 buffers,
2678       char delim,
2679       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
2680       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
2681   ``  [''''&raquo;''' [link boost_asio.reference.async_read_until.overload9 more...]]``
2682
2683   template<
2684       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
2685       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
2686       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
2687   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read_until.overload10 async_read_until]``(
2688       AsyncReadStream & s,
2689       DynamicBuffer_v2 buffers,
2690       string_view delim,
2691       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
2692       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
2693   ``  [''''&raquo;''' [link boost_asio.reference.async_read_until.overload10 more...]]``
2694
2695 Start an asynchronous operation to read data into a dynamic buffer sequence until some part of its data matches a regular expression. 
2696
2697   template<
2698       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
2699       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
2700       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
2701   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read_until.overload11 async_read_until]``(
2702       AsyncReadStream & s,
2703       DynamicBuffer_v2 buffers,
2704       const boost::regex & expr,
2705       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
2706       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
2707   ``  [''''&raquo;''' [link boost_asio.reference.async_read_until.overload11 more...]]``
2708
2709 Start an asynchronous operation to read data into a dynamic buffer sequence until a function object indicates a match. 
2710
2711   template<
2712       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
2713       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
2714       typename MatchCondition,
2715       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
2716   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read_until.overload12 async_read_until]``(
2717       AsyncReadStream & s,
2718       DynamicBuffer_v2 buffers,
2719       MatchCondition match_condition,
2720       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
2721       typename enable_if< is_match_condition< MatchCondition >::value &&is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
2722   ``  [''''&raquo;''' [link boost_asio.reference.async_read_until.overload12 more...]]``
2723
2724 [heading Requirements]
2725
2726 ['Header: ][^boost/asio/read_until.hpp]
2727
2728 ['Convenience header: ][^boost/asio.hpp]
2729
2730
2731 [section:overload1 async_read_until (1 of 12 overloads)]
2732
2733
2734 Start an asynchronous operation to read data into a dynamic buffer sequence until it contains a specified delimiter. 
2735
2736
2737   template<
2738       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
2739       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
2740       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
2741   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until(
2742       AsyncReadStream & s,
2743       DynamicBuffer_v1 && buffers,
2744       char delim,
2745       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
2746       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
2747
2748
2749 This function is used to asynchronously read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains the specified delimiter. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
2750
2751
2752 * The get area of the dynamic buffer sequence contains the specified delimiter.
2753
2754
2755 * An error occurred.
2756
2757 This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. If the dynamic buffer sequence's get area already contains the delimiter, this asynchronous operation completes immediately. The program must ensure that the stream performs no other read operations (such as async\_read, async\_read\_until, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
2758
2759
2760 [heading Parameters]
2761     
2762
2763 [variablelist
2764   
2765 [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
2766
2767 [[buffers][The dynamic buffer sequence into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
2768
2769 [[delim][The delimiter character.]]
2770
2771 [[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
2772 ``
2773    void handler(
2774      // Result of operation.
2775      const boost::system::error_code& error,
2776
2777      // The number of bytes in the dynamic buffer sequence's
2778      // get area up to and including the delimiter.
2779      // 0 if an error occurred.
2780      std::size_t bytes_transferred
2781    ); 
2782 ``
2783 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
2784
2785 ]
2786
2787
2788 [heading Remarks]
2789       
2790 After a successful async\_read\_until operation, the dynamic buffer sequence may contain additional data beyond the delimiter. An application will typically leave that data in the dynamic buffer sequence for a subsequent async\_read\_until operation to examine.
2791
2792
2793 [heading Example]
2794   
2795 To asynchronously read data into a `std::string` until a newline is encountered: 
2796
2797    std::string data;
2798    ...
2799    void handler(const boost::system::error_code& e, std::size_t size)
2800    {
2801      if (!e)
2802      {
2803        std::string line = data.substr(0, n);
2804        data.erase(0, n);
2805        ...
2806      }
2807    }
2808    ...
2809    boost::asio::async_read_until(s, data, '\n', handler); 
2810
2811
2812 After the `async_read_until` operation completes successfully, the buffer `data` contains the delimiter: 
2813
2814    { 'a', 'b', ..., 'c', '\n', 'd', 'e', ... } 
2815
2816
2817 The call to `substr` then extracts the data up to and including the delimiter, so that the string `line` contains: 
2818
2819    { 'a', 'b', ..., 'c', '\n' } 
2820
2821
2822 After the call to `erase`, the remaining data is left in the buffer `data` as follows: 
2823
2824    { 'd', 'e', ... } 
2825
2826
2827 This data may be the start of a new line, to be extracted by a subsequent `async_read_until` operation. 
2828
2829
2830
2831
2832 [endsect]
2833
2834
2835
2836 [section:overload2 async_read_until (2 of 12 overloads)]
2837
2838
2839 Start an asynchronous operation to read data into a dynamic buffer sequence until it contains a specified delimiter. 
2840
2841
2842   template<
2843       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
2844       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
2845       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
2846   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until(
2847       AsyncReadStream & s,
2848       DynamicBuffer_v1 && buffers,
2849       string_view delim,
2850       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
2851       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
2852
2853
2854 This function is used to asynchronously read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains the specified delimiter. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
2855
2856
2857 * The get area of the dynamic buffer sequence contains the specified delimiter.
2858
2859
2860 * An error occurred.
2861
2862 This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. If the dynamic buffer sequence's get area already contains the delimiter, this asynchronous operation completes immediately. The program must ensure that the stream performs no other read operations (such as async\_read, async\_read\_until, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
2863
2864
2865 [heading Parameters]
2866     
2867
2868 [variablelist
2869   
2870 [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
2871
2872 [[buffers][The dynamic buffer sequence into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
2873
2874 [[delim][The delimiter string.]]
2875
2876 [[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
2877 ``
2878    void handler(
2879      // Result of operation.
2880      const boost::system::error_code& error,
2881
2882      // The number of bytes in the dynamic buffer sequence's
2883      // get area up to and including the delimiter.
2884      // 0 if an error occurred.
2885      std::size_t bytes_transferred
2886    ); 
2887 ``
2888 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
2889
2890 ]
2891
2892
2893 [heading Remarks]
2894       
2895 After a successful async\_read\_until operation, the dynamic buffer sequence may contain additional data beyond the delimiter. An application will typically leave that data in the dynamic buffer sequence for a subsequent async\_read\_until operation to examine.
2896
2897
2898 [heading Example]
2899   
2900 To asynchronously read data into a `std::string` until a CR-LF sequence is encountered: 
2901
2902    std::string data;
2903    ...
2904    void handler(const boost::system::error_code& e, std::size_t size)
2905    {
2906      if (!e)
2907      {
2908        std::string line = data.substr(0, n);
2909        data.erase(0, n);
2910        ...
2911      }
2912    }
2913    ...
2914    boost::asio::async_read_until(s, data, "\r\n", handler); 
2915
2916
2917 After the `async_read_until` operation completes successfully, the string `data` contains the delimiter: 
2918
2919    { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } 
2920
2921
2922 The call to `substr` then extracts the data up to and including the delimiter, so that the string `line` contains: 
2923
2924    { 'a', 'b', ..., 'c', '\r', '\n' } 
2925
2926
2927 After the call to `erase`, the remaining data is left in the string `data` as follows: 
2928
2929    { 'd', 'e', ... } 
2930
2931
2932 This data may be the start of a new line, to be extracted by a subsequent `async_read_until` operation. 
2933
2934
2935
2936
2937 [endsect]
2938
2939
2940
2941 [section:overload3 async_read_until (3 of 12 overloads)]
2942
2943
2944 Start an asynchronous operation to read data into a dynamic buffer sequence until some part of its data matches a regular expression. 
2945
2946
2947   template<
2948       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
2949       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
2950       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
2951   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until(
2952       AsyncReadStream & s,
2953       DynamicBuffer_v1 && buffers,
2954       const boost::regex & expr,
2955       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
2956       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
2957
2958
2959 This function is used to asynchronously read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains some data that matches a regular expression. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
2960
2961
2962 * A substring of the dynamic buffer sequence's get area matches the regular expression.
2963
2964
2965 * An error occurred.
2966
2967 This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. If the dynamic buffer sequence's get area already contains data that matches the regular expression, this asynchronous operation completes immediately. The program must ensure that the stream performs no other read operations (such as async\_read, async\_read\_until, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
2968
2969
2970 [heading Parameters]
2971     
2972
2973 [variablelist
2974   
2975 [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
2976
2977 [[buffers][The dynamic buffer sequence into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
2978
2979 [[expr][The regular expression.]]
2980
2981 [[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
2982 ``
2983    void handler(
2984      // Result of operation.
2985      const boost::system::error_code& error,
2986
2987      // The number of bytes in the dynamic buffer
2988      // sequence's get area up to and including the
2989      // substring that matches the regular expression.
2990      // 0 if an error occurred.
2991      std::size_t bytes_transferred
2992    ); 
2993 ``
2994 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
2995
2996 ]
2997
2998
2999 [heading Remarks]
3000       
3001 After a successful async\_read\_until operation, the dynamic buffer sequence may contain additional data beyond that which matched the regular expression. An application will typically leave that data in the dynamic buffer sequence for a subsequent async\_read\_until operation to examine.
3002
3003
3004 [heading Example]
3005   
3006 To asynchronously read data into a `std::string` until a CR-LF sequence is encountered: 
3007
3008    std::string data;
3009    ...
3010    void handler(const boost::system::error_code& e, std::size_t size)
3011    {
3012      if (!e)
3013      {
3014        std::string line = data.substr(0, n);
3015        data.erase(0, n);
3016        ...
3017      }
3018    }
3019    ...
3020    boost::asio::async_read_until(s, data,
3021        boost::regex("\r\n"), handler); 
3022
3023
3024 After the `async_read_until` operation completes successfully, the string `data` contains the data which matched the regular expression: 
3025
3026    { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } 
3027
3028
3029 The call to `substr` then extracts the data up to and including the match, so that the string `line` contains: 
3030
3031    { 'a', 'b', ..., 'c', '\r', '\n' } 
3032
3033
3034 After the call to `erase`, the remaining data is left in the string `data` as follows: 
3035
3036    { 'd', 'e', ... } 
3037
3038
3039 This data may be the start of a new line, to be extracted by a subsequent `async_read_until` operation. 
3040
3041
3042
3043
3044 [endsect]
3045
3046
3047
3048 [section:overload4 async_read_until (4 of 12 overloads)]
3049
3050
3051 Start an asynchronous operation to read data into a dynamic buffer sequence until a function object indicates a match. 
3052
3053
3054   template<
3055       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
3056       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
3057       typename MatchCondition,
3058       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
3059   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until(
3060       AsyncReadStream & s,
3061       DynamicBuffer_v1 && buffers,
3062       MatchCondition match_condition,
3063       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
3064       typename enable_if< is_match_condition< MatchCondition >::value &&is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
3065
3066
3067 This function is used to asynchronously read data into the specified dynamic buffer sequence until a user-defined match condition function object, when applied to the data contained in the dynamic buffer sequence, indicates a successful match. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
3068
3069
3070 * The match condition function object returns a std::pair where the second element evaluates to true.
3071
3072
3073 * An error occurred.
3074
3075 This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. If the match condition function object already indicates a match, this asynchronous operation completes immediately. The program must ensure that the stream performs no other read operations (such as async\_read, async\_read\_until, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
3076
3077
3078 [heading Parameters]
3079     
3080
3081 [variablelist
3082   
3083 [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
3084
3085 [[buffers][The dynamic buffer sequence into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
3086
3087 [[match_condition][The function object to be called to determine whether a match exists. The signature of the function object must be: 
3088 ``
3089    pair<iterator, bool> match_condition(iterator begin, iterator end);
3090 ``
3091 where `iterator` represents the type: 
3092 ``
3093    buffers_iterator<typename DynamicBuffer_v1::const_buffers_type>
3094 ``
3095 The iterator parameters `begin` and `end` define the range of bytes to be scanned to determine whether there is a match. The `first` member of the return value is an iterator marking one-past-the-end of the bytes that have been consumed by the match function. This iterator is used to calculate the `begin` parameter for any subsequent invocation of the match condition. The `second` member of the return value is true if a match has been found, false otherwise.]]
3096
3097 [[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
3098 ``
3099    void handler(
3100      // Result of operation.
3101      const boost::system::error_code& error,
3102
3103      // The number of bytes in the dynamic buffer sequence's
3104      // get area that have been fully consumed by the match
3105      // function. O if an error occurred.
3106      std::size_t bytes_transferred
3107    ); 
3108 ``
3109 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
3110
3111 ]
3112
3113
3114 [heading Remarks]
3115       
3116 After a successful async\_read\_until operation, the dynamic buffer sequence may contain additional data beyond that which matched the function object. An application will typically leave that data in the dynamic buffer sequence for a subsequent async\_read\_until operation to examine.
3117
3118 The default implementation of the `is_match_condition` type trait evaluates to true for function pointers and function objects with a `result_type` typedef. It must be specialised for other user-defined function objects.
3119
3120
3121 [heading Examples]
3122   
3123 To asynchronously read data into a `std::string` until whitespace is encountered: 
3124
3125    typedef boost::asio::buffers_iterator<
3126        boost::asio::const_buffers_1> iterator;
3127
3128    std::pair<iterator, bool>
3129    match_whitespace(iterator begin, iterator end)
3130    {
3131      iterator i = begin;
3132      while (i != end)
3133        if (std::isspace(*i++))
3134          return std::make_pair(i, true);
3135      return std::make_pair(i, false);
3136    }
3137    ...
3138    void handler(const boost::system::error_code& e, std::size_t size);
3139    ...
3140    std::string data;
3141    boost::asio::async_read_until(s, data, match_whitespace, handler);
3142
3143
3144
3145
3146 To asynchronously read data into a `std::string` until a matching character is found: 
3147
3148    class match_char
3149    {
3150    public:
3151      explicit match_char(char c) : c_(c) {}
3152
3153      template <typename Iterator>
3154      std::pair<Iterator, bool> operator()(
3155          Iterator begin, Iterator end) const
3156      {
3157        Iterator i = begin;
3158        while (i != end)
3159          if (c_ == *i++)
3160            return std::make_pair(i, true);
3161        return std::make_pair(i, false);
3162      }
3163
3164    private:
3165      char c_;
3166    };
3167
3168    namespace asio {
3169      template <> struct is_match_condition<match_char>
3170        : public boost::true_type {};
3171    } // namespace asio
3172    ...
3173    void handler(const boost::system::error_code& e, std::size_t size);
3174    ...
3175    std::string data;
3176    boost::asio::async_read_until(s, data, match_char('a'), handler);
3177
3178
3179
3180
3181
3182 [endsect]
3183
3184
3185
3186 [section:overload5 async_read_until (5 of 12 overloads)]
3187
3188
3189 Start an asynchronous operation to read data into a streambuf until it contains a specified delimiter. 
3190
3191
3192   template<
3193       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
3194       typename Allocator,
3195       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
3196   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until(
3197       AsyncReadStream & s,
3198       boost::asio::basic_streambuf< Allocator > & b,
3199       char delim,
3200       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
3201
3202
3203 This function is used to asynchronously read data into the specified streambuf until the streambuf's get area contains the specified delimiter. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
3204
3205
3206 * The get area of the streambuf contains the specified delimiter.
3207
3208
3209 * An error occurred.
3210
3211 This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. If the streambuf's get area already contains the delimiter, this asynchronous operation completes immediately. The program must ensure that the stream performs no other read operations (such as async\_read, async\_read\_until, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
3212
3213
3214 [heading Parameters]
3215     
3216
3217 [variablelist
3218   
3219 [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
3220
3221 [[b][A streambuf object into which the data will be read. Ownership of the streambuf is retained by the caller, which must guarantee that it remains valid until the handler is called.]]
3222
3223 [[delim][The delimiter character.]]
3224
3225 [[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
3226 ``
3227    void handler(
3228      // Result of operation.
3229      const boost::system::error_code& error,
3230
3231      // The number of bytes in the streambuf's get
3232      // area up to and including the delimiter.
3233      // 0 if an error occurred.
3234      std::size_t bytes_transferred
3235    ); 
3236 ``
3237 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
3238
3239 ]
3240
3241
3242 [heading Remarks]
3243       
3244 After a successful async\_read\_until operation, the streambuf may contain additional data beyond the delimiter. An application will typically leave that data in the streambuf for a subsequent async\_read\_until operation to examine.
3245
3246
3247 [heading Example]
3248   
3249 To asynchronously read data into a streambuf until a newline is encountered: 
3250
3251    boost::asio::streambuf b;
3252    ...
3253    void handler(const boost::system::error_code& e, std::size_t size)
3254    {
3255      if (!e)
3256      {
3257        std::istream is(&b);
3258        std::string line;
3259        std::getline(is, line);
3260        ...
3261      }
3262    }
3263    ...
3264    boost::asio::async_read_until(s, b, '\n', handler); 
3265
3266
3267 After the `async_read_until` operation completes successfully, the buffer `b` contains the delimiter: 
3268
3269    { 'a', 'b', ..., 'c', '\n', 'd', 'e', ... } 
3270
3271
3272 The call to `std::getline` then extracts the data up to and including the newline (which is discarded), so that the string `line` contains: 
3273
3274    { 'a', 'b', ..., 'c' } 
3275
3276
3277 The remaining data is left in the buffer `b` as follows: 
3278
3279    { 'd', 'e', ... } 
3280
3281
3282 This data may be the start of a new line, to be extracted by a subsequent `async_read_until` operation. 
3283
3284
3285
3286
3287 [endsect]
3288
3289
3290
3291 [section:overload6 async_read_until (6 of 12 overloads)]
3292
3293
3294 Start an asynchronous operation to read data into a streambuf until it contains a specified delimiter. 
3295
3296
3297   template<
3298       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
3299       typename Allocator,
3300       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
3301   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until(
3302       AsyncReadStream & s,
3303       boost::asio::basic_streambuf< Allocator > & b,
3304       string_view delim,
3305       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
3306
3307
3308 This function is used to asynchronously read data into the specified streambuf until the streambuf's get area contains the specified delimiter. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
3309
3310
3311 * The get area of the streambuf contains the specified delimiter.
3312
3313
3314 * An error occurred.
3315
3316 This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. If the streambuf's get area already contains the delimiter, this asynchronous operation completes immediately. The program must ensure that the stream performs no other read operations (such as async\_read, async\_read\_until, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
3317
3318
3319 [heading Parameters]
3320     
3321
3322 [variablelist
3323   
3324 [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
3325
3326 [[b][A streambuf object into which the data will be read. Ownership of the streambuf is retained by the caller, which must guarantee that it remains valid until the handler is called.]]
3327
3328 [[delim][The delimiter string.]]
3329
3330 [[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
3331 ``
3332    void handler(
3333      // Result of operation.
3334      const boost::system::error_code& error,
3335
3336      // The number of bytes in the streambuf's get
3337      // area up to and including the delimiter.
3338      // 0 if an error occurred.
3339      std::size_t bytes_transferred
3340    ); 
3341 ``
3342 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
3343
3344 ]
3345
3346
3347 [heading Remarks]
3348       
3349 After a successful async\_read\_until operation, the streambuf may contain additional data beyond the delimiter. An application will typically leave that data in the streambuf for a subsequent async\_read\_until operation to examine.
3350
3351
3352 [heading Example]
3353   
3354 To asynchronously read data into a streambuf until a newline is encountered: 
3355
3356    boost::asio::streambuf b;
3357    ...
3358    void handler(const boost::system::error_code& e, std::size_t size)
3359    {
3360      if (!e)
3361      {
3362        std::istream is(&b);
3363        std::string line;
3364        std::getline(is, line);
3365        ...
3366      }
3367    }
3368    ...
3369    boost::asio::async_read_until(s, b, "\r\n", handler); 
3370
3371
3372 After the `async_read_until` operation completes successfully, the buffer `b` contains the delimiter: 
3373
3374    { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } 
3375
3376
3377 The call to `std::getline` then extracts the data up to and including the newline (which is discarded), so that the string `line` contains: 
3378
3379    { 'a', 'b', ..., 'c', '\r' } 
3380
3381
3382 The remaining data is left in the buffer `b` as follows: 
3383
3384    { 'd', 'e', ... } 
3385
3386
3387 This data may be the start of a new line, to be extracted by a subsequent `async_read_until` operation. 
3388
3389
3390
3391
3392 [endsect]
3393
3394
3395
3396 [section:overload7 async_read_until (7 of 12 overloads)]
3397
3398
3399 Start an asynchronous operation to read data into a streambuf until some part of its data matches a regular expression. 
3400
3401
3402   template<
3403       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
3404       typename Allocator,
3405       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
3406   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until(
3407       AsyncReadStream & s,
3408       boost::asio::basic_streambuf< Allocator > & b,
3409       const boost::regex & expr,
3410       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
3411
3412
3413 This function is used to asynchronously read data into the specified streambuf until the streambuf's get area contains some data that matches a regular expression. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
3414
3415
3416 * A substring of the streambuf's get area matches the regular expression.
3417
3418
3419 * An error occurred.
3420
3421 This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. If the streambuf's get area already contains data that matches the regular expression, this asynchronous operation completes immediately. The program must ensure that the stream performs no other read operations (such as async\_read, async\_read\_until, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
3422
3423
3424 [heading Parameters]
3425     
3426
3427 [variablelist
3428   
3429 [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
3430
3431 [[b][A streambuf object into which the data will be read. Ownership of the streambuf is retained by the caller, which must guarantee that it remains valid until the handler is called.]]
3432
3433 [[expr][The regular expression.]]
3434
3435 [[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
3436 ``
3437    void handler(
3438      // Result of operation.
3439      const boost::system::error_code& error,
3440
3441      // The number of bytes in the streambuf's get
3442      // area up to and including the substring
3443      // that matches the regular. expression.
3444      // 0 if an error occurred.
3445      std::size_t bytes_transferred
3446    ); 
3447 ``
3448 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
3449
3450 ]
3451
3452
3453 [heading Remarks]
3454       
3455 After a successful async\_read\_until operation, the streambuf may contain additional data beyond that which matched the regular expression. An application will typically leave that data in the streambuf for a subsequent async\_read\_until operation to examine.
3456
3457
3458 [heading Example]
3459   
3460 To asynchronously read data into a streambuf until a CR-LF sequence is encountered: 
3461
3462    boost::asio::streambuf b;
3463    ...
3464    void handler(const boost::system::error_code& e, std::size_t size)
3465    {
3466      if (!e)
3467      {
3468        std::istream is(&b);
3469        std::string line;
3470        std::getline(is, line);
3471        ...
3472      }
3473    }
3474    ...
3475    boost::asio::async_read_until(s, b, boost::regex("\r\n"), handler); 
3476
3477
3478 After the `async_read_until` operation completes successfully, the buffer `b` contains the data which matched the regular expression: 
3479
3480    { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } 
3481
3482
3483 The call to `std::getline` then extracts the data up to and including the newline (which is discarded), so that the string `line` contains: 
3484
3485    { 'a', 'b', ..., 'c', '\r' } 
3486
3487
3488 The remaining data is left in the buffer `b` as follows: 
3489
3490    { 'd', 'e', ... } 
3491
3492
3493 This data may be the start of a new line, to be extracted by a subsequent `async_read_until` operation. 
3494
3495
3496
3497
3498 [endsect]
3499
3500
3501
3502 [section:overload8 async_read_until (8 of 12 overloads)]
3503
3504
3505 Start an asynchronous operation to read data into a streambuf until a function object indicates a match. 
3506
3507
3508   template<
3509       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
3510       typename Allocator,
3511       typename MatchCondition,
3512       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
3513   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until(
3514       AsyncReadStream & s,
3515       boost::asio::basic_streambuf< Allocator > & b,
3516       MatchCondition match_condition,
3517       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
3518       typename enable_if< is_match_condition< MatchCondition >::value >::type *  = 0);
3519
3520
3521 This function is used to asynchronously read data into the specified streambuf until a user-defined match condition function object, when applied to the data contained in the streambuf, indicates a successful match. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
3522
3523
3524 * The match condition function object returns a std::pair where the second element evaluates to true.
3525
3526
3527 * An error occurred.
3528
3529 This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. If the match condition function object already indicates a match, this asynchronous operation completes immediately. The program must ensure that the stream performs no other read operations (such as async\_read, async\_read\_until, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
3530
3531
3532 [heading Parameters]
3533     
3534
3535 [variablelist
3536   
3537 [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
3538
3539 [[b][A streambuf object into which the data will be read.]]
3540
3541 [[match_condition][The function object to be called to determine whether a match exists. The signature of the function object must be: 
3542 ``
3543    pair<iterator, bool> match_condition(iterator begin, iterator end);
3544 ``
3545 where `iterator` represents the type: 
3546 ``
3547    buffers_iterator<basic_streambuf<Allocator>::const_buffers_type>
3548 ``
3549 The iterator parameters `begin` and `end` define the range of bytes to be scanned to determine whether there is a match. The `first` member of the return value is an iterator marking one-past-the-end of the bytes that have been consumed by the match function. This iterator is used to calculate the `begin` parameter for any subsequent invocation of the match condition. The `second` member of the return value is true if a match has been found, false otherwise.]]
3550
3551 [[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
3552 ``
3553    void handler(
3554      // Result of operation.
3555      const boost::system::error_code& error,
3556
3557      // The number of bytes in the streambuf's get
3558      // area that have been fully consumed by the
3559      // match function. O if an error occurred.
3560      std::size_t bytes_transferred
3561    ); 
3562 ``
3563 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
3564
3565 ]
3566
3567
3568 [heading Remarks]
3569       
3570 After a successful async\_read\_until operation, the streambuf may contain additional data beyond that which matched the function object. An application will typically leave that data in the streambuf for a subsequent async\_read\_until operation to examine.
3571
3572 The default implementation of the `is_match_condition` type trait evaluates to true for function pointers and function objects with a `result_type` typedef. It must be specialised for other user-defined function objects.
3573
3574
3575 [heading Examples]
3576   
3577 To asynchronously read data into a streambuf until whitespace is encountered: 
3578
3579    typedef boost::asio::buffers_iterator<
3580        boost::asio::streambuf::const_buffers_type> iterator;
3581
3582    std::pair<iterator, bool>
3583    match_whitespace(iterator begin, iterator end)
3584    {
3585      iterator i = begin;
3586      while (i != end)
3587        if (std::isspace(*i++))
3588          return std::make_pair(i, true);
3589      return std::make_pair(i, false);
3590    }
3591    ...
3592    void handler(const boost::system::error_code& e, std::size_t size);
3593    ...
3594    boost::asio::streambuf b;
3595    boost::asio::async_read_until(s, b, match_whitespace, handler);
3596
3597
3598
3599
3600 To asynchronously read data into a streambuf until a matching character is found: 
3601
3602    class match_char
3603    {
3604    public:
3605      explicit match_char(char c) : c_(c) {}
3606
3607      template <typename Iterator>
3608      std::pair<Iterator, bool> operator()(
3609          Iterator begin, Iterator end) const
3610      {
3611        Iterator i = begin;
3612        while (i != end)
3613          if (c_ == *i++)
3614            return std::make_pair(i, true);
3615        return std::make_pair(i, false);
3616      }
3617
3618    private:
3619      char c_;
3620    };
3621
3622    namespace asio {
3623      template <> struct is_match_condition<match_char>
3624        : public boost::true_type {};
3625    } // namespace asio
3626    ...
3627    void handler(const boost::system::error_code& e, std::size_t size);
3628    ...
3629    boost::asio::streambuf b;
3630    boost::asio::async_read_until(s, b, match_char('a'), handler);
3631
3632
3633
3634
3635
3636 [endsect]
3637
3638
3639
3640 [section:overload9 async_read_until (9 of 12 overloads)]
3641
3642
3643 Start an asynchronous operation to read data into a dynamic buffer sequence until it contains a specified delimiter. 
3644
3645
3646   template<
3647       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
3648       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
3649       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
3650   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until(
3651       AsyncReadStream & s,
3652       DynamicBuffer_v2 buffers,
3653       char delim,
3654       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
3655       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
3656
3657
3658 This function is used to asynchronously read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains the specified delimiter. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
3659
3660
3661 * The get area of the dynamic buffer sequence contains the specified delimiter.
3662
3663
3664 * An error occurred.
3665
3666 This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. If the dynamic buffer sequence's get area already contains the delimiter, this asynchronous operation completes immediately. The program must ensure that the stream performs no other read operations (such as async\_read, async\_read\_until, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
3667
3668
3669 [heading Parameters]
3670     
3671
3672 [variablelist
3673   
3674 [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
3675
3676 [[buffers][The dynamic buffer sequence into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
3677
3678 [[delim][The delimiter character.]]
3679
3680 [[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
3681 ``
3682    void handler(
3683      // Result of operation.
3684      const boost::system::error_code& error,
3685
3686      // The number of bytes in the dynamic buffer sequence's
3687      // get area up to and including the delimiter.
3688      // 0 if an error occurred.
3689      std::size_t bytes_transferred
3690    ); 
3691 ``
3692 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
3693
3694 ]
3695
3696
3697 [heading Remarks]
3698       
3699 After a successful async\_read\_until operation, the dynamic buffer sequence may contain additional data beyond the delimiter. An application will typically leave that data in the dynamic buffer sequence for a subsequent async\_read\_until operation to examine.
3700
3701
3702 [heading Example]
3703   
3704 To asynchronously read data into a `std::string` until a newline is encountered: 
3705
3706    std::string data;
3707    ...
3708    void handler(const boost::system::error_code& e, std::size_t size)
3709    {
3710      if (!e)
3711      {
3712        std::string line = data.substr(0, n);
3713        data.erase(0, n);
3714        ...
3715      }
3716    }
3717    ...
3718    boost::asio::async_read_until(s, data, '\n', handler); 
3719
3720
3721 After the `async_read_until` operation completes successfully, the buffer `data` contains the delimiter: 
3722
3723    { 'a', 'b', ..., 'c', '\n', 'd', 'e', ... } 
3724
3725
3726 The call to `substr` then extracts the data up to and including the delimiter, so that the string `line` contains: 
3727
3728    { 'a', 'b', ..., 'c', '\n' } 
3729
3730
3731 After the call to `erase`, the remaining data is left in the buffer `data` as follows: 
3732
3733    { 'd', 'e', ... } 
3734
3735
3736 This data may be the start of a new line, to be extracted by a subsequent `async_read_until` operation. 
3737
3738
3739
3740
3741 [endsect]
3742
3743
3744
3745 [section:overload10 async_read_until (10 of 12 overloads)]
3746
3747
3748 Start an asynchronous operation to read data into a dynamic buffer sequence until it contains a specified delimiter. 
3749
3750
3751   template<
3752       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
3753       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
3754       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
3755   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until(
3756       AsyncReadStream & s,
3757       DynamicBuffer_v2 buffers,
3758       string_view delim,
3759       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
3760       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
3761
3762
3763 This function is used to asynchronously read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains the specified delimiter. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
3764
3765
3766 * The get area of the dynamic buffer sequence contains the specified delimiter.
3767
3768
3769 * An error occurred.
3770
3771 This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. If the dynamic buffer sequence's get area already contains the delimiter, this asynchronous operation completes immediately. The program must ensure that the stream performs no other read operations (such as async\_read, async\_read\_until, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
3772
3773
3774 [heading Parameters]
3775     
3776
3777 [variablelist
3778   
3779 [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
3780
3781 [[buffers][The dynamic buffer sequence into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
3782
3783 [[delim][The delimiter string.]]
3784
3785 [[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
3786 ``
3787    void handler(
3788      // Result of operation.
3789      const boost::system::error_code& error,
3790
3791      // The number of bytes in the dynamic buffer sequence's
3792      // get area up to and including the delimiter.
3793      // 0 if an error occurred.
3794      std::size_t bytes_transferred
3795    ); 
3796 ``
3797 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
3798
3799 ]
3800
3801
3802 [heading Remarks]
3803       
3804 After a successful async\_read\_until operation, the dynamic buffer sequence may contain additional data beyond the delimiter. An application will typically leave that data in the dynamic buffer sequence for a subsequent async\_read\_until operation to examine.
3805
3806
3807 [heading Example]
3808   
3809 To asynchronously read data into a `std::string` until a CR-LF sequence is encountered: 
3810
3811    std::string data;
3812    ...
3813    void handler(const boost::system::error_code& e, std::size_t size)
3814    {
3815      if (!e)
3816      {
3817        std::string line = data.substr(0, n);
3818        data.erase(0, n);
3819        ...
3820      }
3821    }
3822    ...
3823    boost::asio::async_read_until(s, data, "\r\n", handler); 
3824
3825
3826 After the `async_read_until` operation completes successfully, the string `data` contains the delimiter: 
3827
3828    { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } 
3829
3830
3831 The call to `substr` then extracts the data up to and including the delimiter, so that the string `line` contains: 
3832
3833    { 'a', 'b', ..., 'c', '\r', '\n' } 
3834
3835
3836 After the call to `erase`, the remaining data is left in the string `data` as follows: 
3837
3838    { 'd', 'e', ... } 
3839
3840
3841 This data may be the start of a new line, to be extracted by a subsequent `async_read_until` operation. 
3842
3843
3844
3845
3846 [endsect]
3847
3848
3849
3850 [section:overload11 async_read_until (11 of 12 overloads)]
3851
3852
3853 Start an asynchronous operation to read data into a dynamic buffer sequence until some part of its data matches a regular expression. 
3854
3855
3856   template<
3857       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
3858       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
3859       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
3860   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until(
3861       AsyncReadStream & s,
3862       DynamicBuffer_v2 buffers,
3863       const boost::regex & expr,
3864       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
3865       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
3866
3867
3868 This function is used to asynchronously read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains some data that matches a regular expression. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
3869
3870
3871 * A substring of the dynamic buffer sequence's get area matches the regular expression.
3872
3873
3874 * An error occurred.
3875
3876 This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. If the dynamic buffer sequence's get area already contains data that matches the regular expression, this asynchronous operation completes immediately. The program must ensure that the stream performs no other read operations (such as async\_read, async\_read\_until, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
3877
3878
3879 [heading Parameters]
3880     
3881
3882 [variablelist
3883   
3884 [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
3885
3886 [[buffers][The dynamic buffer sequence into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
3887
3888 [[expr][The regular expression.]]
3889
3890 [[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
3891 ``
3892    void handler(
3893      // Result of operation.
3894      const boost::system::error_code& error,
3895
3896      // The number of bytes in the dynamic buffer
3897      // sequence's get area up to and including the
3898      // substring that matches the regular expression.
3899      // 0 if an error occurred.
3900      std::size_t bytes_transferred
3901    ); 
3902 ``
3903 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
3904
3905 ]
3906
3907
3908 [heading Remarks]
3909       
3910 After a successful async\_read\_until operation, the dynamic buffer sequence may contain additional data beyond that which matched the regular expression. An application will typically leave that data in the dynamic buffer sequence for a subsequent async\_read\_until operation to examine.
3911
3912
3913 [heading Example]
3914   
3915 To asynchronously read data into a `std::string` until a CR-LF sequence is encountered: 
3916
3917    std::string data;
3918    ...
3919    void handler(const boost::system::error_code& e, std::size_t size)
3920    {
3921      if (!e)
3922      {
3923        std::string line = data.substr(0, n);
3924        data.erase(0, n);
3925        ...
3926      }
3927    }
3928    ...
3929    boost::asio::async_read_until(s, data,
3930        boost::regex("\r\n"), handler); 
3931
3932
3933 After the `async_read_until` operation completes successfully, the string `data` contains the data which matched the regular expression: 
3934
3935    { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } 
3936
3937
3938 The call to `substr` then extracts the data up to and including the match, so that the string `line` contains: 
3939
3940    { 'a', 'b', ..., 'c', '\r', '\n' } 
3941
3942
3943 After the call to `erase`, the remaining data is left in the string `data` as follows: 
3944
3945    { 'd', 'e', ... } 
3946
3947
3948 This data may be the start of a new line, to be extracted by a subsequent `async_read_until` operation. 
3949
3950
3951
3952
3953 [endsect]
3954
3955
3956
3957 [section:overload12 async_read_until (12 of 12 overloads)]
3958
3959
3960 Start an asynchronous operation to read data into a dynamic buffer sequence until a function object indicates a match. 
3961
3962
3963   template<
3964       typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
3965       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
3966       typename MatchCondition,
3967       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
3968   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until(
3969       AsyncReadStream & s,
3970       DynamicBuffer_v2 buffers,
3971       MatchCondition match_condition,
3972       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
3973       typename enable_if< is_match_condition< MatchCondition >::value &&is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
3974
3975
3976 This function is used to asynchronously read data into the specified dynamic buffer sequence until a user-defined match condition function object, when applied to the data contained in the dynamic buffer sequence, indicates a successful match. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
3977
3978
3979 * The match condition function object returns a std::pair where the second element evaluates to true.
3980
3981
3982 * An error occurred.
3983
3984 This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. If the match condition function object already indicates a match, this asynchronous operation completes immediately. The program must ensure that the stream performs no other read operations (such as async\_read, async\_read\_until, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
3985
3986
3987 [heading Parameters]
3988     
3989
3990 [variablelist
3991   
3992 [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
3993
3994 [[buffers][The dynamic buffer sequence into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
3995
3996 [[match_condition][The function object to be called to determine whether a match exists. The signature of the function object must be: 
3997 ``
3998    pair<iterator, bool> match_condition(iterator begin, iterator end);
3999 ``
4000 where `iterator` represents the type: 
4001 ``
4002    buffers_iterator<typename DynamicBuffer_v2::const_buffers_type>
4003 ``
4004 The iterator parameters `begin` and `end` define the range of bytes to be scanned to determine whether there is a match. The `first` member of the return value is an iterator marking one-past-the-end of the bytes that have been consumed by the match function. This iterator is used to calculate the `begin` parameter for any subsequent invocation of the match condition. The `second` member of the return value is true if a match has been found, false otherwise.]]
4005
4006 [[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
4007 ``
4008    void handler(
4009      // Result of operation.
4010      const boost::system::error_code& error,
4011
4012      // The number of bytes in the dynamic buffer sequence's
4013      // get area that have been fully consumed by the match
4014      // function. O if an error occurred.
4015      std::size_t bytes_transferred
4016    ); 
4017 ``
4018 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
4019
4020 ]
4021
4022
4023 [heading Remarks]
4024       
4025 After a successful async\_read\_until operation, the dynamic buffer sequence may contain additional data beyond that which matched the function object. An application will typically leave that data in the dynamic buffer sequence for a subsequent async\_read\_until operation to examine.
4026
4027 The default implementation of the `is_match_condition` type trait evaluates to true for function pointers and function objects with a `result_type` typedef. It must be specialised for other user-defined function objects.
4028
4029
4030 [heading Examples]
4031   
4032 To asynchronously read data into a `std::string` until whitespace is encountered: 
4033
4034    typedef boost::asio::buffers_iterator<
4035        boost::asio::const_buffers_1> iterator;
4036
4037    std::pair<iterator, bool>
4038    match_whitespace(iterator begin, iterator end)
4039    {
4040      iterator i = begin;
4041      while (i != end)
4042        if (std::isspace(*i++))
4043          return std::make_pair(i, true);
4044      return std::make_pair(i, false);
4045    }
4046    ...
4047    void handler(const boost::system::error_code& e, std::size_t size);
4048    ...
4049    std::string data;
4050    boost::asio::async_read_until(s, data, match_whitespace, handler);
4051
4052
4053
4054
4055 To asynchronously read data into a `std::string` until a matching character is found: 
4056
4057    class match_char
4058    {
4059    public:
4060      explicit match_char(char c) : c_(c) {}
4061
4062      template <typename Iterator>
4063      std::pair<Iterator, bool> operator()(
4064          Iterator begin, Iterator end) const
4065      {
4066        Iterator i = begin;
4067        while (i != end)
4068          if (c_ == *i++)
4069            return std::make_pair(i, true);
4070        return std::make_pair(i, false);
4071      }
4072
4073    private:
4074      char c_;
4075    };
4076
4077    namespace asio {
4078      template <> struct is_match_condition<match_char>
4079        : public boost::true_type {};
4080    } // namespace asio
4081    ...
4082    void handler(const boost::system::error_code& e, std::size_t size);
4083    ...
4084    std::string data;
4085    boost::asio::async_read_until(s, data, match_char('a'), handler);
4086
4087
4088
4089
4090
4091 [endsect]
4092
4093
4094 [endsect]
4095
4096 [section:async_result async_result]
4097
4098
4099 An interface for customising the behaviour of an initiating function. 
4100
4101
4102   template<
4103       typename CompletionToken,
4104       typename Signature>
4105   class async_result
4106
4107
4108 [heading Types]
4109 [table
4110   [[Name][Description]]
4111
4112   [
4113
4114     [[link boost_asio.reference.async_result.completion_handler_type [*completion_handler_type]]]
4115     [The concrete completion handler type for the specific signature. ]
4116   
4117   ]
4118
4119   [
4120
4121     [[link boost_asio.reference.async_result.return_type [*return_type]]]
4122     [The return type of the initiating function. ]
4123   
4124   ]
4125
4126 ]
4127
4128 [heading Member Functions]
4129 [table
4130   [[Name][Description]]
4131
4132   [
4133     [[link boost_asio.reference.async_result.async_result [*async_result]]]
4134     [Construct an async result from a given handler. ]
4135   ]
4136   
4137   [
4138     [[link boost_asio.reference.async_result.get [*get]]]
4139     [Obtain the value to be returned from the initiating function. ]
4140   ]
4141   
4142   [
4143     [[link boost_asio.reference.async_result.initiate [*initiate]]]
4144     [Initiate the asynchronous operation that will produce the result, and obtain the value to be returned from the initiating function. ]
4145   ]
4146   
4147 ]
4148
4149 The [link boost_asio.reference.async_result `async_result`] traits class is used for determining:
4150
4151
4152 * the concrete completion handler type to be called at the end of the asynchronous operation;
4153
4154
4155 * the initiating function return type; and
4156
4157
4158 * how the return value of the initiating function is obtained.
4159
4160 The trait allows the handler and return types to be determined at the point where the specific completion handler signature is known.
4161
4162 This template may be specialised for user-defined completion token types. The primary template assumes that the CompletionToken is the completion handler. 
4163
4164 [heading Requirements]
4165
4166 ['Header: ][^boost/asio/async_result.hpp]
4167
4168 ['Convenience header: ][^boost/asio.hpp]
4169
4170
4171 [section:async_result async_result::async_result]
4172
4173 [indexterm2 boost_asio.indexterm.async_result.async_result..async_result..async_result] 
4174 Construct an async result from a given handler. 
4175
4176
4177   async_result(
4178       completion_handler_type & h);
4179
4180
4181 When using a specalised [link boost_asio.reference.async_result `async_result`], the constructor has an opportunity to initialise some state associated with the completion handler, which is then returned from the initiating function. 
4182
4183
4184 [endsect]
4185
4186
4187
4188 [section:completion_handler_type async_result::completion_handler_type]
4189
4190 [indexterm2 boost_asio.indexterm.async_result.completion_handler_type..completion_handler_type..async_result] 
4191 The concrete completion handler type for the specific signature. 
4192
4193
4194   typedef CompletionToken completion_handler_type;
4195
4196
4197
4198 [heading Requirements]
4199
4200 ['Header: ][^boost/asio/async_result.hpp]
4201
4202 ['Convenience header: ][^boost/asio.hpp]
4203
4204
4205 [endsect]
4206
4207
4208
4209 [section:get async_result::get]
4210
4211 [indexterm2 boost_asio.indexterm.async_result.get..get..async_result] 
4212 Obtain the value to be returned from the initiating function. 
4213
4214
4215   return_type get();
4216
4217
4218
4219 [endsect]
4220
4221
4222
4223 [section:initiate async_result::initiate]
4224
4225 [indexterm2 boost_asio.indexterm.async_result.initiate..initiate..async_result] 
4226 Initiate the asynchronous operation that will produce the result, and obtain the value to be returned from the initiating function. 
4227
4228
4229   template<
4230       typename Initiation,
4231       typename RawCompletionToken,
4232       typename... Args>
4233   static return_type initiate(
4234       Initiation && initiation,
4235       RawCompletionToken && token,
4236       Args &&... args);
4237
4238
4239
4240 [endsect]
4241
4242
4243
4244 [section:return_type async_result::return_type]
4245
4246 [indexterm2 boost_asio.indexterm.async_result.return_type..return_type..async_result] 
4247 The return type of the initiating function. 
4248
4249
4250   typedef void return_type;
4251
4252
4253
4254 [heading Requirements]
4255
4256 ['Header: ][^boost/asio/async_result.hpp]
4257
4258 ['Convenience header: ][^boost/asio.hpp]
4259
4260
4261 [endsect]
4262
4263
4264
4265 [endsect]
4266
4267 [section:async_result_lt__std__packaged_task_lt__Result_lp_Args_ellipsis__rp__gt__comma__Signature__gt_ async_result< std::packaged_task< Result(Args...)>, Signature >]
4268
4269
4270 Partial specialisation of `async_result` for `std::packaged_task`. 
4271
4272
4273   template<
4274       typename Result,
4275       typename... Args,
4276       typename Signature>
4277   class async_result< std::packaged_task< Result(Args...)>, Signature >
4278
4279
4280 [heading Types]
4281 [table
4282   [[Name][Description]]
4283
4284   [
4285
4286     [[link boost_asio.reference.async_result_lt__std__packaged_task_lt__Result_lp_Args_ellipsis__rp__gt__comma__Signature__gt_.completion_handler_type [*completion_handler_type]]]
4287     [The packaged task is the concrete completion handler type. ]
4288   
4289   ]
4290
4291   [
4292
4293     [[link boost_asio.reference.async_result_lt__std__packaged_task_lt__Result_lp_Args_ellipsis__rp__gt__comma__Signature__gt_.return_type [*return_type]]]
4294     [The return type of the initiating function is the future obtained from the packaged task. ]
4295   
4296   ]
4297
4298 ]
4299
4300 [heading Member Functions]
4301 [table
4302   [[Name][Description]]
4303
4304   [
4305     [[link boost_asio.reference.async_result_lt__std__packaged_task_lt__Result_lp_Args_ellipsis__rp__gt__comma__Signature__gt_.async_result [*async_result]]]
4306     [The constructor extracts the future from the packaged task. ]
4307   ]
4308   
4309   [
4310     [[link boost_asio.reference.async_result_lt__std__packaged_task_lt__Result_lp_Args_ellipsis__rp__gt__comma__Signature__gt_.get [*get]]]
4311     [Returns the packaged task's future. ]
4312   ]
4313   
4314 ]
4315
4316 [heading Requirements]
4317
4318 ['Header: ][^boost/asio/packaged_task.hpp]
4319
4320 ['Convenience header: ][^boost/asio.hpp]
4321
4322
4323 [section:async_result async_result< std::packaged_task< Result(Args...)>, Signature >::async_result]
4324
4325 [indexterm2 boost_asio.indexterm.async_result_lt__std__packaged_task_lt__Result_lp_Args_ellipsis__rp__gt__comma__Signature__gt_.async_result..async_result..async_result< std::packaged_task< Result(Args\.\.\.)>, Signature >] 
4326 The constructor extracts the future from the packaged task. 
4327
4328
4329   async_result(
4330       completion_handler_type & h);
4331
4332
4333
4334 [endsect]
4335
4336
4337
4338 [section:completion_handler_type async_result< std::packaged_task< Result(Args...)>, Signature >::completion_handler_type]
4339
4340 [indexterm2 boost_asio.indexterm.async_result_lt__std__packaged_task_lt__Result_lp_Args_ellipsis__rp__gt__comma__Signature__gt_.completion_handler_type..completion_handler_type..async_result< std::packaged_task< Result(Args\.\.\.)>, Signature >] 
4341 The packaged task is the concrete completion handler type. 
4342
4343
4344   typedef std::packaged_task< Result(Args...)> completion_handler_type;
4345
4346
4347
4348 [heading Requirements]
4349
4350 ['Header: ][^boost/asio/packaged_task.hpp]
4351
4352 ['Convenience header: ][^boost/asio.hpp]
4353
4354
4355 [endsect]
4356
4357
4358
4359 [section:get async_result< std::packaged_task< Result(Args...)>, Signature >::get]
4360
4361 [indexterm2 boost_asio.indexterm.async_result_lt__std__packaged_task_lt__Result_lp_Args_ellipsis__rp__gt__comma__Signature__gt_.get..get..async_result< std::packaged_task< Result(Args\.\.\.)>, Signature >] 
4362 Returns the packaged task's future. 
4363
4364
4365   return_type get();
4366
4367
4368
4369 [endsect]
4370
4371
4372
4373 [section:return_type async_result< std::packaged_task< Result(Args...)>, Signature >::return_type]
4374
4375 [indexterm2 boost_asio.indexterm.async_result_lt__std__packaged_task_lt__Result_lp_Args_ellipsis__rp__gt__comma__Signature__gt_.return_type..return_type..async_result< std::packaged_task< Result(Args\.\.\.)>, Signature >] 
4376 The return type of the initiating function is the future obtained from the packaged task. 
4377
4378
4379   typedef std::future< Result > return_type;
4380
4381
4382
4383 [heading Requirements]
4384
4385 ['Header: ][^boost/asio/packaged_task.hpp]
4386
4387 ['Convenience header: ][^boost/asio.hpp]
4388
4389
4390 [endsect]
4391
4392
4393
4394 [endsect]
4395
4396 [section:async_write async_write]
4397
4398 [indexterm1 boost_asio.indexterm.async_write..async_write] 
4399 The `async_write` function is a composed asynchronous operation that writes a certain amount of data to a stream before completion. 
4400
4401
4402 Start an asynchronous operation to write all of the supplied data to a stream. 
4403
4404   template<
4405       typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``,
4406       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
4407       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
4408   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write.overload1 async_write]``(
4409       AsyncWriteStream & s,
4410       const ConstBufferSequence & buffers,
4411       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
4412       typename enable_if< is_const_buffer_sequence< ConstBufferSequence >::value >::type *  = 0);
4413   ``  [''''&raquo;''' [link boost_asio.reference.async_write.overload1 more...]]``
4414
4415 Start an asynchronous operation to write a certain amount of data to a stream. 
4416
4417   template<
4418       typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``,
4419       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
4420       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
4421       typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
4422   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write.overload2 async_write]``(
4423       AsyncWriteStream & s,
4424       const ConstBufferSequence & buffers,
4425       CompletionCondition completion_condition,
4426       WriteHandler && handler,
4427       typename enable_if< is_const_buffer_sequence< ConstBufferSequence >::value >::type *  = 0);
4428   ``  [''''&raquo;''' [link boost_asio.reference.async_write.overload2 more...]]``
4429
4430 Start an asynchronous operation to write all of the supplied data to a stream. 
4431
4432   template<
4433       typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``,
4434       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
4435       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
4436   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write.overload3 async_write]``(
4437       AsyncWriteStream & s,
4438       DynamicBuffer_v1 && buffers,
4439       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
4440       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
4441   ``  [''''&raquo;''' [link boost_asio.reference.async_write.overload3 more...]]``
4442
4443 Start an asynchronous operation to write a certain amount of data to a stream. 
4444
4445   template<
4446       typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``,
4447       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
4448       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
4449       typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
4450   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write.overload4 async_write]``(
4451       AsyncWriteStream & s,
4452       DynamicBuffer_v1 && buffers,
4453       CompletionCondition completion_condition,
4454       WriteHandler && handler,
4455       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
4456   ``  [''''&raquo;''' [link boost_asio.reference.async_write.overload4 more...]]``
4457
4458 Start an asynchronous operation to write all of the supplied data to a stream. 
4459
4460   template<
4461       typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``,
4462       typename Allocator,
4463       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
4464   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write.overload5 async_write]``(
4465       AsyncWriteStream & s,
4466       basic_streambuf< Allocator > & b,
4467       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
4468   ``  [''''&raquo;''' [link boost_asio.reference.async_write.overload5 more...]]``
4469
4470 Start an asynchronous operation to write a certain amount of data to a stream. 
4471
4472   template<
4473       typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``,
4474       typename Allocator,
4475       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
4476       typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
4477   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write.overload6 async_write]``(
4478       AsyncWriteStream & s,
4479       basic_streambuf< Allocator > & b,
4480       CompletionCondition completion_condition,
4481       WriteHandler && handler);
4482   ``  [''''&raquo;''' [link boost_asio.reference.async_write.overload6 more...]]``
4483
4484 Start an asynchronous operation to write all of the supplied data to a stream. 
4485
4486   template<
4487       typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``,
4488       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
4489       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
4490   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write.overload7 async_write]``(
4491       AsyncWriteStream & s,
4492       DynamicBuffer_v2 buffers,
4493       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
4494       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
4495   ``  [''''&raquo;''' [link boost_asio.reference.async_write.overload7 more...]]``
4496
4497 Start an asynchronous operation to write a certain amount of data to a stream. 
4498
4499   template<
4500       typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``,
4501       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
4502       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
4503       typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
4504   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write.overload8 async_write]``(
4505       AsyncWriteStream & s,
4506       DynamicBuffer_v2 buffers,
4507       CompletionCondition completion_condition,
4508       WriteHandler && handler,
4509       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
4510   ``  [''''&raquo;''' [link boost_asio.reference.async_write.overload8 more...]]``
4511
4512 [heading Requirements]
4513
4514 ['Header: ][^boost/asio/write.hpp]
4515
4516 ['Convenience header: ][^boost/asio.hpp]
4517
4518
4519 [section:overload1 async_write (1 of 8 overloads)]
4520
4521
4522 Start an asynchronous operation to write all of the supplied data to a stream. 
4523
4524
4525   template<
4526       typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``,
4527       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
4528       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
4529   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write(
4530       AsyncWriteStream & s,
4531       const ConstBufferSequence & buffers,
4532       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
4533       typename enable_if< is_const_buffer_sequence< ConstBufferSequence >::value >::type *  = 0);
4534
4535
4536 This function is used to asynchronously write a certain number of bytes of data to a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
4537
4538
4539 * All of the data in the supplied buffers has been written. That is, the bytes transferred is equal to the sum of the buffer sizes.
4540
4541
4542 * An error occurred.
4543
4544 This operation is implemented in terms of zero or more calls to the stream's async\_write\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other write operations (such as async\_write, the stream's async\_write\_some function, or any other composed operations that perform writes) until this operation completes.
4545
4546
4547 [heading Parameters]
4548     
4549
4550 [variablelist
4551   
4552 [[s][The stream to which the data is to be written. The type must support the AsyncWriteStream concept.]]
4553
4554 [[buffers][One or more buffers containing the data to be written. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
4555
4556 [[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
4557 ``
4558    void handler(
4559      const boost::system::error_code& error, // Result of operation.
4560
4561      std::size_t bytes_transferred           // Number of bytes written from the
4562                                              // buffers. If an error occurred,
4563                                              // this will be less than the sum
4564                                              // of the buffer sizes.
4565    ); 
4566 ``
4567 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
4568
4569 ]
4570
4571
4572 [heading Example]
4573   
4574 To write a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
4575
4576    boost::asio::async_write(s, boost::asio::buffer(data, size), handler);
4577
4578
4579 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
4580
4581
4582
4583
4584 [endsect]
4585
4586
4587
4588 [section:overload2 async_write (2 of 8 overloads)]
4589
4590
4591 Start an asynchronous operation to write a certain amount of data to a stream. 
4592
4593
4594   template<
4595       typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``,
4596       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
4597       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
4598       typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
4599   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write(
4600       AsyncWriteStream & s,
4601       const ConstBufferSequence & buffers,
4602       CompletionCondition completion_condition,
4603       WriteHandler && handler,
4604       typename enable_if< is_const_buffer_sequence< ConstBufferSequence >::value >::type *  = 0);
4605
4606
4607 This function is used to asynchronously write a certain number of bytes of data to a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
4608
4609
4610 * All of the data in the supplied buffers has been written. That is, the bytes transferred is equal to the sum of the buffer sizes.
4611
4612
4613 * The completion\_condition function object returns 0.
4614
4615 This operation is implemented in terms of zero or more calls to the stream's async\_write\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other write operations (such as async\_write, the stream's async\_write\_some function, or any other composed operations that perform writes) until this operation completes.
4616
4617
4618 [heading Parameters]
4619     
4620
4621 [variablelist
4622   
4623 [[s][The stream to which the data is to be written. The type must support the AsyncWriteStream concept.]]
4624
4625 [[buffers][One or more buffers containing the data to be written. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
4626
4627 [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 
4628 ``
4629    std::size_t completion_condition(
4630      // Result of latest async_write_some operation.
4631      const boost::system::error_code& error,
4632
4633      // Number of bytes transferred so far.
4634      std::size_t bytes_transferred
4635    ); 
4636 ``
4637 A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the stream's async\_write\_some function.]]
4638
4639 [[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
4640 ``
4641    void handler(
4642      const boost::system::error_code& error, // Result of operation.
4643
4644      std::size_t bytes_transferred           // Number of bytes written from the
4645                                              // buffers. If an error occurred,
4646                                              // this will be less than the sum
4647                                              // of the buffer sizes.
4648    ); 
4649 ``
4650 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
4651
4652 ]
4653
4654
4655 [heading Example]
4656   
4657 To write a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
4658
4659    boost::asio::async_write(s,
4660        boost::asio::buffer(data, size),
4661        boost::asio::transfer_at_least(32),
4662        handler); 
4663
4664
4665 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
4666
4667
4668
4669
4670 [endsect]
4671
4672
4673
4674 [section:overload3 async_write (3 of 8 overloads)]
4675
4676
4677 Start an asynchronous operation to write all of the supplied data to a stream. 
4678
4679
4680   template<
4681       typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``,
4682       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
4683       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
4684   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write(
4685       AsyncWriteStream & s,
4686       DynamicBuffer_v1 && buffers,
4687       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
4688       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
4689
4690
4691 This function is used to asynchronously write a certain number of bytes of data to a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
4692
4693
4694 * All of the data in the supplied dynamic buffer sequence has been written.
4695
4696
4697 * An error occurred.
4698
4699 This operation is implemented in terms of zero or more calls to the stream's async\_write\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other write operations (such as async\_write, the stream's async\_write\_some function, or any other composed operations that perform writes) until this operation completes.
4700
4701
4702 [heading Parameters]
4703     
4704
4705 [variablelist
4706   
4707 [[s][The stream to which the data is to be written. The type must support the AsyncWriteStream concept.]]
4708
4709 [[buffers][The dynamic buffer sequence from which data will be written. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called. Successfully written data is automatically consumed from the buffers.]]
4710
4711 [[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
4712 ``
4713    void handler(
4714      const boost::system::error_code& error, // Result of operation.
4715
4716      std::size_t bytes_transferred           // Number of bytes written from the
4717                                              // buffers. If an error occurred,
4718                                              // this will be less than the sum
4719                                              // of the buffer sizes.
4720    ); 
4721 ``
4722 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
4723
4724 ]
4725
4726
4727
4728
4729 [endsect]
4730
4731
4732
4733 [section:overload4 async_write (4 of 8 overloads)]
4734
4735
4736 Start an asynchronous operation to write a certain amount of data to a stream. 
4737
4738
4739   template<
4740       typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``,
4741       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
4742       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
4743       typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
4744   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write(
4745       AsyncWriteStream & s,
4746       DynamicBuffer_v1 && buffers,
4747       CompletionCondition completion_condition,
4748       WriteHandler && handler,
4749       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
4750
4751
4752 This function is used to asynchronously write a certain number of bytes of data to a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
4753
4754
4755 * All of the data in the supplied dynamic buffer sequence has been written.
4756
4757
4758 * The completion\_condition function object returns 0.
4759
4760 This operation is implemented in terms of zero or more calls to the stream's async\_write\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other write operations (such as async\_write, the stream's async\_write\_some function, or any other composed operations that perform writes) until this operation completes.
4761
4762
4763 [heading Parameters]
4764     
4765
4766 [variablelist
4767   
4768 [[s][The stream to which the data is to be written. The type must support the AsyncWriteStream concept.]]
4769
4770 [[buffers][The dynamic buffer sequence from which data will be written. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called. Successfully written data is automatically consumed from the buffers.]]
4771
4772 [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 
4773 ``
4774    std::size_t completion_condition(
4775      // Result of latest async_write_some operation.
4776      const boost::system::error_code& error,
4777
4778      // Number of bytes transferred so far.
4779      std::size_t bytes_transferred
4780    ); 
4781 ``
4782 A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the stream's async\_write\_some function.]]
4783
4784 [[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
4785 ``
4786    void handler(
4787      const boost::system::error_code& error, // Result of operation.
4788
4789      std::size_t bytes_transferred           // Number of bytes written from the
4790                                              // buffers. If an error occurred,
4791                                              // this will be less than the sum
4792                                              // of the buffer sizes.
4793    ); 
4794 ``
4795 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
4796
4797 ]
4798
4799
4800
4801
4802 [endsect]
4803
4804
4805
4806 [section:overload5 async_write (5 of 8 overloads)]
4807
4808
4809 Start an asynchronous operation to write all of the supplied data to a stream. 
4810
4811
4812   template<
4813       typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``,
4814       typename Allocator,
4815       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
4816   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write(
4817       AsyncWriteStream & s,
4818       basic_streambuf< Allocator > & b,
4819       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
4820
4821
4822 This function is used to asynchronously write a certain number of bytes of data to a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
4823
4824
4825 * All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written.
4826
4827
4828 * An error occurred.
4829
4830 This operation is implemented in terms of zero or more calls to the stream's async\_write\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other write operations (such as async\_write, the stream's async\_write\_some function, or any other composed operations that perform writes) until this operation completes.
4831
4832
4833 [heading Parameters]
4834     
4835
4836 [variablelist
4837   
4838 [[s][The stream to which the data is to be written. The type must support the AsyncWriteStream concept.]]
4839
4840 [[b][A [link boost_asio.reference.basic_streambuf `basic_streambuf`] object from which data will be written. Ownership of the streambuf is retained by the caller, which must guarantee that it remains valid until the handler is called.]]
4841
4842 [[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
4843 ``
4844    void handler(
4845      const boost::system::error_code& error, // Result of operation.
4846
4847      std::size_t bytes_transferred           // Number of bytes written from the
4848                                              // buffers. If an error occurred,
4849                                              // this will be less than the sum
4850                                              // of the buffer sizes.
4851    ); 
4852 ``
4853 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
4854
4855 ]
4856
4857
4858
4859
4860 [endsect]
4861
4862
4863
4864 [section:overload6 async_write (6 of 8 overloads)]
4865
4866
4867 Start an asynchronous operation to write a certain amount of data to a stream. 
4868
4869
4870   template<
4871       typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``,
4872       typename Allocator,
4873       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
4874       typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
4875   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write(
4876       AsyncWriteStream & s,
4877       basic_streambuf< Allocator > & b,
4878       CompletionCondition completion_condition,
4879       WriteHandler && handler);
4880
4881
4882 This function is used to asynchronously write a certain number of bytes of data to a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
4883
4884
4885 * All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written.
4886
4887
4888 * The completion\_condition function object returns 0.
4889
4890 This operation is implemented in terms of zero or more calls to the stream's async\_write\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other write operations (such as async\_write, the stream's async\_write\_some function, or any other composed operations that perform writes) until this operation completes.
4891
4892
4893 [heading Parameters]
4894     
4895
4896 [variablelist
4897   
4898 [[s][The stream to which the data is to be written. The type must support the AsyncWriteStream concept.]]
4899
4900 [[b][A [link boost_asio.reference.basic_streambuf `basic_streambuf`] object from which data will be written. Ownership of the streambuf is retained by the caller, which must guarantee that it remains valid until the handler is called.]]
4901
4902 [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 
4903 ``
4904    std::size_t completion_condition(
4905      // Result of latest async_write_some operation.
4906      const boost::system::error_code& error,
4907
4908      // Number of bytes transferred so far.
4909      std::size_t bytes_transferred
4910    ); 
4911 ``
4912 A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the stream's async\_write\_some function.]]
4913
4914 [[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
4915 ``
4916    void handler(
4917      const boost::system::error_code& error, // Result of operation.
4918
4919      std::size_t bytes_transferred           // Number of bytes written from the
4920                                              // buffers. If an error occurred,
4921                                              // this will be less than the sum
4922                                              // of the buffer sizes.
4923    ); 
4924 ``
4925 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
4926
4927 ]
4928
4929
4930
4931
4932 [endsect]
4933
4934
4935
4936 [section:overload7 async_write (7 of 8 overloads)]
4937
4938
4939 Start an asynchronous operation to write all of the supplied data to a stream. 
4940
4941
4942   template<
4943       typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``,
4944       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
4945       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
4946   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write(
4947       AsyncWriteStream & s,
4948       DynamicBuffer_v2 buffers,
4949       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
4950       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
4951
4952
4953 This function is used to asynchronously write a certain number of bytes of data to a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
4954
4955
4956 * All of the data in the supplied dynamic buffer sequence has been written.
4957
4958
4959 * An error occurred.
4960
4961 This operation is implemented in terms of zero or more calls to the stream's async\_write\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other write operations (such as async\_write, the stream's async\_write\_some function, or any other composed operations that perform writes) until this operation completes.
4962
4963
4964 [heading Parameters]
4965     
4966
4967 [variablelist
4968   
4969 [[s][The stream to which the data is to be written. The type must support the AsyncWriteStream concept.]]
4970
4971 [[buffers][The dynamic buffer sequence from which data will be written. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called. Successfully written data is automatically consumed from the buffers.]]
4972
4973 [[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
4974 ``
4975    void handler(
4976      const boost::system::error_code& error, // Result of operation.
4977
4978      std::size_t bytes_transferred           // Number of bytes written from the
4979                                              // buffers. If an error occurred,
4980                                              // this will be less than the sum
4981                                              // of the buffer sizes.
4982    ); 
4983 ``
4984 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
4985
4986 ]
4987
4988
4989
4990
4991 [endsect]
4992
4993
4994
4995 [section:overload8 async_write (8 of 8 overloads)]
4996
4997
4998 Start an asynchronous operation to write a certain amount of data to a stream. 
4999
5000
5001   template<
5002       typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``,
5003       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
5004       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
5005       typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
5006   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write(
5007       AsyncWriteStream & s,
5008       DynamicBuffer_v2 buffers,
5009       CompletionCondition completion_condition,
5010       WriteHandler && handler,
5011       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
5012
5013
5014 This function is used to asynchronously write a certain number of bytes of data to a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
5015
5016
5017 * All of the data in the supplied dynamic buffer sequence has been written.
5018
5019
5020 * The completion\_condition function object returns 0.
5021
5022 This operation is implemented in terms of zero or more calls to the stream's async\_write\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other write operations (such as async\_write, the stream's async\_write\_some function, or any other composed operations that perform writes) until this operation completes.
5023
5024
5025 [heading Parameters]
5026     
5027
5028 [variablelist
5029   
5030 [[s][The stream to which the data is to be written. The type must support the AsyncWriteStream concept.]]
5031
5032 [[buffers][The dynamic buffer sequence from which data will be written. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called. Successfully written data is automatically consumed from the buffers.]]
5033
5034 [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 
5035 ``
5036    std::size_t completion_condition(
5037      // Result of latest async_write_some operation.
5038      const boost::system::error_code& error,
5039
5040      // Number of bytes transferred so far.
5041      std::size_t bytes_transferred
5042    ); 
5043 ``
5044 A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the stream's async\_write\_some function.]]
5045
5046 [[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
5047 ``
5048    void handler(
5049      const boost::system::error_code& error, // Result of operation.
5050
5051      std::size_t bytes_transferred           // Number of bytes written from the
5052                                              // buffers. If an error occurred,
5053                                              // this will be less than the sum
5054                                              // of the buffer sizes.
5055    ); 
5056 ``
5057 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
5058
5059 ]
5060
5061
5062
5063
5064 [endsect]
5065
5066
5067 [endsect]
5068
5069 [section:async_write_at async_write_at]
5070
5071 [indexterm1 boost_asio.indexterm.async_write_at..async_write_at] 
5072 The `async_write_at` function is a composed asynchronous operation that writes a certain amount of data at the specified offset before completion. 
5073
5074
5075 Start an asynchronous operation to write all of the supplied data at the specified offset. 
5076
5077   template<
5078       typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``,
5079       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
5080       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
5081   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write_at.overload1 async_write_at]``(
5082       AsyncRandomAccessWriteDevice & d,
5083       uint64_t offset,
5084       const ConstBufferSequence & buffers,
5085       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
5086   ``  [''''&raquo;''' [link boost_asio.reference.async_write_at.overload1 more...]]``
5087
5088 Start an asynchronous operation to write a certain amount of data at the specified offset. 
5089
5090   template<
5091       typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``,
5092       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
5093       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
5094       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
5095   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write_at.overload2 async_write_at]``(
5096       AsyncRandomAccessWriteDevice & d,
5097       uint64_t offset,
5098       const ConstBufferSequence & buffers,
5099       CompletionCondition completion_condition,
5100       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
5101   ``  [''''&raquo;''' [link boost_asio.reference.async_write_at.overload2 more...]]``
5102
5103 Start an asynchronous operation to write all of the supplied data at the specified offset. 
5104
5105   template<
5106       typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``,
5107       typename Allocator,
5108       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
5109   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write_at.overload3 async_write_at]``(
5110       AsyncRandomAccessWriteDevice & d,
5111       uint64_t offset,
5112       basic_streambuf< Allocator > & b,
5113       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
5114   ``  [''''&raquo;''' [link boost_asio.reference.async_write_at.overload3 more...]]``
5115
5116 Start an asynchronous operation to write a certain amount of data at the specified offset. 
5117
5118   template<
5119       typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``,
5120       typename Allocator,
5121       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
5122       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
5123   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write_at.overload4 async_write_at]``(
5124       AsyncRandomAccessWriteDevice & d,
5125       uint64_t offset,
5126       basic_streambuf< Allocator > & b,
5127       CompletionCondition completion_condition,
5128       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
5129   ``  [''''&raquo;''' [link boost_asio.reference.async_write_at.overload4 more...]]``
5130
5131 [heading Requirements]
5132
5133 ['Header: ][^boost/asio/write_at.hpp]
5134
5135 ['Convenience header: ][^boost/asio.hpp]
5136
5137
5138 [section:overload1 async_write_at (1 of 4 overloads)]
5139
5140
5141 Start an asynchronous operation to write all of the supplied data at the specified offset. 
5142
5143
5144   template<
5145       typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``,
5146       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
5147       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
5148   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_at(
5149       AsyncRandomAccessWriteDevice & d,
5150       uint64_t offset,
5151       const ConstBufferSequence & buffers,
5152       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
5153
5154
5155 This function is used to asynchronously write a certain number of bytes of data to a random access device at a specified offset. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
5156
5157
5158 * All of the data in the supplied buffers has been written. That is, the bytes transferred is equal to the sum of the buffer sizes.
5159
5160
5161 * An error occurred.
5162
5163 This operation is implemented in terms of zero or more calls to the device's async\_write\_some\_at function, and is known as a ['composed operation]. The program must ensure that the device performs no ['overlapping] write operations (such as async\_write\_at, the device's async\_write\_some\_at function, or any other composed operations that perform writes) until this operation completes. Operations are overlapping if the regions defined by their offsets, and the numbers of bytes to write, intersect.
5164
5165
5166 [heading Parameters]
5167     
5168
5169 [variablelist
5170   
5171 [[d][The device to which the data is to be written. The type must support the AsyncRandomAccessWriteDevice concept.]]
5172
5173 [[offset][The offset at which the data will be written.]]
5174
5175 [[buffers][One or more buffers containing the data to be written. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
5176
5177 [[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
5178 ``
5179    void handler(
5180      // Result of operation.
5181      const boost::system::error_code& error,
5182
5183      // Number of bytes written from the buffers. If an error
5184      // occurred, this will be less than the sum of the buffer sizes.
5185      std::size_t bytes_transferred
5186    ); 
5187 ``
5188 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
5189
5190 ]
5191
5192
5193 [heading Example]
5194   
5195 To write a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
5196
5197    boost::asio::async_write_at(d, 42, boost::asio::buffer(data, size), handler);
5198
5199
5200 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
5201
5202
5203
5204
5205 [endsect]
5206
5207
5208
5209 [section:overload2 async_write_at (2 of 4 overloads)]
5210
5211
5212 Start an asynchronous operation to write a certain amount of data at the specified offset. 
5213
5214
5215   template<
5216       typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``,
5217       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
5218       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
5219       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
5220   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_at(
5221       AsyncRandomAccessWriteDevice & d,
5222       uint64_t offset,
5223       const ConstBufferSequence & buffers,
5224       CompletionCondition completion_condition,
5225       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
5226
5227
5228 This function is used to asynchronously write a certain number of bytes of data to a random access device at a specified offset. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
5229
5230
5231 * All of the data in the supplied buffers has been written. That is, the bytes transferred is equal to the sum of the buffer sizes.
5232
5233
5234 * The completion\_condition function object returns 0.
5235
5236 This operation is implemented in terms of zero or more calls to the device's async\_write\_some\_at function, and is known as a ['composed operation]. The program must ensure that the device performs no ['overlapping] write operations (such as async\_write\_at, the device's async\_write\_some\_at function, or any other composed operations that perform writes) until this operation completes. Operations are overlapping if the regions defined by their offsets, and the numbers of bytes to write, intersect.
5237
5238
5239 [heading Parameters]
5240     
5241
5242 [variablelist
5243   
5244 [[d][The device to which the data is to be written. The type must support the AsyncRandomAccessWriteDevice concept.]]
5245
5246 [[offset][The offset at which the data will be written.]]
5247
5248 [[buffers][One or more buffers containing the data to be written. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
5249
5250 [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 
5251 ``
5252    std::size_t completion_condition(
5253      // Result of latest async_write_some_at operation.
5254      const boost::system::error_code& error,
5255
5256      // Number of bytes transferred so far.
5257      std::size_t bytes_transferred
5258    ); 
5259 ``
5260 A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the device's async\_write\_some\_at function.]]
5261
5262 [[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
5263 ``
5264    void handler(
5265      // Result of operation.
5266      const boost::system::error_code& error,
5267
5268      // Number of bytes written from the buffers. If an error
5269      // occurred, this will be less than the sum of the buffer sizes.
5270      std::size_t bytes_transferred
5271    ); 
5272 ``
5273 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
5274
5275 ]
5276
5277
5278 [heading Example]
5279   
5280 To write a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
5281
5282    boost::asio::async_write_at(d, 42,
5283        boost::asio::buffer(data, size),
5284        boost::asio::transfer_at_least(32),
5285        handler); 
5286
5287
5288 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
5289
5290
5291
5292
5293 [endsect]
5294
5295
5296
5297 [section:overload3 async_write_at (3 of 4 overloads)]
5298
5299
5300 Start an asynchronous operation to write all of the supplied data at the specified offset. 
5301
5302
5303   template<
5304       typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``,
5305       typename Allocator,
5306       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
5307   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_at(
5308       AsyncRandomAccessWriteDevice & d,
5309       uint64_t offset,
5310       basic_streambuf< Allocator > & b,
5311       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
5312
5313
5314 This function is used to asynchronously write a certain number of bytes of data to a random access device at a specified offset. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
5315
5316
5317 * All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written.
5318
5319
5320 * An error occurred.
5321
5322 This operation is implemented in terms of zero or more calls to the device's async\_write\_some\_at function, and is known as a ['composed operation]. The program must ensure that the device performs no ['overlapping] write operations (such as async\_write\_at, the device's async\_write\_some\_at function, or any other composed operations that perform writes) until this operation completes. Operations are overlapping if the regions defined by their offsets, and the numbers of bytes to write, intersect.
5323
5324
5325 [heading Parameters]
5326     
5327
5328 [variablelist
5329   
5330 [[d][The device to which the data is to be written. The type must support the AsyncRandomAccessWriteDevice concept.]]
5331
5332 [[offset][The offset at which the data will be written.]]
5333
5334 [[b][A [link boost_asio.reference.basic_streambuf `basic_streambuf`] object from which data will be written. Ownership of the streambuf is retained by the caller, which must guarantee that it remains valid until the handler is called.]]
5335
5336 [[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
5337 ``
5338    void handler(
5339      // Result of operation.
5340      const boost::system::error_code& error,
5341
5342      // Number of bytes written from the buffers. If an error
5343      // occurred, this will be less than the sum of the buffer sizes.
5344      std::size_t bytes_transferred
5345    ); 
5346 ``
5347 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
5348
5349 ]
5350
5351
5352
5353
5354 [endsect]
5355
5356
5357
5358 [section:overload4 async_write_at (4 of 4 overloads)]
5359
5360
5361 Start an asynchronous operation to write a certain amount of data at the specified offset. 
5362
5363
5364   template<
5365       typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``,
5366       typename Allocator,
5367       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
5368       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
5369   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_at(
5370       AsyncRandomAccessWriteDevice & d,
5371       uint64_t offset,
5372       basic_streambuf< Allocator > & b,
5373       CompletionCondition completion_condition,
5374       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
5375
5376
5377 This function is used to asynchronously write a certain number of bytes of data to a random access device at a specified offset. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
5378
5379
5380 * All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written.
5381
5382
5383 * The completion\_condition function object returns 0.
5384
5385 This operation is implemented in terms of zero or more calls to the device's async\_write\_some\_at function, and is known as a ['composed operation]. The program must ensure that the device performs no ['overlapping] write operations (such as async\_write\_at, the device's async\_write\_some\_at function, or any other composed operations that perform writes) until this operation completes. Operations are overlapping if the regions defined by their offsets, and the numbers of bytes to write, intersect.
5386
5387
5388 [heading Parameters]
5389     
5390
5391 [variablelist
5392   
5393 [[d][The device to which the data is to be written. The type must support the AsyncRandomAccessWriteDevice concept.]]
5394
5395 [[offset][The offset at which the data will be written.]]
5396
5397 [[b][A [link boost_asio.reference.basic_streambuf `basic_streambuf`] object from which data will be written. Ownership of the streambuf is retained by the caller, which must guarantee that it remains valid until the handler is called.]]
5398
5399 [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 
5400 ``
5401    std::size_t completion_condition(
5402      // Result of latest async_write_some_at operation.
5403      const boost::system::error_code& error,
5404
5405      // Number of bytes transferred so far.
5406      std::size_t bytes_transferred
5407    ); 
5408 ``
5409 A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the device's async\_write\_some\_at function.]]
5410
5411 [[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
5412 ``
5413    void handler(
5414      // Result of operation.
5415      const boost::system::error_code& error,
5416
5417      // Number of bytes written from the buffers. If an error
5418      // occurred, this will be less than the sum of the buffer sizes.
5419      std::size_t bytes_transferred
5420    ); 
5421 ``
5422 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
5423
5424 ]
5425
5426
5427
5428
5429 [endsect]
5430
5431
5432 [endsect]
5433
5434 [section:awaitable awaitable]
5435
5436
5437 The return type of a coroutine or asynchronous operation. 
5438
5439
5440   template<
5441       typename T,
5442       typename ``[link boost_asio.reference.Executor1 Executor]`` = executor>
5443   class awaitable
5444
5445
5446 [heading Types]
5447 [table
5448   [[Name][Description]]
5449
5450   [
5451
5452     [[link boost_asio.reference.awaitable.executor_type [*executor_type]]]
5453     [The executor type that will be used for the coroutine. ]
5454   
5455   ]
5456
5457   [
5458
5459     [[link boost_asio.reference.awaitable.value_type [*value_type]]]
5460     [The type of the awaited value. ]
5461   
5462   ]
5463
5464 ]
5465
5466 [heading Member Functions]
5467 [table
5468   [[Name][Description]]
5469
5470   [
5471     [[link boost_asio.reference.awaitable.awaitable [*awaitable]]]
5472     [Default constructor. 
5473      [hr]
5474      Move constructor. ]
5475   ]
5476   
5477   [
5478     [[link boost_asio.reference.awaitable.valid [*valid]]]
5479     [Checks if the awaitable refers to a future result. ]
5480   ]
5481   
5482   [
5483     [[link boost_asio.reference.awaitable._awaitable [*~awaitable]]]
5484     [Destructor. ]
5485   ]
5486   
5487 ]
5488
5489 [heading Requirements]
5490
5491 ['Header: ][^boost/asio/awaitable.hpp]
5492
5493 ['Convenience header: ][^boost/asio.hpp]
5494
5495 [section:awaitable awaitable::awaitable]
5496
5497 [indexterm2 boost_asio.indexterm.awaitable.awaitable..awaitable..awaitable] 
5498 Default constructor. 
5499
5500
5501   constexpr ``[link boost_asio.reference.awaitable.awaitable.overload1 awaitable]``();
5502   ``  [''''&raquo;''' [link boost_asio.reference.awaitable.awaitable.overload1 more...]]``
5503
5504
5505 Move constructor. 
5506
5507
5508   ``[link boost_asio.reference.awaitable.awaitable.overload2 awaitable]``(
5509       awaitable && other);
5510   ``  [''''&raquo;''' [link boost_asio.reference.awaitable.awaitable.overload2 more...]]``
5511
5512
5513 [section:overload1 awaitable::awaitable (1 of 2 overloads)]
5514
5515
5516 Default constructor. 
5517
5518
5519   constexpr awaitable();
5520
5521
5522
5523 [endsect]
5524
5525
5526
5527 [section:overload2 awaitable::awaitable (2 of 2 overloads)]
5528
5529
5530 Move constructor. 
5531
5532
5533   awaitable(
5534       awaitable && other);
5535
5536
5537
5538 [endsect]
5539
5540
5541 [endsect]
5542
5543
5544 [section:executor_type awaitable::executor_type]
5545
5546 [indexterm2 boost_asio.indexterm.awaitable.executor_type..executor_type..awaitable] 
5547 The executor type that will be used for the coroutine. 
5548
5549
5550   typedef Executor executor_type;
5551
5552
5553
5554 [heading Requirements]
5555
5556 ['Header: ][^boost/asio/awaitable.hpp]
5557
5558 ['Convenience header: ][^boost/asio.hpp]
5559
5560
5561 [endsect]
5562
5563
5564
5565 [section:valid awaitable::valid]
5566
5567 [indexterm2 boost_asio.indexterm.awaitable.valid..valid..awaitable] 
5568 Checks if the awaitable refers to a future result. 
5569
5570
5571   bool valid() const;
5572
5573
5574
5575 [endsect]
5576
5577
5578
5579 [section:value_type awaitable::value_type]
5580
5581 [indexterm2 boost_asio.indexterm.awaitable.value_type..value_type..awaitable] 
5582 The type of the awaited value. 
5583
5584
5585   typedef T value_type;
5586
5587
5588
5589 [heading Requirements]
5590
5591 ['Header: ][^boost/asio/awaitable.hpp]
5592
5593 ['Convenience header: ][^boost/asio.hpp]
5594
5595
5596 [endsect]
5597
5598
5599
5600 [section:_awaitable awaitable::~awaitable]
5601
5602 [indexterm2 boost_asio.indexterm.awaitable._awaitable..~awaitable..awaitable] 
5603 Destructor. 
5604
5605
5606   ~awaitable();
5607
5608
5609
5610 [endsect]
5611
5612
5613
5614 [endsect]
5615
5616 [section:bad_executor bad_executor]
5617
5618
5619 Exception thrown when trying to access an empty polymorphic executor. 
5620
5621
5622   class bad_executor :
5623     public std::exception
5624
5625
5626 [heading Member Functions]
5627 [table
5628   [[Name][Description]]
5629
5630   [
5631     [[link boost_asio.reference.bad_executor.bad_executor [*bad_executor]]]
5632     [Constructor. ]
5633   ]
5634   
5635   [
5636     [[link boost_asio.reference.bad_executor.what [*what]]]
5637     [Obtain message associated with exception. ]
5638   ]
5639   
5640 ]
5641
5642 [heading Requirements]
5643
5644 ['Header: ][^boost/asio/executor.hpp]
5645
5646 ['Convenience header: ][^boost/asio.hpp]
5647
5648
5649 [section:bad_executor bad_executor::bad_executor]
5650
5651 [indexterm2 boost_asio.indexterm.bad_executor.bad_executor..bad_executor..bad_executor] 
5652 Constructor. 
5653
5654
5655   bad_executor();
5656
5657
5658
5659 [endsect]
5660
5661
5662
5663 [section:what bad_executor::what]
5664
5665 [indexterm2 boost_asio.indexterm.bad_executor.what..what..bad_executor] 
5666 Obtain message associated with exception. 
5667
5668
5669   virtual const char * what() const;
5670
5671
5672
5673 [endsect]
5674
5675
5676
5677 [endsect]
5678
5679 [section:basic_datagram_socket basic_datagram_socket]
5680
5681
5682 Provides datagram-oriented socket functionality. 
5683
5684
5685   template<
5686       typename ``[link boost_asio.reference.Protocol Protocol]``,
5687       typename ``[link boost_asio.reference.Executor1 Executor]``>
5688   class basic_datagram_socket :
5689     public basic_socket< Protocol, Executor >
5690
5691
5692 [heading Types]
5693 [table
5694   [[Name][Description]]
5695
5696   [
5697
5698     [[link boost_asio.reference.basic_datagram_socket__rebind_executor [*rebind_executor]]]
5699     [Rebinds the socket type to another executor. ]
5700   
5701   ]
5702
5703   [
5704
5705     [[link boost_asio.reference.basic_datagram_socket.broadcast [*broadcast]]]
5706     [Socket option to permit sending of broadcast messages. ]
5707   
5708   ]
5709
5710   [
5711
5712     [[link boost_asio.reference.basic_datagram_socket.bytes_readable [*bytes_readable]]]
5713     [IO control command to get the amount of data that can be read without blocking. ]
5714   
5715   ]
5716
5717   [
5718
5719     [[link boost_asio.reference.basic_datagram_socket.debug [*debug]]]
5720     [Socket option to enable socket-level debugging. ]
5721   
5722   ]
5723
5724   [
5725
5726     [[link boost_asio.reference.basic_datagram_socket.do_not_route [*do_not_route]]]
5727     [Socket option to prevent routing, use local interfaces only. ]
5728   
5729   ]
5730
5731   [
5732
5733     [[link boost_asio.reference.basic_datagram_socket.enable_connection_aborted [*enable_connection_aborted]]]
5734     [Socket option to report aborted connections on accept. ]
5735   
5736   ]
5737
5738   [
5739
5740     [[link boost_asio.reference.basic_datagram_socket.endpoint_type [*endpoint_type]]]
5741     [The endpoint type. ]
5742   
5743   ]
5744
5745   [
5746
5747     [[link boost_asio.reference.basic_datagram_socket.executor_type [*executor_type]]]
5748     [The type of the executor associated with the object. ]
5749   
5750   ]
5751
5752   [
5753
5754     [[link boost_asio.reference.basic_datagram_socket.keep_alive [*keep_alive]]]
5755     [Socket option to send keep-alives. ]
5756   
5757   ]
5758
5759   [
5760
5761     [[link boost_asio.reference.basic_datagram_socket.linger [*linger]]]
5762     [Socket option to specify whether the socket lingers on close if unsent data is present. ]
5763   
5764   ]
5765
5766   [
5767
5768     [[link boost_asio.reference.basic_datagram_socket.lowest_layer_type [*lowest_layer_type]]]
5769     [A basic_socket is always the lowest layer. ]
5770   
5771   ]
5772
5773   [
5774
5775     [[link boost_asio.reference.basic_datagram_socket.message_flags [*message_flags]]]
5776     [Bitmask type for flags that can be passed to send and receive operations. ]
5777   
5778   ]
5779
5780   [
5781
5782     [[link boost_asio.reference.basic_datagram_socket.native_handle_type [*native_handle_type]]]
5783     [The native representation of a socket. ]
5784   
5785   ]
5786
5787   [
5788
5789     [[link boost_asio.reference.basic_datagram_socket.out_of_band_inline [*out_of_band_inline]]]
5790     [Socket option for putting received out-of-band data inline. ]
5791   
5792   ]
5793
5794   [
5795
5796     [[link boost_asio.reference.basic_datagram_socket.protocol_type [*protocol_type]]]
5797     [The protocol type. ]
5798   
5799   ]
5800
5801   [
5802
5803     [[link boost_asio.reference.basic_datagram_socket.receive_buffer_size [*receive_buffer_size]]]
5804     [Socket option for the receive buffer size of a socket. ]
5805   
5806   ]
5807
5808   [
5809
5810     [[link boost_asio.reference.basic_datagram_socket.receive_low_watermark [*receive_low_watermark]]]
5811     [Socket option for the receive low watermark. ]
5812   
5813   ]
5814
5815   [
5816
5817     [[link boost_asio.reference.basic_datagram_socket.reuse_address [*reuse_address]]]
5818     [Socket option to allow the socket to be bound to an address that is already in use. ]
5819   
5820   ]
5821
5822   [
5823
5824     [[link boost_asio.reference.basic_datagram_socket.send_buffer_size [*send_buffer_size]]]
5825     [Socket option for the send buffer size of a socket. ]
5826   
5827   ]
5828
5829   [
5830
5831     [[link boost_asio.reference.basic_datagram_socket.send_low_watermark [*send_low_watermark]]]
5832     [Socket option for the send low watermark. ]
5833   
5834   ]
5835
5836   [
5837
5838     [[link boost_asio.reference.basic_datagram_socket.shutdown_type [*shutdown_type]]]
5839     [Different ways a socket may be shutdown. ]
5840   
5841   ]
5842
5843   [
5844
5845     [[link boost_asio.reference.basic_datagram_socket.wait_type [*wait_type]]]
5846     [Wait types. ]
5847   
5848   ]
5849
5850 ]
5851
5852 [heading Member Functions]
5853 [table
5854   [[Name][Description]]
5855
5856   [
5857     [[link boost_asio.reference.basic_datagram_socket.assign [*assign]]]
5858     [Assign an existing native socket to the socket. ]
5859   ]
5860   
5861   [
5862     [[link boost_asio.reference.basic_datagram_socket.async_connect [*async_connect]]]
5863     [Start an asynchronous connect. ]
5864   ]
5865   
5866   [
5867     [[link boost_asio.reference.basic_datagram_socket.async_receive [*async_receive]]]
5868     [Start an asynchronous receive on a connected socket. ]
5869   ]
5870   
5871   [
5872     [[link boost_asio.reference.basic_datagram_socket.async_receive_from [*async_receive_from]]]
5873     [Start an asynchronous receive. ]
5874   ]
5875   
5876   [
5877     [[link boost_asio.reference.basic_datagram_socket.async_send [*async_send]]]
5878     [Start an asynchronous send on a connected socket. ]
5879   ]
5880   
5881   [
5882     [[link boost_asio.reference.basic_datagram_socket.async_send_to [*async_send_to]]]
5883     [Start an asynchronous send. ]
5884   ]
5885   
5886   [
5887     [[link boost_asio.reference.basic_datagram_socket.async_wait [*async_wait]]]
5888     [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
5889   ]
5890   
5891   [
5892     [[link boost_asio.reference.basic_datagram_socket.at_mark [*at_mark]]]
5893     [Determine whether the socket is at the out-of-band data mark. ]
5894   ]
5895   
5896   [
5897     [[link boost_asio.reference.basic_datagram_socket.available [*available]]]
5898     [Determine the number of bytes available for reading. ]
5899   ]
5900   
5901   [
5902     [[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket [*basic_datagram_socket]]]
5903     [Construct a basic_datagram_socket without opening it. 
5904      [hr]
5905      Construct and open a basic_datagram_socket. 
5906      [hr]
5907      Construct a basic_datagram_socket, opening it and binding it to the given local endpoint. 
5908      [hr]
5909      Construct a basic_datagram_socket on an existing native socket. 
5910      [hr]
5911      Move-construct a basic_datagram_socket from another. 
5912      [hr]
5913      Move-construct a basic_datagram_socket from a socket of another protocol type. ]
5914   ]
5915   
5916   [
5917     [[link boost_asio.reference.basic_datagram_socket.bind [*bind]]]
5918     [Bind the socket to the given local endpoint. ]
5919   ]
5920   
5921   [
5922     [[link boost_asio.reference.basic_datagram_socket.cancel [*cancel]]]
5923     [Cancel all asynchronous operations associated with the socket. ]
5924   ]
5925   
5926   [
5927     [[link boost_asio.reference.basic_datagram_socket.close [*close]]]
5928     [Close the socket. ]
5929   ]
5930   
5931   [
5932     [[link boost_asio.reference.basic_datagram_socket.connect [*connect]]]
5933     [Connect the socket to the specified endpoint. ]
5934   ]
5935   
5936   [
5937     [[link boost_asio.reference.basic_datagram_socket.get_executor [*get_executor]]]
5938     [Get the executor associated with the object. ]
5939   ]
5940   
5941   [
5942     [[link boost_asio.reference.basic_datagram_socket.get_option [*get_option]]]
5943     [Get an option from the socket. ]
5944   ]
5945   
5946   [
5947     [[link boost_asio.reference.basic_datagram_socket.io_control [*io_control]]]
5948     [Perform an IO control command on the socket. ]
5949   ]
5950   
5951   [
5952     [[link boost_asio.reference.basic_datagram_socket.is_open [*is_open]]]
5953     [Determine whether the socket is open. ]
5954   ]
5955   
5956   [
5957     [[link boost_asio.reference.basic_datagram_socket.local_endpoint [*local_endpoint]]]
5958     [Get the local endpoint of the socket. ]
5959   ]
5960   
5961   [
5962     [[link boost_asio.reference.basic_datagram_socket.lowest_layer [*lowest_layer]]]
5963     [Get a reference to the lowest layer. 
5964      [hr]
5965      Get a const reference to the lowest layer. ]
5966   ]
5967   
5968   [
5969     [[link boost_asio.reference.basic_datagram_socket.native_handle [*native_handle]]]
5970     [Get the native socket representation. ]
5971   ]
5972   
5973   [
5974     [[link boost_asio.reference.basic_datagram_socket.native_non_blocking [*native_non_blocking]]]
5975     [Gets the non-blocking mode of the native socket implementation. 
5976      [hr]
5977      Sets the non-blocking mode of the native socket implementation. ]
5978   ]
5979   
5980   [
5981     [[link boost_asio.reference.basic_datagram_socket.non_blocking [*non_blocking]]]
5982     [Gets the non-blocking mode of the socket. 
5983      [hr]
5984      Sets the non-blocking mode of the socket. ]
5985   ]
5986   
5987   [
5988     [[link boost_asio.reference.basic_datagram_socket.open [*open]]]
5989     [Open the socket using the specified protocol. ]
5990   ]
5991   
5992   [
5993     [[link boost_asio.reference.basic_datagram_socket.operator_eq_ [*operator=]]]
5994     [Move-assign a basic_datagram_socket from another. 
5995      [hr]
5996      Move-assign a basic_datagram_socket from a socket of another protocol type. ]
5997   ]
5998   
5999   [
6000     [[link boost_asio.reference.basic_datagram_socket.receive [*receive]]]
6001     [Receive some data on a connected socket. ]
6002   ]
6003   
6004   [
6005     [[link boost_asio.reference.basic_datagram_socket.receive_from [*receive_from]]]
6006     [Receive a datagram with the endpoint of the sender. ]
6007   ]
6008   
6009   [
6010     [[link boost_asio.reference.basic_datagram_socket.release [*release]]]
6011     [Release ownership of the underlying native socket. ]
6012   ]
6013   
6014   [
6015     [[link boost_asio.reference.basic_datagram_socket.remote_endpoint [*remote_endpoint]]]
6016     [Get the remote endpoint of the socket. ]
6017   ]
6018   
6019   [
6020     [[link boost_asio.reference.basic_datagram_socket.send [*send]]]
6021     [Send some data on a connected socket. ]
6022   ]
6023   
6024   [
6025     [[link boost_asio.reference.basic_datagram_socket.send_to [*send_to]]]
6026     [Send a datagram to the specified endpoint. ]
6027   ]
6028   
6029   [
6030     [[link boost_asio.reference.basic_datagram_socket.set_option [*set_option]]]
6031     [Set an option on the socket. ]
6032   ]
6033   
6034   [
6035     [[link boost_asio.reference.basic_datagram_socket.shutdown [*shutdown]]]
6036     [Disable sends or receives on the socket. ]
6037   ]
6038   
6039   [
6040     [[link boost_asio.reference.basic_datagram_socket.wait [*wait]]]
6041     [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
6042   ]
6043   
6044   [
6045     [[link boost_asio.reference.basic_datagram_socket._basic_datagram_socket [*~basic_datagram_socket]]]
6046     [Destroys the socket. ]
6047   ]
6048   
6049 ]
6050
6051 [heading Data Members]
6052 [table
6053   [[Name][Description]]
6054
6055   [
6056     [[link boost_asio.reference.basic_datagram_socket.max_connections [*max_connections]]]
6057     [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
6058   ]
6059
6060   [
6061     [[link boost_asio.reference.basic_datagram_socket.max_listen_connections [*max_listen_connections]]]
6062     [The maximum length of the queue of pending incoming connections. ]
6063   ]
6064
6065   [
6066     [[link boost_asio.reference.basic_datagram_socket.message_do_not_route [*message_do_not_route]]]
6067     [Specify that the data should not be subject to routing. ]
6068   ]
6069
6070   [
6071     [[link boost_asio.reference.basic_datagram_socket.message_end_of_record [*message_end_of_record]]]
6072     [Specifies that the data marks the end of a record. ]
6073   ]
6074
6075   [
6076     [[link boost_asio.reference.basic_datagram_socket.message_out_of_band [*message_out_of_band]]]
6077     [Process out-of-band data. ]
6078   ]
6079
6080   [
6081     [[link boost_asio.reference.basic_datagram_socket.message_peek [*message_peek]]]
6082     [Peek at incoming data without removing it from the input queue. ]
6083   ]
6084
6085 ]
6086
6087 [heading Protected Data Members]
6088 [table
6089   [[Name][Description]]
6090
6091   [
6092     [[link boost_asio.reference.basic_datagram_socket.impl_ [*impl_]]]
6093     []
6094   ]
6095
6096 ]
6097
6098 The [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] class template provides asynchronous and blocking datagram-oriented socket functionality.
6099
6100
6101 [heading Thread Safety]
6102   
6103 ['Distinct] ['objects:] Safe.
6104
6105 ['Shared] ['objects:] Unsafe. 
6106
6107
6108
6109 [heading Requirements]
6110
6111 ['Header: ][^boost/asio/basic_datagram_socket.hpp]
6112
6113 ['Convenience header: ][^boost/asio.hpp]
6114
6115 [section:assign basic_datagram_socket::assign]
6116
6117 [indexterm2 boost_asio.indexterm.basic_datagram_socket.assign..assign..basic_datagram_socket] 
6118 Assign an existing native socket to the socket. 
6119
6120
6121   void ``[link boost_asio.reference.basic_datagram_socket.assign.overload1 assign]``(
6122       const protocol_type & protocol,
6123       const native_handle_type & native_socket);
6124   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.assign.overload1 more...]]``
6125
6126   void ``[link boost_asio.reference.basic_datagram_socket.assign.overload2 assign]``(
6127       const protocol_type & protocol,
6128       const native_handle_type & native_socket,
6129       boost::system::error_code & ec);
6130   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.assign.overload2 more...]]``
6131
6132
6133 [section:overload1 basic_datagram_socket::assign (1 of 2 overloads)]
6134
6135
6136 ['Inherited from basic_socket.]
6137
6138
6139 Assign an existing native socket to the socket. 
6140
6141
6142   void assign(
6143       const protocol_type & protocol,
6144       const native_handle_type & native_socket);
6145
6146
6147
6148 [endsect]
6149
6150
6151
6152 [section:overload2 basic_datagram_socket::assign (2 of 2 overloads)]
6153
6154
6155 ['Inherited from basic_socket.]
6156
6157
6158 Assign an existing native socket to the socket. 
6159
6160
6161   void assign(
6162       const protocol_type & protocol,
6163       const native_handle_type & native_socket,
6164       boost::system::error_code & ec);
6165
6166
6167
6168 [endsect]
6169
6170
6171 [endsect]
6172
6173
6174 [section:async_connect basic_datagram_socket::async_connect]
6175
6176
6177 ['Inherited from basic_socket.]
6178
6179 [indexterm2 boost_asio.indexterm.basic_datagram_socket.async_connect..async_connect..basic_datagram_socket] 
6180 Start an asynchronous connect. 
6181
6182
6183   template<
6184       typename ``[link boost_asio.reference.ConnectHandler ConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
6185   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect(
6186       const endpoint_type & peer_endpoint,
6187       ConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
6188
6189
6190 This function is used to asynchronously connect a socket to the specified remote endpoint. The function call always returns immediately.
6191
6192 The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
6193
6194
6195 [heading Parameters]
6196     
6197
6198 [variablelist
6199   
6200 [[peer_endpoint][The remote endpoint to which the socket will be connected. Copies will be made of the endpoint object as required.]]
6201
6202 [[handler][The handler to be called when the connection operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
6203 ``
6204    void handler(
6205      const boost::system::error_code& error // Result of operation
6206    ); 
6207 ``
6208 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
6209
6210 ]
6211
6212
6213 [heading Example]
6214   
6215
6216
6217    void connect_handler(const boost::system::error_code& error)
6218    {
6219      if (!error)
6220      {
6221        // Connect succeeded.
6222      }
6223    }
6224
6225    ...
6226
6227    boost::asio::ip::tcp::socket socket(my_context);
6228    boost::asio::ip::tcp::endpoint endpoint(
6229        boost::asio::ip::address::from_string("1.2.3.4"), 12345);
6230    socket.async_connect(endpoint, connect_handler);
6231
6232
6233
6234
6235
6236
6237
6238 [endsect]
6239
6240
6241 [section:async_receive basic_datagram_socket::async_receive]
6242
6243 [indexterm2 boost_asio.indexterm.basic_datagram_socket.async_receive..async_receive..basic_datagram_socket] 
6244 Start an asynchronous receive on a connected socket. 
6245
6246
6247   template<
6248       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
6249       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
6250   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_datagram_socket.async_receive.overload1 async_receive]``(
6251       const MutableBufferSequence & buffers,
6252       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
6253   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.async_receive.overload1 more...]]``
6254
6255   template<
6256       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
6257       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
6258   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_datagram_socket.async_receive.overload2 async_receive]``(
6259       const MutableBufferSequence & buffers,
6260       socket_base::message_flags flags,
6261       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
6262   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.async_receive.overload2 more...]]``
6263
6264
6265 [section:overload1 basic_datagram_socket::async_receive (1 of 2 overloads)]
6266
6267
6268 Start an asynchronous receive on a connected socket. 
6269
6270
6271   template<
6272       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
6273       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
6274   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive(
6275       const MutableBufferSequence & buffers,
6276       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
6277
6278
6279 This function is used to asynchronously receive data from the datagram socket. The function call always returns immediately.
6280
6281
6282 [heading Parameters]
6283     
6284
6285 [variablelist
6286   
6287 [[buffers][One or more buffers into which the data will be received. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
6288
6289 [[handler][The handler to be called when the receive operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
6290 ``
6291    void handler(
6292      const boost::system::error_code& error, // Result of operation.
6293      std::size_t bytes_transferred           // Number of bytes received.
6294    ); 
6295 ``
6296 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
6297
6298 ]
6299
6300
6301 [heading Remarks]
6302       
6303 The async\_receive operation can only be used with a connected socket. Use the async\_receive\_from function to receive data on an unconnected datagram socket.
6304
6305
6306 [heading Example]
6307   
6308 To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
6309
6310    socket.async_receive(boost::asio::buffer(data, size), handler);
6311
6312
6313 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
6314
6315
6316
6317
6318 [endsect]
6319
6320
6321
6322 [section:overload2 basic_datagram_socket::async_receive (2 of 2 overloads)]
6323
6324
6325 Start an asynchronous receive on a connected socket. 
6326
6327
6328   template<
6329       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
6330       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
6331   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive(
6332       const MutableBufferSequence & buffers,
6333       socket_base::message_flags flags,
6334       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
6335
6336
6337 This function is used to asynchronously receive data from the datagram socket. The function call always returns immediately.
6338
6339
6340 [heading Parameters]
6341     
6342
6343 [variablelist
6344   
6345 [[buffers][One or more buffers into which the data will be received. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
6346
6347 [[flags][Flags specifying how the receive call is to be made.]]
6348
6349 [[handler][The handler to be called when the receive operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
6350 ``
6351    void handler(
6352      const boost::system::error_code& error, // Result of operation.
6353      std::size_t bytes_transferred           // Number of bytes received.
6354    ); 
6355 ``
6356 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
6357
6358 ]
6359
6360
6361 [heading Remarks]
6362       
6363 The async\_receive operation can only be used with a connected socket. Use the async\_receive\_from function to receive data on an unconnected datagram socket. 
6364
6365
6366
6367
6368 [endsect]
6369
6370
6371 [endsect]
6372
6373 [section:async_receive_from basic_datagram_socket::async_receive_from]
6374
6375 [indexterm2 boost_asio.indexterm.basic_datagram_socket.async_receive_from..async_receive_from..basic_datagram_socket] 
6376 Start an asynchronous receive. 
6377
6378
6379   template<
6380       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
6381       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
6382   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_datagram_socket.async_receive_from.overload1 async_receive_from]``(
6383       const MutableBufferSequence & buffers,
6384       endpoint_type & sender_endpoint,
6385       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
6386   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.async_receive_from.overload1 more...]]``
6387
6388   template<
6389       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
6390       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
6391   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_datagram_socket.async_receive_from.overload2 async_receive_from]``(
6392       const MutableBufferSequence & buffers,
6393       endpoint_type & sender_endpoint,
6394       socket_base::message_flags flags,
6395       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
6396   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.async_receive_from.overload2 more...]]``
6397
6398
6399 [section:overload1 basic_datagram_socket::async_receive_from (1 of 2 overloads)]
6400
6401
6402 Start an asynchronous receive. 
6403
6404
6405   template<
6406       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
6407       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
6408   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive_from(
6409       const MutableBufferSequence & buffers,
6410       endpoint_type & sender_endpoint,
6411       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
6412
6413
6414 This function is used to asynchronously receive a datagram. The function call always returns immediately.
6415
6416
6417 [heading Parameters]
6418     
6419
6420 [variablelist
6421   
6422 [[buffers][One or more buffers into which the data will be received. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
6423
6424 [[sender_endpoint][An endpoint object that receives the endpoint of the remote sender of the datagram. Ownership of the sender\_endpoint object is retained by the caller, which must guarantee that it is valid until the handler is called.]]
6425
6426 [[handler][The handler to be called when the receive operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
6427 ``
6428    void handler(
6429      const boost::system::error_code& error, // Result of operation.
6430      std::size_t bytes_transferred           // Number of bytes received.
6431    ); 
6432 ``
6433 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
6434
6435 ]
6436
6437
6438 [heading Example]
6439   
6440 To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
6441
6442    socket.async_receive_from(
6443        boost::asio::buffer(data, size), sender_endpoint, handler); 
6444
6445
6446 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
6447
6448
6449
6450
6451 [endsect]
6452
6453
6454
6455 [section:overload2 basic_datagram_socket::async_receive_from (2 of 2 overloads)]
6456
6457
6458 Start an asynchronous receive. 
6459
6460
6461   template<
6462       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
6463       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
6464   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive_from(
6465       const MutableBufferSequence & buffers,
6466       endpoint_type & sender_endpoint,
6467       socket_base::message_flags flags,
6468       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
6469
6470
6471 This function is used to asynchronously receive a datagram. The function call always returns immediately.
6472
6473
6474 [heading Parameters]
6475     
6476
6477 [variablelist
6478   
6479 [[buffers][One or more buffers into which the data will be received. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
6480
6481 [[sender_endpoint][An endpoint object that receives the endpoint of the remote sender of the datagram. Ownership of the sender\_endpoint object is retained by the caller, which must guarantee that it is valid until the handler is called.]]
6482
6483 [[flags][Flags specifying how the receive call is to be made.]]
6484
6485 [[handler][The handler to be called when the receive operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
6486 ``
6487    void handler(
6488      const boost::system::error_code& error, // Result of operation.
6489      std::size_t bytes_transferred           // Number of bytes received.
6490    ); 
6491 ``
6492 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
6493
6494 ]
6495
6496
6497
6498
6499 [endsect]
6500
6501
6502 [endsect]
6503
6504 [section:async_send basic_datagram_socket::async_send]
6505
6506 [indexterm2 boost_asio.indexterm.basic_datagram_socket.async_send..async_send..basic_datagram_socket] 
6507 Start an asynchronous send on a connected socket. 
6508
6509
6510   template<
6511       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
6512       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
6513   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_datagram_socket.async_send.overload1 async_send]``(
6514       const ConstBufferSequence & buffers,
6515       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
6516   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.async_send.overload1 more...]]``
6517
6518   template<
6519       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
6520       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
6521   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_datagram_socket.async_send.overload2 async_send]``(
6522       const ConstBufferSequence & buffers,
6523       socket_base::message_flags flags,
6524       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
6525   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.async_send.overload2 more...]]``
6526
6527
6528 [section:overload1 basic_datagram_socket::async_send (1 of 2 overloads)]
6529
6530
6531 Start an asynchronous send on a connected socket. 
6532
6533
6534   template<
6535       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
6536       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
6537   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send(
6538       const ConstBufferSequence & buffers,
6539       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
6540
6541
6542 This function is used to asynchronously send data on the datagram socket. The function call always returns immediately.
6543
6544
6545 [heading Parameters]
6546     
6547
6548 [variablelist
6549   
6550 [[buffers][One or more data buffers to be sent on the socket. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
6551
6552 [[handler][The handler to be called when the send operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
6553 ``
6554    void handler(
6555      const boost::system::error_code& error, // Result of operation.
6556      std::size_t bytes_transferred           // Number of bytes sent.
6557    ); 
6558 ``
6559 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
6560
6561 ]
6562
6563
6564 [heading Remarks]
6565       
6566 The async\_send operation can only be used with a connected socket. Use the async\_send\_to function to send data on an unconnected datagram socket.
6567
6568
6569 [heading Example]
6570   
6571 To send a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
6572
6573    socket.async_send(boost::asio::buffer(data, size), handler);
6574
6575
6576 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
6577
6578
6579
6580
6581 [endsect]
6582
6583
6584
6585 [section:overload2 basic_datagram_socket::async_send (2 of 2 overloads)]
6586
6587
6588 Start an asynchronous send on a connected socket. 
6589
6590
6591   template<
6592       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
6593       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
6594   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send(
6595       const ConstBufferSequence & buffers,
6596       socket_base::message_flags flags,
6597       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
6598
6599
6600 This function is used to asynchronously send data on the datagram socket. The function call always returns immediately.
6601
6602
6603 [heading Parameters]
6604     
6605
6606 [variablelist
6607   
6608 [[buffers][One or more data buffers to be sent on the socket. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
6609
6610 [[flags][Flags specifying how the send call is to be made.]]
6611
6612 [[handler][The handler to be called when the send operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
6613 ``
6614    void handler(
6615      const boost::system::error_code& error, // Result of operation.
6616      std::size_t bytes_transferred           // Number of bytes sent.
6617    ); 
6618 ``
6619 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
6620
6621 ]
6622
6623
6624 [heading Remarks]
6625       
6626 The async\_send operation can only be used with a connected socket. Use the async\_send\_to function to send data on an unconnected datagram socket. 
6627
6628
6629
6630
6631 [endsect]
6632
6633
6634 [endsect]
6635
6636 [section:async_send_to basic_datagram_socket::async_send_to]
6637
6638 [indexterm2 boost_asio.indexterm.basic_datagram_socket.async_send_to..async_send_to..basic_datagram_socket] 
6639 Start an asynchronous send. 
6640
6641
6642   template<
6643       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
6644       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
6645   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_datagram_socket.async_send_to.overload1 async_send_to]``(
6646       const ConstBufferSequence & buffers,
6647       const endpoint_type & destination,
6648       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
6649   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.async_send_to.overload1 more...]]``
6650
6651   template<
6652       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
6653       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
6654   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_datagram_socket.async_send_to.overload2 async_send_to]``(
6655       const ConstBufferSequence & buffers,
6656       const endpoint_type & destination,
6657       socket_base::message_flags flags,
6658       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
6659   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.async_send_to.overload2 more...]]``
6660
6661
6662 [section:overload1 basic_datagram_socket::async_send_to (1 of 2 overloads)]
6663
6664
6665 Start an asynchronous send. 
6666
6667
6668   template<
6669       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
6670       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
6671   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send_to(
6672       const ConstBufferSequence & buffers,
6673       const endpoint_type & destination,
6674       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
6675
6676
6677 This function is used to asynchronously send a datagram to the specified remote endpoint. The function call always returns immediately.
6678
6679
6680 [heading Parameters]
6681     
6682
6683 [variablelist
6684   
6685 [[buffers][One or more data buffers to be sent to the remote endpoint. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
6686
6687 [[destination][The remote endpoint to which the data will be sent. Copies will be made of the endpoint as required.]]
6688
6689 [[handler][The handler to be called when the send operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
6690 ``
6691    void handler(
6692      const boost::system::error_code& error, // Result of operation.
6693      std::size_t bytes_transferred           // Number of bytes sent.
6694    ); 
6695 ``
6696 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
6697
6698 ]
6699
6700
6701 [heading Example]
6702   
6703 To send a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
6704
6705    boost::asio::ip::udp::endpoint destination(
6706        boost::asio::ip::address::from_string("1.2.3.4"), 12345);
6707    socket.async_send_to(
6708        boost::asio::buffer(data, size), destination, handler);
6709
6710
6711 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
6712
6713
6714
6715
6716 [endsect]
6717
6718
6719
6720 [section:overload2 basic_datagram_socket::async_send_to (2 of 2 overloads)]
6721
6722
6723 Start an asynchronous send. 
6724
6725
6726   template<
6727       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
6728       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
6729   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send_to(
6730       const ConstBufferSequence & buffers,
6731       const endpoint_type & destination,
6732       socket_base::message_flags flags,
6733       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
6734
6735
6736 This function is used to asynchronously send a datagram to the specified remote endpoint. The function call always returns immediately.
6737
6738
6739 [heading Parameters]
6740     
6741
6742 [variablelist
6743   
6744 [[buffers][One or more data buffers to be sent to the remote endpoint. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
6745
6746 [[flags][Flags specifying how the send call is to be made.]]
6747
6748 [[destination][The remote endpoint to which the data will be sent. Copies will be made of the endpoint as required.]]
6749
6750 [[handler][The handler to be called when the send operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
6751 ``
6752    void handler(
6753      const boost::system::error_code& error, // Result of operation.
6754      std::size_t bytes_transferred           // Number of bytes sent.
6755    ); 
6756 ``
6757 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
6758
6759 ]
6760
6761
6762
6763
6764 [endsect]
6765
6766
6767 [endsect]
6768
6769
6770 [section:async_wait basic_datagram_socket::async_wait]
6771
6772
6773 ['Inherited from basic_socket.]
6774
6775 [indexterm2 boost_asio.indexterm.basic_datagram_socket.async_wait..async_wait..basic_datagram_socket] 
6776 Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. 
6777
6778
6779   template<
6780       typename ``[link boost_asio.reference.WaitHandler WaitHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
6781   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait(
6782       wait_type w,
6783       WaitHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
6784
6785
6786 This function is used to perform an asynchronous wait for a socket to enter a ready to read, write or error condition state.
6787
6788
6789 [heading Parameters]
6790     
6791
6792 [variablelist
6793   
6794 [[w][Specifies the desired socket state.]]
6795
6796 [[handler][The handler to be called when the wait operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
6797 ``
6798    void handler(
6799      const boost::system::error_code& error // Result of operation
6800    ); 
6801 ``
6802 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
6803
6804 ]
6805
6806
6807 [heading Example]
6808   
6809
6810
6811    void wait_handler(const boost::system::error_code& error)
6812    {
6813      if (!error)
6814      {
6815        // Wait succeeded.
6816      }
6817    }
6818
6819    ...
6820
6821    boost::asio::ip::tcp::socket socket(my_context);
6822    ...
6823    socket.async_wait(boost::asio::ip::tcp::socket::wait_read, wait_handler);
6824
6825
6826
6827
6828
6829
6830
6831 [endsect]
6832
6833
6834 [section:at_mark basic_datagram_socket::at_mark]
6835
6836 [indexterm2 boost_asio.indexterm.basic_datagram_socket.at_mark..at_mark..basic_datagram_socket] 
6837 Determine whether the socket is at the out-of-band data mark. 
6838
6839
6840   bool ``[link boost_asio.reference.basic_datagram_socket.at_mark.overload1 at_mark]``() const;
6841   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.at_mark.overload1 more...]]``
6842
6843   bool ``[link boost_asio.reference.basic_datagram_socket.at_mark.overload2 at_mark]``(
6844       boost::system::error_code & ec) const;
6845   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.at_mark.overload2 more...]]``
6846
6847
6848 [section:overload1 basic_datagram_socket::at_mark (1 of 2 overloads)]
6849
6850
6851 ['Inherited from basic_socket.]
6852
6853
6854 Determine whether the socket is at the out-of-band data mark. 
6855
6856
6857   bool at_mark() const;
6858
6859
6860 This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
6861
6862
6863 [heading Return Value]
6864       
6865 A bool indicating whether the socket is at the out-of-band data mark.
6866
6867
6868 [heading Exceptions]
6869     
6870
6871 [variablelist
6872   
6873 [[boost::system::system_error][Thrown on failure. ]]
6874
6875 ]
6876
6877
6878
6879
6880 [endsect]
6881
6882
6883
6884 [section:overload2 basic_datagram_socket::at_mark (2 of 2 overloads)]
6885
6886
6887 ['Inherited from basic_socket.]
6888
6889
6890 Determine whether the socket is at the out-of-band data mark. 
6891
6892
6893   bool at_mark(
6894       boost::system::error_code & ec) const;
6895
6896
6897 This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
6898
6899
6900 [heading Parameters]
6901     
6902
6903 [variablelist
6904   
6905 [[ec][Set to indicate what error occurred, if any.]]
6906
6907 ]
6908
6909
6910 [heading Return Value]
6911       
6912 A bool indicating whether the socket is at the out-of-band data mark. 
6913
6914
6915
6916
6917 [endsect]
6918
6919
6920 [endsect]
6921
6922 [section:available basic_datagram_socket::available]
6923
6924 [indexterm2 boost_asio.indexterm.basic_datagram_socket.available..available..basic_datagram_socket] 
6925 Determine the number of bytes available for reading. 
6926
6927
6928   std::size_t ``[link boost_asio.reference.basic_datagram_socket.available.overload1 available]``() const;
6929   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.available.overload1 more...]]``
6930
6931   std::size_t ``[link boost_asio.reference.basic_datagram_socket.available.overload2 available]``(
6932       boost::system::error_code & ec) const;
6933   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.available.overload2 more...]]``
6934
6935
6936 [section:overload1 basic_datagram_socket::available (1 of 2 overloads)]
6937
6938
6939 ['Inherited from basic_socket.]
6940
6941
6942 Determine the number of bytes available for reading. 
6943
6944
6945   std::size_t available() const;
6946
6947
6948 This function is used to determine the number of bytes that may be read without blocking.
6949
6950
6951 [heading Return Value]
6952       
6953 The number of bytes that may be read without blocking, or 0 if an error occurs.
6954
6955
6956 [heading Exceptions]
6957     
6958
6959 [variablelist
6960   
6961 [[boost::system::system_error][Thrown on failure. ]]
6962
6963 ]
6964
6965
6966
6967
6968 [endsect]
6969
6970
6971
6972 [section:overload2 basic_datagram_socket::available (2 of 2 overloads)]
6973
6974
6975 ['Inherited from basic_socket.]
6976
6977
6978 Determine the number of bytes available for reading. 
6979
6980
6981   std::size_t available(
6982       boost::system::error_code & ec) const;
6983
6984
6985 This function is used to determine the number of bytes that may be read without blocking.
6986
6987
6988 [heading Parameters]
6989     
6990
6991 [variablelist
6992   
6993 [[ec][Set to indicate what error occurred, if any.]]
6994
6995 ]
6996
6997
6998 [heading Return Value]
6999       
7000 The number of bytes that may be read without blocking, or 0 if an error occurs. 
7001
7002
7003
7004
7005 [endsect]
7006
7007
7008 [endsect]
7009
7010 [section:basic_datagram_socket basic_datagram_socket::basic_datagram_socket]
7011
7012 [indexterm2 boost_asio.indexterm.basic_datagram_socket.basic_datagram_socket..basic_datagram_socket..basic_datagram_socket] 
7013 Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] without opening it. 
7014
7015
7016   explicit ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload1 basic_datagram_socket]``(
7017       const executor_type & ex);
7018   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload1 more...]]``
7019
7020   template<
7021       typename ExecutionContext>
7022   explicit ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload2 basic_datagram_socket]``(
7023       ExecutionContext & context,
7024       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
7025   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload2 more...]]``
7026
7027
7028 Construct and open a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`]. 
7029
7030
7031   ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload3 basic_datagram_socket]``(
7032       const executor_type & ex,
7033       const protocol_type & protocol);
7034   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload3 more...]]``
7035
7036   template<
7037       typename ExecutionContext>
7038   ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload4 basic_datagram_socket]``(
7039       ExecutionContext & context,
7040       const protocol_type & protocol,
7041       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
7042   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload4 more...]]``
7043
7044
7045 Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`], opening it and binding it to the given local endpoint. 
7046
7047
7048   ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload5 basic_datagram_socket]``(
7049       const executor_type & ex,
7050       const endpoint_type & endpoint);
7051   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload5 more...]]``
7052
7053   template<
7054       typename ExecutionContext>
7055   ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload6 basic_datagram_socket]``(
7056       ExecutionContext & context,
7057       const endpoint_type & endpoint,
7058       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
7059   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload6 more...]]``
7060
7061
7062 Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] on an existing native socket. 
7063
7064
7065   ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload7 basic_datagram_socket]``(
7066       const executor_type & ex,
7067       const protocol_type & protocol,
7068       const native_handle_type & native_socket);
7069   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload7 more...]]``
7070
7071   template<
7072       typename ExecutionContext>
7073   ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload8 basic_datagram_socket]``(
7074       ExecutionContext & context,
7075       const protocol_type & protocol,
7076       const native_handle_type & native_socket,
7077       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
7078   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload8 more...]]``
7079
7080
7081 Move-construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] from another. 
7082
7083
7084   ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload9 basic_datagram_socket]``(
7085       basic_datagram_socket && other);
7086   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload9 more...]]``
7087
7088
7089 Move-construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] from a socket of another protocol type. 
7090
7091
7092   template<
7093       typename ``[link boost_asio.reference.Protocol Protocol1]``,
7094       typename ``[link boost_asio.reference.Executor1 Executor1]``>
7095   ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload10 basic_datagram_socket]``(
7096       basic_datagram_socket< Protocol1, Executor1 > && other,
7097       typename enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type *  = 0);
7098   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload10 more...]]``
7099
7100
7101 [section:overload1 basic_datagram_socket::basic_datagram_socket (1 of 10 overloads)]
7102
7103
7104 Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] without opening it. 
7105
7106
7107   basic_datagram_socket(
7108       const executor_type & ex);
7109
7110
7111 This constructor creates a datagram socket without opening it. The `open()` function must be called before data can be sent or received on the socket.
7112
7113
7114 [heading Parameters]
7115     
7116
7117 [variablelist
7118   
7119 [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket. ]]
7120
7121 ]
7122
7123
7124
7125
7126 [endsect]
7127
7128
7129
7130 [section:overload2 basic_datagram_socket::basic_datagram_socket (2 of 10 overloads)]
7131
7132
7133 Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] without opening it. 
7134
7135
7136   template<
7137       typename ExecutionContext>
7138   basic_datagram_socket(
7139       ExecutionContext & context,
7140       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
7141
7142
7143 This constructor creates a datagram socket without opening it. The `open()` function must be called before data can be sent or received on the socket.
7144
7145
7146 [heading Parameters]
7147     
7148
7149 [variablelist
7150   
7151 [[context][An execution context which provides the I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket. ]]
7152
7153 ]
7154
7155
7156
7157
7158 [endsect]
7159
7160
7161
7162 [section:overload3 basic_datagram_socket::basic_datagram_socket (3 of 10 overloads)]
7163
7164
7165 Construct and open a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`]. 
7166
7167
7168   basic_datagram_socket(
7169       const executor_type & ex,
7170       const protocol_type & protocol);
7171
7172
7173 This constructor creates and opens a datagram socket.
7174
7175
7176 [heading Parameters]
7177     
7178
7179 [variablelist
7180   
7181 [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
7182
7183 [[protocol][An object specifying protocol parameters to be used.]]
7184
7185 ]
7186
7187
7188 [heading Exceptions]
7189     
7190
7191 [variablelist
7192   
7193 [[boost::system::system_error][Thrown on failure. ]]
7194
7195 ]
7196
7197
7198
7199
7200 [endsect]
7201
7202
7203
7204 [section:overload4 basic_datagram_socket::basic_datagram_socket (4 of 10 overloads)]
7205
7206
7207 Construct and open a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`]. 
7208
7209
7210   template<
7211       typename ExecutionContext>
7212   basic_datagram_socket(
7213       ExecutionContext & context,
7214       const protocol_type & protocol,
7215       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
7216
7217
7218 This constructor creates and opens a datagram socket.
7219
7220
7221 [heading Parameters]
7222     
7223
7224 [variablelist
7225   
7226 [[context][An execution context which provides the I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
7227
7228 [[protocol][An object specifying protocol parameters to be used.]]
7229
7230 ]
7231
7232
7233 [heading Exceptions]
7234     
7235
7236 [variablelist
7237   
7238 [[boost::system::system_error][Thrown on failure. ]]
7239
7240 ]
7241
7242
7243
7244
7245 [endsect]
7246
7247
7248
7249 [section:overload5 basic_datagram_socket::basic_datagram_socket (5 of 10 overloads)]
7250
7251
7252 Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`], opening it and binding it to the given local endpoint. 
7253
7254
7255   basic_datagram_socket(
7256       const executor_type & ex,
7257       const endpoint_type & endpoint);
7258
7259
7260 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.
7261
7262
7263 [heading Parameters]
7264     
7265
7266 [variablelist
7267   
7268 [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
7269
7270 [[endpoint][An endpoint on the local machine to which the datagram socket will be bound.]]
7271
7272 ]
7273
7274
7275 [heading Exceptions]
7276     
7277
7278 [variablelist
7279   
7280 [[boost::system::system_error][Thrown on failure. ]]
7281
7282 ]
7283
7284
7285
7286
7287 [endsect]
7288
7289
7290
7291 [section:overload6 basic_datagram_socket::basic_datagram_socket (6 of 10 overloads)]
7292
7293
7294 Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`], opening it and binding it to the given local endpoint. 
7295
7296
7297   template<
7298       typename ExecutionContext>
7299   basic_datagram_socket(
7300       ExecutionContext & context,
7301       const endpoint_type & endpoint,
7302       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
7303
7304
7305 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.
7306
7307
7308 [heading Parameters]
7309     
7310
7311 [variablelist
7312   
7313 [[context][An execution context which provides the I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
7314
7315 [[endpoint][An endpoint on the local machine to which the datagram socket will be bound.]]
7316
7317 ]
7318
7319
7320 [heading Exceptions]
7321     
7322
7323 [variablelist
7324   
7325 [[boost::system::system_error][Thrown on failure. ]]
7326
7327 ]
7328
7329
7330
7331
7332 [endsect]
7333
7334
7335
7336 [section:overload7 basic_datagram_socket::basic_datagram_socket (7 of 10 overloads)]
7337
7338
7339 Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] on an existing native socket. 
7340
7341
7342   basic_datagram_socket(
7343       const executor_type & ex,
7344       const protocol_type & protocol,
7345       const native_handle_type & native_socket);
7346
7347
7348 This constructor creates a datagram socket object to hold an existing native socket.
7349
7350
7351 [heading Parameters]
7352     
7353
7354 [variablelist
7355   
7356 [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
7357
7358 [[protocol][An object specifying protocol parameters to be used.]]
7359
7360 [[native_socket][The new underlying socket implementation.]]
7361
7362 ]
7363
7364
7365 [heading Exceptions]
7366     
7367
7368 [variablelist
7369   
7370 [[boost::system::system_error][Thrown on failure. ]]
7371
7372 ]
7373
7374
7375
7376
7377 [endsect]
7378
7379
7380
7381 [section:overload8 basic_datagram_socket::basic_datagram_socket (8 of 10 overloads)]
7382
7383
7384 Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] on an existing native socket. 
7385
7386
7387   template<
7388       typename ExecutionContext>
7389   basic_datagram_socket(
7390       ExecutionContext & context,
7391       const protocol_type & protocol,
7392       const native_handle_type & native_socket,
7393       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
7394
7395
7396 This constructor creates a datagram socket object to hold an existing native socket.
7397
7398
7399 [heading Parameters]
7400     
7401
7402 [variablelist
7403   
7404 [[context][An execution context which provides the I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
7405
7406 [[protocol][An object specifying protocol parameters to be used.]]
7407
7408 [[native_socket][The new underlying socket implementation.]]
7409
7410 ]
7411
7412
7413 [heading Exceptions]
7414     
7415
7416 [variablelist
7417   
7418 [[boost::system::system_error][Thrown on failure. ]]
7419
7420 ]
7421
7422
7423
7424
7425 [endsect]
7426
7427
7428
7429 [section:overload9 basic_datagram_socket::basic_datagram_socket (9 of 10 overloads)]
7430
7431
7432 Move-construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] from another. 
7433
7434
7435   basic_datagram_socket(
7436       basic_datagram_socket && other);
7437
7438
7439 This constructor moves a datagram socket from one object to another.
7440
7441
7442 [heading Parameters]
7443     
7444
7445 [variablelist
7446   
7447 [[other][The other [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] object from which the move will occur.]]
7448
7449 ]
7450
7451
7452 [heading Remarks]
7453       
7454 Following the move, the moved-from object is in the same state as if constructed using the `basic_datagram_socket(const executor_type&)` constructor. 
7455
7456
7457
7458
7459 [endsect]
7460
7461
7462
7463 [section:overload10 basic_datagram_socket::basic_datagram_socket (10 of 10 overloads)]
7464
7465
7466 Move-construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] from a socket of another protocol type. 
7467
7468
7469   template<
7470       typename ``[link boost_asio.reference.Protocol Protocol1]``,
7471       typename ``[link boost_asio.reference.Executor1 Executor1]``>
7472   basic_datagram_socket(
7473       basic_datagram_socket< Protocol1, Executor1 > && other,
7474       typename enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type *  = 0);
7475
7476
7477 This constructor moves a datagram socket from one object to another.
7478
7479
7480 [heading Parameters]
7481     
7482
7483 [variablelist
7484   
7485 [[other][The other [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] object from which the move will occur.]]
7486
7487 ]
7488
7489
7490 [heading Remarks]
7491       
7492 Following the move, the moved-from object is in the same state as if constructed using the `basic_datagram_socket(const executor_type&)` constructor. 
7493
7494
7495
7496
7497 [endsect]
7498
7499
7500 [endsect]
7501
7502 [section:bind basic_datagram_socket::bind]
7503
7504 [indexterm2 boost_asio.indexterm.basic_datagram_socket.bind..bind..basic_datagram_socket] 
7505 Bind the socket to the given local endpoint. 
7506
7507
7508   void ``[link boost_asio.reference.basic_datagram_socket.bind.overload1 bind]``(
7509       const endpoint_type & endpoint);
7510   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.bind.overload1 more...]]``
7511
7512   void ``[link boost_asio.reference.basic_datagram_socket.bind.overload2 bind]``(
7513       const endpoint_type & endpoint,
7514       boost::system::error_code & ec);
7515   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.bind.overload2 more...]]``
7516
7517
7518 [section:overload1 basic_datagram_socket::bind (1 of 2 overloads)]
7519
7520
7521 ['Inherited from basic_socket.]
7522
7523
7524 Bind the socket to the given local endpoint. 
7525
7526
7527   void bind(
7528       const endpoint_type & endpoint);
7529
7530
7531 This function binds the socket to the specified endpoint on the local machine.
7532
7533
7534 [heading Parameters]
7535     
7536
7537 [variablelist
7538   
7539 [[endpoint][An endpoint on the local machine to which the socket will be bound.]]
7540
7541 ]
7542
7543
7544 [heading Exceptions]
7545     
7546
7547 [variablelist
7548   
7549 [[boost::system::system_error][Thrown on failure.]]
7550
7551 ]
7552
7553
7554 [heading Example]
7555   
7556
7557
7558    boost::asio::ip::tcp::socket socket(my_context);
7559    socket.open(boost::asio::ip::tcp::v4());
7560    socket.bind(boost::asio::ip::tcp::endpoint(
7561          boost::asio::ip::tcp::v4(), 12345));
7562
7563
7564
7565
7566
7567
7568
7569 [endsect]
7570
7571
7572
7573 [section:overload2 basic_datagram_socket::bind (2 of 2 overloads)]
7574
7575
7576 ['Inherited from basic_socket.]
7577
7578
7579 Bind the socket to the given local endpoint. 
7580
7581
7582   void bind(
7583       const endpoint_type & endpoint,
7584       boost::system::error_code & ec);
7585
7586
7587 This function binds the socket to the specified endpoint on the local machine.
7588
7589
7590 [heading Parameters]
7591     
7592
7593 [variablelist
7594   
7595 [[endpoint][An endpoint on the local machine to which the socket will be bound.]]
7596
7597 [[ec][Set to indicate what error occurred, if any.]]
7598
7599 ]
7600
7601
7602 [heading Example]
7603   
7604
7605
7606    boost::asio::ip::tcp::socket socket(my_context);
7607    socket.open(boost::asio::ip::tcp::v4());
7608    boost::system::error_code ec;
7609    socket.bind(boost::asio::ip::tcp::endpoint(
7610          boost::asio::ip::tcp::v4(), 12345), ec);
7611    if (ec)
7612    {
7613      // An error occurred.
7614    }
7615
7616
7617
7618
7619
7620
7621
7622 [endsect]
7623
7624
7625 [endsect]
7626
7627
7628 [section:broadcast basic_datagram_socket::broadcast]
7629
7630
7631 ['Inherited from socket_base.]
7632
7633 [indexterm2 boost_asio.indexterm.basic_datagram_socket.broadcast..broadcast..basic_datagram_socket] 
7634 Socket option to permit sending of broadcast messages. 
7635
7636
7637   typedef implementation_defined broadcast;
7638
7639
7640
7641 Implements the SOL\_SOCKET/SO\_BROADCAST socket option.
7642
7643
7644 [heading Examples]
7645   
7646 Setting the option: 
7647
7648    boost::asio::ip::udp::socket socket(my_context);
7649    ...
7650    boost::asio::socket_base::broadcast option(true);
7651    socket.set_option(option);
7652
7653
7654
7655
7656
7657 Getting the current option value: 
7658
7659    boost::asio::ip::udp::socket socket(my_context);
7660    ...
7661    boost::asio::socket_base::broadcast option;
7662    socket.get_option(option);
7663    bool is_set = option.value();
7664
7665
7666
7667
7668
7669
7670
7671 [heading Requirements]
7672
7673 ['Header: ][^boost/asio/basic_datagram_socket.hpp]
7674
7675 ['Convenience header: ][^boost/asio.hpp]
7676
7677
7678 [endsect]
7679
7680
7681
7682 [section:bytes_readable basic_datagram_socket::bytes_readable]
7683
7684
7685 ['Inherited from socket_base.]
7686
7687 [indexterm2 boost_asio.indexterm.basic_datagram_socket.bytes_readable..bytes_readable..basic_datagram_socket] 
7688 IO control command to get the amount of data that can be read without blocking. 
7689
7690
7691   typedef implementation_defined bytes_readable;
7692
7693
7694
7695 Implements the FIONREAD IO control command.
7696
7697
7698 [heading Example]
7699   
7700
7701
7702    boost::asio::ip::tcp::socket socket(my_context);
7703    ...
7704    boost::asio::socket_base::bytes_readable command(true);
7705    socket.io_control(command);
7706    std::size_t bytes_readable = command.get();
7707
7708
7709
7710
7711
7712
7713
7714 [heading Requirements]
7715
7716 ['Header: ][^boost/asio/basic_datagram_socket.hpp]
7717
7718 ['Convenience header: ][^boost/asio.hpp]
7719
7720
7721 [endsect]
7722
7723
7724 [section:cancel basic_datagram_socket::cancel]
7725
7726 [indexterm2 boost_asio.indexterm.basic_datagram_socket.cancel..cancel..basic_datagram_socket] 
7727 Cancel all asynchronous operations associated with the socket. 
7728
7729
7730   void ``[link boost_asio.reference.basic_datagram_socket.cancel.overload1 cancel]``();
7731   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.cancel.overload1 more...]]``
7732
7733   void ``[link boost_asio.reference.basic_datagram_socket.cancel.overload2 cancel]``(
7734       boost::system::error_code & ec);
7735   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.cancel.overload2 more...]]``
7736
7737
7738 [section:overload1 basic_datagram_socket::cancel (1 of 2 overloads)]
7739
7740
7741 ['Inherited from basic_socket.]
7742
7743
7744 Cancel all asynchronous operations associated with the socket. 
7745
7746
7747   void cancel();
7748
7749
7750 This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
7751
7752
7753 [heading Exceptions]
7754     
7755
7756 [variablelist
7757   
7758 [[boost::system::system_error][Thrown on failure.]]
7759
7760 ]
7761
7762
7763 [heading Remarks]
7764       
7765 Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use:
7766
7767
7768 * It will only cancel asynchronous operations that were initiated in the current thread.
7769
7770
7771 * It can appear to complete without error, but the request to cancel the unfinished operations may be silently ignored by the operating system. Whether it works or not seems to depend on the drivers that are installed.
7772
7773 For portable cancellation, consider using one of the following alternatives:
7774
7775
7776 * Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP.
7777
7778
7779 * Use the `close()` function to simultaneously cancel the outstanding operations and close the socket.
7780
7781 When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above. 
7782
7783
7784 [endsect]
7785
7786
7787
7788 [section:overload2 basic_datagram_socket::cancel (2 of 2 overloads)]
7789
7790
7791 ['Inherited from basic_socket.]
7792
7793
7794 Cancel all asynchronous operations associated with the socket. 
7795
7796
7797   void cancel(
7798       boost::system::error_code & ec);
7799
7800
7801 This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
7802
7803
7804 [heading Parameters]
7805     
7806
7807 [variablelist
7808   
7809 [[ec][Set to indicate what error occurred, if any.]]
7810
7811 ]
7812
7813
7814 [heading Remarks]
7815       
7816 Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use:
7817
7818
7819 * It will only cancel asynchronous operations that were initiated in the current thread.
7820
7821
7822 * It can appear to complete without error, but the request to cancel the unfinished operations may be silently ignored by the operating system. Whether it works or not seems to depend on the drivers that are installed.
7823
7824 For portable cancellation, consider using one of the following alternatives:
7825
7826
7827 * Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP.
7828
7829
7830 * Use the `close()` function to simultaneously cancel the outstanding operations and close the socket.
7831
7832 When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above. 
7833
7834
7835 [endsect]
7836
7837
7838 [endsect]
7839
7840 [section:close basic_datagram_socket::close]
7841
7842 [indexterm2 boost_asio.indexterm.basic_datagram_socket.close..close..basic_datagram_socket] 
7843 Close the socket. 
7844
7845
7846   void ``[link boost_asio.reference.basic_datagram_socket.close.overload1 close]``();
7847   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.close.overload1 more...]]``
7848
7849   void ``[link boost_asio.reference.basic_datagram_socket.close.overload2 close]``(
7850       boost::system::error_code & ec);
7851   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.close.overload2 more...]]``
7852
7853
7854 [section:overload1 basic_datagram_socket::close (1 of 2 overloads)]
7855
7856
7857 ['Inherited from basic_socket.]
7858
7859
7860 Close the socket. 
7861
7862
7863   void close();
7864
7865
7866 This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
7867
7868
7869 [heading Exceptions]
7870     
7871
7872 [variablelist
7873   
7874 [[boost::system::system_error][Thrown on failure. Note that, even if the function indicates an error, the underlying descriptor is closed.]]
7875
7876 ]
7877
7878
7879 [heading Remarks]
7880       
7881 For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket. 
7882
7883
7884
7885
7886 [endsect]
7887
7888
7889
7890 [section:overload2 basic_datagram_socket::close (2 of 2 overloads)]
7891
7892
7893 ['Inherited from basic_socket.]
7894
7895
7896 Close the socket. 
7897
7898
7899   void close(
7900       boost::system::error_code & ec);
7901
7902
7903 This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
7904
7905
7906 [heading Parameters]
7907     
7908
7909 [variablelist
7910   
7911 [[ec][Set to indicate what error occurred, if any. Note that, even if the function indicates an error, the underlying descriptor is closed.]]
7912
7913 ]
7914
7915
7916 [heading Example]
7917   
7918
7919
7920    boost::asio::ip::tcp::socket socket(my_context);
7921    ...
7922    boost::system::error_code ec;
7923    socket.close(ec);
7924    if (ec)
7925    {
7926      // An error occurred.
7927    }
7928
7929
7930
7931
7932
7933 [heading Remarks]
7934       
7935 For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket. 
7936
7937
7938
7939
7940 [endsect]
7941
7942
7943 [endsect]
7944
7945 [section:connect basic_datagram_socket::connect]
7946
7947 [indexterm2 boost_asio.indexterm.basic_datagram_socket.connect..connect..basic_datagram_socket] 
7948 Connect the socket to the specified endpoint. 
7949
7950
7951   void ``[link boost_asio.reference.basic_datagram_socket.connect.overload1 connect]``(
7952       const endpoint_type & peer_endpoint);
7953   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.connect.overload1 more...]]``
7954
7955   void ``[link boost_asio.reference.basic_datagram_socket.connect.overload2 connect]``(
7956       const endpoint_type & peer_endpoint,
7957       boost::system::error_code & ec);
7958   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.connect.overload2 more...]]``
7959
7960
7961 [section:overload1 basic_datagram_socket::connect (1 of 2 overloads)]
7962
7963
7964 ['Inherited from basic_socket.]
7965
7966
7967 Connect the socket to the specified endpoint. 
7968
7969
7970   void connect(
7971       const endpoint_type & peer_endpoint);
7972
7973
7974 This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs.
7975
7976 The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
7977
7978
7979 [heading Parameters]
7980     
7981
7982 [variablelist
7983   
7984 [[peer_endpoint][The remote endpoint to which the socket will be connected.]]
7985
7986 ]
7987
7988
7989 [heading Exceptions]
7990     
7991
7992 [variablelist
7993   
7994 [[boost::system::system_error][Thrown on failure.]]
7995
7996 ]
7997
7998
7999 [heading Example]
8000   
8001
8002
8003    boost::asio::ip::tcp::socket socket(my_context);
8004    boost::asio::ip::tcp::endpoint endpoint(
8005        boost::asio::ip::address::from_string("1.2.3.4"), 12345);
8006    socket.connect(endpoint);
8007
8008
8009
8010
8011
8012
8013
8014 [endsect]
8015
8016
8017
8018 [section:overload2 basic_datagram_socket::connect (2 of 2 overloads)]
8019
8020
8021 ['Inherited from basic_socket.]
8022
8023
8024 Connect the socket to the specified endpoint. 
8025
8026
8027   void connect(
8028       const endpoint_type & peer_endpoint,
8029       boost::system::error_code & ec);
8030
8031
8032 This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs.
8033
8034 The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
8035
8036
8037 [heading Parameters]
8038     
8039
8040 [variablelist
8041   
8042 [[peer_endpoint][The remote endpoint to which the socket will be connected.]]
8043
8044 [[ec][Set to indicate what error occurred, if any.]]
8045
8046 ]
8047
8048
8049 [heading Example]
8050   
8051
8052
8053    boost::asio::ip::tcp::socket socket(my_context);
8054    boost::asio::ip::tcp::endpoint endpoint(
8055        boost::asio::ip::address::from_string("1.2.3.4"), 12345);
8056    boost::system::error_code ec;
8057    socket.connect(endpoint, ec);
8058    if (ec)
8059    {
8060      // An error occurred.
8061    }
8062
8063
8064
8065
8066
8067
8068
8069 [endsect]
8070
8071
8072 [endsect]
8073
8074
8075 [section:debug basic_datagram_socket::debug]
8076
8077
8078 ['Inherited from socket_base.]
8079
8080 [indexterm2 boost_asio.indexterm.basic_datagram_socket.debug..debug..basic_datagram_socket] 
8081 Socket option to enable socket-level debugging. 
8082
8083
8084   typedef implementation_defined debug;
8085
8086
8087
8088 Implements the SOL\_SOCKET/SO\_DEBUG socket option.
8089
8090
8091 [heading Examples]
8092   
8093 Setting the option: 
8094
8095    boost::asio::ip::tcp::socket socket(my_context);
8096    ...
8097    boost::asio::socket_base::debug option(true);
8098    socket.set_option(option);
8099
8100
8101
8102
8103
8104 Getting the current option value: 
8105
8106    boost::asio::ip::tcp::socket socket(my_context);
8107    ...
8108    boost::asio::socket_base::debug option;
8109    socket.get_option(option);
8110    bool is_set = option.value();
8111
8112
8113
8114
8115
8116
8117
8118 [heading Requirements]
8119
8120 ['Header: ][^boost/asio/basic_datagram_socket.hpp]
8121
8122 ['Convenience header: ][^boost/asio.hpp]
8123
8124
8125 [endsect]
8126
8127
8128
8129 [section:do_not_route basic_datagram_socket::do_not_route]
8130
8131
8132 ['Inherited from socket_base.]
8133
8134 [indexterm2 boost_asio.indexterm.basic_datagram_socket.do_not_route..do_not_route..basic_datagram_socket] 
8135 Socket option to prevent routing, use local interfaces only. 
8136
8137
8138   typedef implementation_defined do_not_route;
8139
8140
8141
8142 Implements the SOL\_SOCKET/SO\_DONTROUTE socket option.
8143
8144
8145 [heading Examples]
8146   
8147 Setting the option: 
8148
8149    boost::asio::ip::udp::socket socket(my_context);
8150    ...
8151    boost::asio::socket_base::do_not_route option(true);
8152    socket.set_option(option);
8153
8154
8155
8156
8157
8158 Getting the current option value: 
8159
8160    boost::asio::ip::udp::socket socket(my_context);
8161    ...
8162    boost::asio::socket_base::do_not_route option;
8163    socket.get_option(option);
8164    bool is_set = option.value();
8165
8166
8167
8168
8169
8170
8171
8172 [heading Requirements]
8173
8174 ['Header: ][^boost/asio/basic_datagram_socket.hpp]
8175
8176 ['Convenience header: ][^boost/asio.hpp]
8177
8178
8179 [endsect]
8180
8181
8182
8183 [section:enable_connection_aborted basic_datagram_socket::enable_connection_aborted]
8184
8185
8186 ['Inherited from socket_base.]
8187
8188 [indexterm2 boost_asio.indexterm.basic_datagram_socket.enable_connection_aborted..enable_connection_aborted..basic_datagram_socket] 
8189 Socket option to report aborted connections on accept. 
8190
8191
8192   typedef implementation_defined enable_connection_aborted;
8193
8194
8195
8196 Implements a custom socket option that determines whether or not an accept operation is permitted to fail with `boost::asio::error::connection_aborted`. By default the option is false.
8197
8198
8199 [heading Examples]
8200   
8201 Setting the option: 
8202
8203    boost::asio::ip::tcp::acceptor acceptor(my_context);
8204    ...
8205    boost::asio::socket_base::enable_connection_aborted option(true);
8206    acceptor.set_option(option);
8207
8208
8209
8210
8211
8212 Getting the current option value: 
8213
8214    boost::asio::ip::tcp::acceptor acceptor(my_context);
8215    ...
8216    boost::asio::socket_base::enable_connection_aborted option;
8217    acceptor.get_option(option);
8218    bool is_set = option.value();
8219
8220
8221
8222
8223
8224
8225
8226 [heading Requirements]
8227
8228 ['Header: ][^boost/asio/basic_datagram_socket.hpp]
8229
8230 ['Convenience header: ][^boost/asio.hpp]
8231
8232
8233 [endsect]
8234
8235
8236
8237 [section:endpoint_type basic_datagram_socket::endpoint_type]
8238
8239 [indexterm2 boost_asio.indexterm.basic_datagram_socket.endpoint_type..endpoint_type..basic_datagram_socket] 
8240 The endpoint type. 
8241
8242
8243   typedef Protocol::endpoint endpoint_type;
8244
8245
8246
8247 [heading Requirements]
8248
8249 ['Header: ][^boost/asio/basic_datagram_socket.hpp]
8250
8251 ['Convenience header: ][^boost/asio.hpp]
8252
8253
8254 [endsect]
8255
8256
8257
8258 [section:executor_type basic_datagram_socket::executor_type]
8259
8260 [indexterm2 boost_asio.indexterm.basic_datagram_socket.executor_type..executor_type..basic_datagram_socket] 
8261 The type of the executor associated with the object. 
8262
8263
8264   typedef Executor executor_type;
8265
8266
8267
8268 [heading Requirements]
8269
8270 ['Header: ][^boost/asio/basic_datagram_socket.hpp]
8271
8272 ['Convenience header: ][^boost/asio.hpp]
8273
8274
8275 [endsect]
8276
8277
8278
8279 [section:get_executor basic_datagram_socket::get_executor]
8280
8281
8282 ['Inherited from basic_socket.]
8283
8284 [indexterm2 boost_asio.indexterm.basic_datagram_socket.get_executor..get_executor..basic_datagram_socket] 
8285 Get the executor associated with the object. 
8286
8287
8288   executor_type get_executor();
8289
8290
8291
8292 [endsect]
8293
8294
8295 [section:get_option basic_datagram_socket::get_option]
8296
8297 [indexterm2 boost_asio.indexterm.basic_datagram_socket.get_option..get_option..basic_datagram_socket] 
8298 Get an option from the socket. 
8299
8300
8301   template<
8302       typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
8303   void ``[link boost_asio.reference.basic_datagram_socket.get_option.overload1 get_option]``(
8304       GettableSocketOption & option) const;
8305   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.get_option.overload1 more...]]``
8306
8307   template<
8308       typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
8309   void ``[link boost_asio.reference.basic_datagram_socket.get_option.overload2 get_option]``(
8310       GettableSocketOption & option,
8311       boost::system::error_code & ec) const;
8312   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.get_option.overload2 more...]]``
8313
8314
8315 [section:overload1 basic_datagram_socket::get_option (1 of 2 overloads)]
8316
8317
8318 ['Inherited from basic_socket.]
8319
8320
8321 Get an option from the socket. 
8322
8323
8324   template<
8325       typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
8326   void get_option(
8327       GettableSocketOption & option) const;
8328
8329
8330 This function is used to get the current value of an option on the socket.
8331
8332
8333 [heading Parameters]
8334     
8335
8336 [variablelist
8337   
8338 [[option][The option value to be obtained from the socket.]]
8339
8340 ]
8341
8342
8343 [heading Exceptions]
8344     
8345
8346 [variablelist
8347   
8348 [[boost::system::system_error][Thrown on failure.]]
8349
8350 ]
8351
8352
8353
8354 [heading Example]
8355   
8356 Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option: 
8357
8358    boost::asio::ip::tcp::socket socket(my_context);
8359    ...
8360    boost::asio::ip::tcp::socket::keep_alive option;
8361    socket.get_option(option);
8362    bool is_set = option.value();
8363
8364
8365
8366
8367
8368
8369
8370 [endsect]
8371
8372
8373
8374 [section:overload2 basic_datagram_socket::get_option (2 of 2 overloads)]
8375
8376
8377 ['Inherited from basic_socket.]
8378
8379
8380 Get an option from the socket. 
8381
8382
8383   template<
8384       typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
8385   void get_option(
8386       GettableSocketOption & option,
8387       boost::system::error_code & ec) const;
8388
8389
8390 This function is used to get the current value of an option on the socket.
8391
8392
8393 [heading Parameters]
8394     
8395
8396 [variablelist
8397   
8398 [[option][The option value to be obtained from the socket.]]
8399
8400 [[ec][Set to indicate what error occurred, if any.]]
8401
8402 ]
8403
8404
8405
8406 [heading Example]
8407   
8408 Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option: 
8409
8410    boost::asio::ip::tcp::socket socket(my_context);
8411    ...
8412    boost::asio::ip::tcp::socket::keep_alive option;
8413    boost::system::error_code ec;
8414    socket.get_option(option, ec);
8415    if (ec)
8416    {
8417      // An error occurred.
8418    }
8419    bool is_set = option.value();
8420
8421
8422
8423
8424
8425
8426
8427 [endsect]
8428
8429
8430 [endsect]
8431
8432
8433 [section:impl_ basic_datagram_socket::impl_]
8434
8435
8436 ['Inherited from basic_socket.]
8437
8438 [indexterm2 boost_asio.indexterm.basic_datagram_socket.impl_..impl_..basic_datagram_socket] 
8439
8440   detail::io_object_impl< detail::reactive_socket_service< Protocol >, Executor > impl_;
8441
8442
8443
8444 [endsect]
8445
8446
8447 [section:io_control basic_datagram_socket::io_control]
8448
8449 [indexterm2 boost_asio.indexterm.basic_datagram_socket.io_control..io_control..basic_datagram_socket] 
8450 Perform an IO control command on the socket. 
8451
8452
8453   template<
8454       typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
8455   void ``[link boost_asio.reference.basic_datagram_socket.io_control.overload1 io_control]``(
8456       IoControlCommand & command);
8457   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.io_control.overload1 more...]]``
8458
8459   template<
8460       typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
8461   void ``[link boost_asio.reference.basic_datagram_socket.io_control.overload2 io_control]``(
8462       IoControlCommand & command,
8463       boost::system::error_code & ec);
8464   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.io_control.overload2 more...]]``
8465
8466
8467 [section:overload1 basic_datagram_socket::io_control (1 of 2 overloads)]
8468
8469
8470 ['Inherited from basic_socket.]
8471
8472
8473 Perform an IO control command on the socket. 
8474
8475
8476   template<
8477       typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
8478   void io_control(
8479       IoControlCommand & command);
8480
8481
8482 This function is used to execute an IO control command on the socket.
8483
8484
8485 [heading Parameters]
8486     
8487
8488 [variablelist
8489   
8490 [[command][The IO control command to be performed on the socket.]]
8491
8492 ]
8493
8494
8495 [heading Exceptions]
8496     
8497
8498 [variablelist
8499   
8500 [[boost::system::system_error][Thrown on failure.]]
8501
8502 ]
8503
8504
8505
8506 [heading Example]
8507   
8508 Getting the number of bytes ready to read: 
8509
8510    boost::asio::ip::tcp::socket socket(my_context);
8511    ...
8512    boost::asio::ip::tcp::socket::bytes_readable command;
8513    socket.io_control(command);
8514    std::size_t bytes_readable = command.get();
8515
8516
8517
8518
8519
8520
8521
8522 [endsect]
8523
8524
8525
8526 [section:overload2 basic_datagram_socket::io_control (2 of 2 overloads)]
8527
8528
8529 ['Inherited from basic_socket.]
8530
8531
8532 Perform an IO control command on the socket. 
8533
8534
8535   template<
8536       typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
8537   void io_control(
8538       IoControlCommand & command,
8539       boost::system::error_code & ec);
8540
8541
8542 This function is used to execute an IO control command on the socket.
8543
8544
8545 [heading Parameters]
8546     
8547
8548 [variablelist
8549   
8550 [[command][The IO control command to be performed on the socket.]]
8551
8552 [[ec][Set to indicate what error occurred, if any.]]
8553
8554 ]
8555
8556
8557
8558 [heading Example]
8559   
8560 Getting the number of bytes ready to read: 
8561
8562    boost::asio::ip::tcp::socket socket(my_context);
8563    ...
8564    boost::asio::ip::tcp::socket::bytes_readable command;
8565    boost::system::error_code ec;
8566    socket.io_control(command, ec);
8567    if (ec)
8568    {
8569      // An error occurred.
8570    }
8571    std::size_t bytes_readable = command.get();
8572
8573
8574
8575
8576
8577
8578
8579 [endsect]
8580
8581
8582 [endsect]
8583
8584
8585 [section:is_open basic_datagram_socket::is_open]
8586
8587
8588 ['Inherited from basic_socket.]
8589
8590 [indexterm2 boost_asio.indexterm.basic_datagram_socket.is_open..is_open..basic_datagram_socket] 
8591 Determine whether the socket is open. 
8592
8593
8594   bool is_open() const;
8595
8596
8597
8598 [endsect]
8599
8600
8601
8602 [section:keep_alive basic_datagram_socket::keep_alive]
8603
8604
8605 ['Inherited from socket_base.]
8606
8607 [indexterm2 boost_asio.indexterm.basic_datagram_socket.keep_alive..keep_alive..basic_datagram_socket] 
8608 Socket option to send keep-alives. 
8609
8610
8611   typedef implementation_defined keep_alive;
8612
8613
8614
8615 Implements the SOL\_SOCKET/SO\_KEEPALIVE socket option.
8616
8617
8618 [heading Examples]
8619   
8620 Setting the option: 
8621
8622    boost::asio::ip::tcp::socket socket(my_context);
8623    ...
8624    boost::asio::socket_base::keep_alive option(true);
8625    socket.set_option(option);
8626
8627
8628
8629
8630
8631 Getting the current option value: 
8632
8633    boost::asio::ip::tcp::socket socket(my_context);
8634    ...
8635    boost::asio::socket_base::keep_alive option;
8636    socket.get_option(option);
8637    bool is_set = option.value();
8638
8639
8640
8641
8642
8643
8644
8645 [heading Requirements]
8646
8647 ['Header: ][^boost/asio/basic_datagram_socket.hpp]
8648
8649 ['Convenience header: ][^boost/asio.hpp]
8650
8651
8652 [endsect]
8653
8654
8655
8656 [section:linger basic_datagram_socket::linger]
8657
8658
8659 ['Inherited from socket_base.]
8660
8661 [indexterm2 boost_asio.indexterm.basic_datagram_socket.linger..linger..basic_datagram_socket] 
8662 Socket option to specify whether the socket lingers on close if unsent data is present. 
8663
8664
8665   typedef implementation_defined linger;
8666
8667
8668
8669 Implements the SOL\_SOCKET/SO\_LINGER socket option.
8670
8671
8672 [heading Examples]
8673   
8674 Setting the option: 
8675
8676    boost::asio::ip::tcp::socket socket(my_context);
8677    ...
8678    boost::asio::socket_base::linger option(true, 30);
8679    socket.set_option(option);
8680
8681
8682
8683
8684
8685 Getting the current option value: 
8686
8687    boost::asio::ip::tcp::socket socket(my_context);
8688    ...
8689    boost::asio::socket_base::linger option;
8690    socket.get_option(option);
8691    bool is_set = option.enabled();
8692    unsigned short timeout = option.timeout();
8693
8694
8695
8696
8697
8698
8699
8700 [heading Requirements]
8701
8702 ['Header: ][^boost/asio/basic_datagram_socket.hpp]
8703
8704 ['Convenience header: ][^boost/asio.hpp]
8705
8706
8707 [endsect]
8708
8709
8710 [section:local_endpoint basic_datagram_socket::local_endpoint]
8711
8712 [indexterm2 boost_asio.indexterm.basic_datagram_socket.local_endpoint..local_endpoint..basic_datagram_socket] 
8713 Get the local endpoint of the socket. 
8714
8715
8716   endpoint_type ``[link boost_asio.reference.basic_datagram_socket.local_endpoint.overload1 local_endpoint]``() const;
8717   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.local_endpoint.overload1 more...]]``
8718
8719   endpoint_type ``[link boost_asio.reference.basic_datagram_socket.local_endpoint.overload2 local_endpoint]``(
8720       boost::system::error_code & ec) const;
8721   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.local_endpoint.overload2 more...]]``
8722
8723
8724 [section:overload1 basic_datagram_socket::local_endpoint (1 of 2 overloads)]
8725
8726
8727 ['Inherited from basic_socket.]
8728
8729
8730 Get the local endpoint of the socket. 
8731
8732
8733   endpoint_type local_endpoint() const;
8734
8735
8736 This function is used to obtain the locally bound endpoint of the socket.
8737
8738
8739 [heading Return Value]
8740       
8741 An object that represents the local endpoint of the socket.
8742
8743
8744 [heading Exceptions]
8745     
8746
8747 [variablelist
8748   
8749 [[boost::system::system_error][Thrown on failure.]]
8750
8751 ]
8752
8753
8754 [heading Example]
8755   
8756
8757
8758    boost::asio::ip::tcp::socket socket(my_context);
8759    ...
8760    boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint();
8761
8762
8763
8764
8765
8766
8767
8768 [endsect]
8769
8770
8771
8772 [section:overload2 basic_datagram_socket::local_endpoint (2 of 2 overloads)]
8773
8774
8775 ['Inherited from basic_socket.]
8776
8777
8778 Get the local endpoint of the socket. 
8779
8780
8781   endpoint_type local_endpoint(
8782       boost::system::error_code & ec) const;
8783
8784
8785 This function is used to obtain the locally bound endpoint of the socket.
8786
8787
8788 [heading Parameters]
8789     
8790
8791 [variablelist
8792   
8793 [[ec][Set to indicate what error occurred, if any.]]
8794
8795 ]
8796
8797
8798 [heading Return Value]
8799       
8800 An object that represents the local endpoint of the socket. Returns a default-constructed endpoint object if an error occurred.
8801
8802
8803 [heading Example]
8804   
8805
8806
8807    boost::asio::ip::tcp::socket socket(my_context);
8808    ...
8809    boost::system::error_code ec;
8810    boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint(ec);
8811    if (ec)
8812    {
8813      // An error occurred.
8814    }
8815
8816
8817
8818
8819
8820
8821
8822 [endsect]
8823
8824
8825 [endsect]
8826
8827 [section:lowest_layer basic_datagram_socket::lowest_layer]
8828
8829 [indexterm2 boost_asio.indexterm.basic_datagram_socket.lowest_layer..lowest_layer..basic_datagram_socket] 
8830 Get a reference to the lowest layer. 
8831
8832
8833   lowest_layer_type & ``[link boost_asio.reference.basic_datagram_socket.lowest_layer.overload1 lowest_layer]``();
8834   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.lowest_layer.overload1 more...]]``
8835
8836
8837 Get a const reference to the lowest layer. 
8838
8839
8840   const lowest_layer_type & ``[link boost_asio.reference.basic_datagram_socket.lowest_layer.overload2 lowest_layer]``() const;
8841   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.lowest_layer.overload2 more...]]``
8842
8843
8844 [section:overload1 basic_datagram_socket::lowest_layer (1 of 2 overloads)]
8845
8846
8847 ['Inherited from basic_socket.]
8848
8849
8850 Get a reference to the lowest layer. 
8851
8852
8853   lowest_layer_type & lowest_layer();
8854
8855
8856 This function returns a reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself.
8857
8858
8859 [heading Return Value]
8860       
8861 A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 
8862
8863
8864
8865
8866 [endsect]
8867
8868
8869
8870 [section:overload2 basic_datagram_socket::lowest_layer (2 of 2 overloads)]
8871
8872
8873 ['Inherited from basic_socket.]
8874
8875
8876 Get a const reference to the lowest layer. 
8877
8878
8879   const lowest_layer_type & lowest_layer() const;
8880
8881
8882 This function returns a const reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself.
8883
8884
8885 [heading Return Value]
8886       
8887 A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 
8888
8889
8890
8891
8892 [endsect]
8893
8894
8895 [endsect]
8896
8897
8898 [section:lowest_layer_type basic_datagram_socket::lowest_layer_type]
8899
8900
8901 ['Inherited from basic_socket.]
8902
8903 [indexterm2 boost_asio.indexterm.basic_datagram_socket.lowest_layer_type..lowest_layer_type..basic_datagram_socket] 
8904 A [link boost_asio.reference.basic_socket `basic_socket`] is always the lowest layer. 
8905
8906
8907   typedef basic_socket< Protocol, Executor > lowest_layer_type;
8908
8909
8910 [heading Types]
8911 [table
8912   [[Name][Description]]
8913
8914   [
8915
8916     [[link boost_asio.reference.basic_socket__rebind_executor [*rebind_executor]]]
8917     [Rebinds the socket type to another executor. ]
8918   
8919   ]
8920
8921   [
8922
8923     [[link boost_asio.reference.basic_socket.broadcast [*broadcast]]]
8924     [Socket option to permit sending of broadcast messages. ]
8925   
8926   ]
8927
8928   [
8929
8930     [[link boost_asio.reference.basic_socket.bytes_readable [*bytes_readable]]]
8931     [IO control command to get the amount of data that can be read without blocking. ]
8932   
8933   ]
8934
8935   [
8936
8937     [[link boost_asio.reference.basic_socket.debug [*debug]]]
8938     [Socket option to enable socket-level debugging. ]
8939   
8940   ]
8941
8942   [
8943
8944     [[link boost_asio.reference.basic_socket.do_not_route [*do_not_route]]]
8945     [Socket option to prevent routing, use local interfaces only. ]
8946   
8947   ]
8948
8949   [
8950
8951     [[link boost_asio.reference.basic_socket.enable_connection_aborted [*enable_connection_aborted]]]
8952     [Socket option to report aborted connections on accept. ]
8953   
8954   ]
8955
8956   [
8957
8958     [[link boost_asio.reference.basic_socket.endpoint_type [*endpoint_type]]]
8959     [The endpoint type. ]
8960   
8961   ]
8962
8963   [
8964
8965     [[link boost_asio.reference.basic_socket.executor_type [*executor_type]]]
8966     [The type of the executor associated with the object. ]
8967   
8968   ]
8969
8970   [
8971
8972     [[link boost_asio.reference.basic_socket.keep_alive [*keep_alive]]]
8973     [Socket option to send keep-alives. ]
8974   
8975   ]
8976
8977   [
8978
8979     [[link boost_asio.reference.basic_socket.linger [*linger]]]
8980     [Socket option to specify whether the socket lingers on close if unsent data is present. ]
8981   
8982   ]
8983
8984   [
8985
8986     [[link boost_asio.reference.basic_socket.lowest_layer_type [*lowest_layer_type]]]
8987     [A basic_socket is always the lowest layer. ]
8988   
8989   ]
8990
8991   [
8992
8993     [[link boost_asio.reference.basic_socket.message_flags [*message_flags]]]
8994     [Bitmask type for flags that can be passed to send and receive operations. ]
8995   
8996   ]
8997
8998   [
8999
9000     [[link boost_asio.reference.basic_socket.native_handle_type [*native_handle_type]]]
9001     [The native representation of a socket. ]
9002   
9003   ]
9004
9005   [
9006
9007     [[link boost_asio.reference.basic_socket.out_of_band_inline [*out_of_band_inline]]]
9008     [Socket option for putting received out-of-band data inline. ]
9009   
9010   ]
9011
9012   [
9013
9014     [[link boost_asio.reference.basic_socket.protocol_type [*protocol_type]]]
9015     [The protocol type. ]
9016   
9017   ]
9018
9019   [
9020
9021     [[link boost_asio.reference.basic_socket.receive_buffer_size [*receive_buffer_size]]]
9022     [Socket option for the receive buffer size of a socket. ]
9023   
9024   ]
9025
9026   [
9027
9028     [[link boost_asio.reference.basic_socket.receive_low_watermark [*receive_low_watermark]]]
9029     [Socket option for the receive low watermark. ]
9030   
9031   ]
9032
9033   [
9034
9035     [[link boost_asio.reference.basic_socket.reuse_address [*reuse_address]]]
9036     [Socket option to allow the socket to be bound to an address that is already in use. ]
9037   
9038   ]
9039
9040   [
9041
9042     [[link boost_asio.reference.basic_socket.send_buffer_size [*send_buffer_size]]]
9043     [Socket option for the send buffer size of a socket. ]
9044   
9045   ]
9046
9047   [
9048
9049     [[link boost_asio.reference.basic_socket.send_low_watermark [*send_low_watermark]]]
9050     [Socket option for the send low watermark. ]
9051   
9052   ]
9053
9054   [
9055
9056     [[link boost_asio.reference.basic_socket.shutdown_type [*shutdown_type]]]
9057     [Different ways a socket may be shutdown. ]
9058   
9059   ]
9060
9061   [
9062
9063     [[link boost_asio.reference.basic_socket.wait_type [*wait_type]]]
9064     [Wait types. ]
9065   
9066   ]
9067
9068 ]
9069
9070 [heading Member Functions]
9071 [table
9072   [[Name][Description]]
9073
9074   [
9075     [[link boost_asio.reference.basic_socket.assign [*assign]]]
9076     [Assign an existing native socket to the socket. ]
9077   ]
9078   
9079   [
9080     [[link boost_asio.reference.basic_socket.async_connect [*async_connect]]]
9081     [Start an asynchronous connect. ]
9082   ]
9083   
9084   [
9085     [[link boost_asio.reference.basic_socket.async_wait [*async_wait]]]
9086     [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
9087   ]
9088   
9089   [
9090     [[link boost_asio.reference.basic_socket.at_mark [*at_mark]]]
9091     [Determine whether the socket is at the out-of-band data mark. ]
9092   ]
9093   
9094   [
9095     [[link boost_asio.reference.basic_socket.available [*available]]]
9096     [Determine the number of bytes available for reading. ]
9097   ]
9098   
9099   [
9100     [[link boost_asio.reference.basic_socket.basic_socket [*basic_socket]]]
9101     [Construct a basic_socket without opening it. 
9102      [hr]
9103      Construct and open a basic_socket. 
9104      [hr]
9105      Construct a basic_socket, opening it and binding it to the given local endpoint. 
9106      [hr]
9107      Construct a basic_socket on an existing native socket. 
9108      [hr]
9109      Move-construct a basic_socket from another. 
9110      [hr]
9111      Move-construct a basic_socket from a socket of another protocol type. ]
9112   ]
9113   
9114   [
9115     [[link boost_asio.reference.basic_socket.bind [*bind]]]
9116     [Bind the socket to the given local endpoint. ]
9117   ]
9118   
9119   [
9120     [[link boost_asio.reference.basic_socket.cancel [*cancel]]]
9121     [Cancel all asynchronous operations associated with the socket. ]
9122   ]
9123   
9124   [
9125     [[link boost_asio.reference.basic_socket.close [*close]]]
9126     [Close the socket. ]
9127   ]
9128   
9129   [
9130     [[link boost_asio.reference.basic_socket.connect [*connect]]]
9131     [Connect the socket to the specified endpoint. ]
9132   ]
9133   
9134   [
9135     [[link boost_asio.reference.basic_socket.get_executor [*get_executor]]]
9136     [Get the executor associated with the object. ]
9137   ]
9138   
9139   [
9140     [[link boost_asio.reference.basic_socket.get_option [*get_option]]]
9141     [Get an option from the socket. ]
9142   ]
9143   
9144   [
9145     [[link boost_asio.reference.basic_socket.io_control [*io_control]]]
9146     [Perform an IO control command on the socket. ]
9147   ]
9148   
9149   [
9150     [[link boost_asio.reference.basic_socket.is_open [*is_open]]]
9151     [Determine whether the socket is open. ]
9152   ]
9153   
9154   [
9155     [[link boost_asio.reference.basic_socket.local_endpoint [*local_endpoint]]]
9156     [Get the local endpoint of the socket. ]
9157   ]
9158   
9159   [
9160     [[link boost_asio.reference.basic_socket.lowest_layer [*lowest_layer]]]
9161     [Get a reference to the lowest layer. 
9162      [hr]
9163      Get a const reference to the lowest layer. ]
9164   ]
9165   
9166   [
9167     [[link boost_asio.reference.basic_socket.native_handle [*native_handle]]]
9168     [Get the native socket representation. ]
9169   ]
9170   
9171   [
9172     [[link boost_asio.reference.basic_socket.native_non_blocking [*native_non_blocking]]]
9173     [Gets the non-blocking mode of the native socket implementation. 
9174      [hr]
9175      Sets the non-blocking mode of the native socket implementation. ]
9176   ]
9177   
9178   [
9179     [[link boost_asio.reference.basic_socket.non_blocking [*non_blocking]]]
9180     [Gets the non-blocking mode of the socket. 
9181      [hr]
9182      Sets the non-blocking mode of the socket. ]
9183   ]
9184   
9185   [
9186     [[link boost_asio.reference.basic_socket.open [*open]]]
9187     [Open the socket using the specified protocol. ]
9188   ]
9189   
9190   [
9191     [[link boost_asio.reference.basic_socket.operator_eq_ [*operator=]]]
9192     [Move-assign a basic_socket from another. 
9193      [hr]
9194      Move-assign a basic_socket from a socket of another protocol type. ]
9195   ]
9196   
9197   [
9198     [[link boost_asio.reference.basic_socket.release [*release]]]
9199     [Release ownership of the underlying native socket. ]
9200   ]
9201   
9202   [
9203     [[link boost_asio.reference.basic_socket.remote_endpoint [*remote_endpoint]]]
9204     [Get the remote endpoint of the socket. ]
9205   ]
9206   
9207   [
9208     [[link boost_asio.reference.basic_socket.set_option [*set_option]]]
9209     [Set an option on the socket. ]
9210   ]
9211   
9212   [
9213     [[link boost_asio.reference.basic_socket.shutdown [*shutdown]]]
9214     [Disable sends or receives on the socket. ]
9215   ]
9216   
9217   [
9218     [[link boost_asio.reference.basic_socket.wait [*wait]]]
9219     [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
9220   ]
9221   
9222 ]
9223
9224 [heading Protected Member Functions]
9225 [table
9226   [[Name][Description]]
9227
9228   [
9229     [[link boost_asio.reference.basic_socket._basic_socket [*~basic_socket]]]
9230     [Protected destructor to prevent deletion through this type. ]
9231   ]
9232   
9233 ]
9234
9235 [heading Data Members]
9236 [table
9237   [[Name][Description]]
9238
9239   [
9240     [[link boost_asio.reference.basic_socket.max_connections [*max_connections]]]
9241     [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
9242   ]
9243
9244   [
9245     [[link boost_asio.reference.basic_socket.max_listen_connections [*max_listen_connections]]]
9246     [The maximum length of the queue of pending incoming connections. ]
9247   ]
9248
9249   [
9250     [[link boost_asio.reference.basic_socket.message_do_not_route [*message_do_not_route]]]
9251     [Specify that the data should not be subject to routing. ]
9252   ]
9253
9254   [
9255     [[link boost_asio.reference.basic_socket.message_end_of_record [*message_end_of_record]]]
9256     [Specifies that the data marks the end of a record. ]
9257   ]
9258
9259   [
9260     [[link boost_asio.reference.basic_socket.message_out_of_band [*message_out_of_band]]]
9261     [Process out-of-band data. ]
9262   ]
9263
9264   [
9265     [[link boost_asio.reference.basic_socket.message_peek [*message_peek]]]
9266     [Peek at incoming data without removing it from the input queue. ]
9267   ]
9268
9269 ]
9270
9271 [heading Protected Data Members]
9272 [table
9273   [[Name][Description]]
9274
9275   [
9276     [[link boost_asio.reference.basic_socket.impl_ [*impl_]]]
9277     []
9278   ]
9279
9280 ]
9281
9282 The [link boost_asio.reference.basic_socket `basic_socket`] class template provides functionality that is common to both stream-oriented and datagram-oriented sockets.
9283
9284
9285 [heading Thread Safety]
9286   
9287 ['Distinct] ['objects:] Safe.
9288
9289 ['Shared] ['objects:] Unsafe. 
9290
9291
9292
9293
9294 [heading Requirements]
9295
9296 ['Header: ][^boost/asio/basic_datagram_socket.hpp]
9297
9298 ['Convenience header: ][^boost/asio.hpp]
9299
9300
9301 [endsect]
9302
9303
9304
9305 [section:max_connections basic_datagram_socket::max_connections]
9306
9307
9308 ['Inherited from socket_base.]
9309
9310 [indexterm2 boost_asio.indexterm.basic_datagram_socket.max_connections..max_connections..basic_datagram_socket] 
9311 (Deprecated: Use max\_listen\_connections.) The maximum length of the queue of pending incoming connections. 
9312
9313
9314   static const int max_connections = implementation_defined;
9315
9316
9317
9318 [endsect]
9319
9320
9321
9322 [section:max_listen_connections basic_datagram_socket::max_listen_connections]
9323
9324
9325 ['Inherited from socket_base.]
9326
9327 [indexterm2 boost_asio.indexterm.basic_datagram_socket.max_listen_connections..max_listen_connections..basic_datagram_socket] 
9328 The maximum length of the queue of pending incoming connections. 
9329
9330
9331   static const int max_listen_connections = implementation_defined;
9332
9333
9334
9335 [endsect]
9336
9337
9338
9339 [section:message_do_not_route basic_datagram_socket::message_do_not_route]
9340
9341
9342 ['Inherited from socket_base.]
9343
9344 [indexterm2 boost_asio.indexterm.basic_datagram_socket.message_do_not_route..message_do_not_route..basic_datagram_socket] 
9345 Specify that the data should not be subject to routing. 
9346
9347
9348   static const int message_do_not_route = implementation_defined;
9349
9350
9351
9352 [endsect]
9353
9354
9355
9356 [section:message_end_of_record basic_datagram_socket::message_end_of_record]
9357
9358
9359 ['Inherited from socket_base.]
9360
9361 [indexterm2 boost_asio.indexterm.basic_datagram_socket.message_end_of_record..message_end_of_record..basic_datagram_socket] 
9362 Specifies that the data marks the end of a record. 
9363
9364
9365   static const int message_end_of_record = implementation_defined;
9366
9367
9368
9369 [endsect]
9370
9371
9372
9373 [section:message_flags basic_datagram_socket::message_flags]
9374
9375
9376 ['Inherited from socket_base.]
9377
9378 [indexterm2 boost_asio.indexterm.basic_datagram_socket.message_flags..message_flags..basic_datagram_socket] 
9379 Bitmask type for flags that can be passed to send and receive operations. 
9380
9381
9382   typedef int message_flags;
9383
9384
9385
9386 [heading Requirements]
9387
9388 ['Header: ][^boost/asio/basic_datagram_socket.hpp]
9389
9390 ['Convenience header: ][^boost/asio.hpp]
9391
9392
9393 [endsect]
9394
9395
9396
9397 [section:message_out_of_band basic_datagram_socket::message_out_of_band]
9398
9399
9400 ['Inherited from socket_base.]
9401
9402 [indexterm2 boost_asio.indexterm.basic_datagram_socket.message_out_of_band..message_out_of_band..basic_datagram_socket] 
9403 Process out-of-band data. 
9404
9405
9406   static const int message_out_of_band = implementation_defined;
9407
9408
9409
9410 [endsect]
9411
9412
9413
9414 [section:message_peek basic_datagram_socket::message_peek]
9415
9416
9417 ['Inherited from socket_base.]
9418
9419 [indexterm2 boost_asio.indexterm.basic_datagram_socket.message_peek..message_peek..basic_datagram_socket] 
9420 Peek at incoming data without removing it from the input queue. 
9421
9422
9423   static const int message_peek = implementation_defined;
9424
9425
9426
9427 [endsect]
9428
9429
9430
9431 [section:native_handle basic_datagram_socket::native_handle]
9432
9433
9434 ['Inherited from basic_socket.]
9435
9436 [indexterm2 boost_asio.indexterm.basic_datagram_socket.native_handle..native_handle..basic_datagram_socket] 
9437 Get the native socket representation. 
9438
9439
9440   native_handle_type native_handle();
9441
9442
9443 This function may be used to obtain the underlying representation of the socket. This is intended to allow access to native socket functionality that is not otherwise provided. 
9444
9445
9446 [endsect]
9447
9448
9449
9450 [section:native_handle_type basic_datagram_socket::native_handle_type]
9451
9452 [indexterm2 boost_asio.indexterm.basic_datagram_socket.native_handle_type..native_handle_type..basic_datagram_socket] 
9453 The native representation of a socket. 
9454
9455
9456   typedef implementation_defined native_handle_type;
9457
9458
9459
9460 [heading Requirements]
9461
9462 ['Header: ][^boost/asio/basic_datagram_socket.hpp]
9463
9464 ['Convenience header: ][^boost/asio.hpp]
9465
9466
9467 [endsect]
9468
9469
9470 [section:native_non_blocking basic_datagram_socket::native_non_blocking]
9471
9472 [indexterm2 boost_asio.indexterm.basic_datagram_socket.native_non_blocking..native_non_blocking..basic_datagram_socket] 
9473 Gets the non-blocking mode of the native socket implementation. 
9474
9475
9476   bool ``[link boost_asio.reference.basic_datagram_socket.native_non_blocking.overload1 native_non_blocking]``() const;
9477   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.native_non_blocking.overload1 more...]]``
9478
9479
9480 Sets the non-blocking mode of the native socket implementation. 
9481
9482
9483   void ``[link boost_asio.reference.basic_datagram_socket.native_non_blocking.overload2 native_non_blocking]``(
9484       bool mode);
9485   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.native_non_blocking.overload2 more...]]``
9486
9487   void ``[link boost_asio.reference.basic_datagram_socket.native_non_blocking.overload3 native_non_blocking]``(
9488       bool mode,
9489       boost::system::error_code & ec);
9490   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.native_non_blocking.overload3 more...]]``
9491
9492
9493 [section:overload1 basic_datagram_socket::native_non_blocking (1 of 3 overloads)]
9494
9495
9496 ['Inherited from basic_socket.]
9497
9498
9499 Gets the non-blocking mode of the native socket implementation. 
9500
9501
9502   bool native_non_blocking() const;
9503
9504
9505 This function is used to retrieve the non-blocking mode of the underlying native socket. This mode has no effect on the behaviour of the socket object's synchronous operations.
9506
9507
9508 [heading Return Value]
9509       
9510 `true` if the underlying socket is in non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).
9511
9512
9513 [heading Remarks]
9514       
9515 The current non-blocking mode is cached by the socket object. Consequently, the return value may be incorrect if the non-blocking mode was set directly on the native socket.
9516
9517
9518 [heading Example]
9519   
9520 This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated: 
9521
9522    template <typename Handler>
9523    struct sendfile_op
9524    {
9525      tcp::socket& sock_;
9526      int fd_;
9527      Handler handler_;
9528      off_t offset_;
9529      std::size_t total_bytes_transferred_;
9530
9531      // Function call operator meeting WriteHandler requirements.
9532      // Used as the handler for the async_write_some operation.
9533      void operator()(boost::system::error_code ec, std::size_t)
9534      {
9535        // Put the underlying socket into non-blocking mode.
9536        if (!ec)
9537          if (!sock_.native_non_blocking())
9538            sock_.native_non_blocking(true, ec);
9539
9540        if (!ec)
9541        {
9542          for (;;)
9543          {
9544            // Try the system call.
9545            errno = 0;
9546            int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
9547            ec = boost::system::error_code(n < 0 ? errno : 0,
9548                boost::asio::error::get_system_category());
9549            total_bytes_transferred_ += ec ? 0 : n;
9550
9551            // Retry operation immediately if interrupted by signal.
9552            if (ec == boost::asio::error::interrupted)
9553              continue;
9554
9555            // Check if we need to run the operation again.
9556            if (ec == boost::asio::error::would_block
9557                || ec == boost::asio::error::try_again)
9558            {
9559              // We have to wait for the socket to become ready again.
9560              sock_.async_wait(tcp::socket::wait_write, *this);
9561              return;
9562            }
9563
9564            if (ec || n == 0)
9565            {
9566              // An error occurred, or we have reached the end of the file.
9567              // Either way we must exit the loop so we can call the handler.
9568              break;
9569            }
9570
9571            // Loop around to try calling sendfile again.
9572          }
9573        }
9574
9575        // Pass result back to user's handler.
9576        handler_(ec, total_bytes_transferred_);
9577      }
9578    };
9579
9580    template <typename Handler>
9581    void async_sendfile(tcp::socket& sock, int fd, Handler h)
9582    {
9583      sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
9584      sock.async_wait(tcp::socket::wait_write, op);
9585    } 
9586
9587
9588
9589
9590
9591
9592
9593 [endsect]
9594
9595
9596
9597 [section:overload2 basic_datagram_socket::native_non_blocking (2 of 3 overloads)]
9598
9599
9600 ['Inherited from basic_socket.]
9601
9602
9603 Sets the non-blocking mode of the native socket implementation. 
9604
9605
9606   void native_non_blocking(
9607       bool mode);
9608
9609
9610 This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations.
9611
9612
9613 [heading Parameters]
9614     
9615
9616 [variablelist
9617   
9618 [[mode][If `true`, the underlying socket is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]]
9619
9620 ]
9621
9622
9623 [heading Exceptions]
9624     
9625
9626 [variablelist
9627   
9628 [[boost::system::system_error][Thrown on failure. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense.]]
9629
9630 ]
9631
9632
9633 [heading Example]
9634   
9635 This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated: 
9636
9637    template <typename Handler>
9638    struct sendfile_op
9639    {
9640      tcp::socket& sock_;
9641      int fd_;
9642      Handler handler_;
9643      off_t offset_;
9644      std::size_t total_bytes_transferred_;
9645
9646      // Function call operator meeting WriteHandler requirements.
9647      // Used as the handler for the async_write_some operation.
9648      void operator()(boost::system::error_code ec, std::size_t)
9649      {
9650        // Put the underlying socket into non-blocking mode.
9651        if (!ec)
9652          if (!sock_.native_non_blocking())
9653            sock_.native_non_blocking(true, ec);
9654
9655        if (!ec)
9656        {
9657          for (;;)
9658          {
9659            // Try the system call.
9660            errno = 0;
9661            int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
9662            ec = boost::system::error_code(n < 0 ? errno : 0,
9663                boost::asio::error::get_system_category());
9664            total_bytes_transferred_ += ec ? 0 : n;
9665
9666            // Retry operation immediately if interrupted by signal.
9667            if (ec == boost::asio::error::interrupted)
9668              continue;
9669
9670            // Check if we need to run the operation again.
9671            if (ec == boost::asio::error::would_block
9672                || ec == boost::asio::error::try_again)
9673            {
9674              // We have to wait for the socket to become ready again.
9675              sock_.async_wait(tcp::socket::wait_write, *this);
9676              return;
9677            }
9678
9679            if (ec || n == 0)
9680            {
9681              // An error occurred, or we have reached the end of the file.
9682              // Either way we must exit the loop so we can call the handler.
9683              break;
9684            }
9685
9686            // Loop around to try calling sendfile again.
9687          }
9688        }
9689
9690        // Pass result back to user's handler.
9691        handler_(ec, total_bytes_transferred_);
9692      }
9693    };
9694
9695    template <typename Handler>
9696    void async_sendfile(tcp::socket& sock, int fd, Handler h)
9697    {
9698      sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
9699      sock.async_wait(tcp::socket::wait_write, op);
9700    } 
9701
9702
9703
9704
9705
9706
9707
9708 [endsect]
9709
9710
9711
9712 [section:overload3 basic_datagram_socket::native_non_blocking (3 of 3 overloads)]
9713
9714
9715 ['Inherited from basic_socket.]
9716
9717
9718 Sets the non-blocking mode of the native socket implementation. 
9719
9720
9721   void native_non_blocking(
9722       bool mode,
9723       boost::system::error_code & ec);
9724
9725
9726 This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations.
9727
9728
9729 [heading Parameters]
9730     
9731
9732 [variablelist
9733   
9734 [[mode][If `true`, the underlying socket is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]]
9735
9736 [[ec][Set to indicate what error occurred, if any. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense.]]
9737
9738 ]
9739
9740
9741 [heading Example]
9742   
9743 This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated: 
9744
9745    template <typename Handler>
9746    struct sendfile_op
9747    {
9748      tcp::socket& sock_;
9749      int fd_;
9750      Handler handler_;
9751      off_t offset_;
9752      std::size_t total_bytes_transferred_;
9753
9754      // Function call operator meeting WriteHandler requirements.
9755      // Used as the handler for the async_write_some operation.
9756      void operator()(boost::system::error_code ec, std::size_t)
9757      {
9758        // Put the underlying socket into non-blocking mode.
9759        if (!ec)
9760          if (!sock_.native_non_blocking())
9761            sock_.native_non_blocking(true, ec);
9762
9763        if (!ec)
9764        {
9765          for (;;)
9766          {
9767            // Try the system call.
9768            errno = 0;
9769            int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
9770            ec = boost::system::error_code(n < 0 ? errno : 0,
9771                boost::asio::error::get_system_category());
9772            total_bytes_transferred_ += ec ? 0 : n;
9773
9774            // Retry operation immediately if interrupted by signal.
9775            if (ec == boost::asio::error::interrupted)
9776              continue;
9777
9778            // Check if we need to run the operation again.
9779            if (ec == boost::asio::error::would_block
9780                || ec == boost::asio::error::try_again)
9781            {
9782              // We have to wait for the socket to become ready again.
9783              sock_.async_wait(tcp::socket::wait_write, *this);
9784              return;
9785            }
9786
9787            if (ec || n == 0)
9788            {
9789              // An error occurred, or we have reached the end of the file.
9790              // Either way we must exit the loop so we can call the handler.
9791              break;
9792            }
9793
9794            // Loop around to try calling sendfile again.
9795          }
9796        }
9797
9798        // Pass result back to user's handler.
9799        handler_(ec, total_bytes_transferred_);
9800      }
9801    };
9802
9803    template <typename Handler>
9804    void async_sendfile(tcp::socket& sock, int fd, Handler h)
9805    {
9806      sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
9807      sock.async_wait(tcp::socket::wait_write, op);
9808    } 
9809
9810
9811
9812
9813
9814
9815
9816 [endsect]
9817
9818
9819 [endsect]
9820
9821 [section:non_blocking basic_datagram_socket::non_blocking]
9822
9823 [indexterm2 boost_asio.indexterm.basic_datagram_socket.non_blocking..non_blocking..basic_datagram_socket] 
9824 Gets the non-blocking mode of the socket. 
9825
9826
9827   bool ``[link boost_asio.reference.basic_datagram_socket.non_blocking.overload1 non_blocking]``() const;
9828   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.non_blocking.overload1 more...]]``
9829
9830
9831 Sets the non-blocking mode of the socket. 
9832
9833
9834   void ``[link boost_asio.reference.basic_datagram_socket.non_blocking.overload2 non_blocking]``(
9835       bool mode);
9836   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.non_blocking.overload2 more...]]``
9837
9838   void ``[link boost_asio.reference.basic_datagram_socket.non_blocking.overload3 non_blocking]``(
9839       bool mode,
9840       boost::system::error_code & ec);
9841   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.non_blocking.overload3 more...]]``
9842
9843
9844 [section:overload1 basic_datagram_socket::non_blocking (1 of 3 overloads)]
9845
9846
9847 ['Inherited from basic_socket.]
9848
9849
9850 Gets the non-blocking mode of the socket. 
9851
9852
9853   bool non_blocking() const;
9854
9855
9856
9857 [heading Return Value]
9858       
9859 `true` if the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.
9860
9861
9862 [heading Remarks]
9863       
9864 The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`. 
9865
9866
9867
9868
9869 [endsect]
9870
9871
9872
9873 [section:overload2 basic_datagram_socket::non_blocking (2 of 3 overloads)]
9874
9875
9876 ['Inherited from basic_socket.]
9877
9878
9879 Sets the non-blocking mode of the socket. 
9880
9881
9882   void non_blocking(
9883       bool mode);
9884
9885
9886
9887 [heading Parameters]
9888     
9889
9890 [variablelist
9891   
9892 [[mode][If `true`, the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]]
9893
9894 ]
9895
9896
9897 [heading Exceptions]
9898     
9899
9900 [variablelist
9901   
9902 [[boost::system::system_error][Thrown on failure.]]
9903
9904 ]
9905
9906
9907 [heading Remarks]
9908       
9909 The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`. 
9910
9911
9912
9913
9914 [endsect]
9915
9916
9917
9918 [section:overload3 basic_datagram_socket::non_blocking (3 of 3 overloads)]
9919
9920
9921 ['Inherited from basic_socket.]
9922
9923
9924 Sets the non-blocking mode of the socket. 
9925
9926
9927   void non_blocking(
9928       bool mode,
9929       boost::system::error_code & ec);
9930
9931
9932
9933 [heading Parameters]
9934     
9935
9936 [variablelist
9937   
9938 [[mode][If `true`, the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]]
9939
9940 [[ec][Set to indicate what error occurred, if any.]]
9941
9942 ]
9943
9944
9945 [heading Remarks]
9946       
9947 The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`. 
9948
9949
9950
9951
9952 [endsect]
9953
9954
9955 [endsect]
9956
9957 [section:open basic_datagram_socket::open]
9958
9959 [indexterm2 boost_asio.indexterm.basic_datagram_socket.open..open..basic_datagram_socket] 
9960 Open the socket using the specified protocol. 
9961
9962
9963   void ``[link boost_asio.reference.basic_datagram_socket.open.overload1 open]``(
9964       const protocol_type & protocol = protocol_type());
9965   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.open.overload1 more...]]``
9966
9967   void ``[link boost_asio.reference.basic_datagram_socket.open.overload2 open]``(
9968       const protocol_type & protocol,
9969       boost::system::error_code & ec);
9970   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.open.overload2 more...]]``
9971
9972
9973 [section:overload1 basic_datagram_socket::open (1 of 2 overloads)]
9974
9975
9976 ['Inherited from basic_socket.]
9977
9978
9979 Open the socket using the specified protocol. 
9980
9981
9982   void open(
9983       const protocol_type & protocol = protocol_type());
9984
9985
9986 This function opens the socket so that it will use the specified protocol.
9987
9988
9989 [heading Parameters]
9990     
9991
9992 [variablelist
9993   
9994 [[protocol][An object specifying protocol parameters to be used.]]
9995
9996 ]
9997
9998
9999 [heading Exceptions]
10000     
10001
10002 [variablelist
10003   
10004 [[boost::system::system_error][Thrown on failure.]]
10005
10006 ]
10007
10008
10009 [heading Example]
10010   
10011
10012
10013    boost::asio::ip::tcp::socket socket(my_context);
10014    socket.open(boost::asio::ip::tcp::v4());
10015
10016
10017
10018
10019
10020
10021
10022 [endsect]
10023
10024
10025
10026 [section:overload2 basic_datagram_socket::open (2 of 2 overloads)]
10027
10028
10029 ['Inherited from basic_socket.]
10030
10031
10032 Open the socket using the specified protocol. 
10033
10034
10035   void open(
10036       const protocol_type & protocol,
10037       boost::system::error_code & ec);
10038
10039
10040 This function opens the socket so that it will use the specified protocol.
10041
10042
10043 [heading Parameters]
10044     
10045
10046 [variablelist
10047   
10048 [[protocol][An object specifying which protocol is to be used.]]
10049
10050 [[ec][Set to indicate what error occurred, if any.]]
10051
10052 ]
10053
10054
10055 [heading Example]
10056   
10057
10058
10059    boost::asio::ip::tcp::socket socket(my_context);
10060    boost::system::error_code ec;
10061    socket.open(boost::asio::ip::tcp::v4(), ec);
10062    if (ec)
10063    {
10064      // An error occurred.
10065    }
10066
10067
10068
10069
10070
10071
10072
10073 [endsect]
10074
10075
10076 [endsect]
10077
10078 [section:operator_eq_ basic_datagram_socket::operator=]
10079
10080 [indexterm2 boost_asio.indexterm.basic_datagram_socket.operator_eq_..operator=..basic_datagram_socket] 
10081 Move-assign a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] from another. 
10082
10083
10084   basic_datagram_socket & ``[link boost_asio.reference.basic_datagram_socket.operator_eq_.overload1 operator=]``(
10085       basic_datagram_socket && other);
10086   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.operator_eq_.overload1 more...]]``
10087
10088
10089 Move-assign a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] from a socket of another protocol type. 
10090
10091
10092   template<
10093       typename ``[link boost_asio.reference.Protocol Protocol1]``,
10094       typename ``[link boost_asio.reference.Executor1 Executor1]``>
10095   enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value, basic_datagram_socket & >::type ``[link boost_asio.reference.basic_datagram_socket.operator_eq_.overload2 operator=]``(
10096       basic_datagram_socket< Protocol1, Executor1 > && other);
10097   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.operator_eq_.overload2 more...]]``
10098
10099
10100 [section:overload1 basic_datagram_socket::operator= (1 of 2 overloads)]
10101
10102
10103 Move-assign a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] from another. 
10104
10105
10106   basic_datagram_socket & operator=(
10107       basic_datagram_socket && other);
10108
10109
10110 This assignment operator moves a datagram socket from one object to another.
10111
10112
10113 [heading Parameters]
10114     
10115
10116 [variablelist
10117   
10118 [[other][The other [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] object from which the move will occur.]]
10119
10120 ]
10121
10122
10123 [heading Remarks]
10124       
10125 Following the move, the moved-from object is in the same state as if constructed using the `basic_datagram_socket(const executor_type&)` constructor. 
10126
10127
10128
10129
10130 [endsect]
10131
10132
10133
10134 [section:overload2 basic_datagram_socket::operator= (2 of 2 overloads)]
10135
10136
10137 Move-assign a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] from a socket of another protocol type. 
10138
10139
10140   template<
10141       typename ``[link boost_asio.reference.Protocol Protocol1]``,
10142       typename ``[link boost_asio.reference.Executor1 Executor1]``>
10143   enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value, basic_datagram_socket & >::type operator=(
10144       basic_datagram_socket< Protocol1, Executor1 > && other);
10145
10146
10147 This assignment operator moves a datagram socket from one object to another.
10148
10149
10150 [heading Parameters]
10151     
10152
10153 [variablelist
10154   
10155 [[other][The other [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] object from which the move will occur.]]
10156
10157 ]
10158
10159
10160 [heading Remarks]
10161       
10162 Following the move, the moved-from object is in the same state as if constructed using the `basic_datagram_socket(const executor_type&)` constructor. 
10163
10164
10165
10166
10167 [endsect]
10168
10169
10170 [endsect]
10171
10172
10173 [section:out_of_band_inline basic_datagram_socket::out_of_band_inline]
10174
10175
10176 ['Inherited from socket_base.]
10177
10178 [indexterm2 boost_asio.indexterm.basic_datagram_socket.out_of_band_inline..out_of_band_inline..basic_datagram_socket] 
10179 Socket option for putting received out-of-band data inline. 
10180
10181
10182   typedef implementation_defined out_of_band_inline;
10183
10184
10185
10186 Implements the SOL\_SOCKET/SO\_OOBINLINE socket option.
10187
10188
10189 [heading Examples]
10190   
10191 Setting the option: 
10192
10193    boost::asio::ip::tcp::socket socket(my_context);
10194    ...
10195    boost::asio::socket_base::out_of_band_inline option(true);
10196    socket.set_option(option);
10197
10198
10199
10200
10201
10202 Getting the current option value: 
10203
10204    boost::asio::ip::tcp::socket socket(my_context);
10205    ...
10206    boost::asio::socket_base::out_of_band_inline option;
10207    socket.get_option(option);
10208    bool value = option.value();
10209
10210
10211
10212
10213
10214
10215
10216 [heading Requirements]
10217
10218 ['Header: ][^boost/asio/basic_datagram_socket.hpp]
10219
10220 ['Convenience header: ][^boost/asio.hpp]
10221
10222
10223 [endsect]
10224
10225
10226
10227 [section:protocol_type basic_datagram_socket::protocol_type]
10228
10229 [indexterm2 boost_asio.indexterm.basic_datagram_socket.protocol_type..protocol_type..basic_datagram_socket] 
10230 The protocol type. 
10231
10232
10233   typedef Protocol protocol_type;
10234
10235
10236
10237 [heading Requirements]
10238
10239 ['Header: ][^boost/asio/basic_datagram_socket.hpp]
10240
10241 ['Convenience header: ][^boost/asio.hpp]
10242
10243
10244 [endsect]
10245
10246
10247 [section:receive basic_datagram_socket::receive]
10248
10249 [indexterm2 boost_asio.indexterm.basic_datagram_socket.receive..receive..basic_datagram_socket] 
10250 Receive some data on a connected socket. 
10251
10252
10253   template<
10254       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
10255   std::size_t ``[link boost_asio.reference.basic_datagram_socket.receive.overload1 receive]``(
10256       const MutableBufferSequence & buffers);
10257   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.receive.overload1 more...]]``
10258
10259   template<
10260       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
10261   std::size_t ``[link boost_asio.reference.basic_datagram_socket.receive.overload2 receive]``(
10262       const MutableBufferSequence & buffers,
10263       socket_base::message_flags flags);
10264   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.receive.overload2 more...]]``
10265
10266   template<
10267       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
10268   std::size_t ``[link boost_asio.reference.basic_datagram_socket.receive.overload3 receive]``(
10269       const MutableBufferSequence & buffers,
10270       socket_base::message_flags flags,
10271       boost::system::error_code & ec);
10272   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.receive.overload3 more...]]``
10273
10274
10275 [section:overload1 basic_datagram_socket::receive (1 of 3 overloads)]
10276
10277
10278 Receive some data on a connected socket. 
10279
10280
10281   template<
10282       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
10283   std::size_t receive(
10284       const MutableBufferSequence & buffers);
10285
10286
10287 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.
10288
10289
10290 [heading Parameters]
10291     
10292
10293 [variablelist
10294   
10295 [[buffers][One or more buffers into which the data will be received.]]
10296
10297 ]
10298
10299
10300 [heading Return Value]
10301       
10302 The number of bytes received.
10303
10304
10305 [heading Exceptions]
10306     
10307
10308 [variablelist
10309   
10310 [[boost::system::system_error][Thrown on failure.]]
10311
10312 ]
10313
10314
10315 [heading Remarks]
10316       
10317 The receive operation can only be used with a connected socket. Use the receive\_from function to receive data on an unconnected datagram socket.
10318
10319
10320 [heading Example]
10321   
10322 To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
10323
10324    socket.receive(boost::asio::buffer(data, size)); 
10325
10326
10327 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
10328
10329
10330
10331
10332 [endsect]
10333
10334
10335
10336 [section:overload2 basic_datagram_socket::receive (2 of 3 overloads)]
10337
10338
10339 Receive some data on a connected socket. 
10340
10341
10342   template<
10343       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
10344   std::size_t receive(
10345       const MutableBufferSequence & buffers,
10346       socket_base::message_flags flags);
10347
10348
10349 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.
10350
10351
10352 [heading Parameters]
10353     
10354
10355 [variablelist
10356   
10357 [[buffers][One or more buffers into which the data will be received.]]
10358
10359 [[flags][Flags specifying how the receive call is to be made.]]
10360
10361 ]
10362
10363
10364 [heading Return Value]
10365       
10366 The number of bytes received.
10367
10368
10369 [heading Exceptions]
10370     
10371
10372 [variablelist
10373   
10374 [[boost::system::system_error][Thrown on failure.]]
10375
10376 ]
10377
10378
10379 [heading Remarks]
10380       
10381 The receive operation can only be used with a connected socket. Use the receive\_from function to receive data on an unconnected datagram socket. 
10382
10383
10384
10385
10386 [endsect]
10387
10388
10389
10390 [section:overload3 basic_datagram_socket::receive (3 of 3 overloads)]
10391
10392
10393 Receive some data on a connected socket. 
10394
10395
10396   template<
10397       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
10398   std::size_t receive(
10399       const MutableBufferSequence & buffers,
10400       socket_base::message_flags flags,
10401       boost::system::error_code & ec);
10402
10403
10404 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.
10405
10406
10407 [heading Parameters]
10408     
10409
10410 [variablelist
10411   
10412 [[buffers][One or more buffers into which the data will be received.]]
10413
10414 [[flags][Flags specifying how the receive call is to be made.]]
10415
10416 [[ec][Set to indicate what error occurred, if any.]]
10417
10418 ]
10419
10420
10421 [heading Return Value]
10422       
10423 The number of bytes received.
10424
10425
10426 [heading Remarks]
10427       
10428 The receive operation can only be used with a connected socket. Use the receive\_from function to receive data on an unconnected datagram socket. 
10429
10430
10431
10432
10433 [endsect]
10434
10435
10436 [endsect]
10437
10438
10439 [section:receive_buffer_size basic_datagram_socket::receive_buffer_size]
10440
10441
10442 ['Inherited from socket_base.]
10443
10444 [indexterm2 boost_asio.indexterm.basic_datagram_socket.receive_buffer_size..receive_buffer_size..basic_datagram_socket] 
10445 Socket option for the receive buffer size of a socket. 
10446
10447
10448   typedef implementation_defined receive_buffer_size;
10449
10450
10451
10452 Implements the SOL\_SOCKET/SO\_RCVBUF socket option.
10453
10454
10455 [heading Examples]
10456   
10457 Setting the option: 
10458
10459    boost::asio::ip::tcp::socket socket(my_context);
10460    ...
10461    boost::asio::socket_base::receive_buffer_size option(8192);
10462    socket.set_option(option);
10463
10464
10465
10466
10467
10468 Getting the current option value: 
10469
10470    boost::asio::ip::tcp::socket socket(my_context);
10471    ...
10472    boost::asio::socket_base::receive_buffer_size option;
10473    socket.get_option(option);
10474    int size = option.value();
10475
10476
10477
10478
10479
10480
10481
10482 [heading Requirements]
10483
10484 ['Header: ][^boost/asio/basic_datagram_socket.hpp]
10485
10486 ['Convenience header: ][^boost/asio.hpp]
10487
10488
10489 [endsect]
10490
10491
10492 [section:receive_from basic_datagram_socket::receive_from]
10493
10494 [indexterm2 boost_asio.indexterm.basic_datagram_socket.receive_from..receive_from..basic_datagram_socket] 
10495 Receive a datagram with the endpoint of the sender. 
10496
10497
10498   template<
10499       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
10500   std::size_t ``[link boost_asio.reference.basic_datagram_socket.receive_from.overload1 receive_from]``(
10501       const MutableBufferSequence & buffers,
10502       endpoint_type & sender_endpoint);
10503   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.receive_from.overload1 more...]]``
10504
10505   template<
10506       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
10507   std::size_t ``[link boost_asio.reference.basic_datagram_socket.receive_from.overload2 receive_from]``(
10508       const MutableBufferSequence & buffers,
10509       endpoint_type & sender_endpoint,
10510       socket_base::message_flags flags);
10511   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.receive_from.overload2 more...]]``
10512
10513   template<
10514       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
10515   std::size_t ``[link boost_asio.reference.basic_datagram_socket.receive_from.overload3 receive_from]``(
10516       const MutableBufferSequence & buffers,
10517       endpoint_type & sender_endpoint,
10518       socket_base::message_flags flags,
10519       boost::system::error_code & ec);
10520   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.receive_from.overload3 more...]]``
10521
10522
10523 [section:overload1 basic_datagram_socket::receive_from (1 of 3 overloads)]
10524
10525
10526 Receive a datagram with the endpoint of the sender. 
10527
10528
10529   template<
10530       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
10531   std::size_t receive_from(
10532       const MutableBufferSequence & buffers,
10533       endpoint_type & sender_endpoint);
10534
10535
10536 This function is used to receive a datagram. The function call will block until data has been received successfully or an error occurs.
10537
10538
10539 [heading Parameters]
10540     
10541
10542 [variablelist
10543   
10544 [[buffers][One or more buffers into which the data will be received.]]
10545
10546 [[sender_endpoint][An endpoint object that receives the endpoint of the remote sender of the datagram.]]
10547
10548 ]
10549
10550
10551 [heading Return Value]
10552       
10553 The number of bytes received.
10554
10555
10556 [heading Exceptions]
10557     
10558
10559 [variablelist
10560   
10561 [[boost::system::system_error][Thrown on failure.]]
10562
10563 ]
10564
10565
10566 [heading Example]
10567   
10568 To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
10569
10570    boost::asio::ip::udp::endpoint sender_endpoint;
10571    socket.receive_from(
10572        boost::asio::buffer(data, size), sender_endpoint);
10573
10574
10575 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
10576
10577
10578
10579
10580 [endsect]
10581
10582
10583
10584 [section:overload2 basic_datagram_socket::receive_from (2 of 3 overloads)]
10585
10586
10587 Receive a datagram with the endpoint of the sender. 
10588
10589
10590   template<
10591       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
10592   std::size_t receive_from(
10593       const MutableBufferSequence & buffers,
10594       endpoint_type & sender_endpoint,
10595       socket_base::message_flags flags);
10596
10597
10598 This function is used to receive a datagram. The function call will block until data has been received successfully or an error occurs.
10599
10600
10601 [heading Parameters]
10602     
10603
10604 [variablelist
10605   
10606 [[buffers][One or more buffers into which the data will be received.]]
10607
10608 [[sender_endpoint][An endpoint object that receives the endpoint of the remote sender of the datagram.]]
10609
10610 [[flags][Flags specifying how the receive call is to be made.]]
10611
10612 ]
10613
10614
10615 [heading Return Value]
10616       
10617 The number of bytes received.
10618
10619
10620 [heading Exceptions]
10621     
10622
10623 [variablelist
10624   
10625 [[boost::system::system_error][Thrown on failure. ]]
10626
10627 ]
10628
10629
10630
10631
10632 [endsect]
10633
10634
10635
10636 [section:overload3 basic_datagram_socket::receive_from (3 of 3 overloads)]
10637
10638
10639 Receive a datagram with the endpoint of the sender. 
10640
10641
10642   template<
10643       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
10644   std::size_t receive_from(
10645       const MutableBufferSequence & buffers,
10646       endpoint_type & sender_endpoint,
10647       socket_base::message_flags flags,
10648       boost::system::error_code & ec);
10649
10650
10651 This function is used to receive a datagram. The function call will block until data has been received successfully or an error occurs.
10652
10653
10654 [heading Parameters]
10655     
10656
10657 [variablelist
10658   
10659 [[buffers][One or more buffers into which the data will be received.]]
10660
10661 [[sender_endpoint][An endpoint object that receives the endpoint of the remote sender of the datagram.]]
10662
10663 [[flags][Flags specifying how the receive call is to be made.]]
10664
10665 [[ec][Set to indicate what error occurred, if any.]]
10666
10667 ]
10668
10669
10670 [heading Return Value]
10671       
10672 The number of bytes received. 
10673
10674
10675
10676
10677 [endsect]
10678
10679
10680 [endsect]
10681
10682
10683 [section:receive_low_watermark basic_datagram_socket::receive_low_watermark]
10684
10685
10686 ['Inherited from socket_base.]
10687
10688 [indexterm2 boost_asio.indexterm.basic_datagram_socket.receive_low_watermark..receive_low_watermark..basic_datagram_socket] 
10689 Socket option for the receive low watermark. 
10690
10691
10692   typedef implementation_defined receive_low_watermark;
10693
10694
10695
10696 Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option.
10697
10698
10699 [heading Examples]
10700   
10701 Setting the option: 
10702
10703    boost::asio::ip::tcp::socket socket(my_context);
10704    ...
10705    boost::asio::socket_base::receive_low_watermark option(1024);
10706    socket.set_option(option);
10707
10708
10709
10710
10711
10712 Getting the current option value: 
10713
10714    boost::asio::ip::tcp::socket socket(my_context);
10715    ...
10716    boost::asio::socket_base::receive_low_watermark option;
10717    socket.get_option(option);
10718    int size = option.value();
10719
10720
10721
10722
10723
10724
10725
10726 [heading Requirements]
10727
10728 ['Header: ][^boost/asio/basic_datagram_socket.hpp]
10729
10730 ['Convenience header: ][^boost/asio.hpp]
10731
10732
10733 [endsect]
10734
10735
10736 [section:release basic_datagram_socket::release]
10737
10738 [indexterm2 boost_asio.indexterm.basic_datagram_socket.release..release..basic_datagram_socket] 
10739 Release ownership of the underlying native socket. 
10740
10741
10742   native_handle_type ``[link boost_asio.reference.basic_datagram_socket.release.overload1 release]``();
10743   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.release.overload1 more...]]``
10744
10745   native_handle_type ``[link boost_asio.reference.basic_datagram_socket.release.overload2 release]``(
10746       boost::system::error_code & ec);
10747   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.release.overload2 more...]]``
10748
10749
10750 [section:overload1 basic_datagram_socket::release (1 of 2 overloads)]
10751
10752
10753 ['Inherited from basic_socket.]
10754
10755
10756 Release ownership of the underlying native socket. 
10757
10758
10759   native_handle_type release();
10760
10761
10762 This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error. Ownership of the native socket is then transferred to the caller.
10763
10764
10765 [heading Exceptions]
10766     
10767
10768 [variablelist
10769   
10770 [[boost::system::system_error][Thrown on failure.]]
10771
10772 ]
10773
10774
10775 [heading Remarks]
10776       
10777 This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms. 
10778
10779
10780
10781
10782 [endsect]
10783
10784
10785
10786 [section:overload2 basic_datagram_socket::release (2 of 2 overloads)]
10787
10788
10789 ['Inherited from basic_socket.]
10790
10791
10792 Release ownership of the underlying native socket. 
10793
10794
10795   native_handle_type release(
10796       boost::system::error_code & ec);
10797
10798
10799 This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error. Ownership of the native socket is then transferred to the caller.
10800
10801
10802 [heading Parameters]
10803     
10804
10805 [variablelist
10806   
10807 [[ec][Set to indicate what error occurred, if any.]]
10808
10809 ]
10810
10811
10812 [heading Remarks]
10813       
10814 This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms. 
10815
10816
10817
10818
10819 [endsect]
10820
10821
10822 [endsect]
10823
10824 [section:remote_endpoint basic_datagram_socket::remote_endpoint]
10825
10826 [indexterm2 boost_asio.indexterm.basic_datagram_socket.remote_endpoint..remote_endpoint..basic_datagram_socket] 
10827 Get the remote endpoint of the socket. 
10828
10829
10830   endpoint_type ``[link boost_asio.reference.basic_datagram_socket.remote_endpoint.overload1 remote_endpoint]``() const;
10831   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.remote_endpoint.overload1 more...]]``
10832
10833   endpoint_type ``[link boost_asio.reference.basic_datagram_socket.remote_endpoint.overload2 remote_endpoint]``(
10834       boost::system::error_code & ec) const;
10835   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.remote_endpoint.overload2 more...]]``
10836
10837
10838 [section:overload1 basic_datagram_socket::remote_endpoint (1 of 2 overloads)]
10839
10840
10841 ['Inherited from basic_socket.]
10842
10843
10844 Get the remote endpoint of the socket. 
10845
10846
10847   endpoint_type remote_endpoint() const;
10848
10849
10850 This function is used to obtain the remote endpoint of the socket.
10851
10852
10853 [heading Return Value]
10854       
10855 An object that represents the remote endpoint of the socket.
10856
10857
10858 [heading Exceptions]
10859     
10860
10861 [variablelist
10862   
10863 [[boost::system::system_error][Thrown on failure.]]
10864
10865 ]
10866
10867
10868 [heading Example]
10869   
10870
10871
10872    boost::asio::ip::tcp::socket socket(my_context);
10873    ...
10874    boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint();
10875
10876
10877
10878
10879
10880
10881
10882 [endsect]
10883
10884
10885
10886 [section:overload2 basic_datagram_socket::remote_endpoint (2 of 2 overloads)]
10887
10888
10889 ['Inherited from basic_socket.]
10890
10891
10892 Get the remote endpoint of the socket. 
10893
10894
10895   endpoint_type remote_endpoint(
10896       boost::system::error_code & ec) const;
10897
10898
10899 This function is used to obtain the remote endpoint of the socket.
10900
10901
10902 [heading Parameters]
10903     
10904
10905 [variablelist
10906   
10907 [[ec][Set to indicate what error occurred, if any.]]
10908
10909 ]
10910
10911
10912 [heading Return Value]
10913       
10914 An object that represents the remote endpoint of the socket. Returns a default-constructed endpoint object if an error occurred.
10915
10916
10917 [heading Example]
10918   
10919
10920
10921    boost::asio::ip::tcp::socket socket(my_context);
10922    ...
10923    boost::system::error_code ec;
10924    boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(ec);
10925    if (ec)
10926    {
10927      // An error occurred.
10928    }
10929
10930
10931
10932
10933
10934
10935
10936 [endsect]
10937
10938
10939 [endsect]
10940
10941
10942 [section:reuse_address basic_datagram_socket::reuse_address]
10943
10944
10945 ['Inherited from socket_base.]
10946
10947 [indexterm2 boost_asio.indexterm.basic_datagram_socket.reuse_address..reuse_address..basic_datagram_socket] 
10948 Socket option to allow the socket to be bound to an address that is already in use. 
10949
10950
10951   typedef implementation_defined reuse_address;
10952
10953
10954
10955 Implements the SOL\_SOCKET/SO\_REUSEADDR socket option.
10956
10957
10958 [heading Examples]
10959   
10960 Setting the option: 
10961
10962    boost::asio::ip::tcp::acceptor acceptor(my_context);
10963    ...
10964    boost::asio::socket_base::reuse_address option(true);
10965    acceptor.set_option(option);
10966
10967
10968
10969
10970
10971 Getting the current option value: 
10972
10973    boost::asio::ip::tcp::acceptor acceptor(my_context);
10974    ...
10975    boost::asio::socket_base::reuse_address option;
10976    acceptor.get_option(option);
10977    bool is_set = option.value();
10978
10979
10980
10981
10982
10983
10984
10985 [heading Requirements]
10986
10987 ['Header: ][^boost/asio/basic_datagram_socket.hpp]
10988
10989 ['Convenience header: ][^boost/asio.hpp]
10990
10991
10992 [endsect]
10993
10994
10995 [section:send basic_datagram_socket::send]
10996
10997 [indexterm2 boost_asio.indexterm.basic_datagram_socket.send..send..basic_datagram_socket] 
10998 Send some data on a connected socket. 
10999
11000
11001   template<
11002       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
11003   std::size_t ``[link boost_asio.reference.basic_datagram_socket.send.overload1 send]``(
11004       const ConstBufferSequence & buffers);
11005   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.send.overload1 more...]]``
11006
11007   template<
11008       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
11009   std::size_t ``[link boost_asio.reference.basic_datagram_socket.send.overload2 send]``(
11010       const ConstBufferSequence & buffers,
11011       socket_base::message_flags flags);
11012   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.send.overload2 more...]]``
11013
11014   template<
11015       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
11016   std::size_t ``[link boost_asio.reference.basic_datagram_socket.send.overload3 send]``(
11017       const ConstBufferSequence & buffers,
11018       socket_base::message_flags flags,
11019       boost::system::error_code & ec);
11020   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.send.overload3 more...]]``
11021
11022
11023 [section:overload1 basic_datagram_socket::send (1 of 3 overloads)]
11024
11025
11026 Send some data on a connected socket. 
11027
11028
11029   template<
11030       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
11031   std::size_t send(
11032       const ConstBufferSequence & buffers);
11033
11034
11035 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.
11036
11037
11038 [heading Parameters]
11039     
11040
11041 [variablelist
11042   
11043 [[buffers][One ore more data buffers to be sent on the socket.]]
11044
11045 ]
11046
11047
11048 [heading Return Value]
11049       
11050 The number of bytes sent.
11051
11052
11053 [heading Exceptions]
11054     
11055
11056 [variablelist
11057   
11058 [[boost::system::system_error][Thrown on failure.]]
11059
11060 ]
11061
11062
11063 [heading Remarks]
11064       
11065 The send operation can only be used with a connected socket. Use the send\_to function to send data on an unconnected datagram socket.
11066
11067
11068 [heading Example]
11069   
11070 To send a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
11071
11072    socket.send(boost::asio::buffer(data, size)); 
11073
11074
11075 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
11076
11077
11078
11079
11080 [endsect]
11081
11082
11083
11084 [section:overload2 basic_datagram_socket::send (2 of 3 overloads)]
11085
11086
11087 Send some data on a connected socket. 
11088
11089
11090   template<
11091       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
11092   std::size_t send(
11093       const ConstBufferSequence & buffers,
11094       socket_base::message_flags flags);
11095
11096
11097 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.
11098
11099
11100 [heading Parameters]
11101     
11102
11103 [variablelist
11104   
11105 [[buffers][One ore more data buffers to be sent on the socket.]]
11106
11107 [[flags][Flags specifying how the send call is to be made.]]
11108
11109 ]
11110
11111
11112 [heading Return Value]
11113       
11114 The number of bytes sent.
11115
11116
11117 [heading Exceptions]
11118     
11119
11120 [variablelist
11121   
11122 [[boost::system::system_error][Thrown on failure.]]
11123
11124 ]
11125
11126
11127 [heading Remarks]
11128       
11129 The send operation can only be used with a connected socket. Use the send\_to function to send data on an unconnected datagram socket. 
11130
11131
11132
11133
11134 [endsect]
11135
11136
11137
11138 [section:overload3 basic_datagram_socket::send (3 of 3 overloads)]
11139
11140
11141 Send some data on a connected socket. 
11142
11143
11144   template<
11145       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
11146   std::size_t send(
11147       const ConstBufferSequence & buffers,
11148       socket_base::message_flags flags,
11149       boost::system::error_code & ec);
11150
11151
11152 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.
11153
11154
11155 [heading Parameters]
11156     
11157
11158 [variablelist
11159   
11160 [[buffers][One or more data buffers to be sent on the socket.]]
11161
11162 [[flags][Flags specifying how the send call is to be made.]]
11163
11164 [[ec][Set to indicate what error occurred, if any.]]
11165
11166 ]
11167
11168
11169 [heading Return Value]
11170       
11171 The number of bytes sent.
11172
11173
11174 [heading Remarks]
11175       
11176 The send operation can only be used with a connected socket. Use the send\_to function to send data on an unconnected datagram socket. 
11177
11178
11179
11180
11181 [endsect]
11182
11183
11184 [endsect]
11185
11186
11187 [section:send_buffer_size basic_datagram_socket::send_buffer_size]
11188
11189
11190 ['Inherited from socket_base.]
11191
11192 [indexterm2 boost_asio.indexterm.basic_datagram_socket.send_buffer_size..send_buffer_size..basic_datagram_socket] 
11193 Socket option for the send buffer size of a socket. 
11194
11195
11196   typedef implementation_defined send_buffer_size;
11197
11198
11199
11200 Implements the SOL\_SOCKET/SO\_SNDBUF socket option.
11201
11202
11203 [heading Examples]
11204   
11205 Setting the option: 
11206
11207    boost::asio::ip::tcp::socket socket(my_context);
11208    ...
11209    boost::asio::socket_base::send_buffer_size option(8192);
11210    socket.set_option(option);
11211
11212
11213
11214
11215
11216 Getting the current option value: 
11217
11218    boost::asio::ip::tcp::socket socket(my_context);
11219    ...
11220    boost::asio::socket_base::send_buffer_size option;
11221    socket.get_option(option);
11222    int size = option.value();
11223
11224
11225
11226
11227
11228
11229
11230 [heading Requirements]
11231
11232 ['Header: ][^boost/asio/basic_datagram_socket.hpp]
11233
11234 ['Convenience header: ][^boost/asio.hpp]
11235
11236
11237 [endsect]
11238
11239
11240
11241 [section:send_low_watermark basic_datagram_socket::send_low_watermark]
11242
11243
11244 ['Inherited from socket_base.]
11245
11246 [indexterm2 boost_asio.indexterm.basic_datagram_socket.send_low_watermark..send_low_watermark..basic_datagram_socket] 
11247 Socket option for the send low watermark. 
11248
11249
11250   typedef implementation_defined send_low_watermark;
11251
11252
11253
11254 Implements the SOL\_SOCKET/SO\_SNDLOWAT socket option.
11255
11256
11257 [heading Examples]
11258   
11259 Setting the option: 
11260
11261    boost::asio::ip::tcp::socket socket(my_context);
11262    ...
11263    boost::asio::socket_base::send_low_watermark option(1024);
11264    socket.set_option(option);
11265
11266
11267
11268
11269
11270 Getting the current option value: 
11271
11272    boost::asio::ip::tcp::socket socket(my_context);
11273    ...
11274    boost::asio::socket_base::send_low_watermark option;
11275    socket.get_option(option);
11276    int size = option.value();
11277
11278
11279
11280
11281
11282
11283
11284 [heading Requirements]
11285
11286 ['Header: ][^boost/asio/basic_datagram_socket.hpp]
11287
11288 ['Convenience header: ][^boost/asio.hpp]
11289
11290
11291 [endsect]
11292
11293
11294 [section:send_to basic_datagram_socket::send_to]
11295
11296 [indexterm2 boost_asio.indexterm.basic_datagram_socket.send_to..send_to..basic_datagram_socket] 
11297 Send a datagram to the specified endpoint. 
11298
11299
11300   template<
11301       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
11302   std::size_t ``[link boost_asio.reference.basic_datagram_socket.send_to.overload1 send_to]``(
11303       const ConstBufferSequence & buffers,
11304       const endpoint_type & destination);
11305   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.send_to.overload1 more...]]``
11306
11307   template<
11308       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
11309   std::size_t ``[link boost_asio.reference.basic_datagram_socket.send_to.overload2 send_to]``(
11310       const ConstBufferSequence & buffers,
11311       const endpoint_type & destination,
11312       socket_base::message_flags flags);
11313   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.send_to.overload2 more...]]``
11314
11315   template<
11316       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
11317   std::size_t ``[link boost_asio.reference.basic_datagram_socket.send_to.overload3 send_to]``(
11318       const ConstBufferSequence & buffers,
11319       const endpoint_type & destination,
11320       socket_base::message_flags flags,
11321       boost::system::error_code & ec);
11322   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.send_to.overload3 more...]]``
11323
11324
11325 [section:overload1 basic_datagram_socket::send_to (1 of 3 overloads)]
11326
11327
11328 Send a datagram to the specified endpoint. 
11329
11330
11331   template<
11332       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
11333   std::size_t send_to(
11334       const ConstBufferSequence & buffers,
11335       const endpoint_type & destination);
11336
11337
11338 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.
11339
11340
11341 [heading Parameters]
11342     
11343
11344 [variablelist
11345   
11346 [[buffers][One or more data buffers to be sent to the remote endpoint.]]
11347
11348 [[destination][The remote endpoint to which the data will be sent.]]
11349
11350 ]
11351
11352
11353 [heading Return Value]
11354       
11355 The number of bytes sent.
11356
11357
11358 [heading Exceptions]
11359     
11360
11361 [variablelist
11362   
11363 [[boost::system::system_error][Thrown on failure.]]
11364
11365 ]
11366
11367
11368 [heading Example]
11369   
11370 To send a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
11371
11372    boost::asio::ip::udp::endpoint destination(
11373        boost::asio::ip::address::from_string("1.2.3.4"), 12345);
11374    socket.send_to(boost::asio::buffer(data, size), destination);
11375
11376
11377 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
11378
11379
11380
11381
11382 [endsect]
11383
11384
11385
11386 [section:overload2 basic_datagram_socket::send_to (2 of 3 overloads)]
11387
11388
11389 Send a datagram to the specified endpoint. 
11390
11391
11392   template<
11393       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
11394   std::size_t send_to(
11395       const ConstBufferSequence & buffers,
11396       const endpoint_type & destination,
11397       socket_base::message_flags flags);
11398
11399
11400 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.
11401
11402
11403 [heading Parameters]
11404     
11405
11406 [variablelist
11407   
11408 [[buffers][One or more data buffers to be sent to the remote endpoint.]]
11409
11410 [[destination][The remote endpoint to which the data will be sent.]]
11411
11412 [[flags][Flags specifying how the send call is to be made.]]
11413
11414 ]
11415
11416
11417 [heading Return Value]
11418       
11419 The number of bytes sent.
11420
11421
11422 [heading Exceptions]
11423     
11424
11425 [variablelist
11426   
11427 [[boost::system::system_error][Thrown on failure. ]]
11428
11429 ]
11430
11431
11432
11433
11434 [endsect]
11435
11436
11437
11438 [section:overload3 basic_datagram_socket::send_to (3 of 3 overloads)]
11439
11440
11441 Send a datagram to the specified endpoint. 
11442
11443
11444   template<
11445       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
11446   std::size_t send_to(
11447       const ConstBufferSequence & buffers,
11448       const endpoint_type & destination,
11449       socket_base::message_flags flags,
11450       boost::system::error_code & ec);
11451
11452
11453 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.
11454
11455
11456 [heading Parameters]
11457     
11458
11459 [variablelist
11460   
11461 [[buffers][One or more data buffers to be sent to the remote endpoint.]]
11462
11463 [[destination][The remote endpoint to which the data will be sent.]]
11464
11465 [[flags][Flags specifying how the send call is to be made.]]
11466
11467 [[ec][Set to indicate what error occurred, if any.]]
11468
11469 ]
11470
11471
11472 [heading Return Value]
11473       
11474 The number of bytes sent. 
11475
11476
11477
11478
11479 [endsect]
11480
11481
11482 [endsect]
11483
11484 [section:set_option basic_datagram_socket::set_option]
11485
11486 [indexterm2 boost_asio.indexterm.basic_datagram_socket.set_option..set_option..basic_datagram_socket] 
11487 Set an option on the socket. 
11488
11489
11490   template<
11491       typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
11492   void ``[link boost_asio.reference.basic_datagram_socket.set_option.overload1 set_option]``(
11493       const SettableSocketOption & option);
11494   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.set_option.overload1 more...]]``
11495
11496   template<
11497       typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
11498   void ``[link boost_asio.reference.basic_datagram_socket.set_option.overload2 set_option]``(
11499       const SettableSocketOption & option,
11500       boost::system::error_code & ec);
11501   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.set_option.overload2 more...]]``
11502
11503
11504 [section:overload1 basic_datagram_socket::set_option (1 of 2 overloads)]
11505
11506
11507 ['Inherited from basic_socket.]
11508
11509
11510 Set an option on the socket. 
11511
11512
11513   template<
11514       typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
11515   void set_option(
11516       const SettableSocketOption & option);
11517
11518
11519 This function is used to set an option on the socket.
11520
11521
11522 [heading Parameters]
11523     
11524
11525 [variablelist
11526   
11527 [[option][The new option value to be set on the socket.]]
11528
11529 ]
11530
11531
11532 [heading Exceptions]
11533     
11534
11535 [variablelist
11536   
11537 [[boost::system::system_error][Thrown on failure.]]
11538
11539 ]
11540
11541
11542
11543 [heading Example]
11544   
11545 Setting the IPPROTO\_TCP/TCP\_NODELAY option: 
11546
11547    boost::asio::ip::tcp::socket socket(my_context);
11548    ...
11549    boost::asio::ip::tcp::no_delay option(true);
11550    socket.set_option(option);
11551
11552
11553
11554
11555
11556
11557
11558 [endsect]
11559
11560
11561
11562 [section:overload2 basic_datagram_socket::set_option (2 of 2 overloads)]
11563
11564
11565 ['Inherited from basic_socket.]
11566
11567
11568 Set an option on the socket. 
11569
11570
11571   template<
11572       typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
11573   void set_option(
11574       const SettableSocketOption & option,
11575       boost::system::error_code & ec);
11576
11577
11578 This function is used to set an option on the socket.
11579
11580
11581 [heading Parameters]
11582     
11583
11584 [variablelist
11585   
11586 [[option][The new option value to be set on the socket.]]
11587
11588 [[ec][Set to indicate what error occurred, if any.]]
11589
11590 ]
11591
11592
11593
11594 [heading Example]
11595   
11596 Setting the IPPROTO\_TCP/TCP\_NODELAY option: 
11597
11598    boost::asio::ip::tcp::socket socket(my_context);
11599    ...
11600    boost::asio::ip::tcp::no_delay option(true);
11601    boost::system::error_code ec;
11602    socket.set_option(option, ec);
11603    if (ec)
11604    {
11605      // An error occurred.
11606    }
11607
11608
11609
11610
11611
11612
11613
11614 [endsect]
11615
11616
11617 [endsect]
11618
11619 [section:shutdown basic_datagram_socket::shutdown]
11620
11621 [indexterm2 boost_asio.indexterm.basic_datagram_socket.shutdown..shutdown..basic_datagram_socket] 
11622 Disable sends or receives on the socket. 
11623
11624
11625   void ``[link boost_asio.reference.basic_datagram_socket.shutdown.overload1 shutdown]``(
11626       shutdown_type what);
11627   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.shutdown.overload1 more...]]``
11628
11629   void ``[link boost_asio.reference.basic_datagram_socket.shutdown.overload2 shutdown]``(
11630       shutdown_type what,
11631       boost::system::error_code & ec);
11632   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.shutdown.overload2 more...]]``
11633
11634
11635 [section:overload1 basic_datagram_socket::shutdown (1 of 2 overloads)]
11636
11637
11638 ['Inherited from basic_socket.]
11639
11640
11641 Disable sends or receives on the socket. 
11642
11643
11644   void shutdown(
11645       shutdown_type what);
11646
11647
11648 This function is used to disable send operations, receive operations, or both.
11649
11650
11651 [heading Parameters]
11652     
11653
11654 [variablelist
11655   
11656 [[what][Determines what types of operation will no longer be allowed.]]
11657
11658 ]
11659
11660
11661 [heading Exceptions]
11662     
11663
11664 [variablelist
11665   
11666 [[boost::system::system_error][Thrown on failure.]]
11667
11668 ]
11669
11670
11671 [heading Example]
11672   
11673 Shutting down the send side of the socket: 
11674
11675    boost::asio::ip::tcp::socket socket(my_context);
11676    ...
11677    socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send);
11678
11679
11680
11681
11682
11683
11684
11685 [endsect]
11686
11687
11688
11689 [section:overload2 basic_datagram_socket::shutdown (2 of 2 overloads)]
11690
11691
11692 ['Inherited from basic_socket.]
11693
11694
11695 Disable sends or receives on the socket. 
11696
11697
11698   void shutdown(
11699       shutdown_type what,
11700       boost::system::error_code & ec);
11701
11702
11703 This function is used to disable send operations, receive operations, or both.
11704
11705
11706 [heading Parameters]
11707     
11708
11709 [variablelist
11710   
11711 [[what][Determines what types of operation will no longer be allowed.]]
11712
11713 [[ec][Set to indicate what error occurred, if any.]]
11714
11715 ]
11716
11717
11718 [heading Example]
11719   
11720 Shutting down the send side of the socket: 
11721
11722    boost::asio::ip::tcp::socket socket(my_context);
11723    ...
11724    boost::system::error_code ec;
11725    socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send, ec);
11726    if (ec)
11727    {
11728      // An error occurred.
11729    }
11730
11731
11732
11733
11734
11735
11736
11737 [endsect]
11738
11739
11740 [endsect]
11741
11742
11743 [section:shutdown_type basic_datagram_socket::shutdown_type]
11744
11745
11746 ['Inherited from socket_base.]
11747
11748 [indexterm2 boost_asio.indexterm.basic_datagram_socket.shutdown_type..shutdown_type..basic_datagram_socket] 
11749 Different ways a socket may be shutdown. 
11750
11751
11752   enum shutdown_type
11753
11754 [indexterm2 boost_asio.indexterm.basic_datagram_socket.shutdown_type.shutdown_receive..shutdown_receive..basic_datagram_socket]
11755 [indexterm2 boost_asio.indexterm.basic_datagram_socket.shutdown_type.shutdown_send..shutdown_send..basic_datagram_socket]
11756 [indexterm2 boost_asio.indexterm.basic_datagram_socket.shutdown_type.shutdown_both..shutdown_both..basic_datagram_socket]
11757
11758 [heading Values]
11759 [variablelist
11760
11761   [
11762     [shutdown_receive]
11763     [Shutdown the receive side of the socket. ]
11764   ]
11765
11766   [
11767     [shutdown_send]
11768     [Shutdown the send side of the socket. ]
11769   ]
11770
11771   [
11772     [shutdown_both]
11773     [Shutdown both send and receive on the socket. ]
11774   ]
11775
11776 ]
11777
11778
11779
11780 [endsect]
11781
11782
11783 [section:wait basic_datagram_socket::wait]
11784
11785 [indexterm2 boost_asio.indexterm.basic_datagram_socket.wait..wait..basic_datagram_socket] 
11786 Wait for the socket to become ready to read, ready to write, or to have pending error conditions. 
11787
11788
11789   void ``[link boost_asio.reference.basic_datagram_socket.wait.overload1 wait]``(
11790       wait_type w);
11791   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.wait.overload1 more...]]``
11792
11793   void ``[link boost_asio.reference.basic_datagram_socket.wait.overload2 wait]``(
11794       wait_type w,
11795       boost::system::error_code & ec);
11796   ``  [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.wait.overload2 more...]]``
11797
11798
11799 [section:overload1 basic_datagram_socket::wait (1 of 2 overloads)]
11800
11801
11802 ['Inherited from basic_socket.]
11803
11804
11805 Wait for the socket to become ready to read, ready to write, or to have pending error conditions. 
11806
11807
11808   void wait(
11809       wait_type w);
11810
11811
11812 This function is used to perform a blocking wait for a socket to enter a ready to read, write or error condition state.
11813
11814
11815 [heading Parameters]
11816     
11817
11818 [variablelist
11819   
11820 [[w][Specifies the desired socket state.]]
11821
11822 ]
11823
11824
11825 [heading Example]
11826   
11827 Waiting for a socket to become readable. 
11828
11829    boost::asio::ip::tcp::socket socket(my_context);
11830    ...
11831    socket.wait(boost::asio::ip::tcp::socket::wait_read);
11832
11833
11834
11835
11836
11837
11838
11839 [endsect]
11840
11841
11842
11843 [section:overload2 basic_datagram_socket::wait (2 of 2 overloads)]
11844
11845
11846 ['Inherited from basic_socket.]
11847
11848
11849 Wait for the socket to become ready to read, ready to write, or to have pending error conditions. 
11850
11851
11852   void wait(
11853       wait_type w,
11854       boost::system::error_code & ec);
11855
11856
11857 This function is used to perform a blocking wait for a socket to enter a ready to read, write or error condition state.
11858
11859
11860 [heading Parameters]
11861     
11862
11863 [variablelist
11864   
11865 [[w][Specifies the desired socket state.]]
11866
11867 [[ec][Set to indicate what error occurred, if any.]]
11868
11869 ]
11870
11871
11872 [heading Example]
11873   
11874 Waiting for a socket to become readable. 
11875
11876    boost::asio::ip::tcp::socket socket(my_context);
11877    ...
11878    boost::system::error_code ec;
11879    socket.wait(boost::asio::ip::tcp::socket::wait_read, ec);
11880
11881
11882
11883
11884
11885
11886
11887 [endsect]
11888
11889
11890 [endsect]
11891
11892
11893 [section:wait_type basic_datagram_socket::wait_type]
11894
11895
11896 ['Inherited from socket_base.]
11897
11898 [indexterm2 boost_asio.indexterm.basic_datagram_socket.wait_type..wait_type..basic_datagram_socket] 
11899 Wait types. 
11900
11901
11902   enum wait_type
11903
11904 [indexterm2 boost_asio.indexterm.basic_datagram_socket.wait_type.wait_read..wait_read..basic_datagram_socket]
11905 [indexterm2 boost_asio.indexterm.basic_datagram_socket.wait_type.wait_write..wait_write..basic_datagram_socket]
11906 [indexterm2 boost_asio.indexterm.basic_datagram_socket.wait_type.wait_error..wait_error..basic_datagram_socket]
11907
11908 [heading Values]
11909 [variablelist
11910
11911   [
11912     [wait_read]
11913     [Wait for a socket to become ready to read. ]
11914   ]
11915
11916   [
11917     [wait_write]
11918     [Wait for a socket to become ready to write. ]
11919   ]
11920
11921   [
11922     [wait_error]
11923     [Wait for a socket to have error conditions pending. ]
11924   ]
11925
11926 ]
11927
11928
11929 For use with `basic_socket::wait()` and `basic_socket::async_wait()`. 
11930
11931
11932 [endsect]
11933
11934
11935
11936 [section:_basic_datagram_socket basic_datagram_socket::~basic_datagram_socket]
11937
11938 [indexterm2 boost_asio.indexterm.basic_datagram_socket._basic_datagram_socket..~basic_datagram_socket..basic_datagram_socket] 
11939 Destroys the socket. 
11940
11941
11942   ~basic_datagram_socket();
11943
11944
11945 This function destroys the socket, cancelling any outstanding asynchronous operations associated with the socket as if by calling `cancel`. 
11946
11947
11948 [endsect]
11949
11950
11951
11952 [endsect]
11953
11954 [section:basic_datagram_socket__rebind_executor basic_datagram_socket::rebind_executor]
11955
11956
11957 Rebinds the socket type to another executor. 
11958
11959
11960   template<
11961       typename ``[link boost_asio.reference.Executor1 Executor1]``>
11962   struct rebind_executor
11963
11964
11965 [heading Types]
11966 [table
11967   [[Name][Description]]
11968
11969   [
11970
11971     [[link boost_asio.reference.basic_datagram_socket__rebind_executor.other [*other]]]
11972     [The socket type when rebound to the specified executor. ]
11973   
11974   ]
11975
11976 ]
11977
11978 [heading Requirements]
11979
11980 ['Header: ][^boost/asio/basic_datagram_socket.hpp]
11981
11982 ['Convenience header: ][^boost/asio.hpp]
11983
11984
11985 [section:other basic_datagram_socket::rebind_executor::other]
11986
11987 [indexterm2 boost_asio.indexterm.basic_datagram_socket__rebind_executor.other..other..basic_datagram_socket::rebind_executor] 
11988 The socket type when rebound to the specified executor. 
11989
11990
11991   typedef basic_datagram_socket< Protocol, Executor1 > other;
11992
11993
11994 [heading Types]
11995 [table
11996   [[Name][Description]]
11997
11998   [
11999
12000     [[link boost_asio.reference.basic_datagram_socket__rebind_executor [*rebind_executor]]]
12001     [Rebinds the socket type to another executor. ]
12002   
12003   ]
12004
12005   [
12006
12007     [[link boost_asio.reference.basic_datagram_socket.broadcast [*broadcast]]]
12008     [Socket option to permit sending of broadcast messages. ]
12009   
12010   ]
12011
12012   [
12013
12014     [[link boost_asio.reference.basic_datagram_socket.bytes_readable [*bytes_readable]]]
12015     [IO control command to get the amount of data that can be read without blocking. ]
12016   
12017   ]
12018
12019   [
12020
12021     [[link boost_asio.reference.basic_datagram_socket.debug [*debug]]]
12022     [Socket option to enable socket-level debugging. ]
12023   
12024   ]
12025
12026   [
12027
12028     [[link boost_asio.reference.basic_datagram_socket.do_not_route [*do_not_route]]]
12029     [Socket option to prevent routing, use local interfaces only. ]
12030   
12031   ]
12032
12033   [
12034
12035     [[link boost_asio.reference.basic_datagram_socket.enable_connection_aborted [*enable_connection_aborted]]]
12036     [Socket option to report aborted connections on accept. ]
12037   
12038   ]
12039
12040   [
12041
12042     [[link boost_asio.reference.basic_datagram_socket.endpoint_type [*endpoint_type]]]
12043     [The endpoint type. ]
12044   
12045   ]
12046
12047   [
12048
12049     [[link boost_asio.reference.basic_datagram_socket.executor_type [*executor_type]]]
12050     [The type of the executor associated with the object. ]
12051   
12052   ]
12053
12054   [
12055
12056     [[link boost_asio.reference.basic_datagram_socket.keep_alive [*keep_alive]]]
12057     [Socket option to send keep-alives. ]
12058   
12059   ]
12060
12061   [
12062
12063     [[link boost_asio.reference.basic_datagram_socket.linger [*linger]]]
12064     [Socket option to specify whether the socket lingers on close if unsent data is present. ]
12065   
12066   ]
12067
12068   [
12069
12070     [[link boost_asio.reference.basic_datagram_socket.lowest_layer_type [*lowest_layer_type]]]
12071     [A basic_socket is always the lowest layer. ]
12072   
12073   ]
12074
12075   [
12076
12077     [[link boost_asio.reference.basic_datagram_socket.message_flags [*message_flags]]]
12078     [Bitmask type for flags that can be passed to send and receive operations. ]
12079   
12080   ]
12081
12082   [
12083
12084     [[link boost_asio.reference.basic_datagram_socket.native_handle_type [*native_handle_type]]]
12085     [The native representation of a socket. ]
12086   
12087   ]
12088
12089   [
12090
12091     [[link boost_asio.reference.basic_datagram_socket.out_of_band_inline [*out_of_band_inline]]]
12092     [Socket option for putting received out-of-band data inline. ]
12093   
12094   ]
12095
12096   [
12097
12098     [[link boost_asio.reference.basic_datagram_socket.protocol_type [*protocol_type]]]
12099     [The protocol type. ]
12100   
12101   ]
12102
12103   [
12104
12105     [[link boost_asio.reference.basic_datagram_socket.receive_buffer_size [*receive_buffer_size]]]
12106     [Socket option for the receive buffer size of a socket. ]
12107   
12108   ]
12109
12110   [
12111
12112     [[link boost_asio.reference.basic_datagram_socket.receive_low_watermark [*receive_low_watermark]]]
12113     [Socket option for the receive low watermark. ]
12114   
12115   ]
12116
12117   [
12118
12119     [[link boost_asio.reference.basic_datagram_socket.reuse_address [*reuse_address]]]
12120     [Socket option to allow the socket to be bound to an address that is already in use. ]
12121   
12122   ]
12123
12124   [
12125
12126     [[link boost_asio.reference.basic_datagram_socket.send_buffer_size [*send_buffer_size]]]
12127     [Socket option for the send buffer size of a socket. ]
12128   
12129   ]
12130
12131   [
12132
12133     [[link boost_asio.reference.basic_datagram_socket.send_low_watermark [*send_low_watermark]]]
12134     [Socket option for the send low watermark. ]
12135   
12136   ]
12137
12138   [
12139
12140     [[link boost_asio.reference.basic_datagram_socket.shutdown_type [*shutdown_type]]]
12141     [Different ways a socket may be shutdown. ]
12142   
12143   ]
12144
12145   [
12146
12147     [[link boost_asio.reference.basic_datagram_socket.wait_type [*wait_type]]]
12148     [Wait types. ]
12149   
12150   ]
12151
12152 ]
12153
12154 [heading Member Functions]
12155 [table
12156   [[Name][Description]]
12157
12158   [
12159     [[link boost_asio.reference.basic_datagram_socket.assign [*assign]]]
12160     [Assign an existing native socket to the socket. ]
12161   ]
12162   
12163   [
12164     [[link boost_asio.reference.basic_datagram_socket.async_connect [*async_connect]]]
12165     [Start an asynchronous connect. ]
12166   ]
12167   
12168   [
12169     [[link boost_asio.reference.basic_datagram_socket.async_receive [*async_receive]]]
12170     [Start an asynchronous receive on a connected socket. ]
12171   ]
12172   
12173   [
12174     [[link boost_asio.reference.basic_datagram_socket.async_receive_from [*async_receive_from]]]
12175     [Start an asynchronous receive. ]
12176   ]
12177   
12178   [
12179     [[link boost_asio.reference.basic_datagram_socket.async_send [*async_send]]]
12180     [Start an asynchronous send on a connected socket. ]
12181   ]
12182   
12183   [
12184     [[link boost_asio.reference.basic_datagram_socket.async_send_to [*async_send_to]]]
12185     [Start an asynchronous send. ]
12186   ]
12187   
12188   [
12189     [[link boost_asio.reference.basic_datagram_socket.async_wait [*async_wait]]]
12190     [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
12191   ]
12192   
12193   [
12194     [[link boost_asio.reference.basic_datagram_socket.at_mark [*at_mark]]]
12195     [Determine whether the socket is at the out-of-band data mark. ]
12196   ]
12197   
12198   [
12199     [[link boost_asio.reference.basic_datagram_socket.available [*available]]]
12200     [Determine the number of bytes available for reading. ]
12201   ]
12202   
12203   [
12204     [[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket [*basic_datagram_socket]]]
12205     [Construct a basic_datagram_socket without opening it. 
12206      [hr]
12207      Construct and open a basic_datagram_socket. 
12208      [hr]
12209      Construct a basic_datagram_socket, opening it and binding it to the given local endpoint. 
12210      [hr]
12211      Construct a basic_datagram_socket on an existing native socket. 
12212      [hr]
12213      Move-construct a basic_datagram_socket from another. 
12214      [hr]
12215      Move-construct a basic_datagram_socket from a socket of another protocol type. ]
12216   ]
12217   
12218   [
12219     [[link boost_asio.reference.basic_datagram_socket.bind [*bind]]]
12220     [Bind the socket to the given local endpoint. ]
12221   ]
12222   
12223   [
12224     [[link boost_asio.reference.basic_datagram_socket.cancel [*cancel]]]
12225     [Cancel all asynchronous operations associated with the socket. ]
12226   ]
12227   
12228   [
12229     [[link boost_asio.reference.basic_datagram_socket.close [*close]]]
12230     [Close the socket. ]
12231   ]
12232   
12233   [
12234     [[link boost_asio.reference.basic_datagram_socket.connect [*connect]]]
12235     [Connect the socket to the specified endpoint. ]
12236   ]
12237   
12238   [
12239     [[link boost_asio.reference.basic_datagram_socket.get_executor [*get_executor]]]
12240     [Get the executor associated with the object. ]
12241   ]
12242   
12243   [
12244     [[link boost_asio.reference.basic_datagram_socket.get_option [*get_option]]]
12245     [Get an option from the socket. ]
12246   ]
12247   
12248   [
12249     [[link boost_asio.reference.basic_datagram_socket.io_control [*io_control]]]
12250     [Perform an IO control command on the socket. ]
12251   ]
12252   
12253   [
12254     [[link boost_asio.reference.basic_datagram_socket.is_open [*is_open]]]
12255     [Determine whether the socket is open. ]
12256   ]
12257   
12258   [
12259     [[link boost_asio.reference.basic_datagram_socket.local_endpoint [*local_endpoint]]]
12260     [Get the local endpoint of the socket. ]
12261   ]
12262   
12263   [
12264     [[link boost_asio.reference.basic_datagram_socket.lowest_layer [*lowest_layer]]]
12265     [Get a reference to the lowest layer. 
12266      [hr]
12267      Get a const reference to the lowest layer. ]
12268   ]
12269   
12270   [
12271     [[link boost_asio.reference.basic_datagram_socket.native_handle [*native_handle]]]
12272     [Get the native socket representation. ]
12273   ]
12274   
12275   [
12276     [[link boost_asio.reference.basic_datagram_socket.native_non_blocking [*native_non_blocking]]]
12277     [Gets the non-blocking mode of the native socket implementation. 
12278      [hr]
12279      Sets the non-blocking mode of the native socket implementation. ]
12280   ]
12281   
12282   [
12283     [[link boost_asio.reference.basic_datagram_socket.non_blocking [*non_blocking]]]
12284     [Gets the non-blocking mode of the socket. 
12285      [hr]
12286      Sets the non-blocking mode of the socket. ]
12287   ]
12288   
12289   [
12290     [[link boost_asio.reference.basic_datagram_socket.open [*open]]]
12291     [Open the socket using the specified protocol. ]
12292   ]
12293   
12294   [
12295     [[link boost_asio.reference.basic_datagram_socket.operator_eq_ [*operator=]]]
12296     [Move-assign a basic_datagram_socket from another. 
12297      [hr]
12298      Move-assign a basic_datagram_socket from a socket of another protocol type. ]
12299   ]
12300   
12301   [
12302     [[link boost_asio.reference.basic_datagram_socket.receive [*receive]]]
12303     [Receive some data on a connected socket. ]
12304   ]
12305   
12306   [
12307     [[link boost_asio.reference.basic_datagram_socket.receive_from [*receive_from]]]
12308     [Receive a datagram with the endpoint of the sender. ]
12309   ]
12310   
12311   [
12312     [[link boost_asio.reference.basic_datagram_socket.release [*release]]]
12313     [Release ownership of the underlying native socket. ]
12314   ]
12315   
12316   [
12317     [[link boost_asio.reference.basic_datagram_socket.remote_endpoint [*remote_endpoint]]]
12318     [Get the remote endpoint of the socket. ]
12319   ]
12320   
12321   [
12322     [[link boost_asio.reference.basic_datagram_socket.send [*send]]]
12323     [Send some data on a connected socket. ]
12324   ]
12325   
12326   [
12327     [[link boost_asio.reference.basic_datagram_socket.send_to [*send_to]]]
12328     [Send a datagram to the specified endpoint. ]
12329   ]
12330   
12331   [
12332     [[link boost_asio.reference.basic_datagram_socket.set_option [*set_option]]]
12333     [Set an option on the socket. ]
12334   ]
12335   
12336   [
12337     [[link boost_asio.reference.basic_datagram_socket.shutdown [*shutdown]]]
12338     [Disable sends or receives on the socket. ]
12339   ]
12340   
12341   [
12342     [[link boost_asio.reference.basic_datagram_socket.wait [*wait]]]
12343     [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
12344   ]
12345   
12346   [
12347     [[link boost_asio.reference.basic_datagram_socket._basic_datagram_socket [*~basic_datagram_socket]]]
12348     [Destroys the socket. ]
12349   ]
12350   
12351 ]
12352
12353 [heading Data Members]
12354 [table
12355   [[Name][Description]]
12356
12357   [
12358     [[link boost_asio.reference.basic_datagram_socket.max_connections [*max_connections]]]
12359     [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
12360   ]
12361
12362   [
12363     [[link boost_asio.reference.basic_datagram_socket.max_listen_connections [*max_listen_connections]]]
12364     [The maximum length of the queue of pending incoming connections. ]
12365   ]
12366
12367   [
12368     [[link boost_asio.reference.basic_datagram_socket.message_do_not_route [*message_do_not_route]]]
12369     [Specify that the data should not be subject to routing. ]
12370   ]
12371
12372   [
12373     [[link boost_asio.reference.basic_datagram_socket.message_end_of_record [*message_end_of_record]]]
12374     [Specifies that the data marks the end of a record. ]
12375   ]
12376
12377   [
12378     [[link boost_asio.reference.basic_datagram_socket.message_out_of_band [*message_out_of_band]]]
12379     [Process out-of-band data. ]
12380   ]
12381
12382   [
12383     [[link boost_asio.reference.basic_datagram_socket.message_peek [*message_peek]]]
12384     [Peek at incoming data without removing it from the input queue. ]
12385   ]
12386
12387 ]
12388
12389 [heading Protected Data Members]
12390 [table
12391   [[Name][Description]]
12392
12393   [
12394     [[link boost_asio.reference.basic_datagram_socket.impl_ [*impl_]]]
12395     []
12396   ]
12397
12398 ]
12399
12400 The [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] class template provides asynchronous and blocking datagram-oriented socket functionality.
12401
12402
12403 [heading Thread Safety]
12404   
12405 ['Distinct] ['objects:] Safe.
12406
12407 ['Shared] ['objects:] Unsafe. 
12408
12409
12410
12411
12412 [heading Requirements]
12413
12414 ['Header: ][^boost/asio/basic_datagram_socket.hpp]
12415
12416 ['Convenience header: ][^boost/asio.hpp]
12417
12418
12419 [endsect]
12420
12421
12422
12423 [endsect]
12424
12425 [section:basic_deadline_timer basic_deadline_timer]
12426
12427
12428 Provides waitable timer functionality. 
12429
12430
12431   template<
12432       typename Time,
12433       typename ``[link boost_asio.reference.TimeTraits TimeTraits]`` = boost::asio::time_traits<Time>,
12434       typename ``[link boost_asio.reference.Executor1 Executor]`` = executor>
12435   class basic_deadline_timer
12436
12437
12438 [heading Types]
12439 [table
12440   [[Name][Description]]
12441
12442   [
12443
12444     [[link boost_asio.reference.basic_deadline_timer__rebind_executor [*rebind_executor]]]
12445     [Rebinds the timer type to another executor. ]
12446   
12447   ]
12448
12449   [
12450
12451     [[link boost_asio.reference.basic_deadline_timer.duration_type [*duration_type]]]
12452     [The duration type. ]
12453   
12454   ]
12455
12456   [
12457
12458     [[link boost_asio.reference.basic_deadline_timer.executor_type [*executor_type]]]
12459     [The type of the executor associated with the object. ]
12460   
12461   ]
12462
12463   [
12464
12465     [[link boost_asio.reference.basic_deadline_timer.time_type [*time_type]]]
12466     [The time type. ]
12467   
12468   ]
12469
12470   [
12471
12472     [[link boost_asio.reference.basic_deadline_timer.traits_type [*traits_type]]]
12473     [The time traits type. ]
12474   
12475   ]
12476
12477 ]
12478
12479 [heading Member Functions]
12480 [table
12481   [[Name][Description]]
12482
12483   [
12484     [[link boost_asio.reference.basic_deadline_timer.async_wait [*async_wait]]]
12485     [Start an asynchronous wait on the timer. ]
12486   ]
12487   
12488   [
12489     [[link boost_asio.reference.basic_deadline_timer.basic_deadline_timer [*basic_deadline_timer]]]
12490     [Constructor. 
12491      [hr]
12492      Constructor to set a particular expiry time as an absolute time. 
12493      [hr]
12494      Constructor to set a particular expiry time relative to now. 
12495      [hr]
12496      Move-construct a basic_deadline_timer from another. ]
12497   ]
12498   
12499   [
12500     [[link boost_asio.reference.basic_deadline_timer.cancel [*cancel]]]
12501     [Cancel any asynchronous operations that are waiting on the timer. ]
12502   ]
12503   
12504   [
12505     [[link boost_asio.reference.basic_deadline_timer.cancel_one [*cancel_one]]]
12506     [Cancels one asynchronous operation that is waiting on the timer. ]
12507   ]
12508   
12509   [
12510     [[link boost_asio.reference.basic_deadline_timer.expires_at [*expires_at]]]
12511     [Get the timer's expiry time as an absolute time. 
12512      [hr]
12513      Set the timer's expiry time as an absolute time. ]
12514   ]
12515   
12516   [
12517     [[link boost_asio.reference.basic_deadline_timer.expires_from_now [*expires_from_now]]]
12518     [Get the timer's expiry time relative to now. 
12519      [hr]
12520      Set the timer's expiry time relative to now. ]
12521   ]
12522   
12523   [
12524     [[link boost_asio.reference.basic_deadline_timer.get_executor [*get_executor]]]
12525     [Get the executor associated with the object. ]
12526   ]
12527   
12528   [
12529     [[link boost_asio.reference.basic_deadline_timer.operator_eq_ [*operator=]]]
12530     [Move-assign a basic_deadline_timer from another. ]
12531   ]
12532   
12533   [
12534     [[link boost_asio.reference.basic_deadline_timer.wait [*wait]]]
12535     [Perform a blocking wait on the timer. ]
12536   ]
12537   
12538   [
12539     [[link boost_asio.reference.basic_deadline_timer._basic_deadline_timer [*~basic_deadline_timer]]]
12540     [Destroys the timer. ]
12541   ]
12542   
12543 ]
12544
12545 The [link boost_asio.reference.basic_deadline_timer `basic_deadline_timer`] class template provides the ability to perform a blocking or asynchronous wait for a timer to expire.
12546
12547 A deadline timer is always in one of two states: "expired" or "not expired". If the `wait()` or `async_wait()` function is called on an expired timer, the wait operation will complete immediately.
12548
12549 Most applications will use the [link boost_asio.reference.deadline_timer `deadline_timer`] typedef.
12550
12551
12552 [heading Thread Safety]
12553   
12554 ['Distinct] ['objects:] Safe.
12555
12556 ['Shared] ['objects:] Unsafe.
12557
12558
12559 [heading Examples]
12560   
12561 Performing a blocking wait: 
12562
12563    // Construct a timer without setting an expiry time.
12564    boost::asio::deadline_timer timer(my_context);
12565
12566    // Set an expiry time relative to now.
12567    timer.expires_from_now(boost::posix_time::seconds(5));
12568
12569    // Wait for the timer to expire.
12570    timer.wait();
12571
12572
12573
12574
12575
12576 Performing an asynchronous wait: 
12577
12578    void handler(const boost::system::error_code& error)
12579    {
12580      if (!error)
12581      {
12582        // Timer expired.
12583      }
12584    }
12585
12586    ...
12587
12588    // Construct a timer with an absolute expiry time.
12589    boost::asio::deadline_timer timer(my_context,
12590        boost::posix_time::time_from_string("2005-12-07 23:59:59.000"));
12591
12592    // Start an asynchronous wait.
12593    timer.async_wait(handler);
12594
12595
12596
12597
12598
12599 [heading Changing an active deadline_timer's expiry time]
12600   
12601
12602
12603 Changing the expiry time of a timer while there are pending asynchronous waits causes those wait operations to be cancelled. To ensure that the action associated with the timer is performed only once, use something like this: used:
12604
12605
12606
12607    void on_some_event()
12608    {
12609      if (my_timer.expires_from_now(seconds(5)) > 0)
12610      {
12611        // We managed to cancel the timer. Start new asynchronous wait.
12612        my_timer.async_wait(on_timeout);
12613      }
12614      else
12615      {
12616        // Too late, timer has already expired!
12617      }
12618    }
12619
12620    void on_timeout(const boost::system::error_code& e)
12621    {
12622      if (e != boost::asio::error::operation_aborted)
12623      {
12624        // Timer was not cancelled, take necessary action.
12625      }
12626    }
12627
12628
12629
12630
12631
12632 * The `boost::asio::basic_deadline_timer::expires_from_now()` function cancels any pending asynchronous waits, and returns the number of asynchronous waits that were cancelled. If it returns 0 then you were too late and the wait handler has already been executed, or will soon be executed. If it returns 1 then the wait handler was successfully cancelled.
12633
12634
12635 * If a wait handler is cancelled, the boost::system::error\_code passed to it contains the value `boost::asio::error::operation_aborted`. 
12636
12637
12638
12639 [heading Requirements]
12640
12641 ['Header: ][^boost/asio/basic_deadline_timer.hpp]
12642
12643 ['Convenience header: ][^boost/asio.hpp]
12644
12645
12646 [section:async_wait basic_deadline_timer::async_wait]
12647
12648 [indexterm2 boost_asio.indexterm.basic_deadline_timer.async_wait..async_wait..basic_deadline_timer] 
12649 Start an asynchronous wait on the timer. 
12650
12651
12652   template<
12653       typename ``[link boost_asio.reference.WaitHandler WaitHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
12654   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait(
12655       WaitHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
12656
12657
12658 This function may be used to initiate an asynchronous wait against the timer. It always returns immediately.
12659
12660 For each call to `async_wait()`, the supplied handler will be called exactly once. The handler will be called when:
12661
12662
12663 * The timer has expired.
12664
12665
12666 * The timer was cancelled, in which case the handler is passed the error code `boost::asio::error::operation_aborted`.
12667
12668
12669 [heading Parameters]
12670     
12671
12672 [variablelist
12673   
12674 [[handler][The handler to be called when the timer expires. Copies will be made of the handler as required. The function signature of the handler must be: 
12675 ``
12676    void handler(
12677      const boost::system::error_code& error // Result of operation.
12678    ); 
12679 ``
12680 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
12681
12682 ]
12683
12684
12685
12686
12687 [endsect]
12688
12689
12690 [section:basic_deadline_timer basic_deadline_timer::basic_deadline_timer]
12691
12692 [indexterm2 boost_asio.indexterm.basic_deadline_timer.basic_deadline_timer..basic_deadline_timer..basic_deadline_timer] 
12693 Constructor. 
12694
12695
12696   explicit ``[link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload1 basic_deadline_timer]``(
12697       const executor_type & ex);
12698   ``  [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload1 more...]]``
12699
12700   template<
12701       typename ExecutionContext>
12702   explicit ``[link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload2 basic_deadline_timer]``(
12703       ExecutionContext & context,
12704       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
12705   ``  [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload2 more...]]``
12706
12707
12708 Constructor to set a particular expiry time as an absolute time. 
12709
12710
12711   ``[link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload3 basic_deadline_timer]``(
12712       const executor_type & ex,
12713       const time_type & expiry_time);
12714   ``  [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload3 more...]]``
12715
12716   template<
12717       typename ExecutionContext>
12718   ``[link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload4 basic_deadline_timer]``(
12719       ExecutionContext & context,
12720       const time_type & expiry_time,
12721       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
12722   ``  [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload4 more...]]``
12723
12724
12725 Constructor to set a particular expiry time relative to now. 
12726
12727
12728   ``[link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload5 basic_deadline_timer]``(
12729       const executor_type & ex,
12730       const duration_type & expiry_time);
12731   ``  [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload5 more...]]``
12732
12733   template<
12734       typename ExecutionContext>
12735   ``[link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload6 basic_deadline_timer]``(
12736       ExecutionContext & context,
12737       const duration_type & expiry_time,
12738       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
12739   ``  [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload6 more...]]``
12740
12741
12742 Move-construct a [link boost_asio.reference.basic_deadline_timer `basic_deadline_timer`] from another. 
12743
12744
12745   ``[link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload7 basic_deadline_timer]``(
12746       basic_deadline_timer && other);
12747   ``  [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload7 more...]]``
12748
12749
12750 [section:overload1 basic_deadline_timer::basic_deadline_timer (1 of 7 overloads)]
12751
12752
12753 Constructor. 
12754
12755
12756   basic_deadline_timer(
12757       const executor_type & ex);
12758
12759
12760 This constructor creates a timer without setting an expiry time. The `expires_at()` or `expires_from_now()` functions must be called to set an expiry time before the timer can be waited on.
12761
12762
12763 [heading Parameters]
12764     
12765
12766 [variablelist
12767   
12768 [[ex][The I/O executor that the timer will use, by default, to dispatch handlers for any asynchronous operations performed on the timer. ]]
12769
12770 ]
12771
12772
12773
12774
12775 [endsect]
12776
12777
12778
12779 [section:overload2 basic_deadline_timer::basic_deadline_timer (2 of 7 overloads)]
12780
12781
12782 Constructor. 
12783
12784
12785   template<
12786       typename ExecutionContext>
12787   basic_deadline_timer(
12788       ExecutionContext & context,
12789       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
12790
12791
12792 This constructor creates a timer without setting an expiry time. The `expires_at()` or `expires_from_now()` functions must be called to set an expiry time before the timer can be waited on.
12793
12794
12795 [heading Parameters]
12796     
12797
12798 [variablelist
12799   
12800 [[context][An execution context which provides the I/O executor that the timer will use, by default, to dispatch handlers for any asynchronous operations performed on the timer. ]]
12801
12802 ]
12803
12804
12805
12806
12807 [endsect]
12808
12809
12810
12811 [section:overload3 basic_deadline_timer::basic_deadline_timer (3 of 7 overloads)]
12812
12813
12814 Constructor to set a particular expiry time as an absolute time. 
12815
12816
12817   basic_deadline_timer(
12818       const executor_type & ex,
12819       const time_type & expiry_time);
12820
12821
12822 This constructor creates a timer and sets the expiry time.
12823
12824
12825 [heading Parameters]
12826     
12827
12828 [variablelist
12829   
12830 [[ex][The I/O executor that the timer will use, by default, to dispatch handlers for any asynchronous operations performed on the timer.]]
12831
12832 [[expiry_time][The expiry time to be used for the timer, expressed as an absolute time. ]]
12833
12834 ]
12835
12836
12837
12838
12839 [endsect]
12840
12841
12842
12843 [section:overload4 basic_deadline_timer::basic_deadline_timer (4 of 7 overloads)]
12844
12845
12846 Constructor to set a particular expiry time as an absolute time. 
12847
12848
12849   template<
12850       typename ExecutionContext>
12851   basic_deadline_timer(
12852       ExecutionContext & context,
12853       const time_type & expiry_time,
12854       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
12855
12856
12857 This constructor creates a timer and sets the expiry time.
12858
12859
12860 [heading Parameters]
12861     
12862
12863 [variablelist
12864   
12865 [[context][An execution context which provides the I/O executor that the timer will use, by default, to dispatch handlers for any asynchronous operations performed on the timer.]]
12866
12867 [[expiry_time][The expiry time to be used for the timer, expressed as an absolute time. ]]
12868
12869 ]
12870
12871
12872
12873
12874 [endsect]
12875
12876
12877
12878 [section:overload5 basic_deadline_timer::basic_deadline_timer (5 of 7 overloads)]
12879
12880
12881 Constructor to set a particular expiry time relative to now. 
12882
12883
12884   basic_deadline_timer(
12885       const executor_type & ex,
12886       const duration_type & expiry_time);
12887
12888
12889 This constructor creates a timer and sets the expiry time.
12890
12891
12892 [heading Parameters]
12893     
12894
12895 [variablelist
12896   
12897 [[ex][The I/O executor that the timer will use, by default, to dispatch handlers for any asynchronous operations performed on the timer.]]
12898
12899 [[expiry_time][The expiry time to be used for the timer, relative to now. ]]
12900
12901 ]
12902
12903
12904
12905
12906 [endsect]
12907
12908
12909
12910 [section:overload6 basic_deadline_timer::basic_deadline_timer (6 of 7 overloads)]
12911
12912
12913 Constructor to set a particular expiry time relative to now. 
12914
12915
12916   template<
12917       typename ExecutionContext>
12918   basic_deadline_timer(
12919       ExecutionContext & context,
12920       const duration_type & expiry_time,
12921       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
12922
12923
12924 This constructor creates a timer and sets the expiry time.
12925
12926
12927 [heading Parameters]
12928     
12929
12930 [variablelist
12931   
12932 [[context][An execution context which provides the I/O executor that the timer will use, by default, to dispatch handlers for any asynchronous operations performed on the timer.]]
12933
12934 [[expiry_time][The expiry time to be used for the timer, relative to now. ]]
12935
12936 ]
12937
12938
12939
12940
12941 [endsect]
12942
12943
12944
12945 [section:overload7 basic_deadline_timer::basic_deadline_timer (7 of 7 overloads)]
12946
12947
12948 Move-construct a [link boost_asio.reference.basic_deadline_timer `basic_deadline_timer`] from another. 
12949
12950
12951   basic_deadline_timer(
12952       basic_deadline_timer && other);
12953
12954
12955 This constructor moves a timer from one object to another.
12956
12957
12958 [heading Parameters]
12959     
12960
12961 [variablelist
12962   
12963 [[other][The other [link boost_asio.reference.basic_deadline_timer `basic_deadline_timer`] object from which the move will occur.]]
12964
12965 ]
12966
12967
12968 [heading Remarks]
12969       
12970 Following the move, the moved-from object is in the same state as if constructed using the `basic_deadline_timer(const executor_type&)` constructor. 
12971
12972
12973
12974
12975 [endsect]
12976
12977
12978 [endsect]
12979
12980 [section:cancel basic_deadline_timer::cancel]
12981
12982 [indexterm2 boost_asio.indexterm.basic_deadline_timer.cancel..cancel..basic_deadline_timer] 
12983 Cancel any asynchronous operations that are waiting on the timer. 
12984
12985
12986   std::size_t ``[link boost_asio.reference.basic_deadline_timer.cancel.overload1 cancel]``();
12987   ``  [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.cancel.overload1 more...]]``
12988
12989   std::size_t ``[link boost_asio.reference.basic_deadline_timer.cancel.overload2 cancel]``(
12990       boost::system::error_code & ec);
12991   ``  [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.cancel.overload2 more...]]``
12992
12993
12994 [section:overload1 basic_deadline_timer::cancel (1 of 2 overloads)]
12995
12996
12997 Cancel any asynchronous operations that are waiting on the timer. 
12998
12999
13000   std::size_t cancel();
13001
13002
13003 This function forces the completion of any pending asynchronous wait operations against the timer. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
13004
13005 Cancelling the timer does not change the expiry time.
13006
13007
13008 [heading Return Value]
13009       
13010 The number of asynchronous operations that were cancelled.
13011
13012
13013 [heading Exceptions]
13014     
13015
13016 [variablelist
13017   
13018 [[boost::system::system_error][Thrown on failure.]]
13019
13020 ]
13021
13022
13023 [heading Remarks]
13024       
13025 If the timer has already expired when `cancel()` is called, then the handlers for asynchronous wait operations will:
13026
13027
13028 * have already been invoked; or
13029
13030
13031 * have been queued for invocation in the near future.
13032
13033 These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 
13034
13035
13036 [endsect]
13037
13038
13039
13040 [section:overload2 basic_deadline_timer::cancel (2 of 2 overloads)]
13041
13042
13043 Cancel any asynchronous operations that are waiting on the timer. 
13044
13045
13046   std::size_t cancel(
13047       boost::system::error_code & ec);
13048
13049
13050 This function forces the completion of any pending asynchronous wait operations against the timer. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
13051
13052 Cancelling the timer does not change the expiry time.
13053
13054
13055 [heading Parameters]
13056     
13057
13058 [variablelist
13059   
13060 [[ec][Set to indicate what error occurred, if any.]]
13061
13062 ]
13063
13064
13065 [heading Return Value]
13066       
13067 The number of asynchronous operations that were cancelled.
13068
13069
13070 [heading Remarks]
13071       
13072 If the timer has already expired when `cancel()` is called, then the handlers for asynchronous wait operations will:
13073
13074
13075 * have already been invoked; or
13076
13077
13078 * have been queued for invocation in the near future.
13079
13080 These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 
13081
13082
13083 [endsect]
13084
13085
13086 [endsect]
13087
13088 [section:cancel_one basic_deadline_timer::cancel_one]
13089
13090 [indexterm2 boost_asio.indexterm.basic_deadline_timer.cancel_one..cancel_one..basic_deadline_timer] 
13091 Cancels one asynchronous operation that is waiting on the timer. 
13092
13093
13094   std::size_t ``[link boost_asio.reference.basic_deadline_timer.cancel_one.overload1 cancel_one]``();
13095   ``  [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.cancel_one.overload1 more...]]``
13096
13097   std::size_t ``[link boost_asio.reference.basic_deadline_timer.cancel_one.overload2 cancel_one]``(
13098       boost::system::error_code & ec);
13099   ``  [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.cancel_one.overload2 more...]]``
13100
13101
13102 [section:overload1 basic_deadline_timer::cancel_one (1 of 2 overloads)]
13103
13104
13105 Cancels one asynchronous operation that is waiting on the timer. 
13106
13107
13108   std::size_t cancel_one();
13109
13110
13111 This function forces the completion of one pending asynchronous wait operation against the timer. Handlers are cancelled in FIFO order. The handler for the cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
13112
13113 Cancelling the timer does not change the expiry time.
13114
13115
13116 [heading Return Value]
13117       
13118 The number of asynchronous operations that were cancelled. That is, either 0 or 1.
13119
13120
13121 [heading Exceptions]
13122     
13123
13124 [variablelist
13125   
13126 [[boost::system::system_error][Thrown on failure.]]
13127
13128 ]
13129
13130
13131 [heading Remarks]
13132       
13133 If the timer has already expired when `cancel_one()` is called, then the handlers for asynchronous wait operations will:
13134
13135
13136 * have already been invoked; or
13137
13138
13139 * have been queued for invocation in the near future.
13140
13141 These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 
13142
13143
13144 [endsect]
13145
13146
13147
13148 [section:overload2 basic_deadline_timer::cancel_one (2 of 2 overloads)]
13149
13150
13151 Cancels one asynchronous operation that is waiting on the timer. 
13152
13153
13154   std::size_t cancel_one(
13155       boost::system::error_code & ec);
13156
13157
13158 This function forces the completion of one pending asynchronous wait operation against the timer. Handlers are cancelled in FIFO order. The handler for the cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
13159
13160 Cancelling the timer does not change the expiry time.
13161
13162
13163 [heading Parameters]
13164     
13165
13166 [variablelist
13167   
13168 [[ec][Set to indicate what error occurred, if any.]]
13169
13170 ]
13171
13172
13173 [heading Return Value]
13174       
13175 The number of asynchronous operations that were cancelled. That is, either 0 or 1.
13176
13177
13178 [heading Remarks]
13179       
13180 If the timer has already expired when `cancel_one()` is called, then the handlers for asynchronous wait operations will:
13181
13182
13183 * have already been invoked; or
13184
13185
13186 * have been queued for invocation in the near future.
13187
13188 These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 
13189
13190
13191 [endsect]
13192
13193
13194 [endsect]
13195
13196
13197 [section:duration_type basic_deadline_timer::duration_type]
13198
13199 [indexterm2 boost_asio.indexterm.basic_deadline_timer.duration_type..duration_type..basic_deadline_timer] 
13200 The duration type. 
13201
13202
13203   typedef traits_type::duration_type duration_type;
13204
13205
13206
13207 [heading Requirements]
13208
13209 ['Header: ][^boost/asio/basic_deadline_timer.hpp]
13210
13211 ['Convenience header: ][^boost/asio.hpp]
13212
13213
13214 [endsect]
13215
13216
13217
13218 [section:executor_type basic_deadline_timer::executor_type]
13219
13220 [indexterm2 boost_asio.indexterm.basic_deadline_timer.executor_type..executor_type..basic_deadline_timer] 
13221 The type of the executor associated with the object. 
13222
13223
13224   typedef Executor executor_type;
13225
13226
13227
13228 [heading Requirements]
13229
13230 ['Header: ][^boost/asio/basic_deadline_timer.hpp]
13231
13232 ['Convenience header: ][^boost/asio.hpp]
13233
13234
13235 [endsect]
13236
13237
13238 [section:expires_at basic_deadline_timer::expires_at]
13239
13240 [indexterm2 boost_asio.indexterm.basic_deadline_timer.expires_at..expires_at..basic_deadline_timer] 
13241 Get the timer's expiry time as an absolute time. 
13242
13243
13244   time_type ``[link boost_asio.reference.basic_deadline_timer.expires_at.overload1 expires_at]``() const;
13245   ``  [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.expires_at.overload1 more...]]``
13246
13247
13248 Set the timer's expiry time as an absolute time. 
13249
13250
13251   std::size_t ``[link boost_asio.reference.basic_deadline_timer.expires_at.overload2 expires_at]``(
13252       const time_type & expiry_time);
13253   ``  [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.expires_at.overload2 more...]]``
13254
13255   std::size_t ``[link boost_asio.reference.basic_deadline_timer.expires_at.overload3 expires_at]``(
13256       const time_type & expiry_time,
13257       boost::system::error_code & ec);
13258   ``  [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.expires_at.overload3 more...]]``
13259
13260
13261 [section:overload1 basic_deadline_timer::expires_at (1 of 3 overloads)]
13262
13263
13264 Get the timer's expiry time as an absolute time. 
13265
13266
13267   time_type expires_at() const;
13268
13269
13270 This function may be used to obtain the timer's current expiry time. Whether the timer has expired or not does not affect this value. 
13271
13272
13273 [endsect]
13274
13275
13276
13277 [section:overload2 basic_deadline_timer::expires_at (2 of 3 overloads)]
13278
13279
13280 Set the timer's expiry time as an absolute time. 
13281
13282
13283   std::size_t expires_at(
13284       const time_type & expiry_time);
13285
13286
13287 This function sets the expiry time. Any pending asynchronous wait operations will be cancelled. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
13288
13289
13290 [heading Parameters]
13291     
13292
13293 [variablelist
13294   
13295 [[expiry_time][The expiry time to be used for the timer.]]
13296
13297 ]
13298
13299
13300 [heading Return Value]
13301       
13302 The number of asynchronous operations that were cancelled.
13303
13304
13305 [heading Exceptions]
13306     
13307
13308 [variablelist
13309   
13310 [[boost::system::system_error][Thrown on failure.]]
13311
13312 ]
13313
13314
13315 [heading Remarks]
13316       
13317 If the timer has already expired when `expires_at()` is called, then the handlers for asynchronous wait operations will:
13318
13319
13320 * have already been invoked; or
13321
13322
13323 * have been queued for invocation in the near future.
13324
13325 These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 
13326
13327
13328 [endsect]
13329
13330
13331
13332 [section:overload3 basic_deadline_timer::expires_at (3 of 3 overloads)]
13333
13334
13335 Set the timer's expiry time as an absolute time. 
13336
13337
13338   std::size_t expires_at(
13339       const time_type & expiry_time,
13340       boost::system::error_code & ec);
13341
13342
13343 This function sets the expiry time. Any pending asynchronous wait operations will be cancelled. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
13344
13345
13346 [heading Parameters]
13347     
13348
13349 [variablelist
13350   
13351 [[expiry_time][The expiry time to be used for the timer.]]
13352
13353 [[ec][Set to indicate what error occurred, if any.]]
13354
13355 ]
13356
13357
13358 [heading Return Value]
13359       
13360 The number of asynchronous operations that were cancelled.
13361
13362
13363 [heading Remarks]
13364       
13365 If the timer has already expired when `expires_at()` is called, then the handlers for asynchronous wait operations will:
13366
13367
13368 * have already been invoked; or
13369
13370
13371 * have been queued for invocation in the near future.
13372
13373 These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 
13374
13375
13376 [endsect]
13377
13378
13379 [endsect]
13380
13381 [section:expires_from_now basic_deadline_timer::expires_from_now]
13382
13383 [indexterm2 boost_asio.indexterm.basic_deadline_timer.expires_from_now..expires_from_now..basic_deadline_timer] 
13384 Get the timer's expiry time relative to now. 
13385
13386
13387   duration_type ``[link boost_asio.reference.basic_deadline_timer.expires_from_now.overload1 expires_from_now]``() const;
13388   ``  [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.expires_from_now.overload1 more...]]``
13389
13390
13391 Set the timer's expiry time relative to now. 
13392
13393
13394   std::size_t ``[link boost_asio.reference.basic_deadline_timer.expires_from_now.overload2 expires_from_now]``(
13395       const duration_type & expiry_time);
13396   ``  [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.expires_from_now.overload2 more...]]``
13397
13398   std::size_t ``[link boost_asio.reference.basic_deadline_timer.expires_from_now.overload3 expires_from_now]``(
13399       const duration_type & expiry_time,
13400       boost::system::error_code & ec);
13401   ``  [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.expires_from_now.overload3 more...]]``
13402
13403
13404 [section:overload1 basic_deadline_timer::expires_from_now (1 of 3 overloads)]
13405
13406
13407 Get the timer's expiry time relative to now. 
13408
13409
13410   duration_type expires_from_now() const;
13411
13412
13413 This function may be used to obtain the timer's current expiry time. Whether the timer has expired or not does not affect this value. 
13414
13415
13416 [endsect]
13417
13418
13419
13420 [section:overload2 basic_deadline_timer::expires_from_now (2 of 3 overloads)]
13421
13422
13423 Set the timer's expiry time relative to now. 
13424
13425
13426   std::size_t expires_from_now(
13427       const duration_type & expiry_time);
13428
13429
13430 This function sets the expiry time. Any pending asynchronous wait operations will be cancelled. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
13431
13432
13433 [heading Parameters]
13434     
13435
13436 [variablelist
13437   
13438 [[expiry_time][The expiry time to be used for the timer.]]
13439
13440 ]
13441
13442
13443 [heading Return Value]
13444       
13445 The number of asynchronous operations that were cancelled.
13446
13447
13448 [heading Exceptions]
13449     
13450
13451 [variablelist
13452   
13453 [[boost::system::system_error][Thrown on failure.]]
13454
13455 ]
13456
13457
13458 [heading Remarks]
13459       
13460 If the timer has already expired when `expires_from_now()` is called, then the handlers for asynchronous wait operations will:
13461
13462
13463 * have already been invoked; or
13464
13465
13466 * have been queued for invocation in the near future.
13467
13468 These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 
13469
13470
13471 [endsect]
13472
13473
13474
13475 [section:overload3 basic_deadline_timer::expires_from_now (3 of 3 overloads)]
13476
13477
13478 Set the timer's expiry time relative to now. 
13479
13480
13481   std::size_t expires_from_now(
13482       const duration_type & expiry_time,
13483       boost::system::error_code & ec);
13484
13485
13486 This function sets the expiry time. Any pending asynchronous wait operations will be cancelled. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
13487
13488
13489 [heading Parameters]
13490     
13491
13492 [variablelist
13493   
13494 [[expiry_time][The expiry time to be used for the timer.]]
13495
13496 [[ec][Set to indicate what error occurred, if any.]]
13497
13498 ]
13499
13500
13501 [heading Return Value]
13502       
13503 The number of asynchronous operations that were cancelled.
13504
13505
13506 [heading Remarks]
13507       
13508 If the timer has already expired when `expires_from_now()` is called, then the handlers for asynchronous wait operations will:
13509
13510
13511 * have already been invoked; or
13512
13513
13514 * have been queued for invocation in the near future.
13515
13516 These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 
13517
13518
13519 [endsect]
13520
13521
13522 [endsect]
13523
13524
13525 [section:get_executor basic_deadline_timer::get_executor]
13526
13527 [indexterm2 boost_asio.indexterm.basic_deadline_timer.get_executor..get_executor..basic_deadline_timer] 
13528 Get the executor associated with the object. 
13529
13530
13531   executor_type get_executor();
13532
13533
13534
13535 [endsect]
13536
13537
13538
13539 [section:operator_eq_ basic_deadline_timer::operator=]
13540
13541 [indexterm2 boost_asio.indexterm.basic_deadline_timer.operator_eq_..operator=..basic_deadline_timer] 
13542 Move-assign a [link boost_asio.reference.basic_deadline_timer `basic_deadline_timer`] from another. 
13543
13544
13545   basic_deadline_timer & operator=(
13546       basic_deadline_timer && other);
13547
13548
13549 This assignment operator moves a timer from one object to another. Cancels any outstanding asynchronous operations associated with the target object.
13550
13551
13552 [heading Parameters]
13553     
13554
13555 [variablelist
13556   
13557 [[other][The other [link boost_asio.reference.basic_deadline_timer `basic_deadline_timer`] object from which the move will occur.]]
13558
13559 ]
13560
13561
13562 [heading Remarks]
13563       
13564 Following the move, the moved-from object is in the same state as if constructed using the `basic_deadline_timer(const executor_type&)` constructor. 
13565
13566
13567
13568
13569 [endsect]
13570
13571
13572
13573 [section:time_type basic_deadline_timer::time_type]
13574
13575 [indexterm2 boost_asio.indexterm.basic_deadline_timer.time_type..time_type..basic_deadline_timer] 
13576 The time type. 
13577
13578
13579   typedef traits_type::time_type time_type;
13580
13581
13582
13583 [heading Requirements]
13584
13585 ['Header: ][^boost/asio/basic_deadline_timer.hpp]
13586
13587 ['Convenience header: ][^boost/asio.hpp]
13588
13589
13590 [endsect]
13591
13592
13593
13594 [section:traits_type basic_deadline_timer::traits_type]
13595
13596 [indexterm2 boost_asio.indexterm.basic_deadline_timer.traits_type..traits_type..basic_deadline_timer] 
13597 The time traits type. 
13598
13599
13600   typedef TimeTraits traits_type;
13601
13602
13603
13604 [heading Requirements]
13605
13606 ['Header: ][^boost/asio/basic_deadline_timer.hpp]
13607
13608 ['Convenience header: ][^boost/asio.hpp]
13609
13610
13611 [endsect]
13612
13613
13614 [section:wait basic_deadline_timer::wait]
13615
13616 [indexterm2 boost_asio.indexterm.basic_deadline_timer.wait..wait..basic_deadline_timer] 
13617 Perform a blocking wait on the timer. 
13618
13619
13620   void ``[link boost_asio.reference.basic_deadline_timer.wait.overload1 wait]``();
13621   ``  [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.wait.overload1 more...]]``
13622
13623   void ``[link boost_asio.reference.basic_deadline_timer.wait.overload2 wait]``(
13624       boost::system::error_code & ec);
13625   ``  [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.wait.overload2 more...]]``
13626
13627
13628 [section:overload1 basic_deadline_timer::wait (1 of 2 overloads)]
13629
13630
13631 Perform a blocking wait on the timer. 
13632
13633
13634   void wait();
13635
13636
13637 This function is used to wait for the timer to expire. This function blocks and does not return until the timer has expired.
13638
13639
13640 [heading Exceptions]
13641     
13642
13643 [variablelist
13644   
13645 [[boost::system::system_error][Thrown on failure. ]]
13646
13647 ]
13648
13649
13650
13651
13652 [endsect]
13653
13654
13655
13656 [section:overload2 basic_deadline_timer::wait (2 of 2 overloads)]
13657
13658
13659 Perform a blocking wait on the timer. 
13660
13661
13662   void wait(
13663       boost::system::error_code & ec);
13664
13665
13666 This function is used to wait for the timer to expire. This function blocks and does not return until the timer has expired.
13667
13668
13669 [heading Parameters]
13670     
13671
13672 [variablelist
13673   
13674 [[ec][Set to indicate what error occurred, if any. ]]
13675
13676 ]
13677
13678
13679
13680
13681 [endsect]
13682
13683
13684 [endsect]
13685
13686
13687 [section:_basic_deadline_timer basic_deadline_timer::~basic_deadline_timer]
13688
13689 [indexterm2 boost_asio.indexterm.basic_deadline_timer._basic_deadline_timer..~basic_deadline_timer..basic_deadline_timer] 
13690 Destroys the timer. 
13691
13692
13693   ~basic_deadline_timer();
13694
13695
13696 This function destroys the timer, cancelling any outstanding asynchronous wait operations associated with the timer as if by calling `cancel`. 
13697
13698
13699 [endsect]
13700
13701
13702
13703 [endsect]
13704
13705 [section:basic_deadline_timer__rebind_executor basic_deadline_timer::rebind_executor]
13706
13707
13708 Rebinds the timer type to another executor. 
13709
13710
13711   template<
13712       typename ``[link boost_asio.reference.Executor1 Executor1]``>
13713   struct rebind_executor
13714
13715
13716 [heading Types]
13717 [table
13718   [[Name][Description]]
13719
13720   [
13721
13722     [[link boost_asio.reference.basic_deadline_timer__rebind_executor.other [*other]]]
13723     [The timer type when rebound to the specified executor. ]
13724   
13725   ]
13726
13727 ]
13728
13729 [heading Requirements]
13730
13731 ['Header: ][^boost/asio/basic_deadline_timer.hpp]
13732
13733 ['Convenience header: ][^boost/asio.hpp]
13734
13735
13736 [section:other basic_deadline_timer::rebind_executor::other]
13737
13738 [indexterm2 boost_asio.indexterm.basic_deadline_timer__rebind_executor.other..other..basic_deadline_timer::rebind_executor] 
13739 The timer type when rebound to the specified executor. 
13740
13741
13742   typedef basic_deadline_timer< Time, TimeTraits, Executor1 > other;
13743
13744
13745 [heading Types]
13746 [table
13747   [[Name][Description]]
13748
13749   [
13750
13751     [[link boost_asio.reference.basic_deadline_timer__rebind_executor [*rebind_executor]]]
13752     [Rebinds the timer type to another executor. ]
13753   
13754   ]
13755
13756   [
13757
13758     [[link boost_asio.reference.basic_deadline_timer.duration_type [*duration_type]]]
13759     [The duration type. ]
13760   
13761   ]
13762
13763   [
13764
13765     [[link boost_asio.reference.basic_deadline_timer.executor_type [*executor_type]]]
13766     [The type of the executor associated with the object. ]
13767   
13768   ]
13769
13770   [
13771
13772     [[link boost_asio.reference.basic_deadline_timer.time_type [*time_type]]]
13773     [The time type. ]
13774   
13775   ]
13776
13777   [
13778
13779     [[link boost_asio.reference.basic_deadline_timer.traits_type [*traits_type]]]
13780     [The time traits type. ]
13781   
13782   ]
13783
13784 ]
13785
13786 [heading Member Functions]
13787 [table
13788   [[Name][Description]]
13789
13790   [
13791     [[link boost_asio.reference.basic_deadline_timer.async_wait [*async_wait]]]
13792     [Start an asynchronous wait on the timer. ]
13793   ]
13794   
13795   [
13796     [[link boost_asio.reference.basic_deadline_timer.basic_deadline_timer [*basic_deadline_timer]]]
13797     [Constructor. 
13798      [hr]
13799      Constructor to set a particular expiry time as an absolute time. 
13800      [hr]
13801      Constructor to set a particular expiry time relative to now. 
13802      [hr]
13803      Move-construct a basic_deadline_timer from another. ]
13804   ]
13805   
13806   [
13807     [[link boost_asio.reference.basic_deadline_timer.cancel [*cancel]]]
13808     [Cancel any asynchronous operations that are waiting on the timer. ]
13809   ]
13810   
13811   [
13812     [[link boost_asio.reference.basic_deadline_timer.cancel_one [*cancel_one]]]
13813     [Cancels one asynchronous operation that is waiting on the timer. ]
13814   ]
13815   
13816   [
13817     [[link boost_asio.reference.basic_deadline_timer.expires_at [*expires_at]]]
13818     [Get the timer's expiry time as an absolute time. 
13819      [hr]
13820      Set the timer's expiry time as an absolute time. ]
13821   ]
13822   
13823   [
13824     [[link boost_asio.reference.basic_deadline_timer.expires_from_now [*expires_from_now]]]
13825     [Get the timer's expiry time relative to now. 
13826      [hr]
13827      Set the timer's expiry time relative to now. ]
13828   ]
13829   
13830   [
13831     [[link boost_asio.reference.basic_deadline_timer.get_executor [*get_executor]]]
13832     [Get the executor associated with the object. ]
13833   ]
13834   
13835   [
13836     [[link boost_asio.reference.basic_deadline_timer.operator_eq_ [*operator=]]]
13837     [Move-assign a basic_deadline_timer from another. ]
13838   ]
13839   
13840   [
13841     [[link boost_asio.reference.basic_deadline_timer.wait [*wait]]]
13842     [Perform a blocking wait on the timer. ]
13843   ]
13844   
13845   [
13846     [[link boost_asio.reference.basic_deadline_timer._basic_deadline_timer [*~basic_deadline_timer]]]
13847     [Destroys the timer. ]
13848   ]
13849   
13850 ]
13851
13852 The [link boost_asio.reference.basic_deadline_timer `basic_deadline_timer`] class template provides the ability to perform a blocking or asynchronous wait for a timer to expire.
13853
13854 A deadline timer is always in one of two states: "expired" or "not expired". If the `wait()` or `async_wait()` function is called on an expired timer, the wait operation will complete immediately.
13855
13856 Most applications will use the [link boost_asio.reference.deadline_timer `deadline_timer`] typedef.
13857
13858
13859 [heading Thread Safety]
13860   
13861 ['Distinct] ['objects:] Safe.
13862
13863 ['Shared] ['objects:] Unsafe.
13864
13865
13866 [heading Examples]
13867   
13868 Performing a blocking wait: 
13869
13870    // Construct a timer without setting an expiry time.
13871    boost::asio::deadline_timer timer(my_context);
13872
13873    // Set an expiry time relative to now.
13874    timer.expires_from_now(boost::posix_time::seconds(5));
13875
13876    // Wait for the timer to expire.
13877    timer.wait();
13878
13879
13880
13881
13882
13883 Performing an asynchronous wait: 
13884
13885    void handler(const boost::system::error_code& error)
13886    {
13887      if (!error)
13888      {
13889        // Timer expired.
13890      }
13891    }
13892
13893    ...
13894
13895    // Construct a timer with an absolute expiry time.
13896    boost::asio::deadline_timer timer(my_context,
13897        boost::posix_time::time_from_string("2005-12-07 23:59:59.000"));
13898
13899    // Start an asynchronous wait.
13900    timer.async_wait(handler);
13901
13902
13903
13904
13905
13906 [heading Changing an active deadline_timer's expiry time]
13907   
13908
13909
13910 Changing the expiry time of a timer while there are pending asynchronous waits causes those wait operations to be cancelled. To ensure that the action associated with the timer is performed only once, use something like this: used:
13911
13912
13913
13914    void on_some_event()
13915    {
13916      if (my_timer.expires_from_now(seconds(5)) > 0)
13917      {
13918        // We managed to cancel the timer. Start new asynchronous wait.
13919        my_timer.async_wait(on_timeout);
13920      }
13921      else
13922      {
13923        // Too late, timer has already expired!
13924      }
13925    }
13926
13927    void on_timeout(const boost::system::error_code& e)
13928    {
13929      if (e != boost::asio::error::operation_aborted)
13930      {
13931        // Timer was not cancelled, take necessary action.
13932      }
13933    }
13934
13935
13936
13937
13938
13939 * The `boost::asio::basic_deadline_timer::expires_from_now()` function cancels any pending asynchronous waits, and returns the number of asynchronous waits that were cancelled. If it returns 0 then you were too late and the wait handler has already been executed, or will soon be executed. If it returns 1 then the wait handler was successfully cancelled.
13940
13941
13942 * If a wait handler is cancelled, the boost::system::error\_code passed to it contains the value `boost::asio::error::operation_aborted`. 
13943
13944
13945
13946
13947 [heading Requirements]
13948
13949 ['Header: ][^boost/asio/basic_deadline_timer.hpp]
13950
13951 ['Convenience header: ][^boost/asio.hpp]
13952
13953
13954 [endsect]
13955
13956
13957
13958 [endsect]
13959
13960 [section:basic_io_object basic_io_object]
13961
13962
13963 Base class for all I/O objects. 
13964
13965
13966   template<
13967       typename ``[link boost_asio.reference.IoObjectService IoObjectService]``>
13968   class basic_io_object
13969
13970
13971 [heading Types]
13972 [table
13973   [[Name][Description]]
13974
13975   [
13976
13977     [[link boost_asio.reference.basic_io_object.executor_type [*executor_type]]]
13978     [The type of the executor associated with the object. ]
13979   
13980   ]
13981
13982   [
13983
13984     [[link boost_asio.reference.basic_io_object.implementation_type [*implementation_type]]]
13985     [The underlying implementation type of I/O object. ]
13986   
13987   ]
13988
13989   [
13990
13991     [[link boost_asio.reference.basic_io_object.service_type [*service_type]]]
13992     [The type of the service that will be used to provide I/O operations. ]
13993   
13994   ]
13995
13996 ]
13997
13998 [heading Member Functions]
13999 [table
14000   [[Name][Description]]
14001
14002   [
14003     [[link boost_asio.reference.basic_io_object.get_executor [*get_executor]]]
14004     [Get the executor associated with the object. ]
14005   ]
14006   
14007   [
14008     [[link boost_asio.reference.basic_io_object.get_io_context [*get_io_context]]]
14009     [(Deprecated: Use get_executor().) Get the io_context associated with the object. ]
14010   ]
14011   
14012   [
14013     [[link boost_asio.reference.basic_io_object.get_io_service [*get_io_service]]]
14014     [(Deprecated: Use get_executor().) Get the io_context associated with the object. ]
14015   ]
14016   
14017 ]
14018
14019 [heading Protected Member Functions]
14020 [table
14021   [[Name][Description]]
14022
14023   [
14024     [[link boost_asio.reference.basic_io_object.basic_io_object [*basic_io_object]]]
14025     [Construct a basic_io_object. 
14026      [hr]
14027      Move-construct a basic_io_object. 
14028      [hr]
14029      Perform a converting move-construction of a basic_io_object. ]
14030   ]
14031   
14032   [
14033     [[link boost_asio.reference.basic_io_object.get_implementation [*get_implementation]]]
14034     [Get the underlying implementation of the I/O object. ]
14035   ]
14036   
14037   [
14038     [[link boost_asio.reference.basic_io_object.get_service [*get_service]]]
14039     [Get the service associated with the I/O object. ]
14040   ]
14041   
14042   [
14043     [[link boost_asio.reference.basic_io_object.operator_eq_ [*operator=]]]
14044     [Move-assign a basic_io_object. ]
14045   ]
14046   
14047   [
14048     [[link boost_asio.reference.basic_io_object._basic_io_object [*~basic_io_object]]]
14049     [Protected destructor to prevent deletion through this type. ]
14050   ]
14051   
14052 ]
14053
14054
14055 [heading Remarks]
14056       
14057 All I/O objects are non-copyable. However, when using C++0x, certain I/O objects do support move construction and move assignment. 
14058
14059
14060
14061 [heading Requirements]
14062
14063 ['Header: ][^boost/asio/basic_io_object.hpp]
14064
14065 ['Convenience header: ][^boost/asio.hpp]
14066
14067 [section:basic_io_object basic_io_object::basic_io_object]
14068
14069 [indexterm2 boost_asio.indexterm.basic_io_object.basic_io_object..basic_io_object..basic_io_object] 
14070 Construct a [link boost_asio.reference.basic_io_object `basic_io_object`]. 
14071
14072
14073   explicit ``[link boost_asio.reference.basic_io_object.basic_io_object.overload1 basic_io_object]``(
14074       boost::asio::io_context & io_context);
14075   ``  [''''&raquo;''' [link boost_asio.reference.basic_io_object.basic_io_object.overload1 more...]]``
14076
14077
14078 Move-construct a [link boost_asio.reference.basic_io_object `basic_io_object`]. 
14079
14080
14081   ``[link boost_asio.reference.basic_io_object.basic_io_object.overload2 basic_io_object]``(
14082       basic_io_object && other);
14083   ``  [''''&raquo;''' [link boost_asio.reference.basic_io_object.basic_io_object.overload2 more...]]``
14084
14085
14086 Perform a converting move-construction of a [link boost_asio.reference.basic_io_object `basic_io_object`]. 
14087
14088
14089   template<
14090       typename ``[link boost_asio.reference.IoObjectService IoObjectService1]``>
14091   ``[link boost_asio.reference.basic_io_object.basic_io_object.overload3 basic_io_object]``(
14092       IoObjectService1 & other_service,
14093       typename IoObjectService1::implementation_type & other_implementation);
14094   ``  [''''&raquo;''' [link boost_asio.reference.basic_io_object.basic_io_object.overload3 more...]]``
14095
14096
14097 [section:overload1 basic_io_object::basic_io_object (1 of 3 overloads)]
14098
14099
14100 Construct a [link boost_asio.reference.basic_io_object `basic_io_object`]. 
14101
14102
14103   basic_io_object(
14104       boost::asio::io_context & io_context);
14105
14106
14107 Performs: 
14108
14109    get_service().construct(get_implementation()); 
14110
14111
14112
14113
14114
14115 [endsect]
14116
14117
14118
14119 [section:overload2 basic_io_object::basic_io_object (2 of 3 overloads)]
14120
14121
14122 Move-construct a [link boost_asio.reference.basic_io_object `basic_io_object`]. 
14123
14124
14125   basic_io_object(
14126       basic_io_object && other);
14127
14128
14129 Performs: 
14130
14131    get_service().move_construct(
14132        get_implementation(), other.get_implementation()); 
14133
14134
14135
14136
14137
14138 [heading Remarks]
14139       
14140 Available only for services that support movability, 
14141
14142
14143
14144
14145 [endsect]
14146
14147
14148
14149 [section:overload3 basic_io_object::basic_io_object (3 of 3 overloads)]
14150
14151
14152 Perform a converting move-construction of a [link boost_asio.reference.basic_io_object `basic_io_object`]. 
14153
14154
14155   template<
14156       typename ``[link boost_asio.reference.IoObjectService IoObjectService1]``>
14157   basic_io_object(
14158       IoObjectService1 & other_service,
14159       typename IoObjectService1::implementation_type & other_implementation);
14160
14161
14162
14163 [endsect]
14164
14165
14166 [endsect]
14167
14168
14169 [section:executor_type basic_io_object::executor_type]
14170
14171 [indexterm2 boost_asio.indexterm.basic_io_object.executor_type..executor_type..basic_io_object] 
14172 The type of the executor associated with the object. 
14173
14174
14175   typedef boost::asio::io_context::executor_type executor_type;
14176
14177
14178 [heading Member Functions]
14179 [table
14180   [[Name][Description]]
14181
14182   [
14183     [[link boost_asio.reference.io_context__executor_type.context [*context]]]
14184     [Obtain the underlying execution context. ]
14185   ]
14186   
14187   [
14188     [[link boost_asio.reference.io_context__executor_type.defer [*defer]]]
14189     [Request the io_context to invoke the given function object. ]
14190   ]
14191   
14192   [
14193     [[link boost_asio.reference.io_context__executor_type.dispatch [*dispatch]]]
14194     [Request the io_context to invoke the given function object. ]
14195   ]
14196   
14197   [
14198     [[link boost_asio.reference.io_context__executor_type.on_work_finished [*on_work_finished]]]
14199     [Inform the io_context that some work is no longer outstanding. ]
14200   ]
14201   
14202   [
14203     [[link boost_asio.reference.io_context__executor_type.on_work_started [*on_work_started]]]
14204     [Inform the io_context that it has some outstanding work to do. ]
14205   ]
14206   
14207   [
14208     [[link boost_asio.reference.io_context__executor_type.post [*post]]]
14209     [Request the io_context to invoke the given function object. ]
14210   ]
14211   
14212   [
14213     [[link boost_asio.reference.io_context__executor_type.running_in_this_thread [*running_in_this_thread]]]
14214     [Determine whether the io_context is running in the current thread. ]
14215   ]
14216   
14217 ]
14218
14219 [heading Friends]
14220 [table
14221   [[Name][Description]]
14222
14223   [
14224     [[link boost_asio.reference.io_context__executor_type.operator_not__eq_ [*operator!=]]]
14225     [Compare two executors for inequality. ]
14226   ]
14227   
14228   [
14229     [[link boost_asio.reference.io_context__executor_type.operator_eq__eq_ [*operator==]]]
14230     [Compare two executors for equality. ]
14231   ]
14232   
14233 ]
14234
14235
14236 [heading Requirements]
14237
14238 ['Header: ][^boost/asio/basic_io_object.hpp]
14239
14240 ['Convenience header: ][^boost/asio.hpp]
14241
14242
14243 [endsect]
14244
14245
14246
14247 [section:get_executor basic_io_object::get_executor]
14248
14249 [indexterm2 boost_asio.indexterm.basic_io_object.get_executor..get_executor..basic_io_object] 
14250 Get the executor associated with the object. 
14251
14252
14253   executor_type get_executor();
14254
14255
14256
14257 [endsect]
14258
14259
14260 [section:get_implementation basic_io_object::get_implementation]
14261
14262 [indexterm2 boost_asio.indexterm.basic_io_object.get_implementation..get_implementation..basic_io_object] 
14263 Get the underlying implementation of the I/O object. 
14264
14265
14266   implementation_type & ``[link boost_asio.reference.basic_io_object.get_implementation.overload1 get_implementation]``();
14267   ``  [''''&raquo;''' [link boost_asio.reference.basic_io_object.get_implementation.overload1 more...]]``
14268
14269   const implementation_type & ``[link boost_asio.reference.basic_io_object.get_implementation.overload2 get_implementation]``() const;
14270   ``  [''''&raquo;''' [link boost_asio.reference.basic_io_object.get_implementation.overload2 more...]]``
14271
14272
14273 [section:overload1 basic_io_object::get_implementation (1 of 2 overloads)]
14274
14275
14276 Get the underlying implementation of the I/O object. 
14277
14278
14279   implementation_type & get_implementation();
14280
14281
14282
14283 [endsect]
14284
14285
14286
14287 [section:overload2 basic_io_object::get_implementation (2 of 2 overloads)]
14288
14289
14290 Get the underlying implementation of the I/O object. 
14291
14292
14293   const implementation_type & get_implementation() const;
14294
14295
14296
14297 [endsect]
14298
14299
14300 [endsect]
14301
14302
14303 [section:get_io_context basic_io_object::get_io_context]
14304
14305 [indexterm2 boost_asio.indexterm.basic_io_object.get_io_context..get_io_context..basic_io_object] 
14306 (Deprecated: Use `get_executor()`.) Get the [link boost_asio.reference.io_context `io_context`] associated with the object. 
14307
14308
14309   boost::asio::io_context & get_io_context();
14310
14311
14312 This function may be used to obtain the [link boost_asio.reference.io_context `io_context`] object that the I/O object uses to dispatch handlers for asynchronous operations.
14313
14314
14315 [heading Return Value]
14316       
14317 A reference to the [link boost_asio.reference.io_context `io_context`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller. 
14318
14319
14320
14321
14322 [endsect]
14323
14324
14325
14326 [section:get_io_service basic_io_object::get_io_service]
14327
14328 [indexterm2 boost_asio.indexterm.basic_io_object.get_io_service..get_io_service..basic_io_object] 
14329 (Deprecated: Use `get_executor()`.) Get the [link boost_asio.reference.io_context `io_context`] associated with the object. 
14330
14331
14332   boost::asio::io_context & get_io_service();
14333
14334
14335 This function may be used to obtain the [link boost_asio.reference.io_context `io_context`] object that the I/O object uses to dispatch handlers for asynchronous operations.
14336
14337
14338 [heading Return Value]
14339       
14340 A reference to the [link boost_asio.reference.io_context `io_context`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller. 
14341
14342
14343
14344
14345 [endsect]
14346
14347
14348 [section:get_service basic_io_object::get_service]
14349
14350 [indexterm2 boost_asio.indexterm.basic_io_object.get_service..get_service..basic_io_object] 
14351 Get the service associated with the I/O object. 
14352
14353
14354   service_type & ``[link boost_asio.reference.basic_io_object.get_service.overload1 get_service]``();
14355   ``  [''''&raquo;''' [link boost_asio.reference.basic_io_object.get_service.overload1 more...]]``
14356
14357   const service_type & ``[link boost_asio.reference.basic_io_object.get_service.overload2 get_service]``() const;
14358   ``  [''''&raquo;''' [link boost_asio.reference.basic_io_object.get_service.overload2 more...]]``
14359
14360
14361 [section:overload1 basic_io_object::get_service (1 of 2 overloads)]
14362
14363
14364 Get the service associated with the I/O object. 
14365
14366
14367   service_type & get_service();
14368
14369
14370
14371 [endsect]
14372
14373
14374
14375 [section:overload2 basic_io_object::get_service (2 of 2 overloads)]
14376
14377
14378 Get the service associated with the I/O object. 
14379
14380
14381   const service_type & get_service() const;
14382
14383
14384
14385 [endsect]
14386
14387
14388 [endsect]
14389
14390
14391 [section:implementation_type basic_io_object::implementation_type]
14392
14393 [indexterm2 boost_asio.indexterm.basic_io_object.implementation_type..implementation_type..basic_io_object] 
14394 The underlying implementation type of I/O object. 
14395
14396
14397   typedef service_type::implementation_type implementation_type;
14398
14399
14400
14401 [heading Requirements]
14402
14403 ['Header: ][^boost/asio/basic_io_object.hpp]
14404
14405 ['Convenience header: ][^boost/asio.hpp]
14406
14407
14408 [endsect]
14409
14410
14411
14412 [section:operator_eq_ basic_io_object::operator=]
14413
14414 [indexterm2 boost_asio.indexterm.basic_io_object.operator_eq_..operator=..basic_io_object] 
14415 Move-assign a [link boost_asio.reference.basic_io_object `basic_io_object`]. 
14416
14417
14418   basic_io_object & operator=(
14419       basic_io_object && other);
14420
14421
14422 Performs: 
14423
14424    get_service().move_assign(get_implementation(),
14425        other.get_service(), other.get_implementation()); 
14426
14427
14428
14429
14430
14431 [heading Remarks]
14432       
14433 Available only for services that support movability, 
14434
14435
14436
14437
14438 [endsect]
14439
14440
14441
14442 [section:service_type basic_io_object::service_type]
14443
14444 [indexterm2 boost_asio.indexterm.basic_io_object.service_type..service_type..basic_io_object] 
14445 The type of the service that will be used to provide I/O operations. 
14446
14447
14448   typedef IoObjectService service_type;
14449
14450
14451
14452 [heading Requirements]
14453
14454 ['Header: ][^boost/asio/basic_io_object.hpp]
14455
14456 ['Convenience header: ][^boost/asio.hpp]
14457
14458
14459 [endsect]
14460
14461
14462
14463 [section:_basic_io_object basic_io_object::~basic_io_object]
14464
14465 [indexterm2 boost_asio.indexterm.basic_io_object._basic_io_object..~basic_io_object..basic_io_object] 
14466 Protected destructor to prevent deletion through this type. 
14467
14468
14469   ~basic_io_object();
14470
14471
14472 Performs: 
14473
14474    get_service().destroy(get_implementation()); 
14475
14476
14477
14478
14479
14480 [endsect]
14481
14482
14483
14484 [endsect]
14485
14486 [section:basic_raw_socket basic_raw_socket]
14487
14488
14489 Provides raw-oriented socket functionality. 
14490
14491
14492   template<
14493       typename ``[link boost_asio.reference.Protocol Protocol]``,
14494       typename ``[link boost_asio.reference.Executor1 Executor]``>
14495   class basic_raw_socket :
14496     public basic_socket< Protocol, Executor >
14497
14498
14499 [heading Types]
14500 [table
14501   [[Name][Description]]
14502
14503   [
14504
14505     [[link boost_asio.reference.basic_raw_socket__rebind_executor [*rebind_executor]]]
14506     [Rebinds the socket type to another executor. ]
14507   
14508   ]
14509
14510   [
14511
14512     [[link boost_asio.reference.basic_raw_socket.broadcast [*broadcast]]]
14513     [Socket option to permit sending of broadcast messages. ]
14514   
14515   ]
14516
14517   [
14518
14519     [[link boost_asio.reference.basic_raw_socket.bytes_readable [*bytes_readable]]]
14520     [IO control command to get the amount of data that can be read without blocking. ]
14521   
14522   ]
14523
14524   [
14525
14526     [[link boost_asio.reference.basic_raw_socket.debug [*debug]]]
14527     [Socket option to enable socket-level debugging. ]
14528   
14529   ]
14530
14531   [
14532
14533     [[link boost_asio.reference.basic_raw_socket.do_not_route [*do_not_route]]]
14534     [Socket option to prevent routing, use local interfaces only. ]
14535   
14536   ]
14537
14538   [
14539
14540     [[link boost_asio.reference.basic_raw_socket.enable_connection_aborted [*enable_connection_aborted]]]
14541     [Socket option to report aborted connections on accept. ]
14542   
14543   ]
14544
14545   [
14546
14547     [[link boost_asio.reference.basic_raw_socket.endpoint_type [*endpoint_type]]]
14548     [The endpoint type. ]
14549   
14550   ]
14551
14552   [
14553
14554     [[link boost_asio.reference.basic_raw_socket.executor_type [*executor_type]]]
14555     [The type of the executor associated with the object. ]
14556   
14557   ]
14558
14559   [
14560
14561     [[link boost_asio.reference.basic_raw_socket.keep_alive [*keep_alive]]]
14562     [Socket option to send keep-alives. ]
14563   
14564   ]
14565
14566   [
14567
14568     [[link boost_asio.reference.basic_raw_socket.linger [*linger]]]
14569     [Socket option to specify whether the socket lingers on close if unsent data is present. ]
14570   
14571   ]
14572
14573   [
14574
14575     [[link boost_asio.reference.basic_raw_socket.lowest_layer_type [*lowest_layer_type]]]
14576     [A basic_socket is always the lowest layer. ]
14577   
14578   ]
14579
14580   [
14581
14582     [[link boost_asio.reference.basic_raw_socket.message_flags [*message_flags]]]
14583     [Bitmask type for flags that can be passed to send and receive operations. ]
14584   
14585   ]
14586
14587   [
14588
14589     [[link boost_asio.reference.basic_raw_socket.native_handle_type [*native_handle_type]]]
14590     [The native representation of a socket. ]
14591   
14592   ]
14593
14594   [
14595
14596     [[link boost_asio.reference.basic_raw_socket.out_of_band_inline [*out_of_band_inline]]]
14597     [Socket option for putting received out-of-band data inline. ]
14598   
14599   ]
14600
14601   [
14602
14603     [[link boost_asio.reference.basic_raw_socket.protocol_type [*protocol_type]]]
14604     [The protocol type. ]
14605   
14606   ]
14607
14608   [
14609
14610     [[link boost_asio.reference.basic_raw_socket.receive_buffer_size [*receive_buffer_size]]]
14611     [Socket option for the receive buffer size of a socket. ]
14612   
14613   ]
14614
14615   [
14616
14617     [[link boost_asio.reference.basic_raw_socket.receive_low_watermark [*receive_low_watermark]]]
14618     [Socket option for the receive low watermark. ]
14619   
14620   ]
14621
14622   [
14623
14624     [[link boost_asio.reference.basic_raw_socket.reuse_address [*reuse_address]]]
14625     [Socket option to allow the socket to be bound to an address that is already in use. ]
14626   
14627   ]
14628
14629   [
14630
14631     [[link boost_asio.reference.basic_raw_socket.send_buffer_size [*send_buffer_size]]]
14632     [Socket option for the send buffer size of a socket. ]
14633   
14634   ]
14635
14636   [
14637
14638     [[link boost_asio.reference.basic_raw_socket.send_low_watermark [*send_low_watermark]]]
14639     [Socket option for the send low watermark. ]
14640   
14641   ]
14642
14643   [
14644
14645     [[link boost_asio.reference.basic_raw_socket.shutdown_type [*shutdown_type]]]
14646     [Different ways a socket may be shutdown. ]
14647   
14648   ]
14649
14650   [
14651
14652     [[link boost_asio.reference.basic_raw_socket.wait_type [*wait_type]]]
14653     [Wait types. ]
14654   
14655   ]
14656
14657 ]
14658
14659 [heading Member Functions]
14660 [table
14661   [[Name][Description]]
14662
14663   [
14664     [[link boost_asio.reference.basic_raw_socket.assign [*assign]]]
14665     [Assign an existing native socket to the socket. ]
14666   ]
14667   
14668   [
14669     [[link boost_asio.reference.basic_raw_socket.async_connect [*async_connect]]]
14670     [Start an asynchronous connect. ]
14671   ]
14672   
14673   [
14674     [[link boost_asio.reference.basic_raw_socket.async_receive [*async_receive]]]
14675     [Start an asynchronous receive on a connected socket. ]
14676   ]
14677   
14678   [
14679     [[link boost_asio.reference.basic_raw_socket.async_receive_from [*async_receive_from]]]
14680     [Start an asynchronous receive. ]
14681   ]
14682   
14683   [
14684     [[link boost_asio.reference.basic_raw_socket.async_send [*async_send]]]
14685     [Start an asynchronous send on a connected socket. ]
14686   ]
14687   
14688   [
14689     [[link boost_asio.reference.basic_raw_socket.async_send_to [*async_send_to]]]
14690     [Start an asynchronous send. ]
14691   ]
14692   
14693   [
14694     [[link boost_asio.reference.basic_raw_socket.async_wait [*async_wait]]]
14695     [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
14696   ]
14697   
14698   [
14699     [[link boost_asio.reference.basic_raw_socket.at_mark [*at_mark]]]
14700     [Determine whether the socket is at the out-of-band data mark. ]
14701   ]
14702   
14703   [
14704     [[link boost_asio.reference.basic_raw_socket.available [*available]]]
14705     [Determine the number of bytes available for reading. ]
14706   ]
14707   
14708   [
14709     [[link boost_asio.reference.basic_raw_socket.basic_raw_socket [*basic_raw_socket]]]
14710     [Construct a basic_raw_socket without opening it. 
14711      [hr]
14712      Construct and open a basic_raw_socket. 
14713      [hr]
14714      Construct a basic_raw_socket, opening it and binding it to the given local endpoint. 
14715      [hr]
14716      Construct a basic_raw_socket on an existing native socket. 
14717      [hr]
14718      Move-construct a basic_raw_socket from another. 
14719      [hr]
14720      Move-construct a basic_raw_socket from a socket of another protocol type. ]
14721   ]
14722   
14723   [
14724     [[link boost_asio.reference.basic_raw_socket.bind [*bind]]]
14725     [Bind the socket to the given local endpoint. ]
14726   ]
14727   
14728   [
14729     [[link boost_asio.reference.basic_raw_socket.cancel [*cancel]]]
14730     [Cancel all asynchronous operations associated with the socket. ]
14731   ]
14732   
14733   [
14734     [[link boost_asio.reference.basic_raw_socket.close [*close]]]
14735     [Close the socket. ]
14736   ]
14737   
14738   [
14739     [[link boost_asio.reference.basic_raw_socket.connect [*connect]]]
14740     [Connect the socket to the specified endpoint. ]
14741   ]
14742   
14743   [
14744     [[link boost_asio.reference.basic_raw_socket.get_executor [*get_executor]]]
14745     [Get the executor associated with the object. ]
14746   ]
14747   
14748   [
14749     [[link boost_asio.reference.basic_raw_socket.get_option [*get_option]]]
14750     [Get an option from the socket. ]
14751   ]
14752   
14753   [
14754     [[link boost_asio.reference.basic_raw_socket.io_control [*io_control]]]
14755     [Perform an IO control command on the socket. ]
14756   ]
14757   
14758   [
14759     [[link boost_asio.reference.basic_raw_socket.is_open [*is_open]]]
14760     [Determine whether the socket is open. ]
14761   ]
14762   
14763   [
14764     [[link boost_asio.reference.basic_raw_socket.local_endpoint [*local_endpoint]]]
14765     [Get the local endpoint of the socket. ]
14766   ]
14767   
14768   [
14769     [[link boost_asio.reference.basic_raw_socket.lowest_layer [*lowest_layer]]]
14770     [Get a reference to the lowest layer. 
14771      [hr]
14772      Get a const reference to the lowest layer. ]
14773   ]
14774   
14775   [
14776     [[link boost_asio.reference.basic_raw_socket.native_handle [*native_handle]]]
14777     [Get the native socket representation. ]
14778   ]
14779   
14780   [
14781     [[link boost_asio.reference.basic_raw_socket.native_non_blocking [*native_non_blocking]]]
14782     [Gets the non-blocking mode of the native socket implementation. 
14783      [hr]
14784      Sets the non-blocking mode of the native socket implementation. ]
14785   ]
14786   
14787   [
14788     [[link boost_asio.reference.basic_raw_socket.non_blocking [*non_blocking]]]
14789     [Gets the non-blocking mode of the socket. 
14790      [hr]
14791      Sets the non-blocking mode of the socket. ]
14792   ]
14793   
14794   [
14795     [[link boost_asio.reference.basic_raw_socket.open [*open]]]
14796     [Open the socket using the specified protocol. ]
14797   ]
14798   
14799   [
14800     [[link boost_asio.reference.basic_raw_socket.operator_eq_ [*operator=]]]
14801     [Move-assign a basic_raw_socket from another. 
14802      [hr]
14803      Move-assign a basic_raw_socket from a socket of another protocol type. ]
14804   ]
14805   
14806   [
14807     [[link boost_asio.reference.basic_raw_socket.receive [*receive]]]
14808     [Receive some data on a connected socket. ]
14809   ]
14810   
14811   [
14812     [[link boost_asio.reference.basic_raw_socket.receive_from [*receive_from]]]
14813     [Receive raw data with the endpoint of the sender. ]
14814   ]
14815   
14816   [
14817     [[link boost_asio.reference.basic_raw_socket.release [*release]]]
14818     [Release ownership of the underlying native socket. ]
14819   ]
14820   
14821   [
14822     [[link boost_asio.reference.basic_raw_socket.remote_endpoint [*remote_endpoint]]]
14823     [Get the remote endpoint of the socket. ]
14824   ]
14825   
14826   [
14827     [[link boost_asio.reference.basic_raw_socket.send [*send]]]
14828     [Send some data on a connected socket. ]
14829   ]
14830   
14831   [
14832     [[link boost_asio.reference.basic_raw_socket.send_to [*send_to]]]
14833     [Send raw data to the specified endpoint. ]
14834   ]
14835   
14836   [
14837     [[link boost_asio.reference.basic_raw_socket.set_option [*set_option]]]
14838     [Set an option on the socket. ]
14839   ]
14840   
14841   [
14842     [[link boost_asio.reference.basic_raw_socket.shutdown [*shutdown]]]
14843     [Disable sends or receives on the socket. ]
14844   ]
14845   
14846   [
14847     [[link boost_asio.reference.basic_raw_socket.wait [*wait]]]
14848     [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
14849   ]
14850   
14851   [
14852     [[link boost_asio.reference.basic_raw_socket._basic_raw_socket [*~basic_raw_socket]]]
14853     [Destroys the socket. ]
14854   ]
14855   
14856 ]
14857
14858 [heading Data Members]
14859 [table
14860   [[Name][Description]]
14861
14862   [
14863     [[link boost_asio.reference.basic_raw_socket.max_connections [*max_connections]]]
14864     [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
14865   ]
14866
14867   [
14868     [[link boost_asio.reference.basic_raw_socket.max_listen_connections [*max_listen_connections]]]
14869     [The maximum length of the queue of pending incoming connections. ]
14870   ]
14871
14872   [
14873     [[link boost_asio.reference.basic_raw_socket.message_do_not_route [*message_do_not_route]]]
14874     [Specify that the data should not be subject to routing. ]
14875   ]
14876
14877   [
14878     [[link boost_asio.reference.basic_raw_socket.message_end_of_record [*message_end_of_record]]]
14879     [Specifies that the data marks the end of a record. ]
14880   ]
14881
14882   [
14883     [[link boost_asio.reference.basic_raw_socket.message_out_of_band [*message_out_of_band]]]
14884     [Process out-of-band data. ]
14885   ]
14886
14887   [
14888     [[link boost_asio.reference.basic_raw_socket.message_peek [*message_peek]]]
14889     [Peek at incoming data without removing it from the input queue. ]
14890   ]
14891
14892 ]
14893
14894 [heading Protected Data Members]
14895 [table
14896   [[Name][Description]]
14897
14898   [
14899     [[link boost_asio.reference.basic_raw_socket.impl_ [*impl_]]]
14900     []
14901   ]
14902
14903 ]
14904
14905 The [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] class template provides asynchronous and blocking raw-oriented socket functionality.
14906
14907
14908 [heading Thread Safety]
14909   
14910 ['Distinct] ['objects:] Safe.
14911
14912 ['Shared] ['objects:] Unsafe. 
14913
14914
14915
14916 [heading Requirements]
14917
14918 ['Header: ][^boost/asio/basic_raw_socket.hpp]
14919
14920 ['Convenience header: ][^boost/asio.hpp]
14921
14922 [section:assign basic_raw_socket::assign]
14923
14924 [indexterm2 boost_asio.indexterm.basic_raw_socket.assign..assign..basic_raw_socket] 
14925 Assign an existing native socket to the socket. 
14926
14927
14928   void ``[link boost_asio.reference.basic_raw_socket.assign.overload1 assign]``(
14929       const protocol_type & protocol,
14930       const native_handle_type & native_socket);
14931   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.assign.overload1 more...]]``
14932
14933   void ``[link boost_asio.reference.basic_raw_socket.assign.overload2 assign]``(
14934       const protocol_type & protocol,
14935       const native_handle_type & native_socket,
14936       boost::system::error_code & ec);
14937   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.assign.overload2 more...]]``
14938
14939
14940 [section:overload1 basic_raw_socket::assign (1 of 2 overloads)]
14941
14942
14943 ['Inherited from basic_socket.]
14944
14945
14946 Assign an existing native socket to the socket. 
14947
14948
14949   void assign(
14950       const protocol_type & protocol,
14951       const native_handle_type & native_socket);
14952
14953
14954
14955 [endsect]
14956
14957
14958
14959 [section:overload2 basic_raw_socket::assign (2 of 2 overloads)]
14960
14961
14962 ['Inherited from basic_socket.]
14963
14964
14965 Assign an existing native socket to the socket. 
14966
14967
14968   void assign(
14969       const protocol_type & protocol,
14970       const native_handle_type & native_socket,
14971       boost::system::error_code & ec);
14972
14973
14974
14975 [endsect]
14976
14977
14978 [endsect]
14979
14980
14981 [section:async_connect basic_raw_socket::async_connect]
14982
14983
14984 ['Inherited from basic_socket.]
14985
14986 [indexterm2 boost_asio.indexterm.basic_raw_socket.async_connect..async_connect..basic_raw_socket] 
14987 Start an asynchronous connect. 
14988
14989
14990   template<
14991       typename ``[link boost_asio.reference.ConnectHandler ConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
14992   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect(
14993       const endpoint_type & peer_endpoint,
14994       ConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
14995
14996
14997 This function is used to asynchronously connect a socket to the specified remote endpoint. The function call always returns immediately.
14998
14999 The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
15000
15001
15002 [heading Parameters]
15003     
15004
15005 [variablelist
15006   
15007 [[peer_endpoint][The remote endpoint to which the socket will be connected. Copies will be made of the endpoint object as required.]]
15008
15009 [[handler][The handler to be called when the connection operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
15010 ``
15011    void handler(
15012      const boost::system::error_code& error // Result of operation
15013    ); 
15014 ``
15015 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
15016
15017 ]
15018
15019
15020 [heading Example]
15021   
15022
15023
15024    void connect_handler(const boost::system::error_code& error)
15025    {
15026      if (!error)
15027      {
15028        // Connect succeeded.
15029      }
15030    }
15031
15032    ...
15033
15034    boost::asio::ip::tcp::socket socket(my_context);
15035    boost::asio::ip::tcp::endpoint endpoint(
15036        boost::asio::ip::address::from_string("1.2.3.4"), 12345);
15037    socket.async_connect(endpoint, connect_handler);
15038
15039
15040
15041
15042
15043
15044
15045 [endsect]
15046
15047
15048 [section:async_receive basic_raw_socket::async_receive]
15049
15050 [indexterm2 boost_asio.indexterm.basic_raw_socket.async_receive..async_receive..basic_raw_socket] 
15051 Start an asynchronous receive on a connected socket. 
15052
15053
15054   template<
15055       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
15056       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
15057   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_raw_socket.async_receive.overload1 async_receive]``(
15058       const MutableBufferSequence & buffers,
15059       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
15060   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.async_receive.overload1 more...]]``
15061
15062   template<
15063       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
15064       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
15065   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_raw_socket.async_receive.overload2 async_receive]``(
15066       const MutableBufferSequence & buffers,
15067       socket_base::message_flags flags,
15068       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
15069   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.async_receive.overload2 more...]]``
15070
15071
15072 [section:overload1 basic_raw_socket::async_receive (1 of 2 overloads)]
15073
15074
15075 Start an asynchronous receive on a connected socket. 
15076
15077
15078   template<
15079       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
15080       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
15081   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive(
15082       const MutableBufferSequence & buffers,
15083       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
15084
15085
15086 This function is used to asynchronously receive data from the raw socket. The function call always returns immediately.
15087
15088
15089 [heading Parameters]
15090     
15091
15092 [variablelist
15093   
15094 [[buffers][One or more buffers into which the data will be received. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
15095
15096 [[handler][The handler to be called when the receive operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
15097 ``
15098    void handler(
15099      const boost::system::error_code& error, // Result of operation.
15100      std::size_t bytes_transferred           // Number of bytes received.
15101    ); 
15102 ``
15103 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
15104
15105 ]
15106
15107
15108 [heading Remarks]
15109       
15110 The async\_receive operation can only be used with a connected socket. Use the async\_receive\_from function to receive data on an unconnected raw socket.
15111
15112
15113 [heading Example]
15114   
15115 To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
15116
15117    socket.async_receive(boost::asio::buffer(data, size), handler);
15118
15119
15120 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
15121
15122
15123
15124
15125 [endsect]
15126
15127
15128
15129 [section:overload2 basic_raw_socket::async_receive (2 of 2 overloads)]
15130
15131
15132 Start an asynchronous receive on a connected socket. 
15133
15134
15135   template<
15136       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
15137       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
15138   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive(
15139       const MutableBufferSequence & buffers,
15140       socket_base::message_flags flags,
15141       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
15142
15143
15144 This function is used to asynchronously receive data from the raw socket. The function call always returns immediately.
15145
15146
15147 [heading Parameters]
15148     
15149
15150 [variablelist
15151   
15152 [[buffers][One or more buffers into which the data will be received. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
15153
15154 [[flags][Flags specifying how the receive call is to be made.]]
15155
15156 [[handler][The handler to be called when the receive operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
15157 ``
15158    void handler(
15159      const boost::system::error_code& error, // Result of operation.
15160      std::size_t bytes_transferred           // Number of bytes received.
15161    ); 
15162 ``
15163 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
15164
15165 ]
15166
15167
15168 [heading Remarks]
15169       
15170 The async\_receive operation can only be used with a connected socket. Use the async\_receive\_from function to receive data on an unconnected raw socket. 
15171
15172
15173
15174
15175 [endsect]
15176
15177
15178 [endsect]
15179
15180 [section:async_receive_from basic_raw_socket::async_receive_from]
15181
15182 [indexterm2 boost_asio.indexterm.basic_raw_socket.async_receive_from..async_receive_from..basic_raw_socket] 
15183 Start an asynchronous receive. 
15184
15185
15186   template<
15187       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
15188       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
15189   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_raw_socket.async_receive_from.overload1 async_receive_from]``(
15190       const MutableBufferSequence & buffers,
15191       endpoint_type & sender_endpoint,
15192       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
15193   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.async_receive_from.overload1 more...]]``
15194
15195   template<
15196       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
15197       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
15198   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_raw_socket.async_receive_from.overload2 async_receive_from]``(
15199       const MutableBufferSequence & buffers,
15200       endpoint_type & sender_endpoint,
15201       socket_base::message_flags flags,
15202       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
15203   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.async_receive_from.overload2 more...]]``
15204
15205
15206 [section:overload1 basic_raw_socket::async_receive_from (1 of 2 overloads)]
15207
15208
15209 Start an asynchronous receive. 
15210
15211
15212   template<
15213       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
15214       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
15215   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive_from(
15216       const MutableBufferSequence & buffers,
15217       endpoint_type & sender_endpoint,
15218       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
15219
15220
15221 This function is used to asynchronously receive raw data. The function call always returns immediately.
15222
15223
15224 [heading Parameters]
15225     
15226
15227 [variablelist
15228   
15229 [[buffers][One or more buffers into which the data will be received. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
15230
15231 [[sender_endpoint][An endpoint object that receives the endpoint of the remote sender of the data. Ownership of the sender\_endpoint object is retained by the caller, which must guarantee that it is valid until the handler is called.]]
15232
15233 [[handler][The handler to be called when the receive operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
15234 ``
15235    void handler(
15236      const boost::system::error_code& error, // Result of operation.
15237      std::size_t bytes_transferred           // Number of bytes received.
15238    ); 
15239 ``
15240 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
15241
15242 ]
15243
15244
15245 [heading Example]
15246   
15247 To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
15248
15249    socket.async_receive_from(
15250        boost::asio::buffer(data, size), 0, sender_endpoint, handler); 
15251
15252
15253 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
15254
15255
15256
15257
15258 [endsect]
15259
15260
15261
15262 [section:overload2 basic_raw_socket::async_receive_from (2 of 2 overloads)]
15263
15264
15265 Start an asynchronous receive. 
15266
15267
15268   template<
15269       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
15270       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
15271   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive_from(
15272       const MutableBufferSequence & buffers,
15273       endpoint_type & sender_endpoint,
15274       socket_base::message_flags flags,
15275       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
15276
15277
15278 This function is used to asynchronously receive raw data. The function call always returns immediately.
15279
15280
15281 [heading Parameters]
15282     
15283
15284 [variablelist
15285   
15286 [[buffers][One or more buffers into which the data will be received. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
15287
15288 [[sender_endpoint][An endpoint object that receives the endpoint of the remote sender of the data. Ownership of the sender\_endpoint object is retained by the caller, which must guarantee that it is valid until the handler is called.]]
15289
15290 [[flags][Flags specifying how the receive call is to be made.]]
15291
15292 [[handler][The handler to be called when the receive operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
15293 ``
15294    void handler(
15295      const boost::system::error_code& error, // Result of operation.
15296      std::size_t bytes_transferred           // Number of bytes received.
15297    ); 
15298 ``
15299 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
15300
15301 ]
15302
15303
15304
15305
15306 [endsect]
15307
15308
15309 [endsect]
15310
15311 [section:async_send basic_raw_socket::async_send]
15312
15313 [indexterm2 boost_asio.indexterm.basic_raw_socket.async_send..async_send..basic_raw_socket] 
15314 Start an asynchronous send on a connected socket. 
15315
15316
15317   template<
15318       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
15319       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
15320   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_raw_socket.async_send.overload1 async_send]``(
15321       const ConstBufferSequence & buffers,
15322       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
15323   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.async_send.overload1 more...]]``
15324
15325   template<
15326       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
15327       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
15328   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_raw_socket.async_send.overload2 async_send]``(
15329       const ConstBufferSequence & buffers,
15330       socket_base::message_flags flags,
15331       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
15332   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.async_send.overload2 more...]]``
15333
15334
15335 [section:overload1 basic_raw_socket::async_send (1 of 2 overloads)]
15336
15337
15338 Start an asynchronous send on a connected socket. 
15339
15340
15341   template<
15342       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
15343       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
15344   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send(
15345       const ConstBufferSequence & buffers,
15346       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
15347
15348
15349 This function is used to send data on the raw socket. The function call will block until the data has been sent successfully or an error occurs.
15350
15351
15352 [heading Parameters]
15353     
15354
15355 [variablelist
15356   
15357 [[buffers][One or more data buffers to be sent on the socket. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
15358
15359 [[handler][The handler to be called when the send operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
15360 ``
15361    void handler(
15362      const boost::system::error_code& error, // Result of operation.
15363      std::size_t bytes_transferred           // Number of bytes sent.
15364    ); 
15365 ``
15366 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
15367
15368 ]
15369
15370
15371 [heading Remarks]
15372       
15373 The async\_send operation can only be used with a connected socket. Use the async\_send\_to function to send data on an unconnected raw socket.
15374
15375
15376 [heading Example]
15377   
15378 To send a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
15379
15380    socket.async_send(boost::asio::buffer(data, size), handler);
15381
15382
15383 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
15384
15385
15386
15387
15388 [endsect]
15389
15390
15391
15392 [section:overload2 basic_raw_socket::async_send (2 of 2 overloads)]
15393
15394
15395 Start an asynchronous send on a connected socket. 
15396
15397
15398   template<
15399       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
15400       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
15401   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send(
15402       const ConstBufferSequence & buffers,
15403       socket_base::message_flags flags,
15404       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
15405
15406
15407 This function is used to send data on the raw socket. The function call will block until the data has been sent successfully or an error occurs.
15408
15409
15410 [heading Parameters]
15411     
15412
15413 [variablelist
15414   
15415 [[buffers][One or more data buffers to be sent on the socket. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
15416
15417 [[flags][Flags specifying how the send call is to be made.]]
15418
15419 [[handler][The handler to be called when the send operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
15420 ``
15421    void handler(
15422      const boost::system::error_code& error, // Result of operation.
15423      std::size_t bytes_transferred           // Number of bytes sent.
15424    ); 
15425 ``
15426 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
15427
15428 ]
15429
15430
15431 [heading Remarks]
15432       
15433 The async\_send operation can only be used with a connected socket. Use the async\_send\_to function to send data on an unconnected raw socket. 
15434
15435
15436
15437
15438 [endsect]
15439
15440
15441 [endsect]
15442
15443 [section:async_send_to basic_raw_socket::async_send_to]
15444
15445 [indexterm2 boost_asio.indexterm.basic_raw_socket.async_send_to..async_send_to..basic_raw_socket] 
15446 Start an asynchronous send. 
15447
15448
15449   template<
15450       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
15451       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
15452   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_raw_socket.async_send_to.overload1 async_send_to]``(
15453       const ConstBufferSequence & buffers,
15454       const endpoint_type & destination,
15455       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
15456   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.async_send_to.overload1 more...]]``
15457
15458   template<
15459       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
15460       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
15461   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_raw_socket.async_send_to.overload2 async_send_to]``(
15462       const ConstBufferSequence & buffers,
15463       const endpoint_type & destination,
15464       socket_base::message_flags flags,
15465       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
15466   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.async_send_to.overload2 more...]]``
15467
15468
15469 [section:overload1 basic_raw_socket::async_send_to (1 of 2 overloads)]
15470
15471
15472 Start an asynchronous send. 
15473
15474
15475   template<
15476       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
15477       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
15478   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send_to(
15479       const ConstBufferSequence & buffers,
15480       const endpoint_type & destination,
15481       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
15482
15483
15484 This function is used to asynchronously send raw data to the specified remote endpoint. The function call always returns immediately.
15485
15486
15487 [heading Parameters]
15488     
15489
15490 [variablelist
15491   
15492 [[buffers][One or more data buffers to be sent to the remote endpoint. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
15493
15494 [[destination][The remote endpoint to which the data will be sent. Copies will be made of the endpoint as required.]]
15495
15496 [[handler][The handler to be called when the send operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
15497 ``
15498    void handler(
15499      const boost::system::error_code& error, // Result of operation.
15500      std::size_t bytes_transferred           // Number of bytes sent.
15501    ); 
15502 ``
15503 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
15504
15505 ]
15506
15507
15508 [heading Example]
15509   
15510 To send a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
15511
15512    boost::asio::ip::udp::endpoint destination(
15513        boost::asio::ip::address::from_string("1.2.3.4"), 12345);
15514    socket.async_send_to(
15515        boost::asio::buffer(data, size), destination, handler);
15516
15517
15518 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
15519
15520
15521
15522
15523 [endsect]
15524
15525
15526
15527 [section:overload2 basic_raw_socket::async_send_to (2 of 2 overloads)]
15528
15529
15530 Start an asynchronous send. 
15531
15532
15533   template<
15534       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
15535       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
15536   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send_to(
15537       const ConstBufferSequence & buffers,
15538       const endpoint_type & destination,
15539       socket_base::message_flags flags,
15540       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
15541
15542
15543 This function is used to asynchronously send raw data to the specified remote endpoint. The function call always returns immediately.
15544
15545
15546 [heading Parameters]
15547     
15548
15549 [variablelist
15550   
15551 [[buffers][One or more data buffers to be sent to the remote endpoint. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
15552
15553 [[flags][Flags specifying how the send call is to be made.]]
15554
15555 [[destination][The remote endpoint to which the data will be sent. Copies will be made of the endpoint as required.]]
15556
15557 [[handler][The handler to be called when the send operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
15558 ``
15559    void handler(
15560      const boost::system::error_code& error, // Result of operation.
15561      std::size_t bytes_transferred           // Number of bytes sent.
15562    ); 
15563 ``
15564 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
15565
15566 ]
15567
15568
15569
15570
15571 [endsect]
15572
15573
15574 [endsect]
15575
15576
15577 [section:async_wait basic_raw_socket::async_wait]
15578
15579
15580 ['Inherited from basic_socket.]
15581
15582 [indexterm2 boost_asio.indexterm.basic_raw_socket.async_wait..async_wait..basic_raw_socket] 
15583 Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. 
15584
15585
15586   template<
15587       typename ``[link boost_asio.reference.WaitHandler WaitHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
15588   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait(
15589       wait_type w,
15590       WaitHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
15591
15592
15593 This function is used to perform an asynchronous wait for a socket to enter a ready to read, write or error condition state.
15594
15595
15596 [heading Parameters]
15597     
15598
15599 [variablelist
15600   
15601 [[w][Specifies the desired socket state.]]
15602
15603 [[handler][The handler to be called when the wait operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
15604 ``
15605    void handler(
15606      const boost::system::error_code& error // Result of operation
15607    ); 
15608 ``
15609 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
15610
15611 ]
15612
15613
15614 [heading Example]
15615   
15616
15617
15618    void wait_handler(const boost::system::error_code& error)
15619    {
15620      if (!error)
15621      {
15622        // Wait succeeded.
15623      }
15624    }
15625
15626    ...
15627
15628    boost::asio::ip::tcp::socket socket(my_context);
15629    ...
15630    socket.async_wait(boost::asio::ip::tcp::socket::wait_read, wait_handler);
15631
15632
15633
15634
15635
15636
15637
15638 [endsect]
15639
15640
15641 [section:at_mark basic_raw_socket::at_mark]
15642
15643 [indexterm2 boost_asio.indexterm.basic_raw_socket.at_mark..at_mark..basic_raw_socket] 
15644 Determine whether the socket is at the out-of-band data mark. 
15645
15646
15647   bool ``[link boost_asio.reference.basic_raw_socket.at_mark.overload1 at_mark]``() const;
15648   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.at_mark.overload1 more...]]``
15649
15650   bool ``[link boost_asio.reference.basic_raw_socket.at_mark.overload2 at_mark]``(
15651       boost::system::error_code & ec) const;
15652   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.at_mark.overload2 more...]]``
15653
15654
15655 [section:overload1 basic_raw_socket::at_mark (1 of 2 overloads)]
15656
15657
15658 ['Inherited from basic_socket.]
15659
15660
15661 Determine whether the socket is at the out-of-band data mark. 
15662
15663
15664   bool at_mark() const;
15665
15666
15667 This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
15668
15669
15670 [heading Return Value]
15671       
15672 A bool indicating whether the socket is at the out-of-band data mark.
15673
15674
15675 [heading Exceptions]
15676     
15677
15678 [variablelist
15679   
15680 [[boost::system::system_error][Thrown on failure. ]]
15681
15682 ]
15683
15684
15685
15686
15687 [endsect]
15688
15689
15690
15691 [section:overload2 basic_raw_socket::at_mark (2 of 2 overloads)]
15692
15693
15694 ['Inherited from basic_socket.]
15695
15696
15697 Determine whether the socket is at the out-of-band data mark. 
15698
15699
15700   bool at_mark(
15701       boost::system::error_code & ec) const;
15702
15703
15704 This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
15705
15706
15707 [heading Parameters]
15708     
15709
15710 [variablelist
15711   
15712 [[ec][Set to indicate what error occurred, if any.]]
15713
15714 ]
15715
15716
15717 [heading Return Value]
15718       
15719 A bool indicating whether the socket is at the out-of-band data mark. 
15720
15721
15722
15723
15724 [endsect]
15725
15726
15727 [endsect]
15728
15729 [section:available basic_raw_socket::available]
15730
15731 [indexterm2 boost_asio.indexterm.basic_raw_socket.available..available..basic_raw_socket] 
15732 Determine the number of bytes available for reading. 
15733
15734
15735   std::size_t ``[link boost_asio.reference.basic_raw_socket.available.overload1 available]``() const;
15736   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.available.overload1 more...]]``
15737
15738   std::size_t ``[link boost_asio.reference.basic_raw_socket.available.overload2 available]``(
15739       boost::system::error_code & ec) const;
15740   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.available.overload2 more...]]``
15741
15742
15743 [section:overload1 basic_raw_socket::available (1 of 2 overloads)]
15744
15745
15746 ['Inherited from basic_socket.]
15747
15748
15749 Determine the number of bytes available for reading. 
15750
15751
15752   std::size_t available() const;
15753
15754
15755 This function is used to determine the number of bytes that may be read without blocking.
15756
15757
15758 [heading Return Value]
15759       
15760 The number of bytes that may be read without blocking, or 0 if an error occurs.
15761
15762
15763 [heading Exceptions]
15764     
15765
15766 [variablelist
15767   
15768 [[boost::system::system_error][Thrown on failure. ]]
15769
15770 ]
15771
15772
15773
15774
15775 [endsect]
15776
15777
15778
15779 [section:overload2 basic_raw_socket::available (2 of 2 overloads)]
15780
15781
15782 ['Inherited from basic_socket.]
15783
15784
15785 Determine the number of bytes available for reading. 
15786
15787
15788   std::size_t available(
15789       boost::system::error_code & ec) const;
15790
15791
15792 This function is used to determine the number of bytes that may be read without blocking.
15793
15794
15795 [heading Parameters]
15796     
15797
15798 [variablelist
15799   
15800 [[ec][Set to indicate what error occurred, if any.]]
15801
15802 ]
15803
15804
15805 [heading Return Value]
15806       
15807 The number of bytes that may be read without blocking, or 0 if an error occurs. 
15808
15809
15810
15811
15812 [endsect]
15813
15814
15815 [endsect]
15816
15817 [section:basic_raw_socket basic_raw_socket::basic_raw_socket]
15818
15819 [indexterm2 boost_asio.indexterm.basic_raw_socket.basic_raw_socket..basic_raw_socket..basic_raw_socket] 
15820 Construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] without opening it. 
15821
15822
15823   explicit ``[link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload1 basic_raw_socket]``(
15824       const executor_type & ex);
15825   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload1 more...]]``
15826
15827   template<
15828       typename ExecutionContext>
15829   explicit ``[link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload2 basic_raw_socket]``(
15830       ExecutionContext & context,
15831       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
15832   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload2 more...]]``
15833
15834
15835 Construct and open a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`]. 
15836
15837
15838   ``[link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload3 basic_raw_socket]``(
15839       const executor_type & ex,
15840       const protocol_type & protocol);
15841   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload3 more...]]``
15842
15843   template<
15844       typename ExecutionContext>
15845   ``[link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload4 basic_raw_socket]``(
15846       ExecutionContext & context,
15847       const protocol_type & protocol,
15848       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
15849   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload4 more...]]``
15850
15851
15852 Construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`], opening it and binding it to the given local endpoint. 
15853
15854
15855   ``[link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload5 basic_raw_socket]``(
15856       const executor_type & ex,
15857       const endpoint_type & endpoint);
15858   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload5 more...]]``
15859
15860   template<
15861       typename ExecutionContext>
15862   ``[link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload6 basic_raw_socket]``(
15863       ExecutionContext & context,
15864       const endpoint_type & endpoint,
15865       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
15866   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload6 more...]]``
15867
15868
15869 Construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] on an existing native socket. 
15870
15871
15872   ``[link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload7 basic_raw_socket]``(
15873       const executor_type & ex,
15874       const protocol_type & protocol,
15875       const native_handle_type & native_socket);
15876   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload7 more...]]``
15877
15878   template<
15879       typename ExecutionContext>
15880   ``[link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload8 basic_raw_socket]``(
15881       ExecutionContext & context,
15882       const protocol_type & protocol,
15883       const native_handle_type & native_socket,
15884       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
15885   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload8 more...]]``
15886
15887
15888 Move-construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] from another. 
15889
15890
15891   ``[link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload9 basic_raw_socket]``(
15892       basic_raw_socket && other);
15893   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload9 more...]]``
15894
15895
15896 Move-construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] from a socket of another protocol type. 
15897
15898
15899   template<
15900       typename ``[link boost_asio.reference.Protocol Protocol1]``,
15901       typename ``[link boost_asio.reference.Executor1 Executor1]``>
15902   ``[link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload10 basic_raw_socket]``(
15903       basic_raw_socket< Protocol1, Executor1 > && other,
15904       typename enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type *  = 0);
15905   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload10 more...]]``
15906
15907
15908 [section:overload1 basic_raw_socket::basic_raw_socket (1 of 10 overloads)]
15909
15910
15911 Construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] without opening it. 
15912
15913
15914   basic_raw_socket(
15915       const executor_type & ex);
15916
15917
15918 This constructor creates a raw socket without opening it. The `open()` function must be called before data can be sent or received on the socket.
15919
15920
15921 [heading Parameters]
15922     
15923
15924 [variablelist
15925   
15926 [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket. ]]
15927
15928 ]
15929
15930
15931
15932
15933 [endsect]
15934
15935
15936
15937 [section:overload2 basic_raw_socket::basic_raw_socket (2 of 10 overloads)]
15938
15939
15940 Construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] without opening it. 
15941
15942
15943   template<
15944       typename ExecutionContext>
15945   basic_raw_socket(
15946       ExecutionContext & context,
15947       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
15948
15949
15950 This constructor creates a raw socket without opening it. The `open()` function must be called before data can be sent or received on the socket.
15951
15952
15953 [heading Parameters]
15954     
15955
15956 [variablelist
15957   
15958 [[context][An execution context which provides the I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket. ]]
15959
15960 ]
15961
15962
15963
15964
15965 [endsect]
15966
15967
15968
15969 [section:overload3 basic_raw_socket::basic_raw_socket (3 of 10 overloads)]
15970
15971
15972 Construct and open a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`]. 
15973
15974
15975   basic_raw_socket(
15976       const executor_type & ex,
15977       const protocol_type & protocol);
15978
15979
15980 This constructor creates and opens a raw socket.
15981
15982
15983 [heading Parameters]
15984     
15985
15986 [variablelist
15987   
15988 [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
15989
15990 [[protocol][An object specifying protocol parameters to be used.]]
15991
15992 ]
15993
15994
15995 [heading Exceptions]
15996     
15997
15998 [variablelist
15999   
16000 [[boost::system::system_error][Thrown on failure. ]]
16001
16002 ]
16003
16004
16005
16006
16007 [endsect]
16008
16009
16010
16011 [section:overload4 basic_raw_socket::basic_raw_socket (4 of 10 overloads)]
16012
16013
16014 Construct and open a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`]. 
16015
16016
16017   template<
16018       typename ExecutionContext>
16019   basic_raw_socket(
16020       ExecutionContext & context,
16021       const protocol_type & protocol,
16022       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
16023
16024
16025 This constructor creates and opens a raw socket.
16026
16027
16028 [heading Parameters]
16029     
16030
16031 [variablelist
16032   
16033 [[context][An execution context which provides the I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
16034
16035 [[protocol][An object specifying protocol parameters to be used.]]
16036
16037 ]
16038
16039
16040 [heading Exceptions]
16041     
16042
16043 [variablelist
16044   
16045 [[boost::system::system_error][Thrown on failure. ]]
16046
16047 ]
16048
16049
16050
16051
16052 [endsect]
16053
16054
16055
16056 [section:overload5 basic_raw_socket::basic_raw_socket (5 of 10 overloads)]
16057
16058
16059 Construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`], opening it and binding it to the given local endpoint. 
16060
16061
16062   basic_raw_socket(
16063       const executor_type & ex,
16064       const endpoint_type & endpoint);
16065
16066
16067 This constructor creates a raw 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.
16068
16069
16070 [heading Parameters]
16071     
16072
16073 [variablelist
16074   
16075 [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
16076
16077 [[endpoint][An endpoint on the local machine to which the raw socket will be bound.]]
16078
16079 ]
16080
16081
16082 [heading Exceptions]
16083     
16084
16085 [variablelist
16086   
16087 [[boost::system::system_error][Thrown on failure. ]]
16088
16089 ]
16090
16091
16092
16093
16094 [endsect]
16095
16096
16097
16098 [section:overload6 basic_raw_socket::basic_raw_socket (6 of 10 overloads)]
16099
16100
16101 Construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`], opening it and binding it to the given local endpoint. 
16102
16103
16104   template<
16105       typename ExecutionContext>
16106   basic_raw_socket(
16107       ExecutionContext & context,
16108       const endpoint_type & endpoint,
16109       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
16110
16111
16112 This constructor creates a raw 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.
16113
16114
16115 [heading Parameters]
16116     
16117
16118 [variablelist
16119   
16120 [[context][An execution context which provides the I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
16121
16122 [[endpoint][An endpoint on the local machine to which the raw socket will be bound.]]
16123
16124 ]
16125
16126
16127 [heading Exceptions]
16128     
16129
16130 [variablelist
16131   
16132 [[boost::system::system_error][Thrown on failure. ]]
16133
16134 ]
16135
16136
16137
16138
16139 [endsect]
16140
16141
16142
16143 [section:overload7 basic_raw_socket::basic_raw_socket (7 of 10 overloads)]
16144
16145
16146 Construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] on an existing native socket. 
16147
16148
16149   basic_raw_socket(
16150       const executor_type & ex,
16151       const protocol_type & protocol,
16152       const native_handle_type & native_socket);
16153
16154
16155 This constructor creates a raw socket object to hold an existing native socket.
16156
16157
16158 [heading Parameters]
16159     
16160
16161 [variablelist
16162   
16163 [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
16164
16165 [[protocol][An object specifying protocol parameters to be used.]]
16166
16167 [[native_socket][The new underlying socket implementation.]]
16168
16169 ]
16170
16171
16172 [heading Exceptions]
16173     
16174
16175 [variablelist
16176   
16177 [[boost::system::system_error][Thrown on failure. ]]
16178
16179 ]
16180
16181
16182
16183
16184 [endsect]
16185
16186
16187
16188 [section:overload8 basic_raw_socket::basic_raw_socket (8 of 10 overloads)]
16189
16190
16191 Construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] on an existing native socket. 
16192
16193
16194   template<
16195       typename ExecutionContext>
16196   basic_raw_socket(
16197       ExecutionContext & context,
16198       const protocol_type & protocol,
16199       const native_handle_type & native_socket,
16200       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
16201
16202
16203 This constructor creates a raw socket object to hold an existing native socket.
16204
16205
16206 [heading Parameters]
16207     
16208
16209 [variablelist
16210   
16211 [[context][An execution context which provides the I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
16212
16213 [[protocol][An object specifying protocol parameters to be used.]]
16214
16215 [[native_socket][The new underlying socket implementation.]]
16216
16217 ]
16218
16219
16220 [heading Exceptions]
16221     
16222
16223 [variablelist
16224   
16225 [[boost::system::system_error][Thrown on failure. ]]
16226
16227 ]
16228
16229
16230
16231
16232 [endsect]
16233
16234
16235
16236 [section:overload9 basic_raw_socket::basic_raw_socket (9 of 10 overloads)]
16237
16238
16239 Move-construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] from another. 
16240
16241
16242   basic_raw_socket(
16243       basic_raw_socket && other);
16244
16245
16246 This constructor moves a raw socket from one object to another.
16247
16248
16249 [heading Parameters]
16250     
16251
16252 [variablelist
16253   
16254 [[other][The other [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] object from which the move will occur.]]
16255
16256 ]
16257
16258
16259 [heading Remarks]
16260       
16261 Following the move, the moved-from object is in the same state as if constructed using the `basic_raw_socket(const executor_type&)` constructor. 
16262
16263
16264
16265
16266 [endsect]
16267
16268
16269
16270 [section:overload10 basic_raw_socket::basic_raw_socket (10 of 10 overloads)]
16271
16272
16273 Move-construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] from a socket of another protocol type. 
16274
16275
16276   template<
16277       typename ``[link boost_asio.reference.Protocol Protocol1]``,
16278       typename ``[link boost_asio.reference.Executor1 Executor1]``>
16279   basic_raw_socket(
16280       basic_raw_socket< Protocol1, Executor1 > && other,
16281       typename enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type *  = 0);
16282
16283
16284 This constructor moves a raw socket from one object to another.
16285
16286
16287 [heading Parameters]
16288     
16289
16290 [variablelist
16291   
16292 [[other][The other [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] object from which the move will occur.]]
16293
16294 ]
16295
16296
16297 [heading Remarks]
16298       
16299 Following the move, the moved-from object is in the same state as if constructed using the `basic_raw_socket(const executor_type&)` constructor. 
16300
16301
16302
16303
16304 [endsect]
16305
16306
16307 [endsect]
16308
16309 [section:bind basic_raw_socket::bind]
16310
16311 [indexterm2 boost_asio.indexterm.basic_raw_socket.bind..bind..basic_raw_socket] 
16312 Bind the socket to the given local endpoint. 
16313
16314
16315   void ``[link boost_asio.reference.basic_raw_socket.bind.overload1 bind]``(
16316       const endpoint_type & endpoint);
16317   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.bind.overload1 more...]]``
16318
16319   void ``[link boost_asio.reference.basic_raw_socket.bind.overload2 bind]``(
16320       const endpoint_type & endpoint,
16321       boost::system::error_code & ec);
16322   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.bind.overload2 more...]]``
16323
16324
16325 [section:overload1 basic_raw_socket::bind (1 of 2 overloads)]
16326
16327
16328 ['Inherited from basic_socket.]
16329
16330
16331 Bind the socket to the given local endpoint. 
16332
16333
16334   void bind(
16335       const endpoint_type & endpoint);
16336
16337
16338 This function binds the socket to the specified endpoint on the local machine.
16339
16340
16341 [heading Parameters]
16342     
16343
16344 [variablelist
16345   
16346 [[endpoint][An endpoint on the local machine to which the socket will be bound.]]
16347
16348 ]
16349
16350
16351 [heading Exceptions]
16352     
16353
16354 [variablelist
16355   
16356 [[boost::system::system_error][Thrown on failure.]]
16357
16358 ]
16359
16360
16361 [heading Example]
16362   
16363
16364
16365    boost::asio::ip::tcp::socket socket(my_context);
16366    socket.open(boost::asio::ip::tcp::v4());
16367    socket.bind(boost::asio::ip::tcp::endpoint(
16368          boost::asio::ip::tcp::v4(), 12345));
16369
16370
16371
16372
16373
16374
16375
16376 [endsect]
16377
16378
16379
16380 [section:overload2 basic_raw_socket::bind (2 of 2 overloads)]
16381
16382
16383 ['Inherited from basic_socket.]
16384
16385
16386 Bind the socket to the given local endpoint. 
16387
16388
16389   void bind(
16390       const endpoint_type & endpoint,
16391       boost::system::error_code & ec);
16392
16393
16394 This function binds the socket to the specified endpoint on the local machine.
16395
16396
16397 [heading Parameters]
16398     
16399
16400 [variablelist
16401   
16402 [[endpoint][An endpoint on the local machine to which the socket will be bound.]]
16403
16404 [[ec][Set to indicate what error occurred, if any.]]
16405
16406 ]
16407
16408
16409 [heading Example]
16410   
16411
16412
16413    boost::asio::ip::tcp::socket socket(my_context);
16414    socket.open(boost::asio::ip::tcp::v4());
16415    boost::system::error_code ec;
16416    socket.bind(boost::asio::ip::tcp::endpoint(
16417          boost::asio::ip::tcp::v4(), 12345), ec);
16418    if (ec)
16419    {
16420      // An error occurred.
16421    }
16422
16423
16424
16425
16426
16427
16428
16429 [endsect]
16430
16431
16432 [endsect]
16433
16434
16435 [section:broadcast basic_raw_socket::broadcast]
16436
16437
16438 ['Inherited from socket_base.]
16439
16440 [indexterm2 boost_asio.indexterm.basic_raw_socket.broadcast..broadcast..basic_raw_socket] 
16441 Socket option to permit sending of broadcast messages. 
16442
16443
16444   typedef implementation_defined broadcast;
16445
16446
16447
16448 Implements the SOL\_SOCKET/SO\_BROADCAST socket option.
16449
16450
16451 [heading Examples]
16452   
16453 Setting the option: 
16454
16455    boost::asio::ip::udp::socket socket(my_context);
16456    ...
16457    boost::asio::socket_base::broadcast option(true);
16458    socket.set_option(option);
16459
16460
16461
16462
16463
16464 Getting the current option value: 
16465
16466    boost::asio::ip::udp::socket socket(my_context);
16467    ...
16468    boost::asio::socket_base::broadcast option;
16469    socket.get_option(option);
16470    bool is_set = option.value();
16471
16472
16473
16474
16475
16476
16477
16478 [heading Requirements]
16479
16480 ['Header: ][^boost/asio/basic_raw_socket.hpp]
16481
16482 ['Convenience header: ][^boost/asio.hpp]
16483
16484
16485 [endsect]
16486
16487
16488
16489 [section:bytes_readable basic_raw_socket::bytes_readable]
16490
16491
16492 ['Inherited from socket_base.]
16493
16494 [indexterm2 boost_asio.indexterm.basic_raw_socket.bytes_readable..bytes_readable..basic_raw_socket] 
16495 IO control command to get the amount of data that can be read without blocking. 
16496
16497
16498   typedef implementation_defined bytes_readable;
16499
16500
16501
16502 Implements the FIONREAD IO control command.
16503
16504
16505 [heading Example]
16506   
16507
16508
16509    boost::asio::ip::tcp::socket socket(my_context);
16510    ...
16511    boost::asio::socket_base::bytes_readable command(true);
16512    socket.io_control(command);
16513    std::size_t bytes_readable = command.get();
16514
16515
16516
16517
16518
16519
16520
16521 [heading Requirements]
16522
16523 ['Header: ][^boost/asio/basic_raw_socket.hpp]
16524
16525 ['Convenience header: ][^boost/asio.hpp]
16526
16527
16528 [endsect]
16529
16530
16531 [section:cancel basic_raw_socket::cancel]
16532
16533 [indexterm2 boost_asio.indexterm.basic_raw_socket.cancel..cancel..basic_raw_socket] 
16534 Cancel all asynchronous operations associated with the socket. 
16535
16536
16537   void ``[link boost_asio.reference.basic_raw_socket.cancel.overload1 cancel]``();
16538   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.cancel.overload1 more...]]``
16539
16540   void ``[link boost_asio.reference.basic_raw_socket.cancel.overload2 cancel]``(
16541       boost::system::error_code & ec);
16542   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.cancel.overload2 more...]]``
16543
16544
16545 [section:overload1 basic_raw_socket::cancel (1 of 2 overloads)]
16546
16547
16548 ['Inherited from basic_socket.]
16549
16550
16551 Cancel all asynchronous operations associated with the socket. 
16552
16553
16554   void cancel();
16555
16556
16557 This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
16558
16559
16560 [heading Exceptions]
16561     
16562
16563 [variablelist
16564   
16565 [[boost::system::system_error][Thrown on failure.]]
16566
16567 ]
16568
16569
16570 [heading Remarks]
16571       
16572 Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use:
16573
16574
16575 * It will only cancel asynchronous operations that were initiated in the current thread.
16576
16577
16578 * It can appear to complete without error, but the request to cancel the unfinished operations may be silently ignored by the operating system. Whether it works or not seems to depend on the drivers that are installed.
16579
16580 For portable cancellation, consider using one of the following alternatives:
16581
16582
16583 * Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP.
16584
16585
16586 * Use the `close()` function to simultaneously cancel the outstanding operations and close the socket.
16587
16588 When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above. 
16589
16590
16591 [endsect]
16592
16593
16594
16595 [section:overload2 basic_raw_socket::cancel (2 of 2 overloads)]
16596
16597
16598 ['Inherited from basic_socket.]
16599
16600
16601 Cancel all asynchronous operations associated with the socket. 
16602
16603
16604   void cancel(
16605       boost::system::error_code & ec);
16606
16607
16608 This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
16609
16610
16611 [heading Parameters]
16612     
16613
16614 [variablelist
16615   
16616 [[ec][Set to indicate what error occurred, if any.]]
16617
16618 ]
16619
16620
16621 [heading Remarks]
16622       
16623 Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use:
16624
16625
16626 * It will only cancel asynchronous operations that were initiated in the current thread.
16627
16628
16629 * It can appear to complete without error, but the request to cancel the unfinished operations may be silently ignored by the operating system. Whether it works or not seems to depend on the drivers that are installed.
16630
16631 For portable cancellation, consider using one of the following alternatives:
16632
16633
16634 * Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP.
16635
16636
16637 * Use the `close()` function to simultaneously cancel the outstanding operations and close the socket.
16638
16639 When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above. 
16640
16641
16642 [endsect]
16643
16644
16645 [endsect]
16646
16647 [section:close basic_raw_socket::close]
16648
16649 [indexterm2 boost_asio.indexterm.basic_raw_socket.close..close..basic_raw_socket] 
16650 Close the socket. 
16651
16652
16653   void ``[link boost_asio.reference.basic_raw_socket.close.overload1 close]``();
16654   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.close.overload1 more...]]``
16655
16656   void ``[link boost_asio.reference.basic_raw_socket.close.overload2 close]``(
16657       boost::system::error_code & ec);
16658   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.close.overload2 more...]]``
16659
16660
16661 [section:overload1 basic_raw_socket::close (1 of 2 overloads)]
16662
16663
16664 ['Inherited from basic_socket.]
16665
16666
16667 Close the socket. 
16668
16669
16670   void close();
16671
16672
16673 This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
16674
16675
16676 [heading Exceptions]
16677     
16678
16679 [variablelist
16680   
16681 [[boost::system::system_error][Thrown on failure. Note that, even if the function indicates an error, the underlying descriptor is closed.]]
16682
16683 ]
16684
16685
16686 [heading Remarks]
16687       
16688 For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket. 
16689
16690
16691
16692
16693 [endsect]
16694
16695
16696
16697 [section:overload2 basic_raw_socket::close (2 of 2 overloads)]
16698
16699
16700 ['Inherited from basic_socket.]
16701
16702
16703 Close the socket. 
16704
16705
16706   void close(
16707       boost::system::error_code & ec);
16708
16709
16710 This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
16711
16712
16713 [heading Parameters]
16714     
16715
16716 [variablelist
16717   
16718 [[ec][Set to indicate what error occurred, if any. Note that, even if the function indicates an error, the underlying descriptor is closed.]]
16719
16720 ]
16721
16722
16723 [heading Example]
16724   
16725
16726
16727    boost::asio::ip::tcp::socket socket(my_context);
16728    ...
16729    boost::system::error_code ec;
16730    socket.close(ec);
16731    if (ec)
16732    {
16733      // An error occurred.
16734    }
16735
16736
16737
16738
16739
16740 [heading Remarks]
16741       
16742 For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket. 
16743
16744
16745
16746
16747 [endsect]
16748
16749
16750 [endsect]
16751
16752 [section:connect basic_raw_socket::connect]
16753
16754 [indexterm2 boost_asio.indexterm.basic_raw_socket.connect..connect..basic_raw_socket] 
16755 Connect the socket to the specified endpoint. 
16756
16757
16758   void ``[link boost_asio.reference.basic_raw_socket.connect.overload1 connect]``(
16759       const endpoint_type & peer_endpoint);
16760   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.connect.overload1 more...]]``
16761
16762   void ``[link boost_asio.reference.basic_raw_socket.connect.overload2 connect]``(
16763       const endpoint_type & peer_endpoint,
16764       boost::system::error_code & ec);
16765   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.connect.overload2 more...]]``
16766
16767
16768 [section:overload1 basic_raw_socket::connect (1 of 2 overloads)]
16769
16770
16771 ['Inherited from basic_socket.]
16772
16773
16774 Connect the socket to the specified endpoint. 
16775
16776
16777   void connect(
16778       const endpoint_type & peer_endpoint);
16779
16780
16781 This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs.
16782
16783 The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
16784
16785
16786 [heading Parameters]
16787     
16788
16789 [variablelist
16790   
16791 [[peer_endpoint][The remote endpoint to which the socket will be connected.]]
16792
16793 ]
16794
16795
16796 [heading Exceptions]
16797     
16798
16799 [variablelist
16800   
16801 [[boost::system::system_error][Thrown on failure.]]
16802
16803 ]
16804
16805
16806 [heading Example]
16807   
16808
16809
16810    boost::asio::ip::tcp::socket socket(my_context);
16811    boost::asio::ip::tcp::endpoint endpoint(
16812        boost::asio::ip::address::from_string("1.2.3.4"), 12345);
16813    socket.connect(endpoint);
16814
16815
16816
16817
16818
16819
16820
16821 [endsect]
16822
16823
16824
16825 [section:overload2 basic_raw_socket::connect (2 of 2 overloads)]
16826
16827
16828 ['Inherited from basic_socket.]
16829
16830
16831 Connect the socket to the specified endpoint. 
16832
16833
16834   void connect(
16835       const endpoint_type & peer_endpoint,
16836       boost::system::error_code & ec);
16837
16838
16839 This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs.
16840
16841 The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
16842
16843
16844 [heading Parameters]
16845     
16846
16847 [variablelist
16848   
16849 [[peer_endpoint][The remote endpoint to which the socket will be connected.]]
16850
16851 [[ec][Set to indicate what error occurred, if any.]]
16852
16853 ]
16854
16855
16856 [heading Example]
16857   
16858
16859
16860    boost::asio::ip::tcp::socket socket(my_context);
16861    boost::asio::ip::tcp::endpoint endpoint(
16862        boost::asio::ip::address::from_string("1.2.3.4"), 12345);
16863    boost::system::error_code ec;
16864    socket.connect(endpoint, ec);
16865    if (ec)
16866    {
16867      // An error occurred.
16868    }
16869
16870
16871
16872
16873
16874
16875
16876 [endsect]
16877
16878
16879 [endsect]
16880
16881
16882 [section:debug basic_raw_socket::debug]
16883
16884
16885 ['Inherited from socket_base.]
16886
16887 [indexterm2 boost_asio.indexterm.basic_raw_socket.debug..debug..basic_raw_socket] 
16888 Socket option to enable socket-level debugging. 
16889
16890
16891   typedef implementation_defined debug;
16892
16893
16894
16895 Implements the SOL\_SOCKET/SO\_DEBUG socket option.
16896
16897
16898 [heading Examples]
16899   
16900 Setting the option: 
16901
16902    boost::asio::ip::tcp::socket socket(my_context);
16903    ...
16904    boost::asio::socket_base::debug option(true);
16905    socket.set_option(option);
16906
16907
16908
16909
16910
16911 Getting the current option value: 
16912
16913    boost::asio::ip::tcp::socket socket(my_context);
16914    ...
16915    boost::asio::socket_base::debug option;
16916    socket.get_option(option);
16917    bool is_set = option.value();
16918
16919
16920
16921
16922
16923
16924
16925 [heading Requirements]
16926
16927 ['Header: ][^boost/asio/basic_raw_socket.hpp]
16928
16929 ['Convenience header: ][^boost/asio.hpp]
16930
16931
16932 [endsect]
16933
16934
16935
16936 [section:do_not_route basic_raw_socket::do_not_route]
16937
16938
16939 ['Inherited from socket_base.]
16940
16941 [indexterm2 boost_asio.indexterm.basic_raw_socket.do_not_route..do_not_route..basic_raw_socket] 
16942 Socket option to prevent routing, use local interfaces only. 
16943
16944
16945   typedef implementation_defined do_not_route;
16946
16947
16948
16949 Implements the SOL\_SOCKET/SO\_DONTROUTE socket option.
16950
16951
16952 [heading Examples]
16953   
16954 Setting the option: 
16955
16956    boost::asio::ip::udp::socket socket(my_context);
16957    ...
16958    boost::asio::socket_base::do_not_route option(true);
16959    socket.set_option(option);
16960
16961
16962
16963
16964
16965 Getting the current option value: 
16966
16967    boost::asio::ip::udp::socket socket(my_context);
16968    ...
16969    boost::asio::socket_base::do_not_route option;
16970    socket.get_option(option);
16971    bool is_set = option.value();
16972
16973
16974
16975
16976
16977
16978
16979 [heading Requirements]
16980
16981 ['Header: ][^boost/asio/basic_raw_socket.hpp]
16982
16983 ['Convenience header: ][^boost/asio.hpp]
16984
16985
16986 [endsect]
16987
16988
16989
16990 [section:enable_connection_aborted basic_raw_socket::enable_connection_aborted]
16991
16992
16993 ['Inherited from socket_base.]
16994
16995 [indexterm2 boost_asio.indexterm.basic_raw_socket.enable_connection_aborted..enable_connection_aborted..basic_raw_socket] 
16996 Socket option to report aborted connections on accept. 
16997
16998
16999   typedef implementation_defined enable_connection_aborted;
17000
17001
17002
17003 Implements a custom socket option that determines whether or not an accept operation is permitted to fail with `boost::asio::error::connection_aborted`. By default the option is false.
17004
17005
17006 [heading Examples]
17007   
17008 Setting the option: 
17009
17010    boost::asio::ip::tcp::acceptor acceptor(my_context);
17011    ...
17012    boost::asio::socket_base::enable_connection_aborted option(true);
17013    acceptor.set_option(option);
17014
17015
17016
17017
17018
17019 Getting the current option value: 
17020
17021    boost::asio::ip::tcp::acceptor acceptor(my_context);
17022    ...
17023    boost::asio::socket_base::enable_connection_aborted option;
17024    acceptor.get_option(option);
17025    bool is_set = option.value();
17026
17027
17028
17029
17030
17031
17032
17033 [heading Requirements]
17034
17035 ['Header: ][^boost/asio/basic_raw_socket.hpp]
17036
17037 ['Convenience header: ][^boost/asio.hpp]
17038
17039
17040 [endsect]
17041
17042
17043
17044 [section:endpoint_type basic_raw_socket::endpoint_type]
17045
17046 [indexterm2 boost_asio.indexterm.basic_raw_socket.endpoint_type..endpoint_type..basic_raw_socket] 
17047 The endpoint type. 
17048
17049
17050   typedef Protocol::endpoint endpoint_type;
17051
17052
17053
17054 [heading Requirements]
17055
17056 ['Header: ][^boost/asio/basic_raw_socket.hpp]
17057
17058 ['Convenience header: ][^boost/asio.hpp]
17059
17060
17061 [endsect]
17062
17063
17064
17065 [section:executor_type basic_raw_socket::executor_type]
17066
17067 [indexterm2 boost_asio.indexterm.basic_raw_socket.executor_type..executor_type..basic_raw_socket] 
17068 The type of the executor associated with the object. 
17069
17070
17071   typedef Executor executor_type;
17072
17073
17074
17075 [heading Requirements]
17076
17077 ['Header: ][^boost/asio/basic_raw_socket.hpp]
17078
17079 ['Convenience header: ][^boost/asio.hpp]
17080
17081
17082 [endsect]
17083
17084
17085
17086 [section:get_executor basic_raw_socket::get_executor]
17087
17088
17089 ['Inherited from basic_socket.]
17090
17091 [indexterm2 boost_asio.indexterm.basic_raw_socket.get_executor..get_executor..basic_raw_socket] 
17092 Get the executor associated with the object. 
17093
17094
17095   executor_type get_executor();
17096
17097
17098
17099 [endsect]
17100
17101
17102 [section:get_option basic_raw_socket::get_option]
17103
17104 [indexterm2 boost_asio.indexterm.basic_raw_socket.get_option..get_option..basic_raw_socket] 
17105 Get an option from the socket. 
17106
17107
17108   template<
17109       typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
17110   void ``[link boost_asio.reference.basic_raw_socket.get_option.overload1 get_option]``(
17111       GettableSocketOption & option) const;
17112   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.get_option.overload1 more...]]``
17113
17114   template<
17115       typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
17116   void ``[link boost_asio.reference.basic_raw_socket.get_option.overload2 get_option]``(
17117       GettableSocketOption & option,
17118       boost::system::error_code & ec) const;
17119   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.get_option.overload2 more...]]``
17120
17121
17122 [section:overload1 basic_raw_socket::get_option (1 of 2 overloads)]
17123
17124
17125 ['Inherited from basic_socket.]
17126
17127
17128 Get an option from the socket. 
17129
17130
17131   template<
17132       typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
17133   void get_option(
17134       GettableSocketOption & option) const;
17135
17136
17137 This function is used to get the current value of an option on the socket.
17138
17139
17140 [heading Parameters]
17141     
17142
17143 [variablelist
17144   
17145 [[option][The option value to be obtained from the socket.]]
17146
17147 ]
17148
17149
17150 [heading Exceptions]
17151     
17152
17153 [variablelist
17154   
17155 [[boost::system::system_error][Thrown on failure.]]
17156
17157 ]
17158
17159
17160
17161 [heading Example]
17162   
17163 Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option: 
17164
17165    boost::asio::ip::tcp::socket socket(my_context);
17166    ...
17167    boost::asio::ip::tcp::socket::keep_alive option;
17168    socket.get_option(option);
17169    bool is_set = option.value();
17170
17171
17172
17173
17174
17175
17176
17177 [endsect]
17178
17179
17180
17181 [section:overload2 basic_raw_socket::get_option (2 of 2 overloads)]
17182
17183
17184 ['Inherited from basic_socket.]
17185
17186
17187 Get an option from the socket. 
17188
17189
17190   template<
17191       typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
17192   void get_option(
17193       GettableSocketOption & option,
17194       boost::system::error_code & ec) const;
17195
17196
17197 This function is used to get the current value of an option on the socket.
17198
17199
17200 [heading Parameters]
17201     
17202
17203 [variablelist
17204   
17205 [[option][The option value to be obtained from the socket.]]
17206
17207 [[ec][Set to indicate what error occurred, if any.]]
17208
17209 ]
17210
17211
17212
17213 [heading Example]
17214   
17215 Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option: 
17216
17217    boost::asio::ip::tcp::socket socket(my_context);
17218    ...
17219    boost::asio::ip::tcp::socket::keep_alive option;
17220    boost::system::error_code ec;
17221    socket.get_option(option, ec);
17222    if (ec)
17223    {
17224      // An error occurred.
17225    }
17226    bool is_set = option.value();
17227
17228
17229
17230
17231
17232
17233
17234 [endsect]
17235
17236
17237 [endsect]
17238
17239
17240 [section:impl_ basic_raw_socket::impl_]
17241
17242
17243 ['Inherited from basic_socket.]
17244
17245 [indexterm2 boost_asio.indexterm.basic_raw_socket.impl_..impl_..basic_raw_socket] 
17246
17247   detail::io_object_impl< detail::reactive_socket_service< Protocol >, Executor > impl_;
17248
17249
17250
17251 [endsect]
17252
17253
17254 [section:io_control basic_raw_socket::io_control]
17255
17256 [indexterm2 boost_asio.indexterm.basic_raw_socket.io_control..io_control..basic_raw_socket] 
17257 Perform an IO control command on the socket. 
17258
17259
17260   template<
17261       typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
17262   void ``[link boost_asio.reference.basic_raw_socket.io_control.overload1 io_control]``(
17263       IoControlCommand & command);
17264   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.io_control.overload1 more...]]``
17265
17266   template<
17267       typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
17268   void ``[link boost_asio.reference.basic_raw_socket.io_control.overload2 io_control]``(
17269       IoControlCommand & command,
17270       boost::system::error_code & ec);
17271   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.io_control.overload2 more...]]``
17272
17273
17274 [section:overload1 basic_raw_socket::io_control (1 of 2 overloads)]
17275
17276
17277 ['Inherited from basic_socket.]
17278
17279
17280 Perform an IO control command on the socket. 
17281
17282
17283   template<
17284       typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
17285   void io_control(
17286       IoControlCommand & command);
17287
17288
17289 This function is used to execute an IO control command on the socket.
17290
17291
17292 [heading Parameters]
17293     
17294
17295 [variablelist
17296   
17297 [[command][The IO control command to be performed on the socket.]]
17298
17299 ]
17300
17301
17302 [heading Exceptions]
17303     
17304
17305 [variablelist
17306   
17307 [[boost::system::system_error][Thrown on failure.]]
17308
17309 ]
17310
17311
17312
17313 [heading Example]
17314   
17315 Getting the number of bytes ready to read: 
17316
17317    boost::asio::ip::tcp::socket socket(my_context);
17318    ...
17319    boost::asio::ip::tcp::socket::bytes_readable command;
17320    socket.io_control(command);
17321    std::size_t bytes_readable = command.get();
17322
17323
17324
17325
17326
17327
17328
17329 [endsect]
17330
17331
17332
17333 [section:overload2 basic_raw_socket::io_control (2 of 2 overloads)]
17334
17335
17336 ['Inherited from basic_socket.]
17337
17338
17339 Perform an IO control command on the socket. 
17340
17341
17342   template<
17343       typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
17344   void io_control(
17345       IoControlCommand & command,
17346       boost::system::error_code & ec);
17347
17348
17349 This function is used to execute an IO control command on the socket.
17350
17351
17352 [heading Parameters]
17353     
17354
17355 [variablelist
17356   
17357 [[command][The IO control command to be performed on the socket.]]
17358
17359 [[ec][Set to indicate what error occurred, if any.]]
17360
17361 ]
17362
17363
17364
17365 [heading Example]
17366   
17367 Getting the number of bytes ready to read: 
17368
17369    boost::asio::ip::tcp::socket socket(my_context);
17370    ...
17371    boost::asio::ip::tcp::socket::bytes_readable command;
17372    boost::system::error_code ec;
17373    socket.io_control(command, ec);
17374    if (ec)
17375    {
17376      // An error occurred.
17377    }
17378    std::size_t bytes_readable = command.get();
17379
17380
17381
17382
17383
17384
17385
17386 [endsect]
17387
17388
17389 [endsect]
17390
17391
17392 [section:is_open basic_raw_socket::is_open]
17393
17394
17395 ['Inherited from basic_socket.]
17396
17397 [indexterm2 boost_asio.indexterm.basic_raw_socket.is_open..is_open..basic_raw_socket] 
17398 Determine whether the socket is open. 
17399
17400
17401   bool is_open() const;
17402
17403
17404
17405 [endsect]
17406
17407
17408
17409 [section:keep_alive basic_raw_socket::keep_alive]
17410
17411
17412 ['Inherited from socket_base.]
17413
17414 [indexterm2 boost_asio.indexterm.basic_raw_socket.keep_alive..keep_alive..basic_raw_socket] 
17415 Socket option to send keep-alives. 
17416
17417
17418   typedef implementation_defined keep_alive;
17419
17420
17421
17422 Implements the SOL\_SOCKET/SO\_KEEPALIVE socket option.
17423
17424
17425 [heading Examples]
17426   
17427 Setting the option: 
17428
17429    boost::asio::ip::tcp::socket socket(my_context);
17430    ...
17431    boost::asio::socket_base::keep_alive option(true);
17432    socket.set_option(option);
17433
17434
17435
17436
17437
17438 Getting the current option value: 
17439
17440    boost::asio::ip::tcp::socket socket(my_context);
17441    ...
17442    boost::asio::socket_base::keep_alive option;
17443    socket.get_option(option);
17444    bool is_set = option.value();
17445
17446
17447
17448
17449
17450
17451
17452 [heading Requirements]
17453
17454 ['Header: ][^boost/asio/basic_raw_socket.hpp]
17455
17456 ['Convenience header: ][^boost/asio.hpp]
17457
17458
17459 [endsect]
17460
17461
17462
17463 [section:linger basic_raw_socket::linger]
17464
17465
17466 ['Inherited from socket_base.]
17467
17468 [indexterm2 boost_asio.indexterm.basic_raw_socket.linger..linger..basic_raw_socket] 
17469 Socket option to specify whether the socket lingers on close if unsent data is present. 
17470
17471
17472   typedef implementation_defined linger;
17473
17474
17475
17476 Implements the SOL\_SOCKET/SO\_LINGER socket option.
17477
17478
17479 [heading Examples]
17480   
17481 Setting the option: 
17482
17483    boost::asio::ip::tcp::socket socket(my_context);
17484    ...
17485    boost::asio::socket_base::linger option(true, 30);
17486    socket.set_option(option);
17487
17488
17489
17490
17491
17492 Getting the current option value: 
17493
17494    boost::asio::ip::tcp::socket socket(my_context);
17495    ...
17496    boost::asio::socket_base::linger option;
17497    socket.get_option(option);
17498    bool is_set = option.enabled();
17499    unsigned short timeout = option.timeout();
17500
17501
17502
17503
17504
17505
17506
17507 [heading Requirements]
17508
17509 ['Header: ][^boost/asio/basic_raw_socket.hpp]
17510
17511 ['Convenience header: ][^boost/asio.hpp]
17512
17513
17514 [endsect]
17515
17516
17517 [section:local_endpoint basic_raw_socket::local_endpoint]
17518
17519 [indexterm2 boost_asio.indexterm.basic_raw_socket.local_endpoint..local_endpoint..basic_raw_socket] 
17520 Get the local endpoint of the socket. 
17521
17522
17523   endpoint_type ``[link boost_asio.reference.basic_raw_socket.local_endpoint.overload1 local_endpoint]``() const;
17524   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.local_endpoint.overload1 more...]]``
17525
17526   endpoint_type ``[link boost_asio.reference.basic_raw_socket.local_endpoint.overload2 local_endpoint]``(
17527       boost::system::error_code & ec) const;
17528   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.local_endpoint.overload2 more...]]``
17529
17530
17531 [section:overload1 basic_raw_socket::local_endpoint (1 of 2 overloads)]
17532
17533
17534 ['Inherited from basic_socket.]
17535
17536
17537 Get the local endpoint of the socket. 
17538
17539
17540   endpoint_type local_endpoint() const;
17541
17542
17543 This function is used to obtain the locally bound endpoint of the socket.
17544
17545
17546 [heading Return Value]
17547       
17548 An object that represents the local endpoint of the socket.
17549
17550
17551 [heading Exceptions]
17552     
17553
17554 [variablelist
17555   
17556 [[boost::system::system_error][Thrown on failure.]]
17557
17558 ]
17559
17560
17561 [heading Example]
17562   
17563
17564
17565    boost::asio::ip::tcp::socket socket(my_context);
17566    ...
17567    boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint();
17568
17569
17570
17571
17572
17573
17574
17575 [endsect]
17576
17577
17578
17579 [section:overload2 basic_raw_socket::local_endpoint (2 of 2 overloads)]
17580
17581
17582 ['Inherited from basic_socket.]
17583
17584
17585 Get the local endpoint of the socket. 
17586
17587
17588   endpoint_type local_endpoint(
17589       boost::system::error_code & ec) const;
17590
17591
17592 This function is used to obtain the locally bound endpoint of the socket.
17593
17594
17595 [heading Parameters]
17596     
17597
17598 [variablelist
17599   
17600 [[ec][Set to indicate what error occurred, if any.]]
17601
17602 ]
17603
17604
17605 [heading Return Value]
17606       
17607 An object that represents the local endpoint of the socket. Returns a default-constructed endpoint object if an error occurred.
17608
17609
17610 [heading Example]
17611   
17612
17613
17614    boost::asio::ip::tcp::socket socket(my_context);
17615    ...
17616    boost::system::error_code ec;
17617    boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint(ec);
17618    if (ec)
17619    {
17620      // An error occurred.
17621    }
17622
17623
17624
17625
17626
17627
17628
17629 [endsect]
17630
17631
17632 [endsect]
17633
17634 [section:lowest_layer basic_raw_socket::lowest_layer]
17635
17636 [indexterm2 boost_asio.indexterm.basic_raw_socket.lowest_layer..lowest_layer..basic_raw_socket] 
17637 Get a reference to the lowest layer. 
17638
17639
17640   lowest_layer_type & ``[link boost_asio.reference.basic_raw_socket.lowest_layer.overload1 lowest_layer]``();
17641   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.lowest_layer.overload1 more...]]``
17642
17643
17644 Get a const reference to the lowest layer. 
17645
17646
17647   const lowest_layer_type & ``[link boost_asio.reference.basic_raw_socket.lowest_layer.overload2 lowest_layer]``() const;
17648   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.lowest_layer.overload2 more...]]``
17649
17650
17651 [section:overload1 basic_raw_socket::lowest_layer (1 of 2 overloads)]
17652
17653
17654 ['Inherited from basic_socket.]
17655
17656
17657 Get a reference to the lowest layer. 
17658
17659
17660   lowest_layer_type & lowest_layer();
17661
17662
17663 This function returns a reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself.
17664
17665
17666 [heading Return Value]
17667       
17668 A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 
17669
17670
17671
17672
17673 [endsect]
17674
17675
17676
17677 [section:overload2 basic_raw_socket::lowest_layer (2 of 2 overloads)]
17678
17679
17680 ['Inherited from basic_socket.]
17681
17682
17683 Get a const reference to the lowest layer. 
17684
17685
17686   const lowest_layer_type & lowest_layer() const;
17687
17688
17689 This function returns a const reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself.
17690
17691
17692 [heading Return Value]
17693       
17694 A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 
17695
17696
17697
17698
17699 [endsect]
17700
17701
17702 [endsect]
17703
17704
17705 [section:lowest_layer_type basic_raw_socket::lowest_layer_type]
17706
17707
17708 ['Inherited from basic_socket.]
17709
17710 [indexterm2 boost_asio.indexterm.basic_raw_socket.lowest_layer_type..lowest_layer_type..basic_raw_socket] 
17711 A [link boost_asio.reference.basic_socket `basic_socket`] is always the lowest layer. 
17712
17713
17714   typedef basic_socket< Protocol, Executor > lowest_layer_type;
17715
17716
17717 [heading Types]
17718 [table
17719   [[Name][Description]]
17720
17721   [
17722
17723     [[link boost_asio.reference.basic_socket__rebind_executor [*rebind_executor]]]
17724     [Rebinds the socket type to another executor. ]
17725   
17726   ]
17727
17728   [
17729
17730     [[link boost_asio.reference.basic_socket.broadcast [*broadcast]]]
17731     [Socket option to permit sending of broadcast messages. ]
17732   
17733   ]
17734
17735   [
17736
17737     [[link boost_asio.reference.basic_socket.bytes_readable [*bytes_readable]]]
17738     [IO control command to get the amount of data that can be read without blocking. ]
17739   
17740   ]
17741
17742   [
17743
17744     [[link boost_asio.reference.basic_socket.debug [*debug]]]
17745     [Socket option to enable socket-level debugging. ]
17746   
17747   ]
17748
17749   [
17750
17751     [[link boost_asio.reference.basic_socket.do_not_route [*do_not_route]]]
17752     [Socket option to prevent routing, use local interfaces only. ]
17753   
17754   ]
17755
17756   [
17757
17758     [[link boost_asio.reference.basic_socket.enable_connection_aborted [*enable_connection_aborted]]]
17759     [Socket option to report aborted connections on accept. ]
17760   
17761   ]
17762
17763   [
17764
17765     [[link boost_asio.reference.basic_socket.endpoint_type [*endpoint_type]]]
17766     [The endpoint type. ]
17767   
17768   ]
17769
17770   [
17771
17772     [[link boost_asio.reference.basic_socket.executor_type [*executor_type]]]
17773     [The type of the executor associated with the object. ]
17774   
17775   ]
17776
17777   [
17778
17779     [[link boost_asio.reference.basic_socket.keep_alive [*keep_alive]]]
17780     [Socket option to send keep-alives. ]
17781   
17782   ]
17783
17784   [
17785
17786     [[link boost_asio.reference.basic_socket.linger [*linger]]]
17787     [Socket option to specify whether the socket lingers on close if unsent data is present. ]
17788   
17789   ]
17790
17791   [
17792
17793     [[link boost_asio.reference.basic_socket.lowest_layer_type [*lowest_layer_type]]]
17794     [A basic_socket is always the lowest layer. ]
17795   
17796   ]
17797
17798   [
17799
17800     [[link boost_asio.reference.basic_socket.message_flags [*message_flags]]]
17801     [Bitmask type for flags that can be passed to send and receive operations. ]
17802   
17803   ]
17804
17805   [
17806
17807     [[link boost_asio.reference.basic_socket.native_handle_type [*native_handle_type]]]
17808     [The native representation of a socket. ]
17809   
17810   ]
17811
17812   [
17813
17814     [[link boost_asio.reference.basic_socket.out_of_band_inline [*out_of_band_inline]]]
17815     [Socket option for putting received out-of-band data inline. ]
17816   
17817   ]
17818
17819   [
17820
17821     [[link boost_asio.reference.basic_socket.protocol_type [*protocol_type]]]
17822     [The protocol type. ]
17823   
17824   ]
17825
17826   [
17827
17828     [[link boost_asio.reference.basic_socket.receive_buffer_size [*receive_buffer_size]]]
17829     [Socket option for the receive buffer size of a socket. ]
17830   
17831   ]
17832
17833   [
17834
17835     [[link boost_asio.reference.basic_socket.receive_low_watermark [*receive_low_watermark]]]
17836     [Socket option for the receive low watermark. ]
17837   
17838   ]
17839
17840   [
17841
17842     [[link boost_asio.reference.basic_socket.reuse_address [*reuse_address]]]
17843     [Socket option to allow the socket to be bound to an address that is already in use. ]
17844   
17845   ]
17846
17847   [
17848
17849     [[link boost_asio.reference.basic_socket.send_buffer_size [*send_buffer_size]]]
17850     [Socket option for the send buffer size of a socket. ]
17851   
17852   ]
17853
17854   [
17855
17856     [[link boost_asio.reference.basic_socket.send_low_watermark [*send_low_watermark]]]
17857     [Socket option for the send low watermark. ]
17858   
17859   ]
17860
17861   [
17862
17863     [[link boost_asio.reference.basic_socket.shutdown_type [*shutdown_type]]]
17864     [Different ways a socket may be shutdown. ]
17865   
17866   ]
17867
17868   [
17869
17870     [[link boost_asio.reference.basic_socket.wait_type [*wait_type]]]
17871     [Wait types. ]
17872   
17873   ]
17874
17875 ]
17876
17877 [heading Member Functions]
17878 [table
17879   [[Name][Description]]
17880
17881   [
17882     [[link boost_asio.reference.basic_socket.assign [*assign]]]
17883     [Assign an existing native socket to the socket. ]
17884   ]
17885   
17886   [
17887     [[link boost_asio.reference.basic_socket.async_connect [*async_connect]]]
17888     [Start an asynchronous connect. ]
17889   ]
17890   
17891   [
17892     [[link boost_asio.reference.basic_socket.async_wait [*async_wait]]]
17893     [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
17894   ]
17895   
17896   [
17897     [[link boost_asio.reference.basic_socket.at_mark [*at_mark]]]
17898     [Determine whether the socket is at the out-of-band data mark. ]
17899   ]
17900   
17901   [
17902     [[link boost_asio.reference.basic_socket.available [*available]]]
17903     [Determine the number of bytes available for reading. ]
17904   ]
17905   
17906   [
17907     [[link boost_asio.reference.basic_socket.basic_socket [*basic_socket]]]
17908     [Construct a basic_socket without opening it. 
17909      [hr]
17910      Construct and open a basic_socket. 
17911      [hr]
17912      Construct a basic_socket, opening it and binding it to the given local endpoint. 
17913      [hr]
17914      Construct a basic_socket on an existing native socket. 
17915      [hr]
17916      Move-construct a basic_socket from another. 
17917      [hr]
17918      Move-construct a basic_socket from a socket of another protocol type. ]
17919   ]
17920   
17921   [
17922     [[link boost_asio.reference.basic_socket.bind [*bind]]]
17923     [Bind the socket to the given local endpoint. ]
17924   ]
17925   
17926   [
17927     [[link boost_asio.reference.basic_socket.cancel [*cancel]]]
17928     [Cancel all asynchronous operations associated with the socket. ]
17929   ]
17930   
17931   [
17932     [[link boost_asio.reference.basic_socket.close [*close]]]
17933     [Close the socket. ]
17934   ]
17935   
17936   [
17937     [[link boost_asio.reference.basic_socket.connect [*connect]]]
17938     [Connect the socket to the specified endpoint. ]
17939   ]
17940   
17941   [
17942     [[link boost_asio.reference.basic_socket.get_executor [*get_executor]]]
17943     [Get the executor associated with the object. ]
17944   ]
17945   
17946   [
17947     [[link boost_asio.reference.basic_socket.get_option [*get_option]]]
17948     [Get an option from the socket. ]
17949   ]
17950   
17951   [
17952     [[link boost_asio.reference.basic_socket.io_control [*io_control]]]
17953     [Perform an IO control command on the socket. ]
17954   ]
17955   
17956   [
17957     [[link boost_asio.reference.basic_socket.is_open [*is_open]]]
17958     [Determine whether the socket is open. ]
17959   ]
17960   
17961   [
17962     [[link boost_asio.reference.basic_socket.local_endpoint [*local_endpoint]]]
17963     [Get the local endpoint of the socket. ]
17964   ]
17965   
17966   [
17967     [[link boost_asio.reference.basic_socket.lowest_layer [*lowest_layer]]]
17968     [Get a reference to the lowest layer. 
17969      [hr]
17970      Get a const reference to the lowest layer. ]
17971   ]
17972   
17973   [
17974     [[link boost_asio.reference.basic_socket.native_handle [*native_handle]]]
17975     [Get the native socket representation. ]
17976   ]
17977   
17978   [
17979     [[link boost_asio.reference.basic_socket.native_non_blocking [*native_non_blocking]]]
17980     [Gets the non-blocking mode of the native socket implementation. 
17981      [hr]
17982      Sets the non-blocking mode of the native socket implementation. ]
17983   ]
17984   
17985   [
17986     [[link boost_asio.reference.basic_socket.non_blocking [*non_blocking]]]
17987     [Gets the non-blocking mode of the socket. 
17988      [hr]
17989      Sets the non-blocking mode of the socket. ]
17990   ]
17991   
17992   [
17993     [[link boost_asio.reference.basic_socket.open [*open]]]
17994     [Open the socket using the specified protocol. ]
17995   ]
17996   
17997   [
17998     [[link boost_asio.reference.basic_socket.operator_eq_ [*operator=]]]
17999     [Move-assign a basic_socket from another. 
18000      [hr]
18001      Move-assign a basic_socket from a socket of another protocol type. ]
18002   ]
18003   
18004   [
18005     [[link boost_asio.reference.basic_socket.release [*release]]]
18006     [Release ownership of the underlying native socket. ]
18007   ]
18008   
18009   [
18010     [[link boost_asio.reference.basic_socket.remote_endpoint [*remote_endpoint]]]
18011     [Get the remote endpoint of the socket. ]
18012   ]
18013   
18014   [
18015     [[link boost_asio.reference.basic_socket.set_option [*set_option]]]
18016     [Set an option on the socket. ]
18017   ]
18018   
18019   [
18020     [[link boost_asio.reference.basic_socket.shutdown [*shutdown]]]
18021     [Disable sends or receives on the socket. ]
18022   ]
18023   
18024   [
18025     [[link boost_asio.reference.basic_socket.wait [*wait]]]
18026     [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
18027   ]
18028   
18029 ]
18030
18031 [heading Protected Member Functions]
18032 [table
18033   [[Name][Description]]
18034
18035   [
18036     [[link boost_asio.reference.basic_socket._basic_socket [*~basic_socket]]]
18037     [Protected destructor to prevent deletion through this type. ]
18038   ]
18039   
18040 ]
18041
18042 [heading Data Members]
18043 [table
18044   [[Name][Description]]
18045
18046   [
18047     [[link boost_asio.reference.basic_socket.max_connections [*max_connections]]]
18048     [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
18049   ]
18050
18051   [
18052     [[link boost_asio.reference.basic_socket.max_listen_connections [*max_listen_connections]]]
18053     [The maximum length of the queue of pending incoming connections. ]
18054   ]
18055
18056   [
18057     [[link boost_asio.reference.basic_socket.message_do_not_route [*message_do_not_route]]]
18058     [Specify that the data should not be subject to routing. ]
18059   ]
18060
18061   [
18062     [[link boost_asio.reference.basic_socket.message_end_of_record [*message_end_of_record]]]
18063     [Specifies that the data marks the end of a record. ]
18064   ]
18065
18066   [
18067     [[link boost_asio.reference.basic_socket.message_out_of_band [*message_out_of_band]]]
18068     [Process out-of-band data. ]
18069   ]
18070
18071   [
18072     [[link boost_asio.reference.basic_socket.message_peek [*message_peek]]]
18073     [Peek at incoming data without removing it from the input queue. ]
18074   ]
18075
18076 ]
18077
18078 [heading Protected Data Members]
18079 [table
18080   [[Name][Description]]
18081
18082   [
18083     [[link boost_asio.reference.basic_socket.impl_ [*impl_]]]
18084     []
18085   ]
18086
18087 ]
18088
18089 The [link boost_asio.reference.basic_socket `basic_socket`] class template provides functionality that is common to both stream-oriented and datagram-oriented sockets.
18090
18091
18092 [heading Thread Safety]
18093   
18094 ['Distinct] ['objects:] Safe.
18095
18096 ['Shared] ['objects:] Unsafe. 
18097
18098
18099
18100
18101 [heading Requirements]
18102
18103 ['Header: ][^boost/asio/basic_raw_socket.hpp]
18104
18105 ['Convenience header: ][^boost/asio.hpp]
18106
18107
18108 [endsect]
18109
18110
18111
18112 [section:max_connections basic_raw_socket::max_connections]
18113
18114
18115 ['Inherited from socket_base.]
18116
18117 [indexterm2 boost_asio.indexterm.basic_raw_socket.max_connections..max_connections..basic_raw_socket] 
18118 (Deprecated: Use max\_listen\_connections.) The maximum length of the queue of pending incoming connections. 
18119
18120
18121   static const int max_connections = implementation_defined;
18122
18123
18124
18125 [endsect]
18126
18127
18128
18129 [section:max_listen_connections basic_raw_socket::max_listen_connections]
18130
18131
18132 ['Inherited from socket_base.]
18133
18134 [indexterm2 boost_asio.indexterm.basic_raw_socket.max_listen_connections..max_listen_connections..basic_raw_socket] 
18135 The maximum length of the queue of pending incoming connections. 
18136
18137
18138   static const int max_listen_connections = implementation_defined;
18139
18140
18141
18142 [endsect]
18143
18144
18145
18146 [section:message_do_not_route basic_raw_socket::message_do_not_route]
18147
18148
18149 ['Inherited from socket_base.]
18150
18151 [indexterm2 boost_asio.indexterm.basic_raw_socket.message_do_not_route..message_do_not_route..basic_raw_socket] 
18152 Specify that the data should not be subject to routing. 
18153
18154
18155   static const int message_do_not_route = implementation_defined;
18156
18157
18158
18159 [endsect]
18160
18161
18162
18163 [section:message_end_of_record basic_raw_socket::message_end_of_record]
18164
18165
18166 ['Inherited from socket_base.]
18167
18168 [indexterm2 boost_asio.indexterm.basic_raw_socket.message_end_of_record..message_end_of_record..basic_raw_socket] 
18169 Specifies that the data marks the end of a record. 
18170
18171
18172   static const int message_end_of_record = implementation_defined;
18173
18174
18175
18176 [endsect]
18177
18178
18179
18180 [section:message_flags basic_raw_socket::message_flags]
18181
18182
18183 ['Inherited from socket_base.]
18184
18185 [indexterm2 boost_asio.indexterm.basic_raw_socket.message_flags..message_flags..basic_raw_socket] 
18186 Bitmask type for flags that can be passed to send and receive operations. 
18187
18188
18189   typedef int message_flags;
18190
18191
18192
18193 [heading Requirements]
18194
18195 ['Header: ][^boost/asio/basic_raw_socket.hpp]
18196
18197 ['Convenience header: ][^boost/asio.hpp]
18198
18199
18200 [endsect]
18201
18202
18203
18204 [section:message_out_of_band basic_raw_socket::message_out_of_band]
18205
18206
18207 ['Inherited from socket_base.]
18208
18209 [indexterm2 boost_asio.indexterm.basic_raw_socket.message_out_of_band..message_out_of_band..basic_raw_socket] 
18210 Process out-of-band data. 
18211
18212
18213   static const int message_out_of_band = implementation_defined;
18214
18215
18216
18217 [endsect]
18218
18219
18220
18221 [section:message_peek basic_raw_socket::message_peek]
18222
18223
18224 ['Inherited from socket_base.]
18225
18226 [indexterm2 boost_asio.indexterm.basic_raw_socket.message_peek..message_peek..basic_raw_socket] 
18227 Peek at incoming data without removing it from the input queue. 
18228
18229
18230   static const int message_peek = implementation_defined;
18231
18232
18233
18234 [endsect]
18235
18236
18237
18238 [section:native_handle basic_raw_socket::native_handle]
18239
18240
18241 ['Inherited from basic_socket.]
18242
18243 [indexterm2 boost_asio.indexterm.basic_raw_socket.native_handle..native_handle..basic_raw_socket] 
18244 Get the native socket representation. 
18245
18246
18247   native_handle_type native_handle();
18248
18249
18250 This function may be used to obtain the underlying representation of the socket. This is intended to allow access to native socket functionality that is not otherwise provided. 
18251
18252
18253 [endsect]
18254
18255
18256
18257 [section:native_handle_type basic_raw_socket::native_handle_type]
18258
18259 [indexterm2 boost_asio.indexterm.basic_raw_socket.native_handle_type..native_handle_type..basic_raw_socket] 
18260 The native representation of a socket. 
18261
18262
18263   typedef implementation_defined native_handle_type;
18264
18265
18266
18267 [heading Requirements]
18268
18269 ['Header: ][^boost/asio/basic_raw_socket.hpp]
18270
18271 ['Convenience header: ][^boost/asio.hpp]
18272
18273
18274 [endsect]
18275
18276
18277 [section:native_non_blocking basic_raw_socket::native_non_blocking]
18278
18279 [indexterm2 boost_asio.indexterm.basic_raw_socket.native_non_blocking..native_non_blocking..basic_raw_socket] 
18280 Gets the non-blocking mode of the native socket implementation. 
18281
18282
18283   bool ``[link boost_asio.reference.basic_raw_socket.native_non_blocking.overload1 native_non_blocking]``() const;
18284   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.native_non_blocking.overload1 more...]]``
18285
18286
18287 Sets the non-blocking mode of the native socket implementation. 
18288
18289
18290   void ``[link boost_asio.reference.basic_raw_socket.native_non_blocking.overload2 native_non_blocking]``(
18291       bool mode);
18292   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.native_non_blocking.overload2 more...]]``
18293
18294   void ``[link boost_asio.reference.basic_raw_socket.native_non_blocking.overload3 native_non_blocking]``(
18295       bool mode,
18296       boost::system::error_code & ec);
18297   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.native_non_blocking.overload3 more...]]``
18298
18299
18300 [section:overload1 basic_raw_socket::native_non_blocking (1 of 3 overloads)]
18301
18302
18303 ['Inherited from basic_socket.]
18304
18305
18306 Gets the non-blocking mode of the native socket implementation. 
18307
18308
18309   bool native_non_blocking() const;
18310
18311
18312 This function is used to retrieve the non-blocking mode of the underlying native socket. This mode has no effect on the behaviour of the socket object's synchronous operations.
18313
18314
18315 [heading Return Value]
18316       
18317 `true` if the underlying socket is in non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).
18318
18319
18320 [heading Remarks]
18321       
18322 The current non-blocking mode is cached by the socket object. Consequently, the return value may be incorrect if the non-blocking mode was set directly on the native socket.
18323
18324
18325 [heading Example]
18326   
18327 This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated: 
18328
18329    template <typename Handler>
18330    struct sendfile_op
18331    {
18332      tcp::socket& sock_;
18333      int fd_;
18334      Handler handler_;
18335      off_t offset_;
18336      std::size_t total_bytes_transferred_;
18337
18338      // Function call operator meeting WriteHandler requirements.
18339      // Used as the handler for the async_write_some operation.
18340      void operator()(boost::system::error_code ec, std::size_t)
18341      {
18342        // Put the underlying socket into non-blocking mode.
18343        if (!ec)
18344          if (!sock_.native_non_blocking())
18345            sock_.native_non_blocking(true, ec);
18346
18347        if (!ec)
18348        {
18349          for (;;)
18350          {
18351            // Try the system call.
18352            errno = 0;
18353            int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
18354            ec = boost::system::error_code(n < 0 ? errno : 0,
18355                boost::asio::error::get_system_category());
18356            total_bytes_transferred_ += ec ? 0 : n;
18357
18358            // Retry operation immediately if interrupted by signal.
18359            if (ec == boost::asio::error::interrupted)
18360              continue;
18361
18362            // Check if we need to run the operation again.
18363            if (ec == boost::asio::error::would_block
18364                || ec == boost::asio::error::try_again)
18365            {
18366              // We have to wait for the socket to become ready again.
18367              sock_.async_wait(tcp::socket::wait_write, *this);
18368              return;
18369            }
18370
18371            if (ec || n == 0)
18372            {
18373              // An error occurred, or we have reached the end of the file.
18374              // Either way we must exit the loop so we can call the handler.
18375              break;
18376            }
18377
18378            // Loop around to try calling sendfile again.
18379          }
18380        }
18381
18382        // Pass result back to user's handler.
18383        handler_(ec, total_bytes_transferred_);
18384      }
18385    };
18386
18387    template <typename Handler>
18388    void async_sendfile(tcp::socket& sock, int fd, Handler h)
18389    {
18390      sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
18391      sock.async_wait(tcp::socket::wait_write, op);
18392    } 
18393
18394
18395
18396
18397
18398
18399
18400 [endsect]
18401
18402
18403
18404 [section:overload2 basic_raw_socket::native_non_blocking (2 of 3 overloads)]
18405
18406
18407 ['Inherited from basic_socket.]
18408
18409
18410 Sets the non-blocking mode of the native socket implementation. 
18411
18412
18413   void native_non_blocking(
18414       bool mode);
18415
18416
18417 This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations.
18418
18419
18420 [heading Parameters]
18421     
18422
18423 [variablelist
18424   
18425 [[mode][If `true`, the underlying socket is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]]
18426
18427 ]
18428
18429
18430 [heading Exceptions]
18431     
18432
18433 [variablelist
18434   
18435 [[boost::system::system_error][Thrown on failure. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense.]]
18436
18437 ]
18438
18439
18440 [heading Example]
18441   
18442 This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated: 
18443
18444    template <typename Handler>
18445    struct sendfile_op
18446    {
18447      tcp::socket& sock_;
18448      int fd_;
18449      Handler handler_;
18450      off_t offset_;
18451      std::size_t total_bytes_transferred_;
18452
18453      // Function call operator meeting WriteHandler requirements.
18454      // Used as the handler for the async_write_some operation.
18455      void operator()(boost::system::error_code ec, std::size_t)
18456      {
18457        // Put the underlying socket into non-blocking mode.
18458        if (!ec)
18459          if (!sock_.native_non_blocking())
18460            sock_.native_non_blocking(true, ec);
18461
18462        if (!ec)
18463        {
18464          for (;;)
18465          {
18466            // Try the system call.
18467            errno = 0;
18468            int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
18469            ec = boost::system::error_code(n < 0 ? errno : 0,
18470                boost::asio::error::get_system_category());
18471            total_bytes_transferred_ += ec ? 0 : n;
18472
18473            // Retry operation immediately if interrupted by signal.
18474            if (ec == boost::asio::error::interrupted)
18475              continue;
18476
18477            // Check if we need to run the operation again.
18478            if (ec == boost::asio::error::would_block
18479                || ec == boost::asio::error::try_again)
18480            {
18481              // We have to wait for the socket to become ready again.
18482              sock_.async_wait(tcp::socket::wait_write, *this);
18483              return;
18484            }
18485
18486            if (ec || n == 0)
18487            {
18488              // An error occurred, or we have reached the end of the file.
18489              // Either way we must exit the loop so we can call the handler.
18490              break;
18491            }
18492
18493            // Loop around to try calling sendfile again.
18494          }
18495        }
18496
18497        // Pass result back to user's handler.
18498        handler_(ec, total_bytes_transferred_);
18499      }
18500    };
18501
18502    template <typename Handler>
18503    void async_sendfile(tcp::socket& sock, int fd, Handler h)
18504    {
18505      sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
18506      sock.async_wait(tcp::socket::wait_write, op);
18507    } 
18508
18509
18510
18511
18512
18513
18514
18515 [endsect]
18516
18517
18518
18519 [section:overload3 basic_raw_socket::native_non_blocking (3 of 3 overloads)]
18520
18521
18522 ['Inherited from basic_socket.]
18523
18524
18525 Sets the non-blocking mode of the native socket implementation. 
18526
18527
18528   void native_non_blocking(
18529       bool mode,
18530       boost::system::error_code & ec);
18531
18532
18533 This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations.
18534
18535
18536 [heading Parameters]
18537     
18538
18539 [variablelist
18540   
18541 [[mode][If `true`, the underlying socket is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]]
18542
18543 [[ec][Set to indicate what error occurred, if any. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense.]]
18544
18545 ]
18546
18547
18548 [heading Example]
18549   
18550 This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated: 
18551
18552    template <typename Handler>
18553    struct sendfile_op
18554    {
18555      tcp::socket& sock_;
18556      int fd_;
18557      Handler handler_;
18558      off_t offset_;
18559      std::size_t total_bytes_transferred_;
18560
18561      // Function call operator meeting WriteHandler requirements.
18562      // Used as the handler for the async_write_some operation.
18563      void operator()(boost::system::error_code ec, std::size_t)
18564      {
18565        // Put the underlying socket into non-blocking mode.
18566        if (!ec)
18567          if (!sock_.native_non_blocking())
18568            sock_.native_non_blocking(true, ec);
18569
18570        if (!ec)
18571        {
18572          for (;;)
18573          {
18574            // Try the system call.
18575            errno = 0;
18576            int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
18577            ec = boost::system::error_code(n < 0 ? errno : 0,
18578                boost::asio::error::get_system_category());
18579            total_bytes_transferred_ += ec ? 0 : n;
18580
18581            // Retry operation immediately if interrupted by signal.
18582            if (ec == boost::asio::error::interrupted)
18583              continue;
18584
18585            // Check if we need to run the operation again.
18586            if (ec == boost::asio::error::would_block
18587                || ec == boost::asio::error::try_again)
18588            {
18589              // We have to wait for the socket to become ready again.
18590              sock_.async_wait(tcp::socket::wait_write, *this);
18591              return;
18592            }
18593
18594            if (ec || n == 0)
18595            {
18596              // An error occurred, or we have reached the end of the file.
18597              // Either way we must exit the loop so we can call the handler.
18598              break;
18599            }
18600
18601            // Loop around to try calling sendfile again.
18602          }
18603        }
18604
18605        // Pass result back to user's handler.
18606        handler_(ec, total_bytes_transferred_);
18607      }
18608    };
18609
18610    template <typename Handler>
18611    void async_sendfile(tcp::socket& sock, int fd, Handler h)
18612    {
18613      sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
18614      sock.async_wait(tcp::socket::wait_write, op);
18615    } 
18616
18617
18618
18619
18620
18621
18622
18623 [endsect]
18624
18625
18626 [endsect]
18627
18628 [section:non_blocking basic_raw_socket::non_blocking]
18629
18630 [indexterm2 boost_asio.indexterm.basic_raw_socket.non_blocking..non_blocking..basic_raw_socket] 
18631 Gets the non-blocking mode of the socket. 
18632
18633
18634   bool ``[link boost_asio.reference.basic_raw_socket.non_blocking.overload1 non_blocking]``() const;
18635   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.non_blocking.overload1 more...]]``
18636
18637
18638 Sets the non-blocking mode of the socket. 
18639
18640
18641   void ``[link boost_asio.reference.basic_raw_socket.non_blocking.overload2 non_blocking]``(
18642       bool mode);
18643   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.non_blocking.overload2 more...]]``
18644
18645   void ``[link boost_asio.reference.basic_raw_socket.non_blocking.overload3 non_blocking]``(
18646       bool mode,
18647       boost::system::error_code & ec);
18648   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.non_blocking.overload3 more...]]``
18649
18650
18651 [section:overload1 basic_raw_socket::non_blocking (1 of 3 overloads)]
18652
18653
18654 ['Inherited from basic_socket.]
18655
18656
18657 Gets the non-blocking mode of the socket. 
18658
18659
18660   bool non_blocking() const;
18661
18662
18663
18664 [heading Return Value]
18665       
18666 `true` if the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.
18667
18668
18669 [heading Remarks]
18670       
18671 The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`. 
18672
18673
18674
18675
18676 [endsect]
18677
18678
18679
18680 [section:overload2 basic_raw_socket::non_blocking (2 of 3 overloads)]
18681
18682
18683 ['Inherited from basic_socket.]
18684
18685
18686 Sets the non-blocking mode of the socket. 
18687
18688
18689   void non_blocking(
18690       bool mode);
18691
18692
18693
18694 [heading Parameters]
18695     
18696
18697 [variablelist
18698   
18699 [[mode][If `true`, the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]]
18700
18701 ]
18702
18703
18704 [heading Exceptions]
18705     
18706
18707 [variablelist
18708   
18709 [[boost::system::system_error][Thrown on failure.]]
18710
18711 ]
18712
18713
18714 [heading Remarks]
18715       
18716 The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`. 
18717
18718
18719
18720
18721 [endsect]
18722
18723
18724
18725 [section:overload3 basic_raw_socket::non_blocking (3 of 3 overloads)]
18726
18727
18728 ['Inherited from basic_socket.]
18729
18730
18731 Sets the non-blocking mode of the socket. 
18732
18733
18734   void non_blocking(
18735       bool mode,
18736       boost::system::error_code & ec);
18737
18738
18739
18740 [heading Parameters]
18741     
18742
18743 [variablelist
18744   
18745 [[mode][If `true`, the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]]
18746
18747 [[ec][Set to indicate what error occurred, if any.]]
18748
18749 ]
18750
18751
18752 [heading Remarks]
18753       
18754 The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`. 
18755
18756
18757
18758
18759 [endsect]
18760
18761
18762 [endsect]
18763
18764 [section:open basic_raw_socket::open]
18765
18766 [indexterm2 boost_asio.indexterm.basic_raw_socket.open..open..basic_raw_socket] 
18767 Open the socket using the specified protocol. 
18768
18769
18770   void ``[link boost_asio.reference.basic_raw_socket.open.overload1 open]``(
18771       const protocol_type & protocol = protocol_type());
18772   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.open.overload1 more...]]``
18773
18774   void ``[link boost_asio.reference.basic_raw_socket.open.overload2 open]``(
18775       const protocol_type & protocol,
18776       boost::system::error_code & ec);
18777   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.open.overload2 more...]]``
18778
18779
18780 [section:overload1 basic_raw_socket::open (1 of 2 overloads)]
18781
18782
18783 ['Inherited from basic_socket.]
18784
18785
18786 Open the socket using the specified protocol. 
18787
18788
18789   void open(
18790       const protocol_type & protocol = protocol_type());
18791
18792
18793 This function opens the socket so that it will use the specified protocol.
18794
18795
18796 [heading Parameters]
18797     
18798
18799 [variablelist
18800   
18801 [[protocol][An object specifying protocol parameters to be used.]]
18802
18803 ]
18804
18805
18806 [heading Exceptions]
18807     
18808
18809 [variablelist
18810   
18811 [[boost::system::system_error][Thrown on failure.]]
18812
18813 ]
18814
18815
18816 [heading Example]
18817   
18818
18819
18820    boost::asio::ip::tcp::socket socket(my_context);
18821    socket.open(boost::asio::ip::tcp::v4());
18822
18823
18824
18825
18826
18827
18828
18829 [endsect]
18830
18831
18832
18833 [section:overload2 basic_raw_socket::open (2 of 2 overloads)]
18834
18835
18836 ['Inherited from basic_socket.]
18837
18838
18839 Open the socket using the specified protocol. 
18840
18841
18842   void open(
18843       const protocol_type & protocol,
18844       boost::system::error_code & ec);
18845
18846
18847 This function opens the socket so that it will use the specified protocol.
18848
18849
18850 [heading Parameters]
18851     
18852
18853 [variablelist
18854   
18855 [[protocol][An object specifying which protocol is to be used.]]
18856
18857 [[ec][Set to indicate what error occurred, if any.]]
18858
18859 ]
18860
18861
18862 [heading Example]
18863   
18864
18865
18866    boost::asio::ip::tcp::socket socket(my_context);
18867    boost::system::error_code ec;
18868    socket.open(boost::asio::ip::tcp::v4(), ec);
18869    if (ec)
18870    {
18871      // An error occurred.
18872    }
18873
18874
18875
18876
18877
18878
18879
18880 [endsect]
18881
18882
18883 [endsect]
18884
18885 [section:operator_eq_ basic_raw_socket::operator=]
18886
18887 [indexterm2 boost_asio.indexterm.basic_raw_socket.operator_eq_..operator=..basic_raw_socket] 
18888 Move-assign a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] from another. 
18889
18890
18891   basic_raw_socket & ``[link boost_asio.reference.basic_raw_socket.operator_eq_.overload1 operator=]``(
18892       basic_raw_socket && other);
18893   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.operator_eq_.overload1 more...]]``
18894
18895
18896 Move-assign a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] from a socket of another protocol type. 
18897
18898
18899   template<
18900       typename ``[link boost_asio.reference.Protocol Protocol1]``,
18901       typename ``[link boost_asio.reference.Executor1 Executor1]``>
18902   enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value, basic_raw_socket & >::type ``[link boost_asio.reference.basic_raw_socket.operator_eq_.overload2 operator=]``(
18903       basic_raw_socket< Protocol1, Executor1 > && other);
18904   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.operator_eq_.overload2 more...]]``
18905
18906
18907 [section:overload1 basic_raw_socket::operator= (1 of 2 overloads)]
18908
18909
18910 Move-assign a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] from another. 
18911
18912
18913   basic_raw_socket & operator=(
18914       basic_raw_socket && other);
18915
18916
18917 This assignment operator moves a raw socket from one object to another.
18918
18919
18920 [heading Parameters]
18921     
18922
18923 [variablelist
18924   
18925 [[other][The other [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] object from which the move will occur.]]
18926
18927 ]
18928
18929
18930 [heading Remarks]
18931       
18932 Following the move, the moved-from object is in the same state as if constructed using the `basic_raw_socket(const executor_type&)` constructor. 
18933
18934
18935
18936
18937 [endsect]
18938
18939
18940
18941 [section:overload2 basic_raw_socket::operator= (2 of 2 overloads)]
18942
18943
18944 Move-assign a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] from a socket of another protocol type. 
18945
18946
18947   template<
18948       typename ``[link boost_asio.reference.Protocol Protocol1]``,
18949       typename ``[link boost_asio.reference.Executor1 Executor1]``>
18950   enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value, basic_raw_socket & >::type operator=(
18951       basic_raw_socket< Protocol1, Executor1 > && other);
18952
18953
18954 This assignment operator moves a raw socket from one object to another.
18955
18956
18957 [heading Parameters]
18958     
18959
18960 [variablelist
18961   
18962 [[other][The other [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] object from which the move will occur.]]
18963
18964 ]
18965
18966
18967 [heading Remarks]
18968       
18969 Following the move, the moved-from object is in the same state as if constructed using the `basic_raw_socket(const executor_type&)` constructor. 
18970
18971
18972
18973
18974 [endsect]
18975
18976
18977 [endsect]
18978
18979
18980 [section:out_of_band_inline basic_raw_socket::out_of_band_inline]
18981
18982
18983 ['Inherited from socket_base.]
18984
18985 [indexterm2 boost_asio.indexterm.basic_raw_socket.out_of_band_inline..out_of_band_inline..basic_raw_socket] 
18986 Socket option for putting received out-of-band data inline. 
18987
18988
18989   typedef implementation_defined out_of_band_inline;
18990
18991
18992
18993 Implements the SOL\_SOCKET/SO\_OOBINLINE socket option.
18994
18995
18996 [heading Examples]
18997   
18998 Setting the option: 
18999
19000    boost::asio::ip::tcp::socket socket(my_context);
19001    ...
19002    boost::asio::socket_base::out_of_band_inline option(true);
19003    socket.set_option(option);
19004
19005
19006
19007
19008
19009 Getting the current option value: 
19010
19011    boost::asio::ip::tcp::socket socket(my_context);
19012    ...
19013    boost::asio::socket_base::out_of_band_inline option;
19014    socket.get_option(option);
19015    bool value = option.value();
19016
19017
19018
19019
19020
19021
19022
19023 [heading Requirements]
19024
19025 ['Header: ][^boost/asio/basic_raw_socket.hpp]
19026
19027 ['Convenience header: ][^boost/asio.hpp]
19028
19029
19030 [endsect]
19031
19032
19033
19034 [section:protocol_type basic_raw_socket::protocol_type]
19035
19036 [indexterm2 boost_asio.indexterm.basic_raw_socket.protocol_type..protocol_type..basic_raw_socket] 
19037 The protocol type. 
19038
19039
19040   typedef Protocol protocol_type;
19041
19042
19043
19044 [heading Requirements]
19045
19046 ['Header: ][^boost/asio/basic_raw_socket.hpp]
19047
19048 ['Convenience header: ][^boost/asio.hpp]
19049
19050
19051 [endsect]
19052
19053
19054 [section:receive basic_raw_socket::receive]
19055
19056 [indexterm2 boost_asio.indexterm.basic_raw_socket.receive..receive..basic_raw_socket] 
19057 Receive some data on a connected socket. 
19058
19059
19060   template<
19061       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
19062   std::size_t ``[link boost_asio.reference.basic_raw_socket.receive.overload1 receive]``(
19063       const MutableBufferSequence & buffers);
19064   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.receive.overload1 more...]]``
19065
19066   template<
19067       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
19068   std::size_t ``[link boost_asio.reference.basic_raw_socket.receive.overload2 receive]``(
19069       const MutableBufferSequence & buffers,
19070       socket_base::message_flags flags);
19071   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.receive.overload2 more...]]``
19072
19073   template<
19074       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
19075   std::size_t ``[link boost_asio.reference.basic_raw_socket.receive.overload3 receive]``(
19076       const MutableBufferSequence & buffers,
19077       socket_base::message_flags flags,
19078       boost::system::error_code & ec);
19079   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.receive.overload3 more...]]``
19080
19081
19082 [section:overload1 basic_raw_socket::receive (1 of 3 overloads)]
19083
19084
19085 Receive some data on a connected socket. 
19086
19087
19088   template<
19089       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
19090   std::size_t receive(
19091       const MutableBufferSequence & buffers);
19092
19093
19094 This function is used to receive data on the raw socket. The function call will block until data has been received successfully or an error occurs.
19095
19096
19097 [heading Parameters]
19098     
19099
19100 [variablelist
19101   
19102 [[buffers][One or more buffers into which the data will be received.]]
19103
19104 ]
19105
19106
19107 [heading Return Value]
19108       
19109 The number of bytes received.
19110
19111
19112 [heading Exceptions]
19113     
19114
19115 [variablelist
19116   
19117 [[boost::system::system_error][Thrown on failure.]]
19118
19119 ]
19120
19121
19122 [heading Remarks]
19123       
19124 The receive operation can only be used with a connected socket. Use the receive\_from function to receive data on an unconnected raw socket.
19125
19126
19127 [heading Example]
19128   
19129 To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
19130
19131    socket.receive(boost::asio::buffer(data, size)); 
19132
19133
19134 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
19135
19136
19137
19138
19139 [endsect]
19140
19141
19142
19143 [section:overload2 basic_raw_socket::receive (2 of 3 overloads)]
19144
19145
19146 Receive some data on a connected socket. 
19147
19148
19149   template<
19150       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
19151   std::size_t receive(
19152       const MutableBufferSequence & buffers,
19153       socket_base::message_flags flags);
19154
19155
19156 This function is used to receive data on the raw socket. The function call will block until data has been received successfully or an error occurs.
19157
19158
19159 [heading Parameters]
19160     
19161
19162 [variablelist
19163   
19164 [[buffers][One or more buffers into which the data will be received.]]
19165
19166 [[flags][Flags specifying how the receive call is to be made.]]
19167
19168 ]
19169
19170
19171 [heading Return Value]
19172       
19173 The number of bytes received.
19174
19175
19176 [heading Exceptions]
19177     
19178
19179 [variablelist
19180   
19181 [[boost::system::system_error][Thrown on failure.]]
19182
19183 ]
19184
19185
19186 [heading Remarks]
19187       
19188 The receive operation can only be used with a connected socket. Use the receive\_from function to receive data on an unconnected raw socket. 
19189
19190
19191
19192
19193 [endsect]
19194
19195
19196
19197 [section:overload3 basic_raw_socket::receive (3 of 3 overloads)]
19198
19199
19200 Receive some data on a connected socket. 
19201
19202
19203   template<
19204       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
19205   std::size_t receive(
19206       const MutableBufferSequence & buffers,
19207       socket_base::message_flags flags,
19208       boost::system::error_code & ec);
19209
19210
19211 This function is used to receive data on the raw socket. The function call will block until data has been received successfully or an error occurs.
19212
19213
19214 [heading Parameters]
19215     
19216
19217 [variablelist
19218   
19219 [[buffers][One or more buffers into which the data will be received.]]
19220
19221 [[flags][Flags specifying how the receive call is to be made.]]
19222
19223 [[ec][Set to indicate what error occurred, if any.]]
19224
19225 ]
19226
19227
19228 [heading Return Value]
19229       
19230 The number of bytes received.
19231
19232
19233 [heading Remarks]
19234       
19235 The receive operation can only be used with a connected socket. Use the receive\_from function to receive data on an unconnected raw socket. 
19236
19237
19238
19239
19240 [endsect]
19241
19242
19243 [endsect]
19244
19245
19246 [section:receive_buffer_size basic_raw_socket::receive_buffer_size]
19247
19248
19249 ['Inherited from socket_base.]
19250
19251 [indexterm2 boost_asio.indexterm.basic_raw_socket.receive_buffer_size..receive_buffer_size..basic_raw_socket] 
19252 Socket option for the receive buffer size of a socket. 
19253
19254
19255   typedef implementation_defined receive_buffer_size;
19256
19257
19258
19259 Implements the SOL\_SOCKET/SO\_RCVBUF socket option.
19260
19261
19262 [heading Examples]
19263   
19264 Setting the option: 
19265
19266    boost::asio::ip::tcp::socket socket(my_context);
19267    ...
19268    boost::asio::socket_base::receive_buffer_size option(8192);
19269    socket.set_option(option);
19270
19271
19272
19273
19274
19275 Getting the current option value: 
19276
19277    boost::asio::ip::tcp::socket socket(my_context);
19278    ...
19279    boost::asio::socket_base::receive_buffer_size option;
19280    socket.get_option(option);
19281    int size = option.value();
19282
19283
19284
19285
19286
19287
19288
19289 [heading Requirements]
19290
19291 ['Header: ][^boost/asio/basic_raw_socket.hpp]
19292
19293 ['Convenience header: ][^boost/asio.hpp]
19294
19295
19296 [endsect]
19297
19298
19299 [section:receive_from basic_raw_socket::receive_from]
19300
19301 [indexterm2 boost_asio.indexterm.basic_raw_socket.receive_from..receive_from..basic_raw_socket] 
19302 Receive raw data with the endpoint of the sender. 
19303
19304
19305   template<
19306       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
19307   std::size_t ``[link boost_asio.reference.basic_raw_socket.receive_from.overload1 receive_from]``(
19308       const MutableBufferSequence & buffers,
19309       endpoint_type & sender_endpoint);
19310   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.receive_from.overload1 more...]]``
19311
19312   template<
19313       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
19314   std::size_t ``[link boost_asio.reference.basic_raw_socket.receive_from.overload2 receive_from]``(
19315       const MutableBufferSequence & buffers,
19316       endpoint_type & sender_endpoint,
19317       socket_base::message_flags flags);
19318   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.receive_from.overload2 more...]]``
19319
19320   template<
19321       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
19322   std::size_t ``[link boost_asio.reference.basic_raw_socket.receive_from.overload3 receive_from]``(
19323       const MutableBufferSequence & buffers,
19324       endpoint_type & sender_endpoint,
19325       socket_base::message_flags flags,
19326       boost::system::error_code & ec);
19327   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.receive_from.overload3 more...]]``
19328
19329
19330 [section:overload1 basic_raw_socket::receive_from (1 of 3 overloads)]
19331
19332
19333 Receive raw data with the endpoint of the sender. 
19334
19335
19336   template<
19337       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
19338   std::size_t receive_from(
19339       const MutableBufferSequence & buffers,
19340       endpoint_type & sender_endpoint);
19341
19342
19343 This function is used to receive raw data. The function call will block until data has been received successfully or an error occurs.
19344
19345
19346 [heading Parameters]
19347     
19348
19349 [variablelist
19350   
19351 [[buffers][One or more buffers into which the data will be received.]]
19352
19353 [[sender_endpoint][An endpoint object that receives the endpoint of the remote sender of the data.]]
19354
19355 ]
19356
19357
19358 [heading Return Value]
19359       
19360 The number of bytes received.
19361
19362
19363 [heading Exceptions]
19364     
19365
19366 [variablelist
19367   
19368 [[boost::system::system_error][Thrown on failure.]]
19369
19370 ]
19371
19372
19373 [heading Example]
19374   
19375 To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
19376
19377    boost::asio::ip::udp::endpoint sender_endpoint;
19378    socket.receive_from(
19379        boost::asio::buffer(data, size), sender_endpoint);
19380
19381
19382 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
19383
19384
19385
19386
19387 [endsect]
19388
19389
19390
19391 [section:overload2 basic_raw_socket::receive_from (2 of 3 overloads)]
19392
19393
19394 Receive raw data with the endpoint of the sender. 
19395
19396
19397   template<
19398       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
19399   std::size_t receive_from(
19400       const MutableBufferSequence & buffers,
19401       endpoint_type & sender_endpoint,
19402       socket_base::message_flags flags);
19403
19404
19405 This function is used to receive raw data. The function call will block until data has been received successfully or an error occurs.
19406
19407
19408 [heading Parameters]
19409     
19410
19411 [variablelist
19412   
19413 [[buffers][One or more buffers into which the data will be received.]]
19414
19415 [[sender_endpoint][An endpoint object that receives the endpoint of the remote sender of the data.]]
19416
19417 [[flags][Flags specifying how the receive call is to be made.]]
19418
19419 ]
19420
19421
19422 [heading Return Value]
19423       
19424 The number of bytes received.
19425
19426
19427 [heading Exceptions]
19428     
19429
19430 [variablelist
19431   
19432 [[boost::system::system_error][Thrown on failure. ]]
19433
19434 ]
19435
19436
19437
19438
19439 [endsect]
19440
19441
19442
19443 [section:overload3 basic_raw_socket::receive_from (3 of 3 overloads)]
19444
19445
19446 Receive raw data with the endpoint of the sender. 
19447
19448
19449   template<
19450       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
19451   std::size_t receive_from(
19452       const MutableBufferSequence & buffers,
19453       endpoint_type & sender_endpoint,
19454       socket_base::message_flags flags,
19455       boost::system::error_code & ec);
19456
19457
19458 This function is used to receive raw data. The function call will block until data has been received successfully or an error occurs.
19459
19460
19461 [heading Parameters]
19462     
19463
19464 [variablelist
19465   
19466 [[buffers][One or more buffers into which the data will be received.]]
19467
19468 [[sender_endpoint][An endpoint object that receives the endpoint of the remote sender of the data.]]
19469
19470 [[flags][Flags specifying how the receive call is to be made.]]
19471
19472 [[ec][Set to indicate what error occurred, if any.]]
19473
19474 ]
19475
19476
19477 [heading Return Value]
19478       
19479 The number of bytes received. 
19480
19481
19482
19483
19484 [endsect]
19485
19486
19487 [endsect]
19488
19489
19490 [section:receive_low_watermark basic_raw_socket::receive_low_watermark]
19491
19492
19493 ['Inherited from socket_base.]
19494
19495 [indexterm2 boost_asio.indexterm.basic_raw_socket.receive_low_watermark..receive_low_watermark..basic_raw_socket] 
19496 Socket option for the receive low watermark. 
19497
19498
19499   typedef implementation_defined receive_low_watermark;
19500
19501
19502
19503 Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option.
19504
19505
19506 [heading Examples]
19507   
19508 Setting the option: 
19509
19510    boost::asio::ip::tcp::socket socket(my_context);
19511    ...
19512    boost::asio::socket_base::receive_low_watermark option(1024);
19513    socket.set_option(option);
19514
19515
19516
19517
19518
19519 Getting the current option value: 
19520
19521    boost::asio::ip::tcp::socket socket(my_context);
19522    ...
19523    boost::asio::socket_base::receive_low_watermark option;
19524    socket.get_option(option);
19525    int size = option.value();
19526
19527
19528
19529
19530
19531
19532
19533 [heading Requirements]
19534
19535 ['Header: ][^boost/asio/basic_raw_socket.hpp]
19536
19537 ['Convenience header: ][^boost/asio.hpp]
19538
19539
19540 [endsect]
19541
19542
19543 [section:release basic_raw_socket::release]
19544
19545 [indexterm2 boost_asio.indexterm.basic_raw_socket.release..release..basic_raw_socket] 
19546 Release ownership of the underlying native socket. 
19547
19548
19549   native_handle_type ``[link boost_asio.reference.basic_raw_socket.release.overload1 release]``();
19550   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.release.overload1 more...]]``
19551
19552   native_handle_type ``[link boost_asio.reference.basic_raw_socket.release.overload2 release]``(
19553       boost::system::error_code & ec);
19554   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.release.overload2 more...]]``
19555
19556
19557 [section:overload1 basic_raw_socket::release (1 of 2 overloads)]
19558
19559
19560 ['Inherited from basic_socket.]
19561
19562
19563 Release ownership of the underlying native socket. 
19564
19565
19566   native_handle_type release();
19567
19568
19569 This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error. Ownership of the native socket is then transferred to the caller.
19570
19571
19572 [heading Exceptions]
19573     
19574
19575 [variablelist
19576   
19577 [[boost::system::system_error][Thrown on failure.]]
19578
19579 ]
19580
19581
19582 [heading Remarks]
19583       
19584 This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms. 
19585
19586
19587
19588
19589 [endsect]
19590
19591
19592
19593 [section:overload2 basic_raw_socket::release (2 of 2 overloads)]
19594
19595
19596 ['Inherited from basic_socket.]
19597
19598
19599 Release ownership of the underlying native socket. 
19600
19601
19602   native_handle_type release(
19603       boost::system::error_code & ec);
19604
19605
19606 This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error. Ownership of the native socket is then transferred to the caller.
19607
19608
19609 [heading Parameters]
19610     
19611
19612 [variablelist
19613   
19614 [[ec][Set to indicate what error occurred, if any.]]
19615
19616 ]
19617
19618
19619 [heading Remarks]
19620       
19621 This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms. 
19622
19623
19624
19625
19626 [endsect]
19627
19628
19629 [endsect]
19630
19631 [section:remote_endpoint basic_raw_socket::remote_endpoint]
19632
19633 [indexterm2 boost_asio.indexterm.basic_raw_socket.remote_endpoint..remote_endpoint..basic_raw_socket] 
19634 Get the remote endpoint of the socket. 
19635
19636
19637   endpoint_type ``[link boost_asio.reference.basic_raw_socket.remote_endpoint.overload1 remote_endpoint]``() const;
19638   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.remote_endpoint.overload1 more...]]``
19639
19640   endpoint_type ``[link boost_asio.reference.basic_raw_socket.remote_endpoint.overload2 remote_endpoint]``(
19641       boost::system::error_code & ec) const;
19642   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.remote_endpoint.overload2 more...]]``
19643
19644
19645 [section:overload1 basic_raw_socket::remote_endpoint (1 of 2 overloads)]
19646
19647
19648 ['Inherited from basic_socket.]
19649
19650
19651 Get the remote endpoint of the socket. 
19652
19653
19654   endpoint_type remote_endpoint() const;
19655
19656
19657 This function is used to obtain the remote endpoint of the socket.
19658
19659
19660 [heading Return Value]
19661       
19662 An object that represents the remote endpoint of the socket.
19663
19664
19665 [heading Exceptions]
19666     
19667
19668 [variablelist
19669   
19670 [[boost::system::system_error][Thrown on failure.]]
19671
19672 ]
19673
19674
19675 [heading Example]
19676   
19677
19678
19679    boost::asio::ip::tcp::socket socket(my_context);
19680    ...
19681    boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint();
19682
19683
19684
19685
19686
19687
19688
19689 [endsect]
19690
19691
19692
19693 [section:overload2 basic_raw_socket::remote_endpoint (2 of 2 overloads)]
19694
19695
19696 ['Inherited from basic_socket.]
19697
19698
19699 Get the remote endpoint of the socket. 
19700
19701
19702   endpoint_type remote_endpoint(
19703       boost::system::error_code & ec) const;
19704
19705
19706 This function is used to obtain the remote endpoint of the socket.
19707
19708
19709 [heading Parameters]
19710     
19711
19712 [variablelist
19713   
19714 [[ec][Set to indicate what error occurred, if any.]]
19715
19716 ]
19717
19718
19719 [heading Return Value]
19720       
19721 An object that represents the remote endpoint of the socket. Returns a default-constructed endpoint object if an error occurred.
19722
19723
19724 [heading Example]
19725   
19726
19727
19728    boost::asio::ip::tcp::socket socket(my_context);
19729    ...
19730    boost::system::error_code ec;
19731    boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(ec);
19732    if (ec)
19733    {
19734      // An error occurred.
19735    }
19736
19737
19738
19739
19740
19741
19742
19743 [endsect]
19744
19745
19746 [endsect]
19747
19748
19749 [section:reuse_address basic_raw_socket::reuse_address]
19750
19751
19752 ['Inherited from socket_base.]
19753
19754 [indexterm2 boost_asio.indexterm.basic_raw_socket.reuse_address..reuse_address..basic_raw_socket] 
19755 Socket option to allow the socket to be bound to an address that is already in use. 
19756
19757
19758   typedef implementation_defined reuse_address;
19759
19760
19761
19762 Implements the SOL\_SOCKET/SO\_REUSEADDR socket option.
19763
19764
19765 [heading Examples]
19766   
19767 Setting the option: 
19768
19769    boost::asio::ip::tcp::acceptor acceptor(my_context);
19770    ...
19771    boost::asio::socket_base::reuse_address option(true);
19772    acceptor.set_option(option);
19773
19774
19775
19776
19777
19778 Getting the current option value: 
19779
19780    boost::asio::ip::tcp::acceptor acceptor(my_context);
19781    ...
19782    boost::asio::socket_base::reuse_address option;
19783    acceptor.get_option(option);
19784    bool is_set = option.value();
19785
19786
19787
19788
19789
19790
19791
19792 [heading Requirements]
19793
19794 ['Header: ][^boost/asio/basic_raw_socket.hpp]
19795
19796 ['Convenience header: ][^boost/asio.hpp]
19797
19798
19799 [endsect]
19800
19801
19802 [section:send basic_raw_socket::send]
19803
19804 [indexterm2 boost_asio.indexterm.basic_raw_socket.send..send..basic_raw_socket] 
19805 Send some data on a connected socket. 
19806
19807
19808   template<
19809       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
19810   std::size_t ``[link boost_asio.reference.basic_raw_socket.send.overload1 send]``(
19811       const ConstBufferSequence & buffers);
19812   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.send.overload1 more...]]``
19813
19814   template<
19815       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
19816   std::size_t ``[link boost_asio.reference.basic_raw_socket.send.overload2 send]``(
19817       const ConstBufferSequence & buffers,
19818       socket_base::message_flags flags);
19819   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.send.overload2 more...]]``
19820
19821   template<
19822       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
19823   std::size_t ``[link boost_asio.reference.basic_raw_socket.send.overload3 send]``(
19824       const ConstBufferSequence & buffers,
19825       socket_base::message_flags flags,
19826       boost::system::error_code & ec);
19827   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.send.overload3 more...]]``
19828
19829
19830 [section:overload1 basic_raw_socket::send (1 of 3 overloads)]
19831
19832
19833 Send some data on a connected socket. 
19834
19835
19836   template<
19837       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
19838   std::size_t send(
19839       const ConstBufferSequence & buffers);
19840
19841
19842 This function is used to send data on the raw socket. The function call will block until the data has been sent successfully or an error occurs.
19843
19844
19845 [heading Parameters]
19846     
19847
19848 [variablelist
19849   
19850 [[buffers][One ore more data buffers to be sent on the socket.]]
19851
19852 ]
19853
19854
19855 [heading Return Value]
19856       
19857 The number of bytes sent.
19858
19859
19860 [heading Exceptions]
19861     
19862
19863 [variablelist
19864   
19865 [[boost::system::system_error][Thrown on failure.]]
19866
19867 ]
19868
19869
19870 [heading Remarks]
19871       
19872 The send operation can only be used with a connected socket. Use the send\_to function to send data on an unconnected raw socket.
19873
19874
19875 [heading Example]
19876   
19877 To send a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
19878
19879    socket.send(boost::asio::buffer(data, size)); 
19880
19881
19882 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
19883
19884
19885
19886
19887 [endsect]
19888
19889
19890
19891 [section:overload2 basic_raw_socket::send (2 of 3 overloads)]
19892
19893
19894 Send some data on a connected socket. 
19895
19896
19897   template<
19898       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
19899   std::size_t send(
19900       const ConstBufferSequence & buffers,
19901       socket_base::message_flags flags);
19902
19903
19904 This function is used to send data on the raw socket. The function call will block until the data has been sent successfully or an error occurs.
19905
19906
19907 [heading Parameters]
19908     
19909
19910 [variablelist
19911   
19912 [[buffers][One ore more data buffers to be sent on the socket.]]
19913
19914 [[flags][Flags specifying how the send call is to be made.]]
19915
19916 ]
19917
19918
19919 [heading Return Value]
19920       
19921 The number of bytes sent.
19922
19923
19924 [heading Exceptions]
19925     
19926
19927 [variablelist
19928   
19929 [[boost::system::system_error][Thrown on failure.]]
19930
19931 ]
19932
19933
19934 [heading Remarks]
19935       
19936 The send operation can only be used with a connected socket. Use the send\_to function to send data on an unconnected raw socket. 
19937
19938
19939
19940
19941 [endsect]
19942
19943
19944
19945 [section:overload3 basic_raw_socket::send (3 of 3 overloads)]
19946
19947
19948 Send some data on a connected socket. 
19949
19950
19951   template<
19952       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
19953   std::size_t send(
19954       const ConstBufferSequence & buffers,
19955       socket_base::message_flags flags,
19956       boost::system::error_code & ec);
19957
19958
19959 This function is used to send data on the raw socket. The function call will block until the data has been sent successfully or an error occurs.
19960
19961
19962 [heading Parameters]
19963     
19964
19965 [variablelist
19966   
19967 [[buffers][One or more data buffers to be sent on the socket.]]
19968
19969 [[flags][Flags specifying how the send call is to be made.]]
19970
19971 [[ec][Set to indicate what error occurred, if any.]]
19972
19973 ]
19974
19975
19976 [heading Return Value]
19977       
19978 The number of bytes sent.
19979
19980
19981 [heading Remarks]
19982       
19983 The send operation can only be used with a connected socket. Use the send\_to function to send data on an unconnected raw socket. 
19984
19985
19986
19987
19988 [endsect]
19989
19990
19991 [endsect]
19992
19993
19994 [section:send_buffer_size basic_raw_socket::send_buffer_size]
19995
19996
19997 ['Inherited from socket_base.]
19998
19999 [indexterm2 boost_asio.indexterm.basic_raw_socket.send_buffer_size..send_buffer_size..basic_raw_socket] 
20000 Socket option for the send buffer size of a socket. 
20001
20002
20003   typedef implementation_defined send_buffer_size;
20004
20005
20006
20007 Implements the SOL\_SOCKET/SO\_SNDBUF socket option.
20008
20009
20010 [heading Examples]
20011   
20012 Setting the option: 
20013
20014    boost::asio::ip::tcp::socket socket(my_context);
20015    ...
20016    boost::asio::socket_base::send_buffer_size option(8192);
20017    socket.set_option(option);
20018
20019
20020
20021
20022
20023 Getting the current option value: 
20024
20025    boost::asio::ip::tcp::socket socket(my_context);
20026    ...
20027    boost::asio::socket_base::send_buffer_size option;
20028    socket.get_option(option);
20029    int size = option.value();
20030
20031
20032
20033
20034
20035
20036
20037 [heading Requirements]
20038
20039 ['Header: ][^boost/asio/basic_raw_socket.hpp]
20040
20041 ['Convenience header: ][^boost/asio.hpp]
20042
20043
20044 [endsect]
20045
20046
20047
20048 [section:send_low_watermark basic_raw_socket::send_low_watermark]
20049
20050
20051 ['Inherited from socket_base.]
20052
20053 [indexterm2 boost_asio.indexterm.basic_raw_socket.send_low_watermark..send_low_watermark..basic_raw_socket] 
20054 Socket option for the send low watermark. 
20055
20056
20057   typedef implementation_defined send_low_watermark;
20058
20059
20060
20061 Implements the SOL\_SOCKET/SO\_SNDLOWAT socket option.
20062
20063
20064 [heading Examples]
20065   
20066 Setting the option: 
20067
20068    boost::asio::ip::tcp::socket socket(my_context);
20069    ...
20070    boost::asio::socket_base::send_low_watermark option(1024);
20071    socket.set_option(option);
20072
20073
20074
20075
20076
20077 Getting the current option value: 
20078
20079    boost::asio::ip::tcp::socket socket(my_context);
20080    ...
20081    boost::asio::socket_base::send_low_watermark option;
20082    socket.get_option(option);
20083    int size = option.value();
20084
20085
20086
20087
20088
20089
20090
20091 [heading Requirements]
20092
20093 ['Header: ][^boost/asio/basic_raw_socket.hpp]
20094
20095 ['Convenience header: ][^boost/asio.hpp]
20096
20097
20098 [endsect]
20099
20100
20101 [section:send_to basic_raw_socket::send_to]
20102
20103 [indexterm2 boost_asio.indexterm.basic_raw_socket.send_to..send_to..basic_raw_socket] 
20104 Send raw data to the specified endpoint. 
20105
20106
20107   template<
20108       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
20109   std::size_t ``[link boost_asio.reference.basic_raw_socket.send_to.overload1 send_to]``(
20110       const ConstBufferSequence & buffers,
20111       const endpoint_type & destination);
20112   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.send_to.overload1 more...]]``
20113
20114   template<
20115       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
20116   std::size_t ``[link boost_asio.reference.basic_raw_socket.send_to.overload2 send_to]``(
20117       const ConstBufferSequence & buffers,
20118       const endpoint_type & destination,
20119       socket_base::message_flags flags);
20120   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.send_to.overload2 more...]]``
20121
20122   template<
20123       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
20124   std::size_t ``[link boost_asio.reference.basic_raw_socket.send_to.overload3 send_to]``(
20125       const ConstBufferSequence & buffers,
20126       const endpoint_type & destination,
20127       socket_base::message_flags flags,
20128       boost::system::error_code & ec);
20129   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.send_to.overload3 more...]]``
20130
20131
20132 [section:overload1 basic_raw_socket::send_to (1 of 3 overloads)]
20133
20134
20135 Send raw data to the specified endpoint. 
20136
20137
20138   template<
20139       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
20140   std::size_t send_to(
20141       const ConstBufferSequence & buffers,
20142       const endpoint_type & destination);
20143
20144
20145 This function is used to send raw data to the specified remote endpoint. The function call will block until the data has been sent successfully or an error occurs.
20146
20147
20148 [heading Parameters]
20149     
20150
20151 [variablelist
20152   
20153 [[buffers][One or more data buffers to be sent to the remote endpoint.]]
20154
20155 [[destination][The remote endpoint to which the data will be sent.]]
20156
20157 ]
20158
20159
20160 [heading Return Value]
20161       
20162 The number of bytes sent.
20163
20164
20165 [heading Exceptions]
20166     
20167
20168 [variablelist
20169   
20170 [[boost::system::system_error][Thrown on failure.]]
20171
20172 ]
20173
20174
20175 [heading Example]
20176   
20177 To send a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
20178
20179    boost::asio::ip::udp::endpoint destination(
20180        boost::asio::ip::address::from_string("1.2.3.4"), 12345);
20181    socket.send_to(boost::asio::buffer(data, size), destination);
20182
20183
20184 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
20185
20186
20187
20188
20189 [endsect]
20190
20191
20192
20193 [section:overload2 basic_raw_socket::send_to (2 of 3 overloads)]
20194
20195
20196 Send raw data to the specified endpoint. 
20197
20198
20199   template<
20200       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
20201   std::size_t send_to(
20202       const ConstBufferSequence & buffers,
20203       const endpoint_type & destination,
20204       socket_base::message_flags flags);
20205
20206
20207 This function is used to send raw data to the specified remote endpoint. The function call will block until the data has been sent successfully or an error occurs.
20208
20209
20210 [heading Parameters]
20211     
20212
20213 [variablelist
20214   
20215 [[buffers][One or more data buffers to be sent to the remote endpoint.]]
20216
20217 [[destination][The remote endpoint to which the data will be sent.]]
20218
20219 [[flags][Flags specifying how the send call is to be made.]]
20220
20221 ]
20222
20223
20224 [heading Return Value]
20225       
20226 The number of bytes sent.
20227
20228
20229 [heading Exceptions]
20230     
20231
20232 [variablelist
20233   
20234 [[boost::system::system_error][Thrown on failure. ]]
20235
20236 ]
20237
20238
20239
20240
20241 [endsect]
20242
20243
20244
20245 [section:overload3 basic_raw_socket::send_to (3 of 3 overloads)]
20246
20247
20248 Send raw data to the specified endpoint. 
20249
20250
20251   template<
20252       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
20253   std::size_t send_to(
20254       const ConstBufferSequence & buffers,
20255       const endpoint_type & destination,
20256       socket_base::message_flags flags,
20257       boost::system::error_code & ec);
20258
20259
20260 This function is used to send raw data to the specified remote endpoint. The function call will block until the data has been sent successfully or an error occurs.
20261
20262
20263 [heading Parameters]
20264     
20265
20266 [variablelist
20267   
20268 [[buffers][One or more data buffers to be sent to the remote endpoint.]]
20269
20270 [[destination][The remote endpoint to which the data will be sent.]]
20271
20272 [[flags][Flags specifying how the send call is to be made.]]
20273
20274 [[ec][Set to indicate what error occurred, if any.]]
20275
20276 ]
20277
20278
20279 [heading Return Value]
20280       
20281 The number of bytes sent. 
20282
20283
20284
20285
20286 [endsect]
20287
20288
20289 [endsect]
20290
20291 [section:set_option basic_raw_socket::set_option]
20292
20293 [indexterm2 boost_asio.indexterm.basic_raw_socket.set_option..set_option..basic_raw_socket] 
20294 Set an option on the socket. 
20295
20296
20297   template<
20298       typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
20299   void ``[link boost_asio.reference.basic_raw_socket.set_option.overload1 set_option]``(
20300       const SettableSocketOption & option);
20301   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.set_option.overload1 more...]]``
20302
20303   template<
20304       typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
20305   void ``[link boost_asio.reference.basic_raw_socket.set_option.overload2 set_option]``(
20306       const SettableSocketOption & option,
20307       boost::system::error_code & ec);
20308   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.set_option.overload2 more...]]``
20309
20310
20311 [section:overload1 basic_raw_socket::set_option (1 of 2 overloads)]
20312
20313
20314 ['Inherited from basic_socket.]
20315
20316
20317 Set an option on the socket. 
20318
20319
20320   template<
20321       typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
20322   void set_option(
20323       const SettableSocketOption & option);
20324
20325
20326 This function is used to set an option on the socket.
20327
20328
20329 [heading Parameters]
20330     
20331
20332 [variablelist
20333   
20334 [[option][The new option value to be set on the socket.]]
20335
20336 ]
20337
20338
20339 [heading Exceptions]
20340     
20341
20342 [variablelist
20343   
20344 [[boost::system::system_error][Thrown on failure.]]
20345
20346 ]
20347
20348
20349
20350 [heading Example]
20351   
20352 Setting the IPPROTO\_TCP/TCP\_NODELAY option: 
20353
20354    boost::asio::ip::tcp::socket socket(my_context);
20355    ...
20356    boost::asio::ip::tcp::no_delay option(true);
20357    socket.set_option(option);
20358
20359
20360
20361
20362
20363
20364
20365 [endsect]
20366
20367
20368
20369 [section:overload2 basic_raw_socket::set_option (2 of 2 overloads)]
20370
20371
20372 ['Inherited from basic_socket.]
20373
20374
20375 Set an option on the socket. 
20376
20377
20378   template<
20379       typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
20380   void set_option(
20381       const SettableSocketOption & option,
20382       boost::system::error_code & ec);
20383
20384
20385 This function is used to set an option on the socket.
20386
20387
20388 [heading Parameters]
20389     
20390
20391 [variablelist
20392   
20393 [[option][The new option value to be set on the socket.]]
20394
20395 [[ec][Set to indicate what error occurred, if any.]]
20396
20397 ]
20398
20399
20400
20401 [heading Example]
20402   
20403 Setting the IPPROTO\_TCP/TCP\_NODELAY option: 
20404
20405    boost::asio::ip::tcp::socket socket(my_context);
20406    ...
20407    boost::asio::ip::tcp::no_delay option(true);
20408    boost::system::error_code ec;
20409    socket.set_option(option, ec);
20410    if (ec)
20411    {
20412      // An error occurred.
20413    }
20414
20415
20416
20417
20418
20419
20420
20421 [endsect]
20422
20423
20424 [endsect]
20425
20426 [section:shutdown basic_raw_socket::shutdown]
20427
20428 [indexterm2 boost_asio.indexterm.basic_raw_socket.shutdown..shutdown..basic_raw_socket] 
20429 Disable sends or receives on the socket. 
20430
20431
20432   void ``[link boost_asio.reference.basic_raw_socket.shutdown.overload1 shutdown]``(
20433       shutdown_type what);
20434   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.shutdown.overload1 more...]]``
20435
20436   void ``[link boost_asio.reference.basic_raw_socket.shutdown.overload2 shutdown]``(
20437       shutdown_type what,
20438       boost::system::error_code & ec);
20439   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.shutdown.overload2 more...]]``
20440
20441
20442 [section:overload1 basic_raw_socket::shutdown (1 of 2 overloads)]
20443
20444
20445 ['Inherited from basic_socket.]
20446
20447
20448 Disable sends or receives on the socket. 
20449
20450
20451   void shutdown(
20452       shutdown_type what);
20453
20454
20455 This function is used to disable send operations, receive operations, or both.
20456
20457
20458 [heading Parameters]
20459     
20460
20461 [variablelist
20462   
20463 [[what][Determines what types of operation will no longer be allowed.]]
20464
20465 ]
20466
20467
20468 [heading Exceptions]
20469     
20470
20471 [variablelist
20472   
20473 [[boost::system::system_error][Thrown on failure.]]
20474
20475 ]
20476
20477
20478 [heading Example]
20479   
20480 Shutting down the send side of the socket: 
20481
20482    boost::asio::ip::tcp::socket socket(my_context);
20483    ...
20484    socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send);
20485
20486
20487
20488
20489
20490
20491
20492 [endsect]
20493
20494
20495
20496 [section:overload2 basic_raw_socket::shutdown (2 of 2 overloads)]
20497
20498
20499 ['Inherited from basic_socket.]
20500
20501
20502 Disable sends or receives on the socket. 
20503
20504
20505   void shutdown(
20506       shutdown_type what,
20507       boost::system::error_code & ec);
20508
20509
20510 This function is used to disable send operations, receive operations, or both.
20511
20512
20513 [heading Parameters]
20514     
20515
20516 [variablelist
20517   
20518 [[what][Determines what types of operation will no longer be allowed.]]
20519
20520 [[ec][Set to indicate what error occurred, if any.]]
20521
20522 ]
20523
20524
20525 [heading Example]
20526   
20527 Shutting down the send side of the socket: 
20528
20529    boost::asio::ip::tcp::socket socket(my_context);
20530    ...
20531    boost::system::error_code ec;
20532    socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send, ec);
20533    if (ec)
20534    {
20535      // An error occurred.
20536    }
20537
20538
20539
20540
20541
20542
20543
20544 [endsect]
20545
20546
20547 [endsect]
20548
20549
20550 [section:shutdown_type basic_raw_socket::shutdown_type]
20551
20552
20553 ['Inherited from socket_base.]
20554
20555 [indexterm2 boost_asio.indexterm.basic_raw_socket.shutdown_type..shutdown_type..basic_raw_socket] 
20556 Different ways a socket may be shutdown. 
20557
20558
20559   enum shutdown_type
20560
20561 [indexterm2 boost_asio.indexterm.basic_raw_socket.shutdown_type.shutdown_receive..shutdown_receive..basic_raw_socket]
20562 [indexterm2 boost_asio.indexterm.basic_raw_socket.shutdown_type.shutdown_send..shutdown_send..basic_raw_socket]
20563 [indexterm2 boost_asio.indexterm.basic_raw_socket.shutdown_type.shutdown_both..shutdown_both..basic_raw_socket]
20564
20565 [heading Values]
20566 [variablelist
20567
20568   [
20569     [shutdown_receive]
20570     [Shutdown the receive side of the socket. ]
20571   ]
20572
20573   [
20574     [shutdown_send]
20575     [Shutdown the send side of the socket. ]
20576   ]
20577
20578   [
20579     [shutdown_both]
20580     [Shutdown both send and receive on the socket. ]
20581   ]
20582
20583 ]
20584
20585
20586
20587 [endsect]
20588
20589
20590 [section:wait basic_raw_socket::wait]
20591
20592 [indexterm2 boost_asio.indexterm.basic_raw_socket.wait..wait..basic_raw_socket] 
20593 Wait for the socket to become ready to read, ready to write, or to have pending error conditions. 
20594
20595
20596   void ``[link boost_asio.reference.basic_raw_socket.wait.overload1 wait]``(
20597       wait_type w);
20598   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.wait.overload1 more...]]``
20599
20600   void ``[link boost_asio.reference.basic_raw_socket.wait.overload2 wait]``(
20601       wait_type w,
20602       boost::system::error_code & ec);
20603   ``  [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.wait.overload2 more...]]``
20604
20605
20606 [section:overload1 basic_raw_socket::wait (1 of 2 overloads)]
20607
20608
20609 ['Inherited from basic_socket.]
20610
20611
20612 Wait for the socket to become ready to read, ready to write, or to have pending error conditions. 
20613
20614
20615   void wait(
20616       wait_type w);
20617
20618
20619 This function is used to perform a blocking wait for a socket to enter a ready to read, write or error condition state.
20620
20621
20622 [heading Parameters]
20623     
20624
20625 [variablelist
20626   
20627 [[w][Specifies the desired socket state.]]
20628
20629 ]
20630
20631
20632 [heading Example]
20633   
20634 Waiting for a socket to become readable. 
20635
20636    boost::asio::ip::tcp::socket socket(my_context);
20637    ...
20638    socket.wait(boost::asio::ip::tcp::socket::wait_read);
20639
20640
20641
20642
20643
20644
20645
20646 [endsect]
20647
20648
20649
20650 [section:overload2 basic_raw_socket::wait (2 of 2 overloads)]
20651
20652
20653 ['Inherited from basic_socket.]
20654
20655
20656 Wait for the socket to become ready to read, ready to write, or to have pending error conditions. 
20657
20658
20659   void wait(
20660       wait_type w,
20661       boost::system::error_code & ec);
20662
20663
20664 This function is used to perform a blocking wait for a socket to enter a ready to read, write or error condition state.
20665
20666
20667 [heading Parameters]
20668     
20669
20670 [variablelist
20671   
20672 [[w][Specifies the desired socket state.]]
20673
20674 [[ec][Set to indicate what error occurred, if any.]]
20675
20676 ]
20677
20678
20679 [heading Example]
20680   
20681 Waiting for a socket to become readable. 
20682
20683    boost::asio::ip::tcp::socket socket(my_context);
20684    ...
20685    boost::system::error_code ec;
20686    socket.wait(boost::asio::ip::tcp::socket::wait_read, ec);
20687
20688
20689
20690
20691
20692
20693
20694 [endsect]
20695
20696
20697 [endsect]
20698
20699
20700 [section:wait_type basic_raw_socket::wait_type]
20701
20702
20703 ['Inherited from socket_base.]
20704
20705 [indexterm2 boost_asio.indexterm.basic_raw_socket.wait_type..wait_type..basic_raw_socket] 
20706 Wait types. 
20707
20708
20709   enum wait_type
20710
20711 [indexterm2 boost_asio.indexterm.basic_raw_socket.wait_type.wait_read..wait_read..basic_raw_socket]
20712 [indexterm2 boost_asio.indexterm.basic_raw_socket.wait_type.wait_write..wait_write..basic_raw_socket]
20713 [indexterm2 boost_asio.indexterm.basic_raw_socket.wait_type.wait_error..wait_error..basic_raw_socket]
20714
20715 [heading Values]
20716 [variablelist
20717
20718   [
20719     [wait_read]
20720     [Wait for a socket to become ready to read. ]
20721   ]
20722
20723   [
20724     [wait_write]
20725     [Wait for a socket to become ready to write. ]
20726   ]
20727
20728   [
20729     [wait_error]
20730     [Wait for a socket to have error conditions pending. ]
20731   ]
20732
20733 ]
20734
20735
20736 For use with `basic_socket::wait()` and `basic_socket::async_wait()`. 
20737
20738
20739 [endsect]
20740
20741
20742
20743 [section:_basic_raw_socket basic_raw_socket::~basic_raw_socket]
20744
20745 [indexterm2 boost_asio.indexterm.basic_raw_socket._basic_raw_socket..~basic_raw_socket..basic_raw_socket] 
20746 Destroys the socket. 
20747
20748
20749   ~basic_raw_socket();
20750
20751
20752 This function destroys the socket, cancelling any outstanding asynchronous operations associated with the socket as if by calling `cancel`. 
20753
20754
20755 [endsect]
20756
20757
20758
20759 [endsect]
20760
20761 [section:basic_raw_socket__rebind_executor basic_raw_socket::rebind_executor]
20762
20763
20764 Rebinds the socket type to another executor. 
20765
20766
20767   template<
20768       typename ``[link boost_asio.reference.Executor1 Executor1]``>
20769   struct rebind_executor
20770
20771
20772 [heading Types]
20773 [table
20774   [[Name][Description]]
20775
20776   [
20777
20778     [[link boost_asio.reference.basic_raw_socket__rebind_executor.other [*other]]]
20779     [The socket type when rebound to the specified executor. ]
20780   
20781   ]
20782
20783 ]
20784
20785 [heading Requirements]
20786
20787 ['Header: ][^boost/asio/basic_raw_socket.hpp]
20788
20789 ['Convenience header: ][^boost/asio.hpp]
20790
20791
20792 [section:other basic_raw_socket::rebind_executor::other]
20793
20794 [indexterm2 boost_asio.indexterm.basic_raw_socket__rebind_executor.other..other..basic_raw_socket::rebind_executor] 
20795 The socket type when rebound to the specified executor. 
20796
20797
20798   typedef basic_raw_socket< Protocol, Executor1 > other;
20799
20800
20801 [heading Types]
20802 [table
20803   [[Name][Description]]
20804
20805   [
20806
20807     [[link boost_asio.reference.basic_raw_socket__rebind_executor [*rebind_executor]]]
20808     [Rebinds the socket type to another executor. ]
20809   
20810   ]
20811
20812   [
20813
20814     [[link boost_asio.reference.basic_raw_socket.broadcast [*broadcast]]]
20815     [Socket option to permit sending of broadcast messages. ]
20816   
20817   ]
20818
20819   [
20820
20821     [[link boost_asio.reference.basic_raw_socket.bytes_readable [*bytes_readable]]]
20822     [IO control command to get the amount of data that can be read without blocking. ]
20823   
20824   ]
20825
20826   [
20827
20828     [[link boost_asio.reference.basic_raw_socket.debug [*debug]]]
20829     [Socket option to enable socket-level debugging. ]
20830   
20831   ]
20832
20833   [
20834
20835     [[link boost_asio.reference.basic_raw_socket.do_not_route [*do_not_route]]]
20836     [Socket option to prevent routing, use local interfaces only. ]
20837   
20838   ]
20839
20840   [
20841
20842     [[link boost_asio.reference.basic_raw_socket.enable_connection_aborted [*enable_connection_aborted]]]
20843     [Socket option to report aborted connections on accept. ]
20844   
20845   ]
20846
20847   [
20848
20849     [[link boost_asio.reference.basic_raw_socket.endpoint_type [*endpoint_type]]]
20850     [The endpoint type. ]
20851   
20852   ]
20853
20854   [
20855
20856     [[link boost_asio.reference.basic_raw_socket.executor_type [*executor_type]]]
20857     [The type of the executor associated with the object. ]
20858   
20859   ]
20860
20861   [
20862
20863     [[link boost_asio.reference.basic_raw_socket.keep_alive [*keep_alive]]]
20864     [Socket option to send keep-alives. ]
20865   
20866   ]
20867
20868   [
20869
20870     [[link boost_asio.reference.basic_raw_socket.linger [*linger]]]
20871     [Socket option to specify whether the socket lingers on close if unsent data is present. ]
20872   
20873   ]
20874
20875   [
20876
20877     [[link boost_asio.reference.basic_raw_socket.lowest_layer_type [*lowest_layer_type]]]
20878     [A basic_socket is always the lowest layer. ]
20879   
20880   ]
20881
20882   [
20883
20884     [[link boost_asio.reference.basic_raw_socket.message_flags [*message_flags]]]
20885     [Bitmask type for flags that can be passed to send and receive operations. ]
20886   
20887   ]
20888
20889   [
20890
20891     [[link boost_asio.reference.basic_raw_socket.native_handle_type [*native_handle_type]]]
20892     [The native representation of a socket. ]
20893   
20894   ]
20895
20896   [
20897
20898     [[link boost_asio.reference.basic_raw_socket.out_of_band_inline [*out_of_band_inline]]]
20899     [Socket option for putting received out-of-band data inline. ]
20900   
20901   ]
20902
20903   [
20904
20905     [[link boost_asio.reference.basic_raw_socket.protocol_type [*protocol_type]]]
20906     [The protocol type. ]
20907   
20908   ]
20909
20910   [
20911
20912     [[link boost_asio.reference.basic_raw_socket.receive_buffer_size [*receive_buffer_size]]]
20913     [Socket option for the receive buffer size of a socket. ]
20914   
20915   ]
20916
20917   [
20918
20919     [[link boost_asio.reference.basic_raw_socket.receive_low_watermark [*receive_low_watermark]]]
20920     [Socket option for the receive low watermark. ]
20921   
20922   ]
20923
20924   [
20925
20926     [[link boost_asio.reference.basic_raw_socket.reuse_address [*reuse_address]]]
20927     [Socket option to allow the socket to be bound to an address that is already in use. ]
20928   
20929   ]
20930
20931   [
20932
20933     [[link boost_asio.reference.basic_raw_socket.send_buffer_size [*send_buffer_size]]]
20934     [Socket option for the send buffer size of a socket. ]
20935   
20936   ]
20937
20938   [
20939
20940     [[link boost_asio.reference.basic_raw_socket.send_low_watermark [*send_low_watermark]]]
20941     [Socket option for the send low watermark. ]
20942   
20943   ]
20944
20945   [
20946
20947     [[link boost_asio.reference.basic_raw_socket.shutdown_type [*shutdown_type]]]
20948     [Different ways a socket may be shutdown. ]
20949   
20950   ]
20951
20952   [
20953
20954     [[link boost_asio.reference.basic_raw_socket.wait_type [*wait_type]]]
20955     [Wait types. ]
20956   
20957   ]
20958
20959 ]
20960
20961 [heading Member Functions]
20962 [table
20963   [[Name][Description]]
20964
20965   [
20966     [[link boost_asio.reference.basic_raw_socket.assign [*assign]]]
20967     [Assign an existing native socket to the socket. ]
20968   ]
20969   
20970   [
20971     [[link boost_asio.reference.basic_raw_socket.async_connect [*async_connect]]]
20972     [Start an asynchronous connect. ]
20973   ]
20974   
20975   [
20976     [[link boost_asio.reference.basic_raw_socket.async_receive [*async_receive]]]
20977     [Start an asynchronous receive on a connected socket. ]
20978   ]
20979   
20980   [
20981     [[link boost_asio.reference.basic_raw_socket.async_receive_from [*async_receive_from]]]
20982     [Start an asynchronous receive. ]
20983   ]
20984   
20985   [
20986     [[link boost_asio.reference.basic_raw_socket.async_send [*async_send]]]
20987     [Start an asynchronous send on a connected socket. ]
20988   ]
20989   
20990   [
20991     [[link boost_asio.reference.basic_raw_socket.async_send_to [*async_send_to]]]
20992     [Start an asynchronous send. ]
20993   ]
20994   
20995   [
20996     [[link boost_asio.reference.basic_raw_socket.async_wait [*async_wait]]]
20997     [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
20998   ]
20999   
21000   [
21001     [[link boost_asio.reference.basic_raw_socket.at_mark [*at_mark]]]
21002     [Determine whether the socket is at the out-of-band data mark. ]
21003   ]
21004   
21005   [
21006     [[link boost_asio.reference.basic_raw_socket.available [*available]]]
21007     [Determine the number of bytes available for reading. ]
21008   ]
21009   
21010   [
21011     [[link boost_asio.reference.basic_raw_socket.basic_raw_socket [*basic_raw_socket]]]
21012     [Construct a basic_raw_socket without opening it. 
21013      [hr]
21014      Construct and open a basic_raw_socket. 
21015      [hr]
21016      Construct a basic_raw_socket, opening it and binding it to the given local endpoint. 
21017      [hr]
21018      Construct a basic_raw_socket on an existing native socket. 
21019      [hr]
21020      Move-construct a basic_raw_socket from another. 
21021      [hr]
21022      Move-construct a basic_raw_socket from a socket of another protocol type. ]
21023   ]
21024   
21025   [
21026     [[link boost_asio.reference.basic_raw_socket.bind [*bind]]]
21027     [Bind the socket to the given local endpoint. ]
21028   ]
21029   
21030   [
21031     [[link boost_asio.reference.basic_raw_socket.cancel [*cancel]]]
21032     [Cancel all asynchronous operations associated with the socket. ]
21033   ]
21034   
21035   [
21036     [[link boost_asio.reference.basic_raw_socket.close [*close]]]
21037     [Close the socket. ]
21038   ]
21039   
21040   [
21041     [[link boost_asio.reference.basic_raw_socket.connect [*connect]]]
21042     [Connect the socket to the specified endpoint. ]
21043   ]
21044   
21045   [
21046     [[link boost_asio.reference.basic_raw_socket.get_executor [*get_executor]]]
21047     [Get the executor associated with the object. ]
21048   ]
21049   
21050   [
21051     [[link boost_asio.reference.basic_raw_socket.get_option [*get_option]]]
21052     [Get an option from the socket. ]
21053   ]
21054   
21055   [
21056     [[link boost_asio.reference.basic_raw_socket.io_control [*io_control]]]
21057     [Perform an IO control command on the socket. ]
21058   ]
21059   
21060   [
21061     [[link boost_asio.reference.basic_raw_socket.is_open [*is_open]]]
21062     [Determine whether the socket is open. ]
21063   ]
21064   
21065   [
21066     [[link boost_asio.reference.basic_raw_socket.local_endpoint [*local_endpoint]]]
21067     [Get the local endpoint of the socket. ]
21068   ]
21069   
21070   [
21071     [[link boost_asio.reference.basic_raw_socket.lowest_layer [*lowest_layer]]]
21072     [Get a reference to the lowest layer. 
21073      [hr]
21074      Get a const reference to the lowest layer. ]
21075   ]
21076   
21077   [
21078     [[link boost_asio.reference.basic_raw_socket.native_handle [*native_handle]]]
21079     [Get the native socket representation. ]
21080   ]
21081   
21082   [
21083     [[link boost_asio.reference.basic_raw_socket.native_non_blocking [*native_non_blocking]]]
21084     [Gets the non-blocking mode of the native socket implementation. 
21085      [hr]
21086      Sets the non-blocking mode of the native socket implementation. ]
21087   ]
21088   
21089   [
21090     [[link boost_asio.reference.basic_raw_socket.non_blocking [*non_blocking]]]
21091     [Gets the non-blocking mode of the socket. 
21092      [hr]
21093      Sets the non-blocking mode of the socket. ]
21094   ]
21095   
21096   [
21097     [[link boost_asio.reference.basic_raw_socket.open [*open]]]
21098     [Open the socket using the specified protocol. ]
21099   ]
21100   
21101   [
21102     [[link boost_asio.reference.basic_raw_socket.operator_eq_ [*operator=]]]
21103     [Move-assign a basic_raw_socket from another. 
21104      [hr]
21105      Move-assign a basic_raw_socket from a socket of another protocol type. ]
21106   ]
21107   
21108   [
21109     [[link boost_asio.reference.basic_raw_socket.receive [*receive]]]
21110     [Receive some data on a connected socket. ]
21111   ]
21112   
21113   [
21114     [[link boost_asio.reference.basic_raw_socket.receive_from [*receive_from]]]
21115     [Receive raw data with the endpoint of the sender. ]
21116   ]
21117   
21118   [
21119     [[link boost_asio.reference.basic_raw_socket.release [*release]]]
21120     [Release ownership of the underlying native socket. ]
21121   ]
21122   
21123   [
21124     [[link boost_asio.reference.basic_raw_socket.remote_endpoint [*remote_endpoint]]]
21125     [Get the remote endpoint of the socket. ]
21126   ]
21127   
21128   [
21129     [[link boost_asio.reference.basic_raw_socket.send [*send]]]
21130     [Send some data on a connected socket. ]
21131   ]
21132   
21133   [
21134     [[link boost_asio.reference.basic_raw_socket.send_to [*send_to]]]
21135     [Send raw data to the specified endpoint. ]
21136   ]
21137   
21138   [
21139     [[link boost_asio.reference.basic_raw_socket.set_option [*set_option]]]
21140     [Set an option on the socket. ]
21141   ]
21142   
21143   [
21144     [[link boost_asio.reference.basic_raw_socket.shutdown [*shutdown]]]
21145     [Disable sends or receives on the socket. ]
21146   ]
21147   
21148   [
21149     [[link boost_asio.reference.basic_raw_socket.wait [*wait]]]
21150     [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
21151   ]
21152   
21153   [
21154     [[link boost_asio.reference.basic_raw_socket._basic_raw_socket [*~basic_raw_socket]]]
21155     [Destroys the socket. ]
21156   ]
21157   
21158 ]
21159
21160 [heading Data Members]
21161 [table
21162   [[Name][Description]]
21163
21164   [
21165     [[link boost_asio.reference.basic_raw_socket.max_connections [*max_connections]]]
21166     [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
21167   ]
21168
21169   [
21170     [[link boost_asio.reference.basic_raw_socket.max_listen_connections [*max_listen_connections]]]
21171     [The maximum length of the queue of pending incoming connections. ]
21172   ]
21173
21174   [
21175     [[link boost_asio.reference.basic_raw_socket.message_do_not_route [*message_do_not_route]]]
21176     [Specify that the data should not be subject to routing. ]
21177   ]
21178
21179   [
21180     [[link boost_asio.reference.basic_raw_socket.message_end_of_record [*message_end_of_record]]]
21181     [Specifies that the data marks the end of a record. ]
21182   ]
21183
21184   [
21185     [[link boost_asio.reference.basic_raw_socket.message_out_of_band [*message_out_of_band]]]
21186     [Process out-of-band data. ]
21187   ]
21188
21189   [
21190     [[link boost_asio.reference.basic_raw_socket.message_peek [*message_peek]]]
21191     [Peek at incoming data without removing it from the input queue. ]
21192   ]
21193
21194 ]
21195
21196 [heading Protected Data Members]
21197 [table
21198   [[Name][Description]]
21199
21200   [
21201     [[link boost_asio.reference.basic_raw_socket.impl_ [*impl_]]]
21202     []
21203   ]
21204
21205 ]
21206
21207 The [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] class template provides asynchronous and blocking raw-oriented socket functionality.
21208
21209
21210 [heading Thread Safety]
21211   
21212 ['Distinct] ['objects:] Safe.
21213
21214 ['Shared] ['objects:] Unsafe. 
21215
21216
21217
21218
21219 [heading Requirements]
21220
21221 ['Header: ][^boost/asio/basic_raw_socket.hpp]
21222
21223 ['Convenience header: ][^boost/asio.hpp]
21224
21225
21226 [endsect]
21227
21228
21229
21230 [endsect]
21231
21232 [section:basic_seq_packet_socket basic_seq_packet_socket]
21233
21234
21235 Provides sequenced packet socket functionality. 
21236
21237
21238   template<
21239       typename ``[link boost_asio.reference.Protocol Protocol]``,
21240       typename ``[link boost_asio.reference.Executor1 Executor]``>
21241   class basic_seq_packet_socket :
21242     public basic_socket< Protocol, Executor >
21243
21244
21245 [heading Types]
21246 [table
21247   [[Name][Description]]
21248
21249   [
21250
21251     [[link boost_asio.reference.basic_seq_packet_socket__rebind_executor [*rebind_executor]]]
21252     [Rebinds the socket type to another executor. ]
21253   
21254   ]
21255
21256   [
21257
21258     [[link boost_asio.reference.basic_seq_packet_socket.broadcast [*broadcast]]]
21259     [Socket option to permit sending of broadcast messages. ]
21260   
21261   ]
21262
21263   [
21264
21265     [[link boost_asio.reference.basic_seq_packet_socket.bytes_readable [*bytes_readable]]]
21266     [IO control command to get the amount of data that can be read without blocking. ]
21267   
21268   ]
21269
21270   [
21271
21272     [[link boost_asio.reference.basic_seq_packet_socket.debug [*debug]]]
21273     [Socket option to enable socket-level debugging. ]
21274   
21275   ]
21276
21277   [
21278
21279     [[link boost_asio.reference.basic_seq_packet_socket.do_not_route [*do_not_route]]]
21280     [Socket option to prevent routing, use local interfaces only. ]
21281   
21282   ]
21283
21284   [
21285
21286     [[link boost_asio.reference.basic_seq_packet_socket.enable_connection_aborted [*enable_connection_aborted]]]
21287     [Socket option to report aborted connections on accept. ]
21288   
21289   ]
21290
21291   [
21292
21293     [[link boost_asio.reference.basic_seq_packet_socket.endpoint_type [*endpoint_type]]]
21294     [The endpoint type. ]
21295   
21296   ]
21297
21298   [
21299
21300     [[link boost_asio.reference.basic_seq_packet_socket.executor_type [*executor_type]]]
21301     [The type of the executor associated with the object. ]
21302   
21303   ]
21304
21305   [
21306
21307     [[link boost_asio.reference.basic_seq_packet_socket.keep_alive [*keep_alive]]]
21308     [Socket option to send keep-alives. ]
21309   
21310   ]
21311
21312   [
21313
21314     [[link boost_asio.reference.basic_seq_packet_socket.linger [*linger]]]
21315     [Socket option to specify whether the socket lingers on close if unsent data is present. ]
21316   
21317   ]
21318
21319   [
21320
21321     [[link boost_asio.reference.basic_seq_packet_socket.lowest_layer_type [*lowest_layer_type]]]
21322     [A basic_socket is always the lowest layer. ]
21323   
21324   ]
21325
21326   [
21327
21328     [[link boost_asio.reference.basic_seq_packet_socket.message_flags [*message_flags]]]
21329     [Bitmask type for flags that can be passed to send and receive operations. ]
21330   
21331   ]
21332
21333   [
21334
21335     [[link boost_asio.reference.basic_seq_packet_socket.native_handle_type [*native_handle_type]]]
21336     [The native representation of a socket. ]
21337   
21338   ]
21339
21340   [
21341
21342     [[link boost_asio.reference.basic_seq_packet_socket.out_of_band_inline [*out_of_band_inline]]]
21343     [Socket option for putting received out-of-band data inline. ]
21344   
21345   ]
21346
21347   [
21348
21349     [[link boost_asio.reference.basic_seq_packet_socket.protocol_type [*protocol_type]]]
21350     [The protocol type. ]
21351   
21352   ]
21353
21354   [
21355
21356     [[link boost_asio.reference.basic_seq_packet_socket.receive_buffer_size [*receive_buffer_size]]]
21357     [Socket option for the receive buffer size of a socket. ]
21358   
21359   ]
21360
21361   [
21362
21363     [[link boost_asio.reference.basic_seq_packet_socket.receive_low_watermark [*receive_low_watermark]]]
21364     [Socket option for the receive low watermark. ]
21365   
21366   ]
21367
21368   [
21369
21370     [[link boost_asio.reference.basic_seq_packet_socket.reuse_address [*reuse_address]]]
21371     [Socket option to allow the socket to be bound to an address that is already in use. ]
21372   
21373   ]
21374
21375   [
21376
21377     [[link boost_asio.reference.basic_seq_packet_socket.send_buffer_size [*send_buffer_size]]]
21378     [Socket option for the send buffer size of a socket. ]
21379   
21380   ]
21381
21382   [
21383
21384     [[link boost_asio.reference.basic_seq_packet_socket.send_low_watermark [*send_low_watermark]]]
21385     [Socket option for the send low watermark. ]
21386   
21387   ]
21388
21389   [
21390
21391     [[link boost_asio.reference.basic_seq_packet_socket.shutdown_type [*shutdown_type]]]
21392     [Different ways a socket may be shutdown. ]
21393   
21394   ]
21395
21396   [
21397
21398     [[link boost_asio.reference.basic_seq_packet_socket.wait_type [*wait_type]]]
21399     [Wait types. ]
21400   
21401   ]
21402
21403 ]
21404
21405 [heading Member Functions]
21406 [table
21407   [[Name][Description]]
21408
21409   [
21410     [[link boost_asio.reference.basic_seq_packet_socket.assign [*assign]]]
21411     [Assign an existing native socket to the socket. ]
21412   ]
21413   
21414   [
21415     [[link boost_asio.reference.basic_seq_packet_socket.async_connect [*async_connect]]]
21416     [Start an asynchronous connect. ]
21417   ]
21418   
21419   [
21420     [[link boost_asio.reference.basic_seq_packet_socket.async_receive [*async_receive]]]
21421     [Start an asynchronous receive. ]
21422   ]
21423   
21424   [
21425     [[link boost_asio.reference.basic_seq_packet_socket.async_send [*async_send]]]
21426     [Start an asynchronous send. ]
21427   ]
21428   
21429   [
21430     [[link boost_asio.reference.basic_seq_packet_socket.async_wait [*async_wait]]]
21431     [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
21432   ]
21433   
21434   [
21435     [[link boost_asio.reference.basic_seq_packet_socket.at_mark [*at_mark]]]
21436     [Determine whether the socket is at the out-of-band data mark. ]
21437   ]
21438   
21439   [
21440     [[link boost_asio.reference.basic_seq_packet_socket.available [*available]]]
21441     [Determine the number of bytes available for reading. ]
21442   ]
21443   
21444   [
21445     [[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket [*basic_seq_packet_socket]]]
21446     [Construct a basic_seq_packet_socket without opening it. 
21447      [hr]
21448      Construct and open a basic_seq_packet_socket. 
21449      [hr]
21450      Construct a basic_seq_packet_socket, opening it and binding it to the given local endpoint. 
21451      [hr]
21452      Construct a basic_seq_packet_socket on an existing native socket. 
21453      [hr]
21454      Move-construct a basic_seq_packet_socket from another. 
21455      [hr]
21456      Move-construct a basic_seq_packet_socket from a socket of another protocol type. ]
21457   ]
21458   
21459   [
21460     [[link boost_asio.reference.basic_seq_packet_socket.bind [*bind]]]
21461     [Bind the socket to the given local endpoint. ]
21462   ]
21463   
21464   [
21465     [[link boost_asio.reference.basic_seq_packet_socket.cancel [*cancel]]]
21466     [Cancel all asynchronous operations associated with the socket. ]
21467   ]
21468   
21469   [
21470     [[link boost_asio.reference.basic_seq_packet_socket.close [*close]]]
21471     [Close the socket. ]
21472   ]
21473   
21474   [
21475     [[link boost_asio.reference.basic_seq_packet_socket.connect [*connect]]]
21476     [Connect the socket to the specified endpoint. ]
21477   ]
21478   
21479   [
21480     [[link boost_asio.reference.basic_seq_packet_socket.get_executor [*get_executor]]]
21481     [Get the executor associated with the object. ]
21482   ]
21483   
21484   [
21485     [[link boost_asio.reference.basic_seq_packet_socket.get_option [*get_option]]]
21486     [Get an option from the socket. ]
21487   ]
21488   
21489   [
21490     [[link boost_asio.reference.basic_seq_packet_socket.io_control [*io_control]]]
21491     [Perform an IO control command on the socket. ]
21492   ]
21493   
21494   [
21495     [[link boost_asio.reference.basic_seq_packet_socket.is_open [*is_open]]]
21496     [Determine whether the socket is open. ]
21497   ]
21498   
21499   [
21500     [[link boost_asio.reference.basic_seq_packet_socket.local_endpoint [*local_endpoint]]]
21501     [Get the local endpoint of the socket. ]
21502   ]
21503   
21504   [
21505     [[link boost_asio.reference.basic_seq_packet_socket.lowest_layer [*lowest_layer]]]
21506     [Get a reference to the lowest layer. 
21507      [hr]
21508      Get a const reference to the lowest layer. ]
21509   ]
21510   
21511   [
21512     [[link boost_asio.reference.basic_seq_packet_socket.native_handle [*native_handle]]]
21513     [Get the native socket representation. ]
21514   ]
21515   
21516   [
21517     [[link boost_asio.reference.basic_seq_packet_socket.native_non_blocking [*native_non_blocking]]]
21518     [Gets the non-blocking mode of the native socket implementation. 
21519      [hr]
21520      Sets the non-blocking mode of the native socket implementation. ]
21521   ]
21522   
21523   [
21524     [[link boost_asio.reference.basic_seq_packet_socket.non_blocking [*non_blocking]]]
21525     [Gets the non-blocking mode of the socket. 
21526      [hr]
21527      Sets the non-blocking mode of the socket. ]
21528   ]
21529   
21530   [
21531     [[link boost_asio.reference.basic_seq_packet_socket.open [*open]]]
21532     [Open the socket using the specified protocol. ]
21533   ]
21534   
21535   [
21536     [[link boost_asio.reference.basic_seq_packet_socket.operator_eq_ [*operator=]]]
21537     [Move-assign a basic_seq_packet_socket from another. 
21538      [hr]
21539      Move-assign a basic_seq_packet_socket from a socket of another protocol type. ]
21540   ]
21541   
21542   [
21543     [[link boost_asio.reference.basic_seq_packet_socket.receive [*receive]]]
21544     [Receive some data on the socket. 
21545      [hr]
21546      Receive some data on a connected socket. ]
21547   ]
21548   
21549   [
21550     [[link boost_asio.reference.basic_seq_packet_socket.release [*release]]]
21551     [Release ownership of the underlying native socket. ]
21552   ]
21553   
21554   [
21555     [[link boost_asio.reference.basic_seq_packet_socket.remote_endpoint [*remote_endpoint]]]
21556     [Get the remote endpoint of the socket. ]
21557   ]
21558   
21559   [
21560     [[link boost_asio.reference.basic_seq_packet_socket.send [*send]]]
21561     [Send some data on the socket. ]
21562   ]
21563   
21564   [
21565     [[link boost_asio.reference.basic_seq_packet_socket.set_option [*set_option]]]
21566     [Set an option on the socket. ]
21567   ]
21568   
21569   [
21570     [[link boost_asio.reference.basic_seq_packet_socket.shutdown [*shutdown]]]
21571     [Disable sends or receives on the socket. ]
21572   ]
21573   
21574   [
21575     [[link boost_asio.reference.basic_seq_packet_socket.wait [*wait]]]
21576     [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
21577   ]
21578   
21579   [
21580     [[link boost_asio.reference.basic_seq_packet_socket._basic_seq_packet_socket [*~basic_seq_packet_socket]]]
21581     [Destroys the socket. ]
21582   ]
21583   
21584 ]
21585
21586 [heading Data Members]
21587 [table
21588   [[Name][Description]]
21589
21590   [
21591     [[link boost_asio.reference.basic_seq_packet_socket.max_connections [*max_connections]]]
21592     [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
21593   ]
21594
21595   [
21596     [[link boost_asio.reference.basic_seq_packet_socket.max_listen_connections [*max_listen_connections]]]
21597     [The maximum length of the queue of pending incoming connections. ]
21598   ]
21599
21600   [
21601     [[link boost_asio.reference.basic_seq_packet_socket.message_do_not_route [*message_do_not_route]]]
21602     [Specify that the data should not be subject to routing. ]
21603   ]
21604
21605   [
21606     [[link boost_asio.reference.basic_seq_packet_socket.message_end_of_record [*message_end_of_record]]]
21607     [Specifies that the data marks the end of a record. ]
21608   ]
21609
21610   [
21611     [[link boost_asio.reference.basic_seq_packet_socket.message_out_of_band [*message_out_of_band]]]
21612     [Process out-of-band data. ]
21613   ]
21614
21615   [
21616     [[link boost_asio.reference.basic_seq_packet_socket.message_peek [*message_peek]]]
21617     [Peek at incoming data without removing it from the input queue. ]
21618   ]
21619
21620 ]
21621
21622 [heading Protected Data Members]
21623 [table
21624   [[Name][Description]]
21625
21626   [
21627     [[link boost_asio.reference.basic_seq_packet_socket.impl_ [*impl_]]]
21628     []
21629   ]
21630
21631 ]
21632
21633 The [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] class template provides asynchronous and blocking sequenced packet socket functionality.
21634
21635
21636 [heading Thread Safety]
21637   
21638 ['Distinct] ['objects:] Safe.
21639
21640 ['Shared] ['objects:] Unsafe. 
21641
21642
21643
21644 [heading Requirements]
21645
21646 ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
21647
21648 ['Convenience header: ][^boost/asio.hpp]
21649
21650 [section:assign basic_seq_packet_socket::assign]
21651
21652 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.assign..assign..basic_seq_packet_socket] 
21653 Assign an existing native socket to the socket. 
21654
21655
21656   void ``[link boost_asio.reference.basic_seq_packet_socket.assign.overload1 assign]``(
21657       const protocol_type & protocol,
21658       const native_handle_type & native_socket);
21659   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.assign.overload1 more...]]``
21660
21661   void ``[link boost_asio.reference.basic_seq_packet_socket.assign.overload2 assign]``(
21662       const protocol_type & protocol,
21663       const native_handle_type & native_socket,
21664       boost::system::error_code & ec);
21665   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.assign.overload2 more...]]``
21666
21667
21668 [section:overload1 basic_seq_packet_socket::assign (1 of 2 overloads)]
21669
21670
21671 ['Inherited from basic_socket.]
21672
21673
21674 Assign an existing native socket to the socket. 
21675
21676
21677   void assign(
21678       const protocol_type & protocol,
21679       const native_handle_type & native_socket);
21680
21681
21682
21683 [endsect]
21684
21685
21686
21687 [section:overload2 basic_seq_packet_socket::assign (2 of 2 overloads)]
21688
21689
21690 ['Inherited from basic_socket.]
21691
21692
21693 Assign an existing native socket to the socket. 
21694
21695
21696   void assign(
21697       const protocol_type & protocol,
21698       const native_handle_type & native_socket,
21699       boost::system::error_code & ec);
21700
21701
21702
21703 [endsect]
21704
21705
21706 [endsect]
21707
21708
21709 [section:async_connect basic_seq_packet_socket::async_connect]
21710
21711
21712 ['Inherited from basic_socket.]
21713
21714 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.async_connect..async_connect..basic_seq_packet_socket] 
21715 Start an asynchronous connect. 
21716
21717
21718   template<
21719       typename ``[link boost_asio.reference.ConnectHandler ConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
21720   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect(
21721       const endpoint_type & peer_endpoint,
21722       ConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
21723
21724
21725 This function is used to asynchronously connect a socket to the specified remote endpoint. The function call always returns immediately.
21726
21727 The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
21728
21729
21730 [heading Parameters]
21731     
21732
21733 [variablelist
21734   
21735 [[peer_endpoint][The remote endpoint to which the socket will be connected. Copies will be made of the endpoint object as required.]]
21736
21737 [[handler][The handler to be called when the connection operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
21738 ``
21739    void handler(
21740      const boost::system::error_code& error // Result of operation
21741    ); 
21742 ``
21743 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
21744
21745 ]
21746
21747
21748 [heading Example]
21749   
21750
21751
21752    void connect_handler(const boost::system::error_code& error)
21753    {
21754      if (!error)
21755      {
21756        // Connect succeeded.
21757      }
21758    }
21759
21760    ...
21761
21762    boost::asio::ip::tcp::socket socket(my_context);
21763    boost::asio::ip::tcp::endpoint endpoint(
21764        boost::asio::ip::address::from_string("1.2.3.4"), 12345);
21765    socket.async_connect(endpoint, connect_handler);
21766
21767
21768
21769
21770
21771
21772
21773 [endsect]
21774
21775
21776 [section:async_receive basic_seq_packet_socket::async_receive]
21777
21778 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.async_receive..async_receive..basic_seq_packet_socket] 
21779 Start an asynchronous receive. 
21780
21781
21782   template<
21783       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
21784       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
21785   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_seq_packet_socket.async_receive.overload1 async_receive]``(
21786       const MutableBufferSequence & buffers,
21787       socket_base::message_flags & out_flags,
21788       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
21789   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.async_receive.overload1 more...]]``
21790
21791   template<
21792       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
21793       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
21794   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_seq_packet_socket.async_receive.overload2 async_receive]``(
21795       const MutableBufferSequence & buffers,
21796       socket_base::message_flags in_flags,
21797       socket_base::message_flags & out_flags,
21798       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
21799   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.async_receive.overload2 more...]]``
21800
21801
21802 [section:overload1 basic_seq_packet_socket::async_receive (1 of 2 overloads)]
21803
21804
21805 Start an asynchronous receive. 
21806
21807
21808   template<
21809       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
21810       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
21811   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive(
21812       const MutableBufferSequence & buffers,
21813       socket_base::message_flags & out_flags,
21814       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
21815
21816
21817 This function is used to asynchronously receive data from the sequenced packet socket. The function call always returns immediately.
21818
21819
21820 [heading Parameters]
21821     
21822
21823 [variablelist
21824   
21825 [[buffers][One or more buffers into which the data will be received. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
21826
21827 [[out_flags][Once the asynchronous operation completes, contains flags associated with the received data. For example, if the `socket_base::message_end_of_record` bit is set then the received data marks the end of a record. The caller must guarantee that the referenced variable remains valid until the handler is called.]]
21828
21829 [[handler][The handler to be called when the receive operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
21830 ``
21831    void handler(
21832      const boost::system::error_code& error, // Result of operation.
21833      std::size_t bytes_transferred           // Number of bytes received.
21834    ); 
21835 ``
21836 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
21837
21838 ]
21839
21840
21841 [heading Example]
21842   
21843 To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
21844
21845    socket.async_receive(boost::asio::buffer(data, size), out_flags, handler);
21846
21847
21848 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
21849
21850
21851
21852
21853 [endsect]
21854
21855
21856
21857 [section:overload2 basic_seq_packet_socket::async_receive (2 of 2 overloads)]
21858
21859
21860 Start an asynchronous receive. 
21861
21862
21863   template<
21864       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
21865       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
21866   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive(
21867       const MutableBufferSequence & buffers,
21868       socket_base::message_flags in_flags,
21869       socket_base::message_flags & out_flags,
21870       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
21871
21872
21873 This function is used to asynchronously receive data from the sequenced data socket. The function call always returns immediately.
21874
21875
21876 [heading Parameters]
21877     
21878
21879 [variablelist
21880   
21881 [[buffers][One or more buffers into which the data will be received. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
21882
21883 [[in_flags][Flags specifying how the receive call is to be made.]]
21884
21885 [[out_flags][Once the asynchronous operation completes, contains flags associated with the received data. For example, if the `socket_base::message_end_of_record` bit is set then the received data marks the end of a record. The caller must guarantee that the referenced variable remains valid until the handler is called.]]
21886
21887 [[handler][The handler to be called when the receive operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
21888 ``
21889    void handler(
21890      const boost::system::error_code& error, // Result of operation.
21891      std::size_t bytes_transferred           // Number of bytes received.
21892    ); 
21893 ``
21894 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
21895
21896 ]
21897
21898
21899 [heading Example]
21900   
21901 To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
21902
21903    socket.async_receive(
21904        boost::asio::buffer(data, size),
21905        0, out_flags, handler);
21906
21907
21908 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
21909
21910
21911
21912
21913 [endsect]
21914
21915
21916 [endsect]
21917
21918
21919 [section:async_send basic_seq_packet_socket::async_send]
21920
21921 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.async_send..async_send..basic_seq_packet_socket] 
21922 Start an asynchronous send. 
21923
21924
21925   template<
21926       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
21927       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
21928   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send(
21929       const ConstBufferSequence & buffers,
21930       socket_base::message_flags flags,
21931       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
21932
21933
21934 This function is used to asynchronously send data on the sequenced packet socket. The function call always returns immediately.
21935
21936
21937 [heading Parameters]
21938     
21939
21940 [variablelist
21941   
21942 [[buffers][One or more data buffers to be sent on the socket. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
21943
21944 [[flags][Flags specifying how the send call is to be made.]]
21945
21946 [[handler][The handler to be called when the send operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
21947 ``
21948    void handler(
21949      const boost::system::error_code& error, // Result of operation.
21950      std::size_t bytes_transferred           // Number of bytes sent.
21951    ); 
21952 ``
21953 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
21954
21955 ]
21956
21957
21958 [heading Example]
21959   
21960 To send a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
21961
21962    socket.async_send(boost::asio::buffer(data, size), 0, handler);
21963
21964
21965 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
21966
21967
21968
21969
21970 [endsect]
21971
21972
21973
21974 [section:async_wait basic_seq_packet_socket::async_wait]
21975
21976
21977 ['Inherited from basic_socket.]
21978
21979 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.async_wait..async_wait..basic_seq_packet_socket] 
21980 Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. 
21981
21982
21983   template<
21984       typename ``[link boost_asio.reference.WaitHandler WaitHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
21985   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait(
21986       wait_type w,
21987       WaitHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
21988
21989
21990 This function is used to perform an asynchronous wait for a socket to enter a ready to read, write or error condition state.
21991
21992
21993 [heading Parameters]
21994     
21995
21996 [variablelist
21997   
21998 [[w][Specifies the desired socket state.]]
21999
22000 [[handler][The handler to be called when the wait operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
22001 ``
22002    void handler(
22003      const boost::system::error_code& error // Result of operation
22004    ); 
22005 ``
22006 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
22007
22008 ]
22009
22010
22011 [heading Example]
22012   
22013
22014
22015    void wait_handler(const boost::system::error_code& error)
22016    {
22017      if (!error)
22018      {
22019        // Wait succeeded.
22020      }
22021    }
22022
22023    ...
22024
22025    boost::asio::ip::tcp::socket socket(my_context);
22026    ...
22027    socket.async_wait(boost::asio::ip::tcp::socket::wait_read, wait_handler);
22028
22029
22030
22031
22032
22033
22034
22035 [endsect]
22036
22037
22038 [section:at_mark basic_seq_packet_socket::at_mark]
22039
22040 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.at_mark..at_mark..basic_seq_packet_socket] 
22041 Determine whether the socket is at the out-of-band data mark. 
22042
22043
22044   bool ``[link boost_asio.reference.basic_seq_packet_socket.at_mark.overload1 at_mark]``() const;
22045   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.at_mark.overload1 more...]]``
22046
22047   bool ``[link boost_asio.reference.basic_seq_packet_socket.at_mark.overload2 at_mark]``(
22048       boost::system::error_code & ec) const;
22049   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.at_mark.overload2 more...]]``
22050
22051
22052 [section:overload1 basic_seq_packet_socket::at_mark (1 of 2 overloads)]
22053
22054
22055 ['Inherited from basic_socket.]
22056
22057
22058 Determine whether the socket is at the out-of-band data mark. 
22059
22060
22061   bool at_mark() const;
22062
22063
22064 This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
22065
22066
22067 [heading Return Value]
22068       
22069 A bool indicating whether the socket is at the out-of-band data mark.
22070
22071
22072 [heading Exceptions]
22073     
22074
22075 [variablelist
22076   
22077 [[boost::system::system_error][Thrown on failure. ]]
22078
22079 ]
22080
22081
22082
22083
22084 [endsect]
22085
22086
22087
22088 [section:overload2 basic_seq_packet_socket::at_mark (2 of 2 overloads)]
22089
22090
22091 ['Inherited from basic_socket.]
22092
22093
22094 Determine whether the socket is at the out-of-band data mark. 
22095
22096
22097   bool at_mark(
22098       boost::system::error_code & ec) const;
22099
22100
22101 This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
22102
22103
22104 [heading Parameters]
22105     
22106
22107 [variablelist
22108   
22109 [[ec][Set to indicate what error occurred, if any.]]
22110
22111 ]
22112
22113
22114 [heading Return Value]
22115       
22116 A bool indicating whether the socket is at the out-of-band data mark. 
22117
22118
22119
22120
22121 [endsect]
22122
22123
22124 [endsect]
22125
22126 [section:available basic_seq_packet_socket::available]
22127
22128 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.available..available..basic_seq_packet_socket] 
22129 Determine the number of bytes available for reading. 
22130
22131
22132   std::size_t ``[link boost_asio.reference.basic_seq_packet_socket.available.overload1 available]``() const;
22133   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.available.overload1 more...]]``
22134
22135   std::size_t ``[link boost_asio.reference.basic_seq_packet_socket.available.overload2 available]``(
22136       boost::system::error_code & ec) const;
22137   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.available.overload2 more...]]``
22138
22139
22140 [section:overload1 basic_seq_packet_socket::available (1 of 2 overloads)]
22141
22142
22143 ['Inherited from basic_socket.]
22144
22145
22146 Determine the number of bytes available for reading. 
22147
22148
22149   std::size_t available() const;
22150
22151
22152 This function is used to determine the number of bytes that may be read without blocking.
22153
22154
22155 [heading Return Value]
22156       
22157 The number of bytes that may be read without blocking, or 0 if an error occurs.
22158
22159
22160 [heading Exceptions]
22161     
22162
22163 [variablelist
22164   
22165 [[boost::system::system_error][Thrown on failure. ]]
22166
22167 ]
22168
22169
22170
22171
22172 [endsect]
22173
22174
22175
22176 [section:overload2 basic_seq_packet_socket::available (2 of 2 overloads)]
22177
22178
22179 ['Inherited from basic_socket.]
22180
22181
22182 Determine the number of bytes available for reading. 
22183
22184
22185   std::size_t available(
22186       boost::system::error_code & ec) const;
22187
22188
22189 This function is used to determine the number of bytes that may be read without blocking.
22190
22191
22192 [heading Parameters]
22193     
22194
22195 [variablelist
22196   
22197 [[ec][Set to indicate what error occurred, if any.]]
22198
22199 ]
22200
22201
22202 [heading Return Value]
22203       
22204 The number of bytes that may be read without blocking, or 0 if an error occurs. 
22205
22206
22207
22208
22209 [endsect]
22210
22211
22212 [endsect]
22213
22214 [section:basic_seq_packet_socket basic_seq_packet_socket::basic_seq_packet_socket]
22215
22216 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.basic_seq_packet_socket..basic_seq_packet_socket..basic_seq_packet_socket] 
22217 Construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] without opening it. 
22218
22219
22220   explicit ``[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload1 basic_seq_packet_socket]``(
22221       const executor_type & ex);
22222   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload1 more...]]``
22223
22224   template<
22225       typename ExecutionContext>
22226   explicit ``[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload2 basic_seq_packet_socket]``(
22227       ExecutionContext & context,
22228       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
22229   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload2 more...]]``
22230
22231
22232 Construct and open a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`]. 
22233
22234
22235   ``[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload3 basic_seq_packet_socket]``(
22236       const executor_type & ex,
22237       const protocol_type & protocol);
22238   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload3 more...]]``
22239
22240   template<
22241       typename ExecutionContext>
22242   ``[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload4 basic_seq_packet_socket]``(
22243       ExecutionContext & context,
22244       const protocol_type & protocol,
22245       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
22246   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload4 more...]]``
22247
22248
22249 Construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`], opening it and binding it to the given local endpoint. 
22250
22251
22252   ``[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload5 basic_seq_packet_socket]``(
22253       const executor_type & ex,
22254       const endpoint_type & endpoint);
22255   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload5 more...]]``
22256
22257   template<
22258       typename ExecutionContext>
22259   ``[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload6 basic_seq_packet_socket]``(
22260       ExecutionContext & context,
22261       const endpoint_type & endpoint,
22262       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
22263   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload6 more...]]``
22264
22265
22266 Construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] on an existing native socket. 
22267
22268
22269   ``[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload7 basic_seq_packet_socket]``(
22270       const executor_type & ex,
22271       const protocol_type & protocol,
22272       const native_handle_type & native_socket);
22273   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload7 more...]]``
22274
22275   template<
22276       typename ExecutionContext>
22277   ``[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload8 basic_seq_packet_socket]``(
22278       ExecutionContext & context,
22279       const protocol_type & protocol,
22280       const native_handle_type & native_socket,
22281       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
22282   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload8 more...]]``
22283
22284
22285 Move-construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] from another. 
22286
22287
22288   ``[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload9 basic_seq_packet_socket]``(
22289       basic_seq_packet_socket && other);
22290   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload9 more...]]``
22291
22292
22293 Move-construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] from a socket of another protocol type. 
22294
22295
22296   template<
22297       typename ``[link boost_asio.reference.Protocol Protocol1]``,
22298       typename ``[link boost_asio.reference.Executor1 Executor1]``>
22299   ``[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload10 basic_seq_packet_socket]``(
22300       basic_seq_packet_socket< Protocol1, Executor1 > && other,
22301       typename enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type *  = 0);
22302   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload10 more...]]``
22303
22304
22305 [section:overload1 basic_seq_packet_socket::basic_seq_packet_socket (1 of 10 overloads)]
22306
22307
22308 Construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] without opening it. 
22309
22310
22311   basic_seq_packet_socket(
22312       const executor_type & ex);
22313
22314
22315 This constructor creates a sequenced packet socket without opening it. The socket needs to be opened and then connected or accepted before data can be sent or received on it.
22316
22317
22318 [heading Parameters]
22319     
22320
22321 [variablelist
22322   
22323 [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket. ]]
22324
22325 ]
22326
22327
22328
22329
22330 [endsect]
22331
22332
22333
22334 [section:overload2 basic_seq_packet_socket::basic_seq_packet_socket (2 of 10 overloads)]
22335
22336
22337 Construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] without opening it. 
22338
22339
22340   template<
22341       typename ExecutionContext>
22342   basic_seq_packet_socket(
22343       ExecutionContext & context,
22344       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
22345
22346
22347 This constructor creates a sequenced packet socket without opening it. The socket needs to be opened and then connected or accepted before data can be sent or received on it.
22348
22349
22350 [heading Parameters]
22351     
22352
22353 [variablelist
22354   
22355 [[context][An execution context which provides the I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket. ]]
22356
22357 ]
22358
22359
22360
22361
22362 [endsect]
22363
22364
22365
22366 [section:overload3 basic_seq_packet_socket::basic_seq_packet_socket (3 of 10 overloads)]
22367
22368
22369 Construct and open a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`]. 
22370
22371
22372   basic_seq_packet_socket(
22373       const executor_type & ex,
22374       const protocol_type & protocol);
22375
22376
22377 This constructor creates and opens a sequenced\_packet socket. The socket needs to be connected or accepted before data can be sent or received on it.
22378
22379
22380 [heading Parameters]
22381     
22382
22383 [variablelist
22384   
22385 [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
22386
22387 [[protocol][An object specifying protocol parameters to be used.]]
22388
22389 ]
22390
22391
22392 [heading Exceptions]
22393     
22394
22395 [variablelist
22396   
22397 [[boost::system::system_error][Thrown on failure. ]]
22398
22399 ]
22400
22401
22402
22403
22404 [endsect]
22405
22406
22407
22408 [section:overload4 basic_seq_packet_socket::basic_seq_packet_socket (4 of 10 overloads)]
22409
22410
22411 Construct and open a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`]. 
22412
22413
22414   template<
22415       typename ExecutionContext>
22416   basic_seq_packet_socket(
22417       ExecutionContext & context,
22418       const protocol_type & protocol,
22419       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
22420
22421
22422 This constructor creates and opens a sequenced\_packet socket. The socket needs to be connected or accepted before data can be sent or received on it.
22423
22424
22425 [heading Parameters]
22426     
22427
22428 [variablelist
22429   
22430 [[context][An execution context which provides the I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
22431
22432 [[protocol][An object specifying protocol parameters to be used.]]
22433
22434 ]
22435
22436
22437 [heading Exceptions]
22438     
22439
22440 [variablelist
22441   
22442 [[boost::system::system_error][Thrown on failure. ]]
22443
22444 ]
22445
22446
22447
22448
22449 [endsect]
22450
22451
22452
22453 [section:overload5 basic_seq_packet_socket::basic_seq_packet_socket (5 of 10 overloads)]
22454
22455
22456 Construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`], opening it and binding it to the given local endpoint. 
22457
22458
22459   basic_seq_packet_socket(
22460       const executor_type & ex,
22461       const endpoint_type & endpoint);
22462
22463
22464 This constructor creates a sequenced packet 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.
22465
22466
22467 [heading Parameters]
22468     
22469
22470 [variablelist
22471   
22472 [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
22473
22474 [[endpoint][An endpoint on the local machine to which the sequenced packet socket will be bound.]]
22475
22476 ]
22477
22478
22479 [heading Exceptions]
22480     
22481
22482 [variablelist
22483   
22484 [[boost::system::system_error][Thrown on failure. ]]
22485
22486 ]
22487
22488
22489
22490
22491 [endsect]
22492
22493
22494
22495 [section:overload6 basic_seq_packet_socket::basic_seq_packet_socket (6 of 10 overloads)]
22496
22497
22498 Construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`], opening it and binding it to the given local endpoint. 
22499
22500
22501   template<
22502       typename ExecutionContext>
22503   basic_seq_packet_socket(
22504       ExecutionContext & context,
22505       const endpoint_type & endpoint,
22506       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
22507
22508
22509 This constructor creates a sequenced packet 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.
22510
22511
22512 [heading Parameters]
22513     
22514
22515 [variablelist
22516   
22517 [[context][An execution context which provides the I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
22518
22519 [[endpoint][An endpoint on the local machine to which the sequenced packet socket will be bound.]]
22520
22521 ]
22522
22523
22524 [heading Exceptions]
22525     
22526
22527 [variablelist
22528   
22529 [[boost::system::system_error][Thrown on failure. ]]
22530
22531 ]
22532
22533
22534
22535
22536 [endsect]
22537
22538
22539
22540 [section:overload7 basic_seq_packet_socket::basic_seq_packet_socket (7 of 10 overloads)]
22541
22542
22543 Construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] on an existing native socket. 
22544
22545
22546   basic_seq_packet_socket(
22547       const executor_type & ex,
22548       const protocol_type & protocol,
22549       const native_handle_type & native_socket);
22550
22551
22552 This constructor creates a sequenced packet socket object to hold an existing native socket.
22553
22554
22555 [heading Parameters]
22556     
22557
22558 [variablelist
22559   
22560 [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
22561
22562 [[protocol][An object specifying protocol parameters to be used.]]
22563
22564 [[native_socket][The new underlying socket implementation.]]
22565
22566 ]
22567
22568
22569 [heading Exceptions]
22570     
22571
22572 [variablelist
22573   
22574 [[boost::system::system_error][Thrown on failure. ]]
22575
22576 ]
22577
22578
22579
22580
22581 [endsect]
22582
22583
22584
22585 [section:overload8 basic_seq_packet_socket::basic_seq_packet_socket (8 of 10 overloads)]
22586
22587
22588 Construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] on an existing native socket. 
22589
22590
22591   template<
22592       typename ExecutionContext>
22593   basic_seq_packet_socket(
22594       ExecutionContext & context,
22595       const protocol_type & protocol,
22596       const native_handle_type & native_socket,
22597       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
22598
22599
22600 This constructor creates a sequenced packet socket object to hold an existing native socket.
22601
22602
22603 [heading Parameters]
22604     
22605
22606 [variablelist
22607   
22608 [[context][An execution context which provides the I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
22609
22610 [[protocol][An object specifying protocol parameters to be used.]]
22611
22612 [[native_socket][The new underlying socket implementation.]]
22613
22614 ]
22615
22616
22617 [heading Exceptions]
22618     
22619
22620 [variablelist
22621   
22622 [[boost::system::system_error][Thrown on failure. ]]
22623
22624 ]
22625
22626
22627
22628
22629 [endsect]
22630
22631
22632
22633 [section:overload9 basic_seq_packet_socket::basic_seq_packet_socket (9 of 10 overloads)]
22634
22635
22636 Move-construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] from another. 
22637
22638
22639   basic_seq_packet_socket(
22640       basic_seq_packet_socket && other);
22641
22642
22643 This constructor moves a sequenced packet socket from one object to another.
22644
22645
22646 [heading Parameters]
22647     
22648
22649 [variablelist
22650   
22651 [[other][The other [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] object from which the move will occur.]]
22652
22653 ]
22654
22655
22656 [heading Remarks]
22657       
22658 Following the move, the moved-from object is in the same state as if constructed using the `basic_seq_packet_socket(const executor_type&)` constructor. 
22659
22660
22661
22662
22663 [endsect]
22664
22665
22666
22667 [section:overload10 basic_seq_packet_socket::basic_seq_packet_socket (10 of 10 overloads)]
22668
22669
22670 Move-construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] from a socket of another protocol type. 
22671
22672
22673   template<
22674       typename ``[link boost_asio.reference.Protocol Protocol1]``,
22675       typename ``[link boost_asio.reference.Executor1 Executor1]``>
22676   basic_seq_packet_socket(
22677       basic_seq_packet_socket< Protocol1, Executor1 > && other,
22678       typename enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type *  = 0);
22679
22680
22681 This constructor moves a sequenced packet socket from one object to another.
22682
22683
22684 [heading Parameters]
22685     
22686
22687 [variablelist
22688   
22689 [[other][The other [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] object from which the move will occur.]]
22690
22691 ]
22692
22693
22694 [heading Remarks]
22695       
22696 Following the move, the moved-from object is in the same state as if constructed using the `basic_seq_packet_socket(const executor_type&)` constructor. 
22697
22698
22699
22700
22701 [endsect]
22702
22703
22704 [endsect]
22705
22706 [section:bind basic_seq_packet_socket::bind]
22707
22708 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.bind..bind..basic_seq_packet_socket] 
22709 Bind the socket to the given local endpoint. 
22710
22711
22712   void ``[link boost_asio.reference.basic_seq_packet_socket.bind.overload1 bind]``(
22713       const endpoint_type & endpoint);
22714   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.bind.overload1 more...]]``
22715
22716   void ``[link boost_asio.reference.basic_seq_packet_socket.bind.overload2 bind]``(
22717       const endpoint_type & endpoint,
22718       boost::system::error_code & ec);
22719   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.bind.overload2 more...]]``
22720
22721
22722 [section:overload1 basic_seq_packet_socket::bind (1 of 2 overloads)]
22723
22724
22725 ['Inherited from basic_socket.]
22726
22727
22728 Bind the socket to the given local endpoint. 
22729
22730
22731   void bind(
22732       const endpoint_type & endpoint);
22733
22734
22735 This function binds the socket to the specified endpoint on the local machine.
22736
22737
22738 [heading Parameters]
22739     
22740
22741 [variablelist
22742   
22743 [[endpoint][An endpoint on the local machine to which the socket will be bound.]]
22744
22745 ]
22746
22747
22748 [heading Exceptions]
22749     
22750
22751 [variablelist
22752   
22753 [[boost::system::system_error][Thrown on failure.]]
22754
22755 ]
22756
22757
22758 [heading Example]
22759   
22760
22761
22762    boost::asio::ip::tcp::socket socket(my_context);
22763    socket.open(boost::asio::ip::tcp::v4());
22764    socket.bind(boost::asio::ip::tcp::endpoint(
22765          boost::asio::ip::tcp::v4(), 12345));
22766
22767
22768
22769
22770
22771
22772
22773 [endsect]
22774
22775
22776
22777 [section:overload2 basic_seq_packet_socket::bind (2 of 2 overloads)]
22778
22779
22780 ['Inherited from basic_socket.]
22781
22782
22783 Bind the socket to the given local endpoint. 
22784
22785
22786   void bind(
22787       const endpoint_type & endpoint,
22788       boost::system::error_code & ec);
22789
22790
22791 This function binds the socket to the specified endpoint on the local machine.
22792
22793
22794 [heading Parameters]
22795     
22796
22797 [variablelist
22798   
22799 [[endpoint][An endpoint on the local machine to which the socket will be bound.]]
22800
22801 [[ec][Set to indicate what error occurred, if any.]]
22802
22803 ]
22804
22805
22806 [heading Example]
22807   
22808
22809
22810    boost::asio::ip::tcp::socket socket(my_context);
22811    socket.open(boost::asio::ip::tcp::v4());
22812    boost::system::error_code ec;
22813    socket.bind(boost::asio::ip::tcp::endpoint(
22814          boost::asio::ip::tcp::v4(), 12345), ec);
22815    if (ec)
22816    {
22817      // An error occurred.
22818    }
22819
22820
22821
22822
22823
22824
22825
22826 [endsect]
22827
22828
22829 [endsect]
22830
22831
22832 [section:broadcast basic_seq_packet_socket::broadcast]
22833
22834
22835 ['Inherited from socket_base.]
22836
22837 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.broadcast..broadcast..basic_seq_packet_socket] 
22838 Socket option to permit sending of broadcast messages. 
22839
22840
22841   typedef implementation_defined broadcast;
22842
22843
22844
22845 Implements the SOL\_SOCKET/SO\_BROADCAST socket option.
22846
22847
22848 [heading Examples]
22849   
22850 Setting the option: 
22851
22852    boost::asio::ip::udp::socket socket(my_context);
22853    ...
22854    boost::asio::socket_base::broadcast option(true);
22855    socket.set_option(option);
22856
22857
22858
22859
22860
22861 Getting the current option value: 
22862
22863    boost::asio::ip::udp::socket socket(my_context);
22864    ...
22865    boost::asio::socket_base::broadcast option;
22866    socket.get_option(option);
22867    bool is_set = option.value();
22868
22869
22870
22871
22872
22873
22874
22875 [heading Requirements]
22876
22877 ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
22878
22879 ['Convenience header: ][^boost/asio.hpp]
22880
22881
22882 [endsect]
22883
22884
22885
22886 [section:bytes_readable basic_seq_packet_socket::bytes_readable]
22887
22888
22889 ['Inherited from socket_base.]
22890
22891 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.bytes_readable..bytes_readable..basic_seq_packet_socket] 
22892 IO control command to get the amount of data that can be read without blocking. 
22893
22894
22895   typedef implementation_defined bytes_readable;
22896
22897
22898
22899 Implements the FIONREAD IO control command.
22900
22901
22902 [heading Example]
22903   
22904
22905
22906    boost::asio::ip::tcp::socket socket(my_context);
22907    ...
22908    boost::asio::socket_base::bytes_readable command(true);
22909    socket.io_control(command);
22910    std::size_t bytes_readable = command.get();
22911
22912
22913
22914
22915
22916
22917
22918 [heading Requirements]
22919
22920 ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
22921
22922 ['Convenience header: ][^boost/asio.hpp]
22923
22924
22925 [endsect]
22926
22927
22928 [section:cancel basic_seq_packet_socket::cancel]
22929
22930 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.cancel..cancel..basic_seq_packet_socket] 
22931 Cancel all asynchronous operations associated with the socket. 
22932
22933
22934   void ``[link boost_asio.reference.basic_seq_packet_socket.cancel.overload1 cancel]``();
22935   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.cancel.overload1 more...]]``
22936
22937   void ``[link boost_asio.reference.basic_seq_packet_socket.cancel.overload2 cancel]``(
22938       boost::system::error_code & ec);
22939   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.cancel.overload2 more...]]``
22940
22941
22942 [section:overload1 basic_seq_packet_socket::cancel (1 of 2 overloads)]
22943
22944
22945 ['Inherited from basic_socket.]
22946
22947
22948 Cancel all asynchronous operations associated with the socket. 
22949
22950
22951   void cancel();
22952
22953
22954 This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
22955
22956
22957 [heading Exceptions]
22958     
22959
22960 [variablelist
22961   
22962 [[boost::system::system_error][Thrown on failure.]]
22963
22964 ]
22965
22966
22967 [heading Remarks]
22968       
22969 Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use:
22970
22971
22972 * It will only cancel asynchronous operations that were initiated in the current thread.
22973
22974
22975 * It can appear to complete without error, but the request to cancel the unfinished operations may be silently ignored by the operating system. Whether it works or not seems to depend on the drivers that are installed.
22976
22977 For portable cancellation, consider using one of the following alternatives:
22978
22979
22980 * Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP.
22981
22982
22983 * Use the `close()` function to simultaneously cancel the outstanding operations and close the socket.
22984
22985 When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above. 
22986
22987
22988 [endsect]
22989
22990
22991
22992 [section:overload2 basic_seq_packet_socket::cancel (2 of 2 overloads)]
22993
22994
22995 ['Inherited from basic_socket.]
22996
22997
22998 Cancel all asynchronous operations associated with the socket. 
22999
23000
23001   void cancel(
23002       boost::system::error_code & ec);
23003
23004
23005 This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
23006
23007
23008 [heading Parameters]
23009     
23010
23011 [variablelist
23012   
23013 [[ec][Set to indicate what error occurred, if any.]]
23014
23015 ]
23016
23017
23018 [heading Remarks]
23019       
23020 Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use:
23021
23022
23023 * It will only cancel asynchronous operations that were initiated in the current thread.
23024
23025
23026 * It can appear to complete without error, but the request to cancel the unfinished operations may be silently ignored by the operating system. Whether it works or not seems to depend on the drivers that are installed.
23027
23028 For portable cancellation, consider using one of the following alternatives:
23029
23030
23031 * Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP.
23032
23033
23034 * Use the `close()` function to simultaneously cancel the outstanding operations and close the socket.
23035
23036 When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above. 
23037
23038
23039 [endsect]
23040
23041
23042 [endsect]
23043
23044 [section:close basic_seq_packet_socket::close]
23045
23046 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.close..close..basic_seq_packet_socket] 
23047 Close the socket. 
23048
23049
23050   void ``[link boost_asio.reference.basic_seq_packet_socket.close.overload1 close]``();
23051   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.close.overload1 more...]]``
23052
23053   void ``[link boost_asio.reference.basic_seq_packet_socket.close.overload2 close]``(
23054       boost::system::error_code & ec);
23055   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.close.overload2 more...]]``
23056
23057
23058 [section:overload1 basic_seq_packet_socket::close (1 of 2 overloads)]
23059
23060
23061 ['Inherited from basic_socket.]
23062
23063
23064 Close the socket. 
23065
23066
23067   void close();
23068
23069
23070 This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
23071
23072
23073 [heading Exceptions]
23074     
23075
23076 [variablelist
23077   
23078 [[boost::system::system_error][Thrown on failure. Note that, even if the function indicates an error, the underlying descriptor is closed.]]
23079
23080 ]
23081
23082
23083 [heading Remarks]
23084       
23085 For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket. 
23086
23087
23088
23089
23090 [endsect]
23091
23092
23093
23094 [section:overload2 basic_seq_packet_socket::close (2 of 2 overloads)]
23095
23096
23097 ['Inherited from basic_socket.]
23098
23099
23100 Close the socket. 
23101
23102
23103   void close(
23104       boost::system::error_code & ec);
23105
23106
23107 This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
23108
23109
23110 [heading Parameters]
23111     
23112
23113 [variablelist
23114   
23115 [[ec][Set to indicate what error occurred, if any. Note that, even if the function indicates an error, the underlying descriptor is closed.]]
23116
23117 ]
23118
23119
23120 [heading Example]
23121   
23122
23123
23124    boost::asio::ip::tcp::socket socket(my_context);
23125    ...
23126    boost::system::error_code ec;
23127    socket.close(ec);
23128    if (ec)
23129    {
23130      // An error occurred.
23131    }
23132
23133
23134
23135
23136
23137 [heading Remarks]
23138       
23139 For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket. 
23140
23141
23142
23143
23144 [endsect]
23145
23146
23147 [endsect]
23148
23149 [section:connect basic_seq_packet_socket::connect]
23150
23151 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.connect..connect..basic_seq_packet_socket] 
23152 Connect the socket to the specified endpoint. 
23153
23154
23155   void ``[link boost_asio.reference.basic_seq_packet_socket.connect.overload1 connect]``(
23156       const endpoint_type & peer_endpoint);
23157   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.connect.overload1 more...]]``
23158
23159   void ``[link boost_asio.reference.basic_seq_packet_socket.connect.overload2 connect]``(
23160       const endpoint_type & peer_endpoint,
23161       boost::system::error_code & ec);
23162   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.connect.overload2 more...]]``
23163
23164
23165 [section:overload1 basic_seq_packet_socket::connect (1 of 2 overloads)]
23166
23167
23168 ['Inherited from basic_socket.]
23169
23170
23171 Connect the socket to the specified endpoint. 
23172
23173
23174   void connect(
23175       const endpoint_type & peer_endpoint);
23176
23177
23178 This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs.
23179
23180 The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
23181
23182
23183 [heading Parameters]
23184     
23185
23186 [variablelist
23187   
23188 [[peer_endpoint][The remote endpoint to which the socket will be connected.]]
23189
23190 ]
23191
23192
23193 [heading Exceptions]
23194     
23195
23196 [variablelist
23197   
23198 [[boost::system::system_error][Thrown on failure.]]
23199
23200 ]
23201
23202
23203 [heading Example]
23204   
23205
23206
23207    boost::asio::ip::tcp::socket socket(my_context);
23208    boost::asio::ip::tcp::endpoint endpoint(
23209        boost::asio::ip::address::from_string("1.2.3.4"), 12345);
23210    socket.connect(endpoint);
23211
23212
23213
23214
23215
23216
23217
23218 [endsect]
23219
23220
23221
23222 [section:overload2 basic_seq_packet_socket::connect (2 of 2 overloads)]
23223
23224
23225 ['Inherited from basic_socket.]
23226
23227
23228 Connect the socket to the specified endpoint. 
23229
23230
23231   void connect(
23232       const endpoint_type & peer_endpoint,
23233       boost::system::error_code & ec);
23234
23235
23236 This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs.
23237
23238 The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
23239
23240
23241 [heading Parameters]
23242     
23243
23244 [variablelist
23245   
23246 [[peer_endpoint][The remote endpoint to which the socket will be connected.]]
23247
23248 [[ec][Set to indicate what error occurred, if any.]]
23249
23250 ]
23251
23252
23253 [heading Example]
23254   
23255
23256
23257    boost::asio::ip::tcp::socket socket(my_context);
23258    boost::asio::ip::tcp::endpoint endpoint(
23259        boost::asio::ip::address::from_string("1.2.3.4"), 12345);
23260    boost::system::error_code ec;
23261    socket.connect(endpoint, ec);
23262    if (ec)
23263    {
23264      // An error occurred.
23265    }
23266
23267
23268
23269
23270
23271
23272
23273 [endsect]
23274
23275
23276 [endsect]
23277
23278
23279 [section:debug basic_seq_packet_socket::debug]
23280
23281
23282 ['Inherited from socket_base.]
23283
23284 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.debug..debug..basic_seq_packet_socket] 
23285 Socket option to enable socket-level debugging. 
23286
23287
23288   typedef implementation_defined debug;
23289
23290
23291
23292 Implements the SOL\_SOCKET/SO\_DEBUG socket option.
23293
23294
23295 [heading Examples]
23296   
23297 Setting the option: 
23298
23299    boost::asio::ip::tcp::socket socket(my_context);
23300    ...
23301    boost::asio::socket_base::debug option(true);
23302    socket.set_option(option);
23303
23304
23305
23306
23307
23308 Getting the current option value: 
23309
23310    boost::asio::ip::tcp::socket socket(my_context);
23311    ...
23312    boost::asio::socket_base::debug option;
23313    socket.get_option(option);
23314    bool is_set = option.value();
23315
23316
23317
23318
23319
23320
23321
23322 [heading Requirements]
23323
23324 ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
23325
23326 ['Convenience header: ][^boost/asio.hpp]
23327
23328
23329 [endsect]
23330
23331
23332
23333 [section:do_not_route basic_seq_packet_socket::do_not_route]
23334
23335
23336 ['Inherited from socket_base.]
23337
23338 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.do_not_route..do_not_route..basic_seq_packet_socket] 
23339 Socket option to prevent routing, use local interfaces only. 
23340
23341
23342   typedef implementation_defined do_not_route;
23343
23344
23345
23346 Implements the SOL\_SOCKET/SO\_DONTROUTE socket option.
23347
23348
23349 [heading Examples]
23350   
23351 Setting the option: 
23352
23353    boost::asio::ip::udp::socket socket(my_context);
23354    ...
23355    boost::asio::socket_base::do_not_route option(true);
23356    socket.set_option(option);
23357
23358
23359
23360
23361
23362 Getting the current option value: 
23363
23364    boost::asio::ip::udp::socket socket(my_context);
23365    ...
23366    boost::asio::socket_base::do_not_route option;
23367    socket.get_option(option);
23368    bool is_set = option.value();
23369
23370
23371
23372
23373
23374
23375
23376 [heading Requirements]
23377
23378 ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
23379
23380 ['Convenience header: ][^boost/asio.hpp]
23381
23382
23383 [endsect]
23384
23385
23386
23387 [section:enable_connection_aborted basic_seq_packet_socket::enable_connection_aborted]
23388
23389
23390 ['Inherited from socket_base.]
23391
23392 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.enable_connection_aborted..enable_connection_aborted..basic_seq_packet_socket] 
23393 Socket option to report aborted connections on accept. 
23394
23395
23396   typedef implementation_defined enable_connection_aborted;
23397
23398
23399
23400 Implements a custom socket option that determines whether or not an accept operation is permitted to fail with `boost::asio::error::connection_aborted`. By default the option is false.
23401
23402
23403 [heading Examples]
23404   
23405 Setting the option: 
23406
23407    boost::asio::ip::tcp::acceptor acceptor(my_context);
23408    ...
23409    boost::asio::socket_base::enable_connection_aborted option(true);
23410    acceptor.set_option(option);
23411
23412
23413
23414
23415
23416 Getting the current option value: 
23417
23418    boost::asio::ip::tcp::acceptor acceptor(my_context);
23419    ...
23420    boost::asio::socket_base::enable_connection_aborted option;
23421    acceptor.get_option(option);
23422    bool is_set = option.value();
23423
23424
23425
23426
23427
23428
23429
23430 [heading Requirements]
23431
23432 ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
23433
23434 ['Convenience header: ][^boost/asio.hpp]
23435
23436
23437 [endsect]
23438
23439
23440
23441 [section:endpoint_type basic_seq_packet_socket::endpoint_type]
23442
23443 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.endpoint_type..endpoint_type..basic_seq_packet_socket] 
23444 The endpoint type. 
23445
23446
23447   typedef Protocol::endpoint endpoint_type;
23448
23449
23450
23451 [heading Requirements]
23452
23453 ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
23454
23455 ['Convenience header: ][^boost/asio.hpp]
23456
23457
23458 [endsect]
23459
23460
23461
23462 [section:executor_type basic_seq_packet_socket::executor_type]
23463
23464 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.executor_type..executor_type..basic_seq_packet_socket] 
23465 The type of the executor associated with the object. 
23466
23467
23468   typedef Executor executor_type;
23469
23470
23471
23472 [heading Requirements]
23473
23474 ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
23475
23476 ['Convenience header: ][^boost/asio.hpp]
23477
23478
23479 [endsect]
23480
23481
23482
23483 [section:get_executor basic_seq_packet_socket::get_executor]
23484
23485
23486 ['Inherited from basic_socket.]
23487
23488 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.get_executor..get_executor..basic_seq_packet_socket] 
23489 Get the executor associated with the object. 
23490
23491
23492   executor_type get_executor();
23493
23494
23495
23496 [endsect]
23497
23498
23499 [section:get_option basic_seq_packet_socket::get_option]
23500
23501 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.get_option..get_option..basic_seq_packet_socket] 
23502 Get an option from the socket. 
23503
23504
23505   template<
23506       typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
23507   void ``[link boost_asio.reference.basic_seq_packet_socket.get_option.overload1 get_option]``(
23508       GettableSocketOption & option) const;
23509   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.get_option.overload1 more...]]``
23510
23511   template<
23512       typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
23513   void ``[link boost_asio.reference.basic_seq_packet_socket.get_option.overload2 get_option]``(
23514       GettableSocketOption & option,
23515       boost::system::error_code & ec) const;
23516   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.get_option.overload2 more...]]``
23517
23518
23519 [section:overload1 basic_seq_packet_socket::get_option (1 of 2 overloads)]
23520
23521
23522 ['Inherited from basic_socket.]
23523
23524
23525 Get an option from the socket. 
23526
23527
23528   template<
23529       typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
23530   void get_option(
23531       GettableSocketOption & option) const;
23532
23533
23534 This function is used to get the current value of an option on the socket.
23535
23536
23537 [heading Parameters]
23538     
23539
23540 [variablelist
23541   
23542 [[option][The option value to be obtained from the socket.]]
23543
23544 ]
23545
23546
23547 [heading Exceptions]
23548     
23549
23550 [variablelist
23551   
23552 [[boost::system::system_error][Thrown on failure.]]
23553
23554 ]
23555
23556
23557
23558 [heading Example]
23559   
23560 Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option: 
23561
23562    boost::asio::ip::tcp::socket socket(my_context);
23563    ...
23564    boost::asio::ip::tcp::socket::keep_alive option;
23565    socket.get_option(option);
23566    bool is_set = option.value();
23567
23568
23569
23570
23571
23572
23573
23574 [endsect]
23575
23576
23577
23578 [section:overload2 basic_seq_packet_socket::get_option (2 of 2 overloads)]
23579
23580
23581 ['Inherited from basic_socket.]
23582
23583
23584 Get an option from the socket. 
23585
23586
23587   template<
23588       typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
23589   void get_option(
23590       GettableSocketOption & option,
23591       boost::system::error_code & ec) const;
23592
23593
23594 This function is used to get the current value of an option on the socket.
23595
23596
23597 [heading Parameters]
23598     
23599
23600 [variablelist
23601   
23602 [[option][The option value to be obtained from the socket.]]
23603
23604 [[ec][Set to indicate what error occurred, if any.]]
23605
23606 ]
23607
23608
23609
23610 [heading Example]
23611   
23612 Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option: 
23613
23614    boost::asio::ip::tcp::socket socket(my_context);
23615    ...
23616    boost::asio::ip::tcp::socket::keep_alive option;
23617    boost::system::error_code ec;
23618    socket.get_option(option, ec);
23619    if (ec)
23620    {
23621      // An error occurred.
23622    }
23623    bool is_set = option.value();
23624
23625
23626
23627
23628
23629
23630
23631 [endsect]
23632
23633
23634 [endsect]
23635
23636
23637 [section:impl_ basic_seq_packet_socket::impl_]
23638
23639
23640 ['Inherited from basic_socket.]
23641
23642 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.impl_..impl_..basic_seq_packet_socket] 
23643
23644   detail::io_object_impl< detail::reactive_socket_service< Protocol >, Executor > impl_;
23645
23646
23647
23648 [endsect]
23649
23650
23651 [section:io_control basic_seq_packet_socket::io_control]
23652
23653 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.io_control..io_control..basic_seq_packet_socket] 
23654 Perform an IO control command on the socket. 
23655
23656
23657   template<
23658       typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
23659   void ``[link boost_asio.reference.basic_seq_packet_socket.io_control.overload1 io_control]``(
23660       IoControlCommand & command);
23661   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.io_control.overload1 more...]]``
23662
23663   template<
23664       typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
23665   void ``[link boost_asio.reference.basic_seq_packet_socket.io_control.overload2 io_control]``(
23666       IoControlCommand & command,
23667       boost::system::error_code & ec);
23668   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.io_control.overload2 more...]]``
23669
23670
23671 [section:overload1 basic_seq_packet_socket::io_control (1 of 2 overloads)]
23672
23673
23674 ['Inherited from basic_socket.]
23675
23676
23677 Perform an IO control command on the socket. 
23678
23679
23680   template<
23681       typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
23682   void io_control(
23683       IoControlCommand & command);
23684
23685
23686 This function is used to execute an IO control command on the socket.
23687
23688
23689 [heading Parameters]
23690     
23691
23692 [variablelist
23693   
23694 [[command][The IO control command to be performed on the socket.]]
23695
23696 ]
23697
23698
23699 [heading Exceptions]
23700     
23701
23702 [variablelist
23703   
23704 [[boost::system::system_error][Thrown on failure.]]
23705
23706 ]
23707
23708
23709
23710 [heading Example]
23711   
23712 Getting the number of bytes ready to read: 
23713
23714    boost::asio::ip::tcp::socket socket(my_context);
23715    ...
23716    boost::asio::ip::tcp::socket::bytes_readable command;
23717    socket.io_control(command);
23718    std::size_t bytes_readable = command.get();
23719
23720
23721
23722
23723
23724
23725
23726 [endsect]
23727
23728
23729
23730 [section:overload2 basic_seq_packet_socket::io_control (2 of 2 overloads)]
23731
23732
23733 ['Inherited from basic_socket.]
23734
23735
23736 Perform an IO control command on the socket. 
23737
23738
23739   template<
23740       typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
23741   void io_control(
23742       IoControlCommand & command,
23743       boost::system::error_code & ec);
23744
23745
23746 This function is used to execute an IO control command on the socket.
23747
23748
23749 [heading Parameters]
23750     
23751
23752 [variablelist
23753   
23754 [[command][The IO control command to be performed on the socket.]]
23755
23756 [[ec][Set to indicate what error occurred, if any.]]
23757
23758 ]
23759
23760
23761
23762 [heading Example]
23763   
23764 Getting the number of bytes ready to read: 
23765
23766    boost::asio::ip::tcp::socket socket(my_context);
23767    ...
23768    boost::asio::ip::tcp::socket::bytes_readable command;
23769    boost::system::error_code ec;
23770    socket.io_control(command, ec);
23771    if (ec)
23772    {
23773      // An error occurred.
23774    }
23775    std::size_t bytes_readable = command.get();
23776
23777
23778
23779
23780
23781
23782
23783 [endsect]
23784
23785
23786 [endsect]
23787
23788
23789 [section:is_open basic_seq_packet_socket::is_open]
23790
23791
23792 ['Inherited from basic_socket.]
23793
23794 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.is_open..is_open..basic_seq_packet_socket] 
23795 Determine whether the socket is open. 
23796
23797
23798   bool is_open() const;
23799
23800
23801
23802 [endsect]
23803
23804
23805
23806 [section:keep_alive basic_seq_packet_socket::keep_alive]
23807
23808
23809 ['Inherited from socket_base.]
23810
23811 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.keep_alive..keep_alive..basic_seq_packet_socket] 
23812 Socket option to send keep-alives. 
23813
23814
23815   typedef implementation_defined keep_alive;
23816
23817
23818
23819 Implements the SOL\_SOCKET/SO\_KEEPALIVE socket option.
23820
23821
23822 [heading Examples]
23823   
23824 Setting the option: 
23825
23826    boost::asio::ip::tcp::socket socket(my_context);
23827    ...
23828    boost::asio::socket_base::keep_alive option(true);
23829    socket.set_option(option);
23830
23831
23832
23833
23834
23835 Getting the current option value: 
23836
23837    boost::asio::ip::tcp::socket socket(my_context);
23838    ...
23839    boost::asio::socket_base::keep_alive option;
23840    socket.get_option(option);
23841    bool is_set = option.value();
23842
23843
23844
23845
23846
23847
23848
23849 [heading Requirements]
23850
23851 ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
23852
23853 ['Convenience header: ][^boost/asio.hpp]
23854
23855
23856 [endsect]
23857
23858
23859
23860 [section:linger basic_seq_packet_socket::linger]
23861
23862
23863 ['Inherited from socket_base.]
23864
23865 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.linger..linger..basic_seq_packet_socket] 
23866 Socket option to specify whether the socket lingers on close if unsent data is present. 
23867
23868
23869   typedef implementation_defined linger;
23870
23871
23872
23873 Implements the SOL\_SOCKET/SO\_LINGER socket option.
23874
23875
23876 [heading Examples]
23877   
23878 Setting the option: 
23879
23880    boost::asio::ip::tcp::socket socket(my_context);
23881    ...
23882    boost::asio::socket_base::linger option(true, 30);
23883    socket.set_option(option);
23884
23885
23886
23887
23888
23889 Getting the current option value: 
23890
23891    boost::asio::ip::tcp::socket socket(my_context);
23892    ...
23893    boost::asio::socket_base::linger option;
23894    socket.get_option(option);
23895    bool is_set = option.enabled();
23896    unsigned short timeout = option.timeout();
23897
23898
23899
23900
23901
23902
23903
23904 [heading Requirements]
23905
23906 ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
23907
23908 ['Convenience header: ][^boost/asio.hpp]
23909
23910
23911 [endsect]
23912
23913
23914 [section:local_endpoint basic_seq_packet_socket::local_endpoint]
23915
23916 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.local_endpoint..local_endpoint..basic_seq_packet_socket] 
23917 Get the local endpoint of the socket. 
23918
23919
23920   endpoint_type ``[link boost_asio.reference.basic_seq_packet_socket.local_endpoint.overload1 local_endpoint]``() const;
23921   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.local_endpoint.overload1 more...]]``
23922
23923   endpoint_type ``[link boost_asio.reference.basic_seq_packet_socket.local_endpoint.overload2 local_endpoint]``(
23924       boost::system::error_code & ec) const;
23925   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.local_endpoint.overload2 more...]]``
23926
23927
23928 [section:overload1 basic_seq_packet_socket::local_endpoint (1 of 2 overloads)]
23929
23930
23931 ['Inherited from basic_socket.]
23932
23933
23934 Get the local endpoint of the socket. 
23935
23936
23937   endpoint_type local_endpoint() const;
23938
23939
23940 This function is used to obtain the locally bound endpoint of the socket.
23941
23942
23943 [heading Return Value]
23944       
23945 An object that represents the local endpoint of the socket.
23946
23947
23948 [heading Exceptions]
23949     
23950
23951 [variablelist
23952   
23953 [[boost::system::system_error][Thrown on failure.]]
23954
23955 ]
23956
23957
23958 [heading Example]
23959   
23960
23961
23962    boost::asio::ip::tcp::socket socket(my_context);
23963    ...
23964    boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint();
23965
23966
23967
23968
23969
23970
23971
23972 [endsect]
23973
23974
23975
23976 [section:overload2 basic_seq_packet_socket::local_endpoint (2 of 2 overloads)]
23977
23978
23979 ['Inherited from basic_socket.]
23980
23981
23982 Get the local endpoint of the socket. 
23983
23984
23985   endpoint_type local_endpoint(
23986       boost::system::error_code & ec) const;
23987
23988
23989 This function is used to obtain the locally bound endpoint of the socket.
23990
23991
23992 [heading Parameters]
23993     
23994
23995 [variablelist
23996   
23997 [[ec][Set to indicate what error occurred, if any.]]
23998
23999 ]
24000
24001
24002 [heading Return Value]
24003       
24004 An object that represents the local endpoint of the socket. Returns a default-constructed endpoint object if an error occurred.
24005
24006
24007 [heading Example]
24008   
24009
24010
24011    boost::asio::ip::tcp::socket socket(my_context);
24012    ...
24013    boost::system::error_code ec;
24014    boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint(ec);
24015    if (ec)
24016    {
24017      // An error occurred.
24018    }
24019
24020
24021
24022
24023
24024
24025
24026 [endsect]
24027
24028
24029 [endsect]
24030
24031 [section:lowest_layer basic_seq_packet_socket::lowest_layer]
24032
24033 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.lowest_layer..lowest_layer..basic_seq_packet_socket] 
24034 Get a reference to the lowest layer. 
24035
24036
24037   lowest_layer_type & ``[link boost_asio.reference.basic_seq_packet_socket.lowest_layer.overload1 lowest_layer]``();
24038   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.lowest_layer.overload1 more...]]``
24039
24040
24041 Get a const reference to the lowest layer. 
24042
24043
24044   const lowest_layer_type & ``[link boost_asio.reference.basic_seq_packet_socket.lowest_layer.overload2 lowest_layer]``() const;
24045   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.lowest_layer.overload2 more...]]``
24046
24047
24048 [section:overload1 basic_seq_packet_socket::lowest_layer (1 of 2 overloads)]
24049
24050
24051 ['Inherited from basic_socket.]
24052
24053
24054 Get a reference to the lowest layer. 
24055
24056
24057   lowest_layer_type & lowest_layer();
24058
24059
24060 This function returns a reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself.
24061
24062
24063 [heading Return Value]
24064       
24065 A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 
24066
24067
24068
24069
24070 [endsect]
24071
24072
24073
24074 [section:overload2 basic_seq_packet_socket::lowest_layer (2 of 2 overloads)]
24075
24076
24077 ['Inherited from basic_socket.]
24078
24079
24080 Get a const reference to the lowest layer. 
24081
24082
24083   const lowest_layer_type & lowest_layer() const;
24084
24085
24086 This function returns a const reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself.
24087
24088
24089 [heading Return Value]
24090       
24091 A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 
24092
24093
24094
24095
24096 [endsect]
24097
24098
24099 [endsect]
24100
24101
24102 [section:lowest_layer_type basic_seq_packet_socket::lowest_layer_type]
24103
24104
24105 ['Inherited from basic_socket.]
24106
24107 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.lowest_layer_type..lowest_layer_type..basic_seq_packet_socket] 
24108 A [link boost_asio.reference.basic_socket `basic_socket`] is always the lowest layer. 
24109
24110
24111   typedef basic_socket< Protocol, Executor > lowest_layer_type;
24112
24113
24114 [heading Types]
24115 [table
24116   [[Name][Description]]
24117
24118   [
24119
24120     [[link boost_asio.reference.basic_socket__rebind_executor [*rebind_executor]]]
24121     [Rebinds the socket type to another executor. ]
24122   
24123   ]
24124
24125   [
24126
24127     [[link boost_asio.reference.basic_socket.broadcast [*broadcast]]]
24128     [Socket option to permit sending of broadcast messages. ]
24129   
24130   ]
24131
24132   [
24133
24134     [[link boost_asio.reference.basic_socket.bytes_readable [*bytes_readable]]]
24135     [IO control command to get the amount of data that can be read without blocking. ]
24136   
24137   ]
24138
24139   [
24140
24141     [[link boost_asio.reference.basic_socket.debug [*debug]]]
24142     [Socket option to enable socket-level debugging. ]
24143   
24144   ]
24145
24146   [
24147
24148     [[link boost_asio.reference.basic_socket.do_not_route [*do_not_route]]]
24149     [Socket option to prevent routing, use local interfaces only. ]
24150   
24151   ]
24152
24153   [
24154
24155     [[link boost_asio.reference.basic_socket.enable_connection_aborted [*enable_connection_aborted]]]
24156     [Socket option to report aborted connections on accept. ]
24157   
24158   ]
24159
24160   [
24161
24162     [[link boost_asio.reference.basic_socket.endpoint_type [*endpoint_type]]]
24163     [The endpoint type. ]
24164   
24165   ]
24166
24167   [
24168
24169     [[link boost_asio.reference.basic_socket.executor_type [*executor_type]]]
24170     [The type of the executor associated with the object. ]
24171   
24172   ]
24173
24174   [
24175
24176     [[link boost_asio.reference.basic_socket.keep_alive [*keep_alive]]]
24177     [Socket option to send keep-alives. ]
24178   
24179   ]
24180
24181   [
24182
24183     [[link boost_asio.reference.basic_socket.linger [*linger]]]
24184     [Socket option to specify whether the socket lingers on close if unsent data is present. ]
24185   
24186   ]
24187
24188   [
24189
24190     [[link boost_asio.reference.basic_socket.lowest_layer_type [*lowest_layer_type]]]
24191     [A basic_socket is always the lowest layer. ]
24192   
24193   ]
24194
24195   [
24196
24197     [[link boost_asio.reference.basic_socket.message_flags [*message_flags]]]
24198     [Bitmask type for flags that can be passed to send and receive operations. ]
24199   
24200   ]
24201
24202   [
24203
24204     [[link boost_asio.reference.basic_socket.native_handle_type [*native_handle_type]]]
24205     [The native representation of a socket. ]
24206   
24207   ]
24208
24209   [
24210
24211     [[link boost_asio.reference.basic_socket.out_of_band_inline [*out_of_band_inline]]]
24212     [Socket option for putting received out-of-band data inline. ]
24213   
24214   ]
24215
24216   [
24217
24218     [[link boost_asio.reference.basic_socket.protocol_type [*protocol_type]]]
24219     [The protocol type. ]
24220   
24221   ]
24222
24223   [
24224
24225     [[link boost_asio.reference.basic_socket.receive_buffer_size [*receive_buffer_size]]]
24226     [Socket option for the receive buffer size of a socket. ]
24227   
24228   ]
24229
24230   [
24231
24232     [[link boost_asio.reference.basic_socket.receive_low_watermark [*receive_low_watermark]]]
24233     [Socket option for the receive low watermark. ]
24234   
24235   ]
24236
24237   [
24238
24239     [[link boost_asio.reference.basic_socket.reuse_address [*reuse_address]]]
24240     [Socket option to allow the socket to be bound to an address that is already in use. ]
24241   
24242   ]
24243
24244   [
24245
24246     [[link boost_asio.reference.basic_socket.send_buffer_size [*send_buffer_size]]]
24247     [Socket option for the send buffer size of a socket. ]
24248   
24249   ]
24250
24251   [
24252
24253     [[link boost_asio.reference.basic_socket.send_low_watermark [*send_low_watermark]]]
24254     [Socket option for the send low watermark. ]
24255   
24256   ]
24257
24258   [
24259
24260     [[link boost_asio.reference.basic_socket.shutdown_type [*shutdown_type]]]
24261     [Different ways a socket may be shutdown. ]
24262   
24263   ]
24264
24265   [
24266
24267     [[link boost_asio.reference.basic_socket.wait_type [*wait_type]]]
24268     [Wait types. ]
24269   
24270   ]
24271
24272 ]
24273
24274 [heading Member Functions]
24275 [table
24276   [[Name][Description]]
24277
24278   [
24279     [[link boost_asio.reference.basic_socket.assign [*assign]]]
24280     [Assign an existing native socket to the socket. ]
24281   ]
24282   
24283   [
24284     [[link boost_asio.reference.basic_socket.async_connect [*async_connect]]]
24285     [Start an asynchronous connect. ]
24286   ]
24287   
24288   [
24289     [[link boost_asio.reference.basic_socket.async_wait [*async_wait]]]
24290     [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
24291   ]
24292   
24293   [
24294     [[link boost_asio.reference.basic_socket.at_mark [*at_mark]]]
24295     [Determine whether the socket is at the out-of-band data mark. ]
24296   ]
24297   
24298   [
24299     [[link boost_asio.reference.basic_socket.available [*available]]]
24300     [Determine the number of bytes available for reading. ]
24301   ]
24302   
24303   [
24304     [[link boost_asio.reference.basic_socket.basic_socket [*basic_socket]]]
24305     [Construct a basic_socket without opening it. 
24306      [hr]
24307      Construct and open a basic_socket. 
24308      [hr]
24309      Construct a basic_socket, opening it and binding it to the given local endpoint. 
24310      [hr]
24311      Construct a basic_socket on an existing native socket. 
24312      [hr]
24313      Move-construct a basic_socket from another. 
24314      [hr]
24315      Move-construct a basic_socket from a socket of another protocol type. ]
24316   ]
24317   
24318   [
24319     [[link boost_asio.reference.basic_socket.bind [*bind]]]
24320     [Bind the socket to the given local endpoint. ]
24321   ]
24322   
24323   [
24324     [[link boost_asio.reference.basic_socket.cancel [*cancel]]]
24325     [Cancel all asynchronous operations associated with the socket. ]
24326   ]
24327   
24328   [
24329     [[link boost_asio.reference.basic_socket.close [*close]]]
24330     [Close the socket. ]
24331   ]
24332   
24333   [
24334     [[link boost_asio.reference.basic_socket.connect [*connect]]]
24335     [Connect the socket to the specified endpoint. ]
24336   ]
24337   
24338   [
24339     [[link boost_asio.reference.basic_socket.get_executor [*get_executor]]]
24340     [Get the executor associated with the object. ]
24341   ]
24342   
24343   [
24344     [[link boost_asio.reference.basic_socket.get_option [*get_option]]]
24345     [Get an option from the socket. ]
24346   ]
24347   
24348   [
24349     [[link boost_asio.reference.basic_socket.io_control [*io_control]]]
24350     [Perform an IO control command on the socket. ]
24351   ]
24352   
24353   [
24354     [[link boost_asio.reference.basic_socket.is_open [*is_open]]]
24355     [Determine whether the socket is open. ]
24356   ]
24357   
24358   [
24359     [[link boost_asio.reference.basic_socket.local_endpoint [*local_endpoint]]]
24360     [Get the local endpoint of the socket. ]
24361   ]
24362   
24363   [
24364     [[link boost_asio.reference.basic_socket.lowest_layer [*lowest_layer]]]
24365     [Get a reference to the lowest layer. 
24366      [hr]
24367      Get a const reference to the lowest layer. ]
24368   ]
24369   
24370   [
24371     [[link boost_asio.reference.basic_socket.native_handle [*native_handle]]]
24372     [Get the native socket representation. ]
24373   ]
24374   
24375   [
24376     [[link boost_asio.reference.basic_socket.native_non_blocking [*native_non_blocking]]]
24377     [Gets the non-blocking mode of the native socket implementation. 
24378      [hr]
24379      Sets the non-blocking mode of the native socket implementation. ]
24380   ]
24381   
24382   [
24383     [[link boost_asio.reference.basic_socket.non_blocking [*non_blocking]]]
24384     [Gets the non-blocking mode of the socket. 
24385      [hr]
24386      Sets the non-blocking mode of the socket. ]
24387   ]
24388   
24389   [
24390     [[link boost_asio.reference.basic_socket.open [*open]]]
24391     [Open the socket using the specified protocol. ]
24392   ]
24393   
24394   [
24395     [[link boost_asio.reference.basic_socket.operator_eq_ [*operator=]]]
24396     [Move-assign a basic_socket from another. 
24397      [hr]
24398      Move-assign a basic_socket from a socket of another protocol type. ]
24399   ]
24400   
24401   [
24402     [[link boost_asio.reference.basic_socket.release [*release]]]
24403     [Release ownership of the underlying native socket. ]
24404   ]
24405   
24406   [
24407     [[link boost_asio.reference.basic_socket.remote_endpoint [*remote_endpoint]]]
24408     [Get the remote endpoint of the socket. ]
24409   ]
24410   
24411   [
24412     [[link boost_asio.reference.basic_socket.set_option [*set_option]]]
24413     [Set an option on the socket. ]
24414   ]
24415   
24416   [
24417     [[link boost_asio.reference.basic_socket.shutdown [*shutdown]]]
24418     [Disable sends or receives on the socket. ]
24419   ]
24420   
24421   [
24422     [[link boost_asio.reference.basic_socket.wait [*wait]]]
24423     [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
24424   ]
24425   
24426 ]
24427
24428 [heading Protected Member Functions]
24429 [table
24430   [[Name][Description]]
24431
24432   [
24433     [[link boost_asio.reference.basic_socket._basic_socket [*~basic_socket]]]
24434     [Protected destructor to prevent deletion through this type. ]
24435   ]
24436   
24437 ]
24438
24439 [heading Data Members]
24440 [table
24441   [[Name][Description]]
24442
24443   [
24444     [[link boost_asio.reference.basic_socket.max_connections [*max_connections]]]
24445     [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
24446   ]
24447
24448   [
24449     [[link boost_asio.reference.basic_socket.max_listen_connections [*max_listen_connections]]]
24450     [The maximum length of the queue of pending incoming connections. ]
24451   ]
24452
24453   [
24454     [[link boost_asio.reference.basic_socket.message_do_not_route [*message_do_not_route]]]
24455     [Specify that the data should not be subject to routing. ]
24456   ]
24457
24458   [
24459     [[link boost_asio.reference.basic_socket.message_end_of_record [*message_end_of_record]]]
24460     [Specifies that the data marks the end of a record. ]
24461   ]
24462
24463   [
24464     [[link boost_asio.reference.basic_socket.message_out_of_band [*message_out_of_band]]]
24465     [Process out-of-band data. ]
24466   ]
24467
24468   [
24469     [[link boost_asio.reference.basic_socket.message_peek [*message_peek]]]
24470     [Peek at incoming data without removing it from the input queue. ]
24471   ]
24472
24473 ]
24474
24475 [heading Protected Data Members]
24476 [table
24477   [[Name][Description]]
24478
24479   [
24480     [[link boost_asio.reference.basic_socket.impl_ [*impl_]]]
24481     []
24482   ]
24483
24484 ]
24485
24486 The [link boost_asio.reference.basic_socket `basic_socket`] class template provides functionality that is common to both stream-oriented and datagram-oriented sockets.
24487
24488
24489 [heading Thread Safety]
24490   
24491 ['Distinct] ['objects:] Safe.
24492
24493 ['Shared] ['objects:] Unsafe. 
24494
24495
24496
24497
24498 [heading Requirements]
24499
24500 ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
24501
24502 ['Convenience header: ][^boost/asio.hpp]
24503
24504
24505 [endsect]
24506
24507
24508
24509 [section:max_connections basic_seq_packet_socket::max_connections]
24510
24511
24512 ['Inherited from socket_base.]
24513
24514 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.max_connections..max_connections..basic_seq_packet_socket] 
24515 (Deprecated: Use max\_listen\_connections.) The maximum length of the queue of pending incoming connections. 
24516
24517
24518   static const int max_connections = implementation_defined;
24519
24520
24521
24522 [endsect]
24523
24524
24525
24526 [section:max_listen_connections basic_seq_packet_socket::max_listen_connections]
24527
24528
24529 ['Inherited from socket_base.]
24530
24531 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.max_listen_connections..max_listen_connections..basic_seq_packet_socket] 
24532 The maximum length of the queue of pending incoming connections. 
24533
24534
24535   static const int max_listen_connections = implementation_defined;
24536
24537
24538
24539 [endsect]
24540
24541
24542
24543 [section:message_do_not_route basic_seq_packet_socket::message_do_not_route]
24544
24545
24546 ['Inherited from socket_base.]
24547
24548 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.message_do_not_route..message_do_not_route..basic_seq_packet_socket] 
24549 Specify that the data should not be subject to routing. 
24550
24551
24552   static const int message_do_not_route = implementation_defined;
24553
24554
24555
24556 [endsect]
24557
24558
24559
24560 [section:message_end_of_record basic_seq_packet_socket::message_end_of_record]
24561
24562
24563 ['Inherited from socket_base.]
24564
24565 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.message_end_of_record..message_end_of_record..basic_seq_packet_socket] 
24566 Specifies that the data marks the end of a record. 
24567
24568
24569   static const int message_end_of_record = implementation_defined;
24570
24571
24572
24573 [endsect]
24574
24575
24576
24577 [section:message_flags basic_seq_packet_socket::message_flags]
24578
24579
24580 ['Inherited from socket_base.]
24581
24582 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.message_flags..message_flags..basic_seq_packet_socket] 
24583 Bitmask type for flags that can be passed to send and receive operations. 
24584
24585
24586   typedef int message_flags;
24587
24588
24589
24590 [heading Requirements]
24591
24592 ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
24593
24594 ['Convenience header: ][^boost/asio.hpp]
24595
24596
24597 [endsect]
24598
24599
24600
24601 [section:message_out_of_band basic_seq_packet_socket::message_out_of_band]
24602
24603
24604 ['Inherited from socket_base.]
24605
24606 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.message_out_of_band..message_out_of_band..basic_seq_packet_socket] 
24607 Process out-of-band data. 
24608
24609
24610   static const int message_out_of_band = implementation_defined;
24611
24612
24613
24614 [endsect]
24615
24616
24617
24618 [section:message_peek basic_seq_packet_socket::message_peek]
24619
24620
24621 ['Inherited from socket_base.]
24622
24623 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.message_peek..message_peek..basic_seq_packet_socket] 
24624 Peek at incoming data without removing it from the input queue. 
24625
24626
24627   static const int message_peek = implementation_defined;
24628
24629
24630
24631 [endsect]
24632
24633
24634
24635 [section:native_handle basic_seq_packet_socket::native_handle]
24636
24637
24638 ['Inherited from basic_socket.]
24639
24640 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.native_handle..native_handle..basic_seq_packet_socket] 
24641 Get the native socket representation. 
24642
24643
24644   native_handle_type native_handle();
24645
24646
24647 This function may be used to obtain the underlying representation of the socket. This is intended to allow access to native socket functionality that is not otherwise provided. 
24648
24649
24650 [endsect]
24651
24652
24653
24654 [section:native_handle_type basic_seq_packet_socket::native_handle_type]
24655
24656 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.native_handle_type..native_handle_type..basic_seq_packet_socket] 
24657 The native representation of a socket. 
24658
24659
24660   typedef implementation_defined native_handle_type;
24661
24662
24663
24664 [heading Requirements]
24665
24666 ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
24667
24668 ['Convenience header: ][^boost/asio.hpp]
24669
24670
24671 [endsect]
24672
24673
24674 [section:native_non_blocking basic_seq_packet_socket::native_non_blocking]
24675
24676 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.native_non_blocking..native_non_blocking..basic_seq_packet_socket] 
24677 Gets the non-blocking mode of the native socket implementation. 
24678
24679
24680   bool ``[link boost_asio.reference.basic_seq_packet_socket.native_non_blocking.overload1 native_non_blocking]``() const;
24681   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.native_non_blocking.overload1 more...]]``
24682
24683
24684 Sets the non-blocking mode of the native socket implementation. 
24685
24686
24687   void ``[link boost_asio.reference.basic_seq_packet_socket.native_non_blocking.overload2 native_non_blocking]``(
24688       bool mode);
24689   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.native_non_blocking.overload2 more...]]``
24690
24691   void ``[link boost_asio.reference.basic_seq_packet_socket.native_non_blocking.overload3 native_non_blocking]``(
24692       bool mode,
24693       boost::system::error_code & ec);
24694   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.native_non_blocking.overload3 more...]]``
24695
24696
24697 [section:overload1 basic_seq_packet_socket::native_non_blocking (1 of 3 overloads)]
24698
24699
24700 ['Inherited from basic_socket.]
24701
24702
24703 Gets the non-blocking mode of the native socket implementation. 
24704
24705
24706   bool native_non_blocking() const;
24707
24708
24709 This function is used to retrieve the non-blocking mode of the underlying native socket. This mode has no effect on the behaviour of the socket object's synchronous operations.
24710
24711
24712 [heading Return Value]
24713       
24714 `true` if the underlying socket is in non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).
24715
24716
24717 [heading Remarks]
24718       
24719 The current non-blocking mode is cached by the socket object. Consequently, the return value may be incorrect if the non-blocking mode was set directly on the native socket.
24720
24721
24722 [heading Example]
24723   
24724 This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated: 
24725
24726    template <typename Handler>
24727    struct sendfile_op
24728    {
24729      tcp::socket& sock_;
24730      int fd_;
24731      Handler handler_;
24732      off_t offset_;
24733      std::size_t total_bytes_transferred_;
24734
24735      // Function call operator meeting WriteHandler requirements.
24736      // Used as the handler for the async_write_some operation.
24737      void operator()(boost::system::error_code ec, std::size_t)
24738      {
24739        // Put the underlying socket into non-blocking mode.
24740        if (!ec)
24741          if (!sock_.native_non_blocking())
24742            sock_.native_non_blocking(true, ec);
24743
24744        if (!ec)
24745        {
24746          for (;;)
24747          {
24748            // Try the system call.
24749            errno = 0;
24750            int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
24751            ec = boost::system::error_code(n < 0 ? errno : 0,
24752                boost::asio::error::get_system_category());
24753            total_bytes_transferred_ += ec ? 0 : n;
24754
24755            // Retry operation immediately if interrupted by signal.
24756            if (ec == boost::asio::error::interrupted)
24757              continue;
24758
24759            // Check if we need to run the operation again.
24760            if (ec == boost::asio::error::would_block
24761                || ec == boost::asio::error::try_again)
24762            {
24763              // We have to wait for the socket to become ready again.
24764              sock_.async_wait(tcp::socket::wait_write, *this);
24765              return;
24766            }
24767
24768            if (ec || n == 0)
24769            {
24770              // An error occurred, or we have reached the end of the file.
24771              // Either way we must exit the loop so we can call the handler.
24772              break;
24773            }
24774
24775            // Loop around to try calling sendfile again.
24776          }
24777        }
24778
24779        // Pass result back to user's handler.
24780        handler_(ec, total_bytes_transferred_);
24781      }
24782    };
24783
24784    template <typename Handler>
24785    void async_sendfile(tcp::socket& sock, int fd, Handler h)
24786    {
24787      sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
24788      sock.async_wait(tcp::socket::wait_write, op);
24789    } 
24790
24791
24792
24793
24794
24795
24796
24797 [endsect]
24798
24799
24800
24801 [section:overload2 basic_seq_packet_socket::native_non_blocking (2 of 3 overloads)]
24802
24803
24804 ['Inherited from basic_socket.]
24805
24806
24807 Sets the non-blocking mode of the native socket implementation. 
24808
24809
24810   void native_non_blocking(
24811       bool mode);
24812
24813
24814 This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations.
24815
24816
24817 [heading Parameters]
24818     
24819
24820 [variablelist
24821   
24822 [[mode][If `true`, the underlying socket is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]]
24823
24824 ]
24825
24826
24827 [heading Exceptions]
24828     
24829
24830 [variablelist
24831   
24832 [[boost::system::system_error][Thrown on failure. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense.]]
24833
24834 ]
24835
24836
24837 [heading Example]
24838   
24839 This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated: 
24840
24841    template <typename Handler>
24842    struct sendfile_op
24843    {
24844      tcp::socket& sock_;
24845      int fd_;
24846      Handler handler_;
24847      off_t offset_;
24848      std::size_t total_bytes_transferred_;
24849
24850      // Function call operator meeting WriteHandler requirements.
24851      // Used as the handler for the async_write_some operation.
24852      void operator()(boost::system::error_code ec, std::size_t)
24853      {
24854        // Put the underlying socket into non-blocking mode.
24855        if (!ec)
24856          if (!sock_.native_non_blocking())
24857            sock_.native_non_blocking(true, ec);
24858
24859        if (!ec)
24860        {
24861          for (;;)
24862          {
24863            // Try the system call.
24864            errno = 0;
24865            int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
24866            ec = boost::system::error_code(n < 0 ? errno : 0,
24867                boost::asio::error::get_system_category());
24868            total_bytes_transferred_ += ec ? 0 : n;
24869
24870            // Retry operation immediately if interrupted by signal.
24871            if (ec == boost::asio::error::interrupted)
24872              continue;
24873
24874            // Check if we need to run the operation again.
24875            if (ec == boost::asio::error::would_block
24876                || ec == boost::asio::error::try_again)
24877            {
24878              // We have to wait for the socket to become ready again.
24879              sock_.async_wait(tcp::socket::wait_write, *this);
24880              return;
24881            }
24882
24883            if (ec || n == 0)
24884            {
24885              // An error occurred, or we have reached the end of the file.
24886              // Either way we must exit the loop so we can call the handler.
24887              break;
24888            }
24889
24890            // Loop around to try calling sendfile again.
24891          }
24892        }
24893
24894        // Pass result back to user's handler.
24895        handler_(ec, total_bytes_transferred_);
24896      }
24897    };
24898
24899    template <typename Handler>
24900    void async_sendfile(tcp::socket& sock, int fd, Handler h)
24901    {
24902      sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
24903      sock.async_wait(tcp::socket::wait_write, op);
24904    } 
24905
24906
24907
24908
24909
24910
24911
24912 [endsect]
24913
24914
24915
24916 [section:overload3 basic_seq_packet_socket::native_non_blocking (3 of 3 overloads)]
24917
24918
24919 ['Inherited from basic_socket.]
24920
24921
24922 Sets the non-blocking mode of the native socket implementation. 
24923
24924
24925   void native_non_blocking(
24926       bool mode,
24927       boost::system::error_code & ec);
24928
24929
24930 This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations.
24931
24932
24933 [heading Parameters]
24934     
24935
24936 [variablelist
24937   
24938 [[mode][If `true`, the underlying socket is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]]
24939
24940 [[ec][Set to indicate what error occurred, if any. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense.]]
24941
24942 ]
24943
24944
24945 [heading Example]
24946   
24947 This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated: 
24948
24949    template <typename Handler>
24950    struct sendfile_op
24951    {
24952      tcp::socket& sock_;
24953      int fd_;
24954      Handler handler_;
24955      off_t offset_;
24956      std::size_t total_bytes_transferred_;
24957
24958      // Function call operator meeting WriteHandler requirements.
24959      // Used as the handler for the async_write_some operation.
24960      void operator()(boost::system::error_code ec, std::size_t)
24961      {
24962        // Put the underlying socket into non-blocking mode.
24963        if (!ec)
24964          if (!sock_.native_non_blocking())
24965            sock_.native_non_blocking(true, ec);
24966
24967        if (!ec)
24968        {
24969          for (;;)
24970          {
24971            // Try the system call.
24972            errno = 0;
24973            int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
24974            ec = boost::system::error_code(n < 0 ? errno : 0,
24975                boost::asio::error::get_system_category());
24976            total_bytes_transferred_ += ec ? 0 : n;
24977
24978            // Retry operation immediately if interrupted by signal.
24979            if (ec == boost::asio::error::interrupted)
24980              continue;
24981
24982            // Check if we need to run the operation again.
24983            if (ec == boost::asio::error::would_block
24984                || ec == boost::asio::error::try_again)
24985            {
24986              // We have to wait for the socket to become ready again.
24987              sock_.async_wait(tcp::socket::wait_write, *this);
24988              return;
24989            }
24990
24991            if (ec || n == 0)
24992            {
24993              // An error occurred, or we have reached the end of the file.
24994              // Either way we must exit the loop so we can call the handler.
24995              break;
24996            }
24997
24998            // Loop around to try calling sendfile again.
24999          }
25000        }
25001
25002        // Pass result back to user's handler.
25003        handler_(ec, total_bytes_transferred_);
25004      }
25005    };
25006
25007    template <typename Handler>
25008    void async_sendfile(tcp::socket& sock, int fd, Handler h)
25009    {
25010      sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
25011      sock.async_wait(tcp::socket::wait_write, op);
25012    } 
25013
25014
25015
25016
25017
25018
25019
25020 [endsect]
25021
25022
25023 [endsect]
25024
25025 [section:non_blocking basic_seq_packet_socket::non_blocking]
25026
25027 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.non_blocking..non_blocking..basic_seq_packet_socket] 
25028 Gets the non-blocking mode of the socket. 
25029
25030
25031   bool ``[link boost_asio.reference.basic_seq_packet_socket.non_blocking.overload1 non_blocking]``() const;
25032   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.non_blocking.overload1 more...]]``
25033
25034
25035 Sets the non-blocking mode of the socket. 
25036
25037
25038   void ``[link boost_asio.reference.basic_seq_packet_socket.non_blocking.overload2 non_blocking]``(
25039       bool mode);
25040   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.non_blocking.overload2 more...]]``
25041
25042   void ``[link boost_asio.reference.basic_seq_packet_socket.non_blocking.overload3 non_blocking]``(
25043       bool mode,
25044       boost::system::error_code & ec);
25045   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.non_blocking.overload3 more...]]``
25046
25047
25048 [section:overload1 basic_seq_packet_socket::non_blocking (1 of 3 overloads)]
25049
25050
25051 ['Inherited from basic_socket.]
25052
25053
25054 Gets the non-blocking mode of the socket. 
25055
25056
25057   bool non_blocking() const;
25058
25059
25060
25061 [heading Return Value]
25062       
25063 `true` if the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.
25064
25065
25066 [heading Remarks]
25067       
25068 The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`. 
25069
25070
25071
25072
25073 [endsect]
25074
25075
25076
25077 [section:overload2 basic_seq_packet_socket::non_blocking (2 of 3 overloads)]
25078
25079
25080 ['Inherited from basic_socket.]
25081
25082
25083 Sets the non-blocking mode of the socket. 
25084
25085
25086   void non_blocking(
25087       bool mode);
25088
25089
25090
25091 [heading Parameters]
25092     
25093
25094 [variablelist
25095   
25096 [[mode][If `true`, the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]]
25097
25098 ]
25099
25100
25101 [heading Exceptions]
25102     
25103
25104 [variablelist
25105   
25106 [[boost::system::system_error][Thrown on failure.]]
25107
25108 ]
25109
25110
25111 [heading Remarks]
25112       
25113 The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`. 
25114
25115
25116
25117
25118 [endsect]
25119
25120
25121
25122 [section:overload3 basic_seq_packet_socket::non_blocking (3 of 3 overloads)]
25123
25124
25125 ['Inherited from basic_socket.]
25126
25127
25128 Sets the non-blocking mode of the socket. 
25129
25130
25131   void non_blocking(
25132       bool mode,
25133       boost::system::error_code & ec);
25134
25135
25136
25137 [heading Parameters]
25138     
25139
25140 [variablelist
25141   
25142 [[mode][If `true`, the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]]
25143
25144 [[ec][Set to indicate what error occurred, if any.]]
25145
25146 ]
25147
25148
25149 [heading Remarks]
25150       
25151 The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`. 
25152
25153
25154
25155
25156 [endsect]
25157
25158
25159 [endsect]
25160
25161 [section:open basic_seq_packet_socket::open]
25162
25163 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.open..open..basic_seq_packet_socket] 
25164 Open the socket using the specified protocol. 
25165
25166
25167   void ``[link boost_asio.reference.basic_seq_packet_socket.open.overload1 open]``(
25168       const protocol_type & protocol = protocol_type());
25169   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.open.overload1 more...]]``
25170
25171   void ``[link boost_asio.reference.basic_seq_packet_socket.open.overload2 open]``(
25172       const protocol_type & protocol,
25173       boost::system::error_code & ec);
25174   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.open.overload2 more...]]``
25175
25176
25177 [section:overload1 basic_seq_packet_socket::open (1 of 2 overloads)]
25178
25179
25180 ['Inherited from basic_socket.]
25181
25182
25183 Open the socket using the specified protocol. 
25184
25185
25186   void open(
25187       const protocol_type & protocol = protocol_type());
25188
25189
25190 This function opens the socket so that it will use the specified protocol.
25191
25192
25193 [heading Parameters]
25194     
25195
25196 [variablelist
25197   
25198 [[protocol][An object specifying protocol parameters to be used.]]
25199
25200 ]
25201
25202
25203 [heading Exceptions]
25204     
25205
25206 [variablelist
25207   
25208 [[boost::system::system_error][Thrown on failure.]]
25209
25210 ]
25211
25212
25213 [heading Example]
25214   
25215
25216
25217    boost::asio::ip::tcp::socket socket(my_context);
25218    socket.open(boost::asio::ip::tcp::v4());
25219
25220
25221
25222
25223
25224
25225
25226 [endsect]
25227
25228
25229
25230 [section:overload2 basic_seq_packet_socket::open (2 of 2 overloads)]
25231
25232
25233 ['Inherited from basic_socket.]
25234
25235
25236 Open the socket using the specified protocol. 
25237
25238
25239   void open(
25240       const protocol_type & protocol,
25241       boost::system::error_code & ec);
25242
25243
25244 This function opens the socket so that it will use the specified protocol.
25245
25246
25247 [heading Parameters]
25248     
25249
25250 [variablelist
25251   
25252 [[protocol][An object specifying which protocol is to be used.]]
25253
25254 [[ec][Set to indicate what error occurred, if any.]]
25255
25256 ]
25257
25258
25259 [heading Example]
25260   
25261
25262
25263    boost::asio::ip::tcp::socket socket(my_context);
25264    boost::system::error_code ec;
25265    socket.open(boost::asio::ip::tcp::v4(), ec);
25266    if (ec)
25267    {
25268      // An error occurred.
25269    }
25270
25271
25272
25273
25274
25275
25276
25277 [endsect]
25278
25279
25280 [endsect]
25281
25282 [section:operator_eq_ basic_seq_packet_socket::operator=]
25283
25284 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.operator_eq_..operator=..basic_seq_packet_socket] 
25285 Move-assign a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] from another. 
25286
25287
25288   basic_seq_packet_socket & ``[link boost_asio.reference.basic_seq_packet_socket.operator_eq_.overload1 operator=]``(
25289       basic_seq_packet_socket && other);
25290   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.operator_eq_.overload1 more...]]``
25291
25292
25293 Move-assign a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] from a socket of another protocol type. 
25294
25295
25296   template<
25297       typename ``[link boost_asio.reference.Protocol Protocol1]``,
25298       typename ``[link boost_asio.reference.Executor1 Executor1]``>
25299   enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value, basic_seq_packet_socket & >::type ``[link boost_asio.reference.basic_seq_packet_socket.operator_eq_.overload2 operator=]``(
25300       basic_seq_packet_socket< Protocol1, Executor1 > && other);
25301   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.operator_eq_.overload2 more...]]``
25302
25303
25304 [section:overload1 basic_seq_packet_socket::operator= (1 of 2 overloads)]
25305
25306
25307 Move-assign a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] from another. 
25308
25309
25310   basic_seq_packet_socket & operator=(
25311       basic_seq_packet_socket && other);
25312
25313
25314 This assignment operator moves a sequenced packet socket from one object to another.
25315
25316
25317 [heading Parameters]
25318     
25319
25320 [variablelist
25321   
25322 [[other][The other [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] object from which the move will occur.]]
25323
25324 ]
25325
25326
25327 [heading Remarks]
25328       
25329 Following the move, the moved-from object is in the same state as if constructed using the `basic_seq_packet_socket(const executor_type&)` constructor. 
25330
25331
25332
25333
25334 [endsect]
25335
25336
25337
25338 [section:overload2 basic_seq_packet_socket::operator= (2 of 2 overloads)]
25339
25340
25341 Move-assign a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] from a socket of another protocol type. 
25342
25343
25344   template<
25345       typename ``[link boost_asio.reference.Protocol Protocol1]``,
25346       typename ``[link boost_asio.reference.Executor1 Executor1]``>
25347   enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value, basic_seq_packet_socket & >::type operator=(
25348       basic_seq_packet_socket< Protocol1, Executor1 > && other);
25349
25350
25351 This assignment operator moves a sequenced packet socket from one object to another.
25352
25353
25354 [heading Parameters]
25355     
25356
25357 [variablelist
25358   
25359 [[other][The other [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] object from which the move will occur.]]
25360
25361 ]
25362
25363
25364 [heading Remarks]
25365       
25366 Following the move, the moved-from object is in the same state as if constructed using the `basic_seq_packet_socket(const executor_type&)` constructor. 
25367
25368
25369
25370
25371 [endsect]
25372
25373
25374 [endsect]
25375
25376
25377 [section:out_of_band_inline basic_seq_packet_socket::out_of_band_inline]
25378
25379
25380 ['Inherited from socket_base.]
25381
25382 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.out_of_band_inline..out_of_band_inline..basic_seq_packet_socket] 
25383 Socket option for putting received out-of-band data inline. 
25384
25385
25386   typedef implementation_defined out_of_band_inline;
25387
25388
25389
25390 Implements the SOL\_SOCKET/SO\_OOBINLINE socket option.
25391
25392
25393 [heading Examples]
25394   
25395 Setting the option: 
25396
25397    boost::asio::ip::tcp::socket socket(my_context);
25398    ...
25399    boost::asio::socket_base::out_of_band_inline option(true);
25400    socket.set_option(option);
25401
25402
25403
25404
25405
25406 Getting the current option value: 
25407
25408    boost::asio::ip::tcp::socket socket(my_context);
25409    ...
25410    boost::asio::socket_base::out_of_band_inline option;
25411    socket.get_option(option);
25412    bool value = option.value();
25413
25414
25415
25416
25417
25418
25419
25420 [heading Requirements]
25421
25422 ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
25423
25424 ['Convenience header: ][^boost/asio.hpp]
25425
25426
25427 [endsect]
25428
25429
25430
25431 [section:protocol_type basic_seq_packet_socket::protocol_type]
25432
25433 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.protocol_type..protocol_type..basic_seq_packet_socket] 
25434 The protocol type. 
25435
25436
25437   typedef Protocol protocol_type;
25438
25439
25440
25441 [heading Requirements]
25442
25443 ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
25444
25445 ['Convenience header: ][^boost/asio.hpp]
25446
25447
25448 [endsect]
25449
25450
25451 [section:receive basic_seq_packet_socket::receive]
25452
25453 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.receive..receive..basic_seq_packet_socket] 
25454 Receive some data on the socket. 
25455
25456
25457   template<
25458       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
25459   std::size_t ``[link boost_asio.reference.basic_seq_packet_socket.receive.overload1 receive]``(
25460       const MutableBufferSequence & buffers,
25461       socket_base::message_flags & out_flags);
25462   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.receive.overload1 more...]]``
25463
25464   template<
25465       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
25466   std::size_t ``[link boost_asio.reference.basic_seq_packet_socket.receive.overload2 receive]``(
25467       const MutableBufferSequence & buffers,
25468       socket_base::message_flags in_flags,
25469       socket_base::message_flags & out_flags);
25470   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.receive.overload2 more...]]``
25471
25472
25473 Receive some data on a connected socket. 
25474
25475
25476   template<
25477       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
25478   std::size_t ``[link boost_asio.reference.basic_seq_packet_socket.receive.overload3 receive]``(
25479       const MutableBufferSequence & buffers,
25480       socket_base::message_flags in_flags,
25481       socket_base::message_flags & out_flags,
25482       boost::system::error_code & ec);
25483   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.receive.overload3 more...]]``
25484
25485
25486 [section:overload1 basic_seq_packet_socket::receive (1 of 3 overloads)]
25487
25488
25489 Receive some data on the socket. 
25490
25491
25492   template<
25493       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
25494   std::size_t receive(
25495       const MutableBufferSequence & buffers,
25496       socket_base::message_flags & out_flags);
25497
25498
25499 This function is used to receive data on the sequenced packet socket. The function call will block until data has been received successfully, or until an error occurs.
25500
25501
25502 [heading Parameters]
25503     
25504
25505 [variablelist
25506   
25507 [[buffers][One or more buffers into which the data will be received.]]
25508
25509 [[out_flags][After the receive call completes, contains flags associated with the received data. For example, if the `socket_base::message_end_of_record` bit is set then the received data marks the end of a record.]]
25510
25511 ]
25512
25513
25514 [heading Return Value]
25515       
25516 The number of bytes received.
25517
25518
25519 [heading Exceptions]
25520     
25521
25522 [variablelist
25523   
25524 [[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
25525
25526 ]
25527
25528
25529 [heading Example]
25530   
25531 To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
25532
25533    socket.receive(boost::asio::buffer(data, size), out_flags);
25534
25535
25536 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
25537
25538
25539
25540
25541 [endsect]
25542
25543
25544
25545 [section:overload2 basic_seq_packet_socket::receive (2 of 3 overloads)]
25546
25547
25548 Receive some data on the socket. 
25549
25550
25551   template<
25552       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
25553   std::size_t receive(
25554       const MutableBufferSequence & buffers,
25555       socket_base::message_flags in_flags,
25556       socket_base::message_flags & out_flags);
25557
25558
25559 This function is used to receive data on the sequenced packet socket. The function call will block until data has been received successfully, or until an error occurs.
25560
25561
25562 [heading Parameters]
25563     
25564
25565 [variablelist
25566   
25567 [[buffers][One or more buffers into which the data will be received.]]
25568
25569 [[in_flags][Flags specifying how the receive call is to be made.]]
25570
25571 [[out_flags][After the receive call completes, contains flags associated with the received data. For example, if the `socket_base::message_end_of_record` bit is set then the received data marks the end of a record.]]
25572
25573 ]
25574
25575
25576 [heading Return Value]
25577       
25578 The number of bytes received.
25579
25580
25581 [heading Exceptions]
25582     
25583
25584 [variablelist
25585   
25586 [[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
25587
25588 ]
25589
25590
25591 [heading Remarks]
25592       
25593 The receive operation may not receive all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`]  function if you need to ensure that the requested amount of data is read before the blocking operation completes.
25594
25595
25596 [heading Example]
25597   
25598 To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
25599
25600    socket.receive(boost::asio::buffer(data, size), 0, out_flags);
25601
25602
25603 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
25604
25605
25606
25607
25608 [endsect]
25609
25610
25611
25612 [section:overload3 basic_seq_packet_socket::receive (3 of 3 overloads)]
25613
25614
25615 Receive some data on a connected socket. 
25616
25617
25618   template<
25619       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
25620   std::size_t receive(
25621       const MutableBufferSequence & buffers,
25622       socket_base::message_flags in_flags,
25623       socket_base::message_flags & out_flags,
25624       boost::system::error_code & ec);
25625
25626
25627 This function is used to receive data on the sequenced packet socket. The function call will block until data has been received successfully, or until an error occurs.
25628
25629
25630 [heading Parameters]
25631     
25632
25633 [variablelist
25634   
25635 [[buffers][One or more buffers into which the data will be received.]]
25636
25637 [[in_flags][Flags specifying how the receive call is to be made.]]
25638
25639 [[out_flags][After the receive call completes, contains flags associated with the received data. For example, if the `socket_base::message_end_of_record` bit is set then the received data marks the end of a record.]]
25640
25641 [[ec][Set to indicate what error occurred, if any.]]
25642
25643 ]
25644
25645
25646 [heading Return Value]
25647       
25648 The number of bytes received. Returns 0 if an error occurred.
25649
25650
25651 [heading Remarks]
25652       
25653 The receive operation may not receive all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`]  function if you need to ensure that the requested amount of data is read before the blocking operation completes. 
25654
25655
25656
25657
25658 [endsect]
25659
25660
25661 [endsect]
25662
25663
25664 [section:receive_buffer_size basic_seq_packet_socket::receive_buffer_size]
25665
25666
25667 ['Inherited from socket_base.]
25668
25669 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.receive_buffer_size..receive_buffer_size..basic_seq_packet_socket] 
25670 Socket option for the receive buffer size of a socket. 
25671
25672
25673   typedef implementation_defined receive_buffer_size;
25674
25675
25676
25677 Implements the SOL\_SOCKET/SO\_RCVBUF socket option.
25678
25679
25680 [heading Examples]
25681   
25682 Setting the option: 
25683
25684    boost::asio::ip::tcp::socket socket(my_context);
25685    ...
25686    boost::asio::socket_base::receive_buffer_size option(8192);
25687    socket.set_option(option);
25688
25689
25690
25691
25692
25693 Getting the current option value: 
25694
25695    boost::asio::ip::tcp::socket socket(my_context);
25696    ...
25697    boost::asio::socket_base::receive_buffer_size option;
25698    socket.get_option(option);
25699    int size = option.value();
25700
25701
25702
25703
25704
25705
25706
25707 [heading Requirements]
25708
25709 ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
25710
25711 ['Convenience header: ][^boost/asio.hpp]
25712
25713
25714 [endsect]
25715
25716
25717
25718 [section:receive_low_watermark basic_seq_packet_socket::receive_low_watermark]
25719
25720
25721 ['Inherited from socket_base.]
25722
25723 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.receive_low_watermark..receive_low_watermark..basic_seq_packet_socket] 
25724 Socket option for the receive low watermark. 
25725
25726
25727   typedef implementation_defined receive_low_watermark;
25728
25729
25730
25731 Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option.
25732
25733
25734 [heading Examples]
25735   
25736 Setting the option: 
25737
25738    boost::asio::ip::tcp::socket socket(my_context);
25739    ...
25740    boost::asio::socket_base::receive_low_watermark option(1024);
25741    socket.set_option(option);
25742
25743
25744
25745
25746
25747 Getting the current option value: 
25748
25749    boost::asio::ip::tcp::socket socket(my_context);
25750    ...
25751    boost::asio::socket_base::receive_low_watermark option;
25752    socket.get_option(option);
25753    int size = option.value();
25754
25755
25756
25757
25758
25759
25760
25761 [heading Requirements]
25762
25763 ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
25764
25765 ['Convenience header: ][^boost/asio.hpp]
25766
25767
25768 [endsect]
25769
25770
25771 [section:release basic_seq_packet_socket::release]
25772
25773 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.release..release..basic_seq_packet_socket] 
25774 Release ownership of the underlying native socket. 
25775
25776
25777   native_handle_type ``[link boost_asio.reference.basic_seq_packet_socket.release.overload1 release]``();
25778   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.release.overload1 more...]]``
25779
25780   native_handle_type ``[link boost_asio.reference.basic_seq_packet_socket.release.overload2 release]``(
25781       boost::system::error_code & ec);
25782   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.release.overload2 more...]]``
25783
25784
25785 [section:overload1 basic_seq_packet_socket::release (1 of 2 overloads)]
25786
25787
25788 ['Inherited from basic_socket.]
25789
25790
25791 Release ownership of the underlying native socket. 
25792
25793
25794   native_handle_type release();
25795
25796
25797 This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error. Ownership of the native socket is then transferred to the caller.
25798
25799
25800 [heading Exceptions]
25801     
25802
25803 [variablelist
25804   
25805 [[boost::system::system_error][Thrown on failure.]]
25806
25807 ]
25808
25809
25810 [heading Remarks]
25811       
25812 This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms. 
25813
25814
25815
25816
25817 [endsect]
25818
25819
25820
25821 [section:overload2 basic_seq_packet_socket::release (2 of 2 overloads)]
25822
25823
25824 ['Inherited from basic_socket.]
25825
25826
25827 Release ownership of the underlying native socket. 
25828
25829
25830   native_handle_type release(
25831       boost::system::error_code & ec);
25832
25833
25834 This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error. Ownership of the native socket is then transferred to the caller.
25835
25836
25837 [heading Parameters]
25838     
25839
25840 [variablelist
25841   
25842 [[ec][Set to indicate what error occurred, if any.]]
25843
25844 ]
25845
25846
25847 [heading Remarks]
25848       
25849 This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms. 
25850
25851
25852
25853
25854 [endsect]
25855
25856
25857 [endsect]
25858
25859 [section:remote_endpoint basic_seq_packet_socket::remote_endpoint]
25860
25861 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.remote_endpoint..remote_endpoint..basic_seq_packet_socket] 
25862 Get the remote endpoint of the socket. 
25863
25864
25865   endpoint_type ``[link boost_asio.reference.basic_seq_packet_socket.remote_endpoint.overload1 remote_endpoint]``() const;
25866   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.remote_endpoint.overload1 more...]]``
25867
25868   endpoint_type ``[link boost_asio.reference.basic_seq_packet_socket.remote_endpoint.overload2 remote_endpoint]``(
25869       boost::system::error_code & ec) const;
25870   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.remote_endpoint.overload2 more...]]``
25871
25872
25873 [section:overload1 basic_seq_packet_socket::remote_endpoint (1 of 2 overloads)]
25874
25875
25876 ['Inherited from basic_socket.]
25877
25878
25879 Get the remote endpoint of the socket. 
25880
25881
25882   endpoint_type remote_endpoint() const;
25883
25884
25885 This function is used to obtain the remote endpoint of the socket.
25886
25887
25888 [heading Return Value]
25889       
25890 An object that represents the remote endpoint of the socket.
25891
25892
25893 [heading Exceptions]
25894     
25895
25896 [variablelist
25897   
25898 [[boost::system::system_error][Thrown on failure.]]
25899
25900 ]
25901
25902
25903 [heading Example]
25904   
25905
25906
25907    boost::asio::ip::tcp::socket socket(my_context);
25908    ...
25909    boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint();
25910
25911
25912
25913
25914
25915
25916
25917 [endsect]
25918
25919
25920
25921 [section:overload2 basic_seq_packet_socket::remote_endpoint (2 of 2 overloads)]
25922
25923
25924 ['Inherited from basic_socket.]
25925
25926
25927 Get the remote endpoint of the socket. 
25928
25929
25930   endpoint_type remote_endpoint(
25931       boost::system::error_code & ec) const;
25932
25933
25934 This function is used to obtain the remote endpoint of the socket.
25935
25936
25937 [heading Parameters]
25938     
25939
25940 [variablelist
25941   
25942 [[ec][Set to indicate what error occurred, if any.]]
25943
25944 ]
25945
25946
25947 [heading Return Value]
25948       
25949 An object that represents the remote endpoint of the socket. Returns a default-constructed endpoint object if an error occurred.
25950
25951
25952 [heading Example]
25953   
25954
25955
25956    boost::asio::ip::tcp::socket socket(my_context);
25957    ...
25958    boost::system::error_code ec;
25959    boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(ec);
25960    if (ec)
25961    {
25962      // An error occurred.
25963    }
25964
25965
25966
25967
25968
25969
25970
25971 [endsect]
25972
25973
25974 [endsect]
25975
25976
25977 [section:reuse_address basic_seq_packet_socket::reuse_address]
25978
25979
25980 ['Inherited from socket_base.]
25981
25982 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.reuse_address..reuse_address..basic_seq_packet_socket] 
25983 Socket option to allow the socket to be bound to an address that is already in use. 
25984
25985
25986   typedef implementation_defined reuse_address;
25987
25988
25989
25990 Implements the SOL\_SOCKET/SO\_REUSEADDR socket option.
25991
25992
25993 [heading Examples]
25994   
25995 Setting the option: 
25996
25997    boost::asio::ip::tcp::acceptor acceptor(my_context);
25998    ...
25999    boost::asio::socket_base::reuse_address option(true);
26000    acceptor.set_option(option);
26001
26002
26003
26004
26005
26006 Getting the current option value: 
26007
26008    boost::asio::ip::tcp::acceptor acceptor(my_context);
26009    ...
26010    boost::asio::socket_base::reuse_address option;
26011    acceptor.get_option(option);
26012    bool is_set = option.value();
26013
26014
26015
26016
26017
26018
26019
26020 [heading Requirements]
26021
26022 ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
26023
26024 ['Convenience header: ][^boost/asio.hpp]
26025
26026
26027 [endsect]
26028
26029
26030 [section:send basic_seq_packet_socket::send]
26031
26032 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.send..send..basic_seq_packet_socket] 
26033 Send some data on the socket. 
26034
26035
26036   template<
26037       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
26038   std::size_t ``[link boost_asio.reference.basic_seq_packet_socket.send.overload1 send]``(
26039       const ConstBufferSequence & buffers,
26040       socket_base::message_flags flags);
26041   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.send.overload1 more...]]``
26042
26043   template<
26044       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
26045   std::size_t ``[link boost_asio.reference.basic_seq_packet_socket.send.overload2 send]``(
26046       const ConstBufferSequence & buffers,
26047       socket_base::message_flags flags,
26048       boost::system::error_code & ec);
26049   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.send.overload2 more...]]``
26050
26051
26052 [section:overload1 basic_seq_packet_socket::send (1 of 2 overloads)]
26053
26054
26055 Send some data on the socket. 
26056
26057
26058   template<
26059       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
26060   std::size_t send(
26061       const ConstBufferSequence & buffers,
26062       socket_base::message_flags flags);
26063
26064
26065 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.
26066
26067
26068 [heading Parameters]
26069     
26070
26071 [variablelist
26072   
26073 [[buffers][One or more data buffers to be sent on the socket.]]
26074
26075 [[flags][Flags specifying how the send call is to be made.]]
26076
26077 ]
26078
26079
26080 [heading Return Value]
26081       
26082 The number of bytes sent.
26083
26084
26085 [heading Exceptions]
26086     
26087
26088 [variablelist
26089   
26090 [[boost::system::system_error][Thrown on failure.]]
26091
26092 ]
26093
26094
26095 [heading Example]
26096   
26097 To send a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
26098
26099    socket.send(boost::asio::buffer(data, size), 0);
26100
26101
26102 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
26103
26104
26105
26106
26107 [endsect]
26108
26109
26110
26111 [section:overload2 basic_seq_packet_socket::send (2 of 2 overloads)]
26112
26113
26114 Send some data on the socket. 
26115
26116
26117   template<
26118       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
26119   std::size_t send(
26120       const ConstBufferSequence & buffers,
26121       socket_base::message_flags flags,
26122       boost::system::error_code & ec);
26123
26124
26125 This function is used to send data on the sequenced packet socket. The function call will block the data has been sent successfully, or an until error occurs.
26126
26127
26128 [heading Parameters]
26129     
26130
26131 [variablelist
26132   
26133 [[buffers][One or more data buffers to be sent on the socket.]]
26134
26135 [[flags][Flags specifying how the send call is to be made.]]
26136
26137 [[ec][Set to indicate what error occurred, if any.]]
26138
26139 ]
26140
26141
26142 [heading Return Value]
26143       
26144 The number of bytes sent. Returns 0 if an error occurred.
26145
26146
26147 [heading Remarks]
26148       
26149 The send operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`]  function if you need to ensure that all data is written before the blocking operation completes. 
26150
26151
26152
26153
26154 [endsect]
26155
26156
26157 [endsect]
26158
26159
26160 [section:send_buffer_size basic_seq_packet_socket::send_buffer_size]
26161
26162
26163 ['Inherited from socket_base.]
26164
26165 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.send_buffer_size..send_buffer_size..basic_seq_packet_socket] 
26166 Socket option for the send buffer size of a socket. 
26167
26168
26169   typedef implementation_defined send_buffer_size;
26170
26171
26172
26173 Implements the SOL\_SOCKET/SO\_SNDBUF socket option.
26174
26175
26176 [heading Examples]
26177   
26178 Setting the option: 
26179
26180    boost::asio::ip::tcp::socket socket(my_context);
26181    ...
26182    boost::asio::socket_base::send_buffer_size option(8192);
26183    socket.set_option(option);
26184
26185
26186
26187
26188
26189 Getting the current option value: 
26190
26191    boost::asio::ip::tcp::socket socket(my_context);
26192    ...
26193    boost::asio::socket_base::send_buffer_size option;
26194    socket.get_option(option);
26195    int size = option.value();
26196
26197
26198
26199
26200
26201
26202
26203 [heading Requirements]
26204
26205 ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
26206
26207 ['Convenience header: ][^boost/asio.hpp]
26208
26209
26210 [endsect]
26211
26212
26213
26214 [section:send_low_watermark basic_seq_packet_socket::send_low_watermark]
26215
26216
26217 ['Inherited from socket_base.]
26218
26219 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.send_low_watermark..send_low_watermark..basic_seq_packet_socket] 
26220 Socket option for the send low watermark. 
26221
26222
26223   typedef implementation_defined send_low_watermark;
26224
26225
26226
26227 Implements the SOL\_SOCKET/SO\_SNDLOWAT socket option.
26228
26229
26230 [heading Examples]
26231   
26232 Setting the option: 
26233
26234    boost::asio::ip::tcp::socket socket(my_context);
26235    ...
26236    boost::asio::socket_base::send_low_watermark option(1024);
26237    socket.set_option(option);
26238
26239
26240
26241
26242
26243 Getting the current option value: 
26244
26245    boost::asio::ip::tcp::socket socket(my_context);
26246    ...
26247    boost::asio::socket_base::send_low_watermark option;
26248    socket.get_option(option);
26249    int size = option.value();
26250
26251
26252
26253
26254
26255
26256
26257 [heading Requirements]
26258
26259 ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
26260
26261 ['Convenience header: ][^boost/asio.hpp]
26262
26263
26264 [endsect]
26265
26266
26267 [section:set_option basic_seq_packet_socket::set_option]
26268
26269 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.set_option..set_option..basic_seq_packet_socket] 
26270 Set an option on the socket. 
26271
26272
26273   template<
26274       typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
26275   void ``[link boost_asio.reference.basic_seq_packet_socket.set_option.overload1 set_option]``(
26276       const SettableSocketOption & option);
26277   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.set_option.overload1 more...]]``
26278
26279   template<
26280       typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
26281   void ``[link boost_asio.reference.basic_seq_packet_socket.set_option.overload2 set_option]``(
26282       const SettableSocketOption & option,
26283       boost::system::error_code & ec);
26284   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.set_option.overload2 more...]]``
26285
26286
26287 [section:overload1 basic_seq_packet_socket::set_option (1 of 2 overloads)]
26288
26289
26290 ['Inherited from basic_socket.]
26291
26292
26293 Set an option on the socket. 
26294
26295
26296   template<
26297       typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
26298   void set_option(
26299       const SettableSocketOption & option);
26300
26301
26302 This function is used to set an option on the socket.
26303
26304
26305 [heading Parameters]
26306     
26307
26308 [variablelist
26309   
26310 [[option][The new option value to be set on the socket.]]
26311
26312 ]
26313
26314
26315 [heading Exceptions]
26316     
26317
26318 [variablelist
26319   
26320 [[boost::system::system_error][Thrown on failure.]]
26321
26322 ]
26323
26324
26325
26326 [heading Example]
26327   
26328 Setting the IPPROTO\_TCP/TCP\_NODELAY option: 
26329
26330    boost::asio::ip::tcp::socket socket(my_context);
26331    ...
26332    boost::asio::ip::tcp::no_delay option(true);
26333    socket.set_option(option);
26334
26335
26336
26337
26338
26339
26340
26341 [endsect]
26342
26343
26344
26345 [section:overload2 basic_seq_packet_socket::set_option (2 of 2 overloads)]
26346
26347
26348 ['Inherited from basic_socket.]
26349
26350
26351 Set an option on the socket. 
26352
26353
26354   template<
26355       typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
26356   void set_option(
26357       const SettableSocketOption & option,
26358       boost::system::error_code & ec);
26359
26360
26361 This function is used to set an option on the socket.
26362
26363
26364 [heading Parameters]
26365     
26366
26367 [variablelist
26368   
26369 [[option][The new option value to be set on the socket.]]
26370
26371 [[ec][Set to indicate what error occurred, if any.]]
26372
26373 ]
26374
26375
26376
26377 [heading Example]
26378   
26379 Setting the IPPROTO\_TCP/TCP\_NODELAY option: 
26380
26381    boost::asio::ip::tcp::socket socket(my_context);
26382    ...
26383    boost::asio::ip::tcp::no_delay option(true);
26384    boost::system::error_code ec;
26385    socket.set_option(option, ec);
26386    if (ec)
26387    {
26388      // An error occurred.
26389    }
26390
26391
26392
26393
26394
26395
26396
26397 [endsect]
26398
26399
26400 [endsect]
26401
26402 [section:shutdown basic_seq_packet_socket::shutdown]
26403
26404 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.shutdown..shutdown..basic_seq_packet_socket] 
26405 Disable sends or receives on the socket. 
26406
26407
26408   void ``[link boost_asio.reference.basic_seq_packet_socket.shutdown.overload1 shutdown]``(
26409       shutdown_type what);
26410   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.shutdown.overload1 more...]]``
26411
26412   void ``[link boost_asio.reference.basic_seq_packet_socket.shutdown.overload2 shutdown]``(
26413       shutdown_type what,
26414       boost::system::error_code & ec);
26415   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.shutdown.overload2 more...]]``
26416
26417
26418 [section:overload1 basic_seq_packet_socket::shutdown (1 of 2 overloads)]
26419
26420
26421 ['Inherited from basic_socket.]
26422
26423
26424 Disable sends or receives on the socket. 
26425
26426
26427   void shutdown(
26428       shutdown_type what);
26429
26430
26431 This function is used to disable send operations, receive operations, or both.
26432
26433
26434 [heading Parameters]
26435     
26436
26437 [variablelist
26438   
26439 [[what][Determines what types of operation will no longer be allowed.]]
26440
26441 ]
26442
26443
26444 [heading Exceptions]
26445     
26446
26447 [variablelist
26448   
26449 [[boost::system::system_error][Thrown on failure.]]
26450
26451 ]
26452
26453
26454 [heading Example]
26455   
26456 Shutting down the send side of the socket: 
26457
26458    boost::asio::ip::tcp::socket socket(my_context);
26459    ...
26460    socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send);
26461
26462
26463
26464
26465
26466
26467
26468 [endsect]
26469
26470
26471
26472 [section:overload2 basic_seq_packet_socket::shutdown (2 of 2 overloads)]
26473
26474
26475 ['Inherited from basic_socket.]
26476
26477
26478 Disable sends or receives on the socket. 
26479
26480
26481   void shutdown(
26482       shutdown_type what,
26483       boost::system::error_code & ec);
26484
26485
26486 This function is used to disable send operations, receive operations, or both.
26487
26488
26489 [heading Parameters]
26490     
26491
26492 [variablelist
26493   
26494 [[what][Determines what types of operation will no longer be allowed.]]
26495
26496 [[ec][Set to indicate what error occurred, if any.]]
26497
26498 ]
26499
26500
26501 [heading Example]
26502   
26503 Shutting down the send side of the socket: 
26504
26505    boost::asio::ip::tcp::socket socket(my_context);
26506    ...
26507    boost::system::error_code ec;
26508    socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send, ec);
26509    if (ec)
26510    {
26511      // An error occurred.
26512    }
26513
26514
26515
26516
26517
26518
26519
26520 [endsect]
26521
26522
26523 [endsect]
26524
26525
26526 [section:shutdown_type basic_seq_packet_socket::shutdown_type]
26527
26528
26529 ['Inherited from socket_base.]
26530
26531 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.shutdown_type..shutdown_type..basic_seq_packet_socket] 
26532 Different ways a socket may be shutdown. 
26533
26534
26535   enum shutdown_type
26536
26537 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.shutdown_type.shutdown_receive..shutdown_receive..basic_seq_packet_socket]
26538 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.shutdown_type.shutdown_send..shutdown_send..basic_seq_packet_socket]
26539 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.shutdown_type.shutdown_both..shutdown_both..basic_seq_packet_socket]
26540
26541 [heading Values]
26542 [variablelist
26543
26544   [
26545     [shutdown_receive]
26546     [Shutdown the receive side of the socket. ]
26547   ]
26548
26549   [
26550     [shutdown_send]
26551     [Shutdown the send side of the socket. ]
26552   ]
26553
26554   [
26555     [shutdown_both]
26556     [Shutdown both send and receive on the socket. ]
26557   ]
26558
26559 ]
26560
26561
26562
26563 [endsect]
26564
26565
26566 [section:wait basic_seq_packet_socket::wait]
26567
26568 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.wait..wait..basic_seq_packet_socket] 
26569 Wait for the socket to become ready to read, ready to write, or to have pending error conditions. 
26570
26571
26572   void ``[link boost_asio.reference.basic_seq_packet_socket.wait.overload1 wait]``(
26573       wait_type w);
26574   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.wait.overload1 more...]]``
26575
26576   void ``[link boost_asio.reference.basic_seq_packet_socket.wait.overload2 wait]``(
26577       wait_type w,
26578       boost::system::error_code & ec);
26579   ``  [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.wait.overload2 more...]]``
26580
26581
26582 [section:overload1 basic_seq_packet_socket::wait (1 of 2 overloads)]
26583
26584
26585 ['Inherited from basic_socket.]
26586
26587
26588 Wait for the socket to become ready to read, ready to write, or to have pending error conditions. 
26589
26590
26591   void wait(
26592       wait_type w);
26593
26594
26595 This function is used to perform a blocking wait for a socket to enter a ready to read, write or error condition state.
26596
26597
26598 [heading Parameters]
26599     
26600
26601 [variablelist
26602   
26603 [[w][Specifies the desired socket state.]]
26604
26605 ]
26606
26607
26608 [heading Example]
26609   
26610 Waiting for a socket to become readable. 
26611
26612    boost::asio::ip::tcp::socket socket(my_context);
26613    ...
26614    socket.wait(boost::asio::ip::tcp::socket::wait_read);
26615
26616
26617
26618
26619
26620
26621
26622 [endsect]
26623
26624
26625
26626 [section:overload2 basic_seq_packet_socket::wait (2 of 2 overloads)]
26627
26628
26629 ['Inherited from basic_socket.]
26630
26631
26632 Wait for the socket to become ready to read, ready to write, or to have pending error conditions. 
26633
26634
26635   void wait(
26636       wait_type w,
26637       boost::system::error_code & ec);
26638
26639
26640 This function is used to perform a blocking wait for a socket to enter a ready to read, write or error condition state.
26641
26642
26643 [heading Parameters]
26644     
26645
26646 [variablelist
26647   
26648 [[w][Specifies the desired socket state.]]
26649
26650 [[ec][Set to indicate what error occurred, if any.]]
26651
26652 ]
26653
26654
26655 [heading Example]
26656   
26657 Waiting for a socket to become readable. 
26658
26659    boost::asio::ip::tcp::socket socket(my_context);
26660    ...
26661    boost::system::error_code ec;
26662    socket.wait(boost::asio::ip::tcp::socket::wait_read, ec);
26663
26664
26665
26666
26667
26668
26669
26670 [endsect]
26671
26672
26673 [endsect]
26674
26675
26676 [section:wait_type basic_seq_packet_socket::wait_type]
26677
26678
26679 ['Inherited from socket_base.]
26680
26681 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.wait_type..wait_type..basic_seq_packet_socket] 
26682 Wait types. 
26683
26684
26685   enum wait_type
26686
26687 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.wait_type.wait_read..wait_read..basic_seq_packet_socket]
26688 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.wait_type.wait_write..wait_write..basic_seq_packet_socket]
26689 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.wait_type.wait_error..wait_error..basic_seq_packet_socket]
26690
26691 [heading Values]
26692 [variablelist
26693
26694   [
26695     [wait_read]
26696     [Wait for a socket to become ready to read. ]
26697   ]
26698
26699   [
26700     [wait_write]
26701     [Wait for a socket to become ready to write. ]
26702   ]
26703
26704   [
26705     [wait_error]
26706     [Wait for a socket to have error conditions pending. ]
26707   ]
26708
26709 ]
26710
26711
26712 For use with `basic_socket::wait()` and `basic_socket::async_wait()`. 
26713
26714
26715 [endsect]
26716
26717
26718
26719 [section:_basic_seq_packet_socket basic_seq_packet_socket::~basic_seq_packet_socket]
26720
26721 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket._basic_seq_packet_socket..~basic_seq_packet_socket..basic_seq_packet_socket] 
26722 Destroys the socket. 
26723
26724
26725   ~basic_seq_packet_socket();
26726
26727
26728 This function destroys the socket, cancelling any outstanding asynchronous operations associated with the socket as if by calling `cancel`. 
26729
26730
26731 [endsect]
26732
26733
26734
26735 [endsect]
26736
26737 [section:basic_seq_packet_socket__rebind_executor basic_seq_packet_socket::rebind_executor]
26738
26739
26740 Rebinds the socket type to another executor. 
26741
26742
26743   template<
26744       typename ``[link boost_asio.reference.Executor1 Executor1]``>
26745   struct rebind_executor
26746
26747
26748 [heading Types]
26749 [table
26750   [[Name][Description]]
26751
26752   [
26753
26754     [[link boost_asio.reference.basic_seq_packet_socket__rebind_executor.other [*other]]]
26755     [The socket type when rebound to the specified executor. ]
26756   
26757   ]
26758
26759 ]
26760
26761 [heading Requirements]
26762
26763 ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
26764
26765 ['Convenience header: ][^boost/asio.hpp]
26766
26767
26768 [section:other basic_seq_packet_socket::rebind_executor::other]
26769
26770 [indexterm2 boost_asio.indexterm.basic_seq_packet_socket__rebind_executor.other..other..basic_seq_packet_socket::rebind_executor] 
26771 The socket type when rebound to the specified executor. 
26772
26773
26774   typedef basic_seq_packet_socket< Protocol, Executor1 > other;
26775
26776
26777 [heading Types]
26778 [table
26779   [[Name][Description]]
26780
26781   [
26782
26783     [[link boost_asio.reference.basic_seq_packet_socket__rebind_executor [*rebind_executor]]]
26784     [Rebinds the socket type to another executor. ]
26785   
26786   ]
26787
26788   [
26789
26790     [[link boost_asio.reference.basic_seq_packet_socket.broadcast [*broadcast]]]
26791     [Socket option to permit sending of broadcast messages. ]
26792   
26793   ]
26794
26795   [
26796
26797     [[link boost_asio.reference.basic_seq_packet_socket.bytes_readable [*bytes_readable]]]
26798     [IO control command to get the amount of data that can be read without blocking. ]
26799   
26800   ]
26801
26802   [
26803
26804     [[link boost_asio.reference.basic_seq_packet_socket.debug [*debug]]]
26805     [Socket option to enable socket-level debugging. ]
26806   
26807   ]
26808
26809   [
26810
26811     [[link boost_asio.reference.basic_seq_packet_socket.do_not_route [*do_not_route]]]
26812     [Socket option to prevent routing, use local interfaces only. ]
26813   
26814   ]
26815
26816   [
26817
26818     [[link boost_asio.reference.basic_seq_packet_socket.enable_connection_aborted [*enable_connection_aborted]]]
26819     [Socket option to report aborted connections on accept. ]
26820   
26821   ]
26822
26823   [
26824
26825     [[link boost_asio.reference.basic_seq_packet_socket.endpoint_type [*endpoint_type]]]
26826     [The endpoint type. ]
26827   
26828   ]
26829
26830   [
26831
26832     [[link boost_asio.reference.basic_seq_packet_socket.executor_type [*executor_type]]]
26833     [The type of the executor associated with the object. ]
26834   
26835   ]
26836
26837   [
26838
26839     [[link boost_asio.reference.basic_seq_packet_socket.keep_alive [*keep_alive]]]
26840     [Socket option to send keep-alives. ]
26841   
26842   ]
26843
26844   [
26845
26846     [[link boost_asio.reference.basic_seq_packet_socket.linger [*linger]]]
26847     [Socket option to specify whether the socket lingers on close if unsent data is present. ]
26848   
26849   ]
26850
26851   [
26852
26853     [[link boost_asio.reference.basic_seq_packet_socket.lowest_layer_type [*lowest_layer_type]]]
26854     [A basic_socket is always the lowest layer. ]
26855   
26856   ]
26857
26858   [
26859
26860     [[link boost_asio.reference.basic_seq_packet_socket.message_flags [*message_flags]]]
26861     [Bitmask type for flags that can be passed to send and receive operations. ]
26862   
26863   ]
26864
26865   [
26866
26867     [[link boost_asio.reference.basic_seq_packet_socket.native_handle_type [*native_handle_type]]]
26868     [The native representation of a socket. ]
26869   
26870   ]
26871
26872   [
26873
26874     [[link boost_asio.reference.basic_seq_packet_socket.out_of_band_inline [*out_of_band_inline]]]
26875     [Socket option for putting received out-of-band data inline. ]
26876   
26877   ]
26878
26879   [
26880
26881     [[link boost_asio.reference.basic_seq_packet_socket.protocol_type [*protocol_type]]]
26882     [The protocol type. ]
26883   
26884   ]
26885
26886   [
26887
26888     [[link boost_asio.reference.basic_seq_packet_socket.receive_buffer_size [*receive_buffer_size]]]
26889     [Socket option for the receive buffer size of a socket. ]
26890   
26891   ]
26892
26893   [
26894
26895     [[link boost_asio.reference.basic_seq_packet_socket.receive_low_watermark [*receive_low_watermark]]]
26896     [Socket option for the receive low watermark. ]
26897   
26898   ]
26899
26900   [
26901
26902     [[link boost_asio.reference.basic_seq_packet_socket.reuse_address [*reuse_address]]]
26903     [Socket option to allow the socket to be bound to an address that is already in use. ]
26904   
26905   ]
26906
26907   [
26908
26909     [[link boost_asio.reference.basic_seq_packet_socket.send_buffer_size [*send_buffer_size]]]
26910     [Socket option for the send buffer size of a socket. ]
26911   
26912   ]
26913
26914   [
26915
26916     [[link boost_asio.reference.basic_seq_packet_socket.send_low_watermark [*send_low_watermark]]]
26917     [Socket option for the send low watermark. ]
26918   
26919   ]
26920
26921   [
26922
26923     [[link boost_asio.reference.basic_seq_packet_socket.shutdown_type [*shutdown_type]]]
26924     [Different ways a socket may be shutdown. ]
26925   
26926   ]
26927
26928   [
26929
26930     [[link boost_asio.reference.basic_seq_packet_socket.wait_type [*wait_type]]]
26931     [Wait types. ]
26932   
26933   ]
26934
26935 ]
26936
26937 [heading Member Functions]
26938 [table
26939   [[Name][Description]]
26940
26941   [
26942     [[link boost_asio.reference.basic_seq_packet_socket.assign [*assign]]]
26943     [Assign an existing native socket to the socket. ]
26944   ]
26945   
26946   [
26947     [[link boost_asio.reference.basic_seq_packet_socket.async_connect [*async_connect]]]
26948     [Start an asynchronous connect. ]
26949   ]
26950   
26951   [
26952     [[link boost_asio.reference.basic_seq_packet_socket.async_receive [*async_receive]]]
26953     [Start an asynchronous receive. ]
26954   ]
26955   
26956   [
26957     [[link boost_asio.reference.basic_seq_packet_socket.async_send [*async_send]]]
26958     [Start an asynchronous send. ]
26959   ]
26960   
26961   [
26962     [[link boost_asio.reference.basic_seq_packet_socket.async_wait [*async_wait]]]
26963     [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
26964   ]
26965   
26966   [
26967     [[link boost_asio.reference.basic_seq_packet_socket.at_mark [*at_mark]]]
26968     [Determine whether the socket is at the out-of-band data mark. ]
26969   ]
26970   
26971   [
26972     [[link boost_asio.reference.basic_seq_packet_socket.available [*available]]]
26973     [Determine the number of bytes available for reading. ]
26974   ]
26975   
26976   [
26977     [[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket [*basic_seq_packet_socket]]]
26978     [Construct a basic_seq_packet_socket without opening it. 
26979      [hr]
26980      Construct and open a basic_seq_packet_socket. 
26981      [hr]
26982      Construct a basic_seq_packet_socket, opening it and binding it to the given local endpoint. 
26983      [hr]
26984      Construct a basic_seq_packet_socket on an existing native socket. 
26985      [hr]
26986      Move-construct a basic_seq_packet_socket from another. 
26987      [hr]
26988      Move-construct a basic_seq_packet_socket from a socket of another protocol type. ]
26989   ]
26990   
26991   [
26992     [[link boost_asio.reference.basic_seq_packet_socket.bind [*bind]]]
26993     [Bind the socket to the given local endpoint. ]
26994   ]
26995   
26996   [
26997     [[link boost_asio.reference.basic_seq_packet_socket.cancel [*cancel]]]
26998     [Cancel all asynchronous operations associated with the socket. ]
26999   ]
27000   
27001   [
27002     [[link boost_asio.reference.basic_seq_packet_socket.close [*close]]]
27003     [Close the socket. ]
27004   ]
27005   
27006   [
27007     [[link boost_asio.reference.basic_seq_packet_socket.connect [*connect]]]
27008     [Connect the socket to the specified endpoint. ]
27009   ]
27010   
27011   [
27012     [[link boost_asio.reference.basic_seq_packet_socket.get_executor [*get_executor]]]
27013     [Get the executor associated with the object. ]
27014   ]
27015   
27016   [
27017     [[link boost_asio.reference.basic_seq_packet_socket.get_option [*get_option]]]
27018     [Get an option from the socket. ]
27019   ]
27020   
27021   [
27022     [[link boost_asio.reference.basic_seq_packet_socket.io_control [*io_control]]]
27023     [Perform an IO control command on the socket. ]
27024   ]
27025   
27026   [
27027     [[link boost_asio.reference.basic_seq_packet_socket.is_open [*is_open]]]
27028     [Determine whether the socket is open. ]
27029   ]
27030   
27031   [
27032     [[link boost_asio.reference.basic_seq_packet_socket.local_endpoint [*local_endpoint]]]
27033     [Get the local endpoint of the socket. ]
27034   ]
27035   
27036   [
27037     [[link boost_asio.reference.basic_seq_packet_socket.lowest_layer [*lowest_layer]]]
27038     [Get a reference to the lowest layer. 
27039      [hr]
27040      Get a const reference to the lowest layer. ]
27041   ]
27042   
27043   [
27044     [[link boost_asio.reference.basic_seq_packet_socket.native_handle [*native_handle]]]
27045     [Get the native socket representation. ]
27046   ]
27047   
27048   [
27049     [[link boost_asio.reference.basic_seq_packet_socket.native_non_blocking [*native_non_blocking]]]
27050     [Gets the non-blocking mode of the native socket implementation. 
27051      [hr]
27052      Sets the non-blocking mode of the native socket implementation. ]
27053   ]
27054   
27055   [
27056     [[link boost_asio.reference.basic_seq_packet_socket.non_blocking [*non_blocking]]]
27057     [Gets the non-blocking mode of the socket. 
27058      [hr]
27059      Sets the non-blocking mode of the socket. ]
27060   ]
27061   
27062   [
27063     [[link boost_asio.reference.basic_seq_packet_socket.open [*open]]]
27064     [Open the socket using the specified protocol. ]
27065   ]
27066   
27067   [
27068     [[link boost_asio.reference.basic_seq_packet_socket.operator_eq_ [*operator=]]]
27069     [Move-assign a basic_seq_packet_socket from another. 
27070      [hr]
27071      Move-assign a basic_seq_packet_socket from a socket of another protocol type. ]
27072   ]
27073   
27074   [
27075     [[link boost_asio.reference.basic_seq_packet_socket.receive [*receive]]]
27076     [Receive some data on the socket. 
27077      [hr]
27078      Receive some data on a connected socket. ]
27079   ]
27080   
27081   [
27082     [[link boost_asio.reference.basic_seq_packet_socket.release [*release]]]
27083     [Release ownership of the underlying native socket. ]
27084   ]
27085   
27086   [
27087     [[link boost_asio.reference.basic_seq_packet_socket.remote_endpoint [*remote_endpoint]]]
27088     [Get the remote endpoint of the socket. ]
27089   ]
27090   
27091   [
27092     [[link boost_asio.reference.basic_seq_packet_socket.send [*send]]]
27093     [Send some data on the socket. ]
27094   ]
27095   
27096   [
27097     [[link boost_asio.reference.basic_seq_packet_socket.set_option [*set_option]]]
27098     [Set an option on the socket. ]
27099   ]
27100   
27101   [
27102     [[link boost_asio.reference.basic_seq_packet_socket.shutdown [*shutdown]]]
27103     [Disable sends or receives on the socket. ]
27104   ]
27105   
27106   [
27107     [[link boost_asio.reference.basic_seq_packet_socket.wait [*wait]]]
27108     [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
27109   ]
27110   
27111   [
27112     [[link boost_asio.reference.basic_seq_packet_socket._basic_seq_packet_socket [*~basic_seq_packet_socket]]]
27113     [Destroys the socket. ]
27114   ]
27115   
27116 ]
27117
27118 [heading Data Members]
27119 [table
27120   [[Name][Description]]
27121
27122   [
27123     [[link boost_asio.reference.basic_seq_packet_socket.max_connections [*max_connections]]]
27124     [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
27125   ]
27126
27127   [
27128     [[link boost_asio.reference.basic_seq_packet_socket.max_listen_connections [*max_listen_connections]]]
27129     [The maximum length of the queue of pending incoming connections. ]
27130   ]
27131
27132   [
27133     [[link boost_asio.reference.basic_seq_packet_socket.message_do_not_route [*message_do_not_route]]]
27134     [Specify that the data should not be subject to routing. ]
27135   ]
27136
27137   [
27138     [[link boost_asio.reference.basic_seq_packet_socket.message_end_of_record [*message_end_of_record]]]
27139     [Specifies that the data marks the end of a record. ]
27140   ]
27141
27142   [
27143     [[link boost_asio.reference.basic_seq_packet_socket.message_out_of_band [*message_out_of_band]]]
27144     [Process out-of-band data. ]
27145   ]
27146
27147   [
27148     [[link boost_asio.reference.basic_seq_packet_socket.message_peek [*message_peek]]]
27149     [Peek at incoming data without removing it from the input queue. ]
27150   ]
27151
27152 ]
27153
27154 [heading Protected Data Members]
27155 [table
27156   [[Name][Description]]
27157
27158   [
27159     [[link boost_asio.reference.basic_seq_packet_socket.impl_ [*impl_]]]
27160     []
27161   ]
27162
27163 ]
27164
27165 The [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] class template provides asynchronous and blocking sequenced packet socket functionality.
27166
27167
27168 [heading Thread Safety]
27169   
27170 ['Distinct] ['objects:] Safe.
27171
27172 ['Shared] ['objects:] Unsafe. 
27173
27174
27175
27176
27177 [heading Requirements]
27178
27179 ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
27180
27181 ['Convenience header: ][^boost/asio.hpp]
27182
27183
27184 [endsect]
27185
27186
27187
27188 [endsect]
27189
27190 [section:basic_serial_port basic_serial_port]
27191
27192
27193 Provides serial port functionality. 
27194
27195
27196   template<
27197       typename ``[link boost_asio.reference.Executor1 Executor]`` = executor>
27198   class basic_serial_port :
27199     public serial_port_base
27200
27201
27202 [heading Types]
27203 [table
27204   [[Name][Description]]
27205
27206   [
27207
27208     [[link boost_asio.reference.basic_serial_port__rebind_executor [*rebind_executor]]]
27209     [Rebinds the serial port type to another executor. ]
27210   
27211   ]
27212
27213   [
27214
27215     [[link boost_asio.reference.basic_serial_port.executor_type [*executor_type]]]
27216     [The type of the executor associated with the object. ]
27217   
27218   ]
27219
27220   [
27221
27222     [[link boost_asio.reference.basic_serial_port.lowest_layer_type [*lowest_layer_type]]]
27223     [A basic_basic_serial_port is always the lowest layer. ]
27224   
27225   ]
27226
27227   [
27228
27229     [[link boost_asio.reference.basic_serial_port.native_handle_type [*native_handle_type]]]
27230     [The native representation of a serial port. ]
27231   
27232   ]
27233
27234 ]
27235
27236 [heading Member Functions]
27237 [table
27238   [[Name][Description]]
27239
27240   [
27241     [[link boost_asio.reference.basic_serial_port.assign [*assign]]]
27242     [Assign an existing native serial port to the serial port. ]
27243   ]
27244   
27245   [
27246     [[link boost_asio.reference.basic_serial_port.async_read_some [*async_read_some]]]
27247     [Start an asynchronous read. ]
27248   ]
27249   
27250   [
27251     [[link boost_asio.reference.basic_serial_port.async_write_some [*async_write_some]]]
27252     [Start an asynchronous write. ]
27253   ]
27254   
27255   [
27256     [[link boost_asio.reference.basic_serial_port.basic_serial_port [*basic_serial_port]]]
27257     [Construct a basic_serial_port without opening it. 
27258      [hr]
27259      Construct and open a basic_serial_port. 
27260      [hr]
27261      Construct a basic_serial_port on an existing native serial port. 
27262      [hr]
27263      Move-construct a basic_serial_port from another. ]
27264   ]
27265   
27266   [
27267     [[link boost_asio.reference.basic_serial_port.cancel [*cancel]]]
27268     [Cancel all asynchronous operations associated with the serial port. ]
27269   ]
27270   
27271   [
27272     [[link boost_asio.reference.basic_serial_port.close [*close]]]
27273     [Close the serial port. ]
27274   ]
27275   
27276   [
27277     [[link boost_asio.reference.basic_serial_port.get_executor [*get_executor]]]
27278     [Get the executor associated with the object. ]
27279   ]
27280   
27281   [
27282     [[link boost_asio.reference.basic_serial_port.get_option [*get_option]]]
27283     [Get an option from the serial port. ]
27284   ]
27285   
27286   [
27287     [[link boost_asio.reference.basic_serial_port.is_open [*is_open]]]
27288     [Determine whether the serial port is open. ]
27289   ]
27290   
27291   [
27292     [[link boost_asio.reference.basic_serial_port.lowest_layer [*lowest_layer]]]
27293     [Get a reference to the lowest layer. 
27294      [hr]
27295      Get a const reference to the lowest layer. ]
27296   ]
27297   
27298   [
27299     [[link boost_asio.reference.basic_serial_port.native_handle [*native_handle]]]
27300     [Get the native serial port representation. ]
27301   ]
27302   
27303   [
27304     [[link boost_asio.reference.basic_serial_port.open [*open]]]
27305     [Open the serial port using the specified device name. ]
27306   ]
27307   
27308   [
27309     [[link boost_asio.reference.basic_serial_port.operator_eq_ [*operator=]]]
27310     [Move-assign a basic_serial_port from another. ]
27311   ]
27312   
27313   [
27314     [[link boost_asio.reference.basic_serial_port.read_some [*read_some]]]
27315     [Read some data from the serial port. ]
27316   ]
27317   
27318   [
27319     [[link boost_asio.reference.basic_serial_port.send_break [*send_break]]]
27320     [Send a break sequence to the serial port. ]
27321   ]
27322   
27323   [
27324     [[link boost_asio.reference.basic_serial_port.set_option [*set_option]]]
27325     [Set an option on the serial port. ]
27326   ]
27327   
27328   [
27329     [[link boost_asio.reference.basic_serial_port.write_some [*write_some]]]
27330     [Write some data to the serial port. ]
27331   ]
27332   
27333   [
27334     [[link boost_asio.reference.basic_serial_port._basic_serial_port [*~basic_serial_port]]]
27335     [Destroys the serial port. ]
27336   ]
27337   
27338 ]
27339
27340 The [link boost_asio.reference.basic_serial_port `basic_serial_port`] class provides a wrapper over serial port functionality.
27341
27342
27343 [heading Thread Safety]
27344   
27345 ['Distinct] ['objects:] Safe.
27346
27347 ['Shared] ['objects:] Unsafe. 
27348
27349
27350
27351 [heading Requirements]
27352
27353 ['Header: ][^boost/asio/basic_serial_port.hpp]
27354
27355 ['Convenience header: ][^boost/asio.hpp]
27356
27357 [section:assign basic_serial_port::assign]
27358
27359 [indexterm2 boost_asio.indexterm.basic_serial_port.assign..assign..basic_serial_port] 
27360 Assign an existing native serial port to the serial port. 
27361
27362
27363   void ``[link boost_asio.reference.basic_serial_port.assign.overload1 assign]``(
27364       const native_handle_type & native_serial_port);
27365   ``  [''''&raquo;''' [link boost_asio.reference.basic_serial_port.assign.overload1 more...]]``
27366
27367   void ``[link boost_asio.reference.basic_serial_port.assign.overload2 assign]``(
27368       const native_handle_type & native_serial_port,
27369       boost::system::error_code & ec);
27370   ``  [''''&raquo;''' [link boost_asio.reference.basic_serial_port.assign.overload2 more...]]``
27371
27372
27373 [section:overload1 basic_serial_port::assign (1 of 2 overloads)]
27374
27375
27376 Assign an existing native serial port to the serial port. 
27377
27378
27379   void assign(
27380       const native_handle_type & native_serial_port);
27381
27382
27383
27384 [endsect]
27385
27386
27387
27388 [section:overload2 basic_serial_port::assign (2 of 2 overloads)]
27389
27390
27391 Assign an existing native serial port to the serial port. 
27392
27393
27394   void assign(
27395       const native_handle_type & native_serial_port,
27396       boost::system::error_code & ec);
27397
27398
27399
27400 [endsect]
27401
27402
27403 [endsect]
27404
27405
27406 [section:async_read_some basic_serial_port::async_read_some]
27407
27408 [indexterm2 boost_asio.indexterm.basic_serial_port.async_read_some..async_read_some..basic_serial_port] 
27409 Start an asynchronous read. 
27410
27411
27412   template<
27413       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
27414       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
27415   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_some(
27416       const MutableBufferSequence & buffers,
27417       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
27418
27419
27420 This function is used to asynchronously read data from the serial port. The function call always returns immediately.
27421
27422
27423 [heading Parameters]
27424     
27425
27426 [variablelist
27427   
27428 [[buffers][One or more buffers into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
27429
27430 [[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
27431 ``
27432    void handler(
27433      const boost::system::error_code& error, // Result of operation.
27434      std::size_t bytes_transferred           // Number of bytes read.
27435    ); 
27436 ``
27437 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
27438
27439 ]
27440
27441
27442 [heading Remarks]
27443       
27444 The read operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.async_read `async_read`]  function if you need to ensure that the requested amount of data is read before the asynchronous operation completes.
27445
27446
27447 [heading Example]
27448   
27449 To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
27450
27451    basic_serial_port.async_read_some(
27452        boost::asio::buffer(data, size), handler);
27453
27454
27455 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
27456
27457
27458
27459
27460 [endsect]
27461
27462
27463
27464 [section:async_write_some basic_serial_port::async_write_some]
27465
27466 [indexterm2 boost_asio.indexterm.basic_serial_port.async_write_some..async_write_some..basic_serial_port] 
27467 Start an asynchronous write. 
27468
27469
27470   template<
27471       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
27472       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
27473   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_some(
27474       const ConstBufferSequence & buffers,
27475       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
27476
27477
27478 This function is used to asynchronously write data to the serial port. The function call always returns immediately.
27479
27480
27481 [heading Parameters]
27482     
27483
27484 [variablelist
27485   
27486 [[buffers][One or more data buffers to be written to the serial port. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
27487
27488 [[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
27489 ``
27490    void handler(
27491      const boost::system::error_code& error, // Result of operation.
27492      std::size_t bytes_transferred           // Number of bytes written.
27493    ); 
27494 ``
27495 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
27496
27497 ]
27498
27499
27500 [heading Remarks]
27501       
27502 The write operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.async_write `async_write`]  function if you need to ensure that all data is written before the asynchronous operation completes.
27503
27504
27505 [heading Example]
27506   
27507 To write a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
27508
27509    basic_serial_port.async_write_some(
27510        boost::asio::buffer(data, size), handler);
27511
27512
27513 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
27514
27515
27516
27517
27518 [endsect]
27519
27520
27521 [section:basic_serial_port basic_serial_port::basic_serial_port]
27522
27523 [indexterm2 boost_asio.indexterm.basic_serial_port.basic_serial_port..basic_serial_port..basic_serial_port] 
27524 Construct a [link boost_asio.reference.basic_serial_port `basic_serial_port`] without opening it. 
27525
27526
27527   explicit ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload1 basic_serial_port]``(
27528       const executor_type & ex);
27529   ``  [''''&raquo;''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload1 more...]]``
27530
27531   template<
27532       typename ExecutionContext>
27533   explicit ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload2 basic_serial_port]``(
27534       ExecutionContext & context,
27535       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value, basic_serial_port >::type *  = 0);
27536   ``  [''''&raquo;''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload2 more...]]``
27537
27538
27539 Construct and open a [link boost_asio.reference.basic_serial_port `basic_serial_port`]. 
27540
27541
27542   ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload3 basic_serial_port]``(
27543       const executor_type & ex,
27544       const char * device);
27545   ``  [''''&raquo;''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload3 more...]]``
27546
27547   template<
27548       typename ExecutionContext>
27549   ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload4 basic_serial_port]``(
27550       ExecutionContext & context,
27551       const char * device,
27552       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
27553   ``  [''''&raquo;''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload4 more...]]``
27554
27555   ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload5 basic_serial_port]``(
27556       const executor_type & ex,
27557       const std::string & device);
27558   ``  [''''&raquo;''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload5 more...]]``
27559
27560   template<
27561       typename ExecutionContext>
27562   ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload6 basic_serial_port]``(
27563       ExecutionContext & context,
27564       const std::string & device,
27565       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
27566   ``  [''''&raquo;''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload6 more...]]``
27567
27568
27569 Construct a [link boost_asio.reference.basic_serial_port `basic_serial_port`] on an existing native serial port. 
27570
27571
27572   ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload7 basic_serial_port]``(
27573       const executor_type & ex,
27574       const native_handle_type & native_serial_port);
27575   ``  [''''&raquo;''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload7 more...]]``
27576
27577   template<
27578       typename ExecutionContext>
27579   ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload8 basic_serial_port]``(
27580       ExecutionContext & context,
27581       const native_handle_type & native_serial_port,
27582       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
27583   ``  [''''&raquo;''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload8 more...]]``
27584
27585
27586 Move-construct a [link boost_asio.reference.basic_serial_port `basic_serial_port`] from another. 
27587
27588
27589   ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload9 basic_serial_port]``(
27590       basic_serial_port && other);
27591   ``  [''''&raquo;''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload9 more...]]``
27592
27593
27594 [section:overload1 basic_serial_port::basic_serial_port (1 of 9 overloads)]
27595
27596
27597 Construct a [link boost_asio.reference.basic_serial_port `basic_serial_port`] without opening it. 
27598
27599
27600   basic_serial_port(
27601       const executor_type & ex);
27602
27603
27604 This constructor creates a serial port without opening it.
27605
27606
27607 [heading Parameters]
27608     
27609
27610 [variablelist
27611   
27612 [[ex][The I/O executor that the serial port will use, by default, to dispatch handlers for any asynchronous operations performed on the serial port. ]]
27613
27614 ]
27615
27616
27617
27618
27619 [endsect]
27620
27621
27622
27623 [section:overload2 basic_serial_port::basic_serial_port (2 of 9 overloads)]
27624
27625
27626 Construct a [link boost_asio.reference.basic_serial_port `basic_serial_port`] without opening it. 
27627
27628
27629   template<
27630       typename ExecutionContext>
27631   basic_serial_port(
27632       ExecutionContext & context,
27633       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value, basic_serial_port >::type *  = 0);
27634
27635
27636 This constructor creates a serial port without opening it.
27637
27638
27639 [heading Parameters]
27640     
27641
27642 [variablelist
27643   
27644 [[context][An execution context which provides the I/O executor that the serial port will use, by default, to dispatch handlers for any asynchronous operations performed on the serial port. ]]
27645
27646 ]
27647
27648
27649
27650
27651 [endsect]
27652
27653
27654
27655 [section:overload3 basic_serial_port::basic_serial_port (3 of 9 overloads)]
27656
27657
27658 Construct and open a [link boost_asio.reference.basic_serial_port `basic_serial_port`]. 
27659
27660
27661   basic_serial_port(
27662       const executor_type & ex,
27663       const char * device);
27664
27665
27666 This constructor creates and opens a serial port for the specified device name.
27667
27668
27669 [heading Parameters]
27670     
27671
27672 [variablelist
27673   
27674 [[ex][The I/O executor that the serial port will use, by default, to dispatch handlers for any asynchronous operations performed on the serial port.]]
27675
27676 [[device][The platform-specific device name for this serial port. ]]
27677
27678 ]
27679
27680
27681
27682
27683 [endsect]
27684
27685
27686
27687 [section:overload4 basic_serial_port::basic_serial_port (4 of 9 overloads)]
27688
27689
27690 Construct and open a [link boost_asio.reference.basic_serial_port `basic_serial_port`]. 
27691
27692
27693   template<
27694       typename ExecutionContext>
27695   basic_serial_port(
27696       ExecutionContext & context,
27697       const char * device,
27698       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
27699
27700
27701 This constructor creates and opens a serial port for the specified device name.
27702
27703
27704 [heading Parameters]
27705     
27706
27707 [variablelist
27708   
27709 [[context][An execution context which provides the I/O executor that the serial port will use, by default, to dispatch handlers for any asynchronous operations performed on the serial port.]]
27710
27711 [[device][The platform-specific device name for this serial port. ]]
27712
27713 ]
27714
27715
27716
27717
27718 [endsect]
27719
27720
27721
27722 [section:overload5 basic_serial_port::basic_serial_port (5 of 9 overloads)]
27723
27724
27725 Construct and open a [link boost_asio.reference.basic_serial_port `basic_serial_port`]. 
27726
27727
27728   basic_serial_port(
27729       const executor_type & ex,
27730       const std::string & device);
27731
27732
27733 This constructor creates and opens a serial port for the specified device name.
27734
27735
27736 [heading Parameters]
27737     
27738
27739 [variablelist
27740   
27741 [[ex][The I/O executor that the serial port will use, by default, to dispatch handlers for any asynchronous operations performed on the serial port.]]
27742
27743 [[device][The platform-specific device name for this serial port. ]]
27744
27745 ]
27746
27747
27748
27749
27750 [endsect]
27751
27752
27753
27754 [section:overload6 basic_serial_port::basic_serial_port (6 of 9 overloads)]
27755
27756
27757 Construct and open a [link boost_asio.reference.basic_serial_port `basic_serial_port`]. 
27758
27759
27760   template<
27761       typename ExecutionContext>
27762   basic_serial_port(
27763       ExecutionContext & context,
27764       const std::string & device,
27765       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
27766
27767
27768 This constructor creates and opens a serial port for the specified device name.
27769
27770
27771 [heading Parameters]
27772     
27773
27774 [variablelist
27775   
27776 [[context][An execution context which provides the I/O executor that the serial port will use, by default, to dispatch handlers for any asynchronous operations performed on the serial port.]]
27777
27778 [[device][The platform-specific device name for this serial port. ]]
27779
27780 ]
27781
27782
27783
27784
27785 [endsect]
27786
27787
27788
27789 [section:overload7 basic_serial_port::basic_serial_port (7 of 9 overloads)]
27790
27791
27792 Construct a [link boost_asio.reference.basic_serial_port `basic_serial_port`] on an existing native serial port. 
27793
27794
27795   basic_serial_port(
27796       const executor_type & ex,
27797       const native_handle_type & native_serial_port);
27798
27799
27800 This constructor creates a serial port object to hold an existing native serial port.
27801
27802
27803 [heading Parameters]
27804     
27805
27806 [variablelist
27807   
27808 [[ex][The I/O executor that the serial port will use, by default, to dispatch handlers for any asynchronous operations performed on the serial port.]]
27809
27810 [[native_serial_port][A native serial port.]]
27811
27812 ]
27813
27814
27815 [heading Exceptions]
27816     
27817
27818 [variablelist
27819   
27820 [[boost::system::system_error][Thrown on failure. ]]
27821
27822 ]
27823
27824
27825
27826
27827 [endsect]
27828
27829
27830
27831 [section:overload8 basic_serial_port::basic_serial_port (8 of 9 overloads)]
27832
27833
27834 Construct a [link boost_asio.reference.basic_serial_port `basic_serial_port`] on an existing native serial port. 
27835
27836
27837   template<
27838       typename ExecutionContext>
27839   basic_serial_port(
27840       ExecutionContext & context,
27841       const native_handle_type & native_serial_port,
27842       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
27843
27844
27845 This constructor creates a serial port object to hold an existing native serial port.
27846
27847
27848 [heading Parameters]
27849     
27850
27851 [variablelist
27852   
27853 [[context][An execution context which provides the I/O executor that the serial port will use, by default, to dispatch handlers for any asynchronous operations performed on the serial port.]]
27854
27855 [[native_serial_port][A native serial port.]]
27856
27857 ]
27858
27859
27860 [heading Exceptions]
27861     
27862
27863 [variablelist
27864   
27865 [[boost::system::system_error][Thrown on failure. ]]
27866
27867 ]
27868
27869
27870
27871
27872 [endsect]
27873
27874
27875
27876 [section:overload9 basic_serial_port::basic_serial_port (9 of 9 overloads)]
27877
27878
27879 Move-construct a [link boost_asio.reference.basic_serial_port `basic_serial_port`] from another. 
27880
27881
27882   basic_serial_port(
27883       basic_serial_port && other);
27884
27885
27886 This constructor moves a serial port from one object to another.
27887
27888
27889 [heading Parameters]
27890     
27891
27892 [variablelist
27893   
27894 [[other][The other [link boost_asio.reference.basic_serial_port `basic_serial_port`] object from which the move will occur.]]
27895
27896 ]
27897
27898
27899 [heading Remarks]
27900       
27901 Following the move, the moved-from object is in the same state as if constructed using the `basic_serial_port(const executor_type&)` constructor. 
27902
27903
27904
27905
27906 [endsect]
27907
27908
27909 [endsect]
27910
27911 [section:cancel basic_serial_port::cancel]
27912
27913 [indexterm2 boost_asio.indexterm.basic_serial_port.cancel..cancel..basic_serial_port] 
27914 Cancel all asynchronous operations associated with the serial port. 
27915
27916
27917   void ``[link boost_asio.reference.basic_serial_port.cancel.overload1 cancel]``();
27918   ``  [''''&raquo;''' [link boost_asio.reference.basic_serial_port.cancel.overload1 more...]]``
27919
27920   void ``[link boost_asio.reference.basic_serial_port.cancel.overload2 cancel]``(
27921       boost::system::error_code & ec);
27922   ``  [''''&raquo;''' [link boost_asio.reference.basic_serial_port.cancel.overload2 more...]]``
27923
27924
27925 [section:overload1 basic_serial_port::cancel (1 of 2 overloads)]
27926
27927
27928 Cancel all asynchronous operations associated with the serial port. 
27929
27930
27931   void cancel();
27932
27933
27934 This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
27935
27936
27937 [heading Exceptions]
27938     
27939
27940 [variablelist
27941   
27942 [[boost::system::system_error][Thrown on failure. ]]
27943
27944 ]
27945
27946
27947
27948
27949 [endsect]
27950
27951
27952
27953 [section:overload2 basic_serial_port::cancel (2 of 2 overloads)]
27954
27955
27956 Cancel all asynchronous operations associated with the serial port. 
27957
27958
27959   void cancel(
27960       boost::system::error_code & ec);
27961
27962
27963 This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
27964
27965
27966 [heading Parameters]
27967     
27968
27969 [variablelist
27970   
27971 [[ec][Set to indicate what error occurred, if any. ]]
27972
27973 ]
27974
27975
27976
27977
27978 [endsect]
27979
27980
27981 [endsect]
27982
27983 [section:close basic_serial_port::close]
27984
27985 [indexterm2 boost_asio.indexterm.basic_serial_port.close..close..basic_serial_port] 
27986 Close the serial port. 
27987
27988
27989   void ``[link boost_asio.reference.basic_serial_port.close.overload1 close]``();
27990   ``  [''''&raquo;''' [link boost_asio.reference.basic_serial_port.close.overload1 more...]]``
27991
27992   void ``[link boost_asio.reference.basic_serial_port.close.overload2 close]``(
27993       boost::system::error_code & ec);
27994   ``  [''''&raquo;''' [link boost_asio.reference.basic_serial_port.close.overload2 more...]]``
27995
27996
27997 [section:overload1 basic_serial_port::close (1 of 2 overloads)]
27998
27999
28000 Close the serial port. 
28001
28002
28003   void close();
28004
28005
28006 This function is used to close the serial port. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
28007
28008
28009 [heading Exceptions]
28010     
28011
28012 [variablelist
28013   
28014 [[boost::system::system_error][Thrown on failure. ]]
28015
28016 ]
28017
28018
28019
28020
28021 [endsect]
28022
28023
28024
28025 [section:overload2 basic_serial_port::close (2 of 2 overloads)]
28026
28027
28028 Close the serial port. 
28029
28030
28031   void close(
28032       boost::system::error_code & ec);
28033
28034
28035 This function is used to close the serial port. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
28036
28037
28038 [heading Parameters]
28039     
28040
28041 [variablelist
28042   
28043 [[ec][Set to indicate what error occurred, if any. ]]
28044
28045 ]
28046
28047
28048
28049
28050 [endsect]
28051
28052
28053 [endsect]
28054
28055
28056 [section:executor_type basic_serial_port::executor_type]
28057
28058 [indexterm2 boost_asio.indexterm.basic_serial_port.executor_type..executor_type..basic_serial_port] 
28059 The type of the executor associated with the object. 
28060
28061
28062   typedef Executor executor_type;
28063
28064
28065
28066 [heading Requirements]
28067
28068 ['Header: ][^boost/asio/basic_serial_port.hpp]
28069
28070 ['Convenience header: ][^boost/asio.hpp]
28071
28072
28073 [endsect]
28074
28075
28076
28077 [section:get_executor basic_serial_port::get_executor]
28078
28079 [indexterm2 boost_asio.indexterm.basic_serial_port.get_executor..get_executor..basic_serial_port] 
28080 Get the executor associated with the object. 
28081
28082
28083   executor_type get_executor();
28084
28085
28086
28087 [endsect]
28088
28089
28090 [section:get_option basic_serial_port::get_option]
28091
28092 [indexterm2 boost_asio.indexterm.basic_serial_port.get_option..get_option..basic_serial_port] 
28093 Get an option from the serial port. 
28094
28095
28096   template<
28097       typename ``[link boost_asio.reference.GettableSerialPortOption GettableSerialPortOption]``>
28098   void ``[link boost_asio.reference.basic_serial_port.get_option.overload1 get_option]``(
28099       GettableSerialPortOption & option) const;
28100   ``  [''''&raquo;''' [link boost_asio.reference.basic_serial_port.get_option.overload1 more...]]``
28101
28102   template<
28103       typename ``[link boost_asio.reference.GettableSerialPortOption GettableSerialPortOption]``>
28104   void ``[link boost_asio.reference.basic_serial_port.get_option.overload2 get_option]``(
28105       GettableSerialPortOption & option,
28106       boost::system::error_code & ec) const;
28107   ``  [''''&raquo;''' [link boost_asio.reference.basic_serial_port.get_option.overload2 more...]]``
28108
28109
28110 [section:overload1 basic_serial_port::get_option (1 of 2 overloads)]
28111
28112
28113 Get an option from the serial port. 
28114
28115
28116   template<
28117       typename ``[link boost_asio.reference.GettableSerialPortOption GettableSerialPortOption]``>
28118   void get_option(
28119       GettableSerialPortOption & option) const;
28120
28121
28122 This function is used to get the current value of an option on the serial port.
28123
28124
28125 [heading Parameters]
28126     
28127
28128 [variablelist
28129   
28130 [[option][The option value to be obtained from the serial port.]]
28131
28132 ]
28133
28134
28135 [heading Exceptions]
28136     
28137
28138 [variablelist
28139   
28140 [[boost::system::system_error][Thrown on failure.]]
28141
28142 ]
28143
28144
28145
28146
28147
28148 [endsect]
28149
28150
28151
28152 [section:overload2 basic_serial_port::get_option (2 of 2 overloads)]
28153
28154
28155 Get an option from the serial port. 
28156
28157
28158   template<
28159       typename ``[link boost_asio.reference.GettableSerialPortOption GettableSerialPortOption]``>
28160   void get_option(
28161       GettableSerialPortOption & option,
28162       boost::system::error_code & ec) const;
28163
28164
28165 This function is used to get the current value of an option on the serial port.
28166
28167
28168 [heading Parameters]
28169     
28170
28171 [variablelist
28172   
28173 [[option][The option value to be obtained from the serial port.]]
28174
28175 [[ec][Set to indicate what error occurred, if any.]]
28176
28177 ]
28178
28179
28180
28181
28182
28183 [endsect]
28184
28185
28186 [endsect]
28187
28188
28189 [section:is_open basic_serial_port::is_open]
28190
28191 [indexterm2 boost_asio.indexterm.basic_serial_port.is_open..is_open..basic_serial_port] 
28192 Determine whether the serial port is open. 
28193
28194
28195   bool is_open() const;
28196
28197
28198
28199 [endsect]
28200
28201
28202 [section:lowest_layer basic_serial_port::lowest_layer]
28203
28204 [indexterm2 boost_asio.indexterm.basic_serial_port.lowest_layer..lowest_layer..basic_serial_port] 
28205 Get a reference to the lowest layer. 
28206
28207
28208   lowest_layer_type & ``[link boost_asio.reference.basic_serial_port.lowest_layer.overload1 lowest_layer]``();
28209   ``  [''''&raquo;''' [link boost_asio.reference.basic_serial_port.lowest_layer.overload1 more...]]``
28210
28211
28212 Get a const reference to the lowest layer. 
28213
28214
28215   const lowest_layer_type & ``[link boost_asio.reference.basic_serial_port.lowest_layer.overload2 lowest_layer]``() const;
28216   ``  [''''&raquo;''' [link boost_asio.reference.basic_serial_port.lowest_layer.overload2 more...]]``
28217
28218
28219 [section:overload1 basic_serial_port::lowest_layer (1 of 2 overloads)]
28220
28221
28222 Get a reference to the lowest layer. 
28223
28224
28225   lowest_layer_type & lowest_layer();
28226
28227
28228 This function returns a reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_serial_port `basic_serial_port`] cannot contain any further layers, it simply returns a reference to itself.
28229
28230
28231 [heading Return Value]
28232       
28233 A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 
28234
28235
28236
28237
28238 [endsect]
28239
28240
28241
28242 [section:overload2 basic_serial_port::lowest_layer (2 of 2 overloads)]
28243
28244
28245 Get a const reference to the lowest layer. 
28246
28247
28248   const lowest_layer_type & lowest_layer() const;
28249
28250
28251 This function returns a const reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_serial_port `basic_serial_port`] cannot contain any further layers, it simply returns a reference to itself.
28252
28253
28254 [heading Return Value]
28255       
28256 A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 
28257
28258
28259
28260
28261 [endsect]
28262
28263
28264 [endsect]
28265
28266
28267 [section:lowest_layer_type basic_serial_port::lowest_layer_type]
28268
28269 [indexterm2 boost_asio.indexterm.basic_serial_port.lowest_layer_type..lowest_layer_type..basic_serial_port] 
28270 A basic\_basic\_serial\_port is always the lowest layer. 
28271
28272
28273   typedef basic_serial_port lowest_layer_type;
28274
28275
28276 [heading Types]
28277 [table
28278   [[Name][Description]]
28279
28280   [
28281
28282     [[link boost_asio.reference.basic_serial_port__rebind_executor [*rebind_executor]]]
28283     [Rebinds the serial port type to another executor. ]
28284   
28285   ]
28286
28287   [
28288
28289     [[link boost_asio.reference.basic_serial_port.executor_type [*executor_type]]]
28290     [The type of the executor associated with the object. ]
28291   
28292   ]
28293
28294   [
28295
28296     [[link boost_asio.reference.basic_serial_port.lowest_layer_type [*lowest_layer_type]]]
28297     [A basic_basic_serial_port is always the lowest layer. ]
28298   
28299   ]
28300
28301   [
28302
28303     [[link boost_asio.reference.basic_serial_port.native_handle_type [*native_handle_type]]]
28304     [The native representation of a serial port. ]
28305   
28306   ]
28307
28308 ]
28309
28310 [heading Member Functions]
28311 [table
28312   [[Name][Description]]
28313
28314   [
28315     [[link boost_asio.reference.basic_serial_port.assign [*assign]]]
28316     [Assign an existing native serial port to the serial port. ]
28317   ]
28318   
28319   [
28320     [[link boost_asio.reference.basic_serial_port.async_read_some [*async_read_some]]]
28321     [Start an asynchronous read. ]
28322   ]
28323   
28324   [
28325     [[link boost_asio.reference.basic_serial_port.async_write_some [*async_write_some]]]
28326     [Start an asynchronous write. ]
28327   ]
28328   
28329   [
28330     [[link boost_asio.reference.basic_serial_port.basic_serial_port [*basic_serial_port]]]
28331     [Construct a basic_serial_port without opening it. 
28332      [hr]
28333      Construct and open a basic_serial_port. 
28334      [hr]
28335      Construct a basic_serial_port on an existing native serial port. 
28336      [hr]
28337      Move-construct a basic_serial_port from another. ]
28338   ]
28339   
28340   [
28341     [[link boost_asio.reference.basic_serial_port.cancel [*cancel]]]
28342     [Cancel all asynchronous operations associated with the serial port. ]
28343   ]
28344   
28345   [
28346     [[link boost_asio.reference.basic_serial_port.close [*close]]]
28347     [Close the serial port. ]
28348   ]
28349   
28350   [
28351     [[link boost_asio.reference.basic_serial_port.get_executor [*get_executor]]]
28352     [Get the executor associated with the object. ]
28353   ]
28354   
28355   [
28356     [[link boost_asio.reference.basic_serial_port.get_option [*get_option]]]
28357     [Get an option from the serial port. ]
28358   ]
28359   
28360   [
28361     [[link boost_asio.reference.basic_serial_port.is_open [*is_open]]]
28362     [Determine whether the serial port is open. ]
28363   ]
28364   
28365   [
28366     [[link boost_asio.reference.basic_serial_port.lowest_layer [*lowest_layer]]]
28367     [Get a reference to the lowest layer. 
28368      [hr]
28369      Get a const reference to the lowest layer. ]
28370   ]
28371   
28372   [
28373     [[link boost_asio.reference.basic_serial_port.native_handle [*native_handle]]]
28374     [Get the native serial port representation. ]
28375   ]
28376   
28377   [
28378     [[link boost_asio.reference.basic_serial_port.open [*open]]]
28379     [Open the serial port using the specified device name. ]
28380   ]
28381   
28382   [
28383     [[link boost_asio.reference.basic_serial_port.operator_eq_ [*operator=]]]
28384     [Move-assign a basic_serial_port from another. ]
28385   ]
28386   
28387   [
28388     [[link boost_asio.reference.basic_serial_port.read_some [*read_some]]]
28389     [Read some data from the serial port. ]
28390   ]
28391   
28392   [
28393     [[link boost_asio.reference.basic_serial_port.send_break [*send_break]]]
28394     [Send a break sequence to the serial port. ]
28395   ]
28396   
28397   [
28398     [[link boost_asio.reference.basic_serial_port.set_option [*set_option]]]
28399     [Set an option on the serial port. ]
28400   ]
28401   
28402   [
28403     [[link boost_asio.reference.basic_serial_port.write_some [*write_some]]]
28404     [Write some data to the serial port. ]
28405   ]
28406   
28407   [
28408     [[link boost_asio.reference.basic_serial_port._basic_serial_port [*~basic_serial_port]]]
28409     [Destroys the serial port. ]
28410   ]
28411   
28412 ]
28413
28414 The [link boost_asio.reference.basic_serial_port `basic_serial_port`] class provides a wrapper over serial port functionality.
28415
28416
28417 [heading Thread Safety]
28418   
28419 ['Distinct] ['objects:] Safe.
28420
28421 ['Shared] ['objects:] Unsafe. 
28422
28423
28424
28425
28426 [heading Requirements]
28427
28428 ['Header: ][^boost/asio/basic_serial_port.hpp]
28429
28430 ['Convenience header: ][^boost/asio.hpp]
28431
28432
28433 [endsect]
28434
28435
28436
28437 [section:native_handle basic_serial_port::native_handle]
28438
28439 [indexterm2 boost_asio.indexterm.basic_serial_port.native_handle..native_handle..basic_serial_port] 
28440 Get the native serial port representation. 
28441
28442
28443   native_handle_type native_handle();
28444
28445
28446 This function may be used to obtain the underlying representation of the serial port. This is intended to allow access to native serial port functionality that is not otherwise provided. 
28447
28448
28449 [endsect]
28450
28451
28452
28453 [section:native_handle_type basic_serial_port::native_handle_type]
28454
28455 [indexterm2 boost_asio.indexterm.basic_serial_port.native_handle_type..native_handle_type..basic_serial_port] 
28456 The native representation of a serial port. 
28457
28458
28459   typedef implementation_defined native_handle_type;
28460
28461
28462
28463 [heading Requirements]
28464
28465 ['Header: ][^boost/asio/basic_serial_port.hpp]
28466
28467 ['Convenience header: ][^boost/asio.hpp]
28468
28469
28470 [endsect]
28471
28472
28473 [section:open basic_serial_port::open]
28474
28475 [indexterm2 boost_asio.indexterm.basic_serial_port.open..open..basic_serial_port] 
28476 Open the serial port using the specified device name. 
28477
28478
28479   void ``[link boost_asio.reference.basic_serial_port.open.overload1 open]``(
28480       const std::string & device);
28481   ``  [''''&raquo;''' [link boost_asio.reference.basic_serial_port.open.overload1 more...]]``
28482
28483   void ``[link boost_asio.reference.basic_serial_port.open.overload2 open]``(
28484       const std::string & device,
28485       boost::system::error_code & ec);
28486   ``  [''''&raquo;''' [link boost_asio.reference.basic_serial_port.open.overload2 more...]]``
28487
28488
28489 [section:overload1 basic_serial_port::open (1 of 2 overloads)]
28490
28491
28492 Open the serial port using the specified device name. 
28493
28494
28495   void open(
28496       const std::string & device);
28497
28498
28499 This function opens the serial port for the specified device name.
28500
28501
28502 [heading Parameters]
28503     
28504
28505 [variablelist
28506   
28507 [[device][The platform-specific device name.]]
28508
28509 ]
28510
28511
28512 [heading Exceptions]
28513     
28514
28515 [variablelist
28516   
28517 [[boost::system::system_error][Thrown on failure. ]]
28518
28519 ]
28520
28521
28522
28523
28524 [endsect]
28525
28526
28527
28528 [section:overload2 basic_serial_port::open (2 of 2 overloads)]
28529
28530
28531 Open the serial port using the specified device name. 
28532
28533
28534   void open(
28535       const std::string & device,
28536       boost::system::error_code & ec);
28537
28538
28539 This function opens the serial port using the given platform-specific device name.
28540
28541
28542 [heading Parameters]
28543     
28544
28545 [variablelist
28546   
28547 [[device][The platform-specific device name.]]
28548
28549 [[ec][Set the indicate what error occurred, if any. ]]
28550
28551 ]
28552
28553
28554
28555
28556 [endsect]
28557
28558
28559 [endsect]
28560
28561
28562 [section:operator_eq_ basic_serial_port::operator=]
28563
28564 [indexterm2 boost_asio.indexterm.basic_serial_port.operator_eq_..operator=..basic_serial_port] 
28565 Move-assign a [link boost_asio.reference.basic_serial_port `basic_serial_port`] from another. 
28566
28567
28568   basic_serial_port & operator=(
28569       basic_serial_port && other);
28570
28571
28572 This assignment operator moves a serial port from one object to another.
28573
28574
28575 [heading Parameters]
28576     
28577
28578 [variablelist
28579   
28580 [[other][The other [link boost_asio.reference.basic_serial_port `basic_serial_port`] object from which the move will occur.]]
28581
28582 ]
28583
28584
28585 [heading Remarks]
28586       
28587 Following the move, the moved-from object is in the same state as if constructed using the `basic_serial_port(const executor_type&)` constructor. 
28588
28589
28590
28591
28592 [endsect]
28593
28594
28595 [section:read_some basic_serial_port::read_some]
28596
28597 [indexterm2 boost_asio.indexterm.basic_serial_port.read_some..read_some..basic_serial_port] 
28598 Read some data from the serial port. 
28599
28600
28601   template<
28602       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
28603   std::size_t ``[link boost_asio.reference.basic_serial_port.read_some.overload1 read_some]``(
28604       const MutableBufferSequence & buffers);
28605   ``  [''''&raquo;''' [link boost_asio.reference.basic_serial_port.read_some.overload1 more...]]``
28606
28607   template<
28608       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
28609   std::size_t ``[link boost_asio.reference.basic_serial_port.read_some.overload2 read_some]``(
28610       const MutableBufferSequence & buffers,
28611       boost::system::error_code & ec);
28612   ``  [''''&raquo;''' [link boost_asio.reference.basic_serial_port.read_some.overload2 more...]]``
28613
28614
28615 [section:overload1 basic_serial_port::read_some (1 of 2 overloads)]
28616
28617
28618 Read some data from the serial port. 
28619
28620
28621   template<
28622       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
28623   std::size_t read_some(
28624       const MutableBufferSequence & buffers);
28625
28626
28627 This function is used to read data from the serial port. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
28628
28629
28630 [heading Parameters]
28631     
28632
28633 [variablelist
28634   
28635 [[buffers][One or more buffers into which the data will be read.]]
28636
28637 ]
28638
28639
28640 [heading Return Value]
28641       
28642 The number of bytes read.
28643
28644
28645 [heading Exceptions]
28646     
28647
28648 [variablelist
28649   
28650 [[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
28651
28652 ]
28653
28654
28655 [heading Remarks]
28656       
28657 The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`]  function if you need to ensure that the requested amount of data is read before the blocking operation completes.
28658
28659
28660 [heading Example]
28661   
28662 To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
28663
28664    basic_serial_port.read_some(boost::asio::buffer(data, size));
28665
28666
28667 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
28668
28669
28670
28671
28672 [endsect]
28673
28674
28675
28676 [section:overload2 basic_serial_port::read_some (2 of 2 overloads)]
28677
28678
28679 Read some data from the serial port. 
28680
28681
28682   template<
28683       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
28684   std::size_t read_some(
28685       const MutableBufferSequence & buffers,
28686       boost::system::error_code & ec);
28687
28688
28689 This function is used to read data from the serial port. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
28690
28691
28692 [heading Parameters]
28693     
28694
28695 [variablelist
28696   
28697 [[buffers][One or more buffers into which the data will be read.]]
28698
28699 [[ec][Set to indicate what error occurred, if any.]]
28700
28701 ]
28702
28703
28704 [heading Return Value]
28705       
28706 The number of bytes read. Returns 0 if an error occurred.
28707
28708
28709 [heading Remarks]
28710       
28711 The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`]  function if you need to ensure that the requested amount of data is read before the blocking operation completes. 
28712
28713
28714
28715
28716 [endsect]
28717
28718
28719 [endsect]
28720
28721 [section:send_break basic_serial_port::send_break]
28722
28723 [indexterm2 boost_asio.indexterm.basic_serial_port.send_break..send_break..basic_serial_port] 
28724 Send a break sequence to the serial port. 
28725
28726
28727   void ``[link boost_asio.reference.basic_serial_port.send_break.overload1 send_break]``();
28728   ``  [''''&raquo;''' [link boost_asio.reference.basic_serial_port.send_break.overload1 more...]]``
28729
28730   void ``[link boost_asio.reference.basic_serial_port.send_break.overload2 send_break]``(
28731       boost::system::error_code & ec);
28732   ``  [''''&raquo;''' [link boost_asio.reference.basic_serial_port.send_break.overload2 more...]]``
28733
28734
28735 [section:overload1 basic_serial_port::send_break (1 of 2 overloads)]
28736
28737
28738 Send a break sequence to the serial port. 
28739
28740
28741   void send_break();
28742
28743
28744 This function causes a break sequence of platform-specific duration to be sent out the serial port.
28745
28746
28747 [heading Exceptions]
28748     
28749
28750 [variablelist
28751   
28752 [[boost::system::system_error][Thrown on failure. ]]
28753
28754 ]
28755
28756
28757
28758
28759 [endsect]
28760
28761
28762
28763 [section:overload2 basic_serial_port::send_break (2 of 2 overloads)]
28764
28765
28766 Send a break sequence to the serial port. 
28767
28768
28769   void send_break(
28770       boost::system::error_code & ec);
28771
28772
28773 This function causes a break sequence of platform-specific duration to be sent out the serial port.
28774
28775
28776 [heading Parameters]
28777     
28778
28779 [variablelist
28780   
28781 [[ec][Set to indicate what error occurred, if any. ]]
28782
28783 ]
28784
28785
28786
28787
28788 [endsect]
28789
28790
28791 [endsect]
28792
28793 [section:set_option basic_serial_port::set_option]
28794
28795 [indexterm2 boost_asio.indexterm.basic_serial_port.set_option..set_option..basic_serial_port] 
28796 Set an option on the serial port. 
28797
28798
28799   template<
28800       typename ``[link boost_asio.reference.SettableSerialPortOption SettableSerialPortOption]``>
28801   void ``[link boost_asio.reference.basic_serial_port.set_option.overload1 set_option]``(
28802       const SettableSerialPortOption & option);
28803   ``  [''''&raquo;''' [link boost_asio.reference.basic_serial_port.set_option.overload1 more...]]``
28804
28805   template<
28806       typename ``[link boost_asio.reference.SettableSerialPortOption SettableSerialPortOption]``>
28807   void ``[link boost_asio.reference.basic_serial_port.set_option.overload2 set_option]``(
28808       const SettableSerialPortOption & option,
28809       boost::system::error_code & ec);
28810   ``  [''''&raquo;''' [link boost_asio.reference.basic_serial_port.set_option.overload2 more...]]``
28811
28812
28813 [section:overload1 basic_serial_port::set_option (1 of 2 overloads)]
28814
28815
28816 Set an option on the serial port. 
28817
28818
28819   template<
28820       typename ``[link boost_asio.reference.SettableSerialPortOption SettableSerialPortOption]``>
28821   void set_option(
28822       const SettableSerialPortOption & option);
28823
28824
28825 This function is used to set an option on the serial port.
28826
28827
28828 [heading Parameters]
28829     
28830
28831 [variablelist
28832   
28833 [[option][The option value to be set on the serial port.]]
28834
28835 ]
28836
28837
28838 [heading Exceptions]
28839     
28840
28841 [variablelist
28842   
28843 [[boost::system::system_error][Thrown on failure.]]
28844
28845 ]
28846
28847
28848
28849
28850
28851 [endsect]
28852
28853
28854
28855 [section:overload2 basic_serial_port::set_option (2 of 2 overloads)]
28856
28857
28858 Set an option on the serial port. 
28859
28860
28861   template<
28862       typename ``[link boost_asio.reference.SettableSerialPortOption SettableSerialPortOption]``>
28863   void set_option(
28864       const SettableSerialPortOption & option,
28865       boost::system::error_code & ec);
28866
28867
28868 This function is used to set an option on the serial port.
28869
28870
28871 [heading Parameters]
28872     
28873
28874 [variablelist
28875   
28876 [[option][The option value to be set on the serial port.]]
28877
28878 [[ec][Set to indicate what error occurred, if any.]]
28879
28880 ]
28881
28882
28883
28884
28885
28886 [endsect]
28887
28888
28889 [endsect]
28890
28891 [section:write_some basic_serial_port::write_some]
28892
28893 [indexterm2 boost_asio.indexterm.basic_serial_port.write_some..write_some..basic_serial_port] 
28894 Write some data to the serial port. 
28895
28896
28897   template<
28898       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
28899   std::size_t ``[link boost_asio.reference.basic_serial_port.write_some.overload1 write_some]``(
28900       const ConstBufferSequence & buffers);
28901   ``  [''''&raquo;''' [link boost_asio.reference.basic_serial_port.write_some.overload1 more...]]``
28902
28903   template<
28904       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
28905   std::size_t ``[link boost_asio.reference.basic_serial_port.write_some.overload2 write_some]``(
28906       const ConstBufferSequence & buffers,
28907       boost::system::error_code & ec);
28908   ``  [''''&raquo;''' [link boost_asio.reference.basic_serial_port.write_some.overload2 more...]]``
28909
28910
28911 [section:overload1 basic_serial_port::write_some (1 of 2 overloads)]
28912
28913
28914 Write some data to the serial port. 
28915
28916
28917   template<
28918       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
28919   std::size_t write_some(
28920       const ConstBufferSequence & buffers);
28921
28922
28923 This function is used to write data to the serial port. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
28924
28925
28926 [heading Parameters]
28927     
28928
28929 [variablelist
28930   
28931 [[buffers][One or more data buffers to be written to the serial port.]]
28932
28933 ]
28934
28935
28936 [heading Return Value]
28937       
28938 The number of bytes written.
28939
28940
28941 [heading Exceptions]
28942     
28943
28944 [variablelist
28945   
28946 [[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
28947
28948 ]
28949
28950
28951 [heading Remarks]
28952       
28953 The write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`]  function if you need to ensure that all data is written before the blocking operation completes.
28954
28955
28956 [heading Example]
28957   
28958 To write a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
28959
28960    basic_serial_port.write_some(boost::asio::buffer(data, size));
28961
28962
28963 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
28964
28965
28966
28967
28968 [endsect]
28969
28970
28971
28972 [section:overload2 basic_serial_port::write_some (2 of 2 overloads)]
28973
28974
28975 Write some data to the serial port. 
28976
28977
28978   template<
28979       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
28980   std::size_t write_some(
28981       const ConstBufferSequence & buffers,
28982       boost::system::error_code & ec);
28983
28984
28985 This function is used to write data to the serial port. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
28986
28987
28988 [heading Parameters]
28989     
28990
28991 [variablelist
28992   
28993 [[buffers][One or more data buffers to be written to the serial port.]]
28994
28995 [[ec][Set to indicate what error occurred, if any.]]
28996
28997 ]
28998
28999
29000 [heading Return Value]
29001       
29002 The number of bytes written. Returns 0 if an error occurred.
29003
29004
29005 [heading Remarks]
29006       
29007 The write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`]  function if you need to ensure that all data is written before the blocking operation completes. 
29008
29009
29010
29011
29012 [endsect]
29013
29014
29015 [endsect]
29016
29017
29018 [section:_basic_serial_port basic_serial_port::~basic_serial_port]
29019
29020 [indexterm2 boost_asio.indexterm.basic_serial_port._basic_serial_port..~basic_serial_port..basic_serial_port] 
29021 Destroys the serial port. 
29022
29023
29024   ~basic_serial_port();
29025
29026
29027 This function destroys the serial port, cancelling any outstanding asynchronous wait operations associated with the serial port as if by calling `cancel`. 
29028
29029
29030 [endsect]
29031
29032
29033
29034 [endsect]
29035
29036 [section:basic_serial_port__rebind_executor basic_serial_port::rebind_executor]
29037
29038
29039 Rebinds the serial port type to another executor. 
29040
29041
29042   template<
29043       typename ``[link boost_asio.reference.Executor1 Executor1]``>
29044   struct rebind_executor
29045
29046
29047 [heading Types]
29048 [table
29049   [[Name][Description]]
29050
29051   [
29052
29053     [[link boost_asio.reference.basic_serial_port__rebind_executor.other [*other]]]
29054     [The serial port type when rebound to the specified executor. ]
29055   
29056   ]
29057
29058 ]
29059
29060 [heading Requirements]
29061
29062 ['Header: ][^boost/asio/basic_serial_port.hpp]
29063
29064 ['Convenience header: ][^boost/asio.hpp]
29065
29066
29067 [section:other basic_serial_port::rebind_executor::other]
29068
29069 [indexterm2 boost_asio.indexterm.basic_serial_port__rebind_executor.other..other..basic_serial_port::rebind_executor] 
29070 The serial port type when rebound to the specified executor. 
29071
29072
29073   typedef basic_serial_port< Executor1 > other;
29074
29075
29076 [heading Types]
29077 [table
29078   [[Name][Description]]
29079
29080   [
29081
29082     [[link boost_asio.reference.basic_serial_port__rebind_executor [*rebind_executor]]]
29083     [Rebinds the serial port type to another executor. ]
29084   
29085   ]
29086
29087   [
29088
29089     [[link boost_asio.reference.basic_serial_port.executor_type [*executor_type]]]
29090     [The type of the executor associated with the object. ]
29091   
29092   ]
29093
29094   [
29095
29096     [[link boost_asio.reference.basic_serial_port.lowest_layer_type [*lowest_layer_type]]]
29097     [A basic_basic_serial_port is always the lowest layer. ]
29098   
29099   ]
29100
29101   [
29102
29103     [[link boost_asio.reference.basic_serial_port.native_handle_type [*native_handle_type]]]
29104     [The native representation of a serial port. ]
29105   
29106   ]
29107
29108 ]
29109
29110 [heading Member Functions]
29111 [table
29112   [[Name][Description]]
29113
29114   [
29115     [[link boost_asio.reference.basic_serial_port.assign [*assign]]]
29116     [Assign an existing native serial port to the serial port. ]
29117   ]
29118   
29119   [
29120     [[link boost_asio.reference.basic_serial_port.async_read_some [*async_read_some]]]
29121     [Start an asynchronous read. ]
29122   ]
29123   
29124   [
29125     [[link boost_asio.reference.basic_serial_port.async_write_some [*async_write_some]]]
29126     [Start an asynchronous write. ]
29127   ]
29128   
29129   [
29130     [[link boost_asio.reference.basic_serial_port.basic_serial_port [*basic_serial_port]]]
29131     [Construct a basic_serial_port without opening it. 
29132      [hr]
29133      Construct and open a basic_serial_port. 
29134      [hr]
29135      Construct a basic_serial_port on an existing native serial port. 
29136      [hr]
29137      Move-construct a basic_serial_port from another. ]
29138   ]
29139   
29140   [
29141     [[link boost_asio.reference.basic_serial_port.cancel [*cancel]]]
29142     [Cancel all asynchronous operations associated with the serial port. ]
29143   ]
29144   
29145   [
29146     [[link boost_asio.reference.basic_serial_port.close [*close]]]
29147     [Close the serial port. ]
29148   ]
29149   
29150   [
29151     [[link boost_asio.reference.basic_serial_port.get_executor [*get_executor]]]
29152     [Get the executor associated with the object. ]
29153   ]
29154   
29155   [
29156     [[link boost_asio.reference.basic_serial_port.get_option [*get_option]]]
29157     [Get an option from the serial port. ]
29158   ]
29159   
29160   [
29161     [[link boost_asio.reference.basic_serial_port.is_open [*is_open]]]
29162     [Determine whether the serial port is open. ]
29163   ]
29164   
29165   [
29166     [[link boost_asio.reference.basic_serial_port.lowest_layer [*lowest_layer]]]
29167     [Get a reference to the lowest layer. 
29168      [hr]
29169      Get a const reference to the lowest layer. ]
29170   ]
29171   
29172   [
29173     [[link boost_asio.reference.basic_serial_port.native_handle [*native_handle]]]
29174     [Get the native serial port representation. ]
29175   ]
29176   
29177   [
29178     [[link boost_asio.reference.basic_serial_port.open [*open]]]
29179     [Open the serial port using the specified device name. ]
29180   ]
29181   
29182   [
29183     [[link boost_asio.reference.basic_serial_port.operator_eq_ [*operator=]]]
29184     [Move-assign a basic_serial_port from another. ]
29185   ]
29186   
29187   [
29188     [[link boost_asio.reference.basic_serial_port.read_some [*read_some]]]
29189     [Read some data from the serial port. ]
29190   ]
29191   
29192   [
29193     [[link boost_asio.reference.basic_serial_port.send_break [*send_break]]]
29194     [Send a break sequence to the serial port. ]
29195   ]
29196   
29197   [
29198     [[link boost_asio.reference.basic_serial_port.set_option [*set_option]]]
29199     [Set an option on the serial port. ]
29200   ]
29201   
29202   [
29203     [[link boost_asio.reference.basic_serial_port.write_some [*write_some]]]
29204     [Write some data to the serial port. ]
29205   ]
29206   
29207   [
29208     [[link boost_asio.reference.basic_serial_port._basic_serial_port [*~basic_serial_port]]]
29209     [Destroys the serial port. ]
29210   ]
29211   
29212 ]
29213
29214 The [link boost_asio.reference.basic_serial_port `basic_serial_port`] class provides a wrapper over serial port functionality.
29215
29216
29217 [heading Thread Safety]
29218   
29219 ['Distinct] ['objects:] Safe.
29220
29221 ['Shared] ['objects:] Unsafe. 
29222
29223
29224
29225
29226 [heading Requirements]
29227
29228 ['Header: ][^boost/asio/basic_serial_port.hpp]
29229
29230 ['Convenience header: ][^boost/asio.hpp]
29231
29232
29233 [endsect]
29234
29235
29236
29237 [endsect]
29238
29239 [section:basic_signal_set basic_signal_set]
29240
29241
29242 Provides signal functionality. 
29243
29244
29245   template<
29246       typename ``[link boost_asio.reference.Executor1 Executor]`` = executor>
29247   class basic_signal_set
29248
29249
29250 [heading Types]
29251 [table
29252   [[Name][Description]]
29253
29254   [
29255
29256     [[link boost_asio.reference.basic_signal_set__rebind_executor [*rebind_executor]]]
29257     [Rebinds the signal set type to another executor. ]
29258   
29259   ]
29260
29261   [
29262
29263     [[link boost_asio.reference.basic_signal_set.executor_type [*executor_type]]]
29264     [The type of the executor associated with the object. ]
29265   
29266   ]
29267
29268 ]
29269
29270 [heading Member Functions]
29271 [table
29272   [[Name][Description]]
29273
29274   [
29275     [[link boost_asio.reference.basic_signal_set.add [*add]]]
29276     [Add a signal to a signal_set. ]
29277   ]
29278   
29279   [
29280     [[link boost_asio.reference.basic_signal_set.async_wait [*async_wait]]]
29281     [Start an asynchronous operation to wait for a signal to be delivered. ]
29282   ]
29283   
29284   [
29285     [[link boost_asio.reference.basic_signal_set.basic_signal_set [*basic_signal_set]]]
29286     [Construct a signal set without adding any signals. 
29287      [hr]
29288      Construct a signal set and add one signal. 
29289      [hr]
29290      Construct a signal set and add two signals. 
29291      [hr]
29292      Construct a signal set and add three signals. ]
29293   ]
29294   
29295   [
29296     [[link boost_asio.reference.basic_signal_set.cancel [*cancel]]]
29297     [Cancel all operations associated with the signal set. ]
29298   ]
29299   
29300   [
29301     [[link boost_asio.reference.basic_signal_set.clear [*clear]]]
29302     [Remove all signals from a signal_set. ]
29303   ]
29304   
29305   [
29306     [[link boost_asio.reference.basic_signal_set.get_executor [*get_executor]]]
29307     [Get the executor associated with the object. ]
29308   ]
29309   
29310   [
29311     [[link boost_asio.reference.basic_signal_set.remove [*remove]]]
29312     [Remove a signal from a signal_set. ]
29313   ]
29314   
29315   [
29316     [[link boost_asio.reference.basic_signal_set._basic_signal_set [*~basic_signal_set]]]
29317     [Destroys the signal set. ]
29318   ]
29319   
29320 ]
29321
29322 The [link boost_asio.reference.basic_signal_set `basic_signal_set`] class provides the ability to perform an asynchronous wait for one or more signals to occur.
29323
29324
29325 [heading Thread Safety]
29326   
29327 ['Distinct] ['objects:] Safe.
29328
29329 ['Shared] ['objects:] Unsafe.
29330
29331
29332 [heading Example]
29333   
29334 Performing an asynchronous wait: 
29335
29336    void handler(
29337        const boost::system::error_code& error,
29338        int signal_number)
29339    {
29340      if (!error)
29341      {
29342        // A signal occurred.
29343      }
29344    }
29345
29346    ...
29347
29348    // Construct a signal set registered for process termination.
29349    boost::asio::signal_set signals(my_context, SIGINT, SIGTERM);
29350
29351    // Start an asynchronous wait for one of the signals to occur.
29352    signals.async_wait(handler);
29353
29354
29355
29356
29357
29358 [heading Queueing of signal notifications]
29359   
29360
29361
29362 If a signal is registered with a signal\_set, and the signal occurs when there are no waiting handlers, then the signal notification is queued. The next async\_wait operation on that signal\_set will dequeue the notification. If multiple notifications are queued, subsequent async\_wait operations dequeue them one at a time. Signal notifications are dequeued in order of ascending signal number.
29363
29364 If a signal number is removed from a signal\_set (using the `remove` or `erase` member functions) then any queued notifications for that signal are discarded.
29365
29366
29367 [heading Multiple registration of signals]
29368   
29369
29370
29371 The same signal number may be registered with different signal\_set objects. When the signal occurs, one handler is called for each signal\_set object.
29372
29373 Note that multiple registration only works for signals that are registered using Asio. The application must not also register a signal handler using functions such as `signal()` or `sigaction()`.
29374
29375
29376 [heading Signal masking on POSIX platforms]
29377   
29378
29379
29380 POSIX allows signals to be blocked using functions such as `sigprocmask()` and `pthread_sigmask()`. For signals to be delivered, programs must ensure that any signals registered using signal\_set objects are unblocked in at least one thread. 
29381
29382 [heading Requirements]
29383
29384 ['Header: ][^boost/asio/basic_signal_set.hpp]
29385
29386 ['Convenience header: ][^boost/asio.hpp]
29387
29388 [section:add basic_signal_set::add]
29389
29390 [indexterm2 boost_asio.indexterm.basic_signal_set.add..add..basic_signal_set] 
29391 Add a signal to a signal\_set. 
29392
29393
29394   void ``[link boost_asio.reference.basic_signal_set.add.overload1 add]``(
29395       int signal_number);
29396   ``  [''''&raquo;''' [link boost_asio.reference.basic_signal_set.add.overload1 more...]]``
29397
29398   void ``[link boost_asio.reference.basic_signal_set.add.overload2 add]``(
29399       int signal_number,
29400       boost::system::error_code & ec);
29401   ``  [''''&raquo;''' [link boost_asio.reference.basic_signal_set.add.overload2 more...]]``
29402
29403
29404 [section:overload1 basic_signal_set::add (1 of 2 overloads)]
29405
29406
29407 Add a signal to a signal\_set. 
29408
29409
29410   void add(
29411       int signal_number);
29412
29413
29414 This function adds the specified signal to the set. It has no effect if the signal is already in the set.
29415
29416
29417 [heading Parameters]
29418     
29419
29420 [variablelist
29421   
29422 [[signal_number][The signal to be added to the set.]]
29423
29424 ]
29425
29426
29427 [heading Exceptions]
29428     
29429
29430 [variablelist
29431   
29432 [[boost::system::system_error][Thrown on failure. ]]
29433
29434 ]
29435
29436
29437
29438
29439 [endsect]
29440
29441
29442
29443 [section:overload2 basic_signal_set::add (2 of 2 overloads)]
29444
29445
29446 Add a signal to a signal\_set. 
29447
29448
29449   void add(
29450       int signal_number,
29451       boost::system::error_code & ec);
29452
29453
29454 This function adds the specified signal to the set. It has no effect if the signal is already in the set.
29455
29456
29457 [heading Parameters]
29458     
29459
29460 [variablelist
29461   
29462 [[signal_number][The signal to be added to the set.]]
29463
29464 [[ec][Set to indicate what error occurred, if any. ]]
29465
29466 ]
29467
29468
29469
29470
29471 [endsect]
29472
29473
29474 [endsect]
29475
29476
29477 [section:async_wait basic_signal_set::async_wait]
29478
29479 [indexterm2 boost_asio.indexterm.basic_signal_set.async_wait..async_wait..basic_signal_set] 
29480 Start an asynchronous operation to wait for a signal to be delivered. 
29481
29482
29483   template<
29484       typename ``[link boost_asio.reference.SignalHandler SignalHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
29485   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait(
29486       SignalHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
29487
29488
29489 This function may be used to initiate an asynchronous wait against the signal set. It always returns immediately.
29490
29491 For each call to `async_wait()`, the supplied handler will be called exactly once. The handler will be called when:
29492
29493
29494 * One of the registered signals in the signal set occurs; or
29495
29496
29497 * The signal set was cancelled, in which case the handler is passed the error code `boost::asio::error::operation_aborted`.
29498
29499
29500 [heading Parameters]
29501     
29502
29503 [variablelist
29504   
29505 [[handler][The handler to be called when the signal occurs. Copies will be made of the handler as required. The function signature of the handler must be: 
29506 ``
29507    void handler(
29508      const boost::system::error_code& error, // Result of operation.
29509      int signal_number // Indicates which signal occurred.
29510    ); 
29511 ``
29512 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
29513
29514 ]
29515
29516
29517
29518
29519 [endsect]
29520
29521
29522 [section:basic_signal_set basic_signal_set::basic_signal_set]
29523
29524 [indexterm2 boost_asio.indexterm.basic_signal_set.basic_signal_set..basic_signal_set..basic_signal_set] 
29525 Construct a signal set without adding any signals. 
29526
29527
29528   explicit ``[link boost_asio.reference.basic_signal_set.basic_signal_set.overload1 basic_signal_set]``(
29529       const executor_type & ex);
29530   ``  [''''&raquo;''' [link boost_asio.reference.basic_signal_set.basic_signal_set.overload1 more...]]``
29531
29532   template<
29533       typename ExecutionContext>
29534   explicit ``[link boost_asio.reference.basic_signal_set.basic_signal_set.overload2 basic_signal_set]``(
29535       ExecutionContext & context,
29536       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
29537   ``  [''''&raquo;''' [link boost_asio.reference.basic_signal_set.basic_signal_set.overload2 more...]]``
29538
29539
29540 Construct a signal set and add one signal. 
29541
29542
29543   ``[link boost_asio.reference.basic_signal_set.basic_signal_set.overload3 basic_signal_set]``(
29544       const executor_type & ex,
29545       int signal_number_1);
29546   ``  [''''&raquo;''' [link boost_asio.reference.basic_signal_set.basic_signal_set.overload3 more...]]``
29547
29548   template<
29549       typename ExecutionContext>
29550   ``[link boost_asio.reference.basic_signal_set.basic_signal_set.overload4 basic_signal_set]``(
29551       ExecutionContext & context,
29552       int signal_number_1,
29553       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
29554   ``  [''''&raquo;''' [link boost_asio.reference.basic_signal_set.basic_signal_set.overload4 more...]]``
29555
29556
29557 Construct a signal set and add two signals. 
29558
29559
29560   ``[link boost_asio.reference.basic_signal_set.basic_signal_set.overload5 basic_signal_set]``(
29561       const executor_type & ex,
29562       int signal_number_1,
29563       int signal_number_2);
29564   ``  [''''&raquo;''' [link boost_asio.reference.basic_signal_set.basic_signal_set.overload5 more...]]``
29565
29566   template<
29567       typename ExecutionContext>
29568   ``[link boost_asio.reference.basic_signal_set.basic_signal_set.overload6 basic_signal_set]``(
29569       ExecutionContext & context,
29570       int signal_number_1,
29571       int signal_number_2,
29572       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
29573   ``  [''''&raquo;''' [link boost_asio.reference.basic_signal_set.basic_signal_set.overload6 more...]]``
29574
29575
29576 Construct a signal set and add three signals. 
29577
29578
29579   ``[link boost_asio.reference.basic_signal_set.basic_signal_set.overload7 basic_signal_set]``(
29580       const executor_type & ex,
29581       int signal_number_1,
29582       int signal_number_2,
29583       int signal_number_3);
29584   ``  [''''&raquo;''' [link boost_asio.reference.basic_signal_set.basic_signal_set.overload7 more...]]``
29585
29586   template<
29587       typename ExecutionContext>
29588   ``[link boost_asio.reference.basic_signal_set.basic_signal_set.overload8 basic_signal_set]``(
29589       ExecutionContext & context,
29590       int signal_number_1,
29591       int signal_number_2,
29592       int signal_number_3,
29593       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
29594   ``  [''''&raquo;''' [link boost_asio.reference.basic_signal_set.basic_signal_set.overload8 more...]]``
29595
29596
29597 [section:overload1 basic_signal_set::basic_signal_set (1 of 8 overloads)]
29598
29599
29600 Construct a signal set without adding any signals. 
29601
29602
29603   basic_signal_set(
29604       const executor_type & ex);
29605
29606
29607 This constructor creates a signal set without registering for any signals.
29608
29609
29610 [heading Parameters]
29611     
29612
29613 [variablelist
29614   
29615 [[ex][The I/O executor that the signal set will use, by default, to dispatch handlers for any asynchronous operations performed on the signal set. ]]
29616
29617 ]
29618
29619
29620
29621
29622 [endsect]
29623
29624
29625
29626 [section:overload2 basic_signal_set::basic_signal_set (2 of 8 overloads)]
29627
29628
29629 Construct a signal set without adding any signals. 
29630
29631
29632   template<
29633       typename ExecutionContext>
29634   basic_signal_set(
29635       ExecutionContext & context,
29636       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
29637
29638
29639 This constructor creates a signal set without registering for any signals.
29640
29641
29642 [heading Parameters]
29643     
29644
29645 [variablelist
29646   
29647 [[context][An execution context which provides the I/O executor that the signal set will use, by default, to dispatch handlers for any asynchronous operations performed on the signal set. ]]
29648
29649 ]
29650
29651
29652
29653
29654 [endsect]
29655
29656
29657
29658 [section:overload3 basic_signal_set::basic_signal_set (3 of 8 overloads)]
29659
29660
29661 Construct a signal set and add one signal. 
29662
29663
29664   basic_signal_set(
29665       const executor_type & ex,
29666       int signal_number_1);
29667
29668
29669 This constructor creates a signal set and registers for one signal.
29670
29671
29672 [heading Parameters]
29673     
29674
29675 [variablelist
29676   
29677 [[ex][The I/O executor that the signal set will use, by default, to dispatch handlers for any asynchronous operations performed on the signal set.]]
29678
29679 [[signal_number_1][The signal number to be added.]]
29680
29681 ]
29682
29683
29684 [heading Remarks]
29685       
29686 This constructor is equivalent to performing: 
29687
29688    boost::asio::signal_set signals(ex);
29689    signals.add(signal_number_1); 
29690
29691
29692
29693
29694
29695
29696
29697 [endsect]
29698
29699
29700
29701 [section:overload4 basic_signal_set::basic_signal_set (4 of 8 overloads)]
29702
29703
29704 Construct a signal set and add one signal. 
29705
29706
29707   template<
29708       typename ExecutionContext>
29709   basic_signal_set(
29710       ExecutionContext & context,
29711       int signal_number_1,
29712       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
29713
29714
29715 This constructor creates a signal set and registers for one signal.
29716
29717
29718 [heading Parameters]
29719     
29720
29721 [variablelist
29722   
29723 [[context][An execution context which provides the I/O executor that the signal set will use, by default, to dispatch handlers for any asynchronous operations performed on the signal set.]]
29724
29725 [[signal_number_1][The signal number to be added.]]
29726
29727 ]
29728
29729
29730 [heading Remarks]
29731       
29732 This constructor is equivalent to performing: 
29733
29734    boost::asio::signal_set signals(context);
29735    signals.add(signal_number_1); 
29736
29737
29738
29739
29740
29741
29742
29743 [endsect]
29744
29745
29746
29747 [section:overload5 basic_signal_set::basic_signal_set (5 of 8 overloads)]
29748
29749
29750 Construct a signal set and add two signals. 
29751
29752
29753   basic_signal_set(
29754       const executor_type & ex,
29755       int signal_number_1,
29756       int signal_number_2);
29757
29758
29759 This constructor creates a signal set and registers for two signals.
29760
29761
29762 [heading Parameters]
29763     
29764
29765 [variablelist
29766   
29767 [[ex][The I/O executor that the signal set will use, by default, to dispatch handlers for any asynchronous operations performed on the signal set.]]
29768
29769 [[signal_number_1][The first signal number to be added.]]
29770
29771 [[signal_number_2][The second signal number to be added.]]
29772
29773 ]
29774
29775
29776 [heading Remarks]
29777       
29778 This constructor is equivalent to performing: 
29779
29780    boost::asio::signal_set signals(ex);
29781    signals.add(signal_number_1);
29782    signals.add(signal_number_2); 
29783
29784
29785
29786
29787
29788
29789
29790 [endsect]
29791
29792
29793
29794 [section:overload6 basic_signal_set::basic_signal_set (6 of 8 overloads)]
29795
29796
29797 Construct a signal set and add two signals. 
29798
29799
29800   template<
29801       typename ExecutionContext>
29802   basic_signal_set(
29803       ExecutionContext & context,
29804       int signal_number_1,
29805       int signal_number_2,
29806       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
29807
29808
29809 This constructor creates a signal set and registers for two signals.
29810
29811
29812 [heading Parameters]
29813     
29814
29815 [variablelist
29816   
29817 [[context][An execution context which provides the I/O executor that the signal set will use, by default, to dispatch handlers for any asynchronous operations performed on the signal set.]]
29818
29819 [[signal_number_1][The first signal number to be added.]]
29820
29821 [[signal_number_2][The second signal number to be added.]]
29822
29823 ]
29824
29825
29826 [heading Remarks]
29827       
29828 This constructor is equivalent to performing: 
29829
29830    boost::asio::signal_set signals(context);
29831    signals.add(signal_number_1);
29832    signals.add(signal_number_2); 
29833
29834
29835
29836
29837
29838
29839
29840 [endsect]
29841
29842
29843
29844 [section:overload7 basic_signal_set::basic_signal_set (7 of 8 overloads)]
29845
29846
29847 Construct a signal set and add three signals. 
29848
29849
29850   basic_signal_set(
29851       const executor_type & ex,
29852       int signal_number_1,
29853       int signal_number_2,
29854       int signal_number_3);
29855
29856
29857 This constructor creates a signal set and registers for three signals.
29858
29859
29860 [heading Parameters]
29861     
29862
29863 [variablelist
29864   
29865 [[ex][The I/O executor that the signal set will use, by default, to dispatch handlers for any asynchronous operations performed on the signal set.]]
29866
29867 [[signal_number_1][The first signal number to be added.]]
29868
29869 [[signal_number_2][The second signal number to be added.]]
29870
29871 [[signal_number_3][The third signal number to be added.]]
29872
29873 ]
29874
29875
29876 [heading Remarks]
29877       
29878 This constructor is equivalent to performing: 
29879
29880    boost::asio::signal_set signals(ex);
29881    signals.add(signal_number_1);
29882    signals.add(signal_number_2);
29883    signals.add(signal_number_3); 
29884
29885
29886
29887
29888
29889
29890
29891 [endsect]
29892
29893
29894
29895 [section:overload8 basic_signal_set::basic_signal_set (8 of 8 overloads)]
29896
29897
29898 Construct a signal set and add three signals. 
29899
29900
29901   template<
29902       typename ExecutionContext>
29903   basic_signal_set(
29904       ExecutionContext & context,
29905       int signal_number_1,
29906       int signal_number_2,
29907       int signal_number_3,
29908       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
29909
29910
29911 This constructor creates a signal set and registers for three signals.
29912
29913
29914 [heading Parameters]
29915     
29916
29917 [variablelist
29918   
29919 [[context][An execution context which provides the I/O executor that the signal set will use, by default, to dispatch handlers for any asynchronous operations performed on the signal set.]]
29920
29921 [[signal_number_1][The first signal number to be added.]]
29922
29923 [[signal_number_2][The second signal number to be added.]]
29924
29925 [[signal_number_3][The third signal number to be added.]]
29926
29927 ]
29928
29929
29930 [heading Remarks]
29931       
29932 This constructor is equivalent to performing: 
29933
29934    boost::asio::signal_set signals(context);
29935    signals.add(signal_number_1);
29936    signals.add(signal_number_2);
29937    signals.add(signal_number_3); 
29938
29939
29940
29941
29942
29943
29944
29945 [endsect]
29946
29947
29948 [endsect]
29949
29950 [section:cancel basic_signal_set::cancel]
29951
29952 [indexterm2 boost_asio.indexterm.basic_signal_set.cancel..cancel..basic_signal_set] 
29953 Cancel all operations associated with the signal set. 
29954
29955
29956   void ``[link boost_asio.reference.basic_signal_set.cancel.overload1 cancel]``();
29957   ``  [''''&raquo;''' [link boost_asio.reference.basic_signal_set.cancel.overload1 more...]]``
29958
29959   void ``[link boost_asio.reference.basic_signal_set.cancel.overload2 cancel]``(
29960       boost::system::error_code & ec);
29961   ``  [''''&raquo;''' [link boost_asio.reference.basic_signal_set.cancel.overload2 more...]]``
29962
29963
29964 [section:overload1 basic_signal_set::cancel (1 of 2 overloads)]
29965
29966
29967 Cancel all operations associated with the signal set. 
29968
29969
29970   void cancel();
29971
29972
29973 This function forces the completion of any pending asynchronous wait operations against the signal set. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
29974
29975 Cancellation does not alter the set of registered signals.
29976
29977
29978 [heading Exceptions]
29979     
29980
29981 [variablelist
29982   
29983 [[boost::system::system_error][Thrown on failure.]]
29984
29985 ]
29986
29987
29988 [heading Remarks]
29989       
29990 If a registered signal occurred before `cancel()` is called, then the handlers for asynchronous wait operations will:
29991
29992
29993 * have already been invoked; or
29994
29995
29996 * have been queued for invocation in the near future.
29997
29998 These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 
29999
30000
30001 [endsect]
30002
30003
30004
30005 [section:overload2 basic_signal_set::cancel (2 of 2 overloads)]
30006
30007
30008 Cancel all operations associated with the signal set. 
30009
30010
30011   void cancel(
30012       boost::system::error_code & ec);
30013
30014
30015 This function forces the completion of any pending asynchronous wait operations against the signal set. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
30016
30017 Cancellation does not alter the set of registered signals.
30018
30019
30020 [heading Parameters]
30021     
30022
30023 [variablelist
30024   
30025 [[ec][Set to indicate what error occurred, if any.]]
30026
30027 ]
30028
30029
30030 [heading Remarks]
30031       
30032 If a registered signal occurred before `cancel()` is called, then the handlers for asynchronous wait operations will:
30033
30034
30035 * have already been invoked; or
30036
30037
30038 * have been queued for invocation in the near future.
30039
30040 These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 
30041
30042
30043 [endsect]
30044
30045
30046 [endsect]
30047
30048 [section:clear basic_signal_set::clear]
30049
30050 [indexterm2 boost_asio.indexterm.basic_signal_set.clear..clear..basic_signal_set] 
30051 Remove all signals from a signal\_set. 
30052
30053
30054   void ``[link boost_asio.reference.basic_signal_set.clear.overload1 clear]``();
30055   ``  [''''&raquo;''' [link boost_asio.reference.basic_signal_set.clear.overload1 more...]]``
30056
30057   void ``[link boost_asio.reference.basic_signal_set.clear.overload2 clear]``(
30058       boost::system::error_code & ec);
30059   ``  [''''&raquo;''' [link boost_asio.reference.basic_signal_set.clear.overload2 more...]]``
30060
30061
30062 [section:overload1 basic_signal_set::clear (1 of 2 overloads)]
30063
30064
30065 Remove all signals from a signal\_set. 
30066
30067
30068   void clear();
30069
30070
30071 This function removes all signals from the set. It has no effect if the set is already empty.
30072
30073
30074 [heading Exceptions]
30075     
30076
30077 [variablelist
30078   
30079 [[boost::system::system_error][Thrown on failure.]]
30080
30081 ]
30082
30083
30084 [heading Remarks]
30085       
30086 Removes all queued notifications. 
30087
30088
30089
30090
30091 [endsect]
30092
30093
30094
30095 [section:overload2 basic_signal_set::clear (2 of 2 overloads)]
30096
30097
30098 Remove all signals from a signal\_set. 
30099
30100
30101   void clear(
30102       boost::system::error_code & ec);
30103
30104
30105 This function removes all signals from the set. It has no effect if the set is already empty.
30106
30107
30108 [heading Parameters]
30109     
30110
30111 [variablelist
30112   
30113 [[ec][Set to indicate what error occurred, if any.]]
30114
30115 ]
30116
30117
30118 [heading Remarks]
30119       
30120 Removes all queued notifications. 
30121
30122
30123
30124
30125 [endsect]
30126
30127
30128 [endsect]
30129
30130
30131 [section:executor_type basic_signal_set::executor_type]
30132
30133 [indexterm2 boost_asio.indexterm.basic_signal_set.executor_type..executor_type..basic_signal_set] 
30134 The type of the executor associated with the object. 
30135
30136
30137   typedef Executor executor_type;
30138
30139
30140
30141 [heading Requirements]
30142
30143 ['Header: ][^boost/asio/basic_signal_set.hpp]
30144
30145 ['Convenience header: ][^boost/asio.hpp]
30146
30147
30148 [endsect]
30149
30150
30151
30152 [section:get_executor basic_signal_set::get_executor]
30153
30154 [indexterm2 boost_asio.indexterm.basic_signal_set.get_executor..get_executor..basic_signal_set] 
30155 Get the executor associated with the object. 
30156
30157
30158   executor_type get_executor();
30159
30160
30161
30162 [endsect]
30163
30164
30165 [section:remove basic_signal_set::remove]
30166
30167 [indexterm2 boost_asio.indexterm.basic_signal_set.remove..remove..basic_signal_set] 
30168 Remove a signal from a signal\_set. 
30169
30170
30171   void ``[link boost_asio.reference.basic_signal_set.remove.overload1 remove]``(
30172       int signal_number);
30173   ``  [''''&raquo;''' [link boost_asio.reference.basic_signal_set.remove.overload1 more...]]``
30174
30175   void ``[link boost_asio.reference.basic_signal_set.remove.overload2 remove]``(
30176       int signal_number,
30177       boost::system::error_code & ec);
30178   ``  [''''&raquo;''' [link boost_asio.reference.basic_signal_set.remove.overload2 more...]]``
30179
30180
30181 [section:overload1 basic_signal_set::remove (1 of 2 overloads)]
30182
30183
30184 Remove a signal from a signal\_set. 
30185
30186
30187   void remove(
30188       int signal_number);
30189
30190
30191 This function removes the specified signal from the set. It has no effect if the signal is not in the set.
30192
30193
30194 [heading Parameters]
30195     
30196
30197 [variablelist
30198   
30199 [[signal_number][The signal to be removed from the set.]]
30200
30201 ]
30202
30203
30204 [heading Exceptions]
30205     
30206
30207 [variablelist
30208   
30209 [[boost::system::system_error][Thrown on failure.]]
30210
30211 ]
30212
30213
30214 [heading Remarks]
30215       
30216 Removes any notifications that have been queued for the specified signal number. 
30217
30218
30219
30220
30221 [endsect]
30222
30223
30224
30225 [section:overload2 basic_signal_set::remove (2 of 2 overloads)]
30226
30227
30228 Remove a signal from a signal\_set. 
30229
30230
30231   void remove(
30232       int signal_number,
30233       boost::system::error_code & ec);
30234
30235
30236 This function removes the specified signal from the set. It has no effect if the signal is not in the set.
30237
30238
30239 [heading Parameters]
30240     
30241
30242 [variablelist
30243   
30244 [[signal_number][The signal to be removed from the set.]]
30245
30246 [[ec][Set to indicate what error occurred, if any.]]
30247
30248 ]
30249
30250
30251 [heading Remarks]
30252       
30253 Removes any notifications that have been queued for the specified signal number. 
30254
30255
30256
30257
30258 [endsect]
30259
30260
30261 [endsect]
30262
30263
30264 [section:_basic_signal_set basic_signal_set::~basic_signal_set]
30265
30266 [indexterm2 boost_asio.indexterm.basic_signal_set._basic_signal_set..~basic_signal_set..basic_signal_set] 
30267 Destroys the signal set. 
30268
30269
30270   ~basic_signal_set();
30271
30272
30273 This function destroys the signal set, cancelling any outstanding asynchronous wait operations associated with the signal set as if by calling `cancel`. 
30274
30275
30276 [endsect]
30277
30278
30279
30280 [endsect]
30281
30282 [section:basic_signal_set__rebind_executor basic_signal_set::rebind_executor]
30283
30284
30285 Rebinds the signal set type to another executor. 
30286
30287
30288   template<
30289       typename ``[link boost_asio.reference.Executor1 Executor1]``>
30290   struct rebind_executor
30291
30292
30293 [heading Types]
30294 [table
30295   [[Name][Description]]
30296
30297   [
30298
30299     [[link boost_asio.reference.basic_signal_set__rebind_executor.other [*other]]]
30300     [The signal set type when rebound to the specified executor. ]
30301   
30302   ]
30303
30304 ]
30305
30306 [heading Requirements]
30307
30308 ['Header: ][^boost/asio/basic_signal_set.hpp]
30309
30310 ['Convenience header: ][^boost/asio.hpp]
30311
30312
30313 [section:other basic_signal_set::rebind_executor::other]
30314
30315 [indexterm2 boost_asio.indexterm.basic_signal_set__rebind_executor.other..other..basic_signal_set::rebind_executor] 
30316 The signal set type when rebound to the specified executor. 
30317
30318
30319   typedef basic_signal_set< Executor1 > other;
30320
30321
30322 [heading Types]
30323 [table
30324   [[Name][Description]]
30325
30326   [
30327
30328     [[link boost_asio.reference.basic_signal_set__rebind_executor [*rebind_executor]]]
30329     [Rebinds the signal set type to another executor. ]
30330   
30331   ]
30332
30333   [
30334
30335     [[link boost_asio.reference.basic_signal_set.executor_type [*executor_type]]]
30336     [The type of the executor associated with the object. ]
30337   
30338   ]
30339
30340 ]
30341
30342 [heading Member Functions]
30343 [table
30344   [[Name][Description]]
30345
30346   [
30347     [[link boost_asio.reference.basic_signal_set.add [*add]]]
30348     [Add a signal to a signal_set. ]
30349   ]
30350   
30351   [
30352     [[link boost_asio.reference.basic_signal_set.async_wait [*async_wait]]]
30353     [Start an asynchronous operation to wait for a signal to be delivered. ]
30354   ]
30355   
30356   [
30357     [[link boost_asio.reference.basic_signal_set.basic_signal_set [*basic_signal_set]]]
30358     [Construct a signal set without adding any signals. 
30359      [hr]
30360      Construct a signal set and add one signal. 
30361      [hr]
30362      Construct a signal set and add two signals. 
30363      [hr]
30364      Construct a signal set and add three signals. ]
30365   ]
30366   
30367   [
30368     [[link boost_asio.reference.basic_signal_set.cancel [*cancel]]]
30369     [Cancel all operations associated with the signal set. ]
30370   ]
30371   
30372   [
30373     [[link boost_asio.reference.basic_signal_set.clear [*clear]]]
30374     [Remove all signals from a signal_set. ]
30375   ]
30376   
30377   [
30378     [[link boost_asio.reference.basic_signal_set.get_executor [*get_executor]]]
30379     [Get the executor associated with the object. ]
30380   ]
30381   
30382   [
30383     [[link boost_asio.reference.basic_signal_set.remove [*remove]]]
30384     [Remove a signal from a signal_set. ]
30385   ]
30386   
30387   [
30388     [[link boost_asio.reference.basic_signal_set._basic_signal_set [*~basic_signal_set]]]
30389     [Destroys the signal set. ]
30390   ]
30391   
30392 ]
30393
30394 The [link boost_asio.reference.basic_signal_set `basic_signal_set`] class provides the ability to perform an asynchronous wait for one or more signals to occur.
30395
30396
30397 [heading Thread Safety]
30398   
30399 ['Distinct] ['objects:] Safe.
30400
30401 ['Shared] ['objects:] Unsafe.
30402
30403
30404 [heading Example]
30405   
30406 Performing an asynchronous wait: 
30407
30408    void handler(
30409        const boost::system::error_code& error,
30410        int signal_number)
30411    {
30412      if (!error)
30413      {
30414        // A signal occurred.
30415      }
30416    }
30417
30418    ...
30419
30420    // Construct a signal set registered for process termination.
30421    boost::asio::signal_set signals(my_context, SIGINT, SIGTERM);
30422
30423    // Start an asynchronous wait for one of the signals to occur.
30424    signals.async_wait(handler);
30425
30426
30427
30428
30429
30430 [heading Queueing of signal notifications]
30431   
30432
30433
30434 If a signal is registered with a signal\_set, and the signal occurs when there are no waiting handlers, then the signal notification is queued. The next async\_wait operation on that signal\_set will dequeue the notification. If multiple notifications are queued, subsequent async\_wait operations dequeue them one at a time. Signal notifications are dequeued in order of ascending signal number.
30435
30436 If a signal number is removed from a signal\_set (using the `remove` or `erase` member functions) then any queued notifications for that signal are discarded.
30437
30438
30439 [heading Multiple registration of signals]
30440   
30441
30442
30443 The same signal number may be registered with different signal\_set objects. When the signal occurs, one handler is called for each signal\_set object.
30444
30445 Note that multiple registration only works for signals that are registered using Asio. The application must not also register a signal handler using functions such as `signal()` or `sigaction()`.
30446
30447
30448 [heading Signal masking on POSIX platforms]
30449   
30450
30451
30452 POSIX allows signals to be blocked using functions such as `sigprocmask()` and `pthread_sigmask()`. For signals to be delivered, programs must ensure that any signals registered using signal\_set objects are unblocked in at least one thread. 
30453
30454
30455 [heading Requirements]
30456
30457 ['Header: ][^boost/asio/basic_signal_set.hpp]
30458
30459 ['Convenience header: ][^boost/asio.hpp]
30460
30461
30462 [endsect]
30463
30464
30465
30466 [endsect]
30467
30468 [section:basic_socket basic_socket]
30469
30470
30471 Provides socket functionality. 
30472
30473
30474   template<
30475       typename ``[link boost_asio.reference.Protocol Protocol]``,
30476       typename ``[link boost_asio.reference.Executor1 Executor]``>
30477   class basic_socket :
30478     public socket_base
30479
30480
30481 [heading Types]
30482 [table
30483   [[Name][Description]]
30484
30485   [
30486
30487     [[link boost_asio.reference.basic_socket__rebind_executor [*rebind_executor]]]
30488     [Rebinds the socket type to another executor. ]
30489   
30490   ]
30491
30492   [
30493
30494     [[link boost_asio.reference.basic_socket.broadcast [*broadcast]]]
30495     [Socket option to permit sending of broadcast messages. ]
30496   
30497   ]
30498
30499   [
30500
30501     [[link boost_asio.reference.basic_socket.bytes_readable [*bytes_readable]]]
30502     [IO control command to get the amount of data that can be read without blocking. ]
30503   
30504   ]
30505
30506   [
30507
30508     [[link boost_asio.reference.basic_socket.debug [*debug]]]
30509     [Socket option to enable socket-level debugging. ]
30510   
30511   ]
30512
30513   [
30514
30515     [[link boost_asio.reference.basic_socket.do_not_route [*do_not_route]]]
30516     [Socket option to prevent routing, use local interfaces only. ]
30517   
30518   ]
30519
30520   [
30521
30522     [[link boost_asio.reference.basic_socket.enable_connection_aborted [*enable_connection_aborted]]]
30523     [Socket option to report aborted connections on accept. ]
30524   
30525   ]
30526
30527   [
30528
30529     [[link boost_asio.reference.basic_socket.endpoint_type [*endpoint_type]]]
30530     [The endpoint type. ]
30531   
30532   ]
30533
30534   [
30535
30536     [[link boost_asio.reference.basic_socket.executor_type [*executor_type]]]
30537     [The type of the executor associated with the object. ]
30538   
30539   ]
30540
30541   [
30542
30543     [[link boost_asio.reference.basic_socket.keep_alive [*keep_alive]]]
30544     [Socket option to send keep-alives. ]
30545   
30546   ]
30547
30548   [
30549
30550     [[link boost_asio.reference.basic_socket.linger [*linger]]]
30551     [Socket option to specify whether the socket lingers on close if unsent data is present. ]
30552   
30553   ]
30554
30555   [
30556
30557     [[link boost_asio.reference.basic_socket.lowest_layer_type [*lowest_layer_type]]]
30558     [A basic_socket is always the lowest layer. ]
30559   
30560   ]
30561
30562   [
30563
30564     [[link boost_asio.reference.basic_socket.message_flags [*message_flags]]]
30565     [Bitmask type for flags that can be passed to send and receive operations. ]
30566   
30567   ]
30568
30569   [
30570
30571     [[link boost_asio.reference.basic_socket.native_handle_type [*native_handle_type]]]
30572     [The native representation of a socket. ]
30573   
30574   ]
30575
30576   [
30577
30578     [[link boost_asio.reference.basic_socket.out_of_band_inline [*out_of_band_inline]]]
30579     [Socket option for putting received out-of-band data inline. ]
30580   
30581   ]
30582
30583   [
30584
30585     [[link boost_asio.reference.basic_socket.protocol_type [*protocol_type]]]
30586     [The protocol type. ]
30587   
30588   ]
30589
30590   [
30591
30592     [[link boost_asio.reference.basic_socket.receive_buffer_size [*receive_buffer_size]]]
30593     [Socket option for the receive buffer size of a socket. ]
30594   
30595   ]
30596
30597   [
30598
30599     [[link boost_asio.reference.basic_socket.receive_low_watermark [*receive_low_watermark]]]
30600     [Socket option for the receive low watermark. ]
30601   
30602   ]
30603
30604   [
30605
30606     [[link boost_asio.reference.basic_socket.reuse_address [*reuse_address]]]
30607     [Socket option to allow the socket to be bound to an address that is already in use. ]
30608   
30609   ]
30610
30611   [
30612
30613     [[link boost_asio.reference.basic_socket.send_buffer_size [*send_buffer_size]]]
30614     [Socket option for the send buffer size of a socket. ]
30615   
30616   ]
30617
30618   [
30619
30620     [[link boost_asio.reference.basic_socket.send_low_watermark [*send_low_watermark]]]
30621     [Socket option for the send low watermark. ]
30622   
30623   ]
30624
30625   [
30626
30627     [[link boost_asio.reference.basic_socket.shutdown_type [*shutdown_type]]]
30628     [Different ways a socket may be shutdown. ]
30629   
30630   ]
30631
30632   [
30633
30634     [[link boost_asio.reference.basic_socket.wait_type [*wait_type]]]
30635     [Wait types. ]
30636   
30637   ]
30638
30639 ]
30640
30641 [heading Member Functions]
30642 [table
30643   [[Name][Description]]
30644
30645   [
30646     [[link boost_asio.reference.basic_socket.assign [*assign]]]
30647     [Assign an existing native socket to the socket. ]
30648   ]
30649   
30650   [
30651     [[link boost_asio.reference.basic_socket.async_connect [*async_connect]]]
30652     [Start an asynchronous connect. ]
30653   ]
30654   
30655   [
30656     [[link boost_asio.reference.basic_socket.async_wait [*async_wait]]]
30657     [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
30658   ]
30659   
30660   [
30661     [[link boost_asio.reference.basic_socket.at_mark [*at_mark]]]
30662     [Determine whether the socket is at the out-of-band data mark. ]
30663   ]
30664   
30665   [
30666     [[link boost_asio.reference.basic_socket.available [*available]]]
30667     [Determine the number of bytes available for reading. ]
30668   ]
30669   
30670   [
30671     [[link boost_asio.reference.basic_socket.basic_socket [*basic_socket]]]
30672     [Construct a basic_socket without opening it. 
30673      [hr]
30674      Construct and open a basic_socket. 
30675      [hr]
30676      Construct a basic_socket, opening it and binding it to the given local endpoint. 
30677      [hr]
30678      Construct a basic_socket on an existing native socket. 
30679      [hr]
30680      Move-construct a basic_socket from another. 
30681      [hr]
30682      Move-construct a basic_socket from a socket of another protocol type. ]
30683   ]
30684   
30685   [
30686     [[link boost_asio.reference.basic_socket.bind [*bind]]]
30687     [Bind the socket to the given local endpoint. ]
30688   ]
30689   
30690   [
30691     [[link boost_asio.reference.basic_socket.cancel [*cancel]]]
30692     [Cancel all asynchronous operations associated with the socket. ]
30693   ]
30694   
30695   [
30696     [[link boost_asio.reference.basic_socket.close [*close]]]
30697     [Close the socket. ]
30698   ]
30699   
30700   [
30701     [[link boost_asio.reference.basic_socket.connect [*connect]]]
30702     [Connect the socket to the specified endpoint. ]
30703   ]
30704   
30705   [
30706     [[link boost_asio.reference.basic_socket.get_executor [*get_executor]]]
30707     [Get the executor associated with the object. ]
30708   ]
30709   
30710   [
30711     [[link boost_asio.reference.basic_socket.get_option [*get_option]]]
30712     [Get an option from the socket. ]
30713   ]
30714   
30715   [
30716     [[link boost_asio.reference.basic_socket.io_control [*io_control]]]
30717     [Perform an IO control command on the socket. ]
30718   ]
30719   
30720   [
30721     [[link boost_asio.reference.basic_socket.is_open [*is_open]]]
30722     [Determine whether the socket is open. ]
30723   ]
30724   
30725   [
30726     [[link boost_asio.reference.basic_socket.local_endpoint [*local_endpoint]]]
30727     [Get the local endpoint of the socket. ]
30728   ]
30729   
30730   [
30731     [[link boost_asio.reference.basic_socket.lowest_layer [*lowest_layer]]]
30732     [Get a reference to the lowest layer. 
30733      [hr]
30734      Get a const reference to the lowest layer. ]
30735   ]
30736   
30737   [
30738     [[link boost_asio.reference.basic_socket.native_handle [*native_handle]]]
30739     [Get the native socket representation. ]
30740   ]
30741   
30742   [
30743     [[link boost_asio.reference.basic_socket.native_non_blocking [*native_non_blocking]]]
30744     [Gets the non-blocking mode of the native socket implementation. 
30745      [hr]
30746      Sets the non-blocking mode of the native socket implementation. ]
30747   ]
30748   
30749   [
30750     [[link boost_asio.reference.basic_socket.non_blocking [*non_blocking]]]
30751     [Gets the non-blocking mode of the socket. 
30752      [hr]
30753      Sets the non-blocking mode of the socket. ]
30754   ]
30755   
30756   [
30757     [[link boost_asio.reference.basic_socket.open [*open]]]
30758     [Open the socket using the specified protocol. ]
30759   ]
30760   
30761   [
30762     [[link boost_asio.reference.basic_socket.operator_eq_ [*operator=]]]
30763     [Move-assign a basic_socket from another. 
30764      [hr]
30765      Move-assign a basic_socket from a socket of another protocol type. ]
30766   ]
30767   
30768   [
30769     [[link boost_asio.reference.basic_socket.release [*release]]]
30770     [Release ownership of the underlying native socket. ]
30771   ]
30772   
30773   [
30774     [[link boost_asio.reference.basic_socket.remote_endpoint [*remote_endpoint]]]
30775     [Get the remote endpoint of the socket. ]
30776   ]
30777   
30778   [
30779     [[link boost_asio.reference.basic_socket.set_option [*set_option]]]
30780     [Set an option on the socket. ]
30781   ]
30782   
30783   [
30784     [[link boost_asio.reference.basic_socket.shutdown [*shutdown]]]
30785     [Disable sends or receives on the socket. ]
30786   ]
30787   
30788   [
30789     [[link boost_asio.reference.basic_socket.wait [*wait]]]
30790     [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
30791   ]
30792   
30793 ]
30794
30795 [heading Protected Member Functions]
30796 [table
30797   [[Name][Description]]
30798
30799   [
30800     [[link boost_asio.reference.basic_socket._basic_socket [*~basic_socket]]]
30801     [Protected destructor to prevent deletion through this type. ]
30802   ]
30803   
30804 ]
30805
30806 [heading Data Members]
30807 [table
30808   [[Name][Description]]
30809
30810   [
30811     [[link boost_asio.reference.basic_socket.max_connections [*max_connections]]]
30812     [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
30813   ]
30814
30815   [
30816     [[link boost_asio.reference.basic_socket.max_listen_connections [*max_listen_connections]]]
30817     [The maximum length of the queue of pending incoming connections. ]
30818   ]
30819
30820   [
30821     [[link boost_asio.reference.basic_socket.message_do_not_route [*message_do_not_route]]]
30822     [Specify that the data should not be subject to routing. ]
30823   ]
30824
30825   [
30826     [[link boost_asio.reference.basic_socket.message_end_of_record [*message_end_of_record]]]
30827     [Specifies that the data marks the end of a record. ]
30828   ]
30829
30830   [
30831     [[link boost_asio.reference.basic_socket.message_out_of_band [*message_out_of_band]]]
30832     [Process out-of-band data. ]
30833   ]
30834
30835   [
30836     [[link boost_asio.reference.basic_socket.message_peek [*message_peek]]]
30837     [Peek at incoming data without removing it from the input queue. ]
30838   ]
30839
30840 ]
30841
30842 [heading Protected Data Members]
30843 [table
30844   [[Name][Description]]
30845
30846   [
30847     [[link boost_asio.reference.basic_socket.impl_ [*impl_]]]
30848     []
30849   ]
30850
30851 ]
30852
30853 The [link boost_asio.reference.basic_socket `basic_socket`] class template provides functionality that is common to both stream-oriented and datagram-oriented sockets.
30854
30855
30856 [heading Thread Safety]
30857   
30858 ['Distinct] ['objects:] Safe.
30859
30860 ['Shared] ['objects:] Unsafe. 
30861
30862
30863
30864 [heading Requirements]
30865
30866 ['Header: ][^boost/asio/basic_socket.hpp]
30867
30868 ['Convenience header: ][^boost/asio.hpp]
30869
30870 [section:assign basic_socket::assign]
30871
30872 [indexterm2 boost_asio.indexterm.basic_socket.assign..assign..basic_socket] 
30873 Assign an existing native socket to the socket. 
30874
30875
30876   void ``[link boost_asio.reference.basic_socket.assign.overload1 assign]``(
30877       const protocol_type & protocol,
30878       const native_handle_type & native_socket);
30879   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.assign.overload1 more...]]``
30880
30881   void ``[link boost_asio.reference.basic_socket.assign.overload2 assign]``(
30882       const protocol_type & protocol,
30883       const native_handle_type & native_socket,
30884       boost::system::error_code & ec);
30885   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.assign.overload2 more...]]``
30886
30887
30888 [section:overload1 basic_socket::assign (1 of 2 overloads)]
30889
30890
30891 Assign an existing native socket to the socket. 
30892
30893
30894   void assign(
30895       const protocol_type & protocol,
30896       const native_handle_type & native_socket);
30897
30898
30899
30900 [endsect]
30901
30902
30903
30904 [section:overload2 basic_socket::assign (2 of 2 overloads)]
30905
30906
30907 Assign an existing native socket to the socket. 
30908
30909
30910   void assign(
30911       const protocol_type & protocol,
30912       const native_handle_type & native_socket,
30913       boost::system::error_code & ec);
30914
30915
30916
30917 [endsect]
30918
30919
30920 [endsect]
30921
30922
30923 [section:async_connect basic_socket::async_connect]
30924
30925 [indexterm2 boost_asio.indexterm.basic_socket.async_connect..async_connect..basic_socket] 
30926 Start an asynchronous connect. 
30927
30928
30929   template<
30930       typename ``[link boost_asio.reference.ConnectHandler ConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
30931   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect(
30932       const endpoint_type & peer_endpoint,
30933       ConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
30934
30935
30936 This function is used to asynchronously connect a socket to the specified remote endpoint. The function call always returns immediately.
30937
30938 The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
30939
30940
30941 [heading Parameters]
30942     
30943
30944 [variablelist
30945   
30946 [[peer_endpoint][The remote endpoint to which the socket will be connected. Copies will be made of the endpoint object as required.]]
30947
30948 [[handler][The handler to be called when the connection operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
30949 ``
30950    void handler(
30951      const boost::system::error_code& error // Result of operation
30952    ); 
30953 ``
30954 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
30955
30956 ]
30957
30958
30959 [heading Example]
30960   
30961
30962
30963    void connect_handler(const boost::system::error_code& error)
30964    {
30965      if (!error)
30966      {
30967        // Connect succeeded.
30968      }
30969    }
30970
30971    ...
30972
30973    boost::asio::ip::tcp::socket socket(my_context);
30974    boost::asio::ip::tcp::endpoint endpoint(
30975        boost::asio::ip::address::from_string("1.2.3.4"), 12345);
30976    socket.async_connect(endpoint, connect_handler);
30977
30978
30979
30980
30981
30982
30983
30984 [endsect]
30985
30986
30987
30988 [section:async_wait basic_socket::async_wait]
30989
30990 [indexterm2 boost_asio.indexterm.basic_socket.async_wait..async_wait..basic_socket] 
30991 Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. 
30992
30993
30994   template<
30995       typename ``[link boost_asio.reference.WaitHandler WaitHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
30996   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait(
30997       wait_type w,
30998       WaitHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
30999
31000
31001 This function is used to perform an asynchronous wait for a socket to enter a ready to read, write or error condition state.
31002
31003
31004 [heading Parameters]
31005     
31006
31007 [variablelist
31008   
31009 [[w][Specifies the desired socket state.]]
31010
31011 [[handler][The handler to be called when the wait operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
31012 ``
31013    void handler(
31014      const boost::system::error_code& error // Result of operation
31015    ); 
31016 ``
31017 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
31018
31019 ]
31020
31021
31022 [heading Example]
31023   
31024
31025
31026    void wait_handler(const boost::system::error_code& error)
31027    {
31028      if (!error)
31029      {
31030        // Wait succeeded.
31031      }
31032    }
31033
31034    ...
31035
31036    boost::asio::ip::tcp::socket socket(my_context);
31037    ...
31038    socket.async_wait(boost::asio::ip::tcp::socket::wait_read, wait_handler);
31039
31040
31041
31042
31043
31044
31045
31046 [endsect]
31047
31048
31049 [section:at_mark basic_socket::at_mark]
31050
31051 [indexterm2 boost_asio.indexterm.basic_socket.at_mark..at_mark..basic_socket] 
31052 Determine whether the socket is at the out-of-band data mark. 
31053
31054
31055   bool ``[link boost_asio.reference.basic_socket.at_mark.overload1 at_mark]``() const;
31056   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.at_mark.overload1 more...]]``
31057
31058   bool ``[link boost_asio.reference.basic_socket.at_mark.overload2 at_mark]``(
31059       boost::system::error_code & ec) const;
31060   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.at_mark.overload2 more...]]``
31061
31062
31063 [section:overload1 basic_socket::at_mark (1 of 2 overloads)]
31064
31065
31066 Determine whether the socket is at the out-of-band data mark. 
31067
31068
31069   bool at_mark() const;
31070
31071
31072 This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
31073
31074
31075 [heading Return Value]
31076       
31077 A bool indicating whether the socket is at the out-of-band data mark.
31078
31079
31080 [heading Exceptions]
31081     
31082
31083 [variablelist
31084   
31085 [[boost::system::system_error][Thrown on failure. ]]
31086
31087 ]
31088
31089
31090
31091
31092 [endsect]
31093
31094
31095
31096 [section:overload2 basic_socket::at_mark (2 of 2 overloads)]
31097
31098
31099 Determine whether the socket is at the out-of-band data mark. 
31100
31101
31102   bool at_mark(
31103       boost::system::error_code & ec) const;
31104
31105
31106 This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
31107
31108
31109 [heading Parameters]
31110     
31111
31112 [variablelist
31113   
31114 [[ec][Set to indicate what error occurred, if any.]]
31115
31116 ]
31117
31118
31119 [heading Return Value]
31120       
31121 A bool indicating whether the socket is at the out-of-band data mark. 
31122
31123
31124
31125
31126 [endsect]
31127
31128
31129 [endsect]
31130
31131 [section:available basic_socket::available]
31132
31133 [indexterm2 boost_asio.indexterm.basic_socket.available..available..basic_socket] 
31134 Determine the number of bytes available for reading. 
31135
31136
31137   std::size_t ``[link boost_asio.reference.basic_socket.available.overload1 available]``() const;
31138   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.available.overload1 more...]]``
31139
31140   std::size_t ``[link boost_asio.reference.basic_socket.available.overload2 available]``(
31141       boost::system::error_code & ec) const;
31142   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.available.overload2 more...]]``
31143
31144
31145 [section:overload1 basic_socket::available (1 of 2 overloads)]
31146
31147
31148 Determine the number of bytes available for reading. 
31149
31150
31151   std::size_t available() const;
31152
31153
31154 This function is used to determine the number of bytes that may be read without blocking.
31155
31156
31157 [heading Return Value]
31158       
31159 The number of bytes that may be read without blocking, or 0 if an error occurs.
31160
31161
31162 [heading Exceptions]
31163     
31164
31165 [variablelist
31166   
31167 [[boost::system::system_error][Thrown on failure. ]]
31168
31169 ]
31170
31171
31172
31173
31174 [endsect]
31175
31176
31177
31178 [section:overload2 basic_socket::available (2 of 2 overloads)]
31179
31180
31181 Determine the number of bytes available for reading. 
31182
31183
31184   std::size_t available(
31185       boost::system::error_code & ec) const;
31186
31187
31188 This function is used to determine the number of bytes that may be read without blocking.
31189
31190
31191 [heading Parameters]
31192     
31193
31194 [variablelist
31195   
31196 [[ec][Set to indicate what error occurred, if any.]]
31197
31198 ]
31199
31200
31201 [heading Return Value]
31202       
31203 The number of bytes that may be read without blocking, or 0 if an error occurs. 
31204
31205
31206
31207
31208 [endsect]
31209
31210
31211 [endsect]
31212
31213 [section:basic_socket basic_socket::basic_socket]
31214
31215 [indexterm2 boost_asio.indexterm.basic_socket.basic_socket..basic_socket..basic_socket] 
31216 Construct a [link boost_asio.reference.basic_socket `basic_socket`] without opening it. 
31217
31218
31219   explicit ``[link boost_asio.reference.basic_socket.basic_socket.overload1 basic_socket]``(
31220       const executor_type & ex);
31221   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.basic_socket.overload1 more...]]``
31222
31223   template<
31224       typename ExecutionContext>
31225   explicit ``[link boost_asio.reference.basic_socket.basic_socket.overload2 basic_socket]``(
31226       ExecutionContext & context,
31227       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
31228   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.basic_socket.overload2 more...]]``
31229
31230
31231 Construct and open a [link boost_asio.reference.basic_socket `basic_socket`]. 
31232
31233
31234   ``[link boost_asio.reference.basic_socket.basic_socket.overload3 basic_socket]``(
31235       const executor_type & ex,
31236       const protocol_type & protocol);
31237   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.basic_socket.overload3 more...]]``
31238
31239   template<
31240       typename ExecutionContext>
31241   ``[link boost_asio.reference.basic_socket.basic_socket.overload4 basic_socket]``(
31242       ExecutionContext & context,
31243       const protocol_type & protocol,
31244       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
31245   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.basic_socket.overload4 more...]]``
31246
31247
31248 Construct a [link boost_asio.reference.basic_socket `basic_socket`], opening it and binding it to the given local endpoint. 
31249
31250
31251   ``[link boost_asio.reference.basic_socket.basic_socket.overload5 basic_socket]``(
31252       const executor_type & ex,
31253       const endpoint_type & endpoint);
31254   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.basic_socket.overload5 more...]]``
31255
31256   template<
31257       typename ExecutionContext>
31258   ``[link boost_asio.reference.basic_socket.basic_socket.overload6 basic_socket]``(
31259       ExecutionContext & context,
31260       const endpoint_type & endpoint,
31261       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
31262   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.basic_socket.overload6 more...]]``
31263
31264
31265 Construct a [link boost_asio.reference.basic_socket `basic_socket`] on an existing native socket. 
31266
31267
31268   ``[link boost_asio.reference.basic_socket.basic_socket.overload7 basic_socket]``(
31269       const executor_type & ex,
31270       const protocol_type & protocol,
31271       const native_handle_type & native_socket);
31272   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.basic_socket.overload7 more...]]``
31273
31274   template<
31275       typename ExecutionContext>
31276   ``[link boost_asio.reference.basic_socket.basic_socket.overload8 basic_socket]``(
31277       ExecutionContext & context,
31278       const protocol_type & protocol,
31279       const native_handle_type & native_socket,
31280       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
31281   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.basic_socket.overload8 more...]]``
31282
31283
31284 Move-construct a [link boost_asio.reference.basic_socket `basic_socket`] from another. 
31285
31286
31287   ``[link boost_asio.reference.basic_socket.basic_socket.overload9 basic_socket]``(
31288       basic_socket && other);
31289   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.basic_socket.overload9 more...]]``
31290
31291
31292 Move-construct a [link boost_asio.reference.basic_socket `basic_socket`] from a socket of another protocol type. 
31293
31294
31295   template<
31296       typename ``[link boost_asio.reference.Protocol Protocol1]``,
31297       typename ``[link boost_asio.reference.Executor1 Executor1]``>
31298   ``[link boost_asio.reference.basic_socket.basic_socket.overload10 basic_socket]``(
31299       basic_socket< Protocol1, Executor1 > && other,
31300       typename enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type *  = 0);
31301   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.basic_socket.overload10 more...]]``
31302
31303
31304 [section:overload1 basic_socket::basic_socket (1 of 10 overloads)]
31305
31306
31307 Construct a [link boost_asio.reference.basic_socket `basic_socket`] without opening it. 
31308
31309
31310   basic_socket(
31311       const executor_type & ex);
31312
31313
31314 This constructor creates a socket without opening it.
31315
31316
31317 [heading Parameters]
31318     
31319
31320 [variablelist
31321   
31322 [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket. ]]
31323
31324 ]
31325
31326
31327
31328
31329 [endsect]
31330
31331
31332
31333 [section:overload2 basic_socket::basic_socket (2 of 10 overloads)]
31334
31335
31336 Construct a [link boost_asio.reference.basic_socket `basic_socket`] without opening it. 
31337
31338
31339   template<
31340       typename ExecutionContext>
31341   basic_socket(
31342       ExecutionContext & context,
31343       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
31344
31345
31346 This constructor creates a socket without opening it.
31347
31348
31349 [heading Parameters]
31350     
31351
31352 [variablelist
31353   
31354 [[context][An execution context which provides the I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket. ]]
31355
31356 ]
31357
31358
31359
31360
31361 [endsect]
31362
31363
31364
31365 [section:overload3 basic_socket::basic_socket (3 of 10 overloads)]
31366
31367
31368 Construct and open a [link boost_asio.reference.basic_socket `basic_socket`]. 
31369
31370
31371   basic_socket(
31372       const executor_type & ex,
31373       const protocol_type & protocol);
31374
31375
31376 This constructor creates and opens a socket.
31377
31378
31379 [heading Parameters]
31380     
31381
31382 [variablelist
31383   
31384 [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
31385
31386 [[protocol][An object specifying protocol parameters to be used.]]
31387
31388 ]
31389
31390
31391 [heading Exceptions]
31392     
31393
31394 [variablelist
31395   
31396 [[boost::system::system_error][Thrown on failure. ]]
31397
31398 ]
31399
31400
31401
31402
31403 [endsect]
31404
31405
31406
31407 [section:overload4 basic_socket::basic_socket (4 of 10 overloads)]
31408
31409
31410 Construct and open a [link boost_asio.reference.basic_socket `basic_socket`]. 
31411
31412
31413   template<
31414       typename ExecutionContext>
31415   basic_socket(
31416       ExecutionContext & context,
31417       const protocol_type & protocol,
31418       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
31419
31420
31421 This constructor creates and opens a socket.
31422
31423
31424 [heading Parameters]
31425     
31426
31427 [variablelist
31428   
31429 [[context][An execution context which provides the I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
31430
31431 [[protocol][An object specifying protocol parameters to be used.]]
31432
31433 ]
31434
31435
31436 [heading Exceptions]
31437     
31438
31439 [variablelist
31440   
31441 [[boost::system::system_error][Thrown on failure. ]]
31442
31443 ]
31444
31445
31446
31447
31448 [endsect]
31449
31450
31451
31452 [section:overload5 basic_socket::basic_socket (5 of 10 overloads)]
31453
31454
31455 Construct a [link boost_asio.reference.basic_socket `basic_socket`], opening it and binding it to the given local endpoint. 
31456
31457
31458   basic_socket(
31459       const executor_type & ex,
31460       const endpoint_type & endpoint);
31461
31462
31463 This constructor creates a 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.
31464
31465
31466 [heading Parameters]
31467     
31468
31469 [variablelist
31470   
31471 [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
31472
31473 [[endpoint][An endpoint on the local machine to which the socket will be bound.]]
31474
31475 ]
31476
31477
31478 [heading Exceptions]
31479     
31480
31481 [variablelist
31482   
31483 [[boost::system::system_error][Thrown on failure. ]]
31484
31485 ]
31486
31487
31488
31489
31490 [endsect]
31491
31492
31493
31494 [section:overload6 basic_socket::basic_socket (6 of 10 overloads)]
31495
31496
31497 Construct a [link boost_asio.reference.basic_socket `basic_socket`], opening it and binding it to the given local endpoint. 
31498
31499
31500   template<
31501       typename ExecutionContext>
31502   basic_socket(
31503       ExecutionContext & context,
31504       const endpoint_type & endpoint,
31505       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
31506
31507
31508 This constructor creates a 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.
31509
31510
31511 [heading Parameters]
31512     
31513
31514 [variablelist
31515   
31516 [[context][An execution context which provides the I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
31517
31518 [[endpoint][An endpoint on the local machine to which the socket will be bound.]]
31519
31520 ]
31521
31522
31523 [heading Exceptions]
31524     
31525
31526 [variablelist
31527   
31528 [[boost::system::system_error][Thrown on failure. ]]
31529
31530 ]
31531
31532
31533
31534
31535 [endsect]
31536
31537
31538
31539 [section:overload7 basic_socket::basic_socket (7 of 10 overloads)]
31540
31541
31542 Construct a [link boost_asio.reference.basic_socket `basic_socket`] on an existing native socket. 
31543
31544
31545   basic_socket(
31546       const executor_type & ex,
31547       const protocol_type & protocol,
31548       const native_handle_type & native_socket);
31549
31550
31551 This constructor creates a socket object to hold an existing native socket.
31552
31553
31554 [heading Parameters]
31555     
31556
31557 [variablelist
31558   
31559 [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
31560
31561 [[protocol][An object specifying protocol parameters to be used.]]
31562
31563 [[native_socket][A native socket.]]
31564
31565 ]
31566
31567
31568 [heading Exceptions]
31569     
31570
31571 [variablelist
31572   
31573 [[boost::system::system_error][Thrown on failure. ]]
31574
31575 ]
31576
31577
31578
31579
31580 [endsect]
31581
31582
31583
31584 [section:overload8 basic_socket::basic_socket (8 of 10 overloads)]
31585
31586
31587 Construct a [link boost_asio.reference.basic_socket `basic_socket`] on an existing native socket. 
31588
31589
31590   template<
31591       typename ExecutionContext>
31592   basic_socket(
31593       ExecutionContext & context,
31594       const protocol_type & protocol,
31595       const native_handle_type & native_socket,
31596       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
31597
31598
31599 This constructor creates a socket object to hold an existing native socket.
31600
31601
31602 [heading Parameters]
31603     
31604
31605 [variablelist
31606   
31607 [[context][An execution context which provides the I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
31608
31609 [[protocol][An object specifying protocol parameters to be used.]]
31610
31611 [[native_socket][A native socket.]]
31612
31613 ]
31614
31615
31616 [heading Exceptions]
31617     
31618
31619 [variablelist
31620   
31621 [[boost::system::system_error][Thrown on failure. ]]
31622
31623 ]
31624
31625
31626
31627
31628 [endsect]
31629
31630
31631
31632 [section:overload9 basic_socket::basic_socket (9 of 10 overloads)]
31633
31634
31635 Move-construct a [link boost_asio.reference.basic_socket `basic_socket`] from another. 
31636
31637
31638   basic_socket(
31639       basic_socket && other);
31640
31641
31642 This constructor moves a socket from one object to another.
31643
31644
31645 [heading Parameters]
31646     
31647
31648 [variablelist
31649   
31650 [[other][The other [link boost_asio.reference.basic_socket `basic_socket`] object from which the move will occur.]]
31651
31652 ]
31653
31654
31655 [heading Remarks]
31656       
31657 Following the move, the moved-from object is in the same state as if constructed using the `basic_socket(const executor_type&) constructor`. 
31658
31659
31660
31661
31662 [endsect]
31663
31664
31665
31666 [section:overload10 basic_socket::basic_socket (10 of 10 overloads)]
31667
31668
31669 Move-construct a [link boost_asio.reference.basic_socket `basic_socket`] from a socket of another protocol type. 
31670
31671
31672   template<
31673       typename ``[link boost_asio.reference.Protocol Protocol1]``,
31674       typename ``[link boost_asio.reference.Executor1 Executor1]``>
31675   basic_socket(
31676       basic_socket< Protocol1, Executor1 > && other,
31677       typename enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type *  = 0);
31678
31679
31680 This constructor moves a socket from one object to another.
31681
31682
31683 [heading Parameters]
31684     
31685
31686 [variablelist
31687   
31688 [[other][The other [link boost_asio.reference.basic_socket `basic_socket`] object from which the move will occur.]]
31689
31690 ]
31691
31692
31693 [heading Remarks]
31694       
31695 Following the move, the moved-from object is in the same state as if constructed using the `basic_socket(const executor_type&) constructor`. 
31696
31697
31698
31699
31700 [endsect]
31701
31702
31703 [endsect]
31704
31705 [section:bind basic_socket::bind]
31706
31707 [indexterm2 boost_asio.indexterm.basic_socket.bind..bind..basic_socket] 
31708 Bind the socket to the given local endpoint. 
31709
31710
31711   void ``[link boost_asio.reference.basic_socket.bind.overload1 bind]``(
31712       const endpoint_type & endpoint);
31713   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.bind.overload1 more...]]``
31714
31715   void ``[link boost_asio.reference.basic_socket.bind.overload2 bind]``(
31716       const endpoint_type & endpoint,
31717       boost::system::error_code & ec);
31718   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.bind.overload2 more...]]``
31719
31720
31721 [section:overload1 basic_socket::bind (1 of 2 overloads)]
31722
31723
31724 Bind the socket to the given local endpoint. 
31725
31726
31727   void bind(
31728       const endpoint_type & endpoint);
31729
31730
31731 This function binds the socket to the specified endpoint on the local machine.
31732
31733
31734 [heading Parameters]
31735     
31736
31737 [variablelist
31738   
31739 [[endpoint][An endpoint on the local machine to which the socket will be bound.]]
31740
31741 ]
31742
31743
31744 [heading Exceptions]
31745     
31746
31747 [variablelist
31748   
31749 [[boost::system::system_error][Thrown on failure.]]
31750
31751 ]
31752
31753
31754 [heading Example]
31755   
31756
31757
31758    boost::asio::ip::tcp::socket socket(my_context);
31759    socket.open(boost::asio::ip::tcp::v4());
31760    socket.bind(boost::asio::ip::tcp::endpoint(
31761          boost::asio::ip::tcp::v4(), 12345));
31762
31763
31764
31765
31766
31767
31768
31769 [endsect]
31770
31771
31772
31773 [section:overload2 basic_socket::bind (2 of 2 overloads)]
31774
31775
31776 Bind the socket to the given local endpoint. 
31777
31778
31779   void bind(
31780       const endpoint_type & endpoint,
31781       boost::system::error_code & ec);
31782
31783
31784 This function binds the socket to the specified endpoint on the local machine.
31785
31786
31787 [heading Parameters]
31788     
31789
31790 [variablelist
31791   
31792 [[endpoint][An endpoint on the local machine to which the socket will be bound.]]
31793
31794 [[ec][Set to indicate what error occurred, if any.]]
31795
31796 ]
31797
31798
31799 [heading Example]
31800   
31801
31802
31803    boost::asio::ip::tcp::socket socket(my_context);
31804    socket.open(boost::asio::ip::tcp::v4());
31805    boost::system::error_code ec;
31806    socket.bind(boost::asio::ip::tcp::endpoint(
31807          boost::asio::ip::tcp::v4(), 12345), ec);
31808    if (ec)
31809    {
31810      // An error occurred.
31811    }
31812
31813
31814
31815
31816
31817
31818
31819 [endsect]
31820
31821
31822 [endsect]
31823
31824
31825 [section:broadcast basic_socket::broadcast]
31826
31827
31828 ['Inherited from socket_base.]
31829
31830 [indexterm2 boost_asio.indexterm.basic_socket.broadcast..broadcast..basic_socket] 
31831 Socket option to permit sending of broadcast messages. 
31832
31833
31834   typedef implementation_defined broadcast;
31835
31836
31837
31838 Implements the SOL\_SOCKET/SO\_BROADCAST socket option.
31839
31840
31841 [heading Examples]
31842   
31843 Setting the option: 
31844
31845    boost::asio::ip::udp::socket socket(my_context);
31846    ...
31847    boost::asio::socket_base::broadcast option(true);
31848    socket.set_option(option);
31849
31850
31851
31852
31853
31854 Getting the current option value: 
31855
31856    boost::asio::ip::udp::socket socket(my_context);
31857    ...
31858    boost::asio::socket_base::broadcast option;
31859    socket.get_option(option);
31860    bool is_set = option.value();
31861
31862
31863
31864
31865
31866
31867
31868 [heading Requirements]
31869
31870 ['Header: ][^boost/asio/basic_socket.hpp]
31871
31872 ['Convenience header: ][^boost/asio.hpp]
31873
31874
31875 [endsect]
31876
31877
31878
31879 [section:bytes_readable basic_socket::bytes_readable]
31880
31881
31882 ['Inherited from socket_base.]
31883
31884 [indexterm2 boost_asio.indexterm.basic_socket.bytes_readable..bytes_readable..basic_socket] 
31885 IO control command to get the amount of data that can be read without blocking. 
31886
31887
31888   typedef implementation_defined bytes_readable;
31889
31890
31891
31892 Implements the FIONREAD IO control command.
31893
31894
31895 [heading Example]
31896   
31897
31898
31899    boost::asio::ip::tcp::socket socket(my_context);
31900    ...
31901    boost::asio::socket_base::bytes_readable command(true);
31902    socket.io_control(command);
31903    std::size_t bytes_readable = command.get();
31904
31905
31906
31907
31908
31909
31910
31911 [heading Requirements]
31912
31913 ['Header: ][^boost/asio/basic_socket.hpp]
31914
31915 ['Convenience header: ][^boost/asio.hpp]
31916
31917
31918 [endsect]
31919
31920
31921 [section:cancel basic_socket::cancel]
31922
31923 [indexterm2 boost_asio.indexterm.basic_socket.cancel..cancel..basic_socket] 
31924 Cancel all asynchronous operations associated with the socket. 
31925
31926
31927   void ``[link boost_asio.reference.basic_socket.cancel.overload1 cancel]``();
31928   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.cancel.overload1 more...]]``
31929
31930   void ``[link boost_asio.reference.basic_socket.cancel.overload2 cancel]``(
31931       boost::system::error_code & ec);
31932   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.cancel.overload2 more...]]``
31933
31934
31935 [section:overload1 basic_socket::cancel (1 of 2 overloads)]
31936
31937
31938 Cancel all asynchronous operations associated with the socket. 
31939
31940
31941   void cancel();
31942
31943
31944 This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
31945
31946
31947 [heading Exceptions]
31948     
31949
31950 [variablelist
31951   
31952 [[boost::system::system_error][Thrown on failure.]]
31953
31954 ]
31955
31956
31957 [heading Remarks]
31958       
31959 Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use:
31960
31961
31962 * It will only cancel asynchronous operations that were initiated in the current thread.
31963
31964
31965 * It can appear to complete without error, but the request to cancel the unfinished operations may be silently ignored by the operating system. Whether it works or not seems to depend on the drivers that are installed.
31966
31967 For portable cancellation, consider using one of the following alternatives:
31968
31969
31970 * Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP.
31971
31972
31973 * Use the `close()` function to simultaneously cancel the outstanding operations and close the socket.
31974
31975 When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above. 
31976
31977
31978 [endsect]
31979
31980
31981
31982 [section:overload2 basic_socket::cancel (2 of 2 overloads)]
31983
31984
31985 Cancel all asynchronous operations associated with the socket. 
31986
31987
31988   void cancel(
31989       boost::system::error_code & ec);
31990
31991
31992 This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
31993
31994
31995 [heading Parameters]
31996     
31997
31998 [variablelist
31999   
32000 [[ec][Set to indicate what error occurred, if any.]]
32001
32002 ]
32003
32004
32005 [heading Remarks]
32006       
32007 Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use:
32008
32009
32010 * It will only cancel asynchronous operations that were initiated in the current thread.
32011
32012
32013 * It can appear to complete without error, but the request to cancel the unfinished operations may be silently ignored by the operating system. Whether it works or not seems to depend on the drivers that are installed.
32014
32015 For portable cancellation, consider using one of the following alternatives:
32016
32017
32018 * Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP.
32019
32020
32021 * Use the `close()` function to simultaneously cancel the outstanding operations and close the socket.
32022
32023 When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above. 
32024
32025
32026 [endsect]
32027
32028
32029 [endsect]
32030
32031 [section:close basic_socket::close]
32032
32033 [indexterm2 boost_asio.indexterm.basic_socket.close..close..basic_socket] 
32034 Close the socket. 
32035
32036
32037   void ``[link boost_asio.reference.basic_socket.close.overload1 close]``();
32038   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.close.overload1 more...]]``
32039
32040   void ``[link boost_asio.reference.basic_socket.close.overload2 close]``(
32041       boost::system::error_code & ec);
32042   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.close.overload2 more...]]``
32043
32044
32045 [section:overload1 basic_socket::close (1 of 2 overloads)]
32046
32047
32048 Close the socket. 
32049
32050
32051   void close();
32052
32053
32054 This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
32055
32056
32057 [heading Exceptions]
32058     
32059
32060 [variablelist
32061   
32062 [[boost::system::system_error][Thrown on failure. Note that, even if the function indicates an error, the underlying descriptor is closed.]]
32063
32064 ]
32065
32066
32067 [heading Remarks]
32068       
32069 For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket. 
32070
32071
32072
32073
32074 [endsect]
32075
32076
32077
32078 [section:overload2 basic_socket::close (2 of 2 overloads)]
32079
32080
32081 Close the socket. 
32082
32083
32084   void close(
32085       boost::system::error_code & ec);
32086
32087
32088 This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
32089
32090
32091 [heading Parameters]
32092     
32093
32094 [variablelist
32095   
32096 [[ec][Set to indicate what error occurred, if any. Note that, even if the function indicates an error, the underlying descriptor is closed.]]
32097
32098 ]
32099
32100
32101 [heading Example]
32102   
32103
32104
32105    boost::asio::ip::tcp::socket socket(my_context);
32106    ...
32107    boost::system::error_code ec;
32108    socket.close(ec);
32109    if (ec)
32110    {
32111      // An error occurred.
32112    }
32113
32114
32115
32116
32117
32118 [heading Remarks]
32119       
32120 For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket. 
32121
32122
32123
32124
32125 [endsect]
32126
32127
32128 [endsect]
32129
32130 [section:connect basic_socket::connect]
32131
32132 [indexterm2 boost_asio.indexterm.basic_socket.connect..connect..basic_socket] 
32133 Connect the socket to the specified endpoint. 
32134
32135
32136   void ``[link boost_asio.reference.basic_socket.connect.overload1 connect]``(
32137       const endpoint_type & peer_endpoint);
32138   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.connect.overload1 more...]]``
32139
32140   void ``[link boost_asio.reference.basic_socket.connect.overload2 connect]``(
32141       const endpoint_type & peer_endpoint,
32142       boost::system::error_code & ec);
32143   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.connect.overload2 more...]]``
32144
32145
32146 [section:overload1 basic_socket::connect (1 of 2 overloads)]
32147
32148
32149 Connect the socket to the specified endpoint. 
32150
32151
32152   void connect(
32153       const endpoint_type & peer_endpoint);
32154
32155
32156 This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs.
32157
32158 The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
32159
32160
32161 [heading Parameters]
32162     
32163
32164 [variablelist
32165   
32166 [[peer_endpoint][The remote endpoint to which the socket will be connected.]]
32167
32168 ]
32169
32170
32171 [heading Exceptions]
32172     
32173
32174 [variablelist
32175   
32176 [[boost::system::system_error][Thrown on failure.]]
32177
32178 ]
32179
32180
32181 [heading Example]
32182   
32183
32184
32185    boost::asio::ip::tcp::socket socket(my_context);
32186    boost::asio::ip::tcp::endpoint endpoint(
32187        boost::asio::ip::address::from_string("1.2.3.4"), 12345);
32188    socket.connect(endpoint);
32189
32190
32191
32192
32193
32194
32195
32196 [endsect]
32197
32198
32199
32200 [section:overload2 basic_socket::connect (2 of 2 overloads)]
32201
32202
32203 Connect the socket to the specified endpoint. 
32204
32205
32206   void connect(
32207       const endpoint_type & peer_endpoint,
32208       boost::system::error_code & ec);
32209
32210
32211 This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs.
32212
32213 The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
32214
32215
32216 [heading Parameters]
32217     
32218
32219 [variablelist
32220   
32221 [[peer_endpoint][The remote endpoint to which the socket will be connected.]]
32222
32223 [[ec][Set to indicate what error occurred, if any.]]
32224
32225 ]
32226
32227
32228 [heading Example]
32229   
32230
32231
32232    boost::asio::ip::tcp::socket socket(my_context);
32233    boost::asio::ip::tcp::endpoint endpoint(
32234        boost::asio::ip::address::from_string("1.2.3.4"), 12345);
32235    boost::system::error_code ec;
32236    socket.connect(endpoint, ec);
32237    if (ec)
32238    {
32239      // An error occurred.
32240    }
32241
32242
32243
32244
32245
32246
32247
32248 [endsect]
32249
32250
32251 [endsect]
32252
32253
32254 [section:debug basic_socket::debug]
32255
32256
32257 ['Inherited from socket_base.]
32258
32259 [indexterm2 boost_asio.indexterm.basic_socket.debug..debug..basic_socket] 
32260 Socket option to enable socket-level debugging. 
32261
32262
32263   typedef implementation_defined debug;
32264
32265
32266
32267 Implements the SOL\_SOCKET/SO\_DEBUG socket option.
32268
32269
32270 [heading Examples]
32271   
32272 Setting the option: 
32273
32274    boost::asio::ip::tcp::socket socket(my_context);
32275    ...
32276    boost::asio::socket_base::debug option(true);
32277    socket.set_option(option);
32278
32279
32280
32281
32282
32283 Getting the current option value: 
32284
32285    boost::asio::ip::tcp::socket socket(my_context);
32286    ...
32287    boost::asio::socket_base::debug option;
32288    socket.get_option(option);
32289    bool is_set = option.value();
32290
32291
32292
32293
32294
32295
32296
32297 [heading Requirements]
32298
32299 ['Header: ][^boost/asio/basic_socket.hpp]
32300
32301 ['Convenience header: ][^boost/asio.hpp]
32302
32303
32304 [endsect]
32305
32306
32307
32308 [section:do_not_route basic_socket::do_not_route]
32309
32310
32311 ['Inherited from socket_base.]
32312
32313 [indexterm2 boost_asio.indexterm.basic_socket.do_not_route..do_not_route..basic_socket] 
32314 Socket option to prevent routing, use local interfaces only. 
32315
32316
32317   typedef implementation_defined do_not_route;
32318
32319
32320
32321 Implements the SOL\_SOCKET/SO\_DONTROUTE socket option.
32322
32323
32324 [heading Examples]
32325   
32326 Setting the option: 
32327
32328    boost::asio::ip::udp::socket socket(my_context);
32329    ...
32330    boost::asio::socket_base::do_not_route option(true);
32331    socket.set_option(option);
32332
32333
32334
32335
32336
32337 Getting the current option value: 
32338
32339    boost::asio::ip::udp::socket socket(my_context);
32340    ...
32341    boost::asio::socket_base::do_not_route option;
32342    socket.get_option(option);
32343    bool is_set = option.value();
32344
32345
32346
32347
32348
32349
32350
32351 [heading Requirements]
32352
32353 ['Header: ][^boost/asio/basic_socket.hpp]
32354
32355 ['Convenience header: ][^boost/asio.hpp]
32356
32357
32358 [endsect]
32359
32360
32361
32362 [section:enable_connection_aborted basic_socket::enable_connection_aborted]
32363
32364
32365 ['Inherited from socket_base.]
32366
32367 [indexterm2 boost_asio.indexterm.basic_socket.enable_connection_aborted..enable_connection_aborted..basic_socket] 
32368 Socket option to report aborted connections on accept. 
32369
32370
32371   typedef implementation_defined enable_connection_aborted;
32372
32373
32374
32375 Implements a custom socket option that determines whether or not an accept operation is permitted to fail with `boost::asio::error::connection_aborted`. By default the option is false.
32376
32377
32378 [heading Examples]
32379   
32380 Setting the option: 
32381
32382    boost::asio::ip::tcp::acceptor acceptor(my_context);
32383    ...
32384    boost::asio::socket_base::enable_connection_aborted option(true);
32385    acceptor.set_option(option);
32386
32387
32388
32389
32390
32391 Getting the current option value: 
32392
32393    boost::asio::ip::tcp::acceptor acceptor(my_context);
32394    ...
32395    boost::asio::socket_base::enable_connection_aborted option;
32396    acceptor.get_option(option);
32397    bool is_set = option.value();
32398
32399
32400
32401
32402
32403
32404
32405 [heading Requirements]
32406
32407 ['Header: ][^boost/asio/basic_socket.hpp]
32408
32409 ['Convenience header: ][^boost/asio.hpp]
32410
32411
32412 [endsect]
32413
32414
32415
32416 [section:endpoint_type basic_socket::endpoint_type]
32417
32418 [indexterm2 boost_asio.indexterm.basic_socket.endpoint_type..endpoint_type..basic_socket] 
32419 The endpoint type. 
32420
32421
32422   typedef Protocol::endpoint endpoint_type;
32423
32424
32425
32426 [heading Requirements]
32427
32428 ['Header: ][^boost/asio/basic_socket.hpp]
32429
32430 ['Convenience header: ][^boost/asio.hpp]
32431
32432
32433 [endsect]
32434
32435
32436
32437 [section:executor_type basic_socket::executor_type]
32438
32439 [indexterm2 boost_asio.indexterm.basic_socket.executor_type..executor_type..basic_socket] 
32440 The type of the executor associated with the object. 
32441
32442
32443   typedef Executor executor_type;
32444
32445
32446
32447 [heading Requirements]
32448
32449 ['Header: ][^boost/asio/basic_socket.hpp]
32450
32451 ['Convenience header: ][^boost/asio.hpp]
32452
32453
32454 [endsect]
32455
32456
32457
32458 [section:get_executor basic_socket::get_executor]
32459
32460 [indexterm2 boost_asio.indexterm.basic_socket.get_executor..get_executor..basic_socket] 
32461 Get the executor associated with the object. 
32462
32463
32464   executor_type get_executor();
32465
32466
32467
32468 [endsect]
32469
32470
32471 [section:get_option basic_socket::get_option]
32472
32473 [indexterm2 boost_asio.indexterm.basic_socket.get_option..get_option..basic_socket] 
32474 Get an option from the socket. 
32475
32476
32477   template<
32478       typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
32479   void ``[link boost_asio.reference.basic_socket.get_option.overload1 get_option]``(
32480       GettableSocketOption & option) const;
32481   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.get_option.overload1 more...]]``
32482
32483   template<
32484       typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
32485   void ``[link boost_asio.reference.basic_socket.get_option.overload2 get_option]``(
32486       GettableSocketOption & option,
32487       boost::system::error_code & ec) const;
32488   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.get_option.overload2 more...]]``
32489
32490
32491 [section:overload1 basic_socket::get_option (1 of 2 overloads)]
32492
32493
32494 Get an option from the socket. 
32495
32496
32497   template<
32498       typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
32499   void get_option(
32500       GettableSocketOption & option) const;
32501
32502
32503 This function is used to get the current value of an option on the socket.
32504
32505
32506 [heading Parameters]
32507     
32508
32509 [variablelist
32510   
32511 [[option][The option value to be obtained from the socket.]]
32512
32513 ]
32514
32515
32516 [heading Exceptions]
32517     
32518
32519 [variablelist
32520   
32521 [[boost::system::system_error][Thrown on failure.]]
32522
32523 ]
32524
32525
32526
32527 [heading Example]
32528   
32529 Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option: 
32530
32531    boost::asio::ip::tcp::socket socket(my_context);
32532    ...
32533    boost::asio::ip::tcp::socket::keep_alive option;
32534    socket.get_option(option);
32535    bool is_set = option.value();
32536
32537
32538
32539
32540
32541
32542
32543 [endsect]
32544
32545
32546
32547 [section:overload2 basic_socket::get_option (2 of 2 overloads)]
32548
32549
32550 Get an option from the socket. 
32551
32552
32553   template<
32554       typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
32555   void get_option(
32556       GettableSocketOption & option,
32557       boost::system::error_code & ec) const;
32558
32559
32560 This function is used to get the current value of an option on the socket.
32561
32562
32563 [heading Parameters]
32564     
32565
32566 [variablelist
32567   
32568 [[option][The option value to be obtained from the socket.]]
32569
32570 [[ec][Set to indicate what error occurred, if any.]]
32571
32572 ]
32573
32574
32575
32576 [heading Example]
32577   
32578 Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option: 
32579
32580    boost::asio::ip::tcp::socket socket(my_context);
32581    ...
32582    boost::asio::ip::tcp::socket::keep_alive option;
32583    boost::system::error_code ec;
32584    socket.get_option(option, ec);
32585    if (ec)
32586    {
32587      // An error occurred.
32588    }
32589    bool is_set = option.value();
32590
32591
32592
32593
32594
32595
32596
32597 [endsect]
32598
32599
32600 [endsect]
32601
32602
32603 [section:impl_ basic_socket::impl_]
32604
32605 [indexterm2 boost_asio.indexterm.basic_socket.impl_..impl_..basic_socket] 
32606
32607   detail::io_object_impl< detail::reactive_socket_service< Protocol >, Executor > impl_;
32608
32609
32610
32611 [endsect]
32612
32613
32614 [section:io_control basic_socket::io_control]
32615
32616 [indexterm2 boost_asio.indexterm.basic_socket.io_control..io_control..basic_socket] 
32617 Perform an IO control command on the socket. 
32618
32619
32620   template<
32621       typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
32622   void ``[link boost_asio.reference.basic_socket.io_control.overload1 io_control]``(
32623       IoControlCommand & command);
32624   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.io_control.overload1 more...]]``
32625
32626   template<
32627       typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
32628   void ``[link boost_asio.reference.basic_socket.io_control.overload2 io_control]``(
32629       IoControlCommand & command,
32630       boost::system::error_code & ec);
32631   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.io_control.overload2 more...]]``
32632
32633
32634 [section:overload1 basic_socket::io_control (1 of 2 overloads)]
32635
32636
32637 Perform an IO control command on the socket. 
32638
32639
32640   template<
32641       typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
32642   void io_control(
32643       IoControlCommand & command);
32644
32645
32646 This function is used to execute an IO control command on the socket.
32647
32648
32649 [heading Parameters]
32650     
32651
32652 [variablelist
32653   
32654 [[command][The IO control command to be performed on the socket.]]
32655
32656 ]
32657
32658
32659 [heading Exceptions]
32660     
32661
32662 [variablelist
32663   
32664 [[boost::system::system_error][Thrown on failure.]]
32665
32666 ]
32667
32668
32669
32670 [heading Example]
32671   
32672 Getting the number of bytes ready to read: 
32673
32674    boost::asio::ip::tcp::socket socket(my_context);
32675    ...
32676    boost::asio::ip::tcp::socket::bytes_readable command;
32677    socket.io_control(command);
32678    std::size_t bytes_readable = command.get();
32679
32680
32681
32682
32683
32684
32685
32686 [endsect]
32687
32688
32689
32690 [section:overload2 basic_socket::io_control (2 of 2 overloads)]
32691
32692
32693 Perform an IO control command on the socket. 
32694
32695
32696   template<
32697       typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
32698   void io_control(
32699       IoControlCommand & command,
32700       boost::system::error_code & ec);
32701
32702
32703 This function is used to execute an IO control command on the socket.
32704
32705
32706 [heading Parameters]
32707     
32708
32709 [variablelist
32710   
32711 [[command][The IO control command to be performed on the socket.]]
32712
32713 [[ec][Set to indicate what error occurred, if any.]]
32714
32715 ]
32716
32717
32718
32719 [heading Example]
32720   
32721 Getting the number of bytes ready to read: 
32722
32723    boost::asio::ip::tcp::socket socket(my_context);
32724    ...
32725    boost::asio::ip::tcp::socket::bytes_readable command;
32726    boost::system::error_code ec;
32727    socket.io_control(command, ec);
32728    if (ec)
32729    {
32730      // An error occurred.
32731    }
32732    std::size_t bytes_readable = command.get();
32733
32734
32735
32736
32737
32738
32739
32740 [endsect]
32741
32742
32743 [endsect]
32744
32745
32746 [section:is_open basic_socket::is_open]
32747
32748 [indexterm2 boost_asio.indexterm.basic_socket.is_open..is_open..basic_socket] 
32749 Determine whether the socket is open. 
32750
32751
32752   bool is_open() const;
32753
32754
32755
32756 [endsect]
32757
32758
32759
32760 [section:keep_alive basic_socket::keep_alive]
32761
32762
32763 ['Inherited from socket_base.]
32764
32765 [indexterm2 boost_asio.indexterm.basic_socket.keep_alive..keep_alive..basic_socket] 
32766 Socket option to send keep-alives. 
32767
32768
32769   typedef implementation_defined keep_alive;
32770
32771
32772
32773 Implements the SOL\_SOCKET/SO\_KEEPALIVE socket option.
32774
32775
32776 [heading Examples]
32777   
32778 Setting the option: 
32779
32780    boost::asio::ip::tcp::socket socket(my_context);
32781    ...
32782    boost::asio::socket_base::keep_alive option(true);
32783    socket.set_option(option);
32784
32785
32786
32787
32788
32789 Getting the current option value: 
32790
32791    boost::asio::ip::tcp::socket socket(my_context);
32792    ...
32793    boost::asio::socket_base::keep_alive option;
32794    socket.get_option(option);
32795    bool is_set = option.value();
32796
32797
32798
32799
32800
32801
32802
32803 [heading Requirements]
32804
32805 ['Header: ][^boost/asio/basic_socket.hpp]
32806
32807 ['Convenience header: ][^boost/asio.hpp]
32808
32809
32810 [endsect]
32811
32812
32813
32814 [section:linger basic_socket::linger]
32815
32816
32817 ['Inherited from socket_base.]
32818
32819 [indexterm2 boost_asio.indexterm.basic_socket.linger..linger..basic_socket] 
32820 Socket option to specify whether the socket lingers on close if unsent data is present. 
32821
32822
32823   typedef implementation_defined linger;
32824
32825
32826
32827 Implements the SOL\_SOCKET/SO\_LINGER socket option.
32828
32829
32830 [heading Examples]
32831   
32832 Setting the option: 
32833
32834    boost::asio::ip::tcp::socket socket(my_context);
32835    ...
32836    boost::asio::socket_base::linger option(true, 30);
32837    socket.set_option(option);
32838
32839
32840
32841
32842
32843 Getting the current option value: 
32844
32845    boost::asio::ip::tcp::socket socket(my_context);
32846    ...
32847    boost::asio::socket_base::linger option;
32848    socket.get_option(option);
32849    bool is_set = option.enabled();
32850    unsigned short timeout = option.timeout();
32851
32852
32853
32854
32855
32856
32857
32858 [heading Requirements]
32859
32860 ['Header: ][^boost/asio/basic_socket.hpp]
32861
32862 ['Convenience header: ][^boost/asio.hpp]
32863
32864
32865 [endsect]
32866
32867
32868 [section:local_endpoint basic_socket::local_endpoint]
32869
32870 [indexterm2 boost_asio.indexterm.basic_socket.local_endpoint..local_endpoint..basic_socket] 
32871 Get the local endpoint of the socket. 
32872
32873
32874   endpoint_type ``[link boost_asio.reference.basic_socket.local_endpoint.overload1 local_endpoint]``() const;
32875   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.local_endpoint.overload1 more...]]``
32876
32877   endpoint_type ``[link boost_asio.reference.basic_socket.local_endpoint.overload2 local_endpoint]``(
32878       boost::system::error_code & ec) const;
32879   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.local_endpoint.overload2 more...]]``
32880
32881
32882 [section:overload1 basic_socket::local_endpoint (1 of 2 overloads)]
32883
32884
32885 Get the local endpoint of the socket. 
32886
32887
32888   endpoint_type local_endpoint() const;
32889
32890
32891 This function is used to obtain the locally bound endpoint of the socket.
32892
32893
32894 [heading Return Value]
32895       
32896 An object that represents the local endpoint of the socket.
32897
32898
32899 [heading Exceptions]
32900     
32901
32902 [variablelist
32903   
32904 [[boost::system::system_error][Thrown on failure.]]
32905
32906 ]
32907
32908
32909 [heading Example]
32910   
32911
32912
32913    boost::asio::ip::tcp::socket socket(my_context);
32914    ...
32915    boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint();
32916
32917
32918
32919
32920
32921
32922
32923 [endsect]
32924
32925
32926
32927 [section:overload2 basic_socket::local_endpoint (2 of 2 overloads)]
32928
32929
32930 Get the local endpoint of the socket. 
32931
32932
32933   endpoint_type local_endpoint(
32934       boost::system::error_code & ec) const;
32935
32936
32937 This function is used to obtain the locally bound endpoint of the socket.
32938
32939
32940 [heading Parameters]
32941     
32942
32943 [variablelist
32944   
32945 [[ec][Set to indicate what error occurred, if any.]]
32946
32947 ]
32948
32949
32950 [heading Return Value]
32951       
32952 An object that represents the local endpoint of the socket. Returns a default-constructed endpoint object if an error occurred.
32953
32954
32955 [heading Example]
32956   
32957
32958
32959    boost::asio::ip::tcp::socket socket(my_context);
32960    ...
32961    boost::system::error_code ec;
32962    boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint(ec);
32963    if (ec)
32964    {
32965      // An error occurred.
32966    }
32967
32968
32969
32970
32971
32972
32973
32974 [endsect]
32975
32976
32977 [endsect]
32978
32979 [section:lowest_layer basic_socket::lowest_layer]
32980
32981 [indexterm2 boost_asio.indexterm.basic_socket.lowest_layer..lowest_layer..basic_socket] 
32982 Get a reference to the lowest layer. 
32983
32984
32985   lowest_layer_type & ``[link boost_asio.reference.basic_socket.lowest_layer.overload1 lowest_layer]``();
32986   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.lowest_layer.overload1 more...]]``
32987
32988
32989 Get a const reference to the lowest layer. 
32990
32991
32992   const lowest_layer_type & ``[link boost_asio.reference.basic_socket.lowest_layer.overload2 lowest_layer]``() const;
32993   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.lowest_layer.overload2 more...]]``
32994
32995
32996 [section:overload1 basic_socket::lowest_layer (1 of 2 overloads)]
32997
32998
32999 Get a reference to the lowest layer. 
33000
33001
33002   lowest_layer_type & lowest_layer();
33003
33004
33005 This function returns a reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself.
33006
33007
33008 [heading Return Value]
33009       
33010 A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 
33011
33012
33013
33014
33015 [endsect]
33016
33017
33018
33019 [section:overload2 basic_socket::lowest_layer (2 of 2 overloads)]
33020
33021
33022 Get a const reference to the lowest layer. 
33023
33024
33025   const lowest_layer_type & lowest_layer() const;
33026
33027
33028 This function returns a const reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself.
33029
33030
33031 [heading Return Value]
33032       
33033 A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 
33034
33035
33036
33037
33038 [endsect]
33039
33040
33041 [endsect]
33042
33043
33044 [section:lowest_layer_type basic_socket::lowest_layer_type]
33045
33046 [indexterm2 boost_asio.indexterm.basic_socket.lowest_layer_type..lowest_layer_type..basic_socket] 
33047 A [link boost_asio.reference.basic_socket `basic_socket`] is always the lowest layer. 
33048
33049
33050   typedef basic_socket< Protocol, Executor > lowest_layer_type;
33051
33052
33053 [heading Types]
33054 [table
33055   [[Name][Description]]
33056
33057   [
33058
33059     [[link boost_asio.reference.basic_socket__rebind_executor [*rebind_executor]]]
33060     [Rebinds the socket type to another executor. ]
33061   
33062   ]
33063
33064   [
33065
33066     [[link boost_asio.reference.basic_socket.broadcast [*broadcast]]]
33067     [Socket option to permit sending of broadcast messages. ]
33068   
33069   ]
33070
33071   [
33072
33073     [[link boost_asio.reference.basic_socket.bytes_readable [*bytes_readable]]]
33074     [IO control command to get the amount of data that can be read without blocking. ]
33075   
33076   ]
33077
33078   [
33079
33080     [[link boost_asio.reference.basic_socket.debug [*debug]]]
33081     [Socket option to enable socket-level debugging. ]
33082   
33083   ]
33084
33085   [
33086
33087     [[link boost_asio.reference.basic_socket.do_not_route [*do_not_route]]]
33088     [Socket option to prevent routing, use local interfaces only. ]
33089   
33090   ]
33091
33092   [
33093
33094     [[link boost_asio.reference.basic_socket.enable_connection_aborted [*enable_connection_aborted]]]
33095     [Socket option to report aborted connections on accept. ]
33096   
33097   ]
33098
33099   [
33100
33101     [[link boost_asio.reference.basic_socket.endpoint_type [*endpoint_type]]]
33102     [The endpoint type. ]
33103   
33104   ]
33105
33106   [
33107
33108     [[link boost_asio.reference.basic_socket.executor_type [*executor_type]]]
33109     [The type of the executor associated with the object. ]
33110   
33111   ]
33112
33113   [
33114
33115     [[link boost_asio.reference.basic_socket.keep_alive [*keep_alive]]]
33116     [Socket option to send keep-alives. ]
33117   
33118   ]
33119
33120   [
33121
33122     [[link boost_asio.reference.basic_socket.linger [*linger]]]
33123     [Socket option to specify whether the socket lingers on close if unsent data is present. ]
33124   
33125   ]
33126
33127   [
33128
33129     [[link boost_asio.reference.basic_socket.lowest_layer_type [*lowest_layer_type]]]
33130     [A basic_socket is always the lowest layer. ]
33131   
33132   ]
33133
33134   [
33135
33136     [[link boost_asio.reference.basic_socket.message_flags [*message_flags]]]
33137     [Bitmask type for flags that can be passed to send and receive operations. ]
33138   
33139   ]
33140
33141   [
33142
33143     [[link boost_asio.reference.basic_socket.native_handle_type [*native_handle_type]]]
33144     [The native representation of a socket. ]
33145   
33146   ]
33147
33148   [
33149
33150     [[link boost_asio.reference.basic_socket.out_of_band_inline [*out_of_band_inline]]]
33151     [Socket option for putting received out-of-band data inline. ]
33152   
33153   ]
33154
33155   [
33156
33157     [[link boost_asio.reference.basic_socket.protocol_type [*protocol_type]]]
33158     [The protocol type. ]
33159   
33160   ]
33161
33162   [
33163
33164     [[link boost_asio.reference.basic_socket.receive_buffer_size [*receive_buffer_size]]]
33165     [Socket option for the receive buffer size of a socket. ]
33166   
33167   ]
33168
33169   [
33170
33171     [[link boost_asio.reference.basic_socket.receive_low_watermark [*receive_low_watermark]]]
33172     [Socket option for the receive low watermark. ]
33173   
33174   ]
33175
33176   [
33177
33178     [[link boost_asio.reference.basic_socket.reuse_address [*reuse_address]]]
33179     [Socket option to allow the socket to be bound to an address that is already in use. ]
33180   
33181   ]
33182
33183   [
33184
33185     [[link boost_asio.reference.basic_socket.send_buffer_size [*send_buffer_size]]]
33186     [Socket option for the send buffer size of a socket. ]
33187   
33188   ]
33189
33190   [
33191
33192     [[link boost_asio.reference.basic_socket.send_low_watermark [*send_low_watermark]]]
33193     [Socket option for the send low watermark. ]
33194   
33195   ]
33196
33197   [
33198
33199     [[link boost_asio.reference.basic_socket.shutdown_type [*shutdown_type]]]
33200     [Different ways a socket may be shutdown. ]
33201   
33202   ]
33203
33204   [
33205
33206     [[link boost_asio.reference.basic_socket.wait_type [*wait_type]]]
33207     [Wait types. ]
33208   
33209   ]
33210
33211 ]
33212
33213 [heading Member Functions]
33214 [table
33215   [[Name][Description]]
33216
33217   [
33218     [[link boost_asio.reference.basic_socket.assign [*assign]]]
33219     [Assign an existing native socket to the socket. ]
33220   ]
33221   
33222   [
33223     [[link boost_asio.reference.basic_socket.async_connect [*async_connect]]]
33224     [Start an asynchronous connect. ]
33225   ]
33226   
33227   [
33228     [[link boost_asio.reference.basic_socket.async_wait [*async_wait]]]
33229     [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
33230   ]
33231   
33232   [
33233     [[link boost_asio.reference.basic_socket.at_mark [*at_mark]]]
33234     [Determine whether the socket is at the out-of-band data mark. ]
33235   ]
33236   
33237   [
33238     [[link boost_asio.reference.basic_socket.available [*available]]]
33239     [Determine the number of bytes available for reading. ]
33240   ]
33241   
33242   [
33243     [[link boost_asio.reference.basic_socket.basic_socket [*basic_socket]]]
33244     [Construct a basic_socket without opening it. 
33245      [hr]
33246      Construct and open a basic_socket. 
33247      [hr]
33248      Construct a basic_socket, opening it and binding it to the given local endpoint. 
33249      [hr]
33250      Construct a basic_socket on an existing native socket. 
33251      [hr]
33252      Move-construct a basic_socket from another. 
33253      [hr]
33254      Move-construct a basic_socket from a socket of another protocol type. ]
33255   ]
33256   
33257   [
33258     [[link boost_asio.reference.basic_socket.bind [*bind]]]
33259     [Bind the socket to the given local endpoint. ]
33260   ]
33261   
33262   [
33263     [[link boost_asio.reference.basic_socket.cancel [*cancel]]]
33264     [Cancel all asynchronous operations associated with the socket. ]
33265   ]
33266   
33267   [
33268     [[link boost_asio.reference.basic_socket.close [*close]]]
33269     [Close the socket. ]
33270   ]
33271   
33272   [
33273     [[link boost_asio.reference.basic_socket.connect [*connect]]]
33274     [Connect the socket to the specified endpoint. ]
33275   ]
33276   
33277   [
33278     [[link boost_asio.reference.basic_socket.get_executor [*get_executor]]]
33279     [Get the executor associated with the object. ]
33280   ]
33281   
33282   [
33283     [[link boost_asio.reference.basic_socket.get_option [*get_option]]]
33284     [Get an option from the socket. ]
33285   ]
33286   
33287   [
33288     [[link boost_asio.reference.basic_socket.io_control [*io_control]]]
33289     [Perform an IO control command on the socket. ]
33290   ]
33291   
33292   [
33293     [[link boost_asio.reference.basic_socket.is_open [*is_open]]]
33294     [Determine whether the socket is open. ]
33295   ]
33296   
33297   [
33298     [[link boost_asio.reference.basic_socket.local_endpoint [*local_endpoint]]]
33299     [Get the local endpoint of the socket. ]
33300   ]
33301   
33302   [
33303     [[link boost_asio.reference.basic_socket.lowest_layer [*lowest_layer]]]
33304     [Get a reference to the lowest layer. 
33305      [hr]
33306      Get a const reference to the lowest layer. ]
33307   ]
33308   
33309   [
33310     [[link boost_asio.reference.basic_socket.native_handle [*native_handle]]]
33311     [Get the native socket representation. ]
33312   ]
33313   
33314   [
33315     [[link boost_asio.reference.basic_socket.native_non_blocking [*native_non_blocking]]]
33316     [Gets the non-blocking mode of the native socket implementation. 
33317      [hr]
33318      Sets the non-blocking mode of the native socket implementation. ]
33319   ]
33320   
33321   [
33322     [[link boost_asio.reference.basic_socket.non_blocking [*non_blocking]]]
33323     [Gets the non-blocking mode of the socket. 
33324      [hr]
33325      Sets the non-blocking mode of the socket. ]
33326   ]
33327   
33328   [
33329     [[link boost_asio.reference.basic_socket.open [*open]]]
33330     [Open the socket using the specified protocol. ]
33331   ]
33332   
33333   [
33334     [[link boost_asio.reference.basic_socket.operator_eq_ [*operator=]]]
33335     [Move-assign a basic_socket from another. 
33336      [hr]
33337      Move-assign a basic_socket from a socket of another protocol type. ]
33338   ]
33339   
33340   [
33341     [[link boost_asio.reference.basic_socket.release [*release]]]
33342     [Release ownership of the underlying native socket. ]
33343   ]
33344   
33345   [
33346     [[link boost_asio.reference.basic_socket.remote_endpoint [*remote_endpoint]]]
33347     [Get the remote endpoint of the socket. ]
33348   ]
33349   
33350   [
33351     [[link boost_asio.reference.basic_socket.set_option [*set_option]]]
33352     [Set an option on the socket. ]
33353   ]
33354   
33355   [
33356     [[link boost_asio.reference.basic_socket.shutdown [*shutdown]]]
33357     [Disable sends or receives on the socket. ]
33358   ]
33359   
33360   [
33361     [[link boost_asio.reference.basic_socket.wait [*wait]]]
33362     [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
33363   ]
33364   
33365 ]
33366
33367 [heading Protected Member Functions]
33368 [table
33369   [[Name][Description]]
33370
33371   [
33372     [[link boost_asio.reference.basic_socket._basic_socket [*~basic_socket]]]
33373     [Protected destructor to prevent deletion through this type. ]
33374   ]
33375   
33376 ]
33377
33378 [heading Data Members]
33379 [table
33380   [[Name][Description]]
33381
33382   [
33383     [[link boost_asio.reference.basic_socket.max_connections [*max_connections]]]
33384     [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
33385   ]
33386
33387   [
33388     [[link boost_asio.reference.basic_socket.max_listen_connections [*max_listen_connections]]]
33389     [The maximum length of the queue of pending incoming connections. ]
33390   ]
33391
33392   [
33393     [[link boost_asio.reference.basic_socket.message_do_not_route [*message_do_not_route]]]
33394     [Specify that the data should not be subject to routing. ]
33395   ]
33396
33397   [
33398     [[link boost_asio.reference.basic_socket.message_end_of_record [*message_end_of_record]]]
33399     [Specifies that the data marks the end of a record. ]
33400   ]
33401
33402   [
33403     [[link boost_asio.reference.basic_socket.message_out_of_band [*message_out_of_band]]]
33404     [Process out-of-band data. ]
33405   ]
33406
33407   [
33408     [[link boost_asio.reference.basic_socket.message_peek [*message_peek]]]
33409     [Peek at incoming data without removing it from the input queue. ]
33410   ]
33411
33412 ]
33413
33414 [heading Protected Data Members]
33415 [table
33416   [[Name][Description]]
33417
33418   [
33419     [[link boost_asio.reference.basic_socket.impl_ [*impl_]]]
33420     []
33421   ]
33422
33423 ]
33424
33425 The [link boost_asio.reference.basic_socket `basic_socket`] class template provides functionality that is common to both stream-oriented and datagram-oriented sockets.
33426
33427
33428 [heading Thread Safety]
33429   
33430 ['Distinct] ['objects:] Safe.
33431
33432 ['Shared] ['objects:] Unsafe. 
33433
33434
33435
33436
33437 [heading Requirements]
33438
33439 ['Header: ][^boost/asio/basic_socket.hpp]
33440
33441 ['Convenience header: ][^boost/asio.hpp]
33442
33443
33444 [endsect]
33445
33446
33447
33448 [section:max_connections basic_socket::max_connections]
33449
33450
33451 ['Inherited from socket_base.]
33452
33453 [indexterm2 boost_asio.indexterm.basic_socket.max_connections..max_connections..basic_socket] 
33454 (Deprecated: Use max\_listen\_connections.) The maximum length of the queue of pending incoming connections. 
33455
33456
33457   static const int max_connections = implementation_defined;
33458
33459
33460
33461 [endsect]
33462
33463
33464
33465 [section:max_listen_connections basic_socket::max_listen_connections]
33466
33467
33468 ['Inherited from socket_base.]
33469
33470 [indexterm2 boost_asio.indexterm.basic_socket.max_listen_connections..max_listen_connections..basic_socket] 
33471 The maximum length of the queue of pending incoming connections. 
33472
33473
33474   static const int max_listen_connections = implementation_defined;
33475
33476
33477
33478 [endsect]
33479
33480
33481
33482 [section:message_do_not_route basic_socket::message_do_not_route]
33483
33484
33485 ['Inherited from socket_base.]
33486
33487 [indexterm2 boost_asio.indexterm.basic_socket.message_do_not_route..message_do_not_route..basic_socket] 
33488 Specify that the data should not be subject to routing. 
33489
33490
33491   static const int message_do_not_route = implementation_defined;
33492
33493
33494
33495 [endsect]
33496
33497
33498
33499 [section:message_end_of_record basic_socket::message_end_of_record]
33500
33501
33502 ['Inherited from socket_base.]
33503
33504 [indexterm2 boost_asio.indexterm.basic_socket.message_end_of_record..message_end_of_record..basic_socket] 
33505 Specifies that the data marks the end of a record. 
33506
33507
33508   static const int message_end_of_record = implementation_defined;
33509
33510
33511
33512 [endsect]
33513
33514
33515
33516 [section:message_flags basic_socket::message_flags]
33517
33518
33519 ['Inherited from socket_base.]
33520
33521 [indexterm2 boost_asio.indexterm.basic_socket.message_flags..message_flags..basic_socket] 
33522 Bitmask type for flags that can be passed to send and receive operations. 
33523
33524
33525   typedef int message_flags;
33526
33527
33528
33529 [heading Requirements]
33530
33531 ['Header: ][^boost/asio/basic_socket.hpp]
33532
33533 ['Convenience header: ][^boost/asio.hpp]
33534
33535
33536 [endsect]
33537
33538
33539
33540 [section:message_out_of_band basic_socket::message_out_of_band]
33541
33542
33543 ['Inherited from socket_base.]
33544
33545 [indexterm2 boost_asio.indexterm.basic_socket.message_out_of_band..message_out_of_band..basic_socket] 
33546 Process out-of-band data. 
33547
33548
33549   static const int message_out_of_band = implementation_defined;
33550
33551
33552
33553 [endsect]
33554
33555
33556
33557 [section:message_peek basic_socket::message_peek]
33558
33559
33560 ['Inherited from socket_base.]
33561
33562 [indexterm2 boost_asio.indexterm.basic_socket.message_peek..message_peek..basic_socket] 
33563 Peek at incoming data without removing it from the input queue. 
33564
33565
33566   static const int message_peek = implementation_defined;
33567
33568
33569
33570 [endsect]
33571
33572
33573
33574 [section:native_handle basic_socket::native_handle]
33575
33576 [indexterm2 boost_asio.indexterm.basic_socket.native_handle..native_handle..basic_socket] 
33577 Get the native socket representation. 
33578
33579
33580   native_handle_type native_handle();
33581
33582
33583 This function may be used to obtain the underlying representation of the socket. This is intended to allow access to native socket functionality that is not otherwise provided. 
33584
33585
33586 [endsect]
33587
33588
33589
33590 [section:native_handle_type basic_socket::native_handle_type]
33591
33592 [indexterm2 boost_asio.indexterm.basic_socket.native_handle_type..native_handle_type..basic_socket] 
33593 The native representation of a socket. 
33594
33595
33596   typedef implementation_defined native_handle_type;
33597
33598
33599
33600 [heading Requirements]
33601
33602 ['Header: ][^boost/asio/basic_socket.hpp]
33603
33604 ['Convenience header: ][^boost/asio.hpp]
33605
33606
33607 [endsect]
33608
33609
33610 [section:native_non_blocking basic_socket::native_non_blocking]
33611
33612 [indexterm2 boost_asio.indexterm.basic_socket.native_non_blocking..native_non_blocking..basic_socket] 
33613 Gets the non-blocking mode of the native socket implementation. 
33614
33615
33616   bool ``[link boost_asio.reference.basic_socket.native_non_blocking.overload1 native_non_blocking]``() const;
33617   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.native_non_blocking.overload1 more...]]``
33618
33619
33620 Sets the non-blocking mode of the native socket implementation. 
33621
33622
33623   void ``[link boost_asio.reference.basic_socket.native_non_blocking.overload2 native_non_blocking]``(
33624       bool mode);
33625   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.native_non_blocking.overload2 more...]]``
33626
33627   void ``[link boost_asio.reference.basic_socket.native_non_blocking.overload3 native_non_blocking]``(
33628       bool mode,
33629       boost::system::error_code & ec);
33630   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.native_non_blocking.overload3 more...]]``
33631
33632
33633 [section:overload1 basic_socket::native_non_blocking (1 of 3 overloads)]
33634
33635
33636 Gets the non-blocking mode of the native socket implementation. 
33637
33638
33639   bool native_non_blocking() const;
33640
33641
33642 This function is used to retrieve the non-blocking mode of the underlying native socket. This mode has no effect on the behaviour of the socket object's synchronous operations.
33643
33644
33645 [heading Return Value]
33646       
33647 `true` if the underlying socket is in non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).
33648
33649
33650 [heading Remarks]
33651       
33652 The current non-blocking mode is cached by the socket object. Consequently, the return value may be incorrect if the non-blocking mode was set directly on the native socket.
33653
33654
33655 [heading Example]
33656   
33657 This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated: 
33658
33659    template <typename Handler>
33660    struct sendfile_op
33661    {
33662      tcp::socket& sock_;
33663      int fd_;
33664      Handler handler_;
33665      off_t offset_;
33666      std::size_t total_bytes_transferred_;
33667
33668      // Function call operator meeting WriteHandler requirements.
33669      // Used as the handler for the async_write_some operation.
33670      void operator()(boost::system::error_code ec, std::size_t)
33671      {
33672        // Put the underlying socket into non-blocking mode.
33673        if (!ec)
33674          if (!sock_.native_non_blocking())
33675            sock_.native_non_blocking(true, ec);
33676
33677        if (!ec)
33678        {
33679          for (;;)
33680          {
33681            // Try the system call.
33682            errno = 0;
33683            int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
33684            ec = boost::system::error_code(n < 0 ? errno : 0,
33685                boost::asio::error::get_system_category());
33686            total_bytes_transferred_ += ec ? 0 : n;
33687
33688            // Retry operation immediately if interrupted by signal.
33689            if (ec == boost::asio::error::interrupted)
33690              continue;
33691
33692            // Check if we need to run the operation again.
33693            if (ec == boost::asio::error::would_block
33694                || ec == boost::asio::error::try_again)
33695            {
33696              // We have to wait for the socket to become ready again.
33697              sock_.async_wait(tcp::socket::wait_write, *this);
33698              return;
33699            }
33700
33701            if (ec || n == 0)
33702            {
33703              // An error occurred, or we have reached the end of the file.
33704              // Either way we must exit the loop so we can call the handler.
33705              break;
33706            }
33707
33708            // Loop around to try calling sendfile again.
33709          }
33710        }
33711
33712        // Pass result back to user's handler.
33713        handler_(ec, total_bytes_transferred_);
33714      }
33715    };
33716
33717    template <typename Handler>
33718    void async_sendfile(tcp::socket& sock, int fd, Handler h)
33719    {
33720      sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
33721      sock.async_wait(tcp::socket::wait_write, op);
33722    } 
33723
33724
33725
33726
33727
33728
33729
33730 [endsect]
33731
33732
33733
33734 [section:overload2 basic_socket::native_non_blocking (2 of 3 overloads)]
33735
33736
33737 Sets the non-blocking mode of the native socket implementation. 
33738
33739
33740   void native_non_blocking(
33741       bool mode);
33742
33743
33744 This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations.
33745
33746
33747 [heading Parameters]
33748     
33749
33750 [variablelist
33751   
33752 [[mode][If `true`, the underlying socket is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]]
33753
33754 ]
33755
33756
33757 [heading Exceptions]
33758     
33759
33760 [variablelist
33761   
33762 [[boost::system::system_error][Thrown on failure. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense.]]
33763
33764 ]
33765
33766
33767 [heading Example]
33768   
33769 This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated: 
33770
33771    template <typename Handler>
33772    struct sendfile_op
33773    {
33774      tcp::socket& sock_;
33775      int fd_;
33776      Handler handler_;
33777      off_t offset_;
33778      std::size_t total_bytes_transferred_;
33779
33780      // Function call operator meeting WriteHandler requirements.
33781      // Used as the handler for the async_write_some operation.
33782      void operator()(boost::system::error_code ec, std::size_t)
33783      {
33784        // Put the underlying socket into non-blocking mode.
33785        if (!ec)
33786          if (!sock_.native_non_blocking())
33787            sock_.native_non_blocking(true, ec);
33788
33789        if (!ec)
33790        {
33791          for (;;)
33792          {
33793            // Try the system call.
33794            errno = 0;
33795            int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
33796            ec = boost::system::error_code(n < 0 ? errno : 0,
33797                boost::asio::error::get_system_category());
33798            total_bytes_transferred_ += ec ? 0 : n;
33799
33800            // Retry operation immediately if interrupted by signal.
33801            if (ec == boost::asio::error::interrupted)
33802              continue;
33803
33804            // Check if we need to run the operation again.
33805            if (ec == boost::asio::error::would_block
33806                || ec == boost::asio::error::try_again)
33807            {
33808              // We have to wait for the socket to become ready again.
33809              sock_.async_wait(tcp::socket::wait_write, *this);
33810              return;
33811            }
33812
33813            if (ec || n == 0)
33814            {
33815              // An error occurred, or we have reached the end of the file.
33816              // Either way we must exit the loop so we can call the handler.
33817              break;
33818            }
33819
33820            // Loop around to try calling sendfile again.
33821          }
33822        }
33823
33824        // Pass result back to user's handler.
33825        handler_(ec, total_bytes_transferred_);
33826      }
33827    };
33828
33829    template <typename Handler>
33830    void async_sendfile(tcp::socket& sock, int fd, Handler h)
33831    {
33832      sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
33833      sock.async_wait(tcp::socket::wait_write, op);
33834    } 
33835
33836
33837
33838
33839
33840
33841
33842 [endsect]
33843
33844
33845
33846 [section:overload3 basic_socket::native_non_blocking (3 of 3 overloads)]
33847
33848
33849 Sets the non-blocking mode of the native socket implementation. 
33850
33851
33852   void native_non_blocking(
33853       bool mode,
33854       boost::system::error_code & ec);
33855
33856
33857 This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations.
33858
33859
33860 [heading Parameters]
33861     
33862
33863 [variablelist
33864   
33865 [[mode][If `true`, the underlying socket is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]]
33866
33867 [[ec][Set to indicate what error occurred, if any. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense.]]
33868
33869 ]
33870
33871
33872 [heading Example]
33873   
33874 This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated: 
33875
33876    template <typename Handler>
33877    struct sendfile_op
33878    {
33879      tcp::socket& sock_;
33880      int fd_;
33881      Handler handler_;
33882      off_t offset_;
33883      std::size_t total_bytes_transferred_;
33884
33885      // Function call operator meeting WriteHandler requirements.
33886      // Used as the handler for the async_write_some operation.
33887      void operator()(boost::system::error_code ec, std::size_t)
33888      {
33889        // Put the underlying socket into non-blocking mode.
33890        if (!ec)
33891          if (!sock_.native_non_blocking())
33892            sock_.native_non_blocking(true, ec);
33893
33894        if (!ec)
33895        {
33896          for (;;)
33897          {
33898            // Try the system call.
33899            errno = 0;
33900            int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
33901            ec = boost::system::error_code(n < 0 ? errno : 0,
33902                boost::asio::error::get_system_category());
33903            total_bytes_transferred_ += ec ? 0 : n;
33904
33905            // Retry operation immediately if interrupted by signal.
33906            if (ec == boost::asio::error::interrupted)
33907              continue;
33908
33909            // Check if we need to run the operation again.
33910            if (ec == boost::asio::error::would_block
33911                || ec == boost::asio::error::try_again)
33912            {
33913              // We have to wait for the socket to become ready again.
33914              sock_.async_wait(tcp::socket::wait_write, *this);
33915              return;
33916            }
33917
33918            if (ec || n == 0)
33919            {
33920              // An error occurred, or we have reached the end of the file.
33921              // Either way we must exit the loop so we can call the handler.
33922              break;
33923            }
33924
33925            // Loop around to try calling sendfile again.
33926          }
33927        }
33928
33929        // Pass result back to user's handler.
33930        handler_(ec, total_bytes_transferred_);
33931      }
33932    };
33933
33934    template <typename Handler>
33935    void async_sendfile(tcp::socket& sock, int fd, Handler h)
33936    {
33937      sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
33938      sock.async_wait(tcp::socket::wait_write, op);
33939    } 
33940
33941
33942
33943
33944
33945
33946
33947 [endsect]
33948
33949
33950 [endsect]
33951
33952 [section:non_blocking basic_socket::non_blocking]
33953
33954 [indexterm2 boost_asio.indexterm.basic_socket.non_blocking..non_blocking..basic_socket] 
33955 Gets the non-blocking mode of the socket. 
33956
33957
33958   bool ``[link boost_asio.reference.basic_socket.non_blocking.overload1 non_blocking]``() const;
33959   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.non_blocking.overload1 more...]]``
33960
33961
33962 Sets the non-blocking mode of the socket. 
33963
33964
33965   void ``[link boost_asio.reference.basic_socket.non_blocking.overload2 non_blocking]``(
33966       bool mode);
33967   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.non_blocking.overload2 more...]]``
33968
33969   void ``[link boost_asio.reference.basic_socket.non_blocking.overload3 non_blocking]``(
33970       bool mode,
33971       boost::system::error_code & ec);
33972   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.non_blocking.overload3 more...]]``
33973
33974
33975 [section:overload1 basic_socket::non_blocking (1 of 3 overloads)]
33976
33977
33978 Gets the non-blocking mode of the socket. 
33979
33980
33981   bool non_blocking() const;
33982
33983
33984
33985 [heading Return Value]
33986       
33987 `true` if the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.
33988
33989
33990 [heading Remarks]
33991       
33992 The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`. 
33993
33994
33995
33996
33997 [endsect]
33998
33999
34000
34001 [section:overload2 basic_socket::non_blocking (2 of 3 overloads)]
34002
34003
34004 Sets the non-blocking mode of the socket. 
34005
34006
34007   void non_blocking(
34008       bool mode);
34009
34010
34011
34012 [heading Parameters]
34013     
34014
34015 [variablelist
34016   
34017 [[mode][If `true`, the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]]
34018
34019 ]
34020
34021
34022 [heading Exceptions]
34023     
34024
34025 [variablelist
34026   
34027 [[boost::system::system_error][Thrown on failure.]]
34028
34029 ]
34030
34031
34032 [heading Remarks]
34033       
34034 The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`. 
34035
34036
34037
34038
34039 [endsect]
34040
34041
34042
34043 [section:overload3 basic_socket::non_blocking (3 of 3 overloads)]
34044
34045
34046 Sets the non-blocking mode of the socket. 
34047
34048
34049   void non_blocking(
34050       bool mode,
34051       boost::system::error_code & ec);
34052
34053
34054
34055 [heading Parameters]
34056     
34057
34058 [variablelist
34059   
34060 [[mode][If `true`, the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]]
34061
34062 [[ec][Set to indicate what error occurred, if any.]]
34063
34064 ]
34065
34066
34067 [heading Remarks]
34068       
34069 The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`. 
34070
34071
34072
34073
34074 [endsect]
34075
34076
34077 [endsect]
34078
34079 [section:open basic_socket::open]
34080
34081 [indexterm2 boost_asio.indexterm.basic_socket.open..open..basic_socket] 
34082 Open the socket using the specified protocol. 
34083
34084
34085   void ``[link boost_asio.reference.basic_socket.open.overload1 open]``(
34086       const protocol_type & protocol = protocol_type());
34087   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.open.overload1 more...]]``
34088
34089   void ``[link boost_asio.reference.basic_socket.open.overload2 open]``(
34090       const protocol_type & protocol,
34091       boost::system::error_code & ec);
34092   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.open.overload2 more...]]``
34093
34094
34095 [section:overload1 basic_socket::open (1 of 2 overloads)]
34096
34097
34098 Open the socket using the specified protocol. 
34099
34100
34101   void open(
34102       const protocol_type & protocol = protocol_type());
34103
34104
34105 This function opens the socket so that it will use the specified protocol.
34106
34107
34108 [heading Parameters]
34109     
34110
34111 [variablelist
34112   
34113 [[protocol][An object specifying protocol parameters to be used.]]
34114
34115 ]
34116
34117
34118 [heading Exceptions]
34119     
34120
34121 [variablelist
34122   
34123 [[boost::system::system_error][Thrown on failure.]]
34124
34125 ]
34126
34127
34128 [heading Example]
34129   
34130
34131
34132    boost::asio::ip::tcp::socket socket(my_context);
34133    socket.open(boost::asio::ip::tcp::v4());
34134
34135
34136
34137
34138
34139
34140
34141 [endsect]
34142
34143
34144
34145 [section:overload2 basic_socket::open (2 of 2 overloads)]
34146
34147
34148 Open the socket using the specified protocol. 
34149
34150
34151   void open(
34152       const protocol_type & protocol,
34153       boost::system::error_code & ec);
34154
34155
34156 This function opens the socket so that it will use the specified protocol.
34157
34158
34159 [heading Parameters]
34160     
34161
34162 [variablelist
34163   
34164 [[protocol][An object specifying which protocol is to be used.]]
34165
34166 [[ec][Set to indicate what error occurred, if any.]]
34167
34168 ]
34169
34170
34171 [heading Example]
34172   
34173
34174
34175    boost::asio::ip::tcp::socket socket(my_context);
34176    boost::system::error_code ec;
34177    socket.open(boost::asio::ip::tcp::v4(), ec);
34178    if (ec)
34179    {
34180      // An error occurred.
34181    }
34182
34183
34184
34185
34186
34187
34188
34189 [endsect]
34190
34191
34192 [endsect]
34193
34194 [section:operator_eq_ basic_socket::operator=]
34195
34196 [indexterm2 boost_asio.indexterm.basic_socket.operator_eq_..operator=..basic_socket] 
34197 Move-assign a [link boost_asio.reference.basic_socket `basic_socket`] from another. 
34198
34199
34200   basic_socket & ``[link boost_asio.reference.basic_socket.operator_eq_.overload1 operator=]``(
34201       basic_socket && other);
34202   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.operator_eq_.overload1 more...]]``
34203
34204
34205 Move-assign a [link boost_asio.reference.basic_socket `basic_socket`] from a socket of another protocol type. 
34206
34207
34208   template<
34209       typename ``[link boost_asio.reference.Protocol Protocol1]``,
34210       typename ``[link boost_asio.reference.Executor1 Executor1]``>
34211   enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value, basic_socket & >::type ``[link boost_asio.reference.basic_socket.operator_eq_.overload2 operator=]``(
34212       basic_socket< Protocol1, Executor1 > && other);
34213   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.operator_eq_.overload2 more...]]``
34214
34215
34216 [section:overload1 basic_socket::operator= (1 of 2 overloads)]
34217
34218
34219 Move-assign a [link boost_asio.reference.basic_socket `basic_socket`] from another. 
34220
34221
34222   basic_socket & operator=(
34223       basic_socket && other);
34224
34225
34226 This assignment operator moves a socket from one object to another.
34227
34228
34229 [heading Parameters]
34230     
34231
34232 [variablelist
34233   
34234 [[other][The other [link boost_asio.reference.basic_socket `basic_socket`] object from which the move will occur.]]
34235
34236 ]
34237
34238
34239 [heading Remarks]
34240       
34241 Following the move, the moved-from object is in the same state as if constructed using the `basic_socket(const executor_type&) constructor`. 
34242
34243
34244
34245
34246 [endsect]
34247
34248
34249
34250 [section:overload2 basic_socket::operator= (2 of 2 overloads)]
34251
34252
34253 Move-assign a [link boost_asio.reference.basic_socket `basic_socket`] from a socket of another protocol type. 
34254
34255
34256   template<
34257       typename ``[link boost_asio.reference.Protocol Protocol1]``,
34258       typename ``[link boost_asio.reference.Executor1 Executor1]``>
34259   enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value, basic_socket & >::type operator=(
34260       basic_socket< Protocol1, Executor1 > && other);
34261
34262
34263 This assignment operator moves a socket from one object to another.
34264
34265
34266 [heading Parameters]
34267     
34268
34269 [variablelist
34270   
34271 [[other][The other [link boost_asio.reference.basic_socket `basic_socket`] object from which the move will occur.]]
34272
34273 ]
34274
34275
34276 [heading Remarks]
34277       
34278 Following the move, the moved-from object is in the same state as if constructed using the `basic_socket(const executor_type&) constructor`. 
34279
34280
34281
34282
34283 [endsect]
34284
34285
34286 [endsect]
34287
34288
34289 [section:out_of_band_inline basic_socket::out_of_band_inline]
34290
34291
34292 ['Inherited from socket_base.]
34293
34294 [indexterm2 boost_asio.indexterm.basic_socket.out_of_band_inline..out_of_band_inline..basic_socket] 
34295 Socket option for putting received out-of-band data inline. 
34296
34297
34298   typedef implementation_defined out_of_band_inline;
34299
34300
34301
34302 Implements the SOL\_SOCKET/SO\_OOBINLINE socket option.
34303
34304
34305 [heading Examples]
34306   
34307 Setting the option: 
34308
34309    boost::asio::ip::tcp::socket socket(my_context);
34310    ...
34311    boost::asio::socket_base::out_of_band_inline option(true);
34312    socket.set_option(option);
34313
34314
34315
34316
34317
34318 Getting the current option value: 
34319
34320    boost::asio::ip::tcp::socket socket(my_context);
34321    ...
34322    boost::asio::socket_base::out_of_band_inline option;
34323    socket.get_option(option);
34324    bool value = option.value();
34325
34326
34327
34328
34329
34330
34331
34332 [heading Requirements]
34333
34334 ['Header: ][^boost/asio/basic_socket.hpp]
34335
34336 ['Convenience header: ][^boost/asio.hpp]
34337
34338
34339 [endsect]
34340
34341
34342
34343 [section:protocol_type basic_socket::protocol_type]
34344
34345 [indexterm2 boost_asio.indexterm.basic_socket.protocol_type..protocol_type..basic_socket] 
34346 The protocol type. 
34347
34348
34349   typedef Protocol protocol_type;
34350
34351
34352
34353 [heading Requirements]
34354
34355 ['Header: ][^boost/asio/basic_socket.hpp]
34356
34357 ['Convenience header: ][^boost/asio.hpp]
34358
34359
34360 [endsect]
34361
34362
34363
34364 [section:receive_buffer_size basic_socket::receive_buffer_size]
34365
34366
34367 ['Inherited from socket_base.]
34368
34369 [indexterm2 boost_asio.indexterm.basic_socket.receive_buffer_size..receive_buffer_size..basic_socket] 
34370 Socket option for the receive buffer size of a socket. 
34371
34372
34373   typedef implementation_defined receive_buffer_size;
34374
34375
34376
34377 Implements the SOL\_SOCKET/SO\_RCVBUF socket option.
34378
34379
34380 [heading Examples]
34381   
34382 Setting the option: 
34383
34384    boost::asio::ip::tcp::socket socket(my_context);
34385    ...
34386    boost::asio::socket_base::receive_buffer_size option(8192);
34387    socket.set_option(option);
34388
34389
34390
34391
34392
34393 Getting the current option value: 
34394
34395    boost::asio::ip::tcp::socket socket(my_context);
34396    ...
34397    boost::asio::socket_base::receive_buffer_size option;
34398    socket.get_option(option);
34399    int size = option.value();
34400
34401
34402
34403
34404
34405
34406
34407 [heading Requirements]
34408
34409 ['Header: ][^boost/asio/basic_socket.hpp]
34410
34411 ['Convenience header: ][^boost/asio.hpp]
34412
34413
34414 [endsect]
34415
34416
34417
34418 [section:receive_low_watermark basic_socket::receive_low_watermark]
34419
34420
34421 ['Inherited from socket_base.]
34422
34423 [indexterm2 boost_asio.indexterm.basic_socket.receive_low_watermark..receive_low_watermark..basic_socket] 
34424 Socket option for the receive low watermark. 
34425
34426
34427   typedef implementation_defined receive_low_watermark;
34428
34429
34430
34431 Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option.
34432
34433
34434 [heading Examples]
34435   
34436 Setting the option: 
34437
34438    boost::asio::ip::tcp::socket socket(my_context);
34439    ...
34440    boost::asio::socket_base::receive_low_watermark option(1024);
34441    socket.set_option(option);
34442
34443
34444
34445
34446
34447 Getting the current option value: 
34448
34449    boost::asio::ip::tcp::socket socket(my_context);
34450    ...
34451    boost::asio::socket_base::receive_low_watermark option;
34452    socket.get_option(option);
34453    int size = option.value();
34454
34455
34456
34457
34458
34459
34460
34461 [heading Requirements]
34462
34463 ['Header: ][^boost/asio/basic_socket.hpp]
34464
34465 ['Convenience header: ][^boost/asio.hpp]
34466
34467
34468 [endsect]
34469
34470
34471 [section:release basic_socket::release]
34472
34473 [indexterm2 boost_asio.indexterm.basic_socket.release..release..basic_socket] 
34474 Release ownership of the underlying native socket. 
34475
34476
34477   native_handle_type ``[link boost_asio.reference.basic_socket.release.overload1 release]``();
34478   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.release.overload1 more...]]``
34479
34480   native_handle_type ``[link boost_asio.reference.basic_socket.release.overload2 release]``(
34481       boost::system::error_code & ec);
34482   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.release.overload2 more...]]``
34483
34484
34485 [section:overload1 basic_socket::release (1 of 2 overloads)]
34486
34487
34488 Release ownership of the underlying native socket. 
34489
34490
34491   native_handle_type release();
34492
34493
34494 This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error. Ownership of the native socket is then transferred to the caller.
34495
34496
34497 [heading Exceptions]
34498     
34499
34500 [variablelist
34501   
34502 [[boost::system::system_error][Thrown on failure.]]
34503
34504 ]
34505
34506
34507 [heading Remarks]
34508       
34509 This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms. 
34510
34511
34512
34513
34514 [endsect]
34515
34516
34517
34518 [section:overload2 basic_socket::release (2 of 2 overloads)]
34519
34520
34521 Release ownership of the underlying native socket. 
34522
34523
34524   native_handle_type release(
34525       boost::system::error_code & ec);
34526
34527
34528 This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error. Ownership of the native socket is then transferred to the caller.
34529
34530
34531 [heading Parameters]
34532     
34533
34534 [variablelist
34535   
34536 [[ec][Set to indicate what error occurred, if any.]]
34537
34538 ]
34539
34540
34541 [heading Remarks]
34542       
34543 This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms. 
34544
34545
34546
34547
34548 [endsect]
34549
34550
34551 [endsect]
34552
34553 [section:remote_endpoint basic_socket::remote_endpoint]
34554
34555 [indexterm2 boost_asio.indexterm.basic_socket.remote_endpoint..remote_endpoint..basic_socket] 
34556 Get the remote endpoint of the socket. 
34557
34558
34559   endpoint_type ``[link boost_asio.reference.basic_socket.remote_endpoint.overload1 remote_endpoint]``() const;
34560   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.remote_endpoint.overload1 more...]]``
34561
34562   endpoint_type ``[link boost_asio.reference.basic_socket.remote_endpoint.overload2 remote_endpoint]``(
34563       boost::system::error_code & ec) const;
34564   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.remote_endpoint.overload2 more...]]``
34565
34566
34567 [section:overload1 basic_socket::remote_endpoint (1 of 2 overloads)]
34568
34569
34570 Get the remote endpoint of the socket. 
34571
34572
34573   endpoint_type remote_endpoint() const;
34574
34575
34576 This function is used to obtain the remote endpoint of the socket.
34577
34578
34579 [heading Return Value]
34580       
34581 An object that represents the remote endpoint of the socket.
34582
34583
34584 [heading Exceptions]
34585     
34586
34587 [variablelist
34588   
34589 [[boost::system::system_error][Thrown on failure.]]
34590
34591 ]
34592
34593
34594 [heading Example]
34595   
34596
34597
34598    boost::asio::ip::tcp::socket socket(my_context);
34599    ...
34600    boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint();
34601
34602
34603
34604
34605
34606
34607
34608 [endsect]
34609
34610
34611
34612 [section:overload2 basic_socket::remote_endpoint (2 of 2 overloads)]
34613
34614
34615 Get the remote endpoint of the socket. 
34616
34617
34618   endpoint_type remote_endpoint(
34619       boost::system::error_code & ec) const;
34620
34621
34622 This function is used to obtain the remote endpoint of the socket.
34623
34624
34625 [heading Parameters]
34626     
34627
34628 [variablelist
34629   
34630 [[ec][Set to indicate what error occurred, if any.]]
34631
34632 ]
34633
34634
34635 [heading Return Value]
34636       
34637 An object that represents the remote endpoint of the socket. Returns a default-constructed endpoint object if an error occurred.
34638
34639
34640 [heading Example]
34641   
34642
34643
34644    boost::asio::ip::tcp::socket socket(my_context);
34645    ...
34646    boost::system::error_code ec;
34647    boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(ec);
34648    if (ec)
34649    {
34650      // An error occurred.
34651    }
34652
34653
34654
34655
34656
34657
34658
34659 [endsect]
34660
34661
34662 [endsect]
34663
34664
34665 [section:reuse_address basic_socket::reuse_address]
34666
34667
34668 ['Inherited from socket_base.]
34669
34670 [indexterm2 boost_asio.indexterm.basic_socket.reuse_address..reuse_address..basic_socket] 
34671 Socket option to allow the socket to be bound to an address that is already in use. 
34672
34673
34674   typedef implementation_defined reuse_address;
34675
34676
34677
34678 Implements the SOL\_SOCKET/SO\_REUSEADDR socket option.
34679
34680
34681 [heading Examples]
34682   
34683 Setting the option: 
34684
34685    boost::asio::ip::tcp::acceptor acceptor(my_context);
34686    ...
34687    boost::asio::socket_base::reuse_address option(true);
34688    acceptor.set_option(option);
34689
34690
34691
34692
34693
34694 Getting the current option value: 
34695
34696    boost::asio::ip::tcp::acceptor acceptor(my_context);
34697    ...
34698    boost::asio::socket_base::reuse_address option;
34699    acceptor.get_option(option);
34700    bool is_set = option.value();
34701
34702
34703
34704
34705
34706
34707
34708 [heading Requirements]
34709
34710 ['Header: ][^boost/asio/basic_socket.hpp]
34711
34712 ['Convenience header: ][^boost/asio.hpp]
34713
34714
34715 [endsect]
34716
34717
34718
34719 [section:send_buffer_size basic_socket::send_buffer_size]
34720
34721
34722 ['Inherited from socket_base.]
34723
34724 [indexterm2 boost_asio.indexterm.basic_socket.send_buffer_size..send_buffer_size..basic_socket] 
34725 Socket option for the send buffer size of a socket. 
34726
34727
34728   typedef implementation_defined send_buffer_size;
34729
34730
34731
34732 Implements the SOL\_SOCKET/SO\_SNDBUF socket option.
34733
34734
34735 [heading Examples]
34736   
34737 Setting the option: 
34738
34739    boost::asio::ip::tcp::socket socket(my_context);
34740    ...
34741    boost::asio::socket_base::send_buffer_size option(8192);
34742    socket.set_option(option);
34743
34744
34745
34746
34747
34748 Getting the current option value: 
34749
34750    boost::asio::ip::tcp::socket socket(my_context);
34751    ...
34752    boost::asio::socket_base::send_buffer_size option;
34753    socket.get_option(option);
34754    int size = option.value();
34755
34756
34757
34758
34759
34760
34761
34762 [heading Requirements]
34763
34764 ['Header: ][^boost/asio/basic_socket.hpp]
34765
34766 ['Convenience header: ][^boost/asio.hpp]
34767
34768
34769 [endsect]
34770
34771
34772
34773 [section:send_low_watermark basic_socket::send_low_watermark]
34774
34775
34776 ['Inherited from socket_base.]
34777
34778 [indexterm2 boost_asio.indexterm.basic_socket.send_low_watermark..send_low_watermark..basic_socket] 
34779 Socket option for the send low watermark. 
34780
34781
34782   typedef implementation_defined send_low_watermark;
34783
34784
34785
34786 Implements the SOL\_SOCKET/SO\_SNDLOWAT socket option.
34787
34788
34789 [heading Examples]
34790   
34791 Setting the option: 
34792
34793    boost::asio::ip::tcp::socket socket(my_context);
34794    ...
34795    boost::asio::socket_base::send_low_watermark option(1024);
34796    socket.set_option(option);
34797
34798
34799
34800
34801
34802 Getting the current option value: 
34803
34804    boost::asio::ip::tcp::socket socket(my_context);
34805    ...
34806    boost::asio::socket_base::send_low_watermark option;
34807    socket.get_option(option);
34808    int size = option.value();
34809
34810
34811
34812
34813
34814
34815
34816 [heading Requirements]
34817
34818 ['Header: ][^boost/asio/basic_socket.hpp]
34819
34820 ['Convenience header: ][^boost/asio.hpp]
34821
34822
34823 [endsect]
34824
34825
34826 [section:set_option basic_socket::set_option]
34827
34828 [indexterm2 boost_asio.indexterm.basic_socket.set_option..set_option..basic_socket] 
34829 Set an option on the socket. 
34830
34831
34832   template<
34833       typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
34834   void ``[link boost_asio.reference.basic_socket.set_option.overload1 set_option]``(
34835       const SettableSocketOption & option);
34836   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.set_option.overload1 more...]]``
34837
34838   template<
34839       typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
34840   void ``[link boost_asio.reference.basic_socket.set_option.overload2 set_option]``(
34841       const SettableSocketOption & option,
34842       boost::system::error_code & ec);
34843   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.set_option.overload2 more...]]``
34844
34845
34846 [section:overload1 basic_socket::set_option (1 of 2 overloads)]
34847
34848
34849 Set an option on the socket. 
34850
34851
34852   template<
34853       typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
34854   void set_option(
34855       const SettableSocketOption & option);
34856
34857
34858 This function is used to set an option on the socket.
34859
34860
34861 [heading Parameters]
34862     
34863
34864 [variablelist
34865   
34866 [[option][The new option value to be set on the socket.]]
34867
34868 ]
34869
34870
34871 [heading Exceptions]
34872     
34873
34874 [variablelist
34875   
34876 [[boost::system::system_error][Thrown on failure.]]
34877
34878 ]
34879
34880
34881
34882 [heading Example]
34883   
34884 Setting the IPPROTO\_TCP/TCP\_NODELAY option: 
34885
34886    boost::asio::ip::tcp::socket socket(my_context);
34887    ...
34888    boost::asio::ip::tcp::no_delay option(true);
34889    socket.set_option(option);
34890
34891
34892
34893
34894
34895
34896
34897 [endsect]
34898
34899
34900
34901 [section:overload2 basic_socket::set_option (2 of 2 overloads)]
34902
34903
34904 Set an option on the socket. 
34905
34906
34907   template<
34908       typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
34909   void set_option(
34910       const SettableSocketOption & option,
34911       boost::system::error_code & ec);
34912
34913
34914 This function is used to set an option on the socket.
34915
34916
34917 [heading Parameters]
34918     
34919
34920 [variablelist
34921   
34922 [[option][The new option value to be set on the socket.]]
34923
34924 [[ec][Set to indicate what error occurred, if any.]]
34925
34926 ]
34927
34928
34929
34930 [heading Example]
34931   
34932 Setting the IPPROTO\_TCP/TCP\_NODELAY option: 
34933
34934    boost::asio::ip::tcp::socket socket(my_context);
34935    ...
34936    boost::asio::ip::tcp::no_delay option(true);
34937    boost::system::error_code ec;
34938    socket.set_option(option, ec);
34939    if (ec)
34940    {
34941      // An error occurred.
34942    }
34943
34944
34945
34946
34947
34948
34949
34950 [endsect]
34951
34952
34953 [endsect]
34954
34955 [section:shutdown basic_socket::shutdown]
34956
34957 [indexterm2 boost_asio.indexterm.basic_socket.shutdown..shutdown..basic_socket] 
34958 Disable sends or receives on the socket. 
34959
34960
34961   void ``[link boost_asio.reference.basic_socket.shutdown.overload1 shutdown]``(
34962       shutdown_type what);
34963   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.shutdown.overload1 more...]]``
34964
34965   void ``[link boost_asio.reference.basic_socket.shutdown.overload2 shutdown]``(
34966       shutdown_type what,
34967       boost::system::error_code & ec);
34968   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.shutdown.overload2 more...]]``
34969
34970
34971 [section:overload1 basic_socket::shutdown (1 of 2 overloads)]
34972
34973
34974 Disable sends or receives on the socket. 
34975
34976
34977   void shutdown(
34978       shutdown_type what);
34979
34980
34981 This function is used to disable send operations, receive operations, or both.
34982
34983
34984 [heading Parameters]
34985     
34986
34987 [variablelist
34988   
34989 [[what][Determines what types of operation will no longer be allowed.]]
34990
34991 ]
34992
34993
34994 [heading Exceptions]
34995     
34996
34997 [variablelist
34998   
34999 [[boost::system::system_error][Thrown on failure.]]
35000
35001 ]
35002
35003
35004 [heading Example]
35005   
35006 Shutting down the send side of the socket: 
35007
35008    boost::asio::ip::tcp::socket socket(my_context);
35009    ...
35010    socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send);
35011
35012
35013
35014
35015
35016
35017
35018 [endsect]
35019
35020
35021
35022 [section:overload2 basic_socket::shutdown (2 of 2 overloads)]
35023
35024
35025 Disable sends or receives on the socket. 
35026
35027
35028   void shutdown(
35029       shutdown_type what,
35030       boost::system::error_code & ec);
35031
35032
35033 This function is used to disable send operations, receive operations, or both.
35034
35035
35036 [heading Parameters]
35037     
35038
35039 [variablelist
35040   
35041 [[what][Determines what types of operation will no longer be allowed.]]
35042
35043 [[ec][Set to indicate what error occurred, if any.]]
35044
35045 ]
35046
35047
35048 [heading Example]
35049   
35050 Shutting down the send side of the socket: 
35051
35052    boost::asio::ip::tcp::socket socket(my_context);
35053    ...
35054    boost::system::error_code ec;
35055    socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send, ec);
35056    if (ec)
35057    {
35058      // An error occurred.
35059    }
35060
35061
35062
35063
35064
35065
35066
35067 [endsect]
35068
35069
35070 [endsect]
35071
35072
35073 [section:shutdown_type basic_socket::shutdown_type]
35074
35075
35076 ['Inherited from socket_base.]
35077
35078 [indexterm2 boost_asio.indexterm.basic_socket.shutdown_type..shutdown_type..basic_socket] 
35079 Different ways a socket may be shutdown. 
35080
35081
35082   enum shutdown_type
35083
35084 [indexterm2 boost_asio.indexterm.basic_socket.shutdown_type.shutdown_receive..shutdown_receive..basic_socket]
35085 [indexterm2 boost_asio.indexterm.basic_socket.shutdown_type.shutdown_send..shutdown_send..basic_socket]
35086 [indexterm2 boost_asio.indexterm.basic_socket.shutdown_type.shutdown_both..shutdown_both..basic_socket]
35087
35088 [heading Values]
35089 [variablelist
35090
35091   [
35092     [shutdown_receive]
35093     [Shutdown the receive side of the socket. ]
35094   ]
35095
35096   [
35097     [shutdown_send]
35098     [Shutdown the send side of the socket. ]
35099   ]
35100
35101   [
35102     [shutdown_both]
35103     [Shutdown both send and receive on the socket. ]
35104   ]
35105
35106 ]
35107
35108
35109
35110 [endsect]
35111
35112
35113 [section:wait basic_socket::wait]
35114
35115 [indexterm2 boost_asio.indexterm.basic_socket.wait..wait..basic_socket] 
35116 Wait for the socket to become ready to read, ready to write, or to have pending error conditions. 
35117
35118
35119   void ``[link boost_asio.reference.basic_socket.wait.overload1 wait]``(
35120       wait_type w);
35121   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.wait.overload1 more...]]``
35122
35123   void ``[link boost_asio.reference.basic_socket.wait.overload2 wait]``(
35124       wait_type w,
35125       boost::system::error_code & ec);
35126   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket.wait.overload2 more...]]``
35127
35128
35129 [section:overload1 basic_socket::wait (1 of 2 overloads)]
35130
35131
35132 Wait for the socket to become ready to read, ready to write, or to have pending error conditions. 
35133
35134
35135   void wait(
35136       wait_type w);
35137
35138
35139 This function is used to perform a blocking wait for a socket to enter a ready to read, write or error condition state.
35140
35141
35142 [heading Parameters]
35143     
35144
35145 [variablelist
35146   
35147 [[w][Specifies the desired socket state.]]
35148
35149 ]
35150
35151
35152 [heading Example]
35153   
35154 Waiting for a socket to become readable. 
35155
35156    boost::asio::ip::tcp::socket socket(my_context);
35157    ...
35158    socket.wait(boost::asio::ip::tcp::socket::wait_read);
35159
35160
35161
35162
35163
35164
35165
35166 [endsect]
35167
35168
35169
35170 [section:overload2 basic_socket::wait (2 of 2 overloads)]
35171
35172
35173 Wait for the socket to become ready to read, ready to write, or to have pending error conditions. 
35174
35175
35176   void wait(
35177       wait_type w,
35178       boost::system::error_code & ec);
35179
35180
35181 This function is used to perform a blocking wait for a socket to enter a ready to read, write or error condition state.
35182
35183
35184 [heading Parameters]
35185     
35186
35187 [variablelist
35188   
35189 [[w][Specifies the desired socket state.]]
35190
35191 [[ec][Set to indicate what error occurred, if any.]]
35192
35193 ]
35194
35195
35196 [heading Example]
35197   
35198 Waiting for a socket to become readable. 
35199
35200    boost::asio::ip::tcp::socket socket(my_context);
35201    ...
35202    boost::system::error_code ec;
35203    socket.wait(boost::asio::ip::tcp::socket::wait_read, ec);
35204
35205
35206
35207
35208
35209
35210
35211 [endsect]
35212
35213
35214 [endsect]
35215
35216
35217 [section:wait_type basic_socket::wait_type]
35218
35219
35220 ['Inherited from socket_base.]
35221
35222 [indexterm2 boost_asio.indexterm.basic_socket.wait_type..wait_type..basic_socket] 
35223 Wait types. 
35224
35225
35226   enum wait_type
35227
35228 [indexterm2 boost_asio.indexterm.basic_socket.wait_type.wait_read..wait_read..basic_socket]
35229 [indexterm2 boost_asio.indexterm.basic_socket.wait_type.wait_write..wait_write..basic_socket]
35230 [indexterm2 boost_asio.indexterm.basic_socket.wait_type.wait_error..wait_error..basic_socket]
35231
35232 [heading Values]
35233 [variablelist
35234
35235   [
35236     [wait_read]
35237     [Wait for a socket to become ready to read. ]
35238   ]
35239
35240   [
35241     [wait_write]
35242     [Wait for a socket to become ready to write. ]
35243   ]
35244
35245   [
35246     [wait_error]
35247     [Wait for a socket to have error conditions pending. ]
35248   ]
35249
35250 ]
35251
35252
35253 For use with `basic_socket::wait()` and `basic_socket::async_wait()`. 
35254
35255
35256 [endsect]
35257
35258
35259
35260 [section:_basic_socket basic_socket::~basic_socket]
35261
35262 [indexterm2 boost_asio.indexterm.basic_socket._basic_socket..~basic_socket..basic_socket] 
35263 Protected destructor to prevent deletion through this type. 
35264
35265
35266   ~basic_socket();
35267
35268
35269 This function destroys the socket, cancelling any outstanding asynchronous operations associated with the socket as if by calling `cancel`. 
35270
35271
35272 [endsect]
35273
35274
35275
35276 [endsect]
35277
35278 [section:basic_socket__rebind_executor basic_socket::rebind_executor]
35279
35280
35281 Rebinds the socket type to another executor. 
35282
35283
35284   template<
35285       typename ``[link boost_asio.reference.Executor1 Executor1]``>
35286   struct rebind_executor
35287
35288
35289 [heading Types]
35290 [table
35291   [[Name][Description]]
35292
35293   [
35294
35295     [[link boost_asio.reference.basic_socket__rebind_executor.other [*other]]]
35296     [The socket type when rebound to the specified executor. ]
35297   
35298   ]
35299
35300 ]
35301
35302 [heading Requirements]
35303
35304 ['Header: ][^boost/asio/basic_socket.hpp]
35305
35306 ['Convenience header: ][^boost/asio.hpp]
35307
35308
35309 [section:other basic_socket::rebind_executor::other]
35310
35311 [indexterm2 boost_asio.indexterm.basic_socket__rebind_executor.other..other..basic_socket::rebind_executor] 
35312 The socket type when rebound to the specified executor. 
35313
35314
35315   typedef basic_socket< Protocol, Executor1 > other;
35316
35317
35318 [heading Types]
35319 [table
35320   [[Name][Description]]
35321
35322   [
35323
35324     [[link boost_asio.reference.basic_socket__rebind_executor [*rebind_executor]]]
35325     [Rebinds the socket type to another executor. ]
35326   
35327   ]
35328
35329   [
35330
35331     [[link boost_asio.reference.basic_socket.broadcast [*broadcast]]]
35332     [Socket option to permit sending of broadcast messages. ]
35333   
35334   ]
35335
35336   [
35337
35338     [[link boost_asio.reference.basic_socket.bytes_readable [*bytes_readable]]]
35339     [IO control command to get the amount of data that can be read without blocking. ]
35340   
35341   ]
35342
35343   [
35344
35345     [[link boost_asio.reference.basic_socket.debug [*debug]]]
35346     [Socket option to enable socket-level debugging. ]
35347   
35348   ]
35349
35350   [
35351
35352     [[link boost_asio.reference.basic_socket.do_not_route [*do_not_route]]]
35353     [Socket option to prevent routing, use local interfaces only. ]
35354   
35355   ]
35356
35357   [
35358
35359     [[link boost_asio.reference.basic_socket.enable_connection_aborted [*enable_connection_aborted]]]
35360     [Socket option to report aborted connections on accept. ]
35361   
35362   ]
35363
35364   [
35365
35366     [[link boost_asio.reference.basic_socket.endpoint_type [*endpoint_type]]]
35367     [The endpoint type. ]
35368   
35369   ]
35370
35371   [
35372
35373     [[link boost_asio.reference.basic_socket.executor_type [*executor_type]]]
35374     [The type of the executor associated with the object. ]
35375   
35376   ]
35377
35378   [
35379
35380     [[link boost_asio.reference.basic_socket.keep_alive [*keep_alive]]]
35381     [Socket option to send keep-alives. ]
35382   
35383   ]
35384
35385   [
35386
35387     [[link boost_asio.reference.basic_socket.linger [*linger]]]
35388     [Socket option to specify whether the socket lingers on close if unsent data is present. ]
35389   
35390   ]
35391
35392   [
35393
35394     [[link boost_asio.reference.basic_socket.lowest_layer_type [*lowest_layer_type]]]
35395     [A basic_socket is always the lowest layer. ]
35396   
35397   ]
35398
35399   [
35400
35401     [[link boost_asio.reference.basic_socket.message_flags [*message_flags]]]
35402     [Bitmask type for flags that can be passed to send and receive operations. ]
35403   
35404   ]
35405
35406   [
35407
35408     [[link boost_asio.reference.basic_socket.native_handle_type [*native_handle_type]]]
35409     [The native representation of a socket. ]
35410   
35411   ]
35412
35413   [
35414
35415     [[link boost_asio.reference.basic_socket.out_of_band_inline [*out_of_band_inline]]]
35416     [Socket option for putting received out-of-band data inline. ]
35417   
35418   ]
35419
35420   [
35421
35422     [[link boost_asio.reference.basic_socket.protocol_type [*protocol_type]]]
35423     [The protocol type. ]
35424   
35425   ]
35426
35427   [
35428
35429     [[link boost_asio.reference.basic_socket.receive_buffer_size [*receive_buffer_size]]]
35430     [Socket option for the receive buffer size of a socket. ]
35431   
35432   ]
35433
35434   [
35435
35436     [[link boost_asio.reference.basic_socket.receive_low_watermark [*receive_low_watermark]]]
35437     [Socket option for the receive low watermark. ]
35438   
35439   ]
35440
35441   [
35442
35443     [[link boost_asio.reference.basic_socket.reuse_address [*reuse_address]]]
35444     [Socket option to allow the socket to be bound to an address that is already in use. ]
35445   
35446   ]
35447
35448   [
35449
35450     [[link boost_asio.reference.basic_socket.send_buffer_size [*send_buffer_size]]]
35451     [Socket option for the send buffer size of a socket. ]
35452   
35453   ]
35454
35455   [
35456
35457     [[link boost_asio.reference.basic_socket.send_low_watermark [*send_low_watermark]]]
35458     [Socket option for the send low watermark. ]
35459   
35460   ]
35461
35462   [
35463
35464     [[link boost_asio.reference.basic_socket.shutdown_type [*shutdown_type]]]
35465     [Different ways a socket may be shutdown. ]
35466   
35467   ]
35468
35469   [
35470
35471     [[link boost_asio.reference.basic_socket.wait_type [*wait_type]]]
35472     [Wait types. ]
35473   
35474   ]
35475
35476 ]
35477
35478 [heading Member Functions]
35479 [table
35480   [[Name][Description]]
35481
35482   [
35483     [[link boost_asio.reference.basic_socket.assign [*assign]]]
35484     [Assign an existing native socket to the socket. ]
35485   ]
35486   
35487   [
35488     [[link boost_asio.reference.basic_socket.async_connect [*async_connect]]]
35489     [Start an asynchronous connect. ]
35490   ]
35491   
35492   [
35493     [[link boost_asio.reference.basic_socket.async_wait [*async_wait]]]
35494     [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
35495   ]
35496   
35497   [
35498     [[link boost_asio.reference.basic_socket.at_mark [*at_mark]]]
35499     [Determine whether the socket is at the out-of-band data mark. ]
35500   ]
35501   
35502   [
35503     [[link boost_asio.reference.basic_socket.available [*available]]]
35504     [Determine the number of bytes available for reading. ]
35505   ]
35506   
35507   [
35508     [[link boost_asio.reference.basic_socket.basic_socket [*basic_socket]]]
35509     [Construct a basic_socket without opening it. 
35510      [hr]
35511      Construct and open a basic_socket. 
35512      [hr]
35513      Construct a basic_socket, opening it and binding it to the given local endpoint. 
35514      [hr]
35515      Construct a basic_socket on an existing native socket. 
35516      [hr]
35517      Move-construct a basic_socket from another. 
35518      [hr]
35519      Move-construct a basic_socket from a socket of another protocol type. ]
35520   ]
35521   
35522   [
35523     [[link boost_asio.reference.basic_socket.bind [*bind]]]
35524     [Bind the socket to the given local endpoint. ]
35525   ]
35526   
35527   [
35528     [[link boost_asio.reference.basic_socket.cancel [*cancel]]]
35529     [Cancel all asynchronous operations associated with the socket. ]
35530   ]
35531   
35532   [
35533     [[link boost_asio.reference.basic_socket.close [*close]]]
35534     [Close the socket. ]
35535   ]
35536   
35537   [
35538     [[link boost_asio.reference.basic_socket.connect [*connect]]]
35539     [Connect the socket to the specified endpoint. ]
35540   ]
35541   
35542   [
35543     [[link boost_asio.reference.basic_socket.get_executor [*get_executor]]]
35544     [Get the executor associated with the object. ]
35545   ]
35546   
35547   [
35548     [[link boost_asio.reference.basic_socket.get_option [*get_option]]]
35549     [Get an option from the socket. ]
35550   ]
35551   
35552   [
35553     [[link boost_asio.reference.basic_socket.io_control [*io_control]]]
35554     [Perform an IO control command on the socket. ]
35555   ]
35556   
35557   [
35558     [[link boost_asio.reference.basic_socket.is_open [*is_open]]]
35559     [Determine whether the socket is open. ]
35560   ]
35561   
35562   [
35563     [[link boost_asio.reference.basic_socket.local_endpoint [*local_endpoint]]]
35564     [Get the local endpoint of the socket. ]
35565   ]
35566   
35567   [
35568     [[link boost_asio.reference.basic_socket.lowest_layer [*lowest_layer]]]
35569     [Get a reference to the lowest layer. 
35570      [hr]
35571      Get a const reference to the lowest layer. ]
35572   ]
35573   
35574   [
35575     [[link boost_asio.reference.basic_socket.native_handle [*native_handle]]]
35576     [Get the native socket representation. ]
35577   ]
35578   
35579   [
35580     [[link boost_asio.reference.basic_socket.native_non_blocking [*native_non_blocking]]]
35581     [Gets the non-blocking mode of the native socket implementation. 
35582      [hr]
35583      Sets the non-blocking mode of the native socket implementation. ]
35584   ]
35585   
35586   [
35587     [[link boost_asio.reference.basic_socket.non_blocking [*non_blocking]]]
35588     [Gets the non-blocking mode of the socket. 
35589      [hr]
35590      Sets the non-blocking mode of the socket. ]
35591   ]
35592   
35593   [
35594     [[link boost_asio.reference.basic_socket.open [*open]]]
35595     [Open the socket using the specified protocol. ]
35596   ]
35597   
35598   [
35599     [[link boost_asio.reference.basic_socket.operator_eq_ [*operator=]]]
35600     [Move-assign a basic_socket from another. 
35601      [hr]
35602      Move-assign a basic_socket from a socket of another protocol type. ]
35603   ]
35604   
35605   [
35606     [[link boost_asio.reference.basic_socket.release [*release]]]
35607     [Release ownership of the underlying native socket. ]
35608   ]
35609   
35610   [
35611     [[link boost_asio.reference.basic_socket.remote_endpoint [*remote_endpoint]]]
35612     [Get the remote endpoint of the socket. ]
35613   ]
35614   
35615   [
35616     [[link boost_asio.reference.basic_socket.set_option [*set_option]]]
35617     [Set an option on the socket. ]
35618   ]
35619   
35620   [
35621     [[link boost_asio.reference.basic_socket.shutdown [*shutdown]]]
35622     [Disable sends or receives on the socket. ]
35623   ]
35624   
35625   [
35626     [[link boost_asio.reference.basic_socket.wait [*wait]]]
35627     [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
35628   ]
35629   
35630 ]
35631
35632 [heading Protected Member Functions]
35633 [table
35634   [[Name][Description]]
35635
35636   [
35637     [[link boost_asio.reference.basic_socket._basic_socket [*~basic_socket]]]
35638     [Protected destructor to prevent deletion through this type. ]
35639   ]
35640   
35641 ]
35642
35643 [heading Data Members]
35644 [table
35645   [[Name][Description]]
35646
35647   [
35648     [[link boost_asio.reference.basic_socket.max_connections [*max_connections]]]
35649     [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
35650   ]
35651
35652   [
35653     [[link boost_asio.reference.basic_socket.max_listen_connections [*max_listen_connections]]]
35654     [The maximum length of the queue of pending incoming connections. ]
35655   ]
35656
35657   [
35658     [[link boost_asio.reference.basic_socket.message_do_not_route [*message_do_not_route]]]
35659     [Specify that the data should not be subject to routing. ]
35660   ]
35661
35662   [
35663     [[link boost_asio.reference.basic_socket.message_end_of_record [*message_end_of_record]]]
35664     [Specifies that the data marks the end of a record. ]
35665   ]
35666
35667   [
35668     [[link boost_asio.reference.basic_socket.message_out_of_band [*message_out_of_band]]]
35669     [Process out-of-band data. ]
35670   ]
35671
35672   [
35673     [[link boost_asio.reference.basic_socket.message_peek [*message_peek]]]
35674     [Peek at incoming data without removing it from the input queue. ]
35675   ]
35676
35677 ]
35678
35679 [heading Protected Data Members]
35680 [table
35681   [[Name][Description]]
35682
35683   [
35684     [[link boost_asio.reference.basic_socket.impl_ [*impl_]]]
35685     []
35686   ]
35687
35688 ]
35689
35690 The [link boost_asio.reference.basic_socket `basic_socket`] class template provides functionality that is common to both stream-oriented and datagram-oriented sockets.
35691
35692
35693 [heading Thread Safety]
35694   
35695 ['Distinct] ['objects:] Safe.
35696
35697 ['Shared] ['objects:] Unsafe. 
35698
35699
35700
35701
35702 [heading Requirements]
35703
35704 ['Header: ][^boost/asio/basic_socket.hpp]
35705
35706 ['Convenience header: ][^boost/asio.hpp]
35707
35708
35709 [endsect]
35710
35711
35712
35713 [endsect]
35714
35715 [section:basic_socket_acceptor basic_socket_acceptor]
35716
35717
35718 Provides the ability to accept new connections. 
35719
35720
35721   template<
35722       typename ``[link boost_asio.reference.Protocol Protocol]``,
35723       typename ``[link boost_asio.reference.Executor1 Executor]``>
35724   class basic_socket_acceptor :
35725     public socket_base
35726
35727
35728 [heading Types]
35729 [table
35730   [[Name][Description]]
35731
35732   [
35733
35734     [[link boost_asio.reference.basic_socket_acceptor__rebind_executor [*rebind_executor]]]
35735     [Rebinds the acceptor type to another executor. ]
35736   
35737   ]
35738
35739   [
35740
35741     [[link boost_asio.reference.basic_socket_acceptor.broadcast [*broadcast]]]
35742     [Socket option to permit sending of broadcast messages. ]
35743   
35744   ]
35745
35746   [
35747
35748     [[link boost_asio.reference.basic_socket_acceptor.bytes_readable [*bytes_readable]]]
35749     [IO control command to get the amount of data that can be read without blocking. ]
35750   
35751   ]
35752
35753   [
35754
35755     [[link boost_asio.reference.basic_socket_acceptor.debug [*debug]]]
35756     [Socket option to enable socket-level debugging. ]
35757   
35758   ]
35759
35760   [
35761
35762     [[link boost_asio.reference.basic_socket_acceptor.do_not_route [*do_not_route]]]
35763     [Socket option to prevent routing, use local interfaces only. ]
35764   
35765   ]
35766
35767   [
35768
35769     [[link boost_asio.reference.basic_socket_acceptor.enable_connection_aborted [*enable_connection_aborted]]]
35770     [Socket option to report aborted connections on accept. ]
35771   
35772   ]
35773
35774   [
35775
35776     [[link boost_asio.reference.basic_socket_acceptor.endpoint_type [*endpoint_type]]]
35777     [The endpoint type. ]
35778   
35779   ]
35780
35781   [
35782
35783     [[link boost_asio.reference.basic_socket_acceptor.executor_type [*executor_type]]]
35784     [The type of the executor associated with the object. ]
35785   
35786   ]
35787
35788   [
35789
35790     [[link boost_asio.reference.basic_socket_acceptor.keep_alive [*keep_alive]]]
35791     [Socket option to send keep-alives. ]
35792   
35793   ]
35794
35795   [
35796
35797     [[link boost_asio.reference.basic_socket_acceptor.linger [*linger]]]
35798     [Socket option to specify whether the socket lingers on close if unsent data is present. ]
35799   
35800   ]
35801
35802   [
35803
35804     [[link boost_asio.reference.basic_socket_acceptor.message_flags [*message_flags]]]
35805     [Bitmask type for flags that can be passed to send and receive operations. ]
35806   
35807   ]
35808
35809   [
35810
35811     [[link boost_asio.reference.basic_socket_acceptor.native_handle_type [*native_handle_type]]]
35812     [The native representation of an acceptor. ]
35813   
35814   ]
35815
35816   [
35817
35818     [[link boost_asio.reference.basic_socket_acceptor.out_of_band_inline [*out_of_band_inline]]]
35819     [Socket option for putting received out-of-band data inline. ]
35820   
35821   ]
35822
35823   [
35824
35825     [[link boost_asio.reference.basic_socket_acceptor.protocol_type [*protocol_type]]]
35826     [The protocol type. ]
35827   
35828   ]
35829
35830   [
35831
35832     [[link boost_asio.reference.basic_socket_acceptor.receive_buffer_size [*receive_buffer_size]]]
35833     [Socket option for the receive buffer size of a socket. ]
35834   
35835   ]
35836
35837   [
35838
35839     [[link boost_asio.reference.basic_socket_acceptor.receive_low_watermark [*receive_low_watermark]]]
35840     [Socket option for the receive low watermark. ]
35841   
35842   ]
35843
35844   [
35845
35846     [[link boost_asio.reference.basic_socket_acceptor.reuse_address [*reuse_address]]]
35847     [Socket option to allow the socket to be bound to an address that is already in use. ]
35848   
35849   ]
35850
35851   [
35852
35853     [[link boost_asio.reference.basic_socket_acceptor.send_buffer_size [*send_buffer_size]]]
35854     [Socket option for the send buffer size of a socket. ]
35855   
35856   ]
35857
35858   [
35859
35860     [[link boost_asio.reference.basic_socket_acceptor.send_low_watermark [*send_low_watermark]]]
35861     [Socket option for the send low watermark. ]
35862   
35863   ]
35864
35865   [
35866
35867     [[link boost_asio.reference.basic_socket_acceptor.shutdown_type [*shutdown_type]]]
35868     [Different ways a socket may be shutdown. ]
35869   
35870   ]
35871
35872   [
35873
35874     [[link boost_asio.reference.basic_socket_acceptor.wait_type [*wait_type]]]
35875     [Wait types. ]
35876   
35877   ]
35878
35879 ]
35880
35881 [heading Member Functions]
35882 [table
35883   [[Name][Description]]
35884
35885   [
35886     [[link boost_asio.reference.basic_socket_acceptor.accept [*accept]]]
35887     [Accept a new connection. 
35888      [hr]
35889      Accept a new connection and obtain the endpoint of the peer. ]
35890   ]
35891   
35892   [
35893     [[link boost_asio.reference.basic_socket_acceptor.assign [*assign]]]
35894     [Assigns an existing native acceptor to the acceptor. ]
35895   ]
35896   
35897   [
35898     [[link boost_asio.reference.basic_socket_acceptor.async_accept [*async_accept]]]
35899     [Start an asynchronous accept. ]
35900   ]
35901   
35902   [
35903     [[link boost_asio.reference.basic_socket_acceptor.async_wait [*async_wait]]]
35904     [Asynchronously wait for the acceptor to become ready to read, ready to write, or to have pending error conditions. ]
35905   ]
35906   
35907   [
35908     [[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor [*basic_socket_acceptor]]]
35909     [Construct an acceptor without opening it. 
35910      [hr]
35911      Construct an open acceptor. 
35912      [hr]
35913      Construct an acceptor opened on the given endpoint. 
35914      [hr]
35915      Construct a basic_socket_acceptor on an existing native acceptor. 
35916      [hr]
35917      Move-construct a basic_socket_acceptor from another. 
35918      [hr]
35919      Move-construct a basic_socket_acceptor from an acceptor of another protocol type. ]
35920   ]
35921   
35922   [
35923     [[link boost_asio.reference.basic_socket_acceptor.bind [*bind]]]
35924     [Bind the acceptor to the given local endpoint. ]
35925   ]
35926   
35927   [
35928     [[link boost_asio.reference.basic_socket_acceptor.cancel [*cancel]]]
35929     [Cancel all asynchronous operations associated with the acceptor. ]
35930   ]
35931   
35932   [
35933     [[link boost_asio.reference.basic_socket_acceptor.close [*close]]]
35934     [Close the acceptor. ]
35935   ]
35936   
35937   [
35938     [[link boost_asio.reference.basic_socket_acceptor.get_executor [*get_executor]]]
35939     [Get the executor associated with the object. ]
35940   ]
35941   
35942   [
35943     [[link boost_asio.reference.basic_socket_acceptor.get_option [*get_option]]]
35944     [Get an option from the acceptor. ]
35945   ]
35946   
35947   [
35948     [[link boost_asio.reference.basic_socket_acceptor.io_control [*io_control]]]
35949     [Perform an IO control command on the acceptor. ]
35950   ]
35951   
35952   [
35953     [[link boost_asio.reference.basic_socket_acceptor.is_open [*is_open]]]
35954     [Determine whether the acceptor is open. ]
35955   ]
35956   
35957   [
35958     [[link boost_asio.reference.basic_socket_acceptor.listen [*listen]]]
35959     [Place the acceptor into the state where it will listen for new connections. ]
35960   ]
35961   
35962   [
35963     [[link boost_asio.reference.basic_socket_acceptor.local_endpoint [*local_endpoint]]]
35964     [Get the local endpoint of the acceptor. ]
35965   ]
35966   
35967   [
35968     [[link boost_asio.reference.basic_socket_acceptor.native_handle [*native_handle]]]
35969     [Get the native acceptor representation. ]
35970   ]
35971   
35972   [
35973     [[link boost_asio.reference.basic_socket_acceptor.native_non_blocking [*native_non_blocking]]]
35974     [Gets the non-blocking mode of the native acceptor implementation. 
35975      [hr]
35976      Sets the non-blocking mode of the native acceptor implementation. ]
35977   ]
35978   
35979   [
35980     [[link boost_asio.reference.basic_socket_acceptor.non_blocking [*non_blocking]]]
35981     [Gets the non-blocking mode of the acceptor. 
35982      [hr]
35983      Sets the non-blocking mode of the acceptor. ]
35984   ]
35985   
35986   [
35987     [[link boost_asio.reference.basic_socket_acceptor.open [*open]]]
35988     [Open the acceptor using the specified protocol. ]
35989   ]
35990   
35991   [
35992     [[link boost_asio.reference.basic_socket_acceptor.operator_eq_ [*operator=]]]
35993     [Move-assign a basic_socket_acceptor from another. 
35994      [hr]
35995      Move-assign a basic_socket_acceptor from an acceptor of another protocol type. ]
35996   ]
35997   
35998   [
35999     [[link boost_asio.reference.basic_socket_acceptor.release [*release]]]
36000     [Release ownership of the underlying native acceptor. ]
36001   ]
36002   
36003   [
36004     [[link boost_asio.reference.basic_socket_acceptor.set_option [*set_option]]]
36005     [Set an option on the acceptor. ]
36006   ]
36007   
36008   [
36009     [[link boost_asio.reference.basic_socket_acceptor.wait [*wait]]]
36010     [Wait for the acceptor to become ready to read, ready to write, or to have pending error conditions. ]
36011   ]
36012   
36013   [
36014     [[link boost_asio.reference.basic_socket_acceptor._basic_socket_acceptor [*~basic_socket_acceptor]]]
36015     [Destroys the acceptor. ]
36016   ]
36017   
36018 ]
36019
36020 [heading Data Members]
36021 [table
36022   [[Name][Description]]
36023
36024   [
36025     [[link boost_asio.reference.basic_socket_acceptor.max_connections [*max_connections]]]
36026     [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
36027   ]
36028
36029   [
36030     [[link boost_asio.reference.basic_socket_acceptor.max_listen_connections [*max_listen_connections]]]
36031     [The maximum length of the queue of pending incoming connections. ]
36032   ]
36033
36034   [
36035     [[link boost_asio.reference.basic_socket_acceptor.message_do_not_route [*message_do_not_route]]]
36036     [Specify that the data should not be subject to routing. ]
36037   ]
36038
36039   [
36040     [[link boost_asio.reference.basic_socket_acceptor.message_end_of_record [*message_end_of_record]]]
36041     [Specifies that the data marks the end of a record. ]
36042   ]
36043
36044   [
36045     [[link boost_asio.reference.basic_socket_acceptor.message_out_of_band [*message_out_of_band]]]
36046     [Process out-of-band data. ]
36047   ]
36048
36049   [
36050     [[link boost_asio.reference.basic_socket_acceptor.message_peek [*message_peek]]]
36051     [Peek at incoming data without removing it from the input queue. ]
36052   ]
36053
36054 ]
36055
36056 The [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] class template is used for accepting new socket connections.
36057
36058
36059 [heading Thread Safety]
36060   
36061 ['Distinct] ['objects:] Safe.
36062
36063 ['Shared] ['objects:] Unsafe.
36064
36065
36066 [heading Example]
36067   
36068 Opening a socket acceptor with the SO\_REUSEADDR option enabled: 
36069
36070    boost::asio::ip::tcp::acceptor acceptor(my_context);
36071    boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), port);
36072    acceptor.open(endpoint.protocol());
36073    acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
36074    acceptor.bind(endpoint);
36075    acceptor.listen();
36076
36077
36078
36079
36080
36081
36082 [heading Requirements]
36083
36084 ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
36085
36086 ['Convenience header: ][^boost/asio.hpp]
36087
36088 [section:accept basic_socket_acceptor::accept]
36089
36090 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.accept..accept..basic_socket_acceptor] 
36091 Accept a new connection. 
36092
36093
36094   template<
36095       typename ``[link boost_asio.reference.Protocol Protocol1]``,
36096       typename ``[link boost_asio.reference.Executor1 Executor1]``>
36097   void ``[link boost_asio.reference.basic_socket_acceptor.accept.overload1 accept]``(
36098       basic_socket< Protocol1, Executor1 > & peer,
36099       typename enable_if< is_convertible< Protocol, Protocol1 >::value >::type *  = 0);
36100   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload1 more...]]``
36101
36102   template<
36103       typename ``[link boost_asio.reference.Protocol Protocol1]``,
36104       typename ``[link boost_asio.reference.Executor1 Executor1]``>
36105   void ``[link boost_asio.reference.basic_socket_acceptor.accept.overload2 accept]``(
36106       basic_socket< Protocol1, Executor1 > & peer,
36107       boost::system::error_code & ec,
36108       typename enable_if< is_convertible< Protocol, Protocol1 >::value >::type *  = 0);
36109   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload2 more...]]``
36110
36111
36112 Accept a new connection and obtain the endpoint of the peer. 
36113
36114
36115   template<
36116       typename ``[link boost_asio.reference.Executor1 Executor1]``>
36117   void ``[link boost_asio.reference.basic_socket_acceptor.accept.overload3 accept]``(
36118       basic_socket< protocol_type, Executor1 > & peer,
36119       endpoint_type & peer_endpoint);
36120   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload3 more...]]``
36121
36122   template<
36123       typename ``[link boost_asio.reference.Executor1 Executor1]``>
36124   void ``[link boost_asio.reference.basic_socket_acceptor.accept.overload4 accept]``(
36125       basic_socket< protocol_type, Executor1 > & peer,
36126       endpoint_type & peer_endpoint,
36127       boost::system::error_code & ec);
36128   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload4 more...]]``
36129
36130   Protocol::socket::template rebind_executor< executor_type >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload5 accept]``();
36131   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload5 more...]]``
36132
36133   Protocol::socket::template rebind_executor< executor_type >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload6 accept]``(
36134       boost::system::error_code & ec);
36135   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload6 more...]]``
36136
36137   template<
36138       typename ``[link boost_asio.reference.Executor1 Executor1]``>
36139   Protocol::socket::template rebind_executor< Executor1 >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload7 accept]``(
36140       const Executor1 & ex,
36141       typename enable_if< is_executor< Executor1 >::value >::type *  = 0);
36142   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload7 more...]]``
36143
36144   template<
36145       typename ExecutionContext>
36146   Protocol::socket::template rebind_executor< typename ExecutionContext::executor_type >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload8 accept]``(
36147       ExecutionContext & context,
36148       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
36149   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload8 more...]]``
36150
36151   template<
36152       typename ``[link boost_asio.reference.Executor1 Executor1]``>
36153   Protocol::socket::template rebind_executor< Executor1 >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload9 accept]``(
36154       const Executor1 & ex,
36155       boost::system::error_code & ec,
36156       typename enable_if< is_executor< Executor1 >::value >::type *  = 0);
36157   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload9 more...]]``
36158
36159   template<
36160       typename ExecutionContext>
36161   Protocol::socket::template rebind_executor< typename ExecutionContext::executor_type >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload10 accept]``(
36162       ExecutionContext & context,
36163       boost::system::error_code & ec,
36164       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
36165   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload10 more...]]``
36166
36167   Protocol::socket::template rebind_executor< executor_type >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload11 accept]``(
36168       endpoint_type & peer_endpoint);
36169   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload11 more...]]``
36170
36171   Protocol::socket::template rebind_executor< executor_type >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload12 accept]``(
36172       endpoint_type & peer_endpoint,
36173       boost::system::error_code & ec);
36174   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload12 more...]]``
36175
36176   template<
36177       typename ``[link boost_asio.reference.Executor1 Executor1]``>
36178   Protocol::socket::template rebind_executor< Executor1 >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload13 accept]``(
36179       const Executor1 & ex,
36180       endpoint_type & peer_endpoint,
36181       typename enable_if< is_executor< Executor1 >::value >::type *  = 0);
36182   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload13 more...]]``
36183
36184   template<
36185       typename ExecutionContext>
36186   Protocol::socket::template rebind_executor< typename ExecutionContext::executor_type >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload14 accept]``(
36187       ExecutionContext & context,
36188       endpoint_type & peer_endpoint,
36189       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
36190   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload14 more...]]``
36191
36192   template<
36193       typename ``[link boost_asio.reference.Executor1 Executor1]``>
36194   Protocol::socket::template rebind_executor< Executor1 >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload15 accept]``(
36195       const executor_type & ex,
36196       endpoint_type & peer_endpoint,
36197       boost::system::error_code & ec,
36198       typename enable_if< is_executor< Executor1 >::value >::type *  = 0);
36199   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload15 more...]]``
36200
36201   template<
36202       typename ExecutionContext>
36203   Protocol::socket::template rebind_executor< typename ExecutionContext::executor_type >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload16 accept]``(
36204       ExecutionContext & context,
36205       endpoint_type & peer_endpoint,
36206       boost::system::error_code & ec,
36207       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
36208   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload16 more...]]``
36209
36210
36211 [section:overload1 basic_socket_acceptor::accept (1 of 16 overloads)]
36212
36213
36214 Accept a new connection. 
36215
36216
36217   template<
36218       typename ``[link boost_asio.reference.Protocol Protocol1]``,
36219       typename ``[link boost_asio.reference.Executor1 Executor1]``>
36220   void accept(
36221       basic_socket< Protocol1, Executor1 > & peer,
36222       typename enable_if< is_convertible< Protocol, Protocol1 >::value >::type *  = 0);
36223
36224
36225 This function is used to accept a new connection from a peer into the given socket. The function call will block until a new connection has been accepted successfully or an error occurs.
36226
36227
36228 [heading Parameters]
36229     
36230
36231 [variablelist
36232   
36233 [[peer][The socket into which the new connection will be accepted.]]
36234
36235 ]
36236
36237
36238 [heading Exceptions]
36239     
36240
36241 [variablelist
36242   
36243 [[boost::system::system_error][Thrown on failure.]]
36244
36245 ]
36246
36247
36248 [heading Example]
36249   
36250
36251
36252    boost::asio::ip::tcp::acceptor acceptor(my_context);
36253    ...
36254    boost::asio::ip::tcp::socket socket(my_context);
36255    acceptor.accept(socket);
36256
36257
36258
36259
36260
36261
36262
36263 [endsect]
36264
36265
36266
36267 [section:overload2 basic_socket_acceptor::accept (2 of 16 overloads)]
36268
36269
36270 Accept a new connection. 
36271
36272
36273   template<
36274       typename ``[link boost_asio.reference.Protocol Protocol1]``,
36275       typename ``[link boost_asio.reference.Executor1 Executor1]``>
36276   void accept(
36277       basic_socket< Protocol1, Executor1 > & peer,
36278       boost::system::error_code & ec,
36279       typename enable_if< is_convertible< Protocol, Protocol1 >::value >::type *  = 0);
36280
36281
36282 This function is used to accept a new connection from a peer into the given socket. The function call will block until a new connection has been accepted successfully or an error occurs.
36283
36284
36285 [heading Parameters]
36286     
36287
36288 [variablelist
36289   
36290 [[peer][The socket into which the new connection will be accepted.]]
36291
36292 [[ec][Set to indicate what error occurred, if any.]]
36293
36294 ]
36295
36296
36297 [heading Example]
36298   
36299
36300
36301    boost::asio::ip::tcp::acceptor acceptor(my_context);
36302    ...
36303    boost::asio::ip::tcp::socket socket(my_context);
36304    boost::system::error_code ec;
36305    acceptor.accept(socket, ec);
36306    if (ec)
36307    {
36308      // An error occurred.
36309    }
36310
36311
36312
36313
36314
36315
36316
36317 [endsect]
36318
36319
36320
36321 [section:overload3 basic_socket_acceptor::accept (3 of 16 overloads)]
36322
36323
36324 Accept a new connection and obtain the endpoint of the peer. 
36325
36326
36327   template<
36328       typename ``[link boost_asio.reference.Executor1 Executor1]``>
36329   void accept(
36330       basic_socket< protocol_type, Executor1 > & peer,
36331       endpoint_type & peer_endpoint);
36332
36333
36334 This function is used to accept a new connection from a peer into the given socket, and additionally provide the endpoint of the remote peer. The function call will block until a new connection has been accepted successfully or an error occurs.
36335
36336
36337 [heading Parameters]
36338     
36339
36340 [variablelist
36341   
36342 [[peer][The socket into which the new connection will be accepted.]]
36343
36344 [[peer_endpoint][An endpoint object which will receive the endpoint of the remote peer.]]
36345
36346 ]
36347
36348
36349 [heading Exceptions]
36350     
36351
36352 [variablelist
36353   
36354 [[boost::system::system_error][Thrown on failure.]]
36355
36356 ]
36357
36358
36359 [heading Example]
36360   
36361
36362
36363    boost::asio::ip::tcp::acceptor acceptor(my_context);
36364    ...
36365    boost::asio::ip::tcp::socket socket(my_context);
36366    boost::asio::ip::tcp::endpoint endpoint;
36367    acceptor.accept(socket, endpoint);
36368
36369
36370
36371
36372
36373
36374
36375 [endsect]
36376
36377
36378
36379 [section:overload4 basic_socket_acceptor::accept (4 of 16 overloads)]
36380
36381
36382 Accept a new connection and obtain the endpoint of the peer. 
36383
36384
36385   template<
36386       typename ``[link boost_asio.reference.Executor1 Executor1]``>
36387   void accept(
36388       basic_socket< protocol_type, Executor1 > & peer,
36389       endpoint_type & peer_endpoint,
36390       boost::system::error_code & ec);
36391
36392
36393 This function is used to accept a new connection from a peer into the given socket, and additionally provide the endpoint of the remote peer. The function call will block until a new connection has been accepted successfully or an error occurs.
36394
36395
36396 [heading Parameters]
36397     
36398
36399 [variablelist
36400   
36401 [[peer][The socket into which the new connection will be accepted.]]
36402
36403 [[peer_endpoint][An endpoint object which will receive the endpoint of the remote peer.]]
36404
36405 [[ec][Set to indicate what error occurred, if any.]]
36406
36407 ]
36408
36409
36410 [heading Example]
36411   
36412
36413
36414    boost::asio::ip::tcp::acceptor acceptor(my_context);
36415    ...
36416    boost::asio::ip::tcp::socket socket(my_context);
36417    boost::asio::ip::tcp::endpoint endpoint;
36418    boost::system::error_code ec;
36419    acceptor.accept(socket, endpoint, ec);
36420    if (ec)
36421    {
36422      // An error occurred.
36423    }
36424
36425
36426
36427
36428
36429
36430
36431 [endsect]
36432
36433
36434
36435 [section:overload5 basic_socket_acceptor::accept (5 of 16 overloads)]
36436
36437
36438 Accept a new connection. 
36439
36440
36441   Protocol::socket::template rebind_executor< executor_type >::other accept();
36442
36443
36444 This function is used to accept a new connection from a peer. The function call will block until a new connection has been accepted successfully or an error occurs.
36445
36446 This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
36447
36448
36449 [heading Return Value]
36450       
36451 A socket object representing the newly accepted connection.
36452
36453
36454 [heading Exceptions]
36455     
36456
36457 [variablelist
36458   
36459 [[boost::system::system_error][Thrown on failure.]]
36460
36461 ]
36462
36463
36464 [heading Example]
36465   
36466
36467
36468    boost::asio::ip::tcp::acceptor acceptor(my_context);
36469    ...
36470    boost::asio::ip::tcp::socket socket(acceptor.accept());
36471
36472
36473
36474
36475
36476
36477
36478 [endsect]
36479
36480
36481
36482 [section:overload6 basic_socket_acceptor::accept (6 of 16 overloads)]
36483
36484
36485 Accept a new connection. 
36486
36487
36488   Protocol::socket::template rebind_executor< executor_type >::other accept(
36489       boost::system::error_code & ec);
36490
36491
36492 This function is used to accept a new connection from a peer. The function call will block until a new connection has been accepted successfully or an error occurs.
36493
36494 This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
36495
36496
36497 [heading Parameters]
36498     
36499
36500 [variablelist
36501   
36502 [[ec][Set to indicate what error occurred, if any.]]
36503
36504 ]
36505
36506
36507 [heading Return Value]
36508       
36509 On success, a socket object representing the newly accepted connection. On error, a socket object where `is_open()` is false.
36510
36511
36512 [heading Example]
36513   
36514
36515
36516    boost::asio::ip::tcp::acceptor acceptor(my_context);
36517    ...
36518    boost::asio::ip::tcp::socket socket(acceptor.accept(ec));
36519    if (ec)
36520    {
36521      // An error occurred.
36522    }
36523
36524
36525
36526
36527
36528
36529
36530 [endsect]
36531
36532
36533
36534 [section:overload7 basic_socket_acceptor::accept (7 of 16 overloads)]
36535
36536
36537 Accept a new connection. 
36538
36539
36540   template<
36541       typename ``[link boost_asio.reference.Executor1 Executor1]``>
36542   Protocol::socket::template rebind_executor< Executor1 >::other accept(
36543       const Executor1 & ex,
36544       typename enable_if< is_executor< Executor1 >::value >::type *  = 0);
36545
36546
36547 This function is used to accept a new connection from a peer. The function call will block until a new connection has been accepted successfully or an error occurs.
36548
36549 This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
36550
36551
36552 [heading Parameters]
36553     
36554
36555 [variablelist
36556   
36557 [[ex][The I/O executor object to be used for the newly accepted socket.]]
36558
36559 ]
36560
36561
36562 [heading Return Value]
36563       
36564 A socket object representing the newly accepted connection.
36565
36566
36567 [heading Exceptions]
36568     
36569
36570 [variablelist
36571   
36572 [[boost::system::system_error][Thrown on failure.]]
36573
36574 ]
36575
36576
36577 [heading Example]
36578   
36579
36580
36581    boost::asio::ip::tcp::acceptor acceptor(my_context);
36582    ...
36583    boost::asio::ip::tcp::socket socket(acceptor.accept());
36584
36585
36586
36587
36588
36589
36590
36591 [endsect]
36592
36593
36594
36595 [section:overload8 basic_socket_acceptor::accept (8 of 16 overloads)]
36596
36597
36598 Accept a new connection. 
36599
36600
36601   template<
36602       typename ExecutionContext>
36603   Protocol::socket::template rebind_executor< typename ExecutionContext::executor_type >::other accept(
36604       ExecutionContext & context,
36605       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
36606
36607
36608 This function is used to accept a new connection from a peer. The function call will block until a new connection has been accepted successfully or an error occurs.
36609
36610 This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
36611
36612
36613 [heading Parameters]
36614     
36615
36616 [variablelist
36617   
36618 [[context][The I/O execution context object to be used for the newly accepted socket.]]
36619
36620 ]
36621
36622
36623 [heading Return Value]
36624       
36625 A socket object representing the newly accepted connection.
36626
36627
36628 [heading Exceptions]
36629     
36630
36631 [variablelist
36632   
36633 [[boost::system::system_error][Thrown on failure.]]
36634
36635 ]
36636
36637
36638 [heading Example]
36639   
36640
36641
36642    boost::asio::ip::tcp::acceptor acceptor(my_context);
36643    ...
36644    boost::asio::ip::tcp::socket socket(acceptor.accept());
36645
36646
36647
36648
36649
36650
36651
36652 [endsect]
36653
36654
36655
36656 [section:overload9 basic_socket_acceptor::accept (9 of 16 overloads)]
36657
36658
36659 Accept a new connection. 
36660
36661
36662   template<
36663       typename ``[link boost_asio.reference.Executor1 Executor1]``>
36664   Protocol::socket::template rebind_executor< Executor1 >::other accept(
36665       const Executor1 & ex,
36666       boost::system::error_code & ec,
36667       typename enable_if< is_executor< Executor1 >::value >::type *  = 0);
36668
36669
36670 This function is used to accept a new connection from a peer. The function call will block until a new connection has been accepted successfully or an error occurs.
36671
36672 This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
36673
36674
36675 [heading Parameters]
36676     
36677
36678 [variablelist
36679   
36680 [[ex][The I/O executor object to be used for the newly accepted socket.]]
36681
36682 [[ec][Set to indicate what error occurred, if any.]]
36683
36684 ]
36685
36686
36687 [heading Return Value]
36688       
36689 On success, a socket object representing the newly accepted connection. On error, a socket object where `is_open()` is false.
36690
36691
36692 [heading Example]
36693   
36694
36695
36696    boost::asio::ip::tcp::acceptor acceptor(my_context);
36697    ...
36698    boost::asio::ip::tcp::socket socket(acceptor.accept(my_context2, ec));
36699    if (ec)
36700    {
36701      // An error occurred.
36702    }
36703
36704
36705
36706
36707
36708
36709
36710 [endsect]
36711
36712
36713
36714 [section:overload10 basic_socket_acceptor::accept (10 of 16 overloads)]
36715
36716
36717 Accept a new connection. 
36718
36719
36720   template<
36721       typename ExecutionContext>
36722   Protocol::socket::template rebind_executor< typename ExecutionContext::executor_type >::other accept(
36723       ExecutionContext & context,
36724       boost::system::error_code & ec,
36725       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
36726
36727
36728 This function is used to accept a new connection from a peer. The function call will block until a new connection has been accepted successfully or an error occurs.
36729
36730 This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
36731
36732
36733 [heading Parameters]
36734     
36735
36736 [variablelist
36737   
36738 [[context][The I/O execution context object to be used for the newly accepted socket.]]
36739
36740 [[ec][Set to indicate what error occurred, if any.]]
36741
36742 ]
36743
36744
36745 [heading Return Value]
36746       
36747 On success, a socket object representing the newly accepted connection. On error, a socket object where `is_open()` is false.
36748
36749
36750 [heading Example]
36751   
36752
36753
36754    boost::asio::ip::tcp::acceptor acceptor(my_context);
36755    ...
36756    boost::asio::ip::tcp::socket socket(acceptor.accept(my_context2, ec));
36757    if (ec)
36758    {
36759      // An error occurred.
36760    }
36761
36762
36763
36764
36765
36766
36767
36768 [endsect]
36769
36770
36771
36772 [section:overload11 basic_socket_acceptor::accept (11 of 16 overloads)]
36773
36774
36775 Accept a new connection. 
36776
36777
36778   Protocol::socket::template rebind_executor< executor_type >::other accept(
36779       endpoint_type & peer_endpoint);
36780
36781
36782 This function is used to accept a new connection from a peer. The function call will block until a new connection has been accepted successfully or an error occurs.
36783
36784 This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
36785
36786
36787 [heading Parameters]
36788     
36789
36790 [variablelist
36791   
36792 [[peer_endpoint][An endpoint object into which the endpoint of the remote peer will be written.]]
36793
36794 ]
36795
36796
36797 [heading Return Value]
36798       
36799 A socket object representing the newly accepted connection.
36800
36801
36802 [heading Exceptions]
36803     
36804
36805 [variablelist
36806   
36807 [[boost::system::system_error][Thrown on failure.]]
36808
36809 ]
36810
36811
36812 [heading Example]
36813   
36814
36815
36816    boost::asio::ip::tcp::acceptor acceptor(my_context);
36817    ...
36818    boost::asio::ip::tcp::endpoint endpoint;
36819    boost::asio::ip::tcp::socket socket(acceptor.accept(endpoint));
36820
36821
36822
36823
36824
36825
36826
36827 [endsect]
36828
36829
36830
36831 [section:overload12 basic_socket_acceptor::accept (12 of 16 overloads)]
36832
36833
36834 Accept a new connection. 
36835
36836
36837   Protocol::socket::template rebind_executor< executor_type >::other accept(
36838       endpoint_type & peer_endpoint,
36839       boost::system::error_code & ec);
36840
36841
36842 This function is used to accept a new connection from a peer. The function call will block until a new connection has been accepted successfully or an error occurs.
36843
36844 This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
36845
36846
36847 [heading Parameters]
36848     
36849
36850 [variablelist
36851   
36852 [[peer_endpoint][An endpoint object into which the endpoint of the remote peer will be written.]]
36853
36854 [[ec][Set to indicate what error occurred, if any.]]
36855
36856 ]
36857
36858
36859 [heading Return Value]
36860       
36861 On success, a socket object representing the newly accepted connection. On error, a socket object where `is_open()` is false.
36862
36863
36864 [heading Example]
36865   
36866
36867
36868    boost::asio::ip::tcp::acceptor acceptor(my_context);
36869    ...
36870    boost::asio::ip::tcp::endpoint endpoint;
36871    boost::asio::ip::tcp::socket socket(acceptor.accept(endpoint, ec));
36872    if (ec)
36873    {
36874      // An error occurred.
36875    }
36876
36877
36878
36879
36880
36881
36882
36883 [endsect]
36884
36885
36886
36887 [section:overload13 basic_socket_acceptor::accept (13 of 16 overloads)]
36888
36889
36890 Accept a new connection. 
36891
36892
36893   template<
36894       typename ``[link boost_asio.reference.Executor1 Executor1]``>
36895   Protocol::socket::template rebind_executor< Executor1 >::other accept(
36896       const Executor1 & ex,
36897       endpoint_type & peer_endpoint,
36898       typename enable_if< is_executor< Executor1 >::value >::type *  = 0);
36899
36900
36901 This function is used to accept a new connection from a peer. The function call will block until a new connection has been accepted successfully or an error occurs.
36902
36903 This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
36904
36905
36906 [heading Parameters]
36907     
36908
36909 [variablelist
36910   
36911 [[ex][The I/O executor object to be used for the newly accepted socket.]]
36912
36913 [[peer_endpoint][An endpoint object into which the endpoint of the remote peer will be written.]]
36914
36915 ]
36916
36917
36918 [heading Return Value]
36919       
36920 A socket object representing the newly accepted connection.
36921
36922
36923 [heading Exceptions]
36924     
36925
36926 [variablelist
36927   
36928 [[boost::system::system_error][Thrown on failure.]]
36929
36930 ]
36931
36932
36933 [heading Example]
36934   
36935
36936
36937    boost::asio::ip::tcp::acceptor acceptor(my_context);
36938    ...
36939    boost::asio::ip::tcp::endpoint endpoint;
36940    boost::asio::ip::tcp::socket socket(
36941        acceptor.accept(my_context2, endpoint));
36942
36943
36944
36945
36946
36947
36948
36949 [endsect]
36950
36951
36952
36953 [section:overload14 basic_socket_acceptor::accept (14 of 16 overloads)]
36954
36955
36956 Accept a new connection. 
36957
36958
36959   template<
36960       typename ExecutionContext>
36961   Protocol::socket::template rebind_executor< typename ExecutionContext::executor_type >::other accept(
36962       ExecutionContext & context,
36963       endpoint_type & peer_endpoint,
36964       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
36965
36966
36967 This function is used to accept a new connection from a peer. The function call will block until a new connection has been accepted successfully or an error occurs.
36968
36969 This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
36970
36971
36972 [heading Parameters]
36973     
36974
36975 [variablelist
36976   
36977 [[context][The I/O execution context object to be used for the newly accepted socket.]]
36978
36979 [[peer_endpoint][An endpoint object into which the endpoint of the remote peer will be written.]]
36980
36981 ]
36982
36983
36984 [heading Return Value]
36985       
36986 A socket object representing the newly accepted connection.
36987
36988
36989 [heading Exceptions]
36990     
36991
36992 [variablelist
36993   
36994 [[boost::system::system_error][Thrown on failure.]]
36995
36996 ]
36997
36998
36999 [heading Example]
37000   
37001
37002
37003    boost::asio::ip::tcp::acceptor acceptor(my_context);
37004    ...
37005    boost::asio::ip::tcp::endpoint endpoint;
37006    boost::asio::ip::tcp::socket socket(
37007        acceptor.accept(my_context2, endpoint));
37008
37009
37010
37011
37012
37013
37014
37015 [endsect]
37016
37017
37018
37019 [section:overload15 basic_socket_acceptor::accept (15 of 16 overloads)]
37020
37021
37022 Accept a new connection. 
37023
37024
37025   template<
37026       typename ``[link boost_asio.reference.Executor1 Executor1]``>
37027   Protocol::socket::template rebind_executor< Executor1 >::other accept(
37028       const executor_type & ex,
37029       endpoint_type & peer_endpoint,
37030       boost::system::error_code & ec,
37031       typename enable_if< is_executor< Executor1 >::value >::type *  = 0);
37032
37033
37034 This function is used to accept a new connection from a peer. The function call will block until a new connection has been accepted successfully or an error occurs.
37035
37036 This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
37037
37038
37039 [heading Parameters]
37040     
37041
37042 [variablelist
37043   
37044 [[ex][The I/O executor object to be used for the newly accepted socket.]]
37045
37046 [[peer_endpoint][An endpoint object into which the endpoint of the remote peer will be written.]]
37047
37048 [[ec][Set to indicate what error occurred, if any.]]
37049
37050 ]
37051
37052
37053 [heading Return Value]
37054       
37055 On success, a socket object representing the newly accepted connection. On error, a socket object where `is_open()` is false.
37056
37057
37058 [heading Example]
37059   
37060
37061
37062    boost::asio::ip::tcp::acceptor acceptor(my_context);
37063    ...
37064    boost::asio::ip::tcp::endpoint endpoint;
37065    boost::asio::ip::tcp::socket socket(
37066        acceptor.accept(my_context2, endpoint, ec));
37067    if (ec)
37068    {
37069      // An error occurred.
37070    }
37071
37072
37073
37074
37075
37076
37077
37078 [endsect]
37079
37080
37081
37082 [section:overload16 basic_socket_acceptor::accept (16 of 16 overloads)]
37083
37084
37085 Accept a new connection. 
37086
37087
37088   template<
37089       typename ExecutionContext>
37090   Protocol::socket::template rebind_executor< typename ExecutionContext::executor_type >::other accept(
37091       ExecutionContext & context,
37092       endpoint_type & peer_endpoint,
37093       boost::system::error_code & ec,
37094       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
37095
37096
37097 This function is used to accept a new connection from a peer. The function call will block until a new connection has been accepted successfully or an error occurs.
37098
37099 This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
37100
37101
37102 [heading Parameters]
37103     
37104
37105 [variablelist
37106   
37107 [[context][The I/O execution context object to be used for the newly accepted socket.]]
37108
37109 [[peer_endpoint][An endpoint object into which the endpoint of the remote peer will be written.]]
37110
37111 [[ec][Set to indicate what error occurred, if any.]]
37112
37113 ]
37114
37115
37116 [heading Return Value]
37117       
37118 On success, a socket object representing the newly accepted connection. On error, a socket object where `is_open()` is false.
37119
37120
37121 [heading Example]
37122   
37123
37124
37125    boost::asio::ip::tcp::acceptor acceptor(my_context);
37126    ...
37127    boost::asio::ip::tcp::endpoint endpoint;
37128    boost::asio::ip::tcp::socket socket(
37129        acceptor.accept(my_context2, endpoint, ec));
37130    if (ec)
37131    {
37132      // An error occurred.
37133    }
37134
37135
37136
37137
37138
37139
37140
37141 [endsect]
37142
37143
37144 [endsect]
37145
37146 [section:assign basic_socket_acceptor::assign]
37147
37148 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.assign..assign..basic_socket_acceptor] 
37149 Assigns an existing native acceptor to the acceptor. 
37150
37151
37152   void ``[link boost_asio.reference.basic_socket_acceptor.assign.overload1 assign]``(
37153       const protocol_type & protocol,
37154       const native_handle_type & native_acceptor);
37155   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.assign.overload1 more...]]``
37156
37157   void ``[link boost_asio.reference.basic_socket_acceptor.assign.overload2 assign]``(
37158       const protocol_type & protocol,
37159       const native_handle_type & native_acceptor,
37160       boost::system::error_code & ec);
37161   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.assign.overload2 more...]]``
37162
37163
37164 [section:overload1 basic_socket_acceptor::assign (1 of 2 overloads)]
37165
37166
37167 Assigns an existing native acceptor to the acceptor. 
37168
37169
37170   void assign(
37171       const protocol_type & protocol,
37172       const native_handle_type & native_acceptor);
37173
37174
37175
37176 [endsect]
37177
37178
37179
37180 [section:overload2 basic_socket_acceptor::assign (2 of 2 overloads)]
37181
37182
37183 Assigns an existing native acceptor to the acceptor. 
37184
37185
37186   void assign(
37187       const protocol_type & protocol,
37188       const native_handle_type & native_acceptor,
37189       boost::system::error_code & ec);
37190
37191
37192
37193 [endsect]
37194
37195
37196 [endsect]
37197
37198 [section:async_accept basic_socket_acceptor::async_accept]
37199
37200 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.async_accept..async_accept..basic_socket_acceptor] 
37201 Start an asynchronous accept. 
37202
37203
37204   template<
37205       typename ``[link boost_asio.reference.Protocol Protocol1]``,
37206       typename ``[link boost_asio.reference.Executor1 Executor1]``,
37207       typename ``[link boost_asio.reference.AcceptHandler AcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
37208   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_socket_acceptor.async_accept.overload1 async_accept]``(
37209       basic_socket< Protocol1, Executor1 > & peer,
37210       AcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
37211       typename enable_if< is_convertible< Protocol, Protocol1 >::value >::type *  = 0);
37212   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.async_accept.overload1 more...]]``
37213
37214   template<
37215       typename ``[link boost_asio.reference.Executor1 Executor1]``,
37216       typename ``[link boost_asio.reference.AcceptHandler AcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
37217   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_socket_acceptor.async_accept.overload2 async_accept]``(
37218       basic_socket< protocol_type, Executor1 > & peer,
37219       endpoint_type & peer_endpoint,
37220       AcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
37221   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.async_accept.overload2 more...]]``
37222
37223   template<
37224       typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
37225   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_socket_acceptor.async_accept.overload3 async_accept]``(
37226       MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
37227   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.async_accept.overload3 more...]]``
37228
37229   template<
37230       typename ``[link boost_asio.reference.Executor1 Executor1]``,
37231       typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
37232   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_socket_acceptor.async_accept.overload4 async_accept]``(
37233       const Executor1 & ex,
37234       MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
37235       typename enable_if< is_executor< Executor1 >::value >::type *  = 0);
37236   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.async_accept.overload4 more...]]``
37237
37238   template<
37239       typename ExecutionContext,
37240       typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
37241   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_socket_acceptor.async_accept.overload5 async_accept]``(
37242       ExecutionContext & context,
37243       MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
37244       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
37245   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.async_accept.overload5 more...]]``
37246
37247   template<
37248       typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
37249   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_socket_acceptor.async_accept.overload6 async_accept]``(
37250       endpoint_type & peer_endpoint,
37251       MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
37252   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.async_accept.overload6 more...]]``
37253
37254   template<
37255       typename ``[link boost_asio.reference.Executor1 Executor1]``,
37256       typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
37257   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_socket_acceptor.async_accept.overload7 async_accept]``(
37258       const Executor1 & ex,
37259       endpoint_type & peer_endpoint,
37260       MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
37261       typename enable_if< is_executor< Executor1 >::value >::type *  = 0);
37262   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.async_accept.overload7 more...]]``
37263
37264   template<
37265       typename ExecutionContext,
37266       typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
37267   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_socket_acceptor.async_accept.overload8 async_accept]``(
37268       ExecutionContext & context,
37269       endpoint_type & peer_endpoint,
37270       MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
37271       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
37272   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.async_accept.overload8 more...]]``
37273
37274
37275 [section:overload1 basic_socket_acceptor::async_accept (1 of 8 overloads)]
37276
37277
37278 Start an asynchronous accept. 
37279
37280
37281   template<
37282       typename ``[link boost_asio.reference.Protocol Protocol1]``,
37283       typename ``[link boost_asio.reference.Executor1 Executor1]``,
37284       typename ``[link boost_asio.reference.AcceptHandler AcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
37285   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_accept(
37286       basic_socket< Protocol1, Executor1 > & peer,
37287       AcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
37288       typename enable_if< is_convertible< Protocol, Protocol1 >::value >::type *  = 0);
37289
37290
37291 This function is used to asynchronously accept a new connection into a socket. The function call always returns immediately.
37292
37293
37294 [heading Parameters]
37295     
37296
37297 [variablelist
37298   
37299 [[peer][The socket into which the new connection will be accepted. Ownership of the peer object is retained by the caller, which must guarantee that it is valid until the handler is called.]]
37300
37301 [[handler][The handler to be called when the accept operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
37302 ``
37303    void handler(
37304      const boost::system::error_code& error // Result of operation.
37305    ); 
37306 ``
37307 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
37308
37309 ]
37310
37311
37312 [heading Example]
37313   
37314
37315
37316    void accept_handler(const boost::system::error_code& error)
37317    {
37318      if (!error)
37319      {
37320        // Accept succeeded.
37321      }
37322    }
37323
37324    ...
37325
37326    boost::asio::ip::tcp::acceptor acceptor(my_context);
37327    ...
37328    boost::asio::ip::tcp::socket socket(my_context);
37329    acceptor.async_accept(socket, accept_handler);
37330
37331
37332
37333
37334
37335
37336
37337 [endsect]
37338
37339
37340
37341 [section:overload2 basic_socket_acceptor::async_accept (2 of 8 overloads)]
37342
37343
37344 Start an asynchronous accept. 
37345
37346
37347   template<
37348       typename ``[link boost_asio.reference.Executor1 Executor1]``,
37349       typename ``[link boost_asio.reference.AcceptHandler AcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
37350   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_accept(
37351       basic_socket< protocol_type, Executor1 > & peer,
37352       endpoint_type & peer_endpoint,
37353       AcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
37354
37355
37356 This function is used to asynchronously accept a new connection into a socket, and additionally obtain the endpoint of the remote peer. The function call always returns immediately.
37357
37358
37359 [heading Parameters]
37360     
37361
37362 [variablelist
37363   
37364 [[peer][The socket into which the new connection will be accepted. Ownership of the peer object is retained by the caller, which must guarantee that it is valid until the handler is called.]]
37365
37366 [[peer_endpoint][An endpoint object into which the endpoint of the remote peer will be written. Ownership of the peer\_endpoint object is retained by the caller, which must guarantee that it is valid until the handler is called.]]
37367
37368 [[handler][The handler to be called when the accept operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
37369 ``
37370    void handler(
37371      const boost::system::error_code& error // Result of operation.
37372    ); 
37373 ``
37374 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
37375
37376 ]
37377
37378
37379
37380
37381 [endsect]
37382
37383
37384
37385 [section:overload3 basic_socket_acceptor::async_accept (3 of 8 overloads)]
37386
37387
37388 Start an asynchronous accept. 
37389
37390
37391   template<
37392       typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
37393   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_accept(
37394       MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
37395
37396
37397 This function is used to asynchronously accept a new connection. The function call always returns immediately.
37398
37399 This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
37400
37401
37402 [heading Parameters]
37403     
37404
37405 [variablelist
37406   
37407 [[handler][The handler to be called when the accept operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
37408 ``
37409    void handler(
37410      // Result of operation.
37411      const boost::system::error_code& error,
37412      // On success, the newly accepted socket.
37413      typename Protocol::socket::template
37414        rebind_executor<executor_type>::other peer
37415    ); 
37416 ``
37417 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
37418
37419 ]
37420
37421
37422 [heading Example]
37423   
37424
37425
37426    void accept_handler(const boost::system::error_code& error,
37427        boost::asio::ip::tcp::socket peer)
37428    {
37429      if (!error)
37430      {
37431        // Accept succeeded.
37432      }
37433    }
37434
37435    ...
37436
37437    boost::asio::ip::tcp::acceptor acceptor(my_context);
37438    ...
37439    acceptor.async_accept(accept_handler);
37440
37441
37442
37443
37444
37445
37446
37447 [endsect]
37448
37449
37450
37451 [section:overload4 basic_socket_acceptor::async_accept (4 of 8 overloads)]
37452
37453
37454 Start an asynchronous accept. 
37455
37456
37457   template<
37458       typename ``[link boost_asio.reference.Executor1 Executor1]``,
37459       typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
37460   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_accept(
37461       const Executor1 & ex,
37462       MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
37463       typename enable_if< is_executor< Executor1 >::value >::type *  = 0);
37464
37465
37466 This function is used to asynchronously accept a new connection. The function call always returns immediately.
37467
37468 This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
37469
37470
37471 [heading Parameters]
37472     
37473
37474 [variablelist
37475   
37476 [[ex][The I/O executor object to be used for the newly accepted socket.]]
37477
37478 [[handler][The handler to be called when the accept operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
37479 ``
37480    void handler(
37481      const boost::system::error_code& error, // Result of operation.
37482      typename Protocol::socket::template rebind_executor<
37483        Executor1>::other peer // On success, the newly accepted socket.
37484    ); 
37485 ``
37486 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
37487
37488 ]
37489
37490
37491 [heading Example]
37492   
37493
37494
37495    void accept_handler(const boost::system::error_code& error,
37496        boost::asio::ip::tcp::socket peer)
37497    {
37498      if (!error)
37499      {
37500        // Accept succeeded.
37501      }
37502    }
37503
37504    ...
37505
37506    boost::asio::ip::tcp::acceptor acceptor(my_context);
37507    ...
37508    acceptor.async_accept(my_context2, accept_handler);
37509
37510
37511
37512
37513
37514
37515
37516 [endsect]
37517
37518
37519
37520 [section:overload5 basic_socket_acceptor::async_accept (5 of 8 overloads)]
37521
37522
37523 Start an asynchronous accept. 
37524
37525
37526   template<
37527       typename ExecutionContext,
37528       typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
37529   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_accept(
37530       ExecutionContext & context,
37531       MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
37532       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
37533
37534
37535 This function is used to asynchronously accept a new connection. The function call always returns immediately.
37536
37537 This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
37538
37539
37540 [heading Parameters]
37541     
37542
37543 [variablelist
37544   
37545 [[context][The I/O execution context object to be used for the newly accepted socket.]]
37546
37547 [[handler][The handler to be called when the accept operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
37548 ``
37549    void handler(
37550      const boost::system::error_code& error, // Result of operation.
37551      typename Protocol::socket::template rebind_executor<
37552        typename ExecutionContext::executor_type>::other peer
37553          // On success, the newly accepted socket.
37554    ); 
37555 ``
37556 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
37557
37558 ]
37559
37560
37561 [heading Example]
37562   
37563
37564
37565    void accept_handler(const boost::system::error_code& error,
37566        boost::asio::ip::tcp::socket peer)
37567    {
37568      if (!error)
37569      {
37570        // Accept succeeded.
37571      }
37572    }
37573
37574    ...
37575
37576    boost::asio::ip::tcp::acceptor acceptor(my_context);
37577    ...
37578    acceptor.async_accept(my_context2, accept_handler);
37579
37580
37581
37582
37583
37584
37585
37586 [endsect]
37587
37588
37589
37590 [section:overload6 basic_socket_acceptor::async_accept (6 of 8 overloads)]
37591
37592
37593 Start an asynchronous accept. 
37594
37595
37596   template<
37597       typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
37598   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_accept(
37599       endpoint_type & peer_endpoint,
37600       MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
37601
37602
37603 This function is used to asynchronously accept a new connection. The function call always returns immediately.
37604
37605 This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
37606
37607
37608 [heading Parameters]
37609     
37610
37611 [variablelist
37612   
37613 [[peer_endpoint][An endpoint object into which the endpoint of the remote peer will be written. Ownership of the peer\_endpoint object is retained by the caller, which must guarantee that it is valid until the handler is called.]]
37614
37615 [[handler][The handler to be called when the accept operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
37616 ``
37617    void handler(
37618      // Result of operation.
37619      const boost::system::error_code& error,
37620      // On success, the newly accepted socket.
37621      typename Protocol::socket::template
37622        rebind_executor<executor_type>::other peer
37623    ); 
37624 ``
37625 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
37626
37627 ]
37628
37629
37630 [heading Example]
37631   
37632
37633
37634    void accept_handler(const boost::system::error_code& error,
37635        boost::asio::ip::tcp::socket peer)
37636    {
37637      if (!error)
37638      {
37639        // Accept succeeded.
37640      }
37641    }
37642
37643    ...
37644
37645    boost::asio::ip::tcp::acceptor acceptor(my_context);
37646    ...
37647    boost::asio::ip::tcp::endpoint endpoint;
37648    acceptor.async_accept(endpoint, accept_handler);
37649
37650
37651
37652
37653
37654
37655
37656 [endsect]
37657
37658
37659
37660 [section:overload7 basic_socket_acceptor::async_accept (7 of 8 overloads)]
37661
37662
37663 Start an asynchronous accept. 
37664
37665
37666   template<
37667       typename ``[link boost_asio.reference.Executor1 Executor1]``,
37668       typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
37669   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_accept(
37670       const Executor1 & ex,
37671       endpoint_type & peer_endpoint,
37672       MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
37673       typename enable_if< is_executor< Executor1 >::value >::type *  = 0);
37674
37675
37676 This function is used to asynchronously accept a new connection. The function call always returns immediately.
37677
37678 This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
37679
37680
37681 [heading Parameters]
37682     
37683
37684 [variablelist
37685   
37686 [[ex][The I/O executor object to be used for the newly accepted socket.]]
37687
37688 [[peer_endpoint][An endpoint object into which the endpoint of the remote peer will be written. Ownership of the peer\_endpoint object is retained by the caller, which must guarantee that it is valid until the handler is called.]]
37689
37690 [[handler][The handler to be called when the accept operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
37691 ``
37692    void handler(
37693      const boost::system::error_code& error, // Result of operation.
37694      typename Protocol::socket::template rebind_executor<
37695        Executor1>::other peer // On success, the newly accepted socket.
37696    ); 
37697 ``
37698 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
37699
37700 ]
37701
37702
37703 [heading Example]
37704   
37705
37706
37707    void accept_handler(const boost::system::error_code& error,
37708        boost::asio::ip::tcp::socket peer)
37709    {
37710      if (!error)
37711      {
37712        // Accept succeeded.
37713      }
37714    }
37715
37716    ...
37717
37718    boost::asio::ip::tcp::acceptor acceptor(my_context);
37719    ...
37720    boost::asio::ip::tcp::endpoint endpoint;
37721    acceptor.async_accept(my_context2, endpoint, accept_handler);
37722
37723
37724
37725
37726
37727
37728
37729 [endsect]
37730
37731
37732
37733 [section:overload8 basic_socket_acceptor::async_accept (8 of 8 overloads)]
37734
37735
37736 Start an asynchronous accept. 
37737
37738
37739   template<
37740       typename ExecutionContext,
37741       typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
37742   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_accept(
37743       ExecutionContext & context,
37744       endpoint_type & peer_endpoint,
37745       MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
37746       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
37747
37748
37749 This function is used to asynchronously accept a new connection. The function call always returns immediately.
37750
37751 This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
37752
37753
37754 [heading Parameters]
37755     
37756
37757 [variablelist
37758   
37759 [[context][The I/O execution context object to be used for the newly accepted socket.]]
37760
37761 [[peer_endpoint][An endpoint object into which the endpoint of the remote peer will be written. Ownership of the peer\_endpoint object is retained by the caller, which must guarantee that it is valid until the handler is called.]]
37762
37763 [[handler][The handler to be called when the accept operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
37764 ``
37765    void handler(
37766      const boost::system::error_code& error, // Result of operation.
37767      typename Protocol::socket::template rebind_executor<
37768        typename ExecutionContext::executor_type>::other peer
37769          // On success, the newly accepted socket.
37770    ); 
37771 ``
37772 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
37773
37774 ]
37775
37776
37777 [heading Example]
37778   
37779
37780
37781    void accept_handler(const boost::system::error_code& error,
37782        boost::asio::ip::tcp::socket peer)
37783    {
37784      if (!error)
37785      {
37786        // Accept succeeded.
37787      }
37788    }
37789
37790    ...
37791
37792    boost::asio::ip::tcp::acceptor acceptor(my_context);
37793    ...
37794    boost::asio::ip::tcp::endpoint endpoint;
37795    acceptor.async_accept(my_context2, endpoint, accept_handler);
37796
37797
37798
37799
37800
37801
37802
37803 [endsect]
37804
37805
37806 [endsect]
37807
37808
37809 [section:async_wait basic_socket_acceptor::async_wait]
37810
37811 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.async_wait..async_wait..basic_socket_acceptor] 
37812 Asynchronously wait for the acceptor to become ready to read, ready to write, or to have pending error conditions. 
37813
37814
37815   template<
37816       typename ``[link boost_asio.reference.WaitHandler WaitHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
37817   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait(
37818       wait_type w,
37819       WaitHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
37820
37821
37822 This function is used to perform an asynchronous wait for an acceptor to enter a ready to read, write or error condition state.
37823
37824
37825 [heading Parameters]
37826     
37827
37828 [variablelist
37829   
37830 [[w][Specifies the desired acceptor state.]]
37831
37832 [[handler][The handler to be called when the wait operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
37833 ``
37834    void handler(
37835      const boost::system::error_code& error // Result of operation
37836    ); 
37837 ``
37838 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
37839
37840 ]
37841
37842
37843 [heading Example]
37844   
37845
37846
37847    void wait_handler(const boost::system::error_code& error)
37848    {
37849      if (!error)
37850      {
37851        // Wait succeeded.
37852      }
37853    }
37854
37855    ...
37856
37857    boost::asio::ip::tcp::acceptor acceptor(my_context);
37858    ...
37859    acceptor.async_wait(
37860        boost::asio::ip::tcp::acceptor::wait_read,
37861        wait_handler);
37862
37863
37864
37865
37866
37867
37868
37869 [endsect]
37870
37871
37872 [section:basic_socket_acceptor basic_socket_acceptor::basic_socket_acceptor]
37873
37874 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.basic_socket_acceptor..basic_socket_acceptor..basic_socket_acceptor] 
37875 Construct an acceptor without opening it. 
37876
37877
37878   explicit ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload1 basic_socket_acceptor]``(
37879       const executor_type & ex);
37880   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload1 more...]]``
37881
37882   template<
37883       typename ExecutionContext>
37884   explicit ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload2 basic_socket_acceptor]``(
37885       ExecutionContext & context,
37886       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
37887   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload2 more...]]``
37888
37889
37890 Construct an open acceptor. 
37891
37892
37893   ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload3 basic_socket_acceptor]``(
37894       const executor_type & ex,
37895       const protocol_type & protocol);
37896   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload3 more...]]``
37897
37898   template<
37899       typename ExecutionContext>
37900   ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload4 basic_socket_acceptor]``(
37901       ExecutionContext & context,
37902       const protocol_type & protocol,
37903       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
37904   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload4 more...]]``
37905
37906
37907 Construct an acceptor opened on the given endpoint. 
37908
37909
37910   ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload5 basic_socket_acceptor]``(
37911       const executor_type & ex,
37912       const endpoint_type & endpoint,
37913       bool reuse_addr = true);
37914   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload5 more...]]``
37915
37916   template<
37917       typename ExecutionContext>
37918   ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload6 basic_socket_acceptor]``(
37919       ExecutionContext & context,
37920       const endpoint_type & endpoint,
37921       bool reuse_addr = true,
37922       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
37923   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload6 more...]]``
37924
37925
37926 Construct a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] on an existing native acceptor. 
37927
37928
37929   ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload7 basic_socket_acceptor]``(
37930       const executor_type & ex,
37931       const protocol_type & protocol,
37932       const native_handle_type & native_acceptor);
37933   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload7 more...]]``
37934
37935   template<
37936       typename ExecutionContext>
37937   ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload8 basic_socket_acceptor]``(
37938       ExecutionContext & context,
37939       const protocol_type & protocol,
37940       const native_handle_type & native_acceptor,
37941       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
37942   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload8 more...]]``
37943
37944
37945 Move-construct a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] from another. 
37946
37947
37948   ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload9 basic_socket_acceptor]``(
37949       basic_socket_acceptor && other);
37950   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload9 more...]]``
37951
37952
37953 Move-construct a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] from an acceptor of another protocol type. 
37954
37955
37956   template<
37957       typename ``[link boost_asio.reference.Protocol Protocol1]``,
37958       typename ``[link boost_asio.reference.Executor1 Executor1]``>
37959   ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload10 basic_socket_acceptor]``(
37960       basic_socket_acceptor< Protocol1, Executor1 > && other,
37961       typename enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type *  = 0);
37962   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload10 more...]]``
37963
37964
37965 [section:overload1 basic_socket_acceptor::basic_socket_acceptor (1 of 10 overloads)]
37966
37967
37968 Construct an acceptor without opening it. 
37969
37970
37971   basic_socket_acceptor(
37972       const executor_type & ex);
37973
37974
37975 This constructor creates an acceptor without opening it to listen for new connections. The `open()` function must be called before the acceptor can accept new socket connections.
37976
37977
37978 [heading Parameters]
37979     
37980
37981 [variablelist
37982   
37983 [[ex][The I/O executor that the acceptor will use, by default, to dispatch handlers for any asynchronous operations performed on the acceptor. ]]
37984
37985 ]
37986
37987
37988
37989
37990 [endsect]
37991
37992
37993
37994 [section:overload2 basic_socket_acceptor::basic_socket_acceptor (2 of 10 overloads)]
37995
37996
37997 Construct an acceptor without opening it. 
37998
37999
38000   template<
38001       typename ExecutionContext>
38002   basic_socket_acceptor(
38003       ExecutionContext & context,
38004       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
38005
38006
38007 This constructor creates an acceptor without opening it to listen for new connections. The `open()` function must be called before the acceptor can accept new socket connections.
38008
38009
38010 [heading Parameters]
38011     
38012
38013 [variablelist
38014   
38015 [[context][An execution context which provides the I/O executor that the acceptor will use, by default, to dispatch handlers for any asynchronous operations performed on the acceptor. ]]
38016
38017 ]
38018
38019
38020
38021
38022 [endsect]
38023
38024
38025
38026 [section:overload3 basic_socket_acceptor::basic_socket_acceptor (3 of 10 overloads)]
38027
38028
38029 Construct an open acceptor. 
38030
38031
38032   basic_socket_acceptor(
38033       const executor_type & ex,
38034       const protocol_type & protocol);
38035
38036
38037 This constructor creates an acceptor and automatically opens it.
38038
38039
38040 [heading Parameters]
38041     
38042
38043 [variablelist
38044   
38045 [[ex][The I/O executor that the acceptor will use, by default, to dispatch handlers for any asynchronous operations performed on the acceptor.]]
38046
38047 [[protocol][An object specifying protocol parameters to be used.]]
38048
38049 ]
38050
38051
38052 [heading Exceptions]
38053     
38054
38055 [variablelist
38056   
38057 [[boost::system::system_error][Thrown on failure. ]]
38058
38059 ]
38060
38061
38062
38063
38064 [endsect]
38065
38066
38067
38068 [section:overload4 basic_socket_acceptor::basic_socket_acceptor (4 of 10 overloads)]
38069
38070
38071 Construct an open acceptor. 
38072
38073
38074   template<
38075       typename ExecutionContext>
38076   basic_socket_acceptor(
38077       ExecutionContext & context,
38078       const protocol_type & protocol,
38079       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
38080
38081
38082 This constructor creates an acceptor and automatically opens it.
38083
38084
38085 [heading Parameters]
38086     
38087
38088 [variablelist
38089   
38090 [[context][An execution context which provides the I/O executor that the acceptor will use, by default, to dispatch handlers for any asynchronous operations performed on the acceptor.]]
38091
38092 [[protocol][An object specifying protocol parameters to be used.]]
38093
38094 ]
38095
38096
38097 [heading Exceptions]
38098     
38099
38100 [variablelist
38101   
38102 [[boost::system::system_error][Thrown on failure. ]]
38103
38104 ]
38105
38106
38107
38108
38109 [endsect]
38110
38111
38112
38113 [section:overload5 basic_socket_acceptor::basic_socket_acceptor (5 of 10 overloads)]
38114
38115
38116 Construct an acceptor opened on the given endpoint. 
38117
38118
38119   basic_socket_acceptor(
38120       const executor_type & ex,
38121       const endpoint_type & endpoint,
38122       bool reuse_addr = true);
38123
38124
38125 This constructor creates an acceptor and automatically opens it to listen for new connections on the specified endpoint.
38126
38127
38128 [heading Parameters]
38129     
38130
38131 [variablelist
38132   
38133 [[ex][The I/O executor that the acceptor will use, by default, to dispatch handlers for any asynchronous operations performed on the acceptor.]]
38134
38135 [[endpoint][An endpoint on the local machine on which the acceptor will listen for new connections.]]
38136
38137 [[reuse_addr][Whether the constructor should set the socket option `socket_base::reuse_address`.]]
38138
38139 ]
38140
38141
38142 [heading Exceptions]
38143     
38144
38145 [variablelist
38146   
38147 [[boost::system::system_error][Thrown on failure.]]
38148
38149 ]
38150
38151
38152 [heading Remarks]
38153       
38154 This constructor is equivalent to the following code: 
38155
38156    basic_socket_acceptor<Protocol> acceptor(my_context);
38157    acceptor.open(endpoint.protocol());
38158    if (reuse_addr)
38159      acceptor.set_option(socket_base::reuse_address(true));
38160    acceptor.bind(endpoint);
38161    acceptor.listen();
38162
38163
38164
38165
38166
38167
38168
38169 [endsect]
38170
38171
38172
38173 [section:overload6 basic_socket_acceptor::basic_socket_acceptor (6 of 10 overloads)]
38174
38175
38176 Construct an acceptor opened on the given endpoint. 
38177
38178
38179   template<
38180       typename ExecutionContext>
38181   basic_socket_acceptor(
38182       ExecutionContext & context,
38183       const endpoint_type & endpoint,
38184       bool reuse_addr = true,
38185       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
38186
38187
38188 This constructor creates an acceptor and automatically opens it to listen for new connections on the specified endpoint.
38189
38190
38191 [heading Parameters]
38192     
38193
38194 [variablelist
38195   
38196 [[context][An execution context which provides the I/O executor that the acceptor will use, by default, to dispatch handlers for any asynchronous operations performed on the acceptor.]]
38197
38198 [[endpoint][An endpoint on the local machine on which the acceptor will listen for new connections.]]
38199
38200 [[reuse_addr][Whether the constructor should set the socket option `socket_base::reuse_address`.]]
38201
38202 ]
38203
38204
38205 [heading Exceptions]
38206     
38207
38208 [variablelist
38209   
38210 [[boost::system::system_error][Thrown on failure.]]
38211
38212 ]
38213
38214
38215 [heading Remarks]
38216       
38217 This constructor is equivalent to the following code: 
38218
38219    basic_socket_acceptor<Protocol> acceptor(my_context);
38220    acceptor.open(endpoint.protocol());
38221    if (reuse_addr)
38222      acceptor.set_option(socket_base::reuse_address(true));
38223    acceptor.bind(endpoint);
38224    acceptor.listen();
38225
38226
38227
38228
38229
38230
38231
38232 [endsect]
38233
38234
38235
38236 [section:overload7 basic_socket_acceptor::basic_socket_acceptor (7 of 10 overloads)]
38237
38238
38239 Construct a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] on an existing native acceptor. 
38240
38241
38242   basic_socket_acceptor(
38243       const executor_type & ex,
38244       const protocol_type & protocol,
38245       const native_handle_type & native_acceptor);
38246
38247
38248 This constructor creates an acceptor object to hold an existing native acceptor.
38249
38250
38251 [heading Parameters]
38252     
38253
38254 [variablelist
38255   
38256 [[ex][The I/O executor that the acceptor will use, by default, to dispatch handlers for any asynchronous operations performed on the acceptor.]]
38257
38258 [[protocol][An object specifying protocol parameters to be used.]]
38259
38260 [[native_acceptor][A native acceptor.]]
38261
38262 ]
38263
38264
38265 [heading Exceptions]
38266     
38267
38268 [variablelist
38269   
38270 [[boost::system::system_error][Thrown on failure. ]]
38271
38272 ]
38273
38274
38275
38276
38277 [endsect]
38278
38279
38280
38281 [section:overload8 basic_socket_acceptor::basic_socket_acceptor (8 of 10 overloads)]
38282
38283
38284 Construct a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] on an existing native acceptor. 
38285
38286
38287   template<
38288       typename ExecutionContext>
38289   basic_socket_acceptor(
38290       ExecutionContext & context,
38291       const protocol_type & protocol,
38292       const native_handle_type & native_acceptor,
38293       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
38294
38295
38296 This constructor creates an acceptor object to hold an existing native acceptor.
38297
38298
38299 [heading Parameters]
38300     
38301
38302 [variablelist
38303   
38304 [[context][An execution context which provides the I/O executor that the acceptor will use, by default, to dispatch handlers for any asynchronous operations performed on the acceptor.]]
38305
38306 [[protocol][An object specifying protocol parameters to be used.]]
38307
38308 [[native_acceptor][A native acceptor.]]
38309
38310 ]
38311
38312
38313 [heading Exceptions]
38314     
38315
38316 [variablelist
38317   
38318 [[boost::system::system_error][Thrown on failure. ]]
38319
38320 ]
38321
38322
38323
38324
38325 [endsect]
38326
38327
38328
38329 [section:overload9 basic_socket_acceptor::basic_socket_acceptor (9 of 10 overloads)]
38330
38331
38332 Move-construct a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] from another. 
38333
38334
38335   basic_socket_acceptor(
38336       basic_socket_acceptor && other);
38337
38338
38339 This constructor moves an acceptor from one object to another.
38340
38341
38342 [heading Parameters]
38343     
38344
38345 [variablelist
38346   
38347 [[other][The other [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] object from which the move will occur.]]
38348
38349 ]
38350
38351
38352 [heading Remarks]
38353       
38354 Following the move, the moved-from object is in the same state as if constructed using the `basic_socket_acceptor(const executor_type&)` constructor. 
38355
38356
38357
38358
38359 [endsect]
38360
38361
38362
38363 [section:overload10 basic_socket_acceptor::basic_socket_acceptor (10 of 10 overloads)]
38364
38365
38366 Move-construct a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] from an acceptor of another protocol type. 
38367
38368
38369   template<
38370       typename ``[link boost_asio.reference.Protocol Protocol1]``,
38371       typename ``[link boost_asio.reference.Executor1 Executor1]``>
38372   basic_socket_acceptor(
38373       basic_socket_acceptor< Protocol1, Executor1 > && other,
38374       typename enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type *  = 0);
38375
38376
38377 This constructor moves an acceptor from one object to another.
38378
38379
38380 [heading Parameters]
38381     
38382
38383 [variablelist
38384   
38385 [[other][The other [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] object from which the move will occur.]]
38386
38387 ]
38388
38389
38390 [heading Remarks]
38391       
38392 Following the move, the moved-from object is in the same state as if constructed using the `basic_socket_acceptor(const executor_type&)` constructor. 
38393
38394
38395
38396
38397 [endsect]
38398
38399
38400 [endsect]
38401
38402 [section:bind basic_socket_acceptor::bind]
38403
38404 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.bind..bind..basic_socket_acceptor] 
38405 Bind the acceptor to the given local endpoint. 
38406
38407
38408   void ``[link boost_asio.reference.basic_socket_acceptor.bind.overload1 bind]``(
38409       const endpoint_type & endpoint);
38410   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.bind.overload1 more...]]``
38411
38412   void ``[link boost_asio.reference.basic_socket_acceptor.bind.overload2 bind]``(
38413       const endpoint_type & endpoint,
38414       boost::system::error_code & ec);
38415   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.bind.overload2 more...]]``
38416
38417
38418 [section:overload1 basic_socket_acceptor::bind (1 of 2 overloads)]
38419
38420
38421 Bind the acceptor to the given local endpoint. 
38422
38423
38424   void bind(
38425       const endpoint_type & endpoint);
38426
38427
38428 This function binds the socket acceptor to the specified endpoint on the local machine.
38429
38430
38431 [heading Parameters]
38432     
38433
38434 [variablelist
38435   
38436 [[endpoint][An endpoint on the local machine to which the socket acceptor will be bound.]]
38437
38438 ]
38439
38440
38441 [heading Exceptions]
38442     
38443
38444 [variablelist
38445   
38446 [[boost::system::system_error][Thrown on failure.]]
38447
38448 ]
38449
38450
38451 [heading Example]
38452   
38453
38454
38455    boost::asio::ip::tcp::acceptor acceptor(my_context);
38456    boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), 12345);
38457    acceptor.open(endpoint.protocol());
38458    acceptor.bind(endpoint);
38459
38460
38461
38462
38463
38464
38465
38466 [endsect]
38467
38468
38469
38470 [section:overload2 basic_socket_acceptor::bind (2 of 2 overloads)]
38471
38472
38473 Bind the acceptor to the given local endpoint. 
38474
38475
38476   void bind(
38477       const endpoint_type & endpoint,
38478       boost::system::error_code & ec);
38479
38480
38481 This function binds the socket acceptor to the specified endpoint on the local machine.
38482
38483
38484 [heading Parameters]
38485     
38486
38487 [variablelist
38488   
38489 [[endpoint][An endpoint on the local machine to which the socket acceptor will be bound.]]
38490
38491 [[ec][Set to indicate what error occurred, if any.]]
38492
38493 ]
38494
38495
38496 [heading Example]
38497   
38498
38499
38500    boost::asio::ip::tcp::acceptor acceptor(my_context);
38501    boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), 12345);
38502    acceptor.open(endpoint.protocol());
38503    boost::system::error_code ec;
38504    acceptor.bind(endpoint, ec);
38505    if (ec)
38506    {
38507      // An error occurred.
38508    }
38509
38510
38511
38512
38513
38514
38515
38516 [endsect]
38517
38518
38519 [endsect]
38520
38521
38522 [section:broadcast basic_socket_acceptor::broadcast]
38523
38524
38525 ['Inherited from socket_base.]
38526
38527 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.broadcast..broadcast..basic_socket_acceptor] 
38528 Socket option to permit sending of broadcast messages. 
38529
38530
38531   typedef implementation_defined broadcast;
38532
38533
38534
38535 Implements the SOL\_SOCKET/SO\_BROADCAST socket option.
38536
38537
38538 [heading Examples]
38539   
38540 Setting the option: 
38541
38542    boost::asio::ip::udp::socket socket(my_context);
38543    ...
38544    boost::asio::socket_base::broadcast option(true);
38545    socket.set_option(option);
38546
38547
38548
38549
38550
38551 Getting the current option value: 
38552
38553    boost::asio::ip::udp::socket socket(my_context);
38554    ...
38555    boost::asio::socket_base::broadcast option;
38556    socket.get_option(option);
38557    bool is_set = option.value();
38558
38559
38560
38561
38562
38563
38564
38565 [heading Requirements]
38566
38567 ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
38568
38569 ['Convenience header: ][^boost/asio.hpp]
38570
38571
38572 [endsect]
38573
38574
38575
38576 [section:bytes_readable basic_socket_acceptor::bytes_readable]
38577
38578
38579 ['Inherited from socket_base.]
38580
38581 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.bytes_readable..bytes_readable..basic_socket_acceptor] 
38582 IO control command to get the amount of data that can be read without blocking. 
38583
38584
38585   typedef implementation_defined bytes_readable;
38586
38587
38588
38589 Implements the FIONREAD IO control command.
38590
38591
38592 [heading Example]
38593   
38594
38595
38596    boost::asio::ip::tcp::socket socket(my_context);
38597    ...
38598    boost::asio::socket_base::bytes_readable command(true);
38599    socket.io_control(command);
38600    std::size_t bytes_readable = command.get();
38601
38602
38603
38604
38605
38606
38607
38608 [heading Requirements]
38609
38610 ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
38611
38612 ['Convenience header: ][^boost/asio.hpp]
38613
38614
38615 [endsect]
38616
38617
38618 [section:cancel basic_socket_acceptor::cancel]
38619
38620 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.cancel..cancel..basic_socket_acceptor] 
38621 Cancel all asynchronous operations associated with the acceptor. 
38622
38623
38624   void ``[link boost_asio.reference.basic_socket_acceptor.cancel.overload1 cancel]``();
38625   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.cancel.overload1 more...]]``
38626
38627   void ``[link boost_asio.reference.basic_socket_acceptor.cancel.overload2 cancel]``(
38628       boost::system::error_code & ec);
38629   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.cancel.overload2 more...]]``
38630
38631
38632 [section:overload1 basic_socket_acceptor::cancel (1 of 2 overloads)]
38633
38634
38635 Cancel all asynchronous operations associated with the acceptor. 
38636
38637
38638   void cancel();
38639
38640
38641 This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
38642
38643
38644 [heading Exceptions]
38645     
38646
38647 [variablelist
38648   
38649 [[boost::system::system_error][Thrown on failure. ]]
38650
38651 ]
38652
38653
38654
38655
38656 [endsect]
38657
38658
38659
38660 [section:overload2 basic_socket_acceptor::cancel (2 of 2 overloads)]
38661
38662
38663 Cancel all asynchronous operations associated with the acceptor. 
38664
38665
38666   void cancel(
38667       boost::system::error_code & ec);
38668
38669
38670 This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
38671
38672
38673 [heading Parameters]
38674     
38675
38676 [variablelist
38677   
38678 [[ec][Set to indicate what error occurred, if any. ]]
38679
38680 ]
38681
38682
38683
38684
38685 [endsect]
38686
38687
38688 [endsect]
38689
38690 [section:close basic_socket_acceptor::close]
38691
38692 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.close..close..basic_socket_acceptor] 
38693 Close the acceptor. 
38694
38695
38696   void ``[link boost_asio.reference.basic_socket_acceptor.close.overload1 close]``();
38697   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.close.overload1 more...]]``
38698
38699   void ``[link boost_asio.reference.basic_socket_acceptor.close.overload2 close]``(
38700       boost::system::error_code & ec);
38701   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.close.overload2 more...]]``
38702
38703
38704 [section:overload1 basic_socket_acceptor::close (1 of 2 overloads)]
38705
38706
38707 Close the acceptor. 
38708
38709
38710   void close();
38711
38712
38713 This function is used to close the acceptor. Any asynchronous accept operations will be cancelled immediately.
38714
38715 A subsequent call to `open()` is required before the acceptor can again be used to again perform socket accept operations.
38716
38717
38718 [heading Exceptions]
38719     
38720
38721 [variablelist
38722   
38723 [[boost::system::system_error][Thrown on failure. ]]
38724
38725 ]
38726
38727
38728
38729
38730 [endsect]
38731
38732
38733
38734 [section:overload2 basic_socket_acceptor::close (2 of 2 overloads)]
38735
38736
38737 Close the acceptor. 
38738
38739
38740   void close(
38741       boost::system::error_code & ec);
38742
38743
38744 This function is used to close the acceptor. Any asynchronous accept operations will be cancelled immediately.
38745
38746 A subsequent call to `open()` is required before the acceptor can again be used to again perform socket accept operations.
38747
38748
38749 [heading Parameters]
38750     
38751
38752 [variablelist
38753   
38754 [[ec][Set to indicate what error occurred, if any.]]
38755
38756 ]
38757
38758
38759 [heading Example]
38760   
38761
38762
38763    boost::asio::ip::tcp::acceptor acceptor(my_context);
38764    ...
38765    boost::system::error_code ec;
38766    acceptor.close(ec);
38767    if (ec)
38768    {
38769      // An error occurred.
38770    }
38771
38772
38773
38774
38775
38776
38777
38778 [endsect]
38779
38780
38781 [endsect]
38782
38783
38784 [section:debug basic_socket_acceptor::debug]
38785
38786
38787 ['Inherited from socket_base.]
38788
38789 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.debug..debug..basic_socket_acceptor] 
38790 Socket option to enable socket-level debugging. 
38791
38792
38793   typedef implementation_defined debug;
38794
38795
38796
38797 Implements the SOL\_SOCKET/SO\_DEBUG socket option.
38798
38799
38800 [heading Examples]
38801   
38802 Setting the option: 
38803
38804    boost::asio::ip::tcp::socket socket(my_context);
38805    ...
38806    boost::asio::socket_base::debug option(true);
38807    socket.set_option(option);
38808
38809
38810
38811
38812
38813 Getting the current option value: 
38814
38815    boost::asio::ip::tcp::socket socket(my_context);
38816    ...
38817    boost::asio::socket_base::debug option;
38818    socket.get_option(option);
38819    bool is_set = option.value();
38820
38821
38822
38823
38824
38825
38826
38827 [heading Requirements]
38828
38829 ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
38830
38831 ['Convenience header: ][^boost/asio.hpp]
38832
38833
38834 [endsect]
38835
38836
38837
38838 [section:do_not_route basic_socket_acceptor::do_not_route]
38839
38840
38841 ['Inherited from socket_base.]
38842
38843 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.do_not_route..do_not_route..basic_socket_acceptor] 
38844 Socket option to prevent routing, use local interfaces only. 
38845
38846
38847   typedef implementation_defined do_not_route;
38848
38849
38850
38851 Implements the SOL\_SOCKET/SO\_DONTROUTE socket option.
38852
38853
38854 [heading Examples]
38855   
38856 Setting the option: 
38857
38858    boost::asio::ip::udp::socket socket(my_context);
38859    ...
38860    boost::asio::socket_base::do_not_route option(true);
38861    socket.set_option(option);
38862
38863
38864
38865
38866
38867 Getting the current option value: 
38868
38869    boost::asio::ip::udp::socket socket(my_context);
38870    ...
38871    boost::asio::socket_base::do_not_route option;
38872    socket.get_option(option);
38873    bool is_set = option.value();
38874
38875
38876
38877
38878
38879
38880
38881 [heading Requirements]
38882
38883 ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
38884
38885 ['Convenience header: ][^boost/asio.hpp]
38886
38887
38888 [endsect]
38889
38890
38891
38892 [section:enable_connection_aborted basic_socket_acceptor::enable_connection_aborted]
38893
38894
38895 ['Inherited from socket_base.]
38896
38897 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.enable_connection_aborted..enable_connection_aborted..basic_socket_acceptor] 
38898 Socket option to report aborted connections on accept. 
38899
38900
38901   typedef implementation_defined enable_connection_aborted;
38902
38903
38904
38905 Implements a custom socket option that determines whether or not an accept operation is permitted to fail with `boost::asio::error::connection_aborted`. By default the option is false.
38906
38907
38908 [heading Examples]
38909   
38910 Setting the option: 
38911
38912    boost::asio::ip::tcp::acceptor acceptor(my_context);
38913    ...
38914    boost::asio::socket_base::enable_connection_aborted option(true);
38915    acceptor.set_option(option);
38916
38917
38918
38919
38920
38921 Getting the current option value: 
38922
38923    boost::asio::ip::tcp::acceptor acceptor(my_context);
38924    ...
38925    boost::asio::socket_base::enable_connection_aborted option;
38926    acceptor.get_option(option);
38927    bool is_set = option.value();
38928
38929
38930
38931
38932
38933
38934
38935 [heading Requirements]
38936
38937 ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
38938
38939 ['Convenience header: ][^boost/asio.hpp]
38940
38941
38942 [endsect]
38943
38944
38945
38946 [section:endpoint_type basic_socket_acceptor::endpoint_type]
38947
38948 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.endpoint_type..endpoint_type..basic_socket_acceptor] 
38949 The endpoint type. 
38950
38951
38952   typedef Protocol::endpoint endpoint_type;
38953
38954
38955
38956 [heading Requirements]
38957
38958 ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
38959
38960 ['Convenience header: ][^boost/asio.hpp]
38961
38962
38963 [endsect]
38964
38965
38966
38967 [section:executor_type basic_socket_acceptor::executor_type]
38968
38969 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.executor_type..executor_type..basic_socket_acceptor] 
38970 The type of the executor associated with the object. 
38971
38972
38973   typedef Executor executor_type;
38974
38975
38976
38977 [heading Requirements]
38978
38979 ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
38980
38981 ['Convenience header: ][^boost/asio.hpp]
38982
38983
38984 [endsect]
38985
38986
38987
38988 [section:get_executor basic_socket_acceptor::get_executor]
38989
38990 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.get_executor..get_executor..basic_socket_acceptor] 
38991 Get the executor associated with the object. 
38992
38993
38994   executor_type get_executor();
38995
38996
38997
38998 [endsect]
38999
39000
39001 [section:get_option basic_socket_acceptor::get_option]
39002
39003 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.get_option..get_option..basic_socket_acceptor] 
39004 Get an option from the acceptor. 
39005
39006
39007   template<
39008       typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
39009   void ``[link boost_asio.reference.basic_socket_acceptor.get_option.overload1 get_option]``(
39010       GettableSocketOption & option) const;
39011   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.get_option.overload1 more...]]``
39012
39013   template<
39014       typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
39015   void ``[link boost_asio.reference.basic_socket_acceptor.get_option.overload2 get_option]``(
39016       GettableSocketOption & option,
39017       boost::system::error_code & ec) const;
39018   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.get_option.overload2 more...]]``
39019
39020
39021 [section:overload1 basic_socket_acceptor::get_option (1 of 2 overloads)]
39022
39023
39024 Get an option from the acceptor. 
39025
39026
39027   template<
39028       typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
39029   void get_option(
39030       GettableSocketOption & option) const;
39031
39032
39033 This function is used to get the current value of an option on the acceptor.
39034
39035
39036 [heading Parameters]
39037     
39038
39039 [variablelist
39040   
39041 [[option][The option value to be obtained from the acceptor.]]
39042
39043 ]
39044
39045
39046 [heading Exceptions]
39047     
39048
39049 [variablelist
39050   
39051 [[boost::system::system_error][Thrown on failure.]]
39052
39053 ]
39054
39055
39056
39057 [heading Example]
39058   
39059 Getting the value of the SOL\_SOCKET/SO\_REUSEADDR option: 
39060
39061    boost::asio::ip::tcp::acceptor acceptor(my_context);
39062    ...
39063    boost::asio::ip::tcp::acceptor::reuse_address option;
39064    acceptor.get_option(option);
39065    bool is_set = option.get();
39066
39067
39068
39069
39070
39071
39072
39073 [endsect]
39074
39075
39076
39077 [section:overload2 basic_socket_acceptor::get_option (2 of 2 overloads)]
39078
39079
39080 Get an option from the acceptor. 
39081
39082
39083   template<
39084       typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
39085   void get_option(
39086       GettableSocketOption & option,
39087       boost::system::error_code & ec) const;
39088
39089
39090 This function is used to get the current value of an option on the acceptor.
39091
39092
39093 [heading Parameters]
39094     
39095
39096 [variablelist
39097   
39098 [[option][The option value to be obtained from the acceptor.]]
39099
39100 [[ec][Set to indicate what error occurred, if any.]]
39101
39102 ]
39103
39104
39105
39106 [heading Example]
39107   
39108 Getting the value of the SOL\_SOCKET/SO\_REUSEADDR option: 
39109
39110    boost::asio::ip::tcp::acceptor acceptor(my_context);
39111    ...
39112    boost::asio::ip::tcp::acceptor::reuse_address option;
39113    boost::system::error_code ec;
39114    acceptor.get_option(option, ec);
39115    if (ec)
39116    {
39117      // An error occurred.
39118    }
39119    bool is_set = option.get();
39120
39121
39122
39123
39124
39125
39126
39127 [endsect]
39128
39129
39130 [endsect]
39131
39132 [section:io_control basic_socket_acceptor::io_control]
39133
39134 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.io_control..io_control..basic_socket_acceptor] 
39135 Perform an IO control command on the acceptor. 
39136
39137
39138   template<
39139       typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
39140   void ``[link boost_asio.reference.basic_socket_acceptor.io_control.overload1 io_control]``(
39141       IoControlCommand & command);
39142   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.io_control.overload1 more...]]``
39143
39144   template<
39145       typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
39146   void ``[link boost_asio.reference.basic_socket_acceptor.io_control.overload2 io_control]``(
39147       IoControlCommand & command,
39148       boost::system::error_code & ec);
39149   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.io_control.overload2 more...]]``
39150
39151
39152 [section:overload1 basic_socket_acceptor::io_control (1 of 2 overloads)]
39153
39154
39155 Perform an IO control command on the acceptor. 
39156
39157
39158   template<
39159       typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
39160   void io_control(
39161       IoControlCommand & command);
39162
39163
39164 This function is used to execute an IO control command on the acceptor.
39165
39166
39167 [heading Parameters]
39168     
39169
39170 [variablelist
39171   
39172 [[command][The IO control command to be performed on the acceptor.]]
39173
39174 ]
39175
39176
39177 [heading Exceptions]
39178     
39179
39180 [variablelist
39181   
39182 [[boost::system::system_error][Thrown on failure.]]
39183
39184 ]
39185
39186
39187
39188 [heading Example]
39189   
39190 Getting the number of bytes ready to read: 
39191
39192    boost::asio::ip::tcp::acceptor acceptor(my_context);
39193    ...
39194    boost::asio::ip::tcp::acceptor::non_blocking_io command(true);
39195    socket.io_control(command);
39196
39197
39198
39199
39200
39201
39202
39203 [endsect]
39204
39205
39206
39207 [section:overload2 basic_socket_acceptor::io_control (2 of 2 overloads)]
39208
39209
39210 Perform an IO control command on the acceptor. 
39211
39212
39213   template<
39214       typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
39215   void io_control(
39216       IoControlCommand & command,
39217       boost::system::error_code & ec);
39218
39219
39220 This function is used to execute an IO control command on the acceptor.
39221
39222
39223 [heading Parameters]
39224     
39225
39226 [variablelist
39227   
39228 [[command][The IO control command to be performed on the acceptor.]]
39229
39230 [[ec][Set to indicate what error occurred, if any.]]
39231
39232 ]
39233
39234
39235
39236 [heading Example]
39237   
39238 Getting the number of bytes ready to read: 
39239
39240    boost::asio::ip::tcp::acceptor acceptor(my_context);
39241    ...
39242    boost::asio::ip::tcp::acceptor::non_blocking_io command(true);
39243    boost::system::error_code ec;
39244    socket.io_control(command, ec);
39245    if (ec)
39246    {
39247      // An error occurred.
39248    }
39249
39250
39251
39252
39253
39254
39255
39256 [endsect]
39257
39258
39259 [endsect]
39260
39261
39262 [section:is_open basic_socket_acceptor::is_open]
39263
39264 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.is_open..is_open..basic_socket_acceptor] 
39265 Determine whether the acceptor is open. 
39266
39267
39268   bool is_open() const;
39269
39270
39271
39272 [endsect]
39273
39274
39275
39276 [section:keep_alive basic_socket_acceptor::keep_alive]
39277
39278
39279 ['Inherited from socket_base.]
39280
39281 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.keep_alive..keep_alive..basic_socket_acceptor] 
39282 Socket option to send keep-alives. 
39283
39284
39285   typedef implementation_defined keep_alive;
39286
39287
39288
39289 Implements the SOL\_SOCKET/SO\_KEEPALIVE socket option.
39290
39291
39292 [heading Examples]
39293   
39294 Setting the option: 
39295
39296    boost::asio::ip::tcp::socket socket(my_context);
39297    ...
39298    boost::asio::socket_base::keep_alive option(true);
39299    socket.set_option(option);
39300
39301
39302
39303
39304
39305 Getting the current option value: 
39306
39307    boost::asio::ip::tcp::socket socket(my_context);
39308    ...
39309    boost::asio::socket_base::keep_alive option;
39310    socket.get_option(option);
39311    bool is_set = option.value();
39312
39313
39314
39315
39316
39317
39318
39319 [heading Requirements]
39320
39321 ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
39322
39323 ['Convenience header: ][^boost/asio.hpp]
39324
39325
39326 [endsect]
39327
39328
39329
39330 [section:linger basic_socket_acceptor::linger]
39331
39332
39333 ['Inherited from socket_base.]
39334
39335 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.linger..linger..basic_socket_acceptor] 
39336 Socket option to specify whether the socket lingers on close if unsent data is present. 
39337
39338
39339   typedef implementation_defined linger;
39340
39341
39342
39343 Implements the SOL\_SOCKET/SO\_LINGER socket option.
39344
39345
39346 [heading Examples]
39347   
39348 Setting the option: 
39349
39350    boost::asio::ip::tcp::socket socket(my_context);
39351    ...
39352    boost::asio::socket_base::linger option(true, 30);
39353    socket.set_option(option);
39354
39355
39356
39357
39358
39359 Getting the current option value: 
39360
39361    boost::asio::ip::tcp::socket socket(my_context);
39362    ...
39363    boost::asio::socket_base::linger option;
39364    socket.get_option(option);
39365    bool is_set = option.enabled();
39366    unsigned short timeout = option.timeout();
39367
39368
39369
39370
39371
39372
39373
39374 [heading Requirements]
39375
39376 ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
39377
39378 ['Convenience header: ][^boost/asio.hpp]
39379
39380
39381 [endsect]
39382
39383
39384 [section:listen basic_socket_acceptor::listen]
39385
39386 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.listen..listen..basic_socket_acceptor] 
39387 Place the acceptor into the state where it will listen for new connections. 
39388
39389
39390   void ``[link boost_asio.reference.basic_socket_acceptor.listen.overload1 listen]``(
39391       int backlog = socket_base::max_listen_connections);
39392   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.listen.overload1 more...]]``
39393
39394   void ``[link boost_asio.reference.basic_socket_acceptor.listen.overload2 listen]``(
39395       int backlog,
39396       boost::system::error_code & ec);
39397   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.listen.overload2 more...]]``
39398
39399
39400 [section:overload1 basic_socket_acceptor::listen (1 of 2 overloads)]
39401
39402
39403 Place the acceptor into the state where it will listen for new connections. 
39404
39405
39406   void listen(
39407       int backlog = socket_base::max_listen_connections);
39408
39409
39410 This function puts the socket acceptor into the state where it may accept new connections.
39411
39412
39413 [heading Parameters]
39414     
39415
39416 [variablelist
39417   
39418 [[backlog][The maximum length of the queue of pending connections.]]
39419
39420 ]
39421
39422
39423 [heading Exceptions]
39424     
39425
39426 [variablelist
39427   
39428 [[boost::system::system_error][Thrown on failure. ]]
39429
39430 ]
39431
39432
39433
39434
39435 [endsect]
39436
39437
39438
39439 [section:overload2 basic_socket_acceptor::listen (2 of 2 overloads)]
39440
39441
39442 Place the acceptor into the state where it will listen for new connections. 
39443
39444
39445   void listen(
39446       int backlog,
39447       boost::system::error_code & ec);
39448
39449
39450 This function puts the socket acceptor into the state where it may accept new connections.
39451
39452
39453 [heading Parameters]
39454     
39455
39456 [variablelist
39457   
39458 [[backlog][The maximum length of the queue of pending connections.]]
39459
39460 [[ec][Set to indicate what error occurred, if any.]]
39461
39462 ]
39463
39464
39465 [heading Example]
39466   
39467
39468
39469    boost::asio::ip::tcp::acceptor acceptor(my_context);
39470    ...
39471    boost::system::error_code ec;
39472    acceptor.listen(boost::asio::socket_base::max_listen_connections, ec);
39473    if (ec)
39474    {
39475      // An error occurred.
39476    }
39477
39478
39479
39480
39481
39482
39483
39484 [endsect]
39485
39486
39487 [endsect]
39488
39489 [section:local_endpoint basic_socket_acceptor::local_endpoint]
39490
39491 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.local_endpoint..local_endpoint..basic_socket_acceptor] 
39492 Get the local endpoint of the acceptor. 
39493
39494
39495   endpoint_type ``[link boost_asio.reference.basic_socket_acceptor.local_endpoint.overload1 local_endpoint]``() const;
39496   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.local_endpoint.overload1 more...]]``
39497
39498   endpoint_type ``[link boost_asio.reference.basic_socket_acceptor.local_endpoint.overload2 local_endpoint]``(
39499       boost::system::error_code & ec) const;
39500   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.local_endpoint.overload2 more...]]``
39501
39502
39503 [section:overload1 basic_socket_acceptor::local_endpoint (1 of 2 overloads)]
39504
39505
39506 Get the local endpoint of the acceptor. 
39507
39508
39509   endpoint_type local_endpoint() const;
39510
39511
39512 This function is used to obtain the locally bound endpoint of the acceptor.
39513
39514
39515 [heading Return Value]
39516       
39517 An object that represents the local endpoint of the acceptor.
39518
39519
39520 [heading Exceptions]
39521     
39522
39523 [variablelist
39524   
39525 [[boost::system::system_error][Thrown on failure.]]
39526
39527 ]
39528
39529
39530 [heading Example]
39531   
39532
39533
39534    boost::asio::ip::tcp::acceptor acceptor(my_context);
39535    ...
39536    boost::asio::ip::tcp::endpoint endpoint = acceptor.local_endpoint();
39537
39538
39539
39540
39541
39542
39543
39544 [endsect]
39545
39546
39547
39548 [section:overload2 basic_socket_acceptor::local_endpoint (2 of 2 overloads)]
39549
39550
39551 Get the local endpoint of the acceptor. 
39552
39553
39554   endpoint_type local_endpoint(
39555       boost::system::error_code & ec) const;
39556
39557
39558 This function is used to obtain the locally bound endpoint of the acceptor.
39559
39560
39561 [heading Parameters]
39562     
39563
39564 [variablelist
39565   
39566 [[ec][Set to indicate what error occurred, if any.]]
39567
39568 ]
39569
39570
39571 [heading Return Value]
39572       
39573 An object that represents the local endpoint of the acceptor. Returns a default-constructed endpoint object if an error occurred and the error handler did not throw an exception.
39574
39575
39576 [heading Example]
39577   
39578
39579
39580    boost::asio::ip::tcp::acceptor acceptor(my_context);
39581    ...
39582    boost::system::error_code ec;
39583    boost::asio::ip::tcp::endpoint endpoint = acceptor.local_endpoint(ec);
39584    if (ec)
39585    {
39586      // An error occurred.
39587    }
39588
39589
39590
39591
39592
39593
39594
39595 [endsect]
39596
39597
39598 [endsect]
39599
39600
39601 [section:max_connections basic_socket_acceptor::max_connections]
39602
39603
39604 ['Inherited from socket_base.]
39605
39606 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.max_connections..max_connections..basic_socket_acceptor] 
39607 (Deprecated: Use max\_listen\_connections.) The maximum length of the queue of pending incoming connections. 
39608
39609
39610   static const int max_connections = implementation_defined;
39611
39612
39613
39614 [endsect]
39615
39616
39617
39618 [section:max_listen_connections basic_socket_acceptor::max_listen_connections]
39619
39620
39621 ['Inherited from socket_base.]
39622
39623 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.max_listen_connections..max_listen_connections..basic_socket_acceptor] 
39624 The maximum length of the queue of pending incoming connections. 
39625
39626
39627   static const int max_listen_connections = implementation_defined;
39628
39629
39630
39631 [endsect]
39632
39633
39634
39635 [section:message_do_not_route basic_socket_acceptor::message_do_not_route]
39636
39637
39638 ['Inherited from socket_base.]
39639
39640 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.message_do_not_route..message_do_not_route..basic_socket_acceptor] 
39641 Specify that the data should not be subject to routing. 
39642
39643
39644   static const int message_do_not_route = implementation_defined;
39645
39646
39647
39648 [endsect]
39649
39650
39651
39652 [section:message_end_of_record basic_socket_acceptor::message_end_of_record]
39653
39654
39655 ['Inherited from socket_base.]
39656
39657 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.message_end_of_record..message_end_of_record..basic_socket_acceptor] 
39658 Specifies that the data marks the end of a record. 
39659
39660
39661   static const int message_end_of_record = implementation_defined;
39662
39663
39664
39665 [endsect]
39666
39667
39668
39669 [section:message_flags basic_socket_acceptor::message_flags]
39670
39671
39672 ['Inherited from socket_base.]
39673
39674 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.message_flags..message_flags..basic_socket_acceptor] 
39675 Bitmask type for flags that can be passed to send and receive operations. 
39676
39677
39678   typedef int message_flags;
39679
39680
39681
39682 [heading Requirements]
39683
39684 ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
39685
39686 ['Convenience header: ][^boost/asio.hpp]
39687
39688
39689 [endsect]
39690
39691
39692
39693 [section:message_out_of_band basic_socket_acceptor::message_out_of_band]
39694
39695
39696 ['Inherited from socket_base.]
39697
39698 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.message_out_of_band..message_out_of_band..basic_socket_acceptor] 
39699 Process out-of-band data. 
39700
39701
39702   static const int message_out_of_band = implementation_defined;
39703
39704
39705
39706 [endsect]
39707
39708
39709
39710 [section:message_peek basic_socket_acceptor::message_peek]
39711
39712
39713 ['Inherited from socket_base.]
39714
39715 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.message_peek..message_peek..basic_socket_acceptor] 
39716 Peek at incoming data without removing it from the input queue. 
39717
39718
39719   static const int message_peek = implementation_defined;
39720
39721
39722
39723 [endsect]
39724
39725
39726
39727 [section:native_handle basic_socket_acceptor::native_handle]
39728
39729 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.native_handle..native_handle..basic_socket_acceptor] 
39730 Get the native acceptor representation. 
39731
39732
39733   native_handle_type native_handle();
39734
39735
39736 This function may be used to obtain the underlying representation of the acceptor. This is intended to allow access to native acceptor functionality that is not otherwise provided. 
39737
39738
39739 [endsect]
39740
39741
39742
39743 [section:native_handle_type basic_socket_acceptor::native_handle_type]
39744
39745 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.native_handle_type..native_handle_type..basic_socket_acceptor] 
39746 The native representation of an acceptor. 
39747
39748
39749   typedef implementation_defined native_handle_type;
39750
39751
39752
39753 [heading Requirements]
39754
39755 ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
39756
39757 ['Convenience header: ][^boost/asio.hpp]
39758
39759
39760 [endsect]
39761
39762
39763 [section:native_non_blocking basic_socket_acceptor::native_non_blocking]
39764
39765 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.native_non_blocking..native_non_blocking..basic_socket_acceptor] 
39766 Gets the non-blocking mode of the native acceptor implementation. 
39767
39768
39769   bool ``[link boost_asio.reference.basic_socket_acceptor.native_non_blocking.overload1 native_non_blocking]``() const;
39770   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.native_non_blocking.overload1 more...]]``
39771
39772
39773 Sets the non-blocking mode of the native acceptor implementation. 
39774
39775
39776   void ``[link boost_asio.reference.basic_socket_acceptor.native_non_blocking.overload2 native_non_blocking]``(
39777       bool mode);
39778   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.native_non_blocking.overload2 more...]]``
39779
39780   void ``[link boost_asio.reference.basic_socket_acceptor.native_non_blocking.overload3 native_non_blocking]``(
39781       bool mode,
39782       boost::system::error_code & ec);
39783   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.native_non_blocking.overload3 more...]]``
39784
39785
39786 [section:overload1 basic_socket_acceptor::native_non_blocking (1 of 3 overloads)]
39787
39788
39789 Gets the non-blocking mode of the native acceptor implementation. 
39790
39791
39792   bool native_non_blocking() const;
39793
39794
39795 This function is used to retrieve the non-blocking mode of the underlying native acceptor. This mode has no effect on the behaviour of the acceptor object's synchronous operations.
39796
39797
39798 [heading Return Value]
39799       
39800 `true` if the underlying acceptor is in non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).
39801
39802
39803 [heading Remarks]
39804       
39805 The current non-blocking mode is cached by the acceptor object. Consequently, the return value may be incorrect if the non-blocking mode was set directly on the native acceptor. 
39806
39807
39808
39809
39810 [endsect]
39811
39812
39813
39814 [section:overload2 basic_socket_acceptor::native_non_blocking (2 of 3 overloads)]
39815
39816
39817 Sets the non-blocking mode of the native acceptor implementation. 
39818
39819
39820   void native_non_blocking(
39821       bool mode);
39822
39823
39824 This function is used to modify the non-blocking mode of the underlying native acceptor. It has no effect on the behaviour of the acceptor object's synchronous operations.
39825
39826
39827 [heading Parameters]
39828     
39829
39830 [variablelist
39831   
39832 [[mode][If `true`, the underlying acceptor is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]]
39833
39834 ]
39835
39836
39837 [heading Exceptions]
39838     
39839
39840 [variablelist
39841   
39842 [[boost::system::system_error][Thrown on failure. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense. ]]
39843
39844 ]
39845
39846
39847
39848
39849 [endsect]
39850
39851
39852
39853 [section:overload3 basic_socket_acceptor::native_non_blocking (3 of 3 overloads)]
39854
39855
39856 Sets the non-blocking mode of the native acceptor implementation. 
39857
39858
39859   void native_non_blocking(
39860       bool mode,
39861       boost::system::error_code & ec);
39862
39863
39864 This function is used to modify the non-blocking mode of the underlying native acceptor. It has no effect on the behaviour of the acceptor object's synchronous operations.
39865
39866
39867 [heading Parameters]
39868     
39869
39870 [variablelist
39871   
39872 [[mode][If `true`, the underlying acceptor is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]]
39873
39874 [[ec][Set to indicate what error occurred, if any. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense. ]]
39875
39876 ]
39877
39878
39879
39880
39881 [endsect]
39882
39883
39884 [endsect]
39885
39886 [section:non_blocking basic_socket_acceptor::non_blocking]
39887
39888 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.non_blocking..non_blocking..basic_socket_acceptor] 
39889 Gets the non-blocking mode of the acceptor. 
39890
39891
39892   bool ``[link boost_asio.reference.basic_socket_acceptor.non_blocking.overload1 non_blocking]``() const;
39893   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.non_blocking.overload1 more...]]``
39894
39895
39896 Sets the non-blocking mode of the acceptor. 
39897
39898
39899   void ``[link boost_asio.reference.basic_socket_acceptor.non_blocking.overload2 non_blocking]``(
39900       bool mode);
39901   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.non_blocking.overload2 more...]]``
39902
39903   void ``[link boost_asio.reference.basic_socket_acceptor.non_blocking.overload3 non_blocking]``(
39904       bool mode,
39905       boost::system::error_code & ec);
39906   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.non_blocking.overload3 more...]]``
39907
39908
39909 [section:overload1 basic_socket_acceptor::non_blocking (1 of 3 overloads)]
39910
39911
39912 Gets the non-blocking mode of the acceptor. 
39913
39914
39915   bool non_blocking() const;
39916
39917
39918
39919 [heading Return Value]
39920       
39921 `true` if the acceptor's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.
39922
39923
39924 [heading Remarks]
39925       
39926 The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`. 
39927
39928
39929
39930
39931 [endsect]
39932
39933
39934
39935 [section:overload2 basic_socket_acceptor::non_blocking (2 of 3 overloads)]
39936
39937
39938 Sets the non-blocking mode of the acceptor. 
39939
39940
39941   void non_blocking(
39942       bool mode);
39943
39944
39945
39946 [heading Parameters]
39947     
39948
39949 [variablelist
39950   
39951 [[mode][If `true`, the acceptor's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]]
39952
39953 ]
39954
39955
39956 [heading Exceptions]
39957     
39958
39959 [variablelist
39960   
39961 [[boost::system::system_error][Thrown on failure.]]
39962
39963 ]
39964
39965
39966 [heading Remarks]
39967       
39968 The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`. 
39969
39970
39971
39972
39973 [endsect]
39974
39975
39976
39977 [section:overload3 basic_socket_acceptor::non_blocking (3 of 3 overloads)]
39978
39979
39980 Sets the non-blocking mode of the acceptor. 
39981
39982
39983   void non_blocking(
39984       bool mode,
39985       boost::system::error_code & ec);
39986
39987
39988
39989 [heading Parameters]
39990     
39991
39992 [variablelist
39993   
39994 [[mode][If `true`, the acceptor's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]]
39995
39996 [[ec][Set to indicate what error occurred, if any.]]
39997
39998 ]
39999
40000
40001 [heading Remarks]
40002       
40003 The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`. 
40004
40005
40006
40007
40008 [endsect]
40009
40010
40011 [endsect]
40012
40013 [section:open basic_socket_acceptor::open]
40014
40015 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.open..open..basic_socket_acceptor] 
40016 Open the acceptor using the specified protocol. 
40017
40018
40019   void ``[link boost_asio.reference.basic_socket_acceptor.open.overload1 open]``(
40020       const protocol_type & protocol = protocol_type());
40021   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.open.overload1 more...]]``
40022
40023   void ``[link boost_asio.reference.basic_socket_acceptor.open.overload2 open]``(
40024       const protocol_type & protocol,
40025       boost::system::error_code & ec);
40026   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.open.overload2 more...]]``
40027
40028
40029 [section:overload1 basic_socket_acceptor::open (1 of 2 overloads)]
40030
40031
40032 Open the acceptor using the specified protocol. 
40033
40034
40035   void open(
40036       const protocol_type & protocol = protocol_type());
40037
40038
40039 This function opens the socket acceptor so that it will use the specified protocol.
40040
40041
40042 [heading Parameters]
40043     
40044
40045 [variablelist
40046   
40047 [[protocol][An object specifying which protocol is to be used.]]
40048
40049 ]
40050
40051
40052 [heading Exceptions]
40053     
40054
40055 [variablelist
40056   
40057 [[boost::system::system_error][Thrown on failure.]]
40058
40059 ]
40060
40061
40062 [heading Example]
40063   
40064
40065
40066    boost::asio::ip::tcp::acceptor acceptor(my_context);
40067    acceptor.open(boost::asio::ip::tcp::v4());
40068
40069
40070
40071
40072
40073
40074
40075 [endsect]
40076
40077
40078
40079 [section:overload2 basic_socket_acceptor::open (2 of 2 overloads)]
40080
40081
40082 Open the acceptor using the specified protocol. 
40083
40084
40085   void open(
40086       const protocol_type & protocol,
40087       boost::system::error_code & ec);
40088
40089
40090 This function opens the socket acceptor so that it will use the specified protocol.
40091
40092
40093 [heading Parameters]
40094     
40095
40096 [variablelist
40097   
40098 [[protocol][An object specifying which protocol is to be used.]]
40099
40100 [[ec][Set to indicate what error occurred, if any.]]
40101
40102 ]
40103
40104
40105 [heading Example]
40106   
40107
40108
40109    boost::asio::ip::tcp::acceptor acceptor(my_context);
40110    boost::system::error_code ec;
40111    acceptor.open(boost::asio::ip::tcp::v4(), ec);
40112    if (ec)
40113    {
40114      // An error occurred.
40115    }
40116
40117
40118
40119
40120
40121
40122
40123 [endsect]
40124
40125
40126 [endsect]
40127
40128 [section:operator_eq_ basic_socket_acceptor::operator=]
40129
40130 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.operator_eq_..operator=..basic_socket_acceptor] 
40131 Move-assign a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] from another. 
40132
40133
40134   basic_socket_acceptor & ``[link boost_asio.reference.basic_socket_acceptor.operator_eq_.overload1 operator=]``(
40135       basic_socket_acceptor && other);
40136   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.operator_eq_.overload1 more...]]``
40137
40138
40139 Move-assign a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] from an acceptor of another protocol type. 
40140
40141
40142   template<
40143       typename ``[link boost_asio.reference.Protocol Protocol1]``,
40144       typename ``[link boost_asio.reference.Executor1 Executor1]``>
40145   enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value, basic_socket_acceptor & >::type ``[link boost_asio.reference.basic_socket_acceptor.operator_eq_.overload2 operator=]``(
40146       basic_socket_acceptor< Protocol1, Executor1 > && other);
40147   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.operator_eq_.overload2 more...]]``
40148
40149
40150 [section:overload1 basic_socket_acceptor::operator= (1 of 2 overloads)]
40151
40152
40153 Move-assign a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] from another. 
40154
40155
40156   basic_socket_acceptor & operator=(
40157       basic_socket_acceptor && other);
40158
40159
40160 This assignment operator moves an acceptor from one object to another.
40161
40162
40163 [heading Parameters]
40164     
40165
40166 [variablelist
40167   
40168 [[other][The other [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] object from which the move will occur.]]
40169
40170 ]
40171
40172
40173 [heading Remarks]
40174       
40175 Following the move, the moved-from object is in the same state as if constructed using the `basic_socket_acceptor(const executor_type&)` constructor. 
40176
40177
40178
40179
40180 [endsect]
40181
40182
40183
40184 [section:overload2 basic_socket_acceptor::operator= (2 of 2 overloads)]
40185
40186
40187 Move-assign a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] from an acceptor of another protocol type. 
40188
40189
40190   template<
40191       typename ``[link boost_asio.reference.Protocol Protocol1]``,
40192       typename ``[link boost_asio.reference.Executor1 Executor1]``>
40193   enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value, basic_socket_acceptor & >::type operator=(
40194       basic_socket_acceptor< Protocol1, Executor1 > && other);
40195
40196
40197 This assignment operator moves an acceptor from one object to another.
40198
40199
40200 [heading Parameters]
40201     
40202
40203 [variablelist
40204   
40205 [[other][The other [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] object from which the move will occur.]]
40206
40207 ]
40208
40209
40210 [heading Remarks]
40211       
40212 Following the move, the moved-from object is in the same state as if constructed using the `basic_socket_acceptor(const executor_type&)` constructor. 
40213
40214
40215
40216
40217 [endsect]
40218
40219
40220 [endsect]
40221
40222
40223 [section:out_of_band_inline basic_socket_acceptor::out_of_band_inline]
40224
40225
40226 ['Inherited from socket_base.]
40227
40228 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.out_of_band_inline..out_of_band_inline..basic_socket_acceptor] 
40229 Socket option for putting received out-of-band data inline. 
40230
40231
40232   typedef implementation_defined out_of_band_inline;
40233
40234
40235
40236 Implements the SOL\_SOCKET/SO\_OOBINLINE socket option.
40237
40238
40239 [heading Examples]
40240   
40241 Setting the option: 
40242
40243    boost::asio::ip::tcp::socket socket(my_context);
40244    ...
40245    boost::asio::socket_base::out_of_band_inline option(true);
40246    socket.set_option(option);
40247
40248
40249
40250
40251
40252 Getting the current option value: 
40253
40254    boost::asio::ip::tcp::socket socket(my_context);
40255    ...
40256    boost::asio::socket_base::out_of_band_inline option;
40257    socket.get_option(option);
40258    bool value = option.value();
40259
40260
40261
40262
40263
40264
40265
40266 [heading Requirements]
40267
40268 ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
40269
40270 ['Convenience header: ][^boost/asio.hpp]
40271
40272
40273 [endsect]
40274
40275
40276
40277 [section:protocol_type basic_socket_acceptor::protocol_type]
40278
40279 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.protocol_type..protocol_type..basic_socket_acceptor] 
40280 The protocol type. 
40281
40282
40283   typedef Protocol protocol_type;
40284
40285
40286
40287 [heading Requirements]
40288
40289 ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
40290
40291 ['Convenience header: ][^boost/asio.hpp]
40292
40293
40294 [endsect]
40295
40296
40297
40298 [section:receive_buffer_size basic_socket_acceptor::receive_buffer_size]
40299
40300
40301 ['Inherited from socket_base.]
40302
40303 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.receive_buffer_size..receive_buffer_size..basic_socket_acceptor] 
40304 Socket option for the receive buffer size of a socket. 
40305
40306
40307   typedef implementation_defined receive_buffer_size;
40308
40309
40310
40311 Implements the SOL\_SOCKET/SO\_RCVBUF socket option.
40312
40313
40314 [heading Examples]
40315   
40316 Setting the option: 
40317
40318    boost::asio::ip::tcp::socket socket(my_context);
40319    ...
40320    boost::asio::socket_base::receive_buffer_size option(8192);
40321    socket.set_option(option);
40322
40323
40324
40325
40326
40327 Getting the current option value: 
40328
40329    boost::asio::ip::tcp::socket socket(my_context);
40330    ...
40331    boost::asio::socket_base::receive_buffer_size option;
40332    socket.get_option(option);
40333    int size = option.value();
40334
40335
40336
40337
40338
40339
40340
40341 [heading Requirements]
40342
40343 ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
40344
40345 ['Convenience header: ][^boost/asio.hpp]
40346
40347
40348 [endsect]
40349
40350
40351
40352 [section:receive_low_watermark basic_socket_acceptor::receive_low_watermark]
40353
40354
40355 ['Inherited from socket_base.]
40356
40357 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.receive_low_watermark..receive_low_watermark..basic_socket_acceptor] 
40358 Socket option for the receive low watermark. 
40359
40360
40361   typedef implementation_defined receive_low_watermark;
40362
40363
40364
40365 Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option.
40366
40367
40368 [heading Examples]
40369   
40370 Setting the option: 
40371
40372    boost::asio::ip::tcp::socket socket(my_context);
40373    ...
40374    boost::asio::socket_base::receive_low_watermark option(1024);
40375    socket.set_option(option);
40376
40377
40378
40379
40380
40381 Getting the current option value: 
40382
40383    boost::asio::ip::tcp::socket socket(my_context);
40384    ...
40385    boost::asio::socket_base::receive_low_watermark option;
40386    socket.get_option(option);
40387    int size = option.value();
40388
40389
40390
40391
40392
40393
40394
40395 [heading Requirements]
40396
40397 ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
40398
40399 ['Convenience header: ][^boost/asio.hpp]
40400
40401
40402 [endsect]
40403
40404
40405 [section:release basic_socket_acceptor::release]
40406
40407 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.release..release..basic_socket_acceptor] 
40408 Release ownership of the underlying native acceptor. 
40409
40410
40411   native_handle_type ``[link boost_asio.reference.basic_socket_acceptor.release.overload1 release]``();
40412   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.release.overload1 more...]]``
40413
40414   native_handle_type ``[link boost_asio.reference.basic_socket_acceptor.release.overload2 release]``(
40415       boost::system::error_code & ec);
40416   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.release.overload2 more...]]``
40417
40418
40419 [section:overload1 basic_socket_acceptor::release (1 of 2 overloads)]
40420
40421
40422 Release ownership of the underlying native acceptor. 
40423
40424
40425   native_handle_type release();
40426
40427
40428 This function causes all outstanding asynchronous accept operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error. Ownership of the native acceptor is then transferred to the caller.
40429
40430
40431 [heading Exceptions]
40432     
40433
40434 [variablelist
40435   
40436 [[boost::system::system_error][Thrown on failure.]]
40437
40438 ]
40439
40440
40441 [heading Remarks]
40442       
40443 This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms. 
40444
40445
40446
40447
40448 [endsect]
40449
40450
40451
40452 [section:overload2 basic_socket_acceptor::release (2 of 2 overloads)]
40453
40454
40455 Release ownership of the underlying native acceptor. 
40456
40457
40458   native_handle_type release(
40459       boost::system::error_code & ec);
40460
40461
40462 This function causes all outstanding asynchronous accept operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error. Ownership of the native acceptor is then transferred to the caller.
40463
40464
40465 [heading Parameters]
40466     
40467
40468 [variablelist
40469   
40470 [[ec][Set to indicate what error occurred, if any.]]
40471
40472 ]
40473
40474
40475 [heading Remarks]
40476       
40477 This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms. 
40478
40479
40480
40481
40482 [endsect]
40483
40484
40485 [endsect]
40486
40487
40488 [section:reuse_address basic_socket_acceptor::reuse_address]
40489
40490
40491 ['Inherited from socket_base.]
40492
40493 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.reuse_address..reuse_address..basic_socket_acceptor] 
40494 Socket option to allow the socket to be bound to an address that is already in use. 
40495
40496
40497   typedef implementation_defined reuse_address;
40498
40499
40500
40501 Implements the SOL\_SOCKET/SO\_REUSEADDR socket option.
40502
40503
40504 [heading Examples]
40505   
40506 Setting the option: 
40507
40508    boost::asio::ip::tcp::acceptor acceptor(my_context);
40509    ...
40510    boost::asio::socket_base::reuse_address option(true);
40511    acceptor.set_option(option);
40512
40513
40514
40515
40516
40517 Getting the current option value: 
40518
40519    boost::asio::ip::tcp::acceptor acceptor(my_context);
40520    ...
40521    boost::asio::socket_base::reuse_address option;
40522    acceptor.get_option(option);
40523    bool is_set = option.value();
40524
40525
40526
40527
40528
40529
40530
40531 [heading Requirements]
40532
40533 ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
40534
40535 ['Convenience header: ][^boost/asio.hpp]
40536
40537
40538 [endsect]
40539
40540
40541
40542 [section:send_buffer_size basic_socket_acceptor::send_buffer_size]
40543
40544
40545 ['Inherited from socket_base.]
40546
40547 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.send_buffer_size..send_buffer_size..basic_socket_acceptor] 
40548 Socket option for the send buffer size of a socket. 
40549
40550
40551   typedef implementation_defined send_buffer_size;
40552
40553
40554
40555 Implements the SOL\_SOCKET/SO\_SNDBUF socket option.
40556
40557
40558 [heading Examples]
40559   
40560 Setting the option: 
40561
40562    boost::asio::ip::tcp::socket socket(my_context);
40563    ...
40564    boost::asio::socket_base::send_buffer_size option(8192);
40565    socket.set_option(option);
40566
40567
40568
40569
40570
40571 Getting the current option value: 
40572
40573    boost::asio::ip::tcp::socket socket(my_context);
40574    ...
40575    boost::asio::socket_base::send_buffer_size option;
40576    socket.get_option(option);
40577    int size = option.value();
40578
40579
40580
40581
40582
40583
40584
40585 [heading Requirements]
40586
40587 ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
40588
40589 ['Convenience header: ][^boost/asio.hpp]
40590
40591
40592 [endsect]
40593
40594
40595
40596 [section:send_low_watermark basic_socket_acceptor::send_low_watermark]
40597
40598
40599 ['Inherited from socket_base.]
40600
40601 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.send_low_watermark..send_low_watermark..basic_socket_acceptor] 
40602 Socket option for the send low watermark. 
40603
40604
40605   typedef implementation_defined send_low_watermark;
40606
40607
40608
40609 Implements the SOL\_SOCKET/SO\_SNDLOWAT socket option.
40610
40611
40612 [heading Examples]
40613   
40614 Setting the option: 
40615
40616    boost::asio::ip::tcp::socket socket(my_context);
40617    ...
40618    boost::asio::socket_base::send_low_watermark option(1024);
40619    socket.set_option(option);
40620
40621
40622
40623
40624
40625 Getting the current option value: 
40626
40627    boost::asio::ip::tcp::socket socket(my_context);
40628    ...
40629    boost::asio::socket_base::send_low_watermark option;
40630    socket.get_option(option);
40631    int size = option.value();
40632
40633
40634
40635
40636
40637
40638
40639 [heading Requirements]
40640
40641 ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
40642
40643 ['Convenience header: ][^boost/asio.hpp]
40644
40645
40646 [endsect]
40647
40648
40649 [section:set_option basic_socket_acceptor::set_option]
40650
40651 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.set_option..set_option..basic_socket_acceptor] 
40652 Set an option on the acceptor. 
40653
40654
40655   template<
40656       typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
40657   void ``[link boost_asio.reference.basic_socket_acceptor.set_option.overload1 set_option]``(
40658       const SettableSocketOption & option);
40659   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.set_option.overload1 more...]]``
40660
40661   template<
40662       typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
40663   void ``[link boost_asio.reference.basic_socket_acceptor.set_option.overload2 set_option]``(
40664       const SettableSocketOption & option,
40665       boost::system::error_code & ec);
40666   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.set_option.overload2 more...]]``
40667
40668
40669 [section:overload1 basic_socket_acceptor::set_option (1 of 2 overloads)]
40670
40671
40672 Set an option on the acceptor. 
40673
40674
40675   template<
40676       typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
40677   void set_option(
40678       const SettableSocketOption & option);
40679
40680
40681 This function is used to set an option on the acceptor.
40682
40683
40684 [heading Parameters]
40685     
40686
40687 [variablelist
40688   
40689 [[option][The new option value to be set on the acceptor.]]
40690
40691 ]
40692
40693
40694 [heading Exceptions]
40695     
40696
40697 [variablelist
40698   
40699 [[boost::system::system_error][Thrown on failure.]]
40700
40701 ]
40702
40703
40704
40705 [heading Example]
40706   
40707 Setting the SOL\_SOCKET/SO\_REUSEADDR option: 
40708
40709    boost::asio::ip::tcp::acceptor acceptor(my_context);
40710    ...
40711    boost::asio::ip::tcp::acceptor::reuse_address option(true);
40712    acceptor.set_option(option);
40713
40714
40715
40716
40717
40718
40719
40720 [endsect]
40721
40722
40723
40724 [section:overload2 basic_socket_acceptor::set_option (2 of 2 overloads)]
40725
40726
40727 Set an option on the acceptor. 
40728
40729
40730   template<
40731       typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
40732   void set_option(
40733       const SettableSocketOption & option,
40734       boost::system::error_code & ec);
40735
40736
40737 This function is used to set an option on the acceptor.
40738
40739
40740 [heading Parameters]
40741     
40742
40743 [variablelist
40744   
40745 [[option][The new option value to be set on the acceptor.]]
40746
40747 [[ec][Set to indicate what error occurred, if any.]]
40748
40749 ]
40750
40751
40752
40753 [heading Example]
40754   
40755 Setting the SOL\_SOCKET/SO\_REUSEADDR option: 
40756
40757    boost::asio::ip::tcp::acceptor acceptor(my_context);
40758    ...
40759    boost::asio::ip::tcp::acceptor::reuse_address option(true);
40760    boost::system::error_code ec;
40761    acceptor.set_option(option, ec);
40762    if (ec)
40763    {
40764      // An error occurred.
40765    }
40766
40767
40768
40769
40770
40771
40772
40773 [endsect]
40774
40775
40776 [endsect]
40777
40778
40779 [section:shutdown_type basic_socket_acceptor::shutdown_type]
40780
40781
40782 ['Inherited from socket_base.]
40783
40784 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.shutdown_type..shutdown_type..basic_socket_acceptor] 
40785 Different ways a socket may be shutdown. 
40786
40787
40788   enum shutdown_type
40789
40790 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.shutdown_type.shutdown_receive..shutdown_receive..basic_socket_acceptor]
40791 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.shutdown_type.shutdown_send..shutdown_send..basic_socket_acceptor]
40792 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.shutdown_type.shutdown_both..shutdown_both..basic_socket_acceptor]
40793
40794 [heading Values]
40795 [variablelist
40796
40797   [
40798     [shutdown_receive]
40799     [Shutdown the receive side of the socket. ]
40800   ]
40801
40802   [
40803     [shutdown_send]
40804     [Shutdown the send side of the socket. ]
40805   ]
40806
40807   [
40808     [shutdown_both]
40809     [Shutdown both send and receive on the socket. ]
40810   ]
40811
40812 ]
40813
40814
40815
40816 [endsect]
40817
40818
40819 [section:wait basic_socket_acceptor::wait]
40820
40821 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.wait..wait..basic_socket_acceptor] 
40822 Wait for the acceptor to become ready to read, ready to write, or to have pending error conditions. 
40823
40824
40825   void ``[link boost_asio.reference.basic_socket_acceptor.wait.overload1 wait]``(
40826       wait_type w);
40827   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.wait.overload1 more...]]``
40828
40829   void ``[link boost_asio.reference.basic_socket_acceptor.wait.overload2 wait]``(
40830       wait_type w,
40831       boost::system::error_code & ec);
40832   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.wait.overload2 more...]]``
40833
40834
40835 [section:overload1 basic_socket_acceptor::wait (1 of 2 overloads)]
40836
40837
40838 Wait for the acceptor to become ready to read, ready to write, or to have pending error conditions. 
40839
40840
40841   void wait(
40842       wait_type w);
40843
40844
40845 This function is used to perform a blocking wait for an acceptor to enter a ready to read, write or error condition state.
40846
40847
40848 [heading Parameters]
40849     
40850
40851 [variablelist
40852   
40853 [[w][Specifies the desired acceptor state.]]
40854
40855 ]
40856
40857
40858 [heading Example]
40859   
40860 Waiting for an acceptor to become readable. 
40861
40862    boost::asio::ip::tcp::acceptor acceptor(my_context);
40863    ...
40864    acceptor.wait(boost::asio::ip::tcp::acceptor::wait_read);
40865
40866
40867
40868
40869
40870
40871
40872 [endsect]
40873
40874
40875
40876 [section:overload2 basic_socket_acceptor::wait (2 of 2 overloads)]
40877
40878
40879 Wait for the acceptor to become ready to read, ready to write, or to have pending error conditions. 
40880
40881
40882   void wait(
40883       wait_type w,
40884       boost::system::error_code & ec);
40885
40886
40887 This function is used to perform a blocking wait for an acceptor to enter a ready to read, write or error condition state.
40888
40889
40890 [heading Parameters]
40891     
40892
40893 [variablelist
40894   
40895 [[w][Specifies the desired acceptor state.]]
40896
40897 [[ec][Set to indicate what error occurred, if any.]]
40898
40899 ]
40900
40901
40902 [heading Example]
40903   
40904 Waiting for an acceptor to become readable. 
40905
40906    boost::asio::ip::tcp::acceptor acceptor(my_context);
40907    ...
40908    boost::system::error_code ec;
40909    acceptor.wait(boost::asio::ip::tcp::acceptor::wait_read, ec);
40910
40911
40912
40913
40914
40915
40916
40917 [endsect]
40918
40919
40920 [endsect]
40921
40922
40923 [section:wait_type basic_socket_acceptor::wait_type]
40924
40925
40926 ['Inherited from socket_base.]
40927
40928 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.wait_type..wait_type..basic_socket_acceptor] 
40929 Wait types. 
40930
40931
40932   enum wait_type
40933
40934 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.wait_type.wait_read..wait_read..basic_socket_acceptor]
40935 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.wait_type.wait_write..wait_write..basic_socket_acceptor]
40936 [indexterm2 boost_asio.indexterm.basic_socket_acceptor.wait_type.wait_error..wait_error..basic_socket_acceptor]
40937
40938 [heading Values]
40939 [variablelist
40940
40941   [
40942     [wait_read]
40943     [Wait for a socket to become ready to read. ]
40944   ]
40945
40946   [
40947     [wait_write]
40948     [Wait for a socket to become ready to write. ]
40949   ]
40950
40951   [
40952     [wait_error]
40953     [Wait for a socket to have error conditions pending. ]
40954   ]
40955
40956 ]
40957
40958
40959 For use with `basic_socket::wait()` and `basic_socket::async_wait()`. 
40960
40961
40962 [endsect]
40963
40964
40965
40966 [section:_basic_socket_acceptor basic_socket_acceptor::~basic_socket_acceptor]
40967
40968 [indexterm2 boost_asio.indexterm.basic_socket_acceptor._basic_socket_acceptor..~basic_socket_acceptor..basic_socket_acceptor] 
40969 Destroys the acceptor. 
40970
40971
40972   ~basic_socket_acceptor();
40973
40974
40975 This function destroys the acceptor, cancelling any outstanding asynchronous operations associated with the acceptor as if by calling `cancel`. 
40976
40977
40978 [endsect]
40979
40980
40981
40982 [endsect]
40983
40984 [section:basic_socket_acceptor__rebind_executor basic_socket_acceptor::rebind_executor]
40985
40986
40987 Rebinds the acceptor type to another executor. 
40988
40989
40990   template<
40991       typename ``[link boost_asio.reference.Executor1 Executor1]``>
40992   struct rebind_executor
40993
40994
40995 [heading Types]
40996 [table
40997   [[Name][Description]]
40998
40999   [
41000
41001     [[link boost_asio.reference.basic_socket_acceptor__rebind_executor.other [*other]]]
41002     [The socket type when rebound to the specified executor. ]
41003   
41004   ]
41005
41006 ]
41007
41008 [heading Requirements]
41009
41010 ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
41011
41012 ['Convenience header: ][^boost/asio.hpp]
41013
41014
41015 [section:other basic_socket_acceptor::rebind_executor::other]
41016
41017 [indexterm2 boost_asio.indexterm.basic_socket_acceptor__rebind_executor.other..other..basic_socket_acceptor::rebind_executor] 
41018 The socket type when rebound to the specified executor. 
41019
41020
41021   typedef basic_socket_acceptor< Protocol, Executor1 > other;
41022
41023
41024 [heading Types]
41025 [table
41026   [[Name][Description]]
41027
41028   [
41029
41030     [[link boost_asio.reference.basic_socket_acceptor__rebind_executor [*rebind_executor]]]
41031     [Rebinds the acceptor type to another executor. ]
41032   
41033   ]
41034
41035   [
41036
41037     [[link boost_asio.reference.basic_socket_acceptor.broadcast [*broadcast]]]
41038     [Socket option to permit sending of broadcast messages. ]
41039   
41040   ]
41041
41042   [
41043
41044     [[link boost_asio.reference.basic_socket_acceptor.bytes_readable [*bytes_readable]]]
41045     [IO control command to get the amount of data that can be read without blocking. ]
41046   
41047   ]
41048
41049   [
41050
41051     [[link boost_asio.reference.basic_socket_acceptor.debug [*debug]]]
41052     [Socket option to enable socket-level debugging. ]
41053   
41054   ]
41055
41056   [
41057
41058     [[link boost_asio.reference.basic_socket_acceptor.do_not_route [*do_not_route]]]
41059     [Socket option to prevent routing, use local interfaces only. ]
41060   
41061   ]
41062
41063   [
41064
41065     [[link boost_asio.reference.basic_socket_acceptor.enable_connection_aborted [*enable_connection_aborted]]]
41066     [Socket option to report aborted connections on accept. ]
41067   
41068   ]
41069
41070   [
41071
41072     [[link boost_asio.reference.basic_socket_acceptor.endpoint_type [*endpoint_type]]]
41073     [The endpoint type. ]
41074   
41075   ]
41076
41077   [
41078
41079     [[link boost_asio.reference.basic_socket_acceptor.executor_type [*executor_type]]]
41080     [The type of the executor associated with the object. ]
41081   
41082   ]
41083
41084   [
41085
41086     [[link boost_asio.reference.basic_socket_acceptor.keep_alive [*keep_alive]]]
41087     [Socket option to send keep-alives. ]
41088   
41089   ]
41090
41091   [
41092
41093     [[link boost_asio.reference.basic_socket_acceptor.linger [*linger]]]
41094     [Socket option to specify whether the socket lingers on close if unsent data is present. ]
41095   
41096   ]
41097
41098   [
41099
41100     [[link boost_asio.reference.basic_socket_acceptor.message_flags [*message_flags]]]
41101     [Bitmask type for flags that can be passed to send and receive operations. ]
41102   
41103   ]
41104
41105   [
41106
41107     [[link boost_asio.reference.basic_socket_acceptor.native_handle_type [*native_handle_type]]]
41108     [The native representation of an acceptor. ]
41109   
41110   ]
41111
41112   [
41113
41114     [[link boost_asio.reference.basic_socket_acceptor.out_of_band_inline [*out_of_band_inline]]]
41115     [Socket option for putting received out-of-band data inline. ]
41116   
41117   ]
41118
41119   [
41120
41121     [[link boost_asio.reference.basic_socket_acceptor.protocol_type [*protocol_type]]]
41122     [The protocol type. ]
41123   
41124   ]
41125
41126   [
41127
41128     [[link boost_asio.reference.basic_socket_acceptor.receive_buffer_size [*receive_buffer_size]]]
41129     [Socket option for the receive buffer size of a socket. ]
41130   
41131   ]
41132
41133   [
41134
41135     [[link boost_asio.reference.basic_socket_acceptor.receive_low_watermark [*receive_low_watermark]]]
41136     [Socket option for the receive low watermark. ]
41137   
41138   ]
41139
41140   [
41141
41142     [[link boost_asio.reference.basic_socket_acceptor.reuse_address [*reuse_address]]]
41143     [Socket option to allow the socket to be bound to an address that is already in use. ]
41144   
41145   ]
41146
41147   [
41148
41149     [[link boost_asio.reference.basic_socket_acceptor.send_buffer_size [*send_buffer_size]]]
41150     [Socket option for the send buffer size of a socket. ]
41151   
41152   ]
41153
41154   [
41155
41156     [[link boost_asio.reference.basic_socket_acceptor.send_low_watermark [*send_low_watermark]]]
41157     [Socket option for the send low watermark. ]
41158   
41159   ]
41160
41161   [
41162
41163     [[link boost_asio.reference.basic_socket_acceptor.shutdown_type [*shutdown_type]]]
41164     [Different ways a socket may be shutdown. ]
41165   
41166   ]
41167
41168   [
41169
41170     [[link boost_asio.reference.basic_socket_acceptor.wait_type [*wait_type]]]
41171     [Wait types. ]
41172   
41173   ]
41174
41175 ]
41176
41177 [heading Member Functions]
41178 [table
41179   [[Name][Description]]
41180
41181   [
41182     [[link boost_asio.reference.basic_socket_acceptor.accept [*accept]]]
41183     [Accept a new connection. 
41184      [hr]
41185      Accept a new connection and obtain the endpoint of the peer. ]
41186   ]
41187   
41188   [
41189     [[link boost_asio.reference.basic_socket_acceptor.assign [*assign]]]
41190     [Assigns an existing native acceptor to the acceptor. ]
41191   ]
41192   
41193   [
41194     [[link boost_asio.reference.basic_socket_acceptor.async_accept [*async_accept]]]
41195     [Start an asynchronous accept. ]
41196   ]
41197   
41198   [
41199     [[link boost_asio.reference.basic_socket_acceptor.async_wait [*async_wait]]]
41200     [Asynchronously wait for the acceptor to become ready to read, ready to write, or to have pending error conditions. ]
41201   ]
41202   
41203   [
41204     [[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor [*basic_socket_acceptor]]]
41205     [Construct an acceptor without opening it. 
41206      [hr]
41207      Construct an open acceptor. 
41208      [hr]
41209      Construct an acceptor opened on the given endpoint. 
41210      [hr]
41211      Construct a basic_socket_acceptor on an existing native acceptor. 
41212      [hr]
41213      Move-construct a basic_socket_acceptor from another. 
41214      [hr]
41215      Move-construct a basic_socket_acceptor from an acceptor of another protocol type. ]
41216   ]
41217   
41218   [
41219     [[link boost_asio.reference.basic_socket_acceptor.bind [*bind]]]
41220     [Bind the acceptor to the given local endpoint. ]
41221   ]
41222   
41223   [
41224     [[link boost_asio.reference.basic_socket_acceptor.cancel [*cancel]]]
41225     [Cancel all asynchronous operations associated with the acceptor. ]
41226   ]
41227   
41228   [
41229     [[link boost_asio.reference.basic_socket_acceptor.close [*close]]]
41230     [Close the acceptor. ]
41231   ]
41232   
41233   [
41234     [[link boost_asio.reference.basic_socket_acceptor.get_executor [*get_executor]]]
41235     [Get the executor associated with the object. ]
41236   ]
41237   
41238   [
41239     [[link boost_asio.reference.basic_socket_acceptor.get_option [*get_option]]]
41240     [Get an option from the acceptor. ]
41241   ]
41242   
41243   [
41244     [[link boost_asio.reference.basic_socket_acceptor.io_control [*io_control]]]
41245     [Perform an IO control command on the acceptor. ]
41246   ]
41247   
41248   [
41249     [[link boost_asio.reference.basic_socket_acceptor.is_open [*is_open]]]
41250     [Determine whether the acceptor is open. ]
41251   ]
41252   
41253   [
41254     [[link boost_asio.reference.basic_socket_acceptor.listen [*listen]]]
41255     [Place the acceptor into the state where it will listen for new connections. ]
41256   ]
41257   
41258   [
41259     [[link boost_asio.reference.basic_socket_acceptor.local_endpoint [*local_endpoint]]]
41260     [Get the local endpoint of the acceptor. ]
41261   ]
41262   
41263   [
41264     [[link boost_asio.reference.basic_socket_acceptor.native_handle [*native_handle]]]
41265     [Get the native acceptor representation. ]
41266   ]
41267   
41268   [
41269     [[link boost_asio.reference.basic_socket_acceptor.native_non_blocking [*native_non_blocking]]]
41270     [Gets the non-blocking mode of the native acceptor implementation. 
41271      [hr]
41272      Sets the non-blocking mode of the native acceptor implementation. ]
41273   ]
41274   
41275   [
41276     [[link boost_asio.reference.basic_socket_acceptor.non_blocking [*non_blocking]]]
41277     [Gets the non-blocking mode of the acceptor. 
41278      [hr]
41279      Sets the non-blocking mode of the acceptor. ]
41280   ]
41281   
41282   [
41283     [[link boost_asio.reference.basic_socket_acceptor.open [*open]]]
41284     [Open the acceptor using the specified protocol. ]
41285   ]
41286   
41287   [
41288     [[link boost_asio.reference.basic_socket_acceptor.operator_eq_ [*operator=]]]
41289     [Move-assign a basic_socket_acceptor from another. 
41290      [hr]
41291      Move-assign a basic_socket_acceptor from an acceptor of another protocol type. ]
41292   ]
41293   
41294   [
41295     [[link boost_asio.reference.basic_socket_acceptor.release [*release]]]
41296     [Release ownership of the underlying native acceptor. ]
41297   ]
41298   
41299   [
41300     [[link boost_asio.reference.basic_socket_acceptor.set_option [*set_option]]]
41301     [Set an option on the acceptor. ]
41302   ]
41303   
41304   [
41305     [[link boost_asio.reference.basic_socket_acceptor.wait [*wait]]]
41306     [Wait for the acceptor to become ready to read, ready to write, or to have pending error conditions. ]
41307   ]
41308   
41309   [
41310     [[link boost_asio.reference.basic_socket_acceptor._basic_socket_acceptor [*~basic_socket_acceptor]]]
41311     [Destroys the acceptor. ]
41312   ]
41313   
41314 ]
41315
41316 [heading Data Members]
41317 [table
41318   [[Name][Description]]
41319
41320   [
41321     [[link boost_asio.reference.basic_socket_acceptor.max_connections [*max_connections]]]
41322     [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
41323   ]
41324
41325   [
41326     [[link boost_asio.reference.basic_socket_acceptor.max_listen_connections [*max_listen_connections]]]
41327     [The maximum length of the queue of pending incoming connections. ]
41328   ]
41329
41330   [
41331     [[link boost_asio.reference.basic_socket_acceptor.message_do_not_route [*message_do_not_route]]]
41332     [Specify that the data should not be subject to routing. ]
41333   ]
41334
41335   [
41336     [[link boost_asio.reference.basic_socket_acceptor.message_end_of_record [*message_end_of_record]]]
41337     [Specifies that the data marks the end of a record. ]
41338   ]
41339
41340   [
41341     [[link boost_asio.reference.basic_socket_acceptor.message_out_of_band [*message_out_of_band]]]
41342     [Process out-of-band data. ]
41343   ]
41344
41345   [
41346     [[link boost_asio.reference.basic_socket_acceptor.message_peek [*message_peek]]]
41347     [Peek at incoming data without removing it from the input queue. ]
41348   ]
41349
41350 ]
41351
41352 The [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] class template is used for accepting new socket connections.
41353
41354
41355 [heading Thread Safety]
41356   
41357 ['Distinct] ['objects:] Safe.
41358
41359 ['Shared] ['objects:] Unsafe.
41360
41361
41362 [heading Example]
41363   
41364 Opening a socket acceptor with the SO\_REUSEADDR option enabled: 
41365
41366    boost::asio::ip::tcp::acceptor acceptor(my_context);
41367    boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), port);
41368    acceptor.open(endpoint.protocol());
41369    acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
41370    acceptor.bind(endpoint);
41371    acceptor.listen();
41372
41373
41374
41375
41376
41377
41378
41379 [heading Requirements]
41380
41381 ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
41382
41383 ['Convenience header: ][^boost/asio.hpp]
41384
41385
41386 [endsect]
41387
41388
41389
41390 [endsect]
41391
41392 [section:basic_socket_iostream basic_socket_iostream]
41393
41394
41395 Iostream interface for a socket. 
41396
41397
41398   template<
41399       typename ``[link boost_asio.reference.Protocol Protocol]``,
41400       typename Clock = chrono::steady_clock,
41401       typename ``[link boost_asio.reference.WaitTraits WaitTraits]`` = wait_traits<Clock>>
41402   class basic_socket_iostream
41403
41404
41405 [heading Types]
41406 [table
41407   [[Name][Description]]
41408
41409   [
41410
41411     [[link boost_asio.reference.basic_socket_iostream.clock_type [*clock_type]]]
41412     [The clock type. ]
41413   
41414   ]
41415
41416   [
41417
41418     [[link boost_asio.reference.basic_socket_iostream.duration [*duration]]]
41419     [The duration type. ]
41420   
41421   ]
41422
41423   [
41424
41425     [[link boost_asio.reference.basic_socket_iostream.duration_type [*duration_type]]]
41426     [(Deprecated: Use duration.) The duration type. ]
41427   
41428   ]
41429
41430   [
41431
41432     [[link boost_asio.reference.basic_socket_iostream.endpoint_type [*endpoint_type]]]
41433     [The endpoint type. ]
41434   
41435   ]
41436
41437   [
41438
41439     [[link boost_asio.reference.basic_socket_iostream.protocol_type [*protocol_type]]]
41440     [The protocol type. ]
41441   
41442   ]
41443
41444   [
41445
41446     [[link boost_asio.reference.basic_socket_iostream.time_point [*time_point]]]
41447     [The time type. ]
41448   
41449   ]
41450
41451   [
41452
41453     [[link boost_asio.reference.basic_socket_iostream.time_type [*time_type]]]
41454     [(Deprecated: Use time_point.) The time type. ]
41455   
41456   ]
41457
41458 ]
41459
41460 [heading Member Functions]
41461 [table
41462   [[Name][Description]]
41463
41464   [
41465     [[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream [*basic_socket_iostream]]]
41466     [Construct a basic_socket_iostream without establishing a connection. 
41467      [hr]
41468      Construct a basic_socket_iostream from the supplied socket. 
41469      [hr]
41470      Move-construct a basic_socket_iostream from another. 
41471      [hr]
41472      Establish a connection to an endpoint corresponding to a resolver query. ]
41473   ]
41474   
41475   [
41476     [[link boost_asio.reference.basic_socket_iostream.close [*close]]]
41477     [Close the connection. ]
41478   ]
41479   
41480   [
41481     [[link boost_asio.reference.basic_socket_iostream.connect [*connect]]]
41482     [Establish a connection to an endpoint corresponding to a resolver query. ]
41483   ]
41484   
41485   [
41486     [[link boost_asio.reference.basic_socket_iostream.error [*error]]]
41487     [Get the last error associated with the stream. ]
41488   ]
41489   
41490   [
41491     [[link boost_asio.reference.basic_socket_iostream.expires_after [*expires_after]]]
41492     [Set the stream's expiry time relative to now. ]
41493   ]
41494   
41495   [
41496     [[link boost_asio.reference.basic_socket_iostream.expires_at [*expires_at]]]
41497     [(Deprecated: Use expiry().) Get the stream's expiry time as an absolute time. 
41498      [hr]
41499      Set the stream's expiry time as an absolute time. ]
41500   ]
41501   
41502   [
41503     [[link boost_asio.reference.basic_socket_iostream.expires_from_now [*expires_from_now]]]
41504     [(Deprecated: Use expiry().) Get the stream's expiry time relative to now. 
41505      [hr]
41506      (Deprecated: Use expires_after().) Set the stream's expiry time relative to now. ]
41507   ]
41508   
41509   [
41510     [[link boost_asio.reference.basic_socket_iostream.expiry [*expiry]]]
41511     [Get the stream's expiry time as an absolute time. ]
41512   ]
41513   
41514   [
41515     [[link boost_asio.reference.basic_socket_iostream.operator_eq_ [*operator=]]]
41516     [Move-assign a basic_socket_iostream from another. ]
41517   ]
41518   
41519   [
41520     [[link boost_asio.reference.basic_socket_iostream.rdbuf [*rdbuf]]]
41521     [Return a pointer to the underlying streambuf. ]
41522   ]
41523   
41524   [
41525     [[link boost_asio.reference.basic_socket_iostream.socket [*socket]]]
41526     [Get a reference to the underlying socket. ]
41527   ]
41528   
41529 ]
41530
41531 [heading Requirements]
41532
41533 ['Header: ][^boost/asio/basic_socket_iostream.hpp]
41534
41535 ['Convenience header: ][^boost/asio.hpp]
41536
41537 [section:basic_socket_iostream basic_socket_iostream::basic_socket_iostream]
41538
41539 [indexterm2 boost_asio.indexterm.basic_socket_iostream.basic_socket_iostream..basic_socket_iostream..basic_socket_iostream] 
41540 Construct a [link boost_asio.reference.basic_socket_iostream `basic_socket_iostream`] without establishing a connection. 
41541
41542
41543   ``[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload1 basic_socket_iostream]``();
41544   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload1 more...]]``
41545
41546
41547 Construct a [link boost_asio.reference.basic_socket_iostream `basic_socket_iostream`] from the supplied socket. 
41548
41549
41550   explicit ``[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload2 basic_socket_iostream]``(
41551       basic_stream_socket< protocol_type > s);
41552   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload2 more...]]``
41553
41554
41555 Move-construct a [link boost_asio.reference.basic_socket_iostream `basic_socket_iostream`] from another. 
41556
41557
41558   ``[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload3 basic_socket_iostream]``(
41559       basic_socket_iostream && other);
41560   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload3 more...]]``
41561
41562
41563 Establish a connection to an endpoint corresponding to a resolver query. 
41564
41565
41566   template<
41567       typename T1,
41568       ... ,
41569       typename TN>
41570   explicit ``[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload4 basic_socket_iostream]``(
41571       T1 t1,
41572       ... ,
41573       TN tn);
41574   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload4 more...]]``
41575
41576
41577 [section:overload1 basic_socket_iostream::basic_socket_iostream (1 of 4 overloads)]
41578
41579
41580 Construct a [link boost_asio.reference.basic_socket_iostream `basic_socket_iostream`] without establishing a connection. 
41581
41582
41583   basic_socket_iostream();
41584
41585
41586
41587 [endsect]
41588
41589
41590
41591 [section:overload2 basic_socket_iostream::basic_socket_iostream (2 of 4 overloads)]
41592
41593
41594 Construct a [link boost_asio.reference.basic_socket_iostream `basic_socket_iostream`] from the supplied socket. 
41595
41596
41597   basic_socket_iostream(
41598       basic_stream_socket< protocol_type > s);
41599
41600
41601
41602 [endsect]
41603
41604
41605
41606 [section:overload3 basic_socket_iostream::basic_socket_iostream (3 of 4 overloads)]
41607
41608
41609 Move-construct a [link boost_asio.reference.basic_socket_iostream `basic_socket_iostream`] from another. 
41610
41611
41612   basic_socket_iostream(
41613       basic_socket_iostream && other);
41614
41615
41616
41617 [endsect]
41618
41619
41620
41621 [section:overload4 basic_socket_iostream::basic_socket_iostream (4 of 4 overloads)]
41622
41623
41624 Establish a connection to an endpoint corresponding to a resolver query. 
41625
41626
41627   template<
41628       typename T1,
41629       ... ,
41630       typename TN>
41631   basic_socket_iostream(
41632       T1 t1,
41633       ... ,
41634       TN tn);
41635
41636
41637 This constructor automatically establishes a connection based on the supplied resolver query parameters. The arguments are used to construct a resolver query object. 
41638
41639
41640 [endsect]
41641
41642
41643 [endsect]
41644
41645
41646 [section:clock_type basic_socket_iostream::clock_type]
41647
41648 [indexterm2 boost_asio.indexterm.basic_socket_iostream.clock_type..clock_type..basic_socket_iostream] 
41649 The clock type. 
41650
41651
41652   typedef Clock clock_type;
41653
41654
41655
41656 [heading Requirements]
41657
41658 ['Header: ][^boost/asio/basic_socket_iostream.hpp]
41659
41660 ['Convenience header: ][^boost/asio.hpp]
41661
41662
41663 [endsect]
41664
41665
41666
41667 [section:close basic_socket_iostream::close]
41668
41669 [indexterm2 boost_asio.indexterm.basic_socket_iostream.close..close..basic_socket_iostream] 
41670 Close the connection. 
41671
41672
41673   void close();
41674
41675
41676
41677 [endsect]
41678
41679
41680
41681 [section:connect basic_socket_iostream::connect]
41682
41683 [indexterm2 boost_asio.indexterm.basic_socket_iostream.connect..connect..basic_socket_iostream] 
41684 Establish a connection to an endpoint corresponding to a resolver query. 
41685
41686
41687   template<
41688       typename T1,
41689       ... ,
41690       typename TN>
41691   void connect(
41692       T1 t1,
41693       ... ,
41694       TN tn);
41695
41696
41697 This function automatically establishes a connection based on the supplied resolver query parameters. The arguments are used to construct a resolver query object. 
41698
41699
41700 [endsect]
41701
41702
41703
41704 [section:duration basic_socket_iostream::duration]
41705
41706 [indexterm2 boost_asio.indexterm.basic_socket_iostream.duration..duration..basic_socket_iostream] 
41707 The duration type. 
41708
41709
41710   typedef WaitTraits::duration duration;
41711
41712
41713
41714 [heading Requirements]
41715
41716 ['Header: ][^boost/asio/basic_socket_iostream.hpp]
41717
41718 ['Convenience header: ][^boost/asio.hpp]
41719
41720
41721 [endsect]
41722
41723
41724
41725 [section:duration_type basic_socket_iostream::duration_type]
41726
41727 [indexterm2 boost_asio.indexterm.basic_socket_iostream.duration_type..duration_type..basic_socket_iostream] 
41728 (Deprecated: Use duration.) The duration type. 
41729
41730
41731   typedef WaitTraits::duration_type duration_type;
41732
41733
41734
41735 [heading Requirements]
41736
41737 ['Header: ][^boost/asio/basic_socket_iostream.hpp]
41738
41739 ['Convenience header: ][^boost/asio.hpp]
41740
41741
41742 [endsect]
41743
41744
41745
41746 [section:endpoint_type basic_socket_iostream::endpoint_type]
41747
41748 [indexterm2 boost_asio.indexterm.basic_socket_iostream.endpoint_type..endpoint_type..basic_socket_iostream] 
41749 The endpoint type. 
41750
41751
41752   typedef Protocol::endpoint endpoint_type;
41753
41754
41755
41756 [heading Requirements]
41757
41758 ['Header: ][^boost/asio/basic_socket_iostream.hpp]
41759
41760 ['Convenience header: ][^boost/asio.hpp]
41761
41762
41763 [endsect]
41764
41765
41766
41767 [section:error basic_socket_iostream::error]
41768
41769 [indexterm2 boost_asio.indexterm.basic_socket_iostream.error..error..basic_socket_iostream] 
41770 Get the last error associated with the stream. 
41771
41772
41773   const boost::system::error_code & error() const;
41774
41775
41776
41777 [heading Return Value]
41778       
41779 An `error_code` corresponding to the last error from the stream.
41780
41781
41782 [heading Example]
41783   
41784 To print the error associated with a failure to establish a connection: 
41785
41786    tcp::iostream s("www.boost.org", "http");
41787    if (!s)
41788    {
41789      std::cout << "Error: " << s.error().message() << std::endl;
41790    } 
41791
41792
41793
41794
41795
41796
41797
41798 [endsect]
41799
41800
41801
41802 [section:expires_after basic_socket_iostream::expires_after]
41803
41804 [indexterm2 boost_asio.indexterm.basic_socket_iostream.expires_after..expires_after..basic_socket_iostream] 
41805 Set the stream's expiry time relative to now. 
41806
41807
41808   void expires_after(
41809       const duration & expiry_time);
41810
41811
41812 This function sets the expiry time associated with the stream. Stream operations performed after this time (where the operations cannot be completed using the internal buffers) will fail with the error `boost::asio::error::operation_aborted`.
41813
41814
41815 [heading Parameters]
41816     
41817
41818 [variablelist
41819   
41820 [[expiry_time][The expiry time to be used for the timer. ]]
41821
41822 ]
41823
41824
41825
41826
41827 [endsect]
41828
41829
41830 [section:expires_at basic_socket_iostream::expires_at]
41831
41832 [indexterm2 boost_asio.indexterm.basic_socket_iostream.expires_at..expires_at..basic_socket_iostream] 
41833 (Deprecated: Use `expiry()`.) Get the stream's expiry time as an absolute time. 
41834
41835
41836   time_point ``[link boost_asio.reference.basic_socket_iostream.expires_at.overload1 expires_at]``() const;
41837   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_iostream.expires_at.overload1 more...]]``
41838
41839
41840 Set the stream's expiry time as an absolute time. 
41841
41842
41843   void ``[link boost_asio.reference.basic_socket_iostream.expires_at.overload2 expires_at]``(
41844       const time_point & expiry_time);
41845   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_iostream.expires_at.overload2 more...]]``
41846
41847
41848 [section:overload1 basic_socket_iostream::expires_at (1 of 2 overloads)]
41849
41850
41851 (Deprecated: Use `expiry()`.) Get the stream's expiry time as an absolute time. 
41852
41853
41854   time_point expires_at() const;
41855
41856
41857
41858 [heading Return Value]
41859       
41860 An absolute time value representing the stream's expiry time. 
41861
41862
41863
41864
41865 [endsect]
41866
41867
41868
41869 [section:overload2 basic_socket_iostream::expires_at (2 of 2 overloads)]
41870
41871
41872 Set the stream's expiry time as an absolute time. 
41873
41874
41875   void expires_at(
41876       const time_point & expiry_time);
41877
41878
41879 This function sets the expiry time associated with the stream. Stream operations performed after this time (where the operations cannot be completed using the internal buffers) will fail with the error `boost::asio::error::operation_aborted`.
41880
41881
41882 [heading Parameters]
41883     
41884
41885 [variablelist
41886   
41887 [[expiry_time][The expiry time to be used for the stream. ]]
41888
41889 ]
41890
41891
41892
41893
41894 [endsect]
41895
41896
41897 [endsect]
41898
41899 [section:expires_from_now basic_socket_iostream::expires_from_now]
41900
41901 [indexterm2 boost_asio.indexterm.basic_socket_iostream.expires_from_now..expires_from_now..basic_socket_iostream] 
41902 (Deprecated: Use `expiry()`.) Get the stream's expiry time relative to now. 
41903
41904
41905   duration ``[link boost_asio.reference.basic_socket_iostream.expires_from_now.overload1 expires_from_now]``() const;
41906   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_iostream.expires_from_now.overload1 more...]]``
41907
41908
41909 (Deprecated: Use `expires_after()`.) Set the stream's expiry time relative to now. 
41910
41911
41912   void ``[link boost_asio.reference.basic_socket_iostream.expires_from_now.overload2 expires_from_now]``(
41913       const duration & expiry_time);
41914   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_iostream.expires_from_now.overload2 more...]]``
41915
41916
41917 [section:overload1 basic_socket_iostream::expires_from_now (1 of 2 overloads)]
41918
41919
41920 (Deprecated: Use `expiry()`.) Get the stream's expiry time relative to now. 
41921
41922
41923   duration expires_from_now() const;
41924
41925
41926
41927 [heading Return Value]
41928       
41929 A relative time value representing the stream's expiry time. 
41930
41931
41932
41933
41934 [endsect]
41935
41936
41937
41938 [section:overload2 basic_socket_iostream::expires_from_now (2 of 2 overloads)]
41939
41940
41941 (Deprecated: Use `expires_after()`.) Set the stream's expiry time relative to now. 
41942
41943
41944   void expires_from_now(
41945       const duration & expiry_time);
41946
41947
41948 This function sets the expiry time associated with the stream. Stream operations performed after this time (where the operations cannot be completed using the internal buffers) will fail with the error `boost::asio::error::operation_aborted`.
41949
41950
41951 [heading Parameters]
41952     
41953
41954 [variablelist
41955   
41956 [[expiry_time][The expiry time to be used for the timer. ]]
41957
41958 ]
41959
41960
41961
41962
41963 [endsect]
41964
41965
41966 [endsect]
41967
41968
41969 [section:expiry basic_socket_iostream::expiry]
41970
41971 [indexterm2 boost_asio.indexterm.basic_socket_iostream.expiry..expiry..basic_socket_iostream] 
41972 Get the stream's expiry time as an absolute time. 
41973
41974
41975   time_point expiry() const;
41976
41977
41978
41979 [heading Return Value]
41980       
41981 An absolute time value representing the stream's expiry time. 
41982
41983
41984
41985
41986 [endsect]
41987
41988
41989
41990 [section:operator_eq_ basic_socket_iostream::operator=]
41991
41992 [indexterm2 boost_asio.indexterm.basic_socket_iostream.operator_eq_..operator=..basic_socket_iostream] 
41993 Move-assign a [link boost_asio.reference.basic_socket_iostream `basic_socket_iostream`] from another. 
41994
41995
41996   basic_socket_iostream & operator=(
41997       basic_socket_iostream && other);
41998
41999
42000
42001 [endsect]
42002
42003
42004
42005 [section:protocol_type basic_socket_iostream::protocol_type]
42006
42007 [indexterm2 boost_asio.indexterm.basic_socket_iostream.protocol_type..protocol_type..basic_socket_iostream] 
42008 The protocol type. 
42009
42010
42011   typedef Protocol protocol_type;
42012
42013
42014
42015 [heading Requirements]
42016
42017 ['Header: ][^boost/asio/basic_socket_iostream.hpp]
42018
42019 ['Convenience header: ][^boost/asio.hpp]
42020
42021
42022 [endsect]
42023
42024
42025
42026 [section:rdbuf basic_socket_iostream::rdbuf]
42027
42028 [indexterm2 boost_asio.indexterm.basic_socket_iostream.rdbuf..rdbuf..basic_socket_iostream] 
42029 Return a pointer to the underlying streambuf. 
42030
42031
42032   basic_socket_streambuf< Protocol, Clock, WaitTraits > * rdbuf() const;
42033
42034
42035
42036 [endsect]
42037
42038
42039
42040 [section:socket basic_socket_iostream::socket]
42041
42042 [indexterm2 boost_asio.indexterm.basic_socket_iostream.socket..socket..basic_socket_iostream] 
42043 Get a reference to the underlying socket. 
42044
42045
42046   basic_socket< Protocol > & socket();
42047
42048
42049
42050 [endsect]
42051
42052
42053
42054 [section:time_point basic_socket_iostream::time_point]
42055
42056 [indexterm2 boost_asio.indexterm.basic_socket_iostream.time_point..time_point..basic_socket_iostream] 
42057 The time type. 
42058
42059
42060   typedef WaitTraits::time_point time_point;
42061
42062
42063
42064 [heading Requirements]
42065
42066 ['Header: ][^boost/asio/basic_socket_iostream.hpp]
42067
42068 ['Convenience header: ][^boost/asio.hpp]
42069
42070
42071 [endsect]
42072
42073
42074
42075 [section:time_type basic_socket_iostream::time_type]
42076
42077 [indexterm2 boost_asio.indexterm.basic_socket_iostream.time_type..time_type..basic_socket_iostream] 
42078 (Deprecated: Use time\_point.) The time type. 
42079
42080
42081   typedef WaitTraits::time_type time_type;
42082
42083
42084
42085 [heading Requirements]
42086
42087 ['Header: ][^boost/asio/basic_socket_iostream.hpp]
42088
42089 ['Convenience header: ][^boost/asio.hpp]
42090
42091
42092 [endsect]
42093
42094
42095
42096 [endsect]
42097
42098 [section:basic_socket_streambuf basic_socket_streambuf]
42099
42100
42101 Iostream streambuf for a socket. 
42102
42103
42104   template<
42105       typename ``[link boost_asio.reference.Protocol Protocol]``,
42106       typename Clock = chrono::steady_clock,
42107       typename ``[link boost_asio.reference.WaitTraits WaitTraits]`` = wait_traits<Clock>>
42108   class basic_socket_streambuf :
42109     basic_socket< Protocol >
42110
42111
42112 [heading Types]
42113 [table
42114   [[Name][Description]]
42115
42116   [
42117
42118     [[link boost_asio.reference.basic_socket_streambuf.clock_type [*clock_type]]]
42119     [The clock type. ]
42120   
42121   ]
42122
42123   [
42124
42125     [[link boost_asio.reference.basic_socket_streambuf.duration [*duration]]]
42126     [The duration type. ]
42127   
42128   ]
42129
42130   [
42131
42132     [[link boost_asio.reference.basic_socket_streambuf.duration_type [*duration_type]]]
42133     [(Deprecated: Use duration.) The duration type. ]
42134   
42135   ]
42136
42137   [
42138
42139     [[link boost_asio.reference.basic_socket_streambuf.endpoint_type [*endpoint_type]]]
42140     [The endpoint type. ]
42141   
42142   ]
42143
42144   [
42145
42146     [[link boost_asio.reference.basic_socket_streambuf.protocol_type [*protocol_type]]]
42147     [The protocol type. ]
42148   
42149   ]
42150
42151   [
42152
42153     [[link boost_asio.reference.basic_socket_streambuf.time_point [*time_point]]]
42154     [The time type. ]
42155   
42156   ]
42157
42158   [
42159
42160     [[link boost_asio.reference.basic_socket_streambuf.time_type [*time_type]]]
42161     [(Deprecated: Use time_point.) The time type. ]
42162   
42163   ]
42164
42165 ]
42166
42167 [heading Member Functions]
42168 [table
42169   [[Name][Description]]
42170
42171   [
42172     [[link boost_asio.reference.basic_socket_streambuf.basic_socket_streambuf [*basic_socket_streambuf]]]
42173     [Construct a basic_socket_streambuf without establishing a connection. 
42174      [hr]
42175      Construct a basic_socket_streambuf from the supplied socket. 
42176      [hr]
42177      Move-construct a basic_socket_streambuf from another. ]
42178   ]
42179   
42180   [
42181     [[link boost_asio.reference.basic_socket_streambuf.close [*close]]]
42182     [Close the connection. ]
42183   ]
42184   
42185   [
42186     [[link boost_asio.reference.basic_socket_streambuf.connect [*connect]]]
42187     [Establish a connection. ]
42188   ]
42189   
42190   [
42191     [[link boost_asio.reference.basic_socket_streambuf.error [*error]]]
42192     [Get the last error associated with the stream buffer. ]
42193   ]
42194   
42195   [
42196     [[link boost_asio.reference.basic_socket_streambuf.expires_after [*expires_after]]]
42197     [Set the stream buffer's expiry time relative to now. ]
42198   ]
42199   
42200   [
42201     [[link boost_asio.reference.basic_socket_streambuf.expires_at [*expires_at]]]
42202     [(Deprecated: Use expiry().) Get the stream buffer's expiry time as an absolute time. 
42203      [hr]
42204      Set the stream buffer's expiry time as an absolute time. ]
42205   ]
42206   
42207   [
42208     [[link boost_asio.reference.basic_socket_streambuf.expires_from_now [*expires_from_now]]]
42209     [(Deprecated: Use expiry().) Get the stream buffer's expiry time relative to now. 
42210      [hr]
42211      (Deprecated: Use expires_after().) Set the stream buffer's expiry time relative to now. ]
42212   ]
42213   
42214   [
42215     [[link boost_asio.reference.basic_socket_streambuf.expiry [*expiry]]]
42216     [Get the stream buffer's expiry time as an absolute time. ]
42217   ]
42218   
42219   [
42220     [[link boost_asio.reference.basic_socket_streambuf.operator_eq_ [*operator=]]]
42221     [Move-assign a basic_socket_streambuf from another. ]
42222   ]
42223   
42224   [
42225     [[link boost_asio.reference.basic_socket_streambuf.puberror [*puberror]]]
42226     [(Deprecated: Use error().) Get the last error associated with the stream buffer. ]
42227   ]
42228   
42229   [
42230     [[link boost_asio.reference.basic_socket_streambuf.socket [*socket]]]
42231     [Get a reference to the underlying socket. ]
42232   ]
42233   
42234   [
42235     [[link boost_asio.reference.basic_socket_streambuf._basic_socket_streambuf [*~basic_socket_streambuf]]]
42236     [Destructor flushes buffered data. ]
42237   ]
42238   
42239 ]
42240
42241 [heading Protected Member Functions]
42242 [table
42243   [[Name][Description]]
42244
42245   [
42246     [[link boost_asio.reference.basic_socket_streambuf.overflow [*overflow]]]
42247     []
42248   ]
42249   
42250   [
42251     [[link boost_asio.reference.basic_socket_streambuf.setbuf [*setbuf]]]
42252     []
42253   ]
42254   
42255   [
42256     [[link boost_asio.reference.basic_socket_streambuf.sync [*sync]]]
42257     []
42258   ]
42259   
42260   [
42261     [[link boost_asio.reference.basic_socket_streambuf.underflow [*underflow]]]
42262     []
42263   ]
42264   
42265 ]
42266
42267 [heading Requirements]
42268
42269 ['Header: ][^boost/asio/basic_socket_streambuf.hpp]
42270
42271 ['Convenience header: ][^boost/asio.hpp]
42272
42273 [section:basic_socket_streambuf basic_socket_streambuf::basic_socket_streambuf]
42274
42275 [indexterm2 boost_asio.indexterm.basic_socket_streambuf.basic_socket_streambuf..basic_socket_streambuf..basic_socket_streambuf] 
42276 Construct a [link boost_asio.reference.basic_socket_streambuf `basic_socket_streambuf`] without establishing a connection. 
42277
42278
42279   ``[link boost_asio.reference.basic_socket_streambuf.basic_socket_streambuf.overload1 basic_socket_streambuf]``();
42280   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.basic_socket_streambuf.overload1 more...]]``
42281
42282
42283 Construct a [link boost_asio.reference.basic_socket_streambuf `basic_socket_streambuf`] from the supplied socket. 
42284
42285
42286   explicit ``[link boost_asio.reference.basic_socket_streambuf.basic_socket_streambuf.overload2 basic_socket_streambuf]``(
42287       basic_stream_socket< protocol_type > s);
42288   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.basic_socket_streambuf.overload2 more...]]``
42289
42290
42291 Move-construct a [link boost_asio.reference.basic_socket_streambuf `basic_socket_streambuf`] from another. 
42292
42293
42294   ``[link boost_asio.reference.basic_socket_streambuf.basic_socket_streambuf.overload3 basic_socket_streambuf]``(
42295       basic_socket_streambuf && other);
42296   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.basic_socket_streambuf.overload3 more...]]``
42297
42298
42299 [section:overload1 basic_socket_streambuf::basic_socket_streambuf (1 of 3 overloads)]
42300
42301
42302 Construct a [link boost_asio.reference.basic_socket_streambuf `basic_socket_streambuf`] without establishing a connection. 
42303
42304
42305   basic_socket_streambuf();
42306
42307
42308
42309 [endsect]
42310
42311
42312
42313 [section:overload2 basic_socket_streambuf::basic_socket_streambuf (2 of 3 overloads)]
42314
42315
42316 Construct a [link boost_asio.reference.basic_socket_streambuf `basic_socket_streambuf`] from the supplied socket. 
42317
42318
42319   basic_socket_streambuf(
42320       basic_stream_socket< protocol_type > s);
42321
42322
42323
42324 [endsect]
42325
42326
42327
42328 [section:overload3 basic_socket_streambuf::basic_socket_streambuf (3 of 3 overloads)]
42329
42330
42331 Move-construct a [link boost_asio.reference.basic_socket_streambuf `basic_socket_streambuf`] from another. 
42332
42333
42334   basic_socket_streambuf(
42335       basic_socket_streambuf && other);
42336
42337
42338
42339 [endsect]
42340
42341
42342 [endsect]
42343
42344
42345 [section:clock_type basic_socket_streambuf::clock_type]
42346
42347 [indexterm2 boost_asio.indexterm.basic_socket_streambuf.clock_type..clock_type..basic_socket_streambuf] 
42348 The clock type. 
42349
42350
42351   typedef Clock clock_type;
42352
42353
42354
42355 [heading Requirements]
42356
42357 ['Header: ][^boost/asio/basic_socket_streambuf.hpp]
42358
42359 ['Convenience header: ][^boost/asio.hpp]
42360
42361
42362 [endsect]
42363
42364
42365
42366 [section:close basic_socket_streambuf::close]
42367
42368 [indexterm2 boost_asio.indexterm.basic_socket_streambuf.close..close..basic_socket_streambuf] 
42369 Close the connection. 
42370
42371
42372   basic_socket_streambuf * close();
42373
42374
42375
42376 [heading Return Value]
42377       
42378 `this` if a connection was successfully established, a null pointer otherwise. 
42379
42380
42381
42382
42383 [endsect]
42384
42385
42386 [section:connect basic_socket_streambuf::connect]
42387
42388 [indexterm2 boost_asio.indexterm.basic_socket_streambuf.connect..connect..basic_socket_streambuf] 
42389 Establish a connection. 
42390
42391
42392   basic_socket_streambuf * ``[link boost_asio.reference.basic_socket_streambuf.connect.overload1 connect]``(
42393       const endpoint_type & endpoint);
42394   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.connect.overload1 more...]]``
42395
42396   template<
42397       typename T1,
42398       ... ,
42399       typename TN>
42400   basic_socket_streambuf * ``[link boost_asio.reference.basic_socket_streambuf.connect.overload2 connect]``(
42401       T1 t1,
42402       ... ,
42403       TN tn);
42404   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.connect.overload2 more...]]``
42405
42406
42407 [section:overload1 basic_socket_streambuf::connect (1 of 2 overloads)]
42408
42409
42410 Establish a connection. 
42411
42412
42413   basic_socket_streambuf * connect(
42414       const endpoint_type & endpoint);
42415
42416
42417 This function establishes a connection to the specified endpoint.
42418
42419
42420 [heading Return Value]
42421       
42422 `this` if a connection was successfully established, a null pointer otherwise. 
42423
42424
42425
42426
42427 [endsect]
42428
42429
42430
42431 [section:overload2 basic_socket_streambuf::connect (2 of 2 overloads)]
42432
42433
42434 Establish a connection. 
42435
42436
42437   template<
42438       typename T1,
42439       ... ,
42440       typename TN>
42441   basic_socket_streambuf * connect(
42442       T1 t1,
42443       ... ,
42444       TN tn);
42445
42446
42447 This function automatically establishes a connection based on the supplied resolver query parameters. The arguments are used to construct a resolver query object.
42448
42449
42450 [heading Return Value]
42451       
42452 `this` if a connection was successfully established, a null pointer otherwise. 
42453
42454
42455
42456
42457 [endsect]
42458
42459
42460 [endsect]
42461
42462
42463 [section:duration basic_socket_streambuf::duration]
42464
42465 [indexterm2 boost_asio.indexterm.basic_socket_streambuf.duration..duration..basic_socket_streambuf] 
42466 The duration type. 
42467
42468
42469   typedef WaitTraits::duration duration;
42470
42471
42472
42473 [heading Requirements]
42474
42475 ['Header: ][^boost/asio/basic_socket_streambuf.hpp]
42476
42477 ['Convenience header: ][^boost/asio.hpp]
42478
42479
42480 [endsect]
42481
42482
42483
42484 [section:duration_type basic_socket_streambuf::duration_type]
42485
42486 [indexterm2 boost_asio.indexterm.basic_socket_streambuf.duration_type..duration_type..basic_socket_streambuf] 
42487 (Deprecated: Use duration.) The duration type. 
42488
42489
42490   typedef WaitTraits::duration_type duration_type;
42491
42492
42493
42494 [heading Requirements]
42495
42496 ['Header: ][^boost/asio/basic_socket_streambuf.hpp]
42497
42498 ['Convenience header: ][^boost/asio.hpp]
42499
42500
42501 [endsect]
42502
42503
42504
42505 [section:endpoint_type basic_socket_streambuf::endpoint_type]
42506
42507 [indexterm2 boost_asio.indexterm.basic_socket_streambuf.endpoint_type..endpoint_type..basic_socket_streambuf] 
42508 The endpoint type. 
42509
42510
42511   typedef Protocol::endpoint endpoint_type;
42512
42513
42514
42515 [heading Requirements]
42516
42517 ['Header: ][^boost/asio/basic_socket_streambuf.hpp]
42518
42519 ['Convenience header: ][^boost/asio.hpp]
42520
42521
42522 [endsect]
42523
42524
42525
42526 [section:error basic_socket_streambuf::error]
42527
42528 [indexterm2 boost_asio.indexterm.basic_socket_streambuf.error..error..basic_socket_streambuf] 
42529 Get the last error associated with the stream buffer. 
42530
42531
42532   const boost::system::error_code & error() const;
42533
42534
42535
42536 [heading Return Value]
42537       
42538 An `error_code` corresponding to the last error from the stream buffer. 
42539
42540
42541
42542
42543 [endsect]
42544
42545
42546
42547 [section:expires_after basic_socket_streambuf::expires_after]
42548
42549 [indexterm2 boost_asio.indexterm.basic_socket_streambuf.expires_after..expires_after..basic_socket_streambuf] 
42550 Set the stream buffer's expiry time relative to now. 
42551
42552
42553   void expires_after(
42554       const duration & expiry_time);
42555
42556
42557 This function sets the expiry time associated with the stream. Stream operations performed after this time (where the operations cannot be completed using the internal buffers) will fail with the error `boost::asio::error::operation_aborted`.
42558
42559
42560 [heading Parameters]
42561     
42562
42563 [variablelist
42564   
42565 [[expiry_time][The expiry time to be used for the timer. ]]
42566
42567 ]
42568
42569
42570
42571
42572 [endsect]
42573
42574
42575 [section:expires_at basic_socket_streambuf::expires_at]
42576
42577 [indexterm2 boost_asio.indexterm.basic_socket_streambuf.expires_at..expires_at..basic_socket_streambuf] 
42578 (Deprecated: Use `expiry()`.) Get the stream buffer's expiry time as an absolute time. 
42579
42580
42581   time_point ``[link boost_asio.reference.basic_socket_streambuf.expires_at.overload1 expires_at]``() const;
42582   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.expires_at.overload1 more...]]``
42583
42584
42585 Set the stream buffer's expiry time as an absolute time. 
42586
42587
42588   void ``[link boost_asio.reference.basic_socket_streambuf.expires_at.overload2 expires_at]``(
42589       const time_point & expiry_time);
42590   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.expires_at.overload2 more...]]``
42591
42592
42593 [section:overload1 basic_socket_streambuf::expires_at (1 of 2 overloads)]
42594
42595
42596 (Deprecated: Use `expiry()`.) Get the stream buffer's expiry time as an absolute time. 
42597
42598
42599   time_point expires_at() const;
42600
42601
42602
42603 [heading Return Value]
42604       
42605 An absolute time value representing the stream buffer's expiry time. 
42606
42607
42608
42609
42610 [endsect]
42611
42612
42613
42614 [section:overload2 basic_socket_streambuf::expires_at (2 of 2 overloads)]
42615
42616
42617 Set the stream buffer's expiry time as an absolute time. 
42618
42619
42620   void expires_at(
42621       const time_point & expiry_time);
42622
42623
42624 This function sets the expiry time associated with the stream. Stream operations performed after this time (where the operations cannot be completed using the internal buffers) will fail with the error `boost::asio::error::operation_aborted`.
42625
42626
42627 [heading Parameters]
42628     
42629
42630 [variablelist
42631   
42632 [[expiry_time][The expiry time to be used for the stream. ]]
42633
42634 ]
42635
42636
42637
42638
42639 [endsect]
42640
42641
42642 [endsect]
42643
42644 [section:expires_from_now basic_socket_streambuf::expires_from_now]
42645
42646 [indexterm2 boost_asio.indexterm.basic_socket_streambuf.expires_from_now..expires_from_now..basic_socket_streambuf] 
42647 (Deprecated: Use `expiry()`.) Get the stream buffer's expiry time relative to now. 
42648
42649
42650   duration ``[link boost_asio.reference.basic_socket_streambuf.expires_from_now.overload1 expires_from_now]``() const;
42651   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.expires_from_now.overload1 more...]]``
42652
42653
42654 (Deprecated: Use `expires_after()`.) Set the stream buffer's expiry time relative to now. 
42655
42656
42657   void ``[link boost_asio.reference.basic_socket_streambuf.expires_from_now.overload2 expires_from_now]``(
42658       const duration & expiry_time);
42659   ``  [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.expires_from_now.overload2 more...]]``
42660
42661
42662 [section:overload1 basic_socket_streambuf::expires_from_now (1 of 2 overloads)]
42663
42664
42665 (Deprecated: Use `expiry()`.) Get the stream buffer's expiry time relative to now. 
42666
42667
42668   duration expires_from_now() const;
42669
42670
42671
42672 [heading Return Value]
42673       
42674 A relative time value representing the stream buffer's expiry time. 
42675
42676
42677
42678
42679 [endsect]
42680
42681
42682
42683 [section:overload2 basic_socket_streambuf::expires_from_now (2 of 2 overloads)]
42684
42685
42686 (Deprecated: Use `expires_after()`.) Set the stream buffer's expiry time relative to now. 
42687
42688
42689   void expires_from_now(
42690       const duration & expiry_time);
42691
42692
42693 This function sets the expiry time associated with the stream. Stream operations performed after this time (where the operations cannot be completed using the internal buffers) will fail with the error `boost::asio::error::operation_aborted`.
42694
42695
42696 [heading Parameters]
42697     
42698
42699 [variablelist
42700   
42701 [[expiry_time][The expiry time to be used for the timer. ]]
42702
42703 ]
42704
42705
42706
42707
42708 [endsect]
42709
42710
42711 [endsect]
42712
42713
42714 [section:expiry basic_socket_streambuf::expiry]
42715
42716 [indexterm2 boost_asio.indexterm.basic_socket_streambuf.expiry..expiry..basic_socket_streambuf] 
42717 Get the stream buffer's expiry time as an absolute time. 
42718
42719
42720   time_point expiry() const;
42721
42722
42723
42724 [heading Return Value]
42725       
42726 An absolute time value representing the stream buffer's expiry time. 
42727
42728
42729
42730
42731 [endsect]
42732
42733
42734
42735 [section:operator_eq_ basic_socket_streambuf::operator=]
42736
42737 [indexterm2 boost_asio.indexterm.basic_socket_streambuf.operator_eq_..operator=..basic_socket_streambuf] 
42738 Move-assign a [link boost_asio.reference.basic_socket_streambuf `basic_socket_streambuf`] from another. 
42739
42740
42741   basic_socket_streambuf & operator=(
42742       basic_socket_streambuf && other);
42743
42744
42745
42746 [endsect]
42747
42748
42749
42750 [section:overflow basic_socket_streambuf::overflow]
42751
42752 [indexterm2 boost_asio.indexterm.basic_socket_streambuf.overflow..overflow..basic_socket_streambuf] 
42753
42754   int_type overflow(
42755       int_type c);
42756
42757
42758
42759 [endsect]
42760
42761
42762
42763 [section:protocol_type basic_socket_streambuf::protocol_type]
42764
42765 [indexterm2 boost_asio.indexterm.basic_socket_streambuf.protocol_type..protocol_type..basic_socket_streambuf] 
42766 The protocol type. 
42767
42768
42769   typedef Protocol protocol_type;
42770
42771
42772
42773 [heading Requirements]
42774
42775 ['Header: ][^boost/asio/basic_socket_streambuf.hpp]
42776
42777 ['Convenience header: ][^boost/asio.hpp]
42778
42779
42780 [endsect]
42781
42782
42783
42784 [section:puberror basic_socket_streambuf::puberror]
42785
42786 [indexterm2 boost_asio.indexterm.basic_socket_streambuf.puberror..puberror..basic_socket_streambuf] 
42787 (Deprecated: Use `error()`.) Get the last error associated with the stream buffer. 
42788
42789
42790   const boost::system::error_code & puberror() const;
42791
42792
42793
42794 [heading Return Value]
42795       
42796 An `error_code` corresponding to the last error from the stream buffer. 
42797
42798
42799
42800
42801 [endsect]
42802
42803
42804
42805 [section:setbuf basic_socket_streambuf::setbuf]
42806
42807 [indexterm2 boost_asio.indexterm.basic_socket_streambuf.setbuf..setbuf..basic_socket_streambuf] 
42808
42809   std::streambuf * setbuf(
42810       char_type * s,
42811       std::streamsize n);
42812
42813
42814
42815 [endsect]
42816
42817
42818
42819 [section:socket basic_socket_streambuf::socket]
42820
42821 [indexterm2 boost_asio.indexterm.basic_socket_streambuf.socket..socket..basic_socket_streambuf] 
42822 Get a reference to the underlying socket. 
42823
42824
42825   basic_socket< Protocol > & socket();
42826
42827
42828
42829 [endsect]
42830
42831
42832
42833 [section:sync basic_socket_streambuf::sync]
42834
42835 [indexterm2 boost_asio.indexterm.basic_socket_streambuf.sync..sync..basic_socket_streambuf] 
42836
42837   int sync();
42838
42839
42840
42841 [endsect]
42842
42843
42844
42845 [section:time_point basic_socket_streambuf::time_point]
42846
42847 [indexterm2 boost_asio.indexterm.basic_socket_streambuf.time_point..time_point..basic_socket_streambuf] 
42848 The time type. 
42849
42850
42851   typedef WaitTraits::time_point time_point;
42852
42853
42854
42855 [heading Requirements]
42856
42857 ['Header: ][^boost/asio/basic_socket_streambuf.hpp]
42858
42859 ['Convenience header: ][^boost/asio.hpp]
42860
42861
42862 [endsect]
42863
42864
42865
42866 [section:time_type basic_socket_streambuf::time_type]
42867
42868 [indexterm2 boost_asio.indexterm.basic_socket_streambuf.time_type..time_type..basic_socket_streambuf] 
42869 (Deprecated: Use time\_point.) The time type. 
42870
42871
42872   typedef WaitTraits::time_type time_type;
42873
42874
42875
42876 [heading Requirements]
42877
42878 ['Header: ][^boost/asio/basic_socket_streambuf.hpp]
42879
42880 ['Convenience header: ][^boost/asio.hpp]
42881
42882
42883 [endsect]
42884
42885
42886
42887 [section:underflow basic_socket_streambuf::underflow]
42888
42889 [indexterm2 boost_asio.indexterm.basic_socket_streambuf.underflow..underflow..basic_socket_streambuf] 
42890
42891   int_type underflow();
42892
42893
42894
42895 [endsect]
42896
42897
42898
42899 [section:_basic_socket_streambuf basic_socket_streambuf::~basic_socket_streambuf]
42900
42901 [indexterm2 boost_asio.indexterm.basic_socket_streambuf._basic_socket_streambuf..~basic_socket_streambuf..basic_socket_streambuf] 
42902 Destructor flushes buffered data. 
42903
42904
42905   virtual ~basic_socket_streambuf();
42906
42907
42908
42909 [endsect]
42910
42911
42912
42913 [endsect]
42914
42915 [section:basic_stream_socket basic_stream_socket]
42916
42917
42918 Provides stream-oriented socket functionality. 
42919
42920
42921   template<
42922       typename ``[link boost_asio.reference.Protocol Protocol]``,
42923       typename ``[link boost_asio.reference.Executor1 Executor]``>
42924   class basic_stream_socket :
42925     public basic_socket< Protocol, Executor >
42926
42927
42928 [heading Types]
42929 [table
42930   [[Name][Description]]
42931
42932   [
42933
42934     [[link boost_asio.reference.basic_stream_socket__rebind_executor [*rebind_executor]]]
42935     [Rebinds the socket type to another executor. ]
42936   
42937   ]
42938
42939   [
42940
42941     [[link boost_asio.reference.basic_stream_socket.broadcast [*broadcast]]]
42942     [Socket option to permit sending of broadcast messages. ]
42943   
42944   ]
42945
42946   [
42947
42948     [[link boost_asio.reference.basic_stream_socket.bytes_readable [*bytes_readable]]]
42949     [IO control command to get the amount of data that can be read without blocking. ]
42950   
42951   ]
42952
42953   [
42954
42955     [[link boost_asio.reference.basic_stream_socket.debug [*debug]]]
42956     [Socket option to enable socket-level debugging. ]
42957   
42958   ]
42959
42960   [
42961
42962     [[link boost_asio.reference.basic_stream_socket.do_not_route [*do_not_route]]]
42963     [Socket option to prevent routing, use local interfaces only. ]
42964   
42965   ]
42966
42967   [
42968
42969     [[link boost_asio.reference.basic_stream_socket.enable_connection_aborted [*enable_connection_aborted]]]
42970     [Socket option to report aborted connections on accept. ]
42971   
42972   ]
42973
42974   [
42975
42976     [[link boost_asio.reference.basic_stream_socket.endpoint_type [*endpoint_type]]]
42977     [The endpoint type. ]
42978   
42979   ]
42980
42981   [
42982
42983     [[link boost_asio.reference.basic_stream_socket.executor_type [*executor_type]]]
42984     [The type of the executor associated with the object. ]
42985   
42986   ]
42987
42988   [
42989
42990     [[link boost_asio.reference.basic_stream_socket.keep_alive [*keep_alive]]]
42991     [Socket option to send keep-alives. ]
42992   
42993   ]
42994
42995   [
42996
42997     [[link boost_asio.reference.basic_stream_socket.linger [*linger]]]
42998     [Socket option to specify whether the socket lingers on close if unsent data is present. ]
42999   
43000   ]
43001
43002   [
43003
43004     [[link boost_asio.reference.basic_stream_socket.lowest_layer_type [*lowest_layer_type]]]
43005     [A basic_socket is always the lowest layer. ]
43006   
43007   ]
43008
43009   [
43010
43011     [[link boost_asio.reference.basic_stream_socket.message_flags [*message_flags]]]
43012     [Bitmask type for flags that can be passed to send and receive operations. ]
43013   
43014   ]
43015
43016   [
43017
43018     [[link boost_asio.reference.basic_stream_socket.native_handle_type [*native_handle_type]]]
43019     [The native representation of a socket. ]
43020   
43021   ]
43022
43023   [
43024
43025     [[link boost_asio.reference.basic_stream_socket.out_of_band_inline [*out_of_band_inline]]]
43026     [Socket option for putting received out-of-band data inline. ]
43027   
43028   ]
43029
43030   [
43031
43032     [[link boost_asio.reference.basic_stream_socket.protocol_type [*protocol_type]]]
43033     [The protocol type. ]
43034   
43035   ]
43036
43037   [
43038
43039     [[link boost_asio.reference.basic_stream_socket.receive_buffer_size [*receive_buffer_size]]]
43040     [Socket option for the receive buffer size of a socket. ]
43041   
43042   ]
43043
43044   [
43045
43046     [[link boost_asio.reference.basic_stream_socket.receive_low_watermark [*receive_low_watermark]]]
43047     [Socket option for the receive low watermark. ]
43048   
43049   ]
43050
43051   [
43052
43053     [[link boost_asio.reference.basic_stream_socket.reuse_address [*reuse_address]]]
43054     [Socket option to allow the socket to be bound to an address that is already in use. ]
43055   
43056   ]
43057
43058   [
43059
43060     [[link boost_asio.reference.basic_stream_socket.send_buffer_size [*send_buffer_size]]]
43061     [Socket option for the send buffer size of a socket. ]
43062   
43063   ]
43064
43065   [
43066
43067     [[link boost_asio.reference.basic_stream_socket.send_low_watermark [*send_low_watermark]]]
43068     [Socket option for the send low watermark. ]
43069   
43070   ]
43071
43072   [
43073
43074     [[link boost_asio.reference.basic_stream_socket.shutdown_type [*shutdown_type]]]
43075     [Different ways a socket may be shutdown. ]
43076   
43077   ]
43078
43079   [
43080
43081     [[link boost_asio.reference.basic_stream_socket.wait_type [*wait_type]]]
43082     [Wait types. ]
43083   
43084   ]
43085
43086 ]
43087
43088 [heading Member Functions]
43089 [table
43090   [[Name][Description]]
43091
43092   [
43093     [[link boost_asio.reference.basic_stream_socket.assign [*assign]]]
43094     [Assign an existing native socket to the socket. ]
43095   ]
43096   
43097   [
43098     [[link boost_asio.reference.basic_stream_socket.async_connect [*async_connect]]]
43099     [Start an asynchronous connect. ]
43100   ]
43101   
43102   [
43103     [[link boost_asio.reference.basic_stream_socket.async_read_some [*async_read_some]]]
43104     [Start an asynchronous read. ]
43105   ]
43106   
43107   [
43108     [[link boost_asio.reference.basic_stream_socket.async_receive [*async_receive]]]
43109     [Start an asynchronous receive. ]
43110   ]
43111   
43112   [
43113     [[link boost_asio.reference.basic_stream_socket.async_send [*async_send]]]
43114     [Start an asynchronous send. ]
43115   ]
43116   
43117   [
43118     [[link boost_asio.reference.basic_stream_socket.async_wait [*async_wait]]]
43119     [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
43120   ]
43121   
43122   [
43123     [[link boost_asio.reference.basic_stream_socket.async_write_some [*async_write_some]]]
43124     [Start an asynchronous write. ]
43125   ]
43126   
43127   [
43128     [[link boost_asio.reference.basic_stream_socket.at_mark [*at_mark]]]
43129     [Determine whether the socket is at the out-of-band data mark. ]
43130   ]
43131   
43132   [
43133     [[link boost_asio.reference.basic_stream_socket.available [*available]]]
43134     [Determine the number of bytes available for reading. ]
43135   ]
43136   
43137   [
43138     [[link boost_asio.reference.basic_stream_socket.basic_stream_socket [*basic_stream_socket]]]
43139     [Construct a basic_stream_socket without opening it. 
43140      [hr]
43141      Construct and open a basic_stream_socket. 
43142      [hr]
43143      Construct a basic_stream_socket, opening it and binding it to the given local endpoint. 
43144      [hr]
43145      Construct a basic_stream_socket on an existing native socket. 
43146      [hr]
43147      Move-construct a basic_stream_socket from another. 
43148      [hr]
43149      Move-construct a basic_stream_socket from a socket of another protocol type. ]
43150   ]
43151   
43152   [
43153     [[link boost_asio.reference.basic_stream_socket.bind [*bind]]]
43154     [Bind the socket to the given local endpoint. ]
43155   ]
43156   
43157   [
43158     [[link boost_asio.reference.basic_stream_socket.cancel [*cancel]]]
43159     [Cancel all asynchronous operations associated with the socket. ]
43160   ]
43161   
43162   [
43163     [[link boost_asio.reference.basic_stream_socket.close [*close]]]
43164     [Close the socket. ]
43165   ]
43166   
43167   [
43168     [[link boost_asio.reference.basic_stream_socket.connect [*connect]]]
43169     [Connect the socket to the specified endpoint. ]
43170   ]
43171   
43172   [
43173     [[link boost_asio.reference.basic_stream_socket.get_executor [*get_executor]]]
43174     [Get the executor associated with the object. ]
43175   ]
43176   
43177   [
43178     [[link boost_asio.reference.basic_stream_socket.get_option [*get_option]]]
43179     [Get an option from the socket. ]
43180   ]
43181   
43182   [
43183     [[link boost_asio.reference.basic_stream_socket.io_control [*io_control]]]
43184     [Perform an IO control command on the socket. ]
43185   ]
43186   
43187   [
43188     [[link boost_asio.reference.basic_stream_socket.is_open [*is_open]]]
43189     [Determine whether the socket is open. ]
43190   ]
43191   
43192   [
43193     [[link boost_asio.reference.basic_stream_socket.local_endpoint [*local_endpoint]]]
43194     [Get the local endpoint of the socket. ]
43195   ]
43196   
43197   [
43198     [[link boost_asio.reference.basic_stream_socket.lowest_layer [*lowest_layer]]]
43199     [Get a reference to the lowest layer. 
43200      [hr]
43201      Get a const reference to the lowest layer. ]
43202   ]
43203   
43204   [
43205     [[link boost_asio.reference.basic_stream_socket.native_handle [*native_handle]]]
43206     [Get the native socket representation. ]
43207   ]
43208   
43209   [
43210     [[link boost_asio.reference.basic_stream_socket.native_non_blocking [*native_non_blocking]]]
43211     [Gets the non-blocking mode of the native socket implementation. 
43212      [hr]
43213      Sets the non-blocking mode of the native socket implementation. ]
43214   ]
43215   
43216   [
43217     [[link boost_asio.reference.basic_stream_socket.non_blocking [*non_blocking]]]
43218     [Gets the non-blocking mode of the socket. 
43219      [hr]
43220      Sets the non-blocking mode of the socket. ]
43221   ]
43222   
43223   [
43224     [[link boost_asio.reference.basic_stream_socket.open [*open]]]
43225     [Open the socket using the specified protocol. ]
43226   ]
43227   
43228   [
43229     [[link boost_asio.reference.basic_stream_socket.operator_eq_ [*operator=]]]
43230     [Move-assign a basic_stream_socket from another. 
43231      [hr]
43232      Move-assign a basic_stream_socket from a socket of another protocol type. ]
43233   ]
43234   
43235   [
43236     [[link boost_asio.reference.basic_stream_socket.read_some [*read_some]]]
43237     [Read some data from the socket. ]
43238   ]
43239   
43240   [
43241     [[link boost_asio.reference.basic_stream_socket.receive [*receive]]]
43242     [Receive some data on the socket. 
43243      [hr]
43244      Receive some data on a connected socket. ]
43245   ]
43246   
43247   [
43248     [[link boost_asio.reference.basic_stream_socket.release [*release]]]
43249     [Release ownership of the underlying native socket. ]
43250   ]
43251   
43252   [
43253     [[link boost_asio.reference.basic_stream_socket.remote_endpoint [*remote_endpoint]]]
43254     [Get the remote endpoint of the socket. ]
43255   ]
43256   
43257   [
43258     [[link boost_asio.reference.basic_stream_socket.send [*send]]]
43259     [Send some data on the socket. ]
43260   ]
43261   
43262   [
43263     [[link boost_asio.reference.basic_stream_socket.set_option [*set_option]]]
43264     [Set an option on the socket. ]
43265   ]
43266   
43267   [
43268     [[link boost_asio.reference.basic_stream_socket.shutdown [*shutdown]]]
43269     [Disable sends or receives on the socket. ]
43270   ]
43271   
43272   [
43273     [[link boost_asio.reference.basic_stream_socket.wait [*wait]]]
43274     [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
43275   ]
43276   
43277   [
43278     [[link boost_asio.reference.basic_stream_socket.write_some [*write_some]]]
43279     [Write some data to the socket. ]
43280   ]
43281   
43282   [
43283     [[link boost_asio.reference.basic_stream_socket._basic_stream_socket [*~basic_stream_socket]]]
43284     [Destroys the socket. ]
43285   ]
43286   
43287 ]
43288
43289 [heading Data Members]
43290 [table
43291   [[Name][Description]]
43292
43293   [
43294     [[link boost_asio.reference.basic_stream_socket.max_connections [*max_connections]]]
43295     [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
43296   ]
43297
43298   [
43299     [[link boost_asio.reference.basic_stream_socket.max_listen_connections [*max_listen_connections]]]
43300     [The maximum length of the queue of pending incoming connections. ]
43301   ]
43302
43303   [
43304     [[link boost_asio.reference.basic_stream_socket.message_do_not_route [*message_do_not_route]]]
43305     [Specify that the data should not be subject to routing. ]
43306   ]
43307
43308   [
43309     [[link boost_asio.reference.basic_stream_socket.message_end_of_record [*message_end_of_record]]]
43310     [Specifies that the data marks the end of a record. ]
43311   ]
43312
43313   [
43314     [[link boost_asio.reference.basic_stream_socket.message_out_of_band [*message_out_of_band]]]
43315     [Process out-of-band data. ]
43316   ]
43317
43318   [
43319     [[link boost_asio.reference.basic_stream_socket.message_peek [*message_peek]]]
43320     [Peek at incoming data without removing it from the input queue. ]
43321   ]
43322
43323 ]
43324
43325 [heading Protected Data Members]
43326 [table
43327   [[Name][Description]]
43328
43329   [
43330     [[link boost_asio.reference.basic_stream_socket.impl_ [*impl_]]]
43331     []
43332   ]
43333
43334 ]
43335
43336 The [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] class template provides asynchronous and blocking stream-oriented socket functionality.
43337
43338
43339 [heading Thread Safety]
43340   
43341 ['Distinct] ['objects:] Safe.
43342
43343 ['Shared] ['objects:] Unsafe.
43344
43345
43346
43347
43348 [heading Requirements]
43349
43350 ['Header: ][^boost/asio/basic_stream_socket.hpp]
43351
43352 ['Convenience header: ][^boost/asio.hpp]
43353
43354 [section:assign basic_stream_socket::assign]
43355
43356 [indexterm2 boost_asio.indexterm.basic_stream_socket.assign..assign..basic_stream_socket] 
43357 Assign an existing native socket to the socket. 
43358
43359
43360   void ``[link boost_asio.reference.basic_stream_socket.assign.overload1 assign]``(
43361       const protocol_type & protocol,
43362       const native_handle_type & native_socket);
43363   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.assign.overload1 more...]]``
43364
43365   void ``[link boost_asio.reference.basic_stream_socket.assign.overload2 assign]``(
43366       const protocol_type & protocol,
43367       const native_handle_type & native_socket,
43368       boost::system::error_code & ec);
43369   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.assign.overload2 more...]]``
43370
43371
43372 [section:overload1 basic_stream_socket::assign (1 of 2 overloads)]
43373
43374
43375 ['Inherited from basic_socket.]
43376
43377
43378 Assign an existing native socket to the socket. 
43379
43380
43381   void assign(
43382       const protocol_type & protocol,
43383       const native_handle_type & native_socket);
43384
43385
43386
43387 [endsect]
43388
43389
43390
43391 [section:overload2 basic_stream_socket::assign (2 of 2 overloads)]
43392
43393
43394 ['Inherited from basic_socket.]
43395
43396
43397 Assign an existing native socket to the socket. 
43398
43399
43400   void assign(
43401       const protocol_type & protocol,
43402       const native_handle_type & native_socket,
43403       boost::system::error_code & ec);
43404
43405
43406
43407 [endsect]
43408
43409
43410 [endsect]
43411
43412
43413 [section:async_connect basic_stream_socket::async_connect]
43414
43415
43416 ['Inherited from basic_socket.]
43417
43418 [indexterm2 boost_asio.indexterm.basic_stream_socket.async_connect..async_connect..basic_stream_socket] 
43419 Start an asynchronous connect. 
43420
43421
43422   template<
43423       typename ``[link boost_asio.reference.ConnectHandler ConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
43424   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect(
43425       const endpoint_type & peer_endpoint,
43426       ConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
43427
43428
43429 This function is used to asynchronously connect a socket to the specified remote endpoint. The function call always returns immediately.
43430
43431 The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
43432
43433
43434 [heading Parameters]
43435     
43436
43437 [variablelist
43438   
43439 [[peer_endpoint][The remote endpoint to which the socket will be connected. Copies will be made of the endpoint object as required.]]
43440
43441 [[handler][The handler to be called when the connection operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
43442 ``
43443    void handler(
43444      const boost::system::error_code& error // Result of operation
43445    ); 
43446 ``
43447 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
43448
43449 ]
43450
43451
43452 [heading Example]
43453   
43454
43455
43456    void connect_handler(const boost::system::error_code& error)
43457    {
43458      if (!error)
43459      {
43460        // Connect succeeded.
43461      }
43462    }
43463
43464    ...
43465
43466    boost::asio::ip::tcp::socket socket(my_context);
43467    boost::asio::ip::tcp::endpoint endpoint(
43468        boost::asio::ip::address::from_string("1.2.3.4"), 12345);
43469    socket.async_connect(endpoint, connect_handler);
43470
43471
43472
43473
43474
43475
43476
43477 [endsect]
43478
43479
43480
43481 [section:async_read_some basic_stream_socket::async_read_some]
43482
43483 [indexterm2 boost_asio.indexterm.basic_stream_socket.async_read_some..async_read_some..basic_stream_socket] 
43484 Start an asynchronous read. 
43485
43486
43487   template<
43488       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
43489       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
43490   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_some(
43491       const MutableBufferSequence & buffers,
43492       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
43493
43494
43495 This function is used to asynchronously read data from the stream socket. The function call always returns immediately.
43496
43497
43498 [heading Parameters]
43499     
43500
43501 [variablelist
43502   
43503 [[buffers][One or more buffers into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
43504
43505 [[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
43506 ``
43507    void handler(
43508      const boost::system::error_code& error, // Result of operation.
43509      std::size_t bytes_transferred           // Number of bytes read.
43510    ); 
43511 ``
43512 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
43513
43514 ]
43515
43516
43517 [heading Remarks]
43518       
43519 The read operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.async_read `async_read`]  function if you need to ensure that the requested amount of data is read before the asynchronous operation completes.
43520
43521
43522 [heading Example]
43523   
43524 To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
43525
43526    socket.async_read_some(boost::asio::buffer(data, size), handler);
43527
43528
43529 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
43530
43531
43532
43533
43534 [endsect]
43535
43536
43537 [section:async_receive basic_stream_socket::async_receive]
43538
43539 [indexterm2 boost_asio.indexterm.basic_stream_socket.async_receive..async_receive..basic_stream_socket] 
43540 Start an asynchronous receive. 
43541
43542
43543   template<
43544       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
43545       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
43546   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_stream_socket.async_receive.overload1 async_receive]``(
43547       const MutableBufferSequence & buffers,
43548       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
43549   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.async_receive.overload1 more...]]``
43550
43551   template<
43552       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
43553       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
43554   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_stream_socket.async_receive.overload2 async_receive]``(
43555       const MutableBufferSequence & buffers,
43556       socket_base::message_flags flags,
43557       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
43558   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.async_receive.overload2 more...]]``
43559
43560
43561 [section:overload1 basic_stream_socket::async_receive (1 of 2 overloads)]
43562
43563
43564 Start an asynchronous receive. 
43565
43566
43567   template<
43568       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
43569       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
43570   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive(
43571       const MutableBufferSequence & buffers,
43572       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
43573
43574
43575 This function is used to asynchronously receive data from the stream socket. The function call always returns immediately.
43576
43577
43578 [heading Parameters]
43579     
43580
43581 [variablelist
43582   
43583 [[buffers][One or more buffers into which the data will be received. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
43584
43585 [[handler][The handler to be called when the receive operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
43586 ``
43587    void handler(
43588      const boost::system::error_code& error, // Result of operation.
43589      std::size_t bytes_transferred           // Number of bytes received.
43590    ); 
43591 ``
43592 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
43593
43594 ]
43595
43596
43597 [heading Remarks]
43598       
43599 The receive operation may not receive all of the requested number of bytes. Consider using the [link boost_asio.reference.async_read `async_read`]  function if you need to ensure that the requested amount of data is received before the asynchronous operation completes.
43600
43601
43602 [heading Example]
43603   
43604 To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
43605
43606    socket.async_receive(boost::asio::buffer(data, size), handler);
43607
43608
43609 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
43610
43611
43612
43613
43614 [endsect]
43615
43616
43617
43618 [section:overload2 basic_stream_socket::async_receive (2 of 2 overloads)]
43619
43620
43621 Start an asynchronous receive. 
43622
43623
43624   template<
43625       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
43626       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
43627   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive(
43628       const MutableBufferSequence & buffers,
43629       socket_base::message_flags flags,
43630       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
43631
43632
43633 This function is used to asynchronously receive data from the stream socket. The function call always returns immediately.
43634
43635
43636 [heading Parameters]
43637     
43638
43639 [variablelist
43640   
43641 [[buffers][One or more buffers into which the data will be received. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
43642
43643 [[flags][Flags specifying how the receive call is to be made.]]
43644
43645 [[handler][The handler to be called when the receive operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
43646 ``
43647    void handler(
43648      const boost::system::error_code& error, // Result of operation.
43649      std::size_t bytes_transferred           // Number of bytes received.
43650    ); 
43651 ``
43652 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
43653
43654 ]
43655
43656
43657 [heading Remarks]
43658       
43659 The receive operation may not receive all of the requested number of bytes. Consider using the [link boost_asio.reference.async_read `async_read`]  function if you need to ensure that the requested amount of data is received before the asynchronous operation completes.
43660
43661
43662 [heading Example]
43663   
43664 To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
43665
43666    socket.async_receive(boost::asio::buffer(data, size), 0, handler);
43667
43668
43669 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
43670
43671
43672
43673
43674 [endsect]
43675
43676
43677 [endsect]
43678
43679 [section:async_send basic_stream_socket::async_send]
43680
43681 [indexterm2 boost_asio.indexterm.basic_stream_socket.async_send..async_send..basic_stream_socket] 
43682 Start an asynchronous send. 
43683
43684
43685   template<
43686       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
43687       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
43688   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_stream_socket.async_send.overload1 async_send]``(
43689       const ConstBufferSequence & buffers,
43690       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
43691   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.async_send.overload1 more...]]``
43692
43693   template<
43694       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
43695       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
43696   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_stream_socket.async_send.overload2 async_send]``(
43697       const ConstBufferSequence & buffers,
43698       socket_base::message_flags flags,
43699       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
43700   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.async_send.overload2 more...]]``
43701
43702
43703 [section:overload1 basic_stream_socket::async_send (1 of 2 overloads)]
43704
43705
43706 Start an asynchronous send. 
43707
43708
43709   template<
43710       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
43711       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
43712   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send(
43713       const ConstBufferSequence & buffers,
43714       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
43715
43716
43717 This function is used to asynchronously send data on the stream socket. The function call always returns immediately.
43718
43719
43720 [heading Parameters]
43721     
43722
43723 [variablelist
43724   
43725 [[buffers][One or more data buffers to be sent on the socket. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
43726
43727 [[handler][The handler to be called when the send operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
43728 ``
43729    void handler(
43730      const boost::system::error_code& error, // Result of operation.
43731      std::size_t bytes_transferred           // Number of bytes sent.
43732    ); 
43733 ``
43734 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
43735
43736 ]
43737
43738
43739 [heading Remarks]
43740       
43741 The send operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.async_write `async_write`]  function if you need to ensure that all data is written before the asynchronous operation completes.
43742
43743
43744 [heading Example]
43745   
43746 To send a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
43747
43748    socket.async_send(boost::asio::buffer(data, size), handler);
43749
43750
43751 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
43752
43753
43754
43755
43756 [endsect]
43757
43758
43759
43760 [section:overload2 basic_stream_socket::async_send (2 of 2 overloads)]
43761
43762
43763 Start an asynchronous send. 
43764
43765
43766   template<
43767       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
43768       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
43769   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send(
43770       const ConstBufferSequence & buffers,
43771       socket_base::message_flags flags,
43772       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
43773
43774
43775 This function is used to asynchronously send data on the stream socket. The function call always returns immediately.
43776
43777
43778 [heading Parameters]
43779     
43780
43781 [variablelist
43782   
43783 [[buffers][One or more data buffers to be sent on the socket. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
43784
43785 [[flags][Flags specifying how the send call is to be made.]]
43786
43787 [[handler][The handler to be called when the send operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
43788 ``
43789    void handler(
43790      const boost::system::error_code& error, // Result of operation.
43791      std::size_t bytes_transferred           // Number of bytes sent.
43792    ); 
43793 ``
43794 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
43795
43796 ]
43797
43798
43799 [heading Remarks]
43800       
43801 The send operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.async_write `async_write`]  function if you need to ensure that all data is written before the asynchronous operation completes.
43802
43803
43804 [heading Example]
43805   
43806 To send a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
43807
43808    socket.async_send(boost::asio::buffer(data, size), 0, handler);
43809
43810
43811 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
43812
43813
43814
43815
43816 [endsect]
43817
43818
43819 [endsect]
43820
43821
43822 [section:async_wait basic_stream_socket::async_wait]
43823
43824
43825 ['Inherited from basic_socket.]
43826
43827 [indexterm2 boost_asio.indexterm.basic_stream_socket.async_wait..async_wait..basic_stream_socket] 
43828 Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. 
43829
43830
43831   template<
43832       typename ``[link boost_asio.reference.WaitHandler WaitHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
43833   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait(
43834       wait_type w,
43835       WaitHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
43836
43837
43838 This function is used to perform an asynchronous wait for a socket to enter a ready to read, write or error condition state.
43839
43840
43841 [heading Parameters]
43842     
43843
43844 [variablelist
43845   
43846 [[w][Specifies the desired socket state.]]
43847
43848 [[handler][The handler to be called when the wait operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
43849 ``
43850    void handler(
43851      const boost::system::error_code& error // Result of operation
43852    ); 
43853 ``
43854 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
43855
43856 ]
43857
43858
43859 [heading Example]
43860   
43861
43862
43863    void wait_handler(const boost::system::error_code& error)
43864    {
43865      if (!error)
43866      {
43867        // Wait succeeded.
43868      }
43869    }
43870
43871    ...
43872
43873    boost::asio::ip::tcp::socket socket(my_context);
43874    ...
43875    socket.async_wait(boost::asio::ip::tcp::socket::wait_read, wait_handler);
43876
43877
43878
43879
43880
43881
43882
43883 [endsect]
43884
43885
43886
43887 [section:async_write_some basic_stream_socket::async_write_some]
43888
43889 [indexterm2 boost_asio.indexterm.basic_stream_socket.async_write_some..async_write_some..basic_stream_socket] 
43890 Start an asynchronous write. 
43891
43892
43893   template<
43894       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
43895       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
43896   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_some(
43897       const ConstBufferSequence & buffers,
43898       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
43899
43900
43901 This function is used to asynchronously write data to the stream socket. The function call always returns immediately.
43902
43903
43904 [heading Parameters]
43905     
43906
43907 [variablelist
43908   
43909 [[buffers][One or more data buffers to be written to the socket. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
43910
43911 [[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
43912 ``
43913    void handler(
43914      const boost::system::error_code& error, // Result of operation.
43915      std::size_t bytes_transferred           // Number of bytes written.
43916    ); 
43917 ``
43918 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
43919
43920 ]
43921
43922
43923 [heading Remarks]
43924       
43925 The write operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.async_write `async_write`]  function if you need to ensure that all data is written before the asynchronous operation completes.
43926
43927
43928 [heading Example]
43929   
43930 To write a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
43931
43932    socket.async_write_some(boost::asio::buffer(data, size), handler);
43933
43934
43935 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
43936
43937
43938
43939
43940 [endsect]
43941
43942
43943 [section:at_mark basic_stream_socket::at_mark]
43944
43945 [indexterm2 boost_asio.indexterm.basic_stream_socket.at_mark..at_mark..basic_stream_socket] 
43946 Determine whether the socket is at the out-of-band data mark. 
43947
43948
43949   bool ``[link boost_asio.reference.basic_stream_socket.at_mark.overload1 at_mark]``() const;
43950   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.at_mark.overload1 more...]]``
43951
43952   bool ``[link boost_asio.reference.basic_stream_socket.at_mark.overload2 at_mark]``(
43953       boost::system::error_code & ec) const;
43954   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.at_mark.overload2 more...]]``
43955
43956
43957 [section:overload1 basic_stream_socket::at_mark (1 of 2 overloads)]
43958
43959
43960 ['Inherited from basic_socket.]
43961
43962
43963 Determine whether the socket is at the out-of-band data mark. 
43964
43965
43966   bool at_mark() const;
43967
43968
43969 This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
43970
43971
43972 [heading Return Value]
43973       
43974 A bool indicating whether the socket is at the out-of-band data mark.
43975
43976
43977 [heading Exceptions]
43978     
43979
43980 [variablelist
43981   
43982 [[boost::system::system_error][Thrown on failure. ]]
43983
43984 ]
43985
43986
43987
43988
43989 [endsect]
43990
43991
43992
43993 [section:overload2 basic_stream_socket::at_mark (2 of 2 overloads)]
43994
43995
43996 ['Inherited from basic_socket.]
43997
43998
43999 Determine whether the socket is at the out-of-band data mark. 
44000
44001
44002   bool at_mark(
44003       boost::system::error_code & ec) const;
44004
44005
44006 This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
44007
44008
44009 [heading Parameters]
44010     
44011
44012 [variablelist
44013   
44014 [[ec][Set to indicate what error occurred, if any.]]
44015
44016 ]
44017
44018
44019 [heading Return Value]
44020       
44021 A bool indicating whether the socket is at the out-of-band data mark. 
44022
44023
44024
44025
44026 [endsect]
44027
44028
44029 [endsect]
44030
44031 [section:available basic_stream_socket::available]
44032
44033 [indexterm2 boost_asio.indexterm.basic_stream_socket.available..available..basic_stream_socket] 
44034 Determine the number of bytes available for reading. 
44035
44036
44037   std::size_t ``[link boost_asio.reference.basic_stream_socket.available.overload1 available]``() const;
44038   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.available.overload1 more...]]``
44039
44040   std::size_t ``[link boost_asio.reference.basic_stream_socket.available.overload2 available]``(
44041       boost::system::error_code & ec) const;
44042   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.available.overload2 more...]]``
44043
44044
44045 [section:overload1 basic_stream_socket::available (1 of 2 overloads)]
44046
44047
44048 ['Inherited from basic_socket.]
44049
44050
44051 Determine the number of bytes available for reading. 
44052
44053
44054   std::size_t available() const;
44055
44056
44057 This function is used to determine the number of bytes that may be read without blocking.
44058
44059
44060 [heading Return Value]
44061       
44062 The number of bytes that may be read without blocking, or 0 if an error occurs.
44063
44064
44065 [heading Exceptions]
44066     
44067
44068 [variablelist
44069   
44070 [[boost::system::system_error][Thrown on failure. ]]
44071
44072 ]
44073
44074
44075
44076
44077 [endsect]
44078
44079
44080
44081 [section:overload2 basic_stream_socket::available (2 of 2 overloads)]
44082
44083
44084 ['Inherited from basic_socket.]
44085
44086
44087 Determine the number of bytes available for reading. 
44088
44089
44090   std::size_t available(
44091       boost::system::error_code & ec) const;
44092
44093
44094 This function is used to determine the number of bytes that may be read without blocking.
44095
44096
44097 [heading Parameters]
44098     
44099
44100 [variablelist
44101   
44102 [[ec][Set to indicate what error occurred, if any.]]
44103
44104 ]
44105
44106
44107 [heading Return Value]
44108       
44109 The number of bytes that may be read without blocking, or 0 if an error occurs. 
44110
44111
44112
44113
44114 [endsect]
44115
44116
44117 [endsect]
44118
44119 [section:basic_stream_socket basic_stream_socket::basic_stream_socket]
44120
44121 [indexterm2 boost_asio.indexterm.basic_stream_socket.basic_stream_socket..basic_stream_socket..basic_stream_socket] 
44122 Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] without opening it. 
44123
44124
44125   explicit ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload1 basic_stream_socket]``(
44126       const executor_type & ex);
44127   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload1 more...]]``
44128
44129   template<
44130       typename ExecutionContext>
44131   explicit ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload2 basic_stream_socket]``(
44132       ExecutionContext & context,
44133       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
44134   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload2 more...]]``
44135
44136
44137 Construct and open a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`]. 
44138
44139
44140   ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload3 basic_stream_socket]``(
44141       const executor_type & ex,
44142       const protocol_type & protocol);
44143   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload3 more...]]``
44144
44145   template<
44146       typename ExecutionContext>
44147   ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload4 basic_stream_socket]``(
44148       ExecutionContext & context,
44149       const protocol_type & protocol,
44150       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
44151   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload4 more...]]``
44152
44153
44154 Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`], opening it and binding it to the given local endpoint. 
44155
44156
44157   ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload5 basic_stream_socket]``(
44158       const executor_type & ex,
44159       const endpoint_type & endpoint);
44160   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload5 more...]]``
44161
44162   template<
44163       typename ExecutionContext>
44164   ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload6 basic_stream_socket]``(
44165       ExecutionContext & context,
44166       const endpoint_type & endpoint,
44167       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
44168   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload6 more...]]``
44169
44170
44171 Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] on an existing native socket. 
44172
44173
44174   ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload7 basic_stream_socket]``(
44175       const executor_type & ex,
44176       const protocol_type & protocol,
44177       const native_handle_type & native_socket);
44178   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload7 more...]]``
44179
44180   template<
44181       typename ExecutionContext>
44182   ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload8 basic_stream_socket]``(
44183       ExecutionContext & context,
44184       const protocol_type & protocol,
44185       const native_handle_type & native_socket,
44186       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
44187   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload8 more...]]``
44188
44189
44190 Move-construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] from another. 
44191
44192
44193   ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload9 basic_stream_socket]``(
44194       basic_stream_socket && other);
44195   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload9 more...]]``
44196
44197
44198 Move-construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] from a socket of another protocol type. 
44199
44200
44201   template<
44202       typename ``[link boost_asio.reference.Protocol Protocol1]``,
44203       typename ``[link boost_asio.reference.Executor1 Executor1]``>
44204   ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload10 basic_stream_socket]``(
44205       basic_stream_socket< Protocol1, Executor1 > && other,
44206       typename enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type *  = 0);
44207   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload10 more...]]``
44208
44209
44210 [section:overload1 basic_stream_socket::basic_stream_socket (1 of 10 overloads)]
44211
44212
44213 Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] without opening it. 
44214
44215
44216   basic_stream_socket(
44217       const executor_type & ex);
44218
44219
44220 This constructor creates a stream socket without opening it. The socket needs to be opened and then connected or accepted before data can be sent or received on it.
44221
44222
44223 [heading Parameters]
44224     
44225
44226 [variablelist
44227   
44228 [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket. ]]
44229
44230 ]
44231
44232
44233
44234
44235 [endsect]
44236
44237
44238
44239 [section:overload2 basic_stream_socket::basic_stream_socket (2 of 10 overloads)]
44240
44241
44242 Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] without opening it. 
44243
44244
44245   template<
44246       typename ExecutionContext>
44247   basic_stream_socket(
44248       ExecutionContext & context,
44249       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
44250
44251
44252 This constructor creates a stream socket without opening it. The socket needs to be opened and then connected or accepted before data can be sent or received on it.
44253
44254
44255 [heading Parameters]
44256     
44257
44258 [variablelist
44259   
44260 [[context][An execution context which provides the I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket. ]]
44261
44262 ]
44263
44264
44265
44266
44267 [endsect]
44268
44269
44270
44271 [section:overload3 basic_stream_socket::basic_stream_socket (3 of 10 overloads)]
44272
44273
44274 Construct and open a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`]. 
44275
44276
44277   basic_stream_socket(
44278       const executor_type & ex,
44279       const protocol_type & protocol);
44280
44281
44282 This constructor creates and opens a stream socket. The socket needs to be connected or accepted before data can be sent or received on it.
44283
44284
44285 [heading Parameters]
44286     
44287
44288 [variablelist
44289   
44290 [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
44291
44292 [[protocol][An object specifying protocol parameters to be used.]]
44293
44294 ]
44295
44296
44297 [heading Exceptions]
44298     
44299
44300 [variablelist
44301   
44302 [[boost::system::system_error][Thrown on failure. ]]
44303
44304 ]
44305
44306
44307
44308
44309 [endsect]
44310
44311
44312
44313 [section:overload4 basic_stream_socket::basic_stream_socket (4 of 10 overloads)]
44314
44315
44316 Construct and open a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`]. 
44317
44318
44319   template<
44320       typename ExecutionContext>
44321   basic_stream_socket(
44322       ExecutionContext & context,
44323       const protocol_type & protocol,
44324       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
44325
44326
44327 This constructor creates and opens a stream socket. The socket needs to be connected or accepted before data can be sent or received on it.
44328
44329
44330 [heading Parameters]
44331     
44332
44333 [variablelist
44334   
44335 [[context][An execution context which provides the I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
44336
44337 [[protocol][An object specifying protocol parameters to be used.]]
44338
44339 ]
44340
44341
44342 [heading Exceptions]
44343     
44344
44345 [variablelist
44346   
44347 [[boost::system::system_error][Thrown on failure. ]]
44348
44349 ]
44350
44351
44352
44353
44354 [endsect]
44355
44356
44357
44358 [section:overload5 basic_stream_socket::basic_stream_socket (5 of 10 overloads)]
44359
44360
44361 Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`], opening it and binding it to the given local endpoint. 
44362
44363
44364   basic_stream_socket(
44365       const executor_type & ex,
44366       const endpoint_type & endpoint);
44367
44368
44369 This constructor creates a stream 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.
44370
44371
44372 [heading Parameters]
44373     
44374
44375 [variablelist
44376   
44377 [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
44378
44379 [[endpoint][An endpoint on the local machine to which the stream socket will be bound.]]
44380
44381 ]
44382
44383
44384 [heading Exceptions]
44385     
44386
44387 [variablelist
44388   
44389 [[boost::system::system_error][Thrown on failure. ]]
44390
44391 ]
44392
44393
44394
44395
44396 [endsect]
44397
44398
44399
44400 [section:overload6 basic_stream_socket::basic_stream_socket (6 of 10 overloads)]
44401
44402
44403 Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`], opening it and binding it to the given local endpoint. 
44404
44405
44406   template<
44407       typename ExecutionContext>
44408   basic_stream_socket(
44409       ExecutionContext & context,
44410       const endpoint_type & endpoint,
44411       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
44412
44413
44414 This constructor creates a stream 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.
44415
44416
44417 [heading Parameters]
44418     
44419
44420 [variablelist
44421   
44422 [[context][An execution context which provides the I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
44423
44424 [[endpoint][An endpoint on the local machine to which the stream socket will be bound.]]
44425
44426 ]
44427
44428
44429 [heading Exceptions]
44430     
44431
44432 [variablelist
44433   
44434 [[boost::system::system_error][Thrown on failure. ]]
44435
44436 ]
44437
44438
44439
44440
44441 [endsect]
44442
44443
44444
44445 [section:overload7 basic_stream_socket::basic_stream_socket (7 of 10 overloads)]
44446
44447
44448 Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] on an existing native socket. 
44449
44450
44451   basic_stream_socket(
44452       const executor_type & ex,
44453       const protocol_type & protocol,
44454       const native_handle_type & native_socket);
44455
44456
44457 This constructor creates a stream socket object to hold an existing native socket.
44458
44459
44460 [heading Parameters]
44461     
44462
44463 [variablelist
44464   
44465 [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
44466
44467 [[protocol][An object specifying protocol parameters to be used.]]
44468
44469 [[native_socket][The new underlying socket implementation.]]
44470
44471 ]
44472
44473
44474 [heading Exceptions]
44475     
44476
44477 [variablelist
44478   
44479 [[boost::system::system_error][Thrown on failure. ]]
44480
44481 ]
44482
44483
44484
44485
44486 [endsect]
44487
44488
44489
44490 [section:overload8 basic_stream_socket::basic_stream_socket (8 of 10 overloads)]
44491
44492
44493 Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] on an existing native socket. 
44494
44495
44496   template<
44497       typename ExecutionContext>
44498   basic_stream_socket(
44499       ExecutionContext & context,
44500       const protocol_type & protocol,
44501       const native_handle_type & native_socket,
44502       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
44503
44504
44505 This constructor creates a stream socket object to hold an existing native socket.
44506
44507
44508 [heading Parameters]
44509     
44510
44511 [variablelist
44512   
44513 [[context][An execution context which provides the I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
44514
44515 [[protocol][An object specifying protocol parameters to be used.]]
44516
44517 [[native_socket][The new underlying socket implementation.]]
44518
44519 ]
44520
44521
44522 [heading Exceptions]
44523     
44524
44525 [variablelist
44526   
44527 [[boost::system::system_error][Thrown on failure. ]]
44528
44529 ]
44530
44531
44532
44533
44534 [endsect]
44535
44536
44537
44538 [section:overload9 basic_stream_socket::basic_stream_socket (9 of 10 overloads)]
44539
44540
44541 Move-construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] from another. 
44542
44543
44544   basic_stream_socket(
44545       basic_stream_socket && other);
44546
44547
44548 This constructor moves a stream socket from one object to another.
44549
44550
44551 [heading Parameters]
44552     
44553
44554 [variablelist
44555   
44556 [[other][The other [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] object from which the move will occur.]]
44557
44558 ]
44559
44560
44561 [heading Remarks]
44562       
44563 Following the move, the moved-from object is in the same state as if constructed using the `basic_stream_socket(const executor_type&)` constructor. 
44564
44565
44566
44567
44568 [endsect]
44569
44570
44571
44572 [section:overload10 basic_stream_socket::basic_stream_socket (10 of 10 overloads)]
44573
44574
44575 Move-construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] from a socket of another protocol type. 
44576
44577
44578   template<
44579       typename ``[link boost_asio.reference.Protocol Protocol1]``,
44580       typename ``[link boost_asio.reference.Executor1 Executor1]``>
44581   basic_stream_socket(
44582       basic_stream_socket< Protocol1, Executor1 > && other,
44583       typename enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type *  = 0);
44584
44585
44586 This constructor moves a stream socket from one object to another.
44587
44588
44589 [heading Parameters]
44590     
44591
44592 [variablelist
44593   
44594 [[other][The other [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] object from which the move will occur.]]
44595
44596 ]
44597
44598
44599 [heading Remarks]
44600       
44601 Following the move, the moved-from object is in the same state as if constructed using the `basic_stream_socket(const executor_type&)` constructor. 
44602
44603
44604
44605
44606 [endsect]
44607
44608
44609 [endsect]
44610
44611 [section:bind basic_stream_socket::bind]
44612
44613 [indexterm2 boost_asio.indexterm.basic_stream_socket.bind..bind..basic_stream_socket] 
44614 Bind the socket to the given local endpoint. 
44615
44616
44617   void ``[link boost_asio.reference.basic_stream_socket.bind.overload1 bind]``(
44618       const endpoint_type & endpoint);
44619   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.bind.overload1 more...]]``
44620
44621   void ``[link boost_asio.reference.basic_stream_socket.bind.overload2 bind]``(
44622       const endpoint_type & endpoint,
44623       boost::system::error_code & ec);
44624   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.bind.overload2 more...]]``
44625
44626
44627 [section:overload1 basic_stream_socket::bind (1 of 2 overloads)]
44628
44629
44630 ['Inherited from basic_socket.]
44631
44632
44633 Bind the socket to the given local endpoint. 
44634
44635
44636   void bind(
44637       const endpoint_type & endpoint);
44638
44639
44640 This function binds the socket to the specified endpoint on the local machine.
44641
44642
44643 [heading Parameters]
44644     
44645
44646 [variablelist
44647   
44648 [[endpoint][An endpoint on the local machine to which the socket will be bound.]]
44649
44650 ]
44651
44652
44653 [heading Exceptions]
44654     
44655
44656 [variablelist
44657   
44658 [[boost::system::system_error][Thrown on failure.]]
44659
44660 ]
44661
44662
44663 [heading Example]
44664   
44665
44666
44667    boost::asio::ip::tcp::socket socket(my_context);
44668    socket.open(boost::asio::ip::tcp::v4());
44669    socket.bind(boost::asio::ip::tcp::endpoint(
44670          boost::asio::ip::tcp::v4(), 12345));
44671
44672
44673
44674
44675
44676
44677
44678 [endsect]
44679
44680
44681
44682 [section:overload2 basic_stream_socket::bind (2 of 2 overloads)]
44683
44684
44685 ['Inherited from basic_socket.]
44686
44687
44688 Bind the socket to the given local endpoint. 
44689
44690
44691   void bind(
44692       const endpoint_type & endpoint,
44693       boost::system::error_code & ec);
44694
44695
44696 This function binds the socket to the specified endpoint on the local machine.
44697
44698
44699 [heading Parameters]
44700     
44701
44702 [variablelist
44703   
44704 [[endpoint][An endpoint on the local machine to which the socket will be bound.]]
44705
44706 [[ec][Set to indicate what error occurred, if any.]]
44707
44708 ]
44709
44710
44711 [heading Example]
44712   
44713
44714
44715    boost::asio::ip::tcp::socket socket(my_context);
44716    socket.open(boost::asio::ip::tcp::v4());
44717    boost::system::error_code ec;
44718    socket.bind(boost::asio::ip::tcp::endpoint(
44719          boost::asio::ip::tcp::v4(), 12345), ec);
44720    if (ec)
44721    {
44722      // An error occurred.
44723    }
44724
44725
44726
44727
44728
44729
44730
44731 [endsect]
44732
44733
44734 [endsect]
44735
44736
44737 [section:broadcast basic_stream_socket::broadcast]
44738
44739
44740 ['Inherited from socket_base.]
44741
44742 [indexterm2 boost_asio.indexterm.basic_stream_socket.broadcast..broadcast..basic_stream_socket] 
44743 Socket option to permit sending of broadcast messages. 
44744
44745
44746   typedef implementation_defined broadcast;
44747
44748
44749
44750 Implements the SOL\_SOCKET/SO\_BROADCAST socket option.
44751
44752
44753 [heading Examples]
44754   
44755 Setting the option: 
44756
44757    boost::asio::ip::udp::socket socket(my_context);
44758    ...
44759    boost::asio::socket_base::broadcast option(true);
44760    socket.set_option(option);
44761
44762
44763
44764
44765
44766 Getting the current option value: 
44767
44768    boost::asio::ip::udp::socket socket(my_context);
44769    ...
44770    boost::asio::socket_base::broadcast option;
44771    socket.get_option(option);
44772    bool is_set = option.value();
44773
44774
44775
44776
44777
44778
44779
44780 [heading Requirements]
44781
44782 ['Header: ][^boost/asio/basic_stream_socket.hpp]
44783
44784 ['Convenience header: ][^boost/asio.hpp]
44785
44786
44787 [endsect]
44788
44789
44790
44791 [section:bytes_readable basic_stream_socket::bytes_readable]
44792
44793
44794 ['Inherited from socket_base.]
44795
44796 [indexterm2 boost_asio.indexterm.basic_stream_socket.bytes_readable..bytes_readable..basic_stream_socket] 
44797 IO control command to get the amount of data that can be read without blocking. 
44798
44799
44800   typedef implementation_defined bytes_readable;
44801
44802
44803
44804 Implements the FIONREAD IO control command.
44805
44806
44807 [heading Example]
44808   
44809
44810
44811    boost::asio::ip::tcp::socket socket(my_context);
44812    ...
44813    boost::asio::socket_base::bytes_readable command(true);
44814    socket.io_control(command);
44815    std::size_t bytes_readable = command.get();
44816
44817
44818
44819
44820
44821
44822
44823 [heading Requirements]
44824
44825 ['Header: ][^boost/asio/basic_stream_socket.hpp]
44826
44827 ['Convenience header: ][^boost/asio.hpp]
44828
44829
44830 [endsect]
44831
44832
44833 [section:cancel basic_stream_socket::cancel]
44834
44835 [indexterm2 boost_asio.indexterm.basic_stream_socket.cancel..cancel..basic_stream_socket] 
44836 Cancel all asynchronous operations associated with the socket. 
44837
44838
44839   void ``[link boost_asio.reference.basic_stream_socket.cancel.overload1 cancel]``();
44840   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.cancel.overload1 more...]]``
44841
44842   void ``[link boost_asio.reference.basic_stream_socket.cancel.overload2 cancel]``(
44843       boost::system::error_code & ec);
44844   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.cancel.overload2 more...]]``
44845
44846
44847 [section:overload1 basic_stream_socket::cancel (1 of 2 overloads)]
44848
44849
44850 ['Inherited from basic_socket.]
44851
44852
44853 Cancel all asynchronous operations associated with the socket. 
44854
44855
44856   void cancel();
44857
44858
44859 This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
44860
44861
44862 [heading Exceptions]
44863     
44864
44865 [variablelist
44866   
44867 [[boost::system::system_error][Thrown on failure.]]
44868
44869 ]
44870
44871
44872 [heading Remarks]
44873       
44874 Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use:
44875
44876
44877 * It will only cancel asynchronous operations that were initiated in the current thread.
44878
44879
44880 * It can appear to complete without error, but the request to cancel the unfinished operations may be silently ignored by the operating system. Whether it works or not seems to depend on the drivers that are installed.
44881
44882 For portable cancellation, consider using one of the following alternatives:
44883
44884
44885 * Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP.
44886
44887
44888 * Use the `close()` function to simultaneously cancel the outstanding operations and close the socket.
44889
44890 When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above. 
44891
44892
44893 [endsect]
44894
44895
44896
44897 [section:overload2 basic_stream_socket::cancel (2 of 2 overloads)]
44898
44899
44900 ['Inherited from basic_socket.]
44901
44902
44903 Cancel all asynchronous operations associated with the socket. 
44904
44905
44906   void cancel(
44907       boost::system::error_code & ec);
44908
44909
44910 This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
44911
44912
44913 [heading Parameters]
44914     
44915
44916 [variablelist
44917   
44918 [[ec][Set to indicate what error occurred, if any.]]
44919
44920 ]
44921
44922
44923 [heading Remarks]
44924       
44925 Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use:
44926
44927
44928 * It will only cancel asynchronous operations that were initiated in the current thread.
44929
44930
44931 * It can appear to complete without error, but the request to cancel the unfinished operations may be silently ignored by the operating system. Whether it works or not seems to depend on the drivers that are installed.
44932
44933 For portable cancellation, consider using one of the following alternatives:
44934
44935
44936 * Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP.
44937
44938
44939 * Use the `close()` function to simultaneously cancel the outstanding operations and close the socket.
44940
44941 When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above. 
44942
44943
44944 [endsect]
44945
44946
44947 [endsect]
44948
44949 [section:close basic_stream_socket::close]
44950
44951 [indexterm2 boost_asio.indexterm.basic_stream_socket.close..close..basic_stream_socket] 
44952 Close the socket. 
44953
44954
44955   void ``[link boost_asio.reference.basic_stream_socket.close.overload1 close]``();
44956   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.close.overload1 more...]]``
44957
44958   void ``[link boost_asio.reference.basic_stream_socket.close.overload2 close]``(
44959       boost::system::error_code & ec);
44960   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.close.overload2 more...]]``
44961
44962
44963 [section:overload1 basic_stream_socket::close (1 of 2 overloads)]
44964
44965
44966 ['Inherited from basic_socket.]
44967
44968
44969 Close the socket. 
44970
44971
44972   void close();
44973
44974
44975 This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
44976
44977
44978 [heading Exceptions]
44979     
44980
44981 [variablelist
44982   
44983 [[boost::system::system_error][Thrown on failure. Note that, even if the function indicates an error, the underlying descriptor is closed.]]
44984
44985 ]
44986
44987
44988 [heading Remarks]
44989       
44990 For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket. 
44991
44992
44993
44994
44995 [endsect]
44996
44997
44998
44999 [section:overload2 basic_stream_socket::close (2 of 2 overloads)]
45000
45001
45002 ['Inherited from basic_socket.]
45003
45004
45005 Close the socket. 
45006
45007
45008   void close(
45009       boost::system::error_code & ec);
45010
45011
45012 This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
45013
45014
45015 [heading Parameters]
45016     
45017
45018 [variablelist
45019   
45020 [[ec][Set to indicate what error occurred, if any. Note that, even if the function indicates an error, the underlying descriptor is closed.]]
45021
45022 ]
45023
45024
45025 [heading Example]
45026   
45027
45028
45029    boost::asio::ip::tcp::socket socket(my_context);
45030    ...
45031    boost::system::error_code ec;
45032    socket.close(ec);
45033    if (ec)
45034    {
45035      // An error occurred.
45036    }
45037
45038
45039
45040
45041
45042 [heading Remarks]
45043       
45044 For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket. 
45045
45046
45047
45048
45049 [endsect]
45050
45051
45052 [endsect]
45053
45054 [section:connect basic_stream_socket::connect]
45055
45056 [indexterm2 boost_asio.indexterm.basic_stream_socket.connect..connect..basic_stream_socket] 
45057 Connect the socket to the specified endpoint. 
45058
45059
45060   void ``[link boost_asio.reference.basic_stream_socket.connect.overload1 connect]``(
45061       const endpoint_type & peer_endpoint);
45062   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.connect.overload1 more...]]``
45063
45064   void ``[link boost_asio.reference.basic_stream_socket.connect.overload2 connect]``(
45065       const endpoint_type & peer_endpoint,
45066       boost::system::error_code & ec);
45067   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.connect.overload2 more...]]``
45068
45069
45070 [section:overload1 basic_stream_socket::connect (1 of 2 overloads)]
45071
45072
45073 ['Inherited from basic_socket.]
45074
45075
45076 Connect the socket to the specified endpoint. 
45077
45078
45079   void connect(
45080       const endpoint_type & peer_endpoint);
45081
45082
45083 This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs.
45084
45085 The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
45086
45087
45088 [heading Parameters]
45089     
45090
45091 [variablelist
45092   
45093 [[peer_endpoint][The remote endpoint to which the socket will be connected.]]
45094
45095 ]
45096
45097
45098 [heading Exceptions]
45099     
45100
45101 [variablelist
45102   
45103 [[boost::system::system_error][Thrown on failure.]]
45104
45105 ]
45106
45107
45108 [heading Example]
45109   
45110
45111
45112    boost::asio::ip::tcp::socket socket(my_context);
45113    boost::asio::ip::tcp::endpoint endpoint(
45114        boost::asio::ip::address::from_string("1.2.3.4"), 12345);
45115    socket.connect(endpoint);
45116
45117
45118
45119
45120
45121
45122
45123 [endsect]
45124
45125
45126
45127 [section:overload2 basic_stream_socket::connect (2 of 2 overloads)]
45128
45129
45130 ['Inherited from basic_socket.]
45131
45132
45133 Connect the socket to the specified endpoint. 
45134
45135
45136   void connect(
45137       const endpoint_type & peer_endpoint,
45138       boost::system::error_code & ec);
45139
45140
45141 This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs.
45142
45143 The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
45144
45145
45146 [heading Parameters]
45147     
45148
45149 [variablelist
45150   
45151 [[peer_endpoint][The remote endpoint to which the socket will be connected.]]
45152
45153 [[ec][Set to indicate what error occurred, if any.]]
45154
45155 ]
45156
45157
45158 [heading Example]
45159   
45160
45161
45162    boost::asio::ip::tcp::socket socket(my_context);
45163    boost::asio::ip::tcp::endpoint endpoint(
45164        boost::asio::ip::address::from_string("1.2.3.4"), 12345);
45165    boost::system::error_code ec;
45166    socket.connect(endpoint, ec);
45167    if (ec)
45168    {
45169      // An error occurred.
45170    }
45171
45172
45173
45174
45175
45176
45177
45178 [endsect]
45179
45180
45181 [endsect]
45182
45183
45184 [section:debug basic_stream_socket::debug]
45185
45186
45187 ['Inherited from socket_base.]
45188
45189 [indexterm2 boost_asio.indexterm.basic_stream_socket.debug..debug..basic_stream_socket] 
45190 Socket option to enable socket-level debugging. 
45191
45192
45193   typedef implementation_defined debug;
45194
45195
45196
45197 Implements the SOL\_SOCKET/SO\_DEBUG socket option.
45198
45199
45200 [heading Examples]
45201   
45202 Setting the option: 
45203
45204    boost::asio::ip::tcp::socket socket(my_context);
45205    ...
45206    boost::asio::socket_base::debug option(true);
45207    socket.set_option(option);
45208
45209
45210
45211
45212
45213 Getting the current option value: 
45214
45215    boost::asio::ip::tcp::socket socket(my_context);
45216    ...
45217    boost::asio::socket_base::debug option;
45218    socket.get_option(option);
45219    bool is_set = option.value();
45220
45221
45222
45223
45224
45225
45226
45227 [heading Requirements]
45228
45229 ['Header: ][^boost/asio/basic_stream_socket.hpp]
45230
45231 ['Convenience header: ][^boost/asio.hpp]
45232
45233
45234 [endsect]
45235
45236
45237
45238 [section:do_not_route basic_stream_socket::do_not_route]
45239
45240
45241 ['Inherited from socket_base.]
45242
45243 [indexterm2 boost_asio.indexterm.basic_stream_socket.do_not_route..do_not_route..basic_stream_socket] 
45244 Socket option to prevent routing, use local interfaces only. 
45245
45246
45247   typedef implementation_defined do_not_route;
45248
45249
45250
45251 Implements the SOL\_SOCKET/SO\_DONTROUTE socket option.
45252
45253
45254 [heading Examples]
45255   
45256 Setting the option: 
45257
45258    boost::asio::ip::udp::socket socket(my_context);
45259    ...
45260    boost::asio::socket_base::do_not_route option(true);
45261    socket.set_option(option);
45262
45263
45264
45265
45266
45267 Getting the current option value: 
45268
45269    boost::asio::ip::udp::socket socket(my_context);
45270    ...
45271    boost::asio::socket_base::do_not_route option;
45272    socket.get_option(option);
45273    bool is_set = option.value();
45274
45275
45276
45277
45278
45279
45280
45281 [heading Requirements]
45282
45283 ['Header: ][^boost/asio/basic_stream_socket.hpp]
45284
45285 ['Convenience header: ][^boost/asio.hpp]
45286
45287
45288 [endsect]
45289
45290
45291
45292 [section:enable_connection_aborted basic_stream_socket::enable_connection_aborted]
45293
45294
45295 ['Inherited from socket_base.]
45296
45297 [indexterm2 boost_asio.indexterm.basic_stream_socket.enable_connection_aborted..enable_connection_aborted..basic_stream_socket] 
45298 Socket option to report aborted connections on accept. 
45299
45300
45301   typedef implementation_defined enable_connection_aborted;
45302
45303
45304
45305 Implements a custom socket option that determines whether or not an accept operation is permitted to fail with `boost::asio::error::connection_aborted`. By default the option is false.
45306
45307
45308 [heading Examples]
45309   
45310 Setting the option: 
45311
45312    boost::asio::ip::tcp::acceptor acceptor(my_context);
45313    ...
45314    boost::asio::socket_base::enable_connection_aborted option(true);
45315    acceptor.set_option(option);
45316
45317
45318
45319
45320
45321 Getting the current option value: 
45322
45323    boost::asio::ip::tcp::acceptor acceptor(my_context);
45324    ...
45325    boost::asio::socket_base::enable_connection_aborted option;
45326    acceptor.get_option(option);
45327    bool is_set = option.value();
45328
45329
45330
45331
45332
45333
45334
45335 [heading Requirements]
45336
45337 ['Header: ][^boost/asio/basic_stream_socket.hpp]
45338
45339 ['Convenience header: ][^boost/asio.hpp]
45340
45341
45342 [endsect]
45343
45344
45345
45346 [section:endpoint_type basic_stream_socket::endpoint_type]
45347
45348 [indexterm2 boost_asio.indexterm.basic_stream_socket.endpoint_type..endpoint_type..basic_stream_socket] 
45349 The endpoint type. 
45350
45351
45352   typedef Protocol::endpoint endpoint_type;
45353
45354
45355
45356 [heading Requirements]
45357
45358 ['Header: ][^boost/asio/basic_stream_socket.hpp]
45359
45360 ['Convenience header: ][^boost/asio.hpp]
45361
45362
45363 [endsect]
45364
45365
45366
45367 [section:executor_type basic_stream_socket::executor_type]
45368
45369 [indexterm2 boost_asio.indexterm.basic_stream_socket.executor_type..executor_type..basic_stream_socket] 
45370 The type of the executor associated with the object. 
45371
45372
45373   typedef Executor executor_type;
45374
45375
45376
45377 [heading Requirements]
45378
45379 ['Header: ][^boost/asio/basic_stream_socket.hpp]
45380
45381 ['Convenience header: ][^boost/asio.hpp]
45382
45383
45384 [endsect]
45385
45386
45387
45388 [section:get_executor basic_stream_socket::get_executor]
45389
45390
45391 ['Inherited from basic_socket.]
45392
45393 [indexterm2 boost_asio.indexterm.basic_stream_socket.get_executor..get_executor..basic_stream_socket] 
45394 Get the executor associated with the object. 
45395
45396
45397   executor_type get_executor();
45398
45399
45400
45401 [endsect]
45402
45403
45404 [section:get_option basic_stream_socket::get_option]
45405
45406 [indexterm2 boost_asio.indexterm.basic_stream_socket.get_option..get_option..basic_stream_socket] 
45407 Get an option from the socket. 
45408
45409
45410   template<
45411       typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
45412   void ``[link boost_asio.reference.basic_stream_socket.get_option.overload1 get_option]``(
45413       GettableSocketOption & option) const;
45414   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.get_option.overload1 more...]]``
45415
45416   template<
45417       typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
45418   void ``[link boost_asio.reference.basic_stream_socket.get_option.overload2 get_option]``(
45419       GettableSocketOption & option,
45420       boost::system::error_code & ec) const;
45421   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.get_option.overload2 more...]]``
45422
45423
45424 [section:overload1 basic_stream_socket::get_option (1 of 2 overloads)]
45425
45426
45427 ['Inherited from basic_socket.]
45428
45429
45430 Get an option from the socket. 
45431
45432
45433   template<
45434       typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
45435   void get_option(
45436       GettableSocketOption & option) const;
45437
45438
45439 This function is used to get the current value of an option on the socket.
45440
45441
45442 [heading Parameters]
45443     
45444
45445 [variablelist
45446   
45447 [[option][The option value to be obtained from the socket.]]
45448
45449 ]
45450
45451
45452 [heading Exceptions]
45453     
45454
45455 [variablelist
45456   
45457 [[boost::system::system_error][Thrown on failure.]]
45458
45459 ]
45460
45461
45462
45463 [heading Example]
45464   
45465 Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option: 
45466
45467    boost::asio::ip::tcp::socket socket(my_context);
45468    ...
45469    boost::asio::ip::tcp::socket::keep_alive option;
45470    socket.get_option(option);
45471    bool is_set = option.value();
45472
45473
45474
45475
45476
45477
45478
45479 [endsect]
45480
45481
45482
45483 [section:overload2 basic_stream_socket::get_option (2 of 2 overloads)]
45484
45485
45486 ['Inherited from basic_socket.]
45487
45488
45489 Get an option from the socket. 
45490
45491
45492   template<
45493       typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
45494   void get_option(
45495       GettableSocketOption & option,
45496       boost::system::error_code & ec) const;
45497
45498
45499 This function is used to get the current value of an option on the socket.
45500
45501
45502 [heading Parameters]
45503     
45504
45505 [variablelist
45506   
45507 [[option][The option value to be obtained from the socket.]]
45508
45509 [[ec][Set to indicate what error occurred, if any.]]
45510
45511 ]
45512
45513
45514
45515 [heading Example]
45516   
45517 Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option: 
45518
45519    boost::asio::ip::tcp::socket socket(my_context);
45520    ...
45521    boost::asio::ip::tcp::socket::keep_alive option;
45522    boost::system::error_code ec;
45523    socket.get_option(option, ec);
45524    if (ec)
45525    {
45526      // An error occurred.
45527    }
45528    bool is_set = option.value();
45529
45530
45531
45532
45533
45534
45535
45536 [endsect]
45537
45538
45539 [endsect]
45540
45541
45542 [section:impl_ basic_stream_socket::impl_]
45543
45544
45545 ['Inherited from basic_socket.]
45546
45547 [indexterm2 boost_asio.indexterm.basic_stream_socket.impl_..impl_..basic_stream_socket] 
45548
45549   detail::io_object_impl< detail::reactive_socket_service< Protocol >, Executor > impl_;
45550
45551
45552
45553 [endsect]
45554
45555
45556 [section:io_control basic_stream_socket::io_control]
45557
45558 [indexterm2 boost_asio.indexterm.basic_stream_socket.io_control..io_control..basic_stream_socket] 
45559 Perform an IO control command on the socket. 
45560
45561
45562   template<
45563       typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
45564   void ``[link boost_asio.reference.basic_stream_socket.io_control.overload1 io_control]``(
45565       IoControlCommand & command);
45566   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.io_control.overload1 more...]]``
45567
45568   template<
45569       typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
45570   void ``[link boost_asio.reference.basic_stream_socket.io_control.overload2 io_control]``(
45571       IoControlCommand & command,
45572       boost::system::error_code & ec);
45573   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.io_control.overload2 more...]]``
45574
45575
45576 [section:overload1 basic_stream_socket::io_control (1 of 2 overloads)]
45577
45578
45579 ['Inherited from basic_socket.]
45580
45581
45582 Perform an IO control command on the socket. 
45583
45584
45585   template<
45586       typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
45587   void io_control(
45588       IoControlCommand & command);
45589
45590
45591 This function is used to execute an IO control command on the socket.
45592
45593
45594 [heading Parameters]
45595     
45596
45597 [variablelist
45598   
45599 [[command][The IO control command to be performed on the socket.]]
45600
45601 ]
45602
45603
45604 [heading Exceptions]
45605     
45606
45607 [variablelist
45608   
45609 [[boost::system::system_error][Thrown on failure.]]
45610
45611 ]
45612
45613
45614
45615 [heading Example]
45616   
45617 Getting the number of bytes ready to read: 
45618
45619    boost::asio::ip::tcp::socket socket(my_context);
45620    ...
45621    boost::asio::ip::tcp::socket::bytes_readable command;
45622    socket.io_control(command);
45623    std::size_t bytes_readable = command.get();
45624
45625
45626
45627
45628
45629
45630
45631 [endsect]
45632
45633
45634
45635 [section:overload2 basic_stream_socket::io_control (2 of 2 overloads)]
45636
45637
45638 ['Inherited from basic_socket.]
45639
45640
45641 Perform an IO control command on the socket. 
45642
45643
45644   template<
45645       typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
45646   void io_control(
45647       IoControlCommand & command,
45648       boost::system::error_code & ec);
45649
45650
45651 This function is used to execute an IO control command on the socket.
45652
45653
45654 [heading Parameters]
45655     
45656
45657 [variablelist
45658   
45659 [[command][The IO control command to be performed on the socket.]]
45660
45661 [[ec][Set to indicate what error occurred, if any.]]
45662
45663 ]
45664
45665
45666
45667 [heading Example]
45668   
45669 Getting the number of bytes ready to read: 
45670
45671    boost::asio::ip::tcp::socket socket(my_context);
45672    ...
45673    boost::asio::ip::tcp::socket::bytes_readable command;
45674    boost::system::error_code ec;
45675    socket.io_control(command, ec);
45676    if (ec)
45677    {
45678      // An error occurred.
45679    }
45680    std::size_t bytes_readable = command.get();
45681
45682
45683
45684
45685
45686
45687
45688 [endsect]
45689
45690
45691 [endsect]
45692
45693
45694 [section:is_open basic_stream_socket::is_open]
45695
45696
45697 ['Inherited from basic_socket.]
45698
45699 [indexterm2 boost_asio.indexterm.basic_stream_socket.is_open..is_open..basic_stream_socket] 
45700 Determine whether the socket is open. 
45701
45702
45703   bool is_open() const;
45704
45705
45706
45707 [endsect]
45708
45709
45710
45711 [section:keep_alive basic_stream_socket::keep_alive]
45712
45713
45714 ['Inherited from socket_base.]
45715
45716 [indexterm2 boost_asio.indexterm.basic_stream_socket.keep_alive..keep_alive..basic_stream_socket] 
45717 Socket option to send keep-alives. 
45718
45719
45720   typedef implementation_defined keep_alive;
45721
45722
45723
45724 Implements the SOL\_SOCKET/SO\_KEEPALIVE socket option.
45725
45726
45727 [heading Examples]
45728   
45729 Setting the option: 
45730
45731    boost::asio::ip::tcp::socket socket(my_context);
45732    ...
45733    boost::asio::socket_base::keep_alive option(true);
45734    socket.set_option(option);
45735
45736
45737
45738
45739
45740 Getting the current option value: 
45741
45742    boost::asio::ip::tcp::socket socket(my_context);
45743    ...
45744    boost::asio::socket_base::keep_alive option;
45745    socket.get_option(option);
45746    bool is_set = option.value();
45747
45748
45749
45750
45751
45752
45753
45754 [heading Requirements]
45755
45756 ['Header: ][^boost/asio/basic_stream_socket.hpp]
45757
45758 ['Convenience header: ][^boost/asio.hpp]
45759
45760
45761 [endsect]
45762
45763
45764
45765 [section:linger basic_stream_socket::linger]
45766
45767
45768 ['Inherited from socket_base.]
45769
45770 [indexterm2 boost_asio.indexterm.basic_stream_socket.linger..linger..basic_stream_socket] 
45771 Socket option to specify whether the socket lingers on close if unsent data is present. 
45772
45773
45774   typedef implementation_defined linger;
45775
45776
45777
45778 Implements the SOL\_SOCKET/SO\_LINGER socket option.
45779
45780
45781 [heading Examples]
45782   
45783 Setting the option: 
45784
45785    boost::asio::ip::tcp::socket socket(my_context);
45786    ...
45787    boost::asio::socket_base::linger option(true, 30);
45788    socket.set_option(option);
45789
45790
45791
45792
45793
45794 Getting the current option value: 
45795
45796    boost::asio::ip::tcp::socket socket(my_context);
45797    ...
45798    boost::asio::socket_base::linger option;
45799    socket.get_option(option);
45800    bool is_set = option.enabled();
45801    unsigned short timeout = option.timeout();
45802
45803
45804
45805
45806
45807
45808
45809 [heading Requirements]
45810
45811 ['Header: ][^boost/asio/basic_stream_socket.hpp]
45812
45813 ['Convenience header: ][^boost/asio.hpp]
45814
45815
45816 [endsect]
45817
45818
45819 [section:local_endpoint basic_stream_socket::local_endpoint]
45820
45821 [indexterm2 boost_asio.indexterm.basic_stream_socket.local_endpoint..local_endpoint..basic_stream_socket] 
45822 Get the local endpoint of the socket. 
45823
45824
45825   endpoint_type ``[link boost_asio.reference.basic_stream_socket.local_endpoint.overload1 local_endpoint]``() const;
45826   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.local_endpoint.overload1 more...]]``
45827
45828   endpoint_type ``[link boost_asio.reference.basic_stream_socket.local_endpoint.overload2 local_endpoint]``(
45829       boost::system::error_code & ec) const;
45830   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.local_endpoint.overload2 more...]]``
45831
45832
45833 [section:overload1 basic_stream_socket::local_endpoint (1 of 2 overloads)]
45834
45835
45836 ['Inherited from basic_socket.]
45837
45838
45839 Get the local endpoint of the socket. 
45840
45841
45842   endpoint_type local_endpoint() const;
45843
45844
45845 This function is used to obtain the locally bound endpoint of the socket.
45846
45847
45848 [heading Return Value]
45849       
45850 An object that represents the local endpoint of the socket.
45851
45852
45853 [heading Exceptions]
45854     
45855
45856 [variablelist
45857   
45858 [[boost::system::system_error][Thrown on failure.]]
45859
45860 ]
45861
45862
45863 [heading Example]
45864   
45865
45866
45867    boost::asio::ip::tcp::socket socket(my_context);
45868    ...
45869    boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint();
45870
45871
45872
45873
45874
45875
45876
45877 [endsect]
45878
45879
45880
45881 [section:overload2 basic_stream_socket::local_endpoint (2 of 2 overloads)]
45882
45883
45884 ['Inherited from basic_socket.]
45885
45886
45887 Get the local endpoint of the socket. 
45888
45889
45890   endpoint_type local_endpoint(
45891       boost::system::error_code & ec) const;
45892
45893
45894 This function is used to obtain the locally bound endpoint of the socket.
45895
45896
45897 [heading Parameters]
45898     
45899
45900 [variablelist
45901   
45902 [[ec][Set to indicate what error occurred, if any.]]
45903
45904 ]
45905
45906
45907 [heading Return Value]
45908       
45909 An object that represents the local endpoint of the socket. Returns a default-constructed endpoint object if an error occurred.
45910
45911
45912 [heading Example]
45913   
45914
45915
45916    boost::asio::ip::tcp::socket socket(my_context);
45917    ...
45918    boost::system::error_code ec;
45919    boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint(ec);
45920    if (ec)
45921    {
45922      // An error occurred.
45923    }
45924
45925
45926
45927
45928
45929
45930
45931 [endsect]
45932
45933
45934 [endsect]
45935
45936 [section:lowest_layer basic_stream_socket::lowest_layer]
45937
45938 [indexterm2 boost_asio.indexterm.basic_stream_socket.lowest_layer..lowest_layer..basic_stream_socket] 
45939 Get a reference to the lowest layer. 
45940
45941
45942   lowest_layer_type & ``[link boost_asio.reference.basic_stream_socket.lowest_layer.overload1 lowest_layer]``();
45943   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.lowest_layer.overload1 more...]]``
45944
45945
45946 Get a const reference to the lowest layer. 
45947
45948
45949   const lowest_layer_type & ``[link boost_asio.reference.basic_stream_socket.lowest_layer.overload2 lowest_layer]``() const;
45950   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.lowest_layer.overload2 more...]]``
45951
45952
45953 [section:overload1 basic_stream_socket::lowest_layer (1 of 2 overloads)]
45954
45955
45956 ['Inherited from basic_socket.]
45957
45958
45959 Get a reference to the lowest layer. 
45960
45961
45962   lowest_layer_type & lowest_layer();
45963
45964
45965 This function returns a reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself.
45966
45967
45968 [heading Return Value]
45969       
45970 A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 
45971
45972
45973
45974
45975 [endsect]
45976
45977
45978
45979 [section:overload2 basic_stream_socket::lowest_layer (2 of 2 overloads)]
45980
45981
45982 ['Inherited from basic_socket.]
45983
45984
45985 Get a const reference to the lowest layer. 
45986
45987
45988   const lowest_layer_type & lowest_layer() const;
45989
45990
45991 This function returns a const reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself.
45992
45993
45994 [heading Return Value]
45995       
45996 A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 
45997
45998
45999
46000
46001 [endsect]
46002
46003
46004 [endsect]
46005
46006
46007 [section:lowest_layer_type basic_stream_socket::lowest_layer_type]
46008
46009
46010 ['Inherited from basic_socket.]
46011
46012 [indexterm2 boost_asio.indexterm.basic_stream_socket.lowest_layer_type..lowest_layer_type..basic_stream_socket] 
46013 A [link boost_asio.reference.basic_socket `basic_socket`] is always the lowest layer. 
46014
46015
46016   typedef basic_socket< Protocol, Executor > lowest_layer_type;
46017
46018
46019 [heading Types]
46020 [table
46021   [[Name][Description]]
46022
46023   [
46024
46025     [[link boost_asio.reference.basic_socket__rebind_executor [*rebind_executor]]]
46026     [Rebinds the socket type to another executor. ]
46027   
46028   ]
46029
46030   [
46031
46032     [[link boost_asio.reference.basic_socket.broadcast [*broadcast]]]
46033     [Socket option to permit sending of broadcast messages. ]
46034   
46035   ]
46036
46037   [
46038
46039     [[link boost_asio.reference.basic_socket.bytes_readable [*bytes_readable]]]
46040     [IO control command to get the amount of data that can be read without blocking. ]
46041   
46042   ]
46043
46044   [
46045
46046     [[link boost_asio.reference.basic_socket.debug [*debug]]]
46047     [Socket option to enable socket-level debugging. ]
46048   
46049   ]
46050
46051   [
46052
46053     [[link boost_asio.reference.basic_socket.do_not_route [*do_not_route]]]
46054     [Socket option to prevent routing, use local interfaces only. ]
46055   
46056   ]
46057
46058   [
46059
46060     [[link boost_asio.reference.basic_socket.enable_connection_aborted [*enable_connection_aborted]]]
46061     [Socket option to report aborted connections on accept. ]
46062   
46063   ]
46064
46065   [
46066
46067     [[link boost_asio.reference.basic_socket.endpoint_type [*endpoint_type]]]
46068     [The endpoint type. ]
46069   
46070   ]
46071
46072   [
46073
46074     [[link boost_asio.reference.basic_socket.executor_type [*executor_type]]]
46075     [The type of the executor associated with the object. ]
46076   
46077   ]
46078
46079   [
46080
46081     [[link boost_asio.reference.basic_socket.keep_alive [*keep_alive]]]
46082     [Socket option to send keep-alives. ]
46083   
46084   ]
46085
46086   [
46087
46088     [[link boost_asio.reference.basic_socket.linger [*linger]]]
46089     [Socket option to specify whether the socket lingers on close if unsent data is present. ]
46090   
46091   ]
46092
46093   [
46094
46095     [[link boost_asio.reference.basic_socket.lowest_layer_type [*lowest_layer_type]]]
46096     [A basic_socket is always the lowest layer. ]
46097   
46098   ]
46099
46100   [
46101
46102     [[link boost_asio.reference.basic_socket.message_flags [*message_flags]]]
46103     [Bitmask type for flags that can be passed to send and receive operations. ]
46104   
46105   ]
46106
46107   [
46108
46109     [[link boost_asio.reference.basic_socket.native_handle_type [*native_handle_type]]]
46110     [The native representation of a socket. ]
46111   
46112   ]
46113
46114   [
46115
46116     [[link boost_asio.reference.basic_socket.out_of_band_inline [*out_of_band_inline]]]
46117     [Socket option for putting received out-of-band data inline. ]
46118   
46119   ]
46120
46121   [
46122
46123     [[link boost_asio.reference.basic_socket.protocol_type [*protocol_type]]]
46124     [The protocol type. ]
46125   
46126   ]
46127
46128   [
46129
46130     [[link boost_asio.reference.basic_socket.receive_buffer_size [*receive_buffer_size]]]
46131     [Socket option for the receive buffer size of a socket. ]
46132   
46133   ]
46134
46135   [
46136
46137     [[link boost_asio.reference.basic_socket.receive_low_watermark [*receive_low_watermark]]]
46138     [Socket option for the receive low watermark. ]
46139   
46140   ]
46141
46142   [
46143
46144     [[link boost_asio.reference.basic_socket.reuse_address [*reuse_address]]]
46145     [Socket option to allow the socket to be bound to an address that is already in use. ]
46146   
46147   ]
46148
46149   [
46150
46151     [[link boost_asio.reference.basic_socket.send_buffer_size [*send_buffer_size]]]
46152     [Socket option for the send buffer size of a socket. ]
46153   
46154   ]
46155
46156   [
46157
46158     [[link boost_asio.reference.basic_socket.send_low_watermark [*send_low_watermark]]]
46159     [Socket option for the send low watermark. ]
46160   
46161   ]
46162
46163   [
46164
46165     [[link boost_asio.reference.basic_socket.shutdown_type [*shutdown_type]]]
46166     [Different ways a socket may be shutdown. ]
46167   
46168   ]
46169
46170   [
46171
46172     [[link boost_asio.reference.basic_socket.wait_type [*wait_type]]]
46173     [Wait types. ]
46174   
46175   ]
46176
46177 ]
46178
46179 [heading Member Functions]
46180 [table
46181   [[Name][Description]]
46182
46183   [
46184     [[link boost_asio.reference.basic_socket.assign [*assign]]]
46185     [Assign an existing native socket to the socket. ]
46186   ]
46187   
46188   [
46189     [[link boost_asio.reference.basic_socket.async_connect [*async_connect]]]
46190     [Start an asynchronous connect. ]
46191   ]
46192   
46193   [
46194     [[link boost_asio.reference.basic_socket.async_wait [*async_wait]]]
46195     [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
46196   ]
46197   
46198   [
46199     [[link boost_asio.reference.basic_socket.at_mark [*at_mark]]]
46200     [Determine whether the socket is at the out-of-band data mark. ]
46201   ]
46202   
46203   [
46204     [[link boost_asio.reference.basic_socket.available [*available]]]
46205     [Determine the number of bytes available for reading. ]
46206   ]
46207   
46208   [
46209     [[link boost_asio.reference.basic_socket.basic_socket [*basic_socket]]]
46210     [Construct a basic_socket without opening it. 
46211      [hr]
46212      Construct and open a basic_socket. 
46213      [hr]
46214      Construct a basic_socket, opening it and binding it to the given local endpoint. 
46215      [hr]
46216      Construct a basic_socket on an existing native socket. 
46217      [hr]
46218      Move-construct a basic_socket from another. 
46219      [hr]
46220      Move-construct a basic_socket from a socket of another protocol type. ]
46221   ]
46222   
46223   [
46224     [[link boost_asio.reference.basic_socket.bind [*bind]]]
46225     [Bind the socket to the given local endpoint. ]
46226   ]
46227   
46228   [
46229     [[link boost_asio.reference.basic_socket.cancel [*cancel]]]
46230     [Cancel all asynchronous operations associated with the socket. ]
46231   ]
46232   
46233   [
46234     [[link boost_asio.reference.basic_socket.close [*close]]]
46235     [Close the socket. ]
46236   ]
46237   
46238   [
46239     [[link boost_asio.reference.basic_socket.connect [*connect]]]
46240     [Connect the socket to the specified endpoint. ]
46241   ]
46242   
46243   [
46244     [[link boost_asio.reference.basic_socket.get_executor [*get_executor]]]
46245     [Get the executor associated with the object. ]
46246   ]
46247   
46248   [
46249     [[link boost_asio.reference.basic_socket.get_option [*get_option]]]
46250     [Get an option from the socket. ]
46251   ]
46252   
46253   [
46254     [[link boost_asio.reference.basic_socket.io_control [*io_control]]]
46255     [Perform an IO control command on the socket. ]
46256   ]
46257   
46258   [
46259     [[link boost_asio.reference.basic_socket.is_open [*is_open]]]
46260     [Determine whether the socket is open. ]
46261   ]
46262   
46263   [
46264     [[link boost_asio.reference.basic_socket.local_endpoint [*local_endpoint]]]
46265     [Get the local endpoint of the socket. ]
46266   ]
46267   
46268   [
46269     [[link boost_asio.reference.basic_socket.lowest_layer [*lowest_layer]]]
46270     [Get a reference to the lowest layer. 
46271      [hr]
46272      Get a const reference to the lowest layer. ]
46273   ]
46274   
46275   [
46276     [[link boost_asio.reference.basic_socket.native_handle [*native_handle]]]
46277     [Get the native socket representation. ]
46278   ]
46279   
46280   [
46281     [[link boost_asio.reference.basic_socket.native_non_blocking [*native_non_blocking]]]
46282     [Gets the non-blocking mode of the native socket implementation. 
46283      [hr]
46284      Sets the non-blocking mode of the native socket implementation. ]
46285   ]
46286   
46287   [
46288     [[link boost_asio.reference.basic_socket.non_blocking [*non_blocking]]]
46289     [Gets the non-blocking mode of the socket. 
46290      [hr]
46291      Sets the non-blocking mode of the socket. ]
46292   ]
46293   
46294   [
46295     [[link boost_asio.reference.basic_socket.open [*open]]]
46296     [Open the socket using the specified protocol. ]
46297   ]
46298   
46299   [
46300     [[link boost_asio.reference.basic_socket.operator_eq_ [*operator=]]]
46301     [Move-assign a basic_socket from another. 
46302      [hr]
46303      Move-assign a basic_socket from a socket of another protocol type. ]
46304   ]
46305   
46306   [
46307     [[link boost_asio.reference.basic_socket.release [*release]]]
46308     [Release ownership of the underlying native socket. ]
46309   ]
46310   
46311   [
46312     [[link boost_asio.reference.basic_socket.remote_endpoint [*remote_endpoint]]]
46313     [Get the remote endpoint of the socket. ]
46314   ]
46315   
46316   [
46317     [[link boost_asio.reference.basic_socket.set_option [*set_option]]]
46318     [Set an option on the socket. ]
46319   ]
46320   
46321   [
46322     [[link boost_asio.reference.basic_socket.shutdown [*shutdown]]]
46323     [Disable sends or receives on the socket. ]
46324   ]
46325   
46326   [
46327     [[link boost_asio.reference.basic_socket.wait [*wait]]]
46328     [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
46329   ]
46330   
46331 ]
46332
46333 [heading Protected Member Functions]
46334 [table
46335   [[Name][Description]]
46336
46337   [
46338     [[link boost_asio.reference.basic_socket._basic_socket [*~basic_socket]]]
46339     [Protected destructor to prevent deletion through this type. ]
46340   ]
46341   
46342 ]
46343
46344 [heading Data Members]
46345 [table
46346   [[Name][Description]]
46347
46348   [
46349     [[link boost_asio.reference.basic_socket.max_connections [*max_connections]]]
46350     [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
46351   ]
46352
46353   [
46354     [[link boost_asio.reference.basic_socket.max_listen_connections [*max_listen_connections]]]
46355     [The maximum length of the queue of pending incoming connections. ]
46356   ]
46357
46358   [
46359     [[link boost_asio.reference.basic_socket.message_do_not_route [*message_do_not_route]]]
46360     [Specify that the data should not be subject to routing. ]
46361   ]
46362
46363   [
46364     [[link boost_asio.reference.basic_socket.message_end_of_record [*message_end_of_record]]]
46365     [Specifies that the data marks the end of a record. ]
46366   ]
46367
46368   [
46369     [[link boost_asio.reference.basic_socket.message_out_of_band [*message_out_of_band]]]
46370     [Process out-of-band data. ]
46371   ]
46372
46373   [
46374     [[link boost_asio.reference.basic_socket.message_peek [*message_peek]]]
46375     [Peek at incoming data without removing it from the input queue. ]
46376   ]
46377
46378 ]
46379
46380 [heading Protected Data Members]
46381 [table
46382   [[Name][Description]]
46383
46384   [
46385     [[link boost_asio.reference.basic_socket.impl_ [*impl_]]]
46386     []
46387   ]
46388
46389 ]
46390
46391 The [link boost_asio.reference.basic_socket `basic_socket`] class template provides functionality that is common to both stream-oriented and datagram-oriented sockets.
46392
46393
46394 [heading Thread Safety]
46395   
46396 ['Distinct] ['objects:] Safe.
46397
46398 ['Shared] ['objects:] Unsafe. 
46399
46400
46401
46402
46403 [heading Requirements]
46404
46405 ['Header: ][^boost/asio/basic_stream_socket.hpp]
46406
46407 ['Convenience header: ][^boost/asio.hpp]
46408
46409
46410 [endsect]
46411
46412
46413
46414 [section:max_connections basic_stream_socket::max_connections]
46415
46416
46417 ['Inherited from socket_base.]
46418
46419 [indexterm2 boost_asio.indexterm.basic_stream_socket.max_connections..max_connections..basic_stream_socket] 
46420 (Deprecated: Use max\_listen\_connections.) The maximum length of the queue of pending incoming connections. 
46421
46422
46423   static const int max_connections = implementation_defined;
46424
46425
46426
46427 [endsect]
46428
46429
46430
46431 [section:max_listen_connections basic_stream_socket::max_listen_connections]
46432
46433
46434 ['Inherited from socket_base.]
46435
46436 [indexterm2 boost_asio.indexterm.basic_stream_socket.max_listen_connections..max_listen_connections..basic_stream_socket] 
46437 The maximum length of the queue of pending incoming connections. 
46438
46439
46440   static const int max_listen_connections = implementation_defined;
46441
46442
46443
46444 [endsect]
46445
46446
46447
46448 [section:message_do_not_route basic_stream_socket::message_do_not_route]
46449
46450
46451 ['Inherited from socket_base.]
46452
46453 [indexterm2 boost_asio.indexterm.basic_stream_socket.message_do_not_route..message_do_not_route..basic_stream_socket] 
46454 Specify that the data should not be subject to routing. 
46455
46456
46457   static const int message_do_not_route = implementation_defined;
46458
46459
46460
46461 [endsect]
46462
46463
46464
46465 [section:message_end_of_record basic_stream_socket::message_end_of_record]
46466
46467
46468 ['Inherited from socket_base.]
46469
46470 [indexterm2 boost_asio.indexterm.basic_stream_socket.message_end_of_record..message_end_of_record..basic_stream_socket] 
46471 Specifies that the data marks the end of a record. 
46472
46473
46474   static const int message_end_of_record = implementation_defined;
46475
46476
46477
46478 [endsect]
46479
46480
46481
46482 [section:message_flags basic_stream_socket::message_flags]
46483
46484
46485 ['Inherited from socket_base.]
46486
46487 [indexterm2 boost_asio.indexterm.basic_stream_socket.message_flags..message_flags..basic_stream_socket] 
46488 Bitmask type for flags that can be passed to send and receive operations. 
46489
46490
46491   typedef int message_flags;
46492
46493
46494
46495 [heading Requirements]
46496
46497 ['Header: ][^boost/asio/basic_stream_socket.hpp]
46498
46499 ['Convenience header: ][^boost/asio.hpp]
46500
46501
46502 [endsect]
46503
46504
46505
46506 [section:message_out_of_band basic_stream_socket::message_out_of_band]
46507
46508
46509 ['Inherited from socket_base.]
46510
46511 [indexterm2 boost_asio.indexterm.basic_stream_socket.message_out_of_band..message_out_of_band..basic_stream_socket] 
46512 Process out-of-band data. 
46513
46514
46515   static const int message_out_of_band = implementation_defined;
46516
46517
46518
46519 [endsect]
46520
46521
46522
46523 [section:message_peek basic_stream_socket::message_peek]
46524
46525
46526 ['Inherited from socket_base.]
46527
46528 [indexterm2 boost_asio.indexterm.basic_stream_socket.message_peek..message_peek..basic_stream_socket] 
46529 Peek at incoming data without removing it from the input queue. 
46530
46531
46532   static const int message_peek = implementation_defined;
46533
46534
46535
46536 [endsect]
46537
46538
46539
46540 [section:native_handle basic_stream_socket::native_handle]
46541
46542
46543 ['Inherited from basic_socket.]
46544
46545 [indexterm2 boost_asio.indexterm.basic_stream_socket.native_handle..native_handle..basic_stream_socket] 
46546 Get the native socket representation. 
46547
46548
46549   native_handle_type native_handle();
46550
46551
46552 This function may be used to obtain the underlying representation of the socket. This is intended to allow access to native socket functionality that is not otherwise provided. 
46553
46554
46555 [endsect]
46556
46557
46558
46559 [section:native_handle_type basic_stream_socket::native_handle_type]
46560
46561 [indexterm2 boost_asio.indexterm.basic_stream_socket.native_handle_type..native_handle_type..basic_stream_socket] 
46562 The native representation of a socket. 
46563
46564
46565   typedef implementation_defined native_handle_type;
46566
46567
46568
46569 [heading Requirements]
46570
46571 ['Header: ][^boost/asio/basic_stream_socket.hpp]
46572
46573 ['Convenience header: ][^boost/asio.hpp]
46574
46575
46576 [endsect]
46577
46578
46579 [section:native_non_blocking basic_stream_socket::native_non_blocking]
46580
46581 [indexterm2 boost_asio.indexterm.basic_stream_socket.native_non_blocking..native_non_blocking..basic_stream_socket] 
46582 Gets the non-blocking mode of the native socket implementation. 
46583
46584
46585   bool ``[link boost_asio.reference.basic_stream_socket.native_non_blocking.overload1 native_non_blocking]``() const;
46586   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.native_non_blocking.overload1 more...]]``
46587
46588
46589 Sets the non-blocking mode of the native socket implementation. 
46590
46591
46592   void ``[link boost_asio.reference.basic_stream_socket.native_non_blocking.overload2 native_non_blocking]``(
46593       bool mode);
46594   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.native_non_blocking.overload2 more...]]``
46595
46596   void ``[link boost_asio.reference.basic_stream_socket.native_non_blocking.overload3 native_non_blocking]``(
46597       bool mode,
46598       boost::system::error_code & ec);
46599   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.native_non_blocking.overload3 more...]]``
46600
46601
46602 [section:overload1 basic_stream_socket::native_non_blocking (1 of 3 overloads)]
46603
46604
46605 ['Inherited from basic_socket.]
46606
46607
46608 Gets the non-blocking mode of the native socket implementation. 
46609
46610
46611   bool native_non_blocking() const;
46612
46613
46614 This function is used to retrieve the non-blocking mode of the underlying native socket. This mode has no effect on the behaviour of the socket object's synchronous operations.
46615
46616
46617 [heading Return Value]
46618       
46619 `true` if the underlying socket is in non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).
46620
46621
46622 [heading Remarks]
46623       
46624 The current non-blocking mode is cached by the socket object. Consequently, the return value may be incorrect if the non-blocking mode was set directly on the native socket.
46625
46626
46627 [heading Example]
46628   
46629 This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated: 
46630
46631    template <typename Handler>
46632    struct sendfile_op
46633    {
46634      tcp::socket& sock_;
46635      int fd_;
46636      Handler handler_;
46637      off_t offset_;
46638      std::size_t total_bytes_transferred_;
46639
46640      // Function call operator meeting WriteHandler requirements.
46641      // Used as the handler for the async_write_some operation.
46642      void operator()(boost::system::error_code ec, std::size_t)
46643      {
46644        // Put the underlying socket into non-blocking mode.
46645        if (!ec)
46646          if (!sock_.native_non_blocking())
46647            sock_.native_non_blocking(true, ec);
46648
46649        if (!ec)
46650        {
46651          for (;;)
46652          {
46653            // Try the system call.
46654            errno = 0;
46655            int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
46656            ec = boost::system::error_code(n < 0 ? errno : 0,
46657                boost::asio::error::get_system_category());
46658            total_bytes_transferred_ += ec ? 0 : n;
46659
46660            // Retry operation immediately if interrupted by signal.
46661            if (ec == boost::asio::error::interrupted)
46662              continue;
46663
46664            // Check if we need to run the operation again.
46665            if (ec == boost::asio::error::would_block
46666                || ec == boost::asio::error::try_again)
46667            {
46668              // We have to wait for the socket to become ready again.
46669              sock_.async_wait(tcp::socket::wait_write, *this);
46670              return;
46671            }
46672
46673            if (ec || n == 0)
46674            {
46675              // An error occurred, or we have reached the end of the file.
46676              // Either way we must exit the loop so we can call the handler.
46677              break;
46678            }
46679
46680            // Loop around to try calling sendfile again.
46681          }
46682        }
46683
46684        // Pass result back to user's handler.
46685        handler_(ec, total_bytes_transferred_);
46686      }
46687    };
46688
46689    template <typename Handler>
46690    void async_sendfile(tcp::socket& sock, int fd, Handler h)
46691    {
46692      sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
46693      sock.async_wait(tcp::socket::wait_write, op);
46694    } 
46695
46696
46697
46698
46699
46700
46701
46702 [endsect]
46703
46704
46705
46706 [section:overload2 basic_stream_socket::native_non_blocking (2 of 3 overloads)]
46707
46708
46709 ['Inherited from basic_socket.]
46710
46711
46712 Sets the non-blocking mode of the native socket implementation. 
46713
46714
46715   void native_non_blocking(
46716       bool mode);
46717
46718
46719 This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations.
46720
46721
46722 [heading Parameters]
46723     
46724
46725 [variablelist
46726   
46727 [[mode][If `true`, the underlying socket is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]]
46728
46729 ]
46730
46731
46732 [heading Exceptions]
46733     
46734
46735 [variablelist
46736   
46737 [[boost::system::system_error][Thrown on failure. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense.]]
46738
46739 ]
46740
46741
46742 [heading Example]
46743   
46744 This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated: 
46745
46746    template <typename Handler>
46747    struct sendfile_op
46748    {
46749      tcp::socket& sock_;
46750      int fd_;
46751      Handler handler_;
46752      off_t offset_;
46753      std::size_t total_bytes_transferred_;
46754
46755      // Function call operator meeting WriteHandler requirements.
46756      // Used as the handler for the async_write_some operation.
46757      void operator()(boost::system::error_code ec, std::size_t)
46758      {
46759        // Put the underlying socket into non-blocking mode.
46760        if (!ec)
46761          if (!sock_.native_non_blocking())
46762            sock_.native_non_blocking(true, ec);
46763
46764        if (!ec)
46765        {
46766          for (;;)
46767          {
46768            // Try the system call.
46769            errno = 0;
46770            int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
46771            ec = boost::system::error_code(n < 0 ? errno : 0,
46772                boost::asio::error::get_system_category());
46773            total_bytes_transferred_ += ec ? 0 : n;
46774
46775            // Retry operation immediately if interrupted by signal.
46776            if (ec == boost::asio::error::interrupted)
46777              continue;
46778
46779            // Check if we need to run the operation again.
46780            if (ec == boost::asio::error::would_block
46781                || ec == boost::asio::error::try_again)
46782            {
46783              // We have to wait for the socket to become ready again.
46784              sock_.async_wait(tcp::socket::wait_write, *this);
46785              return;
46786            }
46787
46788            if (ec || n == 0)
46789            {
46790              // An error occurred, or we have reached the end of the file.
46791              // Either way we must exit the loop so we can call the handler.
46792              break;
46793            }
46794
46795            // Loop around to try calling sendfile again.
46796          }
46797        }
46798
46799        // Pass result back to user's handler.
46800        handler_(ec, total_bytes_transferred_);
46801      }
46802    };
46803
46804    template <typename Handler>
46805    void async_sendfile(tcp::socket& sock, int fd, Handler h)
46806    {
46807      sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
46808      sock.async_wait(tcp::socket::wait_write, op);
46809    } 
46810
46811
46812
46813
46814
46815
46816
46817 [endsect]
46818
46819
46820
46821 [section:overload3 basic_stream_socket::native_non_blocking (3 of 3 overloads)]
46822
46823
46824 ['Inherited from basic_socket.]
46825
46826
46827 Sets the non-blocking mode of the native socket implementation. 
46828
46829
46830   void native_non_blocking(
46831       bool mode,
46832       boost::system::error_code & ec);
46833
46834
46835 This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations.
46836
46837
46838 [heading Parameters]
46839     
46840
46841 [variablelist
46842   
46843 [[mode][If `true`, the underlying socket is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]]
46844
46845 [[ec][Set to indicate what error occurred, if any. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense.]]
46846
46847 ]
46848
46849
46850 [heading Example]
46851   
46852 This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated: 
46853
46854    template <typename Handler>
46855    struct sendfile_op
46856    {
46857      tcp::socket& sock_;
46858      int fd_;
46859      Handler handler_;
46860      off_t offset_;
46861      std::size_t total_bytes_transferred_;
46862
46863      // Function call operator meeting WriteHandler requirements.
46864      // Used as the handler for the async_write_some operation.
46865      void operator()(boost::system::error_code ec, std::size_t)
46866      {
46867        // Put the underlying socket into non-blocking mode.
46868        if (!ec)
46869          if (!sock_.native_non_blocking())
46870            sock_.native_non_blocking(true, ec);
46871
46872        if (!ec)
46873        {
46874          for (;;)
46875          {
46876            // Try the system call.
46877            errno = 0;
46878            int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
46879            ec = boost::system::error_code(n < 0 ? errno : 0,
46880                boost::asio::error::get_system_category());
46881            total_bytes_transferred_ += ec ? 0 : n;
46882
46883            // Retry operation immediately if interrupted by signal.
46884            if (ec == boost::asio::error::interrupted)
46885              continue;
46886
46887            // Check if we need to run the operation again.
46888            if (ec == boost::asio::error::would_block
46889                || ec == boost::asio::error::try_again)
46890            {
46891              // We have to wait for the socket to become ready again.
46892              sock_.async_wait(tcp::socket::wait_write, *this);
46893              return;
46894            }
46895
46896            if (ec || n == 0)
46897            {
46898              // An error occurred, or we have reached the end of the file.
46899              // Either way we must exit the loop so we can call the handler.
46900              break;
46901            }
46902
46903            // Loop around to try calling sendfile again.
46904          }
46905        }
46906
46907        // Pass result back to user's handler.
46908        handler_(ec, total_bytes_transferred_);
46909      }
46910    };
46911
46912    template <typename Handler>
46913    void async_sendfile(tcp::socket& sock, int fd, Handler h)
46914    {
46915      sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
46916      sock.async_wait(tcp::socket::wait_write, op);
46917    } 
46918
46919
46920
46921
46922
46923
46924
46925 [endsect]
46926
46927
46928 [endsect]
46929
46930 [section:non_blocking basic_stream_socket::non_blocking]
46931
46932 [indexterm2 boost_asio.indexterm.basic_stream_socket.non_blocking..non_blocking..basic_stream_socket] 
46933 Gets the non-blocking mode of the socket. 
46934
46935
46936   bool ``[link boost_asio.reference.basic_stream_socket.non_blocking.overload1 non_blocking]``() const;
46937   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.non_blocking.overload1 more...]]``
46938
46939
46940 Sets the non-blocking mode of the socket. 
46941
46942
46943   void ``[link boost_asio.reference.basic_stream_socket.non_blocking.overload2 non_blocking]``(
46944       bool mode);
46945   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.non_blocking.overload2 more...]]``
46946
46947   void ``[link boost_asio.reference.basic_stream_socket.non_blocking.overload3 non_blocking]``(
46948       bool mode,
46949       boost::system::error_code & ec);
46950   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.non_blocking.overload3 more...]]``
46951
46952
46953 [section:overload1 basic_stream_socket::non_blocking (1 of 3 overloads)]
46954
46955
46956 ['Inherited from basic_socket.]
46957
46958
46959 Gets the non-blocking mode of the socket. 
46960
46961
46962   bool non_blocking() const;
46963
46964
46965
46966 [heading Return Value]
46967       
46968 `true` if the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.
46969
46970
46971 [heading Remarks]
46972       
46973 The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`. 
46974
46975
46976
46977
46978 [endsect]
46979
46980
46981
46982 [section:overload2 basic_stream_socket::non_blocking (2 of 3 overloads)]
46983
46984
46985 ['Inherited from basic_socket.]
46986
46987
46988 Sets the non-blocking mode of the socket. 
46989
46990
46991   void non_blocking(
46992       bool mode);
46993
46994
46995
46996 [heading Parameters]
46997     
46998
46999 [variablelist
47000   
47001 [[mode][If `true`, the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]]
47002
47003 ]
47004
47005
47006 [heading Exceptions]
47007     
47008
47009 [variablelist
47010   
47011 [[boost::system::system_error][Thrown on failure.]]
47012
47013 ]
47014
47015
47016 [heading Remarks]
47017       
47018 The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`. 
47019
47020
47021
47022
47023 [endsect]
47024
47025
47026
47027 [section:overload3 basic_stream_socket::non_blocking (3 of 3 overloads)]
47028
47029
47030 ['Inherited from basic_socket.]
47031
47032
47033 Sets the non-blocking mode of the socket. 
47034
47035
47036   void non_blocking(
47037       bool mode,
47038       boost::system::error_code & ec);
47039
47040
47041
47042 [heading Parameters]
47043     
47044
47045 [variablelist
47046   
47047 [[mode][If `true`, the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]]
47048
47049 [[ec][Set to indicate what error occurred, if any.]]
47050
47051 ]
47052
47053
47054 [heading Remarks]
47055       
47056 The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`. 
47057
47058
47059
47060
47061 [endsect]
47062
47063
47064 [endsect]
47065
47066 [section:open basic_stream_socket::open]
47067
47068 [indexterm2 boost_asio.indexterm.basic_stream_socket.open..open..basic_stream_socket] 
47069 Open the socket using the specified protocol. 
47070
47071
47072   void ``[link boost_asio.reference.basic_stream_socket.open.overload1 open]``(
47073       const protocol_type & protocol = protocol_type());
47074   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.open.overload1 more...]]``
47075
47076   void ``[link boost_asio.reference.basic_stream_socket.open.overload2 open]``(
47077       const protocol_type & protocol,
47078       boost::system::error_code & ec);
47079   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.open.overload2 more...]]``
47080
47081
47082 [section:overload1 basic_stream_socket::open (1 of 2 overloads)]
47083
47084
47085 ['Inherited from basic_socket.]
47086
47087
47088 Open the socket using the specified protocol. 
47089
47090
47091   void open(
47092       const protocol_type & protocol = protocol_type());
47093
47094
47095 This function opens the socket so that it will use the specified protocol.
47096
47097
47098 [heading Parameters]
47099     
47100
47101 [variablelist
47102   
47103 [[protocol][An object specifying protocol parameters to be used.]]
47104
47105 ]
47106
47107
47108 [heading Exceptions]
47109     
47110
47111 [variablelist
47112   
47113 [[boost::system::system_error][Thrown on failure.]]
47114
47115 ]
47116
47117
47118 [heading Example]
47119   
47120
47121
47122    boost::asio::ip::tcp::socket socket(my_context);
47123    socket.open(boost::asio::ip::tcp::v4());
47124
47125
47126
47127
47128
47129
47130
47131 [endsect]
47132
47133
47134
47135 [section:overload2 basic_stream_socket::open (2 of 2 overloads)]
47136
47137
47138 ['Inherited from basic_socket.]
47139
47140
47141 Open the socket using the specified protocol. 
47142
47143
47144   void open(
47145       const protocol_type & protocol,
47146       boost::system::error_code & ec);
47147
47148
47149 This function opens the socket so that it will use the specified protocol.
47150
47151
47152 [heading Parameters]
47153     
47154
47155 [variablelist
47156   
47157 [[protocol][An object specifying which protocol is to be used.]]
47158
47159 [[ec][Set to indicate what error occurred, if any.]]
47160
47161 ]
47162
47163
47164 [heading Example]
47165   
47166
47167
47168    boost::asio::ip::tcp::socket socket(my_context);
47169    boost::system::error_code ec;
47170    socket.open(boost::asio::ip::tcp::v4(), ec);
47171    if (ec)
47172    {
47173      // An error occurred.
47174    }
47175
47176
47177
47178
47179
47180
47181
47182 [endsect]
47183
47184
47185 [endsect]
47186
47187 [section:operator_eq_ basic_stream_socket::operator=]
47188
47189 [indexterm2 boost_asio.indexterm.basic_stream_socket.operator_eq_..operator=..basic_stream_socket] 
47190 Move-assign a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] from another. 
47191
47192
47193   basic_stream_socket & ``[link boost_asio.reference.basic_stream_socket.operator_eq_.overload1 operator=]``(
47194       basic_stream_socket && other);
47195   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.operator_eq_.overload1 more...]]``
47196
47197
47198 Move-assign a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] from a socket of another protocol type. 
47199
47200
47201   template<
47202       typename ``[link boost_asio.reference.Protocol Protocol1]``,
47203       typename ``[link boost_asio.reference.Executor1 Executor1]``>
47204   enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value, basic_stream_socket & >::type ``[link boost_asio.reference.basic_stream_socket.operator_eq_.overload2 operator=]``(
47205       basic_stream_socket< Protocol1, Executor1 > && other);
47206   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.operator_eq_.overload2 more...]]``
47207
47208
47209 [section:overload1 basic_stream_socket::operator= (1 of 2 overloads)]
47210
47211
47212 Move-assign a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] from another. 
47213
47214
47215   basic_stream_socket & operator=(
47216       basic_stream_socket && other);
47217
47218
47219 This assignment operator moves a stream socket from one object to another.
47220
47221
47222 [heading Parameters]
47223     
47224
47225 [variablelist
47226   
47227 [[other][The other [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] object from which the move will occur.]]
47228
47229 ]
47230
47231
47232 [heading Remarks]
47233       
47234 Following the move, the moved-from object is in the same state as if constructed using the `basic_stream_socket(const executor_type&)` constructor. 
47235
47236
47237
47238
47239 [endsect]
47240
47241
47242
47243 [section:overload2 basic_stream_socket::operator= (2 of 2 overloads)]
47244
47245
47246 Move-assign a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] from a socket of another protocol type. 
47247
47248
47249   template<
47250       typename ``[link boost_asio.reference.Protocol Protocol1]``,
47251       typename ``[link boost_asio.reference.Executor1 Executor1]``>
47252   enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value, basic_stream_socket & >::type operator=(
47253       basic_stream_socket< Protocol1, Executor1 > && other);
47254
47255
47256 This assignment operator moves a stream socket from one object to another.
47257
47258
47259 [heading Parameters]
47260     
47261
47262 [variablelist
47263   
47264 [[other][The other [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] object from which the move will occur.]]
47265
47266 ]
47267
47268
47269 [heading Remarks]
47270       
47271 Following the move, the moved-from object is in the same state as if constructed using the `basic_stream_socket(const executor_type&)` constructor. 
47272
47273
47274
47275
47276 [endsect]
47277
47278
47279 [endsect]
47280
47281
47282 [section:out_of_band_inline basic_stream_socket::out_of_band_inline]
47283
47284
47285 ['Inherited from socket_base.]
47286
47287 [indexterm2 boost_asio.indexterm.basic_stream_socket.out_of_band_inline..out_of_band_inline..basic_stream_socket] 
47288 Socket option for putting received out-of-band data inline. 
47289
47290
47291   typedef implementation_defined out_of_band_inline;
47292
47293
47294
47295 Implements the SOL\_SOCKET/SO\_OOBINLINE socket option.
47296
47297
47298 [heading Examples]
47299   
47300 Setting the option: 
47301
47302    boost::asio::ip::tcp::socket socket(my_context);
47303    ...
47304    boost::asio::socket_base::out_of_band_inline option(true);
47305    socket.set_option(option);
47306
47307
47308
47309
47310
47311 Getting the current option value: 
47312
47313    boost::asio::ip::tcp::socket socket(my_context);
47314    ...
47315    boost::asio::socket_base::out_of_band_inline option;
47316    socket.get_option(option);
47317    bool value = option.value();
47318
47319
47320
47321
47322
47323
47324
47325 [heading Requirements]
47326
47327 ['Header: ][^boost/asio/basic_stream_socket.hpp]
47328
47329 ['Convenience header: ][^boost/asio.hpp]
47330
47331
47332 [endsect]
47333
47334
47335
47336 [section:protocol_type basic_stream_socket::protocol_type]
47337
47338 [indexterm2 boost_asio.indexterm.basic_stream_socket.protocol_type..protocol_type..basic_stream_socket] 
47339 The protocol type. 
47340
47341
47342   typedef Protocol protocol_type;
47343
47344
47345
47346 [heading Requirements]
47347
47348 ['Header: ][^boost/asio/basic_stream_socket.hpp]
47349
47350 ['Convenience header: ][^boost/asio.hpp]
47351
47352
47353 [endsect]
47354
47355
47356 [section:read_some basic_stream_socket::read_some]
47357
47358 [indexterm2 boost_asio.indexterm.basic_stream_socket.read_some..read_some..basic_stream_socket] 
47359 Read some data from the socket. 
47360
47361
47362   template<
47363       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
47364   std::size_t ``[link boost_asio.reference.basic_stream_socket.read_some.overload1 read_some]``(
47365       const MutableBufferSequence & buffers);
47366   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.read_some.overload1 more...]]``
47367
47368   template<
47369       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
47370   std::size_t ``[link boost_asio.reference.basic_stream_socket.read_some.overload2 read_some]``(
47371       const MutableBufferSequence & buffers,
47372       boost::system::error_code & ec);
47373   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.read_some.overload2 more...]]``
47374
47375
47376 [section:overload1 basic_stream_socket::read_some (1 of 2 overloads)]
47377
47378
47379 Read some data from the socket. 
47380
47381
47382   template<
47383       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
47384   std::size_t read_some(
47385       const MutableBufferSequence & buffers);
47386
47387
47388 This function is used to read data from the stream socket. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
47389
47390
47391 [heading Parameters]
47392     
47393
47394 [variablelist
47395   
47396 [[buffers][One or more buffers into which the data will be read.]]
47397
47398 ]
47399
47400
47401 [heading Return Value]
47402       
47403 The number of bytes read.
47404
47405
47406 [heading Exceptions]
47407     
47408
47409 [variablelist
47410   
47411 [[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
47412
47413 ]
47414
47415
47416 [heading Remarks]
47417       
47418 The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`]  function if you need to ensure that the requested amount of data is read before the blocking operation completes.
47419
47420
47421 [heading Example]
47422   
47423 To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
47424
47425    socket.read_some(boost::asio::buffer(data, size));
47426
47427
47428 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
47429
47430
47431
47432
47433 [endsect]
47434
47435
47436
47437 [section:overload2 basic_stream_socket::read_some (2 of 2 overloads)]
47438
47439
47440 Read some data from the socket. 
47441
47442
47443   template<
47444       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
47445   std::size_t read_some(
47446       const MutableBufferSequence & buffers,
47447       boost::system::error_code & ec);
47448
47449
47450 This function is used to read data from the stream socket. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
47451
47452
47453 [heading Parameters]
47454     
47455
47456 [variablelist
47457   
47458 [[buffers][One or more buffers into which the data will be read.]]
47459
47460 [[ec][Set to indicate what error occurred, if any.]]
47461
47462 ]
47463
47464
47465 [heading Return Value]
47466       
47467 The number of bytes read. Returns 0 if an error occurred.
47468
47469
47470 [heading Remarks]
47471       
47472 The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`]  function if you need to ensure that the requested amount of data is read before the blocking operation completes. 
47473
47474
47475
47476
47477 [endsect]
47478
47479
47480 [endsect]
47481
47482 [section:receive basic_stream_socket::receive]
47483
47484 [indexterm2 boost_asio.indexterm.basic_stream_socket.receive..receive..basic_stream_socket] 
47485 Receive some data on the socket. 
47486
47487
47488   template<
47489       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
47490   std::size_t ``[link boost_asio.reference.basic_stream_socket.receive.overload1 receive]``(
47491       const MutableBufferSequence & buffers);
47492   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.receive.overload1 more...]]``
47493
47494   template<
47495       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
47496   std::size_t ``[link boost_asio.reference.basic_stream_socket.receive.overload2 receive]``(
47497       const MutableBufferSequence & buffers,
47498       socket_base::message_flags flags);
47499   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.receive.overload2 more...]]``
47500
47501
47502 Receive some data on a connected socket. 
47503
47504
47505   template<
47506       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
47507   std::size_t ``[link boost_asio.reference.basic_stream_socket.receive.overload3 receive]``(
47508       const MutableBufferSequence & buffers,
47509       socket_base::message_flags flags,
47510       boost::system::error_code & ec);
47511   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.receive.overload3 more...]]``
47512
47513
47514 [section:overload1 basic_stream_socket::receive (1 of 3 overloads)]
47515
47516
47517 Receive some data on the socket. 
47518
47519
47520   template<
47521       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
47522   std::size_t receive(
47523       const MutableBufferSequence & buffers);
47524
47525
47526 This function is used to receive data on the stream socket. The function call will block until one or more bytes of data has been received successfully, or until an error occurs.
47527
47528
47529 [heading Parameters]
47530     
47531
47532 [variablelist
47533   
47534 [[buffers][One or more buffers into which the data will be received.]]
47535
47536 ]
47537
47538
47539 [heading Return Value]
47540       
47541 The number of bytes received.
47542
47543
47544 [heading Exceptions]
47545     
47546
47547 [variablelist
47548   
47549 [[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
47550
47551 ]
47552
47553
47554 [heading Remarks]
47555       
47556 The receive operation may not receive all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`]  function if you need to ensure that the requested amount of data is read before the blocking operation completes.
47557
47558
47559 [heading Example]
47560   
47561 To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
47562
47563    socket.receive(boost::asio::buffer(data, size));
47564
47565
47566 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
47567
47568
47569
47570
47571 [endsect]
47572
47573
47574
47575 [section:overload2 basic_stream_socket::receive (2 of 3 overloads)]
47576
47577
47578 Receive some data on the socket. 
47579
47580
47581   template<
47582       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
47583   std::size_t receive(
47584       const MutableBufferSequence & buffers,
47585       socket_base::message_flags flags);
47586
47587
47588 This function is used to receive data on the stream socket. The function call will block until one or more bytes of data has been received successfully, or until an error occurs.
47589
47590
47591 [heading Parameters]
47592     
47593
47594 [variablelist
47595   
47596 [[buffers][One or more buffers into which the data will be received.]]
47597
47598 [[flags][Flags specifying how the receive call is to be made.]]
47599
47600 ]
47601
47602
47603 [heading Return Value]
47604       
47605 The number of bytes received.
47606
47607
47608 [heading Exceptions]
47609     
47610
47611 [variablelist
47612   
47613 [[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
47614
47615 ]
47616
47617
47618 [heading Remarks]
47619       
47620 The receive operation may not receive all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`]  function if you need to ensure that the requested amount of data is read before the blocking operation completes.
47621
47622
47623 [heading Example]
47624   
47625 To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
47626
47627    socket.receive(boost::asio::buffer(data, size), 0);
47628
47629
47630 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
47631
47632
47633
47634
47635 [endsect]
47636
47637
47638
47639 [section:overload3 basic_stream_socket::receive (3 of 3 overloads)]
47640
47641
47642 Receive some data on a connected socket. 
47643
47644
47645   template<
47646       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
47647   std::size_t receive(
47648       const MutableBufferSequence & buffers,
47649       socket_base::message_flags flags,
47650       boost::system::error_code & ec);
47651
47652
47653 This function is used to receive data on the stream socket. The function call will block until one or more bytes of data has been received successfully, or until an error occurs.
47654
47655
47656 [heading Parameters]
47657     
47658
47659 [variablelist
47660   
47661 [[buffers][One or more buffers into which the data will be received.]]
47662
47663 [[flags][Flags specifying how the receive call is to be made.]]
47664
47665 [[ec][Set to indicate what error occurred, if any.]]
47666
47667 ]
47668
47669
47670 [heading Return Value]
47671       
47672 The number of bytes received. Returns 0 if an error occurred.
47673
47674
47675 [heading Remarks]
47676       
47677 The receive operation may not receive all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`]  function if you need to ensure that the requested amount of data is read before the blocking operation completes. 
47678
47679
47680
47681
47682 [endsect]
47683
47684
47685 [endsect]
47686
47687
47688 [section:receive_buffer_size basic_stream_socket::receive_buffer_size]
47689
47690
47691 ['Inherited from socket_base.]
47692
47693 [indexterm2 boost_asio.indexterm.basic_stream_socket.receive_buffer_size..receive_buffer_size..basic_stream_socket] 
47694 Socket option for the receive buffer size of a socket. 
47695
47696
47697   typedef implementation_defined receive_buffer_size;
47698
47699
47700
47701 Implements the SOL\_SOCKET/SO\_RCVBUF socket option.
47702
47703
47704 [heading Examples]
47705   
47706 Setting the option: 
47707
47708    boost::asio::ip::tcp::socket socket(my_context);
47709    ...
47710    boost::asio::socket_base::receive_buffer_size option(8192);
47711    socket.set_option(option);
47712
47713
47714
47715
47716
47717 Getting the current option value: 
47718
47719    boost::asio::ip::tcp::socket socket(my_context);
47720    ...
47721    boost::asio::socket_base::receive_buffer_size option;
47722    socket.get_option(option);
47723    int size = option.value();
47724
47725
47726
47727
47728
47729
47730
47731 [heading Requirements]
47732
47733 ['Header: ][^boost/asio/basic_stream_socket.hpp]
47734
47735 ['Convenience header: ][^boost/asio.hpp]
47736
47737
47738 [endsect]
47739
47740
47741
47742 [section:receive_low_watermark basic_stream_socket::receive_low_watermark]
47743
47744
47745 ['Inherited from socket_base.]
47746
47747 [indexterm2 boost_asio.indexterm.basic_stream_socket.receive_low_watermark..receive_low_watermark..basic_stream_socket] 
47748 Socket option for the receive low watermark. 
47749
47750
47751   typedef implementation_defined receive_low_watermark;
47752
47753
47754
47755 Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option.
47756
47757
47758 [heading Examples]
47759   
47760 Setting the option: 
47761
47762    boost::asio::ip::tcp::socket socket(my_context);
47763    ...
47764    boost::asio::socket_base::receive_low_watermark option(1024);
47765    socket.set_option(option);
47766
47767
47768
47769
47770
47771 Getting the current option value: 
47772
47773    boost::asio::ip::tcp::socket socket(my_context);
47774    ...
47775    boost::asio::socket_base::receive_low_watermark option;
47776    socket.get_option(option);
47777    int size = option.value();
47778
47779
47780
47781
47782
47783
47784
47785 [heading Requirements]
47786
47787 ['Header: ][^boost/asio/basic_stream_socket.hpp]
47788
47789 ['Convenience header: ][^boost/asio.hpp]
47790
47791
47792 [endsect]
47793
47794
47795 [section:release basic_stream_socket::release]
47796
47797 [indexterm2 boost_asio.indexterm.basic_stream_socket.release..release..basic_stream_socket] 
47798 Release ownership of the underlying native socket. 
47799
47800
47801   native_handle_type ``[link boost_asio.reference.basic_stream_socket.release.overload1 release]``();
47802   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.release.overload1 more...]]``
47803
47804   native_handle_type ``[link boost_asio.reference.basic_stream_socket.release.overload2 release]``(
47805       boost::system::error_code & ec);
47806   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.release.overload2 more...]]``
47807
47808
47809 [section:overload1 basic_stream_socket::release (1 of 2 overloads)]
47810
47811
47812 ['Inherited from basic_socket.]
47813
47814
47815 Release ownership of the underlying native socket. 
47816
47817
47818   native_handle_type release();
47819
47820
47821 This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error. Ownership of the native socket is then transferred to the caller.
47822
47823
47824 [heading Exceptions]
47825     
47826
47827 [variablelist
47828   
47829 [[boost::system::system_error][Thrown on failure.]]
47830
47831 ]
47832
47833
47834 [heading Remarks]
47835       
47836 This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms. 
47837
47838
47839
47840
47841 [endsect]
47842
47843
47844
47845 [section:overload2 basic_stream_socket::release (2 of 2 overloads)]
47846
47847
47848 ['Inherited from basic_socket.]
47849
47850
47851 Release ownership of the underlying native socket. 
47852
47853
47854   native_handle_type release(
47855       boost::system::error_code & ec);
47856
47857
47858 This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error. Ownership of the native socket is then transferred to the caller.
47859
47860
47861 [heading Parameters]
47862     
47863
47864 [variablelist
47865   
47866 [[ec][Set to indicate what error occurred, if any.]]
47867
47868 ]
47869
47870
47871 [heading Remarks]
47872       
47873 This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms. 
47874
47875
47876
47877
47878 [endsect]
47879
47880
47881 [endsect]
47882
47883 [section:remote_endpoint basic_stream_socket::remote_endpoint]
47884
47885 [indexterm2 boost_asio.indexterm.basic_stream_socket.remote_endpoint..remote_endpoint..basic_stream_socket] 
47886 Get the remote endpoint of the socket. 
47887
47888
47889   endpoint_type ``[link boost_asio.reference.basic_stream_socket.remote_endpoint.overload1 remote_endpoint]``() const;
47890   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.remote_endpoint.overload1 more...]]``
47891
47892   endpoint_type ``[link boost_asio.reference.basic_stream_socket.remote_endpoint.overload2 remote_endpoint]``(
47893       boost::system::error_code & ec) const;
47894   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.remote_endpoint.overload2 more...]]``
47895
47896
47897 [section:overload1 basic_stream_socket::remote_endpoint (1 of 2 overloads)]
47898
47899
47900 ['Inherited from basic_socket.]
47901
47902
47903 Get the remote endpoint of the socket. 
47904
47905
47906   endpoint_type remote_endpoint() const;
47907
47908
47909 This function is used to obtain the remote endpoint of the socket.
47910
47911
47912 [heading Return Value]
47913       
47914 An object that represents the remote endpoint of the socket.
47915
47916
47917 [heading Exceptions]
47918     
47919
47920 [variablelist
47921   
47922 [[boost::system::system_error][Thrown on failure.]]
47923
47924 ]
47925
47926
47927 [heading Example]
47928   
47929
47930
47931    boost::asio::ip::tcp::socket socket(my_context);
47932    ...
47933    boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint();
47934
47935
47936
47937
47938
47939
47940
47941 [endsect]
47942
47943
47944
47945 [section:overload2 basic_stream_socket::remote_endpoint (2 of 2 overloads)]
47946
47947
47948 ['Inherited from basic_socket.]
47949
47950
47951 Get the remote endpoint of the socket. 
47952
47953
47954   endpoint_type remote_endpoint(
47955       boost::system::error_code & ec) const;
47956
47957
47958 This function is used to obtain the remote endpoint of the socket.
47959
47960
47961 [heading Parameters]
47962     
47963
47964 [variablelist
47965   
47966 [[ec][Set to indicate what error occurred, if any.]]
47967
47968 ]
47969
47970
47971 [heading Return Value]
47972       
47973 An object that represents the remote endpoint of the socket. Returns a default-constructed endpoint object if an error occurred.
47974
47975
47976 [heading Example]
47977   
47978
47979
47980    boost::asio::ip::tcp::socket socket(my_context);
47981    ...
47982    boost::system::error_code ec;
47983    boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(ec);
47984    if (ec)
47985    {
47986      // An error occurred.
47987    }
47988
47989
47990
47991
47992
47993
47994
47995 [endsect]
47996
47997
47998 [endsect]
47999
48000
48001 [section:reuse_address basic_stream_socket::reuse_address]
48002
48003
48004 ['Inherited from socket_base.]
48005
48006 [indexterm2 boost_asio.indexterm.basic_stream_socket.reuse_address..reuse_address..basic_stream_socket] 
48007 Socket option to allow the socket to be bound to an address that is already in use. 
48008
48009
48010   typedef implementation_defined reuse_address;
48011
48012
48013
48014 Implements the SOL\_SOCKET/SO\_REUSEADDR socket option.
48015
48016
48017 [heading Examples]
48018   
48019 Setting the option: 
48020
48021    boost::asio::ip::tcp::acceptor acceptor(my_context);
48022    ...
48023    boost::asio::socket_base::reuse_address option(true);
48024    acceptor.set_option(option);
48025
48026
48027
48028
48029
48030 Getting the current option value: 
48031
48032    boost::asio::ip::tcp::acceptor acceptor(my_context);
48033    ...
48034    boost::asio::socket_base::reuse_address option;
48035    acceptor.get_option(option);
48036    bool is_set = option.value();
48037
48038
48039
48040
48041
48042
48043
48044 [heading Requirements]
48045
48046 ['Header: ][^boost/asio/basic_stream_socket.hpp]
48047
48048 ['Convenience header: ][^boost/asio.hpp]
48049
48050
48051 [endsect]
48052
48053
48054 [section:send basic_stream_socket::send]
48055
48056 [indexterm2 boost_asio.indexterm.basic_stream_socket.send..send..basic_stream_socket] 
48057 Send some data on the socket. 
48058
48059
48060   template<
48061       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
48062   std::size_t ``[link boost_asio.reference.basic_stream_socket.send.overload1 send]``(
48063       const ConstBufferSequence & buffers);
48064   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.send.overload1 more...]]``
48065
48066   template<
48067       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
48068   std::size_t ``[link boost_asio.reference.basic_stream_socket.send.overload2 send]``(
48069       const ConstBufferSequence & buffers,
48070       socket_base::message_flags flags);
48071   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.send.overload2 more...]]``
48072
48073   template<
48074       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
48075   std::size_t ``[link boost_asio.reference.basic_stream_socket.send.overload3 send]``(
48076       const ConstBufferSequence & buffers,
48077       socket_base::message_flags flags,
48078       boost::system::error_code & ec);
48079   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.send.overload3 more...]]``
48080
48081
48082 [section:overload1 basic_stream_socket::send (1 of 3 overloads)]
48083
48084
48085 Send some data on the socket. 
48086
48087
48088   template<
48089       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
48090   std::size_t send(
48091       const ConstBufferSequence & buffers);
48092
48093
48094 This function is used to send data on the stream socket. The function call will block until one or more bytes of the data has been sent successfully, or an until error occurs.
48095
48096
48097 [heading Parameters]
48098     
48099
48100 [variablelist
48101   
48102 [[buffers][One or more data buffers to be sent on the socket.]]
48103
48104 ]
48105
48106
48107 [heading Return Value]
48108       
48109 The number of bytes sent.
48110
48111
48112 [heading Exceptions]
48113     
48114
48115 [variablelist
48116   
48117 [[boost::system::system_error][Thrown on failure.]]
48118
48119 ]
48120
48121
48122 [heading Remarks]
48123       
48124 The send operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`]  function if you need to ensure that all data is written before the blocking operation completes.
48125
48126
48127 [heading Example]
48128   
48129 To send a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
48130
48131    socket.send(boost::asio::buffer(data, size));
48132
48133
48134 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
48135
48136
48137
48138
48139 [endsect]
48140
48141
48142
48143 [section:overload2 basic_stream_socket::send (2 of 3 overloads)]
48144
48145
48146 Send some data on the socket. 
48147
48148
48149   template<
48150       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
48151   std::size_t send(
48152       const ConstBufferSequence & buffers,
48153       socket_base::message_flags flags);
48154
48155
48156 This function is used to send data on the stream socket. The function call will block until one or more bytes of the data has been sent successfully, or an until error occurs.
48157
48158
48159 [heading Parameters]
48160     
48161
48162 [variablelist
48163   
48164 [[buffers][One or more data buffers to be sent on the socket.]]
48165
48166 [[flags][Flags specifying how the send call is to be made.]]
48167
48168 ]
48169
48170
48171 [heading Return Value]
48172       
48173 The number of bytes sent.
48174
48175
48176 [heading Exceptions]
48177     
48178
48179 [variablelist
48180   
48181 [[boost::system::system_error][Thrown on failure.]]
48182
48183 ]
48184
48185
48186 [heading Remarks]
48187       
48188 The send operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`]  function if you need to ensure that all data is written before the blocking operation completes.
48189
48190
48191 [heading Example]
48192   
48193 To send a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
48194
48195    socket.send(boost::asio::buffer(data, size), 0);
48196
48197
48198 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
48199
48200
48201
48202
48203 [endsect]
48204
48205
48206
48207 [section:overload3 basic_stream_socket::send (3 of 3 overloads)]
48208
48209
48210 Send some data on the socket. 
48211
48212
48213   template<
48214       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
48215   std::size_t send(
48216       const ConstBufferSequence & buffers,
48217       socket_base::message_flags flags,
48218       boost::system::error_code & ec);
48219
48220
48221 This function is used to send data on the stream socket. The function call will block until one or more bytes of the data has been sent successfully, or an until error occurs.
48222
48223
48224 [heading Parameters]
48225     
48226
48227 [variablelist
48228   
48229 [[buffers][One or more data buffers to be sent on the socket.]]
48230
48231 [[flags][Flags specifying how the send call is to be made.]]
48232
48233 [[ec][Set to indicate what error occurred, if any.]]
48234
48235 ]
48236
48237
48238 [heading Return Value]
48239       
48240 The number of bytes sent. Returns 0 if an error occurred.
48241
48242
48243 [heading Remarks]
48244       
48245 The send operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`]  function if you need to ensure that all data is written before the blocking operation completes. 
48246
48247
48248
48249
48250 [endsect]
48251
48252
48253 [endsect]
48254
48255
48256 [section:send_buffer_size basic_stream_socket::send_buffer_size]
48257
48258
48259 ['Inherited from socket_base.]
48260
48261 [indexterm2 boost_asio.indexterm.basic_stream_socket.send_buffer_size..send_buffer_size..basic_stream_socket] 
48262 Socket option for the send buffer size of a socket. 
48263
48264
48265   typedef implementation_defined send_buffer_size;
48266
48267
48268
48269 Implements the SOL\_SOCKET/SO\_SNDBUF socket option.
48270
48271
48272 [heading Examples]
48273   
48274 Setting the option: 
48275
48276    boost::asio::ip::tcp::socket socket(my_context);
48277    ...
48278    boost::asio::socket_base::send_buffer_size option(8192);
48279    socket.set_option(option);
48280
48281
48282
48283
48284
48285 Getting the current option value: 
48286
48287    boost::asio::ip::tcp::socket socket(my_context);
48288    ...
48289    boost::asio::socket_base::send_buffer_size option;
48290    socket.get_option(option);
48291    int size = option.value();
48292
48293
48294
48295
48296
48297
48298
48299 [heading Requirements]
48300
48301 ['Header: ][^boost/asio/basic_stream_socket.hpp]
48302
48303 ['Convenience header: ][^boost/asio.hpp]
48304
48305
48306 [endsect]
48307
48308
48309
48310 [section:send_low_watermark basic_stream_socket::send_low_watermark]
48311
48312
48313 ['Inherited from socket_base.]
48314
48315 [indexterm2 boost_asio.indexterm.basic_stream_socket.send_low_watermark..send_low_watermark..basic_stream_socket] 
48316 Socket option for the send low watermark. 
48317
48318
48319   typedef implementation_defined send_low_watermark;
48320
48321
48322
48323 Implements the SOL\_SOCKET/SO\_SNDLOWAT socket option.
48324
48325
48326 [heading Examples]
48327   
48328 Setting the option: 
48329
48330    boost::asio::ip::tcp::socket socket(my_context);
48331    ...
48332    boost::asio::socket_base::send_low_watermark option(1024);
48333    socket.set_option(option);
48334
48335
48336
48337
48338
48339 Getting the current option value: 
48340
48341    boost::asio::ip::tcp::socket socket(my_context);
48342    ...
48343    boost::asio::socket_base::send_low_watermark option;
48344    socket.get_option(option);
48345    int size = option.value();
48346
48347
48348
48349
48350
48351
48352
48353 [heading Requirements]
48354
48355 ['Header: ][^boost/asio/basic_stream_socket.hpp]
48356
48357 ['Convenience header: ][^boost/asio.hpp]
48358
48359
48360 [endsect]
48361
48362
48363 [section:set_option basic_stream_socket::set_option]
48364
48365 [indexterm2 boost_asio.indexterm.basic_stream_socket.set_option..set_option..basic_stream_socket] 
48366 Set an option on the socket. 
48367
48368
48369   template<
48370       typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
48371   void ``[link boost_asio.reference.basic_stream_socket.set_option.overload1 set_option]``(
48372       const SettableSocketOption & option);
48373   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.set_option.overload1 more...]]``
48374
48375   template<
48376       typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
48377   void ``[link boost_asio.reference.basic_stream_socket.set_option.overload2 set_option]``(
48378       const SettableSocketOption & option,
48379       boost::system::error_code & ec);
48380   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.set_option.overload2 more...]]``
48381
48382
48383 [section:overload1 basic_stream_socket::set_option (1 of 2 overloads)]
48384
48385
48386 ['Inherited from basic_socket.]
48387
48388
48389 Set an option on the socket. 
48390
48391
48392   template<
48393       typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
48394   void set_option(
48395       const SettableSocketOption & option);
48396
48397
48398 This function is used to set an option on the socket.
48399
48400
48401 [heading Parameters]
48402     
48403
48404 [variablelist
48405   
48406 [[option][The new option value to be set on the socket.]]
48407
48408 ]
48409
48410
48411 [heading Exceptions]
48412     
48413
48414 [variablelist
48415   
48416 [[boost::system::system_error][Thrown on failure.]]
48417
48418 ]
48419
48420
48421
48422 [heading Example]
48423   
48424 Setting the IPPROTO\_TCP/TCP\_NODELAY option: 
48425
48426    boost::asio::ip::tcp::socket socket(my_context);
48427    ...
48428    boost::asio::ip::tcp::no_delay option(true);
48429    socket.set_option(option);
48430
48431
48432
48433
48434
48435
48436
48437 [endsect]
48438
48439
48440
48441 [section:overload2 basic_stream_socket::set_option (2 of 2 overloads)]
48442
48443
48444 ['Inherited from basic_socket.]
48445
48446
48447 Set an option on the socket. 
48448
48449
48450   template<
48451       typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
48452   void set_option(
48453       const SettableSocketOption & option,
48454       boost::system::error_code & ec);
48455
48456
48457 This function is used to set an option on the socket.
48458
48459
48460 [heading Parameters]
48461     
48462
48463 [variablelist
48464   
48465 [[option][The new option value to be set on the socket.]]
48466
48467 [[ec][Set to indicate what error occurred, if any.]]
48468
48469 ]
48470
48471
48472
48473 [heading Example]
48474   
48475 Setting the IPPROTO\_TCP/TCP\_NODELAY option: 
48476
48477    boost::asio::ip::tcp::socket socket(my_context);
48478    ...
48479    boost::asio::ip::tcp::no_delay option(true);
48480    boost::system::error_code ec;
48481    socket.set_option(option, ec);
48482    if (ec)
48483    {
48484      // An error occurred.
48485    }
48486
48487
48488
48489
48490
48491
48492
48493 [endsect]
48494
48495
48496 [endsect]
48497
48498 [section:shutdown basic_stream_socket::shutdown]
48499
48500 [indexterm2 boost_asio.indexterm.basic_stream_socket.shutdown..shutdown..basic_stream_socket] 
48501 Disable sends or receives on the socket. 
48502
48503
48504   void ``[link boost_asio.reference.basic_stream_socket.shutdown.overload1 shutdown]``(
48505       shutdown_type what);
48506   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.shutdown.overload1 more...]]``
48507
48508   void ``[link boost_asio.reference.basic_stream_socket.shutdown.overload2 shutdown]``(
48509       shutdown_type what,
48510       boost::system::error_code & ec);
48511   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.shutdown.overload2 more...]]``
48512
48513
48514 [section:overload1 basic_stream_socket::shutdown (1 of 2 overloads)]
48515
48516
48517 ['Inherited from basic_socket.]
48518
48519
48520 Disable sends or receives on the socket. 
48521
48522
48523   void shutdown(
48524       shutdown_type what);
48525
48526
48527 This function is used to disable send operations, receive operations, or both.
48528
48529
48530 [heading Parameters]
48531     
48532
48533 [variablelist
48534   
48535 [[what][Determines what types of operation will no longer be allowed.]]
48536
48537 ]
48538
48539
48540 [heading Exceptions]
48541     
48542
48543 [variablelist
48544   
48545 [[boost::system::system_error][Thrown on failure.]]
48546
48547 ]
48548
48549
48550 [heading Example]
48551   
48552 Shutting down the send side of the socket: 
48553
48554    boost::asio::ip::tcp::socket socket(my_context);
48555    ...
48556    socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send);
48557
48558
48559
48560
48561
48562
48563
48564 [endsect]
48565
48566
48567
48568 [section:overload2 basic_stream_socket::shutdown (2 of 2 overloads)]
48569
48570
48571 ['Inherited from basic_socket.]
48572
48573
48574 Disable sends or receives on the socket. 
48575
48576
48577   void shutdown(
48578       shutdown_type what,
48579       boost::system::error_code & ec);
48580
48581
48582 This function is used to disable send operations, receive operations, or both.
48583
48584
48585 [heading Parameters]
48586     
48587
48588 [variablelist
48589   
48590 [[what][Determines what types of operation will no longer be allowed.]]
48591
48592 [[ec][Set to indicate what error occurred, if any.]]
48593
48594 ]
48595
48596
48597 [heading Example]
48598   
48599 Shutting down the send side of the socket: 
48600
48601    boost::asio::ip::tcp::socket socket(my_context);
48602    ...
48603    boost::system::error_code ec;
48604    socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send, ec);
48605    if (ec)
48606    {
48607      // An error occurred.
48608    }
48609
48610
48611
48612
48613
48614
48615
48616 [endsect]
48617
48618
48619 [endsect]
48620
48621
48622 [section:shutdown_type basic_stream_socket::shutdown_type]
48623
48624
48625 ['Inherited from socket_base.]
48626
48627 [indexterm2 boost_asio.indexterm.basic_stream_socket.shutdown_type..shutdown_type..basic_stream_socket] 
48628 Different ways a socket may be shutdown. 
48629
48630
48631   enum shutdown_type
48632
48633 [indexterm2 boost_asio.indexterm.basic_stream_socket.shutdown_type.shutdown_receive..shutdown_receive..basic_stream_socket]
48634 [indexterm2 boost_asio.indexterm.basic_stream_socket.shutdown_type.shutdown_send..shutdown_send..basic_stream_socket]
48635 [indexterm2 boost_asio.indexterm.basic_stream_socket.shutdown_type.shutdown_both..shutdown_both..basic_stream_socket]
48636
48637 [heading Values]
48638 [variablelist
48639
48640   [
48641     [shutdown_receive]
48642     [Shutdown the receive side of the socket. ]
48643   ]
48644
48645   [
48646     [shutdown_send]
48647     [Shutdown the send side of the socket. ]
48648   ]
48649
48650   [
48651     [shutdown_both]
48652     [Shutdown both send and receive on the socket. ]
48653   ]
48654
48655 ]
48656
48657
48658
48659 [endsect]
48660
48661
48662 [section:wait basic_stream_socket::wait]
48663
48664 [indexterm2 boost_asio.indexterm.basic_stream_socket.wait..wait..basic_stream_socket] 
48665 Wait for the socket to become ready to read, ready to write, or to have pending error conditions. 
48666
48667
48668   void ``[link boost_asio.reference.basic_stream_socket.wait.overload1 wait]``(
48669       wait_type w);
48670   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.wait.overload1 more...]]``
48671
48672   void ``[link boost_asio.reference.basic_stream_socket.wait.overload2 wait]``(
48673       wait_type w,
48674       boost::system::error_code & ec);
48675   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.wait.overload2 more...]]``
48676
48677
48678 [section:overload1 basic_stream_socket::wait (1 of 2 overloads)]
48679
48680
48681 ['Inherited from basic_socket.]
48682
48683
48684 Wait for the socket to become ready to read, ready to write, or to have pending error conditions. 
48685
48686
48687   void wait(
48688       wait_type w);
48689
48690
48691 This function is used to perform a blocking wait for a socket to enter a ready to read, write or error condition state.
48692
48693
48694 [heading Parameters]
48695     
48696
48697 [variablelist
48698   
48699 [[w][Specifies the desired socket state.]]
48700
48701 ]
48702
48703
48704 [heading Example]
48705   
48706 Waiting for a socket to become readable. 
48707
48708    boost::asio::ip::tcp::socket socket(my_context);
48709    ...
48710    socket.wait(boost::asio::ip::tcp::socket::wait_read);
48711
48712
48713
48714
48715
48716
48717
48718 [endsect]
48719
48720
48721
48722 [section:overload2 basic_stream_socket::wait (2 of 2 overloads)]
48723
48724
48725 ['Inherited from basic_socket.]
48726
48727
48728 Wait for the socket to become ready to read, ready to write, or to have pending error conditions. 
48729
48730
48731   void wait(
48732       wait_type w,
48733       boost::system::error_code & ec);
48734
48735
48736 This function is used to perform a blocking wait for a socket to enter a ready to read, write or error condition state.
48737
48738
48739 [heading Parameters]
48740     
48741
48742 [variablelist
48743   
48744 [[w][Specifies the desired socket state.]]
48745
48746 [[ec][Set to indicate what error occurred, if any.]]
48747
48748 ]
48749
48750
48751 [heading Example]
48752   
48753 Waiting for a socket to become readable. 
48754
48755    boost::asio::ip::tcp::socket socket(my_context);
48756    ...
48757    boost::system::error_code ec;
48758    socket.wait(boost::asio::ip::tcp::socket::wait_read, ec);
48759
48760
48761
48762
48763
48764
48765
48766 [endsect]
48767
48768
48769 [endsect]
48770
48771
48772 [section:wait_type basic_stream_socket::wait_type]
48773
48774
48775 ['Inherited from socket_base.]
48776
48777 [indexterm2 boost_asio.indexterm.basic_stream_socket.wait_type..wait_type..basic_stream_socket] 
48778 Wait types. 
48779
48780
48781   enum wait_type
48782
48783 [indexterm2 boost_asio.indexterm.basic_stream_socket.wait_type.wait_read..wait_read..basic_stream_socket]
48784 [indexterm2 boost_asio.indexterm.basic_stream_socket.wait_type.wait_write..wait_write..basic_stream_socket]
48785 [indexterm2 boost_asio.indexterm.basic_stream_socket.wait_type.wait_error..wait_error..basic_stream_socket]
48786
48787 [heading Values]
48788 [variablelist
48789
48790   [
48791     [wait_read]
48792     [Wait for a socket to become ready to read. ]
48793   ]
48794
48795   [
48796     [wait_write]
48797     [Wait for a socket to become ready to write. ]
48798   ]
48799
48800   [
48801     [wait_error]
48802     [Wait for a socket to have error conditions pending. ]
48803   ]
48804
48805 ]
48806
48807
48808 For use with `basic_socket::wait()` and `basic_socket::async_wait()`. 
48809
48810
48811 [endsect]
48812
48813
48814 [section:write_some basic_stream_socket::write_some]
48815
48816 [indexterm2 boost_asio.indexterm.basic_stream_socket.write_some..write_some..basic_stream_socket] 
48817 Write some data to the socket. 
48818
48819
48820   template<
48821       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
48822   std::size_t ``[link boost_asio.reference.basic_stream_socket.write_some.overload1 write_some]``(
48823       const ConstBufferSequence & buffers);
48824   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.write_some.overload1 more...]]``
48825
48826   template<
48827       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
48828   std::size_t ``[link boost_asio.reference.basic_stream_socket.write_some.overload2 write_some]``(
48829       const ConstBufferSequence & buffers,
48830       boost::system::error_code & ec);
48831   ``  [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.write_some.overload2 more...]]``
48832
48833
48834 [section:overload1 basic_stream_socket::write_some (1 of 2 overloads)]
48835
48836
48837 Write some data to the socket. 
48838
48839
48840   template<
48841       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
48842   std::size_t write_some(
48843       const ConstBufferSequence & buffers);
48844
48845
48846 This function is used to write data to the stream socket. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
48847
48848
48849 [heading Parameters]
48850     
48851
48852 [variablelist
48853   
48854 [[buffers][One or more data buffers to be written to the socket.]]
48855
48856 ]
48857
48858
48859 [heading Return Value]
48860       
48861 The number of bytes written.
48862
48863
48864 [heading Exceptions]
48865     
48866
48867 [variablelist
48868   
48869 [[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
48870
48871 ]
48872
48873
48874 [heading Remarks]
48875       
48876 The write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`]  function if you need to ensure that all data is written before the blocking operation completes.
48877
48878
48879 [heading Example]
48880   
48881 To write a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
48882
48883    socket.write_some(boost::asio::buffer(data, size));
48884
48885
48886 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
48887
48888
48889
48890
48891 [endsect]
48892
48893
48894
48895 [section:overload2 basic_stream_socket::write_some (2 of 2 overloads)]
48896
48897
48898 Write some data to the socket. 
48899
48900
48901   template<
48902       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
48903   std::size_t write_some(
48904       const ConstBufferSequence & buffers,
48905       boost::system::error_code & ec);
48906
48907
48908 This function is used to write data to the stream socket. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
48909
48910
48911 [heading Parameters]
48912     
48913
48914 [variablelist
48915   
48916 [[buffers][One or more data buffers to be written to the socket.]]
48917
48918 [[ec][Set to indicate what error occurred, if any.]]
48919
48920 ]
48921
48922
48923 [heading Return Value]
48924       
48925 The number of bytes written. Returns 0 if an error occurred.
48926
48927
48928 [heading Remarks]
48929       
48930 The write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`]  function if you need to ensure that all data is written before the blocking operation completes. 
48931
48932
48933
48934
48935 [endsect]
48936
48937
48938 [endsect]
48939
48940
48941 [section:_basic_stream_socket basic_stream_socket::~basic_stream_socket]
48942
48943 [indexterm2 boost_asio.indexterm.basic_stream_socket._basic_stream_socket..~basic_stream_socket..basic_stream_socket] 
48944 Destroys the socket. 
48945
48946
48947   ~basic_stream_socket();
48948
48949
48950 This function destroys the socket, cancelling any outstanding asynchronous operations associated with the socket as if by calling `cancel`. 
48951
48952
48953 [endsect]
48954
48955
48956
48957 [endsect]
48958
48959 [section:basic_stream_socket__rebind_executor basic_stream_socket::rebind_executor]
48960
48961
48962 Rebinds the socket type to another executor. 
48963
48964
48965   template<
48966       typename ``[link boost_asio.reference.Executor1 Executor1]``>
48967   struct rebind_executor
48968
48969
48970 [heading Types]
48971 [table
48972   [[Name][Description]]
48973
48974   [
48975
48976     [[link boost_asio.reference.basic_stream_socket__rebind_executor.other [*other]]]
48977     [The socket type when rebound to the specified executor. ]
48978   
48979   ]
48980
48981 ]
48982
48983 [heading Requirements]
48984
48985 ['Header: ][^boost/asio/basic_stream_socket.hpp]
48986
48987 ['Convenience header: ][^boost/asio.hpp]
48988
48989
48990 [section:other basic_stream_socket::rebind_executor::other]
48991
48992 [indexterm2 boost_asio.indexterm.basic_stream_socket__rebind_executor.other..other..basic_stream_socket::rebind_executor] 
48993 The socket type when rebound to the specified executor. 
48994
48995
48996   typedef basic_stream_socket< Protocol, Executor1 > other;
48997
48998
48999 [heading Types]
49000 [table
49001   [[Name][Description]]
49002
49003   [
49004
49005     [[link boost_asio.reference.basic_stream_socket__rebind_executor [*rebind_executor]]]
49006     [Rebinds the socket type to another executor. ]
49007   
49008   ]
49009
49010   [
49011
49012     [[link boost_asio.reference.basic_stream_socket.broadcast [*broadcast]]]
49013     [Socket option to permit sending of broadcast messages. ]
49014   
49015   ]
49016
49017   [
49018
49019     [[link boost_asio.reference.basic_stream_socket.bytes_readable [*bytes_readable]]]
49020     [IO control command to get the amount of data that can be read without blocking. ]
49021   
49022   ]
49023
49024   [
49025
49026     [[link boost_asio.reference.basic_stream_socket.debug [*debug]]]
49027     [Socket option to enable socket-level debugging. ]
49028   
49029   ]
49030
49031   [
49032
49033     [[link boost_asio.reference.basic_stream_socket.do_not_route [*do_not_route]]]
49034     [Socket option to prevent routing, use local interfaces only. ]
49035   
49036   ]
49037
49038   [
49039
49040     [[link boost_asio.reference.basic_stream_socket.enable_connection_aborted [*enable_connection_aborted]]]
49041     [Socket option to report aborted connections on accept. ]
49042   
49043   ]
49044
49045   [
49046
49047     [[link boost_asio.reference.basic_stream_socket.endpoint_type [*endpoint_type]]]
49048     [The endpoint type. ]
49049   
49050   ]
49051
49052   [
49053
49054     [[link boost_asio.reference.basic_stream_socket.executor_type [*executor_type]]]
49055     [The type of the executor associated with the object. ]
49056   
49057   ]
49058
49059   [
49060
49061     [[link boost_asio.reference.basic_stream_socket.keep_alive [*keep_alive]]]
49062     [Socket option to send keep-alives. ]
49063   
49064   ]
49065
49066   [
49067
49068     [[link boost_asio.reference.basic_stream_socket.linger [*linger]]]
49069     [Socket option to specify whether the socket lingers on close if unsent data is present. ]
49070   
49071   ]
49072
49073   [
49074
49075     [[link boost_asio.reference.basic_stream_socket.lowest_layer_type [*lowest_layer_type]]]
49076     [A basic_socket is always the lowest layer. ]
49077   
49078   ]
49079
49080   [
49081
49082     [[link boost_asio.reference.basic_stream_socket.message_flags [*message_flags]]]
49083     [Bitmask type for flags that can be passed to send and receive operations. ]
49084   
49085   ]
49086
49087   [
49088
49089     [[link boost_asio.reference.basic_stream_socket.native_handle_type [*native_handle_type]]]
49090     [The native representation of a socket. ]
49091   
49092   ]
49093
49094   [
49095
49096     [[link boost_asio.reference.basic_stream_socket.out_of_band_inline [*out_of_band_inline]]]
49097     [Socket option for putting received out-of-band data inline. ]
49098   
49099   ]
49100
49101   [
49102
49103     [[link boost_asio.reference.basic_stream_socket.protocol_type [*protocol_type]]]
49104     [The protocol type. ]
49105   
49106   ]
49107
49108   [
49109
49110     [[link boost_asio.reference.basic_stream_socket.receive_buffer_size [*receive_buffer_size]]]
49111     [Socket option for the receive buffer size of a socket. ]
49112   
49113   ]
49114
49115   [
49116
49117     [[link boost_asio.reference.basic_stream_socket.receive_low_watermark [*receive_low_watermark]]]
49118     [Socket option for the receive low watermark. ]
49119   
49120   ]
49121
49122   [
49123
49124     [[link boost_asio.reference.basic_stream_socket.reuse_address [*reuse_address]]]
49125     [Socket option to allow the socket to be bound to an address that is already in use. ]
49126   
49127   ]
49128
49129   [
49130
49131     [[link boost_asio.reference.basic_stream_socket.send_buffer_size [*send_buffer_size]]]
49132     [Socket option for the send buffer size of a socket. ]
49133   
49134   ]
49135
49136   [
49137
49138     [[link boost_asio.reference.basic_stream_socket.send_low_watermark [*send_low_watermark]]]
49139     [Socket option for the send low watermark. ]
49140   
49141   ]
49142
49143   [
49144
49145     [[link boost_asio.reference.basic_stream_socket.shutdown_type [*shutdown_type]]]
49146     [Different ways a socket may be shutdown. ]
49147   
49148   ]
49149
49150   [
49151
49152     [[link boost_asio.reference.basic_stream_socket.wait_type [*wait_type]]]
49153     [Wait types. ]
49154   
49155   ]
49156
49157 ]
49158
49159 [heading Member Functions]
49160 [table
49161   [[Name][Description]]
49162
49163   [
49164     [[link boost_asio.reference.basic_stream_socket.assign [*assign]]]
49165     [Assign an existing native socket to the socket. ]
49166   ]
49167   
49168   [
49169     [[link boost_asio.reference.basic_stream_socket.async_connect [*async_connect]]]
49170     [Start an asynchronous connect. ]
49171   ]
49172   
49173   [
49174     [[link boost_asio.reference.basic_stream_socket.async_read_some [*async_read_some]]]
49175     [Start an asynchronous read. ]
49176   ]
49177   
49178   [
49179     [[link boost_asio.reference.basic_stream_socket.async_receive [*async_receive]]]
49180     [Start an asynchronous receive. ]
49181   ]
49182   
49183   [
49184     [[link boost_asio.reference.basic_stream_socket.async_send [*async_send]]]
49185     [Start an asynchronous send. ]
49186   ]
49187   
49188   [
49189     [[link boost_asio.reference.basic_stream_socket.async_wait [*async_wait]]]
49190     [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
49191   ]
49192   
49193   [
49194     [[link boost_asio.reference.basic_stream_socket.async_write_some [*async_write_some]]]
49195     [Start an asynchronous write. ]
49196   ]
49197   
49198   [
49199     [[link boost_asio.reference.basic_stream_socket.at_mark [*at_mark]]]
49200     [Determine whether the socket is at the out-of-band data mark. ]
49201   ]
49202   
49203   [
49204     [[link boost_asio.reference.basic_stream_socket.available [*available]]]
49205     [Determine the number of bytes available for reading. ]
49206   ]
49207   
49208   [
49209     [[link boost_asio.reference.basic_stream_socket.basic_stream_socket [*basic_stream_socket]]]
49210     [Construct a basic_stream_socket without opening it. 
49211      [hr]
49212      Construct and open a basic_stream_socket. 
49213      [hr]
49214      Construct a basic_stream_socket, opening it and binding it to the given local endpoint. 
49215      [hr]
49216      Construct a basic_stream_socket on an existing native socket. 
49217      [hr]
49218      Move-construct a basic_stream_socket from another. 
49219      [hr]
49220      Move-construct a basic_stream_socket from a socket of another protocol type. ]
49221   ]
49222   
49223   [
49224     [[link boost_asio.reference.basic_stream_socket.bind [*bind]]]
49225     [Bind the socket to the given local endpoint. ]
49226   ]
49227   
49228   [
49229     [[link boost_asio.reference.basic_stream_socket.cancel [*cancel]]]
49230     [Cancel all asynchronous operations associated with the socket. ]
49231   ]
49232   
49233   [
49234     [[link boost_asio.reference.basic_stream_socket.close [*close]]]
49235     [Close the socket. ]
49236   ]
49237   
49238   [
49239     [[link boost_asio.reference.basic_stream_socket.connect [*connect]]]
49240     [Connect the socket to the specified endpoint. ]
49241   ]
49242   
49243   [
49244     [[link boost_asio.reference.basic_stream_socket.get_executor [*get_executor]]]
49245     [Get the executor associated with the object. ]
49246   ]
49247   
49248   [
49249     [[link boost_asio.reference.basic_stream_socket.get_option [*get_option]]]
49250     [Get an option from the socket. ]
49251   ]
49252   
49253   [
49254     [[link boost_asio.reference.basic_stream_socket.io_control [*io_control]]]
49255     [Perform an IO control command on the socket. ]
49256   ]
49257   
49258   [
49259     [[link boost_asio.reference.basic_stream_socket.is_open [*is_open]]]
49260     [Determine whether the socket is open. ]
49261   ]
49262   
49263   [
49264     [[link boost_asio.reference.basic_stream_socket.local_endpoint [*local_endpoint]]]
49265     [Get the local endpoint of the socket. ]
49266   ]
49267   
49268   [
49269     [[link boost_asio.reference.basic_stream_socket.lowest_layer [*lowest_layer]]]
49270     [Get a reference to the lowest layer. 
49271      [hr]
49272      Get a const reference to the lowest layer. ]
49273   ]
49274   
49275   [
49276     [[link boost_asio.reference.basic_stream_socket.native_handle [*native_handle]]]
49277     [Get the native socket representation. ]
49278   ]
49279   
49280   [
49281     [[link boost_asio.reference.basic_stream_socket.native_non_blocking [*native_non_blocking]]]
49282     [Gets the non-blocking mode of the native socket implementation. 
49283      [hr]
49284      Sets the non-blocking mode of the native socket implementation. ]
49285   ]
49286   
49287   [
49288     [[link boost_asio.reference.basic_stream_socket.non_blocking [*non_blocking]]]
49289     [Gets the non-blocking mode of the socket. 
49290      [hr]
49291      Sets the non-blocking mode of the socket. ]
49292   ]
49293   
49294   [
49295     [[link boost_asio.reference.basic_stream_socket.open [*open]]]
49296     [Open the socket using the specified protocol. ]
49297   ]
49298   
49299   [
49300     [[link boost_asio.reference.basic_stream_socket.operator_eq_ [*operator=]]]
49301     [Move-assign a basic_stream_socket from another. 
49302      [hr]
49303      Move-assign a basic_stream_socket from a socket of another protocol type. ]
49304   ]
49305   
49306   [
49307     [[link boost_asio.reference.basic_stream_socket.read_some [*read_some]]]
49308     [Read some data from the socket. ]
49309   ]
49310   
49311   [
49312     [[link boost_asio.reference.basic_stream_socket.receive [*receive]]]
49313     [Receive some data on the socket. 
49314      [hr]
49315      Receive some data on a connected socket. ]
49316   ]
49317   
49318   [
49319     [[link boost_asio.reference.basic_stream_socket.release [*release]]]
49320     [Release ownership of the underlying native socket. ]
49321   ]
49322   
49323   [
49324     [[link boost_asio.reference.basic_stream_socket.remote_endpoint [*remote_endpoint]]]
49325     [Get the remote endpoint of the socket. ]
49326   ]
49327   
49328   [
49329     [[link boost_asio.reference.basic_stream_socket.send [*send]]]
49330     [Send some data on the socket. ]
49331   ]
49332   
49333   [
49334     [[link boost_asio.reference.basic_stream_socket.set_option [*set_option]]]
49335     [Set an option on the socket. ]
49336   ]
49337   
49338   [
49339     [[link boost_asio.reference.basic_stream_socket.shutdown [*shutdown]]]
49340     [Disable sends or receives on the socket. ]
49341   ]
49342   
49343   [
49344     [[link boost_asio.reference.basic_stream_socket.wait [*wait]]]
49345     [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
49346   ]
49347   
49348   [
49349     [[link boost_asio.reference.basic_stream_socket.write_some [*write_some]]]
49350     [Write some data to the socket. ]
49351   ]
49352   
49353   [
49354     [[link boost_asio.reference.basic_stream_socket._basic_stream_socket [*~basic_stream_socket]]]
49355     [Destroys the socket. ]
49356   ]
49357   
49358 ]
49359
49360 [heading Data Members]
49361 [table
49362   [[Name][Description]]
49363
49364   [
49365     [[link boost_asio.reference.basic_stream_socket.max_connections [*max_connections]]]
49366     [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
49367   ]
49368
49369   [
49370     [[link boost_asio.reference.basic_stream_socket.max_listen_connections [*max_listen_connections]]]
49371     [The maximum length of the queue of pending incoming connections. ]
49372   ]
49373
49374   [
49375     [[link boost_asio.reference.basic_stream_socket.message_do_not_route [*message_do_not_route]]]
49376     [Specify that the data should not be subject to routing. ]
49377   ]
49378
49379   [
49380     [[link boost_asio.reference.basic_stream_socket.message_end_of_record [*message_end_of_record]]]
49381     [Specifies that the data marks the end of a record. ]
49382   ]
49383
49384   [
49385     [[link boost_asio.reference.basic_stream_socket.message_out_of_band [*message_out_of_band]]]
49386     [Process out-of-band data. ]
49387   ]
49388
49389   [
49390     [[link boost_asio.reference.basic_stream_socket.message_peek [*message_peek]]]
49391     [Peek at incoming data without removing it from the input queue. ]
49392   ]
49393
49394 ]
49395
49396 [heading Protected Data Members]
49397 [table
49398   [[Name][Description]]
49399
49400   [
49401     [[link boost_asio.reference.basic_stream_socket.impl_ [*impl_]]]
49402     []
49403   ]
49404
49405 ]
49406
49407 The [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] class template provides asynchronous and blocking stream-oriented socket functionality.
49408
49409
49410 [heading Thread Safety]
49411   
49412 ['Distinct] ['objects:] Safe.
49413
49414 ['Shared] ['objects:] Unsafe.
49415
49416
49417
49418
49419
49420 [heading Requirements]
49421
49422 ['Header: ][^boost/asio/basic_stream_socket.hpp]
49423
49424 ['Convenience header: ][^boost/asio.hpp]
49425
49426
49427 [endsect]
49428
49429
49430
49431 [endsect]
49432
49433 [section:basic_streambuf basic_streambuf]
49434
49435
49436 Automatically resizable buffer class based on std::streambuf. 
49437
49438
49439   template<
49440       typename Allocator = std::allocator<char>>
49441   class basic_streambuf :
49442     noncopyable
49443
49444
49445 [heading Types]
49446 [table
49447   [[Name][Description]]
49448
49449   [
49450
49451     [[link boost_asio.reference.basic_streambuf.const_buffers_type [*const_buffers_type]]]
49452     [The type used to represent the input sequence as a list of buffers. ]
49453   
49454   ]
49455
49456   [
49457
49458     [[link boost_asio.reference.basic_streambuf.mutable_buffers_type [*mutable_buffers_type]]]
49459     [The type used to represent the output sequence as a list of buffers. ]
49460   
49461   ]
49462
49463 ]
49464
49465 [heading Member Functions]
49466 [table
49467   [[Name][Description]]
49468
49469   [
49470     [[link boost_asio.reference.basic_streambuf.basic_streambuf [*basic_streambuf]]]
49471     [Construct a basic_streambuf object. ]
49472   ]
49473   
49474   [
49475     [[link boost_asio.reference.basic_streambuf.capacity [*capacity]]]
49476     [Get the current capacity of the basic_streambuf. ]
49477   ]
49478   
49479   [
49480     [[link boost_asio.reference.basic_streambuf.commit [*commit]]]
49481     [Move characters from the output sequence to the input sequence. ]
49482   ]
49483   
49484   [
49485     [[link boost_asio.reference.basic_streambuf.consume [*consume]]]
49486     [Remove characters from the input sequence. ]
49487   ]
49488   
49489   [
49490     [[link boost_asio.reference.basic_streambuf.data [*data]]]
49491     [Get a list of buffers that represents the input sequence. ]
49492   ]
49493   
49494   [
49495     [[link boost_asio.reference.basic_streambuf.max_size [*max_size]]]
49496     [Get the maximum size of the basic_streambuf. ]
49497   ]
49498   
49499   [
49500     [[link boost_asio.reference.basic_streambuf.prepare [*prepare]]]
49501     [Get a list of buffers that represents the output sequence, with the given size. ]
49502   ]
49503   
49504   [
49505     [[link boost_asio.reference.basic_streambuf.size [*size]]]
49506     [Get the size of the input sequence. ]
49507   ]
49508   
49509 ]
49510
49511 [heading Protected Member Functions]
49512 [table
49513   [[Name][Description]]
49514
49515   [
49516     [[link boost_asio.reference.basic_streambuf.overflow [*overflow]]]
49517     [Override std::streambuf behaviour. ]
49518   ]
49519   
49520   [
49521     [[link boost_asio.reference.basic_streambuf.reserve [*reserve]]]
49522     []
49523   ]
49524   
49525   [
49526     [[link boost_asio.reference.basic_streambuf.underflow [*underflow]]]
49527     [Override std::streambuf behaviour. ]
49528   ]
49529   
49530 ]
49531
49532 The `basic_streambuf` class is derived from `std::streambuf` to associate the streambuf's input and output sequences with one or more character arrays. These character arrays are internal to the `basic_streambuf` object, but direct access to the array elements is provided to permit them to be used efficiently with I/O operations. Characters written to the output sequence of a `basic_streambuf` object are appended to the input sequence of the same object.
49533
49534 The `basic_streambuf` class's public interface is intended to permit the following implementation strategies:
49535
49536
49537 * A single contiguous character array, which is reallocated as necessary to accommodate changes in the size of the character sequence. This is the implementation approach currently used in Asio.
49538
49539
49540 * A sequence of one or more character arrays, where each array is of the same size. Additional character array objects are appended to the sequence to accommodate changes in the size of the character sequence.
49541
49542
49543 * A sequence of one or more character arrays of varying sizes. Additional character array objects are appended to the sequence to accommodate changes in the size of the character sequence.
49544
49545 The constructor for [link boost_asio.reference.basic_streambuf `basic_streambuf`] accepts a `size_t` argument specifying the maximum of the sum of the sizes of the input sequence and output sequence. During the lifetime of the `basic_streambuf` object, the following invariant holds: 
49546
49547    size() <= max_size()
49548
49549
49550 Any member function that would, if successful, cause the invariant to be violated shall throw an exception of class `std::length_error`.
49551
49552 The constructor for `basic_streambuf` takes an Allocator argument. A copy of this argument is used for any memory allocation performed, by the constructor and by all member functions, during the lifetime of each `basic_streambuf` object.
49553
49554
49555 [heading Examples]
49556   
49557 Writing directly from an streambuf to a socket: 
49558
49559    boost::asio::streambuf b;
49560    std::ostream os(&b);
49561    os << "Hello, World!\n";
49562
49563    // try sending some data in input sequence
49564    size_t n = sock.send(b.data());
49565
49566    b.consume(n); // sent data is removed from input sequence
49567
49568
49569
49570
49571 Reading from a socket directly into a streambuf: 
49572
49573    boost::asio::streambuf b;
49574
49575    // reserve 512 bytes in output sequence
49576    boost::asio::streambuf::mutable_buffers_type bufs = b.prepare(512);
49577
49578    size_t n = sock.receive(bufs);
49579
49580    // received data is "committed" from output sequence to input sequence
49581    b.commit(n);
49582
49583    std::istream is(&b);
49584    std::string s;
49585    is >> s;
49586
49587
49588
49589
49590 [heading Requirements]
49591
49592 ['Header: ][^boost/asio/basic_streambuf.hpp]
49593
49594 ['Convenience header: ][^boost/asio.hpp]
49595
49596
49597 [section:basic_streambuf basic_streambuf::basic_streambuf]
49598
49599 [indexterm2 boost_asio.indexterm.basic_streambuf.basic_streambuf..basic_streambuf..basic_streambuf] 
49600 Construct a [link boost_asio.reference.basic_streambuf `basic_streambuf`] object. 
49601
49602
49603   basic_streambuf(
49604       std::size_t maximum_size = (std::numeric_limits< std::size_t >::max)(),
49605       const Allocator & allocator = Allocator());
49606
49607
49608 Constructs a streambuf with the specified maximum size. The initial size of the streambuf's input sequence is 0. 
49609
49610
49611 [endsect]
49612
49613
49614
49615 [section:capacity basic_streambuf::capacity]
49616
49617 [indexterm2 boost_asio.indexterm.basic_streambuf.capacity..capacity..basic_streambuf] 
49618 Get the current capacity of the [link boost_asio.reference.basic_streambuf `basic_streambuf`]. 
49619
49620
49621   std::size_t capacity() const;
49622
49623
49624
49625 [heading Return Value]
49626       
49627 The current total capacity of the streambuf, i.e. for both the input sequence and output sequence. 
49628
49629
49630
49631
49632 [endsect]
49633
49634
49635
49636 [section:commit basic_streambuf::commit]
49637
49638 [indexterm2 boost_asio.indexterm.basic_streambuf.commit..commit..basic_streambuf] 
49639 Move characters from the output sequence to the input sequence. 
49640
49641
49642   void commit(
49643       std::size_t n);
49644
49645
49646 Appends `n` characters from the start of the output sequence to the input sequence. The beginning of the output sequence is advanced by `n` characters.
49647
49648 Requires a preceding call `prepare(x)` where `x >= n`, and no intervening operations that modify the input or output sequence.
49649
49650
49651 [heading Remarks]
49652       
49653 If `n` is greater than the size of the output sequence, the entire output sequence is moved to the input sequence and no error is issued. 
49654
49655
49656
49657
49658 [endsect]
49659
49660
49661
49662 [section:const_buffers_type basic_streambuf::const_buffers_type]
49663
49664 [indexterm2 boost_asio.indexterm.basic_streambuf.const_buffers_type..const_buffers_type..basic_streambuf] 
49665 The type used to represent the input sequence as a list of buffers. 
49666
49667
49668   typedef implementation_defined const_buffers_type;
49669
49670
49671
49672 [heading Requirements]
49673
49674 ['Header: ][^boost/asio/basic_streambuf.hpp]
49675
49676 ['Convenience header: ][^boost/asio.hpp]
49677
49678
49679 [endsect]
49680
49681
49682
49683 [section:consume basic_streambuf::consume]
49684
49685 [indexterm2 boost_asio.indexterm.basic_streambuf.consume..consume..basic_streambuf] 
49686 Remove characters from the input sequence. 
49687
49688
49689   void consume(
49690       std::size_t n);
49691
49692
49693 Removes `n` characters from the beginning of the input sequence.
49694
49695
49696 [heading Remarks]
49697       
49698 If `n` is greater than the size of the input sequence, the entire input sequence is consumed and no error is issued. 
49699
49700
49701
49702
49703 [endsect]
49704
49705
49706
49707 [section:data basic_streambuf::data]
49708
49709 [indexterm2 boost_asio.indexterm.basic_streambuf.data..data..basic_streambuf] 
49710 Get a list of buffers that represents the input sequence. 
49711
49712
49713   const_buffers_type data() const;
49714
49715
49716
49717 [heading Return Value]
49718       
49719 An object of type `const_buffers_type` that satisfies ConstBufferSequence requirements, representing all character arrays in the input sequence.
49720
49721
49722 [heading Remarks]
49723       
49724 The returned object is invalidated by any `basic_streambuf` member function that modifies the input sequence or output sequence. 
49725
49726
49727
49728
49729 [endsect]
49730
49731
49732
49733 [section:max_size basic_streambuf::max_size]
49734
49735 [indexterm2 boost_asio.indexterm.basic_streambuf.max_size..max_size..basic_streambuf] 
49736 Get the maximum size of the [link boost_asio.reference.basic_streambuf `basic_streambuf`]. 
49737
49738
49739   std::size_t max_size() const;
49740
49741
49742
49743 [heading Return Value]
49744       
49745 The allowed maximum of the sum of the sizes of the input sequence and output sequence. 
49746
49747
49748
49749
49750 [endsect]
49751
49752
49753
49754 [section:mutable_buffers_type basic_streambuf::mutable_buffers_type]
49755
49756 [indexterm2 boost_asio.indexterm.basic_streambuf.mutable_buffers_type..mutable_buffers_type..basic_streambuf] 
49757 The type used to represent the output sequence as a list of buffers. 
49758
49759
49760   typedef implementation_defined mutable_buffers_type;
49761
49762
49763
49764 [heading Requirements]
49765
49766 ['Header: ][^boost/asio/basic_streambuf.hpp]
49767
49768 ['Convenience header: ][^boost/asio.hpp]
49769
49770
49771 [endsect]
49772
49773
49774
49775 [section:overflow basic_streambuf::overflow]
49776
49777 [indexterm2 boost_asio.indexterm.basic_streambuf.overflow..overflow..basic_streambuf] 
49778 Override std::streambuf behaviour. 
49779
49780
49781   int_type overflow(
49782       int_type c);
49783
49784
49785 Behaves according to the specification of `std::streambuf::overflow()`, with the specialisation that `std::length_error` is thrown if appending the character to the input sequence would require the condition `size() > max_size()` to be true. 
49786
49787
49788 [endsect]
49789
49790
49791
49792 [section:prepare basic_streambuf::prepare]
49793
49794 [indexterm2 boost_asio.indexterm.basic_streambuf.prepare..prepare..basic_streambuf] 
49795 Get a list of buffers that represents the output sequence, with the given size. 
49796
49797
49798   mutable_buffers_type prepare(
49799       std::size_t n);
49800
49801
49802 Ensures that the output sequence can accommodate `n` characters, reallocating character array objects as necessary.
49803
49804
49805 [heading Return Value]
49806       
49807 An object of type `mutable_buffers_type` that satisfies MutableBufferSequence requirements, representing character array objects at the start of the output sequence such that the sum of the buffer sizes is `n`.
49808
49809
49810 [heading Exceptions]
49811     
49812
49813 [variablelist
49814   
49815 [[std::length_error][If `size() + n > max_size()`.]]
49816
49817 ]
49818
49819
49820 [heading Remarks]
49821       
49822 The returned object is invalidated by any `basic_streambuf` member function that modifies the input sequence or output sequence. 
49823
49824
49825
49826
49827 [endsect]
49828
49829
49830
49831 [section:reserve basic_streambuf::reserve]
49832
49833 [indexterm2 boost_asio.indexterm.basic_streambuf.reserve..reserve..basic_streambuf] 
49834
49835   void reserve(
49836       std::size_t n);
49837
49838
49839
49840 [endsect]
49841
49842
49843
49844 [section:size basic_streambuf::size]
49845
49846 [indexterm2 boost_asio.indexterm.basic_streambuf.size..size..basic_streambuf] 
49847 Get the size of the input sequence. 
49848
49849
49850   std::size_t size() const;
49851
49852
49853
49854 [heading Return Value]
49855       
49856 The size of the input sequence. The value is equal to that calculated for `s` in the following code: 
49857
49858    size_t s = 0;
49859    const_buffers_type bufs = data();
49860    const_buffers_type::const_iterator i = bufs.begin();
49861    while (i != bufs.end())
49862    {
49863      const_buffer buf(*i++);
49864      s += buf.size();
49865    }
49866
49867
49868
49869
49870
49871
49872
49873 [endsect]
49874
49875
49876
49877 [section:underflow basic_streambuf::underflow]
49878
49879 [indexterm2 boost_asio.indexterm.basic_streambuf.underflow..underflow..basic_streambuf] 
49880 Override std::streambuf behaviour. 
49881
49882
49883   int_type underflow();
49884
49885
49886 Behaves according to the specification of `std::streambuf::underflow()`. 
49887
49888
49889 [endsect]
49890
49891
49892
49893 [endsect]
49894
49895 [section:basic_streambuf_ref basic_streambuf_ref]
49896
49897
49898 Adapts [link boost_asio.reference.basic_streambuf `basic_streambuf`] to the dynamic buffer sequence type requirements. 
49899
49900
49901   template<
49902       typename Allocator = std::allocator<char>>
49903   class basic_streambuf_ref
49904
49905
49906 [heading Types]
49907 [table
49908   [[Name][Description]]
49909
49910   [
49911
49912     [[link boost_asio.reference.basic_streambuf_ref.const_buffers_type [*const_buffers_type]]]
49913     [The type used to represent the input sequence as a list of buffers. ]
49914   
49915   ]
49916
49917   [
49918
49919     [[link boost_asio.reference.basic_streambuf_ref.mutable_buffers_type [*mutable_buffers_type]]]
49920     [The type used to represent the output sequence as a list of buffers. ]
49921   
49922   ]
49923
49924 ]
49925
49926 [heading Member Functions]
49927 [table
49928   [[Name][Description]]
49929
49930   [
49931     [[link boost_asio.reference.basic_streambuf_ref.basic_streambuf_ref [*basic_streambuf_ref]]]
49932     [Construct a basic_streambuf_ref for the given basic_streambuf object. 
49933      [hr]
49934      Copy construct a basic_streambuf_ref. 
49935      [hr]
49936      Move construct a basic_streambuf_ref. ]
49937   ]
49938   
49939   [
49940     [[link boost_asio.reference.basic_streambuf_ref.capacity [*capacity]]]
49941     [Get the current capacity of the dynamic buffer. ]
49942   ]
49943   
49944   [
49945     [[link boost_asio.reference.basic_streambuf_ref.commit [*commit]]]
49946     [Move bytes from the output sequence to the input sequence. ]
49947   ]
49948   
49949   [
49950     [[link boost_asio.reference.basic_streambuf_ref.consume [*consume]]]
49951     [Remove characters from the input sequence. ]
49952   ]
49953   
49954   [
49955     [[link boost_asio.reference.basic_streambuf_ref.data [*data]]]
49956     [Get a list of buffers that represents the input sequence. ]
49957   ]
49958   
49959   [
49960     [[link boost_asio.reference.basic_streambuf_ref.max_size [*max_size]]]
49961     [Get the maximum size of the dynamic buffer. ]
49962   ]
49963   
49964   [
49965     [[link boost_asio.reference.basic_streambuf_ref.prepare [*prepare]]]
49966     [Get a list of buffers that represents the output sequence, with the given size. ]
49967   ]
49968   
49969   [
49970     [[link boost_asio.reference.basic_streambuf_ref.size [*size]]]
49971     [Get the size of the input sequence. ]
49972   ]
49973   
49974 ]
49975
49976 [heading Requirements]
49977
49978 ['Header: ][^boost/asio/basic_streambuf.hpp]
49979
49980 ['Convenience header: ][^boost/asio.hpp]
49981
49982 [section:basic_streambuf_ref basic_streambuf_ref::basic_streambuf_ref]
49983
49984 [indexterm2 boost_asio.indexterm.basic_streambuf_ref.basic_streambuf_ref..basic_streambuf_ref..basic_streambuf_ref] 
49985 Construct a [link boost_asio.reference.basic_streambuf_ref `basic_streambuf_ref`] for the given [link boost_asio.reference.basic_streambuf `basic_streambuf`] object. 
49986
49987
49988   explicit ``[link boost_asio.reference.basic_streambuf_ref.basic_streambuf_ref.overload1 basic_streambuf_ref]``(
49989       basic_streambuf< Allocator > & sb);
49990   ``  [''''&raquo;''' [link boost_asio.reference.basic_streambuf_ref.basic_streambuf_ref.overload1 more...]]``
49991
49992
49993 Copy construct a [link boost_asio.reference.basic_streambuf_ref `basic_streambuf_ref`]. 
49994
49995
49996   ``[link boost_asio.reference.basic_streambuf_ref.basic_streambuf_ref.overload2 basic_streambuf_ref]``(
49997       const basic_streambuf_ref & other);
49998   ``  [''''&raquo;''' [link boost_asio.reference.basic_streambuf_ref.basic_streambuf_ref.overload2 more...]]``
49999
50000
50001 Move construct a [link boost_asio.reference.basic_streambuf_ref `basic_streambuf_ref`]. 
50002
50003
50004   ``[link boost_asio.reference.basic_streambuf_ref.basic_streambuf_ref.overload3 basic_streambuf_ref]``(
50005       basic_streambuf_ref && other);
50006   ``  [''''&raquo;''' [link boost_asio.reference.basic_streambuf_ref.basic_streambuf_ref.overload3 more...]]``
50007
50008
50009 [section:overload1 basic_streambuf_ref::basic_streambuf_ref (1 of 3 overloads)]
50010
50011
50012 Construct a [link boost_asio.reference.basic_streambuf_ref `basic_streambuf_ref`] for the given [link boost_asio.reference.basic_streambuf `basic_streambuf`] object. 
50013
50014
50015   basic_streambuf_ref(
50016       basic_streambuf< Allocator > & sb);
50017
50018
50019
50020 [endsect]
50021
50022
50023
50024 [section:overload2 basic_streambuf_ref::basic_streambuf_ref (2 of 3 overloads)]
50025
50026
50027 Copy construct a [link boost_asio.reference.basic_streambuf_ref `basic_streambuf_ref`]. 
50028
50029
50030   basic_streambuf_ref(
50031       const basic_streambuf_ref & other);
50032
50033
50034
50035 [endsect]
50036
50037
50038
50039 [section:overload3 basic_streambuf_ref::basic_streambuf_ref (3 of 3 overloads)]
50040
50041
50042 Move construct a [link boost_asio.reference.basic_streambuf_ref `basic_streambuf_ref`]. 
50043
50044
50045   basic_streambuf_ref(
50046       basic_streambuf_ref && other);
50047
50048
50049
50050 [endsect]
50051
50052
50053 [endsect]
50054
50055
50056 [section:capacity basic_streambuf_ref::capacity]
50057
50058 [indexterm2 boost_asio.indexterm.basic_streambuf_ref.capacity..capacity..basic_streambuf_ref] 
50059 Get the current capacity of the dynamic buffer. 
50060
50061
50062   std::size_t capacity() const;
50063
50064
50065
50066 [endsect]
50067
50068
50069
50070 [section:commit basic_streambuf_ref::commit]
50071
50072 [indexterm2 boost_asio.indexterm.basic_streambuf_ref.commit..commit..basic_streambuf_ref] 
50073 Move bytes from the output sequence to the input sequence. 
50074
50075
50076   void commit(
50077       std::size_t n);
50078
50079
50080
50081 [endsect]
50082
50083
50084
50085 [section:const_buffers_type basic_streambuf_ref::const_buffers_type]
50086
50087 [indexterm2 boost_asio.indexterm.basic_streambuf_ref.const_buffers_type..const_buffers_type..basic_streambuf_ref] 
50088 The type used to represent the input sequence as a list of buffers. 
50089
50090
50091   typedef basic_streambuf< Allocator >::const_buffers_type const_buffers_type;
50092
50093
50094 [heading Types]
50095 [table
50096   [[Name][Description]]
50097
50098   [
50099
50100     [[link boost_asio.reference.basic_streambuf.const_buffers_type [*const_buffers_type]]]
50101     [The type used to represent the input sequence as a list of buffers. ]
50102   
50103   ]
50104
50105   [
50106
50107     [[link boost_asio.reference.basic_streambuf.mutable_buffers_type [*mutable_buffers_type]]]
50108     [The type used to represent the output sequence as a list of buffers. ]
50109   
50110   ]
50111
50112 ]
50113
50114 [heading Member Functions]
50115 [table
50116   [[Name][Description]]
50117
50118   [
50119     [[link boost_asio.reference.basic_streambuf.basic_streambuf [*basic_streambuf]]]
50120     [Construct a basic_streambuf object. ]
50121   ]
50122   
50123   [
50124     [[link boost_asio.reference.basic_streambuf.capacity [*capacity]]]
50125     [Get the current capacity of the basic_streambuf. ]
50126   ]
50127   
50128   [
50129     [[link boost_asio.reference.basic_streambuf.commit [*commit]]]
50130     [Move characters from the output sequence to the input sequence. ]
50131   ]
50132   
50133   [
50134     [[link boost_asio.reference.basic_streambuf.consume [*consume]]]
50135     [Remove characters from the input sequence. ]
50136   ]
50137   
50138   [
50139     [[link boost_asio.reference.basic_streambuf.data [*data]]]
50140     [Get a list of buffers that represents the input sequence. ]
50141   ]
50142   
50143   [
50144     [[link boost_asio.reference.basic_streambuf.max_size [*max_size]]]
50145     [Get the maximum size of the basic_streambuf. ]
50146   ]
50147   
50148   [
50149     [[link boost_asio.reference.basic_streambuf.prepare [*prepare]]]
50150     [Get a list of buffers that represents the output sequence, with the given size. ]
50151   ]
50152   
50153   [
50154     [[link boost_asio.reference.basic_streambuf.size [*size]]]
50155     [Get the size of the input sequence. ]
50156   ]
50157   
50158 ]
50159
50160 [heading Protected Member Functions]
50161 [table
50162   [[Name][Description]]
50163
50164   [
50165     [[link boost_asio.reference.basic_streambuf.overflow [*overflow]]]
50166     [Override std::streambuf behaviour. ]
50167   ]
50168   
50169   [
50170     [[link boost_asio.reference.basic_streambuf.reserve [*reserve]]]
50171     []
50172   ]
50173   
50174   [
50175     [[link boost_asio.reference.basic_streambuf.underflow [*underflow]]]
50176     [Override std::streambuf behaviour. ]
50177   ]
50178   
50179 ]
50180
50181 The `basic_streambuf` class is derived from `std::streambuf` to associate the streambuf's input and output sequences with one or more character arrays. These character arrays are internal to the `basic_streambuf` object, but direct access to the array elements is provided to permit them to be used efficiently with I/O operations. Characters written to the output sequence of a `basic_streambuf` object are appended to the input sequence of the same object.
50182
50183 The `basic_streambuf` class's public interface is intended to permit the following implementation strategies:
50184
50185
50186 * A single contiguous character array, which is reallocated as necessary to accommodate changes in the size of the character sequence. This is the implementation approach currently used in Asio.
50187
50188
50189 * A sequence of one or more character arrays, where each array is of the same size. Additional character array objects are appended to the sequence to accommodate changes in the size of the character sequence.
50190
50191
50192 * A sequence of one or more character arrays of varying sizes. Additional character array objects are appended to the sequence to accommodate changes in the size of the character sequence.
50193
50194 The constructor for [link boost_asio.reference.basic_streambuf `basic_streambuf`] accepts a `size_t` argument specifying the maximum of the sum of the sizes of the input sequence and output sequence. During the lifetime of the `basic_streambuf` object, the following invariant holds: 
50195
50196    size() <= max_size()
50197
50198
50199 Any member function that would, if successful, cause the invariant to be violated shall throw an exception of class `std::length_error`.
50200
50201 The constructor for `basic_streambuf` takes an Allocator argument. A copy of this argument is used for any memory allocation performed, by the constructor and by all member functions, during the lifetime of each `basic_streambuf` object.
50202
50203
50204 [heading Examples]
50205   
50206 Writing directly from an streambuf to a socket: 
50207
50208    boost::asio::streambuf b;
50209    std::ostream os(&b);
50210    os << "Hello, World!\n";
50211
50212    // try sending some data in input sequence
50213    size_t n = sock.send(b.data());
50214
50215    b.consume(n); // sent data is removed from input sequence
50216
50217
50218
50219
50220 Reading from a socket directly into a streambuf: 
50221
50222    boost::asio::streambuf b;
50223
50224    // reserve 512 bytes in output sequence
50225    boost::asio::streambuf::mutable_buffers_type bufs = b.prepare(512);
50226
50227    size_t n = sock.receive(bufs);
50228
50229    // received data is "committed" from output sequence to input sequence
50230    b.commit(n);
50231
50232    std::istream is(&b);
50233    std::string s;
50234    is >> s;
50235
50236
50237
50238
50239
50240 [heading Requirements]
50241
50242 ['Header: ][^boost/asio/basic_streambuf.hpp]
50243
50244 ['Convenience header: ][^boost/asio.hpp]
50245
50246
50247 [endsect]
50248
50249
50250
50251 [section:consume basic_streambuf_ref::consume]
50252
50253 [indexterm2 boost_asio.indexterm.basic_streambuf_ref.consume..consume..basic_streambuf_ref] 
50254 Remove characters from the input sequence. 
50255
50256
50257   void consume(
50258       std::size_t n);
50259
50260
50261
50262 [endsect]
50263
50264
50265
50266 [section:data basic_streambuf_ref::data]
50267
50268 [indexterm2 boost_asio.indexterm.basic_streambuf_ref.data..data..basic_streambuf_ref] 
50269 Get a list of buffers that represents the input sequence. 
50270
50271
50272   const_buffers_type data() const;
50273
50274
50275
50276 [endsect]
50277
50278
50279
50280 [section:max_size basic_streambuf_ref::max_size]
50281
50282 [indexterm2 boost_asio.indexterm.basic_streambuf_ref.max_size..max_size..basic_streambuf_ref] 
50283 Get the maximum size of the dynamic buffer. 
50284
50285
50286   std::size_t max_size() const;
50287
50288
50289
50290 [endsect]
50291
50292
50293
50294 [section:mutable_buffers_type basic_streambuf_ref::mutable_buffers_type]
50295
50296 [indexterm2 boost_asio.indexterm.basic_streambuf_ref.mutable_buffers_type..mutable_buffers_type..basic_streambuf_ref] 
50297 The type used to represent the output sequence as a list of buffers. 
50298
50299
50300   typedef basic_streambuf< Allocator >::mutable_buffers_type mutable_buffers_type;
50301
50302
50303 [heading Types]
50304 [table
50305   [[Name][Description]]
50306
50307   [
50308
50309     [[link boost_asio.reference.basic_streambuf.const_buffers_type [*const_buffers_type]]]
50310     [The type used to represent the input sequence as a list of buffers. ]
50311   
50312   ]
50313
50314   [
50315
50316     [[link boost_asio.reference.basic_streambuf.mutable_buffers_type [*mutable_buffers_type]]]
50317     [The type used to represent the output sequence as a list of buffers. ]
50318   
50319   ]
50320
50321 ]
50322
50323 [heading Member Functions]
50324 [table
50325   [[Name][Description]]
50326
50327   [
50328     [[link boost_asio.reference.basic_streambuf.basic_streambuf [*basic_streambuf]]]
50329     [Construct a basic_streambuf object. ]
50330   ]
50331   
50332   [
50333     [[link boost_asio.reference.basic_streambuf.capacity [*capacity]]]
50334     [Get the current capacity of the basic_streambuf. ]
50335   ]
50336   
50337   [
50338     [[link boost_asio.reference.basic_streambuf.commit [*commit]]]
50339     [Move characters from the output sequence to the input sequence. ]
50340   ]
50341   
50342   [
50343     [[link boost_asio.reference.basic_streambuf.consume [*consume]]]
50344     [Remove characters from the input sequence. ]
50345   ]
50346   
50347   [
50348     [[link boost_asio.reference.basic_streambuf.data [*data]]]
50349     [Get a list of buffers that represents the input sequence. ]
50350   ]
50351   
50352   [
50353     [[link boost_asio.reference.basic_streambuf.max_size [*max_size]]]
50354     [Get the maximum size of the basic_streambuf. ]
50355   ]
50356   
50357   [
50358     [[link boost_asio.reference.basic_streambuf.prepare [*prepare]]]
50359     [Get a list of buffers that represents the output sequence, with the given size. ]
50360   ]
50361   
50362   [
50363     [[link boost_asio.reference.basic_streambuf.size [*size]]]
50364     [Get the size of the input sequence. ]
50365   ]
50366   
50367 ]
50368
50369 [heading Protected Member Functions]
50370 [table
50371   [[Name][Description]]
50372
50373   [
50374     [[link boost_asio.reference.basic_streambuf.overflow [*overflow]]]
50375     [Override std::streambuf behaviour. ]
50376   ]
50377   
50378   [
50379     [[link boost_asio.reference.basic_streambuf.reserve [*reserve]]]
50380     []
50381   ]
50382   
50383   [
50384     [[link boost_asio.reference.basic_streambuf.underflow [*underflow]]]
50385     [Override std::streambuf behaviour. ]
50386   ]
50387   
50388 ]
50389
50390 The `basic_streambuf` class is derived from `std::streambuf` to associate the streambuf's input and output sequences with one or more character arrays. These character arrays are internal to the `basic_streambuf` object, but direct access to the array elements is provided to permit them to be used efficiently with I/O operations. Characters written to the output sequence of a `basic_streambuf` object are appended to the input sequence of the same object.
50391
50392 The `basic_streambuf` class's public interface is intended to permit the following implementation strategies:
50393
50394
50395 * A single contiguous character array, which is reallocated as necessary to accommodate changes in the size of the character sequence. This is the implementation approach currently used in Asio.
50396
50397
50398 * A sequence of one or more character arrays, where each array is of the same size. Additional character array objects are appended to the sequence to accommodate changes in the size of the character sequence.
50399
50400
50401 * A sequence of one or more character arrays of varying sizes. Additional character array objects are appended to the sequence to accommodate changes in the size of the character sequence.
50402
50403 The constructor for [link boost_asio.reference.basic_streambuf `basic_streambuf`] accepts a `size_t` argument specifying the maximum of the sum of the sizes of the input sequence and output sequence. During the lifetime of the `basic_streambuf` object, the following invariant holds: 
50404
50405    size() <= max_size()
50406
50407
50408 Any member function that would, if successful, cause the invariant to be violated shall throw an exception of class `std::length_error`.
50409
50410 The constructor for `basic_streambuf` takes an Allocator argument. A copy of this argument is used for any memory allocation performed, by the constructor and by all member functions, during the lifetime of each `basic_streambuf` object.
50411
50412
50413 [heading Examples]
50414   
50415 Writing directly from an streambuf to a socket: 
50416
50417    boost::asio::streambuf b;
50418    std::ostream os(&b);
50419    os << "Hello, World!\n";
50420
50421    // try sending some data in input sequence
50422    size_t n = sock.send(b.data());
50423
50424    b.consume(n); // sent data is removed from input sequence
50425
50426
50427
50428
50429 Reading from a socket directly into a streambuf: 
50430
50431    boost::asio::streambuf b;
50432
50433    // reserve 512 bytes in output sequence
50434    boost::asio::streambuf::mutable_buffers_type bufs = b.prepare(512);
50435
50436    size_t n = sock.receive(bufs);
50437
50438    // received data is "committed" from output sequence to input sequence
50439    b.commit(n);
50440
50441    std::istream is(&b);
50442    std::string s;
50443    is >> s;
50444
50445
50446
50447
50448
50449 [heading Requirements]
50450
50451 ['Header: ][^boost/asio/basic_streambuf.hpp]
50452
50453 ['Convenience header: ][^boost/asio.hpp]
50454
50455
50456 [endsect]
50457
50458
50459
50460 [section:prepare basic_streambuf_ref::prepare]
50461
50462 [indexterm2 boost_asio.indexterm.basic_streambuf_ref.prepare..prepare..basic_streambuf_ref] 
50463 Get a list of buffers that represents the output sequence, with the given size. 
50464
50465
50466   mutable_buffers_type prepare(
50467       std::size_t n);
50468
50469
50470
50471 [endsect]
50472
50473
50474
50475 [section:size basic_streambuf_ref::size]
50476
50477 [indexterm2 boost_asio.indexterm.basic_streambuf_ref.size..size..basic_streambuf_ref] 
50478 Get the size of the input sequence. 
50479
50480
50481   std::size_t size() const;
50482
50483
50484
50485 [endsect]
50486
50487
50488
50489 [endsect]
50490
50491 [section:basic_waitable_timer basic_waitable_timer]
50492
50493
50494 Provides waitable timer functionality. 
50495
50496
50497   template<
50498       typename Clock,
50499       typename ``[link boost_asio.reference.WaitTraits WaitTraits]``,
50500       typename ``[link boost_asio.reference.Executor1 Executor]``>
50501   class basic_waitable_timer
50502
50503
50504 [heading Types]
50505 [table
50506   [[Name][Description]]
50507
50508   [
50509
50510     [[link boost_asio.reference.basic_waitable_timer__rebind_executor [*rebind_executor]]]
50511     [Rebinds the timer type to another executor. ]
50512   
50513   ]
50514
50515   [
50516
50517     [[link boost_asio.reference.basic_waitable_timer.clock_type [*clock_type]]]
50518     [The clock type. ]
50519   
50520   ]
50521
50522   [
50523
50524     [[link boost_asio.reference.basic_waitable_timer.duration [*duration]]]
50525     [The duration type of the clock. ]
50526   
50527   ]
50528
50529   [
50530
50531     [[link boost_asio.reference.basic_waitable_timer.executor_type [*executor_type]]]
50532     [The type of the executor associated with the object. ]
50533   
50534   ]
50535
50536   [
50537
50538     [[link boost_asio.reference.basic_waitable_timer.time_point [*time_point]]]
50539     [The time point type of the clock. ]
50540   
50541   ]
50542
50543   [
50544
50545     [[link boost_asio.reference.basic_waitable_timer.traits_type [*traits_type]]]
50546     [The wait traits type. ]
50547   
50548   ]
50549
50550 ]
50551
50552 [heading Member Functions]
50553 [table
50554   [[Name][Description]]
50555
50556   [
50557     [[link boost_asio.reference.basic_waitable_timer.async_wait [*async_wait]]]
50558     [Start an asynchronous wait on the timer. ]
50559   ]
50560   
50561   [
50562     [[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer [*basic_waitable_timer]]]
50563     [Constructor. 
50564      [hr]
50565      Constructor to set a particular expiry time as an absolute time. 
50566      [hr]
50567      Constructor to set a particular expiry time relative to now. 
50568      [hr]
50569      Move-construct a basic_waitable_timer from another. ]
50570   ]
50571   
50572   [
50573     [[link boost_asio.reference.basic_waitable_timer.cancel [*cancel]]]
50574     [Cancel any asynchronous operations that are waiting on the timer. 
50575      [hr]
50576      (Deprecated: Use non-error_code overload.) Cancel any asynchronous operations that are waiting on the timer. ]
50577   ]
50578   
50579   [
50580     [[link boost_asio.reference.basic_waitable_timer.cancel_one [*cancel_one]]]
50581     [Cancels one asynchronous operation that is waiting on the timer. 
50582      [hr]
50583      (Deprecated: Use non-error_code overload.) Cancels one asynchronous operation that is waiting on the timer. ]
50584   ]
50585   
50586   [
50587     [[link boost_asio.reference.basic_waitable_timer.expires_after [*expires_after]]]
50588     [Set the timer's expiry time relative to now. ]
50589   ]
50590   
50591   [
50592     [[link boost_asio.reference.basic_waitable_timer.expires_at [*expires_at]]]
50593     [(Deprecated: Use expiry().) Get the timer's expiry time as an absolute time. 
50594      [hr]
50595      Set the timer's expiry time as an absolute time. 
50596      [hr]
50597      (Deprecated: Use non-error_code overload.) Set the timer's expiry time as an absolute time. ]
50598   ]
50599   
50600   [
50601     [[link boost_asio.reference.basic_waitable_timer.expires_from_now [*expires_from_now]]]
50602     [(Deprecated: Use expiry().) Get the timer's expiry time relative to now. 
50603      [hr]
50604      (Deprecated: Use expires_after().) Set the timer's expiry time relative to now. ]
50605   ]
50606   
50607   [
50608     [[link boost_asio.reference.basic_waitable_timer.expiry [*expiry]]]
50609     [Get the timer's expiry time as an absolute time. ]
50610   ]
50611   
50612   [
50613     [[link boost_asio.reference.basic_waitable_timer.get_executor [*get_executor]]]
50614     [Get the executor associated with the object. ]
50615   ]
50616   
50617   [
50618     [[link boost_asio.reference.basic_waitable_timer.operator_eq_ [*operator=]]]
50619     [Move-assign a basic_waitable_timer from another. ]
50620   ]
50621   
50622   [
50623     [[link boost_asio.reference.basic_waitable_timer.wait [*wait]]]
50624     [Perform a blocking wait on the timer. ]
50625   ]
50626   
50627   [
50628     [[link boost_asio.reference.basic_waitable_timer._basic_waitable_timer [*~basic_waitable_timer]]]
50629     [Destroys the timer. ]
50630   ]
50631   
50632 ]
50633
50634 The [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] class template provides the ability to perform a blocking or asynchronous wait for a timer to expire.
50635
50636 A waitable timer is always in one of two states: "expired" or "not expired". If the `wait()` or `async_wait()` function is called on an expired timer, the wait operation will complete immediately.
50637
50638 Most applications will use one of the [link boost_asio.reference.steady_timer `steady_timer`], [link boost_asio.reference.system_timer `system_timer`] or [link boost_asio.reference.high_resolution_timer `high_resolution_timer`] typedefs.
50639
50640
50641 [heading Remarks]
50642       
50643 This waitable timer functionality is for use with the C++11 standard library's `<chrono>` facility, or with the Boost.Chrono library.
50644
50645
50646 [heading Thread Safety]
50647   
50648 ['Distinct] ['objects:] Safe.
50649
50650 ['Shared] ['objects:] Unsafe.
50651
50652
50653 [heading Examples]
50654   
50655 Performing a blocking wait (C++11): 
50656
50657    // Construct a timer without setting an expiry time.
50658    boost::asio::steady_timer timer(my_context);
50659
50660    // Set an expiry time relative to now.
50661    timer.expires_after(std::chrono::seconds(5));
50662
50663    // Wait for the timer to expire.
50664    timer.wait();
50665
50666
50667
50668
50669
50670 Performing an asynchronous wait (C++11): 
50671
50672    void handler(const boost::system::error_code& error)
50673    {
50674      if (!error)
50675      {
50676        // Timer expired.
50677      }
50678    }
50679
50680    ...
50681
50682    // Construct a timer with an absolute expiry time.
50683    boost::asio::steady_timer timer(my_context,
50684        std::chrono::steady_clock::now() + std::chrono::seconds(60));
50685
50686    // Start an asynchronous wait.
50687    timer.async_wait(handler);
50688
50689
50690
50691
50692
50693 [heading Changing an active waitable timer's expiry time]
50694   
50695
50696
50697 Changing the expiry time of a timer while there are pending asynchronous waits causes those wait operations to be cancelled. To ensure that the action associated with the timer is performed only once, use something like this: used:
50698
50699
50700
50701    void on_some_event()
50702    {
50703      if (my_timer.expires_after(seconds(5)) > 0)
50704      {
50705        // We managed to cancel the timer. Start new asynchronous wait.
50706        my_timer.async_wait(on_timeout);
50707      }
50708      else
50709      {
50710        // Too late, timer has already expired!
50711      }
50712    }
50713
50714    void on_timeout(const boost::system::error_code& e)
50715    {
50716      if (e != boost::asio::error::operation_aborted)
50717      {
50718        // Timer was not cancelled, take necessary action.
50719      }
50720    }
50721
50722
50723
50724
50725
50726 * The `boost::asio::basic_waitable_timer::expires_after()` function cancels any pending asynchronous waits, and returns the number of asynchronous waits that were cancelled. If it returns 0 then you were too late and the wait handler has already been executed, or will soon be executed. If it returns 1 then the wait handler was successfully cancelled.
50727
50728
50729 * If a wait handler is cancelled, the boost::system::error\_code passed to it contains the value `boost::asio::error::operation_aborted`. 
50730
50731
50732
50733 [heading Requirements]
50734
50735 ['Header: ][^boost/asio/basic_waitable_timer.hpp]
50736
50737 ['Convenience header: ][^boost/asio.hpp]
50738
50739
50740 [section:async_wait basic_waitable_timer::async_wait]
50741
50742 [indexterm2 boost_asio.indexterm.basic_waitable_timer.async_wait..async_wait..basic_waitable_timer] 
50743 Start an asynchronous wait on the timer. 
50744
50745
50746   template<
50747       typename ``[link boost_asio.reference.WaitHandler WaitHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
50748   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait(
50749       WaitHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
50750
50751
50752 This function may be used to initiate an asynchronous wait against the timer. It always returns immediately.
50753
50754 For each call to `async_wait()`, the supplied handler will be called exactly once. The handler will be called when:
50755
50756
50757 * The timer has expired.
50758
50759
50760 * The timer was cancelled, in which case the handler is passed the error code `boost::asio::error::operation_aborted`.
50761
50762
50763 [heading Parameters]
50764     
50765
50766 [variablelist
50767   
50768 [[handler][The handler to be called when the timer expires. Copies will be made of the handler as required. The function signature of the handler must be: 
50769 ``
50770    void handler(
50771      const boost::system::error_code& error // Result of operation.
50772    ); 
50773 ``
50774 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
50775
50776 ]
50777
50778
50779
50780
50781 [endsect]
50782
50783
50784 [section:basic_waitable_timer basic_waitable_timer::basic_waitable_timer]
50785
50786 [indexterm2 boost_asio.indexterm.basic_waitable_timer.basic_waitable_timer..basic_waitable_timer..basic_waitable_timer] 
50787 Constructor. 
50788
50789
50790   explicit ``[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload1 basic_waitable_timer]``(
50791       const executor_type & ex);
50792   ``  [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload1 more...]]``
50793
50794   template<
50795       typename ExecutionContext>
50796   explicit ``[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload2 basic_waitable_timer]``(
50797       ExecutionContext & context,
50798       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
50799   ``  [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload2 more...]]``
50800
50801
50802 Constructor to set a particular expiry time as an absolute time. 
50803
50804
50805   ``[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload3 basic_waitable_timer]``(
50806       const executor_type & ex,
50807       const time_point & expiry_time);
50808   ``  [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload3 more...]]``
50809
50810   template<
50811       typename ExecutionContext>
50812   explicit ``[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload4 basic_waitable_timer]``(
50813       ExecutionContext & context,
50814       const time_point & expiry_time,
50815       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
50816   ``  [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload4 more...]]``
50817
50818
50819 Constructor to set a particular expiry time relative to now. 
50820
50821
50822   ``[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload5 basic_waitable_timer]``(
50823       const executor_type & ex,
50824       const duration & expiry_time);
50825   ``  [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload5 more...]]``
50826
50827   template<
50828       typename ExecutionContext>
50829   explicit ``[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload6 basic_waitable_timer]``(
50830       ExecutionContext & context,
50831       const duration & expiry_time,
50832       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
50833   ``  [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload6 more...]]``
50834
50835
50836 Move-construct a [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] from another. 
50837
50838
50839   ``[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload7 basic_waitable_timer]``(
50840       basic_waitable_timer && other);
50841   ``  [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload7 more...]]``
50842
50843
50844 [section:overload1 basic_waitable_timer::basic_waitable_timer (1 of 7 overloads)]
50845
50846
50847 Constructor. 
50848
50849
50850   basic_waitable_timer(
50851       const executor_type & ex);
50852
50853
50854 This constructor creates a timer without setting an expiry time. The `expires_at()` or `expires_after()` functions must be called to set an expiry time before the timer can be waited on.
50855
50856
50857 [heading Parameters]
50858     
50859
50860 [variablelist
50861   
50862 [[ex][The I/O executor that the timer will use, by default, to dispatch handlers for any asynchronous operations performed on the timer. ]]
50863
50864 ]
50865
50866
50867
50868
50869 [endsect]
50870
50871
50872
50873 [section:overload2 basic_waitable_timer::basic_waitable_timer (2 of 7 overloads)]
50874
50875
50876 Constructor. 
50877
50878
50879   template<
50880       typename ExecutionContext>
50881   basic_waitable_timer(
50882       ExecutionContext & context,
50883       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
50884
50885
50886 This constructor creates a timer without setting an expiry time. The `expires_at()` or `expires_after()` functions must be called to set an expiry time before the timer can be waited on.
50887
50888
50889 [heading Parameters]
50890     
50891
50892 [variablelist
50893   
50894 [[context][An execution context which provides the I/O executor that the timer will use, by default, to dispatch handlers for any asynchronous operations performed on the timer. ]]
50895
50896 ]
50897
50898
50899
50900
50901 [endsect]
50902
50903
50904
50905 [section:overload3 basic_waitable_timer::basic_waitable_timer (3 of 7 overloads)]
50906
50907
50908 Constructor to set a particular expiry time as an absolute time. 
50909
50910
50911   basic_waitable_timer(
50912       const executor_type & ex,
50913       const time_point & expiry_time);
50914
50915
50916 This constructor creates a timer and sets the expiry time.
50917
50918
50919 [heading Parameters]
50920     
50921
50922 [variablelist
50923   
50924 [[ex][The I/O executor object that the timer will use, by default, to dispatch handlers for any asynchronous operations performed on the timer.]]
50925
50926 [[expiry_time][The expiry time to be used for the timer, expressed as an absolute time. ]]
50927
50928 ]
50929
50930
50931
50932
50933 [endsect]
50934
50935
50936
50937 [section:overload4 basic_waitable_timer::basic_waitable_timer (4 of 7 overloads)]
50938
50939
50940 Constructor to set a particular expiry time as an absolute time. 
50941
50942
50943   template<
50944       typename ExecutionContext>
50945   basic_waitable_timer(
50946       ExecutionContext & context,
50947       const time_point & expiry_time,
50948       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
50949
50950
50951 This constructor creates a timer and sets the expiry time.
50952
50953
50954 [heading Parameters]
50955     
50956
50957 [variablelist
50958   
50959 [[context][An execution context which provides the I/O executor that the timer will use, by default, to dispatch handlers for any asynchronous operations performed on the timer.]]
50960
50961 [[expiry_time][The expiry time to be used for the timer, expressed as an absolute time. ]]
50962
50963 ]
50964
50965
50966
50967
50968 [endsect]
50969
50970
50971
50972 [section:overload5 basic_waitable_timer::basic_waitable_timer (5 of 7 overloads)]
50973
50974
50975 Constructor to set a particular expiry time relative to now. 
50976
50977
50978   basic_waitable_timer(
50979       const executor_type & ex,
50980       const duration & expiry_time);
50981
50982
50983 This constructor creates a timer and sets the expiry time.
50984
50985
50986 [heading Parameters]
50987     
50988
50989 [variablelist
50990   
50991 [[ex][The I/O executor that the timer will use, by default, to dispatch handlers for any asynchronous operations performed on the timer.]]
50992
50993 [[expiry_time][The expiry time to be used for the timer, relative to now. ]]
50994
50995 ]
50996
50997
50998
50999
51000 [endsect]
51001
51002
51003
51004 [section:overload6 basic_waitable_timer::basic_waitable_timer (6 of 7 overloads)]
51005
51006
51007 Constructor to set a particular expiry time relative to now. 
51008
51009
51010   template<
51011       typename ExecutionContext>
51012   basic_waitable_timer(
51013       ExecutionContext & context,
51014       const duration & expiry_time,
51015       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
51016
51017
51018 This constructor creates a timer and sets the expiry time.
51019
51020
51021 [heading Parameters]
51022     
51023
51024 [variablelist
51025   
51026 [[context][An execution context which provides the I/O executor that the timer will use, by default, to dispatch handlers for any asynchronous operations performed on the timer.]]
51027
51028 [[expiry_time][The expiry time to be used for the timer, relative to now. ]]
51029
51030 ]
51031
51032
51033
51034
51035 [endsect]
51036
51037
51038
51039 [section:overload7 basic_waitable_timer::basic_waitable_timer (7 of 7 overloads)]
51040
51041
51042 Move-construct a [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] from another. 
51043
51044
51045   basic_waitable_timer(
51046       basic_waitable_timer && other);
51047
51048
51049 This constructor moves a timer from one object to another.
51050
51051
51052 [heading Parameters]
51053     
51054
51055 [variablelist
51056   
51057 [[other][The other [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] object from which the move will occur.]]
51058
51059 ]
51060
51061
51062 [heading Remarks]
51063       
51064 Following the move, the moved-from object is in the same state as if constructed using the `basic_waitable_timer(const executor_type&)` constructor. 
51065
51066
51067
51068
51069 [endsect]
51070
51071
51072 [endsect]
51073
51074 [section:cancel basic_waitable_timer::cancel]
51075
51076 [indexterm2 boost_asio.indexterm.basic_waitable_timer.cancel..cancel..basic_waitable_timer] 
51077 Cancel any asynchronous operations that are waiting on the timer. 
51078
51079
51080   std::size_t ``[link boost_asio.reference.basic_waitable_timer.cancel.overload1 cancel]``();
51081   ``  [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.cancel.overload1 more...]]``
51082
51083
51084 (Deprecated: Use non-error\_code overload.) Cancel any asynchronous operations that are waiting on the timer. 
51085
51086
51087   std::size_t ``[link boost_asio.reference.basic_waitable_timer.cancel.overload2 cancel]``(
51088       boost::system::error_code & ec);
51089   ``  [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.cancel.overload2 more...]]``
51090
51091
51092 [section:overload1 basic_waitable_timer::cancel (1 of 2 overloads)]
51093
51094
51095 Cancel any asynchronous operations that are waiting on the timer. 
51096
51097
51098   std::size_t cancel();
51099
51100
51101 This function forces the completion of any pending asynchronous wait operations against the timer. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
51102
51103 Cancelling the timer does not change the expiry time.
51104
51105
51106 [heading Return Value]
51107       
51108 The number of asynchronous operations that were cancelled.
51109
51110
51111 [heading Exceptions]
51112     
51113
51114 [variablelist
51115   
51116 [[boost::system::system_error][Thrown on failure.]]
51117
51118 ]
51119
51120
51121 [heading Remarks]
51122       
51123 If the timer has already expired when `cancel()` is called, then the handlers for asynchronous wait operations will:
51124
51125
51126 * have already been invoked; or
51127
51128
51129 * have been queued for invocation in the near future.
51130
51131 These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 
51132
51133
51134 [endsect]
51135
51136
51137
51138 [section:overload2 basic_waitable_timer::cancel (2 of 2 overloads)]
51139
51140
51141 (Deprecated: Use non-error\_code overload.) Cancel any asynchronous operations that are waiting on the timer. 
51142
51143
51144   std::size_t cancel(
51145       boost::system::error_code & ec);
51146
51147
51148 This function forces the completion of any pending asynchronous wait operations against the timer. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
51149
51150 Cancelling the timer does not change the expiry time.
51151
51152
51153 [heading Parameters]
51154     
51155
51156 [variablelist
51157   
51158 [[ec][Set to indicate what error occurred, if any.]]
51159
51160 ]
51161
51162
51163 [heading Return Value]
51164       
51165 The number of asynchronous operations that were cancelled.
51166
51167
51168 [heading Remarks]
51169       
51170 If the timer has already expired when `cancel()` is called, then the handlers for asynchronous wait operations will:
51171
51172
51173 * have already been invoked; or
51174
51175
51176 * have been queued for invocation in the near future.
51177
51178 These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 
51179
51180
51181 [endsect]
51182
51183
51184 [endsect]
51185
51186 [section:cancel_one basic_waitable_timer::cancel_one]
51187
51188 [indexterm2 boost_asio.indexterm.basic_waitable_timer.cancel_one..cancel_one..basic_waitable_timer] 
51189 Cancels one asynchronous operation that is waiting on the timer. 
51190
51191
51192   std::size_t ``[link boost_asio.reference.basic_waitable_timer.cancel_one.overload1 cancel_one]``();
51193   ``  [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.cancel_one.overload1 more...]]``
51194
51195
51196 (Deprecated: Use non-error\_code overload.) Cancels one asynchronous operation that is waiting on the timer. 
51197
51198
51199   std::size_t ``[link boost_asio.reference.basic_waitable_timer.cancel_one.overload2 cancel_one]``(
51200       boost::system::error_code & ec);
51201   ``  [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.cancel_one.overload2 more...]]``
51202
51203
51204 [section:overload1 basic_waitable_timer::cancel_one (1 of 2 overloads)]
51205
51206
51207 Cancels one asynchronous operation that is waiting on the timer. 
51208
51209
51210   std::size_t cancel_one();
51211
51212
51213 This function forces the completion of one pending asynchronous wait operation against the timer. Handlers are cancelled in FIFO order. The handler for the cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
51214
51215 Cancelling the timer does not change the expiry time.
51216
51217
51218 [heading Return Value]
51219       
51220 The number of asynchronous operations that were cancelled. That is, either 0 or 1.
51221
51222
51223 [heading Exceptions]
51224     
51225
51226 [variablelist
51227   
51228 [[boost::system::system_error][Thrown on failure.]]
51229
51230 ]
51231
51232
51233 [heading Remarks]
51234       
51235 If the timer has already expired when `cancel_one()` is called, then the handlers for asynchronous wait operations will:
51236
51237
51238 * have already been invoked; or
51239
51240
51241 * have been queued for invocation in the near future.
51242
51243 These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 
51244
51245
51246 [endsect]
51247
51248
51249
51250 [section:overload2 basic_waitable_timer::cancel_one (2 of 2 overloads)]
51251
51252
51253 (Deprecated: Use non-error\_code overload.) Cancels one asynchronous operation that is waiting on the timer. 
51254
51255
51256   std::size_t cancel_one(
51257       boost::system::error_code & ec);
51258
51259
51260 This function forces the completion of one pending asynchronous wait operation against the timer. Handlers are cancelled in FIFO order. The handler for the cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
51261
51262 Cancelling the timer does not change the expiry time.
51263
51264
51265 [heading Parameters]
51266     
51267
51268 [variablelist
51269   
51270 [[ec][Set to indicate what error occurred, if any.]]
51271
51272 ]
51273
51274
51275 [heading Return Value]
51276       
51277 The number of asynchronous operations that were cancelled. That is, either 0 or 1.
51278
51279
51280 [heading Remarks]
51281       
51282 If the timer has already expired when `cancel_one()` is called, then the handlers for asynchronous wait operations will:
51283
51284
51285 * have already been invoked; or
51286
51287
51288 * have been queued for invocation in the near future.
51289
51290 These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 
51291
51292
51293 [endsect]
51294
51295
51296 [endsect]
51297
51298
51299 [section:clock_type basic_waitable_timer::clock_type]
51300
51301 [indexterm2 boost_asio.indexterm.basic_waitable_timer.clock_type..clock_type..basic_waitable_timer] 
51302 The clock type. 
51303
51304
51305   typedef Clock clock_type;
51306
51307
51308
51309 [heading Requirements]
51310
51311 ['Header: ][^boost/asio/basic_waitable_timer.hpp]
51312
51313 ['Convenience header: ][^boost/asio.hpp]
51314
51315
51316 [endsect]
51317
51318
51319
51320 [section:duration basic_waitable_timer::duration]
51321
51322 [indexterm2 boost_asio.indexterm.basic_waitable_timer.duration..duration..basic_waitable_timer] 
51323 The duration type of the clock. 
51324
51325
51326   typedef clock_type::duration duration;
51327
51328
51329
51330 [heading Requirements]
51331
51332 ['Header: ][^boost/asio/basic_waitable_timer.hpp]
51333
51334 ['Convenience header: ][^boost/asio.hpp]
51335
51336
51337 [endsect]
51338
51339
51340
51341 [section:executor_type basic_waitable_timer::executor_type]
51342
51343 [indexterm2 boost_asio.indexterm.basic_waitable_timer.executor_type..executor_type..basic_waitable_timer] 
51344 The type of the executor associated with the object. 
51345
51346
51347   typedef Executor executor_type;
51348
51349
51350
51351 [heading Requirements]
51352
51353 ['Header: ][^boost/asio/basic_waitable_timer.hpp]
51354
51355 ['Convenience header: ][^boost/asio.hpp]
51356
51357
51358 [endsect]
51359
51360
51361
51362 [section:expires_after basic_waitable_timer::expires_after]
51363
51364 [indexterm2 boost_asio.indexterm.basic_waitable_timer.expires_after..expires_after..basic_waitable_timer] 
51365 Set the timer's expiry time relative to now. 
51366
51367
51368   std::size_t expires_after(
51369       const duration & expiry_time);
51370
51371
51372 This function sets the expiry time. Any pending asynchronous wait operations will be cancelled. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
51373
51374
51375 [heading Parameters]
51376     
51377
51378 [variablelist
51379   
51380 [[expiry_time][The expiry time to be used for the timer.]]
51381
51382 ]
51383
51384
51385 [heading Return Value]
51386       
51387 The number of asynchronous operations that were cancelled.
51388
51389
51390 [heading Exceptions]
51391     
51392
51393 [variablelist
51394   
51395 [[boost::system::system_error][Thrown on failure.]]
51396
51397 ]
51398
51399
51400 [heading Remarks]
51401       
51402 If the timer has already expired when `expires_after()` is called, then the handlers for asynchronous wait operations will:
51403
51404
51405 * have already been invoked; or
51406
51407
51408 * have been queued for invocation in the near future.
51409
51410 These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 
51411
51412
51413 [endsect]
51414
51415
51416 [section:expires_at basic_waitable_timer::expires_at]
51417
51418 [indexterm2 boost_asio.indexterm.basic_waitable_timer.expires_at..expires_at..basic_waitable_timer] 
51419 (Deprecated: Use `expiry()`.) Get the timer's expiry time as an absolute time. 
51420
51421
51422   time_point ``[link boost_asio.reference.basic_waitable_timer.expires_at.overload1 expires_at]``() const;
51423   ``  [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.expires_at.overload1 more...]]``
51424
51425
51426 Set the timer's expiry time as an absolute time. 
51427
51428
51429   std::size_t ``[link boost_asio.reference.basic_waitable_timer.expires_at.overload2 expires_at]``(
51430       const time_point & expiry_time);
51431   ``  [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.expires_at.overload2 more...]]``
51432
51433
51434 (Deprecated: Use non-error\_code overload.) Set the timer's expiry time as an absolute time. 
51435
51436
51437   std::size_t ``[link boost_asio.reference.basic_waitable_timer.expires_at.overload3 expires_at]``(
51438       const time_point & expiry_time,
51439       boost::system::error_code & ec);
51440   ``  [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.expires_at.overload3 more...]]``
51441
51442
51443 [section:overload1 basic_waitable_timer::expires_at (1 of 3 overloads)]
51444
51445
51446 (Deprecated: Use `expiry()`.) Get the timer's expiry time as an absolute time. 
51447
51448
51449   time_point expires_at() const;
51450
51451
51452 This function may be used to obtain the timer's current expiry time. Whether the timer has expired or not does not affect this value. 
51453
51454
51455 [endsect]
51456
51457
51458
51459 [section:overload2 basic_waitable_timer::expires_at (2 of 3 overloads)]
51460
51461
51462 Set the timer's expiry time as an absolute time. 
51463
51464
51465   std::size_t expires_at(
51466       const time_point & expiry_time);
51467
51468
51469 This function sets the expiry time. Any pending asynchronous wait operations will be cancelled. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
51470
51471
51472 [heading Parameters]
51473     
51474
51475 [variablelist
51476   
51477 [[expiry_time][The expiry time to be used for the timer.]]
51478
51479 ]
51480
51481
51482 [heading Return Value]
51483       
51484 The number of asynchronous operations that were cancelled.
51485
51486
51487 [heading Exceptions]
51488     
51489
51490 [variablelist
51491   
51492 [[boost::system::system_error][Thrown on failure.]]
51493
51494 ]
51495
51496
51497 [heading Remarks]
51498       
51499 If the timer has already expired when `expires_at()` is called, then the handlers for asynchronous wait operations will:
51500
51501
51502 * have already been invoked; or
51503
51504
51505 * have been queued for invocation in the near future.
51506
51507 These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 
51508
51509
51510 [endsect]
51511
51512
51513
51514 [section:overload3 basic_waitable_timer::expires_at (3 of 3 overloads)]
51515
51516
51517 (Deprecated: Use non-error\_code overload.) Set the timer's expiry time as an absolute time. 
51518
51519
51520   std::size_t expires_at(
51521       const time_point & expiry_time,
51522       boost::system::error_code & ec);
51523
51524
51525 This function sets the expiry time. Any pending asynchronous wait operations will be cancelled. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
51526
51527
51528 [heading Parameters]
51529     
51530
51531 [variablelist
51532   
51533 [[expiry_time][The expiry time to be used for the timer.]]
51534
51535 [[ec][Set to indicate what error occurred, if any.]]
51536
51537 ]
51538
51539
51540 [heading Return Value]
51541       
51542 The number of asynchronous operations that were cancelled.
51543
51544
51545 [heading Remarks]
51546       
51547 If the timer has already expired when `expires_at()` is called, then the handlers for asynchronous wait operations will:
51548
51549
51550 * have already been invoked; or
51551
51552
51553 * have been queued for invocation in the near future.
51554
51555 These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 
51556
51557
51558 [endsect]
51559
51560
51561 [endsect]
51562
51563 [section:expires_from_now basic_waitable_timer::expires_from_now]
51564
51565 [indexterm2 boost_asio.indexterm.basic_waitable_timer.expires_from_now..expires_from_now..basic_waitable_timer] 
51566 (Deprecated: Use `expiry()`.) Get the timer's expiry time relative to now. 
51567
51568
51569   duration ``[link boost_asio.reference.basic_waitable_timer.expires_from_now.overload1 expires_from_now]``() const;
51570   ``  [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.expires_from_now.overload1 more...]]``
51571
51572
51573 (Deprecated: Use `expires_after()`.) Set the timer's expiry time relative to now. 
51574
51575
51576   std::size_t ``[link boost_asio.reference.basic_waitable_timer.expires_from_now.overload2 expires_from_now]``(
51577       const duration & expiry_time);
51578   ``  [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.expires_from_now.overload2 more...]]``
51579
51580   std::size_t ``[link boost_asio.reference.basic_waitable_timer.expires_from_now.overload3 expires_from_now]``(
51581       const duration & expiry_time,
51582       boost::system::error_code & ec);
51583   ``  [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.expires_from_now.overload3 more...]]``
51584
51585
51586 [section:overload1 basic_waitable_timer::expires_from_now (1 of 3 overloads)]
51587
51588
51589 (Deprecated: Use `expiry()`.) Get the timer's expiry time relative to now. 
51590
51591
51592   duration expires_from_now() const;
51593
51594
51595 This function may be used to obtain the timer's current expiry time. Whether the timer has expired or not does not affect this value. 
51596
51597
51598 [endsect]
51599
51600
51601
51602 [section:overload2 basic_waitable_timer::expires_from_now (2 of 3 overloads)]
51603
51604
51605 (Deprecated: Use `expires_after()`.) Set the timer's expiry time relative to now. 
51606
51607
51608   std::size_t expires_from_now(
51609       const duration & expiry_time);
51610
51611
51612 This function sets the expiry time. Any pending asynchronous wait operations will be cancelled. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
51613
51614
51615 [heading Parameters]
51616     
51617
51618 [variablelist
51619   
51620 [[expiry_time][The expiry time to be used for the timer.]]
51621
51622 ]
51623
51624
51625 [heading Return Value]
51626       
51627 The number of asynchronous operations that were cancelled.
51628
51629
51630 [heading Exceptions]
51631     
51632
51633 [variablelist
51634   
51635 [[boost::system::system_error][Thrown on failure.]]
51636
51637 ]
51638
51639
51640 [heading Remarks]
51641       
51642 If the timer has already expired when `expires_from_now()` is called, then the handlers for asynchronous wait operations will:
51643
51644
51645 * have already been invoked; or
51646
51647
51648 * have been queued for invocation in the near future.
51649
51650 These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 
51651
51652
51653 [endsect]
51654
51655
51656
51657 [section:overload3 basic_waitable_timer::expires_from_now (3 of 3 overloads)]
51658
51659
51660 (Deprecated: Use `expires_after()`.) Set the timer's expiry time relative to now. 
51661
51662
51663   std::size_t expires_from_now(
51664       const duration & expiry_time,
51665       boost::system::error_code & ec);
51666
51667
51668 This function sets the expiry time. Any pending asynchronous wait operations will be cancelled. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
51669
51670
51671 [heading Parameters]
51672     
51673
51674 [variablelist
51675   
51676 [[expiry_time][The expiry time to be used for the timer.]]
51677
51678 [[ec][Set to indicate what error occurred, if any.]]
51679
51680 ]
51681
51682
51683 [heading Return Value]
51684       
51685 The number of asynchronous operations that were cancelled.
51686
51687
51688 [heading Remarks]
51689       
51690 If the timer has already expired when `expires_from_now()` is called, then the handlers for asynchronous wait operations will:
51691
51692
51693 * have already been invoked; or
51694
51695
51696 * have been queued for invocation in the near future.
51697
51698 These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 
51699
51700
51701 [endsect]
51702
51703
51704 [endsect]
51705
51706
51707 [section:expiry basic_waitable_timer::expiry]
51708
51709 [indexterm2 boost_asio.indexterm.basic_waitable_timer.expiry..expiry..basic_waitable_timer] 
51710 Get the timer's expiry time as an absolute time. 
51711
51712
51713   time_point expiry() const;
51714
51715
51716 This function may be used to obtain the timer's current expiry time. Whether the timer has expired or not does not affect this value. 
51717
51718
51719 [endsect]
51720
51721
51722
51723 [section:get_executor basic_waitable_timer::get_executor]
51724
51725 [indexterm2 boost_asio.indexterm.basic_waitable_timer.get_executor..get_executor..basic_waitable_timer] 
51726 Get the executor associated with the object. 
51727
51728
51729   executor_type get_executor();
51730
51731
51732
51733 [endsect]
51734
51735
51736
51737 [section:operator_eq_ basic_waitable_timer::operator=]
51738
51739 [indexterm2 boost_asio.indexterm.basic_waitable_timer.operator_eq_..operator=..basic_waitable_timer] 
51740 Move-assign a [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] from another. 
51741
51742
51743   basic_waitable_timer & operator=(
51744       basic_waitable_timer && other);
51745
51746
51747 This assignment operator moves a timer from one object to another. Cancels any outstanding asynchronous operations associated with the target object.
51748
51749
51750 [heading Parameters]
51751     
51752
51753 [variablelist
51754   
51755 [[other][The other [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] object from which the move will occur.]]
51756
51757 ]
51758
51759
51760 [heading Remarks]
51761       
51762 Following the move, the moved-from object is in the same state as if constructed using the `basic_waitable_timer(const executor_type&)` constructor. 
51763
51764
51765
51766
51767 [endsect]
51768
51769
51770
51771 [section:time_point basic_waitable_timer::time_point]
51772
51773 [indexterm2 boost_asio.indexterm.basic_waitable_timer.time_point..time_point..basic_waitable_timer] 
51774 The time point type of the clock. 
51775
51776
51777   typedef clock_type::time_point time_point;
51778
51779
51780
51781 [heading Requirements]
51782
51783 ['Header: ][^boost/asio/basic_waitable_timer.hpp]
51784
51785 ['Convenience header: ][^boost/asio.hpp]
51786
51787
51788 [endsect]
51789
51790
51791
51792 [section:traits_type basic_waitable_timer::traits_type]
51793
51794 [indexterm2 boost_asio.indexterm.basic_waitable_timer.traits_type..traits_type..basic_waitable_timer] 
51795 The wait traits type. 
51796
51797
51798   typedef WaitTraits traits_type;
51799
51800
51801
51802 [heading Requirements]
51803
51804 ['Header: ][^boost/asio/basic_waitable_timer.hpp]
51805
51806 ['Convenience header: ][^boost/asio.hpp]
51807
51808
51809 [endsect]
51810
51811
51812 [section:wait basic_waitable_timer::wait]
51813
51814 [indexterm2 boost_asio.indexterm.basic_waitable_timer.wait..wait..basic_waitable_timer] 
51815 Perform a blocking wait on the timer. 
51816
51817
51818   void ``[link boost_asio.reference.basic_waitable_timer.wait.overload1 wait]``();
51819   ``  [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.wait.overload1 more...]]``
51820
51821   void ``[link boost_asio.reference.basic_waitable_timer.wait.overload2 wait]``(
51822       boost::system::error_code & ec);
51823   ``  [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.wait.overload2 more...]]``
51824
51825
51826 [section:overload1 basic_waitable_timer::wait (1 of 2 overloads)]
51827
51828
51829 Perform a blocking wait on the timer. 
51830
51831
51832   void wait();
51833
51834
51835 This function is used to wait for the timer to expire. This function blocks and does not return until the timer has expired.
51836
51837
51838 [heading Exceptions]
51839     
51840
51841 [variablelist
51842   
51843 [[boost::system::system_error][Thrown on failure. ]]
51844
51845 ]
51846
51847
51848
51849
51850 [endsect]
51851
51852
51853
51854 [section:overload2 basic_waitable_timer::wait (2 of 2 overloads)]
51855
51856
51857 Perform a blocking wait on the timer. 
51858
51859
51860   void wait(
51861       boost::system::error_code & ec);
51862
51863
51864 This function is used to wait for the timer to expire. This function blocks and does not return until the timer has expired.
51865
51866
51867 [heading Parameters]
51868     
51869
51870 [variablelist
51871   
51872 [[ec][Set to indicate what error occurred, if any. ]]
51873
51874 ]
51875
51876
51877
51878
51879 [endsect]
51880
51881
51882 [endsect]
51883
51884
51885 [section:_basic_waitable_timer basic_waitable_timer::~basic_waitable_timer]
51886
51887 [indexterm2 boost_asio.indexterm.basic_waitable_timer._basic_waitable_timer..~basic_waitable_timer..basic_waitable_timer] 
51888 Destroys the timer. 
51889
51890
51891   ~basic_waitable_timer();
51892
51893
51894 This function destroys the timer, cancelling any outstanding asynchronous wait operations associated with the timer as if by calling `cancel`. 
51895
51896
51897 [endsect]
51898
51899
51900
51901 [endsect]
51902
51903 [section:basic_waitable_timer__rebind_executor basic_waitable_timer::rebind_executor]
51904
51905
51906 Rebinds the timer type to another executor. 
51907
51908
51909   template<
51910       typename ``[link boost_asio.reference.Executor1 Executor1]``>
51911   struct rebind_executor
51912
51913
51914 [heading Types]
51915 [table
51916   [[Name][Description]]
51917
51918   [
51919
51920     [[link boost_asio.reference.basic_waitable_timer__rebind_executor.other [*other]]]
51921     [The timer type when rebound to the specified executor. ]
51922   
51923   ]
51924
51925 ]
51926
51927 [heading Requirements]
51928
51929 ['Header: ][^boost/asio/basic_waitable_timer.hpp]
51930
51931 ['Convenience header: ][^boost/asio.hpp]
51932
51933
51934 [section:other basic_waitable_timer::rebind_executor::other]
51935
51936 [indexterm2 boost_asio.indexterm.basic_waitable_timer__rebind_executor.other..other..basic_waitable_timer::rebind_executor] 
51937 The timer type when rebound to the specified executor. 
51938
51939
51940   typedef basic_waitable_timer< Clock, WaitTraits, Executor1 > other;
51941
51942
51943 [heading Types]
51944 [table
51945   [[Name][Description]]
51946
51947   [
51948
51949     [[link boost_asio.reference.basic_waitable_timer__rebind_executor [*rebind_executor]]]
51950     [Rebinds the timer type to another executor. ]
51951   
51952   ]
51953
51954   [
51955
51956     [[link boost_asio.reference.basic_waitable_timer.clock_type [*clock_type]]]
51957     [The clock type. ]
51958   
51959   ]
51960
51961   [
51962
51963     [[link boost_asio.reference.basic_waitable_timer.duration [*duration]]]
51964     [The duration type of the clock. ]
51965   
51966   ]
51967
51968   [
51969
51970     [[link boost_asio.reference.basic_waitable_timer.executor_type [*executor_type]]]
51971     [The type of the executor associated with the object. ]
51972   
51973   ]
51974
51975   [
51976
51977     [[link boost_asio.reference.basic_waitable_timer.time_point [*time_point]]]
51978     [The time point type of the clock. ]
51979   
51980   ]
51981
51982   [
51983
51984     [[link boost_asio.reference.basic_waitable_timer.traits_type [*traits_type]]]
51985     [The wait traits type. ]
51986   
51987   ]
51988
51989 ]
51990
51991 [heading Member Functions]
51992 [table
51993   [[Name][Description]]
51994
51995   [
51996     [[link boost_asio.reference.basic_waitable_timer.async_wait [*async_wait]]]
51997     [Start an asynchronous wait on the timer. ]
51998   ]
51999   
52000   [
52001     [[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer [*basic_waitable_timer]]]
52002     [Constructor. 
52003      [hr]
52004      Constructor to set a particular expiry time as an absolute time. 
52005      [hr]
52006      Constructor to set a particular expiry time relative to now. 
52007      [hr]
52008      Move-construct a basic_waitable_timer from another. ]
52009   ]
52010   
52011   [
52012     [[link boost_asio.reference.basic_waitable_timer.cancel [*cancel]]]
52013     [Cancel any asynchronous operations that are waiting on the timer. 
52014      [hr]
52015      (Deprecated: Use non-error_code overload.) Cancel any asynchronous operations that are waiting on the timer. ]
52016   ]
52017   
52018   [
52019     [[link boost_asio.reference.basic_waitable_timer.cancel_one [*cancel_one]]]
52020     [Cancels one asynchronous operation that is waiting on the timer. 
52021      [hr]
52022      (Deprecated: Use non-error_code overload.) Cancels one asynchronous operation that is waiting on the timer. ]
52023   ]
52024   
52025   [
52026     [[link boost_asio.reference.basic_waitable_timer.expires_after [*expires_after]]]
52027     [Set the timer's expiry time relative to now. ]
52028   ]
52029   
52030   [
52031     [[link boost_asio.reference.basic_waitable_timer.expires_at [*expires_at]]]
52032     [(Deprecated: Use expiry().) Get the timer's expiry time as an absolute time. 
52033      [hr]
52034      Set the timer's expiry time as an absolute time. 
52035      [hr]
52036      (Deprecated: Use non-error_code overload.) Set the timer's expiry time as an absolute time. ]
52037   ]
52038   
52039   [
52040     [[link boost_asio.reference.basic_waitable_timer.expires_from_now [*expires_from_now]]]
52041     [(Deprecated: Use expiry().) Get the timer's expiry time relative to now. 
52042      [hr]
52043      (Deprecated: Use expires_after().) Set the timer's expiry time relative to now. ]
52044   ]
52045   
52046   [
52047     [[link boost_asio.reference.basic_waitable_timer.expiry [*expiry]]]
52048     [Get the timer's expiry time as an absolute time. ]
52049   ]
52050   
52051   [
52052     [[link boost_asio.reference.basic_waitable_timer.get_executor [*get_executor]]]
52053     [Get the executor associated with the object. ]
52054   ]
52055   
52056   [
52057     [[link boost_asio.reference.basic_waitable_timer.operator_eq_ [*operator=]]]
52058     [Move-assign a basic_waitable_timer from another. ]
52059   ]
52060   
52061   [
52062     [[link boost_asio.reference.basic_waitable_timer.wait [*wait]]]
52063     [Perform a blocking wait on the timer. ]
52064   ]
52065   
52066   [
52067     [[link boost_asio.reference.basic_waitable_timer._basic_waitable_timer [*~basic_waitable_timer]]]
52068     [Destroys the timer. ]
52069   ]
52070   
52071 ]
52072
52073 The [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] class template provides the ability to perform a blocking or asynchronous wait for a timer to expire.
52074
52075 A waitable timer is always in one of two states: "expired" or "not expired". If the `wait()` or `async_wait()` function is called on an expired timer, the wait operation will complete immediately.
52076
52077 Most applications will use one of the [link boost_asio.reference.steady_timer `steady_timer`], [link boost_asio.reference.system_timer `system_timer`] or [link boost_asio.reference.high_resolution_timer `high_resolution_timer`] typedefs.
52078
52079
52080 [heading Remarks]
52081       
52082 This waitable timer functionality is for use with the C++11 standard library's `<chrono>` facility, or with the Boost.Chrono library.
52083
52084
52085 [heading Thread Safety]
52086   
52087 ['Distinct] ['objects:] Safe.
52088
52089 ['Shared] ['objects:] Unsafe.
52090
52091
52092 [heading Examples]
52093   
52094 Performing a blocking wait (C++11): 
52095
52096    // Construct a timer without setting an expiry time.
52097    boost::asio::steady_timer timer(my_context);
52098
52099    // Set an expiry time relative to now.
52100    timer.expires_after(std::chrono::seconds(5));
52101
52102    // Wait for the timer to expire.
52103    timer.wait();
52104
52105
52106
52107
52108
52109 Performing an asynchronous wait (C++11): 
52110
52111    void handler(const boost::system::error_code& error)
52112    {
52113      if (!error)
52114      {
52115        // Timer expired.
52116      }
52117    }
52118
52119    ...
52120
52121    // Construct a timer with an absolute expiry time.
52122    boost::asio::steady_timer timer(my_context,
52123        std::chrono::steady_clock::now() + std::chrono::seconds(60));
52124
52125    // Start an asynchronous wait.
52126    timer.async_wait(handler);
52127
52128
52129
52130
52131
52132 [heading Changing an active waitable timer's expiry time]
52133   
52134
52135
52136 Changing the expiry time of a timer while there are pending asynchronous waits causes those wait operations to be cancelled. To ensure that the action associated with the timer is performed only once, use something like this: used:
52137
52138
52139
52140    void on_some_event()
52141    {
52142      if (my_timer.expires_after(seconds(5)) > 0)
52143      {
52144        // We managed to cancel the timer. Start new asynchronous wait.
52145        my_timer.async_wait(on_timeout);
52146      }
52147      else
52148      {
52149        // Too late, timer has already expired!
52150      }
52151    }
52152
52153    void on_timeout(const boost::system::error_code& e)
52154    {
52155      if (e != boost::asio::error::operation_aborted)
52156      {
52157        // Timer was not cancelled, take necessary action.
52158      }
52159    }
52160
52161
52162
52163
52164
52165 * The `boost::asio::basic_waitable_timer::expires_after()` function cancels any pending asynchronous waits, and returns the number of asynchronous waits that were cancelled. If it returns 0 then you were too late and the wait handler has already been executed, or will soon be executed. If it returns 1 then the wait handler was successfully cancelled.
52166
52167
52168 * If a wait handler is cancelled, the boost::system::error\_code passed to it contains the value `boost::asio::error::operation_aborted`. 
52169
52170
52171
52172
52173 [heading Requirements]
52174
52175 ['Header: ][^boost/asio/basic_waitable_timer.hpp]
52176
52177 ['Convenience header: ][^boost/asio.hpp]
52178
52179
52180 [endsect]
52181
52182
52183
52184 [endsect]
52185
52186 [section:basic_yield_context basic_yield_context]
52187
52188
52189 Context object the represents the currently executing coroutine. 
52190
52191
52192   template<
52193       typename ``[link boost_asio.reference.Handler Handler]``>
52194   class basic_yield_context
52195
52196
52197 [heading Types]
52198 [table
52199   [[Name][Description]]
52200
52201   [
52202
52203     [[link boost_asio.reference.basic_yield_context.callee_type [*callee_type]]]
52204     [The coroutine callee type, used by the implementation. ]
52205   
52206   ]
52207
52208   [
52209
52210     [[link boost_asio.reference.basic_yield_context.caller_type [*caller_type]]]
52211     [The coroutine caller type, used by the implementation. ]
52212   
52213   ]
52214
52215 ]
52216
52217 [heading Member Functions]
52218 [table
52219   [[Name][Description]]
52220
52221   [
52222     [[link boost_asio.reference.basic_yield_context.basic_yield_context [*basic_yield_context]]]
52223     [Construct a yield context to represent the specified coroutine. 
52224      [hr]
52225      Construct a yield context from another yield context type. ]
52226   ]
52227   
52228   [
52229     [[link boost_asio.reference.basic_yield_context.operator_lb__rb_ [*operator\[\]]]]
52230     [Return a yield context that sets the specified error_code. ]
52231   ]
52232   
52233 ]
52234
52235 The [link boost_asio.reference.basic_yield_context `basic_yield_context`] class is used to represent the currently executing stackful coroutine. A [link boost_asio.reference.basic_yield_context `basic_yield_context`] may be passed as a handler to an asynchronous operation. For example:
52236
52237
52238
52239    template <typename Handler>
52240    void my_coroutine(basic_yield_context<Handler> yield)
52241    {
52242      ...
52243      std::size_t n = my_socket.async_read_some(buffer, yield);
52244      ...
52245    } 
52246
52247
52248
52249
52250 The initiating function (async\_read\_some in the above example) suspends the current coroutine. The coroutine is resumed when the asynchronous operation completes, and the result of the operation is returned. 
52251
52252 [heading Requirements]
52253
52254 ['Header: ][^boost/asio/spawn.hpp]
52255
52256 ['Convenience header: ]None
52257
52258 [section:basic_yield_context basic_yield_context::basic_yield_context]
52259
52260 [indexterm2 boost_asio.indexterm.basic_yield_context.basic_yield_context..basic_yield_context..basic_yield_context] 
52261 Construct a yield context to represent the specified coroutine. 
52262
52263
52264   ``[link boost_asio.reference.basic_yield_context.basic_yield_context.overload1 basic_yield_context]``(
52265       const detail::weak_ptr< callee_type > & coro,
52266       caller_type & ca,
52267       Handler & handler);
52268   ``  [''''&raquo;''' [link boost_asio.reference.basic_yield_context.basic_yield_context.overload1 more...]]``
52269
52270
52271 Construct a yield context from another yield context type. 
52272
52273
52274   template<
52275       typename OtherHandler>
52276   ``[link boost_asio.reference.basic_yield_context.basic_yield_context.overload2 basic_yield_context]``(
52277       const basic_yield_context< OtherHandler > & other);
52278   ``  [''''&raquo;''' [link boost_asio.reference.basic_yield_context.basic_yield_context.overload2 more...]]``
52279
52280
52281 [section:overload1 basic_yield_context::basic_yield_context (1 of 2 overloads)]
52282
52283
52284 Construct a yield context to represent the specified coroutine. 
52285
52286
52287   basic_yield_context(
52288       const detail::weak_ptr< callee_type > & coro,
52289       caller_type & ca,
52290       Handler & handler);
52291
52292
52293 Most applications do not need to use this constructor. Instead, the `spawn()` function passes a yield context as an argument to the coroutine function. 
52294
52295
52296 [endsect]
52297
52298
52299
52300 [section:overload2 basic_yield_context::basic_yield_context (2 of 2 overloads)]
52301
52302
52303 Construct a yield context from another yield context type. 
52304
52305
52306   template<
52307       typename OtherHandler>
52308   basic_yield_context(
52309       const basic_yield_context< OtherHandler > & other);
52310
52311
52312 Requires that OtherHandler be convertible to Handler. 
52313
52314
52315 [endsect]
52316
52317
52318 [endsect]
52319
52320
52321 [section:callee_type basic_yield_context::callee_type]
52322
52323 [indexterm2 boost_asio.indexterm.basic_yield_context.callee_type..callee_type..basic_yield_context] 
52324 The coroutine callee type, used by the implementation. 
52325
52326
52327   typedef implementation_defined callee_type;
52328
52329
52330
52331 When using Boost.Coroutine v1, this type is: 
52332
52333    typename coroutine<void()> 
52334
52335
52336 When using Boost.Coroutine v2 (unidirectional coroutines), this type is: 
52337
52338    push_coroutine<void> 
52339
52340
52341
52342
52343 [heading Requirements]
52344
52345 ['Header: ][^boost/asio/spawn.hpp]
52346
52347 ['Convenience header: ]None
52348
52349
52350 [endsect]
52351
52352
52353
52354 [section:caller_type basic_yield_context::caller_type]
52355
52356 [indexterm2 boost_asio.indexterm.basic_yield_context.caller_type..caller_type..basic_yield_context] 
52357 The coroutine caller type, used by the implementation. 
52358
52359
52360   typedef implementation_defined caller_type;
52361
52362
52363
52364 When using Boost.Coroutine v1, this type is: 
52365
52366    typename coroutine<void()>::caller_type 
52367
52368
52369 When using Boost.Coroutine v2 (unidirectional coroutines), this type is: 
52370
52371    pull_coroutine<void> 
52372
52373
52374
52375
52376 [heading Requirements]
52377
52378 ['Header: ][^boost/asio/spawn.hpp]
52379
52380 ['Convenience header: ]None
52381
52382
52383 [endsect]
52384
52385
52386
52387 [section:operator_lb__rb_ basic_yield_context::operator\[\]]
52388
52389 [indexterm2 boost_asio.indexterm.basic_yield_context.operator_lb__rb_..operator\[\]..basic_yield_context] 
52390 Return a yield context that sets the specified error\_code. 
52391
52392
52393   basic_yield_context operator[](
52394       boost::system::error_code & ec) const;
52395
52396
52397 By default, when a yield context is used with an asynchronous operation, a non-success error\_code is converted to system\_error and thrown. This operator may be used to specify an error\_code object that should instead be set with the asynchronous operation's result. For example:
52398
52399
52400
52401    template <typename Handler>
52402    void my_coroutine(basic_yield_context<Handler> yield)
52403    {
52404      ...
52405      std::size_t n = my_socket.async_read_some(buffer, yield[ec]);
52406      if (ec)
52407      {
52408        // An error occurred.
52409      }
52410      ...
52411    } 
52412
52413
52414
52415
52416
52417 [endsect]
52418
52419
52420
52421 [endsect]
52422
52423 [section:bind_executor bind_executor]
52424
52425 [indexterm1 boost_asio.indexterm.bind_executor..bind_executor] 
52426 Associate an object of type `T` with an executor of type `Executor`. 
52427
52428   template<
52429       typename ``[link boost_asio.reference.Executor1 Executor]``,
52430       typename T>
52431   executor_binder< typename decay< T >::type, Executor > ``[link boost_asio.reference.bind_executor.overload1 bind_executor]``(
52432       const Executor & ex,
52433       T && t,
52434       typename enable_if< is_executor< Executor >::value >::type *  = 0);
52435   ``  [''''&raquo;''' [link boost_asio.reference.bind_executor.overload1 more...]]``
52436
52437 Associate an object of type `T` with an execution context's executor. 
52438
52439   template<
52440       typename ExecutionContext,
52441       typename T>
52442   executor_binder< typename decay< T >::type, typename ExecutionContext::executor_type > ``[link boost_asio.reference.bind_executor.overload2 bind_executor]``(
52443       ExecutionContext & ctx,
52444       T && t,
52445       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
52446   ``  [''''&raquo;''' [link boost_asio.reference.bind_executor.overload2 more...]]``
52447
52448 [heading Requirements]
52449
52450 ['Header: ][^boost/asio/bind_executor.hpp]
52451
52452 ['Convenience header: ][^boost/asio.hpp]
52453
52454
52455 [section:overload1 bind_executor (1 of 2 overloads)]
52456
52457
52458 Associate an object of type `T` with an executor of type `Executor`. 
52459
52460
52461   template<
52462       typename ``[link boost_asio.reference.Executor1 Executor]``,
52463       typename T>
52464   executor_binder< typename decay< T >::type, Executor > bind_executor(
52465       const Executor & ex,
52466       T && t,
52467       typename enable_if< is_executor< Executor >::value >::type *  = 0);
52468
52469
52470
52471 [endsect]
52472
52473
52474
52475 [section:overload2 bind_executor (2 of 2 overloads)]
52476
52477
52478 Associate an object of type `T` with an execution context's executor. 
52479
52480
52481   template<
52482       typename ExecutionContext,
52483       typename T>
52484   executor_binder< typename decay< T >::type, typename ExecutionContext::executor_type > bind_executor(
52485       ExecutionContext & ctx,
52486       T && t,
52487       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
52488
52489
52490
52491 [endsect]
52492
52493
52494 [endsect]
52495
52496 [section:buffer buffer]
52497
52498 [indexterm1 boost_asio.indexterm.buffer..buffer] 
52499 The `boost::asio::buffer` function is used to create a buffer object to represent raw memory, an array of POD elements, a vector of POD elements, or a std::string. 
52500
52501
52502 Create a new modifiable buffer from an existing buffer. 
52503
52504   mutable_buffer ``[link boost_asio.reference.buffer.overload1 buffer]``(
52505       const mutable_buffer & b);
52506   ``  [''''&raquo;''' [link boost_asio.reference.buffer.overload1 more...]]``
52507
52508   mutable_buffer ``[link boost_asio.reference.buffer.overload2 buffer]``(
52509       const mutable_buffer & b,
52510       std::size_t max_size_in_bytes);
52511   ``  [''''&raquo;''' [link boost_asio.reference.buffer.overload2 more...]]``
52512
52513 Create a new non-modifiable buffer from an existing buffer. 
52514
52515   const_buffer ``[link boost_asio.reference.buffer.overload3 buffer]``(
52516       const const_buffer & b);
52517   ``  [''''&raquo;''' [link boost_asio.reference.buffer.overload3 more...]]``
52518
52519   const_buffer ``[link boost_asio.reference.buffer.overload4 buffer]``(
52520       const const_buffer & b,
52521       std::size_t max_size_in_bytes);
52522   ``  [''''&raquo;''' [link boost_asio.reference.buffer.overload4 more...]]``
52523
52524 Create a new modifiable buffer that represents the given memory range. 
52525
52526   mutable_buffer ``[link boost_asio.reference.buffer.overload5 buffer]``(
52527       void * data,
52528       std::size_t size_in_bytes);
52529   ``  [''''&raquo;''' [link boost_asio.reference.buffer.overload5 more...]]``
52530
52531 Create a new non-modifiable buffer that represents the given memory range. 
52532
52533   const_buffer ``[link boost_asio.reference.buffer.overload6 buffer]``(
52534       const void * data,
52535       std::size_t size_in_bytes);
52536   ``  [''''&raquo;''' [link boost_asio.reference.buffer.overload6 more...]]``
52537
52538 Create a new modifiable buffer that represents the given POD array. 
52539
52540   template<
52541       typename PodType,
52542       std::size_t N>
52543   mutable_buffer ``[link boost_asio.reference.buffer.overload7 buffer]``(
52544       PodType (&data)[N]);
52545   ``  [''''&raquo;''' [link boost_asio.reference.buffer.overload7 more...]]``
52546
52547   template<
52548       typename PodType,
52549       std::size_t N>
52550   mutable_buffer ``[link boost_asio.reference.buffer.overload8 buffer]``(
52551       PodType (&data)[N],
52552       std::size_t max_size_in_bytes);
52553   ``  [''''&raquo;''' [link boost_asio.reference.buffer.overload8 more...]]``
52554
52555 Create a new non-modifiable buffer that represents the given POD array. 
52556
52557   template<
52558       typename PodType,
52559       std::size_t N>
52560   const_buffer ``[link boost_asio.reference.buffer.overload9 buffer]``(
52561       const PodType (&data)[N]);
52562   ``  [''''&raquo;''' [link boost_asio.reference.buffer.overload9 more...]]``
52563
52564   template<
52565       typename PodType,
52566       std::size_t N>
52567   const_buffer ``[link boost_asio.reference.buffer.overload10 buffer]``(
52568       const PodType (&data)[N],
52569       std::size_t max_size_in_bytes);
52570   ``  [''''&raquo;''' [link boost_asio.reference.buffer.overload10 more...]]``
52571
52572 Create a new modifiable buffer that represents the given POD array. 
52573
52574   template<
52575       typename PodType,
52576       std::size_t N>
52577   mutable_buffer ``[link boost_asio.reference.buffer.overload11 buffer]``(
52578       boost::array< PodType, N > & data);
52579   ``  [''''&raquo;''' [link boost_asio.reference.buffer.overload11 more...]]``
52580
52581   template<
52582       typename PodType,
52583       std::size_t N>
52584   mutable_buffer ``[link boost_asio.reference.buffer.overload12 buffer]``(
52585       boost::array< PodType, N > & data,
52586       std::size_t max_size_in_bytes);
52587   ``  [''''&raquo;''' [link boost_asio.reference.buffer.overload12 more...]]``
52588
52589 Create a new non-modifiable buffer that represents the given POD array. 
52590
52591   template<
52592       typename PodType,
52593       std::size_t N>
52594   const_buffer ``[link boost_asio.reference.buffer.overload13 buffer]``(
52595       boost::array< const PodType, N > & data);
52596   ``  [''''&raquo;''' [link boost_asio.reference.buffer.overload13 more...]]``
52597
52598   template<
52599       typename PodType,
52600       std::size_t N>
52601   const_buffer ``[link boost_asio.reference.buffer.overload14 buffer]``(
52602       boost::array< const PodType, N > & data,
52603       std::size_t max_size_in_bytes);
52604   ``  [''''&raquo;''' [link boost_asio.reference.buffer.overload14 more...]]``
52605
52606   template<
52607       typename PodType,
52608       std::size_t N>
52609   const_buffer ``[link boost_asio.reference.buffer.overload15 buffer]``(
52610       const boost::array< PodType, N > & data);
52611   ``  [''''&raquo;''' [link boost_asio.reference.buffer.overload15 more...]]``
52612
52613   template<
52614       typename PodType,
52615       std::size_t N>
52616   const_buffer ``[link boost_asio.reference.buffer.overload16 buffer]``(
52617       const boost::array< PodType, N > & data,
52618       std::size_t max_size_in_bytes);
52619   ``  [''''&raquo;''' [link boost_asio.reference.buffer.overload16 more...]]``
52620
52621 Create a new modifiable buffer that represents the given POD array. 
52622
52623   template<
52624       typename PodType,
52625       std::size_t N>
52626   mutable_buffer ``[link boost_asio.reference.buffer.overload17 buffer]``(
52627       std::array< PodType, N > & data);
52628   ``  [''''&raquo;''' [link boost_asio.reference.buffer.overload17 more...]]``
52629
52630   template<
52631       typename PodType,
52632       std::size_t N>
52633   mutable_buffer ``[link boost_asio.reference.buffer.overload18 buffer]``(
52634       std::array< PodType, N > & data,
52635       std::size_t max_size_in_bytes);
52636   ``  [''''&raquo;''' [link boost_asio.reference.buffer.overload18 more...]]``
52637
52638 Create a new non-modifiable buffer that represents the given POD array. 
52639
52640   template<
52641       typename PodType,
52642       std::size_t N>
52643   const_buffer ``[link boost_asio.reference.buffer.overload19 buffer]``(
52644       std::array< const PodType, N > & data);
52645   ``  [''''&raquo;''' [link boost_asio.reference.buffer.overload19 more...]]``
52646
52647   template<
52648       typename PodType,
52649       std::size_t N>
52650   const_buffer ``[link boost_asio.reference.buffer.overload20 buffer]``(
52651       std::array< const PodType, N > & data,
52652       std::size_t max_size_in_bytes);
52653   ``  [''''&raquo;''' [link boost_asio.reference.buffer.overload20 more...]]``
52654
52655   template<
52656       typename PodType,
52657       std::size_t N>
52658   const_buffer ``[link boost_asio.reference.buffer.overload21 buffer]``(
52659       const std::array< PodType, N > & data);
52660   ``  [''''&raquo;''' [link boost_asio.reference.buffer.overload21 more...]]``
52661
52662   template<
52663       typename PodType,
52664       std::size_t N>
52665   const_buffer ``[link boost_asio.reference.buffer.overload22 buffer]``(
52666       const std::array< PodType, N > & data,
52667       std::size_t max_size_in_bytes);
52668   ``  [''''&raquo;''' [link boost_asio.reference.buffer.overload22 more...]]``
52669
52670 Create a new modifiable buffer that represents the given POD vector. 
52671
52672   template<
52673       typename PodType,
52674       typename Allocator>
52675   mutable_buffer ``[link boost_asio.reference.buffer.overload23 buffer]``(
52676       std::vector< PodType, Allocator > & data);
52677   ``  [''''&raquo;''' [link boost_asio.reference.buffer.overload23 more...]]``
52678
52679   template<
52680       typename PodType,
52681       typename Allocator>
52682   mutable_buffer ``[link boost_asio.reference.buffer.overload24 buffer]``(
52683       std::vector< PodType, Allocator > & data,
52684       std::size_t max_size_in_bytes);
52685   ``  [''''&raquo;''' [link boost_asio.reference.buffer.overload24 more...]]``
52686
52687 Create a new non-modifiable buffer that represents the given POD vector. 
52688
52689   template<
52690       typename PodType,
52691       typename Allocator>
52692   const_buffer ``[link boost_asio.reference.buffer.overload25 buffer]``(
52693       const std::vector< PodType, Allocator > & data);
52694   ``  [''''&raquo;''' [link boost_asio.reference.buffer.overload25 more...]]``
52695
52696   template<
52697       typename PodType,
52698       typename Allocator>
52699   const_buffer ``[link boost_asio.reference.buffer.overload26 buffer]``(
52700       const std::vector< PodType, Allocator > & data,
52701       std::size_t max_size_in_bytes);
52702   ``  [''''&raquo;''' [link boost_asio.reference.buffer.overload26 more...]]``
52703
52704 Create a new modifiable buffer that represents the given string. 
52705
52706   template<
52707       typename Elem,
52708       typename Traits,
52709       typename Allocator>
52710   mutable_buffer ``[link boost_asio.reference.buffer.overload27 buffer]``(
52711       std::basic_string< Elem, Traits, Allocator > & data);
52712   ``  [''''&raquo;''' [link boost_asio.reference.buffer.overload27 more...]]``
52713
52714   template<
52715       typename Elem,
52716       typename Traits,
52717       typename Allocator>
52718   mutable_buffer ``[link boost_asio.reference.buffer.overload28 buffer]``(
52719       std::basic_string< Elem, Traits, Allocator > & data,
52720       std::size_t max_size_in_bytes);
52721   ``  [''''&raquo;''' [link boost_asio.reference.buffer.overload28 more...]]``
52722
52723 Create a new non-modifiable buffer that represents the given string. 
52724
52725   template<
52726       typename Elem,
52727       typename Traits,
52728       typename Allocator>
52729   const_buffer ``[link boost_asio.reference.buffer.overload29 buffer]``(
52730       const std::basic_string< Elem, Traits, Allocator > & data);
52731   ``  [''''&raquo;''' [link boost_asio.reference.buffer.overload29 more...]]``
52732
52733   template<
52734       typename Elem,
52735       typename Traits,
52736       typename Allocator>
52737   const_buffer ``[link boost_asio.reference.buffer.overload30 buffer]``(
52738       const std::basic_string< Elem, Traits, Allocator > & data,
52739       std::size_t max_size_in_bytes);
52740   ``  [''''&raquo;''' [link boost_asio.reference.buffer.overload30 more...]]``
52741
52742 Create a new modifiable buffer that represents the given string\_view. 
52743
52744   template<
52745       typename Elem,
52746       typename Traits>
52747   const_buffer ``[link boost_asio.reference.buffer.overload31 buffer]``(
52748       basic_string_view< Elem, Traits > data);
52749   ``  [''''&raquo;''' [link boost_asio.reference.buffer.overload31 more...]]``
52750
52751 Create a new non-modifiable buffer that represents the given string. 
52752
52753   template<
52754       typename Elem,
52755       typename Traits>
52756   const_buffer ``[link boost_asio.reference.buffer.overload32 buffer]``(
52757       basic_string_view< Elem, Traits > data,
52758       std::size_t max_size_in_bytes);
52759   ``  [''''&raquo;''' [link boost_asio.reference.buffer.overload32 more...]]``
52760
52761 A buffer object represents a contiguous region of memory as a 2-tuple consisting of a pointer and size in bytes. A tuple of the form `{void*, size_t}` specifies a mutable (modifiable) region of memory. Similarly, a tuple of the form `{const void*, size_t}` specifies a const (non-modifiable) region of memory. These two forms correspond to the classes [link boost_asio.reference.mutable_buffer `mutable_buffer`] and [link boost_asio.reference.const_buffer `const_buffer`], respectively. To mirror C++'s conversion rules, a [link boost_asio.reference.mutable_buffer `mutable_buffer`] is implicitly convertible to a [link boost_asio.reference.const_buffer `const_buffer`], and the opposite conversion is not permitted.
52762
52763 The simplest use case involves reading or writing a single buffer of a specified size:
52764
52765
52766
52767    sock.send(boost::asio::buffer(data, size)); 
52768
52769
52770
52771
52772 In the above example, the return value of `boost::asio::buffer` meets the requirements of the ConstBufferSequence concept so that it may be directly passed to the socket's write function. A buffer created for modifiable memory also meets the requirements of the MutableBufferSequence concept.
52773
52774 An individual buffer may be created from a builtin array, std::vector, std::array or boost::array of POD elements. This helps prevent buffer overruns by automatically determining the size of the buffer:
52775
52776
52777
52778    char d1[128];
52779    size_t bytes_transferred = sock.receive(boost::asio::buffer(d1));
52780
52781    std::vector<char> d2(128);
52782    bytes_transferred = sock.receive(boost::asio::buffer(d2));
52783
52784    std::array<char, 128> d3;
52785    bytes_transferred = sock.receive(boost::asio::buffer(d3));
52786
52787    boost::array<char, 128> d4;
52788    bytes_transferred = sock.receive(boost::asio::buffer(d4)); 
52789
52790
52791
52792
52793 In all three cases above, the buffers created are exactly 128 bytes long. Note that a vector is ['never] automatically resized when creating or using a buffer. The buffer size is determined using the vector's `size()` member function, and not its capacity.
52794
52795
52796 [heading Accessing Buffer Contents]
52797   
52798
52799
52800 The contents of a buffer may be accessed using the `data()` and `size()` member functions:
52801
52802
52803
52804    boost::asio::mutable_buffer b1 = ...;
52805    std::size_t s1 = b1.size();
52806    unsigned char* p1 = static_cast<unsigned char*>(b1.data());
52807
52808    boost::asio::const_buffer b2 = ...;
52809    std::size_t s2 = b2.size();
52810    const void* p2 = b2.data(); 
52811
52812
52813
52814
52815 The `data()` member function permits violations of type safety, so uses of it in application code should be carefully considered.
52816
52817 For convenience, a [link boost_asio.reference.buffer_size `buffer_size`]  function is provided that works with both buffers and buffer sequences (that is, types meeting the ConstBufferSequence or MutableBufferSequence type requirements). In this case, the function returns the total size of all buffers in the sequence.
52818
52819
52820 [heading Buffer Copying]
52821   
52822
52823
52824 The [link boost_asio.reference.buffer_copy `buffer_copy`]  function may be used to copy raw bytes between individual buffers and buffer sequences.
52825
52826 In particular, when used with the [link boost_asio.reference.buffer_size `buffer_size`]  function, the [link boost_asio.reference.buffer_copy `buffer_copy`]  function can be used to linearise a sequence of buffers. For example:
52827
52828
52829
52830    vector<const_buffer> buffers = ...;
52831
52832    vector<unsigned char> data(boost::asio::buffer_size(buffers));
52833    boost::asio::buffer_copy(boost::asio::buffer(data), buffers); 
52834
52835
52836
52837
52838 Note that [link boost_asio.reference.buffer_copy `buffer_copy`]  is implemented in terms of `memcpy`, and consequently it cannot be used to copy between overlapping memory regions.
52839
52840
52841 [heading Buffer Invalidation]
52842   
52843
52844
52845 A buffer object does not have any ownership of the memory it refers to. It is the responsibility of the application to ensure the memory region remains valid until it is no longer required for an I/O operation. When the memory is no longer available, the buffer is said to have been invalidated.
52846
52847 For the `boost::asio::buffer` overloads that accept an argument of type std::vector, the buffer objects returned are invalidated by any vector operation that also invalidates all references, pointers and iterators referring to the elements in the sequence (C++ Std, 23.2.4)
52848
52849 For the `boost::asio::buffer` overloads that accept an argument of type std::basic\_string, the buffer objects returned are invalidated according to the rules defined for invalidation of references, pointers and iterators referring to elements of the sequence (C++ Std, 21.3).
52850
52851
52852 [heading Buffer Arithmetic]
52853   
52854
52855
52856 Buffer objects may be manipulated using simple arithmetic in a safe way which helps prevent buffer overruns. Consider an array initialised as follows:
52857
52858
52859
52860    boost::array<char, 6> a = { 'a', 'b', 'c', 'd', 'e' }; 
52861
52862
52863
52864
52865 A buffer object `b1` created using:
52866
52867
52868
52869    b1 = boost::asio::buffer(a); 
52870
52871
52872
52873
52874 represents the entire array, `{ 'a', 'b', 'c', 'd', 'e' }`. An optional second argument to the `boost::asio::buffer` function may be used to limit the size, in bytes, of the buffer:
52875
52876
52877
52878    b2 = boost::asio::buffer(a, 3); 
52879
52880
52881
52882
52883 such that `b2` represents the data `{ 'a', 'b', 'c' }`. Even if the size argument exceeds the actual size of the array, the size of the buffer object created will be limited to the array size.
52884
52885 An offset may be applied to an existing buffer to create a new one:
52886
52887
52888
52889    b3 = b1 + 2; 
52890
52891
52892
52893
52894 where `b3` will set to represent `{ 'c', 'd', 'e' }`. If the offset exceeds the size of the existing buffer, the newly created buffer will be empty.
52895
52896 Both an offset and size may be specified to create a buffer that corresponds to a specific range of bytes within an existing buffer:
52897
52898
52899
52900    b4 = boost::asio::buffer(b1 + 1, 3); 
52901
52902
52903
52904
52905 so that `b4` will refer to the bytes `{ 'b', 'c', 'd' }`.
52906
52907
52908 [heading Buffers and Scatter-Gather I/O]
52909   
52910
52911
52912 To read or write using multiple buffers (i.e. scatter-gather I/O), multiple buffer objects may be assigned into a container that supports the MutableBufferSequence (for read) or ConstBufferSequence (for write) concepts:
52913
52914
52915
52916    char d1[128];
52917    std::vector<char> d2(128);
52918    boost::array<char, 128> d3;
52919
52920    boost::array<mutable_buffer, 3> bufs1 = {
52921      boost::asio::buffer(d1),
52922      boost::asio::buffer(d2),
52923      boost::asio::buffer(d3) };
52924    bytes_transferred = sock.receive(bufs1);
52925
52926    std::vector<const_buffer> bufs2;
52927    bufs2.push_back(boost::asio::buffer(d1));
52928    bufs2.push_back(boost::asio::buffer(d2));
52929    bufs2.push_back(boost::asio::buffer(d3));
52930    bytes_transferred = sock.send(bufs2); 
52931
52932
52933
52934
52935 [heading Requirements]
52936
52937 ['Header: ][^boost/asio/buffer.hpp]
52938
52939 ['Convenience header: ][^boost/asio.hpp]
52940
52941
52942 [section:overload1 buffer (1 of 32 overloads)]
52943
52944
52945 Create a new modifiable buffer from an existing buffer. 
52946
52947
52948   mutable_buffer buffer(
52949       const mutable_buffer & b);
52950
52951
52952
52953 [heading Return Value]
52954       
52955 `mutable_buffer(b)`. 
52956
52957
52958
52959
52960 [endsect]
52961
52962
52963
52964 [section:overload2 buffer (2 of 32 overloads)]
52965
52966
52967 Create a new modifiable buffer from an existing buffer. 
52968
52969
52970   mutable_buffer buffer(
52971       const mutable_buffer & b,
52972       std::size_t max_size_in_bytes);
52973
52974
52975
52976 [heading Return Value]
52977       
52978 A [link boost_asio.reference.mutable_buffer `mutable_buffer`] value equivalent to: 
52979
52980    mutable_buffer(
52981        b.data(),
52982        min(b.size(), max_size_in_bytes)); 
52983
52984
52985
52986
52987
52988
52989
52990 [endsect]
52991
52992
52993
52994 [section:overload3 buffer (3 of 32 overloads)]
52995
52996
52997 Create a new non-modifiable buffer from an existing buffer. 
52998
52999
53000   const_buffer buffer(
53001       const const_buffer & b);
53002
53003
53004
53005 [heading Return Value]
53006       
53007 `const_buffer(b)`. 
53008
53009
53010
53011
53012 [endsect]
53013
53014
53015
53016 [section:overload4 buffer (4 of 32 overloads)]
53017
53018
53019 Create a new non-modifiable buffer from an existing buffer. 
53020
53021
53022   const_buffer buffer(
53023       const const_buffer & b,
53024       std::size_t max_size_in_bytes);
53025
53026
53027
53028 [heading Return Value]
53029       
53030 A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to: 
53031
53032    const_buffer(
53033        b.data(),
53034        min(b.size(), max_size_in_bytes)); 
53035
53036
53037
53038
53039
53040
53041
53042 [endsect]
53043
53044
53045
53046 [section:overload5 buffer (5 of 32 overloads)]
53047
53048
53049 Create a new modifiable buffer that represents the given memory range. 
53050
53051
53052   mutable_buffer buffer(
53053       void * data,
53054       std::size_t size_in_bytes);
53055
53056
53057
53058 [heading Return Value]
53059       
53060 `mutable_buffer(data, size_in_bytes)`. 
53061
53062
53063
53064
53065 [endsect]
53066
53067
53068
53069 [section:overload6 buffer (6 of 32 overloads)]
53070
53071
53072 Create a new non-modifiable buffer that represents the given memory range. 
53073
53074
53075   const_buffer buffer(
53076       const void * data,
53077       std::size_t size_in_bytes);
53078
53079
53080
53081 [heading Return Value]
53082       
53083 `const_buffer(data, size_in_bytes)`. 
53084
53085
53086
53087
53088 [endsect]
53089
53090
53091
53092 [section:overload7 buffer (7 of 32 overloads)]
53093
53094
53095 Create a new modifiable buffer that represents the given POD array. 
53096
53097
53098   template<
53099       typename PodType,
53100       std::size_t N>
53101   mutable_buffer buffer(
53102       PodType (&data)[N]);
53103
53104
53105
53106 [heading Return Value]
53107       
53108 A [link boost_asio.reference.mutable_buffer `mutable_buffer`] value equivalent to: 
53109
53110    mutable_buffer(
53111        static_cast<void*>(data),
53112        N * sizeof(PodType)); 
53113
53114
53115
53116
53117
53118
53119
53120 [endsect]
53121
53122
53123
53124 [section:overload8 buffer (8 of 32 overloads)]
53125
53126
53127 Create a new modifiable buffer that represents the given POD array. 
53128
53129
53130   template<
53131       typename PodType,
53132       std::size_t N>
53133   mutable_buffer buffer(
53134       PodType (&data)[N],
53135       std::size_t max_size_in_bytes);
53136
53137
53138
53139 [heading Return Value]
53140       
53141 A [link boost_asio.reference.mutable_buffer `mutable_buffer`] value equivalent to: 
53142
53143    mutable_buffer(
53144        static_cast<void*>(data),
53145        min(N * sizeof(PodType), max_size_in_bytes)); 
53146
53147
53148
53149
53150
53151
53152
53153 [endsect]
53154
53155
53156
53157 [section:overload9 buffer (9 of 32 overloads)]
53158
53159
53160 Create a new non-modifiable buffer that represents the given POD array. 
53161
53162
53163   template<
53164       typename PodType,
53165       std::size_t N>
53166   const_buffer buffer(
53167       const PodType (&data)[N]);
53168
53169
53170
53171 [heading Return Value]
53172       
53173 A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to: 
53174
53175    const_buffer(
53176        static_cast<const void*>(data),
53177        N * sizeof(PodType)); 
53178
53179
53180
53181
53182
53183
53184
53185 [endsect]
53186
53187
53188
53189 [section:overload10 buffer (10 of 32 overloads)]
53190
53191
53192 Create a new non-modifiable buffer that represents the given POD array. 
53193
53194
53195   template<
53196       typename PodType,
53197       std::size_t N>
53198   const_buffer buffer(
53199       const PodType (&data)[N],
53200       std::size_t max_size_in_bytes);
53201
53202
53203
53204 [heading Return Value]
53205       
53206 A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to: 
53207
53208    const_buffer(
53209        static_cast<const void*>(data),
53210        min(N * sizeof(PodType), max_size_in_bytes)); 
53211
53212
53213
53214
53215
53216
53217
53218 [endsect]
53219
53220
53221
53222 [section:overload11 buffer (11 of 32 overloads)]
53223
53224
53225 Create a new modifiable buffer that represents the given POD array. 
53226
53227
53228   template<
53229       typename PodType,
53230       std::size_t N>
53231   mutable_buffer buffer(
53232       boost::array< PodType, N > & data);
53233
53234
53235
53236 [heading Return Value]
53237       
53238 A [link boost_asio.reference.mutable_buffer `mutable_buffer`] value equivalent to: 
53239
53240    mutable_buffer(
53241        data.data(),
53242        data.size() * sizeof(PodType)); 
53243
53244
53245
53246
53247
53248
53249
53250 [endsect]
53251
53252
53253
53254 [section:overload12 buffer (12 of 32 overloads)]
53255
53256
53257 Create a new modifiable buffer that represents the given POD array. 
53258
53259
53260   template<
53261       typename PodType,
53262       std::size_t N>
53263   mutable_buffer buffer(
53264       boost::array< PodType, N > & data,
53265       std::size_t max_size_in_bytes);
53266
53267
53268
53269 [heading Return Value]
53270       
53271 A [link boost_asio.reference.mutable_buffer `mutable_buffer`] value equivalent to: 
53272
53273    mutable_buffer(
53274        data.data(),
53275        min(data.size() * sizeof(PodType), max_size_in_bytes)); 
53276
53277
53278
53279
53280
53281
53282
53283 [endsect]
53284
53285
53286
53287 [section:overload13 buffer (13 of 32 overloads)]
53288
53289
53290 Create a new non-modifiable buffer that represents the given POD array. 
53291
53292
53293   template<
53294       typename PodType,
53295       std::size_t N>
53296   const_buffer buffer(
53297       boost::array< const PodType, N > & data);
53298
53299
53300
53301 [heading Return Value]
53302       
53303 A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to: 
53304
53305    const_buffer(
53306        data.data(),
53307        data.size() * sizeof(PodType)); 
53308
53309
53310
53311
53312
53313
53314
53315 [endsect]
53316
53317
53318
53319 [section:overload14 buffer (14 of 32 overloads)]
53320
53321
53322 Create a new non-modifiable buffer that represents the given POD array. 
53323
53324
53325   template<
53326       typename PodType,
53327       std::size_t N>
53328   const_buffer buffer(
53329       boost::array< const PodType, N > & data,
53330       std::size_t max_size_in_bytes);
53331
53332
53333
53334 [heading Return Value]
53335       
53336 A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to: 
53337
53338    const_buffer(
53339        data.data(),
53340        min(data.size() * sizeof(PodType), max_size_in_bytes)); 
53341
53342
53343
53344
53345
53346
53347
53348 [endsect]
53349
53350
53351
53352 [section:overload15 buffer (15 of 32 overloads)]
53353
53354
53355 Create a new non-modifiable buffer that represents the given POD array. 
53356
53357
53358   template<
53359       typename PodType,
53360       std::size_t N>
53361   const_buffer buffer(
53362       const boost::array< PodType, N > & data);
53363
53364
53365
53366 [heading Return Value]
53367       
53368 A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to: 
53369
53370    const_buffer(
53371        data.data(),
53372        data.size() * sizeof(PodType)); 
53373
53374
53375
53376
53377
53378
53379
53380 [endsect]
53381
53382
53383
53384 [section:overload16 buffer (16 of 32 overloads)]
53385
53386
53387 Create a new non-modifiable buffer that represents the given POD array. 
53388
53389
53390   template<
53391       typename PodType,
53392       std::size_t N>
53393   const_buffer buffer(
53394       const boost::array< PodType, N > & data,
53395       std::size_t max_size_in_bytes);
53396
53397
53398
53399 [heading Return Value]
53400       
53401 A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to: 
53402
53403    const_buffer(
53404        data.data(),
53405        min(data.size() * sizeof(PodType), max_size_in_bytes)); 
53406
53407
53408
53409
53410
53411
53412
53413 [endsect]
53414
53415
53416
53417 [section:overload17 buffer (17 of 32 overloads)]
53418
53419
53420 Create a new modifiable buffer that represents the given POD array. 
53421
53422
53423   template<
53424       typename PodType,
53425       std::size_t N>
53426   mutable_buffer buffer(
53427       std::array< PodType, N > & data);
53428
53429
53430
53431 [heading Return Value]
53432       
53433 A [link boost_asio.reference.mutable_buffer `mutable_buffer`] value equivalent to: 
53434
53435    mutable_buffer(
53436        data.data(),
53437        data.size() * sizeof(PodType)); 
53438
53439
53440
53441
53442
53443
53444
53445 [endsect]
53446
53447
53448
53449 [section:overload18 buffer (18 of 32 overloads)]
53450
53451
53452 Create a new modifiable buffer that represents the given POD array. 
53453
53454
53455   template<
53456       typename PodType,
53457       std::size_t N>
53458   mutable_buffer buffer(
53459       std::array< PodType, N > & data,
53460       std::size_t max_size_in_bytes);
53461
53462
53463
53464 [heading Return Value]
53465       
53466 A [link boost_asio.reference.mutable_buffer `mutable_buffer`] value equivalent to: 
53467
53468    mutable_buffer(
53469        data.data(),
53470        min(data.size() * sizeof(PodType), max_size_in_bytes)); 
53471
53472
53473
53474
53475
53476
53477
53478 [endsect]
53479
53480
53481
53482 [section:overload19 buffer (19 of 32 overloads)]
53483
53484
53485 Create a new non-modifiable buffer that represents the given POD array. 
53486
53487
53488   template<
53489       typename PodType,
53490       std::size_t N>
53491   const_buffer buffer(
53492       std::array< const PodType, N > & data);
53493
53494
53495
53496 [heading Return Value]
53497       
53498 A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to: 
53499
53500    const_buffer(
53501        data.data(),
53502        data.size() * sizeof(PodType)); 
53503
53504
53505
53506
53507
53508
53509
53510 [endsect]
53511
53512
53513
53514 [section:overload20 buffer (20 of 32 overloads)]
53515
53516
53517 Create a new non-modifiable buffer that represents the given POD array. 
53518
53519
53520   template<
53521       typename PodType,
53522       std::size_t N>
53523   const_buffer buffer(
53524       std::array< const PodType, N > & data,
53525       std::size_t max_size_in_bytes);
53526
53527
53528
53529 [heading Return Value]
53530       
53531 A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to: 
53532
53533    const_buffer(
53534        data.data(),
53535        min(data.size() * sizeof(PodType), max_size_in_bytes)); 
53536
53537
53538
53539
53540
53541
53542
53543 [endsect]
53544
53545
53546
53547 [section:overload21 buffer (21 of 32 overloads)]
53548
53549
53550 Create a new non-modifiable buffer that represents the given POD array. 
53551
53552
53553   template<
53554       typename PodType,
53555       std::size_t N>
53556   const_buffer buffer(
53557       const std::array< PodType, N > & data);
53558
53559
53560
53561 [heading Return Value]
53562       
53563 A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to: 
53564
53565    const_buffer(
53566        data.data(),
53567        data.size() * sizeof(PodType)); 
53568
53569
53570
53571
53572
53573
53574
53575 [endsect]
53576
53577
53578
53579 [section:overload22 buffer (22 of 32 overloads)]
53580
53581
53582 Create a new non-modifiable buffer that represents the given POD array. 
53583
53584
53585   template<
53586       typename PodType,
53587       std::size_t N>
53588   const_buffer buffer(
53589       const std::array< PodType, N > & data,
53590       std::size_t max_size_in_bytes);
53591
53592
53593
53594 [heading Return Value]
53595       
53596 A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to: 
53597
53598    const_buffer(
53599        data.data(),
53600        min(data.size() * sizeof(PodType), max_size_in_bytes)); 
53601
53602
53603
53604
53605
53606
53607
53608 [endsect]
53609
53610
53611
53612 [section:overload23 buffer (23 of 32 overloads)]
53613
53614
53615 Create a new modifiable buffer that represents the given POD vector. 
53616
53617
53618   template<
53619       typename PodType,
53620       typename Allocator>
53621   mutable_buffer buffer(
53622       std::vector< PodType, Allocator > & data);
53623
53624
53625
53626 [heading Return Value]
53627       
53628 A [link boost_asio.reference.mutable_buffer `mutable_buffer`] value equivalent to: 
53629
53630    mutable_buffer(
53631        data.size() ? &data[0] : 0,
53632        data.size() * sizeof(PodType)); 
53633
53634
53635
53636
53637
53638 [heading Remarks]
53639       
53640 The buffer is invalidated by any vector operation that would also invalidate iterators. 
53641
53642
53643
53644
53645 [endsect]
53646
53647
53648
53649 [section:overload24 buffer (24 of 32 overloads)]
53650
53651
53652 Create a new modifiable buffer that represents the given POD vector. 
53653
53654
53655   template<
53656       typename PodType,
53657       typename Allocator>
53658   mutable_buffer buffer(
53659       std::vector< PodType, Allocator > & data,
53660       std::size_t max_size_in_bytes);
53661
53662
53663
53664 [heading Return Value]
53665       
53666 A [link boost_asio.reference.mutable_buffer `mutable_buffer`] value equivalent to: 
53667
53668    mutable_buffer(
53669        data.size() ? &data[0] : 0,
53670        min(data.size() * sizeof(PodType), max_size_in_bytes)); 
53671
53672
53673
53674
53675
53676 [heading Remarks]
53677       
53678 The buffer is invalidated by any vector operation that would also invalidate iterators. 
53679
53680
53681
53682
53683 [endsect]
53684
53685
53686
53687 [section:overload25 buffer (25 of 32 overloads)]
53688
53689
53690 Create a new non-modifiable buffer that represents the given POD vector. 
53691
53692
53693   template<
53694       typename PodType,
53695       typename Allocator>
53696   const_buffer buffer(
53697       const std::vector< PodType, Allocator > & data);
53698
53699
53700
53701 [heading Return Value]
53702       
53703 A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to: 
53704
53705    const_buffer(
53706        data.size() ? &data[0] : 0,
53707        data.size() * sizeof(PodType)); 
53708
53709
53710
53711
53712
53713 [heading Remarks]
53714       
53715 The buffer is invalidated by any vector operation that would also invalidate iterators. 
53716
53717
53718
53719
53720 [endsect]
53721
53722
53723
53724 [section:overload26 buffer (26 of 32 overloads)]
53725
53726
53727 Create a new non-modifiable buffer that represents the given POD vector. 
53728
53729
53730   template<
53731       typename PodType,
53732       typename Allocator>
53733   const_buffer buffer(
53734       const std::vector< PodType, Allocator > & data,
53735       std::size_t max_size_in_bytes);
53736
53737
53738
53739 [heading Return Value]
53740       
53741 A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to: 
53742
53743    const_buffer(
53744        data.size() ? &data[0] : 0,
53745        min(data.size() * sizeof(PodType), max_size_in_bytes)); 
53746
53747
53748
53749
53750
53751 [heading Remarks]
53752       
53753 The buffer is invalidated by any vector operation that would also invalidate iterators. 
53754
53755
53756
53757
53758 [endsect]
53759
53760
53761
53762 [section:overload27 buffer (27 of 32 overloads)]
53763
53764
53765 Create a new modifiable buffer that represents the given string. 
53766
53767
53768   template<
53769       typename Elem,
53770       typename Traits,
53771       typename Allocator>
53772   mutable_buffer buffer(
53773       std::basic_string< Elem, Traits, Allocator > & data);
53774
53775
53776
53777 [heading Return Value]
53778       
53779 `mutable_buffer(data.size() ? &data[0] : 0, data.size() * sizeof(Elem))`.
53780
53781
53782 [heading Remarks]
53783       
53784 The buffer is invalidated by any non-const operation called on the given string object. 
53785
53786
53787
53788
53789 [endsect]
53790
53791
53792
53793 [section:overload28 buffer (28 of 32 overloads)]
53794
53795
53796 Create a new modifiable buffer that represents the given string. 
53797
53798
53799   template<
53800       typename Elem,
53801       typename Traits,
53802       typename Allocator>
53803   mutable_buffer buffer(
53804       std::basic_string< Elem, Traits, Allocator > & data,
53805       std::size_t max_size_in_bytes);
53806
53807
53808
53809 [heading Return Value]
53810       
53811 A [link boost_asio.reference.mutable_buffer `mutable_buffer`] value equivalent to: 
53812
53813    mutable_buffer(
53814        data.size() ? &data[0] : 0,
53815        min(data.size() * sizeof(Elem), max_size_in_bytes)); 
53816
53817
53818
53819
53820
53821 [heading Remarks]
53822       
53823 The buffer is invalidated by any non-const operation called on the given string object. 
53824
53825
53826
53827
53828 [endsect]
53829
53830
53831
53832 [section:overload29 buffer (29 of 32 overloads)]
53833
53834
53835 Create a new non-modifiable buffer that represents the given string. 
53836
53837
53838   template<
53839       typename Elem,
53840       typename Traits,
53841       typename Allocator>
53842   const_buffer buffer(
53843       const std::basic_string< Elem, Traits, Allocator > & data);
53844
53845
53846
53847 [heading Return Value]
53848       
53849 `const_buffer(data.data(), data.size() * sizeof(Elem))`.
53850
53851
53852 [heading Remarks]
53853       
53854 The buffer is invalidated by any non-const operation called on the given string object. 
53855
53856
53857
53858
53859 [endsect]
53860
53861
53862
53863 [section:overload30 buffer (30 of 32 overloads)]
53864
53865
53866 Create a new non-modifiable buffer that represents the given string. 
53867
53868
53869   template<
53870       typename Elem,
53871       typename Traits,
53872       typename Allocator>
53873   const_buffer buffer(
53874       const std::basic_string< Elem, Traits, Allocator > & data,
53875       std::size_t max_size_in_bytes);
53876
53877
53878
53879 [heading Return Value]
53880       
53881 A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to: 
53882
53883    const_buffer(
53884        data.data(),
53885        min(data.size() * sizeof(Elem), max_size_in_bytes)); 
53886
53887
53888
53889
53890
53891 [heading Remarks]
53892       
53893 The buffer is invalidated by any non-const operation called on the given string object. 
53894
53895
53896
53897
53898 [endsect]
53899
53900
53901
53902 [section:overload31 buffer (31 of 32 overloads)]
53903
53904
53905 Create a new modifiable buffer that represents the given string\_view. 
53906
53907
53908   template<
53909       typename Elem,
53910       typename Traits>
53911   const_buffer buffer(
53912       basic_string_view< Elem, Traits > data);
53913
53914
53915
53916 [heading Return Value]
53917       
53918 `mutable_buffer(data.size() ? &data[0] : 0, data.size() * sizeof(Elem))`. 
53919
53920
53921
53922
53923 [endsect]
53924
53925
53926
53927 [section:overload32 buffer (32 of 32 overloads)]
53928
53929
53930 Create a new non-modifiable buffer that represents the given string. 
53931
53932
53933   template<
53934       typename Elem,
53935       typename Traits>
53936   const_buffer buffer(
53937       basic_string_view< Elem, Traits > data,
53938       std::size_t max_size_in_bytes);
53939
53940
53941
53942 [heading Return Value]
53943       
53944 A [link boost_asio.reference.mutable_buffer `mutable_buffer`] value equivalent to: 
53945
53946    mutable_buffer(
53947        data.size() ? &data[0] : 0,
53948        min(data.size() * sizeof(Elem), max_size_in_bytes)); 
53949
53950
53951
53952
53953
53954
53955
53956 [endsect]
53957
53958
53959 [endsect]
53960
53961 [section:buffer_cast buffer_cast]
53962
53963 [indexterm1 boost_asio.indexterm.buffer_cast..buffer_cast] 
53964 (Deprecated: Use the `data()` member function.) The `boost::asio::buffer_cast` function is used to obtain a pointer to the underlying memory region associated with a buffer. 
53965
53966
53967 Cast a non-modifiable buffer to a specified pointer to POD type. 
53968
53969   template<
53970       typename PointerToPodType>
53971   PointerToPodType ``[link boost_asio.reference.buffer_cast.overload1 buffer_cast]``(
53972       const mutable_buffer & b);
53973   ``  [''''&raquo;''' [link boost_asio.reference.buffer_cast.overload1 more...]]``
53974
53975   template<
53976       typename PointerToPodType>
53977   PointerToPodType ``[link boost_asio.reference.buffer_cast.overload2 buffer_cast]``(
53978       const const_buffer & b);
53979   ``  [''''&raquo;''' [link boost_asio.reference.buffer_cast.overload2 more...]]``
53980
53981
53982 [heading Examples:]
53983   
53984
53985
53986 To access the memory of a non-modifiable buffer, use: 
53987
53988    boost::asio::const_buffer b1 = ...;
53989    const unsigned char* p1 = boost::asio::buffer_cast<const unsigned char*>(b1);
53990
53991
53992
53993
53994 To access the memory of a modifiable buffer, use: 
53995
53996    boost::asio::mutable_buffer b2 = ...;
53997    unsigned char* p2 = boost::asio::buffer_cast<unsigned char*>(b2);
53998
53999
54000
54001
54002 The `boost::asio::buffer_cast` function permits violations of type safety, so uses of it in application code should be carefully considered. 
54003
54004 [heading Requirements]
54005
54006 ['Header: ][^boost/asio/buffer.hpp]
54007
54008 ['Convenience header: ][^boost/asio.hpp]
54009
54010
54011 [section:overload1 buffer_cast (1 of 2 overloads)]
54012
54013
54014 Cast a non-modifiable buffer to a specified pointer to POD type. 
54015
54016
54017   template<
54018       typename PointerToPodType>
54019   PointerToPodType buffer_cast(
54020       const mutable_buffer & b);
54021
54022
54023
54024 [endsect]
54025
54026
54027
54028 [section:overload2 buffer_cast (2 of 2 overloads)]
54029
54030
54031 Cast a non-modifiable buffer to a specified pointer to POD type. 
54032
54033
54034   template<
54035       typename PointerToPodType>
54036   PointerToPodType buffer_cast(
54037       const const_buffer & b);
54038
54039
54040
54041 [endsect]
54042
54043
54044 [endsect]
54045
54046 [section:buffer_copy buffer_copy]
54047
54048 [indexterm1 boost_asio.indexterm.buffer_copy..buffer_copy] 
54049 The `boost::asio::buffer_copy` function is used to copy bytes from a source buffer (or buffer sequence) to a target buffer (or buffer sequence). 
54050
54051
54052 Copies bytes from a source buffer sequence to a target buffer sequence. 
54053
54054   template<
54055       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
54056       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
54057   std::size_t ``[link boost_asio.reference.buffer_copy.overload1 buffer_copy]``(
54058       const MutableBufferSequence & target,
54059       const ConstBufferSequence & source);
54060   ``  [''''&raquo;''' [link boost_asio.reference.buffer_copy.overload1 more...]]``
54061
54062 Copies a limited number of bytes from a source buffer sequence to a target buffer sequence. 
54063
54064   template<
54065       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
54066       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
54067   std::size_t ``[link boost_asio.reference.buffer_copy.overload2 buffer_copy]``(
54068       const MutableBufferSequence & target,
54069       const ConstBufferSequence & source,
54070       std::size_t max_bytes_to_copy);
54071   ``  [''''&raquo;''' [link boost_asio.reference.buffer_copy.overload2 more...]]``
54072
54073 The `buffer_copy` function is available in two forms:
54074
54075
54076 * A 2-argument form: `buffer_copy(target, source)` 
54077
54078
54079 * A 3-argument form: `buffer_copy(target, source, max_bytes_to_copy)` 
54080
54081 Both forms return the number of bytes actually copied. The number of bytes copied is the lesser of:
54082
54083
54084 * `buffer_size(target)` 
54085
54086
54087 * `buffer_size(source)` 
54088
54089
54090 * `If` specified, `max_bytes_to_copy`.
54091
54092 This prevents buffer overflow, regardless of the buffer sizes used in the copy operation.
54093
54094 Note that [link boost_asio.reference.buffer_copy `buffer_copy`]  is implemented in terms of `memcpy`, and consequently it cannot be used to copy between overlapping memory regions. 
54095
54096 [heading Requirements]
54097
54098 ['Header: ][^boost/asio/buffer.hpp]
54099
54100 ['Convenience header: ][^boost/asio.hpp]
54101
54102
54103 [section:overload1 buffer_copy (1 of 2 overloads)]
54104
54105
54106 Copies bytes from a source buffer sequence to a target buffer sequence. 
54107
54108
54109   template<
54110       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
54111       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
54112   std::size_t buffer_copy(
54113       const MutableBufferSequence & target,
54114       const ConstBufferSequence & source);
54115
54116
54117
54118 [heading Parameters]
54119     
54120
54121 [variablelist
54122   
54123 [[target][A modifiable buffer sequence representing the memory regions to which the bytes will be copied.]]
54124
54125 [[source][A non-modifiable buffer sequence representing the memory regions from which the bytes will be copied.]]
54126
54127 ]
54128
54129
54130 [heading Return Value]
54131       
54132 The number of bytes copied.
54133
54134
54135 [heading Remarks]
54136       
54137 The number of bytes copied is the lesser of:
54138
54139
54140 * `buffer_size(target)` 
54141
54142
54143 * `buffer_size(source)` 
54144
54145 This function is implemented in terms of `memcpy`, and consequently it cannot be used to copy between overlapping memory regions. 
54146
54147
54148 [endsect]
54149
54150
54151
54152 [section:overload2 buffer_copy (2 of 2 overloads)]
54153
54154
54155 Copies a limited number of bytes from a source buffer sequence to a target buffer sequence. 
54156
54157
54158   template<
54159       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
54160       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
54161   std::size_t buffer_copy(
54162       const MutableBufferSequence & target,
54163       const ConstBufferSequence & source,
54164       std::size_t max_bytes_to_copy);
54165
54166
54167
54168 [heading Parameters]
54169     
54170
54171 [variablelist
54172   
54173 [[target][A modifiable buffer sequence representing the memory regions to which the bytes will be copied.]]
54174
54175 [[source][A non-modifiable buffer sequence representing the memory regions from which the bytes will be copied.]]
54176
54177 [[max_bytes_to_copy][The maximum number of bytes to be copied.]]
54178
54179 ]
54180
54181
54182 [heading Return Value]
54183       
54184 The number of bytes copied.
54185
54186
54187 [heading Remarks]
54188       
54189 The number of bytes copied is the lesser of:
54190
54191
54192 * `buffer_size(target)` 
54193
54194
54195 * `buffer_size(source)` 
54196
54197
54198 * `max_bytes_to_copy` 
54199
54200 This function is implemented in terms of `memcpy`, and consequently it cannot be used to copy between overlapping memory regions. 
54201
54202
54203 [endsect]
54204
54205
54206 [endsect]
54207
54208 [section:buffer_sequence_begin buffer_sequence_begin]
54209
54210 [indexterm1 boost_asio.indexterm.buffer_sequence_begin..buffer_sequence_begin] 
54211 The `boost::asio::buffer_sequence_begin` function returns an iterator pointing to the first element in a buffer sequence. 
54212
54213
54214 Get an iterator to the first element in a buffer sequence. 
54215
54216   template<
54217       typename MutableBuffer>
54218   const mutable_buffer * ``[link boost_asio.reference.buffer_sequence_begin.overload1 buffer_sequence_begin]``(
54219       const MutableBuffer & b,
54220       typename enable_if< is_convertible< const MutableBuffer *, const mutable_buffer * >::value >::type *  = 0);
54221   ``  [''''&raquo;''' [link boost_asio.reference.buffer_sequence_begin.overload1 more...]]``
54222
54223   template<
54224       typename ConstBuffer>
54225   const const_buffer * ``[link boost_asio.reference.buffer_sequence_begin.overload2 buffer_sequence_begin]``(
54226       const ConstBuffer & b,
54227       typename enable_if< is_convertible< const ConstBuffer *, const const_buffer * >::value >::type *  = 0);
54228   ``  [''''&raquo;''' [link boost_asio.reference.buffer_sequence_begin.overload2 more...]]``
54229
54230   template<
54231       typename C>
54232   auto ``[link boost_asio.reference.buffer_sequence_begin.overload3 buffer_sequence_begin]``(
54233       C & c,
54234       typename enable_if< !is_convertible< const C *, const mutable_buffer * >::value &&!is_convertible< const C *, const const_buffer * >::value >::type *  = 0);
54235   ``  [''''&raquo;''' [link boost_asio.reference.buffer_sequence_begin.overload3 more...]]``
54236
54237   template<
54238       typename C>
54239   auto ``[link boost_asio.reference.buffer_sequence_begin.overload4 buffer_sequence_begin]``(
54240       const C & c,
54241       typename enable_if< !is_convertible< const C *, const mutable_buffer * >::value &&!is_convertible< const C *, const const_buffer * >::value >::type *  = 0);
54242   ``  [''''&raquo;''' [link boost_asio.reference.buffer_sequence_begin.overload4 more...]]``
54243
54244 [heading Requirements]
54245
54246 ['Header: ][^boost/asio/buffer.hpp]
54247
54248 ['Convenience header: ][^boost/asio.hpp]
54249
54250
54251 [section:overload1 buffer_sequence_begin (1 of 4 overloads)]
54252
54253
54254 Get an iterator to the first element in a buffer sequence. 
54255
54256
54257   template<
54258       typename MutableBuffer>
54259   const mutable_buffer * buffer_sequence_begin(
54260       const MutableBuffer & b,
54261       typename enable_if< is_convertible< const MutableBuffer *, const mutable_buffer * >::value >::type *  = 0);
54262
54263
54264
54265 [endsect]
54266
54267
54268
54269 [section:overload2 buffer_sequence_begin (2 of 4 overloads)]
54270
54271
54272 Get an iterator to the first element in a buffer sequence. 
54273
54274
54275   template<
54276       typename ConstBuffer>
54277   const const_buffer * buffer_sequence_begin(
54278       const ConstBuffer & b,
54279       typename enable_if< is_convertible< const ConstBuffer *, const const_buffer * >::value >::type *  = 0);
54280
54281
54282
54283 [endsect]
54284
54285
54286
54287 [section:overload3 buffer_sequence_begin (3 of 4 overloads)]
54288
54289
54290 Get an iterator to the first element in a buffer sequence. 
54291
54292
54293   template<
54294       typename C>
54295   auto buffer_sequence_begin(
54296       C & c,
54297       typename enable_if< !is_convertible< const C *, const mutable_buffer * >::value &&!is_convertible< const C *, const const_buffer * >::value >::type *  = 0);
54298
54299
54300
54301 [endsect]
54302
54303
54304
54305 [section:overload4 buffer_sequence_begin (4 of 4 overloads)]
54306
54307
54308 Get an iterator to the first element in a buffer sequence. 
54309
54310
54311   template<
54312       typename C>
54313   auto buffer_sequence_begin(
54314       const C & c,
54315       typename enable_if< !is_convertible< const C *, const mutable_buffer * >::value &&!is_convertible< const C *, const const_buffer * >::value >::type *  = 0);
54316
54317
54318
54319 [endsect]
54320
54321
54322 [endsect]
54323
54324 [section:buffer_sequence_end buffer_sequence_end]
54325
54326 [indexterm1 boost_asio.indexterm.buffer_sequence_end..buffer_sequence_end] 
54327 The `boost::asio::buffer_sequence_end` function returns an iterator pointing to one past the end element in a buffer sequence. 
54328
54329
54330 Get an iterator to one past the end element in a buffer sequence. 
54331
54332   template<
54333       typename MutableBuffer>
54334   const mutable_buffer * ``[link boost_asio.reference.buffer_sequence_end.overload1 buffer_sequence_end]``(
54335       const MutableBuffer & b,
54336       typename enable_if< is_convertible< const MutableBuffer *, const mutable_buffer * >::value >::type *  = 0);
54337   ``  [''''&raquo;''' [link boost_asio.reference.buffer_sequence_end.overload1 more...]]``
54338
54339   template<
54340       typename ConstBuffer>
54341   const const_buffer * ``[link boost_asio.reference.buffer_sequence_end.overload2 buffer_sequence_end]``(
54342       const ConstBuffer & b,
54343       typename enable_if< is_convertible< const ConstBuffer *, const const_buffer * >::value >::type *  = 0);
54344   ``  [''''&raquo;''' [link boost_asio.reference.buffer_sequence_end.overload2 more...]]``
54345
54346   template<
54347       typename C>
54348   auto ``[link boost_asio.reference.buffer_sequence_end.overload3 buffer_sequence_end]``(
54349       C & c,
54350       typename enable_if< !is_convertible< const C *, const mutable_buffer * >::value &&!is_convertible< const C *, const const_buffer * >::value >::type *  = 0);
54351   ``  [''''&raquo;''' [link boost_asio.reference.buffer_sequence_end.overload3 more...]]``
54352
54353   template<
54354       typename C>
54355   auto ``[link boost_asio.reference.buffer_sequence_end.overload4 buffer_sequence_end]``(
54356       const C & c,
54357       typename enable_if< !is_convertible< const C *, const mutable_buffer * >::value &&!is_convertible< const C *, const const_buffer * >::value >::type *  = 0);
54358   ``  [''''&raquo;''' [link boost_asio.reference.buffer_sequence_end.overload4 more...]]``
54359
54360 [heading Requirements]
54361
54362 ['Header: ][^boost/asio/buffer.hpp]
54363
54364 ['Convenience header: ][^boost/asio.hpp]
54365
54366
54367 [section:overload1 buffer_sequence_end (1 of 4 overloads)]
54368
54369
54370 Get an iterator to one past the end element in a buffer sequence. 
54371
54372
54373   template<
54374       typename MutableBuffer>
54375   const mutable_buffer * buffer_sequence_end(
54376       const MutableBuffer & b,
54377       typename enable_if< is_convertible< const MutableBuffer *, const mutable_buffer * >::value >::type *  = 0);
54378
54379
54380
54381 [endsect]
54382
54383
54384
54385 [section:overload2 buffer_sequence_end (2 of 4 overloads)]
54386
54387
54388 Get an iterator to one past the end element in a buffer sequence. 
54389
54390
54391   template<
54392       typename ConstBuffer>
54393   const const_buffer * buffer_sequence_end(
54394       const ConstBuffer & b,
54395       typename enable_if< is_convertible< const ConstBuffer *, const const_buffer * >::value >::type *  = 0);
54396
54397
54398
54399 [endsect]
54400
54401
54402
54403 [section:overload3 buffer_sequence_end (3 of 4 overloads)]
54404
54405
54406 Get an iterator to one past the end element in a buffer sequence. 
54407
54408
54409   template<
54410       typename C>
54411   auto buffer_sequence_end(
54412       C & c,
54413       typename enable_if< !is_convertible< const C *, const mutable_buffer * >::value &&!is_convertible< const C *, const const_buffer * >::value >::type *  = 0);
54414
54415
54416
54417 [endsect]
54418
54419
54420
54421 [section:overload4 buffer_sequence_end (4 of 4 overloads)]
54422
54423
54424 Get an iterator to one past the end element in a buffer sequence. 
54425
54426
54427   template<
54428       typename C>
54429   auto buffer_sequence_end(
54430       const C & c,
54431       typename enable_if< !is_convertible< const C *, const mutable_buffer * >::value &&!is_convertible< const C *, const const_buffer * >::value >::type *  = 0);
54432
54433
54434
54435 [endsect]
54436
54437
54438 [endsect]
54439
54440
54441 [section:buffer_size buffer_size]
54442
54443 [indexterm1 boost_asio.indexterm.buffer_size..buffer_size] 
54444 Get the total number of bytes in a buffer sequence. 
54445
54446
54447   template<
54448       typename BufferSequence>
54449   std::size_t buffer_size(
54450       const BufferSequence & b);
54451
54452
54453 The `buffer_size` function determines the total size of all buffers in the buffer sequence, as if computed as follows:
54454
54455
54456
54457    size_t total_size = 0;
54458    auto i = boost::asio::buffer_sequence_begin(buffers);
54459    auto end = boost::asio::buffer_sequence_end(buffers);
54460    for (; i != end; ++i)
54461    {
54462      const_buffer b(*i);
54463      total_size += b.size();
54464    }
54465    return total_size; 
54466
54467
54468
54469
54470 The `BufferSequence` template parameter may meet either of the `ConstBufferSequence` or `MutableBufferSequence` type requirements. 
54471
54472 [heading Requirements]
54473
54474 ['Header: ][^boost/asio/buffer.hpp]
54475
54476 ['Convenience header: ][^boost/asio.hpp]
54477
54478
54479 [endsect]
54480
54481
54482 [section:buffered_read_stream buffered_read_stream]
54483
54484
54485 Adds buffering to the read-related operations of a stream. 
54486
54487
54488   template<
54489       typename Stream>
54490   class buffered_read_stream :
54491     noncopyable
54492
54493
54494 [heading Types]
54495 [table
54496   [[Name][Description]]
54497
54498   [
54499
54500     [[link boost_asio.reference.buffered_read_stream.executor_type [*executor_type]]]
54501     [The type of the executor associated with the object. ]
54502   
54503   ]
54504
54505   [
54506
54507     [[link boost_asio.reference.buffered_read_stream.lowest_layer_type [*lowest_layer_type]]]
54508     [The type of the lowest layer. ]
54509   
54510   ]
54511
54512   [
54513
54514     [[link boost_asio.reference.buffered_read_stream.next_layer_type [*next_layer_type]]]
54515     [The type of the next layer. ]
54516   
54517   ]
54518
54519 ]
54520
54521 [heading Member Functions]
54522 [table
54523   [[Name][Description]]
54524
54525   [
54526     [[link boost_asio.reference.buffered_read_stream.async_fill [*async_fill]]]
54527     [Start an asynchronous fill. ]
54528   ]
54529   
54530   [
54531     [[link boost_asio.reference.buffered_read_stream.async_read_some [*async_read_some]]]
54532     [Start an asynchronous read. The buffer into which the data will be read must be valid for the lifetime of the asynchronous operation. ]
54533   ]
54534   
54535   [
54536     [[link boost_asio.reference.buffered_read_stream.async_write_some [*async_write_some]]]
54537     [Start an asynchronous write. The data being written must be valid for the lifetime of the asynchronous operation. ]
54538   ]
54539   
54540   [
54541     [[link boost_asio.reference.buffered_read_stream.buffered_read_stream [*buffered_read_stream]]]
54542     [Construct, passing the specified argument to initialise the next layer. ]
54543   ]
54544   
54545   [
54546     [[link boost_asio.reference.buffered_read_stream.close [*close]]]
54547     [Close the stream. ]
54548   ]
54549   
54550   [
54551     [[link boost_asio.reference.buffered_read_stream.fill [*fill]]]
54552     [Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation. Throws an exception on failure. 
54553      [hr]
54554      Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation, or 0 if an error occurred. ]
54555   ]
54556   
54557   [
54558     [[link boost_asio.reference.buffered_read_stream.get_executor [*get_executor]]]
54559     [Get the executor associated with the object. ]
54560   ]
54561   
54562   [
54563     [[link boost_asio.reference.buffered_read_stream.in_avail [*in_avail]]]
54564     [Determine the amount of data that may be read without blocking. ]
54565   ]
54566   
54567   [
54568     [[link boost_asio.reference.buffered_read_stream.lowest_layer [*lowest_layer]]]
54569     [Get a reference to the lowest layer. 
54570      [hr]
54571      Get a const reference to the lowest layer. ]
54572   ]
54573   
54574   [
54575     [[link boost_asio.reference.buffered_read_stream.next_layer [*next_layer]]]
54576     [Get a reference to the next layer. ]
54577   ]
54578   
54579   [
54580     [[link boost_asio.reference.buffered_read_stream.peek [*peek]]]
54581     [Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure. 
54582      [hr]
54583      Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred. ]
54584   ]
54585   
54586   [
54587     [[link boost_asio.reference.buffered_read_stream.read_some [*read_some]]]
54588     [Read some data from the stream. Returns the number of bytes read. Throws an exception on failure. 
54589      [hr]
54590      Read some data from the stream. Returns the number of bytes read or 0 if an error occurred. ]
54591   ]
54592   
54593   [
54594     [[link boost_asio.reference.buffered_read_stream.write_some [*write_some]]]
54595     [Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure. 
54596      [hr]
54597      Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred. ]
54598   ]
54599   
54600 ]
54601
54602 [heading Data Members]
54603 [table
54604   [[Name][Description]]
54605
54606   [
54607     [[link boost_asio.reference.buffered_read_stream.default_buffer_size [*default_buffer_size]]]
54608     [The default buffer size. ]
54609   ]
54610
54611 ]
54612
54613 The [link boost_asio.reference.buffered_read_stream `buffered_read_stream`] class template can be used to add buffering to the synchronous and asynchronous read operations of a stream.
54614
54615
54616 [heading Thread Safety]
54617   
54618 ['Distinct] ['objects:] Safe.
54619
54620 ['Shared] ['objects:] Unsafe.
54621
54622
54623
54624
54625 [heading Requirements]
54626
54627 ['Header: ][^boost/asio/buffered_read_stream.hpp]
54628
54629 ['Convenience header: ][^boost/asio.hpp]
54630
54631
54632 [section:async_fill buffered_read_stream::async_fill]
54633
54634 [indexterm2 boost_asio.indexterm.buffered_read_stream.async_fill..async_fill..buffered_read_stream] 
54635 Start an asynchronous fill. 
54636
54637
54638   template<
54639       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
54640   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_fill(
54641       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
54642
54643
54644
54645 [endsect]
54646
54647
54648
54649 [section:async_read_some buffered_read_stream::async_read_some]
54650
54651 [indexterm2 boost_asio.indexterm.buffered_read_stream.async_read_some..async_read_some..buffered_read_stream] 
54652 Start an asynchronous read. The buffer into which the data will be read must be valid for the lifetime of the asynchronous operation. 
54653
54654
54655   template<
54656       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
54657       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
54658   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_some(
54659       const MutableBufferSequence & buffers,
54660       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
54661
54662
54663
54664 [endsect]
54665
54666
54667
54668 [section:async_write_some buffered_read_stream::async_write_some]
54669
54670 [indexterm2 boost_asio.indexterm.buffered_read_stream.async_write_some..async_write_some..buffered_read_stream] 
54671 Start an asynchronous write. The data being written must be valid for the lifetime of the asynchronous operation. 
54672
54673
54674   template<
54675       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
54676       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
54677   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_some(
54678       const ConstBufferSequence & buffers,
54679       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
54680
54681
54682
54683 [endsect]
54684
54685
54686 [section:buffered_read_stream buffered_read_stream::buffered_read_stream]
54687
54688 [indexterm2 boost_asio.indexterm.buffered_read_stream.buffered_read_stream..buffered_read_stream..buffered_read_stream] 
54689 Construct, passing the specified argument to initialise the next layer. 
54690
54691
54692   template<
54693       typename Arg>
54694   explicit ``[link boost_asio.reference.buffered_read_stream.buffered_read_stream.overload1 buffered_read_stream]``(
54695       Arg & a);
54696   ``  [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.buffered_read_stream.overload1 more...]]``
54697
54698   template<
54699       typename Arg>
54700   ``[link boost_asio.reference.buffered_read_stream.buffered_read_stream.overload2 buffered_read_stream]``(
54701       Arg & a,
54702       std::size_t buffer_size);
54703   ``  [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.buffered_read_stream.overload2 more...]]``
54704
54705
54706 [section:overload1 buffered_read_stream::buffered_read_stream (1 of 2 overloads)]
54707
54708
54709 Construct, passing the specified argument to initialise the next layer. 
54710
54711
54712   template<
54713       typename Arg>
54714   buffered_read_stream(
54715       Arg & a);
54716
54717
54718
54719 [endsect]
54720
54721
54722
54723 [section:overload2 buffered_read_stream::buffered_read_stream (2 of 2 overloads)]
54724
54725
54726 Construct, passing the specified argument to initialise the next layer. 
54727
54728
54729   template<
54730       typename Arg>
54731   buffered_read_stream(
54732       Arg & a,
54733       std::size_t buffer_size);
54734
54735
54736
54737 [endsect]
54738
54739
54740 [endsect]
54741
54742 [section:close buffered_read_stream::close]
54743
54744 [indexterm2 boost_asio.indexterm.buffered_read_stream.close..close..buffered_read_stream] 
54745 Close the stream. 
54746
54747
54748   void ``[link boost_asio.reference.buffered_read_stream.close.overload1 close]``();
54749   ``  [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.close.overload1 more...]]``
54750
54751   void ``[link boost_asio.reference.buffered_read_stream.close.overload2 close]``(
54752       boost::system::error_code & ec);
54753   ``  [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.close.overload2 more...]]``
54754
54755
54756 [section:overload1 buffered_read_stream::close (1 of 2 overloads)]
54757
54758
54759 Close the stream. 
54760
54761
54762   void close();
54763
54764
54765
54766 [endsect]
54767
54768
54769
54770 [section:overload2 buffered_read_stream::close (2 of 2 overloads)]
54771
54772
54773 Close the stream. 
54774
54775
54776   void close(
54777       boost::system::error_code & ec);
54778
54779
54780
54781 [endsect]
54782
54783
54784 [endsect]
54785
54786
54787 [section:default_buffer_size buffered_read_stream::default_buffer_size]
54788
54789 [indexterm2 boost_asio.indexterm.buffered_read_stream.default_buffer_size..default_buffer_size..buffered_read_stream] 
54790 The default buffer size. 
54791
54792
54793   static const std::size_t default_buffer_size = implementation_defined;
54794
54795
54796
54797 [endsect]
54798
54799
54800
54801 [section:executor_type buffered_read_stream::executor_type]
54802
54803 [indexterm2 boost_asio.indexterm.buffered_read_stream.executor_type..executor_type..buffered_read_stream] 
54804 The type of the executor associated with the object. 
54805
54806
54807   typedef lowest_layer_type::executor_type executor_type;
54808
54809
54810
54811 [heading Requirements]
54812
54813 ['Header: ][^boost/asio/buffered_read_stream.hpp]
54814
54815 ['Convenience header: ][^boost/asio.hpp]
54816
54817
54818 [endsect]
54819
54820
54821 [section:fill buffered_read_stream::fill]
54822
54823 [indexterm2 boost_asio.indexterm.buffered_read_stream.fill..fill..buffered_read_stream] 
54824 Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation. Throws an exception on failure. 
54825
54826
54827   std::size_t ``[link boost_asio.reference.buffered_read_stream.fill.overload1 fill]``();
54828   ``  [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.fill.overload1 more...]]``
54829
54830
54831 Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation, or 0 if an error occurred. 
54832
54833
54834   std::size_t ``[link boost_asio.reference.buffered_read_stream.fill.overload2 fill]``(
54835       boost::system::error_code & ec);
54836   ``  [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.fill.overload2 more...]]``
54837
54838
54839 [section:overload1 buffered_read_stream::fill (1 of 2 overloads)]
54840
54841
54842 Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation. Throws an exception on failure. 
54843
54844
54845   std::size_t fill();
54846
54847
54848
54849 [endsect]
54850
54851
54852
54853 [section:overload2 buffered_read_stream::fill (2 of 2 overloads)]
54854
54855
54856 Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation, or 0 if an error occurred. 
54857
54858
54859   std::size_t fill(
54860       boost::system::error_code & ec);
54861
54862
54863
54864 [endsect]
54865
54866
54867 [endsect]
54868
54869
54870 [section:get_executor buffered_read_stream::get_executor]
54871
54872 [indexterm2 boost_asio.indexterm.buffered_read_stream.get_executor..get_executor..buffered_read_stream] 
54873 Get the executor associated with the object. 
54874
54875
54876   executor_type get_executor();
54877
54878
54879
54880 [endsect]
54881
54882
54883 [section:in_avail buffered_read_stream::in_avail]
54884
54885 [indexterm2 boost_asio.indexterm.buffered_read_stream.in_avail..in_avail..buffered_read_stream] 
54886 Determine the amount of data that may be read without blocking. 
54887
54888
54889   std::size_t ``[link boost_asio.reference.buffered_read_stream.in_avail.overload1 in_avail]``();
54890   ``  [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.in_avail.overload1 more...]]``
54891
54892   std::size_t ``[link boost_asio.reference.buffered_read_stream.in_avail.overload2 in_avail]``(
54893       boost::system::error_code & ec);
54894   ``  [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.in_avail.overload2 more...]]``
54895
54896
54897 [section:overload1 buffered_read_stream::in_avail (1 of 2 overloads)]
54898
54899
54900 Determine the amount of data that may be read without blocking. 
54901
54902
54903   std::size_t in_avail();
54904
54905
54906
54907 [endsect]
54908
54909
54910
54911 [section:overload2 buffered_read_stream::in_avail (2 of 2 overloads)]
54912
54913
54914 Determine the amount of data that may be read without blocking. 
54915
54916
54917   std::size_t in_avail(
54918       boost::system::error_code & ec);
54919
54920
54921
54922 [endsect]
54923
54924
54925 [endsect]
54926
54927 [section:lowest_layer buffered_read_stream::lowest_layer]
54928
54929 [indexterm2 boost_asio.indexterm.buffered_read_stream.lowest_layer..lowest_layer..buffered_read_stream] 
54930 Get a reference to the lowest layer. 
54931
54932
54933   lowest_layer_type & ``[link boost_asio.reference.buffered_read_stream.lowest_layer.overload1 lowest_layer]``();
54934   ``  [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.lowest_layer.overload1 more...]]``
54935
54936
54937 Get a const reference to the lowest layer. 
54938
54939
54940   const lowest_layer_type & ``[link boost_asio.reference.buffered_read_stream.lowest_layer.overload2 lowest_layer]``() const;
54941   ``  [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.lowest_layer.overload2 more...]]``
54942
54943
54944 [section:overload1 buffered_read_stream::lowest_layer (1 of 2 overloads)]
54945
54946
54947 Get a reference to the lowest layer. 
54948
54949
54950   lowest_layer_type & lowest_layer();
54951
54952
54953
54954 [endsect]
54955
54956
54957
54958 [section:overload2 buffered_read_stream::lowest_layer (2 of 2 overloads)]
54959
54960
54961 Get a const reference to the lowest layer. 
54962
54963
54964   const lowest_layer_type & lowest_layer() const;
54965
54966
54967
54968 [endsect]
54969
54970
54971 [endsect]
54972
54973
54974 [section:lowest_layer_type buffered_read_stream::lowest_layer_type]
54975
54976 [indexterm2 boost_asio.indexterm.buffered_read_stream.lowest_layer_type..lowest_layer_type..buffered_read_stream] 
54977 The type of the lowest layer. 
54978
54979
54980   typedef next_layer_type::lowest_layer_type lowest_layer_type;
54981
54982
54983
54984 [heading Requirements]
54985
54986 ['Header: ][^boost/asio/buffered_read_stream.hpp]
54987
54988 ['Convenience header: ][^boost/asio.hpp]
54989
54990
54991 [endsect]
54992
54993
54994
54995 [section:next_layer buffered_read_stream::next_layer]
54996
54997 [indexterm2 boost_asio.indexterm.buffered_read_stream.next_layer..next_layer..buffered_read_stream] 
54998 Get a reference to the next layer. 
54999
55000
55001   next_layer_type & next_layer();
55002
55003
55004
55005 [endsect]
55006
55007
55008
55009 [section:next_layer_type buffered_read_stream::next_layer_type]
55010
55011 [indexterm2 boost_asio.indexterm.buffered_read_stream.next_layer_type..next_layer_type..buffered_read_stream] 
55012 The type of the next layer. 
55013
55014
55015   typedef remove_reference< Stream >::type next_layer_type;
55016
55017
55018
55019 [heading Requirements]
55020
55021 ['Header: ][^boost/asio/buffered_read_stream.hpp]
55022
55023 ['Convenience header: ][^boost/asio.hpp]
55024
55025
55026 [endsect]
55027
55028
55029 [section:peek buffered_read_stream::peek]
55030
55031 [indexterm2 boost_asio.indexterm.buffered_read_stream.peek..peek..buffered_read_stream] 
55032 Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure. 
55033
55034
55035   template<
55036       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
55037   std::size_t ``[link boost_asio.reference.buffered_read_stream.peek.overload1 peek]``(
55038       const MutableBufferSequence & buffers);
55039   ``  [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.peek.overload1 more...]]``
55040
55041
55042 Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred. 
55043
55044
55045   template<
55046       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
55047   std::size_t ``[link boost_asio.reference.buffered_read_stream.peek.overload2 peek]``(
55048       const MutableBufferSequence & buffers,
55049       boost::system::error_code & ec);
55050   ``  [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.peek.overload2 more...]]``
55051
55052
55053 [section:overload1 buffered_read_stream::peek (1 of 2 overloads)]
55054
55055
55056 Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure. 
55057
55058
55059   template<
55060       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
55061   std::size_t peek(
55062       const MutableBufferSequence & buffers);
55063
55064
55065
55066 [endsect]
55067
55068
55069
55070 [section:overload2 buffered_read_stream::peek (2 of 2 overloads)]
55071
55072
55073 Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred. 
55074
55075
55076   template<
55077       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
55078   std::size_t peek(
55079       const MutableBufferSequence & buffers,
55080       boost::system::error_code & ec);
55081
55082
55083
55084 [endsect]
55085
55086
55087 [endsect]
55088
55089 [section:read_some buffered_read_stream::read_some]
55090
55091 [indexterm2 boost_asio.indexterm.buffered_read_stream.read_some..read_some..buffered_read_stream] 
55092 Read some data from the stream. Returns the number of bytes read. Throws an exception on failure. 
55093
55094
55095   template<
55096       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
55097   std::size_t ``[link boost_asio.reference.buffered_read_stream.read_some.overload1 read_some]``(
55098       const MutableBufferSequence & buffers);
55099   ``  [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.read_some.overload1 more...]]``
55100
55101
55102 Read some data from the stream. Returns the number of bytes read or 0 if an error occurred. 
55103
55104
55105   template<
55106       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
55107   std::size_t ``[link boost_asio.reference.buffered_read_stream.read_some.overload2 read_some]``(
55108       const MutableBufferSequence & buffers,
55109       boost::system::error_code & ec);
55110   ``  [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.read_some.overload2 more...]]``
55111
55112
55113 [section:overload1 buffered_read_stream::read_some (1 of 2 overloads)]
55114
55115
55116 Read some data from the stream. Returns the number of bytes read. Throws an exception on failure. 
55117
55118
55119   template<
55120       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
55121   std::size_t read_some(
55122       const MutableBufferSequence & buffers);
55123
55124
55125
55126 [endsect]
55127
55128
55129
55130 [section:overload2 buffered_read_stream::read_some (2 of 2 overloads)]
55131
55132
55133 Read some data from the stream. Returns the number of bytes read or 0 if an error occurred. 
55134
55135
55136   template<
55137       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
55138   std::size_t read_some(
55139       const MutableBufferSequence & buffers,
55140       boost::system::error_code & ec);
55141
55142
55143
55144 [endsect]
55145
55146
55147 [endsect]
55148
55149 [section:write_some buffered_read_stream::write_some]
55150
55151 [indexterm2 boost_asio.indexterm.buffered_read_stream.write_some..write_some..buffered_read_stream] 
55152 Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure. 
55153
55154
55155   template<
55156       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
55157   std::size_t ``[link boost_asio.reference.buffered_read_stream.write_some.overload1 write_some]``(
55158       const ConstBufferSequence & buffers);
55159   ``  [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.write_some.overload1 more...]]``
55160
55161
55162 Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred. 
55163
55164
55165   template<
55166       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
55167   std::size_t ``[link boost_asio.reference.buffered_read_stream.write_some.overload2 write_some]``(
55168       const ConstBufferSequence & buffers,
55169       boost::system::error_code & ec);
55170   ``  [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.write_some.overload2 more...]]``
55171
55172
55173 [section:overload1 buffered_read_stream::write_some (1 of 2 overloads)]
55174
55175
55176 Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure. 
55177
55178
55179   template<
55180       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
55181   std::size_t write_some(
55182       const ConstBufferSequence & buffers);
55183
55184
55185
55186 [endsect]
55187
55188
55189
55190 [section:overload2 buffered_read_stream::write_some (2 of 2 overloads)]
55191
55192
55193 Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred. 
55194
55195
55196   template<
55197       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
55198   std::size_t write_some(
55199       const ConstBufferSequence & buffers,
55200       boost::system::error_code & ec);
55201
55202
55203
55204 [endsect]
55205
55206
55207 [endsect]
55208
55209
55210 [endsect]
55211
55212 [section:buffered_stream buffered_stream]
55213
55214
55215 Adds buffering to the read- and write-related operations of a stream. 
55216
55217
55218   template<
55219       typename Stream>
55220   class buffered_stream :
55221     noncopyable
55222
55223
55224 [heading Types]
55225 [table
55226   [[Name][Description]]
55227
55228   [
55229
55230     [[link boost_asio.reference.buffered_stream.executor_type [*executor_type]]]
55231     [The type of the executor associated with the object. ]
55232   
55233   ]
55234
55235   [
55236
55237     [[link boost_asio.reference.buffered_stream.lowest_layer_type [*lowest_layer_type]]]
55238     [The type of the lowest layer. ]
55239   
55240   ]
55241
55242   [
55243
55244     [[link boost_asio.reference.buffered_stream.next_layer_type [*next_layer_type]]]
55245     [The type of the next layer. ]
55246   
55247   ]
55248
55249 ]
55250
55251 [heading Member Functions]
55252 [table
55253   [[Name][Description]]
55254
55255   [
55256     [[link boost_asio.reference.buffered_stream.async_fill [*async_fill]]]
55257     [Start an asynchronous fill. ]
55258   ]
55259   
55260   [
55261     [[link boost_asio.reference.buffered_stream.async_flush [*async_flush]]]
55262     [Start an asynchronous flush. ]
55263   ]
55264   
55265   [
55266     [[link boost_asio.reference.buffered_stream.async_read_some [*async_read_some]]]
55267     [Start an asynchronous read. The buffer into which the data will be read must be valid for the lifetime of the asynchronous operation. ]
55268   ]
55269   
55270   [
55271     [[link boost_asio.reference.buffered_stream.async_write_some [*async_write_some]]]
55272     [Start an asynchronous write. The data being written must be valid for the lifetime of the asynchronous operation. ]
55273   ]
55274   
55275   [
55276     [[link boost_asio.reference.buffered_stream.buffered_stream [*buffered_stream]]]
55277     [Construct, passing the specified argument to initialise the next layer. ]
55278   ]
55279   
55280   [
55281     [[link boost_asio.reference.buffered_stream.close [*close]]]
55282     [Close the stream. ]
55283   ]
55284   
55285   [
55286     [[link boost_asio.reference.buffered_stream.fill [*fill]]]
55287     [Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation. Throws an exception on failure. 
55288      [hr]
55289      Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation, or 0 if an error occurred. ]
55290   ]
55291   
55292   [
55293     [[link boost_asio.reference.buffered_stream.flush [*flush]]]
55294     [Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation. Throws an exception on failure. 
55295      [hr]
55296      Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation, or 0 if an error occurred. ]
55297   ]
55298   
55299   [
55300     [[link boost_asio.reference.buffered_stream.get_executor [*get_executor]]]
55301     [Get the executor associated with the object. ]
55302   ]
55303   
55304   [
55305     [[link boost_asio.reference.buffered_stream.in_avail [*in_avail]]]
55306     [Determine the amount of data that may be read without blocking. ]
55307   ]
55308   
55309   [
55310     [[link boost_asio.reference.buffered_stream.lowest_layer [*lowest_layer]]]
55311     [Get a reference to the lowest layer. 
55312      [hr]
55313      Get a const reference to the lowest layer. ]
55314   ]
55315   
55316   [
55317     [[link boost_asio.reference.buffered_stream.next_layer [*next_layer]]]
55318     [Get a reference to the next layer. ]
55319   ]
55320   
55321   [
55322     [[link boost_asio.reference.buffered_stream.peek [*peek]]]
55323     [Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure. 
55324      [hr]
55325      Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred. ]
55326   ]
55327   
55328   [
55329     [[link boost_asio.reference.buffered_stream.read_some [*read_some]]]
55330     [Read some data from the stream. Returns the number of bytes read. Throws an exception on failure. 
55331      [hr]
55332      Read some data from the stream. Returns the number of bytes read or 0 if an error occurred. ]
55333   ]
55334   
55335   [
55336     [[link boost_asio.reference.buffered_stream.write_some [*write_some]]]
55337     [Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure. 
55338      [hr]
55339      Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred. ]
55340   ]
55341   
55342 ]
55343
55344 The [link boost_asio.reference.buffered_stream `buffered_stream`] class template can be used to add buffering to the synchronous and asynchronous read and write operations of a stream.
55345
55346
55347 [heading Thread Safety]
55348   
55349 ['Distinct] ['objects:] Safe.
55350
55351 ['Shared] ['objects:] Unsafe.
55352
55353
55354
55355
55356 [heading Requirements]
55357
55358 ['Header: ][^boost/asio/buffered_stream.hpp]
55359
55360 ['Convenience header: ][^boost/asio.hpp]
55361
55362
55363 [section:async_fill buffered_stream::async_fill]
55364
55365 [indexterm2 boost_asio.indexterm.buffered_stream.async_fill..async_fill..buffered_stream] 
55366 Start an asynchronous fill. 
55367
55368
55369   template<
55370       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
55371   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_fill(
55372       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
55373
55374
55375
55376 [endsect]
55377
55378
55379
55380 [section:async_flush buffered_stream::async_flush]
55381
55382 [indexterm2 boost_asio.indexterm.buffered_stream.async_flush..async_flush..buffered_stream] 
55383 Start an asynchronous flush. 
55384
55385
55386   template<
55387       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
55388   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_flush(
55389       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
55390
55391
55392
55393 [endsect]
55394
55395
55396
55397 [section:async_read_some buffered_stream::async_read_some]
55398
55399 [indexterm2 boost_asio.indexterm.buffered_stream.async_read_some..async_read_some..buffered_stream] 
55400 Start an asynchronous read. The buffer into which the data will be read must be valid for the lifetime of the asynchronous operation. 
55401
55402
55403   template<
55404       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
55405       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
55406   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_some(
55407       const MutableBufferSequence & buffers,
55408       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
55409
55410
55411
55412 [endsect]
55413
55414
55415
55416 [section:async_write_some buffered_stream::async_write_some]
55417
55418 [indexterm2 boost_asio.indexterm.buffered_stream.async_write_some..async_write_some..buffered_stream] 
55419 Start an asynchronous write. The data being written must be valid for the lifetime of the asynchronous operation. 
55420
55421
55422   template<
55423       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
55424       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
55425   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_some(
55426       const ConstBufferSequence & buffers,
55427       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
55428
55429
55430
55431 [endsect]
55432
55433
55434 [section:buffered_stream buffered_stream::buffered_stream]
55435
55436 [indexterm2 boost_asio.indexterm.buffered_stream.buffered_stream..buffered_stream..buffered_stream] 
55437 Construct, passing the specified argument to initialise the next layer. 
55438
55439
55440   template<
55441       typename Arg>
55442   explicit ``[link boost_asio.reference.buffered_stream.buffered_stream.overload1 buffered_stream]``(
55443       Arg & a);
55444   ``  [''''&raquo;''' [link boost_asio.reference.buffered_stream.buffered_stream.overload1 more...]]``
55445
55446   template<
55447       typename Arg>
55448   explicit ``[link boost_asio.reference.buffered_stream.buffered_stream.overload2 buffered_stream]``(
55449       Arg & a,
55450       std::size_t read_buffer_size,
55451       std::size_t write_buffer_size);
55452   ``  [''''&raquo;''' [link boost_asio.reference.buffered_stream.buffered_stream.overload2 more...]]``
55453
55454
55455 [section:overload1 buffered_stream::buffered_stream (1 of 2 overloads)]
55456
55457
55458 Construct, passing the specified argument to initialise the next layer. 
55459
55460
55461   template<
55462       typename Arg>
55463   buffered_stream(
55464       Arg & a);
55465
55466
55467
55468 [endsect]
55469
55470
55471
55472 [section:overload2 buffered_stream::buffered_stream (2 of 2 overloads)]
55473
55474
55475 Construct, passing the specified argument to initialise the next layer. 
55476
55477
55478   template<
55479       typename Arg>
55480   buffered_stream(
55481       Arg & a,
55482       std::size_t read_buffer_size,
55483       std::size_t write_buffer_size);
55484
55485
55486
55487 [endsect]
55488
55489
55490 [endsect]
55491
55492 [section:close buffered_stream::close]
55493
55494 [indexterm2 boost_asio.indexterm.buffered_stream.close..close..buffered_stream] 
55495 Close the stream. 
55496
55497
55498   void ``[link boost_asio.reference.buffered_stream.close.overload1 close]``();
55499   ``  [''''&raquo;''' [link boost_asio.reference.buffered_stream.close.overload1 more...]]``
55500
55501   void ``[link boost_asio.reference.buffered_stream.close.overload2 close]``(
55502       boost::system::error_code & ec);
55503   ``  [''''&raquo;''' [link boost_asio.reference.buffered_stream.close.overload2 more...]]``
55504
55505
55506 [section:overload1 buffered_stream::close (1 of 2 overloads)]
55507
55508
55509 Close the stream. 
55510
55511
55512   void close();
55513
55514
55515
55516 [endsect]
55517
55518
55519
55520 [section:overload2 buffered_stream::close (2 of 2 overloads)]
55521
55522
55523 Close the stream. 
55524
55525
55526   void close(
55527       boost::system::error_code & ec);
55528
55529
55530
55531 [endsect]
55532
55533
55534 [endsect]
55535
55536
55537 [section:executor_type buffered_stream::executor_type]
55538
55539 [indexterm2 boost_asio.indexterm.buffered_stream.executor_type..executor_type..buffered_stream] 
55540 The type of the executor associated with the object. 
55541
55542
55543   typedef lowest_layer_type::executor_type executor_type;
55544
55545
55546
55547 [heading Requirements]
55548
55549 ['Header: ][^boost/asio/buffered_stream.hpp]
55550
55551 ['Convenience header: ][^boost/asio.hpp]
55552
55553
55554 [endsect]
55555
55556
55557 [section:fill buffered_stream::fill]
55558
55559 [indexterm2 boost_asio.indexterm.buffered_stream.fill..fill..buffered_stream] 
55560 Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation. Throws an exception on failure. 
55561
55562
55563   std::size_t ``[link boost_asio.reference.buffered_stream.fill.overload1 fill]``();
55564   ``  [''''&raquo;''' [link boost_asio.reference.buffered_stream.fill.overload1 more...]]``
55565
55566
55567 Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation, or 0 if an error occurred. 
55568
55569
55570   std::size_t ``[link boost_asio.reference.buffered_stream.fill.overload2 fill]``(
55571       boost::system::error_code & ec);
55572   ``  [''''&raquo;''' [link boost_asio.reference.buffered_stream.fill.overload2 more...]]``
55573
55574
55575 [section:overload1 buffered_stream::fill (1 of 2 overloads)]
55576
55577
55578 Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation. Throws an exception on failure. 
55579
55580
55581   std::size_t fill();
55582
55583
55584
55585 [endsect]
55586
55587
55588
55589 [section:overload2 buffered_stream::fill (2 of 2 overloads)]
55590
55591
55592 Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation, or 0 if an error occurred. 
55593
55594
55595   std::size_t fill(
55596       boost::system::error_code & ec);
55597
55598
55599
55600 [endsect]
55601
55602
55603 [endsect]
55604
55605 [section:flush buffered_stream::flush]
55606
55607 [indexterm2 boost_asio.indexterm.buffered_stream.flush..flush..buffered_stream] 
55608 Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation. Throws an exception on failure. 
55609
55610
55611   std::size_t ``[link boost_asio.reference.buffered_stream.flush.overload1 flush]``();
55612   ``  [''''&raquo;''' [link boost_asio.reference.buffered_stream.flush.overload1 more...]]``
55613
55614
55615 Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation, or 0 if an error occurred. 
55616
55617
55618   std::size_t ``[link boost_asio.reference.buffered_stream.flush.overload2 flush]``(
55619       boost::system::error_code & ec);
55620   ``  [''''&raquo;''' [link boost_asio.reference.buffered_stream.flush.overload2 more...]]``
55621
55622
55623 [section:overload1 buffered_stream::flush (1 of 2 overloads)]
55624
55625
55626 Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation. Throws an exception on failure. 
55627
55628
55629   std::size_t flush();
55630
55631
55632
55633 [endsect]
55634
55635
55636
55637 [section:overload2 buffered_stream::flush (2 of 2 overloads)]
55638
55639
55640 Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation, or 0 if an error occurred. 
55641
55642
55643   std::size_t flush(
55644       boost::system::error_code & ec);
55645
55646
55647
55648 [endsect]
55649
55650
55651 [endsect]
55652
55653
55654 [section:get_executor buffered_stream::get_executor]
55655
55656 [indexterm2 boost_asio.indexterm.buffered_stream.get_executor..get_executor..buffered_stream] 
55657 Get the executor associated with the object. 
55658
55659
55660   executor_type get_executor();
55661
55662
55663
55664 [endsect]
55665
55666
55667 [section:in_avail buffered_stream::in_avail]
55668
55669 [indexterm2 boost_asio.indexterm.buffered_stream.in_avail..in_avail..buffered_stream] 
55670 Determine the amount of data that may be read without blocking. 
55671
55672
55673   std::size_t ``[link boost_asio.reference.buffered_stream.in_avail.overload1 in_avail]``();
55674   ``  [''''&raquo;''' [link boost_asio.reference.buffered_stream.in_avail.overload1 more...]]``
55675
55676   std::size_t ``[link boost_asio.reference.buffered_stream.in_avail.overload2 in_avail]``(
55677       boost::system::error_code & ec);
55678   ``  [''''&raquo;''' [link boost_asio.reference.buffered_stream.in_avail.overload2 more...]]``
55679
55680
55681 [section:overload1 buffered_stream::in_avail (1 of 2 overloads)]
55682
55683
55684 Determine the amount of data that may be read without blocking. 
55685
55686
55687   std::size_t in_avail();
55688
55689
55690
55691 [endsect]
55692
55693
55694
55695 [section:overload2 buffered_stream::in_avail (2 of 2 overloads)]
55696
55697
55698 Determine the amount of data that may be read without blocking. 
55699
55700
55701   std::size_t in_avail(
55702       boost::system::error_code & ec);
55703
55704
55705
55706 [endsect]
55707
55708
55709 [endsect]
55710
55711 [section:lowest_layer buffered_stream::lowest_layer]
55712
55713 [indexterm2 boost_asio.indexterm.buffered_stream.lowest_layer..lowest_layer..buffered_stream] 
55714 Get a reference to the lowest layer. 
55715
55716
55717   lowest_layer_type & ``[link boost_asio.reference.buffered_stream.lowest_layer.overload1 lowest_layer]``();
55718   ``  [''''&raquo;''' [link boost_asio.reference.buffered_stream.lowest_layer.overload1 more...]]``
55719
55720
55721 Get a const reference to the lowest layer. 
55722
55723
55724   const lowest_layer_type & ``[link boost_asio.reference.buffered_stream.lowest_layer.overload2 lowest_layer]``() const;
55725   ``  [''''&raquo;''' [link boost_asio.reference.buffered_stream.lowest_layer.overload2 more...]]``
55726
55727
55728 [section:overload1 buffered_stream::lowest_layer (1 of 2 overloads)]
55729
55730
55731 Get a reference to the lowest layer. 
55732
55733
55734   lowest_layer_type & lowest_layer();
55735
55736
55737
55738 [endsect]
55739
55740
55741
55742 [section:overload2 buffered_stream::lowest_layer (2 of 2 overloads)]
55743
55744
55745 Get a const reference to the lowest layer. 
55746
55747
55748   const lowest_layer_type & lowest_layer() const;
55749
55750
55751
55752 [endsect]
55753
55754
55755 [endsect]
55756
55757
55758 [section:lowest_layer_type buffered_stream::lowest_layer_type]
55759
55760 [indexterm2 boost_asio.indexterm.buffered_stream.lowest_layer_type..lowest_layer_type..buffered_stream] 
55761 The type of the lowest layer. 
55762
55763
55764   typedef next_layer_type::lowest_layer_type lowest_layer_type;
55765
55766
55767
55768 [heading Requirements]
55769
55770 ['Header: ][^boost/asio/buffered_stream.hpp]
55771
55772 ['Convenience header: ][^boost/asio.hpp]
55773
55774
55775 [endsect]
55776
55777
55778
55779 [section:next_layer buffered_stream::next_layer]
55780
55781 [indexterm2 boost_asio.indexterm.buffered_stream.next_layer..next_layer..buffered_stream] 
55782 Get a reference to the next layer. 
55783
55784
55785   next_layer_type & next_layer();
55786
55787
55788
55789 [endsect]
55790
55791
55792
55793 [section:next_layer_type buffered_stream::next_layer_type]
55794
55795 [indexterm2 boost_asio.indexterm.buffered_stream.next_layer_type..next_layer_type..buffered_stream] 
55796 The type of the next layer. 
55797
55798
55799   typedef remove_reference< Stream >::type next_layer_type;
55800
55801
55802
55803 [heading Requirements]
55804
55805 ['Header: ][^boost/asio/buffered_stream.hpp]
55806
55807 ['Convenience header: ][^boost/asio.hpp]
55808
55809
55810 [endsect]
55811
55812
55813 [section:peek buffered_stream::peek]
55814
55815 [indexterm2 boost_asio.indexterm.buffered_stream.peek..peek..buffered_stream] 
55816 Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure. 
55817
55818
55819   template<
55820       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
55821   std::size_t ``[link boost_asio.reference.buffered_stream.peek.overload1 peek]``(
55822       const MutableBufferSequence & buffers);
55823   ``  [''''&raquo;''' [link boost_asio.reference.buffered_stream.peek.overload1 more...]]``
55824
55825
55826 Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred. 
55827
55828
55829   template<
55830       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
55831   std::size_t ``[link boost_asio.reference.buffered_stream.peek.overload2 peek]``(
55832       const MutableBufferSequence & buffers,
55833       boost::system::error_code & ec);
55834   ``  [''''&raquo;''' [link boost_asio.reference.buffered_stream.peek.overload2 more...]]``
55835
55836
55837 [section:overload1 buffered_stream::peek (1 of 2 overloads)]
55838
55839
55840 Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure. 
55841
55842
55843   template<
55844       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
55845   std::size_t peek(
55846       const MutableBufferSequence & buffers);
55847
55848
55849
55850 [endsect]
55851
55852
55853
55854 [section:overload2 buffered_stream::peek (2 of 2 overloads)]
55855
55856
55857 Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred. 
55858
55859
55860   template<
55861       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
55862   std::size_t peek(
55863       const MutableBufferSequence & buffers,
55864       boost::system::error_code & ec);
55865
55866
55867
55868 [endsect]
55869
55870
55871 [endsect]
55872
55873 [section:read_some buffered_stream::read_some]
55874
55875 [indexterm2 boost_asio.indexterm.buffered_stream.read_some..read_some..buffered_stream] 
55876 Read some data from the stream. Returns the number of bytes read. Throws an exception on failure. 
55877
55878
55879   template<
55880       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
55881   std::size_t ``[link boost_asio.reference.buffered_stream.read_some.overload1 read_some]``(
55882       const MutableBufferSequence & buffers);
55883   ``  [''''&raquo;''' [link boost_asio.reference.buffered_stream.read_some.overload1 more...]]``
55884
55885
55886 Read some data from the stream. Returns the number of bytes read or 0 if an error occurred. 
55887
55888
55889   template<
55890       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
55891   std::size_t ``[link boost_asio.reference.buffered_stream.read_some.overload2 read_some]``(
55892       const MutableBufferSequence & buffers,
55893       boost::system::error_code & ec);
55894   ``  [''''&raquo;''' [link boost_asio.reference.buffered_stream.read_some.overload2 more...]]``
55895
55896
55897 [section:overload1 buffered_stream::read_some (1 of 2 overloads)]
55898
55899
55900 Read some data from the stream. Returns the number of bytes read. Throws an exception on failure. 
55901
55902
55903   template<
55904       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
55905   std::size_t read_some(
55906       const MutableBufferSequence & buffers);
55907
55908
55909
55910 [endsect]
55911
55912
55913
55914 [section:overload2 buffered_stream::read_some (2 of 2 overloads)]
55915
55916
55917 Read some data from the stream. Returns the number of bytes read or 0 if an error occurred. 
55918
55919
55920   template<
55921       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
55922   std::size_t read_some(
55923       const MutableBufferSequence & buffers,
55924       boost::system::error_code & ec);
55925
55926
55927
55928 [endsect]
55929
55930
55931 [endsect]
55932
55933 [section:write_some buffered_stream::write_some]
55934
55935 [indexterm2 boost_asio.indexterm.buffered_stream.write_some..write_some..buffered_stream] 
55936 Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure. 
55937
55938
55939   template<
55940       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
55941   std::size_t ``[link boost_asio.reference.buffered_stream.write_some.overload1 write_some]``(
55942       const ConstBufferSequence & buffers);
55943   ``  [''''&raquo;''' [link boost_asio.reference.buffered_stream.write_some.overload1 more...]]``
55944
55945
55946 Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred. 
55947
55948
55949   template<
55950       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
55951   std::size_t ``[link boost_asio.reference.buffered_stream.write_some.overload2 write_some]``(
55952       const ConstBufferSequence & buffers,
55953       boost::system::error_code & ec);
55954   ``  [''''&raquo;''' [link boost_asio.reference.buffered_stream.write_some.overload2 more...]]``
55955
55956
55957 [section:overload1 buffered_stream::write_some (1 of 2 overloads)]
55958
55959
55960 Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure. 
55961
55962
55963   template<
55964       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
55965   std::size_t write_some(
55966       const ConstBufferSequence & buffers);
55967
55968
55969
55970 [endsect]
55971
55972
55973
55974 [section:overload2 buffered_stream::write_some (2 of 2 overloads)]
55975
55976
55977 Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred. 
55978
55979
55980   template<
55981       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
55982   std::size_t write_some(
55983       const ConstBufferSequence & buffers,
55984       boost::system::error_code & ec);
55985
55986
55987
55988 [endsect]
55989
55990
55991 [endsect]
55992
55993
55994 [endsect]
55995
55996 [section:buffered_write_stream buffered_write_stream]
55997
55998
55999 Adds buffering to the write-related operations of a stream. 
56000
56001
56002   template<
56003       typename Stream>
56004   class buffered_write_stream :
56005     noncopyable
56006
56007
56008 [heading Types]
56009 [table
56010   [[Name][Description]]
56011
56012   [
56013
56014     [[link boost_asio.reference.buffered_write_stream.executor_type [*executor_type]]]
56015     [The type of the executor associated with the object. ]
56016   
56017   ]
56018
56019   [
56020
56021     [[link boost_asio.reference.buffered_write_stream.lowest_layer_type [*lowest_layer_type]]]
56022     [The type of the lowest layer. ]
56023   
56024   ]
56025
56026   [
56027
56028     [[link boost_asio.reference.buffered_write_stream.next_layer_type [*next_layer_type]]]
56029     [The type of the next layer. ]
56030   
56031   ]
56032
56033 ]
56034
56035 [heading Member Functions]
56036 [table
56037   [[Name][Description]]
56038
56039   [
56040     [[link boost_asio.reference.buffered_write_stream.async_flush [*async_flush]]]
56041     [Start an asynchronous flush. ]
56042   ]
56043   
56044   [
56045     [[link boost_asio.reference.buffered_write_stream.async_read_some [*async_read_some]]]
56046     [Start an asynchronous read. The buffer into which the data will be read must be valid for the lifetime of the asynchronous operation. ]
56047   ]
56048   
56049   [
56050     [[link boost_asio.reference.buffered_write_stream.async_write_some [*async_write_some]]]
56051     [Start an asynchronous write. The data being written must be valid for the lifetime of the asynchronous operation. ]
56052   ]
56053   
56054   [
56055     [[link boost_asio.reference.buffered_write_stream.buffered_write_stream [*buffered_write_stream]]]
56056     [Construct, passing the specified argument to initialise the next layer. ]
56057   ]
56058   
56059   [
56060     [[link boost_asio.reference.buffered_write_stream.close [*close]]]
56061     [Close the stream. ]
56062   ]
56063   
56064   [
56065     [[link boost_asio.reference.buffered_write_stream.flush [*flush]]]
56066     [Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation. Throws an exception on failure. 
56067      [hr]
56068      Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation, or 0 if an error occurred. ]
56069   ]
56070   
56071   [
56072     [[link boost_asio.reference.buffered_write_stream.get_executor [*get_executor]]]
56073     [Get the executor associated with the object. ]
56074   ]
56075   
56076   [
56077     [[link boost_asio.reference.buffered_write_stream.in_avail [*in_avail]]]
56078     [Determine the amount of data that may be read without blocking. ]
56079   ]
56080   
56081   [
56082     [[link boost_asio.reference.buffered_write_stream.lowest_layer [*lowest_layer]]]
56083     [Get a reference to the lowest layer. 
56084      [hr]
56085      Get a const reference to the lowest layer. ]
56086   ]
56087   
56088   [
56089     [[link boost_asio.reference.buffered_write_stream.next_layer [*next_layer]]]
56090     [Get a reference to the next layer. ]
56091   ]
56092   
56093   [
56094     [[link boost_asio.reference.buffered_write_stream.peek [*peek]]]
56095     [Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure. 
56096      [hr]
56097      Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred. ]
56098   ]
56099   
56100   [
56101     [[link boost_asio.reference.buffered_write_stream.read_some [*read_some]]]
56102     [Read some data from the stream. Returns the number of bytes read. Throws an exception on failure. 
56103      [hr]
56104      Read some data from the stream. Returns the number of bytes read or 0 if an error occurred. ]
56105   ]
56106   
56107   [
56108     [[link boost_asio.reference.buffered_write_stream.write_some [*write_some]]]
56109     [Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure. 
56110      [hr]
56111      Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred and the error handler did not throw. ]
56112   ]
56113   
56114 ]
56115
56116 [heading Data Members]
56117 [table
56118   [[Name][Description]]
56119
56120   [
56121     [[link boost_asio.reference.buffered_write_stream.default_buffer_size [*default_buffer_size]]]
56122     [The default buffer size. ]
56123   ]
56124
56125 ]
56126
56127 The [link boost_asio.reference.buffered_write_stream `buffered_write_stream`] class template can be used to add buffering to the synchronous and asynchronous write operations of a stream.
56128
56129
56130 [heading Thread Safety]
56131   
56132 ['Distinct] ['objects:] Safe.
56133
56134 ['Shared] ['objects:] Unsafe.
56135
56136
56137
56138
56139 [heading Requirements]
56140
56141 ['Header: ][^boost/asio/buffered_write_stream.hpp]
56142
56143 ['Convenience header: ][^boost/asio.hpp]
56144
56145
56146 [section:async_flush buffered_write_stream::async_flush]
56147
56148 [indexterm2 boost_asio.indexterm.buffered_write_stream.async_flush..async_flush..buffered_write_stream] 
56149 Start an asynchronous flush. 
56150
56151
56152   template<
56153       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
56154   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_flush(
56155       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
56156
56157
56158
56159 [endsect]
56160
56161
56162
56163 [section:async_read_some buffered_write_stream::async_read_some]
56164
56165 [indexterm2 boost_asio.indexterm.buffered_write_stream.async_read_some..async_read_some..buffered_write_stream] 
56166 Start an asynchronous read. The buffer into which the data will be read must be valid for the lifetime of the asynchronous operation. 
56167
56168
56169   template<
56170       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
56171       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
56172   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_some(
56173       const MutableBufferSequence & buffers,
56174       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
56175
56176
56177
56178 [endsect]
56179
56180
56181
56182 [section:async_write_some buffered_write_stream::async_write_some]
56183
56184 [indexterm2 boost_asio.indexterm.buffered_write_stream.async_write_some..async_write_some..buffered_write_stream] 
56185 Start an asynchronous write. The data being written must be valid for the lifetime of the asynchronous operation. 
56186
56187
56188   template<
56189       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
56190       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
56191   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_some(
56192       const ConstBufferSequence & buffers,
56193       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
56194
56195
56196
56197 [endsect]
56198
56199
56200 [section:buffered_write_stream buffered_write_stream::buffered_write_stream]
56201
56202 [indexterm2 boost_asio.indexterm.buffered_write_stream.buffered_write_stream..buffered_write_stream..buffered_write_stream] 
56203 Construct, passing the specified argument to initialise the next layer. 
56204
56205
56206   template<
56207       typename Arg>
56208   explicit ``[link boost_asio.reference.buffered_write_stream.buffered_write_stream.overload1 buffered_write_stream]``(
56209       Arg & a);
56210   ``  [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.buffered_write_stream.overload1 more...]]``
56211
56212   template<
56213       typename Arg>
56214   ``[link boost_asio.reference.buffered_write_stream.buffered_write_stream.overload2 buffered_write_stream]``(
56215       Arg & a,
56216       std::size_t buffer_size);
56217   ``  [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.buffered_write_stream.overload2 more...]]``
56218
56219
56220 [section:overload1 buffered_write_stream::buffered_write_stream (1 of 2 overloads)]
56221
56222
56223 Construct, passing the specified argument to initialise the next layer. 
56224
56225
56226   template<
56227       typename Arg>
56228   buffered_write_stream(
56229       Arg & a);
56230
56231
56232
56233 [endsect]
56234
56235
56236
56237 [section:overload2 buffered_write_stream::buffered_write_stream (2 of 2 overloads)]
56238
56239
56240 Construct, passing the specified argument to initialise the next layer. 
56241
56242
56243   template<
56244       typename Arg>
56245   buffered_write_stream(
56246       Arg & a,
56247       std::size_t buffer_size);
56248
56249
56250
56251 [endsect]
56252
56253
56254 [endsect]
56255
56256 [section:close buffered_write_stream::close]
56257
56258 [indexterm2 boost_asio.indexterm.buffered_write_stream.close..close..buffered_write_stream] 
56259 Close the stream. 
56260
56261
56262   void ``[link boost_asio.reference.buffered_write_stream.close.overload1 close]``();
56263   ``  [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.close.overload1 more...]]``
56264
56265   void ``[link boost_asio.reference.buffered_write_stream.close.overload2 close]``(
56266       boost::system::error_code & ec);
56267   ``  [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.close.overload2 more...]]``
56268
56269
56270 [section:overload1 buffered_write_stream::close (1 of 2 overloads)]
56271
56272
56273 Close the stream. 
56274
56275
56276   void close();
56277
56278
56279
56280 [endsect]
56281
56282
56283
56284 [section:overload2 buffered_write_stream::close (2 of 2 overloads)]
56285
56286
56287 Close the stream. 
56288
56289
56290   void close(
56291       boost::system::error_code & ec);
56292
56293
56294
56295 [endsect]
56296
56297
56298 [endsect]
56299
56300
56301 [section:default_buffer_size buffered_write_stream::default_buffer_size]
56302
56303 [indexterm2 boost_asio.indexterm.buffered_write_stream.default_buffer_size..default_buffer_size..buffered_write_stream] 
56304 The default buffer size. 
56305
56306
56307   static const std::size_t default_buffer_size = implementation_defined;
56308
56309
56310
56311 [endsect]
56312
56313
56314
56315 [section:executor_type buffered_write_stream::executor_type]
56316
56317 [indexterm2 boost_asio.indexterm.buffered_write_stream.executor_type..executor_type..buffered_write_stream] 
56318 The type of the executor associated with the object. 
56319
56320
56321   typedef lowest_layer_type::executor_type executor_type;
56322
56323
56324
56325 [heading Requirements]
56326
56327 ['Header: ][^boost/asio/buffered_write_stream.hpp]
56328
56329 ['Convenience header: ][^boost/asio.hpp]
56330
56331
56332 [endsect]
56333
56334
56335 [section:flush buffered_write_stream::flush]
56336
56337 [indexterm2 boost_asio.indexterm.buffered_write_stream.flush..flush..buffered_write_stream] 
56338 Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation. Throws an exception on failure. 
56339
56340
56341   std::size_t ``[link boost_asio.reference.buffered_write_stream.flush.overload1 flush]``();
56342   ``  [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.flush.overload1 more...]]``
56343
56344
56345 Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation, or 0 if an error occurred. 
56346
56347
56348   std::size_t ``[link boost_asio.reference.buffered_write_stream.flush.overload2 flush]``(
56349       boost::system::error_code & ec);
56350   ``  [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.flush.overload2 more...]]``
56351
56352
56353 [section:overload1 buffered_write_stream::flush (1 of 2 overloads)]
56354
56355
56356 Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation. Throws an exception on failure. 
56357
56358
56359   std::size_t flush();
56360
56361
56362
56363 [endsect]
56364
56365
56366
56367 [section:overload2 buffered_write_stream::flush (2 of 2 overloads)]
56368
56369
56370 Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation, or 0 if an error occurred. 
56371
56372
56373   std::size_t flush(
56374       boost::system::error_code & ec);
56375
56376
56377
56378 [endsect]
56379
56380
56381 [endsect]
56382
56383
56384 [section:get_executor buffered_write_stream::get_executor]
56385
56386 [indexterm2 boost_asio.indexterm.buffered_write_stream.get_executor..get_executor..buffered_write_stream] 
56387 Get the executor associated with the object. 
56388
56389
56390   executor_type get_executor();
56391
56392
56393
56394 [endsect]
56395
56396
56397 [section:in_avail buffered_write_stream::in_avail]
56398
56399 [indexterm2 boost_asio.indexterm.buffered_write_stream.in_avail..in_avail..buffered_write_stream] 
56400 Determine the amount of data that may be read without blocking. 
56401
56402
56403   std::size_t ``[link boost_asio.reference.buffered_write_stream.in_avail.overload1 in_avail]``();
56404   ``  [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.in_avail.overload1 more...]]``
56405
56406   std::size_t ``[link boost_asio.reference.buffered_write_stream.in_avail.overload2 in_avail]``(
56407       boost::system::error_code & ec);
56408   ``  [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.in_avail.overload2 more...]]``
56409
56410
56411 [section:overload1 buffered_write_stream::in_avail (1 of 2 overloads)]
56412
56413
56414 Determine the amount of data that may be read without blocking. 
56415
56416
56417   std::size_t in_avail();
56418
56419
56420
56421 [endsect]
56422
56423
56424
56425 [section:overload2 buffered_write_stream::in_avail (2 of 2 overloads)]
56426
56427
56428 Determine the amount of data that may be read without blocking. 
56429
56430
56431   std::size_t in_avail(
56432       boost::system::error_code & ec);
56433
56434
56435
56436 [endsect]
56437
56438
56439 [endsect]
56440
56441 [section:lowest_layer buffered_write_stream::lowest_layer]
56442
56443 [indexterm2 boost_asio.indexterm.buffered_write_stream.lowest_layer..lowest_layer..buffered_write_stream] 
56444 Get a reference to the lowest layer. 
56445
56446
56447   lowest_layer_type & ``[link boost_asio.reference.buffered_write_stream.lowest_layer.overload1 lowest_layer]``();
56448   ``  [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.lowest_layer.overload1 more...]]``
56449
56450
56451 Get a const reference to the lowest layer. 
56452
56453
56454   const lowest_layer_type & ``[link boost_asio.reference.buffered_write_stream.lowest_layer.overload2 lowest_layer]``() const;
56455   ``  [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.lowest_layer.overload2 more...]]``
56456
56457
56458 [section:overload1 buffered_write_stream::lowest_layer (1 of 2 overloads)]
56459
56460
56461 Get a reference to the lowest layer. 
56462
56463
56464   lowest_layer_type & lowest_layer();
56465
56466
56467
56468 [endsect]
56469
56470
56471
56472 [section:overload2 buffered_write_stream::lowest_layer (2 of 2 overloads)]
56473
56474
56475 Get a const reference to the lowest layer. 
56476
56477
56478   const lowest_layer_type & lowest_layer() const;
56479
56480
56481
56482 [endsect]
56483
56484
56485 [endsect]
56486
56487
56488 [section:lowest_layer_type buffered_write_stream::lowest_layer_type]
56489
56490 [indexterm2 boost_asio.indexterm.buffered_write_stream.lowest_layer_type..lowest_layer_type..buffered_write_stream] 
56491 The type of the lowest layer. 
56492
56493
56494   typedef next_layer_type::lowest_layer_type lowest_layer_type;
56495
56496
56497
56498 [heading Requirements]
56499
56500 ['Header: ][^boost/asio/buffered_write_stream.hpp]
56501
56502 ['Convenience header: ][^boost/asio.hpp]
56503
56504
56505 [endsect]
56506
56507
56508
56509 [section:next_layer buffered_write_stream::next_layer]
56510
56511 [indexterm2 boost_asio.indexterm.buffered_write_stream.next_layer..next_layer..buffered_write_stream] 
56512 Get a reference to the next layer. 
56513
56514
56515   next_layer_type & next_layer();
56516
56517
56518
56519 [endsect]
56520
56521
56522
56523 [section:next_layer_type buffered_write_stream::next_layer_type]
56524
56525 [indexterm2 boost_asio.indexterm.buffered_write_stream.next_layer_type..next_layer_type..buffered_write_stream] 
56526 The type of the next layer. 
56527
56528
56529   typedef remove_reference< Stream >::type next_layer_type;
56530
56531
56532
56533 [heading Requirements]
56534
56535 ['Header: ][^boost/asio/buffered_write_stream.hpp]
56536
56537 ['Convenience header: ][^boost/asio.hpp]
56538
56539
56540 [endsect]
56541
56542
56543 [section:peek buffered_write_stream::peek]
56544
56545 [indexterm2 boost_asio.indexterm.buffered_write_stream.peek..peek..buffered_write_stream] 
56546 Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure. 
56547
56548
56549   template<
56550       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
56551   std::size_t ``[link boost_asio.reference.buffered_write_stream.peek.overload1 peek]``(
56552       const MutableBufferSequence & buffers);
56553   ``  [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.peek.overload1 more...]]``
56554
56555
56556 Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred. 
56557
56558
56559   template<
56560       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
56561   std::size_t ``[link boost_asio.reference.buffered_write_stream.peek.overload2 peek]``(
56562       const MutableBufferSequence & buffers,
56563       boost::system::error_code & ec);
56564   ``  [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.peek.overload2 more...]]``
56565
56566
56567 [section:overload1 buffered_write_stream::peek (1 of 2 overloads)]
56568
56569
56570 Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure. 
56571
56572
56573   template<
56574       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
56575   std::size_t peek(
56576       const MutableBufferSequence & buffers);
56577
56578
56579
56580 [endsect]
56581
56582
56583
56584 [section:overload2 buffered_write_stream::peek (2 of 2 overloads)]
56585
56586
56587 Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred. 
56588
56589
56590   template<
56591       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
56592   std::size_t peek(
56593       const MutableBufferSequence & buffers,
56594       boost::system::error_code & ec);
56595
56596
56597
56598 [endsect]
56599
56600
56601 [endsect]
56602
56603 [section:read_some buffered_write_stream::read_some]
56604
56605 [indexterm2 boost_asio.indexterm.buffered_write_stream.read_some..read_some..buffered_write_stream] 
56606 Read some data from the stream. Returns the number of bytes read. Throws an exception on failure. 
56607
56608
56609   template<
56610       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
56611   std::size_t ``[link boost_asio.reference.buffered_write_stream.read_some.overload1 read_some]``(
56612       const MutableBufferSequence & buffers);
56613   ``  [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.read_some.overload1 more...]]``
56614
56615
56616 Read some data from the stream. Returns the number of bytes read or 0 if an error occurred. 
56617
56618
56619   template<
56620       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
56621   std::size_t ``[link boost_asio.reference.buffered_write_stream.read_some.overload2 read_some]``(
56622       const MutableBufferSequence & buffers,
56623       boost::system::error_code & ec);
56624   ``  [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.read_some.overload2 more...]]``
56625
56626
56627 [section:overload1 buffered_write_stream::read_some (1 of 2 overloads)]
56628
56629
56630 Read some data from the stream. Returns the number of bytes read. Throws an exception on failure. 
56631
56632
56633   template<
56634       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
56635   std::size_t read_some(
56636       const MutableBufferSequence & buffers);
56637
56638
56639
56640 [endsect]
56641
56642
56643
56644 [section:overload2 buffered_write_stream::read_some (2 of 2 overloads)]
56645
56646
56647 Read some data from the stream. Returns the number of bytes read or 0 if an error occurred. 
56648
56649
56650   template<
56651       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
56652   std::size_t read_some(
56653       const MutableBufferSequence & buffers,
56654       boost::system::error_code & ec);
56655
56656
56657
56658 [endsect]
56659
56660
56661 [endsect]
56662
56663 [section:write_some buffered_write_stream::write_some]
56664
56665 [indexterm2 boost_asio.indexterm.buffered_write_stream.write_some..write_some..buffered_write_stream] 
56666 Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure. 
56667
56668
56669   template<
56670       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
56671   std::size_t ``[link boost_asio.reference.buffered_write_stream.write_some.overload1 write_some]``(
56672       const ConstBufferSequence & buffers);
56673   ``  [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.write_some.overload1 more...]]``
56674
56675
56676 Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred and the error handler did not throw. 
56677
56678
56679   template<
56680       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
56681   std::size_t ``[link boost_asio.reference.buffered_write_stream.write_some.overload2 write_some]``(
56682       const ConstBufferSequence & buffers,
56683       boost::system::error_code & ec);
56684   ``  [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.write_some.overload2 more...]]``
56685
56686
56687 [section:overload1 buffered_write_stream::write_some (1 of 2 overloads)]
56688
56689
56690 Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure. 
56691
56692
56693   template<
56694       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
56695   std::size_t write_some(
56696       const ConstBufferSequence & buffers);
56697
56698
56699
56700 [endsect]
56701
56702
56703
56704 [section:overload2 buffered_write_stream::write_some (2 of 2 overloads)]
56705
56706
56707 Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred and the error handler did not throw. 
56708
56709
56710   template<
56711       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
56712   std::size_t write_some(
56713       const ConstBufferSequence & buffers,
56714       boost::system::error_code & ec);
56715
56716
56717
56718 [endsect]
56719
56720
56721 [endsect]
56722
56723
56724 [endsect]
56725
56726
56727 [section:buffers_begin buffers_begin]
56728
56729 [indexterm1 boost_asio.indexterm.buffers_begin..buffers_begin] 
56730 Construct an iterator representing the beginning of the buffers' data. 
56731
56732
56733   template<
56734       typename BufferSequence>
56735   buffers_iterator< BufferSequence > buffers_begin(
56736       const BufferSequence & buffers);
56737
56738
56739 [heading Requirements]
56740
56741 ['Header: ][^boost/asio/buffers_iterator.hpp]
56742
56743 ['Convenience header: ][^boost/asio.hpp]
56744
56745
56746 [endsect]
56747
56748
56749
56750 [section:buffers_end buffers_end]
56751
56752 [indexterm1 boost_asio.indexterm.buffers_end..buffers_end] 
56753 Construct an iterator representing the end of the buffers' data. 
56754
56755
56756   template<
56757       typename BufferSequence>
56758   buffers_iterator< BufferSequence > buffers_end(
56759       const BufferSequence & buffers);
56760
56761
56762 [heading Requirements]
56763
56764 ['Header: ][^boost/asio/buffers_iterator.hpp]
56765
56766 ['Convenience header: ][^boost/asio.hpp]
56767
56768
56769 [endsect]
56770
56771
56772 [section:buffers_iterator buffers_iterator]
56773
56774
56775 A random access iterator over the bytes in a buffer sequence. 
56776
56777
56778   template<
56779       typename BufferSequence,
56780       typename ByteType = char>
56781   class buffers_iterator
56782
56783
56784 [heading Types]
56785 [table
56786   [[Name][Description]]
56787
56788   [
56789
56790     [[link boost_asio.reference.buffers_iterator.difference_type [*difference_type]]]
56791     [The type used for the distance between two iterators. ]
56792   
56793   ]
56794
56795   [
56796
56797     [[link boost_asio.reference.buffers_iterator.iterator_category [*iterator_category]]]
56798     [The iterator category. ]
56799   
56800   ]
56801
56802   [
56803
56804     [[link boost_asio.reference.buffers_iterator.pointer [*pointer]]]
56805     [The type of the result of applying operator->() to the iterator. ]
56806   
56807   ]
56808
56809   [
56810
56811     [[link boost_asio.reference.buffers_iterator.reference [*reference]]]
56812     [The type of the result of applying operator*() to the iterator. ]
56813   
56814   ]
56815
56816   [
56817
56818     [[link boost_asio.reference.buffers_iterator.value_type [*value_type]]]
56819     [The type of the value pointed to by the iterator. ]
56820   
56821   ]
56822
56823 ]
56824
56825 [heading Member Functions]
56826 [table
56827   [[Name][Description]]
56828
56829   [
56830     [[link boost_asio.reference.buffers_iterator.begin [*begin]]]
56831     [Construct an iterator representing the beginning of the buffers' data. ]
56832   ]
56833   
56834   [
56835     [[link boost_asio.reference.buffers_iterator.buffers_iterator [*buffers_iterator]]]
56836     [Default constructor. Creates an iterator in an undefined state. ]
56837   ]
56838   
56839   [
56840     [[link boost_asio.reference.buffers_iterator.end [*end]]]
56841     [Construct an iterator representing the end of the buffers' data. ]
56842   ]
56843   
56844   [
56845     [[link boost_asio.reference.buffers_iterator.operator__star_ [*operator *]]]
56846     [Dereference an iterator. ]
56847   ]
56848   
56849   [
56850     [[link boost_asio.reference.buffers_iterator.operator_plus__plus_ [*operator++]]]
56851     [Increment operator (prefix). 
56852      [hr]
56853      Increment operator (postfix). ]
56854   ]
56855   
56856   [
56857     [[link boost_asio.reference.buffers_iterator.operator_plus__eq_ [*operator+=]]]
56858     [Addition operator. ]
56859   ]
56860   
56861   [
56862     [[link boost_asio.reference.buffers_iterator.operator_minus__minus_ [*operator--]]]
56863     [Decrement operator (prefix). 
56864      [hr]
56865      Decrement operator (postfix). ]
56866   ]
56867   
56868   [
56869     [[link boost_asio.reference.buffers_iterator.operator_minus__eq_ [*operator-=]]]
56870     [Subtraction operator. ]
56871   ]
56872   
56873   [
56874     [[link boost_asio.reference.buffers_iterator.operator_arrow_ [*operator->]]]
56875     [Dereference an iterator. ]
56876   ]
56877   
56878   [
56879     [[link boost_asio.reference.buffers_iterator.operator_lb__rb_ [*operator\[\]]]]
56880     [Access an individual element. ]
56881   ]
56882   
56883 ]
56884
56885 [heading Friends]
56886 [table
56887   [[Name][Description]]
56888
56889   [
56890     [[link boost_asio.reference.buffers_iterator.operator_not__eq_ [*operator!=]]]
56891     [Test two iterators for inequality. ]
56892   ]
56893   
56894   [
56895     [[link boost_asio.reference.buffers_iterator.operator_plus_ [*operator+]]]
56896     [Addition operator. ]
56897   ]
56898   
56899   [
56900     [[link boost_asio.reference.buffers_iterator.operator_minus_ [*operator-]]]
56901     [Subtraction operator. ]
56902   ]
56903   
56904   [
56905     [[link boost_asio.reference.buffers_iterator.operator_lt_ [*operator<]]]
56906     [Compare two iterators. ]
56907   ]
56908   
56909   [
56910     [[link boost_asio.reference.buffers_iterator.operator_lt__eq_ [*operator<=]]]
56911     [Compare two iterators. ]
56912   ]
56913   
56914   [
56915     [[link boost_asio.reference.buffers_iterator.operator_eq__eq_ [*operator==]]]
56916     [Test two iterators for equality. ]
56917   ]
56918   
56919   [
56920     [[link boost_asio.reference.buffers_iterator.operator_gt_ [*operator>]]]
56921     [Compare two iterators. ]
56922   ]
56923   
56924   [
56925     [[link boost_asio.reference.buffers_iterator.operator_gt__eq_ [*operator>=]]]
56926     [Compare two iterators. ]
56927   ]
56928   
56929 ]
56930
56931 [heading Requirements]
56932
56933 ['Header: ][^boost/asio/buffers_iterator.hpp]
56934
56935 ['Convenience header: ][^boost/asio.hpp]
56936
56937
56938 [section:begin buffers_iterator::begin]
56939
56940 [indexterm2 boost_asio.indexterm.buffers_iterator.begin..begin..buffers_iterator] 
56941 Construct an iterator representing the beginning of the buffers' data. 
56942
56943
56944   static buffers_iterator begin(
56945       const BufferSequence & buffers);
56946
56947
56948
56949 [endsect]
56950
56951
56952
56953 [section:buffers_iterator buffers_iterator::buffers_iterator]
56954
56955 [indexterm2 boost_asio.indexterm.buffers_iterator.buffers_iterator..buffers_iterator..buffers_iterator] 
56956 Default constructor. Creates an iterator in an undefined state. 
56957
56958
56959   buffers_iterator();
56960
56961
56962
56963 [endsect]
56964
56965
56966
56967 [section:difference_type buffers_iterator::difference_type]
56968
56969 [indexterm2 boost_asio.indexterm.buffers_iterator.difference_type..difference_type..buffers_iterator] 
56970 The type used for the distance between two iterators. 
56971
56972
56973   typedef std::ptrdiff_t difference_type;
56974
56975
56976
56977 [heading Requirements]
56978
56979 ['Header: ][^boost/asio/buffers_iterator.hpp]
56980
56981 ['Convenience header: ][^boost/asio.hpp]
56982
56983
56984 [endsect]
56985
56986
56987
56988 [section:end buffers_iterator::end]
56989
56990 [indexterm2 boost_asio.indexterm.buffers_iterator.end..end..buffers_iterator] 
56991 Construct an iterator representing the end of the buffers' data. 
56992
56993
56994   static buffers_iterator end(
56995       const BufferSequence & buffers);
56996
56997
56998
56999 [endsect]
57000
57001
57002
57003 [section:iterator_category buffers_iterator::iterator_category]
57004
57005 [indexterm2 boost_asio.indexterm.buffers_iterator.iterator_category..iterator_category..buffers_iterator] 
57006 The iterator category. 
57007
57008
57009   typedef std::random_access_iterator_tag iterator_category;
57010
57011
57012
57013 [heading Requirements]
57014
57015 ['Header: ][^boost/asio/buffers_iterator.hpp]
57016
57017 ['Convenience header: ][^boost/asio.hpp]
57018
57019
57020 [endsect]
57021
57022
57023
57024 [section:operator__star_ buffers_iterator::operator *]
57025
57026 [indexterm2 boost_asio.indexterm.buffers_iterator.operator__star_..operator *..buffers_iterator] 
57027 Dereference an iterator. 
57028
57029
57030   reference operator *() const;
57031
57032
57033
57034 [endsect]
57035
57036
57037
57038 [section:operator_not__eq_ buffers_iterator::operator!=]
57039
57040 [indexterm2 boost_asio.indexterm.buffers_iterator.operator_not__eq_..operator!=..buffers_iterator] 
57041 Test two iterators for inequality. 
57042
57043
57044   friend bool operator!=(
57045       const buffers_iterator & a,
57046       const buffers_iterator & b);
57047
57048
57049 [heading Requirements]
57050
57051 ['Header: ][^boost/asio/buffers_iterator.hpp]
57052
57053 ['Convenience header: ][^boost/asio.hpp]
57054
57055
57056 [endsect]
57057
57058
57059 [section:operator_plus_ buffers_iterator::operator+]
57060
57061 [indexterm2 boost_asio.indexterm.buffers_iterator.operator_plus_..operator+..buffers_iterator] 
57062 Addition operator. 
57063
57064
57065   friend buffers_iterator ``[link boost_asio.reference.buffers_iterator.operator_plus_.overload1 operator+]``(
57066       const buffers_iterator & iter,
57067       std::ptrdiff_t difference);
57068   ``  [''''&raquo;''' [link boost_asio.reference.buffers_iterator.operator_plus_.overload1 more...]]``
57069
57070   friend buffers_iterator ``[link boost_asio.reference.buffers_iterator.operator_plus_.overload2 operator+]``(
57071       std::ptrdiff_t difference,
57072       const buffers_iterator & iter);
57073   ``  [''''&raquo;''' [link boost_asio.reference.buffers_iterator.operator_plus_.overload2 more...]]``
57074
57075
57076 [section:overload1 buffers_iterator::operator+ (1 of 2 overloads)]
57077
57078
57079 Addition operator. 
57080
57081
57082   friend buffers_iterator operator+(
57083       const buffers_iterator & iter,
57084       std::ptrdiff_t difference);
57085
57086
57087 [heading Requirements]
57088
57089 ['Header: ][^boost/asio/buffers_iterator.hpp]
57090
57091 ['Convenience header: ][^boost/asio.hpp]
57092
57093
57094 [endsect]
57095
57096
57097
57098 [section:overload2 buffers_iterator::operator+ (2 of 2 overloads)]
57099
57100
57101 Addition operator. 
57102
57103
57104   friend buffers_iterator operator+(
57105       std::ptrdiff_t difference,
57106       const buffers_iterator & iter);
57107
57108
57109 [heading Requirements]
57110
57111 ['Header: ][^boost/asio/buffers_iterator.hpp]
57112
57113 ['Convenience header: ][^boost/asio.hpp]
57114
57115
57116 [endsect]
57117
57118
57119 [endsect]
57120
57121 [section:operator_plus__plus_ buffers_iterator::operator++]
57122
57123 [indexterm2 boost_asio.indexterm.buffers_iterator.operator_plus__plus_..operator++..buffers_iterator] 
57124 Increment operator (prefix). 
57125
57126
57127   buffers_iterator & ``[link boost_asio.reference.buffers_iterator.operator_plus__plus_.overload1 operator++]``();
57128   ``  [''''&raquo;''' [link boost_asio.reference.buffers_iterator.operator_plus__plus_.overload1 more...]]``
57129
57130
57131 Increment operator (postfix). 
57132
57133
57134   buffers_iterator ``[link boost_asio.reference.buffers_iterator.operator_plus__plus_.overload2 operator++]``(
57135       int );
57136   ``  [''''&raquo;''' [link boost_asio.reference.buffers_iterator.operator_plus__plus_.overload2 more...]]``
57137
57138
57139 [section:overload1 buffers_iterator::operator++ (1 of 2 overloads)]
57140
57141
57142 Increment operator (prefix). 
57143
57144
57145   buffers_iterator & operator++();
57146
57147
57148
57149 [endsect]
57150
57151
57152
57153 [section:overload2 buffers_iterator::operator++ (2 of 2 overloads)]
57154
57155
57156 Increment operator (postfix). 
57157
57158
57159   buffers_iterator operator++(
57160       int );
57161
57162
57163
57164 [endsect]
57165
57166
57167 [endsect]
57168
57169
57170 [section:operator_plus__eq_ buffers_iterator::operator+=]
57171
57172 [indexterm2 boost_asio.indexterm.buffers_iterator.operator_plus__eq_..operator+=..buffers_iterator] 
57173 Addition operator. 
57174
57175
57176   buffers_iterator & operator+=(
57177       std::ptrdiff_t difference);
57178
57179
57180
57181 [endsect]
57182
57183
57184 [section:operator_minus_ buffers_iterator::operator-]
57185
57186 [indexterm2 boost_asio.indexterm.buffers_iterator.operator_minus_..operator-..buffers_iterator] 
57187 Subtraction operator. 
57188
57189
57190   friend buffers_iterator ``[link boost_asio.reference.buffers_iterator.operator_minus_.overload1 operator-]``(
57191       const buffers_iterator & iter,
57192       std::ptrdiff_t difference);
57193   ``  [''''&raquo;''' [link boost_asio.reference.buffers_iterator.operator_minus_.overload1 more...]]``
57194
57195   friend std::ptrdiff_t ``[link boost_asio.reference.buffers_iterator.operator_minus_.overload2 operator-]``(
57196       const buffers_iterator & a,
57197       const buffers_iterator & b);
57198   ``  [''''&raquo;''' [link boost_asio.reference.buffers_iterator.operator_minus_.overload2 more...]]``
57199
57200
57201 [section:overload1 buffers_iterator::operator- (1 of 2 overloads)]
57202
57203
57204 Subtraction operator. 
57205
57206
57207   friend buffers_iterator operator-(
57208       const buffers_iterator & iter,
57209       std::ptrdiff_t difference);
57210
57211
57212 [heading Requirements]
57213
57214 ['Header: ][^boost/asio/buffers_iterator.hpp]
57215
57216 ['Convenience header: ][^boost/asio.hpp]
57217
57218
57219 [endsect]
57220
57221
57222
57223 [section:overload2 buffers_iterator::operator- (2 of 2 overloads)]
57224
57225
57226 Subtraction operator. 
57227
57228
57229   friend std::ptrdiff_t operator-(
57230       const buffers_iterator & a,
57231       const buffers_iterator & b);
57232
57233
57234 [heading Requirements]
57235
57236 ['Header: ][^boost/asio/buffers_iterator.hpp]
57237
57238 ['Convenience header: ][^boost/asio.hpp]
57239
57240
57241 [endsect]
57242
57243
57244 [endsect]
57245
57246 [section:operator_minus__minus_ buffers_iterator::operator--]
57247
57248 [indexterm2 boost_asio.indexterm.buffers_iterator.operator_minus__minus_..operator--..buffers_iterator] 
57249 Decrement operator (prefix). 
57250
57251
57252   buffers_iterator & ``[link boost_asio.reference.buffers_iterator.operator_minus__minus_.overload1 operator--]``();
57253   ``  [''''&raquo;''' [link boost_asio.reference.buffers_iterator.operator_minus__minus_.overload1 more...]]``
57254
57255
57256 Decrement operator (postfix). 
57257
57258
57259   buffers_iterator ``[link boost_asio.reference.buffers_iterator.operator_minus__minus_.overload2 operator--]``(
57260       int );
57261   ``  [''''&raquo;''' [link boost_asio.reference.buffers_iterator.operator_minus__minus_.overload2 more...]]``
57262
57263
57264 [section:overload1 buffers_iterator::operator-- (1 of 2 overloads)]
57265
57266
57267 Decrement operator (prefix). 
57268
57269
57270   buffers_iterator & operator--();
57271
57272
57273
57274 [endsect]
57275
57276
57277
57278 [section:overload2 buffers_iterator::operator-- (2 of 2 overloads)]
57279
57280
57281 Decrement operator (postfix). 
57282
57283
57284   buffers_iterator operator--(
57285       int );
57286
57287
57288
57289 [endsect]
57290
57291
57292 [endsect]
57293
57294
57295 [section:operator_minus__eq_ buffers_iterator::operator-=]
57296
57297 [indexterm2 boost_asio.indexterm.buffers_iterator.operator_minus__eq_..operator-=..buffers_iterator] 
57298 Subtraction operator. 
57299
57300
57301   buffers_iterator & operator-=(
57302       std::ptrdiff_t difference);
57303
57304
57305
57306 [endsect]
57307
57308
57309
57310 [section:operator_arrow_ buffers_iterator::operator->]
57311
57312 [indexterm2 boost_asio.indexterm.buffers_iterator.operator_arrow_..operator->..buffers_iterator] 
57313 Dereference an iterator. 
57314
57315
57316   pointer operator->() const;
57317
57318
57319
57320 [endsect]
57321
57322
57323
57324 [section:operator_lt_ buffers_iterator::operator<]
57325
57326 [indexterm2 boost_asio.indexterm.buffers_iterator.operator_lt_..operator<..buffers_iterator] 
57327 Compare two iterators. 
57328
57329
57330   friend bool operator<(
57331       const buffers_iterator & a,
57332       const buffers_iterator & b);
57333
57334
57335 [heading Requirements]
57336
57337 ['Header: ][^boost/asio/buffers_iterator.hpp]
57338
57339 ['Convenience header: ][^boost/asio.hpp]
57340
57341
57342 [endsect]
57343
57344
57345
57346 [section:operator_lt__eq_ buffers_iterator::operator<=]
57347
57348 [indexterm2 boost_asio.indexterm.buffers_iterator.operator_lt__eq_..operator<=..buffers_iterator] 
57349 Compare two iterators. 
57350
57351
57352   friend bool operator<=(
57353       const buffers_iterator & a,
57354       const buffers_iterator & b);
57355
57356
57357 [heading Requirements]
57358
57359 ['Header: ][^boost/asio/buffers_iterator.hpp]
57360
57361 ['Convenience header: ][^boost/asio.hpp]
57362
57363
57364 [endsect]
57365
57366
57367
57368 [section:operator_eq__eq_ buffers_iterator::operator==]
57369
57370 [indexterm2 boost_asio.indexterm.buffers_iterator.operator_eq__eq_..operator==..buffers_iterator] 
57371 Test two iterators for equality. 
57372
57373
57374   friend bool operator==(
57375       const buffers_iterator & a,
57376       const buffers_iterator & b);
57377
57378
57379 [heading Requirements]
57380
57381 ['Header: ][^boost/asio/buffers_iterator.hpp]
57382
57383 ['Convenience header: ][^boost/asio.hpp]
57384
57385
57386 [endsect]
57387
57388
57389
57390 [section:operator_gt_ buffers_iterator::operator>]
57391
57392 [indexterm2 boost_asio.indexterm.buffers_iterator.operator_gt_..operator>..buffers_iterator] 
57393 Compare two iterators. 
57394
57395
57396   friend bool operator>(
57397       const buffers_iterator & a,
57398       const buffers_iterator & b);
57399
57400
57401 [heading Requirements]
57402
57403 ['Header: ][^boost/asio/buffers_iterator.hpp]
57404
57405 ['Convenience header: ][^boost/asio.hpp]
57406
57407
57408 [endsect]
57409
57410
57411
57412 [section:operator_gt__eq_ buffers_iterator::operator>=]
57413
57414 [indexterm2 boost_asio.indexterm.buffers_iterator.operator_gt__eq_..operator>=..buffers_iterator] 
57415 Compare two iterators. 
57416
57417
57418   friend bool operator>=(
57419       const buffers_iterator & a,
57420       const buffers_iterator & b);
57421
57422
57423 [heading Requirements]
57424
57425 ['Header: ][^boost/asio/buffers_iterator.hpp]
57426
57427 ['Convenience header: ][^boost/asio.hpp]
57428
57429
57430 [endsect]
57431
57432
57433
57434 [section:operator_lb__rb_ buffers_iterator::operator\[\]]
57435
57436 [indexterm2 boost_asio.indexterm.buffers_iterator.operator_lb__rb_..operator\[\]..buffers_iterator] 
57437 Access an individual element. 
57438
57439
57440   reference operator[](
57441       std::ptrdiff_t difference) const;
57442
57443
57444
57445 [endsect]
57446
57447
57448
57449 [section:pointer buffers_iterator::pointer]
57450
57451 [indexterm2 boost_asio.indexterm.buffers_iterator.pointer..pointer..buffers_iterator] 
57452 The type of the result of applying `operator->()` to the iterator. 
57453
57454
57455   typedef const_or_non_const_ByteType * pointer;
57456
57457
57458
57459 If the buffer sequence stores buffer objects that are convertible to [link boost_asio.reference.mutable_buffer `mutable_buffer`], this is a pointer to a non-const ByteType. Otherwise, a pointer to a const ByteType. 
57460
57461 [heading Requirements]
57462
57463 ['Header: ][^boost/asio/buffers_iterator.hpp]
57464
57465 ['Convenience header: ][^boost/asio.hpp]
57466
57467
57468 [endsect]
57469
57470
57471
57472 [section:reference buffers_iterator::reference]
57473
57474 [indexterm2 boost_asio.indexterm.buffers_iterator.reference..reference..buffers_iterator] 
57475 The type of the result of applying `operator*()` to the iterator. 
57476
57477
57478   typedef const_or_non_const_ByteType & reference;
57479
57480
57481
57482 If the buffer sequence stores buffer objects that are convertible to [link boost_asio.reference.mutable_buffer `mutable_buffer`], this is a reference to a non-const ByteType. Otherwise, a reference to a const ByteType. 
57483
57484 [heading Requirements]
57485
57486 ['Header: ][^boost/asio/buffers_iterator.hpp]
57487
57488 ['Convenience header: ][^boost/asio.hpp]
57489
57490
57491 [endsect]
57492
57493
57494
57495 [section:value_type buffers_iterator::value_type]
57496
57497 [indexterm2 boost_asio.indexterm.buffers_iterator.value_type..value_type..buffers_iterator] 
57498 The type of the value pointed to by the iterator. 
57499
57500
57501   typedef ByteType value_type;
57502
57503
57504
57505 [heading Requirements]
57506
57507 ['Header: ][^boost/asio/buffers_iterator.hpp]
57508
57509 ['Convenience header: ][^boost/asio.hpp]
57510
57511
57512 [endsect]
57513
57514
57515
57516 [endsect]
57517
57518 [section:co_spawn co_spawn]
57519
57520 [indexterm1 boost_asio.indexterm.co_spawn..co_spawn] 
57521 Spawn a new thread of execution. 
57522
57523   template<
57524       typename ``[link boost_asio.reference.Executor1 Executor]``,
57525       typename F,
57526       typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
57527   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.co_spawn.overload1 co_spawn]``(
57528       const Executor & ex,
57529       F && f,
57530       CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
57531       typename enable_if< is_executor< Executor >::value >::type *  = 0);
57532   ``  [''''&raquo;''' [link boost_asio.reference.co_spawn.overload1 more...]]``
57533
57534   template<
57535       typename ExecutionContext,
57536       typename F,
57537       typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
57538   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.co_spawn.overload2 co_spawn]``(
57539       ExecutionContext & ctx,
57540       F && f,
57541       CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
57542       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
57543   ``  [''''&raquo;''' [link boost_asio.reference.co_spawn.overload2 more...]]``
57544
57545 [heading Requirements]
57546
57547 ['Header: ][^boost/asio/co_spawn.hpp]
57548
57549 ['Convenience header: ][^boost/asio.hpp]
57550
57551
57552 [section:overload1 co_spawn (1 of 2 overloads)]
57553
57554
57555 Spawn a new thread of execution. 
57556
57557
57558   template<
57559       typename ``[link boost_asio.reference.Executor1 Executor]``,
57560       typename F,
57561       typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
57562   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` co_spawn(
57563       const Executor & ex,
57564       F && f,
57565       CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
57566       typename enable_if< is_executor< Executor >::value >::type *  = 0);
57567
57568
57569 The entry point function object `f` must have the signature:
57570
57571
57572
57573    awaitable<void, E> f(); 
57574
57575
57576
57577
57578 where `E` is convertible from `Executor`. 
57579
57580
57581 [endsect]
57582
57583
57584
57585 [section:overload2 co_spawn (2 of 2 overloads)]
57586
57587
57588 Spawn a new thread of execution. 
57589
57590
57591   template<
57592       typename ExecutionContext,
57593       typename F,
57594       typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
57595   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` co_spawn(
57596       ExecutionContext & ctx,
57597       F && f,
57598       CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
57599       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
57600
57601
57602 The entry point function object `f` must have the signature:
57603
57604
57605
57606    awaitable<void, E> f(); 
57607
57608
57609
57610
57611 where `E` is convertible from `ExecutionContext::executor_type`. 
57612
57613
57614 [endsect]
57615
57616
57617 [endsect]
57618
57619 [section:connect connect]
57620
57621 [indexterm1 boost_asio.indexterm.connect..connect] 
57622 The `connect` function is a composed operation that establishes a socket connection by trying each endpoint in a sequence. 
57623
57624
57625 Establishes a socket connection by trying each endpoint in a sequence. 
57626
57627   template<
57628       typename ``[link boost_asio.reference.Protocol Protocol]``,
57629       typename ``[link boost_asio.reference.Executor1 Executor]``,
57630       typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``>
57631   Protocol::endpoint ``[link boost_asio.reference.connect.overload1 connect]``(
57632       basic_socket< Protocol, Executor > & s,
57633       const EndpointSequence & endpoints,
57634       typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type *  = 0);
57635   ``  [''''&raquo;''' [link boost_asio.reference.connect.overload1 more...]]``
57636
57637   template<
57638       typename ``[link boost_asio.reference.Protocol Protocol]``,
57639       typename ``[link boost_asio.reference.Executor1 Executor]``,
57640       typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``>
57641   Protocol::endpoint ``[link boost_asio.reference.connect.overload2 connect]``(
57642       basic_socket< Protocol, Executor > & s,
57643       const EndpointSequence & endpoints,
57644       boost::system::error_code & ec,
57645       typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type *  = 0);
57646   ``  [''''&raquo;''' [link boost_asio.reference.connect.overload2 more...]]``
57647
57648 (Deprecated: Use range overload.) Establishes a socket connection by trying each endpoint in a sequence. 
57649
57650   template<
57651       typename ``[link boost_asio.reference.Protocol Protocol]``,
57652       typename ``[link boost_asio.reference.Executor1 Executor]``,
57653       typename Iterator>
57654   Iterator ``[link boost_asio.reference.connect.overload3 connect]``(
57655       basic_socket< Protocol, Executor > & s,
57656       Iterator begin,
57657       typename enable_if<!is_endpoint_sequence< Iterator >::value >::type *  = 0);
57658   ``  [''''&raquo;''' [link boost_asio.reference.connect.overload3 more...]]``
57659
57660   template<
57661       typename ``[link boost_asio.reference.Protocol Protocol]``,
57662       typename ``[link boost_asio.reference.Executor1 Executor]``,
57663       typename Iterator>
57664   Iterator ``[link boost_asio.reference.connect.overload4 connect]``(
57665       basic_socket< Protocol, Executor > & s,
57666       Iterator begin,
57667       boost::system::error_code & ec,
57668       typename enable_if<!is_endpoint_sequence< Iterator >::value >::type *  = 0);
57669   ``  [''''&raquo;''' [link boost_asio.reference.connect.overload4 more...]]``
57670
57671 Establishes a socket connection by trying each endpoint in a sequence. 
57672
57673   template<
57674       typename ``[link boost_asio.reference.Protocol Protocol]``,
57675       typename ``[link boost_asio.reference.Executor1 Executor]``,
57676       typename Iterator>
57677   Iterator ``[link boost_asio.reference.connect.overload5 connect]``(
57678       basic_socket< Protocol, Executor > & s,
57679       Iterator begin,
57680       Iterator end);
57681   ``  [''''&raquo;''' [link boost_asio.reference.connect.overload5 more...]]``
57682
57683   template<
57684       typename ``[link boost_asio.reference.Protocol Protocol]``,
57685       typename ``[link boost_asio.reference.Executor1 Executor]``,
57686       typename Iterator>
57687   Iterator ``[link boost_asio.reference.connect.overload6 connect]``(
57688       basic_socket< Protocol, Executor > & s,
57689       Iterator begin,
57690       Iterator end,
57691       boost::system::error_code & ec);
57692   ``  [''''&raquo;''' [link boost_asio.reference.connect.overload6 more...]]``
57693
57694   template<
57695       typename ``[link boost_asio.reference.Protocol Protocol]``,
57696       typename ``[link boost_asio.reference.Executor1 Executor]``,
57697       typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``,
57698       typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``>
57699   Protocol::endpoint ``[link boost_asio.reference.connect.overload7 connect]``(
57700       basic_socket< Protocol, Executor > & s,
57701       const EndpointSequence & endpoints,
57702       ConnectCondition connect_condition,
57703       typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type *  = 0);
57704   ``  [''''&raquo;''' [link boost_asio.reference.connect.overload7 more...]]``
57705
57706   template<
57707       typename ``[link boost_asio.reference.Protocol Protocol]``,
57708       typename ``[link boost_asio.reference.Executor1 Executor]``,
57709       typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``,
57710       typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``>
57711   Protocol::endpoint ``[link boost_asio.reference.connect.overload8 connect]``(
57712       basic_socket< Protocol, Executor > & s,
57713       const EndpointSequence & endpoints,
57714       ConnectCondition connect_condition,
57715       boost::system::error_code & ec,
57716       typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type *  = 0);
57717   ``  [''''&raquo;''' [link boost_asio.reference.connect.overload8 more...]]``
57718
57719 (Deprecated: Use range overload.) Establishes a socket connection by trying each endpoint in a sequence. 
57720
57721   template<
57722       typename ``[link boost_asio.reference.Protocol Protocol]``,
57723       typename ``[link boost_asio.reference.Executor1 Executor]``,
57724       typename Iterator,
57725       typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``>
57726   Iterator ``[link boost_asio.reference.connect.overload9 connect]``(
57727       basic_socket< Protocol, Executor > & s,
57728       Iterator begin,
57729       ConnectCondition connect_condition,
57730       typename enable_if<!is_endpoint_sequence< Iterator >::value >::type *  = 0);
57731   ``  [''''&raquo;''' [link boost_asio.reference.connect.overload9 more...]]``
57732
57733   template<
57734       typename ``[link boost_asio.reference.Protocol Protocol]``,
57735       typename ``[link boost_asio.reference.Executor1 Executor]``,
57736       typename Iterator,
57737       typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``>
57738   Iterator ``[link boost_asio.reference.connect.overload10 connect]``(
57739       basic_socket< Protocol, Executor > & s,
57740       Iterator begin,
57741       ConnectCondition connect_condition,
57742       boost::system::error_code & ec,
57743       typename enable_if<!is_endpoint_sequence< Iterator >::value >::type *  = 0);
57744   ``  [''''&raquo;''' [link boost_asio.reference.connect.overload10 more...]]``
57745
57746 Establishes a socket connection by trying each endpoint in a sequence. 
57747
57748   template<
57749       typename ``[link boost_asio.reference.Protocol Protocol]``,
57750       typename ``[link boost_asio.reference.Executor1 Executor]``,
57751       typename Iterator,
57752       typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``>
57753   Iterator ``[link boost_asio.reference.connect.overload11 connect]``(
57754       basic_socket< Protocol, Executor > & s,
57755       Iterator begin,
57756       Iterator end,
57757       ConnectCondition connect_condition);
57758   ``  [''''&raquo;''' [link boost_asio.reference.connect.overload11 more...]]``
57759
57760   template<
57761       typename ``[link boost_asio.reference.Protocol Protocol]``,
57762       typename ``[link boost_asio.reference.Executor1 Executor]``,
57763       typename Iterator,
57764       typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``>
57765   Iterator ``[link boost_asio.reference.connect.overload12 connect]``(
57766       basic_socket< Protocol, Executor > & s,
57767       Iterator begin,
57768       Iterator end,
57769       ConnectCondition connect_condition,
57770       boost::system::error_code & ec);
57771   ``  [''''&raquo;''' [link boost_asio.reference.connect.overload12 more...]]``
57772
57773 [heading Requirements]
57774
57775 ['Header: ][^boost/asio/connect.hpp]
57776
57777 ['Convenience header: ][^boost/asio.hpp]
57778
57779
57780 [section:overload1 connect (1 of 12 overloads)]
57781
57782
57783 Establishes a socket connection by trying each endpoint in a sequence. 
57784
57785
57786   template<
57787       typename ``[link boost_asio.reference.Protocol Protocol]``,
57788       typename ``[link boost_asio.reference.Executor1 Executor]``,
57789       typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``>
57790   Protocol::endpoint connect(
57791       basic_socket< Protocol, Executor > & s,
57792       const EndpointSequence & endpoints,
57793       typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type *  = 0);
57794
57795
57796 This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
57797
57798
57799 [heading Parameters]
57800     
57801
57802 [variablelist
57803   
57804 [[s][The socket to be connected. If the socket is already open, it will be closed.]]
57805
57806 [[endpoints][A sequence of endpoints.]]
57807
57808 ]
57809
57810
57811 [heading Return Value]
57812       
57813 The successfully connected endpoint.
57814
57815
57816 [heading Exceptions]
57817     
57818
57819 [variablelist
57820   
57821 [[boost::system::system_error][Thrown on failure. If the sequence is empty, the associated `error_code` is `boost::asio::error::not_found`. Otherwise, contains the error from the last connection attempt.]]
57822
57823 ]
57824
57825
57826 [heading Example]
57827   
57828
57829
57830    tcp::resolver r(my_context);
57831    tcp::resolver::query q("host", "service");
57832    tcp::socket s(my_context);
57833    boost::asio::connect(s, r.resolve(q)); 
57834
57835
57836
57837
57838
57839
57840
57841 [endsect]
57842
57843
57844
57845 [section:overload2 connect (2 of 12 overloads)]
57846
57847
57848 Establishes a socket connection by trying each endpoint in a sequence. 
57849
57850
57851   template<
57852       typename ``[link boost_asio.reference.Protocol Protocol]``,
57853       typename ``[link boost_asio.reference.Executor1 Executor]``,
57854       typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``>
57855   Protocol::endpoint connect(
57856       basic_socket< Protocol, Executor > & s,
57857       const EndpointSequence & endpoints,
57858       boost::system::error_code & ec,
57859       typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type *  = 0);
57860
57861
57862 This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
57863
57864
57865 [heading Parameters]
57866     
57867
57868 [variablelist
57869   
57870 [[s][The socket to be connected. If the socket is already open, it will be closed.]]
57871
57872 [[endpoints][A sequence of endpoints.]]
57873
57874 [[ec][Set to indicate what error occurred, if any. If the sequence is empty, set to `boost::asio::error::not_found`. Otherwise, contains the error from the last connection attempt.]]
57875
57876 ]
57877
57878
57879 [heading Return Value]
57880       
57881 On success, the successfully connected endpoint. Otherwise, a default-constructed endpoint.
57882
57883
57884 [heading Example]
57885   
57886
57887
57888    tcp::resolver r(my_context);
57889    tcp::resolver::query q("host", "service");
57890    tcp::socket s(my_context);
57891    boost::system::error_code ec;
57892    boost::asio::connect(s, r.resolve(q), ec);
57893    if (ec)
57894    {
57895      // An error occurred.
57896    } 
57897
57898
57899
57900
57901
57902
57903
57904 [endsect]
57905
57906
57907
57908 [section:overload3 connect (3 of 12 overloads)]
57909
57910
57911 (Deprecated: Use range overload.) Establishes a socket connection by trying each endpoint in a sequence. 
57912
57913
57914   template<
57915       typename ``[link boost_asio.reference.Protocol Protocol]``,
57916       typename ``[link boost_asio.reference.Executor1 Executor]``,
57917       typename Iterator>
57918   Iterator connect(
57919       basic_socket< Protocol, Executor > & s,
57920       Iterator begin,
57921       typename enable_if<!is_endpoint_sequence< Iterator >::value >::type *  = 0);
57922
57923
57924 This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
57925
57926
57927 [heading Parameters]
57928     
57929
57930 [variablelist
57931   
57932 [[s][The socket to be connected. If the socket is already open, it will be closed.]]
57933
57934 [[begin][An iterator pointing to the start of a sequence of endpoints.]]
57935
57936 ]
57937
57938
57939 [heading Return Value]
57940       
57941 On success, an iterator denoting the successfully connected endpoint. Otherwise, the end iterator.
57942
57943
57944 [heading Exceptions]
57945     
57946
57947 [variablelist
57948   
57949 [[boost::system::system_error][Thrown on failure. If the sequence is empty, the associated `error_code` is `boost::asio::error::not_found`. Otherwise, contains the error from the last connection attempt.]]
57950
57951 ]
57952
57953
57954 [heading Remarks]
57955       
57956 This overload assumes that a default constructed object of type `Iterator` represents the end of the sequence. This is a valid assumption for iterator types such as `boost::asio::ip::tcp::resolver::iterator`. 
57957
57958
57959
57960
57961 [endsect]
57962
57963
57964
57965 [section:overload4 connect (4 of 12 overloads)]
57966
57967
57968 (Deprecated: Use range overload.) Establishes a socket connection by trying each endpoint in a sequence. 
57969
57970
57971   template<
57972       typename ``[link boost_asio.reference.Protocol Protocol]``,
57973       typename ``[link boost_asio.reference.Executor1 Executor]``,
57974       typename Iterator>
57975   Iterator connect(
57976       basic_socket< Protocol, Executor > & s,
57977       Iterator begin,
57978       boost::system::error_code & ec,
57979       typename enable_if<!is_endpoint_sequence< Iterator >::value >::type *  = 0);
57980
57981
57982 This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
57983
57984
57985 [heading Parameters]
57986     
57987
57988 [variablelist
57989   
57990 [[s][The socket to be connected. If the socket is already open, it will be closed.]]
57991
57992 [[begin][An iterator pointing to the start of a sequence of endpoints.]]
57993
57994 [[ec][Set to indicate what error occurred, if any. If the sequence is empty, set to `boost::asio::error::not_found`. Otherwise, contains the error from the last connection attempt.]]
57995
57996 ]
57997
57998
57999 [heading Return Value]
58000       
58001 On success, an iterator denoting the successfully connected endpoint. Otherwise, the end iterator.
58002
58003
58004 [heading Remarks]
58005       
58006 This overload assumes that a default constructed object of type `Iterator` represents the end of the sequence. This is a valid assumption for iterator types such as `boost::asio::ip::tcp::resolver::iterator`. 
58007
58008
58009
58010
58011 [endsect]
58012
58013
58014
58015 [section:overload5 connect (5 of 12 overloads)]
58016
58017
58018 Establishes a socket connection by trying each endpoint in a sequence. 
58019
58020
58021   template<
58022       typename ``[link boost_asio.reference.Protocol Protocol]``,
58023       typename ``[link boost_asio.reference.Executor1 Executor]``,
58024       typename Iterator>
58025   Iterator connect(
58026       basic_socket< Protocol, Executor > & s,
58027       Iterator begin,
58028       Iterator end);
58029
58030
58031 This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
58032
58033
58034 [heading Parameters]
58035     
58036
58037 [variablelist
58038   
58039 [[s][The socket to be connected. If the socket is already open, it will be closed.]]
58040
58041 [[begin][An iterator pointing to the start of a sequence of endpoints.]]
58042
58043 [[end][An iterator pointing to the end of a sequence of endpoints.]]
58044
58045 ]
58046
58047
58048 [heading Return Value]
58049       
58050 An iterator denoting the successfully connected endpoint.
58051
58052
58053 [heading Exceptions]
58054     
58055
58056 [variablelist
58057   
58058 [[boost::system::system_error][Thrown on failure. If the sequence is empty, the associated `error_code` is `boost::asio::error::not_found`. Otherwise, contains the error from the last connection attempt.]]
58059
58060 ]
58061
58062
58063 [heading Example]
58064   
58065
58066
58067    tcp::resolver r(my_context);
58068    tcp::resolver::query q("host", "service");
58069    tcp::resolver::results_type e = r.resolve(q);
58070    tcp::socket s(my_context);
58071    boost::asio::connect(s, e.begin(), e.end()); 
58072
58073
58074
58075
58076
58077
58078
58079 [endsect]
58080
58081
58082
58083 [section:overload6 connect (6 of 12 overloads)]
58084
58085
58086 Establishes a socket connection by trying each endpoint in a sequence. 
58087
58088
58089   template<
58090       typename ``[link boost_asio.reference.Protocol Protocol]``,
58091       typename ``[link boost_asio.reference.Executor1 Executor]``,
58092       typename Iterator>
58093   Iterator connect(
58094       basic_socket< Protocol, Executor > & s,
58095       Iterator begin,
58096       Iterator end,
58097       boost::system::error_code & ec);
58098
58099
58100 This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
58101
58102
58103 [heading Parameters]
58104     
58105
58106 [variablelist
58107   
58108 [[s][The socket to be connected. If the socket is already open, it will be closed.]]
58109
58110 [[begin][An iterator pointing to the start of a sequence of endpoints.]]
58111
58112 [[end][An iterator pointing to the end of a sequence of endpoints.]]
58113
58114 [[ec][Set to indicate what error occurred, if any. If the sequence is empty, set to `boost::asio::error::not_found`. Otherwise, contains the error from the last connection attempt.]]
58115
58116 ]
58117
58118
58119 [heading Return Value]
58120       
58121 On success, an iterator denoting the successfully connected endpoint. Otherwise, the end iterator.
58122
58123
58124 [heading Example]
58125   
58126
58127
58128    tcp::resolver r(my_context);
58129    tcp::resolver::query q("host", "service");
58130    tcp::resolver::results_type e = r.resolve(q);
58131    tcp::socket s(my_context);
58132    boost::system::error_code ec;
58133    boost::asio::connect(s, e.begin(), e.end(), ec);
58134    if (ec)
58135    {
58136      // An error occurred.
58137    } 
58138
58139
58140
58141
58142
58143
58144
58145 [endsect]
58146
58147
58148
58149 [section:overload7 connect (7 of 12 overloads)]
58150
58151
58152 Establishes a socket connection by trying each endpoint in a sequence. 
58153
58154
58155   template<
58156       typename ``[link boost_asio.reference.Protocol Protocol]``,
58157       typename ``[link boost_asio.reference.Executor1 Executor]``,
58158       typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``,
58159       typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``>
58160   Protocol::endpoint connect(
58161       basic_socket< Protocol, Executor > & s,
58162       const EndpointSequence & endpoints,
58163       ConnectCondition connect_condition,
58164       typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type *  = 0);
58165
58166
58167 This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
58168
58169
58170 [heading Parameters]
58171     
58172
58173 [variablelist
58174   
58175 [[s][The socket to be connected. If the socket is already open, it will be closed.]]
58176
58177 [[endpoints][A sequence of endpoints.]]
58178
58179 [[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be: 
58180 ``
58181    bool connect_condition(
58182        const boost::system::error_code& ec,
58183        const typename Protocol::endpoint& next); 
58184 ``
58185 The `ec` parameter contains the result from the most recent connect operation. Before the first connection attempt, `ec` is always set to indicate success. The `next` parameter is the next endpoint to be tried. The function object should return true if the next endpoint should be tried, and false if it should be skipped.]]
58186
58187 ]
58188
58189
58190 [heading Return Value]
58191       
58192 The successfully connected endpoint.
58193
58194
58195 [heading Exceptions]
58196     
58197
58198 [variablelist
58199   
58200 [[boost::system::system_error][Thrown on failure. If the sequence is empty, the associated `error_code` is `boost::asio::error::not_found`. Otherwise, contains the error from the last connection attempt.]]
58201
58202 ]
58203
58204
58205 [heading Example]
58206   
58207 The following connect condition function object can be used to output information about the individual connection attempts: 
58208
58209    struct my_connect_condition
58210    {
58211      bool operator()(
58212          const boost::system::error_code& ec,
58213          const::tcp::endpoint& next)
58214      {
58215        if (ec) std::cout << "Error: " << ec.message() << std::endl;
58216        std::cout << "Trying: " << next << std::endl;
58217        return true;
58218      }
58219    }; 
58220
58221
58222 It would be used with the `boost::asio::connect` function as follows: 
58223
58224    tcp::resolver r(my_context);
58225    tcp::resolver::query q("host", "service");
58226    tcp::socket s(my_context);
58227    tcp::endpoint e = boost::asio::connect(s,
58228        r.resolve(q), my_connect_condition());
58229    std::cout << "Connected to: " << e << std::endl; 
58230
58231
58232
58233
58234
58235
58236
58237 [endsect]
58238
58239
58240
58241 [section:overload8 connect (8 of 12 overloads)]
58242
58243
58244 Establishes a socket connection by trying each endpoint in a sequence. 
58245
58246
58247   template<
58248       typename ``[link boost_asio.reference.Protocol Protocol]``,
58249       typename ``[link boost_asio.reference.Executor1 Executor]``,
58250       typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``,
58251       typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``>
58252   Protocol::endpoint connect(
58253       basic_socket< Protocol, Executor > & s,
58254       const EndpointSequence & endpoints,
58255       ConnectCondition connect_condition,
58256       boost::system::error_code & ec,
58257       typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type *  = 0);
58258
58259
58260 This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
58261
58262
58263 [heading Parameters]
58264     
58265
58266 [variablelist
58267   
58268 [[s][The socket to be connected. If the socket is already open, it will be closed.]]
58269
58270 [[endpoints][A sequence of endpoints.]]
58271
58272 [[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be: 
58273 ``
58274    bool connect_condition(
58275        const boost::system::error_code& ec,
58276        const typename Protocol::endpoint& next); 
58277 ``
58278 The `ec` parameter contains the result from the most recent connect operation. Before the first connection attempt, `ec` is always set to indicate success. The `next` parameter is the next endpoint to be tried. The function object should return true if the next endpoint should be tried, and false if it should be skipped.]]
58279
58280 [[ec][Set to indicate what error occurred, if any. If the sequence is empty, set to `boost::asio::error::not_found`. Otherwise, contains the error from the last connection attempt.]]
58281
58282 ]
58283
58284
58285 [heading Return Value]
58286       
58287 On success, the successfully connected endpoint. Otherwise, a default-constructed endpoint.
58288
58289
58290 [heading Example]
58291   
58292 The following connect condition function object can be used to output information about the individual connection attempts: 
58293
58294    struct my_connect_condition
58295    {
58296      bool operator()(
58297          const boost::system::error_code& ec,
58298          const::tcp::endpoint& next)
58299      {
58300        if (ec) std::cout << "Error: " << ec.message() << std::endl;
58301        std::cout << "Trying: " << next << std::endl;
58302        return true;
58303      }
58304    }; 
58305
58306
58307 It would be used with the `boost::asio::connect` function as follows: 
58308
58309    tcp::resolver r(my_context);
58310    tcp::resolver::query q("host", "service");
58311    tcp::socket s(my_context);
58312    boost::system::error_code ec;
58313    tcp::endpoint e = boost::asio::connect(s,
58314        r.resolve(q), my_connect_condition(), ec);
58315    if (ec)
58316    {
58317      // An error occurred.
58318    }
58319    else
58320    {
58321      std::cout << "Connected to: " << e << std::endl;
58322    } 
58323
58324
58325
58326
58327
58328
58329
58330 [endsect]
58331
58332
58333
58334 [section:overload9 connect (9 of 12 overloads)]
58335
58336
58337 (Deprecated: Use range overload.) Establishes a socket connection by trying each endpoint in a sequence. 
58338
58339
58340   template<
58341       typename ``[link boost_asio.reference.Protocol Protocol]``,
58342       typename ``[link boost_asio.reference.Executor1 Executor]``,
58343       typename Iterator,
58344       typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``>
58345   Iterator connect(
58346       basic_socket< Protocol, Executor > & s,
58347       Iterator begin,
58348       ConnectCondition connect_condition,
58349       typename enable_if<!is_endpoint_sequence< Iterator >::value >::type *  = 0);
58350
58351
58352 This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
58353
58354
58355 [heading Parameters]
58356     
58357
58358 [variablelist
58359   
58360 [[s][The socket to be connected. If the socket is already open, it will be closed.]]
58361
58362 [[begin][An iterator pointing to the start of a sequence of endpoints.]]
58363
58364 [[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be: 
58365 ``
58366    bool connect_condition(
58367        const boost::system::error_code& ec,
58368        const typename Protocol::endpoint& next); 
58369 ``
58370 The `ec` parameter contains the result from the most recent connect operation. Before the first connection attempt, `ec` is always set to indicate success. The `next` parameter is the next endpoint to be tried. The function object should return true if the next endpoint should be tried, and false if it should be skipped.]]
58371
58372 ]
58373
58374
58375 [heading Return Value]
58376       
58377 On success, an iterator denoting the successfully connected endpoint. Otherwise, the end iterator.
58378
58379
58380 [heading Exceptions]
58381     
58382
58383 [variablelist
58384   
58385 [[boost::system::system_error][Thrown on failure. If the sequence is empty, the associated `error_code` is `boost::asio::error::not_found`. Otherwise, contains the error from the last connection attempt.]]
58386
58387 ]
58388
58389
58390 [heading Remarks]
58391       
58392 This overload assumes that a default constructed object of type `Iterator` represents the end of the sequence. This is a valid assumption for iterator types such as `boost::asio::ip::tcp::resolver::iterator`. 
58393
58394
58395
58396
58397 [endsect]
58398
58399
58400
58401 [section:overload10 connect (10 of 12 overloads)]
58402
58403
58404 (Deprecated: Use range overload.) Establishes a socket connection by trying each endpoint in a sequence. 
58405
58406
58407   template<
58408       typename ``[link boost_asio.reference.Protocol Protocol]``,
58409       typename ``[link boost_asio.reference.Executor1 Executor]``,
58410       typename Iterator,
58411       typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``>
58412   Iterator connect(
58413       basic_socket< Protocol, Executor > & s,
58414       Iterator begin,
58415       ConnectCondition connect_condition,
58416       boost::system::error_code & ec,
58417       typename enable_if<!is_endpoint_sequence< Iterator >::value >::type *  = 0);
58418
58419
58420 This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
58421
58422
58423 [heading Parameters]
58424     
58425
58426 [variablelist
58427   
58428 [[s][The socket to be connected. If the socket is already open, it will be closed.]]
58429
58430 [[begin][An iterator pointing to the start of a sequence of endpoints.]]
58431
58432 [[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be: 
58433 ``
58434    bool connect_condition(
58435        const boost::system::error_code& ec,
58436        const typename Protocol::endpoint& next); 
58437 ``
58438 The `ec` parameter contains the result from the most recent connect operation. Before the first connection attempt, `ec` is always set to indicate success. The `next` parameter is the next endpoint to be tried. The function object should return true if the next endpoint should be tried, and false if it should be skipped.]]
58439
58440 [[ec][Set to indicate what error occurred, if any. If the sequence is empty, set to `boost::asio::error::not_found`. Otherwise, contains the error from the last connection attempt.]]
58441
58442 ]
58443
58444
58445 [heading Return Value]
58446       
58447 On success, an iterator denoting the successfully connected endpoint. Otherwise, the end iterator.
58448
58449
58450 [heading Remarks]
58451       
58452 This overload assumes that a default constructed object of type `Iterator` represents the end of the sequence. This is a valid assumption for iterator types such as `boost::asio::ip::tcp::resolver::iterator`. 
58453
58454
58455
58456
58457 [endsect]
58458
58459
58460
58461 [section:overload11 connect (11 of 12 overloads)]
58462
58463
58464 Establishes a socket connection by trying each endpoint in a sequence. 
58465
58466
58467   template<
58468       typename ``[link boost_asio.reference.Protocol Protocol]``,
58469       typename ``[link boost_asio.reference.Executor1 Executor]``,
58470       typename Iterator,
58471       typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``>
58472   Iterator connect(
58473       basic_socket< Protocol, Executor > & s,
58474       Iterator begin,
58475       Iterator end,
58476       ConnectCondition connect_condition);
58477
58478
58479 This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
58480
58481
58482 [heading Parameters]
58483     
58484
58485 [variablelist
58486   
58487 [[s][The socket to be connected. If the socket is already open, it will be closed.]]
58488
58489 [[begin][An iterator pointing to the start of a sequence of endpoints.]]
58490
58491 [[end][An iterator pointing to the end of a sequence of endpoints.]]
58492
58493 [[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be: 
58494 ``
58495    bool connect_condition(
58496        const boost::system::error_code& ec,
58497        const typename Protocol::endpoint& next); 
58498 ``
58499 The `ec` parameter contains the result from the most recent connect operation. Before the first connection attempt, `ec` is always set to indicate success. The `next` parameter is the next endpoint to be tried. The function object should return true if the next endpoint should be tried, and false if it should be skipped.]]
58500
58501 ]
58502
58503
58504 [heading Return Value]
58505       
58506 An iterator denoting the successfully connected endpoint.
58507
58508
58509 [heading Exceptions]
58510     
58511
58512 [variablelist
58513   
58514 [[boost::system::system_error][Thrown on failure. If the sequence is empty, the associated `error_code` is `boost::asio::error::not_found`. Otherwise, contains the error from the last connection attempt.]]
58515
58516 ]
58517
58518
58519 [heading Example]
58520   
58521 The following connect condition function object can be used to output information about the individual connection attempts: 
58522
58523    struct my_connect_condition
58524    {
58525      bool operator()(
58526          const boost::system::error_code& ec,
58527          const::tcp::endpoint& next)
58528      {
58529        if (ec) std::cout << "Error: " << ec.message() << std::endl;
58530        std::cout << "Trying: " << next << std::endl;
58531        return true;
58532      }
58533    }; 
58534
58535
58536 It would be used with the `boost::asio::connect` function as follows: 
58537
58538    tcp::resolver r(my_context);
58539    tcp::resolver::query q("host", "service");
58540    tcp::resolver::results_type e = r.resolve(q);
58541    tcp::socket s(my_context);
58542    tcp::resolver::results_type::iterator i = boost::asio::connect(
58543        s, e.begin(), e.end(), my_connect_condition());
58544    std::cout << "Connected to: " << i->endpoint() << std::endl; 
58545
58546
58547
58548
58549
58550
58551
58552 [endsect]
58553
58554
58555
58556 [section:overload12 connect (12 of 12 overloads)]
58557
58558
58559 Establishes a socket connection by trying each endpoint in a sequence. 
58560
58561
58562   template<
58563       typename ``[link boost_asio.reference.Protocol Protocol]``,
58564       typename ``[link boost_asio.reference.Executor1 Executor]``,
58565       typename Iterator,
58566       typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``>
58567   Iterator connect(
58568       basic_socket< Protocol, Executor > & s,
58569       Iterator begin,
58570       Iterator end,
58571       ConnectCondition connect_condition,
58572       boost::system::error_code & ec);
58573
58574
58575 This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
58576
58577
58578 [heading Parameters]
58579     
58580
58581 [variablelist
58582   
58583 [[s][The socket to be connected. If the socket is already open, it will be closed.]]
58584
58585 [[begin][An iterator pointing to the start of a sequence of endpoints.]]
58586
58587 [[end][An iterator pointing to the end of a sequence of endpoints.]]
58588
58589 [[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be: 
58590 ``
58591    bool connect_condition(
58592        const boost::system::error_code& ec,
58593        const typename Protocol::endpoint& next); 
58594 ``
58595 The `ec` parameter contains the result from the most recent connect operation. Before the first connection attempt, `ec` is always set to indicate success. The `next` parameter is the next endpoint to be tried. The function object should return true if the next endpoint should be tried, and false if it should be skipped.]]
58596
58597 [[ec][Set to indicate what error occurred, if any. If the sequence is empty, set to `boost::asio::error::not_found`. Otherwise, contains the error from the last connection attempt.]]
58598
58599 ]
58600
58601
58602 [heading Return Value]
58603       
58604 On success, an iterator denoting the successfully connected endpoint. Otherwise, the end iterator.
58605
58606
58607 [heading Example]
58608   
58609 The following connect condition function object can be used to output information about the individual connection attempts: 
58610
58611    struct my_connect_condition
58612    {
58613      bool operator()(
58614          const boost::system::error_code& ec,
58615          const::tcp::endpoint& next)
58616      {
58617        if (ec) std::cout << "Error: " << ec.message() << std::endl;
58618        std::cout << "Trying: " << next << std::endl;
58619        return true;
58620      }
58621    }; 
58622
58623
58624 It would be used with the `boost::asio::connect` function as follows: 
58625
58626    tcp::resolver r(my_context);
58627    tcp::resolver::query q("host", "service");
58628    tcp::resolver::results_type e = r.resolve(q);
58629    tcp::socket s(my_context);
58630    boost::system::error_code ec;
58631    tcp::resolver::results_type::iterator i = boost::asio::connect(
58632        s, e.begin(), e.end(), my_connect_condition());
58633    if (ec)
58634    {
58635      // An error occurred.
58636    }
58637    else
58638    {
58639      std::cout << "Connected to: " << i->endpoint() << std::endl;
58640    } 
58641
58642
58643
58644
58645
58646
58647
58648 [endsect]
58649
58650
58651 [endsect]
58652
58653 [section:const_buffer const_buffer]
58654
58655
58656 Holds a buffer that cannot be modified. 
58657
58658
58659   class const_buffer
58660
58661
58662 [heading Member Functions]
58663 [table
58664   [[Name][Description]]
58665
58666   [
58667     [[link boost_asio.reference.const_buffer.const_buffer [*const_buffer]]]
58668     [Construct an empty buffer. 
58669      [hr]
58670      Construct a buffer to represent a given memory range. 
58671      [hr]
58672      Construct a non-modifiable buffer from a modifiable one. ]
58673   ]
58674   
58675   [
58676     [[link boost_asio.reference.const_buffer.data [*data]]]
58677     [Get a pointer to the beginning of the memory range. ]
58678   ]
58679   
58680   [
58681     [[link boost_asio.reference.const_buffer.operator_plus__eq_ [*operator+=]]]
58682     [Move the start of the buffer by the specified number of bytes. ]
58683   ]
58684   
58685   [
58686     [[link boost_asio.reference.const_buffer.size [*size]]]
58687     [Get the size of the memory range. ]
58688   ]
58689   
58690 ]
58691
58692 [heading Related Functions]
58693 [table
58694   [[Name][Description]]
58695
58696   [
58697     [[link boost_asio.reference.const_buffer.operator_plus_ [*operator+]]]
58698     [Create a new non-modifiable buffer that is offset from the start of another. ]
58699   ]
58700   
58701 ]
58702
58703 The [link boost_asio.reference.const_buffer `const_buffer`] class provides a safe representation of a buffer that cannot be modified. It does not own the underlying data, and so is cheap to copy or assign.
58704
58705
58706 [heading Accessing Buffer Contents]
58707   
58708
58709
58710 The contents of a buffer may be accessed using the `data()` and `size()` member functions:
58711
58712
58713
58714    boost::asio::const_buffer b1 = ...;
58715    std::size_t s1 = b1.size();
58716    const unsigned char* p1 = static_cast<const unsigned char*>(b1.data());
58717
58718
58719
58720
58721 The `data()` member function permits violations of type safety, so uses of it in application code should be carefully considered. 
58722
58723 [heading Requirements]
58724
58725 ['Header: ][^boost/asio/buffer.hpp]
58726
58727 ['Convenience header: ][^boost/asio.hpp]
58728
58729 [section:const_buffer const_buffer::const_buffer]
58730
58731 [indexterm2 boost_asio.indexterm.const_buffer.const_buffer..const_buffer..const_buffer] 
58732 Construct an empty buffer. 
58733
58734
58735   ``[link boost_asio.reference.const_buffer.const_buffer.overload1 const_buffer]``();
58736   ``  [''''&raquo;''' [link boost_asio.reference.const_buffer.const_buffer.overload1 more...]]``
58737
58738
58739 Construct a buffer to represent a given memory range. 
58740
58741
58742   ``[link boost_asio.reference.const_buffer.const_buffer.overload2 const_buffer]``(
58743       const void * data,
58744       std::size_t size);
58745   ``  [''''&raquo;''' [link boost_asio.reference.const_buffer.const_buffer.overload2 more...]]``
58746
58747
58748 Construct a non-modifiable buffer from a modifiable one. 
58749
58750
58751   ``[link boost_asio.reference.const_buffer.const_buffer.overload3 const_buffer]``(
58752       const mutable_buffer & b);
58753   ``  [''''&raquo;''' [link boost_asio.reference.const_buffer.const_buffer.overload3 more...]]``
58754
58755
58756 [section:overload1 const_buffer::const_buffer (1 of 3 overloads)]
58757
58758
58759 Construct an empty buffer. 
58760
58761
58762   const_buffer();
58763
58764
58765
58766 [endsect]
58767
58768
58769
58770 [section:overload2 const_buffer::const_buffer (2 of 3 overloads)]
58771
58772
58773 Construct a buffer to represent a given memory range. 
58774
58775
58776   const_buffer(
58777       const void * data,
58778       std::size_t size);
58779
58780
58781
58782 [endsect]
58783
58784
58785
58786 [section:overload3 const_buffer::const_buffer (3 of 3 overloads)]
58787
58788
58789 Construct a non-modifiable buffer from a modifiable one. 
58790
58791
58792   const_buffer(
58793       const mutable_buffer & b);
58794
58795
58796
58797 [endsect]
58798
58799
58800 [endsect]
58801
58802
58803 [section:data const_buffer::data]
58804
58805 [indexterm2 boost_asio.indexterm.const_buffer.data..data..const_buffer] 
58806 Get a pointer to the beginning of the memory range. 
58807
58808
58809   const void * data() const;
58810
58811
58812
58813 [endsect]
58814
58815
58816 [section:operator_plus_ const_buffer::operator+]
58817
58818 [indexterm2 boost_asio.indexterm.const_buffer.operator_plus_..operator+..const_buffer] 
58819 Create a new non-modifiable buffer that is offset from the start of another. 
58820
58821
58822   const_buffer ``[link boost_asio.reference.const_buffer.operator_plus_.overload1 operator+]``(
58823       const const_buffer & b,
58824       std::size_t n);
58825   ``  [''''&raquo;''' [link boost_asio.reference.const_buffer.operator_plus_.overload1 more...]]``
58826
58827   const_buffer ``[link boost_asio.reference.const_buffer.operator_plus_.overload2 operator+]``(
58828       std::size_t n,
58829       const const_buffer & b);
58830   ``  [''''&raquo;''' [link boost_asio.reference.const_buffer.operator_plus_.overload2 more...]]``
58831
58832
58833 [section:overload1 const_buffer::operator+ (1 of 2 overloads)]
58834
58835
58836 Create a new non-modifiable buffer that is offset from the start of another. 
58837
58838
58839   const_buffer operator+(
58840       const const_buffer & b,
58841       std::size_t n);
58842
58843
58844
58845 [endsect]
58846
58847
58848
58849 [section:overload2 const_buffer::operator+ (2 of 2 overloads)]
58850
58851
58852 Create a new non-modifiable buffer that is offset from the start of another. 
58853
58854
58855   const_buffer operator+(
58856       std::size_t n,
58857       const const_buffer & b);
58858
58859
58860
58861 [endsect]
58862
58863
58864 [endsect]
58865
58866
58867 [section:operator_plus__eq_ const_buffer::operator+=]
58868
58869 [indexterm2 boost_asio.indexterm.const_buffer.operator_plus__eq_..operator+=..const_buffer] 
58870 Move the start of the buffer by the specified number of bytes. 
58871
58872
58873   const_buffer & operator+=(
58874       std::size_t n);
58875
58876
58877
58878 [endsect]
58879
58880
58881
58882 [section:size const_buffer::size]
58883
58884 [indexterm2 boost_asio.indexterm.const_buffer.size..size..const_buffer] 
58885 Get the size of the memory range. 
58886
58887
58888   std::size_t size() const;
58889
58890
58891
58892 [endsect]
58893
58894
58895
58896 [endsect]
58897
58898 [section:const_buffers_1 const_buffers_1]
58899
58900
58901 (Deprecated: Use [link boost_asio.reference.const_buffer `const_buffer`].) Adapts a single non-modifiable buffer so that it meets the requirements of the ConstBufferSequence concept. 
58902
58903
58904   class const_buffers_1 :
58905     public const_buffer
58906
58907
58908 [heading Types]
58909 [table
58910   [[Name][Description]]
58911
58912   [
58913
58914     [[link boost_asio.reference.const_buffers_1.const_iterator [*const_iterator]]]
58915     [A random-access iterator type that may be used to read elements. ]
58916   
58917   ]
58918
58919   [
58920
58921     [[link boost_asio.reference.const_buffers_1.value_type [*value_type]]]
58922     [The type for each element in the list of buffers. ]
58923   
58924   ]
58925
58926 ]
58927
58928 [heading Member Functions]
58929 [table
58930   [[Name][Description]]
58931
58932   [
58933     [[link boost_asio.reference.const_buffers_1.begin [*begin]]]
58934     [Get a random-access iterator to the first element. ]
58935   ]
58936   
58937   [
58938     [[link boost_asio.reference.const_buffers_1.const_buffers_1 [*const_buffers_1]]]
58939     [Construct to represent a given memory range. 
58940      [hr]
58941      Construct to represent a single non-modifiable buffer. ]
58942   ]
58943   
58944   [
58945     [[link boost_asio.reference.const_buffers_1.data [*data]]]
58946     [Get a pointer to the beginning of the memory range. ]
58947   ]
58948   
58949   [
58950     [[link boost_asio.reference.const_buffers_1.end [*end]]]
58951     [Get a random-access iterator for one past the last element. ]
58952   ]
58953   
58954   [
58955     [[link boost_asio.reference.const_buffers_1.operator_plus__eq_ [*operator+=]]]
58956     [Move the start of the buffer by the specified number of bytes. ]
58957   ]
58958   
58959   [
58960     [[link boost_asio.reference.const_buffers_1.size [*size]]]
58961     [Get the size of the memory range. ]
58962   ]
58963   
58964 ]
58965
58966 [heading Related Functions]
58967 [table
58968   [[Name][Description]]
58969
58970   [
58971     [[link boost_asio.reference.const_buffers_1.operator_plus_ [*operator+]]]
58972     [Create a new non-modifiable buffer that is offset from the start of another. ]
58973   ]
58974   
58975 ]
58976
58977 [heading Requirements]
58978
58979 ['Header: ][^boost/asio/buffer.hpp]
58980
58981 ['Convenience header: ][^boost/asio.hpp]
58982
58983
58984 [section:begin const_buffers_1::begin]
58985
58986 [indexterm2 boost_asio.indexterm.const_buffers_1.begin..begin..const_buffers_1] 
58987 Get a random-access iterator to the first element. 
58988
58989
58990   const_iterator begin() const;
58991
58992
58993
58994 [endsect]
58995
58996
58997 [section:const_buffers_1 const_buffers_1::const_buffers_1]
58998
58999 [indexterm2 boost_asio.indexterm.const_buffers_1.const_buffers_1..const_buffers_1..const_buffers_1] 
59000 Construct to represent a given memory range. 
59001
59002
59003   ``[link boost_asio.reference.const_buffers_1.const_buffers_1.overload1 const_buffers_1]``(
59004       const void * data,
59005       std::size_t size);
59006   ``  [''''&raquo;''' [link boost_asio.reference.const_buffers_1.const_buffers_1.overload1 more...]]``
59007
59008
59009 Construct to represent a single non-modifiable buffer. 
59010
59011
59012   explicit ``[link boost_asio.reference.const_buffers_1.const_buffers_1.overload2 const_buffers_1]``(
59013       const const_buffer & b);
59014   ``  [''''&raquo;''' [link boost_asio.reference.const_buffers_1.const_buffers_1.overload2 more...]]``
59015
59016
59017 [section:overload1 const_buffers_1::const_buffers_1 (1 of 2 overloads)]
59018
59019
59020 Construct to represent a given memory range. 
59021
59022
59023   const_buffers_1(
59024       const void * data,
59025       std::size_t size);
59026
59027
59028
59029 [endsect]
59030
59031
59032
59033 [section:overload2 const_buffers_1::const_buffers_1 (2 of 2 overloads)]
59034
59035
59036 Construct to represent a single non-modifiable buffer. 
59037
59038
59039   const_buffers_1(
59040       const const_buffer & b);
59041
59042
59043
59044 [endsect]
59045
59046
59047 [endsect]
59048
59049
59050 [section:const_iterator const_buffers_1::const_iterator]
59051
59052 [indexterm2 boost_asio.indexterm.const_buffers_1.const_iterator..const_iterator..const_buffers_1] 
59053 A random-access iterator type that may be used to read elements. 
59054
59055
59056   typedef const const_buffer * const_iterator;
59057
59058
59059
59060 [heading Requirements]
59061
59062 ['Header: ][^boost/asio/buffer.hpp]
59063
59064 ['Convenience header: ][^boost/asio.hpp]
59065
59066
59067 [endsect]
59068
59069
59070
59071 [section:data const_buffers_1::data]
59072
59073
59074 ['Inherited from const_buffer.]
59075
59076 [indexterm2 boost_asio.indexterm.const_buffers_1.data..data..const_buffers_1] 
59077 Get a pointer to the beginning of the memory range. 
59078
59079
59080   const void * data() const;
59081
59082
59083
59084 [endsect]
59085
59086
59087
59088 [section:end const_buffers_1::end]
59089
59090 [indexterm2 boost_asio.indexterm.const_buffers_1.end..end..const_buffers_1] 
59091 Get a random-access iterator for one past the last element. 
59092
59093
59094   const_iterator end() const;
59095
59096
59097
59098 [endsect]
59099
59100
59101 [section:operator_plus_ const_buffers_1::operator+]
59102
59103 [indexterm2 boost_asio.indexterm.const_buffers_1.operator_plus_..operator+..const_buffers_1] 
59104 Create a new non-modifiable buffer that is offset from the start of another. 
59105
59106
59107   const_buffer ``[link boost_asio.reference.const_buffers_1.operator_plus_.overload1 operator+]``(
59108       const const_buffer & b,
59109       std::size_t n);
59110   ``  [''''&raquo;''' [link boost_asio.reference.const_buffers_1.operator_plus_.overload1 more...]]``
59111
59112   const_buffer ``[link boost_asio.reference.const_buffers_1.operator_plus_.overload2 operator+]``(
59113       std::size_t n,
59114       const const_buffer & b);
59115   ``  [''''&raquo;''' [link boost_asio.reference.const_buffers_1.operator_plus_.overload2 more...]]``
59116
59117
59118 [section:overload1 const_buffers_1::operator+ (1 of 2 overloads)]
59119
59120
59121 ['Inherited from const_buffer.]
59122
59123
59124 Create a new non-modifiable buffer that is offset from the start of another. 
59125
59126
59127   const_buffer operator+(
59128       const const_buffer & b,
59129       std::size_t n);
59130
59131
59132
59133 [endsect]
59134
59135
59136
59137 [section:overload2 const_buffers_1::operator+ (2 of 2 overloads)]
59138
59139
59140 ['Inherited from const_buffer.]
59141
59142
59143 Create a new non-modifiable buffer that is offset from the start of another. 
59144
59145
59146   const_buffer operator+(
59147       std::size_t n,
59148       const const_buffer & b);
59149
59150
59151
59152 [endsect]
59153
59154
59155 [endsect]
59156
59157
59158 [section:operator_plus__eq_ const_buffers_1::operator+=]
59159
59160
59161 ['Inherited from const_buffer.]
59162
59163 [indexterm2 boost_asio.indexterm.const_buffers_1.operator_plus__eq_..operator+=..const_buffers_1] 
59164 Move the start of the buffer by the specified number of bytes. 
59165
59166
59167   const_buffer & operator+=(
59168       std::size_t n);
59169
59170
59171
59172 [endsect]
59173
59174
59175
59176 [section:size const_buffers_1::size]
59177
59178
59179 ['Inherited from const_buffer.]
59180
59181 [indexterm2 boost_asio.indexterm.const_buffers_1.size..size..const_buffers_1] 
59182 Get the size of the memory range. 
59183
59184
59185   std::size_t size() const;
59186
59187
59188
59189 [endsect]
59190
59191
59192
59193 [section:value_type const_buffers_1::value_type]
59194
59195 [indexterm2 boost_asio.indexterm.const_buffers_1.value_type..value_type..const_buffers_1] 
59196 The type for each element in the list of buffers. 
59197
59198
59199   typedef const_buffer value_type;
59200
59201
59202 [heading Member Functions]
59203 [table
59204   [[Name][Description]]
59205
59206   [
59207     [[link boost_asio.reference.const_buffer.const_buffer [*const_buffer]]]
59208     [Construct an empty buffer. 
59209      [hr]
59210      Construct a buffer to represent a given memory range. 
59211      [hr]
59212      Construct a non-modifiable buffer from a modifiable one. ]
59213   ]
59214   
59215   [
59216     [[link boost_asio.reference.const_buffer.data [*data]]]
59217     [Get a pointer to the beginning of the memory range. ]
59218   ]
59219   
59220   [
59221     [[link boost_asio.reference.const_buffer.operator_plus__eq_ [*operator+=]]]
59222     [Move the start of the buffer by the specified number of bytes. ]
59223   ]
59224   
59225   [
59226     [[link boost_asio.reference.const_buffer.size [*size]]]
59227     [Get the size of the memory range. ]
59228   ]
59229   
59230 ]
59231
59232 [heading Related Functions]
59233 [table
59234   [[Name][Description]]
59235
59236   [
59237     [[link boost_asio.reference.const_buffer.operator_plus_ [*operator+]]]
59238     [Create a new non-modifiable buffer that is offset from the start of another. ]
59239   ]
59240   
59241 ]
59242
59243 The [link boost_asio.reference.const_buffer `const_buffer`] class provides a safe representation of a buffer that cannot be modified. It does not own the underlying data, and so is cheap to copy or assign.
59244
59245
59246 [heading Accessing Buffer Contents]
59247   
59248
59249
59250 The contents of a buffer may be accessed using the `data()` and `size()` member functions:
59251
59252
59253
59254    boost::asio::const_buffer b1 = ...;
59255    std::size_t s1 = b1.size();
59256    const unsigned char* p1 = static_cast<const unsigned char*>(b1.data());
59257
59258
59259
59260
59261 The `data()` member function permits violations of type safety, so uses of it in application code should be carefully considered. 
59262
59263
59264 [heading Requirements]
59265
59266 ['Header: ][^boost/asio/buffer.hpp]
59267
59268 ['Convenience header: ][^boost/asio.hpp]
59269
59270
59271 [endsect]
59272
59273
59274
59275 [endsect]
59276
59277 [section:coroutine coroutine]
59278
59279
59280 Provides support for implementing stackless coroutines. 
59281
59282
59283   class coroutine
59284
59285
59286 [heading Member Functions]
59287 [table
59288   [[Name][Description]]
59289
59290   [
59291     [[link boost_asio.reference.coroutine.coroutine [*coroutine]]]
59292     [Constructs a coroutine in its initial state. ]
59293   ]
59294   
59295   [
59296     [[link boost_asio.reference.coroutine.is_child [*is_child]]]
59297     [Returns true if the coroutine is the child of a fork. ]
59298   ]
59299   
59300   [
59301     [[link boost_asio.reference.coroutine.is_complete [*is_complete]]]
59302     [Returns true if the coroutine has reached its terminal state. ]
59303   ]
59304   
59305   [
59306     [[link boost_asio.reference.coroutine.is_parent [*is_parent]]]
59307     [Returns true if the coroutine is the parent of a fork. ]
59308   ]
59309   
59310 ]
59311
59312 The `coroutine` class may be used to implement stackless coroutines. The class itself is used to store the current state of the coroutine.
59313
59314 Coroutines are copy-constructible and assignable, and the space overhead is a single int. They can be used as a base class:
59315
59316
59317
59318    class session : coroutine
59319    {
59320      ...
59321    }; 
59322
59323
59324
59325
59326 or as a data member:
59327
59328
59329
59330    class session
59331    {
59332      ...
59333      coroutine coro_;
59334    }; 
59335
59336
59337
59338
59339 or even bound in as a function argument using lambdas or `bind()`. The important thing is that as the application maintains a copy of the object for as long as the coroutine must be kept alive.
59340
59341
59342 [heading Pseudo-keywords]
59343   
59344
59345
59346 A coroutine is used in conjunction with certain "pseudo-keywords", which are implemented as macros. These macros are defined by a header file:
59347
59348
59349
59350    #include <boost/asio/yield.hpp>
59351
59352
59353
59354
59355 and may conversely be undefined as follows:
59356
59357
59358
59359    #include <boost/asio/unyield.hpp>
59360
59361
59362
59363
59364 [*reenter]
59365
59366 The `reenter` macro is used to define the body of a coroutine. It takes a single argument: a pointer or reference to a coroutine object. For example, if the base class is a coroutine object you may write:
59367
59368
59369
59370    reenter (this)
59371    {
59372      ... coroutine body ...
59373    } 
59374
59375
59376
59377
59378 and if a data member or other variable you can write:
59379
59380
59381
59382    reenter (coro_)
59383    {
59384      ... coroutine body ...
59385    } 
59386
59387
59388
59389
59390 When `reenter` is executed at runtime, control jumps to the location of the last `yield` or `fork`.
59391
59392 The coroutine body may also be a single statement, such as:
59393
59394
59395
59396    reenter (this) for (;;)
59397    {
59398      ...
59399    } 
59400
59401
59402
59403
59404 [*Limitation:] The `reenter` macro is implemented using a switch. This means that you must take care when using local variables within the coroutine body. The local variable is not allowed in a position where reentering the coroutine could bypass the variable definition.
59405
59406 [*yield ['statement]]
59407
59408 This form of the `yield` keyword is often used with asynchronous operations:
59409
59410
59411
59412    yield socket_->async_read_some(buffer(*buffer_), *this); 
59413
59414
59415
59416
59417 This divides into four logical steps:
59418
59419
59420 * `yield` saves the current state of the coroutine. 
59421
59422 * The statement initiates the asynchronous operation. 
59423
59424 * The resume point is defined immediately following the statement. 
59425
59426 * Control is transferred to the end of the coroutine body.
59427
59428 When the asynchronous operation completes, the function object is invoked and `reenter` causes control to transfer to the resume point. It is important to remember to carry the coroutine state forward with the asynchronous operation. In the above snippet, the current class is a function object object with a coroutine object as base class or data member.
59429
59430 The statement may also be a compound statement, and this permits us to define local variables with limited scope:
59431
59432
59433
59434    yield
59435    {
59436      mutable_buffers_1 b = buffer(*buffer_);
59437      socket_->async_read_some(b, *this);
59438    } 
59439
59440
59441
59442
59443 [*yield return ['expression] ;]
59444
59445 This form of `yield` is often used in generators or coroutine-based parsers. For example, the function object:
59446
59447
59448
59449    struct interleave : coroutine
59450    {
59451      istream& is1;
59452      istream& is2;
59453      char operator()(char c)
59454      {
59455        reenter (this) for (;;)
59456        {
59457          yield return is1.get();
59458          yield return is2.get();
59459        }
59460      }
59461    }; 
59462
59463
59464
59465
59466 defines a trivial coroutine that interleaves the characters from two input streams.
59467
59468 This type of `yield` divides into three logical steps:
59469
59470
59471 * `yield` saves the current state of the coroutine. 
59472
59473 * The resume point is defined immediately following the semicolon. 
59474
59475 * The value of the expression is returned from the function.
59476
59477 [*yield ;]
59478
59479 This form of `yield` is equivalent to the following steps:
59480
59481
59482 * `yield` saves the current state of the coroutine. 
59483
59484 * The resume point is defined immediately following the semicolon. 
59485
59486 * Control is transferred to the end of the coroutine body.
59487
59488 This form might be applied when coroutines are used for cooperative threading and scheduling is explicitly managed. For example:
59489
59490
59491
59492    struct task : coroutine
59493    {
59494      ...
59495      void operator()()
59496      {
59497        reenter (this)
59498        {
59499          while (... not finished ...)
59500          {
59501            ... do something ...
59502            yield;
59503            ... do some more ...
59504            yield;
59505          }
59506        }
59507      }
59508      ...
59509    };
59510    ...
59511    task t1, t2;
59512    for (;;)
59513    {
59514      t1();
59515      t2();
59516    } 
59517
59518
59519
59520
59521 [*yield break ;]
59522
59523 The final form of `yield` is used to explicitly terminate the coroutine. This form is comprised of two steps:
59524
59525
59526 * `yield` sets the coroutine state to indicate termination. 
59527
59528 * Control is transferred to the end of the coroutine body.
59529
59530 Once terminated, calls to `is_complete()` return true and the coroutine cannot be reentered.
59531
59532 Note that a coroutine may also be implicitly terminated if the coroutine body is exited without a yield, e.g. by return, throw or by running to the end of the body.
59533
59534 [*fork ['statement]]
59535
59536 The `fork` pseudo-keyword is used when "forking" a coroutine, i.e. splitting it into two (or more) copies. One use of `fork` is in a server, where a new coroutine is created to handle each client connection:
59537
59538
59539
59540    reenter (this)
59541    {
59542      do
59543      {
59544        socket_.reset(new tcp::socket(my_context_));
59545        yield acceptor->async_accept(*socket_, *this);
59546        fork server(*this)();
59547      } while (is_parent());
59548      ... client-specific handling follows ...
59549    } 
59550
59551
59552
59553
59554 The logical steps involved in a `fork` are:
59555
59556
59557 * `fork` saves the current state of the coroutine. 
59558
59559 * The statement creates a copy of the coroutine and either executes it immediately or schedules it for later execution. 
59560
59561 * The resume point is defined immediately following the semicolon. 
59562
59563 * For the "parent", control immediately continues from the next line.
59564
59565 The functions `is_parent()` and `is_child()` can be used to differentiate between parent and child. You would use these functions to alter subsequent control flow.
59566
59567 Note that `fork` doesn't do the actual forking by itself. It is the application's responsibility to create a clone of the coroutine and call it. The clone can be called immediately, as above, or scheduled for delayed execution using something like [link boost_asio.reference.post `post`].
59568
59569
59570 [heading Alternate macro names]
59571   
59572
59573
59574 If preferred, an application can use macro names that follow a more typical naming convention, rather than the pseudo-keywords. These are:
59575
59576
59577 * `BOOST_ASIO_CORO_REENTER` instead of `reenter` 
59578
59579 * `BOOST_ASIO_CORO_YIELD` instead of `yield` 
59580
59581 * `BOOST_ASIO_CORO_FORK` instead of `fork` 
59582
59583
59584
59585 [heading Requirements]
59586
59587 ['Header: ][^boost/asio/coroutine.hpp]
59588
59589 ['Convenience header: ][^boost/asio.hpp]
59590
59591
59592 [section:coroutine coroutine::coroutine]
59593
59594 [indexterm2 boost_asio.indexterm.coroutine.coroutine..coroutine..coroutine] 
59595 Constructs a coroutine in its initial state. 
59596
59597
59598   coroutine();
59599
59600
59601
59602 [endsect]
59603
59604
59605
59606 [section:is_child coroutine::is_child]
59607
59608 [indexterm2 boost_asio.indexterm.coroutine.is_child..is_child..coroutine] 
59609 Returns true if the coroutine is the child of a fork. 
59610
59611
59612   bool is_child() const;
59613
59614
59615
59616 [endsect]
59617
59618
59619
59620 [section:is_complete coroutine::is_complete]
59621
59622 [indexterm2 boost_asio.indexterm.coroutine.is_complete..is_complete..coroutine] 
59623 Returns true if the coroutine has reached its terminal state. 
59624
59625
59626   bool is_complete() const;
59627
59628
59629
59630 [endsect]
59631
59632
59633
59634 [section:is_parent coroutine::is_parent]
59635
59636 [indexterm2 boost_asio.indexterm.coroutine.is_parent..is_parent..coroutine] 
59637 Returns true if the coroutine is the parent of a fork. 
59638
59639
59640   bool is_parent() const;
59641
59642
59643
59644 [endsect]
59645
59646
59647
59648 [endsect]
59649
59650
59651 [section:deadline_timer deadline_timer]
59652
59653 [indexterm1 boost_asio.indexterm.deadline_timer..deadline_timer] 
59654 Typedef for the typical usage of timer. Uses a UTC clock. 
59655
59656
59657   typedef basic_deadline_timer< boost::posix_time::ptime > deadline_timer;
59658
59659
59660 [heading Types]
59661 [table
59662   [[Name][Description]]
59663
59664   [
59665
59666     [[link boost_asio.reference.basic_deadline_timer__rebind_executor [*rebind_executor]]]
59667     [Rebinds the timer type to another executor. ]
59668   
59669   ]
59670
59671   [
59672
59673     [[link boost_asio.reference.basic_deadline_timer.duration_type [*duration_type]]]
59674     [The duration type. ]
59675   
59676   ]
59677
59678   [
59679
59680     [[link boost_asio.reference.basic_deadline_timer.executor_type [*executor_type]]]
59681     [The type of the executor associated with the object. ]
59682   
59683   ]
59684
59685   [
59686
59687     [[link boost_asio.reference.basic_deadline_timer.time_type [*time_type]]]
59688     [The time type. ]
59689   
59690   ]
59691
59692   [
59693
59694     [[link boost_asio.reference.basic_deadline_timer.traits_type [*traits_type]]]
59695     [The time traits type. ]
59696   
59697   ]
59698
59699 ]
59700
59701 [heading Member Functions]
59702 [table
59703   [[Name][Description]]
59704
59705   [
59706     [[link boost_asio.reference.basic_deadline_timer.async_wait [*async_wait]]]
59707     [Start an asynchronous wait on the timer. ]
59708   ]
59709   
59710   [
59711     [[link boost_asio.reference.basic_deadline_timer.basic_deadline_timer [*basic_deadline_timer]]]
59712     [Constructor. 
59713      [hr]
59714      Constructor to set a particular expiry time as an absolute time. 
59715      [hr]
59716      Constructor to set a particular expiry time relative to now. 
59717      [hr]
59718      Move-construct a basic_deadline_timer from another. ]
59719   ]
59720   
59721   [
59722     [[link boost_asio.reference.basic_deadline_timer.cancel [*cancel]]]
59723     [Cancel any asynchronous operations that are waiting on the timer. ]
59724   ]
59725   
59726   [
59727     [[link boost_asio.reference.basic_deadline_timer.cancel_one [*cancel_one]]]
59728     [Cancels one asynchronous operation that is waiting on the timer. ]
59729   ]
59730   
59731   [
59732     [[link boost_asio.reference.basic_deadline_timer.expires_at [*expires_at]]]
59733     [Get the timer's expiry time as an absolute time. 
59734      [hr]
59735      Set the timer's expiry time as an absolute time. ]
59736   ]
59737   
59738   [
59739     [[link boost_asio.reference.basic_deadline_timer.expires_from_now [*expires_from_now]]]
59740     [Get the timer's expiry time relative to now. 
59741      [hr]
59742      Set the timer's expiry time relative to now. ]
59743   ]
59744   
59745   [
59746     [[link boost_asio.reference.basic_deadline_timer.get_executor [*get_executor]]]
59747     [Get the executor associated with the object. ]
59748   ]
59749   
59750   [
59751     [[link boost_asio.reference.basic_deadline_timer.operator_eq_ [*operator=]]]
59752     [Move-assign a basic_deadline_timer from another. ]
59753   ]
59754   
59755   [
59756     [[link boost_asio.reference.basic_deadline_timer.wait [*wait]]]
59757     [Perform a blocking wait on the timer. ]
59758   ]
59759   
59760   [
59761     [[link boost_asio.reference.basic_deadline_timer._basic_deadline_timer [*~basic_deadline_timer]]]
59762     [Destroys the timer. ]
59763   ]
59764   
59765 ]
59766
59767 The [link boost_asio.reference.basic_deadline_timer `basic_deadline_timer`] class template provides the ability to perform a blocking or asynchronous wait for a timer to expire.
59768
59769 A deadline timer is always in one of two states: "expired" or "not expired". If the `wait()` or `async_wait()` function is called on an expired timer, the wait operation will complete immediately.
59770
59771 Most applications will use the [link boost_asio.reference.deadline_timer `deadline_timer`] typedef.
59772
59773
59774 [heading Thread Safety]
59775   
59776 ['Distinct] ['objects:] Safe.
59777
59778 ['Shared] ['objects:] Unsafe.
59779
59780
59781 [heading Examples]
59782   
59783 Performing a blocking wait: 
59784
59785    // Construct a timer without setting an expiry time.
59786    boost::asio::deadline_timer timer(my_context);
59787
59788    // Set an expiry time relative to now.
59789    timer.expires_from_now(boost::posix_time::seconds(5));
59790
59791    // Wait for the timer to expire.
59792    timer.wait();
59793
59794
59795
59796
59797
59798 Performing an asynchronous wait: 
59799
59800    void handler(const boost::system::error_code& error)
59801    {
59802      if (!error)
59803      {
59804        // Timer expired.
59805      }
59806    }
59807
59808    ...
59809
59810    // Construct a timer with an absolute expiry time.
59811    boost::asio::deadline_timer timer(my_context,
59812        boost::posix_time::time_from_string("2005-12-07 23:59:59.000"));
59813
59814    // Start an asynchronous wait.
59815    timer.async_wait(handler);
59816
59817
59818
59819
59820
59821 [heading Changing an active deadline_timer's expiry time]
59822   
59823
59824
59825 Changing the expiry time of a timer while there are pending asynchronous waits causes those wait operations to be cancelled. To ensure that the action associated with the timer is performed only once, use something like this: used:
59826
59827
59828
59829    void on_some_event()
59830    {
59831      if (my_timer.expires_from_now(seconds(5)) > 0)
59832      {
59833        // We managed to cancel the timer. Start new asynchronous wait.
59834        my_timer.async_wait(on_timeout);
59835      }
59836      else
59837      {
59838        // Too late, timer has already expired!
59839      }
59840    }
59841
59842    void on_timeout(const boost::system::error_code& e)
59843    {
59844      if (e != boost::asio::error::operation_aborted)
59845      {
59846        // Timer was not cancelled, take necessary action.
59847      }
59848    }
59849
59850
59851
59852
59853
59854 * The `boost::asio::basic_deadline_timer::expires_from_now()` function cancels any pending asynchronous waits, and returns the number of asynchronous waits that were cancelled. If it returns 0 then you were too late and the wait handler has already been executed, or will soon be executed. If it returns 1 then the wait handler was successfully cancelled.
59855
59856
59857 * If a wait handler is cancelled, the boost::system::error\_code passed to it contains the value `boost::asio::error::operation_aborted`. 
59858
59859
59860
59861
59862 [heading Requirements]
59863
59864 ['Header: ][^boost/asio/deadline_timer.hpp]
59865
59866 ['Convenience header: ][^boost/asio.hpp]
59867
59868
59869 [endsect]
59870
59871
59872 [section:default_completion_token default_completion_token]
59873
59874
59875 Traits type used to determine the default completion token type associated with a type (such as an executor). 
59876
59877
59878   template<
59879       typename T>
59880   struct default_completion_token
59881
59882
59883 [heading Types]
59884 [table
59885   [[Name][Description]]
59886
59887   [
59888
59889     [[link boost_asio.reference.default_completion_token.type [*type]]]
59890     [If T has a nested type default_completion_token_type, T::default_completion_token_type. Otherwise the typedef type is not defined. ]
59891   
59892   ]
59893
59894 ]
59895
59896 A program may specialise this traits type if the `T` template parameter in the specialisation is a user-defined type.
59897
59898 Specialisations of this trait may provide a nested typedef `type`, which is a default-constructible completion token type. 
59899
59900 [heading Requirements]
59901
59902 ['Header: ][^boost/asio/async_result.hpp]
59903
59904 ['Convenience header: ][^boost/asio.hpp]
59905
59906
59907 [section:type default_completion_token::type]
59908
59909 [indexterm2 boost_asio.indexterm.default_completion_token.type..type..default_completion_token] 
59910 If `T` has a nested type `default_completion_token_type`, `T::default_completion_token_type`. Otherwise the typedef `type` is not defined. 
59911
59912
59913   typedef see_below type;
59914
59915
59916
59917 [heading Requirements]
59918
59919 ['Header: ][^boost/asio/async_result.hpp]
59920
59921 ['Convenience header: ][^boost/asio.hpp]
59922
59923
59924 [endsect]
59925
59926
59927
59928 [endsect]
59929
59930 [section:defer defer]
59931
59932 [indexterm1 boost_asio.indexterm.defer..defer] 
59933 Submits a completion token or function object for execution. 
59934
59935   template<
59936       typename CompletionToken>
59937   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.defer.overload1 defer]``(
59938       CompletionToken && token);
59939   ``  [''''&raquo;''' [link boost_asio.reference.defer.overload1 more...]]``
59940
59941   template<
59942       typename ``[link boost_asio.reference.Executor1 Executor]``,
59943       typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
59944   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.defer.overload2 defer]``(
59945       const Executor & ex,
59946       CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
59947       typename enable_if< is_executor< Executor >::value >::type *  = 0);
59948   ``  [''''&raquo;''' [link boost_asio.reference.defer.overload2 more...]]``
59949
59950   template<
59951       typename ExecutionContext,
59952       typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
59953   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.defer.overload3 defer]``(
59954       ExecutionContext & ctx,
59955       CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
59956       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
59957   ``  [''''&raquo;''' [link boost_asio.reference.defer.overload3 more...]]``
59958
59959 [heading Requirements]
59960
59961 ['Header: ][^boost/asio/defer.hpp]
59962
59963 ['Convenience header: ][^boost/asio.hpp]
59964
59965
59966 [section:overload1 defer (1 of 3 overloads)]
59967
59968
59969 Submits a completion token or function object for execution. 
59970
59971
59972   template<
59973       typename CompletionToken>
59974   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` defer(
59975       CompletionToken && token);
59976
59977
59978 This function submits an object for execution using the object's associated executor. The function object is queued for execution, and is never called from the current thread prior to returning from `defer()`.
59979
59980 The use of `defer()`, rather than [link boost_asio.reference.post `post`] , indicates the caller's preference that the executor defer the queueing of the function object. This may allow the executor to optimise queueing for cases when the function object represents a continuation of the current call context.
59981
59982 This function has the following effects:
59983
59984
59985 * Constructs a function object handler of type `Handler`, initialized with `handler(forward<CompletionToken>(token))`.
59986
59987
59988 * Constructs an object `result` of type `async_result<Handler>`, initializing the object as `result(handler)`.
59989
59990
59991 * Obtains the handler's associated executor object `ex` by performing `get_associated_executor(handler)`.
59992
59993
59994 * Obtains the handler's associated allocator object `alloc` by performing `get_associated_allocator(handler)`.
59995
59996
59997 * Performs `ex.defer(std::move(handler), alloc)`.
59998
59999
60000 * Returns `result.get()`. 
60001
60002
60003
60004
60005 [endsect]
60006
60007
60008
60009 [section:overload2 defer (2 of 3 overloads)]
60010
60011
60012 Submits a completion token or function object for execution. 
60013
60014
60015   template<
60016       typename ``[link boost_asio.reference.Executor1 Executor]``,
60017       typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
60018   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` defer(
60019       const Executor & ex,
60020       CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
60021       typename enable_if< is_executor< Executor >::value >::type *  = 0);
60022
60023
60024 This function submits an object for execution using the specified executor. The function object is queued for execution, and is never called from the current thread prior to returning from `defer()`.
60025
60026 The use of `defer()`, rather than [link boost_asio.reference.post `post`] , indicates the caller's preference that the executor defer the queueing of the function object. This may allow the executor to optimise queueing for cases when the function object represents a continuation of the current call context.
60027
60028 This function has the following effects:
60029
60030
60031 * Constructs a function object handler of type `Handler`, initialized with `handler(forward<CompletionToken>(token))`.
60032
60033
60034 * Constructs an object `result` of type `async_result<Handler>`, initializing the object as `result(handler)`.
60035
60036
60037 * Obtains the handler's associated executor object `ex1` by performing `get_associated_executor(handler)`.
60038
60039
60040 * Creates a work object `w` by performing `make_work(ex1)`.
60041
60042
60043 * Obtains the handler's associated allocator object `alloc` by performing `get_associated_allocator(handler)`.
60044
60045
60046 * Constructs a function object `f` with a function call operator that performs `ex1.dispatch(std::move(handler), alloc)` followed by `w.reset()`.
60047
60048
60049 * Performs `Executor(ex).defer(std::move(f), alloc)`.
60050
60051
60052 * Returns `result.get()`. 
60053
60054
60055
60056
60057 [endsect]
60058
60059
60060
60061 [section:overload3 defer (3 of 3 overloads)]
60062
60063
60064 Submits a completion token or function object for execution. 
60065
60066
60067   template<
60068       typename ExecutionContext,
60069       typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
60070   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` defer(
60071       ExecutionContext & ctx,
60072       CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
60073       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
60074
60075
60076
60077 [heading Return Value]
60078       
60079 `defer(ctx.get_executor(), forward<CompletionToken>(token))`. 
60080
60081
60082
60083
60084 [endsect]
60085
60086
60087 [endsect]
60088
60089
60090 [section:detached detached]
60091
60092 [indexterm1 boost_asio.indexterm.detached..detached] 
60093 A special value, similar to std::nothrow. 
60094
60095
60096   constexpr detached_t detached;
60097
60098
60099 See the documentation for [link boost_asio.reference.detached_t `detached_t`] for a usage example. 
60100
60101 [heading Requirements]
60102
60103 ['Header: ][^boost/asio/detached.hpp]
60104
60105 ['Convenience header: ][^boost/asio.hpp]
60106
60107
60108 [endsect]
60109
60110
60111 [section:detached_t detached_t]
60112
60113
60114 Class used to specify that an asynchronous operation is detached. 
60115
60116
60117   class detached_t
60118
60119
60120 [heading Member Functions]
60121 [table
60122   [[Name][Description]]
60123
60124   [
60125     [[link boost_asio.reference.detached_t.detached_t [*detached_t]]]
60126     [Constructor. ]
60127   ]
60128   
60129 ]
60130
60131 The [link boost_asio.reference.detached_t `detached_t`] class is used to indicate that an asynchronous operation is detached. That is, there is no completion handler waiting for the operation's result. A [link boost_asio.reference.detached_t `detached_t`] object may be passed as a handler to an asynchronous operation, typically using the special value `boost::asio::detached`. For example:
60132
60133
60134
60135    my_socket.async_send(my_buffer, boost::asio::detached);
60136
60137
60138
60139
60140 [heading Requirements]
60141
60142 ['Header: ][^boost/asio/detached.hpp]
60143
60144 ['Convenience header: ][^boost/asio.hpp]
60145
60146
60147 [section:detached_t detached_t::detached_t]
60148
60149 [indexterm2 boost_asio.indexterm.detached_t.detached_t..detached_t..detached_t] 
60150 Constructor. 
60151
60152
60153   constexpr detached_t();
60154
60155
60156
60157 [endsect]
60158
60159
60160
60161 [endsect]
60162
60163 [section:dispatch dispatch]
60164
60165 [indexterm1 boost_asio.indexterm.dispatch..dispatch] 
60166 Submits a completion token or function object for execution. 
60167
60168   template<
60169       typename CompletionToken>
60170   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.dispatch.overload1 dispatch]``(
60171       CompletionToken && token);
60172   ``  [''''&raquo;''' [link boost_asio.reference.dispatch.overload1 more...]]``
60173
60174   template<
60175       typename ``[link boost_asio.reference.Executor1 Executor]``,
60176       typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
60177   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.dispatch.overload2 dispatch]``(
60178       const Executor & ex,
60179       CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
60180       typename enable_if< is_executor< Executor >::value >::type *  = 0);
60181   ``  [''''&raquo;''' [link boost_asio.reference.dispatch.overload2 more...]]``
60182
60183   template<
60184       typename ExecutionContext,
60185       typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
60186   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.dispatch.overload3 dispatch]``(
60187       ExecutionContext & ctx,
60188       CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
60189       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
60190   ``  [''''&raquo;''' [link boost_asio.reference.dispatch.overload3 more...]]``
60191
60192 [heading Requirements]
60193
60194 ['Header: ][^boost/asio/dispatch.hpp]
60195
60196 ['Convenience header: ][^boost/asio.hpp]
60197
60198
60199 [section:overload1 dispatch (1 of 3 overloads)]
60200
60201
60202 Submits a completion token or function object for execution. 
60203
60204
60205   template<
60206       typename CompletionToken>
60207   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` dispatch(
60208       CompletionToken && token);
60209
60210
60211 This function submits an object for execution using the object's associated executor. The function object may be called from the current thread prior to returning from `dispatch()`. Otherwise, it is queued for execution.
60212
60213 This function has the following effects:
60214
60215
60216 * Constructs a function object handler of type `Handler`, initialized with `handler(forward<CompletionToken>(token))`.
60217
60218
60219 * Constructs an object `result` of type `async_result<Handler>`, initializing the object as `result(handler)`.
60220
60221
60222 * Obtains the handler's associated executor object `ex` by performing `get_associated_executor(handler)`.
60223
60224
60225 * Obtains the handler's associated allocator object `alloc` by performing `get_associated_allocator(handler)`.
60226
60227
60228 * Performs `ex.dispatch(std::move(handler), alloc)`.
60229
60230
60231 * Returns `result.get()`. 
60232
60233
60234
60235
60236 [endsect]
60237
60238
60239
60240 [section:overload2 dispatch (2 of 3 overloads)]
60241
60242
60243 Submits a completion token or function object for execution. 
60244
60245
60246   template<
60247       typename ``[link boost_asio.reference.Executor1 Executor]``,
60248       typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
60249   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` dispatch(
60250       const Executor & ex,
60251       CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
60252       typename enable_if< is_executor< Executor >::value >::type *  = 0);
60253
60254
60255 This function submits an object for execution using the specified executor. The function object may be called from the current thread prior to returning from `dispatch()`. Otherwise, it is queued for execution.
60256
60257 This function has the following effects:
60258
60259
60260 * Constructs a function object handler of type `Handler`, initialized with `handler(forward<CompletionToken>(token))`.
60261
60262
60263 * Constructs an object `result` of type `async_result<Handler>`, initializing the object as `result(handler)`.
60264
60265
60266 * Obtains the handler's associated executor object `ex1` by performing `get_associated_executor(handler)`.
60267
60268
60269 * Creates a work object `w` by performing `make_work(ex1)`.
60270
60271
60272 * Obtains the handler's associated allocator object `alloc` by performing `get_associated_allocator(handler)`.
60273
60274
60275 * Constructs a function object `f` with a function call operator that performs `ex1.dispatch(std::move(handler), alloc)` followed by `w.reset()`.
60276
60277
60278 * Performs `Executor(ex).dispatch(std::move(f), alloc)`.
60279
60280
60281 * Returns `result.get()`. 
60282
60283
60284
60285
60286 [endsect]
60287
60288
60289
60290 [section:overload3 dispatch (3 of 3 overloads)]
60291
60292
60293 Submits a completion token or function object for execution. 
60294
60295
60296   template<
60297       typename ExecutionContext,
60298       typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
60299   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` dispatch(
60300       ExecutionContext & ctx,
60301       CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
60302       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
60303
60304
60305
60306 [heading Return Value]
60307       
60308 `dispatch(ctx.get_executor(), forward<CompletionToken>(token))`. 
60309
60310
60311
60312
60313 [endsect]
60314
60315
60316 [endsect]
60317
60318 [section:dynamic_buffer dynamic_buffer]
60319
60320 [indexterm1 boost_asio.indexterm.dynamic_buffer..dynamic_buffer] 
60321 The `boost::asio::dynamic_buffer` function is used to create a dynamically resized buffer from a `std::basic_string` or `std::vector`. 
60322
60323
60324 Create a new dynamic buffer that represents the given string. 
60325
60326   template<
60327       typename Elem,
60328       typename Traits,
60329       typename Allocator>
60330   dynamic_string_buffer< Elem, Traits, Allocator > ``[link boost_asio.reference.dynamic_buffer.overload1 dynamic_buffer]``(
60331       std::basic_string< Elem, Traits, Allocator > & data);
60332   ``  [''''&raquo;''' [link boost_asio.reference.dynamic_buffer.overload1 more...]]``
60333
60334   template<
60335       typename Elem,
60336       typename Traits,
60337       typename Allocator>
60338   dynamic_string_buffer< Elem, Traits, Allocator > ``[link boost_asio.reference.dynamic_buffer.overload2 dynamic_buffer]``(
60339       std::basic_string< Elem, Traits, Allocator > & data,
60340       std::size_t max_size);
60341   ``  [''''&raquo;''' [link boost_asio.reference.dynamic_buffer.overload2 more...]]``
60342
60343 Create a new dynamic buffer that represents the given vector. 
60344
60345   template<
60346       typename Elem,
60347       typename Allocator>
60348   dynamic_vector_buffer< Elem, Allocator > ``[link boost_asio.reference.dynamic_buffer.overload3 dynamic_buffer]``(
60349       std::vector< Elem, Allocator > & data);
60350   ``  [''''&raquo;''' [link boost_asio.reference.dynamic_buffer.overload3 more...]]``
60351
60352   template<
60353       typename Elem,
60354       typename Allocator>
60355   dynamic_vector_buffer< Elem, Allocator > ``[link boost_asio.reference.dynamic_buffer.overload4 dynamic_buffer]``(
60356       std::vector< Elem, Allocator > & data,
60357       std::size_t max_size);
60358   ``  [''''&raquo;''' [link boost_asio.reference.dynamic_buffer.overload4 more...]]``
60359
60360 [heading Requirements]
60361
60362 ['Header: ][^boost/asio/buffer.hpp]
60363
60364 ['Convenience header: ][^boost/asio.hpp]
60365
60366
60367 [section:overload1 dynamic_buffer (1 of 4 overloads)]
60368
60369
60370 Create a new dynamic buffer that represents the given string. 
60371
60372
60373   template<
60374       typename Elem,
60375       typename Traits,
60376       typename Allocator>
60377   dynamic_string_buffer< Elem, Traits, Allocator > dynamic_buffer(
60378       std::basic_string< Elem, Traits, Allocator > & data);
60379
60380
60381
60382 [heading Return Value]
60383       
60384 `dynamic_string_buffer<Elem, Traits, Allocator>(data)`. 
60385
60386
60387
60388
60389 [endsect]
60390
60391
60392
60393 [section:overload2 dynamic_buffer (2 of 4 overloads)]
60394
60395
60396 Create a new dynamic buffer that represents the given string. 
60397
60398
60399   template<
60400       typename Elem,
60401       typename Traits,
60402       typename Allocator>
60403   dynamic_string_buffer< Elem, Traits, Allocator > dynamic_buffer(
60404       std::basic_string< Elem, Traits, Allocator > & data,
60405       std::size_t max_size);
60406
60407
60408
60409 [heading Return Value]
60410       
60411 `dynamic_string_buffer<Elem, Traits, Allocator>(data, max_size)`. 
60412
60413
60414
60415
60416 [endsect]
60417
60418
60419
60420 [section:overload3 dynamic_buffer (3 of 4 overloads)]
60421
60422
60423 Create a new dynamic buffer that represents the given vector. 
60424
60425
60426   template<
60427       typename Elem,
60428       typename Allocator>
60429   dynamic_vector_buffer< Elem, Allocator > dynamic_buffer(
60430       std::vector< Elem, Allocator > & data);
60431
60432
60433
60434 [heading Return Value]
60435       
60436 `dynamic_vector_buffer<Elem, Allocator>(data)`. 
60437
60438
60439
60440
60441 [endsect]
60442
60443
60444
60445 [section:overload4 dynamic_buffer (4 of 4 overloads)]
60446
60447
60448 Create a new dynamic buffer that represents the given vector. 
60449
60450
60451   template<
60452       typename Elem,
60453       typename Allocator>
60454   dynamic_vector_buffer< Elem, Allocator > dynamic_buffer(
60455       std::vector< Elem, Allocator > & data,
60456       std::size_t max_size);
60457
60458
60459
60460 [heading Return Value]
60461       
60462 `dynamic_vector_buffer<Elem, Allocator>(data, max_size)`. 
60463
60464
60465
60466
60467 [endsect]
60468
60469
60470 [endsect]
60471
60472 [section:dynamic_string_buffer dynamic_string_buffer]
60473
60474
60475 Adapt a basic\_string to the DynamicBuffer requirements. 
60476
60477
60478   template<
60479       typename Elem,
60480       typename Traits,
60481       typename Allocator>
60482   class dynamic_string_buffer
60483
60484
60485 [heading Types]
60486 [table
60487   [[Name][Description]]
60488
60489   [
60490
60491     [[link boost_asio.reference.dynamic_string_buffer.const_buffers_type [*const_buffers_type]]]
60492     [The type used to represent a sequence of constant buffers that refers to the underlying memory. ]
60493   
60494   ]
60495
60496   [
60497
60498     [[link boost_asio.reference.dynamic_string_buffer.mutable_buffers_type [*mutable_buffers_type]]]
60499     [The type used to represent a sequence of mutable buffers that refers to the underlying memory. ]
60500   
60501   ]
60502
60503 ]
60504
60505 [heading Member Functions]
60506 [table
60507   [[Name][Description]]
60508
60509   [
60510     [[link boost_asio.reference.dynamic_string_buffer.capacity [*capacity]]]
60511     [Get the maximum size that the buffer may grow to without triggering reallocation. ]
60512   ]
60513   
60514   [
60515     [[link boost_asio.reference.dynamic_string_buffer.commit [*commit]]]
60516     [DynamicBuffer_v1: Move bytes from the output sequence to the input sequence. ]
60517   ]
60518   
60519   [
60520     [[link boost_asio.reference.dynamic_string_buffer.consume [*consume]]]
60521     [DynamicBuffer_v1: Remove characters from the input sequence. DynamicBuffer_v2: Consume the specified number of bytes from the beginning of the underlying memory. ]
60522   ]
60523   
60524   [
60525     [[link boost_asio.reference.dynamic_string_buffer.data [*data]]]
60526     [DynamicBuffer_v1: Get a list of buffers that represents the input sequence. 
60527      [hr]
60528      DynamicBuffer_v2: Get a sequence of buffers that represents the underlying memory. ]
60529   ]
60530   
60531   [
60532     [[link boost_asio.reference.dynamic_string_buffer.dynamic_string_buffer [*dynamic_string_buffer]]]
60533     [Construct a dynamic buffer from a string. 
60534      [hr]
60535      DynamicBuffer_v2: Copy construct a dynamic buffer. 
60536      [hr]
60537      Move construct a dynamic buffer. ]
60538   ]
60539   
60540   [
60541     [[link boost_asio.reference.dynamic_string_buffer.grow [*grow]]]
60542     [DynamicBuffer_v2: Grow the underlying memory by the specified number of bytes. ]
60543   ]
60544   
60545   [
60546     [[link boost_asio.reference.dynamic_string_buffer.max_size [*max_size]]]
60547     [Get the maximum size of the dynamic buffer. ]
60548   ]
60549   
60550   [
60551     [[link boost_asio.reference.dynamic_string_buffer.prepare [*prepare]]]
60552     [DynamicBuffer_v1: Get a list of buffers that represents the output sequence, with the given size. ]
60553   ]
60554   
60555   [
60556     [[link boost_asio.reference.dynamic_string_buffer.shrink [*shrink]]]
60557     [DynamicBuffer_v2: Shrink the underlying memory by the specified number of bytes. ]
60558   ]
60559   
60560   [
60561     [[link boost_asio.reference.dynamic_string_buffer.size [*size]]]
60562     [DynamicBuffer_v1: Get the size of the input sequence. DynamicBuffer_v2: Get the current size of the underlying memory. ]
60563   ]
60564   
60565 ]
60566
60567 Requires that `sizeof(Elem) == 1`. 
60568
60569 [heading Requirements]
60570
60571 ['Header: ][^boost/asio/buffer.hpp]
60572
60573 ['Convenience header: ][^boost/asio.hpp]
60574
60575
60576 [section:capacity dynamic_string_buffer::capacity]
60577
60578 [indexterm2 boost_asio.indexterm.dynamic_string_buffer.capacity..capacity..dynamic_string_buffer] 
60579 Get the maximum size that the buffer may grow to without triggering reallocation. 
60580
60581
60582   std::size_t capacity() const;
60583
60584
60585
60586 [heading Return Value]
60587       
60588 The current capacity of the underlying string if less than `max_size()`. Otherwise returns `max_size()`. 
60589
60590
60591
60592
60593 [endsect]
60594
60595
60596
60597 [section:commit dynamic_string_buffer::commit]
60598
60599 [indexterm2 boost_asio.indexterm.dynamic_string_buffer.commit..commit..dynamic_string_buffer] 
60600 [*DynamicBuffer\_v1:] Move bytes from the output sequence to the input sequence. 
60601
60602
60603   void commit(
60604       std::size_t n);
60605
60606
60607
60608 [heading Parameters]
60609     
60610
60611 [variablelist
60612   
60613 [[n][The number of bytes to append from the start of the output sequence to the end of the input sequence. The remainder of the output sequence is discarded.]]
60614
60615 ]
60616
60617 Requires a preceding call `prepare(x)` where `x >= n`, and no intervening operations that modify the input or output sequence.
60618
60619
60620 [heading Remarks]
60621       
60622 If `n` is greater than the size of the output sequence, the entire output sequence is moved to the input sequence and no error is issued. 
60623
60624
60625
60626
60627 [endsect]
60628
60629
60630
60631 [section:const_buffers_type dynamic_string_buffer::const_buffers_type]
60632
60633 [indexterm2 boost_asio.indexterm.dynamic_string_buffer.const_buffers_type..const_buffers_type..dynamic_string_buffer] 
60634 The type used to represent a sequence of constant buffers that refers to the underlying memory. 
60635
60636
60637   typedef const_buffer const_buffers_type;
60638
60639
60640 [heading Member Functions]
60641 [table
60642   [[Name][Description]]
60643
60644   [
60645     [[link boost_asio.reference.const_buffer.const_buffer [*const_buffer]]]
60646     [Construct an empty buffer. 
60647      [hr]
60648      Construct a buffer to represent a given memory range. 
60649      [hr]
60650      Construct a non-modifiable buffer from a modifiable one. ]
60651   ]
60652   
60653   [
60654     [[link boost_asio.reference.const_buffer.data [*data]]]
60655     [Get a pointer to the beginning of the memory range. ]
60656   ]
60657   
60658   [
60659     [[link boost_asio.reference.const_buffer.operator_plus__eq_ [*operator+=]]]
60660     [Move the start of the buffer by the specified number of bytes. ]
60661   ]
60662   
60663   [
60664     [[link boost_asio.reference.const_buffer.size [*size]]]
60665     [Get the size of the memory range. ]
60666   ]
60667   
60668 ]
60669
60670 [heading Related Functions]
60671 [table
60672   [[Name][Description]]
60673
60674   [
60675     [[link boost_asio.reference.const_buffer.operator_plus_ [*operator+]]]
60676     [Create a new non-modifiable buffer that is offset from the start of another. ]
60677   ]
60678   
60679 ]
60680
60681 The [link boost_asio.reference.const_buffer `const_buffer`] class provides a safe representation of a buffer that cannot be modified. It does not own the underlying data, and so is cheap to copy or assign.
60682
60683
60684 [heading Accessing Buffer Contents]
60685   
60686
60687
60688 The contents of a buffer may be accessed using the `data()` and `size()` member functions:
60689
60690
60691
60692    boost::asio::const_buffer b1 = ...;
60693    std::size_t s1 = b1.size();
60694    const unsigned char* p1 = static_cast<const unsigned char*>(b1.data());
60695
60696
60697
60698
60699 The `data()` member function permits violations of type safety, so uses of it in application code should be carefully considered. 
60700
60701
60702 [heading Requirements]
60703
60704 ['Header: ][^boost/asio/buffer.hpp]
60705
60706 ['Convenience header: ][^boost/asio.hpp]
60707
60708
60709 [endsect]
60710
60711
60712
60713 [section:consume dynamic_string_buffer::consume]
60714
60715 [indexterm2 boost_asio.indexterm.dynamic_string_buffer.consume..consume..dynamic_string_buffer] 
60716 [*DynamicBuffer\_v1:] Remove characters from the input sequence. [*DynamicBuffer\_v2:] Consume the specified number of bytes from the beginning of the underlying memory. 
60717
60718
60719   void consume(
60720       std::size_t n);
60721
60722
60723 [*DynamicBuffer\_v1:] Removes `n` characters from the beginning of the input sequence.
60724 [heading Remarks]
60725       
60726 If `n` is greater than the size of the input sequence, the entire input sequence is consumed and no error is issued.
60727
60728 [*DynamicBuffer\_v2:] Erases `n` bytes from the beginning of the string. If `n` is greater than the current size of the string, the string is emptied. 
60729
60730
60731 [endsect]
60732
60733
60734 [section:data dynamic_string_buffer::data]
60735
60736 [indexterm2 boost_asio.indexterm.dynamic_string_buffer.data..data..dynamic_string_buffer] 
60737 [*DynamicBuffer\_v1:] Get a list of buffers that represents the input sequence. 
60738
60739
60740   const_buffers_type ``[link boost_asio.reference.dynamic_string_buffer.data.overload1 data]``() const;
60741   ``  [''''&raquo;''' [link boost_asio.reference.dynamic_string_buffer.data.overload1 more...]]``
60742
60743
60744 [*DynamicBuffer\_v2:] Get a sequence of buffers that represents the underlying memory. 
60745
60746
60747   mutable_buffers_type ``[link boost_asio.reference.dynamic_string_buffer.data.overload2 data]``(
60748       std::size_t pos,
60749       std::size_t n);
60750   ``  [''''&raquo;''' [link boost_asio.reference.dynamic_string_buffer.data.overload2 more...]]``
60751
60752   const_buffers_type ``[link boost_asio.reference.dynamic_string_buffer.data.overload3 data]``(
60753       std::size_t pos,
60754       std::size_t n) const;
60755   ``  [''''&raquo;''' [link boost_asio.reference.dynamic_string_buffer.data.overload3 more...]]``
60756
60757
60758 [section:overload1 dynamic_string_buffer::data (1 of 3 overloads)]
60759
60760
60761 [*DynamicBuffer\_v1:] Get a list of buffers that represents the input sequence. 
60762
60763
60764   const_buffers_type data() const;
60765
60766
60767
60768 [heading Return Value]
60769       
60770 An object of type `const_buffers_type` that satisfies ConstBufferSequence requirements, representing the basic\_string memory in the input sequence.
60771
60772
60773 [heading Remarks]
60774       
60775 The returned object is invalidated by any `dynamic_string_buffer` or `basic_string` member function that resizes or erases the string. 
60776
60777
60778
60779
60780 [endsect]
60781
60782
60783
60784 [section:overload2 dynamic_string_buffer::data (2 of 3 overloads)]
60785
60786
60787 [*DynamicBuffer\_v2:] Get a sequence of buffers that represents the underlying memory. 
60788
60789
60790   mutable_buffers_type data(
60791       std::size_t pos,
60792       std::size_t n);
60793
60794
60795
60796 [heading Parameters]
60797     
60798
60799 [variablelist
60800   
60801 [[pos][Position of the first byte to represent in the buffer sequence]]
60802
60803 [[n][The number of bytes to return in the buffer sequence. If the underlying memory is shorter, the buffer sequence represents as many bytes as are available.]]
60804
60805 ]
60806
60807
60808 [heading Return Value]
60809       
60810 An object of type `mutable_buffers_type` that satisfies MutableBufferSequence requirements, representing the basic\_string memory.
60811
60812
60813 [heading Remarks]
60814       
60815 The returned object is invalidated by any `dynamic_string_buffer` or `basic_string` member function that resizes or erases the string. 
60816
60817
60818
60819
60820 [endsect]
60821
60822
60823
60824 [section:overload3 dynamic_string_buffer::data (3 of 3 overloads)]
60825
60826
60827 [*DynamicBuffer\_v2:] Get a sequence of buffers that represents the underlying memory. 
60828
60829
60830   const_buffers_type data(
60831       std::size_t pos,
60832       std::size_t n) const;
60833
60834
60835
60836 [heading Parameters]
60837     
60838
60839 [variablelist
60840   
60841 [[pos][Position of the first byte to represent in the buffer sequence]]
60842
60843 [[n][The number of bytes to return in the buffer sequence. If the underlying memory is shorter, the buffer sequence represents as many bytes as are available.]]
60844
60845 ]
60846
60847
60848 [heading Remarks]
60849       
60850 The returned object is invalidated by any `dynamic_string_buffer` or `basic_string` member function that resizes or erases the string. 
60851
60852
60853
60854
60855 [endsect]
60856
60857
60858 [endsect]
60859
60860 [section:dynamic_string_buffer dynamic_string_buffer::dynamic_string_buffer]
60861
60862 [indexterm2 boost_asio.indexterm.dynamic_string_buffer.dynamic_string_buffer..dynamic_string_buffer..dynamic_string_buffer] 
60863 Construct a dynamic buffer from a string. 
60864
60865
60866   explicit ``[link boost_asio.reference.dynamic_string_buffer.dynamic_string_buffer.overload1 dynamic_string_buffer]``(
60867       std::basic_string< Elem, Traits, Allocator > & s,
60868       std::size_t maximum_size = (std::numeric_limits< std::size_t >::max)());
60869   ``  [''''&raquo;''' [link boost_asio.reference.dynamic_string_buffer.dynamic_string_buffer.overload1 more...]]``
60870
60871
60872 [*DynamicBuffer\_v2:] Copy construct a dynamic buffer. 
60873
60874
60875   ``[link boost_asio.reference.dynamic_string_buffer.dynamic_string_buffer.overload2 dynamic_string_buffer]``(
60876       const dynamic_string_buffer & other);
60877   ``  [''''&raquo;''' [link boost_asio.reference.dynamic_string_buffer.dynamic_string_buffer.overload2 more...]]``
60878
60879
60880 Move construct a dynamic buffer. 
60881
60882
60883   ``[link boost_asio.reference.dynamic_string_buffer.dynamic_string_buffer.overload3 dynamic_string_buffer]``(
60884       dynamic_string_buffer && other);
60885   ``  [''''&raquo;''' [link boost_asio.reference.dynamic_string_buffer.dynamic_string_buffer.overload3 more...]]``
60886
60887
60888 [section:overload1 dynamic_string_buffer::dynamic_string_buffer (1 of 3 overloads)]
60889
60890
60891 Construct a dynamic buffer from a string. 
60892
60893
60894   dynamic_string_buffer(
60895       std::basic_string< Elem, Traits, Allocator > & s,
60896       std::size_t maximum_size = (std::numeric_limits< std::size_t >::max)());
60897
60898
60899
60900 [heading Parameters]
60901     
60902
60903 [variablelist
60904   
60905 [[s][The string to be used as backing storage for the dynamic buffer. The object stores a reference to the string and the user is responsible for ensuring that the string object remains valid while the [link boost_asio.reference.dynamic_string_buffer `dynamic_string_buffer`] object, and copies of the object, are in use.]]
60906
60907 ]
60908
60909 [*DynamicBuffer\_v1:] Any existing data in the string is treated as the dynamic buffer's input sequence.
60910
60911
60912 [heading Parameters]
60913     
60914
60915 [variablelist
60916   
60917 [[maximum_size][Specifies a maximum size for the buffer, in bytes. ]]
60918
60919 ]
60920
60921
60922
60923
60924 [endsect]
60925
60926
60927
60928 [section:overload2 dynamic_string_buffer::dynamic_string_buffer (2 of 3 overloads)]
60929
60930
60931 [*DynamicBuffer\_v2:] Copy construct a dynamic buffer. 
60932
60933
60934   dynamic_string_buffer(
60935       const dynamic_string_buffer & other);
60936
60937
60938
60939 [endsect]
60940
60941
60942
60943 [section:overload3 dynamic_string_buffer::dynamic_string_buffer (3 of 3 overloads)]
60944
60945
60946 Move construct a dynamic buffer. 
60947
60948
60949   dynamic_string_buffer(
60950       dynamic_string_buffer && other);
60951
60952
60953
60954 [endsect]
60955
60956
60957 [endsect]
60958
60959
60960 [section:grow dynamic_string_buffer::grow]
60961
60962 [indexterm2 boost_asio.indexterm.dynamic_string_buffer.grow..grow..dynamic_string_buffer] 
60963 [*DynamicBuffer\_v2:] Grow the underlying memory by the specified number of bytes. 
60964
60965
60966   void grow(
60967       std::size_t n);
60968
60969
60970 Resizes the string to accommodate an additional `n` bytes at the end.
60971
60972
60973 [heading Exceptions]
60974     
60975
60976 [variablelist
60977   
60978 [[std::length_error][If `size() + n > max_size()`. ]]
60979
60980 ]
60981
60982
60983
60984
60985 [endsect]
60986
60987
60988
60989 [section:max_size dynamic_string_buffer::max_size]
60990
60991 [indexterm2 boost_asio.indexterm.dynamic_string_buffer.max_size..max_size..dynamic_string_buffer] 
60992 Get the maximum size of the dynamic buffer. 
60993
60994
60995   std::size_t max_size() const;
60996
60997
60998
60999 [heading Return Value]
61000       
61001 The allowed maximum size of the underlying memory. 
61002
61003
61004
61005
61006 [endsect]
61007
61008
61009
61010 [section:mutable_buffers_type dynamic_string_buffer::mutable_buffers_type]
61011
61012 [indexterm2 boost_asio.indexterm.dynamic_string_buffer.mutable_buffers_type..mutable_buffers_type..dynamic_string_buffer] 
61013 The type used to represent a sequence of mutable buffers that refers to the underlying memory. 
61014
61015
61016   typedef mutable_buffer mutable_buffers_type;
61017
61018
61019 [heading Member Functions]
61020 [table
61021   [[Name][Description]]
61022
61023   [
61024     [[link boost_asio.reference.mutable_buffer.data [*data]]]
61025     [Get a pointer to the beginning of the memory range. ]
61026   ]
61027   
61028   [
61029     [[link boost_asio.reference.mutable_buffer.mutable_buffer [*mutable_buffer]]]
61030     [Construct an empty buffer. 
61031      [hr]
61032      Construct a buffer to represent a given memory range. ]
61033   ]
61034   
61035   [
61036     [[link boost_asio.reference.mutable_buffer.operator_plus__eq_ [*operator+=]]]
61037     [Move the start of the buffer by the specified number of bytes. ]
61038   ]
61039   
61040   [
61041     [[link boost_asio.reference.mutable_buffer.size [*size]]]
61042     [Get the size of the memory range. ]
61043   ]
61044   
61045 ]
61046
61047 [heading Related Functions]
61048 [table
61049   [[Name][Description]]
61050
61051   [
61052     [[link boost_asio.reference.mutable_buffer.operator_plus_ [*operator+]]]
61053     [Create a new modifiable buffer that is offset from the start of another. ]
61054   ]
61055   
61056 ]
61057
61058 The [link boost_asio.reference.mutable_buffer `mutable_buffer`] class provides a safe representation of a buffer that can be modified. It does not own the underlying data, and so is cheap to copy or assign.
61059
61060
61061 [heading Accessing Buffer Contents]
61062   
61063
61064
61065 The contents of a buffer may be accessed using the `data()` and `size()` member functions:
61066
61067
61068
61069    boost::asio::mutable_buffer b1 = ...;
61070    std::size_t s1 = b1.size();
61071    unsigned char* p1 = static_cast<unsigned char*>(b1.data());
61072
61073
61074
61075
61076 The `data()` member function permits violations of type safety, so uses of it in application code should be carefully considered. 
61077
61078
61079 [heading Requirements]
61080
61081 ['Header: ][^boost/asio/buffer.hpp]
61082
61083 ['Convenience header: ][^boost/asio.hpp]
61084
61085
61086 [endsect]
61087
61088
61089
61090 [section:prepare dynamic_string_buffer::prepare]
61091
61092 [indexterm2 boost_asio.indexterm.dynamic_string_buffer.prepare..prepare..dynamic_string_buffer] 
61093 [*DynamicBuffer\_v1:] Get a list of buffers that represents the output sequence, with the given size. 
61094
61095
61096   mutable_buffers_type prepare(
61097       std::size_t n);
61098
61099
61100 Ensures that the output sequence can accommodate `n` bytes, resizing the basic\_string object as necessary.
61101
61102
61103 [heading Return Value]
61104       
61105 An object of type `mutable_buffers_type` that satisfies MutableBufferSequence requirements, representing basic\_string memory at the start of the output sequence of size `n`.
61106
61107
61108 [heading Exceptions]
61109     
61110
61111 [variablelist
61112   
61113 [[std::length_error][If `size() + n > max_size()`.]]
61114
61115 ]
61116
61117
61118 [heading Remarks]
61119       
61120 The returned object is invalidated by any `dynamic_string_buffer` or `basic_string` member function that modifies the input sequence or output sequence. 
61121
61122
61123
61124
61125 [endsect]
61126
61127
61128
61129 [section:shrink dynamic_string_buffer::shrink]
61130
61131 [indexterm2 boost_asio.indexterm.dynamic_string_buffer.shrink..shrink..dynamic_string_buffer] 
61132 [*DynamicBuffer\_v2:] Shrink the underlying memory by the specified number of bytes. 
61133
61134
61135   void shrink(
61136       std::size_t n);
61137
61138
61139 Erases `n` bytes from the end of the string by resizing the basic\_string object. If `n` is greater than the current size of the string, the string is emptied. 
61140
61141
61142 [endsect]
61143
61144
61145
61146 [section:size dynamic_string_buffer::size]
61147
61148 [indexterm2 boost_asio.indexterm.dynamic_string_buffer.size..size..dynamic_string_buffer] 
61149 [*DynamicBuffer\_v1:] Get the size of the input sequence. [*DynamicBuffer\_v2:] Get the current size of the underlying memory. 
61150
61151
61152   std::size_t size() const;
61153
61154
61155
61156 [heading Return Value]
61157       
61158 [*DynamicBuffer\_v1] The current size of the input sequence. [*DynamicBuffer\_v2:] The current size of the underlying string if less than `max_size()`. Otherwise returns `max_size()`. 
61159
61160
61161
61162
61163 [endsect]
61164
61165
61166
61167 [endsect]
61168
61169 [section:dynamic_vector_buffer dynamic_vector_buffer]
61170
61171
61172 Adapt a vector to the DynamicBuffer requirements. 
61173
61174
61175   template<
61176       typename Elem,
61177       typename Allocator>
61178   class dynamic_vector_buffer
61179
61180
61181 [heading Types]
61182 [table
61183   [[Name][Description]]
61184
61185   [
61186
61187     [[link boost_asio.reference.dynamic_vector_buffer.const_buffers_type [*const_buffers_type]]]
61188     [The type used to represent a sequence of constant buffers that refers to the underlying memory. ]
61189   
61190   ]
61191
61192   [
61193
61194     [[link boost_asio.reference.dynamic_vector_buffer.mutable_buffers_type [*mutable_buffers_type]]]
61195     [The type used to represent a sequence of mutable buffers that refers to the underlying memory. ]
61196   
61197   ]
61198
61199 ]
61200
61201 [heading Member Functions]
61202 [table
61203   [[Name][Description]]
61204
61205   [
61206     [[link boost_asio.reference.dynamic_vector_buffer.capacity [*capacity]]]
61207     [Get the maximum size that the buffer may grow to without triggering reallocation. ]
61208   ]
61209   
61210   [
61211     [[link boost_asio.reference.dynamic_vector_buffer.commit [*commit]]]
61212     [DynamicBuffer_v1: Move bytes from the output sequence to the input sequence. ]
61213   ]
61214   
61215   [
61216     [[link boost_asio.reference.dynamic_vector_buffer.consume [*consume]]]
61217     [DynamicBuffer_v1: Remove characters from the input sequence. DynamicBuffer_v2: Consume the specified number of bytes from the beginning of the underlying memory. ]
61218   ]
61219   
61220   [
61221     [[link boost_asio.reference.dynamic_vector_buffer.data [*data]]]
61222     [DynamicBuffer_v1: Get a list of buffers that represents the input sequence. 
61223      [hr]
61224      DynamicBuffer_v2: Get a sequence of buffers that represents the underlying memory. ]
61225   ]
61226   
61227   [
61228     [[link boost_asio.reference.dynamic_vector_buffer.dynamic_vector_buffer [*dynamic_vector_buffer]]]
61229     [Construct a dynamic buffer from a vector. 
61230      [hr]
61231      DynamicBuffer_v2: Copy construct a dynamic buffer. 
61232      [hr]
61233      Move construct a dynamic buffer. ]
61234   ]
61235   
61236   [
61237     [[link boost_asio.reference.dynamic_vector_buffer.grow [*grow]]]
61238     [DynamicBuffer_v2: Grow the underlying memory by the specified number of bytes. ]
61239   ]
61240   
61241   [
61242     [[link boost_asio.reference.dynamic_vector_buffer.max_size [*max_size]]]
61243     [Get the maximum size of the dynamic buffer. ]
61244   ]
61245   
61246   [
61247     [[link boost_asio.reference.dynamic_vector_buffer.prepare [*prepare]]]
61248     [DynamicBuffer_v1: Get a list of buffers that represents the output sequence, with the given size. ]
61249   ]
61250   
61251   [
61252     [[link boost_asio.reference.dynamic_vector_buffer.shrink [*shrink]]]
61253     [DynamicBuffer_v2: Shrink the underlying memory by the specified number of bytes. ]
61254   ]
61255   
61256   [
61257     [[link boost_asio.reference.dynamic_vector_buffer.size [*size]]]
61258     [DynamicBuffer_v1: Get the size of the input sequence. DynamicBuffer_v2: Get the current size of the underlying memory. ]
61259   ]
61260   
61261 ]
61262
61263 Requires that `sizeof(Elem) == 1`. 
61264
61265 [heading Requirements]
61266
61267 ['Header: ][^boost/asio/buffer.hpp]
61268
61269 ['Convenience header: ][^boost/asio.hpp]
61270
61271
61272 [section:capacity dynamic_vector_buffer::capacity]
61273
61274 [indexterm2 boost_asio.indexterm.dynamic_vector_buffer.capacity..capacity..dynamic_vector_buffer] 
61275 Get the maximum size that the buffer may grow to without triggering reallocation. 
61276
61277
61278   std::size_t capacity() const;
61279
61280
61281
61282 [heading Return Value]
61283       
61284 [*DynamicBuffer\_v1:] The current total capacity of the buffer, i.e. for both the input sequence and output sequence. [*DynamicBuffer\_v2:] The current capacity of the underlying vector if less than `max_size()`. Otherwise returns `max_size()`. 
61285
61286
61287
61288
61289 [endsect]
61290
61291
61292
61293 [section:commit dynamic_vector_buffer::commit]
61294
61295 [indexterm2 boost_asio.indexterm.dynamic_vector_buffer.commit..commit..dynamic_vector_buffer] 
61296 [*DynamicBuffer\_v1:] Move bytes from the output sequence to the input sequence. 
61297
61298
61299   void commit(
61300       std::size_t n);
61301
61302
61303
61304 [heading Parameters]
61305     
61306
61307 [variablelist
61308   
61309 [[n][The number of bytes to append from the start of the output sequence to the end of the input sequence. The remainder of the output sequence is discarded.]]
61310
61311 ]
61312
61313 Requires a preceding call `prepare(x)` where `x >= n`, and no intervening operations that modify the input or output sequence.
61314
61315
61316 [heading Remarks]
61317       
61318 If `n` is greater than the size of the output sequence, the entire output sequence is moved to the input sequence and no error is issued. 
61319
61320
61321
61322
61323 [endsect]
61324
61325
61326
61327 [section:const_buffers_type dynamic_vector_buffer::const_buffers_type]
61328
61329 [indexterm2 boost_asio.indexterm.dynamic_vector_buffer.const_buffers_type..const_buffers_type..dynamic_vector_buffer] 
61330 The type used to represent a sequence of constant buffers that refers to the underlying memory. 
61331
61332
61333   typedef const_buffer const_buffers_type;
61334
61335
61336 [heading Member Functions]
61337 [table
61338   [[Name][Description]]
61339
61340   [
61341     [[link boost_asio.reference.const_buffer.const_buffer [*const_buffer]]]
61342     [Construct an empty buffer. 
61343      [hr]
61344      Construct a buffer to represent a given memory range. 
61345      [hr]
61346      Construct a non-modifiable buffer from a modifiable one. ]
61347   ]
61348   
61349   [
61350     [[link boost_asio.reference.const_buffer.data [*data]]]
61351     [Get a pointer to the beginning of the memory range. ]
61352   ]
61353   
61354   [
61355     [[link boost_asio.reference.const_buffer.operator_plus__eq_ [*operator+=]]]
61356     [Move the start of the buffer by the specified number of bytes. ]
61357   ]
61358   
61359   [
61360     [[link boost_asio.reference.const_buffer.size [*size]]]
61361     [Get the size of the memory range. ]
61362   ]
61363   
61364 ]
61365
61366 [heading Related Functions]
61367 [table
61368   [[Name][Description]]
61369
61370   [
61371     [[link boost_asio.reference.const_buffer.operator_plus_ [*operator+]]]
61372     [Create a new non-modifiable buffer that is offset from the start of another. ]
61373   ]
61374   
61375 ]
61376
61377 The [link boost_asio.reference.const_buffer `const_buffer`] class provides a safe representation of a buffer that cannot be modified. It does not own the underlying data, and so is cheap to copy or assign.
61378
61379
61380 [heading Accessing Buffer Contents]
61381   
61382
61383
61384 The contents of a buffer may be accessed using the `data()` and `size()` member functions:
61385
61386
61387
61388    boost::asio::const_buffer b1 = ...;
61389    std::size_t s1 = b1.size();
61390    const unsigned char* p1 = static_cast<const unsigned char*>(b1.data());
61391
61392
61393
61394
61395 The `data()` member function permits violations of type safety, so uses of it in application code should be carefully considered. 
61396
61397
61398 [heading Requirements]
61399
61400 ['Header: ][^boost/asio/buffer.hpp]
61401
61402 ['Convenience header: ][^boost/asio.hpp]
61403
61404
61405 [endsect]
61406
61407
61408
61409 [section:consume dynamic_vector_buffer::consume]
61410
61411 [indexterm2 boost_asio.indexterm.dynamic_vector_buffer.consume..consume..dynamic_vector_buffer] 
61412 [*DynamicBuffer\_v1:] Remove characters from the input sequence. [*DynamicBuffer\_v2:] Consume the specified number of bytes from the beginning of the underlying memory. 
61413
61414
61415   void consume(
61416       std::size_t n);
61417
61418
61419 [*DynamicBuffer\_v1:] Removes `n` characters from the beginning of the input sequence.
61420 [heading Remarks]
61421       
61422 If `n` is greater than the size of the input sequence, the entire input sequence is consumed and no error is issued.
61423
61424 [*DynamicBuffer\_v2:] Erases `n` bytes from the beginning of the vector. If `n` is greater than the current size of the vector, the vector is emptied. 
61425
61426
61427 [endsect]
61428
61429
61430 [section:data dynamic_vector_buffer::data]
61431
61432 [indexterm2 boost_asio.indexterm.dynamic_vector_buffer.data..data..dynamic_vector_buffer] 
61433 [*DynamicBuffer\_v1:] Get a list of buffers that represents the input sequence. 
61434
61435
61436   const_buffers_type ``[link boost_asio.reference.dynamic_vector_buffer.data.overload1 data]``() const;
61437   ``  [''''&raquo;''' [link boost_asio.reference.dynamic_vector_buffer.data.overload1 more...]]``
61438
61439
61440 [*DynamicBuffer\_v2:] Get a sequence of buffers that represents the underlying memory. 
61441
61442
61443   mutable_buffers_type ``[link boost_asio.reference.dynamic_vector_buffer.data.overload2 data]``(
61444       std::size_t pos,
61445       std::size_t n);
61446   ``  [''''&raquo;''' [link boost_asio.reference.dynamic_vector_buffer.data.overload2 more...]]``
61447
61448   const_buffers_type ``[link boost_asio.reference.dynamic_vector_buffer.data.overload3 data]``(
61449       std::size_t pos,
61450       std::size_t n) const;
61451   ``  [''''&raquo;''' [link boost_asio.reference.dynamic_vector_buffer.data.overload3 more...]]``
61452
61453
61454 [section:overload1 dynamic_vector_buffer::data (1 of 3 overloads)]
61455
61456
61457 [*DynamicBuffer\_v1:] Get a list of buffers that represents the input sequence. 
61458
61459
61460   const_buffers_type data() const;
61461
61462
61463
61464 [heading Return Value]
61465       
61466 An object of type `const_buffers_type` that satisfies ConstBufferSequence requirements, representing the vector memory in the input sequence.
61467
61468
61469 [heading Remarks]
61470       
61471 The returned object is invalidated by any `dynamic_vector_buffer` or `vector` member function that modifies the input sequence or output sequence. 
61472
61473
61474
61475
61476 [endsect]
61477
61478
61479
61480 [section:overload2 dynamic_vector_buffer::data (2 of 3 overloads)]
61481
61482
61483 [*DynamicBuffer\_v2:] Get a sequence of buffers that represents the underlying memory. 
61484
61485
61486   mutable_buffers_type data(
61487       std::size_t pos,
61488       std::size_t n);
61489
61490
61491
61492 [heading Parameters]
61493     
61494
61495 [variablelist
61496   
61497 [[pos][Position of the first byte to represent in the buffer sequence]]
61498
61499 [[n][The number of bytes to return in the buffer sequence. If the underlying memory is shorter, the buffer sequence represents as many bytes as are available.]]
61500
61501 ]
61502
61503
61504 [heading Return Value]
61505       
61506 An object of type `mutable_buffers_type` that satisfies MutableBufferSequence requirements, representing the vector memory.
61507
61508
61509 [heading Remarks]
61510       
61511 The returned object is invalidated by any `dynamic_vector_buffer` or `vector` member function that resizes or erases the vector. 
61512
61513
61514
61515
61516 [endsect]
61517
61518
61519
61520 [section:overload3 dynamic_vector_buffer::data (3 of 3 overloads)]
61521
61522
61523 [*DynamicBuffer\_v2:] Get a sequence of buffers that represents the underlying memory. 
61524
61525
61526   const_buffers_type data(
61527       std::size_t pos,
61528       std::size_t n) const;
61529
61530
61531
61532 [heading Parameters]
61533     
61534
61535 [variablelist
61536   
61537 [[pos][Position of the first byte to represent in the buffer sequence]]
61538
61539 [[n][The number of bytes to return in the buffer sequence. If the underlying memory is shorter, the buffer sequence represents as many bytes as are available.]]
61540
61541 ]
61542
61543
61544 [heading Remarks]
61545       
61546 The returned object is invalidated by any `dynamic_vector_buffer` or `vector` member function that resizes or erases the vector. 
61547
61548
61549
61550
61551 [endsect]
61552
61553
61554 [endsect]
61555
61556 [section:dynamic_vector_buffer dynamic_vector_buffer::dynamic_vector_buffer]
61557
61558 [indexterm2 boost_asio.indexterm.dynamic_vector_buffer.dynamic_vector_buffer..dynamic_vector_buffer..dynamic_vector_buffer] 
61559 Construct a dynamic buffer from a vector. 
61560
61561
61562   explicit ``[link boost_asio.reference.dynamic_vector_buffer.dynamic_vector_buffer.overload1 dynamic_vector_buffer]``(
61563       std::vector< Elem, Allocator > & v,
61564       std::size_t maximum_size = (std::numeric_limits< std::size_t >::max)());
61565   ``  [''''&raquo;''' [link boost_asio.reference.dynamic_vector_buffer.dynamic_vector_buffer.overload1 more...]]``
61566
61567
61568 [*DynamicBuffer\_v2:] Copy construct a dynamic buffer. 
61569
61570
61571   ``[link boost_asio.reference.dynamic_vector_buffer.dynamic_vector_buffer.overload2 dynamic_vector_buffer]``(
61572       const dynamic_vector_buffer & other);
61573   ``  [''''&raquo;''' [link boost_asio.reference.dynamic_vector_buffer.dynamic_vector_buffer.overload2 more...]]``
61574
61575
61576 Move construct a dynamic buffer. 
61577
61578
61579   ``[link boost_asio.reference.dynamic_vector_buffer.dynamic_vector_buffer.overload3 dynamic_vector_buffer]``(
61580       dynamic_vector_buffer && other);
61581   ``  [''''&raquo;''' [link boost_asio.reference.dynamic_vector_buffer.dynamic_vector_buffer.overload3 more...]]``
61582
61583
61584 [section:overload1 dynamic_vector_buffer::dynamic_vector_buffer (1 of 3 overloads)]
61585
61586
61587 Construct a dynamic buffer from a vector. 
61588
61589
61590   dynamic_vector_buffer(
61591       std::vector< Elem, Allocator > & v,
61592       std::size_t maximum_size = (std::numeric_limits< std::size_t >::max)());
61593
61594
61595
61596 [heading Parameters]
61597     
61598
61599 [variablelist
61600   
61601 [[v][The vector to be used as backing storage for the dynamic buffer. The object stores a reference to the vector and the user is responsible for ensuring that the vector object remains valid while the [link boost_asio.reference.dynamic_vector_buffer `dynamic_vector_buffer`] object, and copies of the object, are in use.]]
61602
61603 [[maximum_size][Specifies a maximum size for the buffer, in bytes. ]]
61604
61605 ]
61606
61607
61608
61609
61610 [endsect]
61611
61612
61613
61614 [section:overload2 dynamic_vector_buffer::dynamic_vector_buffer (2 of 3 overloads)]
61615
61616
61617 [*DynamicBuffer\_v2:] Copy construct a dynamic buffer. 
61618
61619
61620   dynamic_vector_buffer(
61621       const dynamic_vector_buffer & other);
61622
61623
61624
61625 [endsect]
61626
61627
61628
61629 [section:overload3 dynamic_vector_buffer::dynamic_vector_buffer (3 of 3 overloads)]
61630
61631
61632 Move construct a dynamic buffer. 
61633
61634
61635   dynamic_vector_buffer(
61636       dynamic_vector_buffer && other);
61637
61638
61639
61640 [endsect]
61641
61642
61643 [endsect]
61644
61645
61646 [section:grow dynamic_vector_buffer::grow]
61647
61648 [indexterm2 boost_asio.indexterm.dynamic_vector_buffer.grow..grow..dynamic_vector_buffer] 
61649 [*DynamicBuffer\_v2:] Grow the underlying memory by the specified number of bytes. 
61650
61651
61652   void grow(
61653       std::size_t n);
61654
61655
61656 Resizes the vector to accommodate an additional `n` bytes at the end.
61657
61658
61659 [heading Exceptions]
61660     
61661
61662 [variablelist
61663   
61664 [[std::length_error][If `size() + n > max_size()`. ]]
61665
61666 ]
61667
61668
61669
61670
61671 [endsect]
61672
61673
61674
61675 [section:max_size dynamic_vector_buffer::max_size]
61676
61677 [indexterm2 boost_asio.indexterm.dynamic_vector_buffer.max_size..max_size..dynamic_vector_buffer] 
61678 Get the maximum size of the dynamic buffer. 
61679
61680
61681   std::size_t max_size() const;
61682
61683
61684
61685 [heading Return Value]
61686       
61687 [*DynamicBuffer\_v1:] The allowed maximum of the sum of the sizes of the input sequence and output sequence. [*DynamicBuffer\_v2:] The allowed maximum size of the underlying memory. 
61688
61689
61690
61691
61692 [endsect]
61693
61694
61695
61696 [section:mutable_buffers_type dynamic_vector_buffer::mutable_buffers_type]
61697
61698 [indexterm2 boost_asio.indexterm.dynamic_vector_buffer.mutable_buffers_type..mutable_buffers_type..dynamic_vector_buffer] 
61699 The type used to represent a sequence of mutable buffers that refers to the underlying memory. 
61700
61701
61702   typedef mutable_buffer mutable_buffers_type;
61703
61704
61705 [heading Member Functions]
61706 [table
61707   [[Name][Description]]
61708
61709   [
61710     [[link boost_asio.reference.mutable_buffer.data [*data]]]
61711     [Get a pointer to the beginning of the memory range. ]
61712   ]
61713   
61714   [
61715     [[link boost_asio.reference.mutable_buffer.mutable_buffer [*mutable_buffer]]]
61716     [Construct an empty buffer. 
61717      [hr]
61718      Construct a buffer to represent a given memory range. ]
61719   ]
61720   
61721   [
61722     [[link boost_asio.reference.mutable_buffer.operator_plus__eq_ [*operator+=]]]
61723     [Move the start of the buffer by the specified number of bytes. ]
61724   ]
61725   
61726   [
61727     [[link boost_asio.reference.mutable_buffer.size [*size]]]
61728     [Get the size of the memory range. ]
61729   ]
61730   
61731 ]
61732
61733 [heading Related Functions]
61734 [table
61735   [[Name][Description]]
61736
61737   [
61738     [[link boost_asio.reference.mutable_buffer.operator_plus_ [*operator+]]]
61739     [Create a new modifiable buffer that is offset from the start of another. ]
61740   ]
61741   
61742 ]
61743
61744 The [link boost_asio.reference.mutable_buffer `mutable_buffer`] class provides a safe representation of a buffer that can be modified. It does not own the underlying data, and so is cheap to copy or assign.
61745
61746
61747 [heading Accessing Buffer Contents]
61748   
61749
61750
61751 The contents of a buffer may be accessed using the `data()` and `size()` member functions:
61752
61753
61754
61755    boost::asio::mutable_buffer b1 = ...;
61756    std::size_t s1 = b1.size();
61757    unsigned char* p1 = static_cast<unsigned char*>(b1.data());
61758
61759
61760
61761
61762 The `data()` member function permits violations of type safety, so uses of it in application code should be carefully considered. 
61763
61764
61765 [heading Requirements]
61766
61767 ['Header: ][^boost/asio/buffer.hpp]
61768
61769 ['Convenience header: ][^boost/asio.hpp]
61770
61771
61772 [endsect]
61773
61774
61775
61776 [section:prepare dynamic_vector_buffer::prepare]
61777
61778 [indexterm2 boost_asio.indexterm.dynamic_vector_buffer.prepare..prepare..dynamic_vector_buffer] 
61779 [*DynamicBuffer\_v1:] Get a list of buffers that represents the output sequence, with the given size. 
61780
61781
61782   mutable_buffers_type prepare(
61783       std::size_t n);
61784
61785
61786 Ensures that the output sequence can accommodate `n` bytes, resizing the vector object as necessary.
61787
61788
61789 [heading Return Value]
61790       
61791 An object of type `mutable_buffers_type` that satisfies MutableBufferSequence requirements, representing vector memory at the start of the output sequence of size `n`.
61792
61793
61794 [heading Exceptions]
61795     
61796
61797 [variablelist
61798   
61799 [[std::length_error][If `size() + n > max_size()`.]]
61800
61801 ]
61802
61803
61804 [heading Remarks]
61805       
61806 The returned object is invalidated by any `dynamic_vector_buffer` or `vector` member function that modifies the input sequence or output sequence. 
61807
61808
61809
61810
61811 [endsect]
61812
61813
61814
61815 [section:shrink dynamic_vector_buffer::shrink]
61816
61817 [indexterm2 boost_asio.indexterm.dynamic_vector_buffer.shrink..shrink..dynamic_vector_buffer] 
61818 [*DynamicBuffer\_v2:] Shrink the underlying memory by the specified number of bytes. 
61819
61820
61821   void shrink(
61822       std::size_t n);
61823
61824
61825 Erases `n` bytes from the end of the vector by resizing the vector object. If `n` is greater than the current size of the vector, the vector is emptied. 
61826
61827
61828 [endsect]
61829
61830
61831
61832 [section:size dynamic_vector_buffer::size]
61833
61834 [indexterm2 boost_asio.indexterm.dynamic_vector_buffer.size..size..dynamic_vector_buffer] 
61835 [*DynamicBuffer\_v1:] Get the size of the input sequence. [*DynamicBuffer\_v2:] Get the current size of the underlying memory. 
61836
61837
61838   std::size_t size() const;
61839
61840
61841
61842 [heading Return Value]
61843       
61844 [*DynamicBuffer\_v1] The current size of the input sequence. [*DynamicBuffer\_v2:] The current size of the underlying vector if less than `max_size()`. Otherwise returns `max_size()`. 
61845
61846
61847
61848
61849 [endsect]
61850
61851
61852
61853 [endsect]
61854
61855
61856 [section:error__addrinfo_category error::addrinfo_category]
61857
61858 [indexterm1 boost_asio.indexterm.error__addrinfo_category..error::addrinfo_category] 
61859
61860   static const boost::system::error_category & addrinfo_category = boost::asio::error::get_addrinfo_category();
61861
61862
61863 [heading Requirements]
61864
61865 ['Header: ][^boost/asio/error.hpp]
61866
61867 ['Convenience header: ][^boost/asio.hpp]
61868
61869
61870 [endsect]
61871
61872
61873
61874 [section:error__addrinfo_errors error::addrinfo_errors]
61875
61876 [indexterm1 boost_asio.indexterm.error__addrinfo_errors..error::addrinfo_errors] 
61877
61878   enum addrinfo_errors
61879
61880 [indexterm2 boost_asio.indexterm.error__addrinfo_errors.service_not_found..service_not_found..error::addrinfo_errors]
61881 [indexterm2 boost_asio.indexterm.error__addrinfo_errors.socket_type_not_supported..socket_type_not_supported..error::addrinfo_errors]
61882
61883 [heading Values]
61884 [variablelist
61885
61886   [
61887     [service_not_found]
61888     [The service is not supported for the given socket type. ]
61889   ]
61890
61891   [
61892     [socket_type_not_supported]
61893     [The socket type is not supported. ]
61894   ]
61895
61896 ]
61897
61898
61899 [heading Requirements]
61900
61901 ['Header: ][^boost/asio/error.hpp]
61902
61903 ['Convenience header: ][^boost/asio.hpp]
61904
61905
61906 [endsect]
61907
61908
61909
61910 [section:error__basic_errors error::basic_errors]
61911
61912 [indexterm1 boost_asio.indexterm.error__basic_errors..error::basic_errors] 
61913
61914   enum basic_errors
61915
61916 [indexterm2 boost_asio.indexterm.error__basic_errors.access_denied..access_denied..error::basic_errors]
61917 [indexterm2 boost_asio.indexterm.error__basic_errors.address_family_not_supported..address_family_not_supported..error::basic_errors]
61918 [indexterm2 boost_asio.indexterm.error__basic_errors.address_in_use..address_in_use..error::basic_errors]
61919 [indexterm2 boost_asio.indexterm.error__basic_errors.already_connected..already_connected..error::basic_errors]
61920 [indexterm2 boost_asio.indexterm.error__basic_errors.already_started..already_started..error::basic_errors]
61921 [indexterm2 boost_asio.indexterm.error__basic_errors.broken_pipe..broken_pipe..error::basic_errors]
61922 [indexterm2 boost_asio.indexterm.error__basic_errors.connection_aborted..connection_aborted..error::basic_errors]
61923 [indexterm2 boost_asio.indexterm.error__basic_errors.connection_refused..connection_refused..error::basic_errors]
61924 [indexterm2 boost_asio.indexterm.error__basic_errors.connection_reset..connection_reset..error::basic_errors]
61925 [indexterm2 boost_asio.indexterm.error__basic_errors.bad_descriptor..bad_descriptor..error::basic_errors]
61926 [indexterm2 boost_asio.indexterm.error__basic_errors.fault..fault..error::basic_errors]
61927 [indexterm2 boost_asio.indexterm.error__basic_errors.host_unreachable..host_unreachable..error::basic_errors]
61928 [indexterm2 boost_asio.indexterm.error__basic_errors.in_progress..in_progress..error::basic_errors]
61929 [indexterm2 boost_asio.indexterm.error__basic_errors.interrupted..interrupted..error::basic_errors]
61930 [indexterm2 boost_asio.indexterm.error__basic_errors.invalid_argument..invalid_argument..error::basic_errors]
61931 [indexterm2 boost_asio.indexterm.error__basic_errors.message_size..message_size..error::basic_errors]
61932 [indexterm2 boost_asio.indexterm.error__basic_errors.name_too_long..name_too_long..error::basic_errors]
61933 [indexterm2 boost_asio.indexterm.error__basic_errors.network_down..network_down..error::basic_errors]
61934 [indexterm2 boost_asio.indexterm.error__basic_errors.network_reset..network_reset..error::basic_errors]
61935 [indexterm2 boost_asio.indexterm.error__basic_errors.network_unreachable..network_unreachable..error::basic_errors]
61936 [indexterm2 boost_asio.indexterm.error__basic_errors.no_descriptors..no_descriptors..error::basic_errors]
61937 [indexterm2 boost_asio.indexterm.error__basic_errors.no_buffer_space..no_buffer_space..error::basic_errors]
61938 [indexterm2 boost_asio.indexterm.error__basic_errors.no_memory..no_memory..error::basic_errors]
61939 [indexterm2 boost_asio.indexterm.error__basic_errors.no_permission..no_permission..error::basic_errors]
61940 [indexterm2 boost_asio.indexterm.error__basic_errors.no_protocol_option..no_protocol_option..error::basic_errors]
61941 [indexterm2 boost_asio.indexterm.error__basic_errors.no_such_device..no_such_device..error::basic_errors]
61942 [indexterm2 boost_asio.indexterm.error__basic_errors.not_connected..not_connected..error::basic_errors]
61943 [indexterm2 boost_asio.indexterm.error__basic_errors.not_socket..not_socket..error::basic_errors]
61944 [indexterm2 boost_asio.indexterm.error__basic_errors.operation_aborted..operation_aborted..error::basic_errors]
61945 [indexterm2 boost_asio.indexterm.error__basic_errors.operation_not_supported..operation_not_supported..error::basic_errors]
61946 [indexterm2 boost_asio.indexterm.error__basic_errors.shut_down..shut_down..error::basic_errors]
61947 [indexterm2 boost_asio.indexterm.error__basic_errors.timed_out..timed_out..error::basic_errors]
61948 [indexterm2 boost_asio.indexterm.error__basic_errors.try_again..try_again..error::basic_errors]
61949 [indexterm2 boost_asio.indexterm.error__basic_errors.would_block..would_block..error::basic_errors]
61950
61951 [heading Values]
61952 [variablelist
61953
61954   [
61955     [access_denied]
61956     [Permission denied. ]
61957   ]
61958
61959   [
61960     [address_family_not_supported]
61961     [Address family not supported by protocol. ]
61962   ]
61963
61964   [
61965     [address_in_use]
61966     [Address already in use. ]
61967   ]
61968
61969   [
61970     [already_connected]
61971     [Transport endpoint is already connected. ]
61972   ]
61973
61974   [
61975     [already_started]
61976     [Operation already in progress. ]
61977   ]
61978
61979   [
61980     [broken_pipe]
61981     [Broken pipe. ]
61982   ]
61983
61984   [
61985     [connection_aborted]
61986     [A connection has been aborted. ]
61987   ]
61988
61989   [
61990     [connection_refused]
61991     [Connection refused. ]
61992   ]
61993
61994   [
61995     [connection_reset]
61996     [Connection reset by peer. ]
61997   ]
61998
61999   [
62000     [bad_descriptor]
62001     [Bad file descriptor. ]
62002   ]
62003
62004   [
62005     [fault]
62006     [Bad address. ]
62007   ]
62008
62009   [
62010     [host_unreachable]
62011     [No route to host. ]
62012   ]
62013
62014   [
62015     [in_progress]
62016     [Operation now in progress. ]
62017   ]
62018
62019   [
62020     [interrupted]
62021     [Interrupted system call. ]
62022   ]
62023
62024   [
62025     [invalid_argument]
62026     [Invalid argument. ]
62027   ]
62028
62029   [
62030     [message_size]
62031     [Message too long. ]
62032   ]
62033
62034   [
62035     [name_too_long]
62036     [The name was too long. ]
62037   ]
62038
62039   [
62040     [network_down]
62041     [Network is down. ]
62042   ]
62043
62044   [
62045     [network_reset]
62046     [Network dropped connection on reset. ]
62047   ]
62048
62049   [
62050     [network_unreachable]
62051     [Network is unreachable. ]
62052   ]
62053
62054   [
62055     [no_descriptors]
62056     [Too many open files. ]
62057   ]
62058
62059   [
62060     [no_buffer_space]
62061     [No buffer space available. ]
62062   ]
62063
62064   [
62065     [no_memory]
62066     [Cannot allocate memory. ]
62067   ]
62068
62069   [
62070     [no_permission]
62071     [Operation not permitted. ]
62072   ]
62073
62074   [
62075     [no_protocol_option]
62076     [Protocol not available. ]
62077   ]
62078
62079   [
62080     [no_such_device]
62081     [No such device. ]
62082   ]
62083
62084   [
62085     [not_connected]
62086     [Transport endpoint is not connected. ]
62087   ]
62088
62089   [
62090     [not_socket]
62091     [Socket operation on non-socket. ]
62092   ]
62093
62094   [
62095     [operation_aborted]
62096     [Operation cancelled. ]
62097   ]
62098
62099   [
62100     [operation_not_supported]
62101     [Operation not supported. ]
62102   ]
62103
62104   [
62105     [shut_down]
62106     [Cannot send after transport endpoint shutdown. ]
62107   ]
62108
62109   [
62110     [timed_out]
62111     [Connection timed out. ]
62112   ]
62113
62114   [
62115     [try_again]
62116     [Resource temporarily unavailable. ]
62117   ]
62118
62119   [
62120     [would_block]
62121     [The socket is marked non-blocking and the requested operation would block. ]
62122   ]
62123
62124 ]
62125
62126
62127 [heading Requirements]
62128
62129 ['Header: ][^boost/asio/error.hpp]
62130
62131 ['Convenience header: ][^boost/asio.hpp]
62132
62133
62134 [endsect]
62135
62136
62137
62138 [section:error__get_addrinfo_category error::get_addrinfo_category]
62139
62140 [indexterm1 boost_asio.indexterm.error__get_addrinfo_category..error::get_addrinfo_category] 
62141
62142   const boost::system::error_category & get_addrinfo_category();
62143
62144
62145 [heading Requirements]
62146
62147 ['Header: ][^boost/asio/error.hpp]
62148
62149 ['Convenience header: ][^boost/asio.hpp]
62150
62151
62152 [endsect]
62153
62154
62155
62156 [section:error__get_misc_category error::get_misc_category]
62157
62158 [indexterm1 boost_asio.indexterm.error__get_misc_category..error::get_misc_category] 
62159
62160   const boost::system::error_category & get_misc_category();
62161
62162
62163 [heading Requirements]
62164
62165 ['Header: ][^boost/asio/error.hpp]
62166
62167 ['Convenience header: ][^boost/asio.hpp]
62168
62169
62170 [endsect]
62171
62172
62173
62174 [section:error__get_netdb_category error::get_netdb_category]
62175
62176 [indexterm1 boost_asio.indexterm.error__get_netdb_category..error::get_netdb_category] 
62177
62178   const boost::system::error_category & get_netdb_category();
62179
62180
62181 [heading Requirements]
62182
62183 ['Header: ][^boost/asio/error.hpp]
62184
62185 ['Convenience header: ][^boost/asio.hpp]
62186
62187
62188 [endsect]
62189
62190
62191
62192 [section:error__get_ssl_category error::get_ssl_category]
62193
62194 [indexterm1 boost_asio.indexterm.error__get_ssl_category..error::get_ssl_category] 
62195
62196   const boost::system::error_category & get_ssl_category();
62197
62198
62199 [heading Requirements]
62200
62201 ['Header: ][^boost/asio/ssl/error.hpp]
62202
62203 ['Convenience header: ][^boost/asio/ssl.hpp]
62204
62205
62206 [endsect]
62207
62208
62209
62210 [section:error__get_system_category error::get_system_category]
62211
62212 [indexterm1 boost_asio.indexterm.error__get_system_category..error::get_system_category] 
62213
62214   const boost::system::error_category & get_system_category();
62215
62216
62217 [heading Requirements]
62218
62219 ['Header: ][^boost/asio/error.hpp]
62220
62221 ['Convenience header: ][^boost/asio.hpp]
62222
62223
62224 [endsect]
62225
62226
62227 [section:error__make_error_code error::make_error_code]
62228
62229 [indexterm1 boost_asio.indexterm.error__make_error_code..error::make_error_code] 
62230   boost::system::error_code ``[link boost_asio.reference.error__make_error_code.overload1 make_error_code]``(
62231       basic_errors e);
62232   ``  [''''&raquo;''' [link boost_asio.reference.error__make_error_code.overload1 more...]]``
62233
62234   boost::system::error_code ``[link boost_asio.reference.error__make_error_code.overload2 make_error_code]``(
62235       netdb_errors e);
62236   ``  [''''&raquo;''' [link boost_asio.reference.error__make_error_code.overload2 more...]]``
62237
62238   boost::system::error_code ``[link boost_asio.reference.error__make_error_code.overload3 make_error_code]``(
62239       addrinfo_errors e);
62240   ``  [''''&raquo;''' [link boost_asio.reference.error__make_error_code.overload3 more...]]``
62241
62242   boost::system::error_code ``[link boost_asio.reference.error__make_error_code.overload4 make_error_code]``(
62243       misc_errors e);
62244   ``  [''''&raquo;''' [link boost_asio.reference.error__make_error_code.overload4 more...]]``
62245
62246   boost::system::error_code ``[link boost_asio.reference.error__make_error_code.overload5 make_error_code]``(
62247       ssl_errors e);
62248   ``  [''''&raquo;''' [link boost_asio.reference.error__make_error_code.overload5 more...]]``
62249
62250 [heading Requirements]
62251
62252 ['Header: ][^boost/asio/error.hpp]
62253
62254 ['Convenience header: ][^boost/asio.hpp]
62255
62256
62257 [section:overload1 error::make_error_code (1 of 5 overloads)]
62258
62259
62260
62261   boost::system::error_code make_error_code(
62262       basic_errors e);
62263
62264
62265
62266 [endsect]
62267
62268
62269
62270 [section:overload2 error::make_error_code (2 of 5 overloads)]
62271
62272
62273
62274   boost::system::error_code make_error_code(
62275       netdb_errors e);
62276
62277
62278
62279 [endsect]
62280
62281
62282
62283 [section:overload3 error::make_error_code (3 of 5 overloads)]
62284
62285
62286
62287   boost::system::error_code make_error_code(
62288       addrinfo_errors e);
62289
62290
62291
62292 [endsect]
62293
62294
62295
62296 [section:overload4 error::make_error_code (4 of 5 overloads)]
62297
62298
62299
62300   boost::system::error_code make_error_code(
62301       misc_errors e);
62302
62303
62304
62305 [endsect]
62306
62307
62308
62309 [section:overload5 error::make_error_code (5 of 5 overloads)]
62310
62311
62312
62313   boost::system::error_code make_error_code(
62314       ssl_errors e);
62315
62316
62317
62318 [endsect]
62319
62320
62321 [endsect]
62322
62323
62324 [section:error__misc_category error::misc_category]
62325
62326 [indexterm1 boost_asio.indexterm.error__misc_category..error::misc_category] 
62327
62328   static const boost::system::error_category & misc_category = boost::asio::error::get_misc_category();
62329
62330
62331 [heading Requirements]
62332
62333 ['Header: ][^boost/asio/error.hpp]
62334
62335 ['Convenience header: ][^boost/asio.hpp]
62336
62337
62338 [endsect]
62339
62340
62341
62342 [section:error__misc_errors error::misc_errors]
62343
62344 [indexterm1 boost_asio.indexterm.error__misc_errors..error::misc_errors] 
62345
62346   enum misc_errors
62347
62348 [indexterm2 boost_asio.indexterm.error__misc_errors.already_open..already_open..error::misc_errors]
62349 [indexterm2 boost_asio.indexterm.error__misc_errors.eof..eof..error::misc_errors]
62350 [indexterm2 boost_asio.indexterm.error__misc_errors.not_found..not_found..error::misc_errors]
62351 [indexterm2 boost_asio.indexterm.error__misc_errors.fd_set_failure..fd_set_failure..error::misc_errors]
62352
62353 [heading Values]
62354 [variablelist
62355
62356   [
62357     [already_open]
62358     [Already open. ]
62359   ]
62360
62361   [
62362     [eof]
62363     [End of file or stream. ]
62364   ]
62365
62366   [
62367     [not_found]
62368     [Element not found. ]
62369   ]
62370
62371   [
62372     [fd_set_failure]
62373     [The descriptor cannot fit into the select system call's fd_set. ]
62374   ]
62375
62376 ]
62377
62378
62379 [heading Requirements]
62380
62381 ['Header: ][^boost/asio/error.hpp]
62382
62383 ['Convenience header: ][^boost/asio.hpp]
62384
62385
62386 [endsect]
62387
62388
62389
62390 [section:error__netdb_category error::netdb_category]
62391
62392 [indexterm1 boost_asio.indexterm.error__netdb_category..error::netdb_category] 
62393
62394   static const boost::system::error_category & netdb_category = boost::asio::error::get_netdb_category();
62395
62396
62397 [heading Requirements]
62398
62399 ['Header: ][^boost/asio/error.hpp]
62400
62401 ['Convenience header: ][^boost/asio.hpp]
62402
62403
62404 [endsect]
62405
62406
62407
62408 [section:error__netdb_errors error::netdb_errors]
62409
62410 [indexterm1 boost_asio.indexterm.error__netdb_errors..error::netdb_errors] 
62411
62412   enum netdb_errors
62413
62414 [indexterm2 boost_asio.indexterm.error__netdb_errors.host_not_found..host_not_found..error::netdb_errors]
62415 [indexterm2 boost_asio.indexterm.error__netdb_errors.host_not_found_try_again..host_not_found_try_again..error::netdb_errors]
62416 [indexterm2 boost_asio.indexterm.error__netdb_errors.no_data..no_data..error::netdb_errors]
62417 [indexterm2 boost_asio.indexterm.error__netdb_errors.no_recovery..no_recovery..error::netdb_errors]
62418
62419 [heading Values]
62420 [variablelist
62421
62422   [
62423     [host_not_found]
62424     [Host not found (authoritative). ]
62425   ]
62426
62427   [
62428     [host_not_found_try_again]
62429     [Host not found (non-authoritative). ]
62430   ]
62431
62432   [
62433     [no_data]
62434     [The query is valid but does not have associated address data. ]
62435   ]
62436
62437   [
62438     [no_recovery]
62439     [A non-recoverable error occurred. ]
62440   ]
62441
62442 ]
62443
62444
62445 [heading Requirements]
62446
62447 ['Header: ][^boost/asio/error.hpp]
62448
62449 ['Convenience header: ][^boost/asio.hpp]
62450
62451
62452 [endsect]
62453
62454
62455
62456 [section:error__ssl_category error::ssl_category]
62457
62458 [indexterm1 boost_asio.indexterm.error__ssl_category..error::ssl_category] 
62459
62460   static const boost::system::error_category & ssl_category = boost::asio::error::get_ssl_category();
62461
62462
62463 [heading Requirements]
62464
62465 ['Header: ][^boost/asio/ssl/error.hpp]
62466
62467 ['Convenience header: ][^boost/asio/ssl.hpp]
62468
62469
62470 [endsect]
62471
62472
62473
62474 [section:error__ssl_errors error::ssl_errors]
62475
62476 [indexterm1 boost_asio.indexterm.error__ssl_errors..error::ssl_errors] 
62477
62478   enum ssl_errors
62479
62480
62481 [heading Requirements]
62482
62483 ['Header: ][^boost/asio/ssl/error.hpp]
62484
62485 ['Convenience header: ][^boost/asio/ssl.hpp]
62486
62487
62488 [endsect]
62489
62490
62491
62492 [section:error__system_category error::system_category]
62493
62494 [indexterm1 boost_asio.indexterm.error__system_category..error::system_category] 
62495
62496   static const boost::system::error_category & system_category = boost::asio::error::get_system_category();
62497
62498
62499 [heading Requirements]
62500
62501 ['Header: ][^boost/asio/error.hpp]
62502
62503 ['Convenience header: ][^boost/asio.hpp]
62504
62505
62506 [endsect]
62507
62508
62509 [section:execution_context execution_context]
62510
62511
62512 A context for function object execution. 
62513
62514
62515   class execution_context :
62516     noncopyable
62517
62518
62519 [heading Types]
62520 [table
62521   [[Name][Description]]
62522
62523   [
62524
62525     [[link boost_asio.reference.execution_context__id [*id]]]
62526     [Class used to uniquely identify a service. ]
62527   
62528   ]
62529
62530   [
62531
62532     [[link boost_asio.reference.execution_context__service [*service]]]
62533     [Base class for all io_context services. ]
62534   
62535   ]
62536
62537   [
62538
62539     [[link boost_asio.reference.execution_context.fork_event [*fork_event]]]
62540     [Fork-related event notifications. ]
62541   
62542   ]
62543
62544 ]
62545
62546 [heading Member Functions]
62547 [table
62548   [[Name][Description]]
62549
62550   [
62551     [[link boost_asio.reference.execution_context.execution_context [*execution_context]]]
62552     [Constructor. ]
62553   ]
62554   
62555   [
62556     [[link boost_asio.reference.execution_context.notify_fork [*notify_fork]]]
62557     [Notify the execution_context of a fork-related event. ]
62558   ]
62559   
62560   [
62561     [[link boost_asio.reference.execution_context._execution_context [*~execution_context]]]
62562     [Destructor. ]
62563   ]
62564   
62565 ]
62566
62567 [heading Protected Member Functions]
62568 [table
62569   [[Name][Description]]
62570
62571   [
62572     [[link boost_asio.reference.execution_context.destroy [*destroy]]]
62573     [Destroys all services in the context. ]
62574   ]
62575   
62576   [
62577     [[link boost_asio.reference.execution_context.shutdown [*shutdown]]]
62578     [Shuts down all services in the context. ]
62579   ]
62580   
62581 ]
62582
62583 [heading Friends]
62584 [table
62585   [[Name][Description]]
62586
62587   [
62588     [[link boost_asio.reference.execution_context.add_service [*add_service]]]
62589     [(Deprecated: Use make_service().) Add a service object to the execution_context. ]
62590   ]
62591   
62592   [
62593     [[link boost_asio.reference.execution_context.has_service [*has_service]]]
62594     [Determine if an execution_context contains a specified service type. ]
62595   ]
62596   
62597   [
62598     [[link boost_asio.reference.execution_context.make_service [*make_service]]]
62599     [Creates a service object and adds it to the execution_context. ]
62600   ]
62601   
62602   [
62603     [[link boost_asio.reference.execution_context.use_service [*use_service]]]
62604     [Obtain the service object corresponding to the given type. ]
62605   ]
62606   
62607 ]
62608
62609 An execution context represents a place where function objects will be executed. An `io_context` is an example of an execution context.
62610
62611
62612 [heading The execution_context class and services]
62613   
62614
62615
62616 Class [link boost_asio.reference.execution_context `execution_context`] implements an extensible, type-safe, polymorphic set of services, indexed by service type.
62617
62618 Services exist to manage the resources that are shared across an execution context. For example, timers may be implemented in terms of a single timer queue, and this queue would be stored in a service.
62619
62620 Access to the services of an [link boost_asio.reference.execution_context `execution_context`] is via three function templates, `use_service()`, `add_service()` and `has_service()`.
62621
62622 In a call to `use_service<Service>()`, the type argument chooses a service, making available all members of the named type. If `Service` is not present in an [link boost_asio.reference.execution_context `execution_context`], an object of type `Service` is created and added to the [link boost_asio.reference.execution_context `execution_context`]. A C++ program can check if an [link boost_asio.reference.execution_context `execution_context`] implements a particular service with the function template `has_service<Service>()`.
62623
62624 Service objects may be explicitly added to an [link boost_asio.reference.execution_context `execution_context`] using the function template `add_service<Service>()`. If the `Service` is already present, the [link boost_asio.reference.service_already_exists `service_already_exists`] exception is thrown. If the owner of the service is not the same object as the [link boost_asio.reference.execution_context `execution_context`] parameter, the [link boost_asio.reference.invalid_service_owner `invalid_service_owner`] exception is thrown.
62625
62626 Once a service reference is obtained from an [link boost_asio.reference.execution_context `execution_context`] object by calling `use_service()`, that reference remains usable as long as the owning [link boost_asio.reference.execution_context `execution_context`] object exists.
62627
62628 All service implementations have [link boost_asio.reference.execution_context__service `execution_context::service`] as a public base class. Custom services may be implemented by deriving from this class and then added to an [link boost_asio.reference.execution_context `execution_context`] using the facilities described above.
62629
62630
62631 [heading The execution_context as a base class]
62632   
62633
62634
62635 Class [link boost_asio.reference.execution_context `execution_context`] may be used only as a base class for concrete execution context types. The `io_context` is an example of such a derived type.
62636
62637 On destruction, a class that is derived from [link boost_asio.reference.execution_context `execution_context`] must perform `execution_context::shutdown()` followed by `execution_context::destroy()`.
62638
62639 This destruction sequence permits programs to simplify their resource management by using `shared_ptr<>`. Where an object's lifetime is tied to the lifetime of a connection (or some other sequence of asynchronous operations), a `shared_ptr` to the object would be bound into the handlers for all asynchronous operations associated with it. This works as follows:
62640
62641
62642 * When a single connection ends, all associated asynchronous operations complete. The corresponding handler objects are destroyed, and all `shared_ptr` references to the objects are destroyed.
62643
62644
62645 * To shut down the whole program, the [link boost_asio.reference.io_context `io_context`] function stop() is called to terminate any run() calls as soon as possible. The [link boost_asio.reference.io_context `io_context`] destructor calls `shutdown()` and `destroy()` to destroy all pending handlers, causing all `shared_ptr` references to all connection objects to be destroyed. 
62646
62647
62648
62649 [heading Requirements]
62650
62651 ['Header: ][^boost/asio/execution_context.hpp]
62652
62653 ['Convenience header: ][^boost/asio.hpp]
62654
62655
62656 [section:add_service execution_context::add_service]
62657
62658 [indexterm2 boost_asio.indexterm.execution_context.add_service..add_service..execution_context] 
62659 (Deprecated: Use `make_service()`.) Add a service object to the [link boost_asio.reference.execution_context `execution_context`]. 
62660
62661
62662   template<
62663       typename ``[link boost_asio.reference.Service Service]``>
62664   friend void add_service(
62665       execution_context & e,
62666       Service * svc);
62667
62668
62669 This function is used to add a service to the [link boost_asio.reference.execution_context `execution_context`].
62670
62671
62672 [heading Parameters]
62673     
62674
62675 [variablelist
62676   
62677 [[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]]
62678
62679 [[svc][The service object. On success, ownership of the service object is transferred to the [link boost_asio.reference.execution_context `execution_context`]. When the [link boost_asio.reference.execution_context `execution_context`] object is destroyed, it will destroy the service object by performing:
62680 ``
62681    delete static_cast<execution_context::service*>(svc) 
62682 ``
62683 ]]
62684
62685 ]
62686
62687
62688 [heading Exceptions]
62689     
62690
62691 [variablelist
62692   
62693 [[boost::asio::service_already_exists][Thrown if a service of the given type is already present in the [link boost_asio.reference.execution_context `execution_context`].]]
62694
62695 [[boost::asio::invalid_service_owner][Thrown if the service's owning [link boost_asio.reference.execution_context `execution_context`] is not the [link boost_asio.reference.execution_context `execution_context`] object specified by the `e` parameter. ]]
62696
62697 ]
62698
62699
62700
62701 [heading Requirements]
62702
62703 ['Header: ][^boost/asio/execution_context.hpp]
62704
62705 ['Convenience header: ][^boost/asio.hpp]
62706
62707
62708 [endsect]
62709
62710
62711
62712 [section:destroy execution_context::destroy]
62713
62714 [indexterm2 boost_asio.indexterm.execution_context.destroy..destroy..execution_context] 
62715 Destroys all services in the context. 
62716
62717
62718   void destroy();
62719
62720
62721 This function is implemented as follows:
62722
62723
62724 * For each service object `svc` in the [link boost_asio.reference.execution_context `execution_context`] set, in reverse order * of the beginning of service object lifetime, performs `delete static_cast<execution_context::service*>(svc)`. 
62725
62726
62727
62728
62729 [endsect]
62730
62731
62732
62733 [section:execution_context execution_context::execution_context]
62734
62735 [indexterm2 boost_asio.indexterm.execution_context.execution_context..execution_context..execution_context] 
62736 Constructor. 
62737
62738
62739   execution_context();
62740
62741
62742
62743 [endsect]
62744
62745
62746
62747 [section:fork_event execution_context::fork_event]
62748
62749 [indexterm2 boost_asio.indexterm.execution_context.fork_event..fork_event..execution_context] 
62750 Fork-related event notifications. 
62751
62752
62753   enum fork_event
62754
62755 [indexterm2 boost_asio.indexterm.execution_context.fork_event.fork_prepare..fork_prepare..execution_context]
62756 [indexterm2 boost_asio.indexterm.execution_context.fork_event.fork_parent..fork_parent..execution_context]
62757 [indexterm2 boost_asio.indexterm.execution_context.fork_event.fork_child..fork_child..execution_context]
62758
62759 [heading Values]
62760 [variablelist
62761
62762   [
62763     [fork_prepare]
62764     [Notify the context that the process is about to fork. ]
62765   ]
62766
62767   [
62768     [fork_parent]
62769     [Notify the context that the process has forked and is the parent. ]
62770   ]
62771
62772   [
62773     [fork_child]
62774     [Notify the context that the process has forked and is the child. ]
62775   ]
62776
62777 ]
62778
62779
62780
62781 [endsect]
62782
62783
62784
62785 [section:has_service execution_context::has_service]
62786
62787 [indexterm2 boost_asio.indexterm.execution_context.has_service..has_service..execution_context] 
62788 Determine if an [link boost_asio.reference.execution_context `execution_context`] contains a specified service type. 
62789
62790
62791   template<
62792       typename ``[link boost_asio.reference.Service Service]``>
62793   friend bool has_service(
62794       execution_context & e);
62795
62796
62797 This function is used to determine whether the [link boost_asio.reference.execution_context `execution_context`] contains a service object corresponding to the given service type.
62798
62799
62800 [heading Parameters]
62801     
62802
62803 [variablelist
62804   
62805 [[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]]
62806
62807 ]
62808
62809
62810 [heading Return Value]
62811       
62812 A boolean indicating whether the [link boost_asio.reference.execution_context `execution_context`] contains the service. 
62813
62814
62815
62816 [heading Requirements]
62817
62818 ['Header: ][^boost/asio/execution_context.hpp]
62819
62820 ['Convenience header: ][^boost/asio.hpp]
62821
62822
62823 [endsect]
62824
62825
62826
62827 [section:make_service execution_context::make_service]
62828
62829 [indexterm2 boost_asio.indexterm.execution_context.make_service..make_service..execution_context] 
62830 Creates a service object and adds it to the [link boost_asio.reference.execution_context `execution_context`]. 
62831
62832
62833   template<
62834       typename ``[link boost_asio.reference.Service Service]``,
62835       typename... Args>
62836   friend Service & make_service(
62837       execution_context & e,
62838       Args &&... args);
62839
62840
62841 This function is used to add a service to the [link boost_asio.reference.execution_context `execution_context`].
62842
62843
62844 [heading Parameters]
62845     
62846
62847 [variablelist
62848   
62849 [[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]]
62850
62851 [[args][Zero or more arguments to be passed to the service constructor.]]
62852
62853 ]
62854
62855
62856 [heading Exceptions]
62857     
62858
62859 [variablelist
62860   
62861 [[boost::asio::service_already_exists][Thrown if a service of the given type is already present in the [link boost_asio.reference.execution_context `execution_context`]. ]]
62862
62863 ]
62864
62865
62866
62867 [heading Requirements]
62868
62869 ['Header: ][^boost/asio/execution_context.hpp]
62870
62871 ['Convenience header: ][^boost/asio.hpp]
62872
62873
62874 [endsect]
62875
62876
62877
62878 [section:notify_fork execution_context::notify_fork]
62879
62880 [indexterm2 boost_asio.indexterm.execution_context.notify_fork..notify_fork..execution_context] 
62881 Notify the [link boost_asio.reference.execution_context `execution_context`] of a fork-related event. 
62882
62883
62884   void notify_fork(
62885       fork_event event);
62886
62887
62888 This function is used to inform the [link boost_asio.reference.execution_context `execution_context`] that the process is about to fork, or has just forked. This allows the [link boost_asio.reference.execution_context `execution_context`], and the services it contains, to perform any necessary housekeeping to ensure correct operation following a fork.
62889
62890 This function must not be called while any other [link boost_asio.reference.execution_context `execution_context`] function, or any function associated with the execution\_context's derived class, is being called in another thread. It is, however, safe to call this function from within a completion handler, provided no other thread is accessing the [link boost_asio.reference.execution_context `execution_context`] or its derived class.
62891
62892
62893 [heading Parameters]
62894     
62895
62896 [variablelist
62897   
62898 [[event][A fork-related event.]]
62899
62900 ]
62901
62902
62903 [heading Exceptions]
62904     
62905
62906 [variablelist
62907   
62908 [[boost::system::system_error][Thrown on failure. If the notification fails the [link boost_asio.reference.execution_context `execution_context`] object should no longer be used and should be destroyed.]]
62909
62910 ]
62911
62912
62913 [heading Example]
62914   
62915 The following code illustrates how to incorporate the `notify_fork()` function: 
62916
62917    my_execution_context.notify_fork(execution_context::fork_prepare);
62918    if (fork() == 0)
62919    {
62920      // This is the child process.
62921      my_execution_context.notify_fork(execution_context::fork_child);
62922    }
62923    else
62924    {
62925      // This is the parent process.
62926      my_execution_context.notify_fork(execution_context::fork_parent);
62927    } 
62928
62929
62930
62931
62932
62933 [heading Remarks]
62934       
62935 For each service object `svc` in the [link boost_asio.reference.execution_context `execution_context`] set, performs `svc->notify_fork();`. When processing the fork\_prepare event, services are visited in reverse order of the beginning of service object lifetime. Otherwise, services are visited in order of the beginning of service object lifetime. 
62936
62937
62938
62939
62940 [endsect]
62941
62942
62943
62944 [section:shutdown execution_context::shutdown]
62945
62946 [indexterm2 boost_asio.indexterm.execution_context.shutdown..shutdown..execution_context] 
62947 Shuts down all services in the context. 
62948
62949
62950   void shutdown();
62951
62952
62953 This function is implemented as follows:
62954
62955
62956 * For each service object `svc` in the [link boost_asio.reference.execution_context `execution_context`] set, in reverse order of the beginning of service object lifetime, performs `svc->shutdown()`. 
62957
62958
62959
62960
62961 [endsect]
62962
62963
62964 [section:use_service execution_context::use_service]
62965
62966 [indexterm2 boost_asio.indexterm.execution_context.use_service..use_service..execution_context] 
62967 Obtain the service object corresponding to the given type. 
62968
62969
62970   template<
62971       typename ``[link boost_asio.reference.Service Service]``>
62972   friend Service & ``[link boost_asio.reference.execution_context.use_service.overload1 use_service]``(
62973       execution_context & e);
62974   ``  [''''&raquo;''' [link boost_asio.reference.execution_context.use_service.overload1 more...]]``
62975
62976   template<
62977       typename ``[link boost_asio.reference.Service Service]``>
62978   friend Service & ``[link boost_asio.reference.execution_context.use_service.overload2 use_service]``(
62979       io_context & ioc);
62980   ``  [''''&raquo;''' [link boost_asio.reference.execution_context.use_service.overload2 more...]]``
62981
62982
62983 [section:overload1 execution_context::use_service (1 of 2 overloads)]
62984
62985
62986 Obtain the service object corresponding to the given type. 
62987
62988
62989   template<
62990       typename ``[link boost_asio.reference.Service Service]``>
62991   friend Service & use_service(
62992       execution_context & e);
62993
62994
62995 This function is used to locate a service object that corresponds to the given service type. If there is no existing implementation of the service, then the [link boost_asio.reference.execution_context `execution_context`] will create a new instance of the service.
62996
62997
62998 [heading Parameters]
62999     
63000
63001 [variablelist
63002   
63003 [[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]]
63004
63005 ]
63006
63007
63008 [heading Return Value]
63009       
63010 The service interface implementing the specified service type. Ownership of the service interface is not transferred to the caller. 
63011
63012
63013
63014 [heading Requirements]
63015
63016 ['Header: ][^boost/asio/execution_context.hpp]
63017
63018 ['Convenience header: ][^boost/asio.hpp]
63019
63020
63021 [endsect]
63022
63023
63024
63025 [section:overload2 execution_context::use_service (2 of 2 overloads)]
63026
63027
63028 Obtain the service object corresponding to the given type. 
63029
63030
63031   template<
63032       typename ``[link boost_asio.reference.Service Service]``>
63033   friend Service & use_service(
63034       io_context & ioc);
63035
63036
63037 This function is used to locate a service object that corresponds to the given service type. If there is no existing implementation of the service, then the [link boost_asio.reference.io_context `io_context`] will create a new instance of the service.
63038
63039
63040 [heading Parameters]
63041     
63042
63043 [variablelist
63044   
63045 [[ioc][The [link boost_asio.reference.io_context `io_context`] object that owns the service.]]
63046
63047 ]
63048
63049
63050 [heading Return Value]
63051       
63052 The service interface implementing the specified service type. Ownership of the service interface is not transferred to the caller.
63053
63054
63055 [heading Remarks]
63056       
63057 This overload is preserved for backwards compatibility with services that inherit from [link boost_asio.reference.io_context__service `io_context::service`]. 
63058
63059
63060
63061 [heading Requirements]
63062
63063 ['Header: ][^boost/asio/execution_context.hpp]
63064
63065 ['Convenience header: ][^boost/asio.hpp]
63066
63067
63068 [endsect]
63069
63070
63071 [endsect]
63072
63073
63074 [section:_execution_context execution_context::~execution_context]
63075
63076 [indexterm2 boost_asio.indexterm.execution_context._execution_context..~execution_context..execution_context] 
63077 Destructor. 
63078
63079
63080   ~execution_context();
63081
63082
63083
63084 [endsect]
63085
63086
63087
63088 [endsect]
63089
63090 [section:execution_context__id execution_context::id]
63091
63092
63093 Class used to uniquely identify a service. 
63094
63095
63096   class id :
63097     noncopyable
63098
63099
63100 [heading Member Functions]
63101 [table
63102   [[Name][Description]]
63103
63104   [
63105     [[link boost_asio.reference.execution_context__id.id [*id]]]
63106     [Constructor. ]
63107   ]
63108   
63109 ]
63110
63111 [heading Requirements]
63112
63113 ['Header: ][^boost/asio/execution_context.hpp]
63114
63115 ['Convenience header: ][^boost/asio.hpp]
63116
63117
63118 [section:id execution_context::id::id]
63119
63120 [indexterm2 boost_asio.indexterm.execution_context__id.id..id..execution_context::id] 
63121 Constructor. 
63122
63123
63124   id();
63125
63126
63127
63128 [endsect]
63129
63130
63131
63132 [endsect]
63133
63134 [section:execution_context__service execution_context::service]
63135
63136
63137 Base class for all [link boost_asio.reference.io_context `io_context`] services. 
63138
63139
63140   class service :
63141     noncopyable
63142
63143
63144 [heading Member Functions]
63145 [table
63146   [[Name][Description]]
63147
63148   [
63149     [[link boost_asio.reference.execution_context__service.context [*context]]]
63150     [Get the context object that owns the service. ]
63151   ]
63152   
63153 ]
63154
63155 [heading Protected Member Functions]
63156 [table
63157   [[Name][Description]]
63158
63159   [
63160     [[link boost_asio.reference.execution_context__service.service [*service]]]
63161     [Constructor. ]
63162   ]
63163   
63164   [
63165     [[link boost_asio.reference.execution_context__service._service [*~service]]]
63166     [Destructor. ]
63167   ]
63168   
63169 ]
63170
63171 [heading Private Member Functions]
63172 [table
63173   [[Name][Description]]
63174
63175   [
63176     [[link boost_asio.reference.execution_context__service.notify_fork [*notify_fork]]]
63177     [Handle notification of a fork-related event to perform any necessary housekeeping. ]
63178   ]
63179   
63180   [
63181     [[link boost_asio.reference.execution_context__service.shutdown [*shutdown]]]
63182     [Destroy all user-defined handler objects owned by the service. ]
63183   ]
63184   
63185 ]
63186
63187 [heading Requirements]
63188
63189 ['Header: ][^boost/asio/execution_context.hpp]
63190
63191 ['Convenience header: ][^boost/asio.hpp]
63192
63193
63194 [section:context execution_context::service::context]
63195
63196 [indexterm2 boost_asio.indexterm.execution_context__service.context..context..execution_context::service] 
63197 Get the context object that owns the service. 
63198
63199
63200   execution_context & context();
63201
63202
63203
63204 [endsect]
63205
63206
63207
63208 [section:service execution_context::service::service]
63209
63210 [indexterm2 boost_asio.indexterm.execution_context__service.service..service..execution_context::service] 
63211 Constructor. 
63212
63213
63214   service(
63215       execution_context & owner);
63216
63217
63218
63219 [heading Parameters]
63220     
63221
63222 [variablelist
63223   
63224 [[owner][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service. ]]
63225
63226 ]
63227
63228
63229
63230
63231 [endsect]
63232
63233
63234
63235 [section:_service execution_context::service::~service]
63236
63237 [indexterm2 boost_asio.indexterm.execution_context__service._service..~service..execution_context::service] 
63238 Destructor. 
63239
63240
63241   virtual ~service();
63242
63243
63244
63245 [endsect]
63246
63247
63248
63249 [section:notify_fork execution_context::service::notify_fork]
63250
63251 [indexterm2 boost_asio.indexterm.execution_context__service.notify_fork..notify_fork..execution_context::service] 
63252 Handle notification of a fork-related event to perform any necessary housekeeping. 
63253
63254
63255   virtual void notify_fork(
63256       execution_context::fork_event event);
63257
63258
63259 This function is not a pure virtual so that services only have to implement it if necessary. The default implementation does nothing. 
63260
63261
63262 [endsect]
63263
63264
63265
63266 [section:shutdown execution_context::service::shutdown]
63267
63268 [indexterm2 boost_asio.indexterm.execution_context__service.shutdown..shutdown..execution_context::service] 
63269 Destroy all user-defined handler objects owned by the service. 
63270
63271
63272   void shutdown();
63273
63274
63275
63276 [endsect]
63277
63278
63279
63280 [endsect]
63281
63282 [section:executor executor]
63283
63284
63285 Polymorphic wrapper for executors. 
63286
63287
63288   class executor
63289
63290
63291 [heading Types]
63292 [table
63293   [[Name][Description]]
63294
63295   [
63296
63297     [[link boost_asio.reference.executor__unspecified_bool_type_t [*unspecified_bool_type_t]]]
63298     []
63299   
63300   ]
63301
63302   [
63303
63304     [[link boost_asio.reference.executor.unspecified_bool_type [*unspecified_bool_type]]]
63305     []
63306   
63307   ]
63308
63309 ]
63310
63311 [heading Member Functions]
63312 [table
63313   [[Name][Description]]
63314
63315   [
63316     [[link boost_asio.reference.executor.context [*context]]]
63317     [Obtain the underlying execution context. ]
63318   ]
63319   
63320   [
63321     [[link boost_asio.reference.executor.defer [*defer]]]
63322     [Request the executor to invoke the given function object. ]
63323   ]
63324   
63325   [
63326     [[link boost_asio.reference.executor.dispatch [*dispatch]]]
63327     [Request the executor to invoke the given function object. ]
63328   ]
63329   
63330   [
63331     [[link boost_asio.reference.executor.executor [*executor]]]
63332     [Default constructor. 
63333      [hr]
63334      Construct from nullptr. 
63335      [hr]
63336      Copy constructor. 
63337      [hr]
63338      Move constructor. 
63339      [hr]
63340      Construct a polymorphic wrapper for the specified executor. 
63341      [hr]
63342      Allocator-aware constructor to create a polymorphic wrapper for the specified executor. ]
63343   ]
63344   
63345   [
63346     [[link boost_asio.reference.executor.on_work_finished [*on_work_finished]]]
63347     [Inform the executor that some work is no longer outstanding. ]
63348   ]
63349   
63350   [
63351     [[link boost_asio.reference.executor.on_work_started [*on_work_started]]]
63352     [Inform the executor that it has some outstanding work to do. ]
63353   ]
63354   
63355   [
63356     [[link boost_asio.reference.executor.operator_unspecified_bool_type [*operator unspecified_bool_type]]]
63357     [Operator to test if the executor contains a valid target. ]
63358   ]
63359   
63360   [
63361     [[link boost_asio.reference.executor.operator_eq_ [*operator=]]]
63362     [Assignment operator. 
63363      [hr]
63364      
63365      [hr]
63366      Assignment operator for nullptr_t. 
63367      [hr]
63368      Assignment operator to create a polymorphic wrapper for the specified executor. ]
63369   ]
63370   
63371   [
63372     [[link boost_asio.reference.executor.post [*post]]]
63373     [Request the executor to invoke the given function object. ]
63374   ]
63375   
63376   [
63377     [[link boost_asio.reference.executor.target [*target]]]
63378     [Obtain a pointer to the target executor object. ]
63379   ]
63380   
63381   [
63382     [[link boost_asio.reference.executor.target_type [*target_type]]]
63383     [Obtain type information for the target executor object. ]
63384   ]
63385   
63386   [
63387     [[link boost_asio.reference.executor.unspecified_bool_true [*unspecified_bool_true]]]
63388     []
63389   ]
63390   
63391   [
63392     [[link boost_asio.reference.executor._executor [*~executor]]]
63393     [Destructor. ]
63394   ]
63395   
63396 ]
63397
63398 [heading Friends]
63399 [table
63400   [[Name][Description]]
63401
63402   [
63403     [[link boost_asio.reference.executor.operator_not__eq_ [*operator!=]]]
63404     [Compare two executors for inequality. ]
63405   ]
63406   
63407   [
63408     [[link boost_asio.reference.executor.operator_eq__eq_ [*operator==]]]
63409     [Compare two executors for equality. ]
63410   ]
63411   
63412 ]
63413
63414 [heading Requirements]
63415
63416 ['Header: ][^boost/asio/executor.hpp]
63417
63418 ['Convenience header: ][^boost/asio.hpp]
63419
63420
63421 [section:context executor::context]
63422
63423 [indexterm2 boost_asio.indexterm.executor.context..context..executor] 
63424 Obtain the underlying execution context. 
63425
63426
63427   execution_context & context() const;
63428
63429
63430
63431 [endsect]
63432
63433
63434
63435 [section:defer executor::defer]
63436
63437 [indexterm2 boost_asio.indexterm.executor.defer..defer..executor] 
63438 Request the executor to invoke the given function object. 
63439
63440
63441   template<
63442       typename Function,
63443       typename Allocator>
63444   void defer(
63445       Function && f,
63446       const Allocator & a) const;
63447
63448
63449 This function is used to ask the executor to execute the given function object. The function object is executed according to the rules of the target executor object.
63450
63451
63452 [heading Parameters]
63453     
63454
63455 [variablelist
63456   
63457 [[f][The function object to be called. The executor will make a copy of the handler object as required. The function signature of the function object must be:
63458 ``
63459    void function(); 
63460 ``
63461 ]]
63462
63463 [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
63464
63465 ]
63466
63467
63468
63469
63470 [endsect]
63471
63472
63473
63474 [section:dispatch executor::dispatch]
63475
63476 [indexterm2 boost_asio.indexterm.executor.dispatch..dispatch..executor] 
63477 Request the executor to invoke the given function object. 
63478
63479
63480   template<
63481       typename Function,
63482       typename Allocator>
63483   void dispatch(
63484       Function && f,
63485       const Allocator & a) const;
63486
63487
63488 This function is used to ask the executor to execute the given function object. The function object is executed according to the rules of the target executor object.
63489
63490
63491 [heading Parameters]
63492     
63493
63494 [variablelist
63495   
63496 [[f][The function object to be called. The executor will make a copy of the handler object as required. The function signature of the function object must be:
63497 ``
63498    void function(); 
63499 ``
63500 ]]
63501
63502 [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
63503
63504 ]
63505
63506
63507
63508
63509 [endsect]
63510
63511
63512 [section:executor executor::executor]
63513
63514 [indexterm2 boost_asio.indexterm.executor.executor..executor..executor] 
63515 Default constructor. 
63516
63517
63518   ``[link boost_asio.reference.executor.executor.overload1 executor]``();
63519   ``  [''''&raquo;''' [link boost_asio.reference.executor.executor.overload1 more...]]``
63520
63521
63522 Construct from nullptr. 
63523
63524
63525   ``[link boost_asio.reference.executor.executor.overload2 executor]``(
63526       nullptr_t );
63527   ``  [''''&raquo;''' [link boost_asio.reference.executor.executor.overload2 more...]]``
63528
63529
63530 Copy constructor. 
63531
63532
63533   ``[link boost_asio.reference.executor.executor.overload3 executor]``(
63534       const executor & other);
63535   ``  [''''&raquo;''' [link boost_asio.reference.executor.executor.overload3 more...]]``
63536
63537
63538 Move constructor. 
63539
63540
63541   ``[link boost_asio.reference.executor.executor.overload4 executor]``(
63542       executor && other);
63543   ``  [''''&raquo;''' [link boost_asio.reference.executor.executor.overload4 more...]]``
63544
63545
63546 Construct a polymorphic wrapper for the specified executor. 
63547
63548
63549   template<
63550       typename ``[link boost_asio.reference.Executor1 Executor]``>
63551   ``[link boost_asio.reference.executor.executor.overload5 executor]``(
63552       Executor e);
63553   ``  [''''&raquo;''' [link boost_asio.reference.executor.executor.overload5 more...]]``
63554
63555
63556 Allocator-aware constructor to create a polymorphic wrapper for the specified executor. 
63557
63558
63559   template<
63560       typename ``[link boost_asio.reference.Executor1 Executor]``,
63561       typename Allocator>
63562   ``[link boost_asio.reference.executor.executor.overload6 executor]``(
63563       allocator_arg_t ,
63564       const Allocator & a,
63565       Executor e);
63566   ``  [''''&raquo;''' [link boost_asio.reference.executor.executor.overload6 more...]]``
63567
63568
63569 [section:overload1 executor::executor (1 of 6 overloads)]
63570
63571
63572 Default constructor. 
63573
63574
63575   executor();
63576
63577
63578
63579 [endsect]
63580
63581
63582
63583 [section:overload2 executor::executor (2 of 6 overloads)]
63584
63585
63586 Construct from nullptr. 
63587
63588
63589   executor(
63590       nullptr_t );
63591
63592
63593
63594 [endsect]
63595
63596
63597
63598 [section:overload3 executor::executor (3 of 6 overloads)]
63599
63600
63601 Copy constructor. 
63602
63603
63604   executor(
63605       const executor & other);
63606
63607
63608
63609 [endsect]
63610
63611
63612
63613 [section:overload4 executor::executor (4 of 6 overloads)]
63614
63615
63616 Move constructor. 
63617
63618
63619   executor(
63620       executor && other);
63621
63622
63623
63624 [endsect]
63625
63626
63627
63628 [section:overload5 executor::executor (5 of 6 overloads)]
63629
63630
63631 Construct a polymorphic wrapper for the specified executor. 
63632
63633
63634   template<
63635       typename ``[link boost_asio.reference.Executor1 Executor]``>
63636   executor(
63637       Executor e);
63638
63639
63640
63641 [endsect]
63642
63643
63644
63645 [section:overload6 executor::executor (6 of 6 overloads)]
63646
63647
63648 Allocator-aware constructor to create a polymorphic wrapper for the specified executor. 
63649
63650
63651   template<
63652       typename ``[link boost_asio.reference.Executor1 Executor]``,
63653       typename Allocator>
63654   executor(
63655       allocator_arg_t ,
63656       const Allocator & a,
63657       Executor e);
63658
63659
63660
63661 [endsect]
63662
63663
63664 [endsect]
63665
63666
63667 [section:on_work_finished executor::on_work_finished]
63668
63669 [indexterm2 boost_asio.indexterm.executor.on_work_finished..on_work_finished..executor] 
63670 Inform the executor that some work is no longer outstanding. 
63671
63672
63673   void on_work_finished() const;
63674
63675
63676
63677 [endsect]
63678
63679
63680
63681 [section:on_work_started executor::on_work_started]
63682
63683 [indexterm2 boost_asio.indexterm.executor.on_work_started..on_work_started..executor] 
63684 Inform the executor that it has some outstanding work to do. 
63685
63686
63687   void on_work_started() const;
63688
63689
63690
63691 [endsect]
63692
63693
63694
63695 [section:operator_unspecified_bool_type executor::operator unspecified_bool_type]
63696
63697 [indexterm2 boost_asio.indexterm.executor.operator_unspecified_bool_type..operator unspecified_bool_type..executor] 
63698 Operator to test if the executor contains a valid target. 
63699
63700
63701   operator unspecified_bool_type() const;
63702
63703
63704
63705 [endsect]
63706
63707
63708
63709 [section:operator_not__eq_ executor::operator!=]
63710
63711 [indexterm2 boost_asio.indexterm.executor.operator_not__eq_..operator!=..executor] 
63712 Compare two executors for inequality. 
63713
63714
63715   friend bool operator!=(
63716       const executor & a,
63717       const executor & b);
63718
63719
63720 [heading Requirements]
63721
63722 ['Header: ][^boost/asio/executor.hpp]
63723
63724 ['Convenience header: ][^boost/asio.hpp]
63725
63726
63727 [endsect]
63728
63729
63730 [section:operator_eq_ executor::operator=]
63731
63732 [indexterm2 boost_asio.indexterm.executor.operator_eq_..operator=..executor] 
63733 Assignment operator. 
63734
63735
63736   executor & ``[link boost_asio.reference.executor.operator_eq_.overload1 operator=]``(
63737       const executor & other);
63738   ``  [''''&raquo;''' [link boost_asio.reference.executor.operator_eq_.overload1 more...]]``
63739
63740
63741
63742   executor & ``[link boost_asio.reference.executor.operator_eq_.overload2 operator=]``(
63743       executor && other);
63744   ``  [''''&raquo;''' [link boost_asio.reference.executor.operator_eq_.overload2 more...]]``
63745
63746
63747 Assignment operator for nullptr\_t. 
63748
63749
63750   executor & ``[link boost_asio.reference.executor.operator_eq_.overload3 operator=]``(
63751       nullptr_t );
63752   ``  [''''&raquo;''' [link boost_asio.reference.executor.operator_eq_.overload3 more...]]``
63753
63754
63755 Assignment operator to create a polymorphic wrapper for the specified executor. 
63756
63757
63758   template<
63759       typename ``[link boost_asio.reference.Executor1 Executor]``>
63760   executor & ``[link boost_asio.reference.executor.operator_eq_.overload4 operator=]``(
63761       Executor && e);
63762   ``  [''''&raquo;''' [link boost_asio.reference.executor.operator_eq_.overload4 more...]]``
63763
63764
63765 [section:overload1 executor::operator= (1 of 4 overloads)]
63766
63767
63768 Assignment operator. 
63769
63770
63771   executor & operator=(
63772       const executor & other);
63773
63774
63775
63776 [endsect]
63777
63778
63779
63780 [section:overload2 executor::operator= (2 of 4 overloads)]
63781
63782
63783
63784   executor & operator=(
63785       executor && other);
63786
63787
63788
63789 [endsect]
63790
63791
63792
63793 [section:overload3 executor::operator= (3 of 4 overloads)]
63794
63795
63796 Assignment operator for nullptr\_t. 
63797
63798
63799   executor & operator=(
63800       nullptr_t );
63801
63802
63803
63804 [endsect]
63805
63806
63807
63808 [section:overload4 executor::operator= (4 of 4 overloads)]
63809
63810
63811 Assignment operator to create a polymorphic wrapper for the specified executor. 
63812
63813
63814   template<
63815       typename ``[link boost_asio.reference.Executor1 Executor]``>
63816   executor & operator=(
63817       Executor && e);
63818
63819
63820
63821 [endsect]
63822
63823
63824 [endsect]
63825
63826
63827 [section:operator_eq__eq_ executor::operator==]
63828
63829 [indexterm2 boost_asio.indexterm.executor.operator_eq__eq_..operator==..executor] 
63830 Compare two executors for equality. 
63831
63832
63833   friend bool operator==(
63834       const executor & a,
63835       const executor & b);
63836
63837
63838 [heading Requirements]
63839
63840 ['Header: ][^boost/asio/executor.hpp]
63841
63842 ['Convenience header: ][^boost/asio.hpp]
63843
63844
63845 [endsect]
63846
63847
63848
63849 [section:post executor::post]
63850
63851 [indexterm2 boost_asio.indexterm.executor.post..post..executor] 
63852 Request the executor to invoke the given function object. 
63853
63854
63855   template<
63856       typename Function,
63857       typename Allocator>
63858   void post(
63859       Function && f,
63860       const Allocator & a) const;
63861
63862
63863 This function is used to ask the executor to execute the given function object. The function object is executed according to the rules of the target executor object.
63864
63865
63866 [heading Parameters]
63867     
63868
63869 [variablelist
63870   
63871 [[f][The function object to be called. The executor will make a copy of the handler object as required. The function signature of the function object must be:
63872 ``
63873    void function(); 
63874 ``
63875 ]]
63876
63877 [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
63878
63879 ]
63880
63881
63882
63883
63884 [endsect]
63885
63886
63887 [section:target executor::target]
63888
63889 [indexterm2 boost_asio.indexterm.executor.target..target..executor] 
63890 Obtain a pointer to the target executor object. 
63891
63892
63893   template<
63894       typename ``[link boost_asio.reference.Executor1 Executor]``>
63895   Executor * ``[link boost_asio.reference.executor.target.overload1 target]``();
63896   ``  [''''&raquo;''' [link boost_asio.reference.executor.target.overload1 more...]]``
63897
63898   template<
63899       typename ``[link boost_asio.reference.Executor1 Executor]``>
63900   const Executor * ``[link boost_asio.reference.executor.target.overload2 target]``() const;
63901   ``  [''''&raquo;''' [link boost_asio.reference.executor.target.overload2 more...]]``
63902
63903
63904 [section:overload1 executor::target (1 of 2 overloads)]
63905
63906
63907 Obtain a pointer to the target executor object. 
63908
63909
63910   template<
63911       typename ``[link boost_asio.reference.Executor1 Executor]``>
63912   Executor * target();
63913
63914
63915
63916 [heading Return Value]
63917       
63918 If `target_type() == typeid(T)`, a pointer to the stored executor target; otherwise, a null pointer. 
63919
63920
63921
63922
63923 [endsect]
63924
63925
63926
63927 [section:overload2 executor::target (2 of 2 overloads)]
63928
63929
63930 Obtain a pointer to the target executor object. 
63931
63932
63933   template<
63934       typename ``[link boost_asio.reference.Executor1 Executor]``>
63935   const Executor * target() const;
63936
63937
63938
63939 [heading Return Value]
63940       
63941 If `target_type() == typeid(T)`, a pointer to the stored executor target; otherwise, a null pointer. 
63942
63943
63944
63945
63946 [endsect]
63947
63948
63949 [endsect]
63950
63951
63952 [section:target_type executor::target_type]
63953
63954 [indexterm2 boost_asio.indexterm.executor.target_type..target_type..executor] 
63955 Obtain type information for the target executor object. 
63956
63957
63958   const std::type_info & target_type() const;
63959
63960
63961
63962 [heading Return Value]
63963       
63964 If `*this` has a target type of type `T`, `typeid(T)`; otherwise, `typeid(void)`. 
63965
63966
63967
63968
63969 [endsect]
63970
63971
63972
63973 [section:unspecified_bool_true executor::unspecified_bool_true]
63974
63975 [indexterm2 boost_asio.indexterm.executor.unspecified_bool_true..unspecified_bool_true..executor] 
63976
63977   static void unspecified_bool_true(
63978       unspecified_bool_type_t );
63979
63980
63981
63982 [endsect]
63983
63984
63985
63986 [section:unspecified_bool_type executor::unspecified_bool_type]
63987
63988 [indexterm2 boost_asio.indexterm.executor.unspecified_bool_type..unspecified_bool_type..executor] 
63989
63990   typedef void(*) unspecified_bool_type;
63991
63992
63993
63994 [heading Requirements]
63995
63996 ['Header: ][^boost/asio/executor.hpp]
63997
63998 ['Convenience header: ][^boost/asio.hpp]
63999
64000
64001 [endsect]
64002
64003
64004
64005 [section:_executor executor::~executor]
64006
64007 [indexterm2 boost_asio.indexterm.executor._executor..~executor..executor] 
64008 Destructor. 
64009
64010
64011   ~executor();
64012
64013
64014
64015 [endsect]
64016
64017
64018
64019 [endsect]
64020
64021 [section:executor__unspecified_bool_type_t executor::unspecified_bool_type_t]
64022
64023
64024
64025   struct unspecified_bool_type_t
64026
64027
64028 [heading Requirements]
64029
64030 ['Header: ][^boost/asio/executor.hpp]
64031
64032 ['Convenience header: ][^boost/asio.hpp]
64033
64034
64035 [endsect]
64036
64037
64038 [section:executor_arg executor_arg]
64039
64040 [indexterm1 boost_asio.indexterm.executor_arg..executor_arg] 
64041 A special value, similar to std::nothrow, used to disambiguate constructors that accept executor arguments. 
64042
64043
64044   constexpr executor_arg_t executor_arg;
64045
64046
64047 See [link boost_asio.reference.executor_arg_t `executor_arg_t`] and [link boost_asio.reference.uses_executor `uses_executor`] for more information. 
64048
64049 [heading Requirements]
64050
64051 ['Header: ][^boost/asio/uses_executor.hpp]
64052
64053 ['Convenience header: ][^boost/asio.hpp]
64054
64055
64056 [endsect]
64057
64058
64059 [section:executor_arg_t executor_arg_t]
64060
64061
64062 A special type, similar to std::nothrow\_t, used to disambiguate constructors that accept executor arguments. 
64063
64064
64065   struct executor_arg_t
64066
64067
64068 [heading Member Functions]
64069 [table
64070   [[Name][Description]]
64071
64072   [
64073     [[link boost_asio.reference.executor_arg_t.executor_arg_t [*executor_arg_t]]]
64074     [Constructor. ]
64075   ]
64076   
64077 ]
64078
64079 The [link boost_asio.reference.executor_arg_t `executor_arg_t`] struct is an empty structure type used as a unique type to disambiguate constructor and function overloading. Specifically, some types have constructors with [link boost_asio.reference.executor_arg_t `executor_arg_t`] as the first argument, immediately followed by an argument of a type that satisfies the Executor type requirements. 
64080
64081 [heading Requirements]
64082
64083 ['Header: ][^boost/asio/uses_executor.hpp]
64084
64085 ['Convenience header: ][^boost/asio.hpp]
64086
64087
64088 [section:executor_arg_t executor_arg_t::executor_arg_t]
64089
64090 [indexterm2 boost_asio.indexterm.executor_arg_t.executor_arg_t..executor_arg_t..executor_arg_t] 
64091 Constructor. 
64092
64093
64094   constexpr executor_arg_t();
64095
64096
64097
64098 [endsect]
64099
64100
64101
64102 [endsect]
64103
64104 [section:executor_binder executor_binder]
64105
64106
64107 A call wrapper type to bind an executor of type `Executor` to an object of type `T`. 
64108
64109
64110   template<
64111       typename T,
64112       typename ``[link boost_asio.reference.Executor1 Executor]``>
64113   class executor_binder
64114
64115
64116 [heading Types]
64117 [table
64118   [[Name][Description]]
64119
64120   [
64121
64122     [[link boost_asio.reference.executor_binder.argument_type [*argument_type]]]
64123     [The type of the function's argument. ]
64124   
64125   ]
64126
64127   [
64128
64129     [[link boost_asio.reference.executor_binder.executor_type [*executor_type]]]
64130     [The type of the associated executor. ]
64131   
64132   ]
64133
64134   [
64135
64136     [[link boost_asio.reference.executor_binder.first_argument_type [*first_argument_type]]]
64137     [The type of the function's first argument. ]
64138   
64139   ]
64140
64141   [
64142
64143     [[link boost_asio.reference.executor_binder.result_type [*result_type]]]
64144     [The return type if a function. ]
64145   
64146   ]
64147
64148   [
64149
64150     [[link boost_asio.reference.executor_binder.second_argument_type [*second_argument_type]]]
64151     [The type of the function's second argument. ]
64152   
64153   ]
64154
64155   [
64156
64157     [[link boost_asio.reference.executor_binder.target_type [*target_type]]]
64158     [The type of the target object. ]
64159   
64160   ]
64161
64162 ]
64163
64164 [heading Member Functions]
64165 [table
64166   [[Name][Description]]
64167
64168   [
64169     [[link boost_asio.reference.executor_binder.executor_binder [*executor_binder]]]
64170     [Construct an executor wrapper for the specified object. 
64171      [hr]
64172      Copy constructor. 
64173      [hr]
64174      Construct a copy, but specify a different executor. 
64175      [hr]
64176      Construct a copy of a different executor wrapper type. 
64177      [hr]
64178      Construct a copy of a different executor wrapper type, but specify a different executor. 
64179      [hr]
64180      Move constructor. 
64181      [hr]
64182      Move construct the target object, but specify a different executor. 
64183      [hr]
64184      Move construct from a different executor wrapper type. 
64185      [hr]
64186      Move construct from a different executor wrapper type, but specify a different executor. ]
64187   ]
64188   
64189   [
64190     [[link boost_asio.reference.executor_binder.get [*get]]]
64191     [Obtain a reference to the target object. ]
64192   ]
64193   
64194   [
64195     [[link boost_asio.reference.executor_binder.get_executor [*get_executor]]]
64196     [Obtain the associated executor. ]
64197   ]
64198   
64199   [
64200     [[link boost_asio.reference.executor_binder.operator_lp__rp_ [*operator()]]]
64201     []
64202   ]
64203   
64204   [
64205     [[link boost_asio.reference.executor_binder._executor_binder [*~executor_binder]]]
64206     [Destructor. ]
64207   ]
64208   
64209 ]
64210
64211 [heading Requirements]
64212
64213 ['Header: ][^boost/asio/bind_executor.hpp]
64214
64215 ['Convenience header: ][^boost/asio.hpp]
64216
64217
64218 [section:argument_type executor_binder::argument_type]
64219
64220 [indexterm2 boost_asio.indexterm.executor_binder.argument_type..argument_type..executor_binder] 
64221 The type of the function's argument. 
64222
64223
64224   typedef see_below argument_type;
64225
64226
64227
64228 The type of `argument_type` is based on the type `T` of the wrapper's target object:
64229
64230
64231 * if `T` is a pointer to a function type accepting a single argument, `argument_type` is a synonym for the return type of `T`;
64232
64233
64234 * if `T` is a class type with a member type `argument_type`, then `argument_type` is a synonym for `T::argument_type`;
64235
64236
64237 * otherwise `argument_type` is not defined. 
64238
64239
64240
64241 [heading Requirements]
64242
64243 ['Header: ][^boost/asio/bind_executor.hpp]
64244
64245 ['Convenience header: ][^boost/asio.hpp]
64246
64247
64248 [endsect]
64249
64250
64251 [section:executor_binder executor_binder::executor_binder]
64252
64253 [indexterm2 boost_asio.indexterm.executor_binder.executor_binder..executor_binder..executor_binder] 
64254 Construct an executor wrapper for the specified object. 
64255
64256
64257   template<
64258       typename U>
64259   ``[link boost_asio.reference.executor_binder.executor_binder.overload1 executor_binder]``(
64260       executor_arg_t ,
64261       const executor_type & e,
64262       U && u);
64263   ``  [''''&raquo;''' [link boost_asio.reference.executor_binder.executor_binder.overload1 more...]]``
64264
64265
64266 Copy constructor. 
64267
64268
64269   ``[link boost_asio.reference.executor_binder.executor_binder.overload2 executor_binder]``(
64270       const executor_binder & other);
64271   ``  [''''&raquo;''' [link boost_asio.reference.executor_binder.executor_binder.overload2 more...]]``
64272
64273
64274 Construct a copy, but specify a different executor. 
64275
64276
64277   ``[link boost_asio.reference.executor_binder.executor_binder.overload3 executor_binder]``(
64278       executor_arg_t ,
64279       const executor_type & e,
64280       const executor_binder & other);
64281   ``  [''''&raquo;''' [link boost_asio.reference.executor_binder.executor_binder.overload3 more...]]``
64282
64283
64284 Construct a copy of a different executor wrapper type. 
64285
64286
64287   template<
64288       typename U,
64289       typename ``[link boost_asio.reference.Executor1 OtherExecutor]``>
64290   ``[link boost_asio.reference.executor_binder.executor_binder.overload4 executor_binder]``(
64291       const executor_binder< U, OtherExecutor > & other);
64292   ``  [''''&raquo;''' [link boost_asio.reference.executor_binder.executor_binder.overload4 more...]]``
64293
64294
64295 Construct a copy of a different executor wrapper type, but specify a different executor. 
64296
64297
64298   template<
64299       typename U,
64300       typename ``[link boost_asio.reference.Executor1 OtherExecutor]``>
64301   ``[link boost_asio.reference.executor_binder.executor_binder.overload5 executor_binder]``(
64302       executor_arg_t ,
64303       const executor_type & e,
64304       const executor_binder< U, OtherExecutor > & other);
64305   ``  [''''&raquo;''' [link boost_asio.reference.executor_binder.executor_binder.overload5 more...]]``
64306
64307
64308 Move constructor. 
64309
64310
64311   ``[link boost_asio.reference.executor_binder.executor_binder.overload6 executor_binder]``(
64312       executor_binder && other);
64313   ``  [''''&raquo;''' [link boost_asio.reference.executor_binder.executor_binder.overload6 more...]]``
64314
64315
64316 Move construct the target object, but specify a different executor. 
64317
64318
64319   ``[link boost_asio.reference.executor_binder.executor_binder.overload7 executor_binder]``(
64320       executor_arg_t ,
64321       const executor_type & e,
64322       executor_binder && other);
64323   ``  [''''&raquo;''' [link boost_asio.reference.executor_binder.executor_binder.overload7 more...]]``
64324
64325
64326 Move construct from a different executor wrapper type. 
64327
64328
64329   template<
64330       typename U,
64331       typename ``[link boost_asio.reference.Executor1 OtherExecutor]``>
64332   ``[link boost_asio.reference.executor_binder.executor_binder.overload8 executor_binder]``(
64333       executor_binder< U, OtherExecutor > && other);
64334   ``  [''''&raquo;''' [link boost_asio.reference.executor_binder.executor_binder.overload8 more...]]``
64335
64336
64337 Move construct from a different executor wrapper type, but specify a different executor. 
64338
64339
64340   template<
64341       typename U,
64342       typename ``[link boost_asio.reference.Executor1 OtherExecutor]``>
64343   ``[link boost_asio.reference.executor_binder.executor_binder.overload9 executor_binder]``(
64344       executor_arg_t ,
64345       const executor_type & e,
64346       executor_binder< U, OtherExecutor > && other);
64347   ``  [''''&raquo;''' [link boost_asio.reference.executor_binder.executor_binder.overload9 more...]]``
64348
64349
64350 [section:overload1 executor_binder::executor_binder (1 of 9 overloads)]
64351
64352
64353 Construct an executor wrapper for the specified object. 
64354
64355
64356   template<
64357       typename U>
64358   executor_binder(
64359       executor_arg_t ,
64360       const executor_type & e,
64361       U && u);
64362
64363
64364 This constructor is only valid if the type `T` is constructible from type `U`. 
64365
64366
64367 [endsect]
64368
64369
64370
64371 [section:overload2 executor_binder::executor_binder (2 of 9 overloads)]
64372
64373
64374 Copy constructor. 
64375
64376
64377   executor_binder(
64378       const executor_binder & other);
64379
64380
64381
64382 [endsect]
64383
64384
64385
64386 [section:overload3 executor_binder::executor_binder (3 of 9 overloads)]
64387
64388
64389 Construct a copy, but specify a different executor. 
64390
64391
64392   executor_binder(
64393       executor_arg_t ,
64394       const executor_type & e,
64395       const executor_binder & other);
64396
64397
64398
64399 [endsect]
64400
64401
64402
64403 [section:overload4 executor_binder::executor_binder (4 of 9 overloads)]
64404
64405
64406 Construct a copy of a different executor wrapper type. 
64407
64408
64409   template<
64410       typename U,
64411       typename ``[link boost_asio.reference.Executor1 OtherExecutor]``>
64412   executor_binder(
64413       const executor_binder< U, OtherExecutor > & other);
64414
64415
64416 This constructor is only valid if the `Executor` type is constructible from type `OtherExecutor`, and the type `T` is constructible from type `U`. 
64417
64418
64419 [endsect]
64420
64421
64422
64423 [section:overload5 executor_binder::executor_binder (5 of 9 overloads)]
64424
64425
64426 Construct a copy of a different executor wrapper type, but specify a different executor. 
64427
64428
64429   template<
64430       typename U,
64431       typename ``[link boost_asio.reference.Executor1 OtherExecutor]``>
64432   executor_binder(
64433       executor_arg_t ,
64434       const executor_type & e,
64435       const executor_binder< U, OtherExecutor > & other);
64436
64437
64438 This constructor is only valid if the type `T` is constructible from type `U`. 
64439
64440
64441 [endsect]
64442
64443
64444
64445 [section:overload6 executor_binder::executor_binder (6 of 9 overloads)]
64446
64447
64448 Move constructor. 
64449
64450
64451   executor_binder(
64452       executor_binder && other);
64453
64454
64455
64456 [endsect]
64457
64458
64459
64460 [section:overload7 executor_binder::executor_binder (7 of 9 overloads)]
64461
64462
64463 Move construct the target object, but specify a different executor. 
64464
64465
64466   executor_binder(
64467       executor_arg_t ,
64468       const executor_type & e,
64469       executor_binder && other);
64470
64471
64472
64473 [endsect]
64474
64475
64476
64477 [section:overload8 executor_binder::executor_binder (8 of 9 overloads)]
64478
64479
64480 Move construct from a different executor wrapper type. 
64481
64482
64483   template<
64484       typename U,
64485       typename ``[link boost_asio.reference.Executor1 OtherExecutor]``>
64486   executor_binder(
64487       executor_binder< U, OtherExecutor > && other);
64488
64489
64490
64491 [endsect]
64492
64493
64494
64495 [section:overload9 executor_binder::executor_binder (9 of 9 overloads)]
64496
64497
64498 Move construct from a different executor wrapper type, but specify a different executor. 
64499
64500
64501   template<
64502       typename U,
64503       typename ``[link boost_asio.reference.Executor1 OtherExecutor]``>
64504   executor_binder(
64505       executor_arg_t ,
64506       const executor_type & e,
64507       executor_binder< U, OtherExecutor > && other);
64508
64509
64510
64511 [endsect]
64512
64513
64514 [endsect]
64515
64516
64517 [section:executor_type executor_binder::executor_type]
64518
64519 [indexterm2 boost_asio.indexterm.executor_binder.executor_type..executor_type..executor_binder] 
64520 The type of the associated executor. 
64521
64522
64523   typedef Executor executor_type;
64524
64525
64526
64527 [heading Requirements]
64528
64529 ['Header: ][^boost/asio/bind_executor.hpp]
64530
64531 ['Convenience header: ][^boost/asio.hpp]
64532
64533
64534 [endsect]
64535
64536
64537
64538 [section:first_argument_type executor_binder::first_argument_type]
64539
64540 [indexterm2 boost_asio.indexterm.executor_binder.first_argument_type..first_argument_type..executor_binder] 
64541 The type of the function's first argument. 
64542
64543
64544   typedef see_below first_argument_type;
64545
64546
64547
64548 The type of `first_argument_type` is based on the type `T` of the wrapper's target object:
64549
64550
64551 * if `T` is a pointer to a function type accepting two arguments, `first_argument_type` is a synonym for the return type of `T`;
64552
64553
64554 * if `T` is a class type with a member type `first_argument_type`, then `first_argument_type` is a synonym for `T::first_argument_type`;
64555
64556
64557 * otherwise `first_argument_type` is not defined. 
64558
64559
64560
64561 [heading Requirements]
64562
64563 ['Header: ][^boost/asio/bind_executor.hpp]
64564
64565 ['Convenience header: ][^boost/asio.hpp]
64566
64567
64568 [endsect]
64569
64570
64571 [section:get executor_binder::get]
64572
64573 [indexterm2 boost_asio.indexterm.executor_binder.get..get..executor_binder] 
64574 Obtain a reference to the target object. 
64575
64576
64577   target_type & ``[link boost_asio.reference.executor_binder.get.overload1 get]``();
64578   ``  [''''&raquo;''' [link boost_asio.reference.executor_binder.get.overload1 more...]]``
64579
64580   const target_type & ``[link boost_asio.reference.executor_binder.get.overload2 get]``() const;
64581   ``  [''''&raquo;''' [link boost_asio.reference.executor_binder.get.overload2 more...]]``
64582
64583
64584 [section:overload1 executor_binder::get (1 of 2 overloads)]
64585
64586
64587 Obtain a reference to the target object. 
64588
64589
64590   target_type & get();
64591
64592
64593
64594 [endsect]
64595
64596
64597
64598 [section:overload2 executor_binder::get (2 of 2 overloads)]
64599
64600
64601 Obtain a reference to the target object. 
64602
64603
64604   const target_type & get() const;
64605
64606
64607
64608 [endsect]
64609
64610
64611 [endsect]
64612
64613
64614 [section:get_executor executor_binder::get_executor]
64615
64616 [indexterm2 boost_asio.indexterm.executor_binder.get_executor..get_executor..executor_binder] 
64617 Obtain the associated executor. 
64618
64619
64620   executor_type get_executor() const;
64621
64622
64623
64624 [endsect]
64625
64626
64627 [section:operator_lp__rp_ executor_binder::operator()]
64628
64629 [indexterm2 boost_asio.indexterm.executor_binder.operator_lp__rp_..operator()..executor_binder] 
64630
64631   template<
64632       typename... Args>
64633   auto ``[link boost_asio.reference.executor_binder.operator_lp__rp_.overload1 operator()]``(
64634       Args && ...);
64635   ``  [''''&raquo;''' [link boost_asio.reference.executor_binder.operator_lp__rp_.overload1 more...]]``
64636
64637   template<
64638       typename... Args>
64639   auto ``[link boost_asio.reference.executor_binder.operator_lp__rp_.overload2 operator()]``(
64640       Args && ...) const;
64641   ``  [''''&raquo;''' [link boost_asio.reference.executor_binder.operator_lp__rp_.overload2 more...]]``
64642
64643
64644 [section:overload1 executor_binder::operator() (1 of 2 overloads)]
64645
64646
64647
64648   template<
64649       typename... Args>
64650   auto operator()(
64651       Args && ...);
64652
64653
64654
64655 [endsect]
64656
64657
64658
64659 [section:overload2 executor_binder::operator() (2 of 2 overloads)]
64660
64661
64662
64663   template<
64664       typename... Args>
64665   auto operator()(
64666       Args && ...) const;
64667
64668
64669
64670 [endsect]
64671
64672
64673 [endsect]
64674
64675
64676 [section:result_type executor_binder::result_type]
64677
64678 [indexterm2 boost_asio.indexterm.executor_binder.result_type..result_type..executor_binder] 
64679 The return type if a function. 
64680
64681
64682   typedef see_below result_type;
64683
64684
64685
64686 The type of `result_type` is based on the type `T` of the wrapper's target object:
64687
64688
64689 * if `T` is a pointer to function type, `result_type` is a synonym for the return type of `T`;
64690
64691
64692 * if `T` is a class type with a member type `result_type`, then `result_type` is a synonym for `T::result_type`;
64693
64694
64695 * otherwise `result_type` is not defined. 
64696
64697
64698
64699 [heading Requirements]
64700
64701 ['Header: ][^boost/asio/bind_executor.hpp]
64702
64703 ['Convenience header: ][^boost/asio.hpp]
64704
64705
64706 [endsect]
64707
64708
64709
64710 [section:second_argument_type executor_binder::second_argument_type]
64711
64712 [indexterm2 boost_asio.indexterm.executor_binder.second_argument_type..second_argument_type..executor_binder] 
64713 The type of the function's second argument. 
64714
64715
64716   typedef see_below second_argument_type;
64717
64718
64719
64720 The type of `second_argument_type` is based on the type `T` of the wrapper's target object:
64721
64722
64723 * if `T` is a pointer to a function type accepting two arguments, `second_argument_type` is a synonym for the return type of `T`;
64724
64725
64726 * if `T` is a class type with a member type `first_argument_type`, then `second_argument_type` is a synonym for `T::second_argument_type`;
64727
64728
64729 * otherwise `second_argument_type` is not defined. 
64730
64731
64732
64733 [heading Requirements]
64734
64735 ['Header: ][^boost/asio/bind_executor.hpp]
64736
64737 ['Convenience header: ][^boost/asio.hpp]
64738
64739
64740 [endsect]
64741
64742
64743
64744 [section:target_type executor_binder::target_type]
64745
64746 [indexterm2 boost_asio.indexterm.executor_binder.target_type..target_type..executor_binder] 
64747 The type of the target object. 
64748
64749
64750   typedef T target_type;
64751
64752
64753
64754 [heading Requirements]
64755
64756 ['Header: ][^boost/asio/bind_executor.hpp]
64757
64758 ['Convenience header: ][^boost/asio.hpp]
64759
64760
64761 [endsect]
64762
64763
64764
64765 [section:_executor_binder executor_binder::~executor_binder]
64766
64767 [indexterm2 boost_asio.indexterm.executor_binder._executor_binder..~executor_binder..executor_binder] 
64768 Destructor. 
64769
64770
64771   ~executor_binder();
64772
64773
64774
64775 [endsect]
64776
64777
64778
64779 [endsect]
64780
64781 [section:executor_work_guard executor_work_guard]
64782
64783
64784 An object of type `executor_work_guard` controls ownership of executor work within a scope. 
64785
64786
64787   template<
64788       typename ``[link boost_asio.reference.Executor1 Executor]``>
64789   class executor_work_guard
64790
64791
64792 [heading Types]
64793 [table
64794   [[Name][Description]]
64795
64796   [
64797
64798     [[link boost_asio.reference.executor_work_guard.executor_type [*executor_type]]]
64799     [The underlying executor type. ]
64800   
64801   ]
64802
64803 ]
64804
64805 [heading Member Functions]
64806 [table
64807   [[Name][Description]]
64808
64809   [
64810     [[link boost_asio.reference.executor_work_guard.executor_work_guard [*executor_work_guard]]]
64811     [Constructs a executor_work_guard object for the specified executor. 
64812      [hr]
64813      Copy constructor. 
64814      [hr]
64815      Move constructor. ]
64816   ]
64817   
64818   [
64819     [[link boost_asio.reference.executor_work_guard.get_executor [*get_executor]]]
64820     [Obtain the associated executor. ]
64821   ]
64822   
64823   [
64824     [[link boost_asio.reference.executor_work_guard.owns_work [*owns_work]]]
64825     [Whether the executor_work_guard object owns some outstanding work. ]
64826   ]
64827   
64828   [
64829     [[link boost_asio.reference.executor_work_guard.reset [*reset]]]
64830     [Indicate that the work is no longer outstanding. ]
64831   ]
64832   
64833   [
64834     [[link boost_asio.reference.executor_work_guard._executor_work_guard [*~executor_work_guard]]]
64835     [Destructor. ]
64836   ]
64837   
64838 ]
64839
64840 [heading Requirements]
64841
64842 ['Header: ][^boost/asio/executor_work_guard.hpp]
64843
64844 ['Convenience header: ][^boost/asio.hpp]
64845
64846
64847 [section:executor_type executor_work_guard::executor_type]
64848
64849 [indexterm2 boost_asio.indexterm.executor_work_guard.executor_type..executor_type..executor_work_guard] 
64850 The underlying executor type. 
64851
64852
64853   typedef Executor executor_type;
64854
64855
64856
64857 [heading Requirements]
64858
64859 ['Header: ][^boost/asio/executor_work_guard.hpp]
64860
64861 ['Convenience header: ][^boost/asio.hpp]
64862
64863
64864 [endsect]
64865
64866
64867 [section:executor_work_guard executor_work_guard::executor_work_guard]
64868
64869 [indexterm2 boost_asio.indexterm.executor_work_guard.executor_work_guard..executor_work_guard..executor_work_guard] 
64870 Constructs a `executor_work_guard` object for the specified executor. 
64871
64872
64873   explicit ``[link boost_asio.reference.executor_work_guard.executor_work_guard.overload1 executor_work_guard]``(
64874       const executor_type & e);
64875   ``  [''''&raquo;''' [link boost_asio.reference.executor_work_guard.executor_work_guard.overload1 more...]]``
64876
64877
64878 Copy constructor. 
64879
64880
64881   ``[link boost_asio.reference.executor_work_guard.executor_work_guard.overload2 executor_work_guard]``(
64882       const executor_work_guard & other);
64883   ``  [''''&raquo;''' [link boost_asio.reference.executor_work_guard.executor_work_guard.overload2 more...]]``
64884
64885
64886 Move constructor. 
64887
64888
64889   ``[link boost_asio.reference.executor_work_guard.executor_work_guard.overload3 executor_work_guard]``(
64890       executor_work_guard && other);
64891   ``  [''''&raquo;''' [link boost_asio.reference.executor_work_guard.executor_work_guard.overload3 more...]]``
64892
64893
64894 [section:overload1 executor_work_guard::executor_work_guard (1 of 3 overloads)]
64895
64896
64897 Constructs a `executor_work_guard` object for the specified executor. 
64898
64899
64900   executor_work_guard(
64901       const executor_type & e);
64902
64903
64904 Stores a copy of `e` and calls `on_work_started()` on it. 
64905
64906
64907 [endsect]
64908
64909
64910
64911 [section:overload2 executor_work_guard::executor_work_guard (2 of 3 overloads)]
64912
64913
64914 Copy constructor. 
64915
64916
64917   executor_work_guard(
64918       const executor_work_guard & other);
64919
64920
64921
64922 [endsect]
64923
64924
64925
64926 [section:overload3 executor_work_guard::executor_work_guard (3 of 3 overloads)]
64927
64928
64929 Move constructor. 
64930
64931
64932   executor_work_guard(
64933       executor_work_guard && other);
64934
64935
64936
64937 [endsect]
64938
64939
64940 [endsect]
64941
64942
64943 [section:get_executor executor_work_guard::get_executor]
64944
64945 [indexterm2 boost_asio.indexterm.executor_work_guard.get_executor..get_executor..executor_work_guard] 
64946 Obtain the associated executor. 
64947
64948
64949   executor_type get_executor() const;
64950
64951
64952
64953 [endsect]
64954
64955
64956
64957 [section:owns_work executor_work_guard::owns_work]
64958
64959 [indexterm2 boost_asio.indexterm.executor_work_guard.owns_work..owns_work..executor_work_guard] 
64960 Whether the [link boost_asio.reference.executor_work_guard `executor_work_guard`] object owns some outstanding work. 
64961
64962
64963   bool owns_work() const;
64964
64965
64966
64967 [endsect]
64968
64969
64970
64971 [section:reset executor_work_guard::reset]
64972
64973 [indexterm2 boost_asio.indexterm.executor_work_guard.reset..reset..executor_work_guard] 
64974 Indicate that the work is no longer outstanding. 
64975
64976
64977   void reset();
64978
64979
64980
64981 [endsect]
64982
64983
64984
64985 [section:_executor_work_guard executor_work_guard::~executor_work_guard]
64986
64987 [indexterm2 boost_asio.indexterm.executor_work_guard._executor_work_guard..~executor_work_guard..executor_work_guard] 
64988 Destructor. 
64989
64990
64991   ~executor_work_guard();
64992
64993
64994 Unless the object has already been reset, or is in a moved-from state, calls `on_work_finished()` on the stored executor. 
64995
64996
64997 [endsect]
64998
64999
65000
65001 [endsect]
65002
65003 [section:generic__basic_endpoint generic::basic_endpoint]
65004
65005
65006 Describes an endpoint for any socket type. 
65007
65008
65009   template<
65010       typename ``[link boost_asio.reference.Protocol Protocol]``>
65011   class basic_endpoint
65012
65013
65014 [heading Types]
65015 [table
65016   [[Name][Description]]
65017
65018   [
65019
65020     [[link boost_asio.reference.generic__basic_endpoint.data_type [*data_type]]]
65021     [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
65022   
65023   ]
65024
65025   [
65026
65027     [[link boost_asio.reference.generic__basic_endpoint.protocol_type [*protocol_type]]]
65028     [The protocol type associated with the endpoint. ]
65029   
65030   ]
65031
65032 ]
65033
65034 [heading Member Functions]
65035 [table
65036   [[Name][Description]]
65037
65038   [
65039     [[link boost_asio.reference.generic__basic_endpoint.basic_endpoint [*basic_endpoint]]]
65040     [Default constructor. 
65041      [hr]
65042      Construct an endpoint from the specified socket address. 
65043      [hr]
65044      Construct an endpoint from the specific endpoint type. 
65045      [hr]
65046      Copy constructor. ]
65047   ]
65048   
65049   [
65050     [[link boost_asio.reference.generic__basic_endpoint.capacity [*capacity]]]
65051     [Get the capacity of the endpoint in the native type. ]
65052   ]
65053   
65054   [
65055     [[link boost_asio.reference.generic__basic_endpoint.data [*data]]]
65056     [Get the underlying endpoint in the native type. ]
65057   ]
65058   
65059   [
65060     [[link boost_asio.reference.generic__basic_endpoint.operator_eq_ [*operator=]]]
65061     [Assign from another endpoint. ]
65062   ]
65063   
65064   [
65065     [[link boost_asio.reference.generic__basic_endpoint.protocol [*protocol]]]
65066     [The protocol associated with the endpoint. ]
65067   ]
65068   
65069   [
65070     [[link boost_asio.reference.generic__basic_endpoint.resize [*resize]]]
65071     [Set the underlying size of the endpoint in the native type. ]
65072   ]
65073   
65074   [
65075     [[link boost_asio.reference.generic__basic_endpoint.size [*size]]]
65076     [Get the underlying size of the endpoint in the native type. ]
65077   ]
65078   
65079 ]
65080
65081 [heading Friends]
65082 [table
65083   [[Name][Description]]
65084
65085   [
65086     [[link boost_asio.reference.generic__basic_endpoint.operator_not__eq_ [*operator!=]]]
65087     [Compare two endpoints for inequality. ]
65088   ]
65089   
65090   [
65091     [[link boost_asio.reference.generic__basic_endpoint.operator_lt_ [*operator<]]]
65092     [Compare endpoints for ordering. ]
65093   ]
65094   
65095   [
65096     [[link boost_asio.reference.generic__basic_endpoint.operator_lt__eq_ [*operator<=]]]
65097     [Compare endpoints for ordering. ]
65098   ]
65099   
65100   [
65101     [[link boost_asio.reference.generic__basic_endpoint.operator_eq__eq_ [*operator==]]]
65102     [Compare two endpoints for equality. ]
65103   ]
65104   
65105   [
65106     [[link boost_asio.reference.generic__basic_endpoint.operator_gt_ [*operator>]]]
65107     [Compare endpoints for ordering. ]
65108   ]
65109   
65110   [
65111     [[link boost_asio.reference.generic__basic_endpoint.operator_gt__eq_ [*operator>=]]]
65112     [Compare endpoints for ordering. ]
65113   ]
65114   
65115 ]
65116
65117 The [link boost_asio.reference.generic__basic_endpoint `generic::basic_endpoint`] class template describes an endpoint that may be associated with any socket type.
65118
65119
65120 [heading Remarks]
65121       
65122 The socket types sockaddr type must be able to fit into a `sockaddr_storage` structure.
65123
65124
65125 [heading Thread Safety]
65126   
65127 ['Distinct] ['objects:] Safe.
65128
65129 ['Shared] ['objects:] Unsafe.
65130
65131
65132
65133
65134 [heading Requirements]
65135
65136 ['Header: ][^boost/asio/generic/basic_endpoint.hpp]
65137
65138 ['Convenience header: ][^boost/asio.hpp]
65139
65140 [section:basic_endpoint generic::basic_endpoint::basic_endpoint]
65141
65142 [indexterm2 boost_asio.indexterm.generic__basic_endpoint.basic_endpoint..basic_endpoint..generic::basic_endpoint] 
65143 Default constructor. 
65144
65145
65146   ``[link boost_asio.reference.generic__basic_endpoint.basic_endpoint.overload1 basic_endpoint]``();
65147   ``  [''''&raquo;''' [link boost_asio.reference.generic__basic_endpoint.basic_endpoint.overload1 more...]]``
65148
65149
65150 Construct an endpoint from the specified socket address. 
65151
65152
65153   ``[link boost_asio.reference.generic__basic_endpoint.basic_endpoint.overload2 basic_endpoint]``(
65154       const void * socket_address,
65155       std::size_t socket_address_size,
65156       int socket_protocol = 0);
65157   ``  [''''&raquo;''' [link boost_asio.reference.generic__basic_endpoint.basic_endpoint.overload2 more...]]``
65158
65159
65160 Construct an endpoint from the specific endpoint type. 
65161
65162
65163   template<
65164       typename ``[link boost_asio.reference.Endpoint Endpoint]``>
65165   ``[link boost_asio.reference.generic__basic_endpoint.basic_endpoint.overload3 basic_endpoint]``(
65166       const Endpoint & endpoint);
65167   ``  [''''&raquo;''' [link boost_asio.reference.generic__basic_endpoint.basic_endpoint.overload3 more...]]``
65168
65169
65170 Copy constructor. 
65171
65172
65173   ``[link boost_asio.reference.generic__basic_endpoint.basic_endpoint.overload4 basic_endpoint]``(
65174       const basic_endpoint & other);
65175   ``  [''''&raquo;''' [link boost_asio.reference.generic__basic_endpoint.basic_endpoint.overload4 more...]]``
65176
65177
65178 [section:overload1 generic::basic_endpoint::basic_endpoint (1 of 4 overloads)]
65179
65180
65181 Default constructor. 
65182
65183
65184   basic_endpoint();
65185
65186
65187
65188 [endsect]
65189
65190
65191
65192 [section:overload2 generic::basic_endpoint::basic_endpoint (2 of 4 overloads)]
65193
65194
65195 Construct an endpoint from the specified socket address. 
65196
65197
65198   basic_endpoint(
65199       const void * socket_address,
65200       std::size_t socket_address_size,
65201       int socket_protocol = 0);
65202
65203
65204
65205 [endsect]
65206
65207
65208
65209 [section:overload3 generic::basic_endpoint::basic_endpoint (3 of 4 overloads)]
65210
65211
65212 Construct an endpoint from the specific endpoint type. 
65213
65214
65215   template<
65216       typename ``[link boost_asio.reference.Endpoint Endpoint]``>
65217   basic_endpoint(
65218       const Endpoint & endpoint);
65219
65220
65221
65222 [endsect]
65223
65224
65225
65226 [section:overload4 generic::basic_endpoint::basic_endpoint (4 of 4 overloads)]
65227
65228
65229 Copy constructor. 
65230
65231
65232   basic_endpoint(
65233       const basic_endpoint & other);
65234
65235
65236
65237 [endsect]
65238
65239
65240 [endsect]
65241
65242
65243 [section:capacity generic::basic_endpoint::capacity]
65244
65245 [indexterm2 boost_asio.indexterm.generic__basic_endpoint.capacity..capacity..generic::basic_endpoint] 
65246 Get the capacity of the endpoint in the native type. 
65247
65248
65249   std::size_t capacity() const;
65250
65251
65252
65253 [endsect]
65254
65255
65256 [section:data generic::basic_endpoint::data]
65257
65258 [indexterm2 boost_asio.indexterm.generic__basic_endpoint.data..data..generic::basic_endpoint] 
65259 Get the underlying endpoint in the native type. 
65260
65261
65262   data_type * ``[link boost_asio.reference.generic__basic_endpoint.data.overload1 data]``();
65263   ``  [''''&raquo;''' [link boost_asio.reference.generic__basic_endpoint.data.overload1 more...]]``
65264
65265   const data_type * ``[link boost_asio.reference.generic__basic_endpoint.data.overload2 data]``() const;
65266   ``  [''''&raquo;''' [link boost_asio.reference.generic__basic_endpoint.data.overload2 more...]]``
65267
65268
65269 [section:overload1 generic::basic_endpoint::data (1 of 2 overloads)]
65270
65271
65272 Get the underlying endpoint in the native type. 
65273
65274
65275   data_type * data();
65276
65277
65278
65279 [endsect]
65280
65281
65282
65283 [section:overload2 generic::basic_endpoint::data (2 of 2 overloads)]
65284
65285
65286 Get the underlying endpoint in the native type. 
65287
65288
65289   const data_type * data() const;
65290
65291
65292
65293 [endsect]
65294
65295
65296 [endsect]
65297
65298
65299 [section:data_type generic::basic_endpoint::data_type]
65300
65301 [indexterm2 boost_asio.indexterm.generic__basic_endpoint.data_type..data_type..generic::basic_endpoint] 
65302 The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. 
65303
65304
65305   typedef implementation_defined data_type;
65306
65307
65308
65309 [heading Requirements]
65310
65311 ['Header: ][^boost/asio/generic/basic_endpoint.hpp]
65312
65313 ['Convenience header: ][^boost/asio.hpp]
65314
65315
65316 [endsect]
65317
65318
65319
65320 [section:operator_not__eq_ generic::basic_endpoint::operator!=]
65321
65322 [indexterm2 boost_asio.indexterm.generic__basic_endpoint.operator_not__eq_..operator!=..generic::basic_endpoint] 
65323 Compare two endpoints for inequality. 
65324
65325
65326   friend bool operator!=(
65327       const basic_endpoint< Protocol > & e1,
65328       const basic_endpoint< Protocol > & e2);
65329
65330
65331 [heading Requirements]
65332
65333 ['Header: ][^boost/asio/generic/basic_endpoint.hpp]
65334
65335 ['Convenience header: ][^boost/asio.hpp]
65336
65337
65338 [endsect]
65339
65340
65341
65342 [section:operator_lt_ generic::basic_endpoint::operator<]
65343
65344 [indexterm2 boost_asio.indexterm.generic__basic_endpoint.operator_lt_..operator<..generic::basic_endpoint] 
65345 Compare endpoints for ordering. 
65346
65347
65348   friend bool operator<(
65349       const basic_endpoint< Protocol > & e1,
65350       const basic_endpoint< Protocol > & e2);
65351
65352
65353 [heading Requirements]
65354
65355 ['Header: ][^boost/asio/generic/basic_endpoint.hpp]
65356
65357 ['Convenience header: ][^boost/asio.hpp]
65358
65359
65360 [endsect]
65361
65362
65363
65364 [section:operator_lt__eq_ generic::basic_endpoint::operator<=]
65365
65366 [indexterm2 boost_asio.indexterm.generic__basic_endpoint.operator_lt__eq_..operator<=..generic::basic_endpoint] 
65367 Compare endpoints for ordering. 
65368
65369
65370   friend bool operator<=(
65371       const basic_endpoint< Protocol > & e1,
65372       const basic_endpoint< Protocol > & e2);
65373
65374
65375 [heading Requirements]
65376
65377 ['Header: ][^boost/asio/generic/basic_endpoint.hpp]
65378
65379 ['Convenience header: ][^boost/asio.hpp]
65380
65381
65382 [endsect]
65383
65384
65385
65386 [section:operator_eq_ generic::basic_endpoint::operator=]
65387
65388 [indexterm2 boost_asio.indexterm.generic__basic_endpoint.operator_eq_..operator=..generic::basic_endpoint] 
65389 Assign from another endpoint. 
65390
65391
65392   basic_endpoint & operator=(
65393       const basic_endpoint & other);
65394
65395
65396
65397 [endsect]
65398
65399
65400
65401 [section:operator_eq__eq_ generic::basic_endpoint::operator==]
65402
65403 [indexterm2 boost_asio.indexterm.generic__basic_endpoint.operator_eq__eq_..operator==..generic::basic_endpoint] 
65404 Compare two endpoints for equality. 
65405
65406
65407   friend bool operator==(
65408       const basic_endpoint< Protocol > & e1,
65409       const basic_endpoint< Protocol > & e2);
65410
65411
65412 [heading Requirements]
65413
65414 ['Header: ][^boost/asio/generic/basic_endpoint.hpp]
65415
65416 ['Convenience header: ][^boost/asio.hpp]
65417
65418
65419 [endsect]
65420
65421
65422
65423 [section:operator_gt_ generic::basic_endpoint::operator>]
65424
65425 [indexterm2 boost_asio.indexterm.generic__basic_endpoint.operator_gt_..operator>..generic::basic_endpoint] 
65426 Compare endpoints for ordering. 
65427
65428
65429   friend bool operator>(
65430       const basic_endpoint< Protocol > & e1,
65431       const basic_endpoint< Protocol > & e2);
65432
65433
65434 [heading Requirements]
65435
65436 ['Header: ][^boost/asio/generic/basic_endpoint.hpp]
65437
65438 ['Convenience header: ][^boost/asio.hpp]
65439
65440
65441 [endsect]
65442
65443
65444
65445 [section:operator_gt__eq_ generic::basic_endpoint::operator>=]
65446
65447 [indexterm2 boost_asio.indexterm.generic__basic_endpoint.operator_gt__eq_..operator>=..generic::basic_endpoint] 
65448 Compare endpoints for ordering. 
65449
65450
65451   friend bool operator>=(
65452       const basic_endpoint< Protocol > & e1,
65453       const basic_endpoint< Protocol > & e2);
65454
65455
65456 [heading Requirements]
65457
65458 ['Header: ][^boost/asio/generic/basic_endpoint.hpp]
65459
65460 ['Convenience header: ][^boost/asio.hpp]
65461
65462
65463 [endsect]
65464
65465
65466
65467 [section:protocol generic::basic_endpoint::protocol]
65468
65469 [indexterm2 boost_asio.indexterm.generic__basic_endpoint.protocol..protocol..generic::basic_endpoint] 
65470 The protocol associated with the endpoint. 
65471
65472
65473   protocol_type protocol() const;
65474
65475
65476
65477 [endsect]
65478
65479
65480
65481 [section:protocol_type generic::basic_endpoint::protocol_type]
65482
65483 [indexterm2 boost_asio.indexterm.generic__basic_endpoint.protocol_type..protocol_type..generic::basic_endpoint] 
65484 The protocol type associated with the endpoint. 
65485
65486
65487   typedef Protocol protocol_type;
65488
65489
65490
65491 [heading Requirements]
65492
65493 ['Header: ][^boost/asio/generic/basic_endpoint.hpp]
65494
65495 ['Convenience header: ][^boost/asio.hpp]
65496
65497
65498 [endsect]
65499
65500
65501
65502 [section:resize generic::basic_endpoint::resize]
65503
65504 [indexterm2 boost_asio.indexterm.generic__basic_endpoint.resize..resize..generic::basic_endpoint] 
65505 Set the underlying size of the endpoint in the native type. 
65506
65507
65508   void resize(
65509       std::size_t new_size);
65510
65511
65512
65513 [endsect]
65514
65515
65516
65517 [section:size generic::basic_endpoint::size]
65518
65519 [indexterm2 boost_asio.indexterm.generic__basic_endpoint.size..size..generic::basic_endpoint] 
65520 Get the underlying size of the endpoint in the native type. 
65521
65522
65523   std::size_t size() const;
65524
65525
65526
65527 [endsect]
65528
65529
65530
65531 [endsect]
65532
65533 [section:generic__datagram_protocol generic::datagram_protocol]
65534
65535
65536 Encapsulates the flags needed for a generic datagram-oriented socket. 
65537
65538
65539   class datagram_protocol
65540
65541
65542 [heading Types]
65543 [table
65544   [[Name][Description]]
65545
65546   [
65547
65548     [[link boost_asio.reference.generic__datagram_protocol.endpoint [*endpoint]]]
65549     [The type of an endpoint. ]
65550   
65551   ]
65552
65553   [
65554
65555     [[link boost_asio.reference.generic__datagram_protocol.socket [*socket]]]
65556     [The generic socket type. ]
65557   
65558   ]
65559
65560 ]
65561
65562 [heading Member Functions]
65563 [table
65564   [[Name][Description]]
65565
65566   [
65567     [[link boost_asio.reference.generic__datagram_protocol.datagram_protocol [*datagram_protocol]]]
65568     [Construct a protocol object for a specific address family and protocol. 
65569      [hr]
65570      Construct a generic protocol object from a specific protocol. ]
65571   ]
65572   
65573   [
65574     [[link boost_asio.reference.generic__datagram_protocol.family [*family]]]
65575     [Obtain an identifier for the protocol family. ]
65576   ]
65577   
65578   [
65579     [[link boost_asio.reference.generic__datagram_protocol.protocol [*protocol]]]
65580     [Obtain an identifier for the protocol. ]
65581   ]
65582   
65583   [
65584     [[link boost_asio.reference.generic__datagram_protocol.type [*type]]]
65585     [Obtain an identifier for the type of the protocol. ]
65586   ]
65587   
65588 ]
65589
65590 [heading Friends]
65591 [table
65592   [[Name][Description]]
65593
65594   [
65595     [[link boost_asio.reference.generic__datagram_protocol.operator_not__eq_ [*operator!=]]]
65596     [Compare two protocols for inequality. ]
65597   ]
65598   
65599   [
65600     [[link boost_asio.reference.generic__datagram_protocol.operator_eq__eq_ [*operator==]]]
65601     [Compare two protocols for equality. ]
65602   ]
65603   
65604 ]
65605
65606 The [link boost_asio.reference.generic__datagram_protocol `generic::datagram_protocol`] class contains flags necessary for datagram-oriented sockets of any address family and protocol.
65607
65608
65609 [heading Examples]
65610   
65611 Constructing using a native address family and socket protocol: 
65612
65613    datagram_protocol p(AF_INET, IPPROTO_UDP); 
65614
65615
65616 Constructing from a specific protocol type: 
65617
65618    datagram_protocol p(boost::asio::ip::udp::v4()); 
65619
65620
65621
65622
65623
65624 [heading Thread Safety]
65625   
65626 ['Distinct] ['objects:] Safe.
65627
65628 ['Shared] ['objects:] Safe.
65629
65630
65631
65632
65633 [heading Requirements]
65634
65635 ['Header: ][^boost/asio/generic/datagram_protocol.hpp]
65636
65637 ['Convenience header: ][^boost/asio.hpp]
65638
65639 [section:datagram_protocol generic::datagram_protocol::datagram_protocol]
65640
65641 [indexterm2 boost_asio.indexterm.generic__datagram_protocol.datagram_protocol..datagram_protocol..generic::datagram_protocol] 
65642 Construct a protocol object for a specific address family and protocol. 
65643
65644
65645   ``[link boost_asio.reference.generic__datagram_protocol.datagram_protocol.overload1 datagram_protocol]``(
65646       int address_family,
65647       int socket_protocol);
65648   ``  [''''&raquo;''' [link boost_asio.reference.generic__datagram_protocol.datagram_protocol.overload1 more...]]``
65649
65650
65651 Construct a generic protocol object from a specific protocol. 
65652
65653
65654   template<
65655       typename ``[link boost_asio.reference.Protocol Protocol]``>
65656   ``[link boost_asio.reference.generic__datagram_protocol.datagram_protocol.overload2 datagram_protocol]``(
65657       const Protocol & source_protocol);
65658   ``  [''''&raquo;''' [link boost_asio.reference.generic__datagram_protocol.datagram_protocol.overload2 more...]]``
65659
65660
65661 [section:overload1 generic::datagram_protocol::datagram_protocol (1 of 2 overloads)]
65662
65663
65664 Construct a protocol object for a specific address family and protocol. 
65665
65666
65667   datagram_protocol(
65668       int address_family,
65669       int socket_protocol);
65670
65671
65672
65673 [endsect]
65674
65675
65676
65677 [section:overload2 generic::datagram_protocol::datagram_protocol (2 of 2 overloads)]
65678
65679
65680 Construct a generic protocol object from a specific protocol. 
65681
65682
65683   template<
65684       typename ``[link boost_asio.reference.Protocol Protocol]``>
65685   datagram_protocol(
65686       const Protocol & source_protocol);
65687
65688
65689
65690 [heading Exceptions]
65691     
65692
65693 [variablelist
65694   
65695 [[@c][bad\_cast Thrown if the source protocol is not datagram-oriented. ]]
65696
65697 ]
65698
65699
65700
65701
65702 [endsect]
65703
65704
65705 [endsect]
65706
65707
65708 [section:endpoint generic::datagram_protocol::endpoint]
65709
65710 [indexterm2 boost_asio.indexterm.generic__datagram_protocol.endpoint..endpoint..generic::datagram_protocol] 
65711 The type of an endpoint. 
65712
65713
65714   typedef basic_endpoint< datagram_protocol > endpoint;
65715
65716
65717 [heading Types]
65718 [table
65719   [[Name][Description]]
65720
65721   [
65722
65723     [[link boost_asio.reference.generic__basic_endpoint.data_type [*data_type]]]
65724     [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
65725   
65726   ]
65727
65728   [
65729
65730     [[link boost_asio.reference.generic__basic_endpoint.protocol_type [*protocol_type]]]
65731     [The protocol type associated with the endpoint. ]
65732   
65733   ]
65734
65735 ]
65736
65737 [heading Member Functions]
65738 [table
65739   [[Name][Description]]
65740
65741   [
65742     [[link boost_asio.reference.generic__basic_endpoint.basic_endpoint [*basic_endpoint]]]
65743     [Default constructor. 
65744      [hr]
65745      Construct an endpoint from the specified socket address. 
65746      [hr]
65747      Construct an endpoint from the specific endpoint type. 
65748      [hr]
65749      Copy constructor. ]
65750   ]
65751   
65752   [
65753     [[link boost_asio.reference.generic__basic_endpoint.capacity [*capacity]]]
65754     [Get the capacity of the endpoint in the native type. ]
65755   ]
65756   
65757   [
65758     [[link boost_asio.reference.generic__basic_endpoint.data [*data]]]
65759     [Get the underlying endpoint in the native type. ]
65760   ]
65761   
65762   [
65763     [[link boost_asio.reference.generic__basic_endpoint.operator_eq_ [*operator=]]]
65764     [Assign from another endpoint. ]
65765   ]
65766   
65767   [
65768     [[link boost_asio.reference.generic__basic_endpoint.protocol [*protocol]]]
65769     [The protocol associated with the endpoint. ]
65770   ]
65771   
65772   [
65773     [[link boost_asio.reference.generic__basic_endpoint.resize [*resize]]]
65774     [Set the underlying size of the endpoint in the native type. ]
65775   ]
65776   
65777   [
65778     [[link boost_asio.reference.generic__basic_endpoint.size [*size]]]
65779     [Get the underlying size of the endpoint in the native type. ]
65780   ]
65781   
65782 ]
65783
65784 [heading Friends]
65785 [table
65786   [[Name][Description]]
65787
65788   [
65789     [[link boost_asio.reference.generic__basic_endpoint.operator_not__eq_ [*operator!=]]]
65790     [Compare two endpoints for inequality. ]
65791   ]
65792   
65793   [
65794     [[link boost_asio.reference.generic__basic_endpoint.operator_lt_ [*operator<]]]
65795     [Compare endpoints for ordering. ]
65796   ]
65797   
65798   [
65799     [[link boost_asio.reference.generic__basic_endpoint.operator_lt__eq_ [*operator<=]]]
65800     [Compare endpoints for ordering. ]
65801   ]
65802   
65803   [
65804     [[link boost_asio.reference.generic__basic_endpoint.operator_eq__eq_ [*operator==]]]
65805     [Compare two endpoints for equality. ]
65806   ]
65807   
65808   [
65809     [[link boost_asio.reference.generic__basic_endpoint.operator_gt_ [*operator>]]]
65810     [Compare endpoints for ordering. ]
65811   ]
65812   
65813   [
65814     [[link boost_asio.reference.generic__basic_endpoint.operator_gt__eq_ [*operator>=]]]
65815     [Compare endpoints for ordering. ]
65816   ]
65817   
65818 ]
65819
65820 The [link boost_asio.reference.generic__basic_endpoint `generic::basic_endpoint`] class template describes an endpoint that may be associated with any socket type.
65821
65822
65823 [heading Remarks]
65824       
65825 The socket types sockaddr type must be able to fit into a `sockaddr_storage` structure.
65826
65827
65828 [heading Thread Safety]
65829   
65830 ['Distinct] ['objects:] Safe.
65831
65832 ['Shared] ['objects:] Unsafe.
65833
65834
65835
65836
65837
65838 [heading Requirements]
65839
65840 ['Header: ][^boost/asio/generic/datagram_protocol.hpp]
65841
65842 ['Convenience header: ][^boost/asio.hpp]
65843
65844
65845 [endsect]
65846
65847
65848
65849 [section:family generic::datagram_protocol::family]
65850
65851 [indexterm2 boost_asio.indexterm.generic__datagram_protocol.family..family..generic::datagram_protocol] 
65852 Obtain an identifier for the protocol family. 
65853
65854
65855   int family() const;
65856
65857
65858
65859 [endsect]
65860
65861
65862
65863 [section:operator_not__eq_ generic::datagram_protocol::operator!=]
65864
65865 [indexterm2 boost_asio.indexterm.generic__datagram_protocol.operator_not__eq_..operator!=..generic::datagram_protocol] 
65866 Compare two protocols for inequality. 
65867
65868
65869   friend bool operator!=(
65870       const datagram_protocol & p1,
65871       const datagram_protocol & p2);
65872
65873
65874 [heading Requirements]
65875
65876 ['Header: ][^boost/asio/generic/datagram_protocol.hpp]
65877
65878 ['Convenience header: ][^boost/asio.hpp]
65879
65880
65881 [endsect]
65882
65883
65884
65885 [section:operator_eq__eq_ generic::datagram_protocol::operator==]
65886
65887 [indexterm2 boost_asio.indexterm.generic__datagram_protocol.operator_eq__eq_..operator==..generic::datagram_protocol] 
65888 Compare two protocols for equality. 
65889
65890
65891   friend bool operator==(
65892       const datagram_protocol & p1,
65893       const datagram_protocol & p2);
65894
65895
65896 [heading Requirements]
65897
65898 ['Header: ][^boost/asio/generic/datagram_protocol.hpp]
65899
65900 ['Convenience header: ][^boost/asio.hpp]
65901
65902
65903 [endsect]
65904
65905
65906
65907 [section:protocol generic::datagram_protocol::protocol]
65908
65909 [indexterm2 boost_asio.indexterm.generic__datagram_protocol.protocol..protocol..generic::datagram_protocol] 
65910 Obtain an identifier for the protocol. 
65911
65912
65913   int protocol() const;
65914
65915
65916
65917 [endsect]
65918
65919
65920
65921 [section:socket generic::datagram_protocol::socket]
65922
65923 [indexterm2 boost_asio.indexterm.generic__datagram_protocol.socket..socket..generic::datagram_protocol] 
65924 The generic socket type. 
65925
65926
65927   typedef basic_datagram_socket< datagram_protocol > socket;
65928
65929
65930 [heading Types]
65931 [table
65932   [[Name][Description]]
65933
65934   [
65935
65936     [[link boost_asio.reference.basic_datagram_socket__rebind_executor [*rebind_executor]]]
65937     [Rebinds the socket type to another executor. ]
65938   
65939   ]
65940
65941   [
65942
65943     [[link boost_asio.reference.basic_datagram_socket.broadcast [*broadcast]]]
65944     [Socket option to permit sending of broadcast messages. ]
65945   
65946   ]
65947
65948   [
65949
65950     [[link boost_asio.reference.basic_datagram_socket.bytes_readable [*bytes_readable]]]
65951     [IO control command to get the amount of data that can be read without blocking. ]
65952   
65953   ]
65954
65955   [
65956
65957     [[link boost_asio.reference.basic_datagram_socket.debug [*debug]]]
65958     [Socket option to enable socket-level debugging. ]
65959   
65960   ]
65961
65962   [
65963
65964     [[link boost_asio.reference.basic_datagram_socket.do_not_route [*do_not_route]]]
65965     [Socket option to prevent routing, use local interfaces only. ]
65966   
65967   ]
65968
65969   [
65970
65971     [[link boost_asio.reference.basic_datagram_socket.enable_connection_aborted [*enable_connection_aborted]]]
65972     [Socket option to report aborted connections on accept. ]
65973   
65974   ]
65975
65976   [
65977
65978     [[link boost_asio.reference.basic_datagram_socket.endpoint_type [*endpoint_type]]]
65979     [The endpoint type. ]
65980   
65981   ]
65982
65983   [
65984
65985     [[link boost_asio.reference.basic_datagram_socket.executor_type [*executor_type]]]
65986     [The type of the executor associated with the object. ]
65987   
65988   ]
65989
65990   [
65991
65992     [[link boost_asio.reference.basic_datagram_socket.keep_alive [*keep_alive]]]
65993     [Socket option to send keep-alives. ]
65994   
65995   ]
65996
65997   [
65998
65999     [[link boost_asio.reference.basic_datagram_socket.linger [*linger]]]
66000     [Socket option to specify whether the socket lingers on close if unsent data is present. ]
66001   
66002   ]
66003
66004   [
66005
66006     [[link boost_asio.reference.basic_datagram_socket.lowest_layer_type [*lowest_layer_type]]]
66007     [A basic_socket is always the lowest layer. ]
66008   
66009   ]
66010
66011   [
66012
66013     [[link boost_asio.reference.basic_datagram_socket.message_flags [*message_flags]]]
66014     [Bitmask type for flags that can be passed to send and receive operations. ]
66015   
66016   ]
66017
66018   [
66019
66020     [[link boost_asio.reference.basic_datagram_socket.native_handle_type [*native_handle_type]]]
66021     [The native representation of a socket. ]
66022   
66023   ]
66024
66025   [
66026
66027     [[link boost_asio.reference.basic_datagram_socket.out_of_band_inline [*out_of_band_inline]]]
66028     [Socket option for putting received out-of-band data inline. ]
66029   
66030   ]
66031
66032   [
66033
66034     [[link boost_asio.reference.basic_datagram_socket.protocol_type [*protocol_type]]]
66035     [The protocol type. ]
66036   
66037   ]
66038
66039   [
66040
66041     [[link boost_asio.reference.basic_datagram_socket.receive_buffer_size [*receive_buffer_size]]]
66042     [Socket option for the receive buffer size of a socket. ]
66043   
66044   ]
66045
66046   [
66047
66048     [[link boost_asio.reference.basic_datagram_socket.receive_low_watermark [*receive_low_watermark]]]
66049     [Socket option for the receive low watermark. ]
66050   
66051   ]
66052
66053   [
66054
66055     [[link boost_asio.reference.basic_datagram_socket.reuse_address [*reuse_address]]]
66056     [Socket option to allow the socket to be bound to an address that is already in use. ]
66057   
66058   ]
66059
66060   [
66061
66062     [[link boost_asio.reference.basic_datagram_socket.send_buffer_size [*send_buffer_size]]]
66063     [Socket option for the send buffer size of a socket. ]
66064   
66065   ]
66066
66067   [
66068
66069     [[link boost_asio.reference.basic_datagram_socket.send_low_watermark [*send_low_watermark]]]
66070     [Socket option for the send low watermark. ]
66071   
66072   ]
66073
66074   [
66075
66076     [[link boost_asio.reference.basic_datagram_socket.shutdown_type [*shutdown_type]]]
66077     [Different ways a socket may be shutdown. ]
66078   
66079   ]
66080
66081   [
66082
66083     [[link boost_asio.reference.basic_datagram_socket.wait_type [*wait_type]]]
66084     [Wait types. ]
66085   
66086   ]
66087
66088 ]
66089
66090 [heading Member Functions]
66091 [table
66092   [[Name][Description]]
66093
66094   [
66095     [[link boost_asio.reference.basic_datagram_socket.assign [*assign]]]
66096     [Assign an existing native socket to the socket. ]
66097   ]
66098   
66099   [
66100     [[link boost_asio.reference.basic_datagram_socket.async_connect [*async_connect]]]
66101     [Start an asynchronous connect. ]
66102   ]
66103   
66104   [
66105     [[link boost_asio.reference.basic_datagram_socket.async_receive [*async_receive]]]
66106     [Start an asynchronous receive on a connected socket. ]
66107   ]
66108   
66109   [
66110     [[link boost_asio.reference.basic_datagram_socket.async_receive_from [*async_receive_from]]]
66111     [Start an asynchronous receive. ]
66112   ]
66113   
66114   [
66115     [[link boost_asio.reference.basic_datagram_socket.async_send [*async_send]]]
66116     [Start an asynchronous send on a connected socket. ]
66117   ]
66118   
66119   [
66120     [[link boost_asio.reference.basic_datagram_socket.async_send_to [*async_send_to]]]
66121     [Start an asynchronous send. ]
66122   ]
66123   
66124   [
66125     [[link boost_asio.reference.basic_datagram_socket.async_wait [*async_wait]]]
66126     [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
66127   ]
66128   
66129   [
66130     [[link boost_asio.reference.basic_datagram_socket.at_mark [*at_mark]]]
66131     [Determine whether the socket is at the out-of-band data mark. ]
66132   ]
66133   
66134   [
66135     [[link boost_asio.reference.basic_datagram_socket.available [*available]]]
66136     [Determine the number of bytes available for reading. ]
66137   ]
66138   
66139   [
66140     [[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket [*basic_datagram_socket]]]
66141     [Construct a basic_datagram_socket without opening it. 
66142      [hr]
66143      Construct and open a basic_datagram_socket. 
66144      [hr]
66145      Construct a basic_datagram_socket, opening it and binding it to the given local endpoint. 
66146      [hr]
66147      Construct a basic_datagram_socket on an existing native socket. 
66148      [hr]
66149      Move-construct a basic_datagram_socket from another. 
66150      [hr]
66151      Move-construct a basic_datagram_socket from a socket of another protocol type. ]
66152   ]
66153   
66154   [
66155     [[link boost_asio.reference.basic_datagram_socket.bind [*bind]]]
66156     [Bind the socket to the given local endpoint. ]
66157   ]
66158   
66159   [
66160     [[link boost_asio.reference.basic_datagram_socket.cancel [*cancel]]]
66161     [Cancel all asynchronous operations associated with the socket. ]
66162   ]
66163   
66164   [
66165     [[link boost_asio.reference.basic_datagram_socket.close [*close]]]
66166     [Close the socket. ]
66167   ]
66168   
66169   [
66170     [[link boost_asio.reference.basic_datagram_socket.connect [*connect]]]
66171     [Connect the socket to the specified endpoint. ]
66172   ]
66173   
66174   [
66175     [[link boost_asio.reference.basic_datagram_socket.get_executor [*get_executor]]]
66176     [Get the executor associated with the object. ]
66177   ]
66178   
66179   [
66180     [[link boost_asio.reference.basic_datagram_socket.get_option [*get_option]]]
66181     [Get an option from the socket. ]
66182   ]
66183   
66184   [
66185     [[link boost_asio.reference.basic_datagram_socket.io_control [*io_control]]]
66186     [Perform an IO control command on the socket. ]
66187   ]
66188   
66189   [
66190     [[link boost_asio.reference.basic_datagram_socket.is_open [*is_open]]]
66191     [Determine whether the socket is open. ]
66192   ]
66193   
66194   [
66195     [[link boost_asio.reference.basic_datagram_socket.local_endpoint [*local_endpoint]]]
66196     [Get the local endpoint of the socket. ]
66197   ]
66198   
66199   [
66200     [[link boost_asio.reference.basic_datagram_socket.lowest_layer [*lowest_layer]]]
66201     [Get a reference to the lowest layer. 
66202      [hr]
66203      Get a const reference to the lowest layer. ]
66204   ]
66205   
66206   [
66207     [[link boost_asio.reference.basic_datagram_socket.native_handle [*native_handle]]]
66208     [Get the native socket representation. ]
66209   ]
66210   
66211   [
66212     [[link boost_asio.reference.basic_datagram_socket.native_non_blocking [*native_non_blocking]]]
66213     [Gets the non-blocking mode of the native socket implementation. 
66214      [hr]
66215      Sets the non-blocking mode of the native socket implementation. ]
66216   ]
66217   
66218   [
66219     [[link boost_asio.reference.basic_datagram_socket.non_blocking [*non_blocking]]]
66220     [Gets the non-blocking mode of the socket. 
66221      [hr]
66222      Sets the non-blocking mode of the socket. ]
66223   ]
66224   
66225   [
66226     [[link boost_asio.reference.basic_datagram_socket.open [*open]]]
66227     [Open the socket using the specified protocol. ]
66228   ]
66229   
66230   [
66231     [[link boost_asio.reference.basic_datagram_socket.operator_eq_ [*operator=]]]
66232     [Move-assign a basic_datagram_socket from another. 
66233      [hr]
66234      Move-assign a basic_datagram_socket from a socket of another protocol type. ]
66235   ]
66236   
66237   [
66238     [[link boost_asio.reference.basic_datagram_socket.receive [*receive]]]
66239     [Receive some data on a connected socket. ]
66240   ]
66241   
66242   [
66243     [[link boost_asio.reference.basic_datagram_socket.receive_from [*receive_from]]]
66244     [Receive a datagram with the endpoint of the sender. ]
66245   ]
66246   
66247   [
66248     [[link boost_asio.reference.basic_datagram_socket.release [*release]]]
66249     [Release ownership of the underlying native socket. ]
66250   ]
66251   
66252   [
66253     [[link boost_asio.reference.basic_datagram_socket.remote_endpoint [*remote_endpoint]]]
66254     [Get the remote endpoint of the socket. ]
66255   ]
66256   
66257   [
66258     [[link boost_asio.reference.basic_datagram_socket.send [*send]]]
66259     [Send some data on a connected socket. ]
66260   ]
66261   
66262   [
66263     [[link boost_asio.reference.basic_datagram_socket.send_to [*send_to]]]
66264     [Send a datagram to the specified endpoint. ]
66265   ]
66266   
66267   [
66268     [[link boost_asio.reference.basic_datagram_socket.set_option [*set_option]]]
66269     [Set an option on the socket. ]
66270   ]
66271   
66272   [
66273     [[link boost_asio.reference.basic_datagram_socket.shutdown [*shutdown]]]
66274     [Disable sends or receives on the socket. ]
66275   ]
66276   
66277   [
66278     [[link boost_asio.reference.basic_datagram_socket.wait [*wait]]]
66279     [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
66280   ]
66281   
66282   [
66283     [[link boost_asio.reference.basic_datagram_socket._basic_datagram_socket [*~basic_datagram_socket]]]
66284     [Destroys the socket. ]
66285   ]
66286   
66287 ]
66288
66289 [heading Data Members]
66290 [table
66291   [[Name][Description]]
66292
66293   [
66294     [[link boost_asio.reference.basic_datagram_socket.max_connections [*max_connections]]]
66295     [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
66296   ]
66297
66298   [
66299     [[link boost_asio.reference.basic_datagram_socket.max_listen_connections [*max_listen_connections]]]
66300     [The maximum length of the queue of pending incoming connections. ]
66301   ]
66302
66303   [
66304     [[link boost_asio.reference.basic_datagram_socket.message_do_not_route [*message_do_not_route]]]
66305     [Specify that the data should not be subject to routing. ]
66306   ]
66307
66308   [
66309     [[link boost_asio.reference.basic_datagram_socket.message_end_of_record [*message_end_of_record]]]
66310     [Specifies that the data marks the end of a record. ]
66311   ]
66312
66313   [
66314     [[link boost_asio.reference.basic_datagram_socket.message_out_of_band [*message_out_of_band]]]
66315     [Process out-of-band data. ]
66316   ]
66317
66318   [
66319     [[link boost_asio.reference.basic_datagram_socket.message_peek [*message_peek]]]
66320     [Peek at incoming data without removing it from the input queue. ]
66321   ]
66322
66323 ]
66324
66325 [heading Protected Data Members]
66326 [table
66327   [[Name][Description]]
66328
66329   [
66330     [[link boost_asio.reference.basic_datagram_socket.impl_ [*impl_]]]
66331     []
66332   ]
66333
66334 ]
66335
66336 The [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] class template provides asynchronous and blocking datagram-oriented socket functionality.
66337
66338
66339 [heading Thread Safety]
66340   
66341 ['Distinct] ['objects:] Safe.
66342
66343 ['Shared] ['objects:] Unsafe. 
66344
66345
66346
66347
66348 [heading Requirements]
66349
66350 ['Header: ][^boost/asio/generic/datagram_protocol.hpp]
66351
66352 ['Convenience header: ][^boost/asio.hpp]
66353
66354
66355 [endsect]
66356
66357
66358
66359 [section:type generic::datagram_protocol::type]
66360
66361 [indexterm2 boost_asio.indexterm.generic__datagram_protocol.type..type..generic::datagram_protocol] 
66362 Obtain an identifier for the type of the protocol. 
66363
66364
66365   int type() const;
66366
66367
66368
66369 [endsect]
66370
66371
66372
66373 [endsect]
66374
66375 [section:generic__raw_protocol generic::raw_protocol]
66376
66377
66378 Encapsulates the flags needed for a generic raw socket. 
66379
66380
66381   class raw_protocol
66382
66383
66384 [heading Types]
66385 [table
66386   [[Name][Description]]
66387
66388   [
66389
66390     [[link boost_asio.reference.generic__raw_protocol.endpoint [*endpoint]]]
66391     [The type of an endpoint. ]
66392   
66393   ]
66394
66395   [
66396
66397     [[link boost_asio.reference.generic__raw_protocol.socket [*socket]]]
66398     [The generic socket type. ]
66399   
66400   ]
66401
66402 ]
66403
66404 [heading Member Functions]
66405 [table
66406   [[Name][Description]]
66407
66408   [
66409     [[link boost_asio.reference.generic__raw_protocol.family [*family]]]
66410     [Obtain an identifier for the protocol family. ]
66411   ]
66412   
66413   [
66414     [[link boost_asio.reference.generic__raw_protocol.protocol [*protocol]]]
66415     [Obtain an identifier for the protocol. ]
66416   ]
66417   
66418   [
66419     [[link boost_asio.reference.generic__raw_protocol.raw_protocol [*raw_protocol]]]
66420     [Construct a protocol object for a specific address family and protocol. 
66421      [hr]
66422      Construct a generic protocol object from a specific protocol. ]
66423   ]
66424   
66425   [
66426     [[link boost_asio.reference.generic__raw_protocol.type [*type]]]
66427     [Obtain an identifier for the type of the protocol. ]
66428   ]
66429   
66430 ]
66431
66432 [heading Friends]
66433 [table
66434   [[Name][Description]]
66435
66436   [
66437     [[link boost_asio.reference.generic__raw_protocol.operator_not__eq_ [*operator!=]]]
66438     [Compare two protocols for inequality. ]
66439   ]
66440   
66441   [
66442     [[link boost_asio.reference.generic__raw_protocol.operator_eq__eq_ [*operator==]]]
66443     [Compare two protocols for equality. ]
66444   ]
66445   
66446 ]
66447
66448 The [link boost_asio.reference.generic__raw_protocol `generic::raw_protocol`] class contains flags necessary for raw sockets of any address family and protocol.
66449
66450
66451 [heading Examples]
66452   
66453 Constructing using a native address family and socket protocol: 
66454
66455    raw_protocol p(AF_INET, IPPROTO_ICMP); 
66456
66457
66458 Constructing from a specific protocol type: 
66459
66460    raw_protocol p(boost::asio::ip::icmp::v4()); 
66461
66462
66463
66464
66465
66466 [heading Thread Safety]
66467   
66468 ['Distinct] ['objects:] Safe.
66469
66470 ['Shared] ['objects:] Safe.
66471
66472
66473
66474
66475 [heading Requirements]
66476
66477 ['Header: ][^boost/asio/generic/raw_protocol.hpp]
66478
66479 ['Convenience header: ][^boost/asio.hpp]
66480
66481
66482 [section:endpoint generic::raw_protocol::endpoint]
66483
66484 [indexterm2 boost_asio.indexterm.generic__raw_protocol.endpoint..endpoint..generic::raw_protocol] 
66485 The type of an endpoint. 
66486
66487
66488   typedef basic_endpoint< raw_protocol > endpoint;
66489
66490
66491 [heading Types]
66492 [table
66493   [[Name][Description]]
66494
66495   [
66496
66497     [[link boost_asio.reference.generic__basic_endpoint.data_type [*data_type]]]
66498     [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
66499   
66500   ]
66501
66502   [
66503
66504     [[link boost_asio.reference.generic__basic_endpoint.protocol_type [*protocol_type]]]
66505     [The protocol type associated with the endpoint. ]
66506   
66507   ]
66508
66509 ]
66510
66511 [heading Member Functions]
66512 [table
66513   [[Name][Description]]
66514
66515   [
66516     [[link boost_asio.reference.generic__basic_endpoint.basic_endpoint [*basic_endpoint]]]
66517     [Default constructor. 
66518      [hr]
66519      Construct an endpoint from the specified socket address. 
66520      [hr]
66521      Construct an endpoint from the specific endpoint type. 
66522      [hr]
66523      Copy constructor. ]
66524   ]
66525   
66526   [
66527     [[link boost_asio.reference.generic__basic_endpoint.capacity [*capacity]]]
66528     [Get the capacity of the endpoint in the native type. ]
66529   ]
66530   
66531   [
66532     [[link boost_asio.reference.generic__basic_endpoint.data [*data]]]
66533     [Get the underlying endpoint in the native type. ]
66534   ]
66535   
66536   [
66537     [[link boost_asio.reference.generic__basic_endpoint.operator_eq_ [*operator=]]]
66538     [Assign from another endpoint. ]
66539   ]
66540   
66541   [
66542     [[link boost_asio.reference.generic__basic_endpoint.protocol [*protocol]]]
66543     [The protocol associated with the endpoint. ]
66544   ]
66545   
66546   [
66547     [[link boost_asio.reference.generic__basic_endpoint.resize [*resize]]]
66548     [Set the underlying size of the endpoint in the native type. ]
66549   ]
66550   
66551   [
66552     [[link boost_asio.reference.generic__basic_endpoint.size [*size]]]
66553     [Get the underlying size of the endpoint in the native type. ]
66554   ]
66555   
66556 ]
66557
66558 [heading Friends]
66559 [table
66560   [[Name][Description]]
66561
66562   [
66563     [[link boost_asio.reference.generic__basic_endpoint.operator_not__eq_ [*operator!=]]]
66564     [Compare two endpoints for inequality. ]
66565   ]
66566   
66567   [
66568     [[link boost_asio.reference.generic__basic_endpoint.operator_lt_ [*operator<]]]
66569     [Compare endpoints for ordering. ]
66570   ]
66571   
66572   [
66573     [[link boost_asio.reference.generic__basic_endpoint.operator_lt__eq_ [*operator<=]]]
66574     [Compare endpoints for ordering. ]
66575   ]
66576   
66577   [
66578     [[link boost_asio.reference.generic__basic_endpoint.operator_eq__eq_ [*operator==]]]
66579     [Compare two endpoints for equality. ]
66580   ]
66581   
66582   [
66583     [[link boost_asio.reference.generic__basic_endpoint.operator_gt_ [*operator>]]]
66584     [Compare endpoints for ordering. ]
66585   ]
66586   
66587   [
66588     [[link boost_asio.reference.generic__basic_endpoint.operator_gt__eq_ [*operator>=]]]
66589     [Compare endpoints for ordering. ]
66590   ]
66591   
66592 ]
66593
66594 The [link boost_asio.reference.generic__basic_endpoint `generic::basic_endpoint`] class template describes an endpoint that may be associated with any socket type.
66595
66596
66597 [heading Remarks]
66598       
66599 The socket types sockaddr type must be able to fit into a `sockaddr_storage` structure.
66600
66601
66602 [heading Thread Safety]
66603   
66604 ['Distinct] ['objects:] Safe.
66605
66606 ['Shared] ['objects:] Unsafe.
66607
66608
66609
66610
66611
66612 [heading Requirements]
66613
66614 ['Header: ][^boost/asio/generic/raw_protocol.hpp]
66615
66616 ['Convenience header: ][^boost/asio.hpp]
66617
66618
66619 [endsect]
66620
66621
66622
66623 [section:family generic::raw_protocol::family]
66624
66625 [indexterm2 boost_asio.indexterm.generic__raw_protocol.family..family..generic::raw_protocol] 
66626 Obtain an identifier for the protocol family. 
66627
66628
66629   int family() const;
66630
66631
66632
66633 [endsect]
66634
66635
66636
66637 [section:operator_not__eq_ generic::raw_protocol::operator!=]
66638
66639 [indexterm2 boost_asio.indexterm.generic__raw_protocol.operator_not__eq_..operator!=..generic::raw_protocol] 
66640 Compare two protocols for inequality. 
66641
66642
66643   friend bool operator!=(
66644       const raw_protocol & p1,
66645       const raw_protocol & p2);
66646
66647
66648 [heading Requirements]
66649
66650 ['Header: ][^boost/asio/generic/raw_protocol.hpp]
66651
66652 ['Convenience header: ][^boost/asio.hpp]
66653
66654
66655 [endsect]
66656
66657
66658
66659 [section:operator_eq__eq_ generic::raw_protocol::operator==]
66660
66661 [indexterm2 boost_asio.indexterm.generic__raw_protocol.operator_eq__eq_..operator==..generic::raw_protocol] 
66662 Compare two protocols for equality. 
66663
66664
66665   friend bool operator==(
66666       const raw_protocol & p1,
66667       const raw_protocol & p2);
66668
66669
66670 [heading Requirements]
66671
66672 ['Header: ][^boost/asio/generic/raw_protocol.hpp]
66673
66674 ['Convenience header: ][^boost/asio.hpp]
66675
66676
66677 [endsect]
66678
66679
66680
66681 [section:protocol generic::raw_protocol::protocol]
66682
66683 [indexterm2 boost_asio.indexterm.generic__raw_protocol.protocol..protocol..generic::raw_protocol] 
66684 Obtain an identifier for the protocol. 
66685
66686
66687   int protocol() const;
66688
66689
66690
66691 [endsect]
66692
66693
66694 [section:raw_protocol generic::raw_protocol::raw_protocol]
66695
66696 [indexterm2 boost_asio.indexterm.generic__raw_protocol.raw_protocol..raw_protocol..generic::raw_protocol] 
66697 Construct a protocol object for a specific address family and protocol. 
66698
66699
66700   ``[link boost_asio.reference.generic__raw_protocol.raw_protocol.overload1 raw_protocol]``(
66701       int address_family,
66702       int socket_protocol);
66703   ``  [''''&raquo;''' [link boost_asio.reference.generic__raw_protocol.raw_protocol.overload1 more...]]``
66704
66705
66706 Construct a generic protocol object from a specific protocol. 
66707
66708
66709   template<
66710       typename ``[link boost_asio.reference.Protocol Protocol]``>
66711   ``[link boost_asio.reference.generic__raw_protocol.raw_protocol.overload2 raw_protocol]``(
66712       const Protocol & source_protocol);
66713   ``  [''''&raquo;''' [link boost_asio.reference.generic__raw_protocol.raw_protocol.overload2 more...]]``
66714
66715
66716 [section:overload1 generic::raw_protocol::raw_protocol (1 of 2 overloads)]
66717
66718
66719 Construct a protocol object for a specific address family and protocol. 
66720
66721
66722   raw_protocol(
66723       int address_family,
66724       int socket_protocol);
66725
66726
66727
66728 [endsect]
66729
66730
66731
66732 [section:overload2 generic::raw_protocol::raw_protocol (2 of 2 overloads)]
66733
66734
66735 Construct a generic protocol object from a specific protocol. 
66736
66737
66738   template<
66739       typename ``[link boost_asio.reference.Protocol Protocol]``>
66740   raw_protocol(
66741       const Protocol & source_protocol);
66742
66743
66744
66745 [heading Exceptions]
66746     
66747
66748 [variablelist
66749   
66750 [[@c][bad\_cast Thrown if the source protocol is not raw-oriented. ]]
66751
66752 ]
66753
66754
66755
66756
66757 [endsect]
66758
66759
66760 [endsect]
66761
66762
66763 [section:socket generic::raw_protocol::socket]
66764
66765 [indexterm2 boost_asio.indexterm.generic__raw_protocol.socket..socket..generic::raw_protocol] 
66766 The generic socket type. 
66767
66768
66769   typedef basic_raw_socket< raw_protocol > socket;
66770
66771
66772 [heading Types]
66773 [table
66774   [[Name][Description]]
66775
66776   [
66777
66778     [[link boost_asio.reference.basic_raw_socket__rebind_executor [*rebind_executor]]]
66779     [Rebinds the socket type to another executor. ]
66780   
66781   ]
66782
66783   [
66784
66785     [[link boost_asio.reference.basic_raw_socket.broadcast [*broadcast]]]
66786     [Socket option to permit sending of broadcast messages. ]
66787   
66788   ]
66789
66790   [
66791
66792     [[link boost_asio.reference.basic_raw_socket.bytes_readable [*bytes_readable]]]
66793     [IO control command to get the amount of data that can be read without blocking. ]
66794   
66795   ]
66796
66797   [
66798
66799     [[link boost_asio.reference.basic_raw_socket.debug [*debug]]]
66800     [Socket option to enable socket-level debugging. ]
66801   
66802   ]
66803
66804   [
66805
66806     [[link boost_asio.reference.basic_raw_socket.do_not_route [*do_not_route]]]
66807     [Socket option to prevent routing, use local interfaces only. ]
66808   
66809   ]
66810
66811   [
66812
66813     [[link boost_asio.reference.basic_raw_socket.enable_connection_aborted [*enable_connection_aborted]]]
66814     [Socket option to report aborted connections on accept. ]
66815   
66816   ]
66817
66818   [
66819
66820     [[link boost_asio.reference.basic_raw_socket.endpoint_type [*endpoint_type]]]
66821     [The endpoint type. ]
66822   
66823   ]
66824
66825   [
66826
66827     [[link boost_asio.reference.basic_raw_socket.executor_type [*executor_type]]]
66828     [The type of the executor associated with the object. ]
66829   
66830   ]
66831
66832   [
66833
66834     [[link boost_asio.reference.basic_raw_socket.keep_alive [*keep_alive]]]
66835     [Socket option to send keep-alives. ]
66836   
66837   ]
66838
66839   [
66840
66841     [[link boost_asio.reference.basic_raw_socket.linger [*linger]]]
66842     [Socket option to specify whether the socket lingers on close if unsent data is present. ]
66843   
66844   ]
66845
66846   [
66847
66848     [[link boost_asio.reference.basic_raw_socket.lowest_layer_type [*lowest_layer_type]]]
66849     [A basic_socket is always the lowest layer. ]
66850   
66851   ]
66852
66853   [
66854
66855     [[link boost_asio.reference.basic_raw_socket.message_flags [*message_flags]]]
66856     [Bitmask type for flags that can be passed to send and receive operations. ]
66857   
66858   ]
66859
66860   [
66861
66862     [[link boost_asio.reference.basic_raw_socket.native_handle_type [*native_handle_type]]]
66863     [The native representation of a socket. ]
66864   
66865   ]
66866
66867   [
66868
66869     [[link boost_asio.reference.basic_raw_socket.out_of_band_inline [*out_of_band_inline]]]
66870     [Socket option for putting received out-of-band data inline. ]
66871   
66872   ]
66873
66874   [
66875
66876     [[link boost_asio.reference.basic_raw_socket.protocol_type [*protocol_type]]]
66877     [The protocol type. ]
66878   
66879   ]
66880
66881   [
66882
66883     [[link boost_asio.reference.basic_raw_socket.receive_buffer_size [*receive_buffer_size]]]
66884     [Socket option for the receive buffer size of a socket. ]
66885   
66886   ]
66887
66888   [
66889
66890     [[link boost_asio.reference.basic_raw_socket.receive_low_watermark [*receive_low_watermark]]]
66891     [Socket option for the receive low watermark. ]
66892   
66893   ]
66894
66895   [
66896
66897     [[link boost_asio.reference.basic_raw_socket.reuse_address [*reuse_address]]]
66898     [Socket option to allow the socket to be bound to an address that is already in use. ]
66899   
66900   ]
66901
66902   [
66903
66904     [[link boost_asio.reference.basic_raw_socket.send_buffer_size [*send_buffer_size]]]
66905     [Socket option for the send buffer size of a socket. ]
66906   
66907   ]
66908
66909   [
66910
66911     [[link boost_asio.reference.basic_raw_socket.send_low_watermark [*send_low_watermark]]]
66912     [Socket option for the send low watermark. ]
66913   
66914   ]
66915
66916   [
66917
66918     [[link boost_asio.reference.basic_raw_socket.shutdown_type [*shutdown_type]]]
66919     [Different ways a socket may be shutdown. ]
66920   
66921   ]
66922
66923   [
66924
66925     [[link boost_asio.reference.basic_raw_socket.wait_type [*wait_type]]]
66926     [Wait types. ]
66927   
66928   ]
66929
66930 ]
66931
66932 [heading Member Functions]
66933 [table
66934   [[Name][Description]]
66935
66936   [
66937     [[link boost_asio.reference.basic_raw_socket.assign [*assign]]]
66938     [Assign an existing native socket to the socket. ]
66939   ]
66940   
66941   [
66942     [[link boost_asio.reference.basic_raw_socket.async_connect [*async_connect]]]
66943     [Start an asynchronous connect. ]
66944   ]
66945   
66946   [
66947     [[link boost_asio.reference.basic_raw_socket.async_receive [*async_receive]]]
66948     [Start an asynchronous receive on a connected socket. ]
66949   ]
66950   
66951   [
66952     [[link boost_asio.reference.basic_raw_socket.async_receive_from [*async_receive_from]]]
66953     [Start an asynchronous receive. ]
66954   ]
66955   
66956   [
66957     [[link boost_asio.reference.basic_raw_socket.async_send [*async_send]]]
66958     [Start an asynchronous send on a connected socket. ]
66959   ]
66960   
66961   [
66962     [[link boost_asio.reference.basic_raw_socket.async_send_to [*async_send_to]]]
66963     [Start an asynchronous send. ]
66964   ]
66965   
66966   [
66967     [[link boost_asio.reference.basic_raw_socket.async_wait [*async_wait]]]
66968     [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
66969   ]
66970   
66971   [
66972     [[link boost_asio.reference.basic_raw_socket.at_mark [*at_mark]]]
66973     [Determine whether the socket is at the out-of-band data mark. ]
66974   ]
66975   
66976   [
66977     [[link boost_asio.reference.basic_raw_socket.available [*available]]]
66978     [Determine the number of bytes available for reading. ]
66979   ]
66980   
66981   [
66982     [[link boost_asio.reference.basic_raw_socket.basic_raw_socket [*basic_raw_socket]]]
66983     [Construct a basic_raw_socket without opening it. 
66984      [hr]
66985      Construct and open a basic_raw_socket. 
66986      [hr]
66987      Construct a basic_raw_socket, opening it and binding it to the given local endpoint. 
66988      [hr]
66989      Construct a basic_raw_socket on an existing native socket. 
66990      [hr]
66991      Move-construct a basic_raw_socket from another. 
66992      [hr]
66993      Move-construct a basic_raw_socket from a socket of another protocol type. ]
66994   ]
66995   
66996   [
66997     [[link boost_asio.reference.basic_raw_socket.bind [*bind]]]
66998     [Bind the socket to the given local endpoint. ]
66999   ]
67000   
67001   [
67002     [[link boost_asio.reference.basic_raw_socket.cancel [*cancel]]]
67003     [Cancel all asynchronous operations associated with the socket. ]
67004   ]
67005   
67006   [
67007     [[link boost_asio.reference.basic_raw_socket.close [*close]]]
67008     [Close the socket. ]
67009   ]
67010   
67011   [
67012     [[link boost_asio.reference.basic_raw_socket.connect [*connect]]]
67013     [Connect the socket to the specified endpoint. ]
67014   ]
67015   
67016   [
67017     [[link boost_asio.reference.basic_raw_socket.get_executor [*get_executor]]]
67018     [Get the executor associated with the object. ]
67019   ]
67020   
67021   [
67022     [[link boost_asio.reference.basic_raw_socket.get_option [*get_option]]]
67023     [Get an option from the socket. ]
67024   ]
67025   
67026   [
67027     [[link boost_asio.reference.basic_raw_socket.io_control [*io_control]]]
67028     [Perform an IO control command on the socket. ]
67029   ]
67030   
67031   [
67032     [[link boost_asio.reference.basic_raw_socket.is_open [*is_open]]]
67033     [Determine whether the socket is open. ]
67034   ]
67035   
67036   [
67037     [[link boost_asio.reference.basic_raw_socket.local_endpoint [*local_endpoint]]]
67038     [Get the local endpoint of the socket. ]
67039   ]
67040   
67041   [
67042     [[link boost_asio.reference.basic_raw_socket.lowest_layer [*lowest_layer]]]
67043     [Get a reference to the lowest layer. 
67044      [hr]
67045      Get a const reference to the lowest layer. ]
67046   ]
67047   
67048   [
67049     [[link boost_asio.reference.basic_raw_socket.native_handle [*native_handle]]]
67050     [Get the native socket representation. ]
67051   ]
67052   
67053   [
67054     [[link boost_asio.reference.basic_raw_socket.native_non_blocking [*native_non_blocking]]]
67055     [Gets the non-blocking mode of the native socket implementation. 
67056      [hr]
67057      Sets the non-blocking mode of the native socket implementation. ]
67058   ]
67059   
67060   [
67061     [[link boost_asio.reference.basic_raw_socket.non_blocking [*non_blocking]]]
67062     [Gets the non-blocking mode of the socket. 
67063      [hr]
67064      Sets the non-blocking mode of the socket. ]
67065   ]
67066   
67067   [
67068     [[link boost_asio.reference.basic_raw_socket.open [*open]]]
67069     [Open the socket using the specified protocol. ]
67070   ]
67071   
67072   [
67073     [[link boost_asio.reference.basic_raw_socket.operator_eq_ [*operator=]]]
67074     [Move-assign a basic_raw_socket from another. 
67075      [hr]
67076      Move-assign a basic_raw_socket from a socket of another protocol type. ]
67077   ]
67078   
67079   [
67080     [[link boost_asio.reference.basic_raw_socket.receive [*receive]]]
67081     [Receive some data on a connected socket. ]
67082   ]
67083   
67084   [
67085     [[link boost_asio.reference.basic_raw_socket.receive_from [*receive_from]]]
67086     [Receive raw data with the endpoint of the sender. ]
67087   ]
67088   
67089   [
67090     [[link boost_asio.reference.basic_raw_socket.release [*release]]]
67091     [Release ownership of the underlying native socket. ]
67092   ]
67093   
67094   [
67095     [[link boost_asio.reference.basic_raw_socket.remote_endpoint [*remote_endpoint]]]
67096     [Get the remote endpoint of the socket. ]
67097   ]
67098   
67099   [
67100     [[link boost_asio.reference.basic_raw_socket.send [*send]]]
67101     [Send some data on a connected socket. ]
67102   ]
67103   
67104   [
67105     [[link boost_asio.reference.basic_raw_socket.send_to [*send_to]]]
67106     [Send raw data to the specified endpoint. ]
67107   ]
67108   
67109   [
67110     [[link boost_asio.reference.basic_raw_socket.set_option [*set_option]]]
67111     [Set an option on the socket. ]
67112   ]
67113   
67114   [
67115     [[link boost_asio.reference.basic_raw_socket.shutdown [*shutdown]]]
67116     [Disable sends or receives on the socket. ]
67117   ]
67118   
67119   [
67120     [[link boost_asio.reference.basic_raw_socket.wait [*wait]]]
67121     [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
67122   ]
67123   
67124   [
67125     [[link boost_asio.reference.basic_raw_socket._basic_raw_socket [*~basic_raw_socket]]]
67126     [Destroys the socket. ]
67127   ]
67128   
67129 ]
67130
67131 [heading Data Members]
67132 [table
67133   [[Name][Description]]
67134
67135   [
67136     [[link boost_asio.reference.basic_raw_socket.max_connections [*max_connections]]]
67137     [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
67138   ]
67139
67140   [
67141     [[link boost_asio.reference.basic_raw_socket.max_listen_connections [*max_listen_connections]]]
67142     [The maximum length of the queue of pending incoming connections. ]
67143   ]
67144
67145   [
67146     [[link boost_asio.reference.basic_raw_socket.message_do_not_route [*message_do_not_route]]]
67147     [Specify that the data should not be subject to routing. ]
67148   ]
67149
67150   [
67151     [[link boost_asio.reference.basic_raw_socket.message_end_of_record [*message_end_of_record]]]
67152     [Specifies that the data marks the end of a record. ]
67153   ]
67154
67155   [
67156     [[link boost_asio.reference.basic_raw_socket.message_out_of_band [*message_out_of_band]]]
67157     [Process out-of-band data. ]
67158   ]
67159
67160   [
67161     [[link boost_asio.reference.basic_raw_socket.message_peek [*message_peek]]]
67162     [Peek at incoming data without removing it from the input queue. ]
67163   ]
67164
67165 ]
67166
67167 [heading Protected Data Members]
67168 [table
67169   [[Name][Description]]
67170
67171   [
67172     [[link boost_asio.reference.basic_raw_socket.impl_ [*impl_]]]
67173     []
67174   ]
67175
67176 ]
67177
67178 The [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] class template provides asynchronous and blocking raw-oriented socket functionality.
67179
67180
67181 [heading Thread Safety]
67182   
67183 ['Distinct] ['objects:] Safe.
67184
67185 ['Shared] ['objects:] Unsafe. 
67186
67187
67188
67189
67190 [heading Requirements]
67191
67192 ['Header: ][^boost/asio/generic/raw_protocol.hpp]
67193
67194 ['Convenience header: ][^boost/asio.hpp]
67195
67196
67197 [endsect]
67198
67199
67200
67201 [section:type generic::raw_protocol::type]
67202
67203 [indexterm2 boost_asio.indexterm.generic__raw_protocol.type..type..generic::raw_protocol] 
67204 Obtain an identifier for the type of the protocol. 
67205
67206
67207   int type() const;
67208
67209
67210
67211 [endsect]
67212
67213
67214
67215 [endsect]
67216
67217 [section:generic__seq_packet_protocol generic::seq_packet_protocol]
67218
67219
67220 Encapsulates the flags needed for a generic sequenced packet socket. 
67221
67222
67223   class seq_packet_protocol
67224
67225
67226 [heading Types]
67227 [table
67228   [[Name][Description]]
67229
67230   [
67231
67232     [[link boost_asio.reference.generic__seq_packet_protocol.endpoint [*endpoint]]]
67233     [The type of an endpoint. ]
67234   
67235   ]
67236
67237   [
67238
67239     [[link boost_asio.reference.generic__seq_packet_protocol.socket [*socket]]]
67240     [The generic socket type. ]
67241   
67242   ]
67243
67244 ]
67245
67246 [heading Member Functions]
67247 [table
67248   [[Name][Description]]
67249
67250   [
67251     [[link boost_asio.reference.generic__seq_packet_protocol.family [*family]]]
67252     [Obtain an identifier for the protocol family. ]
67253   ]
67254   
67255   [
67256     [[link boost_asio.reference.generic__seq_packet_protocol.protocol [*protocol]]]
67257     [Obtain an identifier for the protocol. ]
67258   ]
67259   
67260   [
67261     [[link boost_asio.reference.generic__seq_packet_protocol.seq_packet_protocol [*seq_packet_protocol]]]
67262     [Construct a protocol object for a specific address family and protocol. 
67263      [hr]
67264      Construct a generic protocol object from a specific protocol. ]
67265   ]
67266   
67267   [
67268     [[link boost_asio.reference.generic__seq_packet_protocol.type [*type]]]
67269     [Obtain an identifier for the type of the protocol. ]
67270   ]
67271   
67272 ]
67273
67274 [heading Friends]
67275 [table
67276   [[Name][Description]]
67277
67278   [
67279     [[link boost_asio.reference.generic__seq_packet_protocol.operator_not__eq_ [*operator!=]]]
67280     [Compare two protocols for inequality. ]
67281   ]
67282   
67283   [
67284     [[link boost_asio.reference.generic__seq_packet_protocol.operator_eq__eq_ [*operator==]]]
67285     [Compare two protocols for equality. ]
67286   ]
67287   
67288 ]
67289
67290 The [link boost_asio.reference.generic__seq_packet_protocol `generic::seq_packet_protocol`] class contains flags necessary for seq\_packet-oriented sockets of any address family and protocol.
67291
67292
67293 [heading Examples]
67294   
67295 Constructing using a native address family and socket protocol: 
67296
67297    seq_packet_protocol p(AF_INET, IPPROTO_SCTP); 
67298
67299
67300
67301
67302
67303 [heading Thread Safety]
67304   
67305 ['Distinct] ['objects:] Safe.
67306
67307 ['Shared] ['objects:] Safe.
67308
67309
67310
67311
67312 [heading Requirements]
67313
67314 ['Header: ][^boost/asio/generic/seq_packet_protocol.hpp]
67315
67316 ['Convenience header: ][^boost/asio.hpp]
67317
67318
67319 [section:endpoint generic::seq_packet_protocol::endpoint]
67320
67321 [indexterm2 boost_asio.indexterm.generic__seq_packet_protocol.endpoint..endpoint..generic::seq_packet_protocol] 
67322 The type of an endpoint. 
67323
67324
67325   typedef basic_endpoint< seq_packet_protocol > endpoint;
67326
67327
67328 [heading Types]
67329 [table
67330   [[Name][Description]]
67331
67332   [
67333
67334     [[link boost_asio.reference.generic__basic_endpoint.data_type [*data_type]]]
67335     [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
67336   
67337   ]
67338
67339   [
67340
67341     [[link boost_asio.reference.generic__basic_endpoint.protocol_type [*protocol_type]]]
67342     [The protocol type associated with the endpoint. ]
67343   
67344   ]
67345
67346 ]
67347
67348 [heading Member Functions]
67349 [table
67350   [[Name][Description]]
67351
67352   [
67353     [[link boost_asio.reference.generic__basic_endpoint.basic_endpoint [*basic_endpoint]]]
67354     [Default constructor. 
67355      [hr]
67356      Construct an endpoint from the specified socket address. 
67357      [hr]
67358      Construct an endpoint from the specific endpoint type. 
67359      [hr]
67360      Copy constructor. ]
67361   ]
67362   
67363   [
67364     [[link boost_asio.reference.generic__basic_endpoint.capacity [*capacity]]]
67365     [Get the capacity of the endpoint in the native type. ]
67366   ]
67367   
67368   [
67369     [[link boost_asio.reference.generic__basic_endpoint.data [*data]]]
67370     [Get the underlying endpoint in the native type. ]
67371   ]
67372   
67373   [
67374     [[link boost_asio.reference.generic__basic_endpoint.operator_eq_ [*operator=]]]
67375     [Assign from another endpoint. ]
67376   ]
67377   
67378   [
67379     [[link boost_asio.reference.generic__basic_endpoint.protocol [*protocol]]]
67380     [The protocol associated with the endpoint. ]
67381   ]
67382   
67383   [
67384     [[link boost_asio.reference.generic__basic_endpoint.resize [*resize]]]
67385     [Set the underlying size of the endpoint in the native type. ]
67386   ]
67387   
67388   [
67389     [[link boost_asio.reference.generic__basic_endpoint.size [*size]]]
67390     [Get the underlying size of the endpoint in the native type. ]
67391   ]
67392   
67393 ]
67394
67395 [heading Friends]
67396 [table
67397   [[Name][Description]]
67398
67399   [
67400     [[link boost_asio.reference.generic__basic_endpoint.operator_not__eq_ [*operator!=]]]
67401     [Compare two endpoints for inequality. ]
67402   ]
67403   
67404   [
67405     [[link boost_asio.reference.generic__basic_endpoint.operator_lt_ [*operator<]]]
67406     [Compare endpoints for ordering. ]
67407   ]
67408   
67409   [
67410     [[link boost_asio.reference.generic__basic_endpoint.operator_lt__eq_ [*operator<=]]]
67411     [Compare endpoints for ordering. ]
67412   ]
67413   
67414   [
67415     [[link boost_asio.reference.generic__basic_endpoint.operator_eq__eq_ [*operator==]]]
67416     [Compare two endpoints for equality. ]
67417   ]
67418   
67419   [
67420     [[link boost_asio.reference.generic__basic_endpoint.operator_gt_ [*operator>]]]
67421     [Compare endpoints for ordering. ]
67422   ]
67423   
67424   [
67425     [[link boost_asio.reference.generic__basic_endpoint.operator_gt__eq_ [*operator>=]]]
67426     [Compare endpoints for ordering. ]
67427   ]
67428   
67429 ]
67430
67431 The [link boost_asio.reference.generic__basic_endpoint `generic::basic_endpoint`] class template describes an endpoint that may be associated with any socket type.
67432
67433
67434 [heading Remarks]
67435       
67436 The socket types sockaddr type must be able to fit into a `sockaddr_storage` structure.
67437
67438
67439 [heading Thread Safety]
67440   
67441 ['Distinct] ['objects:] Safe.
67442
67443 ['Shared] ['objects:] Unsafe.
67444
67445
67446
67447
67448
67449 [heading Requirements]
67450
67451 ['Header: ][^boost/asio/generic/seq_packet_protocol.hpp]
67452
67453 ['Convenience header: ][^boost/asio.hpp]
67454
67455
67456 [endsect]
67457
67458
67459
67460 [section:family generic::seq_packet_protocol::family]
67461
67462 [indexterm2 boost_asio.indexterm.generic__seq_packet_protocol.family..family..generic::seq_packet_protocol] 
67463 Obtain an identifier for the protocol family. 
67464
67465
67466   int family() const;
67467
67468
67469
67470 [endsect]
67471
67472
67473
67474 [section:operator_not__eq_ generic::seq_packet_protocol::operator!=]
67475
67476 [indexterm2 boost_asio.indexterm.generic__seq_packet_protocol.operator_not__eq_..operator!=..generic::seq_packet_protocol] 
67477 Compare two protocols for inequality. 
67478
67479
67480   friend bool operator!=(
67481       const seq_packet_protocol & p1,
67482       const seq_packet_protocol & p2);
67483
67484
67485 [heading Requirements]
67486
67487 ['Header: ][^boost/asio/generic/seq_packet_protocol.hpp]
67488
67489 ['Convenience header: ][^boost/asio.hpp]
67490
67491
67492 [endsect]
67493
67494
67495
67496 [section:operator_eq__eq_ generic::seq_packet_protocol::operator==]
67497
67498 [indexterm2 boost_asio.indexterm.generic__seq_packet_protocol.operator_eq__eq_..operator==..generic::seq_packet_protocol] 
67499 Compare two protocols for equality. 
67500
67501
67502   friend bool operator==(
67503       const seq_packet_protocol & p1,
67504       const seq_packet_protocol & p2);
67505
67506
67507 [heading Requirements]
67508
67509 ['Header: ][^boost/asio/generic/seq_packet_protocol.hpp]
67510
67511 ['Convenience header: ][^boost/asio.hpp]
67512
67513
67514 [endsect]
67515
67516
67517
67518 [section:protocol generic::seq_packet_protocol::protocol]
67519
67520 [indexterm2 boost_asio.indexterm.generic__seq_packet_protocol.protocol..protocol..generic::seq_packet_protocol] 
67521 Obtain an identifier for the protocol. 
67522
67523
67524   int protocol() const;
67525
67526
67527
67528 [endsect]
67529
67530
67531 [section:seq_packet_protocol generic::seq_packet_protocol::seq_packet_protocol]
67532
67533 [indexterm2 boost_asio.indexterm.generic__seq_packet_protocol.seq_packet_protocol..seq_packet_protocol..generic::seq_packet_protocol] 
67534 Construct a protocol object for a specific address family and protocol. 
67535
67536
67537   ``[link boost_asio.reference.generic__seq_packet_protocol.seq_packet_protocol.overload1 seq_packet_protocol]``(
67538       int address_family,
67539       int socket_protocol);
67540   ``  [''''&raquo;''' [link boost_asio.reference.generic__seq_packet_protocol.seq_packet_protocol.overload1 more...]]``
67541
67542
67543 Construct a generic protocol object from a specific protocol. 
67544
67545
67546   template<
67547       typename ``[link boost_asio.reference.Protocol Protocol]``>
67548   ``[link boost_asio.reference.generic__seq_packet_protocol.seq_packet_protocol.overload2 seq_packet_protocol]``(
67549       const Protocol & source_protocol);
67550   ``  [''''&raquo;''' [link boost_asio.reference.generic__seq_packet_protocol.seq_packet_protocol.overload2 more...]]``
67551
67552
67553 [section:overload1 generic::seq_packet_protocol::seq_packet_protocol (1 of 2 overloads)]
67554
67555
67556 Construct a protocol object for a specific address family and protocol. 
67557
67558
67559   seq_packet_protocol(
67560       int address_family,
67561       int socket_protocol);
67562
67563
67564
67565 [endsect]
67566
67567
67568
67569 [section:overload2 generic::seq_packet_protocol::seq_packet_protocol (2 of 2 overloads)]
67570
67571
67572 Construct a generic protocol object from a specific protocol. 
67573
67574
67575   template<
67576       typename ``[link boost_asio.reference.Protocol Protocol]``>
67577   seq_packet_protocol(
67578       const Protocol & source_protocol);
67579
67580
67581
67582 [heading Exceptions]
67583     
67584
67585 [variablelist
67586   
67587 [[@c][bad\_cast Thrown if the source protocol is not based around sequenced packets. ]]
67588
67589 ]
67590
67591
67592
67593
67594 [endsect]
67595
67596
67597 [endsect]
67598
67599
67600 [section:socket generic::seq_packet_protocol::socket]
67601
67602 [indexterm2 boost_asio.indexterm.generic__seq_packet_protocol.socket..socket..generic::seq_packet_protocol] 
67603 The generic socket type. 
67604
67605
67606   typedef basic_seq_packet_socket< seq_packet_protocol > socket;
67607
67608
67609 [heading Types]
67610 [table
67611   [[Name][Description]]
67612
67613   [
67614
67615     [[link boost_asio.reference.basic_seq_packet_socket__rebind_executor [*rebind_executor]]]
67616     [Rebinds the socket type to another executor. ]
67617   
67618   ]
67619
67620   [
67621
67622     [[link boost_asio.reference.basic_seq_packet_socket.broadcast [*broadcast]]]
67623     [Socket option to permit sending of broadcast messages. ]
67624   
67625   ]
67626
67627   [
67628
67629     [[link boost_asio.reference.basic_seq_packet_socket.bytes_readable [*bytes_readable]]]
67630     [IO control command to get the amount of data that can be read without blocking. ]
67631   
67632   ]
67633
67634   [
67635
67636     [[link boost_asio.reference.basic_seq_packet_socket.debug [*debug]]]
67637     [Socket option to enable socket-level debugging. ]
67638   
67639   ]
67640
67641   [
67642
67643     [[link boost_asio.reference.basic_seq_packet_socket.do_not_route [*do_not_route]]]
67644     [Socket option to prevent routing, use local interfaces only. ]
67645   
67646   ]
67647
67648   [
67649
67650     [[link boost_asio.reference.basic_seq_packet_socket.enable_connection_aborted [*enable_connection_aborted]]]
67651     [Socket option to report aborted connections on accept. ]
67652   
67653   ]
67654
67655   [
67656
67657     [[link boost_asio.reference.basic_seq_packet_socket.endpoint_type [*endpoint_type]]]
67658     [The endpoint type. ]
67659   
67660   ]
67661
67662   [
67663
67664     [[link boost_asio.reference.basic_seq_packet_socket.executor_type [*executor_type]]]
67665     [The type of the executor associated with the object. ]
67666   
67667   ]
67668
67669   [
67670
67671     [[link boost_asio.reference.basic_seq_packet_socket.keep_alive [*keep_alive]]]
67672     [Socket option to send keep-alives. ]
67673   
67674   ]
67675
67676   [
67677
67678     [[link boost_asio.reference.basic_seq_packet_socket.linger [*linger]]]
67679     [Socket option to specify whether the socket lingers on close if unsent data is present. ]
67680   
67681   ]
67682
67683   [
67684
67685     [[link boost_asio.reference.basic_seq_packet_socket.lowest_layer_type [*lowest_layer_type]]]
67686     [A basic_socket is always the lowest layer. ]
67687   
67688   ]
67689
67690   [
67691
67692     [[link boost_asio.reference.basic_seq_packet_socket.message_flags [*message_flags]]]
67693     [Bitmask type for flags that can be passed to send and receive operations. ]
67694   
67695   ]
67696
67697   [
67698
67699     [[link boost_asio.reference.basic_seq_packet_socket.native_handle_type [*native_handle_type]]]
67700     [The native representation of a socket. ]
67701   
67702   ]
67703
67704   [
67705
67706     [[link boost_asio.reference.basic_seq_packet_socket.out_of_band_inline [*out_of_band_inline]]]
67707     [Socket option for putting received out-of-band data inline. ]
67708   
67709   ]
67710
67711   [
67712
67713     [[link boost_asio.reference.basic_seq_packet_socket.protocol_type [*protocol_type]]]
67714     [The protocol type. ]
67715   
67716   ]
67717
67718   [
67719
67720     [[link boost_asio.reference.basic_seq_packet_socket.receive_buffer_size [*receive_buffer_size]]]
67721     [Socket option for the receive buffer size of a socket. ]
67722   
67723   ]
67724
67725   [
67726
67727     [[link boost_asio.reference.basic_seq_packet_socket.receive_low_watermark [*receive_low_watermark]]]
67728     [Socket option for the receive low watermark. ]
67729   
67730   ]
67731
67732   [
67733
67734     [[link boost_asio.reference.basic_seq_packet_socket.reuse_address [*reuse_address]]]
67735     [Socket option to allow the socket to be bound to an address that is already in use. ]
67736   
67737   ]
67738
67739   [
67740
67741     [[link boost_asio.reference.basic_seq_packet_socket.send_buffer_size [*send_buffer_size]]]
67742     [Socket option for the send buffer size of a socket. ]
67743   
67744   ]
67745
67746   [
67747
67748     [[link boost_asio.reference.basic_seq_packet_socket.send_low_watermark [*send_low_watermark]]]
67749     [Socket option for the send low watermark. ]
67750   
67751   ]
67752
67753   [
67754
67755     [[link boost_asio.reference.basic_seq_packet_socket.shutdown_type [*shutdown_type]]]
67756     [Different ways a socket may be shutdown. ]
67757   
67758   ]
67759
67760   [
67761
67762     [[link boost_asio.reference.basic_seq_packet_socket.wait_type [*wait_type]]]
67763     [Wait types. ]
67764   
67765   ]
67766
67767 ]
67768
67769 [heading Member Functions]
67770 [table
67771   [[Name][Description]]
67772
67773   [
67774     [[link boost_asio.reference.basic_seq_packet_socket.assign [*assign]]]
67775     [Assign an existing native socket to the socket. ]
67776   ]
67777   
67778   [
67779     [[link boost_asio.reference.basic_seq_packet_socket.async_connect [*async_connect]]]
67780     [Start an asynchronous connect. ]
67781   ]
67782   
67783   [
67784     [[link boost_asio.reference.basic_seq_packet_socket.async_receive [*async_receive]]]
67785     [Start an asynchronous receive. ]
67786   ]
67787   
67788   [
67789     [[link boost_asio.reference.basic_seq_packet_socket.async_send [*async_send]]]
67790     [Start an asynchronous send. ]
67791   ]
67792   
67793   [
67794     [[link boost_asio.reference.basic_seq_packet_socket.async_wait [*async_wait]]]
67795     [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
67796   ]
67797   
67798   [
67799     [[link boost_asio.reference.basic_seq_packet_socket.at_mark [*at_mark]]]
67800     [Determine whether the socket is at the out-of-band data mark. ]
67801   ]
67802   
67803   [
67804     [[link boost_asio.reference.basic_seq_packet_socket.available [*available]]]
67805     [Determine the number of bytes available for reading. ]
67806   ]
67807   
67808   [
67809     [[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket [*basic_seq_packet_socket]]]
67810     [Construct a basic_seq_packet_socket without opening it. 
67811      [hr]
67812      Construct and open a basic_seq_packet_socket. 
67813      [hr]
67814      Construct a basic_seq_packet_socket, opening it and binding it to the given local endpoint. 
67815      [hr]
67816      Construct a basic_seq_packet_socket on an existing native socket. 
67817      [hr]
67818      Move-construct a basic_seq_packet_socket from another. 
67819      [hr]
67820      Move-construct a basic_seq_packet_socket from a socket of another protocol type. ]
67821   ]
67822   
67823   [
67824     [[link boost_asio.reference.basic_seq_packet_socket.bind [*bind]]]
67825     [Bind the socket to the given local endpoint. ]
67826   ]
67827   
67828   [
67829     [[link boost_asio.reference.basic_seq_packet_socket.cancel [*cancel]]]
67830     [Cancel all asynchronous operations associated with the socket. ]
67831   ]
67832   
67833   [
67834     [[link boost_asio.reference.basic_seq_packet_socket.close [*close]]]
67835     [Close the socket. ]
67836   ]
67837   
67838   [
67839     [[link boost_asio.reference.basic_seq_packet_socket.connect [*connect]]]
67840     [Connect the socket to the specified endpoint. ]
67841   ]
67842   
67843   [
67844     [[link boost_asio.reference.basic_seq_packet_socket.get_executor [*get_executor]]]
67845     [Get the executor associated with the object. ]
67846   ]
67847   
67848   [
67849     [[link boost_asio.reference.basic_seq_packet_socket.get_option [*get_option]]]
67850     [Get an option from the socket. ]
67851   ]
67852   
67853   [
67854     [[link boost_asio.reference.basic_seq_packet_socket.io_control [*io_control]]]
67855     [Perform an IO control command on the socket. ]
67856   ]
67857   
67858   [
67859     [[link boost_asio.reference.basic_seq_packet_socket.is_open [*is_open]]]
67860     [Determine whether the socket is open. ]
67861   ]
67862   
67863   [
67864     [[link boost_asio.reference.basic_seq_packet_socket.local_endpoint [*local_endpoint]]]
67865     [Get the local endpoint of the socket. ]
67866   ]
67867   
67868   [
67869     [[link boost_asio.reference.basic_seq_packet_socket.lowest_layer [*lowest_layer]]]
67870     [Get a reference to the lowest layer. 
67871      [hr]
67872      Get a const reference to the lowest layer. ]
67873   ]
67874   
67875   [
67876     [[link boost_asio.reference.basic_seq_packet_socket.native_handle [*native_handle]]]
67877     [Get the native socket representation. ]
67878   ]
67879   
67880   [
67881     [[link boost_asio.reference.basic_seq_packet_socket.native_non_blocking [*native_non_blocking]]]
67882     [Gets the non-blocking mode of the native socket implementation. 
67883      [hr]
67884      Sets the non-blocking mode of the native socket implementation. ]
67885   ]
67886   
67887   [
67888     [[link boost_asio.reference.basic_seq_packet_socket.non_blocking [*non_blocking]]]
67889     [Gets the non-blocking mode of the socket. 
67890      [hr]
67891      Sets the non-blocking mode of the socket. ]
67892   ]
67893   
67894   [
67895     [[link boost_asio.reference.basic_seq_packet_socket.open [*open]]]
67896     [Open the socket using the specified protocol. ]
67897   ]
67898   
67899   [
67900     [[link boost_asio.reference.basic_seq_packet_socket.operator_eq_ [*operator=]]]
67901     [Move-assign a basic_seq_packet_socket from another. 
67902      [hr]
67903      Move-assign a basic_seq_packet_socket from a socket of another protocol type. ]
67904   ]
67905   
67906   [
67907     [[link boost_asio.reference.basic_seq_packet_socket.receive [*receive]]]
67908     [Receive some data on the socket. 
67909      [hr]
67910      Receive some data on a connected socket. ]
67911   ]
67912   
67913   [
67914     [[link boost_asio.reference.basic_seq_packet_socket.release [*release]]]
67915     [Release ownership of the underlying native socket. ]
67916   ]
67917   
67918   [
67919     [[link boost_asio.reference.basic_seq_packet_socket.remote_endpoint [*remote_endpoint]]]
67920     [Get the remote endpoint of the socket. ]
67921   ]
67922   
67923   [
67924     [[link boost_asio.reference.basic_seq_packet_socket.send [*send]]]
67925     [Send some data on the socket. ]
67926   ]
67927   
67928   [
67929     [[link boost_asio.reference.basic_seq_packet_socket.set_option [*set_option]]]
67930     [Set an option on the socket. ]
67931   ]
67932   
67933   [
67934     [[link boost_asio.reference.basic_seq_packet_socket.shutdown [*shutdown]]]
67935     [Disable sends or receives on the socket. ]
67936   ]
67937   
67938   [
67939     [[link boost_asio.reference.basic_seq_packet_socket.wait [*wait]]]
67940     [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
67941   ]
67942   
67943   [
67944     [[link boost_asio.reference.basic_seq_packet_socket._basic_seq_packet_socket [*~basic_seq_packet_socket]]]
67945     [Destroys the socket. ]
67946   ]
67947   
67948 ]
67949
67950 [heading Data Members]
67951 [table
67952   [[Name][Description]]
67953
67954   [
67955     [[link boost_asio.reference.basic_seq_packet_socket.max_connections [*max_connections]]]
67956     [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
67957   ]
67958
67959   [
67960     [[link boost_asio.reference.basic_seq_packet_socket.max_listen_connections [*max_listen_connections]]]
67961     [The maximum length of the queue of pending incoming connections. ]
67962   ]
67963
67964   [
67965     [[link boost_asio.reference.basic_seq_packet_socket.message_do_not_route [*message_do_not_route]]]
67966     [Specify that the data should not be subject to routing. ]
67967   ]
67968
67969   [
67970     [[link boost_asio.reference.basic_seq_packet_socket.message_end_of_record [*message_end_of_record]]]
67971     [Specifies that the data marks the end of a record. ]
67972   ]
67973
67974   [
67975     [[link boost_asio.reference.basic_seq_packet_socket.message_out_of_band [*message_out_of_band]]]
67976     [Process out-of-band data. ]
67977   ]
67978
67979   [
67980     [[link boost_asio.reference.basic_seq_packet_socket.message_peek [*message_peek]]]
67981     [Peek at incoming data without removing it from the input queue. ]
67982   ]
67983
67984 ]
67985
67986 [heading Protected Data Members]
67987 [table
67988   [[Name][Description]]
67989
67990   [
67991     [[link boost_asio.reference.basic_seq_packet_socket.impl_ [*impl_]]]
67992     []
67993   ]
67994
67995 ]
67996
67997 The [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] class template provides asynchronous and blocking sequenced packet socket functionality.
67998
67999
68000 [heading Thread Safety]
68001   
68002 ['Distinct] ['objects:] Safe.
68003
68004 ['Shared] ['objects:] Unsafe. 
68005
68006
68007
68008
68009 [heading Requirements]
68010
68011 ['Header: ][^boost/asio/generic/seq_packet_protocol.hpp]
68012
68013 ['Convenience header: ][^boost/asio.hpp]
68014
68015
68016 [endsect]
68017
68018
68019
68020 [section:type generic::seq_packet_protocol::type]
68021
68022 [indexterm2 boost_asio.indexterm.generic__seq_packet_protocol.type..type..generic::seq_packet_protocol] 
68023 Obtain an identifier for the type of the protocol. 
68024
68025
68026   int type() const;
68027
68028
68029
68030 [endsect]
68031
68032
68033
68034 [endsect]
68035
68036 [section:generic__stream_protocol generic::stream_protocol]
68037
68038
68039 Encapsulates the flags needed for a generic stream-oriented socket. 
68040
68041
68042   class stream_protocol
68043
68044
68045 [heading Types]
68046 [table
68047   [[Name][Description]]
68048
68049   [
68050
68051     [[link boost_asio.reference.generic__stream_protocol.endpoint [*endpoint]]]
68052     [The type of an endpoint. ]
68053   
68054   ]
68055
68056   [
68057
68058     [[link boost_asio.reference.generic__stream_protocol.iostream [*iostream]]]
68059     [The generic socket iostream type. ]
68060   
68061   ]
68062
68063   [
68064
68065     [[link boost_asio.reference.generic__stream_protocol.socket [*socket]]]
68066     [The generic socket type. ]
68067   
68068   ]
68069
68070 ]
68071
68072 [heading Member Functions]
68073 [table
68074   [[Name][Description]]
68075
68076   [
68077     [[link boost_asio.reference.generic__stream_protocol.family [*family]]]
68078     [Obtain an identifier for the protocol family. ]
68079   ]
68080   
68081   [
68082     [[link boost_asio.reference.generic__stream_protocol.protocol [*protocol]]]
68083     [Obtain an identifier for the protocol. ]
68084   ]
68085   
68086   [
68087     [[link boost_asio.reference.generic__stream_protocol.stream_protocol [*stream_protocol]]]
68088     [Construct a protocol object for a specific address family and protocol. 
68089      [hr]
68090      Construct a generic protocol object from a specific protocol. ]
68091   ]
68092   
68093   [
68094     [[link boost_asio.reference.generic__stream_protocol.type [*type]]]
68095     [Obtain an identifier for the type of the protocol. ]
68096   ]
68097   
68098 ]
68099
68100 [heading Friends]
68101 [table
68102   [[Name][Description]]
68103
68104   [
68105     [[link boost_asio.reference.generic__stream_protocol.operator_not__eq_ [*operator!=]]]
68106     [Compare two protocols for inequality. ]
68107   ]
68108   
68109   [
68110     [[link boost_asio.reference.generic__stream_protocol.operator_eq__eq_ [*operator==]]]
68111     [Compare two protocols for equality. ]
68112   ]
68113   
68114 ]
68115
68116 The [link boost_asio.reference.generic__stream_protocol `generic::stream_protocol`] class contains flags necessary for stream-oriented sockets of any address family and protocol.
68117
68118
68119 [heading Examples]
68120   
68121 Constructing using a native address family and socket protocol: 
68122
68123    stream_protocol p(AF_INET, IPPROTO_TCP); 
68124
68125
68126 Constructing from a specific protocol type: 
68127
68128    stream_protocol p(boost::asio::ip::tcp::v4()); 
68129
68130
68131
68132
68133
68134 [heading Thread Safety]
68135   
68136 ['Distinct] ['objects:] Safe.
68137
68138 ['Shared] ['objects:] Safe.
68139
68140
68141
68142
68143 [heading Requirements]
68144
68145 ['Header: ][^boost/asio/generic/stream_protocol.hpp]
68146
68147 ['Convenience header: ][^boost/asio.hpp]
68148
68149
68150 [section:endpoint generic::stream_protocol::endpoint]
68151
68152 [indexterm2 boost_asio.indexterm.generic__stream_protocol.endpoint..endpoint..generic::stream_protocol] 
68153 The type of an endpoint. 
68154
68155
68156   typedef basic_endpoint< stream_protocol > endpoint;
68157
68158
68159 [heading Types]
68160 [table
68161   [[Name][Description]]
68162
68163   [
68164
68165     [[link boost_asio.reference.generic__basic_endpoint.data_type [*data_type]]]
68166     [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
68167   
68168   ]
68169
68170   [
68171
68172     [[link boost_asio.reference.generic__basic_endpoint.protocol_type [*protocol_type]]]
68173     [The protocol type associated with the endpoint. ]
68174   
68175   ]
68176
68177 ]
68178
68179 [heading Member Functions]
68180 [table
68181   [[Name][Description]]
68182
68183   [
68184     [[link boost_asio.reference.generic__basic_endpoint.basic_endpoint [*basic_endpoint]]]
68185     [Default constructor. 
68186      [hr]
68187      Construct an endpoint from the specified socket address. 
68188      [hr]
68189      Construct an endpoint from the specific endpoint type. 
68190      [hr]
68191      Copy constructor. ]
68192   ]
68193   
68194   [
68195     [[link boost_asio.reference.generic__basic_endpoint.capacity [*capacity]]]
68196     [Get the capacity of the endpoint in the native type. ]
68197   ]
68198   
68199   [
68200     [[link boost_asio.reference.generic__basic_endpoint.data [*data]]]
68201     [Get the underlying endpoint in the native type. ]
68202   ]
68203   
68204   [
68205     [[link boost_asio.reference.generic__basic_endpoint.operator_eq_ [*operator=]]]
68206     [Assign from another endpoint. ]
68207   ]
68208   
68209   [
68210     [[link boost_asio.reference.generic__basic_endpoint.protocol [*protocol]]]
68211     [The protocol associated with the endpoint. ]
68212   ]
68213   
68214   [
68215     [[link boost_asio.reference.generic__basic_endpoint.resize [*resize]]]
68216     [Set the underlying size of the endpoint in the native type. ]
68217   ]
68218   
68219   [
68220     [[link boost_asio.reference.generic__basic_endpoint.size [*size]]]
68221     [Get the underlying size of the endpoint in the native type. ]
68222   ]
68223   
68224 ]
68225
68226 [heading Friends]
68227 [table
68228   [[Name][Description]]
68229
68230   [
68231     [[link boost_asio.reference.generic__basic_endpoint.operator_not__eq_ [*operator!=]]]
68232     [Compare two endpoints for inequality. ]
68233   ]
68234   
68235   [
68236     [[link boost_asio.reference.generic__basic_endpoint.operator_lt_ [*operator<]]]
68237     [Compare endpoints for ordering. ]
68238   ]
68239   
68240   [
68241     [[link boost_asio.reference.generic__basic_endpoint.operator_lt__eq_ [*operator<=]]]
68242     [Compare endpoints for ordering. ]
68243   ]
68244   
68245   [
68246     [[link boost_asio.reference.generic__basic_endpoint.operator_eq__eq_ [*operator==]]]
68247     [Compare two endpoints for equality. ]
68248   ]
68249   
68250   [
68251     [[link boost_asio.reference.generic__basic_endpoint.operator_gt_ [*operator>]]]
68252     [Compare endpoints for ordering. ]
68253   ]
68254   
68255   [
68256     [[link boost_asio.reference.generic__basic_endpoint.operator_gt__eq_ [*operator>=]]]
68257     [Compare endpoints for ordering. ]
68258   ]
68259   
68260 ]
68261
68262 The [link boost_asio.reference.generic__basic_endpoint `generic::basic_endpoint`] class template describes an endpoint that may be associated with any socket type.
68263
68264
68265 [heading Remarks]
68266       
68267 The socket types sockaddr type must be able to fit into a `sockaddr_storage` structure.
68268
68269
68270 [heading Thread Safety]
68271   
68272 ['Distinct] ['objects:] Safe.
68273
68274 ['Shared] ['objects:] Unsafe.
68275
68276
68277
68278
68279
68280 [heading Requirements]
68281
68282 ['Header: ][^boost/asio/generic/stream_protocol.hpp]
68283
68284 ['Convenience header: ][^boost/asio.hpp]
68285
68286
68287 [endsect]
68288
68289
68290
68291 [section:family generic::stream_protocol::family]
68292
68293 [indexterm2 boost_asio.indexterm.generic__stream_protocol.family..family..generic::stream_protocol] 
68294 Obtain an identifier for the protocol family. 
68295
68296
68297   int family() const;
68298
68299
68300
68301 [endsect]
68302
68303
68304
68305 [section:iostream generic::stream_protocol::iostream]
68306
68307 [indexterm2 boost_asio.indexterm.generic__stream_protocol.iostream..iostream..generic::stream_protocol] 
68308 The generic socket iostream type. 
68309
68310
68311   typedef basic_socket_iostream< stream_protocol > iostream;
68312
68313
68314 [heading Types]
68315 [table
68316   [[Name][Description]]
68317
68318   [
68319
68320     [[link boost_asio.reference.basic_socket_iostream.clock_type [*clock_type]]]
68321     [The clock type. ]
68322   
68323   ]
68324
68325   [
68326
68327     [[link boost_asio.reference.basic_socket_iostream.duration [*duration]]]
68328     [The duration type. ]
68329   
68330   ]
68331
68332   [
68333
68334     [[link boost_asio.reference.basic_socket_iostream.duration_type [*duration_type]]]
68335     [(Deprecated: Use duration.) The duration type. ]
68336   
68337   ]
68338
68339   [
68340
68341     [[link boost_asio.reference.basic_socket_iostream.endpoint_type [*endpoint_type]]]
68342     [The endpoint type. ]
68343   
68344   ]
68345
68346   [
68347
68348     [[link boost_asio.reference.basic_socket_iostream.protocol_type [*protocol_type]]]
68349     [The protocol type. ]
68350   
68351   ]
68352
68353   [
68354
68355     [[link boost_asio.reference.basic_socket_iostream.time_point [*time_point]]]
68356     [The time type. ]
68357   
68358   ]
68359
68360   [
68361
68362     [[link boost_asio.reference.basic_socket_iostream.time_type [*time_type]]]
68363     [(Deprecated: Use time_point.) The time type. ]
68364   
68365   ]
68366
68367 ]
68368
68369 [heading Member Functions]
68370 [table
68371   [[Name][Description]]
68372
68373   [
68374     [[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream [*basic_socket_iostream]]]
68375     [Construct a basic_socket_iostream without establishing a connection. 
68376      [hr]
68377      Construct a basic_socket_iostream from the supplied socket. 
68378      [hr]
68379      Move-construct a basic_socket_iostream from another. 
68380      [hr]
68381      Establish a connection to an endpoint corresponding to a resolver query. ]
68382   ]
68383   
68384   [
68385     [[link boost_asio.reference.basic_socket_iostream.close [*close]]]
68386     [Close the connection. ]
68387   ]
68388   
68389   [
68390     [[link boost_asio.reference.basic_socket_iostream.connect [*connect]]]
68391     [Establish a connection to an endpoint corresponding to a resolver query. ]
68392   ]
68393   
68394   [
68395     [[link boost_asio.reference.basic_socket_iostream.error [*error]]]
68396     [Get the last error associated with the stream. ]
68397   ]
68398   
68399   [
68400     [[link boost_asio.reference.basic_socket_iostream.expires_after [*expires_after]]]
68401     [Set the stream's expiry time relative to now. ]
68402   ]
68403   
68404   [
68405     [[link boost_asio.reference.basic_socket_iostream.expires_at [*expires_at]]]
68406     [(Deprecated: Use expiry().) Get the stream's expiry time as an absolute time. 
68407      [hr]
68408      Set the stream's expiry time as an absolute time. ]
68409   ]
68410   
68411   [
68412     [[link boost_asio.reference.basic_socket_iostream.expires_from_now [*expires_from_now]]]
68413     [(Deprecated: Use expiry().) Get the stream's expiry time relative to now. 
68414      [hr]
68415      (Deprecated: Use expires_after().) Set the stream's expiry time relative to now. ]
68416   ]
68417   
68418   [
68419     [[link boost_asio.reference.basic_socket_iostream.expiry [*expiry]]]
68420     [Get the stream's expiry time as an absolute time. ]
68421   ]
68422   
68423   [
68424     [[link boost_asio.reference.basic_socket_iostream.operator_eq_ [*operator=]]]
68425     [Move-assign a basic_socket_iostream from another. ]
68426   ]
68427   
68428   [
68429     [[link boost_asio.reference.basic_socket_iostream.rdbuf [*rdbuf]]]
68430     [Return a pointer to the underlying streambuf. ]
68431   ]
68432   
68433   [
68434     [[link boost_asio.reference.basic_socket_iostream.socket [*socket]]]
68435     [Get a reference to the underlying socket. ]
68436   ]
68437   
68438 ]
68439
68440
68441 [heading Requirements]
68442
68443 ['Header: ][^boost/asio/generic/stream_protocol.hpp]
68444
68445 ['Convenience header: ][^boost/asio.hpp]
68446
68447
68448 [endsect]
68449
68450
68451
68452 [section:operator_not__eq_ generic::stream_protocol::operator!=]
68453
68454 [indexterm2 boost_asio.indexterm.generic__stream_protocol.operator_not__eq_..operator!=..generic::stream_protocol] 
68455 Compare two protocols for inequality. 
68456
68457
68458   friend bool operator!=(
68459       const stream_protocol & p1,
68460       const stream_protocol & p2);
68461
68462
68463 [heading Requirements]
68464
68465 ['Header: ][^boost/asio/generic/stream_protocol.hpp]
68466
68467 ['Convenience header: ][^boost/asio.hpp]
68468
68469
68470 [endsect]
68471
68472
68473
68474 [section:operator_eq__eq_ generic::stream_protocol::operator==]
68475
68476 [indexterm2 boost_asio.indexterm.generic__stream_protocol.operator_eq__eq_..operator==..generic::stream_protocol] 
68477 Compare two protocols for equality. 
68478
68479
68480   friend bool operator==(
68481       const stream_protocol & p1,
68482       const stream_protocol & p2);
68483
68484
68485 [heading Requirements]
68486
68487 ['Header: ][^boost/asio/generic/stream_protocol.hpp]
68488
68489 ['Convenience header: ][^boost/asio.hpp]
68490
68491
68492 [endsect]
68493
68494
68495
68496 [section:protocol generic::stream_protocol::protocol]
68497
68498 [indexterm2 boost_asio.indexterm.generic__stream_protocol.protocol..protocol..generic::stream_protocol] 
68499 Obtain an identifier for the protocol. 
68500
68501
68502   int protocol() const;
68503
68504
68505
68506 [endsect]
68507
68508
68509
68510 [section:socket generic::stream_protocol::socket]
68511
68512 [indexterm2 boost_asio.indexterm.generic__stream_protocol.socket..socket..generic::stream_protocol] 
68513 The generic socket type. 
68514
68515
68516   typedef basic_stream_socket< stream_protocol > socket;
68517
68518
68519 [heading Types]
68520 [table
68521   [[Name][Description]]
68522
68523   [
68524
68525     [[link boost_asio.reference.basic_stream_socket__rebind_executor [*rebind_executor]]]
68526     [Rebinds the socket type to another executor. ]
68527   
68528   ]
68529
68530   [
68531
68532     [[link boost_asio.reference.basic_stream_socket.broadcast [*broadcast]]]
68533     [Socket option to permit sending of broadcast messages. ]
68534   
68535   ]
68536
68537   [
68538
68539     [[link boost_asio.reference.basic_stream_socket.bytes_readable [*bytes_readable]]]
68540     [IO control command to get the amount of data that can be read without blocking. ]
68541   
68542   ]
68543
68544   [
68545
68546     [[link boost_asio.reference.basic_stream_socket.debug [*debug]]]
68547     [Socket option to enable socket-level debugging. ]
68548   
68549   ]
68550
68551   [
68552
68553     [[link boost_asio.reference.basic_stream_socket.do_not_route [*do_not_route]]]
68554     [Socket option to prevent routing, use local interfaces only. ]
68555   
68556   ]
68557
68558   [
68559
68560     [[link boost_asio.reference.basic_stream_socket.enable_connection_aborted [*enable_connection_aborted]]]
68561     [Socket option to report aborted connections on accept. ]
68562   
68563   ]
68564
68565   [
68566
68567     [[link boost_asio.reference.basic_stream_socket.endpoint_type [*endpoint_type]]]
68568     [The endpoint type. ]
68569   
68570   ]
68571
68572   [
68573
68574     [[link boost_asio.reference.basic_stream_socket.executor_type [*executor_type]]]
68575     [The type of the executor associated with the object. ]
68576   
68577   ]
68578
68579   [
68580
68581     [[link boost_asio.reference.basic_stream_socket.keep_alive [*keep_alive]]]
68582     [Socket option to send keep-alives. ]
68583   
68584   ]
68585
68586   [
68587
68588     [[link boost_asio.reference.basic_stream_socket.linger [*linger]]]
68589     [Socket option to specify whether the socket lingers on close if unsent data is present. ]
68590   
68591   ]
68592
68593   [
68594
68595     [[link boost_asio.reference.basic_stream_socket.lowest_layer_type [*lowest_layer_type]]]
68596     [A basic_socket is always the lowest layer. ]
68597   
68598   ]
68599
68600   [
68601
68602     [[link boost_asio.reference.basic_stream_socket.message_flags [*message_flags]]]
68603     [Bitmask type for flags that can be passed to send and receive operations. ]
68604   
68605   ]
68606
68607   [
68608
68609     [[link boost_asio.reference.basic_stream_socket.native_handle_type [*native_handle_type]]]
68610     [The native representation of a socket. ]
68611   
68612   ]
68613
68614   [
68615
68616     [[link boost_asio.reference.basic_stream_socket.out_of_band_inline [*out_of_band_inline]]]
68617     [Socket option for putting received out-of-band data inline. ]
68618   
68619   ]
68620
68621   [
68622
68623     [[link boost_asio.reference.basic_stream_socket.protocol_type [*protocol_type]]]
68624     [The protocol type. ]
68625   
68626   ]
68627
68628   [
68629
68630     [[link boost_asio.reference.basic_stream_socket.receive_buffer_size [*receive_buffer_size]]]
68631     [Socket option for the receive buffer size of a socket. ]
68632   
68633   ]
68634
68635   [
68636
68637     [[link boost_asio.reference.basic_stream_socket.receive_low_watermark [*receive_low_watermark]]]
68638     [Socket option for the receive low watermark. ]
68639   
68640   ]
68641
68642   [
68643
68644     [[link boost_asio.reference.basic_stream_socket.reuse_address [*reuse_address]]]
68645     [Socket option to allow the socket to be bound to an address that is already in use. ]
68646   
68647   ]
68648
68649   [
68650
68651     [[link boost_asio.reference.basic_stream_socket.send_buffer_size [*send_buffer_size]]]
68652     [Socket option for the send buffer size of a socket. ]
68653   
68654   ]
68655
68656   [
68657
68658     [[link boost_asio.reference.basic_stream_socket.send_low_watermark [*send_low_watermark]]]
68659     [Socket option for the send low watermark. ]
68660   
68661   ]
68662
68663   [
68664
68665     [[link boost_asio.reference.basic_stream_socket.shutdown_type [*shutdown_type]]]
68666     [Different ways a socket may be shutdown. ]
68667   
68668   ]
68669
68670   [
68671
68672     [[link boost_asio.reference.basic_stream_socket.wait_type [*wait_type]]]
68673     [Wait types. ]
68674   
68675   ]
68676
68677 ]
68678
68679 [heading Member Functions]
68680 [table
68681   [[Name][Description]]
68682
68683   [
68684     [[link boost_asio.reference.basic_stream_socket.assign [*assign]]]
68685     [Assign an existing native socket to the socket. ]
68686   ]
68687   
68688   [
68689     [[link boost_asio.reference.basic_stream_socket.async_connect [*async_connect]]]
68690     [Start an asynchronous connect. ]
68691   ]
68692   
68693   [
68694     [[link boost_asio.reference.basic_stream_socket.async_read_some [*async_read_some]]]
68695     [Start an asynchronous read. ]
68696   ]
68697   
68698   [
68699     [[link boost_asio.reference.basic_stream_socket.async_receive [*async_receive]]]
68700     [Start an asynchronous receive. ]
68701   ]
68702   
68703   [
68704     [[link boost_asio.reference.basic_stream_socket.async_send [*async_send]]]
68705     [Start an asynchronous send. ]
68706   ]
68707   
68708   [
68709     [[link boost_asio.reference.basic_stream_socket.async_wait [*async_wait]]]
68710     [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
68711   ]
68712   
68713   [
68714     [[link boost_asio.reference.basic_stream_socket.async_write_some [*async_write_some]]]
68715     [Start an asynchronous write. ]
68716   ]
68717   
68718   [
68719     [[link boost_asio.reference.basic_stream_socket.at_mark [*at_mark]]]
68720     [Determine whether the socket is at the out-of-band data mark. ]
68721   ]
68722   
68723   [
68724     [[link boost_asio.reference.basic_stream_socket.available [*available]]]
68725     [Determine the number of bytes available for reading. ]
68726   ]
68727   
68728   [
68729     [[link boost_asio.reference.basic_stream_socket.basic_stream_socket [*basic_stream_socket]]]
68730     [Construct a basic_stream_socket without opening it. 
68731      [hr]
68732      Construct and open a basic_stream_socket. 
68733      [hr]
68734      Construct a basic_stream_socket, opening it and binding it to the given local endpoint. 
68735      [hr]
68736      Construct a basic_stream_socket on an existing native socket. 
68737      [hr]
68738      Move-construct a basic_stream_socket from another. 
68739      [hr]
68740      Move-construct a basic_stream_socket from a socket of another protocol type. ]
68741   ]
68742   
68743   [
68744     [[link boost_asio.reference.basic_stream_socket.bind [*bind]]]
68745     [Bind the socket to the given local endpoint. ]
68746   ]
68747   
68748   [
68749     [[link boost_asio.reference.basic_stream_socket.cancel [*cancel]]]
68750     [Cancel all asynchronous operations associated with the socket. ]
68751   ]
68752   
68753   [
68754     [[link boost_asio.reference.basic_stream_socket.close [*close]]]
68755     [Close the socket. ]
68756   ]
68757   
68758   [
68759     [[link boost_asio.reference.basic_stream_socket.connect [*connect]]]
68760     [Connect the socket to the specified endpoint. ]
68761   ]
68762   
68763   [
68764     [[link boost_asio.reference.basic_stream_socket.get_executor [*get_executor]]]
68765     [Get the executor associated with the object. ]
68766   ]
68767   
68768   [
68769     [[link boost_asio.reference.basic_stream_socket.get_option [*get_option]]]
68770     [Get an option from the socket. ]
68771   ]
68772   
68773   [
68774     [[link boost_asio.reference.basic_stream_socket.io_control [*io_control]]]
68775     [Perform an IO control command on the socket. ]
68776   ]
68777   
68778   [
68779     [[link boost_asio.reference.basic_stream_socket.is_open [*is_open]]]
68780     [Determine whether the socket is open. ]
68781   ]
68782   
68783   [
68784     [[link boost_asio.reference.basic_stream_socket.local_endpoint [*local_endpoint]]]
68785     [Get the local endpoint of the socket. ]
68786   ]
68787   
68788   [
68789     [[link boost_asio.reference.basic_stream_socket.lowest_layer [*lowest_layer]]]
68790     [Get a reference to the lowest layer. 
68791      [hr]
68792      Get a const reference to the lowest layer. ]
68793   ]
68794   
68795   [
68796     [[link boost_asio.reference.basic_stream_socket.native_handle [*native_handle]]]
68797     [Get the native socket representation. ]
68798   ]
68799   
68800   [
68801     [[link boost_asio.reference.basic_stream_socket.native_non_blocking [*native_non_blocking]]]
68802     [Gets the non-blocking mode of the native socket implementation. 
68803      [hr]
68804      Sets the non-blocking mode of the native socket implementation. ]
68805   ]
68806   
68807   [
68808     [[link boost_asio.reference.basic_stream_socket.non_blocking [*non_blocking]]]
68809     [Gets the non-blocking mode of the socket. 
68810      [hr]
68811      Sets the non-blocking mode of the socket. ]
68812   ]
68813   
68814   [
68815     [[link boost_asio.reference.basic_stream_socket.open [*open]]]
68816     [Open the socket using the specified protocol. ]
68817   ]
68818   
68819   [
68820     [[link boost_asio.reference.basic_stream_socket.operator_eq_ [*operator=]]]
68821     [Move-assign a basic_stream_socket from another. 
68822      [hr]
68823      Move-assign a basic_stream_socket from a socket of another protocol type. ]
68824   ]
68825   
68826   [
68827     [[link boost_asio.reference.basic_stream_socket.read_some [*read_some]]]
68828     [Read some data from the socket. ]
68829   ]
68830   
68831   [
68832     [[link boost_asio.reference.basic_stream_socket.receive [*receive]]]
68833     [Receive some data on the socket. 
68834      [hr]
68835      Receive some data on a connected socket. ]
68836   ]
68837   
68838   [
68839     [[link boost_asio.reference.basic_stream_socket.release [*release]]]
68840     [Release ownership of the underlying native socket. ]
68841   ]
68842   
68843   [
68844     [[link boost_asio.reference.basic_stream_socket.remote_endpoint [*remote_endpoint]]]
68845     [Get the remote endpoint of the socket. ]
68846   ]
68847   
68848   [
68849     [[link boost_asio.reference.basic_stream_socket.send [*send]]]
68850     [Send some data on the socket. ]
68851   ]
68852   
68853   [
68854     [[link boost_asio.reference.basic_stream_socket.set_option [*set_option]]]
68855     [Set an option on the socket. ]
68856   ]
68857   
68858   [
68859     [[link boost_asio.reference.basic_stream_socket.shutdown [*shutdown]]]
68860     [Disable sends or receives on the socket. ]
68861   ]
68862   
68863   [
68864     [[link boost_asio.reference.basic_stream_socket.wait [*wait]]]
68865     [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
68866   ]
68867   
68868   [
68869     [[link boost_asio.reference.basic_stream_socket.write_some [*write_some]]]
68870     [Write some data to the socket. ]
68871   ]
68872   
68873   [
68874     [[link boost_asio.reference.basic_stream_socket._basic_stream_socket [*~basic_stream_socket]]]
68875     [Destroys the socket. ]
68876   ]
68877   
68878 ]
68879
68880 [heading Data Members]
68881 [table
68882   [[Name][Description]]
68883
68884   [
68885     [[link boost_asio.reference.basic_stream_socket.max_connections [*max_connections]]]
68886     [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
68887   ]
68888
68889   [
68890     [[link boost_asio.reference.basic_stream_socket.max_listen_connections [*max_listen_connections]]]
68891     [The maximum length of the queue of pending incoming connections. ]
68892   ]
68893
68894   [
68895     [[link boost_asio.reference.basic_stream_socket.message_do_not_route [*message_do_not_route]]]
68896     [Specify that the data should not be subject to routing. ]
68897   ]
68898
68899   [
68900     [[link boost_asio.reference.basic_stream_socket.message_end_of_record [*message_end_of_record]]]
68901     [Specifies that the data marks the end of a record. ]
68902   ]
68903
68904   [
68905     [[link boost_asio.reference.basic_stream_socket.message_out_of_band [*message_out_of_band]]]
68906     [Process out-of-band data. ]
68907   ]
68908
68909   [
68910     [[link boost_asio.reference.basic_stream_socket.message_peek [*message_peek]]]
68911     [Peek at incoming data without removing it from the input queue. ]
68912   ]
68913
68914 ]
68915
68916 [heading Protected Data Members]
68917 [table
68918   [[Name][Description]]
68919
68920   [
68921     [[link boost_asio.reference.basic_stream_socket.impl_ [*impl_]]]
68922     []
68923   ]
68924
68925 ]
68926
68927 The [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] class template provides asynchronous and blocking stream-oriented socket functionality.
68928
68929
68930 [heading Thread Safety]
68931   
68932 ['Distinct] ['objects:] Safe.
68933
68934 ['Shared] ['objects:] Unsafe.
68935
68936
68937
68938
68939
68940 [heading Requirements]
68941
68942 ['Header: ][^boost/asio/generic/stream_protocol.hpp]
68943
68944 ['Convenience header: ][^boost/asio.hpp]
68945
68946
68947 [endsect]
68948
68949
68950 [section:stream_protocol generic::stream_protocol::stream_protocol]
68951
68952 [indexterm2 boost_asio.indexterm.generic__stream_protocol.stream_protocol..stream_protocol..generic::stream_protocol] 
68953 Construct a protocol object for a specific address family and protocol. 
68954
68955
68956   ``[link boost_asio.reference.generic__stream_protocol.stream_protocol.overload1 stream_protocol]``(
68957       int address_family,
68958       int socket_protocol);
68959   ``  [''''&raquo;''' [link boost_asio.reference.generic__stream_protocol.stream_protocol.overload1 more...]]``
68960
68961
68962 Construct a generic protocol object from a specific protocol. 
68963
68964
68965   template<
68966       typename ``[link boost_asio.reference.Protocol Protocol]``>
68967   ``[link boost_asio.reference.generic__stream_protocol.stream_protocol.overload2 stream_protocol]``(
68968       const Protocol & source_protocol);
68969   ``  [''''&raquo;''' [link boost_asio.reference.generic__stream_protocol.stream_protocol.overload2 more...]]``
68970
68971
68972 [section:overload1 generic::stream_protocol::stream_protocol (1 of 2 overloads)]
68973
68974
68975 Construct a protocol object for a specific address family and protocol. 
68976
68977
68978   stream_protocol(
68979       int address_family,
68980       int socket_protocol);
68981
68982
68983
68984 [endsect]
68985
68986
68987
68988 [section:overload2 generic::stream_protocol::stream_protocol (2 of 2 overloads)]
68989
68990
68991 Construct a generic protocol object from a specific protocol. 
68992
68993
68994   template<
68995       typename ``[link boost_asio.reference.Protocol Protocol]``>
68996   stream_protocol(
68997       const Protocol & source_protocol);
68998
68999
69000
69001 [heading Exceptions]
69002     
69003
69004 [variablelist
69005   
69006 [[@c][bad\_cast Thrown if the source protocol is not stream-oriented. ]]
69007
69008 ]
69009
69010
69011
69012
69013 [endsect]
69014
69015
69016 [endsect]
69017
69018
69019 [section:type generic::stream_protocol::type]
69020
69021 [indexterm2 boost_asio.indexterm.generic__stream_protocol.type..type..generic::stream_protocol] 
69022 Obtain an identifier for the type of the protocol. 
69023
69024
69025   int type() const;
69026
69027
69028
69029 [endsect]
69030
69031
69032
69033 [endsect]
69034
69035 [section:get_associated_allocator get_associated_allocator]
69036
69037 [indexterm1 boost_asio.indexterm.get_associated_allocator..get_associated_allocator] 
69038 Helper function to obtain an object's associated allocator. 
69039
69040   template<
69041       typename T>
69042   associated_allocator< T >::type ``[link boost_asio.reference.get_associated_allocator.overload1 get_associated_allocator]``(
69043       const T & t);
69044   ``  [''''&raquo;''' [link boost_asio.reference.get_associated_allocator.overload1 more...]]``
69045
69046   template<
69047       typename T,
69048       typename Allocator>
69049   associated_allocator< T, Allocator >::type ``[link boost_asio.reference.get_associated_allocator.overload2 get_associated_allocator]``(
69050       const T & t,
69051       const Allocator & a);
69052   ``  [''''&raquo;''' [link boost_asio.reference.get_associated_allocator.overload2 more...]]``
69053
69054 [heading Requirements]
69055
69056 ['Header: ][^boost/asio/associated_allocator.hpp]
69057
69058 ['Convenience header: ][^boost/asio.hpp]
69059
69060
69061 [section:overload1 get_associated_allocator (1 of 2 overloads)]
69062
69063
69064 Helper function to obtain an object's associated allocator. 
69065
69066
69067   template<
69068       typename T>
69069   associated_allocator< T >::type get_associated_allocator(
69070       const T & t);
69071
69072
69073
69074 [heading Return Value]
69075       
69076 `associated_allocator<T>::get(t)` 
69077
69078
69079
69080
69081 [endsect]
69082
69083
69084
69085 [section:overload2 get_associated_allocator (2 of 2 overloads)]
69086
69087
69088 Helper function to obtain an object's associated allocator. 
69089
69090
69091   template<
69092       typename T,
69093       typename Allocator>
69094   associated_allocator< T, Allocator >::type get_associated_allocator(
69095       const T & t,
69096       const Allocator & a);
69097
69098
69099
69100 [heading Return Value]
69101       
69102 `associated_allocator<T, Allocator>::get(t, a)` 
69103
69104
69105
69106
69107 [endsect]
69108
69109
69110 [endsect]
69111
69112 [section:get_associated_executor get_associated_executor]
69113
69114 [indexterm1 boost_asio.indexterm.get_associated_executor..get_associated_executor] 
69115 Helper function to obtain an object's associated executor. 
69116
69117   template<
69118       typename T>
69119   associated_executor< T >::type ``[link boost_asio.reference.get_associated_executor.overload1 get_associated_executor]``(
69120       const T & t);
69121   ``  [''''&raquo;''' [link boost_asio.reference.get_associated_executor.overload1 more...]]``
69122
69123   template<
69124       typename T,
69125       typename ``[link boost_asio.reference.Executor1 Executor]``>
69126   associated_executor< T, Executor >::type ``[link boost_asio.reference.get_associated_executor.overload2 get_associated_executor]``(
69127       const T & t,
69128       const Executor & ex,
69129       typename enable_if< is_executor< Executor >::value >::type *  = 0);
69130   ``  [''''&raquo;''' [link boost_asio.reference.get_associated_executor.overload2 more...]]``
69131
69132   template<
69133       typename T,
69134       typename ExecutionContext>
69135   associated_executor< T, typename ExecutionContext::executor_type >::type ``[link boost_asio.reference.get_associated_executor.overload3 get_associated_executor]``(
69136       const T & t,
69137       ExecutionContext & ctx,
69138       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
69139   ``  [''''&raquo;''' [link boost_asio.reference.get_associated_executor.overload3 more...]]``
69140
69141 [heading Requirements]
69142
69143 ['Header: ][^boost/asio/associated_executor.hpp]
69144
69145 ['Convenience header: ][^boost/asio.hpp]
69146
69147
69148 [section:overload1 get_associated_executor (1 of 3 overloads)]
69149
69150
69151 Helper function to obtain an object's associated executor. 
69152
69153
69154   template<
69155       typename T>
69156   associated_executor< T >::type get_associated_executor(
69157       const T & t);
69158
69159
69160
69161 [heading Return Value]
69162       
69163 `associated_executor<T>::get(t)` 
69164
69165
69166
69167
69168 [endsect]
69169
69170
69171
69172 [section:overload2 get_associated_executor (2 of 3 overloads)]
69173
69174
69175 Helper function to obtain an object's associated executor. 
69176
69177
69178   template<
69179       typename T,
69180       typename ``[link boost_asio.reference.Executor1 Executor]``>
69181   associated_executor< T, Executor >::type get_associated_executor(
69182       const T & t,
69183       const Executor & ex,
69184       typename enable_if< is_executor< Executor >::value >::type *  = 0);
69185
69186
69187
69188 [heading Return Value]
69189       
69190 `associated_executor<T, Executor>::get(t, ex)` 
69191
69192
69193
69194
69195 [endsect]
69196
69197
69198
69199 [section:overload3 get_associated_executor (3 of 3 overloads)]
69200
69201
69202 Helper function to obtain an object's associated executor. 
69203
69204
69205   template<
69206       typename T,
69207       typename ExecutionContext>
69208   associated_executor< T, typename ExecutionContext::executor_type >::type get_associated_executor(
69209       const T & t,
69210       ExecutionContext & ctx,
69211       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
69212
69213
69214
69215 [heading Return Value]
69216       
69217 `associated_executor<T, typename ExecutionContext::executor_type>get(t, ctx.get_executor())` 
69218
69219
69220
69221
69222 [endsect]
69223
69224
69225 [endsect]
69226
69227
69228 [section:high_resolution_timer high_resolution_timer]
69229
69230 [indexterm1 boost_asio.indexterm.high_resolution_timer..high_resolution_timer] 
69231 Typedef for a timer based on the high resolution clock. 
69232
69233
69234   typedef basic_waitable_timer< chrono::high_resolution_clock > high_resolution_timer;
69235
69236
69237 [heading Types]
69238 [table
69239   [[Name][Description]]
69240
69241   [
69242
69243     [[link boost_asio.reference.basic_waitable_timer__rebind_executor [*rebind_executor]]]
69244     [Rebinds the timer type to another executor. ]
69245   
69246   ]
69247
69248   [
69249
69250     [[link boost_asio.reference.basic_waitable_timer.clock_type [*clock_type]]]
69251     [The clock type. ]
69252   
69253   ]
69254
69255   [
69256
69257     [[link boost_asio.reference.basic_waitable_timer.duration [*duration]]]
69258     [The duration type of the clock. ]
69259   
69260   ]
69261
69262   [
69263
69264     [[link boost_asio.reference.basic_waitable_timer.executor_type [*executor_type]]]
69265     [The type of the executor associated with the object. ]
69266   
69267   ]
69268
69269   [
69270
69271     [[link boost_asio.reference.basic_waitable_timer.time_point [*time_point]]]
69272     [The time point type of the clock. ]
69273   
69274   ]
69275
69276   [
69277
69278     [[link boost_asio.reference.basic_waitable_timer.traits_type [*traits_type]]]
69279     [The wait traits type. ]
69280   
69281   ]
69282
69283 ]
69284
69285 [heading Member Functions]
69286 [table
69287   [[Name][Description]]
69288
69289   [
69290     [[link boost_asio.reference.basic_waitable_timer.async_wait [*async_wait]]]
69291     [Start an asynchronous wait on the timer. ]
69292   ]
69293   
69294   [
69295     [[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer [*basic_waitable_timer]]]
69296     [Constructor. 
69297      [hr]
69298      Constructor to set a particular expiry time as an absolute time. 
69299      [hr]
69300      Constructor to set a particular expiry time relative to now. 
69301      [hr]
69302      Move-construct a basic_waitable_timer from another. ]
69303   ]
69304   
69305   [
69306     [[link boost_asio.reference.basic_waitable_timer.cancel [*cancel]]]
69307     [Cancel any asynchronous operations that are waiting on the timer. 
69308      [hr]
69309      (Deprecated: Use non-error_code overload.) Cancel any asynchronous operations that are waiting on the timer. ]
69310   ]
69311   
69312   [
69313     [[link boost_asio.reference.basic_waitable_timer.cancel_one [*cancel_one]]]
69314     [Cancels one asynchronous operation that is waiting on the timer. 
69315      [hr]
69316      (Deprecated: Use non-error_code overload.) Cancels one asynchronous operation that is waiting on the timer. ]
69317   ]
69318   
69319   [
69320     [[link boost_asio.reference.basic_waitable_timer.expires_after [*expires_after]]]
69321     [Set the timer's expiry time relative to now. ]
69322   ]
69323   
69324   [
69325     [[link boost_asio.reference.basic_waitable_timer.expires_at [*expires_at]]]
69326     [(Deprecated: Use expiry().) Get the timer's expiry time as an absolute time. 
69327      [hr]
69328      Set the timer's expiry time as an absolute time. 
69329      [hr]
69330      (Deprecated: Use non-error_code overload.) Set the timer's expiry time as an absolute time. ]
69331   ]
69332   
69333   [
69334     [[link boost_asio.reference.basic_waitable_timer.expires_from_now [*expires_from_now]]]
69335     [(Deprecated: Use expiry().) Get the timer's expiry time relative to now. 
69336      [hr]
69337      (Deprecated: Use expires_after().) Set the timer's expiry time relative to now. ]
69338   ]
69339   
69340   [
69341     [[link boost_asio.reference.basic_waitable_timer.expiry [*expiry]]]
69342     [Get the timer's expiry time as an absolute time. ]
69343   ]
69344   
69345   [
69346     [[link boost_asio.reference.basic_waitable_timer.get_executor [*get_executor]]]
69347     [Get the executor associated with the object. ]
69348   ]
69349   
69350   [
69351     [[link boost_asio.reference.basic_waitable_timer.operator_eq_ [*operator=]]]
69352     [Move-assign a basic_waitable_timer from another. ]
69353   ]
69354   
69355   [
69356     [[link boost_asio.reference.basic_waitable_timer.wait [*wait]]]
69357     [Perform a blocking wait on the timer. ]
69358   ]
69359   
69360   [
69361     [[link boost_asio.reference.basic_waitable_timer._basic_waitable_timer [*~basic_waitable_timer]]]
69362     [Destroys the timer. ]
69363   ]
69364   
69365 ]
69366
69367 The [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] class template provides the ability to perform a blocking or asynchronous wait for a timer to expire.
69368
69369 A waitable timer is always in one of two states: "expired" or "not expired". If the `wait()` or `async_wait()` function is called on an expired timer, the wait operation will complete immediately.
69370
69371 Most applications will use one of the [link boost_asio.reference.steady_timer `steady_timer`], [link boost_asio.reference.system_timer `system_timer`] or [link boost_asio.reference.high_resolution_timer `high_resolution_timer`] typedefs.
69372
69373
69374 [heading Remarks]
69375       
69376 This waitable timer functionality is for use with the C++11 standard library's `<chrono>` facility, or with the Boost.Chrono library.
69377
69378
69379 [heading Thread Safety]
69380   
69381 ['Distinct] ['objects:] Safe.
69382
69383 ['Shared] ['objects:] Unsafe.
69384
69385
69386 [heading Examples]
69387   
69388 Performing a blocking wait (C++11): 
69389
69390    // Construct a timer without setting an expiry time.
69391    boost::asio::steady_timer timer(my_context);
69392
69393    // Set an expiry time relative to now.
69394    timer.expires_after(std::chrono::seconds(5));
69395
69396    // Wait for the timer to expire.
69397    timer.wait();
69398
69399
69400
69401
69402
69403 Performing an asynchronous wait (C++11): 
69404
69405    void handler(const boost::system::error_code& error)
69406    {
69407      if (!error)
69408      {
69409        // Timer expired.
69410      }
69411    }
69412
69413    ...
69414
69415    // Construct a timer with an absolute expiry time.
69416    boost::asio::steady_timer timer(my_context,
69417        std::chrono::steady_clock::now() + std::chrono::seconds(60));
69418
69419    // Start an asynchronous wait.
69420    timer.async_wait(handler);
69421
69422
69423
69424
69425
69426 [heading Changing an active waitable timer's expiry time]
69427   
69428
69429
69430 Changing the expiry time of a timer while there are pending asynchronous waits causes those wait operations to be cancelled. To ensure that the action associated with the timer is performed only once, use something like this: used:
69431
69432
69433
69434    void on_some_event()
69435    {
69436      if (my_timer.expires_after(seconds(5)) > 0)
69437      {
69438        // We managed to cancel the timer. Start new asynchronous wait.
69439        my_timer.async_wait(on_timeout);
69440      }
69441      else
69442      {
69443        // Too late, timer has already expired!
69444      }
69445    }
69446
69447    void on_timeout(const boost::system::error_code& e)
69448    {
69449      if (e != boost::asio::error::operation_aborted)
69450      {
69451        // Timer was not cancelled, take necessary action.
69452      }
69453    }
69454
69455
69456
69457
69458
69459 * The `boost::asio::basic_waitable_timer::expires_after()` function cancels any pending asynchronous waits, and returns the number of asynchronous waits that were cancelled. If it returns 0 then you were too late and the wait handler has already been executed, or will soon be executed. If it returns 1 then the wait handler was successfully cancelled.
69460
69461
69462 * If a wait handler is cancelled, the boost::system::error\_code passed to it contains the value `boost::asio::error::operation_aborted`. 
69463
69464
69465
69466
69467 This typedef uses the C++11 `<chrono>` standard library facility, if available. Otherwise, it may use the Boost.Chrono library. To explicitly utilise Boost.Chrono, use the [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] template directly: 
69468
69469    typedef basic_waitable_timer<boost::chrono::high_resolution_clock> timer;
69470
69471
69472
69473
69474 [heading Requirements]
69475
69476 ['Header: ][^boost/asio/high_resolution_timer.hpp]
69477
69478 ['Convenience header: ][^boost/asio.hpp]
69479
69480
69481 [endsect]
69482
69483
69484 [section:invalid_service_owner invalid_service_owner]
69485
69486
69487 Exception thrown when trying to add a service object to an [link boost_asio.reference.execution_context `execution_context`] where the service has a different owner. 
69488
69489
69490   class invalid_service_owner
69491
69492
69493 [heading Member Functions]
69494 [table
69495   [[Name][Description]]
69496
69497   [
69498     [[link boost_asio.reference.invalid_service_owner.invalid_service_owner [*invalid_service_owner]]]
69499     []
69500   ]
69501   
69502 ]
69503
69504 [heading Requirements]
69505
69506 ['Header: ][^boost/asio/execution_context.hpp]
69507
69508 ['Convenience header: ][^boost/asio.hpp]
69509
69510
69511 [section:invalid_service_owner invalid_service_owner::invalid_service_owner]
69512
69513 [indexterm2 boost_asio.indexterm.invalid_service_owner.invalid_service_owner..invalid_service_owner..invalid_service_owner] 
69514
69515   invalid_service_owner();
69516
69517
69518
69519 [endsect]
69520
69521
69522
69523 [endsect]
69524
69525 [section:io_context io_context]
69526
69527
69528 Provides core I/O functionality. 
69529
69530
69531   class io_context :
69532     public execution_context
69533
69534
69535 [heading Types]
69536 [table
69537   [[Name][Description]]
69538
69539   [
69540
69541     [[link boost_asio.reference.io_context__executor_type [*executor_type]]]
69542     [Executor used to submit functions to an io_context. ]
69543   
69544   ]
69545
69546   [
69547
69548     [[link boost_asio.reference.io_context__service [*service]]]
69549     [Base class for all io_context services. ]
69550   
69551   ]
69552
69553   [
69554
69555     [[link boost_asio.reference.io_context__strand [*strand]]]
69556     [Provides serialised handler execution. ]
69557   
69558   ]
69559
69560   [
69561
69562     [[link boost_asio.reference.io_context__work [*work]]]
69563     [(Deprecated: Use executor_work_guard.) Class to inform the io_context when it has work to do. ]
69564   
69565   ]
69566
69567   [
69568
69569     [[link boost_asio.reference.io_context.count_type [*count_type]]]
69570     [The type used to count the number of handlers executed by the context. ]
69571   
69572   ]
69573
69574   [
69575
69576     [[link boost_asio.reference.io_context.fork_event [*fork_event]]]
69577     [Fork-related event notifications. ]
69578   
69579   ]
69580
69581 ]
69582
69583 [heading Member Functions]
69584 [table
69585   [[Name][Description]]
69586
69587   [
69588     [[link boost_asio.reference.io_context.dispatch [*dispatch]]]
69589     [(Deprecated: Use boost::asio::dispatch().) Request the io_context to invoke the given handler. ]
69590   ]
69591   
69592   [
69593     [[link boost_asio.reference.io_context.get_executor [*get_executor]]]
69594     [Obtains the executor associated with the io_context. ]
69595   ]
69596   
69597   [
69598     [[link boost_asio.reference.io_context.io_context [*io_context]]]
69599     [Constructor. ]
69600   ]
69601   
69602   [
69603     [[link boost_asio.reference.io_context.notify_fork [*notify_fork]]]
69604     [Notify the execution_context of a fork-related event. ]
69605   ]
69606   
69607   [
69608     [[link boost_asio.reference.io_context.poll [*poll]]]
69609     [Run the io_context object's event processing loop to execute ready handlers. 
69610      [hr]
69611      (Deprecated: Use non-error_code overload.) Run the io_context object's event processing loop to execute ready handlers. ]
69612   ]
69613   
69614   [
69615     [[link boost_asio.reference.io_context.poll_one [*poll_one]]]
69616     [Run the io_context object's event processing loop to execute one ready handler. 
69617      [hr]
69618      (Deprecated: Use non-error_code overload.) Run the io_context object's event processing loop to execute one ready handler. ]
69619   ]
69620   
69621   [
69622     [[link boost_asio.reference.io_context.post [*post]]]
69623     [(Deprecated: Use boost::asio::post().) Request the io_context to invoke the given handler and return immediately. ]
69624   ]
69625   
69626   [
69627     [[link boost_asio.reference.io_context.reset [*reset]]]
69628     [(Deprecated: Use restart().) Reset the io_context in preparation for a subsequent run() invocation. ]
69629   ]
69630   
69631   [
69632     [[link boost_asio.reference.io_context.restart [*restart]]]
69633     [Restart the io_context in preparation for a subsequent run() invocation. ]
69634   ]
69635   
69636   [
69637     [[link boost_asio.reference.io_context.run [*run]]]
69638     [Run the io_context object's event processing loop. 
69639      [hr]
69640      (Deprecated: Use non-error_code overload.) Run the io_context object's event processing loop. ]
69641   ]
69642   
69643   [
69644     [[link boost_asio.reference.io_context.run_for [*run_for]]]
69645     [Run the io_context object's event processing loop for a specified duration. ]
69646   ]
69647   
69648   [
69649     [[link boost_asio.reference.io_context.run_one [*run_one]]]
69650     [Run the io_context object's event processing loop to execute at most one handler. 
69651      [hr]
69652      (Deprecated: Use non-error_code overlaod.) Run the io_context object's event processing loop to execute at most one handler. ]
69653   ]
69654   
69655   [
69656     [[link boost_asio.reference.io_context.run_one_for [*run_one_for]]]
69657     [Run the io_context object's event processing loop for a specified duration to execute at most one handler. ]
69658   ]
69659   
69660   [
69661     [[link boost_asio.reference.io_context.run_one_until [*run_one_until]]]
69662     [Run the io_context object's event processing loop until a specified time to execute at most one handler. ]
69663   ]
69664   
69665   [
69666     [[link boost_asio.reference.io_context.run_until [*run_until]]]
69667     [Run the io_context object's event processing loop until a specified time. ]
69668   ]
69669   
69670   [
69671     [[link boost_asio.reference.io_context.stop [*stop]]]
69672     [Stop the io_context object's event processing loop. ]
69673   ]
69674   
69675   [
69676     [[link boost_asio.reference.io_context.stopped [*stopped]]]
69677     [Determine whether the io_context object has been stopped. ]
69678   ]
69679   
69680   [
69681     [[link boost_asio.reference.io_context.wrap [*wrap]]]
69682     [(Deprecated: Use boost::asio::bind_executor().) Create a new handler that automatically dispatches the wrapped handler on the io_context. ]
69683   ]
69684   
69685   [
69686     [[link boost_asio.reference.io_context._io_context [*~io_context]]]
69687     [Destructor. ]
69688   ]
69689   
69690 ]
69691
69692 [heading Protected Member Functions]
69693 [table
69694   [[Name][Description]]
69695
69696   [
69697     [[link boost_asio.reference.io_context.destroy [*destroy]]]
69698     [Destroys all services in the context. ]
69699   ]
69700   
69701   [
69702     [[link boost_asio.reference.io_context.shutdown [*shutdown]]]
69703     [Shuts down all services in the context. ]
69704   ]
69705   
69706 ]
69707
69708 [heading Friends]
69709 [table
69710   [[Name][Description]]
69711
69712   [
69713     [[link boost_asio.reference.io_context.add_service [*add_service]]]
69714     [(Deprecated: Use make_service().) Add a service object to the execution_context. ]
69715   ]
69716   
69717   [
69718     [[link boost_asio.reference.io_context.has_service [*has_service]]]
69719     [Determine if an execution_context contains a specified service type. ]
69720   ]
69721   
69722   [
69723     [[link boost_asio.reference.io_context.make_service [*make_service]]]
69724     [Creates a service object and adds it to the execution_context. ]
69725   ]
69726   
69727   [
69728     [[link boost_asio.reference.io_context.use_service [*use_service]]]
69729     [
69730      [hr]
69731      Obtain the service object corresponding to the given type. ]
69732   ]
69733   
69734 ]
69735
69736 The [link boost_asio.reference.io_context `io_context`] class provides the core I/O functionality for users of the asynchronous I/O objects, including:
69737
69738
69739 * `boost::asio::ip::tcp::socket` 
69740
69741 * `boost::asio::ip::tcp::acceptor` 
69742
69743 * `boost::asio::ip::udp::socket` 
69744
69745 * [link boost_asio.reference.deadline_timer `deadline_timer`].
69746
69747 The [link boost_asio.reference.io_context `io_context`] class also includes facilities intended for developers of custom asynchronous services.
69748
69749
69750 [heading Thread Safety]
69751   
69752 ['Distinct] ['objects:] Safe.
69753
69754 ['Shared] ['objects:] Safe, with the specific exceptions of the `restart()` and `notify_fork()` functions. Calling `restart()` while there are unfinished `run()`, `run_one()`, `run_for()`, `run_until()`, `poll()` or `poll_one()` calls results in undefined behaviour. The `notify_fork()` function should not be called while any [link boost_asio.reference.io_context `io_context`] function, or any function on an I/O object that is associated with the [link boost_asio.reference.io_context `io_context`], is being called in another thread.
69755
69756
69757
69758 [heading Synchronous and asynchronous operations]
69759   
69760
69761
69762 Synchronous operations on I/O objects implicitly run the [link boost_asio.reference.io_context `io_context`] object for an individual operation. The [link boost_asio.reference.io_context `io_context`] functions `run()`, `run_one()`, `run_for()`, `run_until()`, `poll()` or `poll_one()` must be called for the [link boost_asio.reference.io_context `io_context`] to perform asynchronous operations on behalf of a C++ program. Notification that an asynchronous operation has completed is delivered by invocation of the associated handler. Handlers are invoked only by a thread that is currently calling any overload of `run()`, `run_one()`, `run_for()`, `run_until()`, `poll()` or `poll_one()` for the [link boost_asio.reference.io_context `io_context`].
69763
69764
69765 [heading Effect of exceptions thrown from handlers]
69766   
69767
69768
69769 If an exception is thrown from a handler, the exception is allowed to propagate through the throwing thread's invocation of `run()`, `run_one()`, `run_for()`, `run_until()`, `poll()` or `poll_one()`. No other threads that are calling any of these functions are affected. It is then the responsibility of the application to catch the exception.
69770
69771 After the exception has been caught, the `run()`, `run_one()`, `run_for()`, `run_until()`, `poll()` or `poll_one()` call may be restarted ['without] the need for an intervening call to `restart()`. This allows the thread to rejoin the [link boost_asio.reference.io_context `io_context`] object's thread pool without impacting any other threads in the pool.
69772
69773 For example:
69774
69775
69776
69777    boost::asio::io_context io_context;
69778    ...
69779    for (;;)
69780    {
69781      try
69782      {
69783        io_context.run();
69784        break; // run() exited normally
69785      }
69786      catch (my_exception& e)
69787      {
69788        // Deal with exception as appropriate.
69789      }
69790    }
69791
69792
69793
69794
69795
69796 [heading Submitting arbitrary tasks to the io_context]
69797   
69798
69799
69800 To submit functions to the [link boost_asio.reference.io_context `io_context`], use the [link boost_asio.reference.dispatch `dispatch`] , [link boost_asio.reference.post `post`]  or [link boost_asio.reference.defer `defer`]  free functions.
69801
69802 For example:
69803
69804
69805
69806    void my_task()
69807    {
69808      ...
69809    }
69810
69811    ...
69812
69813    boost::asio::io_context io_context;
69814
69815    // Submit a function to the io_context.
69816    boost::asio::post(io_context, my_task);
69817
69818    // Submit a lambda object to the io_context.
69819    boost::asio::post(io_context,
69820        []()
69821        {
69822          ...
69823        });
69824
69825    // Run the io_context until it runs out of work.
69826    io_context.run(); 
69827
69828
69829
69830
69831
69832 [heading Stopping the io_context from running out of work]
69833   
69834
69835
69836 Some applications may need to prevent an [link boost_asio.reference.io_context `io_context`] object's `run()` call from returning when there is no more work to do. For example, the [link boost_asio.reference.io_context `io_context`] may be being run in a background thread that is launched prior to the application's asynchronous operations. The `run()` call may be kept running by creating an object of type boost::asio::executor\_work\_guard<io\_context::executor\_type>:
69837
69838
69839
69840    boost::asio::io_context io_context;
69841    boost::asio::executor_work_guard<boost::asio::io_context::executor_type>
69842      = boost::asio::make_work_guard(io_context);
69843    ... 
69844
69845
69846
69847
69848 To effect a shutdown, the application will then need to call the [link boost_asio.reference.io_context `io_context`] object's `stop()` member function. This will cause the [link boost_asio.reference.io_context `io_context`] `run()` call to return as soon as possible, abandoning unfinished operations and without permitting ready handlers to be dispatched.
69849
69850 Alternatively, if the application requires that all operations and handlers be allowed to finish normally, the work object may be explicitly reset.
69851
69852
69853
69854    boost::asio::io_context io_context;
69855    boost::asio::executor_work_guard<boost::asio::io_context::executor_type>
69856      = boost::asio::make_work_guard(io_context);
69857    ...
69858    work.reset(); // Allow run() to exit. 
69859
69860
69861
69862
69863 [heading Requirements]
69864
69865 ['Header: ][^boost/asio/io_context.hpp]
69866
69867 ['Convenience header: ][^boost/asio.hpp]
69868
69869
69870 [section:add_service io_context::add_service]
69871
69872
69873 ['Inherited from execution_context.]
69874
69875 [indexterm2 boost_asio.indexterm.io_context.add_service..add_service..io_context] 
69876 (Deprecated: Use `make_service()`.) Add a service object to the [link boost_asio.reference.execution_context `execution_context`]. 
69877
69878
69879   template<
69880       typename ``[link boost_asio.reference.Service Service]``>
69881   friend void add_service(
69882       execution_context & e,
69883       Service * svc);
69884
69885
69886 This function is used to add a service to the [link boost_asio.reference.execution_context `execution_context`].
69887
69888
69889 [heading Parameters]
69890     
69891
69892 [variablelist
69893   
69894 [[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]]
69895
69896 [[svc][The service object. On success, ownership of the service object is transferred to the [link boost_asio.reference.execution_context `execution_context`]. When the [link boost_asio.reference.execution_context `execution_context`] object is destroyed, it will destroy the service object by performing:
69897 ``
69898    delete static_cast<execution_context::service*>(svc) 
69899 ``
69900 ]]
69901
69902 ]
69903
69904
69905 [heading Exceptions]
69906     
69907
69908 [variablelist
69909   
69910 [[boost::asio::service_already_exists][Thrown if a service of the given type is already present in the [link boost_asio.reference.execution_context `execution_context`].]]
69911
69912 [[boost::asio::invalid_service_owner][Thrown if the service's owning [link boost_asio.reference.execution_context `execution_context`] is not the [link boost_asio.reference.execution_context `execution_context`] object specified by the `e` parameter. ]]
69913
69914 ]
69915
69916
69917
69918 [heading Requirements]
69919
69920 ['Header: ][^boost/asio/io_context.hpp]
69921
69922 ['Convenience header: ][^boost/asio.hpp]
69923
69924
69925 [endsect]
69926
69927
69928
69929 [section:count_type io_context::count_type]
69930
69931 [indexterm2 boost_asio.indexterm.io_context.count_type..count_type..io_context] 
69932 The type used to count the number of handlers executed by the context. 
69933
69934
69935   typedef std::size_t count_type;
69936
69937
69938
69939 [heading Requirements]
69940
69941 ['Header: ][^boost/asio/io_context.hpp]
69942
69943 ['Convenience header: ][^boost/asio.hpp]
69944
69945
69946 [endsect]
69947
69948
69949
69950 [section:destroy io_context::destroy]
69951
69952
69953 ['Inherited from execution_context.]
69954
69955 [indexterm2 boost_asio.indexterm.io_context.destroy..destroy..io_context] 
69956 Destroys all services in the context. 
69957
69958
69959   void destroy();
69960
69961
69962 This function is implemented as follows:
69963
69964
69965 * For each service object `svc` in the [link boost_asio.reference.execution_context `execution_context`] set, in reverse order * of the beginning of service object lifetime, performs `delete static_cast<execution_context::service*>(svc)`. 
69966
69967
69968
69969
69970 [endsect]
69971
69972
69973
69974 [section:dispatch io_context::dispatch]
69975
69976 [indexterm2 boost_asio.indexterm.io_context.dispatch..dispatch..io_context] 
69977 (Deprecated: Use [link boost_asio.reference.dispatch `dispatch`].) Request the [link boost_asio.reference.io_context `io_context`] to invoke the given handler. 
69978
69979
69980   template<
69981       typename ``[link boost_asio.reference.LegacyCompletionHandler LegacyCompletionHandler]``>
69982   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` dispatch(
69983       LegacyCompletionHandler && handler);
69984
69985
69986 This function is used to ask the [link boost_asio.reference.io_context `io_context`] to execute the given handler.
69987
69988 The [link boost_asio.reference.io_context `io_context`] guarantees that the handler will only be called in a thread in which the `run()`, `run_one()`, `poll()` or `poll_one()` member functions is currently being invoked. The handler may be executed inside this function if the guarantee can be met.
69989
69990
69991 [heading Parameters]
69992     
69993
69994 [variablelist
69995   
69996 [[handler][The handler to be called. The [link boost_asio.reference.io_context `io_context`] will make a copy of the handler object as required. The function signature of the handler must be:
69997 ``
69998    void handler(); 
69999 ``
70000 ]]
70001
70002 ]
70003
70004
70005 [heading Remarks]
70006       
70007 This function throws an exception only if:
70008
70009
70010 * the handler's `asio_handler_allocate` function; or
70011
70012
70013 * the handler's copy constructor
70014
70015 throws an exception. 
70016
70017
70018 [endsect]
70019
70020
70021
70022 [section:fork_event io_context::fork_event]
70023
70024
70025 ['Inherited from execution_context.]
70026
70027 [indexterm2 boost_asio.indexterm.io_context.fork_event..fork_event..io_context] 
70028 Fork-related event notifications. 
70029
70030
70031   enum fork_event
70032
70033 [indexterm2 boost_asio.indexterm.io_context.fork_event.fork_prepare..fork_prepare..io_context]
70034 [indexterm2 boost_asio.indexterm.io_context.fork_event.fork_parent..fork_parent..io_context]
70035 [indexterm2 boost_asio.indexterm.io_context.fork_event.fork_child..fork_child..io_context]
70036
70037 [heading Values]
70038 [variablelist
70039
70040   [
70041     [fork_prepare]
70042     [Notify the context that the process is about to fork. ]
70043   ]
70044
70045   [
70046     [fork_parent]
70047     [Notify the context that the process has forked and is the parent. ]
70048   ]
70049
70050   [
70051     [fork_child]
70052     [Notify the context that the process has forked and is the child. ]
70053   ]
70054
70055 ]
70056
70057
70058
70059 [endsect]
70060
70061
70062
70063 [section:get_executor io_context::get_executor]
70064
70065 [indexterm2 boost_asio.indexterm.io_context.get_executor..get_executor..io_context] 
70066 Obtains the executor associated with the [link boost_asio.reference.io_context `io_context`]. 
70067
70068
70069   executor_type get_executor();
70070
70071
70072
70073 [endsect]
70074
70075
70076
70077 [section:has_service io_context::has_service]
70078
70079
70080 ['Inherited from execution_context.]
70081
70082 [indexterm2 boost_asio.indexterm.io_context.has_service..has_service..io_context] 
70083 Determine if an [link boost_asio.reference.execution_context `execution_context`] contains a specified service type. 
70084
70085
70086   template<
70087       typename ``[link boost_asio.reference.Service Service]``>
70088   friend bool has_service(
70089       execution_context & e);
70090
70091
70092 This function is used to determine whether the [link boost_asio.reference.execution_context `execution_context`] contains a service object corresponding to the given service type.
70093
70094
70095 [heading Parameters]
70096     
70097
70098 [variablelist
70099   
70100 [[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]]
70101
70102 ]
70103
70104
70105 [heading Return Value]
70106       
70107 A boolean indicating whether the [link boost_asio.reference.execution_context `execution_context`] contains the service. 
70108
70109
70110
70111 [heading Requirements]
70112
70113 ['Header: ][^boost/asio/io_context.hpp]
70114
70115 ['Convenience header: ][^boost/asio.hpp]
70116
70117
70118 [endsect]
70119
70120
70121 [section:io_context io_context::io_context]
70122
70123 [indexterm2 boost_asio.indexterm.io_context.io_context..io_context..io_context] 
70124 Constructor. 
70125
70126
70127   ``[link boost_asio.reference.io_context.io_context.overload1 io_context]``();
70128   ``  [''''&raquo;''' [link boost_asio.reference.io_context.io_context.overload1 more...]]``
70129
70130   explicit ``[link boost_asio.reference.io_context.io_context.overload2 io_context]``(
70131       int concurrency_hint);
70132   ``  [''''&raquo;''' [link boost_asio.reference.io_context.io_context.overload2 more...]]``
70133
70134
70135 [section:overload1 io_context::io_context (1 of 2 overloads)]
70136
70137
70138 Constructor. 
70139
70140
70141   io_context();
70142
70143
70144
70145 [endsect]
70146
70147
70148
70149 [section:overload2 io_context::io_context (2 of 2 overloads)]
70150
70151
70152 Constructor. 
70153
70154
70155   io_context(
70156       int concurrency_hint);
70157
70158
70159 Construct with a hint about the required level of concurrency.
70160
70161
70162 [heading Parameters]
70163     
70164
70165 [variablelist
70166   
70167 [[concurrency_hint][A suggestion to the implementation on how many threads it should allow to run simultaneously. ]]
70168
70169 ]
70170
70171
70172
70173
70174 [endsect]
70175
70176
70177 [endsect]
70178
70179
70180 [section:make_service io_context::make_service]
70181
70182
70183 ['Inherited from execution_context.]
70184
70185 [indexterm2 boost_asio.indexterm.io_context.make_service..make_service..io_context] 
70186 Creates a service object and adds it to the [link boost_asio.reference.execution_context `execution_context`]. 
70187
70188
70189   template<
70190       typename ``[link boost_asio.reference.Service Service]``,
70191       typename... Args>
70192   friend Service & make_service(
70193       execution_context & e,
70194       Args &&... args);
70195
70196
70197 This function is used to add a service to the [link boost_asio.reference.execution_context `execution_context`].
70198
70199
70200 [heading Parameters]
70201     
70202
70203 [variablelist
70204   
70205 [[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]]
70206
70207 [[args][Zero or more arguments to be passed to the service constructor.]]
70208
70209 ]
70210
70211
70212 [heading Exceptions]
70213     
70214
70215 [variablelist
70216   
70217 [[boost::asio::service_already_exists][Thrown if a service of the given type is already present in the [link boost_asio.reference.execution_context `execution_context`]. ]]
70218
70219 ]
70220
70221
70222
70223 [heading Requirements]
70224
70225 ['Header: ][^boost/asio/io_context.hpp]
70226
70227 ['Convenience header: ][^boost/asio.hpp]
70228
70229
70230 [endsect]
70231
70232
70233
70234 [section:notify_fork io_context::notify_fork]
70235
70236
70237 ['Inherited from execution_context.]
70238
70239 [indexterm2 boost_asio.indexterm.io_context.notify_fork..notify_fork..io_context] 
70240 Notify the [link boost_asio.reference.execution_context `execution_context`] of a fork-related event. 
70241
70242
70243   void notify_fork(
70244       fork_event event);
70245
70246
70247 This function is used to inform the [link boost_asio.reference.execution_context `execution_context`] that the process is about to fork, or has just forked. This allows the [link boost_asio.reference.execution_context `execution_context`], and the services it contains, to perform any necessary housekeeping to ensure correct operation following a fork.
70248
70249 This function must not be called while any other [link boost_asio.reference.execution_context `execution_context`] function, or any function associated with the execution\_context's derived class, is being called in another thread. It is, however, safe to call this function from within a completion handler, provided no other thread is accessing the [link boost_asio.reference.execution_context `execution_context`] or its derived class.
70250
70251
70252 [heading Parameters]
70253     
70254
70255 [variablelist
70256   
70257 [[event][A fork-related event.]]
70258
70259 ]
70260
70261
70262 [heading Exceptions]
70263     
70264
70265 [variablelist
70266   
70267 [[boost::system::system_error][Thrown on failure. If the notification fails the [link boost_asio.reference.execution_context `execution_context`] object should no longer be used and should be destroyed.]]
70268
70269 ]
70270
70271
70272 [heading Example]
70273   
70274 The following code illustrates how to incorporate the `notify_fork()` function: 
70275
70276    my_execution_context.notify_fork(execution_context::fork_prepare);
70277    if (fork() == 0)
70278    {
70279      // This is the child process.
70280      my_execution_context.notify_fork(execution_context::fork_child);
70281    }
70282    else
70283    {
70284      // This is the parent process.
70285      my_execution_context.notify_fork(execution_context::fork_parent);
70286    } 
70287
70288
70289
70290
70291
70292 [heading Remarks]
70293       
70294 For each service object `svc` in the [link boost_asio.reference.execution_context `execution_context`] set, performs `svc->notify_fork();`. When processing the fork\_prepare event, services are visited in reverse order of the beginning of service object lifetime. Otherwise, services are visited in order of the beginning of service object lifetime. 
70295
70296
70297
70298
70299 [endsect]
70300
70301
70302 [section:poll io_context::poll]
70303
70304 [indexterm2 boost_asio.indexterm.io_context.poll..poll..io_context] 
70305 Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop to execute ready handlers. 
70306
70307
70308   count_type ``[link boost_asio.reference.io_context.poll.overload1 poll]``();
70309   ``  [''''&raquo;''' [link boost_asio.reference.io_context.poll.overload1 more...]]``
70310
70311
70312 (Deprecated: Use non-error\_code overload.) Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop to execute ready handlers. 
70313
70314
70315   count_type ``[link boost_asio.reference.io_context.poll.overload2 poll]``(
70316       boost::system::error_code & ec);
70317   ``  [''''&raquo;''' [link boost_asio.reference.io_context.poll.overload2 more...]]``
70318
70319
70320 [section:overload1 io_context::poll (1 of 2 overloads)]
70321
70322
70323 Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop to execute ready handlers. 
70324
70325
70326   count_type poll();
70327
70328
70329 The `poll()` function runs handlers that are ready to run, without blocking, until the [link boost_asio.reference.io_context `io_context`] has been stopped or there are no more ready handlers.
70330
70331
70332 [heading Return Value]
70333       
70334 The number of handlers that were executed. 
70335
70336
70337
70338
70339 [endsect]
70340
70341
70342
70343 [section:overload2 io_context::poll (2 of 2 overloads)]
70344
70345
70346 (Deprecated: Use non-error\_code overload.) Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop to execute ready handlers. 
70347
70348
70349   count_type poll(
70350       boost::system::error_code & ec);
70351
70352
70353 The `poll()` function runs handlers that are ready to run, without blocking, until the [link boost_asio.reference.io_context `io_context`] has been stopped or there are no more ready handlers.
70354
70355
70356 [heading Parameters]
70357     
70358
70359 [variablelist
70360   
70361 [[ec][Set to indicate what error occurred, if any.]]
70362
70363 ]
70364
70365
70366 [heading Return Value]
70367       
70368 The number of handlers that were executed. 
70369
70370
70371
70372
70373 [endsect]
70374
70375
70376 [endsect]
70377
70378 [section:poll_one io_context::poll_one]
70379
70380 [indexterm2 boost_asio.indexterm.io_context.poll_one..poll_one..io_context] 
70381 Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop to execute one ready handler. 
70382
70383
70384   count_type ``[link boost_asio.reference.io_context.poll_one.overload1 poll_one]``();
70385   ``  [''''&raquo;''' [link boost_asio.reference.io_context.poll_one.overload1 more...]]``
70386
70387
70388 (Deprecated: Use non-error\_code overload.) Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop to execute one ready handler. 
70389
70390
70391   count_type ``[link boost_asio.reference.io_context.poll_one.overload2 poll_one]``(
70392       boost::system::error_code & ec);
70393   ``  [''''&raquo;''' [link boost_asio.reference.io_context.poll_one.overload2 more...]]``
70394
70395
70396 [section:overload1 io_context::poll_one (1 of 2 overloads)]
70397
70398
70399 Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop to execute one ready handler. 
70400
70401
70402   count_type poll_one();
70403
70404
70405 The `poll_one()` function runs at most one handler that is ready to run, without blocking.
70406
70407
70408 [heading Return Value]
70409       
70410 The number of handlers that were executed. 
70411
70412
70413
70414
70415 [endsect]
70416
70417
70418
70419 [section:overload2 io_context::poll_one (2 of 2 overloads)]
70420
70421
70422 (Deprecated: Use non-error\_code overload.) Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop to execute one ready handler. 
70423
70424
70425   count_type poll_one(
70426       boost::system::error_code & ec);
70427
70428
70429 The `poll_one()` function runs at most one handler that is ready to run, without blocking.
70430
70431
70432 [heading Parameters]
70433     
70434
70435 [variablelist
70436   
70437 [[ec][Set to indicate what error occurred, if any.]]
70438
70439 ]
70440
70441
70442 [heading Return Value]
70443       
70444 The number of handlers that were executed. 
70445
70446
70447
70448
70449 [endsect]
70450
70451
70452 [endsect]
70453
70454
70455 [section:post io_context::post]
70456
70457 [indexterm2 boost_asio.indexterm.io_context.post..post..io_context] 
70458 (Deprecated: Use [link boost_asio.reference.post `post`].) Request the [link boost_asio.reference.io_context `io_context`] to invoke the given handler and return immediately. 
70459
70460
70461   template<
70462       typename ``[link boost_asio.reference.LegacyCompletionHandler LegacyCompletionHandler]``>
70463   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` post(
70464       LegacyCompletionHandler && handler);
70465
70466
70467 This function is used to ask the [link boost_asio.reference.io_context `io_context`] to execute the given handler, but without allowing the [link boost_asio.reference.io_context `io_context`] to call the handler from inside this function.
70468
70469 The [link boost_asio.reference.io_context `io_context`] guarantees that the handler will only be called in a thread in which the `run()`, `run_one()`, `poll()` or `poll_one()` member functions is currently being invoked.
70470
70471
70472 [heading Parameters]
70473     
70474
70475 [variablelist
70476   
70477 [[handler][The handler to be called. The [link boost_asio.reference.io_context `io_context`] will make a copy of the handler object as required. The function signature of the handler must be:
70478 ``
70479    void handler(); 
70480 ``
70481 ]]
70482
70483 ]
70484
70485
70486 [heading Remarks]
70487       
70488 This function throws an exception only if:
70489
70490
70491 * the handler's `asio_handler_allocate` function; or
70492
70493
70494 * the handler's copy constructor
70495
70496 throws an exception. 
70497
70498
70499 [endsect]
70500
70501
70502
70503 [section:reset io_context::reset]
70504
70505 [indexterm2 boost_asio.indexterm.io_context.reset..reset..io_context] 
70506 (Deprecated: Use `restart()`.) Reset the [link boost_asio.reference.io_context `io_context`] in preparation for a subsequent `run()` invocation. 
70507
70508
70509   void reset();
70510
70511
70512 This function must be called prior to any second or later set of invocations of the `run()`, `run_one()`, `poll()` or `poll_one()` functions when a previous invocation of these functions returned due to the [link boost_asio.reference.io_context `io_context`] being stopped or running out of work. After a call to `restart()`, the [link boost_asio.reference.io_context `io_context`] object's `stopped()` function will return `false`.
70513
70514 This function must not be called while there are any unfinished calls to the `run()`, `run_one()`, `poll()` or `poll_one()` functions. 
70515
70516
70517 [endsect]
70518
70519
70520
70521 [section:restart io_context::restart]
70522
70523 [indexterm2 boost_asio.indexterm.io_context.restart..restart..io_context] 
70524 Restart the [link boost_asio.reference.io_context `io_context`] in preparation for a subsequent `run()` invocation. 
70525
70526
70527   void restart();
70528
70529
70530 This function must be called prior to any second or later set of invocations of the `run()`, `run_one()`, `poll()` or `poll_one()` functions when a previous invocation of these functions returned due to the [link boost_asio.reference.io_context `io_context`] being stopped or running out of work. After a call to `restart()`, the [link boost_asio.reference.io_context `io_context`] object's `stopped()` function will return `false`.
70531
70532 This function must not be called while there are any unfinished calls to the `run()`, `run_one()`, `poll()` or `poll_one()` functions. 
70533
70534
70535 [endsect]
70536
70537
70538 [section:run io_context::run]
70539
70540 [indexterm2 boost_asio.indexterm.io_context.run..run..io_context] 
70541 Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop. 
70542
70543
70544   count_type ``[link boost_asio.reference.io_context.run.overload1 run]``();
70545   ``  [''''&raquo;''' [link boost_asio.reference.io_context.run.overload1 more...]]``
70546
70547
70548 (Deprecated: Use non-error\_code overload.) Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop. 
70549
70550
70551   count_type ``[link boost_asio.reference.io_context.run.overload2 run]``(
70552       boost::system::error_code & ec);
70553   ``  [''''&raquo;''' [link boost_asio.reference.io_context.run.overload2 more...]]``
70554
70555
70556 [section:overload1 io_context::run (1 of 2 overloads)]
70557
70558
70559 Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop. 
70560
70561
70562   count_type run();
70563
70564
70565 The `run()` function blocks until all work has finished and there are no more handlers to be dispatched, or until the [link boost_asio.reference.io_context `io_context`] has been stopped.
70566
70567 Multiple threads may call the `run()` function to set up a pool of threads from which the [link boost_asio.reference.io_context `io_context`] may execute handlers. All threads that are waiting in the pool are equivalent and the [link boost_asio.reference.io_context `io_context`] may choose any one of them to invoke a handler.
70568
70569 A normal exit from the `run()` function implies that the [link boost_asio.reference.io_context `io_context`] object is stopped (the `stopped()` function returns `true`). Subsequent calls to `run()`, `run_one()`, `poll()` or `poll_one()` will return immediately unless there is a prior call to `restart()`.
70570
70571
70572 [heading Return Value]
70573       
70574 The number of handlers that were executed.
70575
70576
70577 [heading Remarks]
70578       
70579 Calling the `run()` function from a thread that is currently calling one of `run()`, `run_one()`, `run_for()`, `run_until()`, `poll()` or `poll_one()` on the same [link boost_asio.reference.io_context `io_context`] object may introduce the potential for deadlock. It is the caller's reponsibility to avoid this.
70580
70581 The `poll()` function may also be used to dispatch ready handlers, but without blocking. 
70582
70583
70584 [endsect]
70585
70586
70587
70588 [section:overload2 io_context::run (2 of 2 overloads)]
70589
70590
70591 (Deprecated: Use non-error\_code overload.) Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop. 
70592
70593
70594   count_type run(
70595       boost::system::error_code & ec);
70596
70597
70598 The `run()` function blocks until all work has finished and there are no more handlers to be dispatched, or until the [link boost_asio.reference.io_context `io_context`] has been stopped.
70599
70600 Multiple threads may call the `run()` function to set up a pool of threads from which the [link boost_asio.reference.io_context `io_context`] may execute handlers. All threads that are waiting in the pool are equivalent and the [link boost_asio.reference.io_context `io_context`] may choose any one of them to invoke a handler.
70601
70602 A normal exit from the `run()` function implies that the [link boost_asio.reference.io_context `io_context`] object is stopped (the `stopped()` function returns `true`). Subsequent calls to `run()`, `run_one()`, `poll()` or `poll_one()` will return immediately unless there is a prior call to `restart()`.
70603
70604
70605 [heading Parameters]
70606     
70607
70608 [variablelist
70609   
70610 [[ec][Set to indicate what error occurred, if any.]]
70611
70612 ]
70613
70614
70615 [heading Return Value]
70616       
70617 The number of handlers that were executed.
70618
70619
70620 [heading Remarks]
70621       
70622 Calling the `run()` function from a thread that is currently calling one of `run()`, `run_one()`, `run_for()`, `run_until()`, `poll()` or `poll_one()` on the same [link boost_asio.reference.io_context `io_context`] object may introduce the potential for deadlock. It is the caller's reponsibility to avoid this.
70623
70624 The `poll()` function may also be used to dispatch ready handlers, but without blocking. 
70625
70626
70627 [endsect]
70628
70629
70630 [endsect]
70631
70632
70633 [section:run_for io_context::run_for]
70634
70635 [indexterm2 boost_asio.indexterm.io_context.run_for..run_for..io_context] 
70636 Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop for a specified duration. 
70637
70638
70639   template<
70640       typename Rep,
70641       typename Period>
70642   std::size_t run_for(
70643       const chrono::duration< Rep, Period > & rel_time);
70644
70645
70646 The `run_for()` function blocks until all work has finished and there are no more handlers to be dispatched, until the [link boost_asio.reference.io_context `io_context`] has been stopped, or until the specified duration has elapsed.
70647
70648
70649 [heading Parameters]
70650     
70651
70652 [variablelist
70653   
70654 [[rel_time][The duration for which the call may block.]]
70655
70656 ]
70657
70658
70659 [heading Return Value]
70660       
70661 The number of handlers that were executed. 
70662
70663
70664
70665
70666 [endsect]
70667
70668
70669 [section:run_one io_context::run_one]
70670
70671 [indexterm2 boost_asio.indexterm.io_context.run_one..run_one..io_context] 
70672 Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop to execute at most one handler. 
70673
70674
70675   count_type ``[link boost_asio.reference.io_context.run_one.overload1 run_one]``();
70676   ``  [''''&raquo;''' [link boost_asio.reference.io_context.run_one.overload1 more...]]``
70677
70678
70679 (Deprecated: Use non-error\_code overlaod.) Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop to execute at most one handler. 
70680
70681
70682   count_type ``[link boost_asio.reference.io_context.run_one.overload2 run_one]``(
70683       boost::system::error_code & ec);
70684   ``  [''''&raquo;''' [link boost_asio.reference.io_context.run_one.overload2 more...]]``
70685
70686
70687 [section:overload1 io_context::run_one (1 of 2 overloads)]
70688
70689
70690 Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop to execute at most one handler. 
70691
70692
70693   count_type run_one();
70694
70695
70696 The `run_one()` function blocks until one handler has been dispatched, or until the [link boost_asio.reference.io_context `io_context`] has been stopped.
70697
70698
70699 [heading Return Value]
70700       
70701 The number of handlers that were executed. A zero return value implies that the [link boost_asio.reference.io_context `io_context`] object is stopped (the `stopped()` function returns `true`). Subsequent calls to `run()`, `run_one()`, `poll()` or `poll_one()` will return immediately unless there is a prior call to `restart()`.
70702
70703
70704 [heading Remarks]
70705       
70706 Calling the `run_one()` function from a thread that is currently calling one of `run()`, `run_one()`, `run_for()`, `run_until()`, `poll()` or `poll_one()` on the same [link boost_asio.reference.io_context `io_context`] object may introduce the potential for deadlock. It is the caller's reponsibility to avoid this. 
70707
70708
70709
70710
70711 [endsect]
70712
70713
70714
70715 [section:overload2 io_context::run_one (2 of 2 overloads)]
70716
70717
70718 (Deprecated: Use non-error\_code overlaod.) Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop to execute at most one handler. 
70719
70720
70721   count_type run_one(
70722       boost::system::error_code & ec);
70723
70724
70725 The `run_one()` function blocks until one handler has been dispatched, or until the [link boost_asio.reference.io_context `io_context`] has been stopped.
70726
70727
70728 [heading Return Value]
70729       
70730 The number of handlers that were executed. A zero return value implies that the [link boost_asio.reference.io_context `io_context`] object is stopped (the `stopped()` function returns `true`). Subsequent calls to `run()`, `run_one()`, `poll()` or `poll_one()` will return immediately unless there is a prior call to `restart()`.
70731
70732 The number of handlers that were executed.
70733
70734
70735 [heading Remarks]
70736       
70737 Calling the `run_one()` function from a thread that is currently calling one of `run()`, `run_one()`, `run_for()`, `run_until()`, `poll()` or `poll_one()` on the same [link boost_asio.reference.io_context `io_context`] object may introduce the potential for deadlock. It is the caller's reponsibility to avoid this. 
70738
70739
70740
70741
70742 [endsect]
70743
70744
70745 [endsect]
70746
70747
70748 [section:run_one_for io_context::run_one_for]
70749
70750 [indexterm2 boost_asio.indexterm.io_context.run_one_for..run_one_for..io_context] 
70751 Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop for a specified duration to execute at most one handler. 
70752
70753
70754   template<
70755       typename Rep,
70756       typename Period>
70757   std::size_t run_one_for(
70758       const chrono::duration< Rep, Period > & rel_time);
70759
70760
70761 The `run_one_for()` function blocks until one handler has been dispatched, until the [link boost_asio.reference.io_context `io_context`] has been stopped, or until the specified duration has elapsed.
70762
70763
70764 [heading Parameters]
70765     
70766
70767 [variablelist
70768   
70769 [[rel_time][The duration for which the call may block.]]
70770
70771 ]
70772
70773
70774 [heading Return Value]
70775       
70776 The number of handlers that were executed. 
70777
70778
70779
70780
70781 [endsect]
70782
70783
70784
70785 [section:run_one_until io_context::run_one_until]
70786
70787 [indexterm2 boost_asio.indexterm.io_context.run_one_until..run_one_until..io_context] 
70788 Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop until a specified time to execute at most one handler. 
70789
70790
70791   template<
70792       typename Clock,
70793       typename Duration>
70794   std::size_t run_one_until(
70795       const chrono::time_point< Clock, Duration > & abs_time);
70796
70797
70798 The `run_one_until()` function blocks until one handler has been dispatched, until the [link boost_asio.reference.io_context `io_context`] has been stopped, or until the specified time has been reached.
70799
70800
70801 [heading Parameters]
70802     
70803
70804 [variablelist
70805   
70806 [[abs_time][The time point until which the call may block.]]
70807
70808 ]
70809
70810
70811 [heading Return Value]
70812       
70813 The number of handlers that were executed. 
70814
70815
70816
70817
70818 [endsect]
70819
70820
70821
70822 [section:run_until io_context::run_until]
70823
70824 [indexterm2 boost_asio.indexterm.io_context.run_until..run_until..io_context] 
70825 Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop until a specified time. 
70826
70827
70828   template<
70829       typename Clock,
70830       typename Duration>
70831   std::size_t run_until(
70832       const chrono::time_point< Clock, Duration > & abs_time);
70833
70834
70835 The `run_until()` function blocks until all work has finished and there are no more handlers to be dispatched, until the [link boost_asio.reference.io_context `io_context`] has been stopped, or until the specified time has been reached.
70836
70837
70838 [heading Parameters]
70839     
70840
70841 [variablelist
70842   
70843 [[abs_time][The time point until which the call may block.]]
70844
70845 ]
70846
70847
70848 [heading Return Value]
70849       
70850 The number of handlers that were executed. 
70851
70852
70853
70854
70855 [endsect]
70856
70857
70858
70859 [section:shutdown io_context::shutdown]
70860
70861
70862 ['Inherited from execution_context.]
70863
70864 [indexterm2 boost_asio.indexterm.io_context.shutdown..shutdown..io_context] 
70865 Shuts down all services in the context. 
70866
70867
70868   void shutdown();
70869
70870
70871 This function is implemented as follows:
70872
70873
70874 * For each service object `svc` in the [link boost_asio.reference.execution_context `execution_context`] set, in reverse order of the beginning of service object lifetime, performs `svc->shutdown()`. 
70875
70876
70877
70878
70879 [endsect]
70880
70881
70882
70883 [section:stop io_context::stop]
70884
70885 [indexterm2 boost_asio.indexterm.io_context.stop..stop..io_context] 
70886 Stop the [link boost_asio.reference.io_context `io_context`] object's event processing loop. 
70887
70888
70889   void stop();
70890
70891
70892 This function does not block, but instead simply signals the [link boost_asio.reference.io_context `io_context`] to stop. All invocations of its `run()` or `run_one()` member functions should return as soon as possible. Subsequent calls to `run()`, `run_one()`, `poll()` or `poll_one()` will return immediately until `restart()` is called. 
70893
70894
70895 [endsect]
70896
70897
70898
70899 [section:stopped io_context::stopped]
70900
70901 [indexterm2 boost_asio.indexterm.io_context.stopped..stopped..io_context] 
70902 Determine whether the [link boost_asio.reference.io_context `io_context`] object has been stopped. 
70903
70904
70905   bool stopped() const;
70906
70907
70908 This function is used to determine whether an [link boost_asio.reference.io_context `io_context`] object has been stopped, either through an explicit call to `stop()`, or due to running out of work. When an [link boost_asio.reference.io_context `io_context`] object is stopped, calls to `run()`, `run_one()`, `poll()` or `poll_one()` will return immediately without invoking any handlers.
70909
70910
70911 [heading Return Value]
70912       
70913 `true` if the [link boost_asio.reference.io_context `io_context`] object is stopped, otherwise `false`. 
70914
70915
70916
70917
70918 [endsect]
70919
70920
70921 [section:use_service io_context::use_service]
70922
70923 [indexterm2 boost_asio.indexterm.io_context.use_service..use_service..io_context] 
70924
70925   template<
70926       typename ``[link boost_asio.reference.Service Service]``>
70927   friend Service & ``[link boost_asio.reference.io_context.use_service.overload1 use_service]``(
70928       io_context & ioc);
70929   ``  [''''&raquo;''' [link boost_asio.reference.io_context.use_service.overload1 more...]]``
70930
70931
70932 Obtain the service object corresponding to the given type. 
70933
70934
70935   template<
70936       typename ``[link boost_asio.reference.Service Service]``>
70937   friend Service & ``[link boost_asio.reference.io_context.use_service.overload2 use_service]``(
70938       execution_context & e);
70939   ``  [''''&raquo;''' [link boost_asio.reference.io_context.use_service.overload2 more...]]``
70940
70941
70942 [section:overload1 io_context::use_service (1 of 2 overloads)]
70943
70944
70945
70946   template<
70947       typename ``[link boost_asio.reference.Service Service]``>
70948   friend Service & use_service(
70949       io_context & ioc);
70950
70951
70952 [heading Requirements]
70953
70954 ['Header: ][^boost/asio/io_context.hpp]
70955
70956 ['Convenience header: ][^boost/asio.hpp]
70957
70958
70959 [endsect]
70960
70961
70962
70963 [section:overload2 io_context::use_service (2 of 2 overloads)]
70964
70965
70966 ['Inherited from execution_context.]
70967
70968
70969 Obtain the service object corresponding to the given type. 
70970
70971
70972   template<
70973       typename ``[link boost_asio.reference.Service Service]``>
70974   friend Service & use_service(
70975       execution_context & e);
70976
70977
70978 This function is used to locate a service object that corresponds to the given service type. If there is no existing implementation of the service, then the [link boost_asio.reference.execution_context `execution_context`] will create a new instance of the service.
70979
70980
70981 [heading Parameters]
70982     
70983
70984 [variablelist
70985   
70986 [[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]]
70987
70988 ]
70989
70990
70991 [heading Return Value]
70992       
70993 The service interface implementing the specified service type. Ownership of the service interface is not transferred to the caller. 
70994
70995
70996
70997 [heading Requirements]
70998
70999 ['Header: ][^boost/asio/io_context.hpp]
71000
71001 ['Convenience header: ][^boost/asio.hpp]
71002
71003
71004 [endsect]
71005
71006
71007 [endsect]
71008
71009
71010 [section:wrap io_context::wrap]
71011
71012 [indexterm2 boost_asio.indexterm.io_context.wrap..wrap..io_context] 
71013 (Deprecated: Use [link boost_asio.reference.bind_executor `bind_executor`].) Create a new handler that automatically dispatches the wrapped handler on the [link boost_asio.reference.io_context `io_context`]. 
71014
71015
71016   template<
71017       typename ``[link boost_asio.reference.Handler Handler]``>
71018   unspecified wrap(
71019       Handler handler);
71020
71021
71022 This function is used to create a new handler function object that, when invoked, will automatically pass the wrapped handler to the [link boost_asio.reference.io_context `io_context`] object's dispatch function.
71023
71024
71025 [heading Parameters]
71026     
71027
71028 [variablelist
71029   
71030 [[handler][The handler to be wrapped. The [link boost_asio.reference.io_context `io_context`] will make a copy of the handler object as required. The function signature of the handler must be:
71031 ``
71032    void handler(A1 a1, ... An an); 
71033 ``
71034 ]]
71035
71036 ]
71037
71038
71039 [heading Return Value]
71040       
71041 A function object that, when invoked, passes the wrapped handler to the [link boost_asio.reference.io_context `io_context`] object's dispatch function. Given a function object with the signature: 
71042
71043    R f(A1 a1, ... An an); 
71044
71045
71046 If this function object is passed to the wrap function like so: 
71047
71048    io_context.wrap(f); 
71049
71050
71051 then the return value is a function object with the signature 
71052
71053    void g(A1 a1, ... An an); 
71054
71055
71056 that, when invoked, executes code equivalent to: 
71057
71058    io_context.dispatch(boost::bind(f, a1, ... an)); 
71059
71060
71061
71062
71063
71064
71065
71066 [endsect]
71067
71068
71069
71070 [section:_io_context io_context::~io_context]
71071
71072 [indexterm2 boost_asio.indexterm.io_context._io_context..~io_context..io_context] 
71073 Destructor. 
71074
71075
71076   ~io_context();
71077
71078
71079 On destruction, the [link boost_asio.reference.io_context `io_context`] performs the following sequence of operations:
71080
71081
71082 * For each service object `svc` in the [link boost_asio.reference.io_context `io_context`] set, in reverse order of the beginning of service object lifetime, performs `svc->shutdown()`.
71083
71084
71085 * Uninvoked handler objects that were scheduled for deferred invocation on the [link boost_asio.reference.io_context `io_context`], or any associated strand, are destroyed.
71086
71087
71088 * For each service object `svc` in the [link boost_asio.reference.io_context `io_context`] set, in reverse order of the beginning of service object lifetime, performs `delete static_cast<io_context::service*>(svc)`.
71089
71090
71091 [heading Remarks]
71092       
71093 The destruction sequence described above permits programs to simplify their resource management by using `shared_ptr<>`. Where an object's lifetime is tied to the lifetime of a connection (or some other sequence of asynchronous operations), a `shared_ptr` to the object would be bound into the handlers for all asynchronous operations associated with it. This works as follows:
71094
71095
71096 * When a single connection ends, all associated asynchronous operations complete. The corresponding handler objects are destroyed, and all `shared_ptr` references to the objects are destroyed.
71097
71098
71099 * To shut down the whole program, the [link boost_asio.reference.io_context `io_context`] function `stop()` is called to terminate any `run()` calls as soon as possible. The [link boost_asio.reference.io_context `io_context`] destructor defined above destroys all handlers, causing all `shared_ptr` references to all connection objects to be destroyed. 
71100
71101
71102
71103
71104 [endsect]
71105
71106
71107
71108 [endsect]
71109
71110 [section:io_context__executor_type io_context::executor_type]
71111
71112
71113 Executor used to submit functions to an [link boost_asio.reference.io_context `io_context`]. 
71114
71115
71116   class executor_type
71117
71118
71119 [heading Member Functions]
71120 [table
71121   [[Name][Description]]
71122
71123   [
71124     [[link boost_asio.reference.io_context__executor_type.context [*context]]]
71125     [Obtain the underlying execution context. ]
71126   ]
71127   
71128   [
71129     [[link boost_asio.reference.io_context__executor_type.defer [*defer]]]
71130     [Request the io_context to invoke the given function object. ]
71131   ]
71132   
71133   [
71134     [[link boost_asio.reference.io_context__executor_type.dispatch [*dispatch]]]
71135     [Request the io_context to invoke the given function object. ]
71136   ]
71137   
71138   [
71139     [[link boost_asio.reference.io_context__executor_type.on_work_finished [*on_work_finished]]]
71140     [Inform the io_context that some work is no longer outstanding. ]
71141   ]
71142   
71143   [
71144     [[link boost_asio.reference.io_context__executor_type.on_work_started [*on_work_started]]]
71145     [Inform the io_context that it has some outstanding work to do. ]
71146   ]
71147   
71148   [
71149     [[link boost_asio.reference.io_context__executor_type.post [*post]]]
71150     [Request the io_context to invoke the given function object. ]
71151   ]
71152   
71153   [
71154     [[link boost_asio.reference.io_context__executor_type.running_in_this_thread [*running_in_this_thread]]]
71155     [Determine whether the io_context is running in the current thread. ]
71156   ]
71157   
71158 ]
71159
71160 [heading Friends]
71161 [table
71162   [[Name][Description]]
71163
71164   [
71165     [[link boost_asio.reference.io_context__executor_type.operator_not__eq_ [*operator!=]]]
71166     [Compare two executors for inequality. ]
71167   ]
71168   
71169   [
71170     [[link boost_asio.reference.io_context__executor_type.operator_eq__eq_ [*operator==]]]
71171     [Compare two executors for equality. ]
71172   ]
71173   
71174 ]
71175
71176 [heading Requirements]
71177
71178 ['Header: ][^boost/asio/io_context.hpp]
71179
71180 ['Convenience header: ][^boost/asio.hpp]
71181
71182
71183 [section:context io_context::executor_type::context]
71184
71185 [indexterm2 boost_asio.indexterm.io_context__executor_type.context..context..io_context::executor_type] 
71186 Obtain the underlying execution context. 
71187
71188
71189   io_context & context() const;
71190
71191
71192
71193 [endsect]
71194
71195
71196
71197 [section:defer io_context::executor_type::defer]
71198
71199 [indexterm2 boost_asio.indexterm.io_context__executor_type.defer..defer..io_context::executor_type] 
71200 Request the [link boost_asio.reference.io_context `io_context`] to invoke the given function object. 
71201
71202
71203   template<
71204       typename Function,
71205       typename Allocator>
71206   void defer(
71207       Function && f,
71208       const Allocator & a) const;
71209
71210
71211 This function is used to ask the [link boost_asio.reference.io_context `io_context`] to execute the given function object. The function object will never be executed inside `defer()`. Instead, it will be scheduled to run on the [link boost_asio.reference.io_context `io_context`].
71212
71213 If the current thread belongs to the [link boost_asio.reference.io_context `io_context`], `defer()` will delay scheduling the function object until the current thread returns control to the pool.
71214
71215
71216 [heading Parameters]
71217     
71218
71219 [variablelist
71220   
71221 [[f][The function object to be called. The executor will make a copy of the handler object as required. The function signature of the function object must be:
71222 ``
71223    void function(); 
71224 ``
71225 ]]
71226
71227 [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
71228
71229 ]
71230
71231
71232
71233
71234 [endsect]
71235
71236
71237
71238 [section:dispatch io_context::executor_type::dispatch]
71239
71240 [indexterm2 boost_asio.indexterm.io_context__executor_type.dispatch..dispatch..io_context::executor_type] 
71241 Request the [link boost_asio.reference.io_context `io_context`] to invoke the given function object. 
71242
71243
71244   template<
71245       typename Function,
71246       typename Allocator>
71247   void dispatch(
71248       Function && f,
71249       const Allocator & a) const;
71250
71251
71252 This function is used to ask the [link boost_asio.reference.io_context `io_context`] to execute the given function object. If the current thread is running the [link boost_asio.reference.io_context `io_context`], `dispatch()` executes the function before returning. Otherwise, the function will be scheduled to run on the [link boost_asio.reference.io_context `io_context`].
71253
71254
71255 [heading Parameters]
71256     
71257
71258 [variablelist
71259   
71260 [[f][The function object to be called. The executor will make a copy of the handler object as required. The function signature of the function object must be:
71261 ``
71262    void function(); 
71263 ``
71264 ]]
71265
71266 [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
71267
71268 ]
71269
71270
71271
71272
71273 [endsect]
71274
71275
71276
71277 [section:on_work_finished io_context::executor_type::on_work_finished]
71278
71279 [indexterm2 boost_asio.indexterm.io_context__executor_type.on_work_finished..on_work_finished..io_context::executor_type] 
71280 Inform the [link boost_asio.reference.io_context `io_context`] that some work is no longer outstanding. 
71281
71282
71283   void on_work_finished() const;
71284
71285
71286 This function is used to inform the [link boost_asio.reference.io_context `io_context`] that some work has finished. Once the count of unfinished work reaches zero, the [link boost_asio.reference.io_context `io_context`] is stopped and the `run()` and `run_one()` functions may exit. 
71287
71288
71289 [endsect]
71290
71291
71292
71293 [section:on_work_started io_context::executor_type::on_work_started]
71294
71295 [indexterm2 boost_asio.indexterm.io_context__executor_type.on_work_started..on_work_started..io_context::executor_type] 
71296 Inform the [link boost_asio.reference.io_context `io_context`] that it has some outstanding work to do. 
71297
71298
71299   void on_work_started() const;
71300
71301
71302 This function is used to inform the [link boost_asio.reference.io_context `io_context`] that some work has begun. This ensures that the io\_context's `run()` and `run_one()` functions do not exit while the work is underway. 
71303
71304
71305 [endsect]
71306
71307
71308
71309 [section:operator_not__eq_ io_context::executor_type::operator!=]
71310
71311 [indexterm2 boost_asio.indexterm.io_context__executor_type.operator_not__eq_..operator!=..io_context::executor_type] 
71312 Compare two executors for inequality. 
71313
71314
71315   friend bool operator!=(
71316       const executor_type & a,
71317       const executor_type & b);
71318
71319
71320 Two executors are equal if they refer to the same underlying [link boost_asio.reference.io_context `io_context`]. 
71321
71322 [heading Requirements]
71323
71324 ['Header: ][^boost/asio/io_context.hpp]
71325
71326 ['Convenience header: ][^boost/asio.hpp]
71327
71328
71329 [endsect]
71330
71331
71332
71333 [section:operator_eq__eq_ io_context::executor_type::operator==]
71334
71335 [indexterm2 boost_asio.indexterm.io_context__executor_type.operator_eq__eq_..operator==..io_context::executor_type] 
71336 Compare two executors for equality. 
71337
71338
71339   friend bool operator==(
71340       const executor_type & a,
71341       const executor_type & b);
71342
71343
71344 Two executors are equal if they refer to the same underlying [link boost_asio.reference.io_context `io_context`]. 
71345
71346 [heading Requirements]
71347
71348 ['Header: ][^boost/asio/io_context.hpp]
71349
71350 ['Convenience header: ][^boost/asio.hpp]
71351
71352
71353 [endsect]
71354
71355
71356
71357 [section:post io_context::executor_type::post]
71358
71359 [indexterm2 boost_asio.indexterm.io_context__executor_type.post..post..io_context::executor_type] 
71360 Request the [link boost_asio.reference.io_context `io_context`] to invoke the given function object. 
71361
71362
71363   template<
71364       typename Function,
71365       typename Allocator>
71366   void post(
71367       Function && f,
71368       const Allocator & a) const;
71369
71370
71371 This function is used to ask the [link boost_asio.reference.io_context `io_context`] to execute the given function object. The function object will never be executed inside `post()`. Instead, it will be scheduled to run on the [link boost_asio.reference.io_context `io_context`].
71372
71373
71374 [heading Parameters]
71375     
71376
71377 [variablelist
71378   
71379 [[f][The function object to be called. The executor will make a copy of the handler object as required. The function signature of the function object must be:
71380 ``
71381    void function(); 
71382 ``
71383 ]]
71384
71385 [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
71386
71387 ]
71388
71389
71390
71391
71392 [endsect]
71393
71394
71395
71396 [section:running_in_this_thread io_context::executor_type::running_in_this_thread]
71397
71398 [indexterm2 boost_asio.indexterm.io_context__executor_type.running_in_this_thread..running_in_this_thread..io_context::executor_type] 
71399 Determine whether the [link boost_asio.reference.io_context `io_context`] is running in the current thread. 
71400
71401
71402   bool running_in_this_thread() const;
71403
71404
71405
71406 [heading Return Value]
71407       
71408 `true` if the current thread is running the [link boost_asio.reference.io_context `io_context`]. Otherwise returns `false`. 
71409
71410
71411
71412
71413 [endsect]
71414
71415
71416
71417 [endsect]
71418
71419 [section:io_context__service io_context::service]
71420
71421
71422 Base class for all [link boost_asio.reference.io_context `io_context`] services. 
71423
71424
71425   class service
71426
71427
71428 [heading Member Functions]
71429 [table
71430   [[Name][Description]]
71431
71432   [
71433     [[link boost_asio.reference.io_context__service.get_io_context [*get_io_context]]]
71434     [Get the io_context object that owns the service. ]
71435   ]
71436   
71437 ]
71438
71439 [heading Protected Member Functions]
71440 [table
71441   [[Name][Description]]
71442
71443   [
71444     [[link boost_asio.reference.io_context__service.service [*service]]]
71445     [Constructor. ]
71446   ]
71447   
71448   [
71449     [[link boost_asio.reference.io_context__service._service [*~service]]]
71450     [Destructor. ]
71451   ]
71452   
71453 ]
71454
71455 [heading Requirements]
71456
71457 ['Header: ][^boost/asio/io_context.hpp]
71458
71459 ['Convenience header: ][^boost/asio.hpp]
71460
71461
71462 [section:get_io_context io_context::service::get_io_context]
71463
71464 [indexterm2 boost_asio.indexterm.io_context__service.get_io_context..get_io_context..io_context::service] 
71465 Get the [link boost_asio.reference.io_context `io_context`] object that owns the service. 
71466
71467
71468   boost::asio::io_context & get_io_context();
71469
71470
71471
71472 [endsect]
71473
71474
71475
71476 [section:service io_context::service::service]
71477
71478 [indexterm2 boost_asio.indexterm.io_context__service.service..service..io_context::service] 
71479 Constructor. 
71480
71481
71482   service(
71483       boost::asio::io_context & owner);
71484
71485
71486
71487 [heading Parameters]
71488     
71489
71490 [variablelist
71491   
71492 [[owner][The [link boost_asio.reference.io_context `io_context`] object that owns the service. ]]
71493
71494 ]
71495
71496
71497
71498
71499 [endsect]
71500
71501
71502
71503 [section:_service io_context::service::~service]
71504
71505 [indexterm2 boost_asio.indexterm.io_context__service._service..~service..io_context::service] 
71506 Destructor. 
71507
71508
71509   virtual ~service();
71510
71511
71512
71513 [endsect]
71514
71515
71516
71517 [endsect]
71518
71519 [section:io_context__strand io_context::strand]
71520
71521
71522 Provides serialised handler execution. 
71523
71524
71525   class strand
71526
71527
71528 [heading Member Functions]
71529 [table
71530   [[Name][Description]]
71531
71532   [
71533     [[link boost_asio.reference.io_context__strand.context [*context]]]
71534     [Obtain the underlying execution context. ]
71535   ]
71536   
71537   [
71538     [[link boost_asio.reference.io_context__strand.defer [*defer]]]
71539     [Request the strand to invoke the given function object. ]
71540   ]
71541   
71542   [
71543     [[link boost_asio.reference.io_context__strand.dispatch [*dispatch]]]
71544     [Request the strand to invoke the given function object. 
71545      [hr]
71546      (Deprecated: Use boost::asio::dispatch().) Request the strand to invoke the given handler. ]
71547   ]
71548   
71549   [
71550     [[link boost_asio.reference.io_context__strand.on_work_finished [*on_work_finished]]]
71551     [Inform the strand that some work is no longer outstanding. ]
71552   ]
71553   
71554   [
71555     [[link boost_asio.reference.io_context__strand.on_work_started [*on_work_started]]]
71556     [Inform the strand that it has some outstanding work to do. ]
71557   ]
71558   
71559   [
71560     [[link boost_asio.reference.io_context__strand.post [*post]]]
71561     [Request the strand to invoke the given function object. 
71562      [hr]
71563      (Deprecated: Use boost::asio::post().) Request the strand to invoke the given handler and return immediately. ]
71564   ]
71565   
71566   [
71567     [[link boost_asio.reference.io_context__strand.running_in_this_thread [*running_in_this_thread]]]
71568     [Determine whether the strand is running in the current thread. ]
71569   ]
71570   
71571   [
71572     [[link boost_asio.reference.io_context__strand.strand [*strand]]]
71573     [Constructor. ]
71574   ]
71575   
71576   [
71577     [[link boost_asio.reference.io_context__strand.wrap [*wrap]]]
71578     [(Deprecated: Use boost::asio::bind_executor().) Create a new handler that automatically dispatches the wrapped handler on the strand. ]
71579   ]
71580   
71581   [
71582     [[link boost_asio.reference.io_context__strand._strand [*~strand]]]
71583     [Destructor. ]
71584   ]
71585   
71586 ]
71587
71588 [heading Friends]
71589 [table
71590   [[Name][Description]]
71591
71592   [
71593     [[link boost_asio.reference.io_context__strand.operator_not__eq_ [*operator!=]]]
71594     [Compare two strands for inequality. ]
71595   ]
71596   
71597   [
71598     [[link boost_asio.reference.io_context__strand.operator_eq__eq_ [*operator==]]]
71599     [Compare two strands for equality. ]
71600   ]
71601   
71602 ]
71603
71604 The [link boost_asio.reference.io_context__strand `io_context::strand`] class provides the ability to post and dispatch handlers with the guarantee that none of those handlers will execute concurrently.
71605
71606
71607 [heading Order of handler invocation]
71608   
71609 Given:
71610
71611
71612 * a strand object `s` 
71613
71614
71615 * an object `a` meeting completion handler requirements
71616
71617
71618 * an object `a1` which is an arbitrary copy of `a` made by the implementation
71619
71620
71621 * an object `b` meeting completion handler requirements
71622
71623
71624 * an object `b1` which is an arbitrary copy of `b` made by the implementation
71625
71626 if any of the following conditions are true:
71627
71628
71629 * `s.post(a)` happens-before `s.post(b)` 
71630
71631
71632 * `s.post(a)` happens-before `s.dispatch(b)`, where the latter is performed outside the strand
71633
71634
71635 * `s.dispatch(a)` happens-before `s.post(b)`, where the former is performed outside the strand
71636
71637
71638 * `s.dispatch(a)` happens-before `s.dispatch(b)`, where both are performed outside the strand
71639
71640 then `asio_handler_invoke(a1, &a1)` happens-before `asio_handler_invoke(b1, &b1)`.
71641
71642 Note that in the following case: 
71643
71644    async_op_1(..., s.wrap(a));
71645    async_op_2(..., s.wrap(b)); 
71646
71647
71648 the completion of the first async operation will perform `s.dispatch(a)`, and the second will perform `s.dispatch(b)`, but the order in which those are performed is unspecified. That is, you cannot state whether one happens-before the other. Therefore none of the above conditions are met and no ordering guarantee is made.
71649
71650
71651 [heading Remarks]
71652       
71653 The implementation makes no guarantee that handlers posted or dispatched through different `strand` objects will be invoked concurrently.
71654
71655
71656 [heading Thread Safety]
71657   
71658 ['Distinct] ['objects:] Safe.
71659
71660 ['Shared] ['objects:] Safe.
71661
71662
71663
71664
71665 [heading Requirements]
71666
71667 ['Header: ][^boost/asio/io_context_strand.hpp]
71668
71669 ['Convenience header: ][^boost/asio.hpp]
71670
71671
71672 [section:context io_context::strand::context]
71673
71674 [indexterm2 boost_asio.indexterm.io_context__strand.context..context..io_context::strand] 
71675 Obtain the underlying execution context. 
71676
71677
71678   boost::asio::io_context & context() const;
71679
71680
71681
71682 [endsect]
71683
71684
71685
71686 [section:defer io_context::strand::defer]
71687
71688 [indexterm2 boost_asio.indexterm.io_context__strand.defer..defer..io_context::strand] 
71689 Request the strand to invoke the given function object. 
71690
71691
71692   template<
71693       typename Function,
71694       typename Allocator>
71695   void defer(
71696       Function && f,
71697       const Allocator & a) const;
71698
71699
71700 This function is used to ask the executor to execute the given function object. The function object will never be executed inside this function. Instead, it will be scheduled to run by the underlying [link boost_asio.reference.io_context `io_context`].
71701
71702
71703 [heading Parameters]
71704     
71705
71706 [variablelist
71707   
71708 [[f][The function object to be called. The executor will make a copy of the handler object as required. The function signature of the function object must be:
71709 ``
71710    void function(); 
71711 ``
71712 ]]
71713
71714 [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
71715
71716 ]
71717
71718
71719
71720
71721 [endsect]
71722
71723
71724 [section:dispatch io_context::strand::dispatch]
71725
71726 [indexterm2 boost_asio.indexterm.io_context__strand.dispatch..dispatch..io_context::strand] 
71727 Request the strand to invoke the given function object. 
71728
71729
71730   template<
71731       typename Function,
71732       typename Allocator>
71733   void ``[link boost_asio.reference.io_context__strand.dispatch.overload1 dispatch]``(
71734       Function && f,
71735       const Allocator & a) const;
71736   ``  [''''&raquo;''' [link boost_asio.reference.io_context__strand.dispatch.overload1 more...]]``
71737
71738
71739 (Deprecated: Use [link boost_asio.reference.dispatch `dispatch`].) Request the strand to invoke the given handler. 
71740
71741
71742   template<
71743       typename ``[link boost_asio.reference.LegacyCompletionHandler LegacyCompletionHandler]``>
71744   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.io_context__strand.dispatch.overload2 dispatch]``(
71745       LegacyCompletionHandler && handler);
71746   ``  [''''&raquo;''' [link boost_asio.reference.io_context__strand.dispatch.overload2 more...]]``
71747
71748
71749 [section:overload1 io_context::strand::dispatch (1 of 2 overloads)]
71750
71751
71752 Request the strand to invoke the given function object. 
71753
71754
71755   template<
71756       typename Function,
71757       typename Allocator>
71758   void dispatch(
71759       Function && f,
71760       const Allocator & a) const;
71761
71762
71763 This function is used to ask the strand to execute the given function object on its underlying [link boost_asio.reference.io_context `io_context`]. The function object will be executed inside this function if the strand is not otherwise busy and if the underlying io\_context's executor's `dispatch()` function is also able to execute the function before returning.
71764
71765
71766 [heading Parameters]
71767     
71768
71769 [variablelist
71770   
71771 [[f][The function object to be called. The executor will make a copy of the handler object as required. The function signature of the function object must be:
71772 ``
71773    void function(); 
71774 ``
71775 ]]
71776
71777 [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
71778
71779 ]
71780
71781
71782
71783
71784 [endsect]
71785
71786
71787
71788 [section:overload2 io_context::strand::dispatch (2 of 2 overloads)]
71789
71790
71791 (Deprecated: Use [link boost_asio.reference.dispatch `dispatch`].) Request the strand to invoke the given handler. 
71792
71793
71794   template<
71795       typename ``[link boost_asio.reference.LegacyCompletionHandler LegacyCompletionHandler]``>
71796   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` dispatch(
71797       LegacyCompletionHandler && handler);
71798
71799
71800 This function is used to ask the strand to execute the given handler.
71801
71802 The strand object guarantees that handlers posted or dispatched through the strand will not be executed concurrently. The handler may be executed inside this function if the guarantee can be met. If this function is called from within a handler that was posted or dispatched through the same strand, then the new handler will be executed immediately.
71803
71804 The strand's guarantee is in addition to the guarantee provided by the underlying [link boost_asio.reference.io_context `io_context`]. The [link boost_asio.reference.io_context `io_context`] guarantees that the handler will only be called in a thread in which the io\_context's run member function is currently being invoked.
71805
71806
71807 [heading Parameters]
71808     
71809
71810 [variablelist
71811   
71812 [[handler][The handler to be called. The strand will make a copy of the handler object as required. The function signature of the handler must be: 
71813 ``
71814    void handler(); 
71815 ``
71816 ]]
71817
71818 ]
71819
71820
71821
71822
71823 [endsect]
71824
71825
71826 [endsect]
71827
71828
71829 [section:on_work_finished io_context::strand::on_work_finished]
71830
71831 [indexterm2 boost_asio.indexterm.io_context__strand.on_work_finished..on_work_finished..io_context::strand] 
71832 Inform the strand that some work is no longer outstanding. 
71833
71834
71835   void on_work_finished() const;
71836
71837
71838 The strand delegates this call to its underlying [link boost_asio.reference.io_context `io_context`]. 
71839
71840
71841 [endsect]
71842
71843
71844
71845 [section:on_work_started io_context::strand::on_work_started]
71846
71847 [indexterm2 boost_asio.indexterm.io_context__strand.on_work_started..on_work_started..io_context::strand] 
71848 Inform the strand that it has some outstanding work to do. 
71849
71850
71851   void on_work_started() const;
71852
71853
71854 The strand delegates this call to its underlying [link boost_asio.reference.io_context `io_context`]. 
71855
71856
71857 [endsect]
71858
71859
71860
71861 [section:operator_not__eq_ io_context::strand::operator!=]
71862
71863 [indexterm2 boost_asio.indexterm.io_context__strand.operator_not__eq_..operator!=..io_context::strand] 
71864 Compare two strands for inequality. 
71865
71866
71867   friend bool operator!=(
71868       const strand & a,
71869       const strand & b);
71870
71871
71872 Two strands are equal if they refer to the same ordered, non-concurrent state. 
71873
71874 [heading Requirements]
71875
71876 ['Header: ][^boost/asio/io_context_strand.hpp]
71877
71878 ['Convenience header: ][^boost/asio.hpp]
71879
71880
71881 [endsect]
71882
71883
71884
71885 [section:operator_eq__eq_ io_context::strand::operator==]
71886
71887 [indexterm2 boost_asio.indexterm.io_context__strand.operator_eq__eq_..operator==..io_context::strand] 
71888 Compare two strands for equality. 
71889
71890
71891   friend bool operator==(
71892       const strand & a,
71893       const strand & b);
71894
71895
71896 Two strands are equal if they refer to the same ordered, non-concurrent state. 
71897
71898 [heading Requirements]
71899
71900 ['Header: ][^boost/asio/io_context_strand.hpp]
71901
71902 ['Convenience header: ][^boost/asio.hpp]
71903
71904
71905 [endsect]
71906
71907
71908 [section:post io_context::strand::post]
71909
71910 [indexterm2 boost_asio.indexterm.io_context__strand.post..post..io_context::strand] 
71911 Request the strand to invoke the given function object. 
71912
71913
71914   template<
71915       typename Function,
71916       typename Allocator>
71917   void ``[link boost_asio.reference.io_context__strand.post.overload1 post]``(
71918       Function && f,
71919       const Allocator & a) const;
71920   ``  [''''&raquo;''' [link boost_asio.reference.io_context__strand.post.overload1 more...]]``
71921
71922
71923 (Deprecated: Use [link boost_asio.reference.post `post`].) Request the strand to invoke the given handler and return immediately. 
71924
71925
71926   template<
71927       typename ``[link boost_asio.reference.LegacyCompletionHandler LegacyCompletionHandler]``>
71928   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.io_context__strand.post.overload2 post]``(
71929       LegacyCompletionHandler && handler);
71930   ``  [''''&raquo;''' [link boost_asio.reference.io_context__strand.post.overload2 more...]]``
71931
71932
71933 [section:overload1 io_context::strand::post (1 of 2 overloads)]
71934
71935
71936 Request the strand to invoke the given function object. 
71937
71938
71939   template<
71940       typename Function,
71941       typename Allocator>
71942   void post(
71943       Function && f,
71944       const Allocator & a) const;
71945
71946
71947 This function is used to ask the executor to execute the given function object. The function object will never be executed inside this function. Instead, it will be scheduled to run by the underlying [link boost_asio.reference.io_context `io_context`].
71948
71949
71950 [heading Parameters]
71951     
71952
71953 [variablelist
71954   
71955 [[f][The function object to be called. The executor will make a copy of the handler object as required. The function signature of the function object must be:
71956 ``
71957    void function(); 
71958 ``
71959 ]]
71960
71961 [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
71962
71963 ]
71964
71965
71966
71967
71968 [endsect]
71969
71970
71971
71972 [section:overload2 io_context::strand::post (2 of 2 overloads)]
71973
71974
71975 (Deprecated: Use [link boost_asio.reference.post `post`].) Request the strand to invoke the given handler and return immediately. 
71976
71977
71978   template<
71979       typename ``[link boost_asio.reference.LegacyCompletionHandler LegacyCompletionHandler]``>
71980   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` post(
71981       LegacyCompletionHandler && handler);
71982
71983
71984 This function is used to ask the strand to execute the given handler, but without allowing the strand to call the handler from inside this function.
71985
71986 The strand object guarantees that handlers posted or dispatched through the strand will not be executed concurrently. The strand's guarantee is in addition to the guarantee provided by the underlying [link boost_asio.reference.io_context `io_context`]. The [link boost_asio.reference.io_context `io_context`] guarantees that the handler will only be called in a thread in which the io\_context's run member function is currently being invoked.
71987
71988
71989 [heading Parameters]
71990     
71991
71992 [variablelist
71993   
71994 [[handler][The handler to be called. The strand will make a copy of the handler object as required. The function signature of the handler must be: 
71995 ``
71996    void handler(); 
71997 ``
71998 ]]
71999
72000 ]
72001
72002
72003
72004
72005 [endsect]
72006
72007
72008 [endsect]
72009
72010
72011 [section:running_in_this_thread io_context::strand::running_in_this_thread]
72012
72013 [indexterm2 boost_asio.indexterm.io_context__strand.running_in_this_thread..running_in_this_thread..io_context::strand] 
72014 Determine whether the strand is running in the current thread. 
72015
72016
72017   bool running_in_this_thread() const;
72018
72019
72020
72021 [heading Return Value]
72022       
72023 `true` if the current thread is executing a handler that was submitted to the strand using `post()`, `dispatch()` or `wrap()`. Otherwise returns `false`. 
72024
72025
72026
72027
72028 [endsect]
72029
72030
72031
72032 [section:strand io_context::strand::strand]
72033
72034 [indexterm2 boost_asio.indexterm.io_context__strand.strand..strand..io_context::strand] 
72035 Constructor. 
72036
72037
72038   strand(
72039       boost::asio::io_context & io_context);
72040
72041
72042 Constructs the strand.
72043
72044
72045 [heading Parameters]
72046     
72047
72048 [variablelist
72049   
72050 [[io_context][The [link boost_asio.reference.io_context `io_context`] object that the strand will use to dispatch handlers that are ready to be run. ]]
72051
72052 ]
72053
72054
72055
72056
72057 [endsect]
72058
72059
72060
72061 [section:wrap io_context::strand::wrap]
72062
72063 [indexterm2 boost_asio.indexterm.io_context__strand.wrap..wrap..io_context::strand] 
72064 (Deprecated: Use [link boost_asio.reference.bind_executor `bind_executor`].) Create a new handler that automatically dispatches the wrapped handler on the strand. 
72065
72066
72067   template<
72068       typename ``[link boost_asio.reference.Handler Handler]``>
72069   unspecified wrap(
72070       Handler handler);
72071
72072
72073 This function is used to create a new handler function object that, when invoked, will automatically pass the wrapped handler to the strand's dispatch function.
72074
72075
72076 [heading Parameters]
72077     
72078
72079 [variablelist
72080   
72081 [[handler][The handler to be wrapped. The strand will make a copy of the handler object as required. The function signature of the handler must be:
72082 ``
72083    void handler(A1 a1, ... An an); 
72084 ``
72085 ]]
72086
72087 ]
72088
72089
72090 [heading Return Value]
72091       
72092 A function object that, when invoked, passes the wrapped handler to the strand's dispatch function. Given a function object with the signature: 
72093
72094    R f(A1 a1, ... An an); 
72095
72096
72097 If this function object is passed to the wrap function like so: 
72098
72099    strand.wrap(f); 
72100
72101
72102 then the return value is a function object with the signature 
72103
72104    void g(A1 a1, ... An an); 
72105
72106
72107 that, when invoked, executes code equivalent to: 
72108
72109    strand.dispatch(boost::bind(f, a1, ... an)); 
72110
72111
72112
72113
72114
72115
72116
72117 [endsect]
72118
72119
72120
72121 [section:_strand io_context::strand::~strand]
72122
72123 [indexterm2 boost_asio.indexterm.io_context__strand._strand..~strand..io_context::strand] 
72124 Destructor. 
72125
72126
72127   ~strand();
72128
72129
72130 Destroys a strand.
72131
72132 Handlers posted through the strand that have not yet been invoked will still be dispatched in a way that meets the guarantee of non-concurrency. 
72133
72134
72135 [endsect]
72136
72137
72138
72139 [endsect]
72140
72141 [section:io_context__work io_context::work]
72142
72143
72144 (Deprecated: Use [link boost_asio.reference.executor_work_guard `executor_work_guard`].) Class to inform the [link boost_asio.reference.io_context `io_context`] when it has work to do. 
72145
72146
72147   class work
72148
72149
72150 [heading Member Functions]
72151 [table
72152   [[Name][Description]]
72153
72154   [
72155     [[link boost_asio.reference.io_context__work.get_io_context [*get_io_context]]]
72156     [Get the io_context associated with the work. ]
72157   ]
72158   
72159   [
72160     [[link boost_asio.reference.io_context__work.work [*work]]]
72161     [Constructor notifies the io_context that work is starting. 
72162      [hr]
72163      Copy constructor notifies the io_context that work is starting. ]
72164   ]
72165   
72166   [
72167     [[link boost_asio.reference.io_context__work._work [*~work]]]
72168     [Destructor notifies the io_context that the work is complete. ]
72169   ]
72170   
72171 ]
72172
72173 The work class is used to inform the [link boost_asio.reference.io_context `io_context`] when work starts and finishes. This ensures that the [link boost_asio.reference.io_context `io_context`] object's `run()` function will not exit while work is underway, and that it does exit when there is no unfinished work remaining.
72174
72175 The work class is copy-constructible so that it may be used as a data member in a handler class. It is not assignable. 
72176
72177 [heading Requirements]
72178
72179 ['Header: ][^boost/asio/io_context.hpp]
72180
72181 ['Convenience header: ][^boost/asio.hpp]
72182
72183
72184 [section:get_io_context io_context::work::get_io_context]
72185
72186 [indexterm2 boost_asio.indexterm.io_context__work.get_io_context..get_io_context..io_context::work] 
72187 Get the [link boost_asio.reference.io_context `io_context`] associated with the work. 
72188
72189
72190   boost::asio::io_context & get_io_context();
72191
72192
72193
72194 [endsect]
72195
72196
72197 [section:work io_context::work::work]
72198
72199 [indexterm2 boost_asio.indexterm.io_context__work.work..work..io_context::work] 
72200 Constructor notifies the [link boost_asio.reference.io_context `io_context`] that work is starting. 
72201
72202
72203   explicit ``[link boost_asio.reference.io_context__work.work.overload1 work]``(
72204       boost::asio::io_context & io_context);
72205   ``  [''''&raquo;''' [link boost_asio.reference.io_context__work.work.overload1 more...]]``
72206
72207
72208 Copy constructor notifies the [link boost_asio.reference.io_context `io_context`] that work is starting. 
72209
72210
72211   ``[link boost_asio.reference.io_context__work.work.overload2 work]``(
72212       const work & other);
72213   ``  [''''&raquo;''' [link boost_asio.reference.io_context__work.work.overload2 more...]]``
72214
72215
72216 [section:overload1 io_context::work::work (1 of 2 overloads)]
72217
72218
72219 Constructor notifies the [link boost_asio.reference.io_context `io_context`] that work is starting. 
72220
72221
72222   work(
72223       boost::asio::io_context & io_context);
72224
72225
72226 The constructor is used to inform the [link boost_asio.reference.io_context `io_context`] that some work has begun. This ensures that the [link boost_asio.reference.io_context `io_context`] object's `run()` function will not exit while the work is underway. 
72227
72228
72229 [endsect]
72230
72231
72232
72233 [section:overload2 io_context::work::work (2 of 2 overloads)]
72234
72235
72236 Copy constructor notifies the [link boost_asio.reference.io_context `io_context`] that work is starting. 
72237
72238
72239   work(
72240       const work & other);
72241
72242
72243 The constructor is used to inform the [link boost_asio.reference.io_context `io_context`] that some work has begun. This ensures that the [link boost_asio.reference.io_context `io_context`] object's `run()` function will not exit while the work is underway. 
72244
72245
72246 [endsect]
72247
72248
72249 [endsect]
72250
72251
72252 [section:_work io_context::work::~work]
72253
72254 [indexterm2 boost_asio.indexterm.io_context__work._work..~work..io_context::work] 
72255 Destructor notifies the [link boost_asio.reference.io_context `io_context`] that the work is complete. 
72256
72257
72258   ~work();
72259
72260
72261 The destructor is used to inform the [link boost_asio.reference.io_context `io_context`] that some work has finished. Once the count of unfinished work reaches zero, the [link boost_asio.reference.io_context `io_context`] object's `run()` function is permitted to exit. 
72262
72263
72264 [endsect]
72265
72266
72267
72268 [endsect]
72269
72270
72271 [section:io_service io_service]
72272
72273 [indexterm1 boost_asio.indexterm.io_service..io_service] 
72274 Typedef for backwards compatibility. 
72275
72276
72277   typedef io_context io_service;
72278
72279
72280 [heading Types]
72281 [table
72282   [[Name][Description]]
72283
72284   [
72285
72286     [[link boost_asio.reference.io_context__executor_type [*executor_type]]]
72287     [Executor used to submit functions to an io_context. ]
72288   
72289   ]
72290
72291   [
72292
72293     [[link boost_asio.reference.io_context__service [*service]]]
72294     [Base class for all io_context services. ]
72295   
72296   ]
72297
72298   [
72299
72300     [[link boost_asio.reference.io_context__strand [*strand]]]
72301     [Provides serialised handler execution. ]
72302   
72303   ]
72304
72305   [
72306
72307     [[link boost_asio.reference.io_context__work [*work]]]
72308     [(Deprecated: Use executor_work_guard.) Class to inform the io_context when it has work to do. ]
72309   
72310   ]
72311
72312   [
72313
72314     [[link boost_asio.reference.io_context.count_type [*count_type]]]
72315     [The type used to count the number of handlers executed by the context. ]
72316   
72317   ]
72318
72319   [
72320
72321     [[link boost_asio.reference.io_context.fork_event [*fork_event]]]
72322     [Fork-related event notifications. ]
72323   
72324   ]
72325
72326 ]
72327
72328 [heading Member Functions]
72329 [table
72330   [[Name][Description]]
72331
72332   [
72333     [[link boost_asio.reference.io_context.dispatch [*dispatch]]]
72334     [(Deprecated: Use boost::asio::dispatch().) Request the io_context to invoke the given handler. ]
72335   ]
72336   
72337   [
72338     [[link boost_asio.reference.io_context.get_executor [*get_executor]]]
72339     [Obtains the executor associated with the io_context. ]
72340   ]
72341   
72342   [
72343     [[link boost_asio.reference.io_context.io_context [*io_context]]]
72344     [Constructor. ]
72345   ]
72346   
72347   [
72348     [[link boost_asio.reference.io_context.notify_fork [*notify_fork]]]
72349     [Notify the execution_context of a fork-related event. ]
72350   ]
72351   
72352   [
72353     [[link boost_asio.reference.io_context.poll [*poll]]]
72354     [Run the io_context object's event processing loop to execute ready handlers. 
72355      [hr]
72356      (Deprecated: Use non-error_code overload.) Run the io_context object's event processing loop to execute ready handlers. ]
72357   ]
72358   
72359   [
72360     [[link boost_asio.reference.io_context.poll_one [*poll_one]]]
72361     [Run the io_context object's event processing loop to execute one ready handler. 
72362      [hr]
72363      (Deprecated: Use non-error_code overload.) Run the io_context object's event processing loop to execute one ready handler. ]
72364   ]
72365   
72366   [
72367     [[link boost_asio.reference.io_context.post [*post]]]
72368     [(Deprecated: Use boost::asio::post().) Request the io_context to invoke the given handler and return immediately. ]
72369   ]
72370   
72371   [
72372     [[link boost_asio.reference.io_context.reset [*reset]]]
72373     [(Deprecated: Use restart().) Reset the io_context in preparation for a subsequent run() invocation. ]
72374   ]
72375   
72376   [
72377     [[link boost_asio.reference.io_context.restart [*restart]]]
72378     [Restart the io_context in preparation for a subsequent run() invocation. ]
72379   ]
72380   
72381   [
72382     [[link boost_asio.reference.io_context.run [*run]]]
72383     [Run the io_context object's event processing loop. 
72384      [hr]
72385      (Deprecated: Use non-error_code overload.) Run the io_context object's event processing loop. ]
72386   ]
72387   
72388   [
72389     [[link boost_asio.reference.io_context.run_for [*run_for]]]
72390     [Run the io_context object's event processing loop for a specified duration. ]
72391   ]
72392   
72393   [
72394     [[link boost_asio.reference.io_context.run_one [*run_one]]]
72395     [Run the io_context object's event processing loop to execute at most one handler. 
72396      [hr]
72397      (Deprecated: Use non-error_code overlaod.) Run the io_context object's event processing loop to execute at most one handler. ]
72398   ]
72399   
72400   [
72401     [[link boost_asio.reference.io_context.run_one_for [*run_one_for]]]
72402     [Run the io_context object's event processing loop for a specified duration to execute at most one handler. ]
72403   ]
72404   
72405   [
72406     [[link boost_asio.reference.io_context.run_one_until [*run_one_until]]]
72407     [Run the io_context object's event processing loop until a specified time to execute at most one handler. ]
72408   ]
72409   
72410   [
72411     [[link boost_asio.reference.io_context.run_until [*run_until]]]
72412     [Run the io_context object's event processing loop until a specified time. ]
72413   ]
72414   
72415   [
72416     [[link boost_asio.reference.io_context.stop [*stop]]]
72417     [Stop the io_context object's event processing loop. ]
72418   ]
72419   
72420   [
72421     [[link boost_asio.reference.io_context.stopped [*stopped]]]
72422     [Determine whether the io_context object has been stopped. ]
72423   ]
72424   
72425   [
72426     [[link boost_asio.reference.io_context.wrap [*wrap]]]
72427     [(Deprecated: Use boost::asio::bind_executor().) Create a new handler that automatically dispatches the wrapped handler on the io_context. ]
72428   ]
72429   
72430   [
72431     [[link boost_asio.reference.io_context._io_context [*~io_context]]]
72432     [Destructor. ]
72433   ]
72434   
72435 ]
72436
72437 [heading Protected Member Functions]
72438 [table
72439   [[Name][Description]]
72440
72441   [
72442     [[link boost_asio.reference.io_context.destroy [*destroy]]]
72443     [Destroys all services in the context. ]
72444   ]
72445   
72446   [
72447     [[link boost_asio.reference.io_context.shutdown [*shutdown]]]
72448     [Shuts down all services in the context. ]
72449   ]
72450   
72451 ]
72452
72453 [heading Friends]
72454 [table
72455   [[Name][Description]]
72456
72457   [
72458     [[link boost_asio.reference.io_context.add_service [*add_service]]]
72459     [(Deprecated: Use make_service().) Add a service object to the execution_context. ]
72460   ]
72461   
72462   [
72463     [[link boost_asio.reference.io_context.has_service [*has_service]]]
72464     [Determine if an execution_context contains a specified service type. ]
72465   ]
72466   
72467   [
72468     [[link boost_asio.reference.io_context.make_service [*make_service]]]
72469     [Creates a service object and adds it to the execution_context. ]
72470   ]
72471   
72472   [
72473     [[link boost_asio.reference.io_context.use_service [*use_service]]]
72474     [
72475      [hr]
72476      Obtain the service object corresponding to the given type. ]
72477   ]
72478   
72479 ]
72480
72481 The [link boost_asio.reference.io_context `io_context`] class provides the core I/O functionality for users of the asynchronous I/O objects, including:
72482
72483
72484 * `boost::asio::ip::tcp::socket` 
72485
72486 * `boost::asio::ip::tcp::acceptor` 
72487
72488 * `boost::asio::ip::udp::socket` 
72489
72490 * [link boost_asio.reference.deadline_timer `deadline_timer`].
72491
72492 The [link boost_asio.reference.io_context `io_context`] class also includes facilities intended for developers of custom asynchronous services.
72493
72494
72495 [heading Thread Safety]
72496   
72497 ['Distinct] ['objects:] Safe.
72498
72499 ['Shared] ['objects:] Safe, with the specific exceptions of the `restart()` and `notify_fork()` functions. Calling `restart()` while there are unfinished `run()`, `run_one()`, `run_for()`, `run_until()`, `poll()` or `poll_one()` calls results in undefined behaviour. The `notify_fork()` function should not be called while any [link boost_asio.reference.io_context `io_context`] function, or any function on an I/O object that is associated with the [link boost_asio.reference.io_context `io_context`], is being called in another thread.
72500
72501
72502
72503 [heading Synchronous and asynchronous operations]
72504   
72505
72506
72507 Synchronous operations on I/O objects implicitly run the [link boost_asio.reference.io_context `io_context`] object for an individual operation. The [link boost_asio.reference.io_context `io_context`] functions `run()`, `run_one()`, `run_for()`, `run_until()`, `poll()` or `poll_one()` must be called for the [link boost_asio.reference.io_context `io_context`] to perform asynchronous operations on behalf of a C++ program. Notification that an asynchronous operation has completed is delivered by invocation of the associated handler. Handlers are invoked only by a thread that is currently calling any overload of `run()`, `run_one()`, `run_for()`, `run_until()`, `poll()` or `poll_one()` for the [link boost_asio.reference.io_context `io_context`].
72508
72509
72510 [heading Effect of exceptions thrown from handlers]
72511   
72512
72513
72514 If an exception is thrown from a handler, the exception is allowed to propagate through the throwing thread's invocation of `run()`, `run_one()`, `run_for()`, `run_until()`, `poll()` or `poll_one()`. No other threads that are calling any of these functions are affected. It is then the responsibility of the application to catch the exception.
72515
72516 After the exception has been caught, the `run()`, `run_one()`, `run_for()`, `run_until()`, `poll()` or `poll_one()` call may be restarted ['without] the need for an intervening call to `restart()`. This allows the thread to rejoin the [link boost_asio.reference.io_context `io_context`] object's thread pool without impacting any other threads in the pool.
72517
72518 For example:
72519
72520
72521
72522    boost::asio::io_context io_context;
72523    ...
72524    for (;;)
72525    {
72526      try
72527      {
72528        io_context.run();
72529        break; // run() exited normally
72530      }
72531      catch (my_exception& e)
72532      {
72533        // Deal with exception as appropriate.
72534      }
72535    }
72536
72537
72538
72539
72540
72541 [heading Submitting arbitrary tasks to the io_context]
72542   
72543
72544
72545 To submit functions to the [link boost_asio.reference.io_context `io_context`], use the [link boost_asio.reference.dispatch `dispatch`] , [link boost_asio.reference.post `post`]  or [link boost_asio.reference.defer `defer`]  free functions.
72546
72547 For example:
72548
72549
72550
72551    void my_task()
72552    {
72553      ...
72554    }
72555
72556    ...
72557
72558    boost::asio::io_context io_context;
72559
72560    // Submit a function to the io_context.
72561    boost::asio::post(io_context, my_task);
72562
72563    // Submit a lambda object to the io_context.
72564    boost::asio::post(io_context,
72565        []()
72566        {
72567          ...
72568        });
72569
72570    // Run the io_context until it runs out of work.
72571    io_context.run(); 
72572
72573
72574
72575
72576
72577 [heading Stopping the io_context from running out of work]
72578   
72579
72580
72581 Some applications may need to prevent an [link boost_asio.reference.io_context `io_context`] object's `run()` call from returning when there is no more work to do. For example, the [link boost_asio.reference.io_context `io_context`] may be being run in a background thread that is launched prior to the application's asynchronous operations. The `run()` call may be kept running by creating an object of type boost::asio::executor\_work\_guard<io\_context::executor\_type>:
72582
72583
72584
72585    boost::asio::io_context io_context;
72586    boost::asio::executor_work_guard<boost::asio::io_context::executor_type>
72587      = boost::asio::make_work_guard(io_context);
72588    ... 
72589
72590
72591
72592
72593 To effect a shutdown, the application will then need to call the [link boost_asio.reference.io_context `io_context`] object's `stop()` member function. This will cause the [link boost_asio.reference.io_context `io_context`] `run()` call to return as soon as possible, abandoning unfinished operations and without permitting ready handlers to be dispatched.
72594
72595 Alternatively, if the application requires that all operations and handlers be allowed to finish normally, the work object may be explicitly reset.
72596
72597
72598
72599    boost::asio::io_context io_context;
72600    boost::asio::executor_work_guard<boost::asio::io_context::executor_type>
72601      = boost::asio::make_work_guard(io_context);
72602    ...
72603    work.reset(); // Allow run() to exit. 
72604
72605
72606
72607
72608
72609 [heading Requirements]
72610
72611 ['Header: ][^boost/asio/io_service.hpp]
72612
72613 ['Convenience header: ][^boost/asio.hpp]
72614
72615
72616 [endsect]
72617
72618
72619 [section:ip__address ip::address]
72620
72621
72622 Implements version-independent IP addresses. 
72623
72624
72625   class address
72626
72627
72628 [heading Member Functions]
72629 [table
72630   [[Name][Description]]
72631
72632   [
72633     [[link boost_asio.reference.ip__address.address [*address]]]
72634     [Default constructor. 
72635      [hr]
72636      Construct an address from an IPv4 address. 
72637      [hr]
72638      Construct an address from an IPv6 address. 
72639      [hr]
72640      Copy constructor. ]
72641   ]
72642   
72643   [
72644     [[link boost_asio.reference.ip__address.from_string [*from_string]]]
72645     [(Deprecated: Use make_address().) Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. ]
72646   ]
72647   
72648   [
72649     [[link boost_asio.reference.ip__address.is_loopback [*is_loopback]]]
72650     [Determine whether the address is a loopback address. ]
72651   ]
72652   
72653   [
72654     [[link boost_asio.reference.ip__address.is_multicast [*is_multicast]]]
72655     [Determine whether the address is a multicast address. ]
72656   ]
72657   
72658   [
72659     [[link boost_asio.reference.ip__address.is_unspecified [*is_unspecified]]]
72660     [Determine whether the address is unspecified. ]
72661   ]
72662   
72663   [
72664     [[link boost_asio.reference.ip__address.is_v4 [*is_v4]]]
72665     [Get whether the address is an IP version 4 address. ]
72666   ]
72667   
72668   [
72669     [[link boost_asio.reference.ip__address.is_v6 [*is_v6]]]
72670     [Get whether the address is an IP version 6 address. ]
72671   ]
72672   
72673   [
72674     [[link boost_asio.reference.ip__address.operator_eq_ [*operator=]]]
72675     [Assign from another address. 
72676      [hr]
72677      Assign from an IPv4 address. 
72678      [hr]
72679      Assign from an IPv6 address. ]
72680   ]
72681   
72682   [
72683     [[link boost_asio.reference.ip__address.to_string [*to_string]]]
72684     [Get the address as a string. 
72685      [hr]
72686      (Deprecated: Use other overload.) Get the address as a string. ]
72687   ]
72688   
72689   [
72690     [[link boost_asio.reference.ip__address.to_v4 [*to_v4]]]
72691     [Get the address as an IP version 4 address. ]
72692   ]
72693   
72694   [
72695     [[link boost_asio.reference.ip__address.to_v6 [*to_v6]]]
72696     [Get the address as an IP version 6 address. ]
72697   ]
72698   
72699 ]
72700
72701 [heading Friends]
72702 [table
72703   [[Name][Description]]
72704
72705   [
72706     [[link boost_asio.reference.ip__address.operator_not__eq_ [*operator!=]]]
72707     [Compare two addresses for inequality. ]
72708   ]
72709   
72710   [
72711     [[link boost_asio.reference.ip__address.operator_lt_ [*operator<]]]
72712     [Compare addresses for ordering. ]
72713   ]
72714   
72715   [
72716     [[link boost_asio.reference.ip__address.operator_lt__eq_ [*operator<=]]]
72717     [Compare addresses for ordering. ]
72718   ]
72719   
72720   [
72721     [[link boost_asio.reference.ip__address.operator_eq__eq_ [*operator==]]]
72722     [Compare two addresses for equality. ]
72723   ]
72724   
72725   [
72726     [[link boost_asio.reference.ip__address.operator_gt_ [*operator>]]]
72727     [Compare addresses for ordering. ]
72728   ]
72729   
72730   [
72731     [[link boost_asio.reference.ip__address.operator_gt__eq_ [*operator>=]]]
72732     [Compare addresses for ordering. ]
72733   ]
72734   
72735 ]
72736
72737 [heading Related Functions]
72738 [table
72739   [[Name][Description]]
72740
72741   [
72742     [[link boost_asio.reference.ip__address.make_address [*make_address]]]
72743     [Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. ]
72744   ]
72745   
72746   [
72747     [[link boost_asio.reference.ip__address.operator_lt__lt_ [*operator<<]]]
72748     [Output an address as a string. ]
72749   ]
72750   
72751 ]
72752
72753 The [link boost_asio.reference.ip__address `ip::address`] class provides the ability to use either IP version 4 or version 6 addresses.
72754
72755
72756 [heading Thread Safety]
72757   
72758 ['Distinct] ['objects:] Safe.
72759
72760 ['Shared] ['objects:] Unsafe. 
72761
72762
72763
72764 [heading Requirements]
72765
72766 ['Header: ][^boost/asio/ip/address.hpp]
72767
72768 ['Convenience header: ][^boost/asio.hpp]
72769
72770 [section:address ip::address::address]
72771
72772 [indexterm2 boost_asio.indexterm.ip__address.address..address..ip::address] 
72773 Default constructor. 
72774
72775
72776   ``[link boost_asio.reference.ip__address.address.overload1 address]``();
72777   ``  [''''&raquo;''' [link boost_asio.reference.ip__address.address.overload1 more...]]``
72778
72779
72780 Construct an address from an IPv4 address. 
72781
72782
72783   ``[link boost_asio.reference.ip__address.address.overload2 address]``(
72784       const boost::asio::ip::address_v4 & ipv4_address);
72785   ``  [''''&raquo;''' [link boost_asio.reference.ip__address.address.overload2 more...]]``
72786
72787
72788 Construct an address from an IPv6 address. 
72789
72790
72791   ``[link boost_asio.reference.ip__address.address.overload3 address]``(
72792       const boost::asio::ip::address_v6 & ipv6_address);
72793   ``  [''''&raquo;''' [link boost_asio.reference.ip__address.address.overload3 more...]]``
72794
72795
72796 Copy constructor. 
72797
72798
72799   ``[link boost_asio.reference.ip__address.address.overload4 address]``(
72800       const address & other);
72801   ``  [''''&raquo;''' [link boost_asio.reference.ip__address.address.overload4 more...]]``
72802
72803
72804 [section:overload1 ip::address::address (1 of 4 overloads)]
72805
72806
72807 Default constructor. 
72808
72809
72810   address();
72811
72812
72813
72814 [endsect]
72815
72816
72817
72818 [section:overload2 ip::address::address (2 of 4 overloads)]
72819
72820
72821 Construct an address from an IPv4 address. 
72822
72823
72824   address(
72825       const boost::asio::ip::address_v4 & ipv4_address);
72826
72827
72828
72829 [endsect]
72830
72831
72832
72833 [section:overload3 ip::address::address (3 of 4 overloads)]
72834
72835
72836 Construct an address from an IPv6 address. 
72837
72838
72839   address(
72840       const boost::asio::ip::address_v6 & ipv6_address);
72841
72842
72843
72844 [endsect]
72845
72846
72847
72848 [section:overload4 ip::address::address (4 of 4 overloads)]
72849
72850
72851 Copy constructor. 
72852
72853
72854   address(
72855       const address & other);
72856
72857
72858
72859 [endsect]
72860
72861
72862 [endsect]
72863
72864 [section:from_string ip::address::from_string]
72865
72866 [indexterm2 boost_asio.indexterm.ip__address.from_string..from_string..ip::address] 
72867 (Deprecated: Use `make_address()`.) Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. 
72868
72869
72870   static address ``[link boost_asio.reference.ip__address.from_string.overload1 from_string]``(
72871       const char * str);
72872   ``  [''''&raquo;''' [link boost_asio.reference.ip__address.from_string.overload1 more...]]``
72873
72874   static address ``[link boost_asio.reference.ip__address.from_string.overload2 from_string]``(
72875       const char * str,
72876       boost::system::error_code & ec);
72877   ``  [''''&raquo;''' [link boost_asio.reference.ip__address.from_string.overload2 more...]]``
72878
72879   static address ``[link boost_asio.reference.ip__address.from_string.overload3 from_string]``(
72880       const std::string & str);
72881   ``  [''''&raquo;''' [link boost_asio.reference.ip__address.from_string.overload3 more...]]``
72882
72883   static address ``[link boost_asio.reference.ip__address.from_string.overload4 from_string]``(
72884       const std::string & str,
72885       boost::system::error_code & ec);
72886   ``  [''''&raquo;''' [link boost_asio.reference.ip__address.from_string.overload4 more...]]``
72887
72888
72889 [section:overload1 ip::address::from_string (1 of 4 overloads)]
72890
72891
72892 (Deprecated: Use `make_address()`.) Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. 
72893
72894
72895   static address from_string(
72896       const char * str);
72897
72898
72899
72900 [endsect]
72901
72902
72903
72904 [section:overload2 ip::address::from_string (2 of 4 overloads)]
72905
72906
72907 (Deprecated: Use `make_address()`.) Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. 
72908
72909
72910   static address from_string(
72911       const char * str,
72912       boost::system::error_code & ec);
72913
72914
72915
72916 [endsect]
72917
72918
72919
72920 [section:overload3 ip::address::from_string (3 of 4 overloads)]
72921
72922
72923 (Deprecated: Use `make_address()`.) Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. 
72924
72925
72926   static address from_string(
72927       const std::string & str);
72928
72929
72930
72931 [endsect]
72932
72933
72934
72935 [section:overload4 ip::address::from_string (4 of 4 overloads)]
72936
72937
72938 (Deprecated: Use `make_address()`.) Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. 
72939
72940
72941   static address from_string(
72942       const std::string & str,
72943       boost::system::error_code & ec);
72944
72945
72946
72947 [endsect]
72948
72949
72950 [endsect]
72951
72952
72953 [section:is_loopback ip::address::is_loopback]
72954
72955 [indexterm2 boost_asio.indexterm.ip__address.is_loopback..is_loopback..ip::address] 
72956 Determine whether the address is a loopback address. 
72957
72958
72959   bool is_loopback() const;
72960
72961
72962
72963 [endsect]
72964
72965
72966
72967 [section:is_multicast ip::address::is_multicast]
72968
72969 [indexterm2 boost_asio.indexterm.ip__address.is_multicast..is_multicast..ip::address] 
72970 Determine whether the address is a multicast address. 
72971
72972
72973   bool is_multicast() const;
72974
72975
72976
72977 [endsect]
72978
72979
72980
72981 [section:is_unspecified ip::address::is_unspecified]
72982
72983 [indexterm2 boost_asio.indexterm.ip__address.is_unspecified..is_unspecified..ip::address] 
72984 Determine whether the address is unspecified. 
72985
72986
72987   bool is_unspecified() const;
72988
72989
72990
72991 [endsect]
72992
72993
72994
72995 [section:is_v4 ip::address::is_v4]
72996
72997 [indexterm2 boost_asio.indexterm.ip__address.is_v4..is_v4..ip::address] 
72998 Get whether the address is an IP version 4 address. 
72999
73000
73001   bool is_v4() const;
73002
73003
73004
73005 [endsect]
73006
73007
73008
73009 [section:is_v6 ip::address::is_v6]
73010
73011 [indexterm2 boost_asio.indexterm.ip__address.is_v6..is_v6..ip::address] 
73012 Get whether the address is an IP version 6 address. 
73013
73014
73015   bool is_v6() const;
73016
73017
73018
73019 [endsect]
73020
73021
73022 [section:make_address ip::address::make_address]
73023
73024 [indexterm2 boost_asio.indexterm.ip__address.make_address..make_address..ip::address] 
73025 Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. 
73026
73027
73028   address ``[link boost_asio.reference.ip__address.make_address.overload1 make_address]``(
73029       const char * str);
73030   ``  [''''&raquo;''' [link boost_asio.reference.ip__address.make_address.overload1 more...]]``
73031
73032   address ``[link boost_asio.reference.ip__address.make_address.overload2 make_address]``(
73033       const char * str,
73034       boost::system::error_code & ec);
73035   ``  [''''&raquo;''' [link boost_asio.reference.ip__address.make_address.overload2 more...]]``
73036
73037   address ``[link boost_asio.reference.ip__address.make_address.overload3 make_address]``(
73038       const std::string & str);
73039   ``  [''''&raquo;''' [link boost_asio.reference.ip__address.make_address.overload3 more...]]``
73040
73041   address ``[link boost_asio.reference.ip__address.make_address.overload4 make_address]``(
73042       const std::string & str,
73043       boost::system::error_code & ec);
73044   ``  [''''&raquo;''' [link boost_asio.reference.ip__address.make_address.overload4 more...]]``
73045
73046   address ``[link boost_asio.reference.ip__address.make_address.overload5 make_address]``(
73047       string_view str);
73048   ``  [''''&raquo;''' [link boost_asio.reference.ip__address.make_address.overload5 more...]]``
73049
73050   address ``[link boost_asio.reference.ip__address.make_address.overload6 make_address]``(
73051       string_view str,
73052       boost::system::error_code & ec);
73053   ``  [''''&raquo;''' [link boost_asio.reference.ip__address.make_address.overload6 more...]]``
73054
73055
73056 [section:overload1 ip::address::make_address (1 of 6 overloads)]
73057
73058
73059 Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. 
73060
73061
73062   address make_address(
73063       const char * str);
73064
73065
73066
73067 [endsect]
73068
73069
73070
73071 [section:overload2 ip::address::make_address (2 of 6 overloads)]
73072
73073
73074 Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. 
73075
73076
73077   address make_address(
73078       const char * str,
73079       boost::system::error_code & ec);
73080
73081
73082
73083 [endsect]
73084
73085
73086
73087 [section:overload3 ip::address::make_address (3 of 6 overloads)]
73088
73089
73090 Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. 
73091
73092
73093   address make_address(
73094       const std::string & str);
73095
73096
73097
73098 [endsect]
73099
73100
73101
73102 [section:overload4 ip::address::make_address (4 of 6 overloads)]
73103
73104
73105 Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. 
73106
73107
73108   address make_address(
73109       const std::string & str,
73110       boost::system::error_code & ec);
73111
73112
73113
73114 [endsect]
73115
73116
73117
73118 [section:overload5 ip::address::make_address (5 of 6 overloads)]
73119
73120
73121 Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. 
73122
73123
73124   address make_address(
73125       string_view str);
73126
73127
73128
73129 [endsect]
73130
73131
73132
73133 [section:overload6 ip::address::make_address (6 of 6 overloads)]
73134
73135
73136 Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. 
73137
73138
73139   address make_address(
73140       string_view str,
73141       boost::system::error_code & ec);
73142
73143
73144
73145 [endsect]
73146
73147
73148 [endsect]
73149
73150
73151 [section:operator_not__eq_ ip::address::operator!=]
73152
73153 [indexterm2 boost_asio.indexterm.ip__address.operator_not__eq_..operator!=..ip::address] 
73154 Compare two addresses for inequality. 
73155
73156
73157   friend bool operator!=(
73158       const address & a1,
73159       const address & a2);
73160
73161
73162 [heading Requirements]
73163
73164 ['Header: ][^boost/asio/ip/address.hpp]
73165
73166 ['Convenience header: ][^boost/asio.hpp]
73167
73168
73169 [endsect]
73170
73171
73172
73173 [section:operator_lt_ ip::address::operator<]
73174
73175 [indexterm2 boost_asio.indexterm.ip__address.operator_lt_..operator<..ip::address] 
73176 Compare addresses for ordering. 
73177
73178
73179   friend bool operator<(
73180       const address & a1,
73181       const address & a2);
73182
73183
73184 [heading Requirements]
73185
73186 ['Header: ][^boost/asio/ip/address.hpp]
73187
73188 ['Convenience header: ][^boost/asio.hpp]
73189
73190
73191 [endsect]
73192
73193
73194
73195 [section:operator_lt__lt_ ip::address::operator<<]
73196
73197 [indexterm2 boost_asio.indexterm.ip__address.operator_lt__lt_..operator<<..ip::address] 
73198 Output an address as a string. 
73199
73200
73201   template<
73202       typename Elem,
73203       typename Traits>
73204   std::basic_ostream< Elem, Traits > & operator<<(
73205       std::basic_ostream< Elem, Traits > & os,
73206       const address & addr);
73207
73208
73209 Used to output a human-readable string for a specified address.
73210
73211
73212 [heading Parameters]
73213     
73214
73215 [variablelist
73216   
73217 [[os][The output stream to which the string will be written.]]
73218
73219 [[addr][The address to be written.]]
73220
73221 ]
73222
73223
73224 [heading Return Value]
73225       
73226 The output stream. 
73227
73228
73229
73230
73231 [endsect]
73232
73233
73234
73235 [section:operator_lt__eq_ ip::address::operator<=]
73236
73237 [indexterm2 boost_asio.indexterm.ip__address.operator_lt__eq_..operator<=..ip::address] 
73238 Compare addresses for ordering. 
73239
73240
73241   friend bool operator<=(
73242       const address & a1,
73243       const address & a2);
73244
73245
73246 [heading Requirements]
73247
73248 ['Header: ][^boost/asio/ip/address.hpp]
73249
73250 ['Convenience header: ][^boost/asio.hpp]
73251
73252
73253 [endsect]
73254
73255
73256 [section:operator_eq_ ip::address::operator=]
73257
73258 [indexterm2 boost_asio.indexterm.ip__address.operator_eq_..operator=..ip::address] 
73259 Assign from another address. 
73260
73261
73262   address & ``[link boost_asio.reference.ip__address.operator_eq_.overload1 operator=]``(
73263       const address & other);
73264   ``  [''''&raquo;''' [link boost_asio.reference.ip__address.operator_eq_.overload1 more...]]``
73265
73266
73267 Assign from an IPv4 address. 
73268
73269
73270   address & ``[link boost_asio.reference.ip__address.operator_eq_.overload2 operator=]``(
73271       const boost::asio::ip::address_v4 & ipv4_address);
73272   ``  [''''&raquo;''' [link boost_asio.reference.ip__address.operator_eq_.overload2 more...]]``
73273
73274
73275 Assign from an IPv6 address. 
73276
73277
73278   address & ``[link boost_asio.reference.ip__address.operator_eq_.overload3 operator=]``(
73279       const boost::asio::ip::address_v6 & ipv6_address);
73280   ``  [''''&raquo;''' [link boost_asio.reference.ip__address.operator_eq_.overload3 more...]]``
73281
73282
73283 [section:overload1 ip::address::operator= (1 of 3 overloads)]
73284
73285
73286 Assign from another address. 
73287
73288
73289   address & operator=(
73290       const address & other);
73291
73292
73293
73294 [endsect]
73295
73296
73297
73298 [section:overload2 ip::address::operator= (2 of 3 overloads)]
73299
73300
73301 Assign from an IPv4 address. 
73302
73303
73304   address & operator=(
73305       const boost::asio::ip::address_v4 & ipv4_address);
73306
73307
73308
73309 [endsect]
73310
73311
73312
73313 [section:overload3 ip::address::operator= (3 of 3 overloads)]
73314
73315
73316 Assign from an IPv6 address. 
73317
73318
73319   address & operator=(
73320       const boost::asio::ip::address_v6 & ipv6_address);
73321
73322
73323
73324 [endsect]
73325
73326
73327 [endsect]
73328
73329
73330 [section:operator_eq__eq_ ip::address::operator==]
73331
73332 [indexterm2 boost_asio.indexterm.ip__address.operator_eq__eq_..operator==..ip::address] 
73333 Compare two addresses for equality. 
73334
73335
73336   friend bool operator==(
73337       const address & a1,
73338       const address & a2);
73339
73340
73341 [heading Requirements]
73342
73343 ['Header: ][^boost/asio/ip/address.hpp]
73344
73345 ['Convenience header: ][^boost/asio.hpp]
73346
73347
73348 [endsect]
73349
73350
73351
73352 [section:operator_gt_ ip::address::operator>]
73353
73354 [indexterm2 boost_asio.indexterm.ip__address.operator_gt_..operator>..ip::address] 
73355 Compare addresses for ordering. 
73356
73357
73358   friend bool operator>(
73359       const address & a1,
73360       const address & a2);
73361
73362
73363 [heading Requirements]
73364
73365 ['Header: ][^boost/asio/ip/address.hpp]
73366
73367 ['Convenience header: ][^boost/asio.hpp]
73368
73369
73370 [endsect]
73371
73372
73373
73374 [section:operator_gt__eq_ ip::address::operator>=]
73375
73376 [indexterm2 boost_asio.indexterm.ip__address.operator_gt__eq_..operator>=..ip::address] 
73377 Compare addresses for ordering. 
73378
73379
73380   friend bool operator>=(
73381       const address & a1,
73382       const address & a2);
73383
73384
73385 [heading Requirements]
73386
73387 ['Header: ][^boost/asio/ip/address.hpp]
73388
73389 ['Convenience header: ][^boost/asio.hpp]
73390
73391
73392 [endsect]
73393
73394
73395 [section:to_string ip::address::to_string]
73396
73397 [indexterm2 boost_asio.indexterm.ip__address.to_string..to_string..ip::address] 
73398 Get the address as a string. 
73399
73400
73401   std::string ``[link boost_asio.reference.ip__address.to_string.overload1 to_string]``() const;
73402   ``  [''''&raquo;''' [link boost_asio.reference.ip__address.to_string.overload1 more...]]``
73403
73404
73405 (Deprecated: Use other overload.) Get the address as a string. 
73406
73407
73408   std::string ``[link boost_asio.reference.ip__address.to_string.overload2 to_string]``(
73409       boost::system::error_code & ec) const;
73410   ``  [''''&raquo;''' [link boost_asio.reference.ip__address.to_string.overload2 more...]]``
73411
73412
73413 [section:overload1 ip::address::to_string (1 of 2 overloads)]
73414
73415
73416 Get the address as a string. 
73417
73418
73419   std::string to_string() const;
73420
73421
73422
73423 [endsect]
73424
73425
73426
73427 [section:overload2 ip::address::to_string (2 of 2 overloads)]
73428
73429
73430 (Deprecated: Use other overload.) Get the address as a string. 
73431
73432
73433   std::string to_string(
73434       boost::system::error_code & ec) const;
73435
73436
73437
73438 [endsect]
73439
73440
73441 [endsect]
73442
73443
73444 [section:to_v4 ip::address::to_v4]
73445
73446 [indexterm2 boost_asio.indexterm.ip__address.to_v4..to_v4..ip::address] 
73447 Get the address as an IP version 4 address. 
73448
73449
73450   boost::asio::ip::address_v4 to_v4() const;
73451
73452
73453
73454 [endsect]
73455
73456
73457
73458 [section:to_v6 ip::address::to_v6]
73459
73460 [indexterm2 boost_asio.indexterm.ip__address.to_v6..to_v6..ip::address] 
73461 Get the address as an IP version 6 address. 
73462
73463
73464   boost::asio::ip::address_v6 to_v6() const;
73465
73466
73467
73468 [endsect]
73469
73470
73471
73472 [endsect]
73473
73474 [section:ip__address_v4 ip::address_v4]
73475
73476
73477 Implements IP version 4 style addresses. 
73478
73479
73480   class address_v4
73481
73482
73483 [heading Types]
73484 [table
73485   [[Name][Description]]
73486
73487   [
73488
73489     [[link boost_asio.reference.ip__address_v4.bytes_type [*bytes_type]]]
73490     [The type used to represent an address as an array of bytes. ]
73491   
73492   ]
73493
73494   [
73495
73496     [[link boost_asio.reference.ip__address_v4.uint_type [*uint_type]]]
73497     [The type used to represent an address as an unsigned integer. ]
73498   
73499   ]
73500
73501 ]
73502
73503 [heading Member Functions]
73504 [table
73505   [[Name][Description]]
73506
73507   [
73508     [[link boost_asio.reference.ip__address_v4.address_v4 [*address_v4]]]
73509     [Default constructor. 
73510      [hr]
73511      Construct an address from raw bytes. 
73512      [hr]
73513      Construct an address from an unsigned integer in host byte order. 
73514      [hr]
73515      Copy constructor. ]
73516   ]
73517   
73518   [
73519     [[link boost_asio.reference.ip__address_v4.any [*any]]]
73520     [Obtain an address object that represents any address. ]
73521   ]
73522   
73523   [
73524     [[link boost_asio.reference.ip__address_v4.broadcast [*broadcast]]]
73525     [Obtain an address object that represents the broadcast address. 
73526      [hr]
73527      (Deprecated: Use network_v4 class.) Obtain an address object that represents the broadcast address that corresponds to the specified address and netmask. ]
73528   ]
73529   
73530   [
73531     [[link boost_asio.reference.ip__address_v4.from_string [*from_string]]]
73532     [(Deprecated: Use make_address_v4().) Create an address from an IP address string in dotted decimal form. ]
73533   ]
73534   
73535   [
73536     [[link boost_asio.reference.ip__address_v4.is_class_a [*is_class_a]]]
73537     [(Deprecated: Use network_v4 class.) Determine whether the address is a class A address. ]
73538   ]
73539   
73540   [
73541     [[link boost_asio.reference.ip__address_v4.is_class_b [*is_class_b]]]
73542     [(Deprecated: Use network_v4 class.) Determine whether the address is a class B address. ]
73543   ]
73544   
73545   [
73546     [[link boost_asio.reference.ip__address_v4.is_class_c [*is_class_c]]]
73547     [(Deprecated: Use network_v4 class.) Determine whether the address is a class C address. ]
73548   ]
73549   
73550   [
73551     [[link boost_asio.reference.ip__address_v4.is_loopback [*is_loopback]]]
73552     [Determine whether the address is a loopback address. ]
73553   ]
73554   
73555   [
73556     [[link boost_asio.reference.ip__address_v4.is_multicast [*is_multicast]]]
73557     [Determine whether the address is a multicast address. ]
73558   ]
73559   
73560   [
73561     [[link boost_asio.reference.ip__address_v4.is_unspecified [*is_unspecified]]]
73562     [Determine whether the address is unspecified. ]
73563   ]
73564   
73565   [
73566     [[link boost_asio.reference.ip__address_v4.loopback [*loopback]]]
73567     [Obtain an address object that represents the loopback address. ]
73568   ]
73569   
73570   [
73571     [[link boost_asio.reference.ip__address_v4.netmask [*netmask]]]
73572     [(Deprecated: Use network_v4 class.) Obtain the netmask that corresponds to the address, based on its address class. ]
73573   ]
73574   
73575   [
73576     [[link boost_asio.reference.ip__address_v4.operator_eq_ [*operator=]]]
73577     [Assign from another address. ]
73578   ]
73579   
73580   [
73581     [[link boost_asio.reference.ip__address_v4.to_bytes [*to_bytes]]]
73582     [Get the address in bytes, in network byte order. ]
73583   ]
73584   
73585   [
73586     [[link boost_asio.reference.ip__address_v4.to_string [*to_string]]]
73587     [Get the address as a string in dotted decimal format. 
73588      [hr]
73589      (Deprecated: Use other overload.) Get the address as a string in dotted decimal format. ]
73590   ]
73591   
73592   [
73593     [[link boost_asio.reference.ip__address_v4.to_uint [*to_uint]]]
73594     [Get the address as an unsigned integer in host byte order. ]
73595   ]
73596   
73597   [
73598     [[link boost_asio.reference.ip__address_v4.to_ulong [*to_ulong]]]
73599     [Get the address as an unsigned long in host byte order. ]
73600   ]
73601   
73602 ]
73603
73604 [heading Friends]
73605 [table
73606   [[Name][Description]]
73607
73608   [
73609     [[link boost_asio.reference.ip__address_v4.operator_not__eq_ [*operator!=]]]
73610     [Compare two addresses for inequality. ]
73611   ]
73612   
73613   [
73614     [[link boost_asio.reference.ip__address_v4.operator_lt_ [*operator<]]]
73615     [Compare addresses for ordering. ]
73616   ]
73617   
73618   [
73619     [[link boost_asio.reference.ip__address_v4.operator_lt__eq_ [*operator<=]]]
73620     [Compare addresses for ordering. ]
73621   ]
73622   
73623   [
73624     [[link boost_asio.reference.ip__address_v4.operator_eq__eq_ [*operator==]]]
73625     [Compare two addresses for equality. ]
73626   ]
73627   
73628   [
73629     [[link boost_asio.reference.ip__address_v4.operator_gt_ [*operator>]]]
73630     [Compare addresses for ordering. ]
73631   ]
73632   
73633   [
73634     [[link boost_asio.reference.ip__address_v4.operator_gt__eq_ [*operator>=]]]
73635     [Compare addresses for ordering. ]
73636   ]
73637   
73638 ]
73639
73640 [heading Related Functions]
73641 [table
73642   [[Name][Description]]
73643
73644   [
73645     [[link boost_asio.reference.ip__address_v4.make_address_v4 [*make_address_v4]]]
73646     [Create an IPv4 address from raw bytes in network order. 
73647
73648      Create an IPv4 address from an unsigned integer in host byte order. 
73649
73650      Create an IPv4 address from an IP address string in dotted decimal form. 
73651
73652      Create an IPv4 address from a IPv4-mapped IPv6 address. ]
73653   ]
73654   
73655   [
73656     [[link boost_asio.reference.ip__address_v4.make_network_v4 [*make_network_v4]]]
73657     [Create an IPv4 network from an address and prefix length. 
73658
73659      Create an IPv4 network from an address and netmask. ]
73660   ]
73661   
73662   [
73663     [[link boost_asio.reference.ip__address_v4.operator_lt__lt_ [*operator<<]]]
73664     [Output an address as a string. 
73665
73666      Output a network as a string. ]
73667   ]
73668   
73669 ]
73670
73671 The [link boost_asio.reference.ip__address_v4 `ip::address_v4`] class provides the ability to use and manipulate IP version 4 addresses.
73672
73673
73674 [heading Thread Safety]
73675   
73676 ['Distinct] ['objects:] Safe.
73677
73678 ['Shared] ['objects:] Unsafe. 
73679
73680
73681
73682 [heading Requirements]
73683
73684 ['Header: ][^boost/asio/ip/address_v4.hpp]
73685
73686 ['Convenience header: ][^boost/asio.hpp]
73687
73688 [section:address_v4 ip::address_v4::address_v4]
73689
73690 [indexterm2 boost_asio.indexterm.ip__address_v4.address_v4..address_v4..ip::address_v4] 
73691 Default constructor. 
73692
73693
73694   ``[link boost_asio.reference.ip__address_v4.address_v4.overload1 address_v4]``();
73695   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v4.address_v4.overload1 more...]]``
73696
73697
73698 Construct an address from raw bytes. 
73699
73700
73701   explicit ``[link boost_asio.reference.ip__address_v4.address_v4.overload2 address_v4]``(
73702       const bytes_type & bytes);
73703   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v4.address_v4.overload2 more...]]``
73704
73705
73706 Construct an address from an unsigned integer in host byte order. 
73707
73708
73709   explicit ``[link boost_asio.reference.ip__address_v4.address_v4.overload3 address_v4]``(
73710       uint_type addr);
73711   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v4.address_v4.overload3 more...]]``
73712
73713
73714 Copy constructor. 
73715
73716
73717   ``[link boost_asio.reference.ip__address_v4.address_v4.overload4 address_v4]``(
73718       const address_v4 & other);
73719   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v4.address_v4.overload4 more...]]``
73720
73721
73722 [section:overload1 ip::address_v4::address_v4 (1 of 4 overloads)]
73723
73724
73725 Default constructor. 
73726
73727
73728   address_v4();
73729
73730
73731
73732 [endsect]
73733
73734
73735
73736 [section:overload2 ip::address_v4::address_v4 (2 of 4 overloads)]
73737
73738
73739 Construct an address from raw bytes. 
73740
73741
73742   address_v4(
73743       const bytes_type & bytes);
73744
73745
73746
73747 [endsect]
73748
73749
73750
73751 [section:overload3 ip::address_v4::address_v4 (3 of 4 overloads)]
73752
73753
73754 Construct an address from an unsigned integer in host byte order. 
73755
73756
73757   address_v4(
73758       uint_type addr);
73759
73760
73761
73762 [endsect]
73763
73764
73765
73766 [section:overload4 ip::address_v4::address_v4 (4 of 4 overloads)]
73767
73768
73769 Copy constructor. 
73770
73771
73772   address_v4(
73773       const address_v4 & other);
73774
73775
73776
73777 [endsect]
73778
73779
73780 [endsect]
73781
73782
73783 [section:any ip::address_v4::any]
73784
73785 [indexterm2 boost_asio.indexterm.ip__address_v4.any..any..ip::address_v4] 
73786 Obtain an address object that represents any address. 
73787
73788
73789   static address_v4 any();
73790
73791
73792
73793 [endsect]
73794
73795
73796 [section:broadcast ip::address_v4::broadcast]
73797
73798 [indexterm2 boost_asio.indexterm.ip__address_v4.broadcast..broadcast..ip::address_v4] 
73799 Obtain an address object that represents the broadcast address. 
73800
73801
73802   static address_v4 ``[link boost_asio.reference.ip__address_v4.broadcast.overload1 broadcast]``();
73803   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v4.broadcast.overload1 more...]]``
73804
73805
73806 (Deprecated: Use [link boost_asio.reference.ip__network_v4 `ip::network_v4`] class.) Obtain an address object that represents the broadcast address that corresponds to the specified address and netmask. 
73807
73808
73809   static address_v4 ``[link boost_asio.reference.ip__address_v4.broadcast.overload2 broadcast]``(
73810       const address_v4 & addr,
73811       const address_v4 & mask);
73812   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v4.broadcast.overload2 more...]]``
73813
73814
73815 [section:overload1 ip::address_v4::broadcast (1 of 2 overloads)]
73816
73817
73818 Obtain an address object that represents the broadcast address. 
73819
73820
73821   static address_v4 broadcast();
73822
73823
73824
73825 [endsect]
73826
73827
73828
73829 [section:overload2 ip::address_v4::broadcast (2 of 2 overloads)]
73830
73831
73832 (Deprecated: Use [link boost_asio.reference.ip__network_v4 `ip::network_v4`] class.) Obtain an address object that represents the broadcast address that corresponds to the specified address and netmask. 
73833
73834
73835   static address_v4 broadcast(
73836       const address_v4 & addr,
73837       const address_v4 & mask);
73838
73839
73840
73841 [endsect]
73842
73843
73844 [endsect]
73845
73846
73847 [section:bytes_type ip::address_v4::bytes_type]
73848
73849 [indexterm2 boost_asio.indexterm.ip__address_v4.bytes_type..bytes_type..ip::address_v4] 
73850 The type used to represent an address as an array of bytes. 
73851
73852
73853   typedef array< unsigned char, 4 > bytes_type;
73854
73855
73856
73857
73858 [heading Remarks]
73859       
73860 This type is defined in terms of the C++0x template `std::array` when it is available. Otherwise, it uses `boost:array`. 
73861
73862
73863
73864 [heading Requirements]
73865
73866 ['Header: ][^boost/asio/ip/address_v4.hpp]
73867
73868 ['Convenience header: ][^boost/asio.hpp]
73869
73870
73871 [endsect]
73872
73873
73874 [section:from_string ip::address_v4::from_string]
73875
73876 [indexterm2 boost_asio.indexterm.ip__address_v4.from_string..from_string..ip::address_v4] 
73877 (Deprecated: Use `make_address_v4()`.) Create an address from an IP address string in dotted decimal form. 
73878
73879
73880   static address_v4 ``[link boost_asio.reference.ip__address_v4.from_string.overload1 from_string]``(
73881       const char * str);
73882   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v4.from_string.overload1 more...]]``
73883
73884   static address_v4 ``[link boost_asio.reference.ip__address_v4.from_string.overload2 from_string]``(
73885       const char * str,
73886       boost::system::error_code & ec);
73887   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v4.from_string.overload2 more...]]``
73888
73889   static address_v4 ``[link boost_asio.reference.ip__address_v4.from_string.overload3 from_string]``(
73890       const std::string & str);
73891   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v4.from_string.overload3 more...]]``
73892
73893   static address_v4 ``[link boost_asio.reference.ip__address_v4.from_string.overload4 from_string]``(
73894       const std::string & str,
73895       boost::system::error_code & ec);
73896   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v4.from_string.overload4 more...]]``
73897
73898
73899 [section:overload1 ip::address_v4::from_string (1 of 4 overloads)]
73900
73901
73902 (Deprecated: Use `make_address_v4()`.) Create an address from an IP address string in dotted decimal form. 
73903
73904
73905   static address_v4 from_string(
73906       const char * str);
73907
73908
73909
73910 [endsect]
73911
73912
73913
73914 [section:overload2 ip::address_v4::from_string (2 of 4 overloads)]
73915
73916
73917 (Deprecated: Use `make_address_v4()`.) Create an address from an IP address string in dotted decimal form. 
73918
73919
73920   static address_v4 from_string(
73921       const char * str,
73922       boost::system::error_code & ec);
73923
73924
73925
73926 [endsect]
73927
73928
73929
73930 [section:overload3 ip::address_v4::from_string (3 of 4 overloads)]
73931
73932
73933 (Deprecated: Use `make_address_v4()`.) Create an address from an IP address string in dotted decimal form. 
73934
73935
73936   static address_v4 from_string(
73937       const std::string & str);
73938
73939
73940
73941 [endsect]
73942
73943
73944
73945 [section:overload4 ip::address_v4::from_string (4 of 4 overloads)]
73946
73947
73948 (Deprecated: Use `make_address_v4()`.) Create an address from an IP address string in dotted decimal form. 
73949
73950
73951   static address_v4 from_string(
73952       const std::string & str,
73953       boost::system::error_code & ec);
73954
73955
73956
73957 [endsect]
73958
73959
73960 [endsect]
73961
73962
73963 [section:is_class_a ip::address_v4::is_class_a]
73964
73965 [indexterm2 boost_asio.indexterm.ip__address_v4.is_class_a..is_class_a..ip::address_v4] 
73966 (Deprecated: Use [link boost_asio.reference.ip__network_v4 `ip::network_v4`] class.) Determine whether the address is a class A address. 
73967
73968
73969   bool is_class_a() const;
73970
73971
73972
73973 [endsect]
73974
73975
73976
73977 [section:is_class_b ip::address_v4::is_class_b]
73978
73979 [indexterm2 boost_asio.indexterm.ip__address_v4.is_class_b..is_class_b..ip::address_v4] 
73980 (Deprecated: Use [link boost_asio.reference.ip__network_v4 `ip::network_v4`] class.) Determine whether the address is a class B address. 
73981
73982
73983   bool is_class_b() const;
73984
73985
73986
73987 [endsect]
73988
73989
73990
73991 [section:is_class_c ip::address_v4::is_class_c]
73992
73993 [indexterm2 boost_asio.indexterm.ip__address_v4.is_class_c..is_class_c..ip::address_v4] 
73994 (Deprecated: Use [link boost_asio.reference.ip__network_v4 `ip::network_v4`] class.) Determine whether the address is a class C address. 
73995
73996
73997   bool is_class_c() const;
73998
73999
74000
74001 [endsect]
74002
74003
74004
74005 [section:is_loopback ip::address_v4::is_loopback]
74006
74007 [indexterm2 boost_asio.indexterm.ip__address_v4.is_loopback..is_loopback..ip::address_v4] 
74008 Determine whether the address is a loopback address. 
74009
74010
74011   bool is_loopback() const;
74012
74013
74014
74015 [endsect]
74016
74017
74018
74019 [section:is_multicast ip::address_v4::is_multicast]
74020
74021 [indexterm2 boost_asio.indexterm.ip__address_v4.is_multicast..is_multicast..ip::address_v4] 
74022 Determine whether the address is a multicast address. 
74023
74024
74025   bool is_multicast() const;
74026
74027
74028
74029 [endsect]
74030
74031
74032
74033 [section:is_unspecified ip::address_v4::is_unspecified]
74034
74035 [indexterm2 boost_asio.indexterm.ip__address_v4.is_unspecified..is_unspecified..ip::address_v4] 
74036 Determine whether the address is unspecified. 
74037
74038
74039   bool is_unspecified() const;
74040
74041
74042
74043 [endsect]
74044
74045
74046
74047 [section:loopback ip::address_v4::loopback]
74048
74049 [indexterm2 boost_asio.indexterm.ip__address_v4.loopback..loopback..ip::address_v4] 
74050 Obtain an address object that represents the loopback address. 
74051
74052
74053   static address_v4 loopback();
74054
74055
74056
74057 [endsect]
74058
74059
74060 [section:make_address_v4 ip::address_v4::make_address_v4]
74061
74062 [indexterm2 boost_asio.indexterm.ip__address_v4.make_address_v4..make_address_v4..ip::address_v4] 
74063 Create an IPv4 address from raw bytes in network order. 
74064
74065
74066   address_v4 ``[link boost_asio.reference.ip__address_v4.make_address_v4.overload1 make_address_v4]``(
74067       const address_v4::bytes_type & bytes);
74068   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v4.make_address_v4.overload1 more...]]``
74069
74070
74071 Create an IPv4 address from an unsigned integer in host byte order. 
74072
74073
74074   address_v4 ``[link boost_asio.reference.ip__address_v4.make_address_v4.overload2 make_address_v4]``(
74075       address_v4::uint_type addr);
74076   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v4.make_address_v4.overload2 more...]]``
74077
74078
74079 Create an IPv4 address from an IP address string in dotted decimal form. 
74080
74081
74082   address_v4 ``[link boost_asio.reference.ip__address_v4.make_address_v4.overload3 make_address_v4]``(
74083       const char * str);
74084   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v4.make_address_v4.overload3 more...]]``
74085
74086   address_v4 ``[link boost_asio.reference.ip__address_v4.make_address_v4.overload4 make_address_v4]``(
74087       const char * str,
74088       boost::system::error_code & ec);
74089   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v4.make_address_v4.overload4 more...]]``
74090
74091   address_v4 ``[link boost_asio.reference.ip__address_v4.make_address_v4.overload5 make_address_v4]``(
74092       const std::string & str);
74093   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v4.make_address_v4.overload5 more...]]``
74094
74095   address_v4 ``[link boost_asio.reference.ip__address_v4.make_address_v4.overload6 make_address_v4]``(
74096       const std::string & str,
74097       boost::system::error_code & ec);
74098   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v4.make_address_v4.overload6 more...]]``
74099
74100   address_v4 ``[link boost_asio.reference.ip__address_v4.make_address_v4.overload7 make_address_v4]``(
74101       string_view str);
74102   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v4.make_address_v4.overload7 more...]]``
74103
74104   address_v4 ``[link boost_asio.reference.ip__address_v4.make_address_v4.overload8 make_address_v4]``(
74105       string_view str,
74106       boost::system::error_code & ec);
74107   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v4.make_address_v4.overload8 more...]]``
74108
74109
74110 Create an IPv4 address from a IPv4-mapped IPv6 address. 
74111
74112
74113   address_v4 ``[link boost_asio.reference.ip__address_v4.make_address_v4.overload9 make_address_v4]``(
74114       v4_mapped_t ,
74115       const address_v6 & v6_addr);
74116   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v4.make_address_v4.overload9 more...]]``
74117
74118
74119 [section:overload1 ip::address_v4::make_address_v4 (1 of 9 overloads)]
74120
74121
74122 Create an IPv4 address from raw bytes in network order. 
74123
74124
74125   address_v4 make_address_v4(
74126       const address_v4::bytes_type & bytes);
74127
74128
74129
74130 [endsect]
74131
74132
74133
74134 [section:overload2 ip::address_v4::make_address_v4 (2 of 9 overloads)]
74135
74136
74137 Create an IPv4 address from an unsigned integer in host byte order. 
74138
74139
74140   address_v4 make_address_v4(
74141       address_v4::uint_type addr);
74142
74143
74144
74145 [endsect]
74146
74147
74148
74149 [section:overload3 ip::address_v4::make_address_v4 (3 of 9 overloads)]
74150
74151
74152 Create an IPv4 address from an IP address string in dotted decimal form. 
74153
74154
74155   address_v4 make_address_v4(
74156       const char * str);
74157
74158
74159
74160 [endsect]
74161
74162
74163
74164 [section:overload4 ip::address_v4::make_address_v4 (4 of 9 overloads)]
74165
74166
74167 Create an IPv4 address from an IP address string in dotted decimal form. 
74168
74169
74170   address_v4 make_address_v4(
74171       const char * str,
74172       boost::system::error_code & ec);
74173
74174
74175
74176 [endsect]
74177
74178
74179
74180 [section:overload5 ip::address_v4::make_address_v4 (5 of 9 overloads)]
74181
74182
74183 Create an IPv4 address from an IP address string in dotted decimal form. 
74184
74185
74186   address_v4 make_address_v4(
74187       const std::string & str);
74188
74189
74190
74191 [endsect]
74192
74193
74194
74195 [section:overload6 ip::address_v4::make_address_v4 (6 of 9 overloads)]
74196
74197
74198 Create an IPv4 address from an IP address string in dotted decimal form. 
74199
74200
74201   address_v4 make_address_v4(
74202       const std::string & str,
74203       boost::system::error_code & ec);
74204
74205
74206
74207 [endsect]
74208
74209
74210
74211 [section:overload7 ip::address_v4::make_address_v4 (7 of 9 overloads)]
74212
74213
74214 Create an IPv4 address from an IP address string in dotted decimal form. 
74215
74216
74217   address_v4 make_address_v4(
74218       string_view str);
74219
74220
74221
74222 [endsect]
74223
74224
74225
74226 [section:overload8 ip::address_v4::make_address_v4 (8 of 9 overloads)]
74227
74228
74229 Create an IPv4 address from an IP address string in dotted decimal form. 
74230
74231
74232   address_v4 make_address_v4(
74233       string_view str,
74234       boost::system::error_code & ec);
74235
74236
74237
74238 [endsect]
74239
74240
74241
74242 [section:overload9 ip::address_v4::make_address_v4 (9 of 9 overloads)]
74243
74244
74245 Create an IPv4 address from a IPv4-mapped IPv6 address. 
74246
74247
74248   address_v4 make_address_v4(
74249       v4_mapped_t ,
74250       const address_v6 & v6_addr);
74251
74252
74253
74254 [endsect]
74255
74256
74257 [endsect]
74258
74259 [section:make_network_v4 ip::address_v4::make_network_v4]
74260
74261 [indexterm2 boost_asio.indexterm.ip__address_v4.make_network_v4..make_network_v4..ip::address_v4] 
74262 Create an IPv4 network from an address and prefix length. 
74263
74264
74265   network_v4 ``[link boost_asio.reference.ip__address_v4.make_network_v4.overload1 make_network_v4]``(
74266       const address_v4 & addr,
74267       unsigned short prefix_len);
74268   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v4.make_network_v4.overload1 more...]]``
74269
74270
74271 Create an IPv4 network from an address and netmask. 
74272
74273
74274   network_v4 ``[link boost_asio.reference.ip__address_v4.make_network_v4.overload2 make_network_v4]``(
74275       const address_v4 & addr,
74276       const address_v4 & mask);
74277   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v4.make_network_v4.overload2 more...]]``
74278
74279
74280 [section:overload1 ip::address_v4::make_network_v4 (1 of 2 overloads)]
74281
74282
74283 Create an IPv4 network from an address and prefix length. 
74284
74285
74286   network_v4 make_network_v4(
74287       const address_v4 & addr,
74288       unsigned short prefix_len);
74289
74290
74291
74292 [endsect]
74293
74294
74295
74296 [section:overload2 ip::address_v4::make_network_v4 (2 of 2 overloads)]
74297
74298
74299 Create an IPv4 network from an address and netmask. 
74300
74301
74302   network_v4 make_network_v4(
74303       const address_v4 & addr,
74304       const address_v4 & mask);
74305
74306
74307
74308 [endsect]
74309
74310
74311 [endsect]
74312
74313
74314 [section:netmask ip::address_v4::netmask]
74315
74316 [indexterm2 boost_asio.indexterm.ip__address_v4.netmask..netmask..ip::address_v4] 
74317 (Deprecated: Use [link boost_asio.reference.ip__network_v4 `ip::network_v4`] class.) Obtain the netmask that corresponds to the address, based on its address class. 
74318
74319
74320   static address_v4 netmask(
74321       const address_v4 & addr);
74322
74323
74324
74325 [endsect]
74326
74327
74328
74329 [section:operator_not__eq_ ip::address_v4::operator!=]
74330
74331 [indexterm2 boost_asio.indexterm.ip__address_v4.operator_not__eq_..operator!=..ip::address_v4] 
74332 Compare two addresses for inequality. 
74333
74334
74335   friend bool operator!=(
74336       const address_v4 & a1,
74337       const address_v4 & a2);
74338
74339
74340 [heading Requirements]
74341
74342 ['Header: ][^boost/asio/ip/address_v4.hpp]
74343
74344 ['Convenience header: ][^boost/asio.hpp]
74345
74346
74347 [endsect]
74348
74349
74350
74351 [section:operator_lt_ ip::address_v4::operator<]
74352
74353 [indexterm2 boost_asio.indexterm.ip__address_v4.operator_lt_..operator<..ip::address_v4] 
74354 Compare addresses for ordering. 
74355
74356
74357   friend bool operator<(
74358       const address_v4 & a1,
74359       const address_v4 & a2);
74360
74361
74362 [heading Requirements]
74363
74364 ['Header: ][^boost/asio/ip/address_v4.hpp]
74365
74366 ['Convenience header: ][^boost/asio.hpp]
74367
74368
74369 [endsect]
74370
74371
74372 [section:operator_lt__lt_ ip::address_v4::operator<<]
74373
74374 [indexterm2 boost_asio.indexterm.ip__address_v4.operator_lt__lt_..operator<<..ip::address_v4] 
74375 Output an address as a string. 
74376
74377
74378   template<
74379       typename Elem,
74380       typename Traits>
74381   std::basic_ostream< Elem, Traits > & ``[link boost_asio.reference.ip__address_v4.operator_lt__lt_.overload1 operator<<]``(
74382       std::basic_ostream< Elem, Traits > & os,
74383       const address_v4 & addr);
74384   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v4.operator_lt__lt_.overload1 more...]]``
74385
74386
74387 Output a network as a string. 
74388
74389
74390   template<
74391       typename Elem,
74392       typename Traits>
74393   std::basic_ostream< Elem, Traits > & ``[link boost_asio.reference.ip__address_v4.operator_lt__lt_.overload2 operator<<]``(
74394       std::basic_ostream< Elem, Traits > & os,
74395       const network_v4 & net);
74396   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v4.operator_lt__lt_.overload2 more...]]``
74397
74398
74399 [section:overload1 ip::address_v4::operator<< (1 of 2 overloads)]
74400
74401
74402 Output an address as a string. 
74403
74404
74405   template<
74406       typename Elem,
74407       typename Traits>
74408   std::basic_ostream< Elem, Traits > & operator<<(
74409       std::basic_ostream< Elem, Traits > & os,
74410       const address_v4 & addr);
74411
74412
74413 Used to output a human-readable string for a specified address.
74414
74415
74416 [heading Parameters]
74417     
74418
74419 [variablelist
74420   
74421 [[os][The output stream to which the string will be written.]]
74422
74423 [[addr][The address to be written.]]
74424
74425 ]
74426
74427
74428 [heading Return Value]
74429       
74430 The output stream. 
74431
74432
74433
74434
74435 [endsect]
74436
74437
74438
74439 [section:overload2 ip::address_v4::operator<< (2 of 2 overloads)]
74440
74441
74442 Output a network as a string. 
74443
74444
74445   template<
74446       typename Elem,
74447       typename Traits>
74448   std::basic_ostream< Elem, Traits > & operator<<(
74449       std::basic_ostream< Elem, Traits > & os,
74450       const network_v4 & net);
74451
74452
74453 Used to output a human-readable string for a specified network.
74454
74455
74456 [heading Parameters]
74457     
74458
74459 [variablelist
74460   
74461 [[os][The output stream to which the string will be written.]]
74462
74463 [[net][The network to be written.]]
74464
74465 ]
74466
74467
74468 [heading Return Value]
74469       
74470 The output stream. 
74471
74472
74473
74474
74475 [endsect]
74476
74477
74478 [endsect]
74479
74480
74481 [section:operator_lt__eq_ ip::address_v4::operator<=]
74482
74483 [indexterm2 boost_asio.indexterm.ip__address_v4.operator_lt__eq_..operator<=..ip::address_v4] 
74484 Compare addresses for ordering. 
74485
74486
74487   friend bool operator<=(
74488       const address_v4 & a1,
74489       const address_v4 & a2);
74490
74491
74492 [heading Requirements]
74493
74494 ['Header: ][^boost/asio/ip/address_v4.hpp]
74495
74496 ['Convenience header: ][^boost/asio.hpp]
74497
74498
74499 [endsect]
74500
74501
74502
74503 [section:operator_eq_ ip::address_v4::operator=]
74504
74505 [indexterm2 boost_asio.indexterm.ip__address_v4.operator_eq_..operator=..ip::address_v4] 
74506 Assign from another address. 
74507
74508
74509   address_v4 & operator=(
74510       const address_v4 & other);
74511
74512
74513
74514 [endsect]
74515
74516
74517
74518 [section:operator_eq__eq_ ip::address_v4::operator==]
74519
74520 [indexterm2 boost_asio.indexterm.ip__address_v4.operator_eq__eq_..operator==..ip::address_v4] 
74521 Compare two addresses for equality. 
74522
74523
74524   friend bool operator==(
74525       const address_v4 & a1,
74526       const address_v4 & a2);
74527
74528
74529 [heading Requirements]
74530
74531 ['Header: ][^boost/asio/ip/address_v4.hpp]
74532
74533 ['Convenience header: ][^boost/asio.hpp]
74534
74535
74536 [endsect]
74537
74538
74539
74540 [section:operator_gt_ ip::address_v4::operator>]
74541
74542 [indexterm2 boost_asio.indexterm.ip__address_v4.operator_gt_..operator>..ip::address_v4] 
74543 Compare addresses for ordering. 
74544
74545
74546   friend bool operator>(
74547       const address_v4 & a1,
74548       const address_v4 & a2);
74549
74550
74551 [heading Requirements]
74552
74553 ['Header: ][^boost/asio/ip/address_v4.hpp]
74554
74555 ['Convenience header: ][^boost/asio.hpp]
74556
74557
74558 [endsect]
74559
74560
74561
74562 [section:operator_gt__eq_ ip::address_v4::operator>=]
74563
74564 [indexterm2 boost_asio.indexterm.ip__address_v4.operator_gt__eq_..operator>=..ip::address_v4] 
74565 Compare addresses for ordering. 
74566
74567
74568   friend bool operator>=(
74569       const address_v4 & a1,
74570       const address_v4 & a2);
74571
74572
74573 [heading Requirements]
74574
74575 ['Header: ][^boost/asio/ip/address_v4.hpp]
74576
74577 ['Convenience header: ][^boost/asio.hpp]
74578
74579
74580 [endsect]
74581
74582
74583
74584 [section:to_bytes ip::address_v4::to_bytes]
74585
74586 [indexterm2 boost_asio.indexterm.ip__address_v4.to_bytes..to_bytes..ip::address_v4] 
74587 Get the address in bytes, in network byte order. 
74588
74589
74590   bytes_type to_bytes() const;
74591
74592
74593
74594 [endsect]
74595
74596
74597 [section:to_string ip::address_v4::to_string]
74598
74599 [indexterm2 boost_asio.indexterm.ip__address_v4.to_string..to_string..ip::address_v4] 
74600 Get the address as a string in dotted decimal format. 
74601
74602
74603   std::string ``[link boost_asio.reference.ip__address_v4.to_string.overload1 to_string]``() const;
74604   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v4.to_string.overload1 more...]]``
74605
74606
74607 (Deprecated: Use other overload.) Get the address as a string in dotted decimal format. 
74608
74609
74610   std::string ``[link boost_asio.reference.ip__address_v4.to_string.overload2 to_string]``(
74611       boost::system::error_code & ec) const;
74612   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v4.to_string.overload2 more...]]``
74613
74614
74615 [section:overload1 ip::address_v4::to_string (1 of 2 overloads)]
74616
74617
74618 Get the address as a string in dotted decimal format. 
74619
74620
74621   std::string to_string() const;
74622
74623
74624
74625 [endsect]
74626
74627
74628
74629 [section:overload2 ip::address_v4::to_string (2 of 2 overloads)]
74630
74631
74632 (Deprecated: Use other overload.) Get the address as a string in dotted decimal format. 
74633
74634
74635   std::string to_string(
74636       boost::system::error_code & ec) const;
74637
74638
74639
74640 [endsect]
74641
74642
74643 [endsect]
74644
74645
74646 [section:to_uint ip::address_v4::to_uint]
74647
74648 [indexterm2 boost_asio.indexterm.ip__address_v4.to_uint..to_uint..ip::address_v4] 
74649 Get the address as an unsigned integer in host byte order. 
74650
74651
74652   uint_type to_uint() const;
74653
74654
74655
74656 [endsect]
74657
74658
74659
74660 [section:to_ulong ip::address_v4::to_ulong]
74661
74662 [indexterm2 boost_asio.indexterm.ip__address_v4.to_ulong..to_ulong..ip::address_v4] 
74663 Get the address as an unsigned long in host byte order. 
74664
74665
74666   unsigned long to_ulong() const;
74667
74668
74669
74670 [endsect]
74671
74672
74673
74674 [section:uint_type ip::address_v4::uint_type]
74675
74676 [indexterm2 boost_asio.indexterm.ip__address_v4.uint_type..uint_type..ip::address_v4] 
74677 The type used to represent an address as an unsigned integer. 
74678
74679
74680   typedef uint_least32_t uint_type;
74681
74682
74683
74684 [heading Requirements]
74685
74686 ['Header: ][^boost/asio/ip/address_v4.hpp]
74687
74688 ['Convenience header: ][^boost/asio.hpp]
74689
74690
74691 [endsect]
74692
74693
74694
74695 [endsect]
74696
74697
74698 [section:ip__address_v4_iterator ip::address_v4_iterator]
74699
74700 [indexterm1 boost_asio.indexterm.ip__address_v4_iterator..ip::address_v4_iterator] 
74701 An input iterator that can be used for traversing IPv4 addresses. 
74702
74703
74704   typedef basic_address_iterator< address_v4 > address_v4_iterator;
74705
74706
74707
74708 [heading Requirements]
74709
74710 ['Header: ][^boost/asio/ip/address_v4_iterator.hpp]
74711
74712 ['Convenience header: ][^boost/asio.hpp]
74713
74714
74715 [endsect]
74716
74717
74718
74719 [section:ip__address_v4_range ip::address_v4_range]
74720
74721 [indexterm1 boost_asio.indexterm.ip__address_v4_range..ip::address_v4_range] 
74722 Represents a range of IPv4 addresses. 
74723
74724
74725   typedef basic_address_range< address_v4 > address_v4_range;
74726
74727
74728
74729 [heading Requirements]
74730
74731 ['Header: ][^boost/asio/ip/address_v4_range.hpp]
74732
74733 ['Convenience header: ][^boost/asio.hpp]
74734
74735
74736 [endsect]
74737
74738
74739 [section:ip__address_v6 ip::address_v6]
74740
74741
74742 Implements IP version 6 style addresses. 
74743
74744
74745   class address_v6
74746
74747
74748 [heading Types]
74749 [table
74750   [[Name][Description]]
74751
74752   [
74753
74754     [[link boost_asio.reference.ip__address_v6.bytes_type [*bytes_type]]]
74755     [The type used to represent an address as an array of bytes. ]
74756   
74757   ]
74758
74759 ]
74760
74761 [heading Member Functions]
74762 [table
74763   [[Name][Description]]
74764
74765   [
74766     [[link boost_asio.reference.ip__address_v6.address_v6 [*address_v6]]]
74767     [Default constructor. 
74768      [hr]
74769      Construct an address from raw bytes and scope ID. 
74770      [hr]
74771      Copy constructor. ]
74772   ]
74773   
74774   [
74775     [[link boost_asio.reference.ip__address_v6.any [*any]]]
74776     [Obtain an address object that represents any address. ]
74777   ]
74778   
74779   [
74780     [[link boost_asio.reference.ip__address_v6.from_string [*from_string]]]
74781     [(Deprecated: Use make_address_v6().) Create an IPv6 address from an IP address string. ]
74782   ]
74783   
74784   [
74785     [[link boost_asio.reference.ip__address_v6.is_link_local [*is_link_local]]]
74786     [Determine whether the address is link local. ]
74787   ]
74788   
74789   [
74790     [[link boost_asio.reference.ip__address_v6.is_loopback [*is_loopback]]]
74791     [Determine whether the address is a loopback address. ]
74792   ]
74793   
74794   [
74795     [[link boost_asio.reference.ip__address_v6.is_multicast [*is_multicast]]]
74796     [Determine whether the address is a multicast address. ]
74797   ]
74798   
74799   [
74800     [[link boost_asio.reference.ip__address_v6.is_multicast_global [*is_multicast_global]]]
74801     [Determine whether the address is a global multicast address. ]
74802   ]
74803   
74804   [
74805     [[link boost_asio.reference.ip__address_v6.is_multicast_link_local [*is_multicast_link_local]]]
74806     [Determine whether the address is a link-local multicast address. ]
74807   ]
74808   
74809   [
74810     [[link boost_asio.reference.ip__address_v6.is_multicast_node_local [*is_multicast_node_local]]]
74811     [Determine whether the address is a node-local multicast address. ]
74812   ]
74813   
74814   [
74815     [[link boost_asio.reference.ip__address_v6.is_multicast_org_local [*is_multicast_org_local]]]
74816     [Determine whether the address is a org-local multicast address. ]
74817   ]
74818   
74819   [
74820     [[link boost_asio.reference.ip__address_v6.is_multicast_site_local [*is_multicast_site_local]]]
74821     [Determine whether the address is a site-local multicast address. ]
74822   ]
74823   
74824   [
74825     [[link boost_asio.reference.ip__address_v6.is_site_local [*is_site_local]]]
74826     [Determine whether the address is site local. ]
74827   ]
74828   
74829   [
74830     [[link boost_asio.reference.ip__address_v6.is_unspecified [*is_unspecified]]]
74831     [Determine whether the address is unspecified. ]
74832   ]
74833   
74834   [
74835     [[link boost_asio.reference.ip__address_v6.is_v4_compatible [*is_v4_compatible]]]
74836     [(Deprecated: No replacement.) Determine whether the address is an IPv4-compatible address. ]
74837   ]
74838   
74839   [
74840     [[link boost_asio.reference.ip__address_v6.is_v4_mapped [*is_v4_mapped]]]
74841     [Determine whether the address is a mapped IPv4 address. ]
74842   ]
74843   
74844   [
74845     [[link boost_asio.reference.ip__address_v6.loopback [*loopback]]]
74846     [Obtain an address object that represents the loopback address. ]
74847   ]
74848   
74849   [
74850     [[link boost_asio.reference.ip__address_v6.operator_eq_ [*operator=]]]
74851     [Assign from another address. ]
74852   ]
74853   
74854   [
74855     [[link boost_asio.reference.ip__address_v6.scope_id [*scope_id]]]
74856     [The scope ID of the address. ]
74857   ]
74858   
74859   [
74860     [[link boost_asio.reference.ip__address_v6.to_bytes [*to_bytes]]]
74861     [Get the address in bytes, in network byte order. ]
74862   ]
74863   
74864   [
74865     [[link boost_asio.reference.ip__address_v6.to_string [*to_string]]]
74866     [Get the address as a string. 
74867      [hr]
74868      (Deprecated: Use other overload.) Get the address as a string. ]
74869   ]
74870   
74871   [
74872     [[link boost_asio.reference.ip__address_v6.to_v4 [*to_v4]]]
74873     [(Deprecated: Use make_address_v4().) Converts an IPv4-mapped or IPv4-compatible address to an IPv4 address. ]
74874   ]
74875   
74876   [
74877     [[link boost_asio.reference.ip__address_v6.v4_compatible [*v4_compatible]]]
74878     [(Deprecated: No replacement.) Create an IPv4-compatible IPv6 address. ]
74879   ]
74880   
74881   [
74882     [[link boost_asio.reference.ip__address_v6.v4_mapped [*v4_mapped]]]
74883     [(Deprecated: Use make_address_v6().) Create an IPv4-mapped IPv6 address. ]
74884   ]
74885   
74886 ]
74887
74888 [heading Friends]
74889 [table
74890   [[Name][Description]]
74891
74892   [
74893     [[link boost_asio.reference.ip__address_v6.operator_not__eq_ [*operator!=]]]
74894     [Compare two addresses for inequality. ]
74895   ]
74896   
74897   [
74898     [[link boost_asio.reference.ip__address_v6.operator_lt_ [*operator<]]]
74899     [Compare addresses for ordering. ]
74900   ]
74901   
74902   [
74903     [[link boost_asio.reference.ip__address_v6.operator_lt__eq_ [*operator<=]]]
74904     [Compare addresses for ordering. ]
74905   ]
74906   
74907   [
74908     [[link boost_asio.reference.ip__address_v6.operator_eq__eq_ [*operator==]]]
74909     [Compare two addresses for equality. ]
74910   ]
74911   
74912   [
74913     [[link boost_asio.reference.ip__address_v6.operator_gt_ [*operator>]]]
74914     [Compare addresses for ordering. ]
74915   ]
74916   
74917   [
74918     [[link boost_asio.reference.ip__address_v6.operator_gt__eq_ [*operator>=]]]
74919     [Compare addresses for ordering. ]
74920   ]
74921   
74922 ]
74923
74924 [heading Related Functions]
74925 [table
74926   [[Name][Description]]
74927
74928   [
74929     [[link boost_asio.reference.ip__address_v6.make_address_v6 [*make_address_v6]]]
74930     [Create an IPv6 address from raw bytes and scope ID. 
74931
74932      Create an IPv6 address from an IP address string. 
74933
74934      Createan IPv6 address from an IP address string. 
74935
74936      Create an IPv4-mapped IPv6 address from an IPv4 address. ]
74937   ]
74938   
74939   [
74940     [[link boost_asio.reference.ip__address_v6.make_network_v6 [*make_network_v6]]]
74941     [Create an IPv6 network from an address and prefix length. ]
74942   ]
74943   
74944   [
74945     [[link boost_asio.reference.ip__address_v6.operator_lt__lt_ [*operator<<]]]
74946     [Output an address as a string. 
74947
74948      Output a network as a string. ]
74949   ]
74950   
74951 ]
74952
74953 The [link boost_asio.reference.ip__address_v6 `ip::address_v6`] class provides the ability to use and manipulate IP version 6 addresses.
74954
74955
74956 [heading Thread Safety]
74957   
74958 ['Distinct] ['objects:] Safe.
74959
74960 ['Shared] ['objects:] Unsafe. 
74961
74962
74963
74964 [heading Requirements]
74965
74966 ['Header: ][^boost/asio/ip/address_v6.hpp]
74967
74968 ['Convenience header: ][^boost/asio.hpp]
74969
74970 [section:address_v6 ip::address_v6::address_v6]
74971
74972 [indexterm2 boost_asio.indexterm.ip__address_v6.address_v6..address_v6..ip::address_v6] 
74973 Default constructor. 
74974
74975
74976   ``[link boost_asio.reference.ip__address_v6.address_v6.overload1 address_v6]``();
74977   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v6.address_v6.overload1 more...]]``
74978
74979
74980 Construct an address from raw bytes and scope ID. 
74981
74982
74983   explicit ``[link boost_asio.reference.ip__address_v6.address_v6.overload2 address_v6]``(
74984       const bytes_type & bytes,
74985       unsigned long scope_id = 0);
74986   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v6.address_v6.overload2 more...]]``
74987
74988
74989 Copy constructor. 
74990
74991
74992   ``[link boost_asio.reference.ip__address_v6.address_v6.overload3 address_v6]``(
74993       const address_v6 & other);
74994   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v6.address_v6.overload3 more...]]``
74995
74996
74997 [section:overload1 ip::address_v6::address_v6 (1 of 3 overloads)]
74998
74999
75000 Default constructor. 
75001
75002
75003   address_v6();
75004
75005
75006
75007 [endsect]
75008
75009
75010
75011 [section:overload2 ip::address_v6::address_v6 (2 of 3 overloads)]
75012
75013
75014 Construct an address from raw bytes and scope ID. 
75015
75016
75017   address_v6(
75018       const bytes_type & bytes,
75019       unsigned long scope_id = 0);
75020
75021
75022
75023 [endsect]
75024
75025
75026
75027 [section:overload3 ip::address_v6::address_v6 (3 of 3 overloads)]
75028
75029
75030 Copy constructor. 
75031
75032
75033   address_v6(
75034       const address_v6 & other);
75035
75036
75037
75038 [endsect]
75039
75040
75041 [endsect]
75042
75043
75044 [section:any ip::address_v6::any]
75045
75046 [indexterm2 boost_asio.indexterm.ip__address_v6.any..any..ip::address_v6] 
75047 Obtain an address object that represents any address. 
75048
75049
75050   static address_v6 any();
75051
75052
75053
75054 [endsect]
75055
75056
75057
75058 [section:bytes_type ip::address_v6::bytes_type]
75059
75060 [indexterm2 boost_asio.indexterm.ip__address_v6.bytes_type..bytes_type..ip::address_v6] 
75061 The type used to represent an address as an array of bytes. 
75062
75063
75064   typedef array< unsigned char, 16 > bytes_type;
75065
75066
75067
75068
75069 [heading Remarks]
75070       
75071 This type is defined in terms of the C++0x template `std::array` when it is available. Otherwise, it uses `boost:array`. 
75072
75073
75074
75075 [heading Requirements]
75076
75077 ['Header: ][^boost/asio/ip/address_v6.hpp]
75078
75079 ['Convenience header: ][^boost/asio.hpp]
75080
75081
75082 [endsect]
75083
75084
75085 [section:from_string ip::address_v6::from_string]
75086
75087 [indexterm2 boost_asio.indexterm.ip__address_v6.from_string..from_string..ip::address_v6] 
75088 (Deprecated: Use `make_address_v6()`.) Create an IPv6 address from an IP address string. 
75089
75090
75091   static address_v6 ``[link boost_asio.reference.ip__address_v6.from_string.overload1 from_string]``(
75092       const char * str);
75093   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v6.from_string.overload1 more...]]``
75094
75095   static address_v6 ``[link boost_asio.reference.ip__address_v6.from_string.overload2 from_string]``(
75096       const char * str,
75097       boost::system::error_code & ec);
75098   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v6.from_string.overload2 more...]]``
75099
75100   static address_v6 ``[link boost_asio.reference.ip__address_v6.from_string.overload3 from_string]``(
75101       const std::string & str);
75102   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v6.from_string.overload3 more...]]``
75103
75104   static address_v6 ``[link boost_asio.reference.ip__address_v6.from_string.overload4 from_string]``(
75105       const std::string & str,
75106       boost::system::error_code & ec);
75107   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v6.from_string.overload4 more...]]``
75108
75109
75110 [section:overload1 ip::address_v6::from_string (1 of 4 overloads)]
75111
75112
75113 (Deprecated: Use `make_address_v6()`.) Create an IPv6 address from an IP address string. 
75114
75115
75116   static address_v6 from_string(
75117       const char * str);
75118
75119
75120
75121 [endsect]
75122
75123
75124
75125 [section:overload2 ip::address_v6::from_string (2 of 4 overloads)]
75126
75127
75128 (Deprecated: Use `make_address_v6()`.) Create an IPv6 address from an IP address string. 
75129
75130
75131   static address_v6 from_string(
75132       const char * str,
75133       boost::system::error_code & ec);
75134
75135
75136
75137 [endsect]
75138
75139
75140
75141 [section:overload3 ip::address_v6::from_string (3 of 4 overloads)]
75142
75143
75144 (Deprecated: Use `make_address_v6()`.) Create an IPv6 address from an IP address string. 
75145
75146
75147   static address_v6 from_string(
75148       const std::string & str);
75149
75150
75151
75152 [endsect]
75153
75154
75155
75156 [section:overload4 ip::address_v6::from_string (4 of 4 overloads)]
75157
75158
75159 (Deprecated: Use `make_address_v6()`.) Create an IPv6 address from an IP address string. 
75160
75161
75162   static address_v6 from_string(
75163       const std::string & str,
75164       boost::system::error_code & ec);
75165
75166
75167
75168 [endsect]
75169
75170
75171 [endsect]
75172
75173
75174 [section:is_link_local ip::address_v6::is_link_local]
75175
75176 [indexterm2 boost_asio.indexterm.ip__address_v6.is_link_local..is_link_local..ip::address_v6] 
75177 Determine whether the address is link local. 
75178
75179
75180   bool is_link_local() const;
75181
75182
75183
75184 [endsect]
75185
75186
75187
75188 [section:is_loopback ip::address_v6::is_loopback]
75189
75190 [indexterm2 boost_asio.indexterm.ip__address_v6.is_loopback..is_loopback..ip::address_v6] 
75191 Determine whether the address is a loopback address. 
75192
75193
75194   bool is_loopback() const;
75195
75196
75197
75198 [endsect]
75199
75200
75201
75202 [section:is_multicast ip::address_v6::is_multicast]
75203
75204 [indexterm2 boost_asio.indexterm.ip__address_v6.is_multicast..is_multicast..ip::address_v6] 
75205 Determine whether the address is a multicast address. 
75206
75207
75208   bool is_multicast() const;
75209
75210
75211
75212 [endsect]
75213
75214
75215
75216 [section:is_multicast_global ip::address_v6::is_multicast_global]
75217
75218 [indexterm2 boost_asio.indexterm.ip__address_v6.is_multicast_global..is_multicast_global..ip::address_v6] 
75219 Determine whether the address is a global multicast address. 
75220
75221
75222   bool is_multicast_global() const;
75223
75224
75225
75226 [endsect]
75227
75228
75229
75230 [section:is_multicast_link_local ip::address_v6::is_multicast_link_local]
75231
75232 [indexterm2 boost_asio.indexterm.ip__address_v6.is_multicast_link_local..is_multicast_link_local..ip::address_v6] 
75233 Determine whether the address is a link-local multicast address. 
75234
75235
75236   bool is_multicast_link_local() const;
75237
75238
75239
75240 [endsect]
75241
75242
75243
75244 [section:is_multicast_node_local ip::address_v6::is_multicast_node_local]
75245
75246 [indexterm2 boost_asio.indexterm.ip__address_v6.is_multicast_node_local..is_multicast_node_local..ip::address_v6] 
75247 Determine whether the address is a node-local multicast address. 
75248
75249
75250   bool is_multicast_node_local() const;
75251
75252
75253
75254 [endsect]
75255
75256
75257
75258 [section:is_multicast_org_local ip::address_v6::is_multicast_org_local]
75259
75260 [indexterm2 boost_asio.indexterm.ip__address_v6.is_multicast_org_local..is_multicast_org_local..ip::address_v6] 
75261 Determine whether the address is a org-local multicast address. 
75262
75263
75264   bool is_multicast_org_local() const;
75265
75266
75267
75268 [endsect]
75269
75270
75271
75272 [section:is_multicast_site_local ip::address_v6::is_multicast_site_local]
75273
75274 [indexterm2 boost_asio.indexterm.ip__address_v6.is_multicast_site_local..is_multicast_site_local..ip::address_v6] 
75275 Determine whether the address is a site-local multicast address. 
75276
75277
75278   bool is_multicast_site_local() const;
75279
75280
75281
75282 [endsect]
75283
75284
75285
75286 [section:is_site_local ip::address_v6::is_site_local]
75287
75288 [indexterm2 boost_asio.indexterm.ip__address_v6.is_site_local..is_site_local..ip::address_v6] 
75289 Determine whether the address is site local. 
75290
75291
75292   bool is_site_local() const;
75293
75294
75295
75296 [endsect]
75297
75298
75299
75300 [section:is_unspecified ip::address_v6::is_unspecified]
75301
75302 [indexterm2 boost_asio.indexterm.ip__address_v6.is_unspecified..is_unspecified..ip::address_v6] 
75303 Determine whether the address is unspecified. 
75304
75305
75306   bool is_unspecified() const;
75307
75308
75309
75310 [endsect]
75311
75312
75313
75314 [section:is_v4_compatible ip::address_v6::is_v4_compatible]
75315
75316 [indexterm2 boost_asio.indexterm.ip__address_v6.is_v4_compatible..is_v4_compatible..ip::address_v6] 
75317 (Deprecated: No replacement.) Determine whether the address is an IPv4-compatible address. 
75318
75319
75320   bool is_v4_compatible() const;
75321
75322
75323
75324 [endsect]
75325
75326
75327
75328 [section:is_v4_mapped ip::address_v6::is_v4_mapped]
75329
75330 [indexterm2 boost_asio.indexterm.ip__address_v6.is_v4_mapped..is_v4_mapped..ip::address_v6] 
75331 Determine whether the address is a mapped IPv4 address. 
75332
75333
75334   bool is_v4_mapped() const;
75335
75336
75337
75338 [endsect]
75339
75340
75341
75342 [section:loopback ip::address_v6::loopback]
75343
75344 [indexterm2 boost_asio.indexterm.ip__address_v6.loopback..loopback..ip::address_v6] 
75345 Obtain an address object that represents the loopback address. 
75346
75347
75348   static address_v6 loopback();
75349
75350
75351
75352 [endsect]
75353
75354
75355 [section:make_address_v6 ip::address_v6::make_address_v6]
75356
75357 [indexterm2 boost_asio.indexterm.ip__address_v6.make_address_v6..make_address_v6..ip::address_v6] 
75358 Create an IPv6 address from raw bytes and scope ID. 
75359
75360
75361   address_v6 ``[link boost_asio.reference.ip__address_v6.make_address_v6.overload1 make_address_v6]``(
75362       const address_v6::bytes_type & bytes,
75363       unsigned long scope_id = 0);
75364   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v6.make_address_v6.overload1 more...]]``
75365
75366
75367 Create an IPv6 address from an IP address string. 
75368
75369
75370   address_v6 ``[link boost_asio.reference.ip__address_v6.make_address_v6.overload2 make_address_v6]``(
75371       const char * str);
75372   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v6.make_address_v6.overload2 more...]]``
75373
75374   address_v6 ``[link boost_asio.reference.ip__address_v6.make_address_v6.overload3 make_address_v6]``(
75375       const char * str,
75376       boost::system::error_code & ec);
75377   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v6.make_address_v6.overload3 more...]]``
75378
75379
75380 Createan IPv6 address from an IP address string. 
75381
75382
75383   address_v6 ``[link boost_asio.reference.ip__address_v6.make_address_v6.overload4 make_address_v6]``(
75384       const std::string & str);
75385   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v6.make_address_v6.overload4 more...]]``
75386
75387   address_v6 ``[link boost_asio.reference.ip__address_v6.make_address_v6.overload5 make_address_v6]``(
75388       const std::string & str,
75389       boost::system::error_code & ec);
75390   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v6.make_address_v6.overload5 more...]]``
75391
75392   address_v6 ``[link boost_asio.reference.ip__address_v6.make_address_v6.overload6 make_address_v6]``(
75393       string_view str);
75394   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v6.make_address_v6.overload6 more...]]``
75395
75396   address_v6 ``[link boost_asio.reference.ip__address_v6.make_address_v6.overload7 make_address_v6]``(
75397       string_view str,
75398       boost::system::error_code & ec);
75399   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v6.make_address_v6.overload7 more...]]``
75400
75401
75402 Create an IPv4-mapped IPv6 address from an IPv4 address. 
75403
75404
75405   address_v6 ``[link boost_asio.reference.ip__address_v6.make_address_v6.overload8 make_address_v6]``(
75406       v4_mapped_t ,
75407       const address_v4 & v4_addr);
75408   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v6.make_address_v6.overload8 more...]]``
75409
75410
75411 [section:overload1 ip::address_v6::make_address_v6 (1 of 8 overloads)]
75412
75413
75414 Create an IPv6 address from raw bytes and scope ID. 
75415
75416
75417   address_v6 make_address_v6(
75418       const address_v6::bytes_type & bytes,
75419       unsigned long scope_id = 0);
75420
75421
75422
75423 [endsect]
75424
75425
75426
75427 [section:overload2 ip::address_v6::make_address_v6 (2 of 8 overloads)]
75428
75429
75430 Create an IPv6 address from an IP address string. 
75431
75432
75433   address_v6 make_address_v6(
75434       const char * str);
75435
75436
75437
75438 [endsect]
75439
75440
75441
75442 [section:overload3 ip::address_v6::make_address_v6 (3 of 8 overloads)]
75443
75444
75445 Create an IPv6 address from an IP address string. 
75446
75447
75448   address_v6 make_address_v6(
75449       const char * str,
75450       boost::system::error_code & ec);
75451
75452
75453
75454 [endsect]
75455
75456
75457
75458 [section:overload4 ip::address_v6::make_address_v6 (4 of 8 overloads)]
75459
75460
75461 Createan IPv6 address from an IP address string. 
75462
75463
75464   address_v6 make_address_v6(
75465       const std::string & str);
75466
75467
75468
75469 [endsect]
75470
75471
75472
75473 [section:overload5 ip::address_v6::make_address_v6 (5 of 8 overloads)]
75474
75475
75476 Create an IPv6 address from an IP address string. 
75477
75478
75479   address_v6 make_address_v6(
75480       const std::string & str,
75481       boost::system::error_code & ec);
75482
75483
75484
75485 [endsect]
75486
75487
75488
75489 [section:overload6 ip::address_v6::make_address_v6 (6 of 8 overloads)]
75490
75491
75492 Create an IPv6 address from an IP address string. 
75493
75494
75495   address_v6 make_address_v6(
75496       string_view str);
75497
75498
75499
75500 [endsect]
75501
75502
75503
75504 [section:overload7 ip::address_v6::make_address_v6 (7 of 8 overloads)]
75505
75506
75507 Create an IPv6 address from an IP address string. 
75508
75509
75510   address_v6 make_address_v6(
75511       string_view str,
75512       boost::system::error_code & ec);
75513
75514
75515
75516 [endsect]
75517
75518
75519
75520 [section:overload8 ip::address_v6::make_address_v6 (8 of 8 overloads)]
75521
75522
75523 Create an IPv4-mapped IPv6 address from an IPv4 address. 
75524
75525
75526   address_v6 make_address_v6(
75527       v4_mapped_t ,
75528       const address_v4 & v4_addr);
75529
75530
75531
75532 [endsect]
75533
75534
75535 [endsect]
75536
75537
75538 [section:make_network_v6 ip::address_v6::make_network_v6]
75539
75540 [indexterm2 boost_asio.indexterm.ip__address_v6.make_network_v6..make_network_v6..ip::address_v6] 
75541 Create an IPv6 network from an address and prefix length. 
75542
75543
75544   network_v6 make_network_v6(
75545       const address_v6 & addr,
75546       unsigned short prefix_len);
75547
75548
75549
75550 [endsect]
75551
75552
75553
75554 [section:operator_not__eq_ ip::address_v6::operator!=]
75555
75556 [indexterm2 boost_asio.indexterm.ip__address_v6.operator_not__eq_..operator!=..ip::address_v6] 
75557 Compare two addresses for inequality. 
75558
75559
75560   friend bool operator!=(
75561       const address_v6 & a1,
75562       const address_v6 & a2);
75563
75564
75565 [heading Requirements]
75566
75567 ['Header: ][^boost/asio/ip/address_v6.hpp]
75568
75569 ['Convenience header: ][^boost/asio.hpp]
75570
75571
75572 [endsect]
75573
75574
75575
75576 [section:operator_lt_ ip::address_v6::operator<]
75577
75578 [indexterm2 boost_asio.indexterm.ip__address_v6.operator_lt_..operator<..ip::address_v6] 
75579 Compare addresses for ordering. 
75580
75581
75582   friend bool operator<(
75583       const address_v6 & a1,
75584       const address_v6 & a2);
75585
75586
75587 [heading Requirements]
75588
75589 ['Header: ][^boost/asio/ip/address_v6.hpp]
75590
75591 ['Convenience header: ][^boost/asio.hpp]
75592
75593
75594 [endsect]
75595
75596
75597 [section:operator_lt__lt_ ip::address_v6::operator<<]
75598
75599 [indexterm2 boost_asio.indexterm.ip__address_v6.operator_lt__lt_..operator<<..ip::address_v6] 
75600 Output an address as a string. 
75601
75602
75603   template<
75604       typename Elem,
75605       typename Traits>
75606   std::basic_ostream< Elem, Traits > & ``[link boost_asio.reference.ip__address_v6.operator_lt__lt_.overload1 operator<<]``(
75607       std::basic_ostream< Elem, Traits > & os,
75608       const address_v6 & addr);
75609   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v6.operator_lt__lt_.overload1 more...]]``
75610
75611
75612 Output a network as a string. 
75613
75614
75615   template<
75616       typename Elem,
75617       typename Traits>
75618   std::basic_ostream< Elem, Traits > & ``[link boost_asio.reference.ip__address_v6.operator_lt__lt_.overload2 operator<<]``(
75619       std::basic_ostream< Elem, Traits > & os,
75620       const network_v6 & net);
75621   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v6.operator_lt__lt_.overload2 more...]]``
75622
75623
75624 [section:overload1 ip::address_v6::operator<< (1 of 2 overloads)]
75625
75626
75627 Output an address as a string. 
75628
75629
75630   template<
75631       typename Elem,
75632       typename Traits>
75633   std::basic_ostream< Elem, Traits > & operator<<(
75634       std::basic_ostream< Elem, Traits > & os,
75635       const address_v6 & addr);
75636
75637
75638 Used to output a human-readable string for a specified address.
75639
75640
75641 [heading Parameters]
75642     
75643
75644 [variablelist
75645   
75646 [[os][The output stream to which the string will be written.]]
75647
75648 [[addr][The address to be written.]]
75649
75650 ]
75651
75652
75653 [heading Return Value]
75654       
75655 The output stream. 
75656
75657
75658
75659
75660 [endsect]
75661
75662
75663
75664 [section:overload2 ip::address_v6::operator<< (2 of 2 overloads)]
75665
75666
75667 Output a network as a string. 
75668
75669
75670   template<
75671       typename Elem,
75672       typename Traits>
75673   std::basic_ostream< Elem, Traits > & operator<<(
75674       std::basic_ostream< Elem, Traits > & os,
75675       const network_v6 & net);
75676
75677
75678 Used to output a human-readable string for a specified network.
75679
75680
75681 [heading Parameters]
75682     
75683
75684 [variablelist
75685   
75686 [[os][The output stream to which the string will be written.]]
75687
75688 [[net][The network to be written.]]
75689
75690 ]
75691
75692
75693 [heading Return Value]
75694       
75695 The output stream. 
75696
75697
75698
75699
75700 [endsect]
75701
75702
75703 [endsect]
75704
75705
75706 [section:operator_lt__eq_ ip::address_v6::operator<=]
75707
75708 [indexterm2 boost_asio.indexterm.ip__address_v6.operator_lt__eq_..operator<=..ip::address_v6] 
75709 Compare addresses for ordering. 
75710
75711
75712   friend bool operator<=(
75713       const address_v6 & a1,
75714       const address_v6 & a2);
75715
75716
75717 [heading Requirements]
75718
75719 ['Header: ][^boost/asio/ip/address_v6.hpp]
75720
75721 ['Convenience header: ][^boost/asio.hpp]
75722
75723
75724 [endsect]
75725
75726
75727
75728 [section:operator_eq_ ip::address_v6::operator=]
75729
75730 [indexterm2 boost_asio.indexterm.ip__address_v6.operator_eq_..operator=..ip::address_v6] 
75731 Assign from another address. 
75732
75733
75734   address_v6 & operator=(
75735       const address_v6 & other);
75736
75737
75738
75739 [endsect]
75740
75741
75742
75743 [section:operator_eq__eq_ ip::address_v6::operator==]
75744
75745 [indexterm2 boost_asio.indexterm.ip__address_v6.operator_eq__eq_..operator==..ip::address_v6] 
75746 Compare two addresses for equality. 
75747
75748
75749   friend bool operator==(
75750       const address_v6 & a1,
75751       const address_v6 & a2);
75752
75753
75754 [heading Requirements]
75755
75756 ['Header: ][^boost/asio/ip/address_v6.hpp]
75757
75758 ['Convenience header: ][^boost/asio.hpp]
75759
75760
75761 [endsect]
75762
75763
75764
75765 [section:operator_gt_ ip::address_v6::operator>]
75766
75767 [indexterm2 boost_asio.indexterm.ip__address_v6.operator_gt_..operator>..ip::address_v6] 
75768 Compare addresses for ordering. 
75769
75770
75771   friend bool operator>(
75772       const address_v6 & a1,
75773       const address_v6 & a2);
75774
75775
75776 [heading Requirements]
75777
75778 ['Header: ][^boost/asio/ip/address_v6.hpp]
75779
75780 ['Convenience header: ][^boost/asio.hpp]
75781
75782
75783 [endsect]
75784
75785
75786
75787 [section:operator_gt__eq_ ip::address_v6::operator>=]
75788
75789 [indexterm2 boost_asio.indexterm.ip__address_v6.operator_gt__eq_..operator>=..ip::address_v6] 
75790 Compare addresses for ordering. 
75791
75792
75793   friend bool operator>=(
75794       const address_v6 & a1,
75795       const address_v6 & a2);
75796
75797
75798 [heading Requirements]
75799
75800 ['Header: ][^boost/asio/ip/address_v6.hpp]
75801
75802 ['Convenience header: ][^boost/asio.hpp]
75803
75804
75805 [endsect]
75806
75807
75808 [section:scope_id ip::address_v6::scope_id]
75809
75810 [indexterm2 boost_asio.indexterm.ip__address_v6.scope_id..scope_id..ip::address_v6] 
75811 The scope ID of the address. 
75812
75813
75814   unsigned long ``[link boost_asio.reference.ip__address_v6.scope_id.overload1 scope_id]``() const;
75815   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v6.scope_id.overload1 more...]]``
75816
75817   void ``[link boost_asio.reference.ip__address_v6.scope_id.overload2 scope_id]``(
75818       unsigned long id);
75819   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v6.scope_id.overload2 more...]]``
75820
75821
75822 [section:overload1 ip::address_v6::scope_id (1 of 2 overloads)]
75823
75824
75825 The scope ID of the address. 
75826
75827
75828   unsigned long scope_id() const;
75829
75830
75831 Returns the scope ID associated with the IPv6 address. 
75832
75833
75834 [endsect]
75835
75836
75837
75838 [section:overload2 ip::address_v6::scope_id (2 of 2 overloads)]
75839
75840
75841 The scope ID of the address. 
75842
75843
75844   void scope_id(
75845       unsigned long id);
75846
75847
75848 Modifies the scope ID associated with the IPv6 address. 
75849
75850
75851 [endsect]
75852
75853
75854 [endsect]
75855
75856
75857 [section:to_bytes ip::address_v6::to_bytes]
75858
75859 [indexterm2 boost_asio.indexterm.ip__address_v6.to_bytes..to_bytes..ip::address_v6] 
75860 Get the address in bytes, in network byte order. 
75861
75862
75863   bytes_type to_bytes() const;
75864
75865
75866
75867 [endsect]
75868
75869
75870 [section:to_string ip::address_v6::to_string]
75871
75872 [indexterm2 boost_asio.indexterm.ip__address_v6.to_string..to_string..ip::address_v6] 
75873 Get the address as a string. 
75874
75875
75876   std::string ``[link boost_asio.reference.ip__address_v6.to_string.overload1 to_string]``() const;
75877   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v6.to_string.overload1 more...]]``
75878
75879
75880 (Deprecated: Use other overload.) Get the address as a string. 
75881
75882
75883   std::string ``[link boost_asio.reference.ip__address_v6.to_string.overload2 to_string]``(
75884       boost::system::error_code & ec) const;
75885   ``  [''''&raquo;''' [link boost_asio.reference.ip__address_v6.to_string.overload2 more...]]``
75886
75887
75888 [section:overload1 ip::address_v6::to_string (1 of 2 overloads)]
75889
75890
75891 Get the address as a string. 
75892
75893
75894   std::string to_string() const;
75895
75896
75897
75898 [endsect]
75899
75900
75901
75902 [section:overload2 ip::address_v6::to_string (2 of 2 overloads)]
75903
75904
75905 (Deprecated: Use other overload.) Get the address as a string. 
75906
75907
75908   std::string to_string(
75909       boost::system::error_code & ec) const;
75910
75911
75912
75913 [endsect]
75914
75915
75916 [endsect]
75917
75918
75919 [section:to_v4 ip::address_v6::to_v4]
75920
75921 [indexterm2 boost_asio.indexterm.ip__address_v6.to_v4..to_v4..ip::address_v6] 
75922 (Deprecated: Use `make_address_v4()`.) Converts an IPv4-mapped or IPv4-compatible address to an IPv4 address. 
75923
75924
75925   address_v4 to_v4() const;
75926
75927
75928
75929 [endsect]
75930
75931
75932
75933 [section:v4_compatible ip::address_v6::v4_compatible]
75934
75935 [indexterm2 boost_asio.indexterm.ip__address_v6.v4_compatible..v4_compatible..ip::address_v6] 
75936 (Deprecated: No replacement.) Create an IPv4-compatible IPv6 address. 
75937
75938
75939   static address_v6 v4_compatible(
75940       const address_v4 & addr);
75941
75942
75943
75944 [endsect]
75945
75946
75947
75948 [section:v4_mapped ip::address_v6::v4_mapped]
75949
75950 [indexterm2 boost_asio.indexterm.ip__address_v6.v4_mapped..v4_mapped..ip::address_v6] 
75951 (Deprecated: Use `make_address_v6()`.) Create an IPv4-mapped IPv6 address. 
75952
75953
75954   static address_v6 v4_mapped(
75955       const address_v4 & addr);
75956
75957
75958
75959 [endsect]
75960
75961
75962
75963 [endsect]
75964
75965
75966 [section:ip__address_v6_iterator ip::address_v6_iterator]
75967
75968 [indexterm1 boost_asio.indexterm.ip__address_v6_iterator..ip::address_v6_iterator] 
75969 An input iterator that can be used for traversing IPv6 addresses. 
75970
75971
75972   typedef basic_address_iterator< address_v6 > address_v6_iterator;
75973
75974
75975
75976 [heading Requirements]
75977
75978 ['Header: ][^boost/asio/ip/address_v6_iterator.hpp]
75979
75980 ['Convenience header: ][^boost/asio.hpp]
75981
75982
75983 [endsect]
75984
75985
75986
75987 [section:ip__address_v6_range ip::address_v6_range]
75988
75989 [indexterm1 boost_asio.indexterm.ip__address_v6_range..ip::address_v6_range] 
75990 Represents a range of IPv6 addresses. 
75991
75992
75993   typedef basic_address_range< address_v6 > address_v6_range;
75994
75995
75996
75997 [heading Requirements]
75998
75999 ['Header: ][^boost/asio/ip/address_v6_range.hpp]
76000
76001 ['Convenience header: ][^boost/asio.hpp]
76002
76003
76004 [endsect]
76005
76006
76007 [section:ip__bad_address_cast ip::bad_address_cast]
76008
76009
76010 Thrown to indicate a failed address conversion. 
76011
76012
76013   class bad_address_cast
76014
76015
76016 [heading Member Functions]
76017 [table
76018   [[Name][Description]]
76019
76020   [
76021     [[link boost_asio.reference.ip__bad_address_cast.bad_address_cast [*bad_address_cast]]]
76022     [Default constructor. ]
76023   ]
76024   
76025   [
76026     [[link boost_asio.reference.ip__bad_address_cast.what [*what]]]
76027     [Get the message associated with the exception. ]
76028   ]
76029   
76030   [
76031     [[link boost_asio.reference.ip__bad_address_cast._bad_address_cast [*~bad_address_cast]]]
76032     [Destructor. ]
76033   ]
76034   
76035 ]
76036
76037 [heading Requirements]
76038
76039 ['Header: ][^boost/asio/ip/bad_address_cast.hpp]
76040
76041 ['Convenience header: ][^boost/asio.hpp]
76042
76043
76044 [section:bad_address_cast ip::bad_address_cast::bad_address_cast]
76045
76046 [indexterm2 boost_asio.indexterm.ip__bad_address_cast.bad_address_cast..bad_address_cast..ip::bad_address_cast] 
76047 Default constructor. 
76048
76049
76050   bad_address_cast();
76051
76052
76053
76054 [endsect]
76055
76056
76057
76058 [section:what ip::bad_address_cast::what]
76059
76060 [indexterm2 boost_asio.indexterm.ip__bad_address_cast.what..what..ip::bad_address_cast] 
76061 Get the message associated with the exception. 
76062
76063
76064   virtual const char * what() const;
76065
76066
76067
76068 [endsect]
76069
76070
76071
76072 [section:_bad_address_cast ip::bad_address_cast::~bad_address_cast]
76073
76074 [indexterm2 boost_asio.indexterm.ip__bad_address_cast._bad_address_cast..~bad_address_cast..ip::bad_address_cast] 
76075 Destructor. 
76076
76077
76078   virtual ~bad_address_cast();
76079
76080
76081
76082 [endsect]
76083
76084
76085
76086 [endsect]
76087
76088 [section:ip__basic_address_iterator_lt__address_v4__gt_ ip::basic_address_iterator< address_v4 >]
76089
76090
76091 An input iterator that can be used for traversing IPv4 addresses. 
76092
76093
76094   template<>
76095   class basic_address_iterator< address_v4 >
76096
76097
76098 [heading Types]
76099 [table
76100   [[Name][Description]]
76101
76102   [
76103
76104     [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.difference_type [*difference_type]]]
76105     [Distance between two iterators. ]
76106   
76107   ]
76108
76109   [
76110
76111     [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.iterator_category [*iterator_category]]]
76112     [Denotes that the iterator satisfies the input iterator requirements. ]
76113   
76114   ]
76115
76116   [
76117
76118     [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.pointer [*pointer]]]
76119     [The type of a pointer to an element pointed to by the iterator. ]
76120   
76121   ]
76122
76123   [
76124
76125     [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.reference [*reference]]]
76126     [The type of a reference to an element pointed to by the iterator. ]
76127   
76128   ]
76129
76130   [
76131
76132     [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.value_type [*value_type]]]
76133     [The type of the elements pointed to by the iterator. ]
76134   
76135   ]
76136
76137 ]
76138
76139 [heading Member Functions]
76140 [table
76141   [[Name][Description]]
76142
76143   [
76144     [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.basic_address_iterator [*basic_address_iterator]]]
76145     [Construct an iterator that points to the specified address. 
76146      [hr]
76147      Copy constructor. ]
76148   ]
76149   
76150   [
76151     [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator__star_ [*operator *]]]
76152     [Dereference the iterator. ]
76153   ]
76154   
76155   [
76156     [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_plus__plus_ [*operator++]]]
76157     [Pre-increment operator. 
76158      [hr]
76159      Post-increment operator. ]
76160   ]
76161   
76162   [
76163     [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_minus__minus_ [*operator--]]]
76164     [Pre-decrement operator. 
76165      [hr]
76166      Post-decrement operator. ]
76167   ]
76168   
76169   [
76170     [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_arrow_ [*operator->]]]
76171     [Dereference the iterator. ]
76172   ]
76173   
76174   [
76175     [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_eq_ [*operator=]]]
76176     [Assignment operator. ]
76177   ]
76178   
76179 ]
76180
76181 [heading Friends]
76182 [table
76183   [[Name][Description]]
76184
76185   [
76186     [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_not__eq_ [*operator!=]]]
76187     [Compare two addresses for inequality. ]
76188   ]
76189   
76190   [
76191     [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_eq__eq_ [*operator==]]]
76192     [Compare two addresses for equality. ]
76193   ]
76194   
76195 ]
76196
76197 In addition to satisfying the input iterator requirements, this iterator also supports decrement.
76198
76199
76200 [heading Thread Safety]
76201   
76202 ['Distinct] ['objects:] Safe.
76203
76204 ['Shared] ['objects:] Unsafe. 
76205
76206
76207
76208 [heading Requirements]
76209
76210 ['Header: ][^boost/asio/ip/address_v4_iterator.hpp]
76211
76212 ['Convenience header: ][^boost/asio.hpp]
76213
76214 [section:basic_address_iterator ip::basic_address_iterator< address_v4 >::basic_address_iterator]
76215
76216 [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.basic_address_iterator..basic_address_iterator..ip::basic_address_iterator< address_v4 >] 
76217 Construct an iterator that points to the specified address. 
76218
76219
76220   ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.basic_address_iterator.overload1 basic_address_iterator]``(
76221       const address_v4 & addr);
76222   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.basic_address_iterator.overload1 more...]]``
76223
76224
76225 Copy constructor. 
76226
76227
76228   ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.basic_address_iterator.overload2 basic_address_iterator]``(
76229       const basic_address_iterator & other);
76230   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.basic_address_iterator.overload2 more...]]``
76231
76232
76233 [section:overload1 ip::basic_address_iterator< address_v4 >::basic_address_iterator (1 of 2 overloads)]
76234
76235
76236 Construct an iterator that points to the specified address. 
76237
76238
76239   basic_address_iterator(
76240       const address_v4 & addr);
76241
76242
76243
76244 [endsect]
76245
76246
76247
76248 [section:overload2 ip::basic_address_iterator< address_v4 >::basic_address_iterator (2 of 2 overloads)]
76249
76250
76251 Copy constructor. 
76252
76253
76254   basic_address_iterator(
76255       const basic_address_iterator & other);
76256
76257
76258
76259 [endsect]
76260
76261
76262 [endsect]
76263
76264
76265 [section:difference_type ip::basic_address_iterator< address_v4 >::difference_type]
76266
76267 [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.difference_type..difference_type..ip::basic_address_iterator< address_v4 >] 
76268 Distance between two iterators. 
76269
76270
76271   typedef std::ptrdiff_t difference_type;
76272
76273
76274
76275 [heading Requirements]
76276
76277 ['Header: ][^boost/asio/ip/address_v4_iterator.hpp]
76278
76279 ['Convenience header: ][^boost/asio.hpp]
76280
76281
76282 [endsect]
76283
76284
76285
76286 [section:iterator_category ip::basic_address_iterator< address_v4 >::iterator_category]
76287
76288 [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.iterator_category..iterator_category..ip::basic_address_iterator< address_v4 >] 
76289 Denotes that the iterator satisfies the input iterator requirements. 
76290
76291
76292   typedef std::input_iterator_tag iterator_category;
76293
76294
76295
76296 [heading Requirements]
76297
76298 ['Header: ][^boost/asio/ip/address_v4_iterator.hpp]
76299
76300 ['Convenience header: ][^boost/asio.hpp]
76301
76302
76303 [endsect]
76304
76305
76306
76307 [section:operator__star_ ip::basic_address_iterator< address_v4 >::operator *]
76308
76309 [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.operator__star_..operator *..ip::basic_address_iterator< address_v4 >] 
76310 Dereference the iterator. 
76311
76312
76313   const address_v4 & operator *() const;
76314
76315
76316
76317 [endsect]
76318
76319
76320
76321 [section:operator_not__eq_ ip::basic_address_iterator< address_v4 >::operator!=]
76322
76323 [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.operator_not__eq_..operator!=..ip::basic_address_iterator< address_v4 >] 
76324 Compare two addresses for inequality. 
76325
76326
76327   friend bool operator!=(
76328       const basic_address_iterator & a,
76329       const basic_address_iterator & b);
76330
76331
76332 [heading Requirements]
76333
76334 ['Header: ][^boost/asio/ip/address_v4_iterator.hpp]
76335
76336 ['Convenience header: ][^boost/asio.hpp]
76337
76338
76339 [endsect]
76340
76341
76342 [section:operator_plus__plus_ ip::basic_address_iterator< address_v4 >::operator++]
76343
76344 [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.operator_plus__plus_..operator++..ip::basic_address_iterator< address_v4 >] 
76345 Pre-increment operator. 
76346
76347
76348   basic_address_iterator & ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_plus__plus_.overload1 operator++]``();
76349   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_plus__plus_.overload1 more...]]``
76350
76351
76352 Post-increment operator. 
76353
76354
76355   basic_address_iterator ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_plus__plus_.overload2 operator++]``(
76356       int );
76357   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_plus__plus_.overload2 more...]]``
76358
76359
76360 [section:overload1 ip::basic_address_iterator< address_v4 >::operator++ (1 of 2 overloads)]
76361
76362
76363 Pre-increment operator. 
76364
76365
76366   basic_address_iterator & operator++();
76367
76368
76369
76370 [endsect]
76371
76372
76373
76374 [section:overload2 ip::basic_address_iterator< address_v4 >::operator++ (2 of 2 overloads)]
76375
76376
76377 Post-increment operator. 
76378
76379
76380   basic_address_iterator operator++(
76381       int );
76382
76383
76384
76385 [endsect]
76386
76387
76388 [endsect]
76389
76390 [section:operator_minus__minus_ ip::basic_address_iterator< address_v4 >::operator--]
76391
76392 [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.operator_minus__minus_..operator--..ip::basic_address_iterator< address_v4 >] 
76393 Pre-decrement operator. 
76394
76395
76396   basic_address_iterator & ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_minus__minus_.overload1 operator--]``();
76397   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_minus__minus_.overload1 more...]]``
76398
76399
76400 Post-decrement operator. 
76401
76402
76403   basic_address_iterator ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_minus__minus_.overload2 operator--]``(
76404       int );
76405   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_minus__minus_.overload2 more...]]``
76406
76407
76408 [section:overload1 ip::basic_address_iterator< address_v4 >::operator-- (1 of 2 overloads)]
76409
76410
76411 Pre-decrement operator. 
76412
76413
76414   basic_address_iterator & operator--();
76415
76416
76417
76418 [endsect]
76419
76420
76421
76422 [section:overload2 ip::basic_address_iterator< address_v4 >::operator-- (2 of 2 overloads)]
76423
76424
76425 Post-decrement operator. 
76426
76427
76428   basic_address_iterator operator--(
76429       int );
76430
76431
76432
76433 [endsect]
76434
76435
76436 [endsect]
76437
76438
76439 [section:operator_arrow_ ip::basic_address_iterator< address_v4 >::operator->]
76440
76441 [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.operator_arrow_..operator->..ip::basic_address_iterator< address_v4 >] 
76442 Dereference the iterator. 
76443
76444
76445   const address_v4 * operator->() const;
76446
76447
76448
76449 [endsect]
76450
76451
76452
76453 [section:operator_eq_ ip::basic_address_iterator< address_v4 >::operator=]
76454
76455 [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.operator_eq_..operator=..ip::basic_address_iterator< address_v4 >] 
76456 Assignment operator. 
76457
76458
76459   basic_address_iterator & operator=(
76460       const basic_address_iterator & other);
76461
76462
76463
76464 [endsect]
76465
76466
76467
76468 [section:operator_eq__eq_ ip::basic_address_iterator< address_v4 >::operator==]
76469
76470 [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.operator_eq__eq_..operator==..ip::basic_address_iterator< address_v4 >] 
76471 Compare two addresses for equality. 
76472
76473
76474   friend bool operator==(
76475       const basic_address_iterator & a,
76476       const basic_address_iterator & b);
76477
76478
76479 [heading Requirements]
76480
76481 ['Header: ][^boost/asio/ip/address_v4_iterator.hpp]
76482
76483 ['Convenience header: ][^boost/asio.hpp]
76484
76485
76486 [endsect]
76487
76488
76489
76490 [section:pointer ip::basic_address_iterator< address_v4 >::pointer]
76491
76492 [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.pointer..pointer..ip::basic_address_iterator< address_v4 >] 
76493 The type of a pointer to an element pointed to by the iterator. 
76494
76495
76496   typedef const address_v4 * pointer;
76497
76498
76499
76500 [heading Requirements]
76501
76502 ['Header: ][^boost/asio/ip/address_v4_iterator.hpp]
76503
76504 ['Convenience header: ][^boost/asio.hpp]
76505
76506
76507 [endsect]
76508
76509
76510
76511 [section:reference ip::basic_address_iterator< address_v4 >::reference]
76512
76513 [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.reference..reference..ip::basic_address_iterator< address_v4 >] 
76514 The type of a reference to an element pointed to by the iterator. 
76515
76516
76517   typedef const address_v4 & reference;
76518
76519
76520 [heading Types]
76521 [table
76522   [[Name][Description]]
76523
76524   [
76525
76526     [[link boost_asio.reference.ip__address_v4.bytes_type [*bytes_type]]]
76527     [The type used to represent an address as an array of bytes. ]
76528   
76529   ]
76530
76531   [
76532
76533     [[link boost_asio.reference.ip__address_v4.uint_type [*uint_type]]]
76534     [The type used to represent an address as an unsigned integer. ]
76535   
76536   ]
76537
76538 ]
76539
76540 [heading Member Functions]
76541 [table
76542   [[Name][Description]]
76543
76544   [
76545     [[link boost_asio.reference.ip__address_v4.address_v4 [*address_v4]]]
76546     [Default constructor. 
76547      [hr]
76548      Construct an address from raw bytes. 
76549      [hr]
76550      Construct an address from an unsigned integer in host byte order. 
76551      [hr]
76552      Copy constructor. ]
76553   ]
76554   
76555   [
76556     [[link boost_asio.reference.ip__address_v4.any [*any]]]
76557     [Obtain an address object that represents any address. ]
76558   ]
76559   
76560   [
76561     [[link boost_asio.reference.ip__address_v4.broadcast [*broadcast]]]
76562     [Obtain an address object that represents the broadcast address. 
76563      [hr]
76564      (Deprecated: Use network_v4 class.) Obtain an address object that represents the broadcast address that corresponds to the specified address and netmask. ]
76565   ]
76566   
76567   [
76568     [[link boost_asio.reference.ip__address_v4.from_string [*from_string]]]
76569     [(Deprecated: Use make_address_v4().) Create an address from an IP address string in dotted decimal form. ]
76570   ]
76571   
76572   [
76573     [[link boost_asio.reference.ip__address_v4.is_class_a [*is_class_a]]]
76574     [(Deprecated: Use network_v4 class.) Determine whether the address is a class A address. ]
76575   ]
76576   
76577   [
76578     [[link boost_asio.reference.ip__address_v4.is_class_b [*is_class_b]]]
76579     [(Deprecated: Use network_v4 class.) Determine whether the address is a class B address. ]
76580   ]
76581   
76582   [
76583     [[link boost_asio.reference.ip__address_v4.is_class_c [*is_class_c]]]
76584     [(Deprecated: Use network_v4 class.) Determine whether the address is a class C address. ]
76585   ]
76586   
76587   [
76588     [[link boost_asio.reference.ip__address_v4.is_loopback [*is_loopback]]]
76589     [Determine whether the address is a loopback address. ]
76590   ]
76591   
76592   [
76593     [[link boost_asio.reference.ip__address_v4.is_multicast [*is_multicast]]]
76594     [Determine whether the address is a multicast address. ]
76595   ]
76596   
76597   [
76598     [[link boost_asio.reference.ip__address_v4.is_unspecified [*is_unspecified]]]
76599     [Determine whether the address is unspecified. ]
76600   ]
76601   
76602   [
76603     [[link boost_asio.reference.ip__address_v4.loopback [*loopback]]]
76604     [Obtain an address object that represents the loopback address. ]
76605   ]
76606   
76607   [
76608     [[link boost_asio.reference.ip__address_v4.netmask [*netmask]]]
76609     [(Deprecated: Use network_v4 class.) Obtain the netmask that corresponds to the address, based on its address class. ]
76610   ]
76611   
76612   [
76613     [[link boost_asio.reference.ip__address_v4.operator_eq_ [*operator=]]]
76614     [Assign from another address. ]
76615   ]
76616   
76617   [
76618     [[link boost_asio.reference.ip__address_v4.to_bytes [*to_bytes]]]
76619     [Get the address in bytes, in network byte order. ]
76620   ]
76621   
76622   [
76623     [[link boost_asio.reference.ip__address_v4.to_string [*to_string]]]
76624     [Get the address as a string in dotted decimal format. 
76625      [hr]
76626      (Deprecated: Use other overload.) Get the address as a string in dotted decimal format. ]
76627   ]
76628   
76629   [
76630     [[link boost_asio.reference.ip__address_v4.to_uint [*to_uint]]]
76631     [Get the address as an unsigned integer in host byte order. ]
76632   ]
76633   
76634   [
76635     [[link boost_asio.reference.ip__address_v4.to_ulong [*to_ulong]]]
76636     [Get the address as an unsigned long in host byte order. ]
76637   ]
76638   
76639 ]
76640
76641 [heading Friends]
76642 [table
76643   [[Name][Description]]
76644
76645   [
76646     [[link boost_asio.reference.ip__address_v4.operator_not__eq_ [*operator!=]]]
76647     [Compare two addresses for inequality. ]
76648   ]
76649   
76650   [
76651     [[link boost_asio.reference.ip__address_v4.operator_lt_ [*operator<]]]
76652     [Compare addresses for ordering. ]
76653   ]
76654   
76655   [
76656     [[link boost_asio.reference.ip__address_v4.operator_lt__eq_ [*operator<=]]]
76657     [Compare addresses for ordering. ]
76658   ]
76659   
76660   [
76661     [[link boost_asio.reference.ip__address_v4.operator_eq__eq_ [*operator==]]]
76662     [Compare two addresses for equality. ]
76663   ]
76664   
76665   [
76666     [[link boost_asio.reference.ip__address_v4.operator_gt_ [*operator>]]]
76667     [Compare addresses for ordering. ]
76668   ]
76669   
76670   [
76671     [[link boost_asio.reference.ip__address_v4.operator_gt__eq_ [*operator>=]]]
76672     [Compare addresses for ordering. ]
76673   ]
76674   
76675 ]
76676
76677 [heading Related Functions]
76678 [table
76679   [[Name][Description]]
76680
76681   [
76682     [[link boost_asio.reference.ip__address_v4.make_address_v4 [*make_address_v4]]]
76683     [Create an IPv4 address from raw bytes in network order. 
76684
76685      Create an IPv4 address from an unsigned integer in host byte order. 
76686
76687      Create an IPv4 address from an IP address string in dotted decimal form. 
76688
76689      Create an IPv4 address from a IPv4-mapped IPv6 address. ]
76690   ]
76691   
76692   [
76693     [[link boost_asio.reference.ip__address_v4.make_network_v4 [*make_network_v4]]]
76694     [Create an IPv4 network from an address and prefix length. 
76695
76696      Create an IPv4 network from an address and netmask. ]
76697   ]
76698   
76699   [
76700     [[link boost_asio.reference.ip__address_v4.operator_lt__lt_ [*operator<<]]]
76701     [Output an address as a string. 
76702
76703      Output a network as a string. ]
76704   ]
76705   
76706 ]
76707
76708 The [link boost_asio.reference.ip__address_v4 `ip::address_v4`] class provides the ability to use and manipulate IP version 4 addresses.
76709
76710
76711 [heading Thread Safety]
76712   
76713 ['Distinct] ['objects:] Safe.
76714
76715 ['Shared] ['objects:] Unsafe. 
76716
76717
76718
76719
76720 [heading Requirements]
76721
76722 ['Header: ][^boost/asio/ip/address_v4_iterator.hpp]
76723
76724 ['Convenience header: ][^boost/asio.hpp]
76725
76726
76727 [endsect]
76728
76729
76730
76731 [section:value_type ip::basic_address_iterator< address_v4 >::value_type]
76732
76733 [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.value_type..value_type..ip::basic_address_iterator< address_v4 >] 
76734 The type of the elements pointed to by the iterator. 
76735
76736
76737   typedef address_v4 value_type;
76738
76739
76740 [heading Types]
76741 [table
76742   [[Name][Description]]
76743
76744   [
76745
76746     [[link boost_asio.reference.ip__address_v4.bytes_type [*bytes_type]]]
76747     [The type used to represent an address as an array of bytes. ]
76748   
76749   ]
76750
76751   [
76752
76753     [[link boost_asio.reference.ip__address_v4.uint_type [*uint_type]]]
76754     [The type used to represent an address as an unsigned integer. ]
76755   
76756   ]
76757
76758 ]
76759
76760 [heading Member Functions]
76761 [table
76762   [[Name][Description]]
76763
76764   [
76765     [[link boost_asio.reference.ip__address_v4.address_v4 [*address_v4]]]
76766     [Default constructor. 
76767      [hr]
76768      Construct an address from raw bytes. 
76769      [hr]
76770      Construct an address from an unsigned integer in host byte order. 
76771      [hr]
76772      Copy constructor. ]
76773   ]
76774   
76775   [
76776     [[link boost_asio.reference.ip__address_v4.any [*any]]]
76777     [Obtain an address object that represents any address. ]
76778   ]
76779   
76780   [
76781     [[link boost_asio.reference.ip__address_v4.broadcast [*broadcast]]]
76782     [Obtain an address object that represents the broadcast address. 
76783      [hr]
76784      (Deprecated: Use network_v4 class.) Obtain an address object that represents the broadcast address that corresponds to the specified address and netmask. ]
76785   ]
76786   
76787   [
76788     [[link boost_asio.reference.ip__address_v4.from_string [*from_string]]]
76789     [(Deprecated: Use make_address_v4().) Create an address from an IP address string in dotted decimal form. ]
76790   ]
76791   
76792   [
76793     [[link boost_asio.reference.ip__address_v4.is_class_a [*is_class_a]]]
76794     [(Deprecated: Use network_v4 class.) Determine whether the address is a class A address. ]
76795   ]
76796   
76797   [
76798     [[link boost_asio.reference.ip__address_v4.is_class_b [*is_class_b]]]
76799     [(Deprecated: Use network_v4 class.) Determine whether the address is a class B address. ]
76800   ]
76801   
76802   [
76803     [[link boost_asio.reference.ip__address_v4.is_class_c [*is_class_c]]]
76804     [(Deprecated: Use network_v4 class.) Determine whether the address is a class C address. ]
76805   ]
76806   
76807   [
76808     [[link boost_asio.reference.ip__address_v4.is_loopback [*is_loopback]]]
76809     [Determine whether the address is a loopback address. ]
76810   ]
76811   
76812   [
76813     [[link boost_asio.reference.ip__address_v4.is_multicast [*is_multicast]]]
76814     [Determine whether the address is a multicast address. ]
76815   ]
76816   
76817   [
76818     [[link boost_asio.reference.ip__address_v4.is_unspecified [*is_unspecified]]]
76819     [Determine whether the address is unspecified. ]
76820   ]
76821   
76822   [
76823     [[link boost_asio.reference.ip__address_v4.loopback [*loopback]]]
76824     [Obtain an address object that represents the loopback address. ]
76825   ]
76826   
76827   [
76828     [[link boost_asio.reference.ip__address_v4.netmask [*netmask]]]
76829     [(Deprecated: Use network_v4 class.) Obtain the netmask that corresponds to the address, based on its address class. ]
76830   ]
76831   
76832   [
76833     [[link boost_asio.reference.ip__address_v4.operator_eq_ [*operator=]]]
76834     [Assign from another address. ]
76835   ]
76836   
76837   [
76838     [[link boost_asio.reference.ip__address_v4.to_bytes [*to_bytes]]]
76839     [Get the address in bytes, in network byte order. ]
76840   ]
76841   
76842   [
76843     [[link boost_asio.reference.ip__address_v4.to_string [*to_string]]]
76844     [Get the address as a string in dotted decimal format. 
76845      [hr]
76846      (Deprecated: Use other overload.) Get the address as a string in dotted decimal format. ]
76847   ]
76848   
76849   [
76850     [[link boost_asio.reference.ip__address_v4.to_uint [*to_uint]]]
76851     [Get the address as an unsigned integer in host byte order. ]
76852   ]
76853   
76854   [
76855     [[link boost_asio.reference.ip__address_v4.to_ulong [*to_ulong]]]
76856     [Get the address as an unsigned long in host byte order. ]
76857   ]
76858   
76859 ]
76860
76861 [heading Friends]
76862 [table
76863   [[Name][Description]]
76864
76865   [
76866     [[link boost_asio.reference.ip__address_v4.operator_not__eq_ [*operator!=]]]
76867     [Compare two addresses for inequality. ]
76868   ]
76869   
76870   [
76871     [[link boost_asio.reference.ip__address_v4.operator_lt_ [*operator<]]]
76872     [Compare addresses for ordering. ]
76873   ]
76874   
76875   [
76876     [[link boost_asio.reference.ip__address_v4.operator_lt__eq_ [*operator<=]]]
76877     [Compare addresses for ordering. ]
76878   ]
76879   
76880   [
76881     [[link boost_asio.reference.ip__address_v4.operator_eq__eq_ [*operator==]]]
76882     [Compare two addresses for equality. ]
76883   ]
76884   
76885   [
76886     [[link boost_asio.reference.ip__address_v4.operator_gt_ [*operator>]]]
76887     [Compare addresses for ordering. ]
76888   ]
76889   
76890   [
76891     [[link boost_asio.reference.ip__address_v4.operator_gt__eq_ [*operator>=]]]
76892     [Compare addresses for ordering. ]
76893   ]
76894   
76895 ]
76896
76897 [heading Related Functions]
76898 [table
76899   [[Name][Description]]
76900
76901   [
76902     [[link boost_asio.reference.ip__address_v4.make_address_v4 [*make_address_v4]]]
76903     [Create an IPv4 address from raw bytes in network order. 
76904
76905      Create an IPv4 address from an unsigned integer in host byte order. 
76906
76907      Create an IPv4 address from an IP address string in dotted decimal form. 
76908
76909      Create an IPv4 address from a IPv4-mapped IPv6 address. ]
76910   ]
76911   
76912   [
76913     [[link boost_asio.reference.ip__address_v4.make_network_v4 [*make_network_v4]]]
76914     [Create an IPv4 network from an address and prefix length. 
76915
76916      Create an IPv4 network from an address and netmask. ]
76917   ]
76918   
76919   [
76920     [[link boost_asio.reference.ip__address_v4.operator_lt__lt_ [*operator<<]]]
76921     [Output an address as a string. 
76922
76923      Output a network as a string. ]
76924   ]
76925   
76926 ]
76927
76928 The [link boost_asio.reference.ip__address_v4 `ip::address_v4`] class provides the ability to use and manipulate IP version 4 addresses.
76929
76930
76931 [heading Thread Safety]
76932   
76933 ['Distinct] ['objects:] Safe.
76934
76935 ['Shared] ['objects:] Unsafe. 
76936
76937
76938
76939
76940 [heading Requirements]
76941
76942 ['Header: ][^boost/asio/ip/address_v4_iterator.hpp]
76943
76944 ['Convenience header: ][^boost/asio.hpp]
76945
76946
76947 [endsect]
76948
76949
76950
76951 [endsect]
76952
76953 [section:ip__basic_address_iterator_lt__address_v6__gt_ ip::basic_address_iterator< address_v6 >]
76954
76955
76956 An input iterator that can be used for traversing IPv6 addresses. 
76957
76958
76959   template<>
76960   class basic_address_iterator< address_v6 >
76961
76962
76963 [heading Types]
76964 [table
76965   [[Name][Description]]
76966
76967   [
76968
76969     [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.difference_type [*difference_type]]]
76970     [Distance between two iterators. ]
76971   
76972   ]
76973
76974   [
76975
76976     [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.iterator_category [*iterator_category]]]
76977     [Denotes that the iterator satisfies the input iterator requirements. ]
76978   
76979   ]
76980
76981   [
76982
76983     [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.pointer [*pointer]]]
76984     [The type of a pointer to an element pointed to by the iterator. ]
76985   
76986   ]
76987
76988   [
76989
76990     [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.reference [*reference]]]
76991     [The type of a reference to an element pointed to by the iterator. ]
76992   
76993   ]
76994
76995   [
76996
76997     [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.value_type [*value_type]]]
76998     [The type of the elements pointed to by the iterator. ]
76999   
77000   ]
77001
77002 ]
77003
77004 [heading Member Functions]
77005 [table
77006   [[Name][Description]]
77007
77008   [
77009     [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.basic_address_iterator [*basic_address_iterator]]]
77010     [Construct an iterator that points to the specified address. 
77011      [hr]
77012      Copy constructor. ]
77013   ]
77014   
77015   [
77016     [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator__star_ [*operator *]]]
77017     [Dereference the iterator. ]
77018   ]
77019   
77020   [
77021     [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_plus__plus_ [*operator++]]]
77022     [Pre-increment operator. 
77023      [hr]
77024      Post-increment operator. ]
77025   ]
77026   
77027   [
77028     [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_minus__minus_ [*operator--]]]
77029     [Pre-decrement operator. 
77030      [hr]
77031      Post-decrement operator. ]
77032   ]
77033   
77034   [
77035     [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_arrow_ [*operator->]]]
77036     [Dereference the iterator. ]
77037   ]
77038   
77039   [
77040     [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_eq_ [*operator=]]]
77041     [Assignment operator. ]
77042   ]
77043   
77044 ]
77045
77046 [heading Friends]
77047 [table
77048   [[Name][Description]]
77049
77050   [
77051     [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_not__eq_ [*operator!=]]]
77052     [Compare two addresses for inequality. ]
77053   ]
77054   
77055   [
77056     [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_eq__eq_ [*operator==]]]
77057     [Compare two addresses for equality. ]
77058   ]
77059   
77060 ]
77061
77062 In addition to satisfying the input iterator requirements, this iterator also supports decrement.
77063
77064
77065 [heading Thread Safety]
77066   
77067 ['Distinct] ['objects:] Safe.
77068
77069 ['Shared] ['objects:] Unsafe. 
77070
77071
77072
77073 [heading Requirements]
77074
77075 ['Header: ][^boost/asio/ip/address_v6_iterator.hpp]
77076
77077 ['Convenience header: ][^boost/asio.hpp]
77078
77079 [section:basic_address_iterator ip::basic_address_iterator< address_v6 >::basic_address_iterator]
77080
77081 [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.basic_address_iterator..basic_address_iterator..ip::basic_address_iterator< address_v6 >] 
77082 Construct an iterator that points to the specified address. 
77083
77084
77085   ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.basic_address_iterator.overload1 basic_address_iterator]``(
77086       const address_v6 & addr);
77087   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.basic_address_iterator.overload1 more...]]``
77088
77089
77090 Copy constructor. 
77091
77092
77093   ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.basic_address_iterator.overload2 basic_address_iterator]``(
77094       const basic_address_iterator & other);
77095   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.basic_address_iterator.overload2 more...]]``
77096
77097
77098 [section:overload1 ip::basic_address_iterator< address_v6 >::basic_address_iterator (1 of 2 overloads)]
77099
77100
77101 Construct an iterator that points to the specified address. 
77102
77103
77104   basic_address_iterator(
77105       const address_v6 & addr);
77106
77107
77108
77109 [endsect]
77110
77111
77112
77113 [section:overload2 ip::basic_address_iterator< address_v6 >::basic_address_iterator (2 of 2 overloads)]
77114
77115
77116 Copy constructor. 
77117
77118
77119   basic_address_iterator(
77120       const basic_address_iterator & other);
77121
77122
77123
77124 [endsect]
77125
77126
77127 [endsect]
77128
77129
77130 [section:difference_type ip::basic_address_iterator< address_v6 >::difference_type]
77131
77132 [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.difference_type..difference_type..ip::basic_address_iterator< address_v6 >] 
77133 Distance between two iterators. 
77134
77135
77136   typedef std::ptrdiff_t difference_type;
77137
77138
77139
77140 [heading Requirements]
77141
77142 ['Header: ][^boost/asio/ip/address_v6_iterator.hpp]
77143
77144 ['Convenience header: ][^boost/asio.hpp]
77145
77146
77147 [endsect]
77148
77149
77150
77151 [section:iterator_category ip::basic_address_iterator< address_v6 >::iterator_category]
77152
77153 [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.iterator_category..iterator_category..ip::basic_address_iterator< address_v6 >] 
77154 Denotes that the iterator satisfies the input iterator requirements. 
77155
77156
77157   typedef std::input_iterator_tag iterator_category;
77158
77159
77160
77161 [heading Requirements]
77162
77163 ['Header: ][^boost/asio/ip/address_v6_iterator.hpp]
77164
77165 ['Convenience header: ][^boost/asio.hpp]
77166
77167
77168 [endsect]
77169
77170
77171
77172 [section:operator__star_ ip::basic_address_iterator< address_v6 >::operator *]
77173
77174 [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.operator__star_..operator *..ip::basic_address_iterator< address_v6 >] 
77175 Dereference the iterator. 
77176
77177
77178   const address_v6 & operator *() const;
77179
77180
77181
77182 [endsect]
77183
77184
77185
77186 [section:operator_not__eq_ ip::basic_address_iterator< address_v6 >::operator!=]
77187
77188 [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.operator_not__eq_..operator!=..ip::basic_address_iterator< address_v6 >] 
77189 Compare two addresses for inequality. 
77190
77191
77192   friend bool operator!=(
77193       const basic_address_iterator & a,
77194       const basic_address_iterator & b);
77195
77196
77197 [heading Requirements]
77198
77199 ['Header: ][^boost/asio/ip/address_v6_iterator.hpp]
77200
77201 ['Convenience header: ][^boost/asio.hpp]
77202
77203
77204 [endsect]
77205
77206
77207 [section:operator_plus__plus_ ip::basic_address_iterator< address_v6 >::operator++]
77208
77209 [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.operator_plus__plus_..operator++..ip::basic_address_iterator< address_v6 >] 
77210 Pre-increment operator. 
77211
77212
77213   basic_address_iterator & ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_plus__plus_.overload1 operator++]``();
77214   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_plus__plus_.overload1 more...]]``
77215
77216
77217 Post-increment operator. 
77218
77219
77220   basic_address_iterator ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_plus__plus_.overload2 operator++]``(
77221       int );
77222   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_plus__plus_.overload2 more...]]``
77223
77224
77225 [section:overload1 ip::basic_address_iterator< address_v6 >::operator++ (1 of 2 overloads)]
77226
77227
77228 Pre-increment operator. 
77229
77230
77231   basic_address_iterator & operator++();
77232
77233
77234
77235 [endsect]
77236
77237
77238
77239 [section:overload2 ip::basic_address_iterator< address_v6 >::operator++ (2 of 2 overloads)]
77240
77241
77242 Post-increment operator. 
77243
77244
77245   basic_address_iterator operator++(
77246       int );
77247
77248
77249
77250 [endsect]
77251
77252
77253 [endsect]
77254
77255 [section:operator_minus__minus_ ip::basic_address_iterator< address_v6 >::operator--]
77256
77257 [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.operator_minus__minus_..operator--..ip::basic_address_iterator< address_v6 >] 
77258 Pre-decrement operator. 
77259
77260
77261   basic_address_iterator & ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_minus__minus_.overload1 operator--]``();
77262   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_minus__minus_.overload1 more...]]``
77263
77264
77265 Post-decrement operator. 
77266
77267
77268   basic_address_iterator ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_minus__minus_.overload2 operator--]``(
77269       int );
77270   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_minus__minus_.overload2 more...]]``
77271
77272
77273 [section:overload1 ip::basic_address_iterator< address_v6 >::operator-- (1 of 2 overloads)]
77274
77275
77276 Pre-decrement operator. 
77277
77278
77279   basic_address_iterator & operator--();
77280
77281
77282
77283 [endsect]
77284
77285
77286
77287 [section:overload2 ip::basic_address_iterator< address_v6 >::operator-- (2 of 2 overloads)]
77288
77289
77290 Post-decrement operator. 
77291
77292
77293   basic_address_iterator operator--(
77294       int );
77295
77296
77297
77298 [endsect]
77299
77300
77301 [endsect]
77302
77303
77304 [section:operator_arrow_ ip::basic_address_iterator< address_v6 >::operator->]
77305
77306 [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.operator_arrow_..operator->..ip::basic_address_iterator< address_v6 >] 
77307 Dereference the iterator. 
77308
77309
77310   const address_v6 * operator->() const;
77311
77312
77313
77314 [endsect]
77315
77316
77317
77318 [section:operator_eq_ ip::basic_address_iterator< address_v6 >::operator=]
77319
77320 [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.operator_eq_..operator=..ip::basic_address_iterator< address_v6 >] 
77321 Assignment operator. 
77322
77323
77324   basic_address_iterator & operator=(
77325       const basic_address_iterator & other);
77326
77327
77328
77329 [endsect]
77330
77331
77332
77333 [section:operator_eq__eq_ ip::basic_address_iterator< address_v6 >::operator==]
77334
77335 [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.operator_eq__eq_..operator==..ip::basic_address_iterator< address_v6 >] 
77336 Compare two addresses for equality. 
77337
77338
77339   friend bool operator==(
77340       const basic_address_iterator & a,
77341       const basic_address_iterator & b);
77342
77343
77344 [heading Requirements]
77345
77346 ['Header: ][^boost/asio/ip/address_v6_iterator.hpp]
77347
77348 ['Convenience header: ][^boost/asio.hpp]
77349
77350
77351 [endsect]
77352
77353
77354
77355 [section:pointer ip::basic_address_iterator< address_v6 >::pointer]
77356
77357 [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.pointer..pointer..ip::basic_address_iterator< address_v6 >] 
77358 The type of a pointer to an element pointed to by the iterator. 
77359
77360
77361   typedef const address_v6 * pointer;
77362
77363
77364
77365 [heading Requirements]
77366
77367 ['Header: ][^boost/asio/ip/address_v6_iterator.hpp]
77368
77369 ['Convenience header: ][^boost/asio.hpp]
77370
77371
77372 [endsect]
77373
77374
77375
77376 [section:reference ip::basic_address_iterator< address_v6 >::reference]
77377
77378 [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.reference..reference..ip::basic_address_iterator< address_v6 >] 
77379 The type of a reference to an element pointed to by the iterator. 
77380
77381
77382   typedef const address_v6 & reference;
77383
77384
77385 [heading Types]
77386 [table
77387   [[Name][Description]]
77388
77389   [
77390
77391     [[link boost_asio.reference.ip__address_v6.bytes_type [*bytes_type]]]
77392     [The type used to represent an address as an array of bytes. ]
77393   
77394   ]
77395
77396 ]
77397
77398 [heading Member Functions]
77399 [table
77400   [[Name][Description]]
77401
77402   [
77403     [[link boost_asio.reference.ip__address_v6.address_v6 [*address_v6]]]
77404     [Default constructor. 
77405      [hr]
77406      Construct an address from raw bytes and scope ID. 
77407      [hr]
77408      Copy constructor. ]
77409   ]
77410   
77411   [
77412     [[link boost_asio.reference.ip__address_v6.any [*any]]]
77413     [Obtain an address object that represents any address. ]
77414   ]
77415   
77416   [
77417     [[link boost_asio.reference.ip__address_v6.from_string [*from_string]]]
77418     [(Deprecated: Use make_address_v6().) Create an IPv6 address from an IP address string. ]
77419   ]
77420   
77421   [
77422     [[link boost_asio.reference.ip__address_v6.is_link_local [*is_link_local]]]
77423     [Determine whether the address is link local. ]
77424   ]
77425   
77426   [
77427     [[link boost_asio.reference.ip__address_v6.is_loopback [*is_loopback]]]
77428     [Determine whether the address is a loopback address. ]
77429   ]
77430   
77431   [
77432     [[link boost_asio.reference.ip__address_v6.is_multicast [*is_multicast]]]
77433     [Determine whether the address is a multicast address. ]
77434   ]
77435   
77436   [
77437     [[link boost_asio.reference.ip__address_v6.is_multicast_global [*is_multicast_global]]]
77438     [Determine whether the address is a global multicast address. ]
77439   ]
77440   
77441   [
77442     [[link boost_asio.reference.ip__address_v6.is_multicast_link_local [*is_multicast_link_local]]]
77443     [Determine whether the address is a link-local multicast address. ]
77444   ]
77445   
77446   [
77447     [[link boost_asio.reference.ip__address_v6.is_multicast_node_local [*is_multicast_node_local]]]
77448     [Determine whether the address is a node-local multicast address. ]
77449   ]
77450   
77451   [
77452     [[link boost_asio.reference.ip__address_v6.is_multicast_org_local [*is_multicast_org_local]]]
77453     [Determine whether the address is a org-local multicast address. ]
77454   ]
77455   
77456   [
77457     [[link boost_asio.reference.ip__address_v6.is_multicast_site_local [*is_multicast_site_local]]]
77458     [Determine whether the address is a site-local multicast address. ]
77459   ]
77460   
77461   [
77462     [[link boost_asio.reference.ip__address_v6.is_site_local [*is_site_local]]]
77463     [Determine whether the address is site local. ]
77464   ]
77465   
77466   [
77467     [[link boost_asio.reference.ip__address_v6.is_unspecified [*is_unspecified]]]
77468     [Determine whether the address is unspecified. ]
77469   ]
77470   
77471   [
77472     [[link boost_asio.reference.ip__address_v6.is_v4_compatible [*is_v4_compatible]]]
77473     [(Deprecated: No replacement.) Determine whether the address is an IPv4-compatible address. ]
77474   ]
77475   
77476   [
77477     [[link boost_asio.reference.ip__address_v6.is_v4_mapped [*is_v4_mapped]]]
77478     [Determine whether the address is a mapped IPv4 address. ]
77479   ]
77480   
77481   [
77482     [[link boost_asio.reference.ip__address_v6.loopback [*loopback]]]
77483     [Obtain an address object that represents the loopback address. ]
77484   ]
77485   
77486   [
77487     [[link boost_asio.reference.ip__address_v6.operator_eq_ [*operator=]]]
77488     [Assign from another address. ]
77489   ]
77490   
77491   [
77492     [[link boost_asio.reference.ip__address_v6.scope_id [*scope_id]]]
77493     [The scope ID of the address. ]
77494   ]
77495   
77496   [
77497     [[link boost_asio.reference.ip__address_v6.to_bytes [*to_bytes]]]
77498     [Get the address in bytes, in network byte order. ]
77499   ]
77500   
77501   [
77502     [[link boost_asio.reference.ip__address_v6.to_string [*to_string]]]
77503     [Get the address as a string. 
77504      [hr]
77505      (Deprecated: Use other overload.) Get the address as a string. ]
77506   ]
77507   
77508   [
77509     [[link boost_asio.reference.ip__address_v6.to_v4 [*to_v4]]]
77510     [(Deprecated: Use make_address_v4().) Converts an IPv4-mapped or IPv4-compatible address to an IPv4 address. ]
77511   ]
77512   
77513   [
77514     [[link boost_asio.reference.ip__address_v6.v4_compatible [*v4_compatible]]]
77515     [(Deprecated: No replacement.) Create an IPv4-compatible IPv6 address. ]
77516   ]
77517   
77518   [
77519     [[link boost_asio.reference.ip__address_v6.v4_mapped [*v4_mapped]]]
77520     [(Deprecated: Use make_address_v6().) Create an IPv4-mapped IPv6 address. ]
77521   ]
77522   
77523 ]
77524
77525 [heading Friends]
77526 [table
77527   [[Name][Description]]
77528
77529   [
77530     [[link boost_asio.reference.ip__address_v6.operator_not__eq_ [*operator!=]]]
77531     [Compare two addresses for inequality. ]
77532   ]
77533   
77534   [
77535     [[link boost_asio.reference.ip__address_v6.operator_lt_ [*operator<]]]
77536     [Compare addresses for ordering. ]
77537   ]
77538   
77539   [
77540     [[link boost_asio.reference.ip__address_v6.operator_lt__eq_ [*operator<=]]]
77541     [Compare addresses for ordering. ]
77542   ]
77543   
77544   [
77545     [[link boost_asio.reference.ip__address_v6.operator_eq__eq_ [*operator==]]]
77546     [Compare two addresses for equality. ]
77547   ]
77548   
77549   [
77550     [[link boost_asio.reference.ip__address_v6.operator_gt_ [*operator>]]]
77551     [Compare addresses for ordering. ]
77552   ]
77553   
77554   [
77555     [[link boost_asio.reference.ip__address_v6.operator_gt__eq_ [*operator>=]]]
77556     [Compare addresses for ordering. ]
77557   ]
77558   
77559 ]
77560
77561 [heading Related Functions]
77562 [table
77563   [[Name][Description]]
77564
77565   [
77566     [[link boost_asio.reference.ip__address_v6.make_address_v6 [*make_address_v6]]]
77567     [Create an IPv6 address from raw bytes and scope ID. 
77568
77569      Create an IPv6 address from an IP address string. 
77570
77571      Createan IPv6 address from an IP address string. 
77572
77573      Create an IPv4-mapped IPv6 address from an IPv4 address. ]
77574   ]
77575   
77576   [
77577     [[link boost_asio.reference.ip__address_v6.make_network_v6 [*make_network_v6]]]
77578     [Create an IPv6 network from an address and prefix length. ]
77579   ]
77580   
77581   [
77582     [[link boost_asio.reference.ip__address_v6.operator_lt__lt_ [*operator<<]]]
77583     [Output an address as a string. 
77584
77585      Output a network as a string. ]
77586   ]
77587   
77588 ]
77589
77590 The [link boost_asio.reference.ip__address_v6 `ip::address_v6`] class provides the ability to use and manipulate IP version 6 addresses.
77591
77592
77593 [heading Thread Safety]
77594   
77595 ['Distinct] ['objects:] Safe.
77596
77597 ['Shared] ['objects:] Unsafe. 
77598
77599
77600
77601
77602 [heading Requirements]
77603
77604 ['Header: ][^boost/asio/ip/address_v6_iterator.hpp]
77605
77606 ['Convenience header: ][^boost/asio.hpp]
77607
77608
77609 [endsect]
77610
77611
77612
77613 [section:value_type ip::basic_address_iterator< address_v6 >::value_type]
77614
77615 [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.value_type..value_type..ip::basic_address_iterator< address_v6 >] 
77616 The type of the elements pointed to by the iterator. 
77617
77618
77619   typedef address_v6 value_type;
77620
77621
77622 [heading Types]
77623 [table
77624   [[Name][Description]]
77625
77626   [
77627
77628     [[link boost_asio.reference.ip__address_v6.bytes_type [*bytes_type]]]
77629     [The type used to represent an address as an array of bytes. ]
77630   
77631   ]
77632
77633 ]
77634
77635 [heading Member Functions]
77636 [table
77637   [[Name][Description]]
77638
77639   [
77640     [[link boost_asio.reference.ip__address_v6.address_v6 [*address_v6]]]
77641     [Default constructor. 
77642      [hr]
77643      Construct an address from raw bytes and scope ID. 
77644      [hr]
77645      Copy constructor. ]
77646   ]
77647   
77648   [
77649     [[link boost_asio.reference.ip__address_v6.any [*any]]]
77650     [Obtain an address object that represents any address. ]
77651   ]
77652   
77653   [
77654     [[link boost_asio.reference.ip__address_v6.from_string [*from_string]]]
77655     [(Deprecated: Use make_address_v6().) Create an IPv6 address from an IP address string. ]
77656   ]
77657   
77658   [
77659     [[link boost_asio.reference.ip__address_v6.is_link_local [*is_link_local]]]
77660     [Determine whether the address is link local. ]
77661   ]
77662   
77663   [
77664     [[link boost_asio.reference.ip__address_v6.is_loopback [*is_loopback]]]
77665     [Determine whether the address is a loopback address. ]
77666   ]
77667   
77668   [
77669     [[link boost_asio.reference.ip__address_v6.is_multicast [*is_multicast]]]
77670     [Determine whether the address is a multicast address. ]
77671   ]
77672   
77673   [
77674     [[link boost_asio.reference.ip__address_v6.is_multicast_global [*is_multicast_global]]]
77675     [Determine whether the address is a global multicast address. ]
77676   ]
77677   
77678   [
77679     [[link boost_asio.reference.ip__address_v6.is_multicast_link_local [*is_multicast_link_local]]]
77680     [Determine whether the address is a link-local multicast address. ]
77681   ]
77682   
77683   [
77684     [[link boost_asio.reference.ip__address_v6.is_multicast_node_local [*is_multicast_node_local]]]
77685     [Determine whether the address is a node-local multicast address. ]
77686   ]
77687   
77688   [
77689     [[link boost_asio.reference.ip__address_v6.is_multicast_org_local [*is_multicast_org_local]]]
77690     [Determine whether the address is a org-local multicast address. ]
77691   ]
77692   
77693   [
77694     [[link boost_asio.reference.ip__address_v6.is_multicast_site_local [*is_multicast_site_local]]]
77695     [Determine whether the address is a site-local multicast address. ]
77696   ]
77697   
77698   [
77699     [[link boost_asio.reference.ip__address_v6.is_site_local [*is_site_local]]]
77700     [Determine whether the address is site local. ]
77701   ]
77702   
77703   [
77704     [[link boost_asio.reference.ip__address_v6.is_unspecified [*is_unspecified]]]
77705     [Determine whether the address is unspecified. ]
77706   ]
77707   
77708   [
77709     [[link boost_asio.reference.ip__address_v6.is_v4_compatible [*is_v4_compatible]]]
77710     [(Deprecated: No replacement.) Determine whether the address is an IPv4-compatible address. ]
77711   ]
77712   
77713   [
77714     [[link boost_asio.reference.ip__address_v6.is_v4_mapped [*is_v4_mapped]]]
77715     [Determine whether the address is a mapped IPv4 address. ]
77716   ]
77717   
77718   [
77719     [[link boost_asio.reference.ip__address_v6.loopback [*loopback]]]
77720     [Obtain an address object that represents the loopback address. ]
77721   ]
77722   
77723   [
77724     [[link boost_asio.reference.ip__address_v6.operator_eq_ [*operator=]]]
77725     [Assign from another address. ]
77726   ]
77727   
77728   [
77729     [[link boost_asio.reference.ip__address_v6.scope_id [*scope_id]]]
77730     [The scope ID of the address. ]
77731   ]
77732   
77733   [
77734     [[link boost_asio.reference.ip__address_v6.to_bytes [*to_bytes]]]
77735     [Get the address in bytes, in network byte order. ]
77736   ]
77737   
77738   [
77739     [[link boost_asio.reference.ip__address_v6.to_string [*to_string]]]
77740     [Get the address as a string. 
77741      [hr]
77742      (Deprecated: Use other overload.) Get the address as a string. ]
77743   ]
77744   
77745   [
77746     [[link boost_asio.reference.ip__address_v6.to_v4 [*to_v4]]]
77747     [(Deprecated: Use make_address_v4().) Converts an IPv4-mapped or IPv4-compatible address to an IPv4 address. ]
77748   ]
77749   
77750   [
77751     [[link boost_asio.reference.ip__address_v6.v4_compatible [*v4_compatible]]]
77752     [(Deprecated: No replacement.) Create an IPv4-compatible IPv6 address. ]
77753   ]
77754   
77755   [
77756     [[link boost_asio.reference.ip__address_v6.v4_mapped [*v4_mapped]]]
77757     [(Deprecated: Use make_address_v6().) Create an IPv4-mapped IPv6 address. ]
77758   ]
77759   
77760 ]
77761
77762 [heading Friends]
77763 [table
77764   [[Name][Description]]
77765
77766   [
77767     [[link boost_asio.reference.ip__address_v6.operator_not__eq_ [*operator!=]]]
77768     [Compare two addresses for inequality. ]
77769   ]
77770   
77771   [
77772     [[link boost_asio.reference.ip__address_v6.operator_lt_ [*operator<]]]
77773     [Compare addresses for ordering. ]
77774   ]
77775   
77776   [
77777     [[link boost_asio.reference.ip__address_v6.operator_lt__eq_ [*operator<=]]]
77778     [Compare addresses for ordering. ]
77779   ]
77780   
77781   [
77782     [[link boost_asio.reference.ip__address_v6.operator_eq__eq_ [*operator==]]]
77783     [Compare two addresses for equality. ]
77784   ]
77785   
77786   [
77787     [[link boost_asio.reference.ip__address_v6.operator_gt_ [*operator>]]]
77788     [Compare addresses for ordering. ]
77789   ]
77790   
77791   [
77792     [[link boost_asio.reference.ip__address_v6.operator_gt__eq_ [*operator>=]]]
77793     [Compare addresses for ordering. ]
77794   ]
77795   
77796 ]
77797
77798 [heading Related Functions]
77799 [table
77800   [[Name][Description]]
77801
77802   [
77803     [[link boost_asio.reference.ip__address_v6.make_address_v6 [*make_address_v6]]]
77804     [Create an IPv6 address from raw bytes and scope ID. 
77805
77806      Create an IPv6 address from an IP address string. 
77807
77808      Createan IPv6 address from an IP address string. 
77809
77810      Create an IPv4-mapped IPv6 address from an IPv4 address. ]
77811   ]
77812   
77813   [
77814     [[link boost_asio.reference.ip__address_v6.make_network_v6 [*make_network_v6]]]
77815     [Create an IPv6 network from an address and prefix length. ]
77816   ]
77817   
77818   [
77819     [[link boost_asio.reference.ip__address_v6.operator_lt__lt_ [*operator<<]]]
77820     [Output an address as a string. 
77821
77822      Output a network as a string. ]
77823   ]
77824   
77825 ]
77826
77827 The [link boost_asio.reference.ip__address_v6 `ip::address_v6`] class provides the ability to use and manipulate IP version 6 addresses.
77828
77829
77830 [heading Thread Safety]
77831   
77832 ['Distinct] ['objects:] Safe.
77833
77834 ['Shared] ['objects:] Unsafe. 
77835
77836
77837
77838
77839 [heading Requirements]
77840
77841 ['Header: ][^boost/asio/ip/address_v6_iterator.hpp]
77842
77843 ['Convenience header: ][^boost/asio.hpp]
77844
77845
77846 [endsect]
77847
77848
77849
77850 [endsect]
77851
77852 [section:ip__basic_address_range_lt__address_v4__gt_ ip::basic_address_range< address_v4 >]
77853
77854
77855 Represents a range of IPv4 addresses. 
77856
77857
77858   template<>
77859   class basic_address_range< address_v4 >
77860
77861
77862 [heading Types]
77863 [table
77864   [[Name][Description]]
77865
77866   [
77867
77868     [[link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.iterator [*iterator]]]
77869     [The type of an iterator that points into the range. ]
77870   
77871   ]
77872
77873 ]
77874
77875 [heading Member Functions]
77876 [table
77877   [[Name][Description]]
77878
77879   [
77880     [[link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.basic_address_range [*basic_address_range]]]
77881     [Construct an empty range. 
77882      [hr]
77883      Construct an range that represents the given range of addresses. 
77884      [hr]
77885      Copy constructor. ]
77886   ]
77887   
77888   [
77889     [[link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.begin [*begin]]]
77890     [Obtain an iterator that points to the start of the range. ]
77891   ]
77892   
77893   [
77894     [[link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.empty [*empty]]]
77895     [Determine whether the range is empty. ]
77896   ]
77897   
77898   [
77899     [[link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.end [*end]]]
77900     [Obtain an iterator that points to the end of the range. ]
77901   ]
77902   
77903   [
77904     [[link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.find [*find]]]
77905     [Find an address in the range. ]
77906   ]
77907   
77908   [
77909     [[link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.operator_eq_ [*operator=]]]
77910     [Assignment operator. ]
77911   ]
77912   
77913   [
77914     [[link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.size [*size]]]
77915     [Return the size of the range. ]
77916   ]
77917   
77918 ]
77919
77920
77921 [heading Thread Safety]
77922   
77923 ['Distinct] ['objects:] Safe.
77924
77925 ['Shared] ['objects:] Unsafe. 
77926
77927
77928
77929 [heading Requirements]
77930
77931 ['Header: ][^boost/asio/ip/address_v4_range.hpp]
77932
77933 ['Convenience header: ][^boost/asio.hpp]
77934
77935 [section:basic_address_range ip::basic_address_range< address_v4 >::basic_address_range]
77936
77937 [indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v4__gt_.basic_address_range..basic_address_range..ip::basic_address_range< address_v4 >] 
77938 Construct an empty range. 
77939
77940
77941   ``[link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.basic_address_range.overload1 basic_address_range]``();
77942   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.basic_address_range.overload1 more...]]``
77943
77944
77945 Construct an range that represents the given range of addresses. 
77946
77947
77948   explicit ``[link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.basic_address_range.overload2 basic_address_range]``(
77949       const iterator & first,
77950       const iterator & last);
77951   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.basic_address_range.overload2 more...]]``
77952
77953
77954 Copy constructor. 
77955
77956
77957   ``[link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.basic_address_range.overload3 basic_address_range]``(
77958       const basic_address_range & other);
77959   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.basic_address_range.overload3 more...]]``
77960
77961
77962 [section:overload1 ip::basic_address_range< address_v4 >::basic_address_range (1 of 3 overloads)]
77963
77964
77965 Construct an empty range. 
77966
77967
77968   basic_address_range();
77969
77970
77971
77972 [endsect]
77973
77974
77975
77976 [section:overload2 ip::basic_address_range< address_v4 >::basic_address_range (2 of 3 overloads)]
77977
77978
77979 Construct an range that represents the given range of addresses. 
77980
77981
77982   basic_address_range(
77983       const iterator & first,
77984       const iterator & last);
77985
77986
77987
77988 [endsect]
77989
77990
77991
77992 [section:overload3 ip::basic_address_range< address_v4 >::basic_address_range (3 of 3 overloads)]
77993
77994
77995 Copy constructor. 
77996
77997
77998   basic_address_range(
77999       const basic_address_range & other);
78000
78001
78002
78003 [endsect]
78004
78005
78006 [endsect]
78007
78008
78009 [section:begin ip::basic_address_range< address_v4 >::begin]
78010
78011 [indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v4__gt_.begin..begin..ip::basic_address_range< address_v4 >] 
78012 Obtain an iterator that points to the start of the range. 
78013
78014
78015   iterator begin() const;
78016
78017
78018
78019 [endsect]
78020
78021
78022
78023 [section:empty ip::basic_address_range< address_v4 >::empty]
78024
78025 [indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v4__gt_.empty..empty..ip::basic_address_range< address_v4 >] 
78026 Determine whether the range is empty. 
78027
78028
78029   bool empty() const;
78030
78031
78032
78033 [endsect]
78034
78035
78036
78037 [section:end ip::basic_address_range< address_v4 >::end]
78038
78039 [indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v4__gt_.end..end..ip::basic_address_range< address_v4 >] 
78040 Obtain an iterator that points to the end of the range. 
78041
78042
78043   iterator end() const;
78044
78045
78046
78047 [endsect]
78048
78049
78050
78051 [section:find ip::basic_address_range< address_v4 >::find]
78052
78053 [indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v4__gt_.find..find..ip::basic_address_range< address_v4 >] 
78054 Find an address in the range. 
78055
78056
78057   iterator find(
78058       const address_v4 & addr) const;
78059
78060
78061
78062 [endsect]
78063
78064
78065
78066 [section:iterator ip::basic_address_range< address_v4 >::iterator]
78067
78068 [indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v4__gt_.iterator..iterator..ip::basic_address_range< address_v4 >] 
78069 The type of an iterator that points into the range. 
78070
78071
78072   typedef basic_address_iterator< address_v4 > iterator;
78073
78074
78075
78076 [heading Requirements]
78077
78078 ['Header: ][^boost/asio/ip/address_v4_range.hpp]
78079
78080 ['Convenience header: ][^boost/asio.hpp]
78081
78082
78083 [endsect]
78084
78085
78086
78087 [section:operator_eq_ ip::basic_address_range< address_v4 >::operator=]
78088
78089 [indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v4__gt_.operator_eq_..operator=..ip::basic_address_range< address_v4 >] 
78090 Assignment operator. 
78091
78092
78093   basic_address_range & operator=(
78094       const basic_address_range & other);
78095
78096
78097
78098 [endsect]
78099
78100
78101
78102 [section:size ip::basic_address_range< address_v4 >::size]
78103
78104 [indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v4__gt_.size..size..ip::basic_address_range< address_v4 >] 
78105 Return the size of the range. 
78106
78107
78108   std::size_t size() const;
78109
78110
78111
78112 [endsect]
78113
78114
78115
78116 [endsect]
78117
78118 [section:ip__basic_address_range_lt__address_v6__gt_ ip::basic_address_range< address_v6 >]
78119
78120
78121 Represents a range of IPv6 addresses. 
78122
78123
78124   template<>
78125   class basic_address_range< address_v6 >
78126
78127
78128 [heading Types]
78129 [table
78130   [[Name][Description]]
78131
78132   [
78133
78134     [[link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.iterator [*iterator]]]
78135     [The type of an iterator that points into the range. ]
78136   
78137   ]
78138
78139 ]
78140
78141 [heading Member Functions]
78142 [table
78143   [[Name][Description]]
78144
78145   [
78146     [[link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.basic_address_range [*basic_address_range]]]
78147     [Construct an empty range. 
78148      [hr]
78149      Construct an range that represents the given range of addresses. 
78150      [hr]
78151      Copy constructor. ]
78152   ]
78153   
78154   [
78155     [[link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.begin [*begin]]]
78156     [Obtain an iterator that points to the start of the range. ]
78157   ]
78158   
78159   [
78160     [[link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.empty [*empty]]]
78161     [Determine whether the range is empty. ]
78162   ]
78163   
78164   [
78165     [[link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.end [*end]]]
78166     [Obtain an iterator that points to the end of the range. ]
78167   ]
78168   
78169   [
78170     [[link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.find [*find]]]
78171     [Find an address in the range. ]
78172   ]
78173   
78174   [
78175     [[link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.operator_eq_ [*operator=]]]
78176     [Assignment operator. ]
78177   ]
78178   
78179 ]
78180
78181
78182 [heading Thread Safety]
78183   
78184 ['Distinct] ['objects:] Safe.
78185
78186 ['Shared] ['objects:] Unsafe. 
78187
78188
78189
78190 [heading Requirements]
78191
78192 ['Header: ][^boost/asio/ip/address_v6_range.hpp]
78193
78194 ['Convenience header: ][^boost/asio.hpp]
78195
78196 [section:basic_address_range ip::basic_address_range< address_v6 >::basic_address_range]
78197
78198 [indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v6__gt_.basic_address_range..basic_address_range..ip::basic_address_range< address_v6 >] 
78199 Construct an empty range. 
78200
78201
78202   ``[link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.basic_address_range.overload1 basic_address_range]``();
78203   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.basic_address_range.overload1 more...]]``
78204
78205
78206 Construct an range that represents the given range of addresses. 
78207
78208
78209   explicit ``[link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.basic_address_range.overload2 basic_address_range]``(
78210       const iterator & first,
78211       const iterator & last);
78212   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.basic_address_range.overload2 more...]]``
78213
78214
78215 Copy constructor. 
78216
78217
78218   ``[link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.basic_address_range.overload3 basic_address_range]``(
78219       const basic_address_range & other);
78220   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.basic_address_range.overload3 more...]]``
78221
78222
78223 [section:overload1 ip::basic_address_range< address_v6 >::basic_address_range (1 of 3 overloads)]
78224
78225
78226 Construct an empty range. 
78227
78228
78229   basic_address_range();
78230
78231
78232
78233 [endsect]
78234
78235
78236
78237 [section:overload2 ip::basic_address_range< address_v6 >::basic_address_range (2 of 3 overloads)]
78238
78239
78240 Construct an range that represents the given range of addresses. 
78241
78242
78243   basic_address_range(
78244       const iterator & first,
78245       const iterator & last);
78246
78247
78248
78249 [endsect]
78250
78251
78252
78253 [section:overload3 ip::basic_address_range< address_v6 >::basic_address_range (3 of 3 overloads)]
78254
78255
78256 Copy constructor. 
78257
78258
78259   basic_address_range(
78260       const basic_address_range & other);
78261
78262
78263
78264 [endsect]
78265
78266
78267 [endsect]
78268
78269
78270 [section:begin ip::basic_address_range< address_v6 >::begin]
78271
78272 [indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v6__gt_.begin..begin..ip::basic_address_range< address_v6 >] 
78273 Obtain an iterator that points to the start of the range. 
78274
78275
78276   iterator begin() const;
78277
78278
78279
78280 [endsect]
78281
78282
78283
78284 [section:empty ip::basic_address_range< address_v6 >::empty]
78285
78286 [indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v6__gt_.empty..empty..ip::basic_address_range< address_v6 >] 
78287 Determine whether the range is empty. 
78288
78289
78290   bool empty() const;
78291
78292
78293
78294 [endsect]
78295
78296
78297
78298 [section:end ip::basic_address_range< address_v6 >::end]
78299
78300 [indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v6__gt_.end..end..ip::basic_address_range< address_v6 >] 
78301 Obtain an iterator that points to the end of the range. 
78302
78303
78304   iterator end() const;
78305
78306
78307
78308 [endsect]
78309
78310
78311
78312 [section:find ip::basic_address_range< address_v6 >::find]
78313
78314 [indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v6__gt_.find..find..ip::basic_address_range< address_v6 >] 
78315 Find an address in the range. 
78316
78317
78318   iterator find(
78319       const address_v6 & addr) const;
78320
78321
78322
78323 [endsect]
78324
78325
78326
78327 [section:iterator ip::basic_address_range< address_v6 >::iterator]
78328
78329 [indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v6__gt_.iterator..iterator..ip::basic_address_range< address_v6 >] 
78330 The type of an iterator that points into the range. 
78331
78332
78333   typedef basic_address_iterator< address_v6 > iterator;
78334
78335
78336
78337 [heading Requirements]
78338
78339 ['Header: ][^boost/asio/ip/address_v6_range.hpp]
78340
78341 ['Convenience header: ][^boost/asio.hpp]
78342
78343
78344 [endsect]
78345
78346
78347
78348 [section:operator_eq_ ip::basic_address_range< address_v6 >::operator=]
78349
78350 [indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v6__gt_.operator_eq_..operator=..ip::basic_address_range< address_v6 >] 
78351 Assignment operator. 
78352
78353
78354   basic_address_range & operator=(
78355       const basic_address_range & other);
78356
78357
78358
78359 [endsect]
78360
78361
78362
78363 [endsect]
78364
78365 [section:ip__basic_endpoint ip::basic_endpoint]
78366
78367
78368 Describes an endpoint for a version-independent IP socket. 
78369
78370
78371   template<
78372       typename ``[link boost_asio.reference.InternetProtocol InternetProtocol]``>
78373   class basic_endpoint
78374
78375
78376 [heading Types]
78377 [table
78378   [[Name][Description]]
78379
78380   [
78381
78382     [[link boost_asio.reference.ip__basic_endpoint.data_type [*data_type]]]
78383     [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
78384   
78385   ]
78386
78387   [
78388
78389     [[link boost_asio.reference.ip__basic_endpoint.protocol_type [*protocol_type]]]
78390     [The protocol type associated with the endpoint. ]
78391   
78392   ]
78393
78394 ]
78395
78396 [heading Member Functions]
78397 [table
78398   [[Name][Description]]
78399
78400   [
78401     [[link boost_asio.reference.ip__basic_endpoint.address [*address]]]
78402     [Get the IP address associated with the endpoint. 
78403      [hr]
78404      Set the IP address associated with the endpoint. ]
78405   ]
78406   
78407   [
78408     [[link boost_asio.reference.ip__basic_endpoint.basic_endpoint [*basic_endpoint]]]
78409     [Default constructor. 
78410      [hr]
78411      Construct an endpoint using a port number, specified in the host's byte order. The IP address will be the any address (i.e. INADDR_ANY or in6addr_any). This constructor would typically be used for accepting new connections. 
78412      [hr]
78413      Construct an endpoint using a port number and an IP address. This constructor may be used for accepting connections on a specific interface or for making a connection to a remote endpoint. 
78414      [hr]
78415      Copy constructor. 
78416      [hr]
78417      Move constructor. ]
78418   ]
78419   
78420   [
78421     [[link boost_asio.reference.ip__basic_endpoint.capacity [*capacity]]]
78422     [Get the capacity of the endpoint in the native type. ]
78423   ]
78424   
78425   [
78426     [[link boost_asio.reference.ip__basic_endpoint.data [*data]]]
78427     [Get the underlying endpoint in the native type. ]
78428   ]
78429   
78430   [
78431     [[link boost_asio.reference.ip__basic_endpoint.operator_eq_ [*operator=]]]
78432     [Assign from another endpoint. 
78433      [hr]
78434      Move-assign from another endpoint. ]
78435   ]
78436   
78437   [
78438     [[link boost_asio.reference.ip__basic_endpoint.port [*port]]]
78439     [Get the port associated with the endpoint. The port number is always in the host's byte order. 
78440      [hr]
78441      Set the port associated with the endpoint. The port number is always in the host's byte order. ]
78442   ]
78443   
78444   [
78445     [[link boost_asio.reference.ip__basic_endpoint.protocol [*protocol]]]
78446     [The protocol associated with the endpoint. ]
78447   ]
78448   
78449   [
78450     [[link boost_asio.reference.ip__basic_endpoint.resize [*resize]]]
78451     [Set the underlying size of the endpoint in the native type. ]
78452   ]
78453   
78454   [
78455     [[link boost_asio.reference.ip__basic_endpoint.size [*size]]]
78456     [Get the underlying size of the endpoint in the native type. ]
78457   ]
78458   
78459 ]
78460
78461 [heading Friends]
78462 [table
78463   [[Name][Description]]
78464
78465   [
78466     [[link boost_asio.reference.ip__basic_endpoint.operator_not__eq_ [*operator!=]]]
78467     [Compare two endpoints for inequality. ]
78468   ]
78469   
78470   [
78471     [[link boost_asio.reference.ip__basic_endpoint.operator_lt_ [*operator<]]]
78472     [Compare endpoints for ordering. ]
78473   ]
78474   
78475   [
78476     [[link boost_asio.reference.ip__basic_endpoint.operator_lt__eq_ [*operator<=]]]
78477     [Compare endpoints for ordering. ]
78478   ]
78479   
78480   [
78481     [[link boost_asio.reference.ip__basic_endpoint.operator_eq__eq_ [*operator==]]]
78482     [Compare two endpoints for equality. ]
78483   ]
78484   
78485   [
78486     [[link boost_asio.reference.ip__basic_endpoint.operator_gt_ [*operator>]]]
78487     [Compare endpoints for ordering. ]
78488   ]
78489   
78490   [
78491     [[link boost_asio.reference.ip__basic_endpoint.operator_gt__eq_ [*operator>=]]]
78492     [Compare endpoints for ordering. ]
78493   ]
78494   
78495 ]
78496
78497 [heading Related Functions]
78498 [table
78499   [[Name][Description]]
78500
78501   [
78502     [[link boost_asio.reference.ip__basic_endpoint.operator_lt__lt_ [*operator<<]]]
78503     [Output an endpoint as a string. ]
78504   ]
78505   
78506 ]
78507
78508 The [link boost_asio.reference.ip__basic_endpoint `ip::basic_endpoint`] class template describes an endpoint that may be associated with a particular socket.
78509
78510
78511 [heading Thread Safety]
78512   
78513 ['Distinct] ['objects:] Safe.
78514
78515 ['Shared] ['objects:] Unsafe.
78516
78517
78518
78519
78520 [heading Requirements]
78521
78522 ['Header: ][^boost/asio/ip/basic_endpoint.hpp]
78523
78524 ['Convenience header: ][^boost/asio.hpp]
78525
78526 [section:address ip::basic_endpoint::address]
78527
78528 [indexterm2 boost_asio.indexterm.ip__basic_endpoint.address..address..ip::basic_endpoint] 
78529 Get the IP address associated with the endpoint. 
78530
78531
78532   boost::asio::ip::address ``[link boost_asio.reference.ip__basic_endpoint.address.overload1 address]``() const;
78533   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.address.overload1 more...]]``
78534
78535
78536 Set the IP address associated with the endpoint. 
78537
78538
78539   void ``[link boost_asio.reference.ip__basic_endpoint.address.overload2 address]``(
78540       const boost::asio::ip::address & addr);
78541   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.address.overload2 more...]]``
78542
78543
78544 [section:overload1 ip::basic_endpoint::address (1 of 2 overloads)]
78545
78546
78547 Get the IP address associated with the endpoint. 
78548
78549
78550   boost::asio::ip::address address() const;
78551
78552
78553
78554 [endsect]
78555
78556
78557
78558 [section:overload2 ip::basic_endpoint::address (2 of 2 overloads)]
78559
78560
78561 Set the IP address associated with the endpoint. 
78562
78563
78564   void address(
78565       const boost::asio::ip::address & addr);
78566
78567
78568
78569 [endsect]
78570
78571
78572 [endsect]
78573
78574 [section:basic_endpoint ip::basic_endpoint::basic_endpoint]
78575
78576 [indexterm2 boost_asio.indexterm.ip__basic_endpoint.basic_endpoint..basic_endpoint..ip::basic_endpoint] 
78577 Default constructor. 
78578
78579
78580   ``[link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload1 basic_endpoint]``();
78581   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload1 more...]]``
78582
78583
78584 Construct an endpoint using a port number, specified in the host's byte order. The IP address will be the any address (i.e. INADDR\_ANY or in6addr\_any). This constructor would typically be used for accepting new connections. 
78585
78586
78587   ``[link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload2 basic_endpoint]``(
78588       const InternetProtocol & internet_protocol,
78589       unsigned short port_num);
78590   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload2 more...]]``
78591
78592
78593 Construct an endpoint using a port number and an IP address. This constructor may be used for accepting connections on a specific interface or for making a connection to a remote endpoint. 
78594
78595
78596   ``[link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload3 basic_endpoint]``(
78597       const boost::asio::ip::address & addr,
78598       unsigned short port_num);
78599   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload3 more...]]``
78600
78601
78602 Copy constructor. 
78603
78604
78605   ``[link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload4 basic_endpoint]``(
78606       const basic_endpoint & other);
78607   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload4 more...]]``
78608
78609
78610 Move constructor. 
78611
78612
78613   ``[link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload5 basic_endpoint]``(
78614       basic_endpoint && other);
78615   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload5 more...]]``
78616
78617
78618 [section:overload1 ip::basic_endpoint::basic_endpoint (1 of 5 overloads)]
78619
78620
78621 Default constructor. 
78622
78623
78624   basic_endpoint();
78625
78626
78627
78628 [endsect]
78629
78630
78631
78632 [section:overload2 ip::basic_endpoint::basic_endpoint (2 of 5 overloads)]
78633
78634
78635 Construct an endpoint using a port number, specified in the host's byte order. The IP address will be the any address (i.e. INADDR\_ANY or in6addr\_any). This constructor would typically be used for accepting new connections. 
78636
78637
78638   basic_endpoint(
78639       const InternetProtocol & internet_protocol,
78640       unsigned short port_num);
78641
78642
78643
78644 [heading Examples]
78645   
78646 To initialise an IPv4 TCP endpoint for port 1234, use: 
78647
78648    boost::asio::ip::tcp::endpoint ep(boost::asio::ip::tcp::v4(), 1234);
78649
78650
78651
78652
78653 To specify an IPv6 UDP endpoint for port 9876, use: 
78654
78655    boost::asio::ip::udp::endpoint ep(boost::asio::ip::udp::v6(), 9876);
78656
78657
78658
78659
78660
78661 [endsect]
78662
78663
78664
78665 [section:overload3 ip::basic_endpoint::basic_endpoint (3 of 5 overloads)]
78666
78667
78668 Construct an endpoint using a port number and an IP address. This constructor may be used for accepting connections on a specific interface or for making a connection to a remote endpoint. 
78669
78670
78671   basic_endpoint(
78672       const boost::asio::ip::address & addr,
78673       unsigned short port_num);
78674
78675
78676
78677 [endsect]
78678
78679
78680
78681 [section:overload4 ip::basic_endpoint::basic_endpoint (4 of 5 overloads)]
78682
78683
78684 Copy constructor. 
78685
78686
78687   basic_endpoint(
78688       const basic_endpoint & other);
78689
78690
78691
78692 [endsect]
78693
78694
78695
78696 [section:overload5 ip::basic_endpoint::basic_endpoint (5 of 5 overloads)]
78697
78698
78699 Move constructor. 
78700
78701
78702   basic_endpoint(
78703       basic_endpoint && other);
78704
78705
78706
78707 [endsect]
78708
78709
78710 [endsect]
78711
78712
78713 [section:capacity ip::basic_endpoint::capacity]
78714
78715 [indexterm2 boost_asio.indexterm.ip__basic_endpoint.capacity..capacity..ip::basic_endpoint] 
78716 Get the capacity of the endpoint in the native type. 
78717
78718
78719   std::size_t capacity() const;
78720
78721
78722
78723 [endsect]
78724
78725
78726 [section:data ip::basic_endpoint::data]
78727
78728 [indexterm2 boost_asio.indexterm.ip__basic_endpoint.data..data..ip::basic_endpoint] 
78729 Get the underlying endpoint in the native type. 
78730
78731
78732   data_type * ``[link boost_asio.reference.ip__basic_endpoint.data.overload1 data]``();
78733   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.data.overload1 more...]]``
78734
78735   const data_type * ``[link boost_asio.reference.ip__basic_endpoint.data.overload2 data]``() const;
78736   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.data.overload2 more...]]``
78737
78738
78739 [section:overload1 ip::basic_endpoint::data (1 of 2 overloads)]
78740
78741
78742 Get the underlying endpoint in the native type. 
78743
78744
78745   data_type * data();
78746
78747
78748
78749 [endsect]
78750
78751
78752
78753 [section:overload2 ip::basic_endpoint::data (2 of 2 overloads)]
78754
78755
78756 Get the underlying endpoint in the native type. 
78757
78758
78759   const data_type * data() const;
78760
78761
78762
78763 [endsect]
78764
78765
78766 [endsect]
78767
78768
78769 [section:data_type ip::basic_endpoint::data_type]
78770
78771 [indexterm2 boost_asio.indexterm.ip__basic_endpoint.data_type..data_type..ip::basic_endpoint] 
78772 The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. 
78773
78774
78775   typedef implementation_defined data_type;
78776
78777
78778
78779 [heading Requirements]
78780
78781 ['Header: ][^boost/asio/ip/basic_endpoint.hpp]
78782
78783 ['Convenience header: ][^boost/asio.hpp]
78784
78785
78786 [endsect]
78787
78788
78789
78790 [section:operator_not__eq_ ip::basic_endpoint::operator!=]
78791
78792 [indexterm2 boost_asio.indexterm.ip__basic_endpoint.operator_not__eq_..operator!=..ip::basic_endpoint] 
78793 Compare two endpoints for inequality. 
78794
78795
78796   friend bool operator!=(
78797       const basic_endpoint< InternetProtocol > & e1,
78798       const basic_endpoint< InternetProtocol > & e2);
78799
78800
78801 [heading Requirements]
78802
78803 ['Header: ][^boost/asio/ip/basic_endpoint.hpp]
78804
78805 ['Convenience header: ][^boost/asio.hpp]
78806
78807
78808 [endsect]
78809
78810
78811
78812 [section:operator_lt_ ip::basic_endpoint::operator<]
78813
78814 [indexterm2 boost_asio.indexterm.ip__basic_endpoint.operator_lt_..operator<..ip::basic_endpoint] 
78815 Compare endpoints for ordering. 
78816
78817
78818   friend bool operator<(
78819       const basic_endpoint< InternetProtocol > & e1,
78820       const basic_endpoint< InternetProtocol > & e2);
78821
78822
78823 [heading Requirements]
78824
78825 ['Header: ][^boost/asio/ip/basic_endpoint.hpp]
78826
78827 ['Convenience header: ][^boost/asio.hpp]
78828
78829
78830 [endsect]
78831
78832
78833
78834 [section:operator_lt__lt_ ip::basic_endpoint::operator<<]
78835
78836 [indexterm2 boost_asio.indexterm.ip__basic_endpoint.operator_lt__lt_..operator<<..ip::basic_endpoint] 
78837 Output an endpoint as a string. 
78838
78839
78840   std::basic_ostream< Elem, Traits > & operator<<(
78841       std::basic_ostream< Elem, Traits > & os,
78842       const basic_endpoint< InternetProtocol > & endpoint);
78843
78844
78845 Used to output a human-readable string for a specified endpoint.
78846
78847
78848 [heading Parameters]
78849     
78850
78851 [variablelist
78852   
78853 [[os][The output stream to which the string will be written.]]
78854
78855 [[endpoint][The endpoint to be written.]]
78856
78857 ]
78858
78859
78860 [heading Return Value]
78861       
78862 The output stream. 
78863
78864
78865
78866
78867 [endsect]
78868
78869
78870
78871 [section:operator_lt__eq_ ip::basic_endpoint::operator<=]
78872
78873 [indexterm2 boost_asio.indexterm.ip__basic_endpoint.operator_lt__eq_..operator<=..ip::basic_endpoint] 
78874 Compare endpoints for ordering. 
78875
78876
78877   friend bool operator<=(
78878       const basic_endpoint< InternetProtocol > & e1,
78879       const basic_endpoint< InternetProtocol > & e2);
78880
78881
78882 [heading Requirements]
78883
78884 ['Header: ][^boost/asio/ip/basic_endpoint.hpp]
78885
78886 ['Convenience header: ][^boost/asio.hpp]
78887
78888
78889 [endsect]
78890
78891
78892 [section:operator_eq_ ip::basic_endpoint::operator=]
78893
78894 [indexterm2 boost_asio.indexterm.ip__basic_endpoint.operator_eq_..operator=..ip::basic_endpoint] 
78895 Assign from another endpoint. 
78896
78897
78898   basic_endpoint & ``[link boost_asio.reference.ip__basic_endpoint.operator_eq_.overload1 operator=]``(
78899       const basic_endpoint & other);
78900   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.operator_eq_.overload1 more...]]``
78901
78902
78903 Move-assign from another endpoint. 
78904
78905
78906   basic_endpoint & ``[link boost_asio.reference.ip__basic_endpoint.operator_eq_.overload2 operator=]``(
78907       basic_endpoint && other);
78908   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.operator_eq_.overload2 more...]]``
78909
78910
78911 [section:overload1 ip::basic_endpoint::operator= (1 of 2 overloads)]
78912
78913
78914 Assign from another endpoint. 
78915
78916
78917   basic_endpoint & operator=(
78918       const basic_endpoint & other);
78919
78920
78921
78922 [endsect]
78923
78924
78925
78926 [section:overload2 ip::basic_endpoint::operator= (2 of 2 overloads)]
78927
78928
78929 Move-assign from another endpoint. 
78930
78931
78932   basic_endpoint & operator=(
78933       basic_endpoint && other);
78934
78935
78936
78937 [endsect]
78938
78939
78940 [endsect]
78941
78942
78943 [section:operator_eq__eq_ ip::basic_endpoint::operator==]
78944
78945 [indexterm2 boost_asio.indexterm.ip__basic_endpoint.operator_eq__eq_..operator==..ip::basic_endpoint] 
78946 Compare two endpoints for equality. 
78947
78948
78949   friend bool operator==(
78950       const basic_endpoint< InternetProtocol > & e1,
78951       const basic_endpoint< InternetProtocol > & e2);
78952
78953
78954 [heading Requirements]
78955
78956 ['Header: ][^boost/asio/ip/basic_endpoint.hpp]
78957
78958 ['Convenience header: ][^boost/asio.hpp]
78959
78960
78961 [endsect]
78962
78963
78964
78965 [section:operator_gt_ ip::basic_endpoint::operator>]
78966
78967 [indexterm2 boost_asio.indexterm.ip__basic_endpoint.operator_gt_..operator>..ip::basic_endpoint] 
78968 Compare endpoints for ordering. 
78969
78970
78971   friend bool operator>(
78972       const basic_endpoint< InternetProtocol > & e1,
78973       const basic_endpoint< InternetProtocol > & e2);
78974
78975
78976 [heading Requirements]
78977
78978 ['Header: ][^boost/asio/ip/basic_endpoint.hpp]
78979
78980 ['Convenience header: ][^boost/asio.hpp]
78981
78982
78983 [endsect]
78984
78985
78986
78987 [section:operator_gt__eq_ ip::basic_endpoint::operator>=]
78988
78989 [indexterm2 boost_asio.indexterm.ip__basic_endpoint.operator_gt__eq_..operator>=..ip::basic_endpoint] 
78990 Compare endpoints for ordering. 
78991
78992
78993   friend bool operator>=(
78994       const basic_endpoint< InternetProtocol > & e1,
78995       const basic_endpoint< InternetProtocol > & e2);
78996
78997
78998 [heading Requirements]
78999
79000 ['Header: ][^boost/asio/ip/basic_endpoint.hpp]
79001
79002 ['Convenience header: ][^boost/asio.hpp]
79003
79004
79005 [endsect]
79006
79007
79008 [section:port ip::basic_endpoint::port]
79009
79010 [indexterm2 boost_asio.indexterm.ip__basic_endpoint.port..port..ip::basic_endpoint] 
79011 Get the port associated with the endpoint. The port number is always in the host's byte order. 
79012
79013
79014   unsigned short ``[link boost_asio.reference.ip__basic_endpoint.port.overload1 port]``() const;
79015   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.port.overload1 more...]]``
79016
79017
79018 Set the port associated with the endpoint. The port number is always in the host's byte order. 
79019
79020
79021   void ``[link boost_asio.reference.ip__basic_endpoint.port.overload2 port]``(
79022       unsigned short port_num);
79023   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.port.overload2 more...]]``
79024
79025
79026 [section:overload1 ip::basic_endpoint::port (1 of 2 overloads)]
79027
79028
79029 Get the port associated with the endpoint. The port number is always in the host's byte order. 
79030
79031
79032   unsigned short port() const;
79033
79034
79035
79036 [endsect]
79037
79038
79039
79040 [section:overload2 ip::basic_endpoint::port (2 of 2 overloads)]
79041
79042
79043 Set the port associated with the endpoint. The port number is always in the host's byte order. 
79044
79045
79046   void port(
79047       unsigned short port_num);
79048
79049
79050
79051 [endsect]
79052
79053
79054 [endsect]
79055
79056
79057 [section:protocol ip::basic_endpoint::protocol]
79058
79059 [indexterm2 boost_asio.indexterm.ip__basic_endpoint.protocol..protocol..ip::basic_endpoint] 
79060 The protocol associated with the endpoint. 
79061
79062
79063   protocol_type protocol() const;
79064
79065
79066
79067 [endsect]
79068
79069
79070
79071 [section:protocol_type ip::basic_endpoint::protocol_type]
79072
79073 [indexterm2 boost_asio.indexterm.ip__basic_endpoint.protocol_type..protocol_type..ip::basic_endpoint] 
79074 The protocol type associated with the endpoint. 
79075
79076
79077   typedef InternetProtocol protocol_type;
79078
79079
79080
79081 [heading Requirements]
79082
79083 ['Header: ][^boost/asio/ip/basic_endpoint.hpp]
79084
79085 ['Convenience header: ][^boost/asio.hpp]
79086
79087
79088 [endsect]
79089
79090
79091
79092 [section:resize ip::basic_endpoint::resize]
79093
79094 [indexterm2 boost_asio.indexterm.ip__basic_endpoint.resize..resize..ip::basic_endpoint] 
79095 Set the underlying size of the endpoint in the native type. 
79096
79097
79098   void resize(
79099       std::size_t new_size);
79100
79101
79102
79103 [endsect]
79104
79105
79106
79107 [section:size ip::basic_endpoint::size]
79108
79109 [indexterm2 boost_asio.indexterm.ip__basic_endpoint.size..size..ip::basic_endpoint] 
79110 Get the underlying size of the endpoint in the native type. 
79111
79112
79113   std::size_t size() const;
79114
79115
79116
79117 [endsect]
79118
79119
79120
79121 [endsect]
79122
79123 [section:ip__basic_resolver ip::basic_resolver]
79124
79125
79126 Provides endpoint resolution functionality. 
79127
79128
79129   template<
79130       typename ``[link boost_asio.reference.InternetProtocol InternetProtocol]``,
79131       typename ``[link boost_asio.reference.Executor1 Executor]``>
79132   class basic_resolver :
79133     public ip::resolver_base
79134
79135
79136 [heading Types]
79137 [table
79138   [[Name][Description]]
79139
79140   [
79141
79142     [[link boost_asio.reference.ip__basic_resolver__rebind_executor [*rebind_executor]]]
79143     [Rebinds the resolver type to another executor. ]
79144   
79145   ]
79146
79147   [
79148
79149     [[link boost_asio.reference.ip__basic_resolver.endpoint_type [*endpoint_type]]]
79150     [The endpoint type. ]
79151   
79152   ]
79153
79154   [
79155
79156     [[link boost_asio.reference.ip__basic_resolver.executor_type [*executor_type]]]
79157     [The type of the executor associated with the object. ]
79158   
79159   ]
79160
79161   [
79162
79163     [[link boost_asio.reference.ip__basic_resolver.flags [*flags]]]
79164     [A bitmask type (C++ Std \[lib.bitmask.types\]). ]
79165   
79166   ]
79167
79168   [
79169
79170     [[link boost_asio.reference.ip__basic_resolver.iterator [*iterator]]]
79171     [(Deprecated.) The iterator type. ]
79172   
79173   ]
79174
79175   [
79176
79177     [[link boost_asio.reference.ip__basic_resolver.protocol_type [*protocol_type]]]
79178     [The protocol type. ]
79179   
79180   ]
79181
79182   [
79183
79184     [[link boost_asio.reference.ip__basic_resolver.query [*query]]]
79185     [(Deprecated.) The query type. ]
79186   
79187   ]
79188
79189   [
79190
79191     [[link boost_asio.reference.ip__basic_resolver.results_type [*results_type]]]
79192     [The results type. ]
79193   
79194   ]
79195
79196 ]
79197
79198 [heading Member Functions]
79199 [table
79200   [[Name][Description]]
79201
79202   [
79203     [[link boost_asio.reference.ip__basic_resolver.async_resolve [*async_resolve]]]
79204     [(Deprecated: Use overload with separate host and service parameters.) Asynchronously perform forward resolution of a query to a list of entries. 
79205      [hr]
79206      Asynchronously perform forward resolution of a query to a list of entries. 
79207      [hr]
79208      Asynchronously perform reverse resolution of an endpoint to a list of entries. ]
79209   ]
79210   
79211   [
79212     [[link boost_asio.reference.ip__basic_resolver.basic_resolver [*basic_resolver]]]
79213     [Construct with executor. 
79214      [hr]
79215      Construct with execution context. 
79216      [hr]
79217      Move-construct a basic_resolver from another. ]
79218   ]
79219   
79220   [
79221     [[link boost_asio.reference.ip__basic_resolver.cancel [*cancel]]]
79222     [Cancel any asynchronous operations that are waiting on the resolver. ]
79223   ]
79224   
79225   [
79226     [[link boost_asio.reference.ip__basic_resolver.get_executor [*get_executor]]]
79227     [Get the executor associated with the object. ]
79228   ]
79229   
79230   [
79231     [[link boost_asio.reference.ip__basic_resolver.operator_eq_ [*operator=]]]
79232     [Move-assign a basic_resolver from another. ]
79233   ]
79234   
79235   [
79236     [[link boost_asio.reference.ip__basic_resolver.resolve [*resolve]]]
79237     [(Deprecated: Use overload with separate host and service parameters.) Perform forward resolution of a query to a list of entries. 
79238      [hr]
79239      Perform forward resolution of a query to a list of entries. 
79240      [hr]
79241      Perform reverse resolution of an endpoint to a list of entries. ]
79242   ]
79243   
79244   [
79245     [[link boost_asio.reference.ip__basic_resolver._basic_resolver [*~basic_resolver]]]
79246     [Destroys the resolver. ]
79247   ]
79248   
79249 ]
79250
79251 [heading Data Members]
79252 [table
79253   [[Name][Description]]
79254
79255   [
79256     [[link boost_asio.reference.ip__basic_resolver.address_configured [*address_configured]]]
79257     [Only return IPv4 addresses if a non-loopback IPv4 address is configured for the system. Only return IPv6 addresses if a non-loopback IPv6 address is configured for the system. ]
79258   ]
79259
79260   [
79261     [[link boost_asio.reference.ip__basic_resolver.all_matching [*all_matching]]]
79262     [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ]
79263   ]
79264
79265   [
79266     [[link boost_asio.reference.ip__basic_resolver.canonical_name [*canonical_name]]]
79267     [Determine the canonical name of the host specified in the query. ]
79268   ]
79269
79270   [
79271     [[link boost_asio.reference.ip__basic_resolver.numeric_host [*numeric_host]]]
79272     [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ]
79273   ]
79274
79275   [
79276     [[link boost_asio.reference.ip__basic_resolver.numeric_service [*numeric_service]]]
79277     [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ]
79278   ]
79279
79280   [
79281     [[link boost_asio.reference.ip__basic_resolver.passive [*passive]]]
79282     [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ]
79283   ]
79284
79285   [
79286     [[link boost_asio.reference.ip__basic_resolver.v4_mapped [*v4_mapped]]]
79287     [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ]
79288   ]
79289
79290 ]
79291
79292 The [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] class template provides the ability to resolve a query to a list of endpoints.
79293
79294
79295 [heading Thread Safety]
79296   
79297 ['Distinct] ['objects:] Safe.
79298
79299 ['Shared] ['objects:] Unsafe. 
79300
79301
79302
79303 [heading Requirements]
79304
79305 ['Header: ][^boost/asio/ip/basic_resolver.hpp]
79306
79307 ['Convenience header: ][^boost/asio.hpp]
79308
79309
79310 [section:address_configured ip::basic_resolver::address_configured]
79311
79312
79313 ['Inherited from ip::resolver_base.]
79314
79315 [indexterm2 boost_asio.indexterm.ip__basic_resolver.address_configured..address_configured..ip::basic_resolver] 
79316 Only return IPv4 addresses if a non-loopback IPv4 address is configured for the system. Only return IPv6 addresses if a non-loopback IPv6 address is configured for the system. 
79317
79318
79319   static const flags address_configured = implementation_defined;
79320
79321
79322
79323 [endsect]
79324
79325
79326
79327 [section:all_matching ip::basic_resolver::all_matching]
79328
79329
79330 ['Inherited from ip::resolver_base.]
79331
79332 [indexterm2 boost_asio.indexterm.ip__basic_resolver.all_matching..all_matching..ip::basic_resolver] 
79333 If used with v4\_mapped, return all matching IPv6 and IPv4 addresses. 
79334
79335
79336   static const flags all_matching = implementation_defined;
79337
79338
79339
79340 [endsect]
79341
79342
79343 [section:async_resolve ip::basic_resolver::async_resolve]
79344
79345 [indexterm2 boost_asio.indexterm.ip__basic_resolver.async_resolve..async_resolve..ip::basic_resolver] 
79346 (Deprecated: Use overload with separate host and service parameters.) Asynchronously perform forward resolution of a query to a list of entries. 
79347
79348
79349   template<
79350       typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
79351   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.ip__basic_resolver.async_resolve.overload1 async_resolve]``(
79352       const query & q,
79353       ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
79354   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.async_resolve.overload1 more...]]``
79355
79356
79357 Asynchronously perform forward resolution of a query to a list of entries. 
79358
79359
79360   template<
79361       typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
79362   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.ip__basic_resolver.async_resolve.overload2 async_resolve]``(
79363       string_view host,
79364       string_view service,
79365       ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
79366   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.async_resolve.overload2 more...]]``
79367
79368   template<
79369       typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
79370   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.ip__basic_resolver.async_resolve.overload3 async_resolve]``(
79371       string_view host,
79372       string_view service,
79373       resolver_base::flags resolve_flags,
79374       ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
79375   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.async_resolve.overload3 more...]]``
79376
79377   template<
79378       typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
79379   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.ip__basic_resolver.async_resolve.overload4 async_resolve]``(
79380       const protocol_type & protocol,
79381       string_view host,
79382       string_view service,
79383       ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
79384   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.async_resolve.overload4 more...]]``
79385
79386   template<
79387       typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
79388   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.ip__basic_resolver.async_resolve.overload5 async_resolve]``(
79389       const protocol_type & protocol,
79390       string_view host,
79391       string_view service,
79392       resolver_base::flags resolve_flags,
79393       ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
79394   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.async_resolve.overload5 more...]]``
79395
79396
79397 Asynchronously perform reverse resolution of an endpoint to a list of entries. 
79398
79399
79400   template<
79401       typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
79402   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.ip__basic_resolver.async_resolve.overload6 async_resolve]``(
79403       const endpoint_type & e,
79404       ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
79405   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.async_resolve.overload6 more...]]``
79406
79407
79408 [section:overload1 ip::basic_resolver::async_resolve (1 of 6 overloads)]
79409
79410
79411 (Deprecated: Use overload with separate host and service parameters.) Asynchronously perform forward resolution of a query to a list of entries. 
79412
79413
79414   template<
79415       typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
79416   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_resolve(
79417       const query & q,
79418       ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
79419
79420
79421 This function is used to asynchronously resolve a query into a list of endpoint entries.
79422
79423
79424 [heading Parameters]
79425     
79426
79427 [variablelist
79428   
79429 [[q][A query object that determines what endpoints will be returned.]]
79430
79431 [[handler][The handler to be called when the resolve operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
79432 ``
79433    void handler(
79434      const boost::system::error_code& error, // Result of operation.
79435      resolver::results_type results // Resolved endpoints as a range.
79436    ); 
79437 ``
79438 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
79439
79440 ]
79441
79442 A successful resolve operation is guaranteed to pass a non-empty range to the handler. 
79443
79444
79445 [endsect]
79446
79447
79448
79449 [section:overload2 ip::basic_resolver::async_resolve (2 of 6 overloads)]
79450
79451
79452 Asynchronously perform forward resolution of a query to a list of entries. 
79453
79454
79455   template<
79456       typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
79457   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_resolve(
79458       string_view host,
79459       string_view service,
79460       ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
79461
79462
79463 This function is used to resolve host and service names into a list of endpoint entries.
79464
79465
79466 [heading Parameters]
79467     
79468
79469 [variablelist
79470   
79471 [[host][A string identifying a location. May be a descriptive name or a numeric address string. If an empty string and the passive flag has been specified, the resolved endpoints are suitable for local service binding. If an empty string and passive is not specified, the resolved endpoints will use the loopback address.]]
79472
79473 [[service][A string identifying the requested service. This may be a descriptive name or a numeric string corresponding to a port number. May be an empty string, in which case all resolved endpoints will have a port number of 0.]]
79474
79475 [[handler][The handler to be called when the resolve operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
79476 ``
79477    void handler(
79478      const boost::system::error_code& error, // Result of operation.
79479      resolver::results_type results // Resolved endpoints as a range.
79480    ); 
79481 ``
79482 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
79483
79484 ]
79485
79486 A successful resolve operation is guaranteed to pass a non-empty range to the handler.
79487
79488
79489 [heading Remarks]
79490       
79491 On POSIX systems, host names may be locally defined in the file `/etc/hosts`. On Windows, host names may be defined in the file `c:\windows\system32\drivers\etc\hosts`. Remote host name resolution is performed using DNS. Operating systems may use additional locations when resolving host names (such as NETBIOS names on Windows).
79492
79493 On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names. 
79494
79495
79496 [endsect]
79497
79498
79499
79500 [section:overload3 ip::basic_resolver::async_resolve (3 of 6 overloads)]
79501
79502
79503 Asynchronously perform forward resolution of a query to a list of entries. 
79504
79505
79506   template<
79507       typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
79508   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_resolve(
79509       string_view host,
79510       string_view service,
79511       resolver_base::flags resolve_flags,
79512       ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
79513
79514
79515 This function is used to resolve host and service names into a list of endpoint entries.
79516
79517
79518 [heading Parameters]
79519     
79520
79521 [variablelist
79522   
79523 [[host][A string identifying a location. May be a descriptive name or a numeric address string. If an empty string and the passive flag has been specified, the resolved endpoints are suitable for local service binding. If an empty string and passive is not specified, the resolved endpoints will use the loopback address.]]
79524
79525 [[service][A string identifying the requested service. This may be a descriptive name or a numeric string corresponding to a port number. May be an empty string, in which case all resolved endpoints will have a port number of 0.]]
79526
79527 [[resolve_flags][A set of flags that determine how name resolution should be performed. The default flags are suitable for communication with remote hosts. See the [link boost_asio.reference.ip__resolver_base `ip::resolver_base`]  documentation for the set of available flags.]]
79528
79529 [[handler][The handler to be called when the resolve operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
79530 ``
79531    void handler(
79532      const boost::system::error_code& error, // Result of operation.
79533      resolver::results_type results // Resolved endpoints as a range.
79534    ); 
79535 ``
79536 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
79537
79538 ]
79539
79540 A successful resolve operation is guaranteed to pass a non-empty range to the handler.
79541
79542
79543 [heading Remarks]
79544       
79545 On POSIX systems, host names may be locally defined in the file `/etc/hosts`. On Windows, host names may be defined in the file `c:\windows\system32\drivers\etc\hosts`. Remote host name resolution is performed using DNS. Operating systems may use additional locations when resolving host names (such as NETBIOS names on Windows).
79546
79547 On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names. 
79548
79549
79550 [endsect]
79551
79552
79553
79554 [section:overload4 ip::basic_resolver::async_resolve (4 of 6 overloads)]
79555
79556
79557 Asynchronously perform forward resolution of a query to a list of entries. 
79558
79559
79560   template<
79561       typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
79562   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_resolve(
79563       const protocol_type & protocol,
79564       string_view host,
79565       string_view service,
79566       ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
79567
79568
79569 This function is used to resolve host and service names into a list of endpoint entries.
79570
79571
79572 [heading Parameters]
79573     
79574
79575 [variablelist
79576   
79577 [[protocol][A protocol object, normally representing either the IPv4 or IPv6 version of an internet protocol.]]
79578
79579 [[host][A string identifying a location. May be a descriptive name or a numeric address string. If an empty string and the passive flag has been specified, the resolved endpoints are suitable for local service binding. If an empty string and passive is not specified, the resolved endpoints will use the loopback address.]]
79580
79581 [[service][A string identifying the requested service. This may be a descriptive name or a numeric string corresponding to a port number. May be an empty string, in which case all resolved endpoints will have a port number of 0.]]
79582
79583 [[handler][The handler to be called when the resolve operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
79584 ``
79585    void handler(
79586      const boost::system::error_code& error, // Result of operation.
79587      resolver::results_type results // Resolved endpoints as a range.
79588    ); 
79589 ``
79590 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
79591
79592 ]
79593
79594 A successful resolve operation is guaranteed to pass a non-empty range to the handler.
79595
79596
79597 [heading Remarks]
79598       
79599 On POSIX systems, host names may be locally defined in the file `/etc/hosts`. On Windows, host names may be defined in the file `c:\windows\system32\drivers\etc\hosts`. Remote host name resolution is performed using DNS. Operating systems may use additional locations when resolving host names (such as NETBIOS names on Windows).
79600
79601 On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names. 
79602
79603
79604 [endsect]
79605
79606
79607
79608 [section:overload5 ip::basic_resolver::async_resolve (5 of 6 overloads)]
79609
79610
79611 Asynchronously perform forward resolution of a query to a list of entries. 
79612
79613
79614   template<
79615       typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
79616   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_resolve(
79617       const protocol_type & protocol,
79618       string_view host,
79619       string_view service,
79620       resolver_base::flags resolve_flags,
79621       ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
79622
79623
79624 This function is used to resolve host and service names into a list of endpoint entries.
79625
79626
79627 [heading Parameters]
79628     
79629
79630 [variablelist
79631   
79632 [[protocol][A protocol object, normally representing either the IPv4 or IPv6 version of an internet protocol.]]
79633
79634 [[host][A string identifying a location. May be a descriptive name or a numeric address string. If an empty string and the passive flag has been specified, the resolved endpoints are suitable for local service binding. If an empty string and passive is not specified, the resolved endpoints will use the loopback address.]]
79635
79636 [[service][A string identifying the requested service. This may be a descriptive name or a numeric string corresponding to a port number. May be an empty string, in which case all resolved endpoints will have a port number of 0.]]
79637
79638 [[resolve_flags][A set of flags that determine how name resolution should be performed. The default flags are suitable for communication with remote hosts. See the [link boost_asio.reference.ip__resolver_base `ip::resolver_base`]  documentation for the set of available flags.]]
79639
79640 [[handler][The handler to be called when the resolve operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
79641 ``
79642    void handler(
79643      const boost::system::error_code& error, // Result of operation.
79644      resolver::results_type results // Resolved endpoints as a range.
79645    ); 
79646 ``
79647 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
79648
79649 ]
79650
79651 A successful resolve operation is guaranteed to pass a non-empty range to the handler.
79652
79653
79654 [heading Remarks]
79655       
79656 On POSIX systems, host names may be locally defined in the file `/etc/hosts`. On Windows, host names may be defined in the file `c:\windows\system32\drivers\etc\hosts`. Remote host name resolution is performed using DNS. Operating systems may use additional locations when resolving host names (such as NETBIOS names on Windows).
79657
79658 On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names. 
79659
79660
79661 [endsect]
79662
79663
79664
79665 [section:overload6 ip::basic_resolver::async_resolve (6 of 6 overloads)]
79666
79667
79668 Asynchronously perform reverse resolution of an endpoint to a list of entries. 
79669
79670
79671   template<
79672       typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
79673   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_resolve(
79674       const endpoint_type & e,
79675       ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
79676
79677
79678 This function is used to asynchronously resolve an endpoint into a list of endpoint entries.
79679
79680
79681 [heading Parameters]
79682     
79683
79684 [variablelist
79685   
79686 [[e][An endpoint object that determines what endpoints will be returned.]]
79687
79688 [[handler][The handler to be called when the resolve operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
79689 ``
79690    void handler(
79691      const boost::system::error_code& error, // Result of operation.
79692      resolver::results_type results // Resolved endpoints as a range.
79693    ); 
79694 ``
79695 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
79696
79697 ]
79698
79699 A successful resolve operation is guaranteed to pass a non-empty range to the handler. 
79700
79701
79702 [endsect]
79703
79704
79705 [endsect]
79706
79707 [section:basic_resolver ip::basic_resolver::basic_resolver]
79708
79709 [indexterm2 boost_asio.indexterm.ip__basic_resolver.basic_resolver..basic_resolver..ip::basic_resolver] 
79710 Construct with executor. 
79711
79712
79713   explicit ``[link boost_asio.reference.ip__basic_resolver.basic_resolver.overload1 basic_resolver]``(
79714       const executor_type & ex);
79715   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.basic_resolver.overload1 more...]]``
79716
79717
79718 Construct with execution context. 
79719
79720
79721   template<
79722       typename ExecutionContext>
79723   explicit ``[link boost_asio.reference.ip__basic_resolver.basic_resolver.overload2 basic_resolver]``(
79724       ExecutionContext & context,
79725       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
79726   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.basic_resolver.overload2 more...]]``
79727
79728
79729 Move-construct a [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] from another. 
79730
79731
79732   ``[link boost_asio.reference.ip__basic_resolver.basic_resolver.overload3 basic_resolver]``(
79733       basic_resolver && other);
79734   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.basic_resolver.overload3 more...]]``
79735
79736
79737 [section:overload1 ip::basic_resolver::basic_resolver (1 of 3 overloads)]
79738
79739
79740 Construct with executor. 
79741
79742
79743   basic_resolver(
79744       const executor_type & ex);
79745
79746
79747 This constructor creates a [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`].
79748
79749
79750 [heading Parameters]
79751     
79752
79753 [variablelist
79754   
79755 [[ex][The I/O executor that the resolver will use, by default, to dispatch handlers for any asynchronous operations performed on the resolver. ]]
79756
79757 ]
79758
79759
79760
79761
79762 [endsect]
79763
79764
79765
79766 [section:overload2 ip::basic_resolver::basic_resolver (2 of 3 overloads)]
79767
79768
79769 Construct with execution context. 
79770
79771
79772   template<
79773       typename ExecutionContext>
79774   basic_resolver(
79775       ExecutionContext & context,
79776       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
79777
79778
79779 This constructor creates a [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`].
79780
79781
79782 [heading Parameters]
79783     
79784
79785 [variablelist
79786   
79787 [[context][An execution context which provides the I/O executor that the resolver will use, by default, to dispatch handlers for any asynchronous operations performed on the resolver. ]]
79788
79789 ]
79790
79791
79792
79793
79794 [endsect]
79795
79796
79797
79798 [section:overload3 ip::basic_resolver::basic_resolver (3 of 3 overloads)]
79799
79800
79801 Move-construct a [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] from another. 
79802
79803
79804   basic_resolver(
79805       basic_resolver && other);
79806
79807
79808 This constructor moves a resolver from one object to another.
79809
79810
79811 [heading Parameters]
79812     
79813
79814 [variablelist
79815   
79816 [[other][The other [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] object from which the move will occur.]]
79817
79818 ]
79819
79820
79821 [heading Remarks]
79822       
79823 Following the move, the moved-from object is in the same state as if constructed using the `basic_resolver(const executor_type&) constructor`. 
79824
79825
79826
79827
79828 [endsect]
79829
79830
79831 [endsect]
79832
79833
79834 [section:cancel ip::basic_resolver::cancel]
79835
79836 [indexterm2 boost_asio.indexterm.ip__basic_resolver.cancel..cancel..ip::basic_resolver] 
79837 Cancel any asynchronous operations that are waiting on the resolver. 
79838
79839
79840   void cancel();
79841
79842
79843 This function forces the completion of any pending asynchronous operations on the host resolver. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code. 
79844
79845
79846 [endsect]
79847
79848
79849
79850 [section:canonical_name ip::basic_resolver::canonical_name]
79851
79852
79853 ['Inherited from ip::resolver_base.]
79854
79855 [indexterm2 boost_asio.indexterm.ip__basic_resolver.canonical_name..canonical_name..ip::basic_resolver] 
79856 Determine the canonical name of the host specified in the query. 
79857
79858
79859   static const flags canonical_name = implementation_defined;
79860
79861
79862
79863 [endsect]
79864
79865
79866
79867 [section:endpoint_type ip::basic_resolver::endpoint_type]
79868
79869 [indexterm2 boost_asio.indexterm.ip__basic_resolver.endpoint_type..endpoint_type..ip::basic_resolver] 
79870 The endpoint type. 
79871
79872
79873   typedef InternetProtocol::endpoint endpoint_type;
79874
79875
79876
79877 [heading Requirements]
79878
79879 ['Header: ][^boost/asio/ip/basic_resolver.hpp]
79880
79881 ['Convenience header: ][^boost/asio.hpp]
79882
79883
79884 [endsect]
79885
79886
79887
79888 [section:executor_type ip::basic_resolver::executor_type]
79889
79890 [indexterm2 boost_asio.indexterm.ip__basic_resolver.executor_type..executor_type..ip::basic_resolver] 
79891 The type of the executor associated with the object. 
79892
79893
79894   typedef Executor executor_type;
79895
79896
79897
79898 [heading Requirements]
79899
79900 ['Header: ][^boost/asio/ip/basic_resolver.hpp]
79901
79902 ['Convenience header: ][^boost/asio.hpp]
79903
79904
79905 [endsect]
79906
79907
79908
79909 [section:flags ip::basic_resolver::flags]
79910
79911
79912 ['Inherited from ip::resolver_base.]
79913
79914 [indexterm2 boost_asio.indexterm.ip__basic_resolver.flags..flags..ip::basic_resolver] 
79915 A bitmask type (C++ Std [lib.bitmask.types]). 
79916
79917
79918   typedef unspecified flags;
79919
79920
79921
79922 [heading Requirements]
79923
79924 ['Header: ][^boost/asio/ip/basic_resolver.hpp]
79925
79926 ['Convenience header: ][^boost/asio.hpp]
79927
79928
79929 [endsect]
79930
79931
79932
79933 [section:get_executor ip::basic_resolver::get_executor]
79934
79935 [indexterm2 boost_asio.indexterm.ip__basic_resolver.get_executor..get_executor..ip::basic_resolver] 
79936 Get the executor associated with the object. 
79937
79938
79939   executor_type get_executor();
79940
79941
79942
79943 [endsect]
79944
79945
79946
79947 [section:iterator ip::basic_resolver::iterator]
79948
79949 [indexterm2 boost_asio.indexterm.ip__basic_resolver.iterator..iterator..ip::basic_resolver] 
79950 (Deprecated.) The iterator type. 
79951
79952
79953   typedef basic_resolver_iterator< InternetProtocol > iterator;
79954
79955
79956 [heading Types]
79957 [table
79958   [[Name][Description]]
79959
79960   [
79961
79962     [[link boost_asio.reference.ip__basic_resolver_iterator.difference_type [*difference_type]]]
79963     [The type used for the distance between two iterators. ]
79964   
79965   ]
79966
79967   [
79968
79969     [[link boost_asio.reference.ip__basic_resolver_iterator.iterator_category [*iterator_category]]]
79970     [The iterator category. ]
79971   
79972   ]
79973
79974   [
79975
79976     [[link boost_asio.reference.ip__basic_resolver_iterator.pointer [*pointer]]]
79977     [The type of the result of applying operator->() to the iterator. ]
79978   
79979   ]
79980
79981   [
79982
79983     [[link boost_asio.reference.ip__basic_resolver_iterator.reference [*reference]]]
79984     [The type of the result of applying operator*() to the iterator. ]
79985   
79986   ]
79987
79988   [
79989
79990     [[link boost_asio.reference.ip__basic_resolver_iterator.value_type [*value_type]]]
79991     [The type of the value pointed to by the iterator. ]
79992   
79993   ]
79994
79995 ]
79996
79997 [heading Member Functions]
79998 [table
79999   [[Name][Description]]
80000
80001   [
80002     [[link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator [*basic_resolver_iterator]]]
80003     [Default constructor creates an end iterator. 
80004      [hr]
80005      Copy constructor. 
80006      [hr]
80007      Move constructor. ]
80008   ]
80009   
80010   [
80011     [[link boost_asio.reference.ip__basic_resolver_iterator.operator__star_ [*operator *]]]
80012     [Dereference an iterator. ]
80013   ]
80014   
80015   [
80016     [[link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_ [*operator++]]]
80017     [Increment operator (prefix). 
80018      [hr]
80019      Increment operator (postfix). ]
80020   ]
80021   
80022   [
80023     [[link boost_asio.reference.ip__basic_resolver_iterator.operator_arrow_ [*operator->]]]
80024     [Dereference an iterator. ]
80025   ]
80026   
80027   [
80028     [[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq_ [*operator=]]]
80029     [Assignment operator. 
80030      [hr]
80031      Move-assignment operator. ]
80032   ]
80033   
80034 ]
80035
80036 [heading Protected Member Functions]
80037 [table
80038   [[Name][Description]]
80039
80040   [
80041     [[link boost_asio.reference.ip__basic_resolver_iterator.dereference [*dereference]]]
80042     []
80043   ]
80044   
80045   [
80046     [[link boost_asio.reference.ip__basic_resolver_iterator.equal [*equal]]]
80047     []
80048   ]
80049   
80050   [
80051     [[link boost_asio.reference.ip__basic_resolver_iterator.increment [*increment]]]
80052     []
80053   ]
80054   
80055 ]
80056
80057 [heading Protected Data Members]
80058 [table
80059   [[Name][Description]]
80060
80061   [
80062     [[link boost_asio.reference.ip__basic_resolver_iterator.index_ [*index_]]]
80063     []
80064   ]
80065
80066   [
80067     [[link boost_asio.reference.ip__basic_resolver_iterator.values_ [*values_]]]
80068     []
80069   ]
80070
80071 ]
80072
80073 [heading Friends]
80074 [table
80075   [[Name][Description]]
80076
80077   [
80078     [[link boost_asio.reference.ip__basic_resolver_iterator.operator_not__eq_ [*operator!=]]]
80079     [Test two iterators for inequality. ]
80080   ]
80081   
80082   [
80083     [[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq__eq_ [*operator==]]]
80084     [Test two iterators for equality. ]
80085   ]
80086   
80087 ]
80088
80089 The [link boost_asio.reference.ip__basic_resolver_iterator `ip::basic_resolver_iterator`] class template is used to define iterators over the results returned by a resolver.
80090
80091 The iterator's value\_type, obtained when the iterator is dereferenced, is: 
80092
80093    const basic_resolver_entry<InternetProtocol> 
80094
80095
80096
80097
80098
80099 [heading Thread Safety]
80100   
80101 ['Distinct] ['objects:] Safe.
80102
80103 ['Shared] ['objects:] Unsafe. 
80104
80105
80106
80107
80108 [heading Requirements]
80109
80110 ['Header: ][^boost/asio/ip/basic_resolver.hpp]
80111
80112 ['Convenience header: ][^boost/asio.hpp]
80113
80114
80115 [endsect]
80116
80117
80118
80119 [section:numeric_host ip::basic_resolver::numeric_host]
80120
80121
80122 ['Inherited from ip::resolver_base.]
80123
80124 [indexterm2 boost_asio.indexterm.ip__basic_resolver.numeric_host..numeric_host..ip::basic_resolver] 
80125 Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. 
80126
80127
80128   static const flags numeric_host = implementation_defined;
80129
80130
80131
80132 [endsect]
80133
80134
80135
80136 [section:numeric_service ip::basic_resolver::numeric_service]
80137
80138
80139 ['Inherited from ip::resolver_base.]
80140
80141 [indexterm2 boost_asio.indexterm.ip__basic_resolver.numeric_service..numeric_service..ip::basic_resolver] 
80142 Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. 
80143
80144
80145   static const flags numeric_service = implementation_defined;
80146
80147
80148
80149 [endsect]
80150
80151
80152
80153 [section:operator_eq_ ip::basic_resolver::operator=]
80154
80155 [indexterm2 boost_asio.indexterm.ip__basic_resolver.operator_eq_..operator=..ip::basic_resolver] 
80156 Move-assign a [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] from another. 
80157
80158
80159   basic_resolver & operator=(
80160       basic_resolver && other);
80161
80162
80163 This assignment operator moves a resolver from one object to another. Cancels any outstanding asynchronous operations associated with the target object.
80164
80165
80166 [heading Parameters]
80167     
80168
80169 [variablelist
80170   
80171 [[other][The other [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] object from which the move will occur.]]
80172
80173 ]
80174
80175
80176 [heading Remarks]
80177       
80178 Following the move, the moved-from object is in the same state as if constructed using the `basic_resolver(const executor_type&) constructor`. 
80179
80180
80181
80182
80183 [endsect]
80184
80185
80186
80187 [section:passive ip::basic_resolver::passive]
80188
80189
80190 ['Inherited from ip::resolver_base.]
80191
80192 [indexterm2 boost_asio.indexterm.ip__basic_resolver.passive..passive..ip::basic_resolver] 
80193 Indicate that returned endpoint is intended for use as a locally bound socket endpoint. 
80194
80195
80196   static const flags passive = implementation_defined;
80197
80198
80199
80200 [endsect]
80201
80202
80203
80204 [section:protocol_type ip::basic_resolver::protocol_type]
80205
80206 [indexterm2 boost_asio.indexterm.ip__basic_resolver.protocol_type..protocol_type..ip::basic_resolver] 
80207 The protocol type. 
80208
80209
80210   typedef InternetProtocol protocol_type;
80211
80212
80213
80214 [heading Requirements]
80215
80216 ['Header: ][^boost/asio/ip/basic_resolver.hpp]
80217
80218 ['Convenience header: ][^boost/asio.hpp]
80219
80220
80221 [endsect]
80222
80223
80224
80225 [section:query ip::basic_resolver::query]
80226
80227 [indexterm2 boost_asio.indexterm.ip__basic_resolver.query..query..ip::basic_resolver] 
80228 (Deprecated.) The query type. 
80229
80230
80231   typedef basic_resolver_query< InternetProtocol > query;
80232
80233
80234 [heading Types]
80235 [table
80236   [[Name][Description]]
80237
80238   [
80239
80240     [[link boost_asio.reference.ip__basic_resolver_query.flags [*flags]]]
80241     [A bitmask type (C++ Std \[lib.bitmask.types\]). ]
80242   
80243   ]
80244
80245   [
80246
80247     [[link boost_asio.reference.ip__basic_resolver_query.protocol_type [*protocol_type]]]
80248     [The protocol type associated with the endpoint query. ]
80249   
80250   ]
80251
80252 ]
80253
80254 [heading Member Functions]
80255 [table
80256   [[Name][Description]]
80257
80258   [
80259     [[link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query [*basic_resolver_query]]]
80260     [Construct with specified service name for any protocol. 
80261      [hr]
80262      Construct with specified service name for a given protocol. 
80263      [hr]
80264      Construct with specified host name and service name for any protocol. 
80265      [hr]
80266      Construct with specified host name and service name for a given protocol. ]
80267   ]
80268   
80269   [
80270     [[link boost_asio.reference.ip__basic_resolver_query.hints [*hints]]]
80271     [Get the hints associated with the query. ]
80272   ]
80273   
80274   [
80275     [[link boost_asio.reference.ip__basic_resolver_query.host_name [*host_name]]]
80276     [Get the host name associated with the query. ]
80277   ]
80278   
80279   [
80280     [[link boost_asio.reference.ip__basic_resolver_query.service_name [*service_name]]]
80281     [Get the service name associated with the query. ]
80282   ]
80283   
80284 ]
80285
80286 [heading Data Members]
80287 [table
80288   [[Name][Description]]
80289
80290   [
80291     [[link boost_asio.reference.ip__basic_resolver_query.address_configured [*address_configured]]]
80292     [Only return IPv4 addresses if a non-loopback IPv4 address is configured for the system. Only return IPv6 addresses if a non-loopback IPv6 address is configured for the system. ]
80293   ]
80294
80295   [
80296     [[link boost_asio.reference.ip__basic_resolver_query.all_matching [*all_matching]]]
80297     [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ]
80298   ]
80299
80300   [
80301     [[link boost_asio.reference.ip__basic_resolver_query.canonical_name [*canonical_name]]]
80302     [Determine the canonical name of the host specified in the query. ]
80303   ]
80304
80305   [
80306     [[link boost_asio.reference.ip__basic_resolver_query.numeric_host [*numeric_host]]]
80307     [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ]
80308   ]
80309
80310   [
80311     [[link boost_asio.reference.ip__basic_resolver_query.numeric_service [*numeric_service]]]
80312     [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ]
80313   ]
80314
80315   [
80316     [[link boost_asio.reference.ip__basic_resolver_query.passive [*passive]]]
80317     [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ]
80318   ]
80319
80320   [
80321     [[link boost_asio.reference.ip__basic_resolver_query.v4_mapped [*v4_mapped]]]
80322     [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ]
80323   ]
80324
80325 ]
80326
80327 The [link boost_asio.reference.ip__basic_resolver_query `ip::basic_resolver_query`] class template describes a query that can be passed to a resolver.
80328
80329
80330 [heading Thread Safety]
80331   
80332 ['Distinct] ['objects:] Safe.
80333
80334 ['Shared] ['objects:] Unsafe. 
80335
80336
80337
80338
80339 [heading Requirements]
80340
80341 ['Header: ][^boost/asio/ip/basic_resolver.hpp]
80342
80343 ['Convenience header: ][^boost/asio.hpp]
80344
80345
80346 [endsect]
80347
80348
80349 [section:resolve ip::basic_resolver::resolve]
80350
80351 [indexterm2 boost_asio.indexterm.ip__basic_resolver.resolve..resolve..ip::basic_resolver] 
80352 (Deprecated: Use overload with separate host and service parameters.) Perform forward resolution of a query to a list of entries. 
80353
80354
80355   results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload1 resolve]``(
80356       const query & q);
80357   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.resolve.overload1 more...]]``
80358
80359   results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload2 resolve]``(
80360       const query & q,
80361       boost::system::error_code & ec);
80362   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.resolve.overload2 more...]]``
80363
80364
80365 Perform forward resolution of a query to a list of entries. 
80366
80367
80368   results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload3 resolve]``(
80369       string_view host,
80370       string_view service);
80371   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.resolve.overload3 more...]]``
80372
80373   results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload4 resolve]``(
80374       string_view host,
80375       string_view service,
80376       boost::system::error_code & ec);
80377   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.resolve.overload4 more...]]``
80378
80379   results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload5 resolve]``(
80380       string_view host,
80381       string_view service,
80382       resolver_base::flags resolve_flags);
80383   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.resolve.overload5 more...]]``
80384
80385   results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload6 resolve]``(
80386       string_view host,
80387       string_view service,
80388       resolver_base::flags resolve_flags,
80389       boost::system::error_code & ec);
80390   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.resolve.overload6 more...]]``
80391
80392   results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload7 resolve]``(
80393       const protocol_type & protocol,
80394       string_view host,
80395       string_view service);
80396   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.resolve.overload7 more...]]``
80397
80398   results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload8 resolve]``(
80399       const protocol_type & protocol,
80400       string_view host,
80401       string_view service,
80402       boost::system::error_code & ec);
80403   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.resolve.overload8 more...]]``
80404
80405   results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload9 resolve]``(
80406       const protocol_type & protocol,
80407       string_view host,
80408       string_view service,
80409       resolver_base::flags resolve_flags);
80410   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.resolve.overload9 more...]]``
80411
80412   results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload10 resolve]``(
80413       const protocol_type & protocol,
80414       string_view host,
80415       string_view service,
80416       resolver_base::flags resolve_flags,
80417       boost::system::error_code & ec);
80418   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.resolve.overload10 more...]]``
80419
80420
80421 Perform reverse resolution of an endpoint to a list of entries. 
80422
80423
80424   results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload11 resolve]``(
80425       const endpoint_type & e);
80426   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.resolve.overload11 more...]]``
80427
80428   results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload12 resolve]``(
80429       const endpoint_type & e,
80430       boost::system::error_code & ec);
80431   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.resolve.overload12 more...]]``
80432
80433
80434 [section:overload1 ip::basic_resolver::resolve (1 of 12 overloads)]
80435
80436
80437 (Deprecated: Use overload with separate host and service parameters.) Perform forward resolution of a query to a list of entries. 
80438
80439
80440   results_type resolve(
80441       const query & q);
80442
80443
80444 This function is used to resolve a query into a list of endpoint entries.
80445
80446
80447 [heading Parameters]
80448     
80449
80450 [variablelist
80451   
80452 [[q][A query object that determines what endpoints will be returned.]]
80453
80454 ]
80455
80456
80457 [heading Return Value]
80458       
80459 A range object representing the list of endpoint entries. A successful call to this function is guaranteed to return a non-empty range.
80460
80461
80462 [heading Exceptions]
80463     
80464
80465 [variablelist
80466   
80467 [[boost::system::system_error][Thrown on failure. ]]
80468
80469 ]
80470
80471
80472
80473
80474 [endsect]
80475
80476
80477
80478 [section:overload2 ip::basic_resolver::resolve (2 of 12 overloads)]
80479
80480
80481 (Deprecated: Use overload with separate host and service parameters.) Perform forward resolution of a query to a list of entries. 
80482
80483
80484   results_type resolve(
80485       const query & q,
80486       boost::system::error_code & ec);
80487
80488
80489 This function is used to resolve a query into a list of endpoint entries.
80490
80491
80492 [heading Parameters]
80493     
80494
80495 [variablelist
80496   
80497 [[q][A query object that determines what endpoints will be returned.]]
80498
80499 [[ec][Set to indicate what error occurred, if any.]]
80500
80501 ]
80502
80503
80504 [heading Return Value]
80505       
80506 A range object representing the list of endpoint entries. An empty range is returned if an error occurs. A successful call to this function is guaranteed to return a non-empty range. 
80507
80508
80509
80510
80511 [endsect]
80512
80513
80514
80515 [section:overload3 ip::basic_resolver::resolve (3 of 12 overloads)]
80516
80517
80518 Perform forward resolution of a query to a list of entries. 
80519
80520
80521   results_type resolve(
80522       string_view host,
80523       string_view service);
80524
80525
80526 This function is used to resolve host and service names into a list of endpoint entries.
80527
80528
80529 [heading Parameters]
80530     
80531
80532 [variablelist
80533   
80534 [[host][A string identifying a location. May be a descriptive name or a numeric address string. If an empty string and the passive flag has been specified, the resolved endpoints are suitable for local service binding. If an empty string and passive is not specified, the resolved endpoints will use the loopback address.]]
80535
80536 [[service][A string identifying the requested service. This may be a descriptive name or a numeric string corresponding to a port number. May be an empty string, in which case all resolved endpoints will have a port number of 0.]]
80537
80538 ]
80539
80540
80541 [heading Return Value]
80542       
80543 A range object representing the list of endpoint entries. A successful call to this function is guaranteed to return a non-empty range.
80544
80545
80546 [heading Exceptions]
80547     
80548
80549 [variablelist
80550   
80551 [[boost::system::system_error][Thrown on failure.]]
80552
80553 ]
80554
80555
80556 [heading Remarks]
80557       
80558 On POSIX systems, host names may be locally defined in the file `/etc/hosts`. On Windows, host names may be defined in the file `c:\windows\system32\drivers\etc\hosts`. Remote host name resolution is performed using DNS. Operating systems may use additional locations when resolving host names (such as NETBIOS names on Windows).
80559
80560 On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names. 
80561
80562
80563 [endsect]
80564
80565
80566
80567 [section:overload4 ip::basic_resolver::resolve (4 of 12 overloads)]
80568
80569
80570 Perform forward resolution of a query to a list of entries. 
80571
80572
80573   results_type resolve(
80574       string_view host,
80575       string_view service,
80576       boost::system::error_code & ec);
80577
80578
80579 This function is used to resolve host and service names into a list of endpoint entries.
80580
80581
80582 [heading Parameters]
80583     
80584
80585 [variablelist
80586   
80587 [[host][A string identifying a location. May be a descriptive name or a numeric address string. If an empty string and the passive flag has been specified, the resolved endpoints are suitable for local service binding. If an empty string and passive is not specified, the resolved endpoints will use the loopback address.]]
80588
80589 [[service][A string identifying the requested service. This may be a descriptive name or a numeric string corresponding to a port number. May be an empty string, in which case all resolved endpoints will have a port number of 0.]]
80590
80591 [[ec][Set to indicate what error occurred, if any.]]
80592
80593 ]
80594
80595
80596 [heading Return Value]
80597       
80598 A range object representing the list of endpoint entries. An empty range is returned if an error occurs. A successful call to this function is guaranteed to return a non-empty range.
80599
80600
80601 [heading Remarks]
80602       
80603 On POSIX systems, host names may be locally defined in the file `/etc/hosts`. On Windows, host names may be defined in the file `c:\windows\system32\drivers\etc\hosts`. Remote host name resolution is performed using DNS. Operating systems may use additional locations when resolving host names (such as NETBIOS names on Windows).
80604
80605 On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names. 
80606
80607
80608 [endsect]
80609
80610
80611
80612 [section:overload5 ip::basic_resolver::resolve (5 of 12 overloads)]
80613
80614
80615 Perform forward resolution of a query to a list of entries. 
80616
80617
80618   results_type resolve(
80619       string_view host,
80620       string_view service,
80621       resolver_base::flags resolve_flags);
80622
80623
80624 This function is used to resolve host and service names into a list of endpoint entries.
80625
80626
80627 [heading Parameters]
80628     
80629
80630 [variablelist
80631   
80632 [[host][A string identifying a location. May be a descriptive name or a numeric address string. If an empty string and the passive flag has been specified, the resolved endpoints are suitable for local service binding. If an empty string and passive is not specified, the resolved endpoints will use the loopback address.]]
80633
80634 [[service][A string identifying the requested service. This may be a descriptive name or a numeric string corresponding to a port number. May be an empty string, in which case all resolved endpoints will have a port number of 0.]]
80635
80636 [[resolve_flags][A set of flags that determine how name resolution should be performed. The default flags are suitable for communication with remote hosts. See the [link boost_asio.reference.ip__resolver_base `ip::resolver_base`]  documentation for the set of available flags.]]
80637
80638 ]
80639
80640
80641 [heading Return Value]
80642       
80643 A range object representing the list of endpoint entries. A successful call to this function is guaranteed to return a non-empty range.
80644
80645
80646 [heading Exceptions]
80647     
80648
80649 [variablelist
80650   
80651 [[boost::system::system_error][Thrown on failure.]]
80652
80653 ]
80654
80655
80656 [heading Remarks]
80657       
80658 On POSIX systems, host names may be locally defined in the file `/etc/hosts`. On Windows, host names may be defined in the file `c:\windows\system32\drivers\etc\hosts`. Remote host name resolution is performed using DNS. Operating systems may use additional locations when resolving host names (such as NETBIOS names on Windows).
80659
80660 On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names. 
80661
80662
80663 [endsect]
80664
80665
80666
80667 [section:overload6 ip::basic_resolver::resolve (6 of 12 overloads)]
80668
80669
80670 Perform forward resolution of a query to a list of entries. 
80671
80672
80673   results_type resolve(
80674       string_view host,
80675       string_view service,
80676       resolver_base::flags resolve_flags,
80677       boost::system::error_code & ec);
80678
80679
80680 This function is used to resolve host and service names into a list of endpoint entries.
80681
80682
80683 [heading Parameters]
80684     
80685
80686 [variablelist
80687   
80688 [[host][A string identifying a location. May be a descriptive name or a numeric address string. If an empty string and the passive flag has been specified, the resolved endpoints are suitable for local service binding. If an empty string and passive is not specified, the resolved endpoints will use the loopback address.]]
80689
80690 [[service][A string identifying the requested service. This may be a descriptive name or a numeric string corresponding to a port number. May be an empty string, in which case all resolved endpoints will have a port number of 0.]]
80691
80692 [[resolve_flags][A set of flags that determine how name resolution should be performed. The default flags are suitable for communication with remote hosts. See the [link boost_asio.reference.ip__resolver_base `ip::resolver_base`]  documentation for the set of available flags.]]
80693
80694 [[ec][Set to indicate what error occurred, if any.]]
80695
80696 ]
80697
80698
80699 [heading Return Value]
80700       
80701 A range object representing the list of endpoint entries. An empty range is returned if an error occurs. A successful call to this function is guaranteed to return a non-empty range.
80702
80703
80704 [heading Remarks]
80705       
80706 On POSIX systems, host names may be locally defined in the file `/etc/hosts`. On Windows, host names may be defined in the file `c:\windows\system32\drivers\etc\hosts`. Remote host name resolution is performed using DNS. Operating systems may use additional locations when resolving host names (such as NETBIOS names on Windows).
80707
80708 On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names. 
80709
80710
80711 [endsect]
80712
80713
80714
80715 [section:overload7 ip::basic_resolver::resolve (7 of 12 overloads)]
80716
80717
80718 Perform forward resolution of a query to a list of entries. 
80719
80720
80721   results_type resolve(
80722       const protocol_type & protocol,
80723       string_view host,
80724       string_view service);
80725
80726
80727 This function is used to resolve host and service names into a list of endpoint entries.
80728
80729
80730 [heading Parameters]
80731     
80732
80733 [variablelist
80734   
80735 [[protocol][A protocol object, normally representing either the IPv4 or IPv6 version of an internet protocol.]]
80736
80737 [[host][A string identifying a location. May be a descriptive name or a numeric address string. If an empty string and the passive flag has been specified, the resolved endpoints are suitable for local service binding. If an empty string and passive is not specified, the resolved endpoints will use the loopback address.]]
80738
80739 [[service][A string identifying the requested service. This may be a descriptive name or a numeric string corresponding to a port number. May be an empty string, in which case all resolved endpoints will have a port number of 0.]]
80740
80741 ]
80742
80743
80744 [heading Return Value]
80745       
80746 A range object representing the list of endpoint entries. A successful call to this function is guaranteed to return a non-empty range.
80747
80748
80749 [heading Exceptions]
80750     
80751
80752 [variablelist
80753   
80754 [[boost::system::system_error][Thrown on failure.]]
80755
80756 ]
80757
80758
80759 [heading Remarks]
80760       
80761 On POSIX systems, host names may be locally defined in the file `/etc/hosts`. On Windows, host names may be defined in the file `c:\windows\system32\drivers\etc\hosts`. Remote host name resolution is performed using DNS. Operating systems may use additional locations when resolving host names (such as NETBIOS names on Windows).
80762
80763 On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names. 
80764
80765
80766 [endsect]
80767
80768
80769
80770 [section:overload8 ip::basic_resolver::resolve (8 of 12 overloads)]
80771
80772
80773 Perform forward resolution of a query to a list of entries. 
80774
80775
80776   results_type resolve(
80777       const protocol_type & protocol,
80778       string_view host,
80779       string_view service,
80780       boost::system::error_code & ec);
80781
80782
80783 This function is used to resolve host and service names into a list of endpoint entries.
80784
80785
80786 [heading Parameters]
80787     
80788
80789 [variablelist
80790   
80791 [[protocol][A protocol object, normally representing either the IPv4 or IPv6 version of an internet protocol.]]
80792
80793 [[host][A string identifying a location. May be a descriptive name or a numeric address string. If an empty string and the passive flag has been specified, the resolved endpoints are suitable for local service binding. If an empty string and passive is not specified, the resolved endpoints will use the loopback address.]]
80794
80795 [[service][A string identifying the requested service. This may be a descriptive name or a numeric string corresponding to a port number. May be an empty string, in which case all resolved endpoints will have a port number of 0.]]
80796
80797 [[ec][Set to indicate what error occurred, if any.]]
80798
80799 ]
80800
80801
80802 [heading Return Value]
80803       
80804 A range object representing the list of endpoint entries. An empty range is returned if an error occurs. A successful call to this function is guaranteed to return a non-empty range.
80805
80806
80807 [heading Remarks]
80808       
80809 On POSIX systems, host names may be locally defined in the file `/etc/hosts`. On Windows, host names may be defined in the file `c:\windows\system32\drivers\etc\hosts`. Remote host name resolution is performed using DNS. Operating systems may use additional locations when resolving host names (such as NETBIOS names on Windows).
80810
80811 On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names. 
80812
80813
80814 [endsect]
80815
80816
80817
80818 [section:overload9 ip::basic_resolver::resolve (9 of 12 overloads)]
80819
80820
80821 Perform forward resolution of a query to a list of entries. 
80822
80823
80824   results_type resolve(
80825       const protocol_type & protocol,
80826       string_view host,
80827       string_view service,
80828       resolver_base::flags resolve_flags);
80829
80830
80831 This function is used to resolve host and service names into a list of endpoint entries.
80832
80833
80834 [heading Parameters]
80835     
80836
80837 [variablelist
80838   
80839 [[protocol][A protocol object, normally representing either the IPv4 or IPv6 version of an internet protocol.]]
80840
80841 [[host][A string identifying a location. May be a descriptive name or a numeric address string. If an empty string and the passive flag has been specified, the resolved endpoints are suitable for local service binding. If an empty string and passive is not specified, the resolved endpoints will use the loopback address.]]
80842
80843 [[service][A string identifying the requested service. This may be a descriptive name or a numeric string corresponding to a port number. May be an empty string, in which case all resolved endpoints will have a port number of 0.]]
80844
80845 [[resolve_flags][A set of flags that determine how name resolution should be performed. The default flags are suitable for communication with remote hosts. See the [link boost_asio.reference.ip__resolver_base `ip::resolver_base`]  documentation for the set of available flags.]]
80846
80847 ]
80848
80849
80850 [heading Return Value]
80851       
80852 A range object representing the list of endpoint entries. A successful call to this function is guaranteed to return a non-empty range.
80853
80854
80855 [heading Exceptions]
80856     
80857
80858 [variablelist
80859   
80860 [[boost::system::system_error][Thrown on failure.]]
80861
80862 ]
80863
80864
80865 [heading Remarks]
80866       
80867 On POSIX systems, host names may be locally defined in the file `/etc/hosts`. On Windows, host names may be defined in the file `c:\windows\system32\drivers\etc\hosts`. Remote host name resolution is performed using DNS. Operating systems may use additional locations when resolving host names (such as NETBIOS names on Windows).
80868
80869 On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names. 
80870
80871
80872 [endsect]
80873
80874
80875
80876 [section:overload10 ip::basic_resolver::resolve (10 of 12 overloads)]
80877
80878
80879 Perform forward resolution of a query to a list of entries. 
80880
80881
80882   results_type resolve(
80883       const protocol_type & protocol,
80884       string_view host,
80885       string_view service,
80886       resolver_base::flags resolve_flags,
80887       boost::system::error_code & ec);
80888
80889
80890 This function is used to resolve host and service names into a list of endpoint entries.
80891
80892
80893 [heading Parameters]
80894     
80895
80896 [variablelist
80897   
80898 [[protocol][A protocol object, normally representing either the IPv4 or IPv6 version of an internet protocol.]]
80899
80900 [[host][A string identifying a location. May be a descriptive name or a numeric address string. If an empty string and the passive flag has been specified, the resolved endpoints are suitable for local service binding. If an empty string and passive is not specified, the resolved endpoints will use the loopback address.]]
80901
80902 [[service][A string identifying the requested service. This may be a descriptive name or a numeric string corresponding to a port number. May be an empty string, in which case all resolved endpoints will have a port number of 0.]]
80903
80904 [[resolve_flags][A set of flags that determine how name resolution should be performed. The default flags are suitable for communication with remote hosts. See the [link boost_asio.reference.ip__resolver_base `ip::resolver_base`]  documentation for the set of available flags.]]
80905
80906 [[ec][Set to indicate what error occurred, if any.]]
80907
80908 ]
80909
80910
80911 [heading Return Value]
80912       
80913 A range object representing the list of endpoint entries. An empty range is returned if an error occurs. A successful call to this function is guaranteed to return a non-empty range.
80914
80915
80916 [heading Remarks]
80917       
80918 On POSIX systems, host names may be locally defined in the file `/etc/hosts`. On Windows, host names may be defined in the file `c:\windows\system32\drivers\etc\hosts`. Remote host name resolution is performed using DNS. Operating systems may use additional locations when resolving host names (such as NETBIOS names on Windows).
80919
80920 On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names. 
80921
80922
80923 [endsect]
80924
80925
80926
80927 [section:overload11 ip::basic_resolver::resolve (11 of 12 overloads)]
80928
80929
80930 Perform reverse resolution of an endpoint to a list of entries. 
80931
80932
80933   results_type resolve(
80934       const endpoint_type & e);
80935
80936
80937 This function is used to resolve an endpoint into a list of endpoint entries.
80938
80939
80940 [heading Parameters]
80941     
80942
80943 [variablelist
80944   
80945 [[e][An endpoint object that determines what endpoints will be returned.]]
80946
80947 ]
80948
80949
80950 [heading Return Value]
80951       
80952 A range object representing the list of endpoint entries. A successful call to this function is guaranteed to return a non-empty range.
80953
80954
80955 [heading Exceptions]
80956     
80957
80958 [variablelist
80959   
80960 [[boost::system::system_error][Thrown on failure. ]]
80961
80962 ]
80963
80964
80965
80966
80967 [endsect]
80968
80969
80970
80971 [section:overload12 ip::basic_resolver::resolve (12 of 12 overloads)]
80972
80973
80974 Perform reverse resolution of an endpoint to a list of entries. 
80975
80976
80977   results_type resolve(
80978       const endpoint_type & e,
80979       boost::system::error_code & ec);
80980
80981
80982 This function is used to resolve an endpoint into a list of endpoint entries.
80983
80984
80985 [heading Parameters]
80986     
80987
80988 [variablelist
80989   
80990 [[e][An endpoint object that determines what endpoints will be returned.]]
80991
80992 [[ec][Set to indicate what error occurred, if any.]]
80993
80994 ]
80995
80996
80997 [heading Return Value]
80998       
80999 A range object representing the list of endpoint entries. An empty range is returned if an error occurs. A successful call to this function is guaranteed to return a non-empty range. 
81000
81001
81002
81003
81004 [endsect]
81005
81006
81007 [endsect]
81008
81009
81010 [section:results_type ip::basic_resolver::results_type]
81011
81012 [indexterm2 boost_asio.indexterm.ip__basic_resolver.results_type..results_type..ip::basic_resolver] 
81013 The results type. 
81014
81015
81016   typedef basic_resolver_results< InternetProtocol > results_type;
81017
81018
81019 [heading Types]
81020 [table
81021   [[Name][Description]]
81022
81023   [
81024
81025     [[link boost_asio.reference.ip__basic_resolver_results.const_iterator [*const_iterator]]]
81026     [The type of an iterator into the range. ]
81027   
81028   ]
81029
81030   [
81031
81032     [[link boost_asio.reference.ip__basic_resolver_results.const_reference [*const_reference]]]
81033     [The type of a const reference to a value in the range. ]
81034   
81035   ]
81036
81037   [
81038
81039     [[link boost_asio.reference.ip__basic_resolver_results.difference_type [*difference_type]]]
81040     [Type used to represent the distance between two iterators in the range. ]
81041   
81042   ]
81043
81044   [
81045
81046     [[link boost_asio.reference.ip__basic_resolver_results.endpoint_type [*endpoint_type]]]
81047     [The endpoint type associated with the results. ]
81048   
81049   ]
81050
81051   [
81052
81053     [[link boost_asio.reference.ip__basic_resolver_results.iterator [*iterator]]]
81054     [The type of an iterator into the range. ]
81055   
81056   ]
81057
81058   [
81059
81060     [[link boost_asio.reference.ip__basic_resolver_results.iterator_category [*iterator_category]]]
81061     [The iterator category. ]
81062   
81063   ]
81064
81065   [
81066
81067     [[link boost_asio.reference.ip__basic_resolver_results.pointer [*pointer]]]
81068     [The type of the result of applying operator->() to the iterator. ]
81069   
81070   ]
81071
81072   [
81073
81074     [[link boost_asio.reference.ip__basic_resolver_results.protocol_type [*protocol_type]]]
81075     [The protocol type associated with the results. ]
81076   
81077   ]
81078
81079   [
81080
81081     [[link boost_asio.reference.ip__basic_resolver_results.reference [*reference]]]
81082     [The type of a non-const reference to a value in the range. ]
81083   
81084   ]
81085
81086   [
81087
81088     [[link boost_asio.reference.ip__basic_resolver_results.size_type [*size_type]]]
81089     [Type used to represent a count of the elements in the range. ]
81090   
81091   ]
81092
81093   [
81094
81095     [[link boost_asio.reference.ip__basic_resolver_results.value_type [*value_type]]]
81096     [The type of a value in the results range. ]
81097   
81098   ]
81099
81100 ]
81101
81102 [heading Member Functions]
81103 [table
81104   [[Name][Description]]
81105
81106   [
81107     [[link boost_asio.reference.ip__basic_resolver_results.basic_resolver_results [*basic_resolver_results]]]
81108     [Default constructor creates an empty range. 
81109      [hr]
81110      Copy constructor. 
81111      [hr]
81112      Move constructor. ]
81113   ]
81114   
81115   [
81116     [[link boost_asio.reference.ip__basic_resolver_results.begin [*begin]]]
81117     [Obtain a begin iterator for the results range. ]
81118   ]
81119   
81120   [
81121     [[link boost_asio.reference.ip__basic_resolver_results.cbegin [*cbegin]]]
81122     [Obtain a begin iterator for the results range. ]
81123   ]
81124   
81125   [
81126     [[link boost_asio.reference.ip__basic_resolver_results.cend [*cend]]]
81127     [Obtain an end iterator for the results range. ]
81128   ]
81129   
81130   [
81131     [[link boost_asio.reference.ip__basic_resolver_results.empty [*empty]]]
81132     [Determine whether the results range is empty. ]
81133   ]
81134   
81135   [
81136     [[link boost_asio.reference.ip__basic_resolver_results.end [*end]]]
81137     [Obtain an end iterator for the results range. ]
81138   ]
81139   
81140   [
81141     [[link boost_asio.reference.ip__basic_resolver_results.max_size [*max_size]]]
81142     [Get the maximum number of entries permitted in a results range. ]
81143   ]
81144   
81145   [
81146     [[link boost_asio.reference.ip__basic_resolver_results.operator__star_ [*operator *]]]
81147     [Dereference an iterator. ]
81148   ]
81149   
81150   [
81151     [[link boost_asio.reference.ip__basic_resolver_results.operator_plus__plus_ [*operator++]]]
81152     [Increment operator (prefix). 
81153      [hr]
81154      Increment operator (postfix). ]
81155   ]
81156   
81157   [
81158     [[link boost_asio.reference.ip__basic_resolver_results.operator_arrow_ [*operator->]]]
81159     [Dereference an iterator. ]
81160   ]
81161   
81162   [
81163     [[link boost_asio.reference.ip__basic_resolver_results.operator_eq_ [*operator=]]]
81164     [Assignment operator. 
81165      [hr]
81166      Move-assignment operator. ]
81167   ]
81168   
81169   [
81170     [[link boost_asio.reference.ip__basic_resolver_results.size [*size]]]
81171     [Get the number of entries in the results range. ]
81172   ]
81173   
81174   [
81175     [[link boost_asio.reference.ip__basic_resolver_results.swap [*swap]]]
81176     [Swap the results range with another. ]
81177   ]
81178   
81179 ]
81180
81181 [heading Protected Member Functions]
81182 [table
81183   [[Name][Description]]
81184
81185   [
81186     [[link boost_asio.reference.ip__basic_resolver_results.dereference [*dereference]]]
81187     []
81188   ]
81189   
81190   [
81191     [[link boost_asio.reference.ip__basic_resolver_results.equal [*equal]]]
81192     []
81193   ]
81194   
81195   [
81196     [[link boost_asio.reference.ip__basic_resolver_results.increment [*increment]]]
81197     []
81198   ]
81199   
81200 ]
81201
81202 [heading Protected Data Members]
81203 [table
81204   [[Name][Description]]
81205
81206   [
81207     [[link boost_asio.reference.ip__basic_resolver_results.index_ [*index_]]]
81208     []
81209   ]
81210
81211   [
81212     [[link boost_asio.reference.ip__basic_resolver_results.values_ [*values_]]]
81213     []
81214   ]
81215
81216 ]
81217
81218 [heading Friends]
81219 [table
81220   [[Name][Description]]
81221
81222   [
81223     [[link boost_asio.reference.ip__basic_resolver_results.operator_not__eq_ [*operator!=]]]
81224     [Test two iterators for inequality. ]
81225   ]
81226   
81227   [
81228     [[link boost_asio.reference.ip__basic_resolver_results.operator_eq__eq_ [*operator==]]]
81229     [Test two iterators for equality. ]
81230   ]
81231   
81232 ]
81233
81234 The [link boost_asio.reference.ip__basic_resolver_results `ip::basic_resolver_results`] class template is used to define a range over the results returned by a resolver.
81235
81236 The iterator's value\_type, obtained when a results iterator is dereferenced, is:
81237
81238    const basic_resolver_entry<InternetProtocol> 
81239
81240
81241
81242
81243
81244 [heading Remarks]
81245       
81246 For backward compatibility, [link boost_asio.reference.ip__basic_resolver_results `ip::basic_resolver_results`] is derived from [link boost_asio.reference.ip__basic_resolver_iterator `ip::basic_resolver_iterator`]. This derivation is deprecated.
81247
81248
81249 [heading Thread Safety]
81250   
81251 ['Distinct] ['objects:] Safe.
81252
81253 ['Shared] ['objects:] Unsafe. 
81254
81255
81256
81257
81258 [heading Requirements]
81259
81260 ['Header: ][^boost/asio/ip/basic_resolver.hpp]
81261
81262 ['Convenience header: ][^boost/asio.hpp]
81263
81264
81265 [endsect]
81266
81267
81268
81269 [section:v4_mapped ip::basic_resolver::v4_mapped]
81270
81271
81272 ['Inherited from ip::resolver_base.]
81273
81274 [indexterm2 boost_asio.indexterm.ip__basic_resolver.v4_mapped..v4_mapped..ip::basic_resolver] 
81275 If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. 
81276
81277
81278   static const flags v4_mapped = implementation_defined;
81279
81280
81281
81282 [endsect]
81283
81284
81285
81286 [section:_basic_resolver ip::basic_resolver::~basic_resolver]
81287
81288 [indexterm2 boost_asio.indexterm.ip__basic_resolver._basic_resolver..~basic_resolver..ip::basic_resolver] 
81289 Destroys the resolver. 
81290
81291
81292   ~basic_resolver();
81293
81294
81295 This function destroys the resolver, cancelling any outstanding asynchronous wait operations associated with the resolver as if by calling `cancel`. 
81296
81297
81298 [endsect]
81299
81300
81301
81302 [endsect]
81303
81304 [section:ip__basic_resolver__rebind_executor ip::basic_resolver::rebind_executor]
81305
81306
81307 Rebinds the resolver type to another executor. 
81308
81309
81310   template<
81311       typename ``[link boost_asio.reference.Executor1 Executor1]``>
81312   struct rebind_executor
81313
81314
81315 [heading Types]
81316 [table
81317   [[Name][Description]]
81318
81319   [
81320
81321     [[link boost_asio.reference.ip__basic_resolver__rebind_executor.other [*other]]]
81322     [The resolver type when rebound to the specified executor. ]
81323   
81324   ]
81325
81326 ]
81327
81328 [heading Requirements]
81329
81330 ['Header: ][^boost/asio/ip/basic_resolver.hpp]
81331
81332 ['Convenience header: ][^boost/asio.hpp]
81333
81334
81335 [section:other ip::basic_resolver::rebind_executor::other]
81336
81337 [indexterm2 boost_asio.indexterm.ip__basic_resolver__rebind_executor.other..other..ip::basic_resolver::rebind_executor] 
81338 The resolver type when rebound to the specified executor. 
81339
81340
81341   typedef basic_resolver< InternetProtocol, Executor1 > other;
81342
81343
81344 [heading Types]
81345 [table
81346   [[Name][Description]]
81347
81348   [
81349
81350     [[link boost_asio.reference.ip__basic_resolver__rebind_executor [*rebind_executor]]]
81351     [Rebinds the resolver type to another executor. ]
81352   
81353   ]
81354
81355   [
81356
81357     [[link boost_asio.reference.ip__basic_resolver.endpoint_type [*endpoint_type]]]
81358     [The endpoint type. ]
81359   
81360   ]
81361
81362   [
81363
81364     [[link boost_asio.reference.ip__basic_resolver.executor_type [*executor_type]]]
81365     [The type of the executor associated with the object. ]
81366   
81367   ]
81368
81369   [
81370
81371     [[link boost_asio.reference.ip__basic_resolver.flags [*flags]]]
81372     [A bitmask type (C++ Std \[lib.bitmask.types\]). ]
81373   
81374   ]
81375
81376   [
81377
81378     [[link boost_asio.reference.ip__basic_resolver.iterator [*iterator]]]
81379     [(Deprecated.) The iterator type. ]
81380   
81381   ]
81382
81383   [
81384
81385     [[link boost_asio.reference.ip__basic_resolver.protocol_type [*protocol_type]]]
81386     [The protocol type. ]
81387   
81388   ]
81389
81390   [
81391
81392     [[link boost_asio.reference.ip__basic_resolver.query [*query]]]
81393     [(Deprecated.) The query type. ]
81394   
81395   ]
81396
81397   [
81398
81399     [[link boost_asio.reference.ip__basic_resolver.results_type [*results_type]]]
81400     [The results type. ]
81401   
81402   ]
81403
81404 ]
81405
81406 [heading Member Functions]
81407 [table
81408   [[Name][Description]]
81409
81410   [
81411     [[link boost_asio.reference.ip__basic_resolver.async_resolve [*async_resolve]]]
81412     [(Deprecated: Use overload with separate host and service parameters.) Asynchronously perform forward resolution of a query to a list of entries. 
81413      [hr]
81414      Asynchronously perform forward resolution of a query to a list of entries. 
81415      [hr]
81416      Asynchronously perform reverse resolution of an endpoint to a list of entries. ]
81417   ]
81418   
81419   [
81420     [[link boost_asio.reference.ip__basic_resolver.basic_resolver [*basic_resolver]]]
81421     [Construct with executor. 
81422      [hr]
81423      Construct with execution context. 
81424      [hr]
81425      Move-construct a basic_resolver from another. ]
81426   ]
81427   
81428   [
81429     [[link boost_asio.reference.ip__basic_resolver.cancel [*cancel]]]
81430     [Cancel any asynchronous operations that are waiting on the resolver. ]
81431   ]
81432   
81433   [
81434     [[link boost_asio.reference.ip__basic_resolver.get_executor [*get_executor]]]
81435     [Get the executor associated with the object. ]
81436   ]
81437   
81438   [
81439     [[link boost_asio.reference.ip__basic_resolver.operator_eq_ [*operator=]]]
81440     [Move-assign a basic_resolver from another. ]
81441   ]
81442   
81443   [
81444     [[link boost_asio.reference.ip__basic_resolver.resolve [*resolve]]]
81445     [(Deprecated: Use overload with separate host and service parameters.) Perform forward resolution of a query to a list of entries. 
81446      [hr]
81447      Perform forward resolution of a query to a list of entries. 
81448      [hr]
81449      Perform reverse resolution of an endpoint to a list of entries. ]
81450   ]
81451   
81452   [
81453     [[link boost_asio.reference.ip__basic_resolver._basic_resolver [*~basic_resolver]]]
81454     [Destroys the resolver. ]
81455   ]
81456   
81457 ]
81458
81459 [heading Data Members]
81460 [table
81461   [[Name][Description]]
81462
81463   [
81464     [[link boost_asio.reference.ip__basic_resolver.address_configured [*address_configured]]]
81465     [Only return IPv4 addresses if a non-loopback IPv4 address is configured for the system. Only return IPv6 addresses if a non-loopback IPv6 address is configured for the system. ]
81466   ]
81467
81468   [
81469     [[link boost_asio.reference.ip__basic_resolver.all_matching [*all_matching]]]
81470     [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ]
81471   ]
81472
81473   [
81474     [[link boost_asio.reference.ip__basic_resolver.canonical_name [*canonical_name]]]
81475     [Determine the canonical name of the host specified in the query. ]
81476   ]
81477
81478   [
81479     [[link boost_asio.reference.ip__basic_resolver.numeric_host [*numeric_host]]]
81480     [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ]
81481   ]
81482
81483   [
81484     [[link boost_asio.reference.ip__basic_resolver.numeric_service [*numeric_service]]]
81485     [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ]
81486   ]
81487
81488   [
81489     [[link boost_asio.reference.ip__basic_resolver.passive [*passive]]]
81490     [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ]
81491   ]
81492
81493   [
81494     [[link boost_asio.reference.ip__basic_resolver.v4_mapped [*v4_mapped]]]
81495     [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ]
81496   ]
81497
81498 ]
81499
81500 The [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] class template provides the ability to resolve a query to a list of endpoints.
81501
81502
81503 [heading Thread Safety]
81504   
81505 ['Distinct] ['objects:] Safe.
81506
81507 ['Shared] ['objects:] Unsafe. 
81508
81509
81510
81511
81512 [heading Requirements]
81513
81514 ['Header: ][^boost/asio/ip/basic_resolver.hpp]
81515
81516 ['Convenience header: ][^boost/asio.hpp]
81517
81518
81519 [endsect]
81520
81521
81522
81523 [endsect]
81524
81525 [section:ip__basic_resolver_entry ip::basic_resolver_entry]
81526
81527
81528 An entry produced by a resolver. 
81529
81530
81531   template<
81532       typename ``[link boost_asio.reference.InternetProtocol InternetProtocol]``>
81533   class basic_resolver_entry
81534
81535
81536 [heading Types]
81537 [table
81538   [[Name][Description]]
81539
81540   [
81541
81542     [[link boost_asio.reference.ip__basic_resolver_entry.endpoint_type [*endpoint_type]]]
81543     [The endpoint type associated with the endpoint entry. ]
81544   
81545   ]
81546
81547   [
81548
81549     [[link boost_asio.reference.ip__basic_resolver_entry.protocol_type [*protocol_type]]]
81550     [The protocol type associated with the endpoint entry. ]
81551   
81552   ]
81553
81554 ]
81555
81556 [heading Member Functions]
81557 [table
81558   [[Name][Description]]
81559
81560   [
81561     [[link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry [*basic_resolver_entry]]]
81562     [Default constructor. 
81563      [hr]
81564      Construct with specified endpoint, host name and service name. ]
81565   ]
81566   
81567   [
81568     [[link boost_asio.reference.ip__basic_resolver_entry.endpoint [*endpoint]]]
81569     [Get the endpoint associated with the entry. ]
81570   ]
81571   
81572   [
81573     [[link boost_asio.reference.ip__basic_resolver_entry.host_name [*host_name]]]
81574     [Get the host name associated with the entry. ]
81575   ]
81576   
81577   [
81578     [[link boost_asio.reference.ip__basic_resolver_entry.operator_endpoint_type [*operator endpoint_type]]]
81579     [Convert to the endpoint associated with the entry. ]
81580   ]
81581   
81582   [
81583     [[link boost_asio.reference.ip__basic_resolver_entry.service_name [*service_name]]]
81584     [Get the service name associated with the entry. ]
81585   ]
81586   
81587 ]
81588
81589 The [link boost_asio.reference.ip__basic_resolver_entry `ip::basic_resolver_entry`] class template describes an entry as returned by a resolver.
81590
81591
81592 [heading Thread Safety]
81593   
81594 ['Distinct] ['objects:] Safe.
81595
81596 ['Shared] ['objects:] Unsafe. 
81597
81598
81599
81600 [heading Requirements]
81601
81602 ['Header: ][^boost/asio/ip/basic_resolver_entry.hpp]
81603
81604 ['Convenience header: ][^boost/asio.hpp]
81605
81606 [section:basic_resolver_entry ip::basic_resolver_entry::basic_resolver_entry]
81607
81608 [indexterm2 boost_asio.indexterm.ip__basic_resolver_entry.basic_resolver_entry..basic_resolver_entry..ip::basic_resolver_entry] 
81609 Default constructor. 
81610
81611
81612   ``[link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry.overload1 basic_resolver_entry]``();
81613   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry.overload1 more...]]``
81614
81615
81616 Construct with specified endpoint, host name and service name. 
81617
81618
81619   ``[link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry.overload2 basic_resolver_entry]``(
81620       const endpoint_type & ep,
81621       string_view host,
81622       string_view service);
81623   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry.overload2 more...]]``
81624
81625
81626 [section:overload1 ip::basic_resolver_entry::basic_resolver_entry (1 of 2 overloads)]
81627
81628
81629 Default constructor. 
81630
81631
81632   basic_resolver_entry();
81633
81634
81635
81636 [endsect]
81637
81638
81639
81640 [section:overload2 ip::basic_resolver_entry::basic_resolver_entry (2 of 2 overloads)]
81641
81642
81643 Construct with specified endpoint, host name and service name. 
81644
81645
81646   basic_resolver_entry(
81647       const endpoint_type & ep,
81648       string_view host,
81649       string_view service);
81650
81651
81652
81653 [endsect]
81654
81655
81656 [endsect]
81657
81658
81659 [section:endpoint ip::basic_resolver_entry::endpoint]
81660
81661 [indexterm2 boost_asio.indexterm.ip__basic_resolver_entry.endpoint..endpoint..ip::basic_resolver_entry] 
81662 Get the endpoint associated with the entry. 
81663
81664
81665   endpoint_type endpoint() const;
81666
81667
81668
81669 [endsect]
81670
81671
81672
81673 [section:endpoint_type ip::basic_resolver_entry::endpoint_type]
81674
81675 [indexterm2 boost_asio.indexterm.ip__basic_resolver_entry.endpoint_type..endpoint_type..ip::basic_resolver_entry] 
81676 The endpoint type associated with the endpoint entry. 
81677
81678
81679   typedef InternetProtocol::endpoint endpoint_type;
81680
81681
81682
81683 [heading Requirements]
81684
81685 ['Header: ][^boost/asio/ip/basic_resolver_entry.hpp]
81686
81687 ['Convenience header: ][^boost/asio.hpp]
81688
81689
81690 [endsect]
81691
81692
81693 [section:host_name ip::basic_resolver_entry::host_name]
81694
81695 [indexterm2 boost_asio.indexterm.ip__basic_resolver_entry.host_name..host_name..ip::basic_resolver_entry] 
81696 Get the host name associated with the entry. 
81697
81698
81699   std::string ``[link boost_asio.reference.ip__basic_resolver_entry.host_name.overload1 host_name]``() const;
81700   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_entry.host_name.overload1 more...]]``
81701
81702   template<
81703       class Allocator>
81704   std::basic_string< char, std::char_traits< char >, Allocator > ``[link boost_asio.reference.ip__basic_resolver_entry.host_name.overload2 host_name]``(
81705       const Allocator & alloc = Allocator()) const;
81706   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_entry.host_name.overload2 more...]]``
81707
81708
81709 [section:overload1 ip::basic_resolver_entry::host_name (1 of 2 overloads)]
81710
81711
81712 Get the host name associated with the entry. 
81713
81714
81715   std::string host_name() const;
81716
81717
81718
81719 [endsect]
81720
81721
81722
81723 [section:overload2 ip::basic_resolver_entry::host_name (2 of 2 overloads)]
81724
81725
81726 Get the host name associated with the entry. 
81727
81728
81729   template<
81730       class Allocator>
81731   std::basic_string< char, std::char_traits< char >, Allocator > host_name(
81732       const Allocator & alloc = Allocator()) const;
81733
81734
81735
81736 [endsect]
81737
81738
81739 [endsect]
81740
81741
81742 [section:operator_endpoint_type ip::basic_resolver_entry::operator endpoint_type]
81743
81744 [indexterm2 boost_asio.indexterm.ip__basic_resolver_entry.operator_endpoint_type..operator endpoint_type..ip::basic_resolver_entry] 
81745 Convert to the endpoint associated with the entry. 
81746
81747
81748   operator endpoint_type() const;
81749
81750
81751
81752 [endsect]
81753
81754
81755
81756 [section:protocol_type ip::basic_resolver_entry::protocol_type]
81757
81758 [indexterm2 boost_asio.indexterm.ip__basic_resolver_entry.protocol_type..protocol_type..ip::basic_resolver_entry] 
81759 The protocol type associated with the endpoint entry. 
81760
81761
81762   typedef InternetProtocol protocol_type;
81763
81764
81765
81766 [heading Requirements]
81767
81768 ['Header: ][^boost/asio/ip/basic_resolver_entry.hpp]
81769
81770 ['Convenience header: ][^boost/asio.hpp]
81771
81772
81773 [endsect]
81774
81775
81776 [section:service_name ip::basic_resolver_entry::service_name]
81777
81778 [indexterm2 boost_asio.indexterm.ip__basic_resolver_entry.service_name..service_name..ip::basic_resolver_entry] 
81779 Get the service name associated with the entry. 
81780
81781
81782   std::string ``[link boost_asio.reference.ip__basic_resolver_entry.service_name.overload1 service_name]``() const;
81783   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_entry.service_name.overload1 more...]]``
81784
81785   template<
81786       class Allocator>
81787   std::basic_string< char, std::char_traits< char >, Allocator > ``[link boost_asio.reference.ip__basic_resolver_entry.service_name.overload2 service_name]``(
81788       const Allocator & alloc = Allocator()) const;
81789   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_entry.service_name.overload2 more...]]``
81790
81791
81792 [section:overload1 ip::basic_resolver_entry::service_name (1 of 2 overloads)]
81793
81794
81795 Get the service name associated with the entry. 
81796
81797
81798   std::string service_name() const;
81799
81800
81801
81802 [endsect]
81803
81804
81805
81806 [section:overload2 ip::basic_resolver_entry::service_name (2 of 2 overloads)]
81807
81808
81809 Get the service name associated with the entry. 
81810
81811
81812   template<
81813       class Allocator>
81814   std::basic_string< char, std::char_traits< char >, Allocator > service_name(
81815       const Allocator & alloc = Allocator()) const;
81816
81817
81818
81819 [endsect]
81820
81821
81822 [endsect]
81823
81824
81825 [endsect]
81826
81827 [section:ip__basic_resolver_iterator ip::basic_resolver_iterator]
81828
81829
81830 An iterator over the entries produced by a resolver. 
81831
81832
81833   template<
81834       typename ``[link boost_asio.reference.InternetProtocol InternetProtocol]``>
81835   class basic_resolver_iterator
81836
81837
81838 [heading Types]
81839 [table
81840   [[Name][Description]]
81841
81842   [
81843
81844     [[link boost_asio.reference.ip__basic_resolver_iterator.difference_type [*difference_type]]]
81845     [The type used for the distance between two iterators. ]
81846   
81847   ]
81848
81849   [
81850
81851     [[link boost_asio.reference.ip__basic_resolver_iterator.iterator_category [*iterator_category]]]
81852     [The iterator category. ]
81853   
81854   ]
81855
81856   [
81857
81858     [[link boost_asio.reference.ip__basic_resolver_iterator.pointer [*pointer]]]
81859     [The type of the result of applying operator->() to the iterator. ]
81860   
81861   ]
81862
81863   [
81864
81865     [[link boost_asio.reference.ip__basic_resolver_iterator.reference [*reference]]]
81866     [The type of the result of applying operator*() to the iterator. ]
81867   
81868   ]
81869
81870   [
81871
81872     [[link boost_asio.reference.ip__basic_resolver_iterator.value_type [*value_type]]]
81873     [The type of the value pointed to by the iterator. ]
81874   
81875   ]
81876
81877 ]
81878
81879 [heading Member Functions]
81880 [table
81881   [[Name][Description]]
81882
81883   [
81884     [[link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator [*basic_resolver_iterator]]]
81885     [Default constructor creates an end iterator. 
81886      [hr]
81887      Copy constructor. 
81888      [hr]
81889      Move constructor. ]
81890   ]
81891   
81892   [
81893     [[link boost_asio.reference.ip__basic_resolver_iterator.operator__star_ [*operator *]]]
81894     [Dereference an iterator. ]
81895   ]
81896   
81897   [
81898     [[link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_ [*operator++]]]
81899     [Increment operator (prefix). 
81900      [hr]
81901      Increment operator (postfix). ]
81902   ]
81903   
81904   [
81905     [[link boost_asio.reference.ip__basic_resolver_iterator.operator_arrow_ [*operator->]]]
81906     [Dereference an iterator. ]
81907   ]
81908   
81909   [
81910     [[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq_ [*operator=]]]
81911     [Assignment operator. 
81912      [hr]
81913      Move-assignment operator. ]
81914   ]
81915   
81916 ]
81917
81918 [heading Protected Member Functions]
81919 [table
81920   [[Name][Description]]
81921
81922   [
81923     [[link boost_asio.reference.ip__basic_resolver_iterator.dereference [*dereference]]]
81924     []
81925   ]
81926   
81927   [
81928     [[link boost_asio.reference.ip__basic_resolver_iterator.equal [*equal]]]
81929     []
81930   ]
81931   
81932   [
81933     [[link boost_asio.reference.ip__basic_resolver_iterator.increment [*increment]]]
81934     []
81935   ]
81936   
81937 ]
81938
81939 [heading Protected Data Members]
81940 [table
81941   [[Name][Description]]
81942
81943   [
81944     [[link boost_asio.reference.ip__basic_resolver_iterator.index_ [*index_]]]
81945     []
81946   ]
81947
81948   [
81949     [[link boost_asio.reference.ip__basic_resolver_iterator.values_ [*values_]]]
81950     []
81951   ]
81952
81953 ]
81954
81955 [heading Friends]
81956 [table
81957   [[Name][Description]]
81958
81959   [
81960     [[link boost_asio.reference.ip__basic_resolver_iterator.operator_not__eq_ [*operator!=]]]
81961     [Test two iterators for inequality. ]
81962   ]
81963   
81964   [
81965     [[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq__eq_ [*operator==]]]
81966     [Test two iterators for equality. ]
81967   ]
81968   
81969 ]
81970
81971 The [link boost_asio.reference.ip__basic_resolver_iterator `ip::basic_resolver_iterator`] class template is used to define iterators over the results returned by a resolver.
81972
81973 The iterator's value\_type, obtained when the iterator is dereferenced, is: 
81974
81975    const basic_resolver_entry<InternetProtocol> 
81976
81977
81978
81979
81980
81981 [heading Thread Safety]
81982   
81983 ['Distinct] ['objects:] Safe.
81984
81985 ['Shared] ['objects:] Unsafe. 
81986
81987
81988
81989 [heading Requirements]
81990
81991 ['Header: ][^boost/asio/ip/basic_resolver_iterator.hpp]
81992
81993 ['Convenience header: ][^boost/asio.hpp]
81994
81995 [section:basic_resolver_iterator ip::basic_resolver_iterator::basic_resolver_iterator]
81996
81997 [indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.basic_resolver_iterator..basic_resolver_iterator..ip::basic_resolver_iterator] 
81998 Default constructor creates an end iterator. 
81999
82000
82001   ``[link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator.overload1 basic_resolver_iterator]``();
82002   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator.overload1 more...]]``
82003
82004
82005 Copy constructor. 
82006
82007
82008   ``[link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator.overload2 basic_resolver_iterator]``(
82009       const basic_resolver_iterator & other);
82010   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator.overload2 more...]]``
82011
82012
82013 Move constructor. 
82014
82015
82016   ``[link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator.overload3 basic_resolver_iterator]``(
82017       basic_resolver_iterator && other);
82018   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator.overload3 more...]]``
82019
82020
82021 [section:overload1 ip::basic_resolver_iterator::basic_resolver_iterator (1 of 3 overloads)]
82022
82023
82024 Default constructor creates an end iterator. 
82025
82026
82027   basic_resolver_iterator();
82028
82029
82030
82031 [endsect]
82032
82033
82034
82035 [section:overload2 ip::basic_resolver_iterator::basic_resolver_iterator (2 of 3 overloads)]
82036
82037
82038 Copy constructor. 
82039
82040
82041   basic_resolver_iterator(
82042       const basic_resolver_iterator & other);
82043
82044
82045
82046 [endsect]
82047
82048
82049
82050 [section:overload3 ip::basic_resolver_iterator::basic_resolver_iterator (3 of 3 overloads)]
82051
82052
82053 Move constructor. 
82054
82055
82056   basic_resolver_iterator(
82057       basic_resolver_iterator && other);
82058
82059
82060
82061 [endsect]
82062
82063
82064 [endsect]
82065
82066
82067 [section:dereference ip::basic_resolver_iterator::dereference]
82068
82069 [indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.dereference..dereference..ip::basic_resolver_iterator] 
82070
82071   const basic_resolver_entry< InternetProtocol > & dereference() const;
82072
82073
82074
82075 [endsect]
82076
82077
82078
82079 [section:difference_type ip::basic_resolver_iterator::difference_type]
82080
82081 [indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.difference_type..difference_type..ip::basic_resolver_iterator] 
82082 The type used for the distance between two iterators. 
82083
82084
82085   typedef std::ptrdiff_t difference_type;
82086
82087
82088
82089 [heading Requirements]
82090
82091 ['Header: ][^boost/asio/ip/basic_resolver_iterator.hpp]
82092
82093 ['Convenience header: ][^boost/asio.hpp]
82094
82095
82096 [endsect]
82097
82098
82099
82100 [section:equal ip::basic_resolver_iterator::equal]
82101
82102 [indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.equal..equal..ip::basic_resolver_iterator] 
82103
82104   bool equal(
82105       const basic_resolver_iterator & other) const;
82106
82107
82108
82109 [endsect]
82110
82111
82112
82113 [section:increment ip::basic_resolver_iterator::increment]
82114
82115 [indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.increment..increment..ip::basic_resolver_iterator] 
82116
82117   void increment();
82118
82119
82120
82121 [endsect]
82122
82123
82124
82125 [section:index_ ip::basic_resolver_iterator::index_]
82126
82127 [indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.index_..index_..ip::basic_resolver_iterator] 
82128
82129   std::size_t index_;
82130
82131
82132
82133 [endsect]
82134
82135
82136
82137 [section:iterator_category ip::basic_resolver_iterator::iterator_category]
82138
82139 [indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.iterator_category..iterator_category..ip::basic_resolver_iterator] 
82140 The iterator category. 
82141
82142
82143   typedef std::forward_iterator_tag iterator_category;
82144
82145
82146
82147 [heading Requirements]
82148
82149 ['Header: ][^boost/asio/ip/basic_resolver_iterator.hpp]
82150
82151 ['Convenience header: ][^boost/asio.hpp]
82152
82153
82154 [endsect]
82155
82156
82157
82158 [section:operator__star_ ip::basic_resolver_iterator::operator *]
82159
82160 [indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.operator__star_..operator *..ip::basic_resolver_iterator] 
82161 Dereference an iterator. 
82162
82163
82164   const basic_resolver_entry< InternetProtocol > & operator *() const;
82165
82166
82167
82168 [endsect]
82169
82170
82171
82172 [section:operator_not__eq_ ip::basic_resolver_iterator::operator!=]
82173
82174 [indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.operator_not__eq_..operator!=..ip::basic_resolver_iterator] 
82175 Test two iterators for inequality. 
82176
82177
82178   friend bool operator!=(
82179       const basic_resolver_iterator & a,
82180       const basic_resolver_iterator & b);
82181
82182
82183 [heading Requirements]
82184
82185 ['Header: ][^boost/asio/ip/basic_resolver_iterator.hpp]
82186
82187 ['Convenience header: ][^boost/asio.hpp]
82188
82189
82190 [endsect]
82191
82192
82193 [section:operator_plus__plus_ ip::basic_resolver_iterator::operator++]
82194
82195 [indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.operator_plus__plus_..operator++..ip::basic_resolver_iterator] 
82196 Increment operator (prefix). 
82197
82198
82199   basic_resolver_iterator & ``[link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_.overload1 operator++]``();
82200   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_.overload1 more...]]``
82201
82202
82203 Increment operator (postfix). 
82204
82205
82206   basic_resolver_iterator ``[link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_.overload2 operator++]``(
82207       int );
82208   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_.overload2 more...]]``
82209
82210
82211 [section:overload1 ip::basic_resolver_iterator::operator++ (1 of 2 overloads)]
82212
82213
82214 Increment operator (prefix). 
82215
82216
82217   basic_resolver_iterator & operator++();
82218
82219
82220
82221 [endsect]
82222
82223
82224
82225 [section:overload2 ip::basic_resolver_iterator::operator++ (2 of 2 overloads)]
82226
82227
82228 Increment operator (postfix). 
82229
82230
82231   basic_resolver_iterator operator++(
82232       int );
82233
82234
82235
82236 [endsect]
82237
82238
82239 [endsect]
82240
82241
82242 [section:operator_arrow_ ip::basic_resolver_iterator::operator->]
82243
82244 [indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.operator_arrow_..operator->..ip::basic_resolver_iterator] 
82245 Dereference an iterator. 
82246
82247
82248   const basic_resolver_entry< InternetProtocol > * operator->() const;
82249
82250
82251
82252 [endsect]
82253
82254
82255 [section:operator_eq_ ip::basic_resolver_iterator::operator=]
82256
82257 [indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.operator_eq_..operator=..ip::basic_resolver_iterator] 
82258 Assignment operator. 
82259
82260
82261   basic_resolver_iterator & ``[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq_.overload1 operator=]``(
82262       const basic_resolver_iterator & other);
82263   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_iterator.operator_eq_.overload1 more...]]``
82264
82265
82266 Move-assignment operator. 
82267
82268
82269   basic_resolver_iterator & ``[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq_.overload2 operator=]``(
82270       basic_resolver_iterator && other);
82271   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_iterator.operator_eq_.overload2 more...]]``
82272
82273
82274 [section:overload1 ip::basic_resolver_iterator::operator= (1 of 2 overloads)]
82275
82276
82277 Assignment operator. 
82278
82279
82280   basic_resolver_iterator & operator=(
82281       const basic_resolver_iterator & other);
82282
82283
82284
82285 [endsect]
82286
82287
82288
82289 [section:overload2 ip::basic_resolver_iterator::operator= (2 of 2 overloads)]
82290
82291
82292 Move-assignment operator. 
82293
82294
82295   basic_resolver_iterator & operator=(
82296       basic_resolver_iterator && other);
82297
82298
82299
82300 [endsect]
82301
82302
82303 [endsect]
82304
82305
82306 [section:operator_eq__eq_ ip::basic_resolver_iterator::operator==]
82307
82308 [indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.operator_eq__eq_..operator==..ip::basic_resolver_iterator] 
82309 Test two iterators for equality. 
82310
82311
82312   friend bool operator==(
82313       const basic_resolver_iterator & a,
82314       const basic_resolver_iterator & b);
82315
82316
82317 [heading Requirements]
82318
82319 ['Header: ][^boost/asio/ip/basic_resolver_iterator.hpp]
82320
82321 ['Convenience header: ][^boost/asio.hpp]
82322
82323
82324 [endsect]
82325
82326
82327
82328 [section:pointer ip::basic_resolver_iterator::pointer]
82329
82330 [indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.pointer..pointer..ip::basic_resolver_iterator] 
82331 The type of the result of applying `operator->()` to the iterator. 
82332
82333
82334   typedef const basic_resolver_entry< InternetProtocol > * pointer;
82335
82336
82337
82338 [heading Requirements]
82339
82340 ['Header: ][^boost/asio/ip/basic_resolver_iterator.hpp]
82341
82342 ['Convenience header: ][^boost/asio.hpp]
82343
82344
82345 [endsect]
82346
82347
82348
82349 [section:reference ip::basic_resolver_iterator::reference]
82350
82351 [indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.reference..reference..ip::basic_resolver_iterator] 
82352 The type of the result of applying `operator*()` to the iterator. 
82353
82354
82355   typedef const basic_resolver_entry< InternetProtocol > & reference;
82356
82357
82358 [heading Types]
82359 [table
82360   [[Name][Description]]
82361
82362   [
82363
82364     [[link boost_asio.reference.ip__basic_resolver_entry.endpoint_type [*endpoint_type]]]
82365     [The endpoint type associated with the endpoint entry. ]
82366   
82367   ]
82368
82369   [
82370
82371     [[link boost_asio.reference.ip__basic_resolver_entry.protocol_type [*protocol_type]]]
82372     [The protocol type associated with the endpoint entry. ]
82373   
82374   ]
82375
82376 ]
82377
82378 [heading Member Functions]
82379 [table
82380   [[Name][Description]]
82381
82382   [
82383     [[link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry [*basic_resolver_entry]]]
82384     [Default constructor. 
82385      [hr]
82386      Construct with specified endpoint, host name and service name. ]
82387   ]
82388   
82389   [
82390     [[link boost_asio.reference.ip__basic_resolver_entry.endpoint [*endpoint]]]
82391     [Get the endpoint associated with the entry. ]
82392   ]
82393   
82394   [
82395     [[link boost_asio.reference.ip__basic_resolver_entry.host_name [*host_name]]]
82396     [Get the host name associated with the entry. ]
82397   ]
82398   
82399   [
82400     [[link boost_asio.reference.ip__basic_resolver_entry.operator_endpoint_type [*operator endpoint_type]]]
82401     [Convert to the endpoint associated with the entry. ]
82402   ]
82403   
82404   [
82405     [[link boost_asio.reference.ip__basic_resolver_entry.service_name [*service_name]]]
82406     [Get the service name associated with the entry. ]
82407   ]
82408   
82409 ]
82410
82411 The [link boost_asio.reference.ip__basic_resolver_entry `ip::basic_resolver_entry`] class template describes an entry as returned by a resolver.
82412
82413
82414 [heading Thread Safety]
82415   
82416 ['Distinct] ['objects:] Safe.
82417
82418 ['Shared] ['objects:] Unsafe. 
82419
82420
82421
82422
82423 [heading Requirements]
82424
82425 ['Header: ][^boost/asio/ip/basic_resolver_iterator.hpp]
82426
82427 ['Convenience header: ][^boost/asio.hpp]
82428
82429
82430 [endsect]
82431
82432
82433
82434 [section:value_type ip::basic_resolver_iterator::value_type]
82435
82436 [indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.value_type..value_type..ip::basic_resolver_iterator] 
82437 The type of the value pointed to by the iterator. 
82438
82439
82440   typedef basic_resolver_entry< InternetProtocol > value_type;
82441
82442
82443 [heading Types]
82444 [table
82445   [[Name][Description]]
82446
82447   [
82448
82449     [[link boost_asio.reference.ip__basic_resolver_entry.endpoint_type [*endpoint_type]]]
82450     [The endpoint type associated with the endpoint entry. ]
82451   
82452   ]
82453
82454   [
82455
82456     [[link boost_asio.reference.ip__basic_resolver_entry.protocol_type [*protocol_type]]]
82457     [The protocol type associated with the endpoint entry. ]
82458   
82459   ]
82460
82461 ]
82462
82463 [heading Member Functions]
82464 [table
82465   [[Name][Description]]
82466
82467   [
82468     [[link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry [*basic_resolver_entry]]]
82469     [Default constructor. 
82470      [hr]
82471      Construct with specified endpoint, host name and service name. ]
82472   ]
82473   
82474   [
82475     [[link boost_asio.reference.ip__basic_resolver_entry.endpoint [*endpoint]]]
82476     [Get the endpoint associated with the entry. ]
82477   ]
82478   
82479   [
82480     [[link boost_asio.reference.ip__basic_resolver_entry.host_name [*host_name]]]
82481     [Get the host name associated with the entry. ]
82482   ]
82483   
82484   [
82485     [[link boost_asio.reference.ip__basic_resolver_entry.operator_endpoint_type [*operator endpoint_type]]]
82486     [Convert to the endpoint associated with the entry. ]
82487   ]
82488   
82489   [
82490     [[link boost_asio.reference.ip__basic_resolver_entry.service_name [*service_name]]]
82491     [Get the service name associated with the entry. ]
82492   ]
82493   
82494 ]
82495
82496 The [link boost_asio.reference.ip__basic_resolver_entry `ip::basic_resolver_entry`] class template describes an entry as returned by a resolver.
82497
82498
82499 [heading Thread Safety]
82500   
82501 ['Distinct] ['objects:] Safe.
82502
82503 ['Shared] ['objects:] Unsafe. 
82504
82505
82506
82507
82508 [heading Requirements]
82509
82510 ['Header: ][^boost/asio/ip/basic_resolver_iterator.hpp]
82511
82512 ['Convenience header: ][^boost/asio.hpp]
82513
82514
82515 [endsect]
82516
82517
82518
82519 [section:values_ ip::basic_resolver_iterator::values_]
82520
82521 [indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.values_..values_..ip::basic_resolver_iterator] 
82522
82523   values_ptr_type values_;
82524
82525
82526
82527 [endsect]
82528
82529
82530
82531 [endsect]
82532
82533 [section:ip__basic_resolver_query ip::basic_resolver_query]
82534
82535
82536 An query to be passed to a resolver. 
82537
82538
82539   template<
82540       typename ``[link boost_asio.reference.InternetProtocol InternetProtocol]``>
82541   class basic_resolver_query :
82542     public ip::resolver_query_base
82543
82544
82545 [heading Types]
82546 [table
82547   [[Name][Description]]
82548
82549   [
82550
82551     [[link boost_asio.reference.ip__basic_resolver_query.flags [*flags]]]
82552     [A bitmask type (C++ Std \[lib.bitmask.types\]). ]
82553   
82554   ]
82555
82556   [
82557
82558     [[link boost_asio.reference.ip__basic_resolver_query.protocol_type [*protocol_type]]]
82559     [The protocol type associated with the endpoint query. ]
82560   
82561   ]
82562
82563 ]
82564
82565 [heading Member Functions]
82566 [table
82567   [[Name][Description]]
82568
82569   [
82570     [[link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query [*basic_resolver_query]]]
82571     [Construct with specified service name for any protocol. 
82572      [hr]
82573      Construct with specified service name for a given protocol. 
82574      [hr]
82575      Construct with specified host name and service name for any protocol. 
82576      [hr]
82577      Construct with specified host name and service name for a given protocol. ]
82578   ]
82579   
82580   [
82581     [[link boost_asio.reference.ip__basic_resolver_query.hints [*hints]]]
82582     [Get the hints associated with the query. ]
82583   ]
82584   
82585   [
82586     [[link boost_asio.reference.ip__basic_resolver_query.host_name [*host_name]]]
82587     [Get the host name associated with the query. ]
82588   ]
82589   
82590   [
82591     [[link boost_asio.reference.ip__basic_resolver_query.service_name [*service_name]]]
82592     [Get the service name associated with the query. ]
82593   ]
82594   
82595 ]
82596
82597 [heading Data Members]
82598 [table
82599   [[Name][Description]]
82600
82601   [
82602     [[link boost_asio.reference.ip__basic_resolver_query.address_configured [*address_configured]]]
82603     [Only return IPv4 addresses if a non-loopback IPv4 address is configured for the system. Only return IPv6 addresses if a non-loopback IPv6 address is configured for the system. ]
82604   ]
82605
82606   [
82607     [[link boost_asio.reference.ip__basic_resolver_query.all_matching [*all_matching]]]
82608     [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ]
82609   ]
82610
82611   [
82612     [[link boost_asio.reference.ip__basic_resolver_query.canonical_name [*canonical_name]]]
82613     [Determine the canonical name of the host specified in the query. ]
82614   ]
82615
82616   [
82617     [[link boost_asio.reference.ip__basic_resolver_query.numeric_host [*numeric_host]]]
82618     [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ]
82619   ]
82620
82621   [
82622     [[link boost_asio.reference.ip__basic_resolver_query.numeric_service [*numeric_service]]]
82623     [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ]
82624   ]
82625
82626   [
82627     [[link boost_asio.reference.ip__basic_resolver_query.passive [*passive]]]
82628     [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ]
82629   ]
82630
82631   [
82632     [[link boost_asio.reference.ip__basic_resolver_query.v4_mapped [*v4_mapped]]]
82633     [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ]
82634   ]
82635
82636 ]
82637
82638 The [link boost_asio.reference.ip__basic_resolver_query `ip::basic_resolver_query`] class template describes a query that can be passed to a resolver.
82639
82640
82641 [heading Thread Safety]
82642   
82643 ['Distinct] ['objects:] Safe.
82644
82645 ['Shared] ['objects:] Unsafe. 
82646
82647
82648
82649 [heading Requirements]
82650
82651 ['Header: ][^boost/asio/ip/basic_resolver_query.hpp]
82652
82653 ['Convenience header: ][^boost/asio.hpp]
82654
82655
82656 [section:address_configured ip::basic_resolver_query::address_configured]
82657
82658
82659 ['Inherited from ip::resolver_base.]
82660
82661 [indexterm2 boost_asio.indexterm.ip__basic_resolver_query.address_configured..address_configured..ip::basic_resolver_query] 
82662 Only return IPv4 addresses if a non-loopback IPv4 address is configured for the system. Only return IPv6 addresses if a non-loopback IPv6 address is configured for the system. 
82663
82664
82665   static const flags address_configured = implementation_defined;
82666
82667
82668
82669 [endsect]
82670
82671
82672
82673 [section:all_matching ip::basic_resolver_query::all_matching]
82674
82675
82676 ['Inherited from ip::resolver_base.]
82677
82678 [indexterm2 boost_asio.indexterm.ip__basic_resolver_query.all_matching..all_matching..ip::basic_resolver_query] 
82679 If used with v4\_mapped, return all matching IPv6 and IPv4 addresses. 
82680
82681
82682   static const flags all_matching = implementation_defined;
82683
82684
82685
82686 [endsect]
82687
82688
82689 [section:basic_resolver_query ip::basic_resolver_query::basic_resolver_query]
82690
82691 [indexterm2 boost_asio.indexterm.ip__basic_resolver_query.basic_resolver_query..basic_resolver_query..ip::basic_resolver_query] 
82692 Construct with specified service name for any protocol. 
82693
82694
82695   ``[link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload1 basic_resolver_query]``(
82696       const std::string & service,
82697       resolver_query_base::flags resolve_flags = passive|address_configured);
82698   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload1 more...]]``
82699
82700
82701 Construct with specified service name for a given protocol. 
82702
82703
82704   ``[link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload2 basic_resolver_query]``(
82705       const protocol_type & protocol,
82706       const std::string & service,
82707       resolver_query_base::flags resolve_flags = passive|address_configured);
82708   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload2 more...]]``
82709
82710
82711 Construct with specified host name and service name for any protocol. 
82712
82713
82714   ``[link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload3 basic_resolver_query]``(
82715       const std::string & host,
82716       const std::string & service,
82717       resolver_query_base::flags resolve_flags = address_configured);
82718   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload3 more...]]``
82719
82720
82721 Construct with specified host name and service name for a given protocol. 
82722
82723
82724   ``[link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload4 basic_resolver_query]``(
82725       const protocol_type & protocol,
82726       const std::string & host,
82727       const std::string & service,
82728       resolver_query_base::flags resolve_flags = address_configured);
82729   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload4 more...]]``
82730
82731
82732 [section:overload1 ip::basic_resolver_query::basic_resolver_query (1 of 4 overloads)]
82733
82734
82735 Construct with specified service name for any protocol. 
82736
82737
82738   basic_resolver_query(
82739       const std::string & service,
82740       resolver_query_base::flags resolve_flags = passive|address_configured);
82741
82742
82743 This constructor is typically used to perform name resolution for local service binding.
82744
82745
82746 [heading Parameters]
82747     
82748
82749 [variablelist
82750   
82751 [[service][A string identifying the requested service. This may be a descriptive name or a numeric string corresponding to a port number.]]
82752
82753 [[resolve_flags][A set of flags that determine how name resolution should be performed. The default flags are suitable for local service binding.]]
82754
82755 ]
82756
82757
82758 [heading Remarks]
82759       
82760 On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names. 
82761
82762
82763
82764
82765 [endsect]
82766
82767
82768
82769 [section:overload2 ip::basic_resolver_query::basic_resolver_query (2 of 4 overloads)]
82770
82771
82772 Construct with specified service name for a given protocol. 
82773
82774
82775   basic_resolver_query(
82776       const protocol_type & protocol,
82777       const std::string & service,
82778       resolver_query_base::flags resolve_flags = passive|address_configured);
82779
82780
82781 This constructor is typically used to perform name resolution for local service binding with a specific protocol version.
82782
82783
82784 [heading Parameters]
82785     
82786
82787 [variablelist
82788   
82789 [[protocol][A protocol object, normally representing either the IPv4 or IPv6 version of an internet protocol.]]
82790
82791 [[service][A string identifying the requested service. This may be a descriptive name or a numeric string corresponding to a port number.]]
82792
82793 [[resolve_flags][A set of flags that determine how name resolution should be performed. The default flags are suitable for local service binding.]]
82794
82795 ]
82796
82797
82798 [heading Remarks]
82799       
82800 On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names. 
82801
82802
82803
82804
82805 [endsect]
82806
82807
82808
82809 [section:overload3 ip::basic_resolver_query::basic_resolver_query (3 of 4 overloads)]
82810
82811
82812 Construct with specified host name and service name for any protocol. 
82813
82814
82815   basic_resolver_query(
82816       const std::string & host,
82817       const std::string & service,
82818       resolver_query_base::flags resolve_flags = address_configured);
82819
82820
82821 This constructor is typically used to perform name resolution for communication with remote hosts.
82822
82823
82824 [heading Parameters]
82825     
82826
82827 [variablelist
82828   
82829 [[host][A string identifying a location. May be a descriptive name or a numeric address string. If an empty string and the passive flag has been specified, the resolved endpoints are suitable for local service binding. If an empty string and passive is not specified, the resolved endpoints will use the loopback address.]]
82830
82831 [[service][A string identifying the requested service. This may be a descriptive name or a numeric string corresponding to a port number. May be an empty string, in which case all resolved endpoints will have a port number of 0.]]
82832
82833 [[resolve_flags][A set of flags that determine how name resolution should be performed. The default flags are suitable for communication with remote hosts.]]
82834
82835 ]
82836
82837
82838 [heading Remarks]
82839       
82840 On POSIX systems, host names may be locally defined in the file `/etc/hosts`. On Windows, host names may be defined in the file `c:\windows\system32\drivers\etc\hosts`. Remote host name resolution is performed using DNS. Operating systems may use additional locations when resolving host names (such as NETBIOS names on Windows).
82841
82842 On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names. 
82843
82844
82845 [endsect]
82846
82847
82848
82849 [section:overload4 ip::basic_resolver_query::basic_resolver_query (4 of 4 overloads)]
82850
82851
82852 Construct with specified host name and service name for a given protocol. 
82853
82854
82855   basic_resolver_query(
82856       const protocol_type & protocol,
82857       const std::string & host,
82858       const std::string & service,
82859       resolver_query_base::flags resolve_flags = address_configured);
82860
82861
82862 This constructor is typically used to perform name resolution for communication with remote hosts.
82863
82864
82865 [heading Parameters]
82866     
82867
82868 [variablelist
82869   
82870 [[protocol][A protocol object, normally representing either the IPv4 or IPv6 version of an internet protocol.]]
82871
82872 [[host][A string identifying a location. May be a descriptive name or a numeric address string. If an empty string and the passive flag has been specified, the resolved endpoints are suitable for local service binding. If an empty string and passive is not specified, the resolved endpoints will use the loopback address.]]
82873
82874 [[service][A string identifying the requested service. This may be a descriptive name or a numeric string corresponding to a port number. May be an empty string, in which case all resolved endpoints will have a port number of 0.]]
82875
82876 [[resolve_flags][A set of flags that determine how name resolution should be performed. The default flags are suitable for communication with remote hosts.]]
82877
82878 ]
82879
82880
82881 [heading Remarks]
82882       
82883 On POSIX systems, host names may be locally defined in the file `/etc/hosts`. On Windows, host names may be defined in the file `c:\windows\system32\drivers\etc\hosts`. Remote host name resolution is performed using DNS. Operating systems may use additional locations when resolving host names (such as NETBIOS names on Windows).
82884
82885 On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names. 
82886
82887
82888 [endsect]
82889
82890
82891 [endsect]
82892
82893
82894 [section:canonical_name ip::basic_resolver_query::canonical_name]
82895
82896
82897 ['Inherited from ip::resolver_base.]
82898
82899 [indexterm2 boost_asio.indexterm.ip__basic_resolver_query.canonical_name..canonical_name..ip::basic_resolver_query] 
82900 Determine the canonical name of the host specified in the query. 
82901
82902
82903   static const flags canonical_name = implementation_defined;
82904
82905
82906
82907 [endsect]
82908
82909
82910
82911 [section:flags ip::basic_resolver_query::flags]
82912
82913
82914 ['Inherited from ip::resolver_base.]
82915
82916 [indexterm2 boost_asio.indexterm.ip__basic_resolver_query.flags..flags..ip::basic_resolver_query] 
82917 A bitmask type (C++ Std [lib.bitmask.types]). 
82918
82919
82920   typedef unspecified flags;
82921
82922
82923
82924 [heading Requirements]
82925
82926 ['Header: ][^boost/asio/ip/basic_resolver_query.hpp]
82927
82928 ['Convenience header: ][^boost/asio.hpp]
82929
82930
82931 [endsect]
82932
82933
82934
82935 [section:hints ip::basic_resolver_query::hints]
82936
82937 [indexterm2 boost_asio.indexterm.ip__basic_resolver_query.hints..hints..ip::basic_resolver_query] 
82938 Get the hints associated with the query. 
82939
82940
82941   const boost::asio::detail::addrinfo_type & hints() const;
82942
82943
82944
82945 [endsect]
82946
82947
82948
82949 [section:host_name ip::basic_resolver_query::host_name]
82950
82951 [indexterm2 boost_asio.indexterm.ip__basic_resolver_query.host_name..host_name..ip::basic_resolver_query] 
82952 Get the host name associated with the query. 
82953
82954
82955   std::string host_name() const;
82956
82957
82958
82959 [endsect]
82960
82961
82962
82963 [section:numeric_host ip::basic_resolver_query::numeric_host]
82964
82965
82966 ['Inherited from ip::resolver_base.]
82967
82968 [indexterm2 boost_asio.indexterm.ip__basic_resolver_query.numeric_host..numeric_host..ip::basic_resolver_query] 
82969 Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. 
82970
82971
82972   static const flags numeric_host = implementation_defined;
82973
82974
82975
82976 [endsect]
82977
82978
82979
82980 [section:numeric_service ip::basic_resolver_query::numeric_service]
82981
82982
82983 ['Inherited from ip::resolver_base.]
82984
82985 [indexterm2 boost_asio.indexterm.ip__basic_resolver_query.numeric_service..numeric_service..ip::basic_resolver_query] 
82986 Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. 
82987
82988
82989   static const flags numeric_service = implementation_defined;
82990
82991
82992
82993 [endsect]
82994
82995
82996
82997 [section:passive ip::basic_resolver_query::passive]
82998
82999
83000 ['Inherited from ip::resolver_base.]
83001
83002 [indexterm2 boost_asio.indexterm.ip__basic_resolver_query.passive..passive..ip::basic_resolver_query] 
83003 Indicate that returned endpoint is intended for use as a locally bound socket endpoint. 
83004
83005
83006   static const flags passive = implementation_defined;
83007
83008
83009
83010 [endsect]
83011
83012
83013
83014 [section:protocol_type ip::basic_resolver_query::protocol_type]
83015
83016 [indexterm2 boost_asio.indexterm.ip__basic_resolver_query.protocol_type..protocol_type..ip::basic_resolver_query] 
83017 The protocol type associated with the endpoint query. 
83018
83019
83020   typedef InternetProtocol protocol_type;
83021
83022
83023
83024 [heading Requirements]
83025
83026 ['Header: ][^boost/asio/ip/basic_resolver_query.hpp]
83027
83028 ['Convenience header: ][^boost/asio.hpp]
83029
83030
83031 [endsect]
83032
83033
83034
83035 [section:service_name ip::basic_resolver_query::service_name]
83036
83037 [indexterm2 boost_asio.indexterm.ip__basic_resolver_query.service_name..service_name..ip::basic_resolver_query] 
83038 Get the service name associated with the query. 
83039
83040
83041   std::string service_name() const;
83042
83043
83044
83045 [endsect]
83046
83047
83048
83049 [section:v4_mapped ip::basic_resolver_query::v4_mapped]
83050
83051
83052 ['Inherited from ip::resolver_base.]
83053
83054 [indexterm2 boost_asio.indexterm.ip__basic_resolver_query.v4_mapped..v4_mapped..ip::basic_resolver_query] 
83055 If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. 
83056
83057
83058   static const flags v4_mapped = implementation_defined;
83059
83060
83061
83062 [endsect]
83063
83064
83065
83066 [endsect]
83067
83068 [section:ip__basic_resolver_results ip::basic_resolver_results]
83069
83070
83071 A range of entries produced by a resolver. 
83072
83073
83074   template<
83075       typename ``[link boost_asio.reference.InternetProtocol InternetProtocol]``>
83076   class basic_resolver_results :
83077     public ip::basic_resolver_iterator< InternetProtocol >
83078
83079
83080 [heading Types]
83081 [table
83082   [[Name][Description]]
83083
83084   [
83085
83086     [[link boost_asio.reference.ip__basic_resolver_results.const_iterator [*const_iterator]]]
83087     [The type of an iterator into the range. ]
83088   
83089   ]
83090
83091   [
83092
83093     [[link boost_asio.reference.ip__basic_resolver_results.const_reference [*const_reference]]]
83094     [The type of a const reference to a value in the range. ]
83095   
83096   ]
83097
83098   [
83099
83100     [[link boost_asio.reference.ip__basic_resolver_results.difference_type [*difference_type]]]
83101     [Type used to represent the distance between two iterators in the range. ]
83102   
83103   ]
83104
83105   [
83106
83107     [[link boost_asio.reference.ip__basic_resolver_results.endpoint_type [*endpoint_type]]]
83108     [The endpoint type associated with the results. ]
83109   
83110   ]
83111
83112   [
83113
83114     [[link boost_asio.reference.ip__basic_resolver_results.iterator [*iterator]]]
83115     [The type of an iterator into the range. ]
83116   
83117   ]
83118
83119   [
83120
83121     [[link boost_asio.reference.ip__basic_resolver_results.iterator_category [*iterator_category]]]
83122     [The iterator category. ]
83123   
83124   ]
83125
83126   [
83127
83128     [[link boost_asio.reference.ip__basic_resolver_results.pointer [*pointer]]]
83129     [The type of the result of applying operator->() to the iterator. ]
83130   
83131   ]
83132
83133   [
83134
83135     [[link boost_asio.reference.ip__basic_resolver_results.protocol_type [*protocol_type]]]
83136     [The protocol type associated with the results. ]
83137   
83138   ]
83139
83140   [
83141
83142     [[link boost_asio.reference.ip__basic_resolver_results.reference [*reference]]]
83143     [The type of a non-const reference to a value in the range. ]
83144   
83145   ]
83146
83147   [
83148
83149     [[link boost_asio.reference.ip__basic_resolver_results.size_type [*size_type]]]
83150     [Type used to represent a count of the elements in the range. ]
83151   
83152   ]
83153
83154   [
83155
83156     [[link boost_asio.reference.ip__basic_resolver_results.value_type [*value_type]]]
83157     [The type of a value in the results range. ]
83158   
83159   ]
83160
83161 ]
83162
83163 [heading Member Functions]
83164 [table
83165   [[Name][Description]]
83166
83167   [
83168     [[link boost_asio.reference.ip__basic_resolver_results.basic_resolver_results [*basic_resolver_results]]]
83169     [Default constructor creates an empty range. 
83170      [hr]
83171      Copy constructor. 
83172      [hr]
83173      Move constructor. ]
83174   ]
83175   
83176   [
83177     [[link boost_asio.reference.ip__basic_resolver_results.begin [*begin]]]
83178     [Obtain a begin iterator for the results range. ]
83179   ]
83180   
83181   [
83182     [[link boost_asio.reference.ip__basic_resolver_results.cbegin [*cbegin]]]
83183     [Obtain a begin iterator for the results range. ]
83184   ]
83185   
83186   [
83187     [[link boost_asio.reference.ip__basic_resolver_results.cend [*cend]]]
83188     [Obtain an end iterator for the results range. ]
83189   ]
83190   
83191   [
83192     [[link boost_asio.reference.ip__basic_resolver_results.empty [*empty]]]
83193     [Determine whether the results range is empty. ]
83194   ]
83195   
83196   [
83197     [[link boost_asio.reference.ip__basic_resolver_results.end [*end]]]
83198     [Obtain an end iterator for the results range. ]
83199   ]
83200   
83201   [
83202     [[link boost_asio.reference.ip__basic_resolver_results.max_size [*max_size]]]
83203     [Get the maximum number of entries permitted in a results range. ]
83204   ]
83205   
83206   [
83207     [[link boost_asio.reference.ip__basic_resolver_results.operator__star_ [*operator *]]]
83208     [Dereference an iterator. ]
83209   ]
83210   
83211   [
83212     [[link boost_asio.reference.ip__basic_resolver_results.operator_plus__plus_ [*operator++]]]
83213     [Increment operator (prefix). 
83214      [hr]
83215      Increment operator (postfix). ]
83216   ]
83217   
83218   [
83219     [[link boost_asio.reference.ip__basic_resolver_results.operator_arrow_ [*operator->]]]
83220     [Dereference an iterator. ]
83221   ]
83222   
83223   [
83224     [[link boost_asio.reference.ip__basic_resolver_results.operator_eq_ [*operator=]]]
83225     [Assignment operator. 
83226      [hr]
83227      Move-assignment operator. ]
83228   ]
83229   
83230   [
83231     [[link boost_asio.reference.ip__basic_resolver_results.size [*size]]]
83232     [Get the number of entries in the results range. ]
83233   ]
83234   
83235   [
83236     [[link boost_asio.reference.ip__basic_resolver_results.swap [*swap]]]
83237     [Swap the results range with another. ]
83238   ]
83239   
83240 ]
83241
83242 [heading Protected Member Functions]
83243 [table
83244   [[Name][Description]]
83245
83246   [
83247     [[link boost_asio.reference.ip__basic_resolver_results.dereference [*dereference]]]
83248     []
83249   ]
83250   
83251   [
83252     [[link boost_asio.reference.ip__basic_resolver_results.equal [*equal]]]
83253     []
83254   ]
83255   
83256   [
83257     [[link boost_asio.reference.ip__basic_resolver_results.increment [*increment]]]
83258     []
83259   ]
83260   
83261 ]
83262
83263 [heading Protected Data Members]
83264 [table
83265   [[Name][Description]]
83266
83267   [
83268     [[link boost_asio.reference.ip__basic_resolver_results.index_ [*index_]]]
83269     []
83270   ]
83271
83272   [
83273     [[link boost_asio.reference.ip__basic_resolver_results.values_ [*values_]]]
83274     []
83275   ]
83276
83277 ]
83278
83279 [heading Friends]
83280 [table
83281   [[Name][Description]]
83282
83283   [
83284     [[link boost_asio.reference.ip__basic_resolver_results.operator_not__eq_ [*operator!=]]]
83285     [Test two iterators for inequality. ]
83286   ]
83287   
83288   [
83289     [[link boost_asio.reference.ip__basic_resolver_results.operator_eq__eq_ [*operator==]]]
83290     [Test two iterators for equality. ]
83291   ]
83292   
83293 ]
83294
83295 The [link boost_asio.reference.ip__basic_resolver_results `ip::basic_resolver_results`] class template is used to define a range over the results returned by a resolver.
83296
83297 The iterator's value\_type, obtained when a results iterator is dereferenced, is:
83298
83299    const basic_resolver_entry<InternetProtocol> 
83300
83301
83302
83303
83304
83305 [heading Remarks]
83306       
83307 For backward compatibility, [link boost_asio.reference.ip__basic_resolver_results `ip::basic_resolver_results`] is derived from [link boost_asio.reference.ip__basic_resolver_iterator `ip::basic_resolver_iterator`]. This derivation is deprecated.
83308
83309
83310 [heading Thread Safety]
83311   
83312 ['Distinct] ['objects:] Safe.
83313
83314 ['Shared] ['objects:] Unsafe. 
83315
83316
83317
83318 [heading Requirements]
83319
83320 ['Header: ][^boost/asio/ip/basic_resolver_results.hpp]
83321
83322 ['Convenience header: ][^boost/asio.hpp]
83323
83324 [section:basic_resolver_results ip::basic_resolver_results::basic_resolver_results]
83325
83326 [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.basic_resolver_results..basic_resolver_results..ip::basic_resolver_results] 
83327 Default constructor creates an empty range. 
83328
83329
83330   ``[link boost_asio.reference.ip__basic_resolver_results.basic_resolver_results.overload1 basic_resolver_results]``();
83331   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_results.basic_resolver_results.overload1 more...]]``
83332
83333
83334 Copy constructor. 
83335
83336
83337   ``[link boost_asio.reference.ip__basic_resolver_results.basic_resolver_results.overload2 basic_resolver_results]``(
83338       const basic_resolver_results & other);
83339   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_results.basic_resolver_results.overload2 more...]]``
83340
83341
83342 Move constructor. 
83343
83344
83345   ``[link boost_asio.reference.ip__basic_resolver_results.basic_resolver_results.overload3 basic_resolver_results]``(
83346       basic_resolver_results && other);
83347   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_results.basic_resolver_results.overload3 more...]]``
83348
83349
83350 [section:overload1 ip::basic_resolver_results::basic_resolver_results (1 of 3 overloads)]
83351
83352
83353 Default constructor creates an empty range. 
83354
83355
83356   basic_resolver_results();
83357
83358
83359
83360 [endsect]
83361
83362
83363
83364 [section:overload2 ip::basic_resolver_results::basic_resolver_results (2 of 3 overloads)]
83365
83366
83367 Copy constructor. 
83368
83369
83370   basic_resolver_results(
83371       const basic_resolver_results & other);
83372
83373
83374
83375 [endsect]
83376
83377
83378
83379 [section:overload3 ip::basic_resolver_results::basic_resolver_results (3 of 3 overloads)]
83380
83381
83382 Move constructor. 
83383
83384
83385   basic_resolver_results(
83386       basic_resolver_results && other);
83387
83388
83389
83390 [endsect]
83391
83392
83393 [endsect]
83394
83395
83396 [section:begin ip::basic_resolver_results::begin]
83397
83398 [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.begin..begin..ip::basic_resolver_results] 
83399 Obtain a begin iterator for the results range. 
83400
83401
83402   const_iterator begin() const;
83403
83404
83405
83406 [endsect]
83407
83408
83409
83410 [section:cbegin ip::basic_resolver_results::cbegin]
83411
83412 [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.cbegin..cbegin..ip::basic_resolver_results] 
83413 Obtain a begin iterator for the results range. 
83414
83415
83416   const_iterator cbegin() const;
83417
83418
83419
83420 [endsect]
83421
83422
83423
83424 [section:cend ip::basic_resolver_results::cend]
83425
83426 [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.cend..cend..ip::basic_resolver_results] 
83427 Obtain an end iterator for the results range. 
83428
83429
83430   const_iterator cend() const;
83431
83432
83433
83434 [endsect]
83435
83436
83437
83438 [section:const_iterator ip::basic_resolver_results::const_iterator]
83439
83440 [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.const_iterator..const_iterator..ip::basic_resolver_results] 
83441 The type of an iterator into the range. 
83442
83443
83444   typedef basic_resolver_iterator< protocol_type > const_iterator;
83445
83446
83447 [heading Types]
83448 [table
83449   [[Name][Description]]
83450
83451   [
83452
83453     [[link boost_asio.reference.ip__basic_resolver_iterator.difference_type [*difference_type]]]
83454     [The type used for the distance between two iterators. ]
83455   
83456   ]
83457
83458   [
83459
83460     [[link boost_asio.reference.ip__basic_resolver_iterator.iterator_category [*iterator_category]]]
83461     [The iterator category. ]
83462   
83463   ]
83464
83465   [
83466
83467     [[link boost_asio.reference.ip__basic_resolver_iterator.pointer [*pointer]]]
83468     [The type of the result of applying operator->() to the iterator. ]
83469   
83470   ]
83471
83472   [
83473
83474     [[link boost_asio.reference.ip__basic_resolver_iterator.reference [*reference]]]
83475     [The type of the result of applying operator*() to the iterator. ]
83476   
83477   ]
83478
83479   [
83480
83481     [[link boost_asio.reference.ip__basic_resolver_iterator.value_type [*value_type]]]
83482     [The type of the value pointed to by the iterator. ]
83483   
83484   ]
83485
83486 ]
83487
83488 [heading Member Functions]
83489 [table
83490   [[Name][Description]]
83491
83492   [
83493     [[link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator [*basic_resolver_iterator]]]
83494     [Default constructor creates an end iterator. 
83495      [hr]
83496      Copy constructor. 
83497      [hr]
83498      Move constructor. ]
83499   ]
83500   
83501   [
83502     [[link boost_asio.reference.ip__basic_resolver_iterator.operator__star_ [*operator *]]]
83503     [Dereference an iterator. ]
83504   ]
83505   
83506   [
83507     [[link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_ [*operator++]]]
83508     [Increment operator (prefix). 
83509      [hr]
83510      Increment operator (postfix). ]
83511   ]
83512   
83513   [
83514     [[link boost_asio.reference.ip__basic_resolver_iterator.operator_arrow_ [*operator->]]]
83515     [Dereference an iterator. ]
83516   ]
83517   
83518   [
83519     [[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq_ [*operator=]]]
83520     [Assignment operator. 
83521      [hr]
83522      Move-assignment operator. ]
83523   ]
83524   
83525 ]
83526
83527 [heading Protected Member Functions]
83528 [table
83529   [[Name][Description]]
83530
83531   [
83532     [[link boost_asio.reference.ip__basic_resolver_iterator.dereference [*dereference]]]
83533     []
83534   ]
83535   
83536   [
83537     [[link boost_asio.reference.ip__basic_resolver_iterator.equal [*equal]]]
83538     []
83539   ]
83540   
83541   [
83542     [[link boost_asio.reference.ip__basic_resolver_iterator.increment [*increment]]]
83543     []
83544   ]
83545   
83546 ]
83547
83548 [heading Protected Data Members]
83549 [table
83550   [[Name][Description]]
83551
83552   [
83553     [[link boost_asio.reference.ip__basic_resolver_iterator.index_ [*index_]]]
83554     []
83555   ]
83556
83557   [
83558     [[link boost_asio.reference.ip__basic_resolver_iterator.values_ [*values_]]]
83559     []
83560   ]
83561
83562 ]
83563
83564 [heading Friends]
83565 [table
83566   [[Name][Description]]
83567
83568   [
83569     [[link boost_asio.reference.ip__basic_resolver_iterator.operator_not__eq_ [*operator!=]]]
83570     [Test two iterators for inequality. ]
83571   ]
83572   
83573   [
83574     [[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq__eq_ [*operator==]]]
83575     [Test two iterators for equality. ]
83576   ]
83577   
83578 ]
83579
83580 The [link boost_asio.reference.ip__basic_resolver_iterator `ip::basic_resolver_iterator`] class template is used to define iterators over the results returned by a resolver.
83581
83582 The iterator's value\_type, obtained when the iterator is dereferenced, is: 
83583
83584    const basic_resolver_entry<InternetProtocol> 
83585
83586
83587
83588
83589
83590 [heading Thread Safety]
83591   
83592 ['Distinct] ['objects:] Safe.
83593
83594 ['Shared] ['objects:] Unsafe. 
83595
83596
83597
83598
83599 [heading Requirements]
83600
83601 ['Header: ][^boost/asio/ip/basic_resolver_results.hpp]
83602
83603 ['Convenience header: ][^boost/asio.hpp]
83604
83605
83606 [endsect]
83607
83608
83609
83610 [section:const_reference ip::basic_resolver_results::const_reference]
83611
83612 [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.const_reference..const_reference..ip::basic_resolver_results] 
83613 The type of a const reference to a value in the range. 
83614
83615
83616   typedef const value_type & const_reference;
83617
83618
83619 [heading Types]
83620 [table
83621   [[Name][Description]]
83622
83623   [
83624
83625     [[link boost_asio.reference.ip__basic_resolver_entry.endpoint_type [*endpoint_type]]]
83626     [The endpoint type associated with the endpoint entry. ]
83627   
83628   ]
83629
83630   [
83631
83632     [[link boost_asio.reference.ip__basic_resolver_entry.protocol_type [*protocol_type]]]
83633     [The protocol type associated with the endpoint entry. ]
83634   
83635   ]
83636
83637 ]
83638
83639 [heading Member Functions]
83640 [table
83641   [[Name][Description]]
83642
83643   [
83644     [[link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry [*basic_resolver_entry]]]
83645     [Default constructor. 
83646      [hr]
83647      Construct with specified endpoint, host name and service name. ]
83648   ]
83649   
83650   [
83651     [[link boost_asio.reference.ip__basic_resolver_entry.endpoint [*endpoint]]]
83652     [Get the endpoint associated with the entry. ]
83653   ]
83654   
83655   [
83656     [[link boost_asio.reference.ip__basic_resolver_entry.host_name [*host_name]]]
83657     [Get the host name associated with the entry. ]
83658   ]
83659   
83660   [
83661     [[link boost_asio.reference.ip__basic_resolver_entry.operator_endpoint_type [*operator endpoint_type]]]
83662     [Convert to the endpoint associated with the entry. ]
83663   ]
83664   
83665   [
83666     [[link boost_asio.reference.ip__basic_resolver_entry.service_name [*service_name]]]
83667     [Get the service name associated with the entry. ]
83668   ]
83669   
83670 ]
83671
83672 The [link boost_asio.reference.ip__basic_resolver_entry `ip::basic_resolver_entry`] class template describes an entry as returned by a resolver.
83673
83674
83675 [heading Thread Safety]
83676   
83677 ['Distinct] ['objects:] Safe.
83678
83679 ['Shared] ['objects:] Unsafe. 
83680
83681
83682
83683
83684 [heading Requirements]
83685
83686 ['Header: ][^boost/asio/ip/basic_resolver_results.hpp]
83687
83688 ['Convenience header: ][^boost/asio.hpp]
83689
83690
83691 [endsect]
83692
83693
83694
83695 [section:dereference ip::basic_resolver_results::dereference]
83696
83697
83698 ['Inherited from ip::basic_resolver.]
83699
83700 [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.dereference..dereference..ip::basic_resolver_results] 
83701
83702   const basic_resolver_entry< InternetProtocol > & dereference() const;
83703
83704
83705
83706 [endsect]
83707
83708
83709
83710 [section:difference_type ip::basic_resolver_results::difference_type]
83711
83712 [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.difference_type..difference_type..ip::basic_resolver_results] 
83713 Type used to represent the distance between two iterators in the range. 
83714
83715
83716   typedef std::ptrdiff_t difference_type;
83717
83718
83719
83720 [heading Requirements]
83721
83722 ['Header: ][^boost/asio/ip/basic_resolver_results.hpp]
83723
83724 ['Convenience header: ][^boost/asio.hpp]
83725
83726
83727 [endsect]
83728
83729
83730
83731 [section:empty ip::basic_resolver_results::empty]
83732
83733 [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.empty..empty..ip::basic_resolver_results] 
83734 Determine whether the results range is empty. 
83735
83736
83737   bool empty() const;
83738
83739
83740
83741 [endsect]
83742
83743
83744
83745 [section:end ip::basic_resolver_results::end]
83746
83747 [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.end..end..ip::basic_resolver_results] 
83748 Obtain an end iterator for the results range. 
83749
83750
83751   const_iterator end() const;
83752
83753
83754
83755 [endsect]
83756
83757
83758
83759 [section:endpoint_type ip::basic_resolver_results::endpoint_type]
83760
83761 [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.endpoint_type..endpoint_type..ip::basic_resolver_results] 
83762 The endpoint type associated with the results. 
83763
83764
83765   typedef protocol_type::endpoint endpoint_type;
83766
83767
83768
83769 [heading Requirements]
83770
83771 ['Header: ][^boost/asio/ip/basic_resolver_results.hpp]
83772
83773 ['Convenience header: ][^boost/asio.hpp]
83774
83775
83776 [endsect]
83777
83778
83779
83780 [section:equal ip::basic_resolver_results::equal]
83781
83782
83783 ['Inherited from ip::basic_resolver.]
83784
83785 [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.equal..equal..ip::basic_resolver_results] 
83786
83787   bool equal(
83788       const basic_resolver_iterator & other) const;
83789
83790
83791
83792 [endsect]
83793
83794
83795
83796 [section:increment ip::basic_resolver_results::increment]
83797
83798
83799 ['Inherited from ip::basic_resolver.]
83800
83801 [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.increment..increment..ip::basic_resolver_results] 
83802
83803   void increment();
83804
83805
83806
83807 [endsect]
83808
83809
83810
83811 [section:index_ ip::basic_resolver_results::index_]
83812
83813
83814 ['Inherited from ip::basic_resolver.]
83815
83816 [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.index_..index_..ip::basic_resolver_results] 
83817
83818   std::size_t index_;
83819
83820
83821
83822 [endsect]
83823
83824
83825
83826 [section:iterator ip::basic_resolver_results::iterator]
83827
83828 [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.iterator..iterator..ip::basic_resolver_results] 
83829 The type of an iterator into the range. 
83830
83831
83832   typedef const_iterator iterator;
83833
83834
83835 [heading Types]
83836 [table
83837   [[Name][Description]]
83838
83839   [
83840
83841     [[link boost_asio.reference.ip__basic_resolver_iterator.difference_type [*difference_type]]]
83842     [The type used for the distance between two iterators. ]
83843   
83844   ]
83845
83846   [
83847
83848     [[link boost_asio.reference.ip__basic_resolver_iterator.iterator_category [*iterator_category]]]
83849     [The iterator category. ]
83850   
83851   ]
83852
83853   [
83854
83855     [[link boost_asio.reference.ip__basic_resolver_iterator.pointer [*pointer]]]
83856     [The type of the result of applying operator->() to the iterator. ]
83857   
83858   ]
83859
83860   [
83861
83862     [[link boost_asio.reference.ip__basic_resolver_iterator.reference [*reference]]]
83863     [The type of the result of applying operator*() to the iterator. ]
83864   
83865   ]
83866
83867   [
83868
83869     [[link boost_asio.reference.ip__basic_resolver_iterator.value_type [*value_type]]]
83870     [The type of the value pointed to by the iterator. ]
83871   
83872   ]
83873
83874 ]
83875
83876 [heading Member Functions]
83877 [table
83878   [[Name][Description]]
83879
83880   [
83881     [[link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator [*basic_resolver_iterator]]]
83882     [Default constructor creates an end iterator. 
83883      [hr]
83884      Copy constructor. 
83885      [hr]
83886      Move constructor. ]
83887   ]
83888   
83889   [
83890     [[link boost_asio.reference.ip__basic_resolver_iterator.operator__star_ [*operator *]]]
83891     [Dereference an iterator. ]
83892   ]
83893   
83894   [
83895     [[link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_ [*operator++]]]
83896     [Increment operator (prefix). 
83897      [hr]
83898      Increment operator (postfix). ]
83899   ]
83900   
83901   [
83902     [[link boost_asio.reference.ip__basic_resolver_iterator.operator_arrow_ [*operator->]]]
83903     [Dereference an iterator. ]
83904   ]
83905   
83906   [
83907     [[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq_ [*operator=]]]
83908     [Assignment operator. 
83909      [hr]
83910      Move-assignment operator. ]
83911   ]
83912   
83913 ]
83914
83915 [heading Protected Member Functions]
83916 [table
83917   [[Name][Description]]
83918
83919   [
83920     [[link boost_asio.reference.ip__basic_resolver_iterator.dereference [*dereference]]]
83921     []
83922   ]
83923   
83924   [
83925     [[link boost_asio.reference.ip__basic_resolver_iterator.equal [*equal]]]
83926     []
83927   ]
83928   
83929   [
83930     [[link boost_asio.reference.ip__basic_resolver_iterator.increment [*increment]]]
83931     []
83932   ]
83933   
83934 ]
83935
83936 [heading Protected Data Members]
83937 [table
83938   [[Name][Description]]
83939
83940   [
83941     [[link boost_asio.reference.ip__basic_resolver_iterator.index_ [*index_]]]
83942     []
83943   ]
83944
83945   [
83946     [[link boost_asio.reference.ip__basic_resolver_iterator.values_ [*values_]]]
83947     []
83948   ]
83949
83950 ]
83951
83952 [heading Friends]
83953 [table
83954   [[Name][Description]]
83955
83956   [
83957     [[link boost_asio.reference.ip__basic_resolver_iterator.operator_not__eq_ [*operator!=]]]
83958     [Test two iterators for inequality. ]
83959   ]
83960   
83961   [
83962     [[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq__eq_ [*operator==]]]
83963     [Test two iterators for equality. ]
83964   ]
83965   
83966 ]
83967
83968 The [link boost_asio.reference.ip__basic_resolver_iterator `ip::basic_resolver_iterator`] class template is used to define iterators over the results returned by a resolver.
83969
83970 The iterator's value\_type, obtained when the iterator is dereferenced, is: 
83971
83972    const basic_resolver_entry<InternetProtocol> 
83973
83974
83975
83976
83977
83978 [heading Thread Safety]
83979   
83980 ['Distinct] ['objects:] Safe.
83981
83982 ['Shared] ['objects:] Unsafe. 
83983
83984
83985
83986
83987 [heading Requirements]
83988
83989 ['Header: ][^boost/asio/ip/basic_resolver_results.hpp]
83990
83991 ['Convenience header: ][^boost/asio.hpp]
83992
83993
83994 [endsect]
83995
83996
83997
83998 [section:iterator_category ip::basic_resolver_results::iterator_category]
83999
84000
84001 ['Inherited from ip::basic_resolver.]
84002
84003 [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.iterator_category..iterator_category..ip::basic_resolver_results] 
84004 The iterator category. 
84005
84006
84007   typedef std::forward_iterator_tag iterator_category;
84008
84009
84010
84011 [heading Requirements]
84012
84013 ['Header: ][^boost/asio/ip/basic_resolver_results.hpp]
84014
84015 ['Convenience header: ][^boost/asio.hpp]
84016
84017
84018 [endsect]
84019
84020
84021
84022 [section:max_size ip::basic_resolver_results::max_size]
84023
84024 [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.max_size..max_size..ip::basic_resolver_results] 
84025 Get the maximum number of entries permitted in a results range. 
84026
84027
84028   size_type max_size() const;
84029
84030
84031
84032 [endsect]
84033
84034
84035
84036 [section:operator__star_ ip::basic_resolver_results::operator *]
84037
84038
84039 ['Inherited from ip::basic_resolver.]
84040
84041 [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.operator__star_..operator *..ip::basic_resolver_results] 
84042 Dereference an iterator. 
84043
84044
84045   const basic_resolver_entry< InternetProtocol > & operator *() const;
84046
84047
84048
84049 [endsect]
84050
84051
84052 [section:operator_not__eq_ ip::basic_resolver_results::operator!=]
84053
84054 [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.operator_not__eq_..operator!=..ip::basic_resolver_results] 
84055 Test two iterators for inequality. 
84056
84057
84058   friend bool ``[link boost_asio.reference.ip__basic_resolver_results.operator_not__eq_.overload1 operator!=]``(
84059       const basic_resolver_results & a,
84060       const basic_resolver_results & b);
84061   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_results.operator_not__eq_.overload1 more...]]``
84062
84063   friend bool ``[link boost_asio.reference.ip__basic_resolver_results.operator_not__eq_.overload2 operator!=]``(
84064       const basic_resolver_iterator & a,
84065       const basic_resolver_iterator & b);
84066   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_results.operator_not__eq_.overload2 more...]]``
84067
84068
84069 [section:overload1 ip::basic_resolver_results::operator!= (1 of 2 overloads)]
84070
84071
84072 Test two iterators for inequality. 
84073
84074
84075   friend bool operator!=(
84076       const basic_resolver_results & a,
84077       const basic_resolver_results & b);
84078
84079
84080 [heading Requirements]
84081
84082 ['Header: ][^boost/asio/ip/basic_resolver_results.hpp]
84083
84084 ['Convenience header: ][^boost/asio.hpp]
84085
84086
84087 [endsect]
84088
84089
84090
84091 [section:overload2 ip::basic_resolver_results::operator!= (2 of 2 overloads)]
84092
84093
84094 ['Inherited from ip::basic_resolver.]
84095
84096
84097 Test two iterators for inequality. 
84098
84099
84100   friend bool operator!=(
84101       const basic_resolver_iterator & a,
84102       const basic_resolver_iterator & b);
84103
84104
84105 [heading Requirements]
84106
84107 ['Header: ][^boost/asio/ip/basic_resolver_results.hpp]
84108
84109 ['Convenience header: ][^boost/asio.hpp]
84110
84111
84112 [endsect]
84113
84114
84115 [endsect]
84116
84117 [section:operator_plus__plus_ ip::basic_resolver_results::operator++]
84118
84119 [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.operator_plus__plus_..operator++..ip::basic_resolver_results] 
84120 Increment operator (prefix). 
84121
84122
84123   basic_resolver_iterator & ``[link boost_asio.reference.ip__basic_resolver_results.operator_plus__plus_.overload1 operator++]``();
84124   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_results.operator_plus__plus_.overload1 more...]]``
84125
84126
84127 Increment operator (postfix). 
84128
84129
84130   basic_resolver_iterator ``[link boost_asio.reference.ip__basic_resolver_results.operator_plus__plus_.overload2 operator++]``(
84131       int );
84132   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_results.operator_plus__plus_.overload2 more...]]``
84133
84134
84135 [section:overload1 ip::basic_resolver_results::operator++ (1 of 2 overloads)]
84136
84137
84138 ['Inherited from ip::basic_resolver.]
84139
84140
84141 Increment operator (prefix). 
84142
84143
84144   basic_resolver_iterator & operator++();
84145
84146
84147
84148 [endsect]
84149
84150
84151
84152 [section:overload2 ip::basic_resolver_results::operator++ (2 of 2 overloads)]
84153
84154
84155 ['Inherited from ip::basic_resolver.]
84156
84157
84158 Increment operator (postfix). 
84159
84160
84161   basic_resolver_iterator operator++(
84162       int );
84163
84164
84165
84166 [endsect]
84167
84168
84169 [endsect]
84170
84171
84172 [section:operator_arrow_ ip::basic_resolver_results::operator->]
84173
84174
84175 ['Inherited from ip::basic_resolver.]
84176
84177 [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.operator_arrow_..operator->..ip::basic_resolver_results] 
84178 Dereference an iterator. 
84179
84180
84181   const basic_resolver_entry< InternetProtocol > * operator->() const;
84182
84183
84184
84185 [endsect]
84186
84187
84188 [section:operator_eq_ ip::basic_resolver_results::operator=]
84189
84190 [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.operator_eq_..operator=..ip::basic_resolver_results] 
84191 Assignment operator. 
84192
84193
84194   basic_resolver_results & ``[link boost_asio.reference.ip__basic_resolver_results.operator_eq_.overload1 operator=]``(
84195       const basic_resolver_results & other);
84196   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_results.operator_eq_.overload1 more...]]``
84197
84198
84199 Move-assignment operator. 
84200
84201
84202   basic_resolver_results & ``[link boost_asio.reference.ip__basic_resolver_results.operator_eq_.overload2 operator=]``(
84203       basic_resolver_results && other);
84204   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_results.operator_eq_.overload2 more...]]``
84205
84206
84207 [section:overload1 ip::basic_resolver_results::operator= (1 of 2 overloads)]
84208
84209
84210 Assignment operator. 
84211
84212
84213   basic_resolver_results & operator=(
84214       const basic_resolver_results & other);
84215
84216
84217
84218 [endsect]
84219
84220
84221
84222 [section:overload2 ip::basic_resolver_results::operator= (2 of 2 overloads)]
84223
84224
84225 Move-assignment operator. 
84226
84227
84228   basic_resolver_results & operator=(
84229       basic_resolver_results && other);
84230
84231
84232
84233 [endsect]
84234
84235
84236 [endsect]
84237
84238 [section:operator_eq__eq_ ip::basic_resolver_results::operator==]
84239
84240 [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.operator_eq__eq_..operator==..ip::basic_resolver_results] 
84241 Test two iterators for equality. 
84242
84243
84244   friend bool ``[link boost_asio.reference.ip__basic_resolver_results.operator_eq__eq_.overload1 operator==]``(
84245       const basic_resolver_results & a,
84246       const basic_resolver_results & b);
84247   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_results.operator_eq__eq_.overload1 more...]]``
84248
84249   friend bool ``[link boost_asio.reference.ip__basic_resolver_results.operator_eq__eq_.overload2 operator==]``(
84250       const basic_resolver_iterator & a,
84251       const basic_resolver_iterator & b);
84252   ``  [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_results.operator_eq__eq_.overload2 more...]]``
84253
84254
84255 [section:overload1 ip::basic_resolver_results::operator== (1 of 2 overloads)]
84256
84257
84258 Test two iterators for equality. 
84259
84260
84261   friend bool operator==(
84262       const basic_resolver_results & a,
84263       const basic_resolver_results & b);
84264
84265
84266 [heading Requirements]
84267
84268 ['Header: ][^boost/asio/ip/basic_resolver_results.hpp]
84269
84270 ['Convenience header: ][^boost/asio.hpp]
84271
84272
84273 [endsect]
84274
84275
84276
84277 [section:overload2 ip::basic_resolver_results::operator== (2 of 2 overloads)]
84278
84279
84280 ['Inherited from ip::basic_resolver.]
84281
84282
84283 Test two iterators for equality. 
84284
84285
84286   friend bool operator==(
84287       const basic_resolver_iterator & a,
84288       const basic_resolver_iterator & b);
84289
84290
84291 [heading Requirements]
84292
84293 ['Header: ][^boost/asio/ip/basic_resolver_results.hpp]
84294
84295 ['Convenience header: ][^boost/asio.hpp]
84296
84297
84298 [endsect]
84299
84300
84301 [endsect]
84302
84303
84304 [section:pointer ip::basic_resolver_results::pointer]
84305
84306
84307 ['Inherited from ip::basic_resolver.]
84308
84309 [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.pointer..pointer..ip::basic_resolver_results] 
84310 The type of the result of applying `operator->()` to the iterator. 
84311
84312
84313   typedef const basic_resolver_entry< InternetProtocol > * pointer;
84314
84315
84316
84317 [heading Requirements]
84318
84319 ['Header: ][^boost/asio/ip/basic_resolver_results.hpp]
84320
84321 ['Convenience header: ][^boost/asio.hpp]
84322
84323
84324 [endsect]
84325
84326
84327
84328 [section:protocol_type ip::basic_resolver_results::protocol_type]
84329
84330 [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.protocol_type..protocol_type..ip::basic_resolver_results] 
84331 The protocol type associated with the results. 
84332
84333
84334   typedef InternetProtocol protocol_type;
84335
84336
84337
84338 [heading Requirements]
84339
84340 ['Header: ][^boost/asio/ip/basic_resolver_results.hpp]
84341
84342 ['Convenience header: ][^boost/asio.hpp]
84343
84344
84345 [endsect]
84346
84347
84348
84349 [section:reference ip::basic_resolver_results::reference]
84350
84351 [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.reference..reference..ip::basic_resolver_results] 
84352 The type of a non-const reference to a value in the range. 
84353
84354
84355   typedef value_type & reference;
84356
84357
84358 [heading Types]
84359 [table
84360   [[Name][Description]]
84361
84362   [
84363
84364     [[link boost_asio.reference.ip__basic_resolver_entry.endpoint_type [*endpoint_type]]]
84365     [The endpoint type associated with the endpoint entry. ]
84366   
84367   ]
84368
84369   [
84370
84371     [[link boost_asio.reference.ip__basic_resolver_entry.protocol_type [*protocol_type]]]
84372     [The protocol type associated with the endpoint entry. ]
84373   
84374   ]
84375
84376 ]
84377
84378 [heading Member Functions]
84379 [table
84380   [[Name][Description]]
84381
84382   [
84383     [[link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry [*basic_resolver_entry]]]
84384     [Default constructor. 
84385      [hr]
84386      Construct with specified endpoint, host name and service name. ]
84387   ]
84388   
84389   [
84390     [[link boost_asio.reference.ip__basic_resolver_entry.endpoint [*endpoint]]]
84391     [Get the endpoint associated with the entry. ]
84392   ]
84393   
84394   [
84395     [[link boost_asio.reference.ip__basic_resolver_entry.host_name [*host_name]]]
84396     [Get the host name associated with the entry. ]
84397   ]
84398   
84399   [
84400     [[link boost_asio.reference.ip__basic_resolver_entry.operator_endpoint_type [*operator endpoint_type]]]
84401     [Convert to the endpoint associated with the entry. ]
84402   ]
84403   
84404   [
84405     [[link boost_asio.reference.ip__basic_resolver_entry.service_name [*service_name]]]
84406     [Get the service name associated with the entry. ]
84407   ]
84408   
84409 ]
84410
84411 The [link boost_asio.reference.ip__basic_resolver_entry `ip::basic_resolver_entry`] class template describes an entry as returned by a resolver.
84412
84413
84414 [heading Thread Safety]
84415   
84416 ['Distinct] ['objects:] Safe.
84417
84418 ['Shared] ['objects:] Unsafe. 
84419
84420
84421
84422
84423 [heading Requirements]
84424
84425 ['Header: ][^boost/asio/ip/basic_resolver_results.hpp]
84426
84427 ['Convenience header: ][^boost/asio.hpp]
84428
84429
84430 [endsect]
84431
84432
84433
84434 [section:size ip::basic_resolver_results::size]
84435
84436 [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.size..size..ip::basic_resolver_results] 
84437 Get the number of entries in the results range. 
84438
84439
84440   size_type size() const;
84441
84442
84443
84444 [endsect]
84445
84446
84447
84448 [section:size_type ip::basic_resolver_results::size_type]
84449
84450 [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.size_type..size_type..ip::basic_resolver_results] 
84451 Type used to represent a count of the elements in the range. 
84452
84453
84454   typedef std::size_t size_type;
84455
84456
84457
84458 [heading Requirements]
84459
84460 ['Header: ][^boost/asio/ip/basic_resolver_results.hpp]
84461
84462 ['Convenience header: ][^boost/asio.hpp]
84463
84464
84465 [endsect]
84466
84467
84468
84469 [section:swap ip::basic_resolver_results::swap]
84470
84471 [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.swap..swap..ip::basic_resolver_results] 
84472 Swap the results range with another. 
84473
84474
84475   void swap(
84476       basic_resolver_results & that);
84477
84478
84479
84480 [endsect]
84481
84482
84483
84484 [section:value_type ip::basic_resolver_results::value_type]
84485
84486 [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.value_type..value_type..ip::basic_resolver_results] 
84487 The type of a value in the results range. 
84488
84489
84490   typedef basic_resolver_entry< protocol_type > value_type;
84491
84492
84493 [heading Types]
84494 [table
84495   [[Name][Description]]
84496
84497   [
84498
84499     [[link boost_asio.reference.ip__basic_resolver_entry.endpoint_type [*endpoint_type]]]
84500     [The endpoint type associated with the endpoint entry. ]
84501   
84502   ]
84503
84504   [
84505
84506     [[link boost_asio.reference.ip__basic_resolver_entry.protocol_type [*protocol_type]]]
84507     [The protocol type associated with the endpoint entry. ]
84508   
84509   ]
84510
84511 ]
84512
84513 [heading Member Functions]
84514 [table
84515   [[Name][Description]]
84516
84517   [
84518     [[link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry [*basic_resolver_entry]]]
84519     [Default constructor. 
84520      [hr]
84521      Construct with specified endpoint, host name and service name. ]
84522   ]
84523   
84524   [
84525     [[link boost_asio.reference.ip__basic_resolver_entry.endpoint [*endpoint]]]
84526     [Get the endpoint associated with the entry. ]
84527   ]
84528   
84529   [
84530     [[link boost_asio.reference.ip__basic_resolver_entry.host_name [*host_name]]]
84531     [Get the host name associated with the entry. ]
84532   ]
84533   
84534   [
84535     [[link boost_asio.reference.ip__basic_resolver_entry.operator_endpoint_type [*operator endpoint_type]]]
84536     [Convert to the endpoint associated with the entry. ]
84537   ]
84538   
84539   [
84540     [[link boost_asio.reference.ip__basic_resolver_entry.service_name [*service_name]]]
84541     [Get the service name associated with the entry. ]
84542   ]
84543   
84544 ]
84545
84546 The [link boost_asio.reference.ip__basic_resolver_entry `ip::basic_resolver_entry`] class template describes an entry as returned by a resolver.
84547
84548
84549 [heading Thread Safety]
84550   
84551 ['Distinct] ['objects:] Safe.
84552
84553 ['Shared] ['objects:] Unsafe. 
84554
84555
84556
84557
84558 [heading Requirements]
84559
84560 ['Header: ][^boost/asio/ip/basic_resolver_results.hpp]
84561
84562 ['Convenience header: ][^boost/asio.hpp]
84563
84564
84565 [endsect]
84566
84567
84568
84569 [section:values_ ip::basic_resolver_results::values_]
84570
84571
84572 ['Inherited from ip::basic_resolver.]
84573
84574 [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.values_..values_..ip::basic_resolver_results] 
84575
84576   values_ptr_type values_;
84577
84578
84579
84580 [endsect]
84581
84582
84583
84584 [endsect]
84585
84586 [section:ip__host_name ip::host_name]
84587
84588 [indexterm1 boost_asio.indexterm.ip__host_name..ip::host_name] 
84589 Get the current host name. 
84590
84591   std::string ``[link boost_asio.reference.ip__host_name.overload1 host_name]``();
84592   ``  [''''&raquo;''' [link boost_asio.reference.ip__host_name.overload1 more...]]``
84593
84594   std::string ``[link boost_asio.reference.ip__host_name.overload2 host_name]``(
84595       boost::system::error_code & ec);
84596   ``  [''''&raquo;''' [link boost_asio.reference.ip__host_name.overload2 more...]]``
84597
84598 [heading Requirements]
84599
84600 ['Header: ][^boost/asio/ip/host_name.hpp]
84601
84602 ['Convenience header: ][^boost/asio.hpp]
84603
84604
84605 [section:overload1 ip::host_name (1 of 2 overloads)]
84606
84607
84608 Get the current host name. 
84609
84610
84611   std::string host_name();
84612
84613
84614
84615 [endsect]
84616
84617
84618
84619 [section:overload2 ip::host_name (2 of 2 overloads)]
84620
84621
84622 Get the current host name. 
84623
84624
84625   std::string host_name(
84626       boost::system::error_code & ec);
84627
84628
84629
84630 [endsect]
84631
84632
84633 [endsect]
84634
84635 [section:ip__icmp ip::icmp]
84636
84637
84638 Encapsulates the flags needed for ICMP. 
84639
84640
84641   class icmp
84642
84643
84644 [heading Types]
84645 [table
84646   [[Name][Description]]
84647
84648   [
84649
84650     [[link boost_asio.reference.ip__icmp.endpoint [*endpoint]]]
84651     [The type of a ICMP endpoint. ]
84652   
84653   ]
84654
84655   [
84656
84657     [[link boost_asio.reference.ip__icmp.resolver [*resolver]]]
84658     [The ICMP resolver type. ]
84659   
84660   ]
84661
84662   [
84663
84664     [[link boost_asio.reference.ip__icmp.socket [*socket]]]
84665     [The ICMP socket type. ]
84666   
84667   ]
84668
84669 ]
84670
84671 [heading Member Functions]
84672 [table
84673   [[Name][Description]]
84674
84675   [
84676     [[link boost_asio.reference.ip__icmp.family [*family]]]
84677     [Obtain an identifier for the protocol family. ]
84678   ]
84679   
84680   [
84681     [[link boost_asio.reference.ip__icmp.protocol [*protocol]]]
84682     [Obtain an identifier for the protocol. ]
84683   ]
84684   
84685   [
84686     [[link boost_asio.reference.ip__icmp.type [*type]]]
84687     [Obtain an identifier for the type of the protocol. ]
84688   ]
84689   
84690   [
84691     [[link boost_asio.reference.ip__icmp.v4 [*v4]]]
84692     [Construct to represent the IPv4 ICMP protocol. ]
84693   ]
84694   
84695   [
84696     [[link boost_asio.reference.ip__icmp.v6 [*v6]]]
84697     [Construct to represent the IPv6 ICMP protocol. ]
84698   ]
84699   
84700 ]
84701
84702 [heading Friends]
84703 [table
84704   [[Name][Description]]
84705
84706   [
84707     [[link boost_asio.reference.ip__icmp.operator_not__eq_ [*operator!=]]]
84708     [Compare two protocols for inequality. ]
84709   ]
84710   
84711   [
84712     [[link boost_asio.reference.ip__icmp.operator_eq__eq_ [*operator==]]]
84713     [Compare two protocols for equality. ]
84714   ]
84715   
84716 ]
84717
84718 The [link boost_asio.reference.ip__icmp `ip::icmp`] class contains flags necessary for ICMP sockets.
84719
84720
84721 [heading Thread Safety]
84722   
84723 ['Distinct] ['objects:] Safe.
84724
84725 ['Shared] ['objects:] Safe.
84726
84727
84728
84729
84730 [heading Requirements]
84731
84732 ['Header: ][^boost/asio/ip/icmp.hpp]
84733
84734 ['Convenience header: ][^boost/asio.hpp]
84735
84736
84737 [section:endpoint ip::icmp::endpoint]
84738
84739 [indexterm2 boost_asio.indexterm.ip__icmp.endpoint..endpoint..ip::icmp] 
84740 The type of a ICMP endpoint. 
84741
84742
84743   typedef basic_endpoint< icmp > endpoint;
84744
84745
84746 [heading Types]
84747 [table
84748   [[Name][Description]]
84749
84750   [
84751
84752     [[link boost_asio.reference.ip__basic_endpoint.data_type [*data_type]]]
84753     [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
84754   
84755   ]
84756
84757   [
84758
84759     [[link boost_asio.reference.ip__basic_endpoint.protocol_type [*protocol_type]]]
84760     [The protocol type associated with the endpoint. ]
84761   
84762   ]
84763
84764 ]
84765
84766 [heading Member Functions]
84767 [table
84768   [[Name][Description]]
84769
84770   [
84771     [[link boost_asio.reference.ip__basic_endpoint.address [*address]]]
84772     [Get the IP address associated with the endpoint. 
84773      [hr]
84774      Set the IP address associated with the endpoint. ]
84775   ]
84776   
84777   [
84778     [[link boost_asio.reference.ip__basic_endpoint.basic_endpoint [*basic_endpoint]]]
84779     [Default constructor. 
84780      [hr]
84781      Construct an endpoint using a port number, specified in the host's byte order. The IP address will be the any address (i.e. INADDR_ANY or in6addr_any). This constructor would typically be used for accepting new connections. 
84782      [hr]
84783      Construct an endpoint using a port number and an IP address. This constructor may be used for accepting connections on a specific interface or for making a connection to a remote endpoint. 
84784      [hr]
84785      Copy constructor. 
84786      [hr]
84787      Move constructor. ]
84788   ]
84789   
84790   [
84791     [[link boost_asio.reference.ip__basic_endpoint.capacity [*capacity]]]
84792     [Get the capacity of the endpoint in the native type. ]
84793   ]
84794   
84795   [
84796     [[link boost_asio.reference.ip__basic_endpoint.data [*data]]]
84797     [Get the underlying endpoint in the native type. ]
84798   ]
84799   
84800   [
84801     [[link boost_asio.reference.ip__basic_endpoint.operator_eq_ [*operator=]]]
84802     [Assign from another endpoint. 
84803      [hr]
84804      Move-assign from another endpoint. ]
84805   ]
84806   
84807   [
84808     [[link boost_asio.reference.ip__basic_endpoint.port [*port]]]
84809     [Get the port associated with the endpoint. The port number is always in the host's byte order. 
84810      [hr]
84811      Set the port associated with the endpoint. The port number is always in the host's byte order. ]
84812   ]
84813   
84814   [
84815     [[link boost_asio.reference.ip__basic_endpoint.protocol [*protocol]]]
84816     [The protocol associated with the endpoint. ]
84817   ]
84818   
84819   [
84820     [[link boost_asio.reference.ip__basic_endpoint.resize [*resize]]]
84821     [Set the underlying size of the endpoint in the native type. ]
84822   ]
84823   
84824   [
84825     [[link boost_asio.reference.ip__basic_endpoint.size [*size]]]
84826     [Get the underlying size of the endpoint in the native type. ]
84827   ]
84828   
84829 ]
84830
84831 [heading Friends]
84832 [table
84833   [[Name][Description]]
84834
84835   [
84836     [[link boost_asio.reference.ip__basic_endpoint.operator_not__eq_ [*operator!=]]]
84837     [Compare two endpoints for inequality. ]
84838   ]
84839   
84840   [
84841     [[link boost_asio.reference.ip__basic_endpoint.operator_lt_ [*operator<]]]
84842     [Compare endpoints for ordering. ]
84843   ]
84844   
84845   [
84846     [[link boost_asio.reference.ip__basic_endpoint.operator_lt__eq_ [*operator<=]]]
84847     [Compare endpoints for ordering. ]
84848   ]
84849   
84850   [
84851     [[link boost_asio.reference.ip__basic_endpoint.operator_eq__eq_ [*operator==]]]
84852     [Compare two endpoints for equality. ]
84853   ]
84854   
84855   [
84856     [[link boost_asio.reference.ip__basic_endpoint.operator_gt_ [*operator>]]]
84857     [Compare endpoints for ordering. ]
84858   ]
84859   
84860   [
84861     [[link boost_asio.reference.ip__basic_endpoint.operator_gt__eq_ [*operator>=]]]
84862     [Compare endpoints for ordering. ]
84863   ]
84864   
84865 ]
84866
84867 [heading Related Functions]
84868 [table
84869   [[Name][Description]]
84870
84871   [
84872     [[link boost_asio.reference.ip__basic_endpoint.operator_lt__lt_ [*operator<<]]]
84873     [Output an endpoint as a string. ]
84874   ]
84875   
84876 ]
84877
84878 The [link boost_asio.reference.ip__basic_endpoint `ip::basic_endpoint`] class template describes an endpoint that may be associated with a particular socket.
84879
84880
84881 [heading Thread Safety]
84882   
84883 ['Distinct] ['objects:] Safe.
84884
84885 ['Shared] ['objects:] Unsafe.
84886
84887
84888
84889
84890
84891 [heading Requirements]
84892
84893 ['Header: ][^boost/asio/ip/icmp.hpp]
84894
84895 ['Convenience header: ][^boost/asio.hpp]
84896
84897
84898 [endsect]
84899
84900
84901
84902 [section:family ip::icmp::family]
84903
84904 [indexterm2 boost_asio.indexterm.ip__icmp.family..family..ip::icmp] 
84905 Obtain an identifier for the protocol family. 
84906
84907
84908   int family() const;
84909
84910
84911
84912 [endsect]
84913
84914
84915
84916 [section:operator_not__eq_ ip::icmp::operator!=]
84917
84918 [indexterm2 boost_asio.indexterm.ip__icmp.operator_not__eq_..operator!=..ip::icmp] 
84919 Compare two protocols for inequality. 
84920
84921
84922   friend bool operator!=(
84923       const icmp & p1,
84924       const icmp & p2);
84925
84926
84927 [heading Requirements]
84928
84929 ['Header: ][^boost/asio/ip/icmp.hpp]
84930
84931 ['Convenience header: ][^boost/asio.hpp]
84932
84933
84934 [endsect]
84935
84936
84937
84938 [section:operator_eq__eq_ ip::icmp::operator==]
84939
84940 [indexterm2 boost_asio.indexterm.ip__icmp.operator_eq__eq_..operator==..ip::icmp] 
84941 Compare two protocols for equality. 
84942
84943
84944   friend bool operator==(
84945       const icmp & p1,
84946       const icmp & p2);
84947
84948
84949 [heading Requirements]
84950
84951 ['Header: ][^boost/asio/ip/icmp.hpp]
84952
84953 ['Convenience header: ][^boost/asio.hpp]
84954
84955
84956 [endsect]
84957
84958
84959
84960 [section:protocol ip::icmp::protocol]
84961
84962 [indexterm2 boost_asio.indexterm.ip__icmp.protocol..protocol..ip::icmp] 
84963 Obtain an identifier for the protocol. 
84964
84965
84966   int protocol() const;
84967
84968
84969
84970 [endsect]
84971
84972
84973
84974 [section:resolver ip::icmp::resolver]
84975
84976 [indexterm2 boost_asio.indexterm.ip__icmp.resolver..resolver..ip::icmp] 
84977 The ICMP resolver type. 
84978
84979
84980   typedef basic_resolver< icmp > resolver;
84981
84982
84983 [heading Types]
84984 [table
84985   [[Name][Description]]
84986
84987   [
84988
84989     [[link boost_asio.reference.ip__basic_resolver__rebind_executor [*rebind_executor]]]
84990     [Rebinds the resolver type to another executor. ]
84991   
84992   ]
84993
84994   [
84995
84996     [[link boost_asio.reference.ip__basic_resolver.endpoint_type [*endpoint_type]]]
84997     [The endpoint type. ]
84998   
84999   ]
85000
85001   [
85002
85003     [[link boost_asio.reference.ip__basic_resolver.executor_type [*executor_type]]]
85004     [The type of the executor associated with the object. ]
85005   
85006   ]
85007
85008   [
85009
85010     [[link boost_asio.reference.ip__basic_resolver.flags [*flags]]]
85011     [A bitmask type (C++ Std \[lib.bitmask.types\]). ]
85012   
85013   ]
85014
85015   [
85016
85017     [[link boost_asio.reference.ip__basic_resolver.iterator [*iterator]]]
85018     [(Deprecated.) The iterator type. ]
85019   
85020   ]
85021
85022   [
85023
85024     [[link boost_asio.reference.ip__basic_resolver.protocol_type [*protocol_type]]]
85025     [The protocol type. ]
85026   
85027   ]
85028
85029   [
85030
85031     [[link boost_asio.reference.ip__basic_resolver.query [*query]]]
85032     [(Deprecated.) The query type. ]
85033   
85034   ]
85035
85036   [
85037
85038     [[link boost_asio.reference.ip__basic_resolver.results_type [*results_type]]]
85039     [The results type. ]
85040   
85041   ]
85042
85043 ]
85044
85045 [heading Member Functions]
85046 [table
85047   [[Name][Description]]
85048
85049   [
85050     [[link boost_asio.reference.ip__basic_resolver.async_resolve [*async_resolve]]]
85051     [(Deprecated: Use overload with separate host and service parameters.) Asynchronously perform forward resolution of a query to a list of entries. 
85052      [hr]
85053      Asynchronously perform forward resolution of a query to a list of entries. 
85054      [hr]
85055      Asynchronously perform reverse resolution of an endpoint to a list of entries. ]
85056   ]
85057   
85058   [
85059     [[link boost_asio.reference.ip__basic_resolver.basic_resolver [*basic_resolver]]]
85060     [Construct with executor. 
85061      [hr]
85062      Construct with execution context. 
85063      [hr]
85064      Move-construct a basic_resolver from another. ]
85065   ]
85066   
85067   [
85068     [[link boost_asio.reference.ip__basic_resolver.cancel [*cancel]]]
85069     [Cancel any asynchronous operations that are waiting on the resolver. ]
85070   ]
85071   
85072   [
85073     [[link boost_asio.reference.ip__basic_resolver.get_executor [*get_executor]]]
85074     [Get the executor associated with the object. ]
85075   ]
85076   
85077   [
85078     [[link boost_asio.reference.ip__basic_resolver.operator_eq_ [*operator=]]]
85079     [Move-assign a basic_resolver from another. ]
85080   ]
85081   
85082   [
85083     [[link boost_asio.reference.ip__basic_resolver.resolve [*resolve]]]
85084     [(Deprecated: Use overload with separate host and service parameters.) Perform forward resolution of a query to a list of entries. 
85085      [hr]
85086      Perform forward resolution of a query to a list of entries. 
85087      [hr]
85088      Perform reverse resolution of an endpoint to a list of entries. ]
85089   ]
85090   
85091   [
85092     [[link boost_asio.reference.ip__basic_resolver._basic_resolver [*~basic_resolver]]]
85093     [Destroys the resolver. ]
85094   ]
85095   
85096 ]
85097
85098 [heading Data Members]
85099 [table
85100   [[Name][Description]]
85101
85102   [
85103     [[link boost_asio.reference.ip__basic_resolver.address_configured [*address_configured]]]
85104     [Only return IPv4 addresses if a non-loopback IPv4 address is configured for the system. Only return IPv6 addresses if a non-loopback IPv6 address is configured for the system. ]
85105   ]
85106
85107   [
85108     [[link boost_asio.reference.ip__basic_resolver.all_matching [*all_matching]]]
85109     [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ]
85110   ]
85111
85112   [
85113     [[link boost_asio.reference.ip__basic_resolver.canonical_name [*canonical_name]]]
85114     [Determine the canonical name of the host specified in the query. ]
85115   ]
85116
85117   [
85118     [[link boost_asio.reference.ip__basic_resolver.numeric_host [*numeric_host]]]
85119     [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ]
85120   ]
85121
85122   [
85123     [[link boost_asio.reference.ip__basic_resolver.numeric_service [*numeric_service]]]
85124     [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ]
85125   ]
85126
85127   [
85128     [[link boost_asio.reference.ip__basic_resolver.passive [*passive]]]
85129     [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ]
85130   ]
85131
85132   [
85133     [[link boost_asio.reference.ip__basic_resolver.v4_mapped [*v4_mapped]]]
85134     [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ]
85135   ]
85136
85137 ]
85138
85139 The [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] class template provides the ability to resolve a query to a list of endpoints.
85140
85141
85142 [heading Thread Safety]
85143   
85144 ['Distinct] ['objects:] Safe.
85145
85146 ['Shared] ['objects:] Unsafe. 
85147
85148
85149
85150
85151 [heading Requirements]
85152
85153 ['Header: ][^boost/asio/ip/icmp.hpp]
85154
85155 ['Convenience header: ][^boost/asio.hpp]
85156
85157
85158 [endsect]
85159
85160
85161
85162 [section:socket ip::icmp::socket]
85163
85164 [indexterm2 boost_asio.indexterm.ip__icmp.socket..socket..ip::icmp] 
85165 The ICMP socket type. 
85166
85167
85168   typedef basic_raw_socket< icmp > socket;
85169
85170
85171 [heading Types]
85172 [table
85173   [[Name][Description]]
85174
85175   [
85176
85177     [[link boost_asio.reference.basic_raw_socket__rebind_executor [*rebind_executor]]]
85178     [Rebinds the socket type to another executor. ]
85179   
85180   ]
85181
85182   [
85183
85184     [[link boost_asio.reference.basic_raw_socket.broadcast [*broadcast]]]
85185     [Socket option to permit sending of broadcast messages. ]
85186   
85187   ]
85188
85189   [
85190
85191     [[link boost_asio.reference.basic_raw_socket.bytes_readable [*bytes_readable]]]
85192     [IO control command to get the amount of data that can be read without blocking. ]
85193   
85194   ]
85195
85196   [
85197
85198     [[link boost_asio.reference.basic_raw_socket.debug [*debug]]]
85199     [Socket option to enable socket-level debugging. ]
85200   
85201   ]
85202
85203   [
85204
85205     [[link boost_asio.reference.basic_raw_socket.do_not_route [*do_not_route]]]
85206     [Socket option to prevent routing, use local interfaces only. ]
85207   
85208   ]
85209
85210   [
85211
85212     [[link boost_asio.reference.basic_raw_socket.enable_connection_aborted [*enable_connection_aborted]]]
85213     [Socket option to report aborted connections on accept. ]
85214   
85215   ]
85216
85217   [
85218
85219     [[link boost_asio.reference.basic_raw_socket.endpoint_type [*endpoint_type]]]
85220     [The endpoint type. ]
85221   
85222   ]
85223
85224   [
85225
85226     [[link boost_asio.reference.basic_raw_socket.executor_type [*executor_type]]]
85227     [The type of the executor associated with the object. ]
85228   
85229   ]
85230
85231   [
85232
85233     [[link boost_asio.reference.basic_raw_socket.keep_alive [*keep_alive]]]
85234     [Socket option to send keep-alives. ]
85235   
85236   ]
85237
85238   [
85239
85240     [[link boost_asio.reference.basic_raw_socket.linger [*linger]]]
85241     [Socket option to specify whether the socket lingers on close if unsent data is present. ]
85242   
85243   ]
85244
85245   [
85246
85247     [[link boost_asio.reference.basic_raw_socket.lowest_layer_type [*lowest_layer_type]]]
85248     [A basic_socket is always the lowest layer. ]
85249   
85250   ]
85251
85252   [
85253
85254     [[link boost_asio.reference.basic_raw_socket.message_flags [*message_flags]]]
85255     [Bitmask type for flags that can be passed to send and receive operations. ]
85256   
85257   ]
85258
85259   [
85260
85261     [[link boost_asio.reference.basic_raw_socket.native_handle_type [*native_handle_type]]]
85262     [The native representation of a socket. ]
85263   
85264   ]
85265
85266   [
85267
85268     [[link boost_asio.reference.basic_raw_socket.out_of_band_inline [*out_of_band_inline]]]
85269     [Socket option for putting received out-of-band data inline. ]
85270   
85271   ]
85272
85273   [
85274
85275     [[link boost_asio.reference.basic_raw_socket.protocol_type [*protocol_type]]]
85276     [The protocol type. ]
85277   
85278   ]
85279
85280   [
85281
85282     [[link boost_asio.reference.basic_raw_socket.receive_buffer_size [*receive_buffer_size]]]
85283     [Socket option for the receive buffer size of a socket. ]
85284   
85285   ]
85286
85287   [
85288
85289     [[link boost_asio.reference.basic_raw_socket.receive_low_watermark [*receive_low_watermark]]]
85290     [Socket option for the receive low watermark. ]
85291   
85292   ]
85293
85294   [
85295
85296     [[link boost_asio.reference.basic_raw_socket.reuse_address [*reuse_address]]]
85297     [Socket option to allow the socket to be bound to an address that is already in use. ]
85298   
85299   ]
85300
85301   [
85302
85303     [[link boost_asio.reference.basic_raw_socket.send_buffer_size [*send_buffer_size]]]
85304     [Socket option for the send buffer size of a socket. ]
85305   
85306   ]
85307
85308   [
85309
85310     [[link boost_asio.reference.basic_raw_socket.send_low_watermark [*send_low_watermark]]]
85311     [Socket option for the send low watermark. ]
85312   
85313   ]
85314
85315   [
85316
85317     [[link boost_asio.reference.basic_raw_socket.shutdown_type [*shutdown_type]]]
85318     [Different ways a socket may be shutdown. ]
85319   
85320   ]
85321
85322   [
85323
85324     [[link boost_asio.reference.basic_raw_socket.wait_type [*wait_type]]]
85325     [Wait types. ]
85326   
85327   ]
85328
85329 ]
85330
85331 [heading Member Functions]
85332 [table
85333   [[Name][Description]]
85334
85335   [
85336     [[link boost_asio.reference.basic_raw_socket.assign [*assign]]]
85337     [Assign an existing native socket to the socket. ]
85338   ]
85339   
85340   [
85341     [[link boost_asio.reference.basic_raw_socket.async_connect [*async_connect]]]
85342     [Start an asynchronous connect. ]
85343   ]
85344   
85345   [
85346     [[link boost_asio.reference.basic_raw_socket.async_receive [*async_receive]]]
85347     [Start an asynchronous receive on a connected socket. ]
85348   ]
85349   
85350   [
85351     [[link boost_asio.reference.basic_raw_socket.async_receive_from [*async_receive_from]]]
85352     [Start an asynchronous receive. ]
85353   ]
85354   
85355   [
85356     [[link boost_asio.reference.basic_raw_socket.async_send [*async_send]]]
85357     [Start an asynchronous send on a connected socket. ]
85358   ]
85359   
85360   [
85361     [[link boost_asio.reference.basic_raw_socket.async_send_to [*async_send_to]]]
85362     [Start an asynchronous send. ]
85363   ]
85364   
85365   [
85366     [[link boost_asio.reference.basic_raw_socket.async_wait [*async_wait]]]
85367     [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
85368   ]
85369   
85370   [
85371     [[link boost_asio.reference.basic_raw_socket.at_mark [*at_mark]]]
85372     [Determine whether the socket is at the out-of-band data mark. ]
85373   ]
85374   
85375   [
85376     [[link boost_asio.reference.basic_raw_socket.available [*available]]]
85377     [Determine the number of bytes available for reading. ]
85378   ]
85379   
85380   [
85381     [[link boost_asio.reference.basic_raw_socket.basic_raw_socket [*basic_raw_socket]]]
85382     [Construct a basic_raw_socket without opening it. 
85383      [hr]
85384      Construct and open a basic_raw_socket. 
85385      [hr]
85386      Construct a basic_raw_socket, opening it and binding it to the given local endpoint. 
85387      [hr]
85388      Construct a basic_raw_socket on an existing native socket. 
85389      [hr]
85390      Move-construct a basic_raw_socket from another. 
85391      [hr]
85392      Move-construct a basic_raw_socket from a socket of another protocol type. ]
85393   ]
85394   
85395   [
85396     [[link boost_asio.reference.basic_raw_socket.bind [*bind]]]
85397     [Bind the socket to the given local endpoint. ]
85398   ]
85399   
85400   [
85401     [[link boost_asio.reference.basic_raw_socket.cancel [*cancel]]]
85402     [Cancel all asynchronous operations associated with the socket. ]
85403   ]
85404   
85405   [
85406     [[link boost_asio.reference.basic_raw_socket.close [*close]]]
85407     [Close the socket. ]
85408   ]
85409   
85410   [
85411     [[link boost_asio.reference.basic_raw_socket.connect [*connect]]]
85412     [Connect the socket to the specified endpoint. ]
85413   ]
85414   
85415   [
85416     [[link boost_asio.reference.basic_raw_socket.get_executor [*get_executor]]]
85417     [Get the executor associated with the object. ]
85418   ]
85419   
85420   [
85421     [[link boost_asio.reference.basic_raw_socket.get_option [*get_option]]]
85422     [Get an option from the socket. ]
85423   ]
85424   
85425   [
85426     [[link boost_asio.reference.basic_raw_socket.io_control [*io_control]]]
85427     [Perform an IO control command on the socket. ]
85428   ]
85429   
85430   [
85431     [[link boost_asio.reference.basic_raw_socket.is_open [*is_open]]]
85432     [Determine whether the socket is open. ]
85433   ]
85434   
85435   [
85436     [[link boost_asio.reference.basic_raw_socket.local_endpoint [*local_endpoint]]]
85437     [Get the local endpoint of the socket. ]
85438   ]
85439   
85440   [
85441     [[link boost_asio.reference.basic_raw_socket.lowest_layer [*lowest_layer]]]
85442     [Get a reference to the lowest layer. 
85443      [hr]
85444      Get a const reference to the lowest layer. ]
85445   ]
85446   
85447   [
85448     [[link boost_asio.reference.basic_raw_socket.native_handle [*native_handle]]]
85449     [Get the native socket representation. ]
85450   ]
85451   
85452   [
85453     [[link boost_asio.reference.basic_raw_socket.native_non_blocking [*native_non_blocking]]]
85454     [Gets the non-blocking mode of the native socket implementation. 
85455      [hr]
85456      Sets the non-blocking mode of the native socket implementation. ]
85457   ]
85458   
85459   [
85460     [[link boost_asio.reference.basic_raw_socket.non_blocking [*non_blocking]]]
85461     [Gets the non-blocking mode of the socket. 
85462      [hr]
85463      Sets the non-blocking mode of the socket. ]
85464   ]
85465   
85466   [
85467     [[link boost_asio.reference.basic_raw_socket.open [*open]]]
85468     [Open the socket using the specified protocol. ]
85469   ]
85470   
85471   [
85472     [[link boost_asio.reference.basic_raw_socket.operator_eq_ [*operator=]]]
85473     [Move-assign a basic_raw_socket from another. 
85474      [hr]
85475      Move-assign a basic_raw_socket from a socket of another protocol type. ]
85476   ]
85477   
85478   [
85479     [[link boost_asio.reference.basic_raw_socket.receive [*receive]]]
85480     [Receive some data on a connected socket. ]
85481   ]
85482   
85483   [
85484     [[link boost_asio.reference.basic_raw_socket.receive_from [*receive_from]]]
85485     [Receive raw data with the endpoint of the sender. ]
85486   ]
85487   
85488   [
85489     [[link boost_asio.reference.basic_raw_socket.release [*release]]]
85490     [Release ownership of the underlying native socket. ]
85491   ]
85492   
85493   [
85494     [[link boost_asio.reference.basic_raw_socket.remote_endpoint [*remote_endpoint]]]
85495     [Get the remote endpoint of the socket. ]
85496   ]
85497   
85498   [
85499     [[link boost_asio.reference.basic_raw_socket.send [*send]]]
85500     [Send some data on a connected socket. ]
85501   ]
85502   
85503   [
85504     [[link boost_asio.reference.basic_raw_socket.send_to [*send_to]]]
85505     [Send raw data to the specified endpoint. ]
85506   ]
85507   
85508   [
85509     [[link boost_asio.reference.basic_raw_socket.set_option [*set_option]]]
85510     [Set an option on the socket. ]
85511   ]
85512   
85513   [
85514     [[link boost_asio.reference.basic_raw_socket.shutdown [*shutdown]]]
85515     [Disable sends or receives on the socket. ]
85516   ]
85517   
85518   [
85519     [[link boost_asio.reference.basic_raw_socket.wait [*wait]]]
85520     [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
85521   ]
85522   
85523   [
85524     [[link boost_asio.reference.basic_raw_socket._basic_raw_socket [*~basic_raw_socket]]]
85525     [Destroys the socket. ]
85526   ]
85527   
85528 ]
85529
85530 [heading Data Members]
85531 [table
85532   [[Name][Description]]
85533
85534   [
85535     [[link boost_asio.reference.basic_raw_socket.max_connections [*max_connections]]]
85536     [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
85537   ]
85538
85539   [
85540     [[link boost_asio.reference.basic_raw_socket.max_listen_connections [*max_listen_connections]]]
85541     [The maximum length of the queue of pending incoming connections. ]
85542   ]
85543
85544   [
85545     [[link boost_asio.reference.basic_raw_socket.message_do_not_route [*message_do_not_route]]]
85546     [Specify that the data should not be subject to routing. ]
85547   ]
85548
85549   [
85550     [[link boost_asio.reference.basic_raw_socket.message_end_of_record [*message_end_of_record]]]
85551     [Specifies that the data marks the end of a record. ]
85552   ]
85553
85554   [
85555     [[link boost_asio.reference.basic_raw_socket.message_out_of_band [*message_out_of_band]]]
85556     [Process out-of-band data. ]
85557   ]
85558
85559   [
85560     [[link boost_asio.reference.basic_raw_socket.message_peek [*message_peek]]]
85561     [Peek at incoming data without removing it from the input queue. ]
85562   ]
85563
85564 ]
85565
85566 [heading Protected Data Members]
85567 [table
85568   [[Name][Description]]
85569
85570   [
85571     [[link boost_asio.reference.basic_raw_socket.impl_ [*impl_]]]
85572     []
85573   ]
85574
85575 ]
85576
85577 The [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] class template provides asynchronous and blocking raw-oriented socket functionality.
85578
85579
85580 [heading Thread Safety]
85581   
85582 ['Distinct] ['objects:] Safe.
85583
85584 ['Shared] ['objects:] Unsafe. 
85585
85586
85587
85588
85589 [heading Requirements]
85590
85591 ['Header: ][^boost/asio/ip/icmp.hpp]
85592
85593 ['Convenience header: ][^boost/asio.hpp]
85594
85595
85596 [endsect]
85597
85598
85599
85600 [section:type ip::icmp::type]
85601
85602 [indexterm2 boost_asio.indexterm.ip__icmp.type..type..ip::icmp] 
85603 Obtain an identifier for the type of the protocol. 
85604
85605
85606   int type() const;
85607
85608
85609
85610 [endsect]
85611
85612
85613
85614 [section:v4 ip::icmp::v4]
85615
85616 [indexterm2 boost_asio.indexterm.ip__icmp.v4..v4..ip::icmp] 
85617 Construct to represent the IPv4 ICMP protocol. 
85618
85619
85620   static icmp v4();
85621
85622
85623
85624 [endsect]
85625
85626
85627
85628 [section:v6 ip::icmp::v6]
85629
85630 [indexterm2 boost_asio.indexterm.ip__icmp.v6..v6..ip::icmp] 
85631 Construct to represent the IPv6 ICMP protocol. 
85632
85633
85634   static icmp v6();
85635
85636
85637
85638 [endsect]
85639
85640
85641
85642 [endsect]
85643
85644
85645 [section:ip__multicast__enable_loopback ip::multicast::enable_loopback]
85646
85647 [indexterm1 boost_asio.indexterm.ip__multicast__enable_loopback..ip::multicast::enable_loopback] 
85648 Socket option determining whether outgoing multicast packets will be received on the same socket if it is a member of the multicast group. 
85649
85650
85651   typedef implementation_defined enable_loopback;
85652
85653
85654
85655 Implements the IPPROTO\_IP/IP\_MULTICAST\_LOOP socket option.
85656
85657
85658 [heading Examples]
85659   
85660 Setting the option: 
85661
85662    boost::asio::ip::udp::socket socket(my_context);
85663    ...
85664    boost::asio::ip::multicast::enable_loopback option(true);
85665    socket.set_option(option);
85666
85667
85668
85669
85670
85671 Getting the current option value: 
85672
85673    boost::asio::ip::udp::socket socket(my_context);
85674    ...
85675    boost::asio::ip::multicast::enable_loopback option;
85676    socket.get_option(option);
85677    bool is_set = option.value();
85678
85679
85680
85681
85682
85683
85684
85685 [heading Requirements]
85686
85687 ['Header: ][^boost/asio/ip/multicast.hpp]
85688
85689 ['Convenience header: ][^boost/asio.hpp]
85690
85691
85692 [endsect]
85693
85694
85695
85696 [section:ip__multicast__hops ip::multicast::hops]
85697
85698 [indexterm1 boost_asio.indexterm.ip__multicast__hops..ip::multicast::hops] 
85699 Socket option for time-to-live associated with outgoing multicast packets. 
85700
85701
85702   typedef implementation_defined hops;
85703
85704
85705
85706 Implements the IPPROTO\_IP/IP\_MULTICAST\_TTL socket option.
85707
85708
85709 [heading Examples]
85710   
85711 Setting the option: 
85712
85713    boost::asio::ip::udp::socket socket(my_context);
85714    ...
85715    boost::asio::ip::multicast::hops option(4);
85716    socket.set_option(option);
85717
85718
85719
85720
85721
85722 Getting the current option value: 
85723
85724    boost::asio::ip::udp::socket socket(my_context);
85725    ...
85726    boost::asio::ip::multicast::hops option;
85727    socket.get_option(option);
85728    int ttl = option.value();
85729
85730
85731
85732
85733
85734
85735
85736 [heading Requirements]
85737
85738 ['Header: ][^boost/asio/ip/multicast.hpp]
85739
85740 ['Convenience header: ][^boost/asio.hpp]
85741
85742
85743 [endsect]
85744
85745
85746
85747 [section:ip__multicast__join_group ip::multicast::join_group]
85748
85749 [indexterm1 boost_asio.indexterm.ip__multicast__join_group..ip::multicast::join_group] 
85750 Socket option to join a multicast group on a specified interface. 
85751
85752
85753   typedef implementation_defined join_group;
85754
85755
85756
85757 Implements the IPPROTO\_IP/IP\_ADD\_MEMBERSHIP socket option.
85758
85759
85760 [heading Examples]
85761   
85762 Setting the option to join a multicast group: 
85763
85764    boost::asio::ip::udp::socket socket(my_context);
85765    ...
85766    boost::asio::ip::address multicast_address =
85767      boost::asio::ip::address::from_string("225.0.0.1");
85768    boost::asio::ip::multicast::join_group option(multicast_address);
85769    socket.set_option(option);
85770
85771
85772
85773
85774
85775
85776
85777 [heading Requirements]
85778
85779 ['Header: ][^boost/asio/ip/multicast.hpp]
85780
85781 ['Convenience header: ][^boost/asio.hpp]
85782
85783
85784 [endsect]
85785
85786
85787
85788 [section:ip__multicast__leave_group ip::multicast::leave_group]
85789
85790 [indexterm1 boost_asio.indexterm.ip__multicast__leave_group..ip::multicast::leave_group] 
85791 Socket option to leave a multicast group on a specified interface. 
85792
85793
85794   typedef implementation_defined leave_group;
85795
85796
85797
85798 Implements the IPPROTO\_IP/IP\_DROP\_MEMBERSHIP socket option.
85799
85800
85801 [heading Examples]
85802   
85803 Setting the option to leave a multicast group: 
85804
85805    boost::asio::ip::udp::socket socket(my_context);
85806    ...
85807    boost::asio::ip::address multicast_address =
85808      boost::asio::ip::address::from_string("225.0.0.1");
85809    boost::asio::ip::multicast::leave_group option(multicast_address);
85810    socket.set_option(option);
85811
85812
85813
85814
85815
85816
85817
85818 [heading Requirements]
85819
85820 ['Header: ][^boost/asio/ip/multicast.hpp]
85821
85822 ['Convenience header: ][^boost/asio.hpp]
85823
85824
85825 [endsect]
85826
85827
85828
85829 [section:ip__multicast__outbound_interface ip::multicast::outbound_interface]
85830
85831 [indexterm1 boost_asio.indexterm.ip__multicast__outbound_interface..ip::multicast::outbound_interface] 
85832 Socket option for local interface to use for outgoing multicast packets. 
85833
85834
85835   typedef implementation_defined outbound_interface;
85836
85837
85838
85839 Implements the IPPROTO\_IP/IP\_MULTICAST\_IF socket option.
85840
85841
85842 [heading Examples]
85843   
85844 Setting the option: 
85845
85846    boost::asio::ip::udp::socket socket(my_context);
85847    ...
85848    boost::asio::ip::address_v4 local_interface =
85849      boost::asio::ip::address_v4::from_string("1.2.3.4");
85850    boost::asio::ip::multicast::outbound_interface option(local_interface);
85851    socket.set_option(option);
85852
85853
85854
85855
85856
85857
85858
85859 [heading Requirements]
85860
85861 ['Header: ][^boost/asio/ip/multicast.hpp]
85862
85863 ['Convenience header: ][^boost/asio.hpp]
85864
85865
85866 [endsect]
85867
85868
85869 [section:ip__network_v4 ip::network_v4]
85870
85871
85872 Represents an IPv4 network. 
85873
85874
85875   class network_v4
85876
85877
85878 [heading Member Functions]
85879 [table
85880   [[Name][Description]]
85881
85882   [
85883     [[link boost_asio.reference.ip__network_v4.address [*address]]]
85884     [Obtain the address object specified when the network object was created. ]
85885   ]
85886   
85887   [
85888     [[link boost_asio.reference.ip__network_v4.broadcast [*broadcast]]]
85889     [Obtain an address object that represents the network's broadcast address. ]
85890   ]
85891   
85892   [
85893     [[link boost_asio.reference.ip__network_v4.canonical [*canonical]]]
85894     [Obtain the true network address, omitting any host bits. ]
85895   ]
85896   
85897   [
85898     [[link boost_asio.reference.ip__network_v4.hosts [*hosts]]]
85899     [Obtain an address range corresponding to the hosts in the network. ]
85900   ]
85901   
85902   [
85903     [[link boost_asio.reference.ip__network_v4.is_host [*is_host]]]
85904     [Test if network is a valid host address. ]
85905   ]
85906   
85907   [
85908     [[link boost_asio.reference.ip__network_v4.is_subnet_of [*is_subnet_of]]]
85909     [Test if a network is a real subnet of another network. ]
85910   ]
85911   
85912   [
85913     [[link boost_asio.reference.ip__network_v4.netmask [*netmask]]]
85914     [Obtain the netmask that was specified when the network object was created. ]
85915   ]
85916   
85917   [
85918     [[link boost_asio.reference.ip__network_v4.network [*network]]]
85919     [Obtain an address object that represents the network address. ]
85920   ]
85921   
85922   [
85923     [[link boost_asio.reference.ip__network_v4.network_v4 [*network_v4]]]
85924     [Default constructor. 
85925      [hr]
85926      Construct a network based on the specified address and prefix length. 
85927      [hr]
85928      Construct network based on the specified address and netmask. 
85929      [hr]
85930      Copy constructor. ]
85931   ]
85932   
85933   [
85934     [[link boost_asio.reference.ip__network_v4.operator_eq_ [*operator=]]]
85935     [Assign from another network. ]
85936   ]
85937   
85938   [
85939     [[link boost_asio.reference.ip__network_v4.prefix_length [*prefix_length]]]
85940     [Obtain the prefix length that was specified when the network object was created. ]
85941   ]
85942   
85943   [
85944     [[link boost_asio.reference.ip__network_v4.to_string [*to_string]]]
85945     [Get the network as an address in dotted decimal format. ]
85946   ]
85947   
85948 ]
85949
85950 [heading Friends]
85951 [table
85952   [[Name][Description]]
85953
85954   [
85955     [[link boost_asio.reference.ip__network_v4.operator_not__eq_ [*operator!=]]]
85956     [Compare two networks for inequality. ]
85957   ]
85958   
85959   [
85960     [[link boost_asio.reference.ip__network_v4.operator_eq__eq_ [*operator==]]]
85961     [Compare two networks for equality. ]
85962   ]
85963   
85964 ]
85965
85966 [heading Related Functions]
85967 [table
85968   [[Name][Description]]
85969
85970   [
85971     [[link boost_asio.reference.ip__network_v4.make_network_v4 [*make_network_v4]]]
85972     [Create an IPv4 network from a string containing IP address and prefix length. ]
85973   ]
85974   
85975 ]
85976
85977 The [link boost_asio.reference.ip__network_v4 `ip::network_v4`] class provides the ability to use and manipulate IP version 4 networks.
85978
85979
85980 [heading Thread Safety]
85981   
85982 ['Distinct] ['objects:] Safe.
85983
85984 ['Shared] ['objects:] Unsafe. 
85985
85986
85987
85988 [heading Requirements]
85989
85990 ['Header: ][^boost/asio/ip/network_v4.hpp]
85991
85992 ['Convenience header: ][^boost/asio.hpp]
85993
85994
85995 [section:address ip::network_v4::address]
85996
85997 [indexterm2 boost_asio.indexterm.ip__network_v4.address..address..ip::network_v4] 
85998 Obtain the address object specified when the network object was created. 
85999
86000
86001   address_v4 address() const;
86002
86003
86004
86005 [endsect]
86006
86007
86008
86009 [section:broadcast ip::network_v4::broadcast]
86010
86011 [indexterm2 boost_asio.indexterm.ip__network_v4.broadcast..broadcast..ip::network_v4] 
86012 Obtain an address object that represents the network's broadcast address. 
86013
86014
86015   address_v4 broadcast() const;
86016
86017
86018
86019 [endsect]
86020
86021
86022
86023 [section:canonical ip::network_v4::canonical]
86024
86025 [indexterm2 boost_asio.indexterm.ip__network_v4.canonical..canonical..ip::network_v4] 
86026 Obtain the true network address, omitting any host bits. 
86027
86028
86029   network_v4 canonical() const;
86030
86031
86032
86033 [endsect]
86034
86035
86036
86037 [section:hosts ip::network_v4::hosts]
86038
86039 [indexterm2 boost_asio.indexterm.ip__network_v4.hosts..hosts..ip::network_v4] 
86040 Obtain an address range corresponding to the hosts in the network. 
86041
86042
86043   address_v4_range hosts() const;
86044
86045
86046
86047 [endsect]
86048
86049
86050
86051 [section:is_host ip::network_v4::is_host]
86052
86053 [indexterm2 boost_asio.indexterm.ip__network_v4.is_host..is_host..ip::network_v4] 
86054 Test if network is a valid host address. 
86055
86056
86057   bool is_host() const;
86058
86059
86060
86061 [endsect]
86062
86063
86064
86065 [section:is_subnet_of ip::network_v4::is_subnet_of]
86066
86067 [indexterm2 boost_asio.indexterm.ip__network_v4.is_subnet_of..is_subnet_of..ip::network_v4] 
86068 Test if a network is a real subnet of another network. 
86069
86070
86071   bool is_subnet_of(
86072       const network_v4 & other) const;
86073
86074
86075
86076 [endsect]
86077
86078
86079 [section:make_network_v4 ip::network_v4::make_network_v4]
86080
86081 [indexterm2 boost_asio.indexterm.ip__network_v4.make_network_v4..make_network_v4..ip::network_v4] 
86082 Create an IPv4 network from a string containing IP address and prefix length. 
86083
86084
86085   network_v4 ``[link boost_asio.reference.ip__network_v4.make_network_v4.overload1 make_network_v4]``(
86086       const char * str);
86087   ``  [''''&raquo;''' [link boost_asio.reference.ip__network_v4.make_network_v4.overload1 more...]]``
86088
86089   network_v4 ``[link boost_asio.reference.ip__network_v4.make_network_v4.overload2 make_network_v4]``(
86090       const char * str,
86091       boost::system::error_code & ec);
86092   ``  [''''&raquo;''' [link boost_asio.reference.ip__network_v4.make_network_v4.overload2 more...]]``
86093
86094   network_v4 ``[link boost_asio.reference.ip__network_v4.make_network_v4.overload3 make_network_v4]``(
86095       const std::string & str);
86096   ``  [''''&raquo;''' [link boost_asio.reference.ip__network_v4.make_network_v4.overload3 more...]]``
86097
86098   network_v4 ``[link boost_asio.reference.ip__network_v4.make_network_v4.overload4 make_network_v4]``(
86099       const std::string & str,
86100       boost::system::error_code & ec);
86101   ``  [''''&raquo;''' [link boost_asio.reference.ip__network_v4.make_network_v4.overload4 more...]]``
86102
86103   network_v4 ``[link boost_asio.reference.ip__network_v4.make_network_v4.overload5 make_network_v4]``(
86104       string_view str);
86105   ``  [''''&raquo;''' [link boost_asio.reference.ip__network_v4.make_network_v4.overload5 more...]]``
86106
86107   network_v4 ``[link boost_asio.reference.ip__network_v4.make_network_v4.overload6 make_network_v4]``(
86108       string_view str,
86109       boost::system::error_code & ec);
86110   ``  [''''&raquo;''' [link boost_asio.reference.ip__network_v4.make_network_v4.overload6 more...]]``
86111
86112
86113 [section:overload1 ip::network_v4::make_network_v4 (1 of 6 overloads)]
86114
86115
86116 Create an IPv4 network from a string containing IP address and prefix length. 
86117
86118
86119   network_v4 make_network_v4(
86120       const char * str);
86121
86122
86123
86124 [endsect]
86125
86126
86127
86128 [section:overload2 ip::network_v4::make_network_v4 (2 of 6 overloads)]
86129
86130
86131 Create an IPv4 network from a string containing IP address and prefix length. 
86132
86133
86134   network_v4 make_network_v4(
86135       const char * str,
86136       boost::system::error_code & ec);
86137
86138
86139
86140 [endsect]
86141
86142
86143
86144 [section:overload3 ip::network_v4::make_network_v4 (3 of 6 overloads)]
86145
86146
86147 Create an IPv4 network from a string containing IP address and prefix length. 
86148
86149
86150   network_v4 make_network_v4(
86151       const std::string & str);
86152
86153
86154
86155 [endsect]
86156
86157
86158
86159 [section:overload4 ip::network_v4::make_network_v4 (4 of 6 overloads)]
86160
86161
86162 Create an IPv4 network from a string containing IP address and prefix length. 
86163
86164
86165   network_v4 make_network_v4(
86166       const std::string & str,
86167       boost::system::error_code & ec);
86168
86169
86170
86171 [endsect]
86172
86173
86174
86175 [section:overload5 ip::network_v4::make_network_v4 (5 of 6 overloads)]
86176
86177
86178 Create an IPv4 network from a string containing IP address and prefix length. 
86179
86180
86181   network_v4 make_network_v4(
86182       string_view str);
86183
86184
86185
86186 [endsect]
86187
86188
86189
86190 [section:overload6 ip::network_v4::make_network_v4 (6 of 6 overloads)]
86191
86192
86193 Create an IPv4 network from a string containing IP address and prefix length. 
86194
86195
86196   network_v4 make_network_v4(
86197       string_view str,
86198       boost::system::error_code & ec);
86199
86200
86201
86202 [endsect]
86203
86204
86205 [endsect]
86206
86207
86208 [section:netmask ip::network_v4::netmask]
86209
86210 [indexterm2 boost_asio.indexterm.ip__network_v4.netmask..netmask..ip::network_v4] 
86211 Obtain the netmask that was specified when the network object was created. 
86212
86213
86214   address_v4 netmask() const;
86215
86216
86217
86218 [endsect]
86219
86220
86221
86222 [section:network ip::network_v4::network]
86223
86224 [indexterm2 boost_asio.indexterm.ip__network_v4.network..network..ip::network_v4] 
86225 Obtain an address object that represents the network address. 
86226
86227
86228   address_v4 network() const;
86229
86230
86231
86232 [endsect]
86233
86234
86235 [section:network_v4 ip::network_v4::network_v4]
86236
86237 [indexterm2 boost_asio.indexterm.ip__network_v4.network_v4..network_v4..ip::network_v4] 
86238 Default constructor. 
86239
86240
86241   ``[link boost_asio.reference.ip__network_v4.network_v4.overload1 network_v4]``();
86242   ``  [''''&raquo;''' [link boost_asio.reference.ip__network_v4.network_v4.overload1 more...]]``
86243
86244
86245 Construct a network based on the specified address and prefix length. 
86246
86247
86248   ``[link boost_asio.reference.ip__network_v4.network_v4.overload2 network_v4]``(
86249       const address_v4 & addr,
86250       unsigned short prefix_len);
86251   ``  [''''&raquo;''' [link boost_asio.reference.ip__network_v4.network_v4.overload2 more...]]``
86252
86253
86254 Construct network based on the specified address and netmask. 
86255
86256
86257   ``[link boost_asio.reference.ip__network_v4.network_v4.overload3 network_v4]``(
86258       const address_v4 & addr,
86259       const address_v4 & mask);
86260   ``  [''''&raquo;''' [link boost_asio.reference.ip__network_v4.network_v4.overload3 more...]]``
86261
86262
86263 Copy constructor. 
86264
86265
86266   ``[link boost_asio.reference.ip__network_v4.network_v4.overload4 network_v4]``(
86267       const network_v4 & other);
86268   ``  [''''&raquo;''' [link boost_asio.reference.ip__network_v4.network_v4.overload4 more...]]``
86269
86270
86271 [section:overload1 ip::network_v4::network_v4 (1 of 4 overloads)]
86272
86273
86274 Default constructor. 
86275
86276
86277   network_v4();
86278
86279
86280
86281 [endsect]
86282
86283
86284
86285 [section:overload2 ip::network_v4::network_v4 (2 of 4 overloads)]
86286
86287
86288 Construct a network based on the specified address and prefix length. 
86289
86290
86291   network_v4(
86292       const address_v4 & addr,
86293       unsigned short prefix_len);
86294
86295
86296
86297 [endsect]
86298
86299
86300
86301 [section:overload3 ip::network_v4::network_v4 (3 of 4 overloads)]
86302
86303
86304 Construct network based on the specified address and netmask. 
86305
86306
86307   network_v4(
86308       const address_v4 & addr,
86309       const address_v4 & mask);
86310
86311
86312
86313 [endsect]
86314
86315
86316
86317 [section:overload4 ip::network_v4::network_v4 (4 of 4 overloads)]
86318
86319
86320 Copy constructor. 
86321
86322
86323   network_v4(
86324       const network_v4 & other);
86325
86326
86327
86328 [endsect]
86329
86330
86331 [endsect]
86332
86333
86334 [section:operator_not__eq_ ip::network_v4::operator!=]
86335
86336 [indexterm2 boost_asio.indexterm.ip__network_v4.operator_not__eq_..operator!=..ip::network_v4] 
86337 Compare two networks for inequality. 
86338
86339
86340   friend bool operator!=(
86341       const network_v4 & a,
86342       const network_v4 & b);
86343
86344
86345 [heading Requirements]
86346
86347 ['Header: ][^boost/asio/ip/network_v4.hpp]
86348
86349 ['Convenience header: ][^boost/asio.hpp]
86350
86351
86352 [endsect]
86353
86354
86355
86356 [section:operator_eq_ ip::network_v4::operator=]
86357
86358 [indexterm2 boost_asio.indexterm.ip__network_v4.operator_eq_..operator=..ip::network_v4] 
86359 Assign from another network. 
86360
86361
86362   network_v4 & operator=(
86363       const network_v4 & other);
86364
86365
86366
86367 [endsect]
86368
86369
86370
86371 [section:operator_eq__eq_ ip::network_v4::operator==]
86372
86373 [indexterm2 boost_asio.indexterm.ip__network_v4.operator_eq__eq_..operator==..ip::network_v4] 
86374 Compare two networks for equality. 
86375
86376
86377   friend bool operator==(
86378       const network_v4 & a,
86379       const network_v4 & b);
86380
86381
86382 [heading Requirements]
86383
86384 ['Header: ][^boost/asio/ip/network_v4.hpp]
86385
86386 ['Convenience header: ][^boost/asio.hpp]
86387
86388
86389 [endsect]
86390
86391
86392
86393 [section:prefix_length ip::network_v4::prefix_length]
86394
86395 [indexterm2 boost_asio.indexterm.ip__network_v4.prefix_length..prefix_length..ip::network_v4] 
86396 Obtain the prefix length that was specified when the network object was created. 
86397
86398
86399   unsigned short prefix_length() const;
86400
86401
86402
86403 [endsect]
86404
86405
86406 [section:to_string ip::network_v4::to_string]
86407
86408 [indexterm2 boost_asio.indexterm.ip__network_v4.to_string..to_string..ip::network_v4] 
86409 Get the network as an address in dotted decimal format. 
86410
86411
86412   std::string ``[link boost_asio.reference.ip__network_v4.to_string.overload1 to_string]``() const;
86413   ``  [''''&raquo;''' [link boost_asio.reference.ip__network_v4.to_string.overload1 more...]]``
86414
86415   std::string ``[link boost_asio.reference.ip__network_v4.to_string.overload2 to_string]``(
86416       boost::system::error_code & ec) const;
86417   ``  [''''&raquo;''' [link boost_asio.reference.ip__network_v4.to_string.overload2 more...]]``
86418
86419
86420 [section:overload1 ip::network_v4::to_string (1 of 2 overloads)]
86421
86422
86423 Get the network as an address in dotted decimal format. 
86424
86425
86426   std::string to_string() const;
86427
86428
86429
86430 [endsect]
86431
86432
86433
86434 [section:overload2 ip::network_v4::to_string (2 of 2 overloads)]
86435
86436
86437 Get the network as an address in dotted decimal format. 
86438
86439
86440   std::string to_string(
86441       boost::system::error_code & ec) const;
86442
86443
86444
86445 [endsect]
86446
86447
86448 [endsect]
86449
86450
86451 [endsect]
86452
86453 [section:ip__network_v6 ip::network_v6]
86454
86455
86456 Represents an IPv6 network. 
86457
86458
86459   class network_v6
86460
86461
86462 [heading Member Functions]
86463 [table
86464   [[Name][Description]]
86465
86466   [
86467     [[link boost_asio.reference.ip__network_v6.address [*address]]]
86468     [Obtain the address object specified when the network object was created. ]
86469   ]
86470   
86471   [
86472     [[link boost_asio.reference.ip__network_v6.canonical [*canonical]]]
86473     [Obtain the true network address, omitting any host bits. ]
86474   ]
86475   
86476   [
86477     [[link boost_asio.reference.ip__network_v6.hosts [*hosts]]]
86478     [Obtain an address range corresponding to the hosts in the network. ]
86479   ]
86480   
86481   [
86482     [[link boost_asio.reference.ip__network_v6.is_host [*is_host]]]
86483     [Test if network is a valid host address. ]
86484   ]
86485   
86486   [
86487     [[link boost_asio.reference.ip__network_v6.is_subnet_of [*is_subnet_of]]]
86488     [Test if a network is a real subnet of another network. ]
86489   ]
86490   
86491   [
86492     [[link boost_asio.reference.ip__network_v6.network [*network]]]
86493     [Obtain an address object that represents the network address. ]
86494   ]
86495   
86496   [
86497     [[link boost_asio.reference.ip__network_v6.network_v6 [*network_v6]]]
86498     [Default constructor. 
86499      [hr]
86500      Construct a network based on the specified address and prefix length. 
86501      [hr]
86502      Copy constructor. ]
86503   ]
86504   
86505   [
86506     [[link boost_asio.reference.ip__network_v6.operator_eq_ [*operator=]]]
86507     [Assign from another network. ]
86508   ]
86509   
86510   [
86511     [[link boost_asio.reference.ip__network_v6.prefix_length [*prefix_length]]]
86512     [Obtain the prefix length that was specified when the network object was created. ]
86513   ]
86514   
86515   [
86516     [[link boost_asio.reference.ip__network_v6.to_string [*to_string]]]
86517     [Get the network as an address in dotted decimal format. ]
86518   ]
86519   
86520 ]
86521
86522 [heading Friends]
86523 [table
86524   [[Name][Description]]
86525
86526   [
86527     [[link boost_asio.reference.ip__network_v6.operator_not__eq_ [*operator!=]]]
86528     [Compare two networks for inequality. ]
86529   ]
86530   
86531   [
86532     [[link boost_asio.reference.ip__network_v6.operator_eq__eq_ [*operator==]]]
86533     [Compare two networks for equality. ]
86534   ]
86535   
86536 ]
86537
86538 [heading Related Functions]
86539 [table
86540   [[Name][Description]]
86541
86542   [
86543     [[link boost_asio.reference.ip__network_v6.make_network_v6 [*make_network_v6]]]
86544     [Create an IPv6 network from a string containing IP address and prefix length. ]
86545   ]
86546   
86547 ]
86548
86549 The [link boost_asio.reference.ip__network_v6 `ip::network_v6`] class provides the ability to use and manipulate IP version 6 networks.
86550
86551
86552 [heading Thread Safety]
86553   
86554 ['Distinct] ['objects:] Safe.
86555
86556 ['Shared] ['objects:] Unsafe. 
86557
86558
86559
86560 [heading Requirements]
86561
86562 ['Header: ][^boost/asio/ip/network_v6.hpp]
86563
86564 ['Convenience header: ][^boost/asio.hpp]
86565
86566
86567 [section:address ip::network_v6::address]
86568
86569 [indexterm2 boost_asio.indexterm.ip__network_v6.address..address..ip::network_v6] 
86570 Obtain the address object specified when the network object was created. 
86571
86572
86573   address_v6 address() const;
86574
86575
86576
86577 [endsect]
86578
86579
86580
86581 [section:canonical ip::network_v6::canonical]
86582
86583 [indexterm2 boost_asio.indexterm.ip__network_v6.canonical..canonical..ip::network_v6] 
86584 Obtain the true network address, omitting any host bits. 
86585
86586
86587   network_v6 canonical() const;
86588
86589
86590
86591 [endsect]
86592
86593
86594
86595 [section:hosts ip::network_v6::hosts]
86596
86597 [indexterm2 boost_asio.indexterm.ip__network_v6.hosts..hosts..ip::network_v6] 
86598 Obtain an address range corresponding to the hosts in the network. 
86599
86600
86601   address_v6_range hosts() const;
86602
86603
86604
86605 [endsect]
86606
86607
86608
86609 [section:is_host ip::network_v6::is_host]
86610
86611 [indexterm2 boost_asio.indexterm.ip__network_v6.is_host..is_host..ip::network_v6] 
86612 Test if network is a valid host address. 
86613
86614
86615   bool is_host() const;
86616
86617
86618
86619 [endsect]
86620
86621
86622
86623 [section:is_subnet_of ip::network_v6::is_subnet_of]
86624
86625 [indexterm2 boost_asio.indexterm.ip__network_v6.is_subnet_of..is_subnet_of..ip::network_v6] 
86626 Test if a network is a real subnet of another network. 
86627
86628
86629   bool is_subnet_of(
86630       const network_v6 & other) const;
86631
86632
86633
86634 [endsect]
86635
86636
86637 [section:make_network_v6 ip::network_v6::make_network_v6]
86638
86639 [indexterm2 boost_asio.indexterm.ip__network_v6.make_network_v6..make_network_v6..ip::network_v6] 
86640 Create an IPv6 network from a string containing IP address and prefix length. 
86641
86642
86643   network_v6 ``[link boost_asio.reference.ip__network_v6.make_network_v6.overload1 make_network_v6]``(
86644       const char * str);
86645   ``  [''''&raquo;''' [link boost_asio.reference.ip__network_v6.make_network_v6.overload1 more...]]``
86646
86647   network_v6 ``[link boost_asio.reference.ip__network_v6.make_network_v6.overload2 make_network_v6]``(
86648       const char * str,
86649       boost::system::error_code & ec);
86650   ``  [''''&raquo;''' [link boost_asio.reference.ip__network_v6.make_network_v6.overload2 more...]]``
86651
86652   network_v6 ``[link boost_asio.reference.ip__network_v6.make_network_v6.overload3 make_network_v6]``(
86653       const std::string & str);
86654   ``  [''''&raquo;''' [link boost_asio.reference.ip__network_v6.make_network_v6.overload3 more...]]``
86655
86656   network_v6 ``[link boost_asio.reference.ip__network_v6.make_network_v6.overload4 make_network_v6]``(
86657       const std::string & str,
86658       boost::system::error_code & ec);
86659   ``  [''''&raquo;''' [link boost_asio.reference.ip__network_v6.make_network_v6.overload4 more...]]``
86660
86661   network_v6 ``[link boost_asio.reference.ip__network_v6.make_network_v6.overload5 make_network_v6]``(
86662       string_view str);
86663   ``  [''''&raquo;''' [link boost_asio.reference.ip__network_v6.make_network_v6.overload5 more...]]``
86664
86665   network_v6 ``[link boost_asio.reference.ip__network_v6.make_network_v6.overload6 make_network_v6]``(
86666       string_view str,
86667       boost::system::error_code & ec);
86668   ``  [''''&raquo;''' [link boost_asio.reference.ip__network_v6.make_network_v6.overload6 more...]]``
86669
86670
86671 [section:overload1 ip::network_v6::make_network_v6 (1 of 6 overloads)]
86672
86673
86674 Create an IPv6 network from a string containing IP address and prefix length. 
86675
86676
86677   network_v6 make_network_v6(
86678       const char * str);
86679
86680
86681
86682 [endsect]
86683
86684
86685
86686 [section:overload2 ip::network_v6::make_network_v6 (2 of 6 overloads)]
86687
86688
86689 Create an IPv6 network from a string containing IP address and prefix length. 
86690
86691
86692   network_v6 make_network_v6(
86693       const char * str,
86694       boost::system::error_code & ec);
86695
86696
86697
86698 [endsect]
86699
86700
86701
86702 [section:overload3 ip::network_v6::make_network_v6 (3 of 6 overloads)]
86703
86704
86705 Create an IPv6 network from a string containing IP address and prefix length. 
86706
86707
86708   network_v6 make_network_v6(
86709       const std::string & str);
86710
86711
86712
86713 [endsect]
86714
86715
86716
86717 [section:overload4 ip::network_v6::make_network_v6 (4 of 6 overloads)]
86718
86719
86720 Create an IPv6 network from a string containing IP address and prefix length. 
86721
86722
86723   network_v6 make_network_v6(
86724       const std::string & str,
86725       boost::system::error_code & ec);
86726
86727
86728
86729 [endsect]
86730
86731
86732
86733 [section:overload5 ip::network_v6::make_network_v6 (5 of 6 overloads)]
86734
86735
86736 Create an IPv6 network from a string containing IP address and prefix length. 
86737
86738
86739   network_v6 make_network_v6(
86740       string_view str);
86741
86742
86743
86744 [endsect]
86745
86746
86747
86748 [section:overload6 ip::network_v6::make_network_v6 (6 of 6 overloads)]
86749
86750
86751 Create an IPv6 network from a string containing IP address and prefix length. 
86752
86753
86754   network_v6 make_network_v6(
86755       string_view str,
86756       boost::system::error_code & ec);
86757
86758
86759
86760 [endsect]
86761
86762
86763 [endsect]
86764
86765
86766 [section:network ip::network_v6::network]
86767
86768 [indexterm2 boost_asio.indexterm.ip__network_v6.network..network..ip::network_v6] 
86769 Obtain an address object that represents the network address. 
86770
86771
86772   address_v6 network() const;
86773
86774
86775
86776 [endsect]
86777
86778
86779 [section:network_v6 ip::network_v6::network_v6]
86780
86781 [indexterm2 boost_asio.indexterm.ip__network_v6.network_v6..network_v6..ip::network_v6] 
86782 Default constructor. 
86783
86784
86785   ``[link boost_asio.reference.ip__network_v6.network_v6.overload1 network_v6]``();
86786   ``  [''''&raquo;''' [link boost_asio.reference.ip__network_v6.network_v6.overload1 more...]]``
86787
86788
86789 Construct a network based on the specified address and prefix length. 
86790
86791
86792   ``[link boost_asio.reference.ip__network_v6.network_v6.overload2 network_v6]``(
86793       const address_v6 & addr,
86794       unsigned short prefix_len);
86795   ``  [''''&raquo;''' [link boost_asio.reference.ip__network_v6.network_v6.overload2 more...]]``
86796
86797
86798 Copy constructor. 
86799
86800
86801   ``[link boost_asio.reference.ip__network_v6.network_v6.overload3 network_v6]``(
86802       const network_v6 & other);
86803   ``  [''''&raquo;''' [link boost_asio.reference.ip__network_v6.network_v6.overload3 more...]]``
86804
86805
86806 [section:overload1 ip::network_v6::network_v6 (1 of 3 overloads)]
86807
86808
86809 Default constructor. 
86810
86811
86812   network_v6();
86813
86814
86815
86816 [endsect]
86817
86818
86819
86820 [section:overload2 ip::network_v6::network_v6 (2 of 3 overloads)]
86821
86822
86823 Construct a network based on the specified address and prefix length. 
86824
86825
86826   network_v6(
86827       const address_v6 & addr,
86828       unsigned short prefix_len);
86829
86830
86831
86832 [endsect]
86833
86834
86835
86836 [section:overload3 ip::network_v6::network_v6 (3 of 3 overloads)]
86837
86838
86839 Copy constructor. 
86840
86841
86842   network_v6(
86843       const network_v6 & other);
86844
86845
86846
86847 [endsect]
86848
86849
86850 [endsect]
86851
86852
86853 [section:operator_not__eq_ ip::network_v6::operator!=]
86854
86855 [indexterm2 boost_asio.indexterm.ip__network_v6.operator_not__eq_..operator!=..ip::network_v6] 
86856 Compare two networks for inequality. 
86857
86858
86859   friend bool operator!=(
86860       const network_v6 & a,
86861       const network_v6 & b);
86862
86863
86864 [heading Requirements]
86865
86866 ['Header: ][^boost/asio/ip/network_v6.hpp]
86867
86868 ['Convenience header: ][^boost/asio.hpp]
86869
86870
86871 [endsect]
86872
86873
86874
86875 [section:operator_eq_ ip::network_v6::operator=]
86876
86877 [indexterm2 boost_asio.indexterm.ip__network_v6.operator_eq_..operator=..ip::network_v6] 
86878 Assign from another network. 
86879
86880
86881   network_v6 & operator=(
86882       const network_v6 & other);
86883
86884
86885
86886 [endsect]
86887
86888
86889
86890 [section:operator_eq__eq_ ip::network_v6::operator==]
86891
86892 [indexterm2 boost_asio.indexterm.ip__network_v6.operator_eq__eq_..operator==..ip::network_v6] 
86893 Compare two networks for equality. 
86894
86895
86896   friend bool operator==(
86897       const network_v6 & a,
86898       const network_v6 & b);
86899
86900
86901 [heading Requirements]
86902
86903 ['Header: ][^boost/asio/ip/network_v6.hpp]
86904
86905 ['Convenience header: ][^boost/asio.hpp]
86906
86907
86908 [endsect]
86909
86910
86911
86912 [section:prefix_length ip::network_v6::prefix_length]
86913
86914 [indexterm2 boost_asio.indexterm.ip__network_v6.prefix_length..prefix_length..ip::network_v6] 
86915 Obtain the prefix length that was specified when the network object was created. 
86916
86917
86918   unsigned short prefix_length() const;
86919
86920
86921
86922 [endsect]
86923
86924
86925 [section:to_string ip::network_v6::to_string]
86926
86927 [indexterm2 boost_asio.indexterm.ip__network_v6.to_string..to_string..ip::network_v6] 
86928 Get the network as an address in dotted decimal format. 
86929
86930
86931   std::string ``[link boost_asio.reference.ip__network_v6.to_string.overload1 to_string]``() const;
86932   ``  [''''&raquo;''' [link boost_asio.reference.ip__network_v6.to_string.overload1 more...]]``
86933
86934   std::string ``[link boost_asio.reference.ip__network_v6.to_string.overload2 to_string]``(
86935       boost::system::error_code & ec) const;
86936   ``  [''''&raquo;''' [link boost_asio.reference.ip__network_v6.to_string.overload2 more...]]``
86937
86938
86939 [section:overload1 ip::network_v6::to_string (1 of 2 overloads)]
86940
86941
86942 Get the network as an address in dotted decimal format. 
86943
86944
86945   std::string to_string() const;
86946
86947
86948
86949 [endsect]
86950
86951
86952
86953 [section:overload2 ip::network_v6::to_string (2 of 2 overloads)]
86954
86955
86956 Get the network as an address in dotted decimal format. 
86957
86958
86959   std::string to_string(
86960       boost::system::error_code & ec) const;
86961
86962
86963
86964 [endsect]
86965
86966
86967 [endsect]
86968
86969
86970 [endsect]
86971
86972 [section:ip__resolver_base ip::resolver_base]
86973
86974
86975 The [link boost_asio.reference.ip__resolver_base `ip::resolver_base`] class is used as a base for the [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] class templates to provide a common place to define the flag constants. 
86976
86977
86978   class resolver_base
86979
86980
86981 [heading Types]
86982 [table
86983   [[Name][Description]]
86984
86985   [
86986
86987     [[link boost_asio.reference.ip__resolver_base.flags [*flags]]]
86988     [A bitmask type (C++ Std \[lib.bitmask.types\]). ]
86989   
86990   ]
86991
86992 ]
86993
86994 [heading Protected Member Functions]
86995 [table
86996   [[Name][Description]]
86997
86998   [
86999     [[link boost_asio.reference.ip__resolver_base._resolver_base [*~resolver_base]]]
87000     [Protected destructor to prevent deletion through this type. ]
87001   ]
87002   
87003 ]
87004
87005 [heading Data Members]
87006 [table
87007   [[Name][Description]]
87008
87009   [
87010     [[link boost_asio.reference.ip__resolver_base.address_configured [*address_configured]]]
87011     [Only return IPv4 addresses if a non-loopback IPv4 address is configured for the system. Only return IPv6 addresses if a non-loopback IPv6 address is configured for the system. ]
87012   ]
87013
87014   [
87015     [[link boost_asio.reference.ip__resolver_base.all_matching [*all_matching]]]
87016     [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ]
87017   ]
87018
87019   [
87020     [[link boost_asio.reference.ip__resolver_base.canonical_name [*canonical_name]]]
87021     [Determine the canonical name of the host specified in the query. ]
87022   ]
87023
87024   [
87025     [[link boost_asio.reference.ip__resolver_base.numeric_host [*numeric_host]]]
87026     [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ]
87027   ]
87028
87029   [
87030     [[link boost_asio.reference.ip__resolver_base.numeric_service [*numeric_service]]]
87031     [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ]
87032   ]
87033
87034   [
87035     [[link boost_asio.reference.ip__resolver_base.passive [*passive]]]
87036     [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ]
87037   ]
87038
87039   [
87040     [[link boost_asio.reference.ip__resolver_base.v4_mapped [*v4_mapped]]]
87041     [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ]
87042   ]
87043
87044 ]
87045
87046 [heading Requirements]
87047
87048 ['Header: ][^boost/asio/ip/resolver_base.hpp]
87049
87050 ['Convenience header: ][^boost/asio.hpp]
87051
87052
87053 [section:address_configured ip::resolver_base::address_configured]
87054
87055 [indexterm2 boost_asio.indexterm.ip__resolver_base.address_configured..address_configured..ip::resolver_base] 
87056 Only return IPv4 addresses if a non-loopback IPv4 address is configured for the system. Only return IPv6 addresses if a non-loopback IPv6 address is configured for the system. 
87057
87058
87059   static const flags address_configured = implementation_defined;
87060
87061
87062
87063 [endsect]
87064
87065
87066
87067 [section:all_matching ip::resolver_base::all_matching]
87068
87069 [indexterm2 boost_asio.indexterm.ip__resolver_base.all_matching..all_matching..ip::resolver_base] 
87070 If used with v4\_mapped, return all matching IPv6 and IPv4 addresses. 
87071
87072
87073   static const flags all_matching = implementation_defined;
87074
87075
87076
87077 [endsect]
87078
87079
87080
87081 [section:canonical_name ip::resolver_base::canonical_name]
87082
87083 [indexterm2 boost_asio.indexterm.ip__resolver_base.canonical_name..canonical_name..ip::resolver_base] 
87084 Determine the canonical name of the host specified in the query. 
87085
87086
87087   static const flags canonical_name = implementation_defined;
87088
87089
87090
87091 [endsect]
87092
87093
87094
87095 [section:flags ip::resolver_base::flags]
87096
87097 [indexterm2 boost_asio.indexterm.ip__resolver_base.flags..flags..ip::resolver_base] 
87098 A bitmask type (C++ Std [lib.bitmask.types]). 
87099
87100
87101   typedef unspecified flags;
87102
87103
87104
87105 [heading Requirements]
87106
87107 ['Header: ][^boost/asio/ip/resolver_base.hpp]
87108
87109 ['Convenience header: ][^boost/asio.hpp]
87110
87111
87112 [endsect]
87113
87114
87115
87116 [section:numeric_host ip::resolver_base::numeric_host]
87117
87118 [indexterm2 boost_asio.indexterm.ip__resolver_base.numeric_host..numeric_host..ip::resolver_base] 
87119 Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. 
87120
87121
87122   static const flags numeric_host = implementation_defined;
87123
87124
87125
87126 [endsect]
87127
87128
87129
87130 [section:numeric_service ip::resolver_base::numeric_service]
87131
87132 [indexterm2 boost_asio.indexterm.ip__resolver_base.numeric_service..numeric_service..ip::resolver_base] 
87133 Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. 
87134
87135
87136   static const flags numeric_service = implementation_defined;
87137
87138
87139
87140 [endsect]
87141
87142
87143
87144 [section:passive ip::resolver_base::passive]
87145
87146 [indexterm2 boost_asio.indexterm.ip__resolver_base.passive..passive..ip::resolver_base] 
87147 Indicate that returned endpoint is intended for use as a locally bound socket endpoint. 
87148
87149
87150   static const flags passive = implementation_defined;
87151
87152
87153
87154 [endsect]
87155
87156
87157
87158 [section:v4_mapped ip::resolver_base::v4_mapped]
87159
87160 [indexterm2 boost_asio.indexterm.ip__resolver_base.v4_mapped..v4_mapped..ip::resolver_base] 
87161 If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. 
87162
87163
87164   static const flags v4_mapped = implementation_defined;
87165
87166
87167
87168 [endsect]
87169
87170
87171
87172 [section:_resolver_base ip::resolver_base::~resolver_base]
87173
87174 [indexterm2 boost_asio.indexterm.ip__resolver_base._resolver_base..~resolver_base..ip::resolver_base] 
87175 Protected destructor to prevent deletion through this type. 
87176
87177
87178   ~resolver_base();
87179
87180
87181
87182 [endsect]
87183
87184
87185
87186 [endsect]
87187
87188 [section:ip__resolver_query_base ip::resolver_query_base]
87189
87190
87191 The [link boost_asio.reference.ip__resolver_query_base `ip::resolver_query_base`] class is used as a base for the [link boost_asio.reference.ip__basic_resolver_query `ip::basic_resolver_query`] class templates to provide a common place to define the flag constants. 
87192
87193
87194   class resolver_query_base :
87195     public ip::resolver_base
87196
87197
87198 [heading Types]
87199 [table
87200   [[Name][Description]]
87201
87202   [
87203
87204     [[link boost_asio.reference.ip__resolver_query_base.flags [*flags]]]
87205     [A bitmask type (C++ Std \[lib.bitmask.types\]). ]
87206   
87207   ]
87208
87209 ]
87210
87211 [heading Protected Member Functions]
87212 [table
87213   [[Name][Description]]
87214
87215   [
87216     [[link boost_asio.reference.ip__resolver_query_base._resolver_query_base [*~resolver_query_base]]]
87217     [Protected destructor to prevent deletion through this type. ]
87218   ]
87219   
87220 ]
87221
87222 [heading Data Members]
87223 [table
87224   [[Name][Description]]
87225
87226   [
87227     [[link boost_asio.reference.ip__resolver_query_base.address_configured [*address_configured]]]
87228     [Only return IPv4 addresses if a non-loopback IPv4 address is configured for the system. Only return IPv6 addresses if a non-loopback IPv6 address is configured for the system. ]
87229   ]
87230
87231   [
87232     [[link boost_asio.reference.ip__resolver_query_base.all_matching [*all_matching]]]
87233     [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ]
87234   ]
87235
87236   [
87237     [[link boost_asio.reference.ip__resolver_query_base.canonical_name [*canonical_name]]]
87238     [Determine the canonical name of the host specified in the query. ]
87239   ]
87240
87241   [
87242     [[link boost_asio.reference.ip__resolver_query_base.numeric_host [*numeric_host]]]
87243     [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ]
87244   ]
87245
87246   [
87247     [[link boost_asio.reference.ip__resolver_query_base.numeric_service [*numeric_service]]]
87248     [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ]
87249   ]
87250
87251   [
87252     [[link boost_asio.reference.ip__resolver_query_base.passive [*passive]]]
87253     [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ]
87254   ]
87255
87256   [
87257     [[link boost_asio.reference.ip__resolver_query_base.v4_mapped [*v4_mapped]]]
87258     [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ]
87259   ]
87260
87261 ]
87262
87263 [heading Requirements]
87264
87265 ['Header: ][^boost/asio/ip/resolver_query_base.hpp]
87266
87267 ['Convenience header: ][^boost/asio.hpp]
87268
87269
87270 [section:address_configured ip::resolver_query_base::address_configured]
87271
87272
87273 ['Inherited from ip::resolver_base.]
87274
87275 [indexterm2 boost_asio.indexterm.ip__resolver_query_base.address_configured..address_configured..ip::resolver_query_base] 
87276 Only return IPv4 addresses if a non-loopback IPv4 address is configured for the system. Only return IPv6 addresses if a non-loopback IPv6 address is configured for the system. 
87277
87278
87279   static const flags address_configured = implementation_defined;
87280
87281
87282
87283 [endsect]
87284
87285
87286
87287 [section:all_matching ip::resolver_query_base::all_matching]
87288
87289
87290 ['Inherited from ip::resolver_base.]
87291
87292 [indexterm2 boost_asio.indexterm.ip__resolver_query_base.all_matching..all_matching..ip::resolver_query_base] 
87293 If used with v4\_mapped, return all matching IPv6 and IPv4 addresses. 
87294
87295
87296   static const flags all_matching = implementation_defined;
87297
87298
87299
87300 [endsect]
87301
87302
87303
87304 [section:canonical_name ip::resolver_query_base::canonical_name]
87305
87306
87307 ['Inherited from ip::resolver_base.]
87308
87309 [indexterm2 boost_asio.indexterm.ip__resolver_query_base.canonical_name..canonical_name..ip::resolver_query_base] 
87310 Determine the canonical name of the host specified in the query. 
87311
87312
87313   static const flags canonical_name = implementation_defined;
87314
87315
87316
87317 [endsect]
87318
87319
87320
87321 [section:flags ip::resolver_query_base::flags]
87322
87323
87324 ['Inherited from ip::resolver_base.]
87325
87326 [indexterm2 boost_asio.indexterm.ip__resolver_query_base.flags..flags..ip::resolver_query_base] 
87327 A bitmask type (C++ Std [lib.bitmask.types]). 
87328
87329
87330   typedef unspecified flags;
87331
87332
87333
87334 [heading Requirements]
87335
87336 ['Header: ][^boost/asio/ip/resolver_query_base.hpp]
87337
87338 ['Convenience header: ][^boost/asio.hpp]
87339
87340
87341 [endsect]
87342
87343
87344
87345 [section:numeric_host ip::resolver_query_base::numeric_host]
87346
87347
87348 ['Inherited from ip::resolver_base.]
87349
87350 [indexterm2 boost_asio.indexterm.ip__resolver_query_base.numeric_host..numeric_host..ip::resolver_query_base] 
87351 Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. 
87352
87353
87354   static const flags numeric_host = implementation_defined;
87355
87356
87357
87358 [endsect]
87359
87360
87361
87362 [section:numeric_service ip::resolver_query_base::numeric_service]
87363
87364
87365 ['Inherited from ip::resolver_base.]
87366
87367 [indexterm2 boost_asio.indexterm.ip__resolver_query_base.numeric_service..numeric_service..ip::resolver_query_base] 
87368 Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. 
87369
87370
87371   static const flags numeric_service = implementation_defined;
87372
87373
87374
87375 [endsect]
87376
87377
87378
87379 [section:passive ip::resolver_query_base::passive]
87380
87381
87382 ['Inherited from ip::resolver_base.]
87383
87384 [indexterm2 boost_asio.indexterm.ip__resolver_query_base.passive..passive..ip::resolver_query_base] 
87385 Indicate that returned endpoint is intended for use as a locally bound socket endpoint. 
87386
87387
87388   static const flags passive = implementation_defined;
87389
87390
87391
87392 [endsect]
87393
87394
87395
87396 [section:v4_mapped ip::resolver_query_base::v4_mapped]
87397
87398
87399 ['Inherited from ip::resolver_base.]
87400
87401 [indexterm2 boost_asio.indexterm.ip__resolver_query_base.v4_mapped..v4_mapped..ip::resolver_query_base] 
87402 If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. 
87403
87404
87405   static const flags v4_mapped = implementation_defined;
87406
87407
87408
87409 [endsect]
87410
87411
87412
87413 [section:_resolver_query_base ip::resolver_query_base::~resolver_query_base]
87414
87415 [indexterm2 boost_asio.indexterm.ip__resolver_query_base._resolver_query_base..~resolver_query_base..ip::resolver_query_base] 
87416 Protected destructor to prevent deletion through this type. 
87417
87418
87419   ~resolver_query_base();
87420
87421
87422
87423 [endsect]
87424
87425
87426
87427 [endsect]
87428
87429 [section:ip__tcp ip::tcp]
87430
87431
87432 Encapsulates the flags needed for TCP. 
87433
87434
87435   class tcp
87436
87437
87438 [heading Types]
87439 [table
87440   [[Name][Description]]
87441
87442   [
87443
87444     [[link boost_asio.reference.ip__tcp.acceptor [*acceptor]]]
87445     [The TCP acceptor type. ]
87446   
87447   ]
87448
87449   [
87450
87451     [[link boost_asio.reference.ip__tcp.endpoint [*endpoint]]]
87452     [The type of a TCP endpoint. ]
87453   
87454   ]
87455
87456   [
87457
87458     [[link boost_asio.reference.ip__tcp.iostream [*iostream]]]
87459     [The TCP iostream type. ]
87460   
87461   ]
87462
87463   [
87464
87465     [[link boost_asio.reference.ip__tcp.no_delay [*no_delay]]]
87466     [Socket option for disabling the Nagle algorithm. ]
87467   
87468   ]
87469
87470   [
87471
87472     [[link boost_asio.reference.ip__tcp.resolver [*resolver]]]
87473     [The TCP resolver type. ]
87474   
87475   ]
87476
87477   [
87478
87479     [[link boost_asio.reference.ip__tcp.socket [*socket]]]
87480     [The TCP socket type. ]
87481   
87482   ]
87483
87484 ]
87485
87486 [heading Member Functions]
87487 [table
87488   [[Name][Description]]
87489
87490   [
87491     [[link boost_asio.reference.ip__tcp.family [*family]]]
87492     [Obtain an identifier for the protocol family. ]
87493   ]
87494   
87495   [
87496     [[link boost_asio.reference.ip__tcp.protocol [*protocol]]]
87497     [Obtain an identifier for the protocol. ]
87498   ]
87499   
87500   [
87501     [[link boost_asio.reference.ip__tcp.type [*type]]]
87502     [Obtain an identifier for the type of the protocol. ]
87503   ]
87504   
87505   [
87506     [[link boost_asio.reference.ip__tcp.v4 [*v4]]]
87507     [Construct to represent the IPv4 TCP protocol. ]
87508   ]
87509   
87510   [
87511     [[link boost_asio.reference.ip__tcp.v6 [*v6]]]
87512     [Construct to represent the IPv6 TCP protocol. ]
87513   ]
87514   
87515 ]
87516
87517 [heading Friends]
87518 [table
87519   [[Name][Description]]
87520
87521   [
87522     [[link boost_asio.reference.ip__tcp.operator_not__eq_ [*operator!=]]]
87523     [Compare two protocols for inequality. ]
87524   ]
87525   
87526   [
87527     [[link boost_asio.reference.ip__tcp.operator_eq__eq_ [*operator==]]]
87528     [Compare two protocols for equality. ]
87529   ]
87530   
87531 ]
87532
87533 The [link boost_asio.reference.ip__tcp `ip::tcp`] class contains flags necessary for TCP sockets.
87534
87535
87536 [heading Thread Safety]
87537   
87538 ['Distinct] ['objects:] Safe.
87539
87540 ['Shared] ['objects:] Safe.
87541
87542
87543
87544
87545 [heading Requirements]
87546
87547 ['Header: ][^boost/asio/ip/tcp.hpp]
87548
87549 ['Convenience header: ][^boost/asio.hpp]
87550
87551
87552 [section:acceptor ip::tcp::acceptor]
87553
87554 [indexterm2 boost_asio.indexterm.ip__tcp.acceptor..acceptor..ip::tcp] 
87555 The TCP acceptor type. 
87556
87557
87558   typedef basic_socket_acceptor< tcp > acceptor;
87559
87560
87561 [heading Types]
87562 [table
87563   [[Name][Description]]
87564
87565   [
87566
87567     [[link boost_asio.reference.basic_socket_acceptor__rebind_executor [*rebind_executor]]]
87568     [Rebinds the acceptor type to another executor. ]
87569   
87570   ]
87571
87572   [
87573
87574     [[link boost_asio.reference.basic_socket_acceptor.broadcast [*broadcast]]]
87575     [Socket option to permit sending of broadcast messages. ]
87576   
87577   ]
87578
87579   [
87580
87581     [[link boost_asio.reference.basic_socket_acceptor.bytes_readable [*bytes_readable]]]
87582     [IO control command to get the amount of data that can be read without blocking. ]
87583   
87584   ]
87585
87586   [
87587
87588     [[link boost_asio.reference.basic_socket_acceptor.debug [*debug]]]
87589     [Socket option to enable socket-level debugging. ]
87590   
87591   ]
87592
87593   [
87594
87595     [[link boost_asio.reference.basic_socket_acceptor.do_not_route [*do_not_route]]]
87596     [Socket option to prevent routing, use local interfaces only. ]
87597   
87598   ]
87599
87600   [
87601
87602     [[link boost_asio.reference.basic_socket_acceptor.enable_connection_aborted [*enable_connection_aborted]]]
87603     [Socket option to report aborted connections on accept. ]
87604   
87605   ]
87606
87607   [
87608
87609     [[link boost_asio.reference.basic_socket_acceptor.endpoint_type [*endpoint_type]]]
87610     [The endpoint type. ]
87611   
87612   ]
87613
87614   [
87615
87616     [[link boost_asio.reference.basic_socket_acceptor.executor_type [*executor_type]]]
87617     [The type of the executor associated with the object. ]
87618   
87619   ]
87620
87621   [
87622
87623     [[link boost_asio.reference.basic_socket_acceptor.keep_alive [*keep_alive]]]
87624     [Socket option to send keep-alives. ]
87625   
87626   ]
87627
87628   [
87629
87630     [[link boost_asio.reference.basic_socket_acceptor.linger [*linger]]]
87631     [Socket option to specify whether the socket lingers on close if unsent data is present. ]
87632   
87633   ]
87634
87635   [
87636
87637     [[link boost_asio.reference.basic_socket_acceptor.message_flags [*message_flags]]]
87638     [Bitmask type for flags that can be passed to send and receive operations. ]
87639   
87640   ]
87641
87642   [
87643
87644     [[link boost_asio.reference.basic_socket_acceptor.native_handle_type [*native_handle_type]]]
87645     [The native representation of an acceptor. ]
87646   
87647   ]
87648
87649   [
87650
87651     [[link boost_asio.reference.basic_socket_acceptor.out_of_band_inline [*out_of_band_inline]]]
87652     [Socket option for putting received out-of-band data inline. ]
87653   
87654   ]
87655
87656   [
87657
87658     [[link boost_asio.reference.basic_socket_acceptor.protocol_type [*protocol_type]]]
87659     [The protocol type. ]
87660   
87661   ]
87662
87663   [
87664
87665     [[link boost_asio.reference.basic_socket_acceptor.receive_buffer_size [*receive_buffer_size]]]
87666     [Socket option for the receive buffer size of a socket. ]
87667   
87668   ]
87669
87670   [
87671
87672     [[link boost_asio.reference.basic_socket_acceptor.receive_low_watermark [*receive_low_watermark]]]
87673     [Socket option for the receive low watermark. ]
87674   
87675   ]
87676
87677   [
87678
87679     [[link boost_asio.reference.basic_socket_acceptor.reuse_address [*reuse_address]]]
87680     [Socket option to allow the socket to be bound to an address that is already in use. ]
87681   
87682   ]
87683
87684   [
87685
87686     [[link boost_asio.reference.basic_socket_acceptor.send_buffer_size [*send_buffer_size]]]
87687     [Socket option for the send buffer size of a socket. ]
87688   
87689   ]
87690
87691   [
87692
87693     [[link boost_asio.reference.basic_socket_acceptor.send_low_watermark [*send_low_watermark]]]
87694     [Socket option for the send low watermark. ]
87695   
87696   ]
87697
87698   [
87699
87700     [[link boost_asio.reference.basic_socket_acceptor.shutdown_type [*shutdown_type]]]
87701     [Different ways a socket may be shutdown. ]
87702   
87703   ]
87704
87705   [
87706
87707     [[link boost_asio.reference.basic_socket_acceptor.wait_type [*wait_type]]]
87708     [Wait types. ]
87709   
87710   ]
87711
87712 ]
87713
87714 [heading Member Functions]
87715 [table
87716   [[Name][Description]]
87717
87718   [
87719     [[link boost_asio.reference.basic_socket_acceptor.accept [*accept]]]
87720     [Accept a new connection. 
87721      [hr]
87722      Accept a new connection and obtain the endpoint of the peer. ]
87723   ]
87724   
87725   [
87726     [[link boost_asio.reference.basic_socket_acceptor.assign [*assign]]]
87727     [Assigns an existing native acceptor to the acceptor. ]
87728   ]
87729   
87730   [
87731     [[link boost_asio.reference.basic_socket_acceptor.async_accept [*async_accept]]]
87732     [Start an asynchronous accept. ]
87733   ]
87734   
87735   [
87736     [[link boost_asio.reference.basic_socket_acceptor.async_wait [*async_wait]]]
87737     [Asynchronously wait for the acceptor to become ready to read, ready to write, or to have pending error conditions. ]
87738   ]
87739   
87740   [
87741     [[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor [*basic_socket_acceptor]]]
87742     [Construct an acceptor without opening it. 
87743      [hr]
87744      Construct an open acceptor. 
87745      [hr]
87746      Construct an acceptor opened on the given endpoint. 
87747      [hr]
87748      Construct a basic_socket_acceptor on an existing native acceptor. 
87749      [hr]
87750      Move-construct a basic_socket_acceptor from another. 
87751      [hr]
87752      Move-construct a basic_socket_acceptor from an acceptor of another protocol type. ]
87753   ]
87754   
87755   [
87756     [[link boost_asio.reference.basic_socket_acceptor.bind [*bind]]]
87757     [Bind the acceptor to the given local endpoint. ]
87758   ]
87759   
87760   [
87761     [[link boost_asio.reference.basic_socket_acceptor.cancel [*cancel]]]
87762     [Cancel all asynchronous operations associated with the acceptor. ]
87763   ]
87764   
87765   [
87766     [[link boost_asio.reference.basic_socket_acceptor.close [*close]]]
87767     [Close the acceptor. ]
87768   ]
87769   
87770   [
87771     [[link boost_asio.reference.basic_socket_acceptor.get_executor [*get_executor]]]
87772     [Get the executor associated with the object. ]
87773   ]
87774   
87775   [
87776     [[link boost_asio.reference.basic_socket_acceptor.get_option [*get_option]]]
87777     [Get an option from the acceptor. ]
87778   ]
87779   
87780   [
87781     [[link boost_asio.reference.basic_socket_acceptor.io_control [*io_control]]]
87782     [Perform an IO control command on the acceptor. ]
87783   ]
87784   
87785   [
87786     [[link boost_asio.reference.basic_socket_acceptor.is_open [*is_open]]]
87787     [Determine whether the acceptor is open. ]
87788   ]
87789   
87790   [
87791     [[link boost_asio.reference.basic_socket_acceptor.listen [*listen]]]
87792     [Place the acceptor into the state where it will listen for new connections. ]
87793   ]
87794   
87795   [
87796     [[link boost_asio.reference.basic_socket_acceptor.local_endpoint [*local_endpoint]]]
87797     [Get the local endpoint of the acceptor. ]
87798   ]
87799   
87800   [
87801     [[link boost_asio.reference.basic_socket_acceptor.native_handle [*native_handle]]]
87802     [Get the native acceptor representation. ]
87803   ]
87804   
87805   [
87806     [[link boost_asio.reference.basic_socket_acceptor.native_non_blocking [*native_non_blocking]]]
87807     [Gets the non-blocking mode of the native acceptor implementation. 
87808      [hr]
87809      Sets the non-blocking mode of the native acceptor implementation. ]
87810   ]
87811   
87812   [
87813     [[link boost_asio.reference.basic_socket_acceptor.non_blocking [*non_blocking]]]
87814     [Gets the non-blocking mode of the acceptor. 
87815      [hr]
87816      Sets the non-blocking mode of the acceptor. ]
87817   ]
87818   
87819   [
87820     [[link boost_asio.reference.basic_socket_acceptor.open [*open]]]
87821     [Open the acceptor using the specified protocol. ]
87822   ]
87823   
87824   [
87825     [[link boost_asio.reference.basic_socket_acceptor.operator_eq_ [*operator=]]]
87826     [Move-assign a basic_socket_acceptor from another. 
87827      [hr]
87828      Move-assign a basic_socket_acceptor from an acceptor of another protocol type. ]
87829   ]
87830   
87831   [
87832     [[link boost_asio.reference.basic_socket_acceptor.release [*release]]]
87833     [Release ownership of the underlying native acceptor. ]
87834   ]
87835   
87836   [
87837     [[link boost_asio.reference.basic_socket_acceptor.set_option [*set_option]]]
87838     [Set an option on the acceptor. ]
87839   ]
87840   
87841   [
87842     [[link boost_asio.reference.basic_socket_acceptor.wait [*wait]]]
87843     [Wait for the acceptor to become ready to read, ready to write, or to have pending error conditions. ]
87844   ]
87845   
87846   [
87847     [[link boost_asio.reference.basic_socket_acceptor._basic_socket_acceptor [*~basic_socket_acceptor]]]
87848     [Destroys the acceptor. ]
87849   ]
87850   
87851 ]
87852
87853 [heading Data Members]
87854 [table
87855   [[Name][Description]]
87856
87857   [
87858     [[link boost_asio.reference.basic_socket_acceptor.max_connections [*max_connections]]]
87859     [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
87860   ]
87861
87862   [
87863     [[link boost_asio.reference.basic_socket_acceptor.max_listen_connections [*max_listen_connections]]]
87864     [The maximum length of the queue of pending incoming connections. ]
87865   ]
87866
87867   [
87868     [[link boost_asio.reference.basic_socket_acceptor.message_do_not_route [*message_do_not_route]]]
87869     [Specify that the data should not be subject to routing. ]
87870   ]
87871
87872   [
87873     [[link boost_asio.reference.basic_socket_acceptor.message_end_of_record [*message_end_of_record]]]
87874     [Specifies that the data marks the end of a record. ]
87875   ]
87876
87877   [
87878     [[link boost_asio.reference.basic_socket_acceptor.message_out_of_band [*message_out_of_band]]]
87879     [Process out-of-band data. ]
87880   ]
87881
87882   [
87883     [[link boost_asio.reference.basic_socket_acceptor.message_peek [*message_peek]]]
87884     [Peek at incoming data without removing it from the input queue. ]
87885   ]
87886
87887 ]
87888
87889 The [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] class template is used for accepting new socket connections.
87890
87891
87892 [heading Thread Safety]
87893   
87894 ['Distinct] ['objects:] Safe.
87895
87896 ['Shared] ['objects:] Unsafe.
87897
87898
87899 [heading Example]
87900   
87901 Opening a socket acceptor with the SO\_REUSEADDR option enabled: 
87902
87903    boost::asio::ip::tcp::acceptor acceptor(my_context);
87904    boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), port);
87905    acceptor.open(endpoint.protocol());
87906    acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
87907    acceptor.bind(endpoint);
87908    acceptor.listen();
87909
87910
87911
87912
87913
87914
87915
87916 [heading Requirements]
87917
87918 ['Header: ][^boost/asio/ip/tcp.hpp]
87919
87920 ['Convenience header: ][^boost/asio.hpp]
87921
87922
87923 [endsect]
87924
87925
87926
87927 [section:endpoint ip::tcp::endpoint]
87928
87929 [indexterm2 boost_asio.indexterm.ip__tcp.endpoint..endpoint..ip::tcp] 
87930 The type of a TCP endpoint. 
87931
87932
87933   typedef basic_endpoint< tcp > endpoint;
87934
87935
87936 [heading Types]
87937 [table
87938   [[Name][Description]]
87939
87940   [
87941
87942     [[link boost_asio.reference.ip__basic_endpoint.data_type [*data_type]]]
87943     [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
87944   
87945   ]
87946
87947   [
87948
87949     [[link boost_asio.reference.ip__basic_endpoint.protocol_type [*protocol_type]]]
87950     [The protocol type associated with the endpoint. ]
87951   
87952   ]
87953
87954 ]
87955
87956 [heading Member Functions]
87957 [table
87958   [[Name][Description]]
87959
87960   [
87961     [[link boost_asio.reference.ip__basic_endpoint.address [*address]]]
87962     [Get the IP address associated with the endpoint. 
87963      [hr]
87964      Set the IP address associated with the endpoint. ]
87965   ]
87966   
87967   [
87968     [[link boost_asio.reference.ip__basic_endpoint.basic_endpoint [*basic_endpoint]]]
87969     [Default constructor. 
87970      [hr]
87971      Construct an endpoint using a port number, specified in the host's byte order. The IP address will be the any address (i.e. INADDR_ANY or in6addr_any). This constructor would typically be used for accepting new connections. 
87972      [hr]
87973      Construct an endpoint using a port number and an IP address. This constructor may be used for accepting connections on a specific interface or for making a connection to a remote endpoint. 
87974      [hr]
87975      Copy constructor. 
87976      [hr]
87977      Move constructor. ]
87978   ]
87979   
87980   [
87981     [[link boost_asio.reference.ip__basic_endpoint.capacity [*capacity]]]
87982     [Get the capacity of the endpoint in the native type. ]
87983   ]
87984   
87985   [
87986     [[link boost_asio.reference.ip__basic_endpoint.data [*data]]]
87987     [Get the underlying endpoint in the native type. ]
87988   ]
87989   
87990   [
87991     [[link boost_asio.reference.ip__basic_endpoint.operator_eq_ [*operator=]]]
87992     [Assign from another endpoint. 
87993      [hr]
87994      Move-assign from another endpoint. ]
87995   ]
87996   
87997   [
87998     [[link boost_asio.reference.ip__basic_endpoint.port [*port]]]
87999     [Get the port associated with the endpoint. The port number is always in the host's byte order. 
88000      [hr]
88001      Set the port associated with the endpoint. The port number is always in the host's byte order. ]
88002   ]
88003   
88004   [
88005     [[link boost_asio.reference.ip__basic_endpoint.protocol [*protocol]]]
88006     [The protocol associated with the endpoint. ]
88007   ]
88008   
88009   [
88010     [[link boost_asio.reference.ip__basic_endpoint.resize [*resize]]]
88011     [Set the underlying size of the endpoint in the native type. ]
88012   ]
88013   
88014   [
88015     [[link boost_asio.reference.ip__basic_endpoint.size [*size]]]
88016     [Get the underlying size of the endpoint in the native type. ]
88017   ]
88018   
88019 ]
88020
88021 [heading Friends]
88022 [table
88023   [[Name][Description]]
88024
88025   [
88026     [[link boost_asio.reference.ip__basic_endpoint.operator_not__eq_ [*operator!=]]]
88027     [Compare two endpoints for inequality. ]
88028   ]
88029   
88030   [
88031     [[link boost_asio.reference.ip__basic_endpoint.operator_lt_ [*operator<]]]
88032     [Compare endpoints for ordering. ]
88033   ]
88034   
88035   [
88036     [[link boost_asio.reference.ip__basic_endpoint.operator_lt__eq_ [*operator<=]]]
88037     [Compare endpoints for ordering. ]
88038   ]
88039   
88040   [
88041     [[link boost_asio.reference.ip__basic_endpoint.operator_eq__eq_ [*operator==]]]
88042     [Compare two endpoints for equality. ]
88043   ]
88044   
88045   [
88046     [[link boost_asio.reference.ip__basic_endpoint.operator_gt_ [*operator>]]]
88047     [Compare endpoints for ordering. ]
88048   ]
88049   
88050   [
88051     [[link boost_asio.reference.ip__basic_endpoint.operator_gt__eq_ [*operator>=]]]
88052     [Compare endpoints for ordering. ]
88053   ]
88054   
88055 ]
88056
88057 [heading Related Functions]
88058 [table
88059   [[Name][Description]]
88060
88061   [
88062     [[link boost_asio.reference.ip__basic_endpoint.operator_lt__lt_ [*operator<<]]]
88063     [Output an endpoint as a string. ]
88064   ]
88065   
88066 ]
88067
88068 The [link boost_asio.reference.ip__basic_endpoint `ip::basic_endpoint`] class template describes an endpoint that may be associated with a particular socket.
88069
88070
88071 [heading Thread Safety]
88072   
88073 ['Distinct] ['objects:] Safe.
88074
88075 ['Shared] ['objects:] Unsafe.
88076
88077
88078
88079
88080
88081 [heading Requirements]
88082
88083 ['Header: ][^boost/asio/ip/tcp.hpp]
88084
88085 ['Convenience header: ][^boost/asio.hpp]
88086
88087
88088 [endsect]
88089
88090
88091
88092 [section:family ip::tcp::family]
88093
88094 [indexterm2 boost_asio.indexterm.ip__tcp.family..family..ip::tcp] 
88095 Obtain an identifier for the protocol family. 
88096
88097
88098   int family() const;
88099
88100
88101
88102 [endsect]
88103
88104
88105
88106 [section:iostream ip::tcp::iostream]
88107
88108 [indexterm2 boost_asio.indexterm.ip__tcp.iostream..iostream..ip::tcp] 
88109 The TCP iostream type. 
88110
88111
88112   typedef basic_socket_iostream< tcp > iostream;
88113
88114
88115 [heading Types]
88116 [table
88117   [[Name][Description]]
88118
88119   [
88120
88121     [[link boost_asio.reference.basic_socket_iostream.clock_type [*clock_type]]]
88122     [The clock type. ]
88123   
88124   ]
88125
88126   [
88127
88128     [[link boost_asio.reference.basic_socket_iostream.duration [*duration]]]
88129     [The duration type. ]
88130   
88131   ]
88132
88133   [
88134
88135     [[link boost_asio.reference.basic_socket_iostream.duration_type [*duration_type]]]
88136     [(Deprecated: Use duration.) The duration type. ]
88137   
88138   ]
88139
88140   [
88141
88142     [[link boost_asio.reference.basic_socket_iostream.endpoint_type [*endpoint_type]]]
88143     [The endpoint type. ]
88144   
88145   ]
88146
88147   [
88148
88149     [[link boost_asio.reference.basic_socket_iostream.protocol_type [*protocol_type]]]
88150     [The protocol type. ]
88151   
88152   ]
88153
88154   [
88155
88156     [[link boost_asio.reference.basic_socket_iostream.time_point [*time_point]]]
88157     [The time type. ]
88158   
88159   ]
88160
88161   [
88162
88163     [[link boost_asio.reference.basic_socket_iostream.time_type [*time_type]]]
88164     [(Deprecated: Use time_point.) The time type. ]
88165   
88166   ]
88167
88168 ]
88169
88170 [heading Member Functions]
88171 [table
88172   [[Name][Description]]
88173
88174   [
88175     [[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream [*basic_socket_iostream]]]
88176     [Construct a basic_socket_iostream without establishing a connection. 
88177      [hr]
88178      Construct a basic_socket_iostream from the supplied socket. 
88179      [hr]
88180      Move-construct a basic_socket_iostream from another. 
88181      [hr]
88182      Establish a connection to an endpoint corresponding to a resolver query. ]
88183   ]
88184   
88185   [
88186     [[link boost_asio.reference.basic_socket_iostream.close [*close]]]
88187     [Close the connection. ]
88188   ]
88189   
88190   [
88191     [[link boost_asio.reference.basic_socket_iostream.connect [*connect]]]
88192     [Establish a connection to an endpoint corresponding to a resolver query. ]
88193   ]
88194   
88195   [
88196     [[link boost_asio.reference.basic_socket_iostream.error [*error]]]
88197     [Get the last error associated with the stream. ]
88198   ]
88199   
88200   [
88201     [[link boost_asio.reference.basic_socket_iostream.expires_after [*expires_after]]]
88202     [Set the stream's expiry time relative to now. ]
88203   ]
88204   
88205   [
88206     [[link boost_asio.reference.basic_socket_iostream.expires_at [*expires_at]]]
88207     [(Deprecated: Use expiry().) Get the stream's expiry time as an absolute time. 
88208      [hr]
88209      Set the stream's expiry time as an absolute time. ]
88210   ]
88211   
88212   [
88213     [[link boost_asio.reference.basic_socket_iostream.expires_from_now [*expires_from_now]]]
88214     [(Deprecated: Use expiry().) Get the stream's expiry time relative to now. 
88215      [hr]
88216      (Deprecated: Use expires_after().) Set the stream's expiry time relative to now. ]
88217   ]
88218   
88219   [
88220     [[link boost_asio.reference.basic_socket_iostream.expiry [*expiry]]]
88221     [Get the stream's expiry time as an absolute time. ]
88222   ]
88223   
88224   [
88225     [[link boost_asio.reference.basic_socket_iostream.operator_eq_ [*operator=]]]
88226     [Move-assign a basic_socket_iostream from another. ]
88227   ]
88228   
88229   [
88230     [[link boost_asio.reference.basic_socket_iostream.rdbuf [*rdbuf]]]
88231     [Return a pointer to the underlying streambuf. ]
88232   ]
88233   
88234   [
88235     [[link boost_asio.reference.basic_socket_iostream.socket [*socket]]]
88236     [Get a reference to the underlying socket. ]
88237   ]
88238   
88239 ]
88240
88241
88242 [heading Requirements]
88243
88244 ['Header: ][^boost/asio/ip/tcp.hpp]
88245
88246 ['Convenience header: ][^boost/asio.hpp]
88247
88248
88249 [endsect]
88250
88251
88252
88253 [section:no_delay ip::tcp::no_delay]
88254
88255 [indexterm2 boost_asio.indexterm.ip__tcp.no_delay..no_delay..ip::tcp] 
88256 Socket option for disabling the Nagle algorithm. 
88257
88258
88259   typedef implementation_defined no_delay;
88260
88261
88262
88263 Implements the IPPROTO\_TCP/TCP\_NODELAY socket option.
88264
88265
88266 [heading Examples]
88267   
88268 Setting the option: 
88269
88270    boost::asio::ip::tcp::socket socket(my_context);
88271    ...
88272    boost::asio::ip::tcp::no_delay option(true);
88273    socket.set_option(option);
88274
88275
88276
88277
88278
88279 Getting the current option value: 
88280
88281    boost::asio::ip::tcp::socket socket(my_context);
88282    ...
88283    boost::asio::ip::tcp::no_delay option;
88284    socket.get_option(option);
88285    bool is_set = option.value();
88286
88287
88288
88289
88290
88291
88292
88293 [heading Requirements]
88294
88295 ['Header: ][^boost/asio/ip/tcp.hpp]
88296
88297 ['Convenience header: ][^boost/asio.hpp]
88298
88299
88300 [endsect]
88301
88302
88303
88304 [section:operator_not__eq_ ip::tcp::operator!=]
88305
88306 [indexterm2 boost_asio.indexterm.ip__tcp.operator_not__eq_..operator!=..ip::tcp] 
88307 Compare two protocols for inequality. 
88308
88309
88310   friend bool operator!=(
88311       const tcp & p1,
88312       const tcp & p2);
88313
88314
88315 [heading Requirements]
88316
88317 ['Header: ][^boost/asio/ip/tcp.hpp]
88318
88319 ['Convenience header: ][^boost/asio.hpp]
88320
88321
88322 [endsect]
88323
88324
88325
88326 [section:operator_eq__eq_ ip::tcp::operator==]
88327
88328 [indexterm2 boost_asio.indexterm.ip__tcp.operator_eq__eq_..operator==..ip::tcp] 
88329 Compare two protocols for equality. 
88330
88331
88332   friend bool operator==(
88333       const tcp & p1,
88334       const tcp & p2);
88335
88336
88337 [heading Requirements]
88338
88339 ['Header: ][^boost/asio/ip/tcp.hpp]
88340
88341 ['Convenience header: ][^boost/asio.hpp]
88342
88343
88344 [endsect]
88345
88346
88347
88348 [section:protocol ip::tcp::protocol]
88349
88350 [indexterm2 boost_asio.indexterm.ip__tcp.protocol..protocol..ip::tcp] 
88351 Obtain an identifier for the protocol. 
88352
88353
88354   int protocol() const;
88355
88356
88357
88358 [endsect]
88359
88360
88361
88362 [section:resolver ip::tcp::resolver]
88363
88364 [indexterm2 boost_asio.indexterm.ip__tcp.resolver..resolver..ip::tcp] 
88365 The TCP resolver type. 
88366
88367
88368   typedef basic_resolver< tcp > resolver;
88369
88370
88371 [heading Types]
88372 [table
88373   [[Name][Description]]
88374
88375   [
88376
88377     [[link boost_asio.reference.ip__basic_resolver__rebind_executor [*rebind_executor]]]
88378     [Rebinds the resolver type to another executor. ]
88379   
88380   ]
88381
88382   [
88383
88384     [[link boost_asio.reference.ip__basic_resolver.endpoint_type [*endpoint_type]]]
88385     [The endpoint type. ]
88386   
88387   ]
88388
88389   [
88390
88391     [[link boost_asio.reference.ip__basic_resolver.executor_type [*executor_type]]]
88392     [The type of the executor associated with the object. ]
88393   
88394   ]
88395
88396   [
88397
88398     [[link boost_asio.reference.ip__basic_resolver.flags [*flags]]]
88399     [A bitmask type (C++ Std \[lib.bitmask.types\]). ]
88400   
88401   ]
88402
88403   [
88404
88405     [[link boost_asio.reference.ip__basic_resolver.iterator [*iterator]]]
88406     [(Deprecated.) The iterator type. ]
88407   
88408   ]
88409
88410   [
88411
88412     [[link boost_asio.reference.ip__basic_resolver.protocol_type [*protocol_type]]]
88413     [The protocol type. ]
88414   
88415   ]
88416
88417   [
88418
88419     [[link boost_asio.reference.ip__basic_resolver.query [*query]]]
88420     [(Deprecated.) The query type. ]
88421   
88422   ]
88423
88424   [
88425
88426     [[link boost_asio.reference.ip__basic_resolver.results_type [*results_type]]]
88427     [The results type. ]
88428   
88429   ]
88430
88431 ]
88432
88433 [heading Member Functions]
88434 [table
88435   [[Name][Description]]
88436
88437   [
88438     [[link boost_asio.reference.ip__basic_resolver.async_resolve [*async_resolve]]]
88439     [(Deprecated: Use overload with separate host and service parameters.) Asynchronously perform forward resolution of a query to a list of entries. 
88440      [hr]
88441      Asynchronously perform forward resolution of a query to a list of entries. 
88442      [hr]
88443      Asynchronously perform reverse resolution of an endpoint to a list of entries. ]
88444   ]
88445   
88446   [
88447     [[link boost_asio.reference.ip__basic_resolver.basic_resolver [*basic_resolver]]]
88448     [Construct with executor. 
88449      [hr]
88450      Construct with execution context. 
88451      [hr]
88452      Move-construct a basic_resolver from another. ]
88453   ]
88454   
88455   [
88456     [[link boost_asio.reference.ip__basic_resolver.cancel [*cancel]]]
88457     [Cancel any asynchronous operations that are waiting on the resolver. ]
88458   ]
88459   
88460   [
88461     [[link boost_asio.reference.ip__basic_resolver.get_executor [*get_executor]]]
88462     [Get the executor associated with the object. ]
88463   ]
88464   
88465   [
88466     [[link boost_asio.reference.ip__basic_resolver.operator_eq_ [*operator=]]]
88467     [Move-assign a basic_resolver from another. ]
88468   ]
88469   
88470   [
88471     [[link boost_asio.reference.ip__basic_resolver.resolve [*resolve]]]
88472     [(Deprecated: Use overload with separate host and service parameters.) Perform forward resolution of a query to a list of entries. 
88473      [hr]
88474      Perform forward resolution of a query to a list of entries. 
88475      [hr]
88476      Perform reverse resolution of an endpoint to a list of entries. ]
88477   ]
88478   
88479   [
88480     [[link boost_asio.reference.ip__basic_resolver._basic_resolver [*~basic_resolver]]]
88481     [Destroys the resolver. ]
88482   ]
88483   
88484 ]
88485
88486 [heading Data Members]
88487 [table
88488   [[Name][Description]]
88489
88490   [
88491     [[link boost_asio.reference.ip__basic_resolver.address_configured [*address_configured]]]
88492     [Only return IPv4 addresses if a non-loopback IPv4 address is configured for the system. Only return IPv6 addresses if a non-loopback IPv6 address is configured for the system. ]
88493   ]
88494
88495   [
88496     [[link boost_asio.reference.ip__basic_resolver.all_matching [*all_matching]]]
88497     [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ]
88498   ]
88499
88500   [
88501     [[link boost_asio.reference.ip__basic_resolver.canonical_name [*canonical_name]]]
88502     [Determine the canonical name of the host specified in the query. ]
88503   ]
88504
88505   [
88506     [[link boost_asio.reference.ip__basic_resolver.numeric_host [*numeric_host]]]
88507     [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ]
88508   ]
88509
88510   [
88511     [[link boost_asio.reference.ip__basic_resolver.numeric_service [*numeric_service]]]
88512     [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ]
88513   ]
88514
88515   [
88516     [[link boost_asio.reference.ip__basic_resolver.passive [*passive]]]
88517     [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ]
88518   ]
88519
88520   [
88521     [[link boost_asio.reference.ip__basic_resolver.v4_mapped [*v4_mapped]]]
88522     [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ]
88523   ]
88524
88525 ]
88526
88527 The [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] class template provides the ability to resolve a query to a list of endpoints.
88528
88529
88530 [heading Thread Safety]
88531   
88532 ['Distinct] ['objects:] Safe.
88533
88534 ['Shared] ['objects:] Unsafe. 
88535
88536
88537
88538
88539 [heading Requirements]
88540
88541 ['Header: ][^boost/asio/ip/tcp.hpp]
88542
88543 ['Convenience header: ][^boost/asio.hpp]
88544
88545
88546 [endsect]
88547
88548
88549
88550 [section:socket ip::tcp::socket]
88551
88552 [indexterm2 boost_asio.indexterm.ip__tcp.socket..socket..ip::tcp] 
88553 The TCP socket type. 
88554
88555
88556   typedef basic_stream_socket< tcp > socket;
88557
88558
88559 [heading Types]
88560 [table
88561   [[Name][Description]]
88562
88563   [
88564
88565     [[link boost_asio.reference.basic_stream_socket__rebind_executor [*rebind_executor]]]
88566     [Rebinds the socket type to another executor. ]
88567   
88568   ]
88569
88570   [
88571
88572     [[link boost_asio.reference.basic_stream_socket.broadcast [*broadcast]]]
88573     [Socket option to permit sending of broadcast messages. ]
88574   
88575   ]
88576
88577   [
88578
88579     [[link boost_asio.reference.basic_stream_socket.bytes_readable [*bytes_readable]]]
88580     [IO control command to get the amount of data that can be read without blocking. ]
88581   
88582   ]
88583
88584   [
88585
88586     [[link boost_asio.reference.basic_stream_socket.debug [*debug]]]
88587     [Socket option to enable socket-level debugging. ]
88588   
88589   ]
88590
88591   [
88592
88593     [[link boost_asio.reference.basic_stream_socket.do_not_route [*do_not_route]]]
88594     [Socket option to prevent routing, use local interfaces only. ]
88595   
88596   ]
88597
88598   [
88599
88600     [[link boost_asio.reference.basic_stream_socket.enable_connection_aborted [*enable_connection_aborted]]]
88601     [Socket option to report aborted connections on accept. ]
88602   
88603   ]
88604
88605   [
88606
88607     [[link boost_asio.reference.basic_stream_socket.endpoint_type [*endpoint_type]]]
88608     [The endpoint type. ]
88609   
88610   ]
88611
88612   [
88613
88614     [[link boost_asio.reference.basic_stream_socket.executor_type [*executor_type]]]
88615     [The type of the executor associated with the object. ]
88616   
88617   ]
88618
88619   [
88620
88621     [[link boost_asio.reference.basic_stream_socket.keep_alive [*keep_alive]]]
88622     [Socket option to send keep-alives. ]
88623   
88624   ]
88625
88626   [
88627
88628     [[link boost_asio.reference.basic_stream_socket.linger [*linger]]]
88629     [Socket option to specify whether the socket lingers on close if unsent data is present. ]
88630   
88631   ]
88632
88633   [
88634
88635     [[link boost_asio.reference.basic_stream_socket.lowest_layer_type [*lowest_layer_type]]]
88636     [A basic_socket is always the lowest layer. ]
88637   
88638   ]
88639
88640   [
88641
88642     [[link boost_asio.reference.basic_stream_socket.message_flags [*message_flags]]]
88643     [Bitmask type for flags that can be passed to send and receive operations. ]
88644   
88645   ]
88646
88647   [
88648
88649     [[link boost_asio.reference.basic_stream_socket.native_handle_type [*native_handle_type]]]
88650     [The native representation of a socket. ]
88651   
88652   ]
88653
88654   [
88655
88656     [[link boost_asio.reference.basic_stream_socket.out_of_band_inline [*out_of_band_inline]]]
88657     [Socket option for putting received out-of-band data inline. ]
88658   
88659   ]
88660
88661   [
88662
88663     [[link boost_asio.reference.basic_stream_socket.protocol_type [*protocol_type]]]
88664     [The protocol type. ]
88665   
88666   ]
88667
88668   [
88669
88670     [[link boost_asio.reference.basic_stream_socket.receive_buffer_size [*receive_buffer_size]]]
88671     [Socket option for the receive buffer size of a socket. ]
88672   
88673   ]
88674
88675   [
88676
88677     [[link boost_asio.reference.basic_stream_socket.receive_low_watermark [*receive_low_watermark]]]
88678     [Socket option for the receive low watermark. ]
88679   
88680   ]
88681
88682   [
88683
88684     [[link boost_asio.reference.basic_stream_socket.reuse_address [*reuse_address]]]
88685     [Socket option to allow the socket to be bound to an address that is already in use. ]
88686   
88687   ]
88688
88689   [
88690
88691     [[link boost_asio.reference.basic_stream_socket.send_buffer_size [*send_buffer_size]]]
88692     [Socket option for the send buffer size of a socket. ]
88693   
88694   ]
88695
88696   [
88697
88698     [[link boost_asio.reference.basic_stream_socket.send_low_watermark [*send_low_watermark]]]
88699     [Socket option for the send low watermark. ]
88700   
88701   ]
88702
88703   [
88704
88705     [[link boost_asio.reference.basic_stream_socket.shutdown_type [*shutdown_type]]]
88706     [Different ways a socket may be shutdown. ]
88707   
88708   ]
88709
88710   [
88711
88712     [[link boost_asio.reference.basic_stream_socket.wait_type [*wait_type]]]
88713     [Wait types. ]
88714   
88715   ]
88716
88717 ]
88718
88719 [heading Member Functions]
88720 [table
88721   [[Name][Description]]
88722
88723   [
88724     [[link boost_asio.reference.basic_stream_socket.assign [*assign]]]
88725     [Assign an existing native socket to the socket. ]
88726   ]
88727   
88728   [
88729     [[link boost_asio.reference.basic_stream_socket.async_connect [*async_connect]]]
88730     [Start an asynchronous connect. ]
88731   ]
88732   
88733   [
88734     [[link boost_asio.reference.basic_stream_socket.async_read_some [*async_read_some]]]
88735     [Start an asynchronous read. ]
88736   ]
88737   
88738   [
88739     [[link boost_asio.reference.basic_stream_socket.async_receive [*async_receive]]]
88740     [Start an asynchronous receive. ]
88741   ]
88742   
88743   [
88744     [[link boost_asio.reference.basic_stream_socket.async_send [*async_send]]]
88745     [Start an asynchronous send. ]
88746   ]
88747   
88748   [
88749     [[link boost_asio.reference.basic_stream_socket.async_wait [*async_wait]]]
88750     [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
88751   ]
88752   
88753   [
88754     [[link boost_asio.reference.basic_stream_socket.async_write_some [*async_write_some]]]
88755     [Start an asynchronous write. ]
88756   ]
88757   
88758   [
88759     [[link boost_asio.reference.basic_stream_socket.at_mark [*at_mark]]]
88760     [Determine whether the socket is at the out-of-band data mark. ]
88761   ]
88762   
88763   [
88764     [[link boost_asio.reference.basic_stream_socket.available [*available]]]
88765     [Determine the number of bytes available for reading. ]
88766   ]
88767   
88768   [
88769     [[link boost_asio.reference.basic_stream_socket.basic_stream_socket [*basic_stream_socket]]]
88770     [Construct a basic_stream_socket without opening it. 
88771      [hr]
88772      Construct and open a basic_stream_socket. 
88773      [hr]
88774      Construct a basic_stream_socket, opening it and binding it to the given local endpoint. 
88775      [hr]
88776      Construct a basic_stream_socket on an existing native socket. 
88777      [hr]
88778      Move-construct a basic_stream_socket from another. 
88779      [hr]
88780      Move-construct a basic_stream_socket from a socket of another protocol type. ]
88781   ]
88782   
88783   [
88784     [[link boost_asio.reference.basic_stream_socket.bind [*bind]]]
88785     [Bind the socket to the given local endpoint. ]
88786   ]
88787   
88788   [
88789     [[link boost_asio.reference.basic_stream_socket.cancel [*cancel]]]
88790     [Cancel all asynchronous operations associated with the socket. ]
88791   ]
88792   
88793   [
88794     [[link boost_asio.reference.basic_stream_socket.close [*close]]]
88795     [Close the socket. ]
88796   ]
88797   
88798   [
88799     [[link boost_asio.reference.basic_stream_socket.connect [*connect]]]
88800     [Connect the socket to the specified endpoint. ]
88801   ]
88802   
88803   [
88804     [[link boost_asio.reference.basic_stream_socket.get_executor [*get_executor]]]
88805     [Get the executor associated with the object. ]
88806   ]
88807   
88808   [
88809     [[link boost_asio.reference.basic_stream_socket.get_option [*get_option]]]
88810     [Get an option from the socket. ]
88811   ]
88812   
88813   [
88814     [[link boost_asio.reference.basic_stream_socket.io_control [*io_control]]]
88815     [Perform an IO control command on the socket. ]
88816   ]
88817   
88818   [
88819     [[link boost_asio.reference.basic_stream_socket.is_open [*is_open]]]
88820     [Determine whether the socket is open. ]
88821   ]
88822   
88823   [
88824     [[link boost_asio.reference.basic_stream_socket.local_endpoint [*local_endpoint]]]
88825     [Get the local endpoint of the socket. ]
88826   ]
88827   
88828   [
88829     [[link boost_asio.reference.basic_stream_socket.lowest_layer [*lowest_layer]]]
88830     [Get a reference to the lowest layer. 
88831      [hr]
88832      Get a const reference to the lowest layer. ]
88833   ]
88834   
88835   [
88836     [[link boost_asio.reference.basic_stream_socket.native_handle [*native_handle]]]
88837     [Get the native socket representation. ]
88838   ]
88839   
88840   [
88841     [[link boost_asio.reference.basic_stream_socket.native_non_blocking [*native_non_blocking]]]
88842     [Gets the non-blocking mode of the native socket implementation. 
88843      [hr]
88844      Sets the non-blocking mode of the native socket implementation. ]
88845   ]
88846   
88847   [
88848     [[link boost_asio.reference.basic_stream_socket.non_blocking [*non_blocking]]]
88849     [Gets the non-blocking mode of the socket. 
88850      [hr]
88851      Sets the non-blocking mode of the socket. ]
88852   ]
88853   
88854   [
88855     [[link boost_asio.reference.basic_stream_socket.open [*open]]]
88856     [Open the socket using the specified protocol. ]
88857   ]
88858   
88859   [
88860     [[link boost_asio.reference.basic_stream_socket.operator_eq_ [*operator=]]]
88861     [Move-assign a basic_stream_socket from another. 
88862      [hr]
88863      Move-assign a basic_stream_socket from a socket of another protocol type. ]
88864   ]
88865   
88866   [
88867     [[link boost_asio.reference.basic_stream_socket.read_some [*read_some]]]
88868     [Read some data from the socket. ]
88869   ]
88870   
88871   [
88872     [[link boost_asio.reference.basic_stream_socket.receive [*receive]]]
88873     [Receive some data on the socket. 
88874      [hr]
88875      Receive some data on a connected socket. ]
88876   ]
88877   
88878   [
88879     [[link boost_asio.reference.basic_stream_socket.release [*release]]]
88880     [Release ownership of the underlying native socket. ]
88881   ]
88882   
88883   [
88884     [[link boost_asio.reference.basic_stream_socket.remote_endpoint [*remote_endpoint]]]
88885     [Get the remote endpoint of the socket. ]
88886   ]
88887   
88888   [
88889     [[link boost_asio.reference.basic_stream_socket.send [*send]]]
88890     [Send some data on the socket. ]
88891   ]
88892   
88893   [
88894     [[link boost_asio.reference.basic_stream_socket.set_option [*set_option]]]
88895     [Set an option on the socket. ]
88896   ]
88897   
88898   [
88899     [[link boost_asio.reference.basic_stream_socket.shutdown [*shutdown]]]
88900     [Disable sends or receives on the socket. ]
88901   ]
88902   
88903   [
88904     [[link boost_asio.reference.basic_stream_socket.wait [*wait]]]
88905     [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
88906   ]
88907   
88908   [
88909     [[link boost_asio.reference.basic_stream_socket.write_some [*write_some]]]
88910     [Write some data to the socket. ]
88911   ]
88912   
88913   [
88914     [[link boost_asio.reference.basic_stream_socket._basic_stream_socket [*~basic_stream_socket]]]
88915     [Destroys the socket. ]
88916   ]
88917   
88918 ]
88919
88920 [heading Data Members]
88921 [table
88922   [[Name][Description]]
88923
88924   [
88925     [[link boost_asio.reference.basic_stream_socket.max_connections [*max_connections]]]
88926     [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
88927   ]
88928
88929   [
88930     [[link boost_asio.reference.basic_stream_socket.max_listen_connections [*max_listen_connections]]]
88931     [The maximum length of the queue of pending incoming connections. ]
88932   ]
88933
88934   [
88935     [[link boost_asio.reference.basic_stream_socket.message_do_not_route [*message_do_not_route]]]
88936     [Specify that the data should not be subject to routing. ]
88937   ]
88938
88939   [
88940     [[link boost_asio.reference.basic_stream_socket.message_end_of_record [*message_end_of_record]]]
88941     [Specifies that the data marks the end of a record. ]
88942   ]
88943
88944   [
88945     [[link boost_asio.reference.basic_stream_socket.message_out_of_band [*message_out_of_band]]]
88946     [Process out-of-band data. ]
88947   ]
88948
88949   [
88950     [[link boost_asio.reference.basic_stream_socket.message_peek [*message_peek]]]
88951     [Peek at incoming data without removing it from the input queue. ]
88952   ]
88953
88954 ]
88955
88956 [heading Protected Data Members]
88957 [table
88958   [[Name][Description]]
88959
88960   [
88961     [[link boost_asio.reference.basic_stream_socket.impl_ [*impl_]]]
88962     []
88963   ]
88964
88965 ]
88966
88967 The [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] class template provides asynchronous and blocking stream-oriented socket functionality.
88968
88969
88970 [heading Thread Safety]
88971   
88972 ['Distinct] ['objects:] Safe.
88973
88974 ['Shared] ['objects:] Unsafe.
88975
88976
88977
88978
88979
88980 [heading Requirements]
88981
88982 ['Header: ][^boost/asio/ip/tcp.hpp]
88983
88984 ['Convenience header: ][^boost/asio.hpp]
88985
88986
88987 [endsect]
88988
88989
88990
88991 [section:type ip::tcp::type]
88992
88993 [indexterm2 boost_asio.indexterm.ip__tcp.type..type..ip::tcp] 
88994 Obtain an identifier for the type of the protocol. 
88995
88996
88997   int type() const;
88998
88999
89000
89001 [endsect]
89002
89003
89004
89005 [section:v4 ip::tcp::v4]
89006
89007 [indexterm2 boost_asio.indexterm.ip__tcp.v4..v4..ip::tcp] 
89008 Construct to represent the IPv4 TCP protocol. 
89009
89010
89011   static tcp v4();
89012
89013
89014
89015 [endsect]
89016
89017
89018
89019 [section:v6 ip::tcp::v6]
89020
89021 [indexterm2 boost_asio.indexterm.ip__tcp.v6..v6..ip::tcp] 
89022 Construct to represent the IPv6 TCP protocol. 
89023
89024
89025   static tcp v6();
89026
89027
89028
89029 [endsect]
89030
89031
89032
89033 [endsect]
89034
89035 [section:ip__udp ip::udp]
89036
89037
89038 Encapsulates the flags needed for UDP. 
89039
89040
89041   class udp
89042
89043
89044 [heading Types]
89045 [table
89046   [[Name][Description]]
89047
89048   [
89049
89050     [[link boost_asio.reference.ip__udp.endpoint [*endpoint]]]
89051     [The type of a UDP endpoint. ]
89052   
89053   ]
89054
89055   [
89056
89057     [[link boost_asio.reference.ip__udp.resolver [*resolver]]]
89058     [The UDP resolver type. ]
89059   
89060   ]
89061
89062   [
89063
89064     [[link boost_asio.reference.ip__udp.socket [*socket]]]
89065     [The UDP socket type. ]
89066   
89067   ]
89068
89069 ]
89070
89071 [heading Member Functions]
89072 [table
89073   [[Name][Description]]
89074
89075   [
89076     [[link boost_asio.reference.ip__udp.family [*family]]]
89077     [Obtain an identifier for the protocol family. ]
89078   ]
89079   
89080   [
89081     [[link boost_asio.reference.ip__udp.protocol [*protocol]]]
89082     [Obtain an identifier for the protocol. ]
89083   ]
89084   
89085   [
89086     [[link boost_asio.reference.ip__udp.type [*type]]]
89087     [Obtain an identifier for the type of the protocol. ]
89088   ]
89089   
89090   [
89091     [[link boost_asio.reference.ip__udp.v4 [*v4]]]
89092     [Construct to represent the IPv4 UDP protocol. ]
89093   ]
89094   
89095   [
89096     [[link boost_asio.reference.ip__udp.v6 [*v6]]]
89097     [Construct to represent the IPv6 UDP protocol. ]
89098   ]
89099   
89100 ]
89101
89102 [heading Friends]
89103 [table
89104   [[Name][Description]]
89105
89106   [
89107     [[link boost_asio.reference.ip__udp.operator_not__eq_ [*operator!=]]]
89108     [Compare two protocols for inequality. ]
89109   ]
89110   
89111   [
89112     [[link boost_asio.reference.ip__udp.operator_eq__eq_ [*operator==]]]
89113     [Compare two protocols for equality. ]
89114   ]
89115   
89116 ]
89117
89118 The [link boost_asio.reference.ip__udp `ip::udp`] class contains flags necessary for UDP sockets.
89119
89120
89121 [heading Thread Safety]
89122   
89123 ['Distinct] ['objects:] Safe.
89124
89125 ['Shared] ['objects:] Safe.
89126
89127
89128
89129
89130 [heading Requirements]
89131
89132 ['Header: ][^boost/asio/ip/udp.hpp]
89133
89134 ['Convenience header: ][^boost/asio.hpp]
89135
89136
89137 [section:endpoint ip::udp::endpoint]
89138
89139 [indexterm2 boost_asio.indexterm.ip__udp.endpoint..endpoint..ip::udp] 
89140 The type of a UDP endpoint. 
89141
89142
89143   typedef basic_endpoint< udp > endpoint;
89144
89145
89146 [heading Types]
89147 [table
89148   [[Name][Description]]
89149
89150   [
89151
89152     [[link boost_asio.reference.ip__basic_endpoint.data_type [*data_type]]]
89153     [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
89154   
89155   ]
89156
89157   [
89158
89159     [[link boost_asio.reference.ip__basic_endpoint.protocol_type [*protocol_type]]]
89160     [The protocol type associated with the endpoint. ]
89161   
89162   ]
89163
89164 ]
89165
89166 [heading Member Functions]
89167 [table
89168   [[Name][Description]]
89169
89170   [
89171     [[link boost_asio.reference.ip__basic_endpoint.address [*address]]]
89172     [Get the IP address associated with the endpoint. 
89173      [hr]
89174      Set the IP address associated with the endpoint. ]
89175   ]
89176   
89177   [
89178     [[link boost_asio.reference.ip__basic_endpoint.basic_endpoint [*basic_endpoint]]]
89179     [Default constructor. 
89180      [hr]
89181      Construct an endpoint using a port number, specified in the host's byte order. The IP address will be the any address (i.e. INADDR_ANY or in6addr_any). This constructor would typically be used for accepting new connections. 
89182      [hr]
89183      Construct an endpoint using a port number and an IP address. This constructor may be used for accepting connections on a specific interface or for making a connection to a remote endpoint. 
89184      [hr]
89185      Copy constructor. 
89186      [hr]
89187      Move constructor. ]
89188   ]
89189   
89190   [
89191     [[link boost_asio.reference.ip__basic_endpoint.capacity [*capacity]]]
89192     [Get the capacity of the endpoint in the native type. ]
89193   ]
89194   
89195   [
89196     [[link boost_asio.reference.ip__basic_endpoint.data [*data]]]
89197     [Get the underlying endpoint in the native type. ]
89198   ]
89199   
89200   [
89201     [[link boost_asio.reference.ip__basic_endpoint.operator_eq_ [*operator=]]]
89202     [Assign from another endpoint. 
89203      [hr]
89204      Move-assign from another endpoint. ]
89205   ]
89206   
89207   [
89208     [[link boost_asio.reference.ip__basic_endpoint.port [*port]]]
89209     [Get the port associated with the endpoint. The port number is always in the host's byte order. 
89210      [hr]
89211      Set the port associated with the endpoint. The port number is always in the host's byte order. ]
89212   ]
89213   
89214   [
89215     [[link boost_asio.reference.ip__basic_endpoint.protocol [*protocol]]]
89216     [The protocol associated with the endpoint. ]
89217   ]
89218   
89219   [
89220     [[link boost_asio.reference.ip__basic_endpoint.resize [*resize]]]
89221     [Set the underlying size of the endpoint in the native type. ]
89222   ]
89223   
89224   [
89225     [[link boost_asio.reference.ip__basic_endpoint.size [*size]]]
89226     [Get the underlying size of the endpoint in the native type. ]
89227   ]
89228   
89229 ]
89230
89231 [heading Friends]
89232 [table
89233   [[Name][Description]]
89234
89235   [
89236     [[link boost_asio.reference.ip__basic_endpoint.operator_not__eq_ [*operator!=]]]
89237     [Compare two endpoints for inequality. ]
89238   ]
89239   
89240   [
89241     [[link boost_asio.reference.ip__basic_endpoint.operator_lt_ [*operator<]]]
89242     [Compare endpoints for ordering. ]
89243   ]
89244   
89245   [
89246     [[link boost_asio.reference.ip__basic_endpoint.operator_lt__eq_ [*operator<=]]]
89247     [Compare endpoints for ordering. ]
89248   ]
89249   
89250   [
89251     [[link boost_asio.reference.ip__basic_endpoint.operator_eq__eq_ [*operator==]]]
89252     [Compare two endpoints for equality. ]
89253   ]
89254   
89255   [
89256     [[link boost_asio.reference.ip__basic_endpoint.operator_gt_ [*operator>]]]
89257     [Compare endpoints for ordering. ]
89258   ]
89259   
89260   [
89261     [[link boost_asio.reference.ip__basic_endpoint.operator_gt__eq_ [*operator>=]]]
89262     [Compare endpoints for ordering. ]
89263   ]
89264   
89265 ]
89266
89267 [heading Related Functions]
89268 [table
89269   [[Name][Description]]
89270
89271   [
89272     [[link boost_asio.reference.ip__basic_endpoint.operator_lt__lt_ [*operator<<]]]
89273     [Output an endpoint as a string. ]
89274   ]
89275   
89276 ]
89277
89278 The [link boost_asio.reference.ip__basic_endpoint `ip::basic_endpoint`] class template describes an endpoint that may be associated with a particular socket.
89279
89280
89281 [heading Thread Safety]
89282   
89283 ['Distinct] ['objects:] Safe.
89284
89285 ['Shared] ['objects:] Unsafe.
89286
89287
89288
89289
89290
89291 [heading Requirements]
89292
89293 ['Header: ][^boost/asio/ip/udp.hpp]
89294
89295 ['Convenience header: ][^boost/asio.hpp]
89296
89297
89298 [endsect]
89299
89300
89301
89302 [section:family ip::udp::family]
89303
89304 [indexterm2 boost_asio.indexterm.ip__udp.family..family..ip::udp] 
89305 Obtain an identifier for the protocol family. 
89306
89307
89308   int family() const;
89309
89310
89311
89312 [endsect]
89313
89314
89315
89316 [section:operator_not__eq_ ip::udp::operator!=]
89317
89318 [indexterm2 boost_asio.indexterm.ip__udp.operator_not__eq_..operator!=..ip::udp] 
89319 Compare two protocols for inequality. 
89320
89321
89322   friend bool operator!=(
89323       const udp & p1,
89324       const udp & p2);
89325
89326
89327 [heading Requirements]
89328
89329 ['Header: ][^boost/asio/ip/udp.hpp]
89330
89331 ['Convenience header: ][^boost/asio.hpp]
89332
89333
89334 [endsect]
89335
89336
89337
89338 [section:operator_eq__eq_ ip::udp::operator==]
89339
89340 [indexterm2 boost_asio.indexterm.ip__udp.operator_eq__eq_..operator==..ip::udp] 
89341 Compare two protocols for equality. 
89342
89343
89344   friend bool operator==(
89345       const udp & p1,
89346       const udp & p2);
89347
89348
89349 [heading Requirements]
89350
89351 ['Header: ][^boost/asio/ip/udp.hpp]
89352
89353 ['Convenience header: ][^boost/asio.hpp]
89354
89355
89356 [endsect]
89357
89358
89359
89360 [section:protocol ip::udp::protocol]
89361
89362 [indexterm2 boost_asio.indexterm.ip__udp.protocol..protocol..ip::udp] 
89363 Obtain an identifier for the protocol. 
89364
89365
89366   int protocol() const;
89367
89368
89369
89370 [endsect]
89371
89372
89373
89374 [section:resolver ip::udp::resolver]
89375
89376 [indexterm2 boost_asio.indexterm.ip__udp.resolver..resolver..ip::udp] 
89377 The UDP resolver type. 
89378
89379
89380   typedef basic_resolver< udp > resolver;
89381
89382
89383 [heading Types]
89384 [table
89385   [[Name][Description]]
89386
89387   [
89388
89389     [[link boost_asio.reference.ip__basic_resolver__rebind_executor [*rebind_executor]]]
89390     [Rebinds the resolver type to another executor. ]
89391   
89392   ]
89393
89394   [
89395
89396     [[link boost_asio.reference.ip__basic_resolver.endpoint_type [*endpoint_type]]]
89397     [The endpoint type. ]
89398   
89399   ]
89400
89401   [
89402
89403     [[link boost_asio.reference.ip__basic_resolver.executor_type [*executor_type]]]
89404     [The type of the executor associated with the object. ]
89405   
89406   ]
89407
89408   [
89409
89410     [[link boost_asio.reference.ip__basic_resolver.flags [*flags]]]
89411     [A bitmask type (C++ Std \[lib.bitmask.types\]). ]
89412   
89413   ]
89414
89415   [
89416
89417     [[link boost_asio.reference.ip__basic_resolver.iterator [*iterator]]]
89418     [(Deprecated.) The iterator type. ]
89419   
89420   ]
89421
89422   [
89423
89424     [[link boost_asio.reference.ip__basic_resolver.protocol_type [*protocol_type]]]
89425     [The protocol type. ]
89426   
89427   ]
89428
89429   [
89430
89431     [[link boost_asio.reference.ip__basic_resolver.query [*query]]]
89432     [(Deprecated.) The query type. ]
89433   
89434   ]
89435
89436   [
89437
89438     [[link boost_asio.reference.ip__basic_resolver.results_type [*results_type]]]
89439     [The results type. ]
89440   
89441   ]
89442
89443 ]
89444
89445 [heading Member Functions]
89446 [table
89447   [[Name][Description]]
89448
89449   [
89450     [[link boost_asio.reference.ip__basic_resolver.async_resolve [*async_resolve]]]
89451     [(Deprecated: Use overload with separate host and service parameters.) Asynchronously perform forward resolution of a query to a list of entries. 
89452      [hr]
89453      Asynchronously perform forward resolution of a query to a list of entries. 
89454      [hr]
89455      Asynchronously perform reverse resolution of an endpoint to a list of entries. ]
89456   ]
89457   
89458   [
89459     [[link boost_asio.reference.ip__basic_resolver.basic_resolver [*basic_resolver]]]
89460     [Construct with executor. 
89461      [hr]
89462      Construct with execution context. 
89463      [hr]
89464      Move-construct a basic_resolver from another. ]
89465   ]
89466   
89467   [
89468     [[link boost_asio.reference.ip__basic_resolver.cancel [*cancel]]]
89469     [Cancel any asynchronous operations that are waiting on the resolver. ]
89470   ]
89471   
89472   [
89473     [[link boost_asio.reference.ip__basic_resolver.get_executor [*get_executor]]]
89474     [Get the executor associated with the object. ]
89475   ]
89476   
89477   [
89478     [[link boost_asio.reference.ip__basic_resolver.operator_eq_ [*operator=]]]
89479     [Move-assign a basic_resolver from another. ]
89480   ]
89481   
89482   [
89483     [[link boost_asio.reference.ip__basic_resolver.resolve [*resolve]]]
89484     [(Deprecated: Use overload with separate host and service parameters.) Perform forward resolution of a query to a list of entries. 
89485      [hr]
89486      Perform forward resolution of a query to a list of entries. 
89487      [hr]
89488      Perform reverse resolution of an endpoint to a list of entries. ]
89489   ]
89490   
89491   [
89492     [[link boost_asio.reference.ip__basic_resolver._basic_resolver [*~basic_resolver]]]
89493     [Destroys the resolver. ]
89494   ]
89495   
89496 ]
89497
89498 [heading Data Members]
89499 [table
89500   [[Name][Description]]
89501
89502   [
89503     [[link boost_asio.reference.ip__basic_resolver.address_configured [*address_configured]]]
89504     [Only return IPv4 addresses if a non-loopback IPv4 address is configured for the system. Only return IPv6 addresses if a non-loopback IPv6 address is configured for the system. ]
89505   ]
89506
89507   [
89508     [[link boost_asio.reference.ip__basic_resolver.all_matching [*all_matching]]]
89509     [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ]
89510   ]
89511
89512   [
89513     [[link boost_asio.reference.ip__basic_resolver.canonical_name [*canonical_name]]]
89514     [Determine the canonical name of the host specified in the query. ]
89515   ]
89516
89517   [
89518     [[link boost_asio.reference.ip__basic_resolver.numeric_host [*numeric_host]]]
89519     [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ]
89520   ]
89521
89522   [
89523     [[link boost_asio.reference.ip__basic_resolver.numeric_service [*numeric_service]]]
89524     [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ]
89525   ]
89526
89527   [
89528     [[link boost_asio.reference.ip__basic_resolver.passive [*passive]]]
89529     [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ]
89530   ]
89531
89532   [
89533     [[link boost_asio.reference.ip__basic_resolver.v4_mapped [*v4_mapped]]]
89534     [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ]
89535   ]
89536
89537 ]
89538
89539 The [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] class template provides the ability to resolve a query to a list of endpoints.
89540
89541
89542 [heading Thread Safety]
89543   
89544 ['Distinct] ['objects:] Safe.
89545
89546 ['Shared] ['objects:] Unsafe. 
89547
89548
89549
89550
89551 [heading Requirements]
89552
89553 ['Header: ][^boost/asio/ip/udp.hpp]
89554
89555 ['Convenience header: ][^boost/asio.hpp]
89556
89557
89558 [endsect]
89559
89560
89561
89562 [section:socket ip::udp::socket]
89563
89564 [indexterm2 boost_asio.indexterm.ip__udp.socket..socket..ip::udp] 
89565 The UDP socket type. 
89566
89567
89568   typedef basic_datagram_socket< udp > socket;
89569
89570
89571 [heading Types]
89572 [table
89573   [[Name][Description]]
89574
89575   [
89576
89577     [[link boost_asio.reference.basic_datagram_socket__rebind_executor [*rebind_executor]]]
89578     [Rebinds the socket type to another executor. ]
89579   
89580   ]
89581
89582   [
89583
89584     [[link boost_asio.reference.basic_datagram_socket.broadcast [*broadcast]]]
89585     [Socket option to permit sending of broadcast messages. ]
89586   
89587   ]
89588
89589   [
89590
89591     [[link boost_asio.reference.basic_datagram_socket.bytes_readable [*bytes_readable]]]
89592     [IO control command to get the amount of data that can be read without blocking. ]
89593   
89594   ]
89595
89596   [
89597
89598     [[link boost_asio.reference.basic_datagram_socket.debug [*debug]]]
89599     [Socket option to enable socket-level debugging. ]
89600   
89601   ]
89602
89603   [
89604
89605     [[link boost_asio.reference.basic_datagram_socket.do_not_route [*do_not_route]]]
89606     [Socket option to prevent routing, use local interfaces only. ]
89607   
89608   ]
89609
89610   [
89611
89612     [[link boost_asio.reference.basic_datagram_socket.enable_connection_aborted [*enable_connection_aborted]]]
89613     [Socket option to report aborted connections on accept. ]
89614   
89615   ]
89616
89617   [
89618
89619     [[link boost_asio.reference.basic_datagram_socket.endpoint_type [*endpoint_type]]]
89620     [The endpoint type. ]
89621   
89622   ]
89623
89624   [
89625
89626     [[link boost_asio.reference.basic_datagram_socket.executor_type [*executor_type]]]
89627     [The type of the executor associated with the object. ]
89628   
89629   ]
89630
89631   [
89632
89633     [[link boost_asio.reference.basic_datagram_socket.keep_alive [*keep_alive]]]
89634     [Socket option to send keep-alives. ]
89635   
89636   ]
89637
89638   [
89639
89640     [[link boost_asio.reference.basic_datagram_socket.linger [*linger]]]
89641     [Socket option to specify whether the socket lingers on close if unsent data is present. ]
89642   
89643   ]
89644
89645   [
89646
89647     [[link boost_asio.reference.basic_datagram_socket.lowest_layer_type [*lowest_layer_type]]]
89648     [A basic_socket is always the lowest layer. ]
89649   
89650   ]
89651
89652   [
89653
89654     [[link boost_asio.reference.basic_datagram_socket.message_flags [*message_flags]]]
89655     [Bitmask type for flags that can be passed to send and receive operations. ]
89656   
89657   ]
89658
89659   [
89660
89661     [[link boost_asio.reference.basic_datagram_socket.native_handle_type [*native_handle_type]]]
89662     [The native representation of a socket. ]
89663   
89664   ]
89665
89666   [
89667
89668     [[link boost_asio.reference.basic_datagram_socket.out_of_band_inline [*out_of_band_inline]]]
89669     [Socket option for putting received out-of-band data inline. ]
89670   
89671   ]
89672
89673   [
89674
89675     [[link boost_asio.reference.basic_datagram_socket.protocol_type [*protocol_type]]]
89676     [The protocol type. ]
89677   
89678   ]
89679
89680   [
89681
89682     [[link boost_asio.reference.basic_datagram_socket.receive_buffer_size [*receive_buffer_size]]]
89683     [Socket option for the receive buffer size of a socket. ]
89684   
89685   ]
89686
89687   [
89688
89689     [[link boost_asio.reference.basic_datagram_socket.receive_low_watermark [*receive_low_watermark]]]
89690     [Socket option for the receive low watermark. ]
89691   
89692   ]
89693
89694   [
89695
89696     [[link boost_asio.reference.basic_datagram_socket.reuse_address [*reuse_address]]]
89697     [Socket option to allow the socket to be bound to an address that is already in use. ]
89698   
89699   ]
89700
89701   [
89702
89703     [[link boost_asio.reference.basic_datagram_socket.send_buffer_size [*send_buffer_size]]]
89704     [Socket option for the send buffer size of a socket. ]
89705   
89706   ]
89707
89708   [
89709
89710     [[link boost_asio.reference.basic_datagram_socket.send_low_watermark [*send_low_watermark]]]
89711     [Socket option for the send low watermark. ]
89712   
89713   ]
89714
89715   [
89716
89717     [[link boost_asio.reference.basic_datagram_socket.shutdown_type [*shutdown_type]]]
89718     [Different ways a socket may be shutdown. ]
89719   
89720   ]
89721
89722   [
89723
89724     [[link boost_asio.reference.basic_datagram_socket.wait_type [*wait_type]]]
89725     [Wait types. ]
89726   
89727   ]
89728
89729 ]
89730
89731 [heading Member Functions]
89732 [table
89733   [[Name][Description]]
89734
89735   [
89736     [[link boost_asio.reference.basic_datagram_socket.assign [*assign]]]
89737     [Assign an existing native socket to the socket. ]
89738   ]
89739   
89740   [
89741     [[link boost_asio.reference.basic_datagram_socket.async_connect [*async_connect]]]
89742     [Start an asynchronous connect. ]
89743   ]
89744   
89745   [
89746     [[link boost_asio.reference.basic_datagram_socket.async_receive [*async_receive]]]
89747     [Start an asynchronous receive on a connected socket. ]
89748   ]
89749   
89750   [
89751     [[link boost_asio.reference.basic_datagram_socket.async_receive_from [*async_receive_from]]]
89752     [Start an asynchronous receive. ]
89753   ]
89754   
89755   [
89756     [[link boost_asio.reference.basic_datagram_socket.async_send [*async_send]]]
89757     [Start an asynchronous send on a connected socket. ]
89758   ]
89759   
89760   [
89761     [[link boost_asio.reference.basic_datagram_socket.async_send_to [*async_send_to]]]
89762     [Start an asynchronous send. ]
89763   ]
89764   
89765   [
89766     [[link boost_asio.reference.basic_datagram_socket.async_wait [*async_wait]]]
89767     [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
89768   ]
89769   
89770   [
89771     [[link boost_asio.reference.basic_datagram_socket.at_mark [*at_mark]]]
89772     [Determine whether the socket is at the out-of-band data mark. ]
89773   ]
89774   
89775   [
89776     [[link boost_asio.reference.basic_datagram_socket.available [*available]]]
89777     [Determine the number of bytes available for reading. ]
89778   ]
89779   
89780   [
89781     [[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket [*basic_datagram_socket]]]
89782     [Construct a basic_datagram_socket without opening it. 
89783      [hr]
89784      Construct and open a basic_datagram_socket. 
89785      [hr]
89786      Construct a basic_datagram_socket, opening it and binding it to the given local endpoint. 
89787      [hr]
89788      Construct a basic_datagram_socket on an existing native socket. 
89789      [hr]
89790      Move-construct a basic_datagram_socket from another. 
89791      [hr]
89792      Move-construct a basic_datagram_socket from a socket of another protocol type. ]
89793   ]
89794   
89795   [
89796     [[link boost_asio.reference.basic_datagram_socket.bind [*bind]]]
89797     [Bind the socket to the given local endpoint. ]
89798   ]
89799   
89800   [
89801     [[link boost_asio.reference.basic_datagram_socket.cancel [*cancel]]]
89802     [Cancel all asynchronous operations associated with the socket. ]
89803   ]
89804   
89805   [
89806     [[link boost_asio.reference.basic_datagram_socket.close [*close]]]
89807     [Close the socket. ]
89808   ]
89809   
89810   [
89811     [[link boost_asio.reference.basic_datagram_socket.connect [*connect]]]
89812     [Connect the socket to the specified endpoint. ]
89813   ]
89814   
89815   [
89816     [[link boost_asio.reference.basic_datagram_socket.get_executor [*get_executor]]]
89817     [Get the executor associated with the object. ]
89818   ]
89819   
89820   [
89821     [[link boost_asio.reference.basic_datagram_socket.get_option [*get_option]]]
89822     [Get an option from the socket. ]
89823   ]
89824   
89825   [
89826     [[link boost_asio.reference.basic_datagram_socket.io_control [*io_control]]]
89827     [Perform an IO control command on the socket. ]
89828   ]
89829   
89830   [
89831     [[link boost_asio.reference.basic_datagram_socket.is_open [*is_open]]]
89832     [Determine whether the socket is open. ]
89833   ]
89834   
89835   [
89836     [[link boost_asio.reference.basic_datagram_socket.local_endpoint [*local_endpoint]]]
89837     [Get the local endpoint of the socket. ]
89838   ]
89839   
89840   [
89841     [[link boost_asio.reference.basic_datagram_socket.lowest_layer [*lowest_layer]]]
89842     [Get a reference to the lowest layer. 
89843      [hr]
89844      Get a const reference to the lowest layer. ]
89845   ]
89846   
89847   [
89848     [[link boost_asio.reference.basic_datagram_socket.native_handle [*native_handle]]]
89849     [Get the native socket representation. ]
89850   ]
89851   
89852   [
89853     [[link boost_asio.reference.basic_datagram_socket.native_non_blocking [*native_non_blocking]]]
89854     [Gets the non-blocking mode of the native socket implementation. 
89855      [hr]
89856      Sets the non-blocking mode of the native socket implementation. ]
89857   ]
89858   
89859   [
89860     [[link boost_asio.reference.basic_datagram_socket.non_blocking [*non_blocking]]]
89861     [Gets the non-blocking mode of the socket. 
89862      [hr]
89863      Sets the non-blocking mode of the socket. ]
89864   ]
89865   
89866   [
89867     [[link boost_asio.reference.basic_datagram_socket.open [*open]]]
89868     [Open the socket using the specified protocol. ]
89869   ]
89870   
89871   [
89872     [[link boost_asio.reference.basic_datagram_socket.operator_eq_ [*operator=]]]
89873     [Move-assign a basic_datagram_socket from another. 
89874      [hr]
89875      Move-assign a basic_datagram_socket from a socket of another protocol type. ]
89876   ]
89877   
89878   [
89879     [[link boost_asio.reference.basic_datagram_socket.receive [*receive]]]
89880     [Receive some data on a connected socket. ]
89881   ]
89882   
89883   [
89884     [[link boost_asio.reference.basic_datagram_socket.receive_from [*receive_from]]]
89885     [Receive a datagram with the endpoint of the sender. ]
89886   ]
89887   
89888   [
89889     [[link boost_asio.reference.basic_datagram_socket.release [*release]]]
89890     [Release ownership of the underlying native socket. ]
89891   ]
89892   
89893   [
89894     [[link boost_asio.reference.basic_datagram_socket.remote_endpoint [*remote_endpoint]]]
89895     [Get the remote endpoint of the socket. ]
89896   ]
89897   
89898   [
89899     [[link boost_asio.reference.basic_datagram_socket.send [*send]]]
89900     [Send some data on a connected socket. ]
89901   ]
89902   
89903   [
89904     [[link boost_asio.reference.basic_datagram_socket.send_to [*send_to]]]
89905     [Send a datagram to the specified endpoint. ]
89906   ]
89907   
89908   [
89909     [[link boost_asio.reference.basic_datagram_socket.set_option [*set_option]]]
89910     [Set an option on the socket. ]
89911   ]
89912   
89913   [
89914     [[link boost_asio.reference.basic_datagram_socket.shutdown [*shutdown]]]
89915     [Disable sends or receives on the socket. ]
89916   ]
89917   
89918   [
89919     [[link boost_asio.reference.basic_datagram_socket.wait [*wait]]]
89920     [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
89921   ]
89922   
89923   [
89924     [[link boost_asio.reference.basic_datagram_socket._basic_datagram_socket [*~basic_datagram_socket]]]
89925     [Destroys the socket. ]
89926   ]
89927   
89928 ]
89929
89930 [heading Data Members]
89931 [table
89932   [[Name][Description]]
89933
89934   [
89935     [[link boost_asio.reference.basic_datagram_socket.max_connections [*max_connections]]]
89936     [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
89937   ]
89938
89939   [
89940     [[link boost_asio.reference.basic_datagram_socket.max_listen_connections [*max_listen_connections]]]
89941     [The maximum length of the queue of pending incoming connections. ]
89942   ]
89943
89944   [
89945     [[link boost_asio.reference.basic_datagram_socket.message_do_not_route [*message_do_not_route]]]
89946     [Specify that the data should not be subject to routing. ]
89947   ]
89948
89949   [
89950     [[link boost_asio.reference.basic_datagram_socket.message_end_of_record [*message_end_of_record]]]
89951     [Specifies that the data marks the end of a record. ]
89952   ]
89953
89954   [
89955     [[link boost_asio.reference.basic_datagram_socket.message_out_of_band [*message_out_of_band]]]
89956     [Process out-of-band data. ]
89957   ]
89958
89959   [
89960     [[link boost_asio.reference.basic_datagram_socket.message_peek [*message_peek]]]
89961     [Peek at incoming data without removing it from the input queue. ]
89962   ]
89963
89964 ]
89965
89966 [heading Protected Data Members]
89967 [table
89968   [[Name][Description]]
89969
89970   [
89971     [[link boost_asio.reference.basic_datagram_socket.impl_ [*impl_]]]
89972     []
89973   ]
89974
89975 ]
89976
89977 The [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] class template provides asynchronous and blocking datagram-oriented socket functionality.
89978
89979
89980 [heading Thread Safety]
89981   
89982 ['Distinct] ['objects:] Safe.
89983
89984 ['Shared] ['objects:] Unsafe. 
89985
89986
89987
89988
89989 [heading Requirements]
89990
89991 ['Header: ][^boost/asio/ip/udp.hpp]
89992
89993 ['Convenience header: ][^boost/asio.hpp]
89994
89995
89996 [endsect]
89997
89998
89999
90000 [section:type ip::udp::type]
90001
90002 [indexterm2 boost_asio.indexterm.ip__udp.type..type..ip::udp] 
90003 Obtain an identifier for the type of the protocol. 
90004
90005
90006   int type() const;
90007
90008
90009
90010 [endsect]
90011
90012
90013
90014 [section:v4 ip::udp::v4]
90015
90016 [indexterm2 boost_asio.indexterm.ip__udp.v4..v4..ip::udp] 
90017 Construct to represent the IPv4 UDP protocol. 
90018
90019
90020   static udp v4();
90021
90022
90023
90024 [endsect]
90025
90026
90027
90028 [section:v6 ip::udp::v6]
90029
90030 [indexterm2 boost_asio.indexterm.ip__udp.v6..v6..ip::udp] 
90031 Construct to represent the IPv6 UDP protocol. 
90032
90033
90034   static udp v6();
90035
90036
90037
90038 [endsect]
90039
90040
90041
90042 [endsect]
90043
90044
90045 [section:ip__unicast__hops ip::unicast::hops]
90046
90047 [indexterm1 boost_asio.indexterm.ip__unicast__hops..ip::unicast::hops] 
90048 Socket option for time-to-live associated with outgoing unicast packets. 
90049
90050
90051   typedef implementation_defined hops;
90052
90053
90054
90055 Implements the IPPROTO\_IP/IP\_UNICAST\_TTL socket option.
90056
90057
90058 [heading Examples]
90059   
90060 Setting the option: 
90061
90062    boost::asio::ip::udp::socket socket(my_context);
90063    ...
90064    boost::asio::ip::unicast::hops option(4);
90065    socket.set_option(option);
90066
90067
90068
90069
90070
90071 Getting the current option value: 
90072
90073    boost::asio::ip::udp::socket socket(my_context);
90074    ...
90075    boost::asio::ip::unicast::hops option;
90076    socket.get_option(option);
90077    int ttl = option.value();
90078
90079
90080
90081
90082
90083
90084
90085 [heading Requirements]
90086
90087 ['Header: ][^boost/asio/ip/unicast.hpp]
90088
90089 ['Convenience header: ][^boost/asio.hpp]
90090
90091
90092 [endsect]
90093
90094
90095
90096 [section:ip__v4_mapped_t ip::v4_mapped_t]
90097
90098 [indexterm1 boost_asio.indexterm.ip__v4_mapped_t..ip::v4_mapped_t] 
90099 Tag type used for distinguishing overloads that deal in IPv4-mapped IPv6 addresses. 
90100
90101
90102   enum v4_mapped_t
90103
90104 [indexterm2 boost_asio.indexterm.ip__v4_mapped_t.v4_mapped..v4_mapped..ip::v4_mapped_t]
90105
90106 [heading Values]
90107 [variablelist
90108
90109   [
90110     [v4_mapped]
90111     []
90112   ]
90113
90114 ]
90115
90116
90117 [heading Requirements]
90118
90119 ['Header: ][^boost/asio/ip/address_v6.hpp]
90120
90121 ['Convenience header: ][^boost/asio.hpp]
90122
90123
90124 [endsect]
90125
90126
90127
90128 [section:ip__v6_only ip::v6_only]
90129
90130 [indexterm1 boost_asio.indexterm.ip__v6_only..ip::v6_only] 
90131 Socket option for determining whether an IPv6 socket supports IPv6 communication only. 
90132
90133
90134   typedef implementation_defined v6_only;
90135
90136
90137
90138 Implements the IPPROTO\_IPV6/IP\_V6ONLY socket option.
90139
90140
90141 [heading Examples]
90142   
90143 Setting the option: 
90144
90145    boost::asio::ip::tcp::socket socket(my_context);
90146    ...
90147    boost::asio::ip::v6_only option(true);
90148    socket.set_option(option);
90149
90150
90151
90152
90153
90154 Getting the current option value: 
90155
90156    boost::asio::ip::tcp::socket socket(my_context);
90157    ...
90158    boost::asio::ip::v6_only option;
90159    socket.get_option(option);
90160    bool v6_only = option.value();
90161
90162
90163
90164
90165
90166
90167
90168 [heading Requirements]
90169
90170 ['Header: ][^boost/asio/ip/v6_only.hpp]
90171
90172 ['Convenience header: ][^boost/asio.hpp]
90173
90174
90175 [endsect]
90176
90177
90178 [section:is_const_buffer_sequence is_const_buffer_sequence]
90179
90180
90181 Trait to determine whether a type satisfies the ConstBufferSequence requirements. 
90182
90183
90184   template<
90185       typename T>
90186   struct is_const_buffer_sequence
90187
90188
90189 [heading Requirements]
90190
90191 ['Header: ][^boost/asio/buffer.hpp]
90192
90193 ['Convenience header: ][^boost/asio.hpp]
90194
90195
90196 [endsect]
90197
90198 [section:is_dynamic_buffer is_dynamic_buffer]
90199
90200
90201 Trait to determine whether a type satisfies the DynamicBuffer requirements. 
90202
90203
90204   template<
90205       typename T>
90206   struct is_dynamic_buffer
90207
90208
90209 If `BOOST_ASIO_NO_DYNAMIC_BUFFER_V1` is not defined, determines whether the type satisfies the DynamicBuffer\_v1 requirements. Otherwise, if `BOOST_ASIO_NO_DYNAMIC_BUFFER_V1` is defined, determines whether the type satisfies the DynamicBuffer\_v2 requirements. 
90210
90211 [heading Requirements]
90212
90213 ['Header: ][^boost/asio/buffer.hpp]
90214
90215 ['Convenience header: ][^boost/asio.hpp]
90216
90217
90218 [endsect]
90219
90220 [section:is_dynamic_buffer_v1 is_dynamic_buffer_v1]
90221
90222
90223 Trait to determine whether a type satisfies the DynamicBuffer\_v1 requirements. 
90224
90225
90226   template<
90227       typename T>
90228   struct is_dynamic_buffer_v1
90229
90230
90231 [heading Requirements]
90232
90233 ['Header: ][^boost/asio/buffer.hpp]
90234
90235 ['Convenience header: ][^boost/asio.hpp]
90236
90237
90238 [endsect]
90239
90240 [section:is_dynamic_buffer_v2 is_dynamic_buffer_v2]
90241
90242
90243 Trait to determine whether a type satisfies the DynamicBuffer\_v2 requirements. 
90244
90245
90246   template<
90247       typename T>
90248   struct is_dynamic_buffer_v2
90249
90250
90251 [heading Requirements]
90252
90253 ['Header: ][^boost/asio/buffer.hpp]
90254
90255 ['Convenience header: ][^boost/asio.hpp]
90256
90257
90258 [endsect]
90259
90260 [section:is_endpoint_sequence is_endpoint_sequence]
90261
90262
90263 Type trait used to determine whether a type is an endpoint sequence that can be used with with `connect` and `async_connect`. 
90264
90265
90266   template<
90267       typename T>
90268   struct is_endpoint_sequence
90269
90270
90271 [heading Data Members]
90272 [table
90273   [[Name][Description]]
90274
90275   [
90276     [[link boost_asio.reference.is_endpoint_sequence.value [*value]]]
90277     [The value member is true if the type may be used as an endpoint sequence. ]
90278   ]
90279
90280 ]
90281
90282 [heading Requirements]
90283
90284 ['Header: ][^boost/asio/connect.hpp]
90285
90286 ['Convenience header: ][^boost/asio.hpp]
90287
90288
90289 [section:value is_endpoint_sequence::value]
90290
90291 [indexterm2 boost_asio.indexterm.is_endpoint_sequence.value..value..is_endpoint_sequence] 
90292 The value member is true if the type may be used as an endpoint sequence. 
90293
90294
90295   static const bool value;
90296
90297
90298
90299 [endsect]
90300
90301
90302
90303 [endsect]
90304
90305 [section:is_executor is_executor]
90306
90307
90308 The [link boost_asio.reference.is_executor `is_executor`] trait detects whether a type T meets the Executor type requirements. 
90309
90310
90311   template<
90312       typename T>
90313   struct is_executor
90314
90315
90316 Class template `is_executor` is a UnaryTypeTrait that is derived from `true_type` if the type `T` meets the syntactic requirements for Executor, otherwise `false_type`. 
90317
90318 [heading Requirements]
90319
90320 ['Header: ][^boost/asio/is_executor.hpp]
90321
90322 ['Convenience header: ][^boost/asio.hpp]
90323
90324
90325 [endsect]
90326
90327 [section:is_match_condition is_match_condition]
90328
90329
90330 Type trait used to determine whether a type can be used as a match condition function with read\_until and async\_read\_until. 
90331
90332
90333   template<
90334       typename T>
90335   struct is_match_condition
90336
90337
90338 [heading Data Members]
90339 [table
90340   [[Name][Description]]
90341
90342   [
90343     [[link boost_asio.reference.is_match_condition.value [*value]]]
90344     [The value member is true if the type may be used as a match condition. ]
90345   ]
90346
90347 ]
90348
90349 [heading Requirements]
90350
90351 ['Header: ][^boost/asio/read_until.hpp]
90352
90353 ['Convenience header: ][^boost/asio.hpp]
90354
90355
90356 [section:value is_match_condition::value]
90357
90358 [indexterm2 boost_asio.indexterm.is_match_condition.value..value..is_match_condition] 
90359 The value member is true if the type may be used as a match condition. 
90360
90361
90362   static const bool value;
90363
90364
90365
90366 [endsect]
90367
90368
90369
90370 [endsect]
90371
90372 [section:is_mutable_buffer_sequence is_mutable_buffer_sequence]
90373
90374
90375 Trait to determine whether a type satisfies the MutableBufferSequence requirements. 
90376
90377
90378   template<
90379       typename T>
90380   struct is_mutable_buffer_sequence
90381
90382
90383 [heading Requirements]
90384
90385 ['Header: ][^boost/asio/buffer.hpp]
90386
90387 ['Convenience header: ][^boost/asio.hpp]
90388
90389
90390 [endsect]
90391
90392 [section:is_read_buffered is_read_buffered]
90393
90394
90395 The [link boost_asio.reference.is_read_buffered `is_read_buffered`] class is a traits class that may be used to determine whether a stream type supports buffering of read data. 
90396
90397
90398   template<
90399       typename Stream>
90400   class is_read_buffered
90401
90402
90403 [heading Data Members]
90404 [table
90405   [[Name][Description]]
90406
90407   [
90408     [[link boost_asio.reference.is_read_buffered.value [*value]]]
90409     [The value member is true only if the Stream type supports buffering of read data. ]
90410   ]
90411
90412 ]
90413
90414 [heading Requirements]
90415
90416 ['Header: ][^boost/asio/is_read_buffered.hpp]
90417
90418 ['Convenience header: ][^boost/asio.hpp]
90419
90420
90421 [section:value is_read_buffered::value]
90422
90423 [indexterm2 boost_asio.indexterm.is_read_buffered.value..value..is_read_buffered] 
90424 The value member is true only if the Stream type supports buffering of read data. 
90425
90426
90427   static const bool value;
90428
90429
90430
90431 [endsect]
90432
90433
90434
90435 [endsect]
90436
90437 [section:is_write_buffered is_write_buffered]
90438
90439
90440 The [link boost_asio.reference.is_write_buffered `is_write_buffered`] class is a traits class that may be used to determine whether a stream type supports buffering of written data. 
90441
90442
90443   template<
90444       typename Stream>
90445   class is_write_buffered
90446
90447
90448 [heading Data Members]
90449 [table
90450   [[Name][Description]]
90451
90452   [
90453     [[link boost_asio.reference.is_write_buffered.value [*value]]]
90454     [The value member is true only if the Stream type supports buffering of written data. ]
90455   ]
90456
90457 ]
90458
90459 [heading Requirements]
90460
90461 ['Header: ][^boost/asio/is_write_buffered.hpp]
90462
90463 ['Convenience header: ][^boost/asio.hpp]
90464
90465
90466 [section:value is_write_buffered::value]
90467
90468 [indexterm2 boost_asio.indexterm.is_write_buffered.value..value..is_write_buffered] 
90469 The value member is true only if the Stream type supports buffering of written data. 
90470
90471
90472   static const bool value;
90473
90474
90475
90476 [endsect]
90477
90478
90479
90480 [endsect]
90481
90482 [section:local__basic_endpoint local::basic_endpoint]
90483
90484
90485 Describes an endpoint for a UNIX socket. 
90486
90487
90488   template<
90489       typename ``[link boost_asio.reference.Protocol Protocol]``>
90490   class basic_endpoint
90491
90492
90493 [heading Types]
90494 [table
90495   [[Name][Description]]
90496
90497   [
90498
90499     [[link boost_asio.reference.local__basic_endpoint.data_type [*data_type]]]
90500     [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
90501   
90502   ]
90503
90504   [
90505
90506     [[link boost_asio.reference.local__basic_endpoint.protocol_type [*protocol_type]]]
90507     [The protocol type associated with the endpoint. ]
90508   
90509   ]
90510
90511 ]
90512
90513 [heading Member Functions]
90514 [table
90515   [[Name][Description]]
90516
90517   [
90518     [[link boost_asio.reference.local__basic_endpoint.basic_endpoint [*basic_endpoint]]]
90519     [Default constructor. 
90520      [hr]
90521      Construct an endpoint using the specified path name. 
90522      [hr]
90523      Copy constructor. ]
90524   ]
90525   
90526   [
90527     [[link boost_asio.reference.local__basic_endpoint.capacity [*capacity]]]
90528     [Get the capacity of the endpoint in the native type. ]
90529   ]
90530   
90531   [
90532     [[link boost_asio.reference.local__basic_endpoint.data [*data]]]
90533     [Get the underlying endpoint in the native type. ]
90534   ]
90535   
90536   [
90537     [[link boost_asio.reference.local__basic_endpoint.operator_eq_ [*operator=]]]
90538     [Assign from another endpoint. ]
90539   ]
90540   
90541   [
90542     [[link boost_asio.reference.local__basic_endpoint.path [*path]]]
90543     [Get the path associated with the endpoint. 
90544      [hr]
90545      Set the path associated with the endpoint. ]
90546   ]
90547   
90548   [
90549     [[link boost_asio.reference.local__basic_endpoint.protocol [*protocol]]]
90550     [The protocol associated with the endpoint. ]
90551   ]
90552   
90553   [
90554     [[link boost_asio.reference.local__basic_endpoint.resize [*resize]]]
90555     [Set the underlying size of the endpoint in the native type. ]
90556   ]
90557   
90558   [
90559     [[link boost_asio.reference.local__basic_endpoint.size [*size]]]
90560     [Get the underlying size of the endpoint in the native type. ]
90561   ]
90562   
90563 ]
90564
90565 [heading Friends]
90566 [table
90567   [[Name][Description]]
90568
90569   [
90570     [[link boost_asio.reference.local__basic_endpoint.operator_not__eq_ [*operator!=]]]
90571     [Compare two endpoints for inequality. ]
90572   ]
90573   
90574   [
90575     [[link boost_asio.reference.local__basic_endpoint.operator_lt_ [*operator<]]]
90576     [Compare endpoints for ordering. ]
90577   ]
90578   
90579   [
90580     [[link boost_asio.reference.local__basic_endpoint.operator_lt__eq_ [*operator<=]]]
90581     [Compare endpoints for ordering. ]
90582   ]
90583   
90584   [
90585     [[link boost_asio.reference.local__basic_endpoint.operator_eq__eq_ [*operator==]]]
90586     [Compare two endpoints for equality. ]
90587   ]
90588   
90589   [
90590     [[link boost_asio.reference.local__basic_endpoint.operator_gt_ [*operator>]]]
90591     [Compare endpoints for ordering. ]
90592   ]
90593   
90594   [
90595     [[link boost_asio.reference.local__basic_endpoint.operator_gt__eq_ [*operator>=]]]
90596     [Compare endpoints for ordering. ]
90597   ]
90598   
90599 ]
90600
90601 [heading Related Functions]
90602 [table
90603   [[Name][Description]]
90604
90605   [
90606     [[link boost_asio.reference.local__basic_endpoint.operator_lt__lt_ [*operator<<]]]
90607     [Output an endpoint as a string. ]
90608   ]
90609   
90610 ]
90611
90612 The [link boost_asio.reference.local__basic_endpoint `local::basic_endpoint`] class template describes an endpoint that may be associated with a particular UNIX socket.
90613
90614
90615 [heading Thread Safety]
90616   
90617 ['Distinct] ['objects:] Safe.
90618
90619 ['Shared] ['objects:] Unsafe.
90620
90621
90622
90623
90624 [heading Requirements]
90625
90626 ['Header: ][^boost/asio/local/basic_endpoint.hpp]
90627
90628 ['Convenience header: ][^boost/asio.hpp]
90629
90630 [section:basic_endpoint local::basic_endpoint::basic_endpoint]
90631
90632 [indexterm2 boost_asio.indexterm.local__basic_endpoint.basic_endpoint..basic_endpoint..local::basic_endpoint] 
90633 Default constructor. 
90634
90635
90636   ``[link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload1 basic_endpoint]``();
90637   ``  [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload1 more...]]``
90638
90639
90640 Construct an endpoint using the specified path name. 
90641
90642
90643   ``[link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload2 basic_endpoint]``(
90644       const char * path_name);
90645   ``  [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload2 more...]]``
90646
90647   ``[link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload3 basic_endpoint]``(
90648       const std::string & path_name);
90649   ``  [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload3 more...]]``
90650
90651
90652 Copy constructor. 
90653
90654
90655   ``[link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload4 basic_endpoint]``(
90656       const basic_endpoint & other);
90657   ``  [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload4 more...]]``
90658
90659
90660 [section:overload1 local::basic_endpoint::basic_endpoint (1 of 4 overloads)]
90661
90662
90663 Default constructor. 
90664
90665
90666   basic_endpoint();
90667
90668
90669
90670 [endsect]
90671
90672
90673
90674 [section:overload2 local::basic_endpoint::basic_endpoint (2 of 4 overloads)]
90675
90676
90677 Construct an endpoint using the specified path name. 
90678
90679
90680   basic_endpoint(
90681       const char * path_name);
90682
90683
90684
90685 [endsect]
90686
90687
90688
90689 [section:overload3 local::basic_endpoint::basic_endpoint (3 of 4 overloads)]
90690
90691
90692 Construct an endpoint using the specified path name. 
90693
90694
90695   basic_endpoint(
90696       const std::string & path_name);
90697
90698
90699
90700 [endsect]
90701
90702
90703
90704 [section:overload4 local::basic_endpoint::basic_endpoint (4 of 4 overloads)]
90705
90706
90707 Copy constructor. 
90708
90709
90710   basic_endpoint(
90711       const basic_endpoint & other);
90712
90713
90714
90715 [endsect]
90716
90717
90718 [endsect]
90719
90720
90721 [section:capacity local::basic_endpoint::capacity]
90722
90723 [indexterm2 boost_asio.indexterm.local__basic_endpoint.capacity..capacity..local::basic_endpoint] 
90724 Get the capacity of the endpoint in the native type. 
90725
90726
90727   std::size_t capacity() const;
90728
90729
90730
90731 [endsect]
90732
90733
90734 [section:data local::basic_endpoint::data]
90735
90736 [indexterm2 boost_asio.indexterm.local__basic_endpoint.data..data..local::basic_endpoint] 
90737 Get the underlying endpoint in the native type. 
90738
90739
90740   data_type * ``[link boost_asio.reference.local__basic_endpoint.data.overload1 data]``();
90741   ``  [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.data.overload1 more...]]``
90742
90743   const data_type * ``[link boost_asio.reference.local__basic_endpoint.data.overload2 data]``() const;
90744   ``  [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.data.overload2 more...]]``
90745
90746
90747 [section:overload1 local::basic_endpoint::data (1 of 2 overloads)]
90748
90749
90750 Get the underlying endpoint in the native type. 
90751
90752
90753   data_type * data();
90754
90755
90756
90757 [endsect]
90758
90759
90760
90761 [section:overload2 local::basic_endpoint::data (2 of 2 overloads)]
90762
90763
90764 Get the underlying endpoint in the native type. 
90765
90766
90767   const data_type * data() const;
90768
90769
90770
90771 [endsect]
90772
90773
90774 [endsect]
90775
90776
90777 [section:data_type local::basic_endpoint::data_type]
90778
90779 [indexterm2 boost_asio.indexterm.local__basic_endpoint.data_type..data_type..local::basic_endpoint] 
90780 The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. 
90781
90782
90783   typedef implementation_defined data_type;
90784
90785
90786
90787 [heading Requirements]
90788
90789 ['Header: ][^boost/asio/local/basic_endpoint.hpp]
90790
90791 ['Convenience header: ][^boost/asio.hpp]
90792
90793
90794 [endsect]
90795
90796
90797
90798 [section:operator_not__eq_ local::basic_endpoint::operator!=]
90799
90800 [indexterm2 boost_asio.indexterm.local__basic_endpoint.operator_not__eq_..operator!=..local::basic_endpoint] 
90801 Compare two endpoints for inequality. 
90802
90803
90804   friend bool operator!=(
90805       const basic_endpoint< Protocol > & e1,
90806       const basic_endpoint< Protocol > & e2);
90807
90808
90809 [heading Requirements]
90810
90811 ['Header: ][^boost/asio/local/basic_endpoint.hpp]
90812
90813 ['Convenience header: ][^boost/asio.hpp]
90814
90815
90816 [endsect]
90817
90818
90819
90820 [section:operator_lt_ local::basic_endpoint::operator<]
90821
90822 [indexterm2 boost_asio.indexterm.local__basic_endpoint.operator_lt_..operator<..local::basic_endpoint] 
90823 Compare endpoints for ordering. 
90824
90825
90826   friend bool operator<(
90827       const basic_endpoint< Protocol > & e1,
90828       const basic_endpoint< Protocol > & e2);
90829
90830
90831 [heading Requirements]
90832
90833 ['Header: ][^boost/asio/local/basic_endpoint.hpp]
90834
90835 ['Convenience header: ][^boost/asio.hpp]
90836
90837
90838 [endsect]
90839
90840
90841
90842 [section:operator_lt__lt_ local::basic_endpoint::operator<<]
90843
90844 [indexterm2 boost_asio.indexterm.local__basic_endpoint.operator_lt__lt_..operator<<..local::basic_endpoint] 
90845 Output an endpoint as a string. 
90846
90847
90848   std::basic_ostream< Elem, Traits > & operator<<(
90849       std::basic_ostream< Elem, Traits > & os,
90850       const basic_endpoint< Protocol > & endpoint);
90851
90852
90853 Used to output a human-readable string for a specified endpoint.
90854
90855
90856 [heading Parameters]
90857     
90858
90859 [variablelist
90860   
90861 [[os][The output stream to which the string will be written.]]
90862
90863 [[endpoint][The endpoint to be written.]]
90864
90865 ]
90866
90867
90868 [heading Return Value]
90869       
90870 The output stream. 
90871
90872
90873
90874
90875 [endsect]
90876
90877
90878
90879 [section:operator_lt__eq_ local::basic_endpoint::operator<=]
90880
90881 [indexterm2 boost_asio.indexterm.local__basic_endpoint.operator_lt__eq_..operator<=..local::basic_endpoint] 
90882 Compare endpoints for ordering. 
90883
90884
90885   friend bool operator<=(
90886       const basic_endpoint< Protocol > & e1,
90887       const basic_endpoint< Protocol > & e2);
90888
90889
90890 [heading Requirements]
90891
90892 ['Header: ][^boost/asio/local/basic_endpoint.hpp]
90893
90894 ['Convenience header: ][^boost/asio.hpp]
90895
90896
90897 [endsect]
90898
90899
90900
90901 [section:operator_eq_ local::basic_endpoint::operator=]
90902
90903 [indexterm2 boost_asio.indexterm.local__basic_endpoint.operator_eq_..operator=..local::basic_endpoint] 
90904 Assign from another endpoint. 
90905
90906
90907   basic_endpoint & operator=(
90908       const basic_endpoint & other);
90909
90910
90911
90912 [endsect]
90913
90914
90915
90916 [section:operator_eq__eq_ local::basic_endpoint::operator==]
90917
90918 [indexterm2 boost_asio.indexterm.local__basic_endpoint.operator_eq__eq_..operator==..local::basic_endpoint] 
90919 Compare two endpoints for equality. 
90920
90921
90922   friend bool operator==(
90923       const basic_endpoint< Protocol > & e1,
90924       const basic_endpoint< Protocol > & e2);
90925
90926
90927 [heading Requirements]
90928
90929 ['Header: ][^boost/asio/local/basic_endpoint.hpp]
90930
90931 ['Convenience header: ][^boost/asio.hpp]
90932
90933
90934 [endsect]
90935
90936
90937
90938 [section:operator_gt_ local::basic_endpoint::operator>]
90939
90940 [indexterm2 boost_asio.indexterm.local__basic_endpoint.operator_gt_..operator>..local::basic_endpoint] 
90941 Compare endpoints for ordering. 
90942
90943
90944   friend bool operator>(
90945       const basic_endpoint< Protocol > & e1,
90946       const basic_endpoint< Protocol > & e2);
90947
90948
90949 [heading Requirements]
90950
90951 ['Header: ][^boost/asio/local/basic_endpoint.hpp]
90952
90953 ['Convenience header: ][^boost/asio.hpp]
90954
90955
90956 [endsect]
90957
90958
90959
90960 [section:operator_gt__eq_ local::basic_endpoint::operator>=]
90961
90962 [indexterm2 boost_asio.indexterm.local__basic_endpoint.operator_gt__eq_..operator>=..local::basic_endpoint] 
90963 Compare endpoints for ordering. 
90964
90965
90966   friend bool operator>=(
90967       const basic_endpoint< Protocol > & e1,
90968       const basic_endpoint< Protocol > & e2);
90969
90970
90971 [heading Requirements]
90972
90973 ['Header: ][^boost/asio/local/basic_endpoint.hpp]
90974
90975 ['Convenience header: ][^boost/asio.hpp]
90976
90977
90978 [endsect]
90979
90980
90981 [section:path local::basic_endpoint::path]
90982
90983 [indexterm2 boost_asio.indexterm.local__basic_endpoint.path..path..local::basic_endpoint] 
90984 Get the path associated with the endpoint. 
90985
90986
90987   std::string ``[link boost_asio.reference.local__basic_endpoint.path.overload1 path]``() const;
90988   ``  [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.path.overload1 more...]]``
90989
90990
90991 Set the path associated with the endpoint. 
90992
90993
90994   void ``[link boost_asio.reference.local__basic_endpoint.path.overload2 path]``(
90995       const char * p);
90996   ``  [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.path.overload2 more...]]``
90997
90998   void ``[link boost_asio.reference.local__basic_endpoint.path.overload3 path]``(
90999       const std::string & p);
91000   ``  [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.path.overload3 more...]]``
91001
91002
91003 [section:overload1 local::basic_endpoint::path (1 of 3 overloads)]
91004
91005
91006 Get the path associated with the endpoint. 
91007
91008
91009   std::string path() const;
91010
91011
91012
91013 [endsect]
91014
91015
91016
91017 [section:overload2 local::basic_endpoint::path (2 of 3 overloads)]
91018
91019
91020 Set the path associated with the endpoint. 
91021
91022
91023   void path(
91024       const char * p);
91025
91026
91027
91028 [endsect]
91029
91030
91031
91032 [section:overload3 local::basic_endpoint::path (3 of 3 overloads)]
91033
91034
91035 Set the path associated with the endpoint. 
91036
91037
91038   void path(
91039       const std::string & p);
91040
91041
91042
91043 [endsect]
91044
91045
91046 [endsect]
91047
91048
91049 [section:protocol local::basic_endpoint::protocol]
91050
91051 [indexterm2 boost_asio.indexterm.local__basic_endpoint.protocol..protocol..local::basic_endpoint] 
91052 The protocol associated with the endpoint. 
91053
91054
91055   protocol_type protocol() const;
91056
91057
91058
91059 [endsect]
91060
91061
91062
91063 [section:protocol_type local::basic_endpoint::protocol_type]
91064
91065 [indexterm2 boost_asio.indexterm.local__basic_endpoint.protocol_type..protocol_type..local::basic_endpoint] 
91066 The protocol type associated with the endpoint. 
91067
91068
91069   typedef Protocol protocol_type;
91070
91071
91072
91073 [heading Requirements]
91074
91075 ['Header: ][^boost/asio/local/basic_endpoint.hpp]
91076
91077 ['Convenience header: ][^boost/asio.hpp]
91078
91079
91080 [endsect]
91081
91082
91083
91084 [section:resize local::basic_endpoint::resize]
91085
91086 [indexterm2 boost_asio.indexterm.local__basic_endpoint.resize..resize..local::basic_endpoint] 
91087 Set the underlying size of the endpoint in the native type. 
91088
91089
91090   void resize(
91091       std::size_t new_size);
91092
91093
91094
91095 [endsect]
91096
91097
91098
91099 [section:size local::basic_endpoint::size]
91100
91101 [indexterm2 boost_asio.indexterm.local__basic_endpoint.size..size..local::basic_endpoint] 
91102 Get the underlying size of the endpoint in the native type. 
91103
91104
91105   std::size_t size() const;
91106
91107
91108
91109 [endsect]
91110
91111
91112
91113 [endsect]
91114
91115 [section:local__connect_pair local::connect_pair]
91116
91117 [indexterm1 boost_asio.indexterm.local__connect_pair..local::connect_pair] 
91118 Create a pair of connected sockets. 
91119
91120   template<
91121       typename ``[link boost_asio.reference.Protocol Protocol]``,
91122       typename ``[link boost_asio.reference.Executor1 Executor1]``,
91123       typename ``[link boost_asio.reference.Executor1 Executor2]``>
91124   void ``[link boost_asio.reference.local__connect_pair.overload1 connect_pair]``(
91125       basic_socket< Protocol, Executor1 > & socket1,
91126       basic_socket< Protocol, Executor2 > & socket2);
91127   ``  [''''&raquo;''' [link boost_asio.reference.local__connect_pair.overload1 more...]]``
91128
91129   template<
91130       typename ``[link boost_asio.reference.Protocol Protocol]``,
91131       typename ``[link boost_asio.reference.Executor1 Executor1]``,
91132       typename ``[link boost_asio.reference.Executor1 Executor2]``>
91133   void ``[link boost_asio.reference.local__connect_pair.overload2 connect_pair]``(
91134       basic_socket< Protocol, Executor1 > & socket1,
91135       basic_socket< Protocol, Executor2 > & socket2,
91136       boost::system::error_code & ec);
91137   ``  [''''&raquo;''' [link boost_asio.reference.local__connect_pair.overload2 more...]]``
91138
91139 [heading Requirements]
91140
91141 ['Header: ][^boost/asio/local/connect_pair.hpp]
91142
91143 ['Convenience header: ][^boost/asio.hpp]
91144
91145
91146 [section:overload1 local::connect_pair (1 of 2 overloads)]
91147
91148
91149 Create a pair of connected sockets. 
91150
91151
91152   template<
91153       typename ``[link boost_asio.reference.Protocol Protocol]``,
91154       typename ``[link boost_asio.reference.Executor1 Executor1]``,
91155       typename ``[link boost_asio.reference.Executor1 Executor2]``>
91156   void connect_pair(
91157       basic_socket< Protocol, Executor1 > & socket1,
91158       basic_socket< Protocol, Executor2 > & socket2);
91159
91160
91161
91162 [endsect]
91163
91164
91165
91166 [section:overload2 local::connect_pair (2 of 2 overloads)]
91167
91168
91169 Create a pair of connected sockets. 
91170
91171
91172   template<
91173       typename ``[link boost_asio.reference.Protocol Protocol]``,
91174       typename ``[link boost_asio.reference.Executor1 Executor1]``,
91175       typename ``[link boost_asio.reference.Executor1 Executor2]``>
91176   void connect_pair(
91177       basic_socket< Protocol, Executor1 > & socket1,
91178       basic_socket< Protocol, Executor2 > & socket2,
91179       boost::system::error_code & ec);
91180
91181
91182
91183 [endsect]
91184
91185
91186 [endsect]
91187
91188 [section:local__datagram_protocol local::datagram_protocol]
91189
91190
91191 Encapsulates the flags needed for datagram-oriented UNIX sockets. 
91192
91193
91194   class datagram_protocol
91195
91196
91197 [heading Types]
91198 [table
91199   [[Name][Description]]
91200
91201   [
91202
91203     [[link boost_asio.reference.local__datagram_protocol.endpoint [*endpoint]]]
91204     [The type of a UNIX domain endpoint. ]
91205   
91206   ]
91207
91208   [
91209
91210     [[link boost_asio.reference.local__datagram_protocol.socket [*socket]]]
91211     [The UNIX domain socket type. ]
91212   
91213   ]
91214
91215 ]
91216
91217 [heading Member Functions]
91218 [table
91219   [[Name][Description]]
91220
91221   [
91222     [[link boost_asio.reference.local__datagram_protocol.family [*family]]]
91223     [Obtain an identifier for the protocol family. ]
91224   ]
91225   
91226   [
91227     [[link boost_asio.reference.local__datagram_protocol.protocol [*protocol]]]
91228     [Obtain an identifier for the protocol. ]
91229   ]
91230   
91231   [
91232     [[link boost_asio.reference.local__datagram_protocol.type [*type]]]
91233     [Obtain an identifier for the type of the protocol. ]
91234   ]
91235   
91236 ]
91237
91238 The [link boost_asio.reference.local__datagram_protocol `local::datagram_protocol`] class contains flags necessary for datagram-oriented UNIX domain sockets.
91239
91240
91241 [heading Thread Safety]
91242   
91243 ['Distinct] ['objects:] Safe.
91244
91245 ['Shared] ['objects:] Safe.
91246
91247
91248
91249
91250 [heading Requirements]
91251
91252 ['Header: ][^boost/asio/local/datagram_protocol.hpp]
91253
91254 ['Convenience header: ][^boost/asio.hpp]
91255
91256
91257 [section:endpoint local::datagram_protocol::endpoint]
91258
91259 [indexterm2 boost_asio.indexterm.local__datagram_protocol.endpoint..endpoint..local::datagram_protocol] 
91260 The type of a UNIX domain endpoint. 
91261
91262
91263   typedef basic_endpoint< datagram_protocol > endpoint;
91264
91265
91266 [heading Types]
91267 [table
91268   [[Name][Description]]
91269
91270   [
91271
91272     [[link boost_asio.reference.local__basic_endpoint.data_type [*data_type]]]
91273     [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
91274   
91275   ]
91276
91277   [
91278
91279     [[link boost_asio.reference.local__basic_endpoint.protocol_type [*protocol_type]]]
91280     [The protocol type associated with the endpoint. ]
91281   
91282   ]
91283
91284 ]
91285
91286 [heading Member Functions]
91287 [table
91288   [[Name][Description]]
91289
91290   [
91291     [[link boost_asio.reference.local__basic_endpoint.basic_endpoint [*basic_endpoint]]]
91292     [Default constructor. 
91293      [hr]
91294      Construct an endpoint using the specified path name. 
91295      [hr]
91296      Copy constructor. ]
91297   ]
91298   
91299   [
91300     [[link boost_asio.reference.local__basic_endpoint.capacity [*capacity]]]
91301     [Get the capacity of the endpoint in the native type. ]
91302   ]
91303   
91304   [
91305     [[link boost_asio.reference.local__basic_endpoint.data [*data]]]
91306     [Get the underlying endpoint in the native type. ]
91307   ]
91308   
91309   [
91310     [[link boost_asio.reference.local__basic_endpoint.operator_eq_ [*operator=]]]
91311     [Assign from another endpoint. ]
91312   ]
91313   
91314   [
91315     [[link boost_asio.reference.local__basic_endpoint.path [*path]]]
91316     [Get the path associated with the endpoint. 
91317      [hr]
91318      Set the path associated with the endpoint. ]
91319   ]
91320   
91321   [
91322     [[link boost_asio.reference.local__basic_endpoint.protocol [*protocol]]]
91323     [The protocol associated with the endpoint. ]
91324   ]
91325   
91326   [
91327     [[link boost_asio.reference.local__basic_endpoint.resize [*resize]]]
91328     [Set the underlying size of the endpoint in the native type. ]
91329   ]
91330   
91331   [
91332     [[link boost_asio.reference.local__basic_endpoint.size [*size]]]
91333     [Get the underlying size of the endpoint in the native type. ]
91334   ]
91335   
91336 ]
91337
91338 [heading Friends]
91339 [table
91340   [[Name][Description]]
91341
91342   [
91343     [[link boost_asio.reference.local__basic_endpoint.operator_not__eq_ [*operator!=]]]
91344     [Compare two endpoints for inequality. ]
91345   ]
91346   
91347   [
91348     [[link boost_asio.reference.local__basic_endpoint.operator_lt_ [*operator<]]]
91349     [Compare endpoints for ordering. ]
91350   ]
91351   
91352   [
91353     [[link boost_asio.reference.local__basic_endpoint.operator_lt__eq_ [*operator<=]]]
91354     [Compare endpoints for ordering. ]
91355   ]
91356   
91357   [
91358     [[link boost_asio.reference.local__basic_endpoint.operator_eq__eq_ [*operator==]]]
91359     [Compare two endpoints for equality. ]
91360   ]
91361   
91362   [
91363     [[link boost_asio.reference.local__basic_endpoint.operator_gt_ [*operator>]]]
91364     [Compare endpoints for ordering. ]
91365   ]
91366   
91367   [
91368     [[link boost_asio.reference.local__basic_endpoint.operator_gt__eq_ [*operator>=]]]
91369     [Compare endpoints for ordering. ]
91370   ]
91371   
91372 ]
91373
91374 [heading Related Functions]
91375 [table
91376   [[Name][Description]]
91377
91378   [
91379     [[link boost_asio.reference.local__basic_endpoint.operator_lt__lt_ [*operator<<]]]
91380     [Output an endpoint as a string. ]
91381   ]
91382   
91383 ]
91384
91385 The [link boost_asio.reference.local__basic_endpoint `local::basic_endpoint`] class template describes an endpoint that may be associated with a particular UNIX socket.
91386
91387
91388 [heading Thread Safety]
91389   
91390 ['Distinct] ['objects:] Safe.
91391
91392 ['Shared] ['objects:] Unsafe.
91393
91394
91395
91396
91397
91398 [heading Requirements]
91399
91400 ['Header: ][^boost/asio/local/datagram_protocol.hpp]
91401
91402 ['Convenience header: ][^boost/asio.hpp]
91403
91404
91405 [endsect]
91406
91407
91408
91409 [section:family local::datagram_protocol::family]
91410
91411 [indexterm2 boost_asio.indexterm.local__datagram_protocol.family..family..local::datagram_protocol] 
91412 Obtain an identifier for the protocol family. 
91413
91414
91415   int family() const;
91416
91417
91418
91419 [endsect]
91420
91421
91422
91423 [section:protocol local::datagram_protocol::protocol]
91424
91425 [indexterm2 boost_asio.indexterm.local__datagram_protocol.protocol..protocol..local::datagram_protocol] 
91426 Obtain an identifier for the protocol. 
91427
91428
91429   int protocol() const;
91430
91431
91432
91433 [endsect]
91434
91435
91436
91437 [section:socket local::datagram_protocol::socket]
91438
91439 [indexterm2 boost_asio.indexterm.local__datagram_protocol.socket..socket..local::datagram_protocol] 
91440 The UNIX domain socket type. 
91441
91442
91443   typedef basic_datagram_socket< datagram_protocol > socket;
91444
91445
91446 [heading Types]
91447 [table
91448   [[Name][Description]]
91449
91450   [
91451
91452     [[link boost_asio.reference.basic_datagram_socket__rebind_executor [*rebind_executor]]]
91453     [Rebinds the socket type to another executor. ]
91454   
91455   ]
91456
91457   [
91458
91459     [[link boost_asio.reference.basic_datagram_socket.broadcast [*broadcast]]]
91460     [Socket option to permit sending of broadcast messages. ]
91461   
91462   ]
91463
91464   [
91465
91466     [[link boost_asio.reference.basic_datagram_socket.bytes_readable [*bytes_readable]]]
91467     [IO control command to get the amount of data that can be read without blocking. ]
91468   
91469   ]
91470
91471   [
91472
91473     [[link boost_asio.reference.basic_datagram_socket.debug [*debug]]]
91474     [Socket option to enable socket-level debugging. ]
91475   
91476   ]
91477
91478   [
91479
91480     [[link boost_asio.reference.basic_datagram_socket.do_not_route [*do_not_route]]]
91481     [Socket option to prevent routing, use local interfaces only. ]
91482   
91483   ]
91484
91485   [
91486
91487     [[link boost_asio.reference.basic_datagram_socket.enable_connection_aborted [*enable_connection_aborted]]]
91488     [Socket option to report aborted connections on accept. ]
91489   
91490   ]
91491
91492   [
91493
91494     [[link boost_asio.reference.basic_datagram_socket.endpoint_type [*endpoint_type]]]
91495     [The endpoint type. ]
91496   
91497   ]
91498
91499   [
91500
91501     [[link boost_asio.reference.basic_datagram_socket.executor_type [*executor_type]]]
91502     [The type of the executor associated with the object. ]
91503   
91504   ]
91505
91506   [
91507
91508     [[link boost_asio.reference.basic_datagram_socket.keep_alive [*keep_alive]]]
91509     [Socket option to send keep-alives. ]
91510   
91511   ]
91512
91513   [
91514
91515     [[link boost_asio.reference.basic_datagram_socket.linger [*linger]]]
91516     [Socket option to specify whether the socket lingers on close if unsent data is present. ]
91517   
91518   ]
91519
91520   [
91521
91522     [[link boost_asio.reference.basic_datagram_socket.lowest_layer_type [*lowest_layer_type]]]
91523     [A basic_socket is always the lowest layer. ]
91524   
91525   ]
91526
91527   [
91528
91529     [[link boost_asio.reference.basic_datagram_socket.message_flags [*message_flags]]]
91530     [Bitmask type for flags that can be passed to send and receive operations. ]
91531   
91532   ]
91533
91534   [
91535
91536     [[link boost_asio.reference.basic_datagram_socket.native_handle_type [*native_handle_type]]]
91537     [The native representation of a socket. ]
91538   
91539   ]
91540
91541   [
91542
91543     [[link boost_asio.reference.basic_datagram_socket.out_of_band_inline [*out_of_band_inline]]]
91544     [Socket option for putting received out-of-band data inline. ]
91545   
91546   ]
91547
91548   [
91549
91550     [[link boost_asio.reference.basic_datagram_socket.protocol_type [*protocol_type]]]
91551     [The protocol type. ]
91552   
91553   ]
91554
91555   [
91556
91557     [[link boost_asio.reference.basic_datagram_socket.receive_buffer_size [*receive_buffer_size]]]
91558     [Socket option for the receive buffer size of a socket. ]
91559   
91560   ]
91561
91562   [
91563
91564     [[link boost_asio.reference.basic_datagram_socket.receive_low_watermark [*receive_low_watermark]]]
91565     [Socket option for the receive low watermark. ]
91566   
91567   ]
91568
91569   [
91570
91571     [[link boost_asio.reference.basic_datagram_socket.reuse_address [*reuse_address]]]
91572     [Socket option to allow the socket to be bound to an address that is already in use. ]
91573   
91574   ]
91575
91576   [
91577
91578     [[link boost_asio.reference.basic_datagram_socket.send_buffer_size [*send_buffer_size]]]
91579     [Socket option for the send buffer size of a socket. ]
91580   
91581   ]
91582
91583   [
91584
91585     [[link boost_asio.reference.basic_datagram_socket.send_low_watermark [*send_low_watermark]]]
91586     [Socket option for the send low watermark. ]
91587   
91588   ]
91589
91590   [
91591
91592     [[link boost_asio.reference.basic_datagram_socket.shutdown_type [*shutdown_type]]]
91593     [Different ways a socket may be shutdown. ]
91594   
91595   ]
91596
91597   [
91598
91599     [[link boost_asio.reference.basic_datagram_socket.wait_type [*wait_type]]]
91600     [Wait types. ]
91601   
91602   ]
91603
91604 ]
91605
91606 [heading Member Functions]
91607 [table
91608   [[Name][Description]]
91609
91610   [
91611     [[link boost_asio.reference.basic_datagram_socket.assign [*assign]]]
91612     [Assign an existing native socket to the socket. ]
91613   ]
91614   
91615   [
91616     [[link boost_asio.reference.basic_datagram_socket.async_connect [*async_connect]]]
91617     [Start an asynchronous connect. ]
91618   ]
91619   
91620   [
91621     [[link boost_asio.reference.basic_datagram_socket.async_receive [*async_receive]]]
91622     [Start an asynchronous receive on a connected socket. ]
91623   ]
91624   
91625   [
91626     [[link boost_asio.reference.basic_datagram_socket.async_receive_from [*async_receive_from]]]
91627     [Start an asynchronous receive. ]
91628   ]
91629   
91630   [
91631     [[link boost_asio.reference.basic_datagram_socket.async_send [*async_send]]]
91632     [Start an asynchronous send on a connected socket. ]
91633   ]
91634   
91635   [
91636     [[link boost_asio.reference.basic_datagram_socket.async_send_to [*async_send_to]]]
91637     [Start an asynchronous send. ]
91638   ]
91639   
91640   [
91641     [[link boost_asio.reference.basic_datagram_socket.async_wait [*async_wait]]]
91642     [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
91643   ]
91644   
91645   [
91646     [[link boost_asio.reference.basic_datagram_socket.at_mark [*at_mark]]]
91647     [Determine whether the socket is at the out-of-band data mark. ]
91648   ]
91649   
91650   [
91651     [[link boost_asio.reference.basic_datagram_socket.available [*available]]]
91652     [Determine the number of bytes available for reading. ]
91653   ]
91654   
91655   [
91656     [[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket [*basic_datagram_socket]]]
91657     [Construct a basic_datagram_socket without opening it. 
91658      [hr]
91659      Construct and open a basic_datagram_socket. 
91660      [hr]
91661      Construct a basic_datagram_socket, opening it and binding it to the given local endpoint. 
91662      [hr]
91663      Construct a basic_datagram_socket on an existing native socket. 
91664      [hr]
91665      Move-construct a basic_datagram_socket from another. 
91666      [hr]
91667      Move-construct a basic_datagram_socket from a socket of another protocol type. ]
91668   ]
91669   
91670   [
91671     [[link boost_asio.reference.basic_datagram_socket.bind [*bind]]]
91672     [Bind the socket to the given local endpoint. ]
91673   ]
91674   
91675   [
91676     [[link boost_asio.reference.basic_datagram_socket.cancel [*cancel]]]
91677     [Cancel all asynchronous operations associated with the socket. ]
91678   ]
91679   
91680   [
91681     [[link boost_asio.reference.basic_datagram_socket.close [*close]]]
91682     [Close the socket. ]
91683   ]
91684   
91685   [
91686     [[link boost_asio.reference.basic_datagram_socket.connect [*connect]]]
91687     [Connect the socket to the specified endpoint. ]
91688   ]
91689   
91690   [
91691     [[link boost_asio.reference.basic_datagram_socket.get_executor [*get_executor]]]
91692     [Get the executor associated with the object. ]
91693   ]
91694   
91695   [
91696     [[link boost_asio.reference.basic_datagram_socket.get_option [*get_option]]]
91697     [Get an option from the socket. ]
91698   ]
91699   
91700   [
91701     [[link boost_asio.reference.basic_datagram_socket.io_control [*io_control]]]
91702     [Perform an IO control command on the socket. ]
91703   ]
91704   
91705   [
91706     [[link boost_asio.reference.basic_datagram_socket.is_open [*is_open]]]
91707     [Determine whether the socket is open. ]
91708   ]
91709   
91710   [
91711     [[link boost_asio.reference.basic_datagram_socket.local_endpoint [*local_endpoint]]]
91712     [Get the local endpoint of the socket. ]
91713   ]
91714   
91715   [
91716     [[link boost_asio.reference.basic_datagram_socket.lowest_layer [*lowest_layer]]]
91717     [Get a reference to the lowest layer. 
91718      [hr]
91719      Get a const reference to the lowest layer. ]
91720   ]
91721   
91722   [
91723     [[link boost_asio.reference.basic_datagram_socket.native_handle [*native_handle]]]
91724     [Get the native socket representation. ]
91725   ]
91726   
91727   [
91728     [[link boost_asio.reference.basic_datagram_socket.native_non_blocking [*native_non_blocking]]]
91729     [Gets the non-blocking mode of the native socket implementation. 
91730      [hr]
91731      Sets the non-blocking mode of the native socket implementation. ]
91732   ]
91733   
91734   [
91735     [[link boost_asio.reference.basic_datagram_socket.non_blocking [*non_blocking]]]
91736     [Gets the non-blocking mode of the socket. 
91737      [hr]
91738      Sets the non-blocking mode of the socket. ]
91739   ]
91740   
91741   [
91742     [[link boost_asio.reference.basic_datagram_socket.open [*open]]]
91743     [Open the socket using the specified protocol. ]
91744   ]
91745   
91746   [
91747     [[link boost_asio.reference.basic_datagram_socket.operator_eq_ [*operator=]]]
91748     [Move-assign a basic_datagram_socket from another. 
91749      [hr]
91750      Move-assign a basic_datagram_socket from a socket of another protocol type. ]
91751   ]
91752   
91753   [
91754     [[link boost_asio.reference.basic_datagram_socket.receive [*receive]]]
91755     [Receive some data on a connected socket. ]
91756   ]
91757   
91758   [
91759     [[link boost_asio.reference.basic_datagram_socket.receive_from [*receive_from]]]
91760     [Receive a datagram with the endpoint of the sender. ]
91761   ]
91762   
91763   [
91764     [[link boost_asio.reference.basic_datagram_socket.release [*release]]]
91765     [Release ownership of the underlying native socket. ]
91766   ]
91767   
91768   [
91769     [[link boost_asio.reference.basic_datagram_socket.remote_endpoint [*remote_endpoint]]]
91770     [Get the remote endpoint of the socket. ]
91771   ]
91772   
91773   [
91774     [[link boost_asio.reference.basic_datagram_socket.send [*send]]]
91775     [Send some data on a connected socket. ]
91776   ]
91777   
91778   [
91779     [[link boost_asio.reference.basic_datagram_socket.send_to [*send_to]]]
91780     [Send a datagram to the specified endpoint. ]
91781   ]
91782   
91783   [
91784     [[link boost_asio.reference.basic_datagram_socket.set_option [*set_option]]]
91785     [Set an option on the socket. ]
91786   ]
91787   
91788   [
91789     [[link boost_asio.reference.basic_datagram_socket.shutdown [*shutdown]]]
91790     [Disable sends or receives on the socket. ]
91791   ]
91792   
91793   [
91794     [[link boost_asio.reference.basic_datagram_socket.wait [*wait]]]
91795     [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
91796   ]
91797   
91798   [
91799     [[link boost_asio.reference.basic_datagram_socket._basic_datagram_socket [*~basic_datagram_socket]]]
91800     [Destroys the socket. ]
91801   ]
91802   
91803 ]
91804
91805 [heading Data Members]
91806 [table
91807   [[Name][Description]]
91808
91809   [
91810     [[link boost_asio.reference.basic_datagram_socket.max_connections [*max_connections]]]
91811     [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
91812   ]
91813
91814   [
91815     [[link boost_asio.reference.basic_datagram_socket.max_listen_connections [*max_listen_connections]]]
91816     [The maximum length of the queue of pending incoming connections. ]
91817   ]
91818
91819   [
91820     [[link boost_asio.reference.basic_datagram_socket.message_do_not_route [*message_do_not_route]]]
91821     [Specify that the data should not be subject to routing. ]
91822   ]
91823
91824   [
91825     [[link boost_asio.reference.basic_datagram_socket.message_end_of_record [*message_end_of_record]]]
91826     [Specifies that the data marks the end of a record. ]
91827   ]
91828
91829   [
91830     [[link boost_asio.reference.basic_datagram_socket.message_out_of_band [*message_out_of_band]]]
91831     [Process out-of-band data. ]
91832   ]
91833
91834   [
91835     [[link boost_asio.reference.basic_datagram_socket.message_peek [*message_peek]]]
91836     [Peek at incoming data without removing it from the input queue. ]
91837   ]
91838
91839 ]
91840
91841 [heading Protected Data Members]
91842 [table
91843   [[Name][Description]]
91844
91845   [
91846     [[link boost_asio.reference.basic_datagram_socket.impl_ [*impl_]]]
91847     []
91848   ]
91849
91850 ]
91851
91852 The [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] class template provides asynchronous and blocking datagram-oriented socket functionality.
91853
91854
91855 [heading Thread Safety]
91856   
91857 ['Distinct] ['objects:] Safe.
91858
91859 ['Shared] ['objects:] Unsafe. 
91860
91861
91862
91863
91864 [heading Requirements]
91865
91866 ['Header: ][^boost/asio/local/datagram_protocol.hpp]
91867
91868 ['Convenience header: ][^boost/asio.hpp]
91869
91870
91871 [endsect]
91872
91873
91874
91875 [section:type local::datagram_protocol::type]
91876
91877 [indexterm2 boost_asio.indexterm.local__datagram_protocol.type..type..local::datagram_protocol] 
91878 Obtain an identifier for the type of the protocol. 
91879
91880
91881   int type() const;
91882
91883
91884
91885 [endsect]
91886
91887
91888
91889 [endsect]
91890
91891 [section:local__stream_protocol local::stream_protocol]
91892
91893
91894 Encapsulates the flags needed for stream-oriented UNIX sockets. 
91895
91896
91897   class stream_protocol
91898
91899
91900 [heading Types]
91901 [table
91902   [[Name][Description]]
91903
91904   [
91905
91906     [[link boost_asio.reference.local__stream_protocol.acceptor [*acceptor]]]
91907     [The UNIX domain acceptor type. ]
91908   
91909   ]
91910
91911   [
91912
91913     [[link boost_asio.reference.local__stream_protocol.endpoint [*endpoint]]]
91914     [The type of a UNIX domain endpoint. ]
91915   
91916   ]
91917
91918   [
91919
91920     [[link boost_asio.reference.local__stream_protocol.iostream [*iostream]]]
91921     [The UNIX domain iostream type. ]
91922   
91923   ]
91924
91925   [
91926
91927     [[link boost_asio.reference.local__stream_protocol.socket [*socket]]]
91928     [The UNIX domain socket type. ]
91929   
91930   ]
91931
91932 ]
91933
91934 [heading Member Functions]
91935 [table
91936   [[Name][Description]]
91937
91938   [
91939     [[link boost_asio.reference.local__stream_protocol.family [*family]]]
91940     [Obtain an identifier for the protocol family. ]
91941   ]
91942   
91943   [
91944     [[link boost_asio.reference.local__stream_protocol.protocol [*protocol]]]
91945     [Obtain an identifier for the protocol. ]
91946   ]
91947   
91948   [
91949     [[link boost_asio.reference.local__stream_protocol.type [*type]]]
91950     [Obtain an identifier for the type of the protocol. ]
91951   ]
91952   
91953 ]
91954
91955 The [link boost_asio.reference.local__stream_protocol `local::stream_protocol`] class contains flags necessary for stream-oriented UNIX domain sockets.
91956
91957
91958 [heading Thread Safety]
91959   
91960 ['Distinct] ['objects:] Safe.
91961
91962 ['Shared] ['objects:] Safe.
91963
91964
91965
91966
91967 [heading Requirements]
91968
91969 ['Header: ][^boost/asio/local/stream_protocol.hpp]
91970
91971 ['Convenience header: ][^boost/asio.hpp]
91972
91973
91974 [section:acceptor local::stream_protocol::acceptor]
91975
91976 [indexterm2 boost_asio.indexterm.local__stream_protocol.acceptor..acceptor..local::stream_protocol] 
91977 The UNIX domain acceptor type. 
91978
91979
91980   typedef basic_socket_acceptor< stream_protocol > acceptor;
91981
91982
91983 [heading Types]
91984 [table
91985   [[Name][Description]]
91986
91987   [
91988
91989     [[link boost_asio.reference.basic_socket_acceptor__rebind_executor [*rebind_executor]]]
91990     [Rebinds the acceptor type to another executor. ]
91991   
91992   ]
91993
91994   [
91995
91996     [[link boost_asio.reference.basic_socket_acceptor.broadcast [*broadcast]]]
91997     [Socket option to permit sending of broadcast messages. ]
91998   
91999   ]
92000
92001   [
92002
92003     [[link boost_asio.reference.basic_socket_acceptor.bytes_readable [*bytes_readable]]]
92004     [IO control command to get the amount of data that can be read without blocking. ]
92005   
92006   ]
92007
92008   [
92009
92010     [[link boost_asio.reference.basic_socket_acceptor.debug [*debug]]]
92011     [Socket option to enable socket-level debugging. ]
92012   
92013   ]
92014
92015   [
92016
92017     [[link boost_asio.reference.basic_socket_acceptor.do_not_route [*do_not_route]]]
92018     [Socket option to prevent routing, use local interfaces only. ]
92019   
92020   ]
92021
92022   [
92023
92024     [[link boost_asio.reference.basic_socket_acceptor.enable_connection_aborted [*enable_connection_aborted]]]
92025     [Socket option to report aborted connections on accept. ]
92026   
92027   ]
92028
92029   [
92030
92031     [[link boost_asio.reference.basic_socket_acceptor.endpoint_type [*endpoint_type]]]
92032     [The endpoint type. ]
92033   
92034   ]
92035
92036   [
92037
92038     [[link boost_asio.reference.basic_socket_acceptor.executor_type [*executor_type]]]
92039     [The type of the executor associated with the object. ]
92040   
92041   ]
92042
92043   [
92044
92045     [[link boost_asio.reference.basic_socket_acceptor.keep_alive [*keep_alive]]]
92046     [Socket option to send keep-alives. ]
92047   
92048   ]
92049
92050   [
92051
92052     [[link boost_asio.reference.basic_socket_acceptor.linger [*linger]]]
92053     [Socket option to specify whether the socket lingers on close if unsent data is present. ]
92054   
92055   ]
92056
92057   [
92058
92059     [[link boost_asio.reference.basic_socket_acceptor.message_flags [*message_flags]]]
92060     [Bitmask type for flags that can be passed to send and receive operations. ]
92061   
92062   ]
92063
92064   [
92065
92066     [[link boost_asio.reference.basic_socket_acceptor.native_handle_type [*native_handle_type]]]
92067     [The native representation of an acceptor. ]
92068   
92069   ]
92070
92071   [
92072
92073     [[link boost_asio.reference.basic_socket_acceptor.out_of_band_inline [*out_of_band_inline]]]
92074     [Socket option for putting received out-of-band data inline. ]
92075   
92076   ]
92077
92078   [
92079
92080     [[link boost_asio.reference.basic_socket_acceptor.protocol_type [*protocol_type]]]
92081     [The protocol type. ]
92082   
92083   ]
92084
92085   [
92086
92087     [[link boost_asio.reference.basic_socket_acceptor.receive_buffer_size [*receive_buffer_size]]]
92088     [Socket option for the receive buffer size of a socket. ]
92089   
92090   ]
92091
92092   [
92093
92094     [[link boost_asio.reference.basic_socket_acceptor.receive_low_watermark [*receive_low_watermark]]]
92095     [Socket option for the receive low watermark. ]
92096   
92097   ]
92098
92099   [
92100
92101     [[link boost_asio.reference.basic_socket_acceptor.reuse_address [*reuse_address]]]
92102     [Socket option to allow the socket to be bound to an address that is already in use. ]
92103   
92104   ]
92105
92106   [
92107
92108     [[link boost_asio.reference.basic_socket_acceptor.send_buffer_size [*send_buffer_size]]]
92109     [Socket option for the send buffer size of a socket. ]
92110   
92111   ]
92112
92113   [
92114
92115     [[link boost_asio.reference.basic_socket_acceptor.send_low_watermark [*send_low_watermark]]]
92116     [Socket option for the send low watermark. ]
92117   
92118   ]
92119
92120   [
92121
92122     [[link boost_asio.reference.basic_socket_acceptor.shutdown_type [*shutdown_type]]]
92123     [Different ways a socket may be shutdown. ]
92124   
92125   ]
92126
92127   [
92128
92129     [[link boost_asio.reference.basic_socket_acceptor.wait_type [*wait_type]]]
92130     [Wait types. ]
92131   
92132   ]
92133
92134 ]
92135
92136 [heading Member Functions]
92137 [table
92138   [[Name][Description]]
92139
92140   [
92141     [[link boost_asio.reference.basic_socket_acceptor.accept [*accept]]]
92142     [Accept a new connection. 
92143      [hr]
92144      Accept a new connection and obtain the endpoint of the peer. ]
92145   ]
92146   
92147   [
92148     [[link boost_asio.reference.basic_socket_acceptor.assign [*assign]]]
92149     [Assigns an existing native acceptor to the acceptor. ]
92150   ]
92151   
92152   [
92153     [[link boost_asio.reference.basic_socket_acceptor.async_accept [*async_accept]]]
92154     [Start an asynchronous accept. ]
92155   ]
92156   
92157   [
92158     [[link boost_asio.reference.basic_socket_acceptor.async_wait [*async_wait]]]
92159     [Asynchronously wait for the acceptor to become ready to read, ready to write, or to have pending error conditions. ]
92160   ]
92161   
92162   [
92163     [[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor [*basic_socket_acceptor]]]
92164     [Construct an acceptor without opening it. 
92165      [hr]
92166      Construct an open acceptor. 
92167      [hr]
92168      Construct an acceptor opened on the given endpoint. 
92169      [hr]
92170      Construct a basic_socket_acceptor on an existing native acceptor. 
92171      [hr]
92172      Move-construct a basic_socket_acceptor from another. 
92173      [hr]
92174      Move-construct a basic_socket_acceptor from an acceptor of another protocol type. ]
92175   ]
92176   
92177   [
92178     [[link boost_asio.reference.basic_socket_acceptor.bind [*bind]]]
92179     [Bind the acceptor to the given local endpoint. ]
92180   ]
92181   
92182   [
92183     [[link boost_asio.reference.basic_socket_acceptor.cancel [*cancel]]]
92184     [Cancel all asynchronous operations associated with the acceptor. ]
92185   ]
92186   
92187   [
92188     [[link boost_asio.reference.basic_socket_acceptor.close [*close]]]
92189     [Close the acceptor. ]
92190   ]
92191   
92192   [
92193     [[link boost_asio.reference.basic_socket_acceptor.get_executor [*get_executor]]]
92194     [Get the executor associated with the object. ]
92195   ]
92196   
92197   [
92198     [[link boost_asio.reference.basic_socket_acceptor.get_option [*get_option]]]
92199     [Get an option from the acceptor. ]
92200   ]
92201   
92202   [
92203     [[link boost_asio.reference.basic_socket_acceptor.io_control [*io_control]]]
92204     [Perform an IO control command on the acceptor. ]
92205   ]
92206   
92207   [
92208     [[link boost_asio.reference.basic_socket_acceptor.is_open [*is_open]]]
92209     [Determine whether the acceptor is open. ]
92210   ]
92211   
92212   [
92213     [[link boost_asio.reference.basic_socket_acceptor.listen [*listen]]]
92214     [Place the acceptor into the state where it will listen for new connections. ]
92215   ]
92216   
92217   [
92218     [[link boost_asio.reference.basic_socket_acceptor.local_endpoint [*local_endpoint]]]
92219     [Get the local endpoint of the acceptor. ]
92220   ]
92221   
92222   [
92223     [[link boost_asio.reference.basic_socket_acceptor.native_handle [*native_handle]]]
92224     [Get the native acceptor representation. ]
92225   ]
92226   
92227   [
92228     [[link boost_asio.reference.basic_socket_acceptor.native_non_blocking [*native_non_blocking]]]
92229     [Gets the non-blocking mode of the native acceptor implementation. 
92230      [hr]
92231      Sets the non-blocking mode of the native acceptor implementation. ]
92232   ]
92233   
92234   [
92235     [[link boost_asio.reference.basic_socket_acceptor.non_blocking [*non_blocking]]]
92236     [Gets the non-blocking mode of the acceptor. 
92237      [hr]
92238      Sets the non-blocking mode of the acceptor. ]
92239   ]
92240   
92241   [
92242     [[link boost_asio.reference.basic_socket_acceptor.open [*open]]]
92243     [Open the acceptor using the specified protocol. ]
92244   ]
92245   
92246   [
92247     [[link boost_asio.reference.basic_socket_acceptor.operator_eq_ [*operator=]]]
92248     [Move-assign a basic_socket_acceptor from another. 
92249      [hr]
92250      Move-assign a basic_socket_acceptor from an acceptor of another protocol type. ]
92251   ]
92252   
92253   [
92254     [[link boost_asio.reference.basic_socket_acceptor.release [*release]]]
92255     [Release ownership of the underlying native acceptor. ]
92256   ]
92257   
92258   [
92259     [[link boost_asio.reference.basic_socket_acceptor.set_option [*set_option]]]
92260     [Set an option on the acceptor. ]
92261   ]
92262   
92263   [
92264     [[link boost_asio.reference.basic_socket_acceptor.wait [*wait]]]
92265     [Wait for the acceptor to become ready to read, ready to write, or to have pending error conditions. ]
92266   ]
92267   
92268   [
92269     [[link boost_asio.reference.basic_socket_acceptor._basic_socket_acceptor [*~basic_socket_acceptor]]]
92270     [Destroys the acceptor. ]
92271   ]
92272   
92273 ]
92274
92275 [heading Data Members]
92276 [table
92277   [[Name][Description]]
92278
92279   [
92280     [[link boost_asio.reference.basic_socket_acceptor.max_connections [*max_connections]]]
92281     [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
92282   ]
92283
92284   [
92285     [[link boost_asio.reference.basic_socket_acceptor.max_listen_connections [*max_listen_connections]]]
92286     [The maximum length of the queue of pending incoming connections. ]
92287   ]
92288
92289   [
92290     [[link boost_asio.reference.basic_socket_acceptor.message_do_not_route [*message_do_not_route]]]
92291     [Specify that the data should not be subject to routing. ]
92292   ]
92293
92294   [
92295     [[link boost_asio.reference.basic_socket_acceptor.message_end_of_record [*message_end_of_record]]]
92296     [Specifies that the data marks the end of a record. ]
92297   ]
92298
92299   [
92300     [[link boost_asio.reference.basic_socket_acceptor.message_out_of_band [*message_out_of_band]]]
92301     [Process out-of-band data. ]
92302   ]
92303
92304   [
92305     [[link boost_asio.reference.basic_socket_acceptor.message_peek [*message_peek]]]
92306     [Peek at incoming data without removing it from the input queue. ]
92307   ]
92308
92309 ]
92310
92311 The [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] class template is used for accepting new socket connections.
92312
92313
92314 [heading Thread Safety]
92315   
92316 ['Distinct] ['objects:] Safe.
92317
92318 ['Shared] ['objects:] Unsafe.
92319
92320
92321 [heading Example]
92322   
92323 Opening a socket acceptor with the SO\_REUSEADDR option enabled: 
92324
92325    boost::asio::ip::tcp::acceptor acceptor(my_context);
92326    boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), port);
92327    acceptor.open(endpoint.protocol());
92328    acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
92329    acceptor.bind(endpoint);
92330    acceptor.listen();
92331
92332
92333
92334
92335
92336
92337
92338 [heading Requirements]
92339
92340 ['Header: ][^boost/asio/local/stream_protocol.hpp]
92341
92342 ['Convenience header: ][^boost/asio.hpp]
92343
92344
92345 [endsect]
92346
92347
92348
92349 [section:endpoint local::stream_protocol::endpoint]
92350
92351 [indexterm2 boost_asio.indexterm.local__stream_protocol.endpoint..endpoint..local::stream_protocol] 
92352 The type of a UNIX domain endpoint. 
92353
92354
92355   typedef basic_endpoint< stream_protocol > endpoint;
92356
92357
92358 [heading Types]
92359 [table
92360   [[Name][Description]]
92361
92362   [
92363
92364     [[link boost_asio.reference.local__basic_endpoint.data_type [*data_type]]]
92365     [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
92366   
92367   ]
92368
92369   [
92370
92371     [[link boost_asio.reference.local__basic_endpoint.protocol_type [*protocol_type]]]
92372     [The protocol type associated with the endpoint. ]
92373   
92374   ]
92375
92376 ]
92377
92378 [heading Member Functions]
92379 [table
92380   [[Name][Description]]
92381
92382   [
92383     [[link boost_asio.reference.local__basic_endpoint.basic_endpoint [*basic_endpoint]]]
92384     [Default constructor. 
92385      [hr]
92386      Construct an endpoint using the specified path name. 
92387      [hr]
92388      Copy constructor. ]
92389   ]
92390   
92391   [
92392     [[link boost_asio.reference.local__basic_endpoint.capacity [*capacity]]]
92393     [Get the capacity of the endpoint in the native type. ]
92394   ]
92395   
92396   [
92397     [[link boost_asio.reference.local__basic_endpoint.data [*data]]]
92398     [Get the underlying endpoint in the native type. ]
92399   ]
92400   
92401   [
92402     [[link boost_asio.reference.local__basic_endpoint.operator_eq_ [*operator=]]]
92403     [Assign from another endpoint. ]
92404   ]
92405   
92406   [
92407     [[link boost_asio.reference.local__basic_endpoint.path [*path]]]
92408     [Get the path associated with the endpoint. 
92409      [hr]
92410      Set the path associated with the endpoint. ]
92411   ]
92412   
92413   [
92414     [[link boost_asio.reference.local__basic_endpoint.protocol [*protocol]]]
92415     [The protocol associated with the endpoint. ]
92416   ]
92417   
92418   [
92419     [[link boost_asio.reference.local__basic_endpoint.resize [*resize]]]
92420     [Set the underlying size of the endpoint in the native type. ]
92421   ]
92422   
92423   [
92424     [[link boost_asio.reference.local__basic_endpoint.size [*size]]]
92425     [Get the underlying size of the endpoint in the native type. ]
92426   ]
92427   
92428 ]
92429
92430 [heading Friends]
92431 [table
92432   [[Name][Description]]
92433
92434   [
92435     [[link boost_asio.reference.local__basic_endpoint.operator_not__eq_ [*operator!=]]]
92436     [Compare two endpoints for inequality. ]
92437   ]
92438   
92439   [
92440     [[link boost_asio.reference.local__basic_endpoint.operator_lt_ [*operator<]]]
92441     [Compare endpoints for ordering. ]
92442   ]
92443   
92444   [
92445     [[link boost_asio.reference.local__basic_endpoint.operator_lt__eq_ [*operator<=]]]
92446     [Compare endpoints for ordering. ]
92447   ]
92448   
92449   [
92450     [[link boost_asio.reference.local__basic_endpoint.operator_eq__eq_ [*operator==]]]
92451     [Compare two endpoints for equality. ]
92452   ]
92453   
92454   [
92455     [[link boost_asio.reference.local__basic_endpoint.operator_gt_ [*operator>]]]
92456     [Compare endpoints for ordering. ]
92457   ]
92458   
92459   [
92460     [[link boost_asio.reference.local__basic_endpoint.operator_gt__eq_ [*operator>=]]]
92461     [Compare endpoints for ordering. ]
92462   ]
92463   
92464 ]
92465
92466 [heading Related Functions]
92467 [table
92468   [[Name][Description]]
92469
92470   [
92471     [[link boost_asio.reference.local__basic_endpoint.operator_lt__lt_ [*operator<<]]]
92472     [Output an endpoint as a string. ]
92473   ]
92474   
92475 ]
92476
92477 The [link boost_asio.reference.local__basic_endpoint `local::basic_endpoint`] class template describes an endpoint that may be associated with a particular UNIX socket.
92478
92479
92480 [heading Thread Safety]
92481   
92482 ['Distinct] ['objects:] Safe.
92483
92484 ['Shared] ['objects:] Unsafe.
92485
92486
92487
92488
92489
92490 [heading Requirements]
92491
92492 ['Header: ][^boost/asio/local/stream_protocol.hpp]
92493
92494 ['Convenience header: ][^boost/asio.hpp]
92495
92496
92497 [endsect]
92498
92499
92500
92501 [section:family local::stream_protocol::family]
92502
92503 [indexterm2 boost_asio.indexterm.local__stream_protocol.family..family..local::stream_protocol] 
92504 Obtain an identifier for the protocol family. 
92505
92506
92507   int family() const;
92508
92509
92510
92511 [endsect]
92512
92513
92514
92515 [section:iostream local::stream_protocol::iostream]
92516
92517 [indexterm2 boost_asio.indexterm.local__stream_protocol.iostream..iostream..local::stream_protocol] 
92518 The UNIX domain iostream type. 
92519
92520
92521   typedef basic_socket_iostream< stream_protocol > iostream;
92522
92523
92524 [heading Types]
92525 [table
92526   [[Name][Description]]
92527
92528   [
92529
92530     [[link boost_asio.reference.basic_socket_iostream.clock_type [*clock_type]]]
92531     [The clock type. ]
92532   
92533   ]
92534
92535   [
92536
92537     [[link boost_asio.reference.basic_socket_iostream.duration [*duration]]]
92538     [The duration type. ]
92539   
92540   ]
92541
92542   [
92543
92544     [[link boost_asio.reference.basic_socket_iostream.duration_type [*duration_type]]]
92545     [(Deprecated: Use duration.) The duration type. ]
92546   
92547   ]
92548
92549   [
92550
92551     [[link boost_asio.reference.basic_socket_iostream.endpoint_type [*endpoint_type]]]
92552     [The endpoint type. ]
92553   
92554   ]
92555
92556   [
92557
92558     [[link boost_asio.reference.basic_socket_iostream.protocol_type [*protocol_type]]]
92559     [The protocol type. ]
92560   
92561   ]
92562
92563   [
92564
92565     [[link boost_asio.reference.basic_socket_iostream.time_point [*time_point]]]
92566     [The time type. ]
92567   
92568   ]
92569
92570   [
92571
92572     [[link boost_asio.reference.basic_socket_iostream.time_type [*time_type]]]
92573     [(Deprecated: Use time_point.) The time type. ]
92574   
92575   ]
92576
92577 ]
92578
92579 [heading Member Functions]
92580 [table
92581   [[Name][Description]]
92582
92583   [
92584     [[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream [*basic_socket_iostream]]]
92585     [Construct a basic_socket_iostream without establishing a connection. 
92586      [hr]
92587      Construct a basic_socket_iostream from the supplied socket. 
92588      [hr]
92589      Move-construct a basic_socket_iostream from another. 
92590      [hr]
92591      Establish a connection to an endpoint corresponding to a resolver query. ]
92592   ]
92593   
92594   [
92595     [[link boost_asio.reference.basic_socket_iostream.close [*close]]]
92596     [Close the connection. ]
92597   ]
92598   
92599   [
92600     [[link boost_asio.reference.basic_socket_iostream.connect [*connect]]]
92601     [Establish a connection to an endpoint corresponding to a resolver query. ]
92602   ]
92603   
92604   [
92605     [[link boost_asio.reference.basic_socket_iostream.error [*error]]]
92606     [Get the last error associated with the stream. ]
92607   ]
92608   
92609   [
92610     [[link boost_asio.reference.basic_socket_iostream.expires_after [*expires_after]]]
92611     [Set the stream's expiry time relative to now. ]
92612   ]
92613   
92614   [
92615     [[link boost_asio.reference.basic_socket_iostream.expires_at [*expires_at]]]
92616     [(Deprecated: Use expiry().) Get the stream's expiry time as an absolute time. 
92617      [hr]
92618      Set the stream's expiry time as an absolute time. ]
92619   ]
92620   
92621   [
92622     [[link boost_asio.reference.basic_socket_iostream.expires_from_now [*expires_from_now]]]
92623     [(Deprecated: Use expiry().) Get the stream's expiry time relative to now. 
92624      [hr]
92625      (Deprecated: Use expires_after().) Set the stream's expiry time relative to now. ]
92626   ]
92627   
92628   [
92629     [[link boost_asio.reference.basic_socket_iostream.expiry [*expiry]]]
92630     [Get the stream's expiry time as an absolute time. ]
92631   ]
92632   
92633   [
92634     [[link boost_asio.reference.basic_socket_iostream.operator_eq_ [*operator=]]]
92635     [Move-assign a basic_socket_iostream from another. ]
92636   ]
92637   
92638   [
92639     [[link boost_asio.reference.basic_socket_iostream.rdbuf [*rdbuf]]]
92640     [Return a pointer to the underlying streambuf. ]
92641   ]
92642   
92643   [
92644     [[link boost_asio.reference.basic_socket_iostream.socket [*socket]]]
92645     [Get a reference to the underlying socket. ]
92646   ]
92647   
92648 ]
92649
92650
92651 [heading Requirements]
92652
92653 ['Header: ][^boost/asio/local/stream_protocol.hpp]
92654
92655 ['Convenience header: ][^boost/asio.hpp]
92656
92657
92658 [endsect]
92659
92660
92661
92662 [section:protocol local::stream_protocol::protocol]
92663
92664 [indexterm2 boost_asio.indexterm.local__stream_protocol.protocol..protocol..local::stream_protocol] 
92665 Obtain an identifier for the protocol. 
92666
92667
92668   int protocol() const;
92669
92670
92671
92672 [endsect]
92673
92674
92675
92676 [section:socket local::stream_protocol::socket]
92677
92678 [indexterm2 boost_asio.indexterm.local__stream_protocol.socket..socket..local::stream_protocol] 
92679 The UNIX domain socket type. 
92680
92681
92682   typedef basic_stream_socket< stream_protocol > socket;
92683
92684
92685 [heading Types]
92686 [table
92687   [[Name][Description]]
92688
92689   [
92690
92691     [[link boost_asio.reference.basic_stream_socket__rebind_executor [*rebind_executor]]]
92692     [Rebinds the socket type to another executor. ]
92693   
92694   ]
92695
92696   [
92697
92698     [[link boost_asio.reference.basic_stream_socket.broadcast [*broadcast]]]
92699     [Socket option to permit sending of broadcast messages. ]
92700   
92701   ]
92702
92703   [
92704
92705     [[link boost_asio.reference.basic_stream_socket.bytes_readable [*bytes_readable]]]
92706     [IO control command to get the amount of data that can be read without blocking. ]
92707   
92708   ]
92709
92710   [
92711
92712     [[link boost_asio.reference.basic_stream_socket.debug [*debug]]]
92713     [Socket option to enable socket-level debugging. ]
92714   
92715   ]
92716
92717   [
92718
92719     [[link boost_asio.reference.basic_stream_socket.do_not_route [*do_not_route]]]
92720     [Socket option to prevent routing, use local interfaces only. ]
92721   
92722   ]
92723
92724   [
92725
92726     [[link boost_asio.reference.basic_stream_socket.enable_connection_aborted [*enable_connection_aborted]]]
92727     [Socket option to report aborted connections on accept. ]
92728   
92729   ]
92730
92731   [
92732
92733     [[link boost_asio.reference.basic_stream_socket.endpoint_type [*endpoint_type]]]
92734     [The endpoint type. ]
92735   
92736   ]
92737
92738   [
92739
92740     [[link boost_asio.reference.basic_stream_socket.executor_type [*executor_type]]]
92741     [The type of the executor associated with the object. ]
92742   
92743   ]
92744
92745   [
92746
92747     [[link boost_asio.reference.basic_stream_socket.keep_alive [*keep_alive]]]
92748     [Socket option to send keep-alives. ]
92749   
92750   ]
92751
92752   [
92753
92754     [[link boost_asio.reference.basic_stream_socket.linger [*linger]]]
92755     [Socket option to specify whether the socket lingers on close if unsent data is present. ]
92756   
92757   ]
92758
92759   [
92760
92761     [[link boost_asio.reference.basic_stream_socket.lowest_layer_type [*lowest_layer_type]]]
92762     [A basic_socket is always the lowest layer. ]
92763   
92764   ]
92765
92766   [
92767
92768     [[link boost_asio.reference.basic_stream_socket.message_flags [*message_flags]]]
92769     [Bitmask type for flags that can be passed to send and receive operations. ]
92770   
92771   ]
92772
92773   [
92774
92775     [[link boost_asio.reference.basic_stream_socket.native_handle_type [*native_handle_type]]]
92776     [The native representation of a socket. ]
92777   
92778   ]
92779
92780   [
92781
92782     [[link boost_asio.reference.basic_stream_socket.out_of_band_inline [*out_of_band_inline]]]
92783     [Socket option for putting received out-of-band data inline. ]
92784   
92785   ]
92786
92787   [
92788
92789     [[link boost_asio.reference.basic_stream_socket.protocol_type [*protocol_type]]]
92790     [The protocol type. ]
92791   
92792   ]
92793
92794   [
92795
92796     [[link boost_asio.reference.basic_stream_socket.receive_buffer_size [*receive_buffer_size]]]
92797     [Socket option for the receive buffer size of a socket. ]
92798   
92799   ]
92800
92801   [
92802
92803     [[link boost_asio.reference.basic_stream_socket.receive_low_watermark [*receive_low_watermark]]]
92804     [Socket option for the receive low watermark. ]
92805   
92806   ]
92807
92808   [
92809
92810     [[link boost_asio.reference.basic_stream_socket.reuse_address [*reuse_address]]]
92811     [Socket option to allow the socket to be bound to an address that is already in use. ]
92812   
92813   ]
92814
92815   [
92816
92817     [[link boost_asio.reference.basic_stream_socket.send_buffer_size [*send_buffer_size]]]
92818     [Socket option for the send buffer size of a socket. ]
92819   
92820   ]
92821
92822   [
92823
92824     [[link boost_asio.reference.basic_stream_socket.send_low_watermark [*send_low_watermark]]]
92825     [Socket option for the send low watermark. ]
92826   
92827   ]
92828
92829   [
92830
92831     [[link boost_asio.reference.basic_stream_socket.shutdown_type [*shutdown_type]]]
92832     [Different ways a socket may be shutdown. ]
92833   
92834   ]
92835
92836   [
92837
92838     [[link boost_asio.reference.basic_stream_socket.wait_type [*wait_type]]]
92839     [Wait types. ]
92840   
92841   ]
92842
92843 ]
92844
92845 [heading Member Functions]
92846 [table
92847   [[Name][Description]]
92848
92849   [
92850     [[link boost_asio.reference.basic_stream_socket.assign [*assign]]]
92851     [Assign an existing native socket to the socket. ]
92852   ]
92853   
92854   [
92855     [[link boost_asio.reference.basic_stream_socket.async_connect [*async_connect]]]
92856     [Start an asynchronous connect. ]
92857   ]
92858   
92859   [
92860     [[link boost_asio.reference.basic_stream_socket.async_read_some [*async_read_some]]]
92861     [Start an asynchronous read. ]
92862   ]
92863   
92864   [
92865     [[link boost_asio.reference.basic_stream_socket.async_receive [*async_receive]]]
92866     [Start an asynchronous receive. ]
92867   ]
92868   
92869   [
92870     [[link boost_asio.reference.basic_stream_socket.async_send [*async_send]]]
92871     [Start an asynchronous send. ]
92872   ]
92873   
92874   [
92875     [[link boost_asio.reference.basic_stream_socket.async_wait [*async_wait]]]
92876     [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
92877   ]
92878   
92879   [
92880     [[link boost_asio.reference.basic_stream_socket.async_write_some [*async_write_some]]]
92881     [Start an asynchronous write. ]
92882   ]
92883   
92884   [
92885     [[link boost_asio.reference.basic_stream_socket.at_mark [*at_mark]]]
92886     [Determine whether the socket is at the out-of-band data mark. ]
92887   ]
92888   
92889   [
92890     [[link boost_asio.reference.basic_stream_socket.available [*available]]]
92891     [Determine the number of bytes available for reading. ]
92892   ]
92893   
92894   [
92895     [[link boost_asio.reference.basic_stream_socket.basic_stream_socket [*basic_stream_socket]]]
92896     [Construct a basic_stream_socket without opening it. 
92897      [hr]
92898      Construct and open a basic_stream_socket. 
92899      [hr]
92900      Construct a basic_stream_socket, opening it and binding it to the given local endpoint. 
92901      [hr]
92902      Construct a basic_stream_socket on an existing native socket. 
92903      [hr]
92904      Move-construct a basic_stream_socket from another. 
92905      [hr]
92906      Move-construct a basic_stream_socket from a socket of another protocol type. ]
92907   ]
92908   
92909   [
92910     [[link boost_asio.reference.basic_stream_socket.bind [*bind]]]
92911     [Bind the socket to the given local endpoint. ]
92912   ]
92913   
92914   [
92915     [[link boost_asio.reference.basic_stream_socket.cancel [*cancel]]]
92916     [Cancel all asynchronous operations associated with the socket. ]
92917   ]
92918   
92919   [
92920     [[link boost_asio.reference.basic_stream_socket.close [*close]]]
92921     [Close the socket. ]
92922   ]
92923   
92924   [
92925     [[link boost_asio.reference.basic_stream_socket.connect [*connect]]]
92926     [Connect the socket to the specified endpoint. ]
92927   ]
92928   
92929   [
92930     [[link boost_asio.reference.basic_stream_socket.get_executor [*get_executor]]]
92931     [Get the executor associated with the object. ]
92932   ]
92933   
92934   [
92935     [[link boost_asio.reference.basic_stream_socket.get_option [*get_option]]]
92936     [Get an option from the socket. ]
92937   ]
92938   
92939   [
92940     [[link boost_asio.reference.basic_stream_socket.io_control [*io_control]]]
92941     [Perform an IO control command on the socket. ]
92942   ]
92943   
92944   [
92945     [[link boost_asio.reference.basic_stream_socket.is_open [*is_open]]]
92946     [Determine whether the socket is open. ]
92947   ]
92948   
92949   [
92950     [[link boost_asio.reference.basic_stream_socket.local_endpoint [*local_endpoint]]]
92951     [Get the local endpoint of the socket. ]
92952   ]
92953   
92954   [
92955     [[link boost_asio.reference.basic_stream_socket.lowest_layer [*lowest_layer]]]
92956     [Get a reference to the lowest layer. 
92957      [hr]
92958      Get a const reference to the lowest layer. ]
92959   ]
92960   
92961   [
92962     [[link boost_asio.reference.basic_stream_socket.native_handle [*native_handle]]]
92963     [Get the native socket representation. ]
92964   ]
92965   
92966   [
92967     [[link boost_asio.reference.basic_stream_socket.native_non_blocking [*native_non_blocking]]]
92968     [Gets the non-blocking mode of the native socket implementation. 
92969      [hr]
92970      Sets the non-blocking mode of the native socket implementation. ]
92971   ]
92972   
92973   [
92974     [[link boost_asio.reference.basic_stream_socket.non_blocking [*non_blocking]]]
92975     [Gets the non-blocking mode of the socket. 
92976      [hr]
92977      Sets the non-blocking mode of the socket. ]
92978   ]
92979   
92980   [
92981     [[link boost_asio.reference.basic_stream_socket.open [*open]]]
92982     [Open the socket using the specified protocol. ]
92983   ]
92984   
92985   [
92986     [[link boost_asio.reference.basic_stream_socket.operator_eq_ [*operator=]]]
92987     [Move-assign a basic_stream_socket from another. 
92988      [hr]
92989      Move-assign a basic_stream_socket from a socket of another protocol type. ]
92990   ]
92991   
92992   [
92993     [[link boost_asio.reference.basic_stream_socket.read_some [*read_some]]]
92994     [Read some data from the socket. ]
92995   ]
92996   
92997   [
92998     [[link boost_asio.reference.basic_stream_socket.receive [*receive]]]
92999     [Receive some data on the socket. 
93000      [hr]
93001      Receive some data on a connected socket. ]
93002   ]
93003   
93004   [
93005     [[link boost_asio.reference.basic_stream_socket.release [*release]]]
93006     [Release ownership of the underlying native socket. ]
93007   ]
93008   
93009   [
93010     [[link boost_asio.reference.basic_stream_socket.remote_endpoint [*remote_endpoint]]]
93011     [Get the remote endpoint of the socket. ]
93012   ]
93013   
93014   [
93015     [[link boost_asio.reference.basic_stream_socket.send [*send]]]
93016     [Send some data on the socket. ]
93017   ]
93018   
93019   [
93020     [[link boost_asio.reference.basic_stream_socket.set_option [*set_option]]]
93021     [Set an option on the socket. ]
93022   ]
93023   
93024   [
93025     [[link boost_asio.reference.basic_stream_socket.shutdown [*shutdown]]]
93026     [Disable sends or receives on the socket. ]
93027   ]
93028   
93029   [
93030     [[link boost_asio.reference.basic_stream_socket.wait [*wait]]]
93031     [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
93032   ]
93033   
93034   [
93035     [[link boost_asio.reference.basic_stream_socket.write_some [*write_some]]]
93036     [Write some data to the socket. ]
93037   ]
93038   
93039   [
93040     [[link boost_asio.reference.basic_stream_socket._basic_stream_socket [*~basic_stream_socket]]]
93041     [Destroys the socket. ]
93042   ]
93043   
93044 ]
93045
93046 [heading Data Members]
93047 [table
93048   [[Name][Description]]
93049
93050   [
93051     [[link boost_asio.reference.basic_stream_socket.max_connections [*max_connections]]]
93052     [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
93053   ]
93054
93055   [
93056     [[link boost_asio.reference.basic_stream_socket.max_listen_connections [*max_listen_connections]]]
93057     [The maximum length of the queue of pending incoming connections. ]
93058   ]
93059
93060   [
93061     [[link boost_asio.reference.basic_stream_socket.message_do_not_route [*message_do_not_route]]]
93062     [Specify that the data should not be subject to routing. ]
93063   ]
93064
93065   [
93066     [[link boost_asio.reference.basic_stream_socket.message_end_of_record [*message_end_of_record]]]
93067     [Specifies that the data marks the end of a record. ]
93068   ]
93069
93070   [
93071     [[link boost_asio.reference.basic_stream_socket.message_out_of_band [*message_out_of_band]]]
93072     [Process out-of-band data. ]
93073   ]
93074
93075   [
93076     [[link boost_asio.reference.basic_stream_socket.message_peek [*message_peek]]]
93077     [Peek at incoming data without removing it from the input queue. ]
93078   ]
93079
93080 ]
93081
93082 [heading Protected Data Members]
93083 [table
93084   [[Name][Description]]
93085
93086   [
93087     [[link boost_asio.reference.basic_stream_socket.impl_ [*impl_]]]
93088     []
93089   ]
93090
93091 ]
93092
93093 The [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] class template provides asynchronous and blocking stream-oriented socket functionality.
93094
93095
93096 [heading Thread Safety]
93097   
93098 ['Distinct] ['objects:] Safe.
93099
93100 ['Shared] ['objects:] Unsafe.
93101
93102
93103
93104
93105
93106 [heading Requirements]
93107
93108 ['Header: ][^boost/asio/local/stream_protocol.hpp]
93109
93110 ['Convenience header: ][^boost/asio.hpp]
93111
93112
93113 [endsect]
93114
93115
93116
93117 [section:type local::stream_protocol::type]
93118
93119 [indexterm2 boost_asio.indexterm.local__stream_protocol.type..type..local::stream_protocol] 
93120 Obtain an identifier for the type of the protocol. 
93121
93122
93123   int type() const;
93124
93125
93126
93127 [endsect]
93128
93129
93130
93131 [endsect]
93132
93133 [section:make_strand make_strand]
93134
93135 [indexterm1 boost_asio.indexterm.make_strand..make_strand] 
93136 The `boost::asio::make_strand` function creates a [link boost_asio.reference.strand `strand`]  object for an executor or execution context. 
93137
93138
93139 Create a [link boost_asio.reference.strand `strand`]  object for an executor. 
93140
93141   template<
93142       typename ``[link boost_asio.reference.Executor1 Executor]``>
93143   strand< Executor > ``[link boost_asio.reference.make_strand.overload1 make_strand]``(
93144       const Executor & ex,
93145       typename enable_if< is_executor< Executor >::value >::type *  = 0);
93146   ``  [''''&raquo;''' [link boost_asio.reference.make_strand.overload1 more...]]``
93147
93148 Create a [link boost_asio.reference.strand `strand`]  object for an execution context. 
93149
93150   template<
93151       typename ExecutionContext>
93152   strand< typename ExecutionContext::executor_type > ``[link boost_asio.reference.make_strand.overload2 make_strand]``(
93153       ExecutionContext & ctx,
93154       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
93155   ``  [''''&raquo;''' [link boost_asio.reference.make_strand.overload2 more...]]``
93156
93157 [heading Requirements]
93158
93159 ['Header: ][^boost/asio/strand.hpp]
93160
93161 ['Convenience header: ][^boost/asio.hpp]
93162
93163
93164 [section:overload1 make_strand (1 of 2 overloads)]
93165
93166
93167 Create a [link boost_asio.reference.strand `strand`]  object for an executor. 
93168
93169
93170   template<
93171       typename ``[link boost_asio.reference.Executor1 Executor]``>
93172   strand< Executor > make_strand(
93173       const Executor & ex,
93174       typename enable_if< is_executor< Executor >::value >::type *  = 0);
93175
93176
93177
93178 [endsect]
93179
93180
93181
93182 [section:overload2 make_strand (2 of 2 overloads)]
93183
93184
93185 Create a [link boost_asio.reference.strand `strand`]  object for an execution context. 
93186
93187
93188   template<
93189       typename ExecutionContext>
93190   strand< typename ExecutionContext::executor_type > make_strand(
93191       ExecutionContext & ctx,
93192       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
93193
93194
93195
93196 [endsect]
93197
93198
93199 [endsect]
93200
93201 [section:make_work_guard make_work_guard]
93202
93203 [indexterm1 boost_asio.indexterm.make_work_guard..make_work_guard] 
93204 Create an [link boost_asio.reference.executor_work_guard `executor_work_guard`]  object. 
93205
93206   template<
93207       typename ``[link boost_asio.reference.Executor1 Executor]``>
93208   executor_work_guard< Executor > ``[link boost_asio.reference.make_work_guard.overload1 make_work_guard]``(
93209       const Executor & ex,
93210       typename enable_if< is_executor< Executor >::value >::type *  = 0);
93211   ``  [''''&raquo;''' [link boost_asio.reference.make_work_guard.overload1 more...]]``
93212
93213   template<
93214       typename ExecutionContext>
93215   executor_work_guard< typename ExecutionContext::executor_type > ``[link boost_asio.reference.make_work_guard.overload2 make_work_guard]``(
93216       ExecutionContext & ctx,
93217       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
93218   ``  [''''&raquo;''' [link boost_asio.reference.make_work_guard.overload2 more...]]``
93219
93220   template<
93221       typename T>
93222   executor_work_guard< typename associated_executor< T >::type > ``[link boost_asio.reference.make_work_guard.overload3 make_work_guard]``(
93223       const T & t,
93224       typename enable_if<!is_executor< T >::value &&!is_convertible< T &, execution_context & >::value >::type *  = 0);
93225   ``  [''''&raquo;''' [link boost_asio.reference.make_work_guard.overload3 more...]]``
93226
93227   template<
93228       typename T,
93229       typename ``[link boost_asio.reference.Executor1 Executor]``>
93230   executor_work_guard< typename associated_executor< T, Executor >::type > ``[link boost_asio.reference.make_work_guard.overload4 make_work_guard]``(
93231       const T & t,
93232       const Executor & ex,
93233       typename enable_if< is_executor< Executor >::value >::type *  = 0);
93234   ``  [''''&raquo;''' [link boost_asio.reference.make_work_guard.overload4 more...]]``
93235
93236   template<
93237       typename T,
93238       typename ExecutionContext>
93239   executor_work_guard< typename associated_executor< T, typename ExecutionContext::executor_type >::type > ``[link boost_asio.reference.make_work_guard.overload5 make_work_guard]``(
93240       const T & t,
93241       ExecutionContext & ctx,
93242       typename enable_if<!is_executor< T >::value &&!is_convertible< T &, execution_context & >::value &&is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
93243   ``  [''''&raquo;''' [link boost_asio.reference.make_work_guard.overload5 more...]]``
93244
93245 [heading Requirements]
93246
93247 ['Header: ][^boost/asio/executor_work_guard.hpp]
93248
93249 ['Convenience header: ][^boost/asio.hpp]
93250
93251
93252 [section:overload1 make_work_guard (1 of 5 overloads)]
93253
93254
93255 Create an [link boost_asio.reference.executor_work_guard `executor_work_guard`]  object. 
93256
93257
93258   template<
93259       typename ``[link boost_asio.reference.Executor1 Executor]``>
93260   executor_work_guard< Executor > make_work_guard(
93261       const Executor & ex,
93262       typename enable_if< is_executor< Executor >::value >::type *  = 0);
93263
93264
93265
93266 [endsect]
93267
93268
93269
93270 [section:overload2 make_work_guard (2 of 5 overloads)]
93271
93272
93273 Create an [link boost_asio.reference.executor_work_guard `executor_work_guard`]  object. 
93274
93275
93276   template<
93277       typename ExecutionContext>
93278   executor_work_guard< typename ExecutionContext::executor_type > make_work_guard(
93279       ExecutionContext & ctx,
93280       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
93281
93282
93283
93284 [endsect]
93285
93286
93287
93288 [section:overload3 make_work_guard (3 of 5 overloads)]
93289
93290
93291 Create an [link boost_asio.reference.executor_work_guard `executor_work_guard`]  object. 
93292
93293
93294   template<
93295       typename T>
93296   executor_work_guard< typename associated_executor< T >::type > make_work_guard(
93297       const T & t,
93298       typename enable_if<!is_executor< T >::value &&!is_convertible< T &, execution_context & >::value >::type *  = 0);
93299
93300
93301
93302 [endsect]
93303
93304
93305
93306 [section:overload4 make_work_guard (4 of 5 overloads)]
93307
93308
93309 Create an [link boost_asio.reference.executor_work_guard `executor_work_guard`]  object. 
93310
93311
93312   template<
93313       typename T,
93314       typename ``[link boost_asio.reference.Executor1 Executor]``>
93315   executor_work_guard< typename associated_executor< T, Executor >::type > make_work_guard(
93316       const T & t,
93317       const Executor & ex,
93318       typename enable_if< is_executor< Executor >::value >::type *  = 0);
93319
93320
93321
93322 [endsect]
93323
93324
93325
93326 [section:overload5 make_work_guard (5 of 5 overloads)]
93327
93328
93329 Create an [link boost_asio.reference.executor_work_guard `executor_work_guard`]  object. 
93330
93331
93332   template<
93333       typename T,
93334       typename ExecutionContext>
93335   executor_work_guard< typename associated_executor< T, typename ExecutionContext::executor_type >::type > make_work_guard(
93336       const T & t,
93337       ExecutionContext & ctx,
93338       typename enable_if<!is_executor< T >::value &&!is_convertible< T &, execution_context & >::value &&is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
93339
93340
93341
93342 [endsect]
93343
93344
93345 [endsect]
93346
93347 [section:mutable_buffer mutable_buffer]
93348
93349
93350 Holds a buffer that can be modified. 
93351
93352
93353   class mutable_buffer
93354
93355
93356 [heading Member Functions]
93357 [table
93358   [[Name][Description]]
93359
93360   [
93361     [[link boost_asio.reference.mutable_buffer.data [*data]]]
93362     [Get a pointer to the beginning of the memory range. ]
93363   ]
93364   
93365   [
93366     [[link boost_asio.reference.mutable_buffer.mutable_buffer [*mutable_buffer]]]
93367     [Construct an empty buffer. 
93368      [hr]
93369      Construct a buffer to represent a given memory range. ]
93370   ]
93371   
93372   [
93373     [[link boost_asio.reference.mutable_buffer.operator_plus__eq_ [*operator+=]]]
93374     [Move the start of the buffer by the specified number of bytes. ]
93375   ]
93376   
93377   [
93378     [[link boost_asio.reference.mutable_buffer.size [*size]]]
93379     [Get the size of the memory range. ]
93380   ]
93381   
93382 ]
93383
93384 [heading Related Functions]
93385 [table
93386   [[Name][Description]]
93387
93388   [
93389     [[link boost_asio.reference.mutable_buffer.operator_plus_ [*operator+]]]
93390     [Create a new modifiable buffer that is offset from the start of another. ]
93391   ]
93392   
93393 ]
93394
93395 The [link boost_asio.reference.mutable_buffer `mutable_buffer`] class provides a safe representation of a buffer that can be modified. It does not own the underlying data, and so is cheap to copy or assign.
93396
93397
93398 [heading Accessing Buffer Contents]
93399   
93400
93401
93402 The contents of a buffer may be accessed using the `data()` and `size()` member functions:
93403
93404
93405
93406    boost::asio::mutable_buffer b1 = ...;
93407    std::size_t s1 = b1.size();
93408    unsigned char* p1 = static_cast<unsigned char*>(b1.data());
93409
93410
93411
93412
93413 The `data()` member function permits violations of type safety, so uses of it in application code should be carefully considered. 
93414
93415 [heading Requirements]
93416
93417 ['Header: ][^boost/asio/buffer.hpp]
93418
93419 ['Convenience header: ][^boost/asio.hpp]
93420
93421
93422 [section:data mutable_buffer::data]
93423
93424 [indexterm2 boost_asio.indexterm.mutable_buffer.data..data..mutable_buffer] 
93425 Get a pointer to the beginning of the memory range. 
93426
93427
93428   void * data() const;
93429
93430
93431
93432 [endsect]
93433
93434
93435 [section:mutable_buffer mutable_buffer::mutable_buffer]
93436
93437 [indexterm2 boost_asio.indexterm.mutable_buffer.mutable_buffer..mutable_buffer..mutable_buffer] 
93438 Construct an empty buffer. 
93439
93440
93441   ``[link boost_asio.reference.mutable_buffer.mutable_buffer.overload1 mutable_buffer]``();
93442   ``  [''''&raquo;''' [link boost_asio.reference.mutable_buffer.mutable_buffer.overload1 more...]]``
93443
93444
93445 Construct a buffer to represent a given memory range. 
93446
93447
93448   ``[link boost_asio.reference.mutable_buffer.mutable_buffer.overload2 mutable_buffer]``(
93449       void * data,
93450       std::size_t size);
93451   ``  [''''&raquo;''' [link boost_asio.reference.mutable_buffer.mutable_buffer.overload2 more...]]``
93452
93453
93454 [section:overload1 mutable_buffer::mutable_buffer (1 of 2 overloads)]
93455
93456
93457 Construct an empty buffer. 
93458
93459
93460   mutable_buffer();
93461
93462
93463
93464 [endsect]
93465
93466
93467
93468 [section:overload2 mutable_buffer::mutable_buffer (2 of 2 overloads)]
93469
93470
93471 Construct a buffer to represent a given memory range. 
93472
93473
93474   mutable_buffer(
93475       void * data,
93476       std::size_t size);
93477
93478
93479
93480 [endsect]
93481
93482
93483 [endsect]
93484
93485 [section:operator_plus_ mutable_buffer::operator+]
93486
93487 [indexterm2 boost_asio.indexterm.mutable_buffer.operator_plus_..operator+..mutable_buffer] 
93488 Create a new modifiable buffer that is offset from the start of another. 
93489
93490
93491   mutable_buffer ``[link boost_asio.reference.mutable_buffer.operator_plus_.overload1 operator+]``(
93492       const mutable_buffer & b,
93493       std::size_t n);
93494   ``  [''''&raquo;''' [link boost_asio.reference.mutable_buffer.operator_plus_.overload1 more...]]``
93495
93496   mutable_buffer ``[link boost_asio.reference.mutable_buffer.operator_plus_.overload2 operator+]``(
93497       std::size_t n,
93498       const mutable_buffer & b);
93499   ``  [''''&raquo;''' [link boost_asio.reference.mutable_buffer.operator_plus_.overload2 more...]]``
93500
93501
93502 [section:overload1 mutable_buffer::operator+ (1 of 2 overloads)]
93503
93504
93505 Create a new modifiable buffer that is offset from the start of another. 
93506
93507
93508   mutable_buffer operator+(
93509       const mutable_buffer & b,
93510       std::size_t n);
93511
93512
93513
93514 [endsect]
93515
93516
93517
93518 [section:overload2 mutable_buffer::operator+ (2 of 2 overloads)]
93519
93520
93521 Create a new modifiable buffer that is offset from the start of another. 
93522
93523
93524   mutable_buffer operator+(
93525       std::size_t n,
93526       const mutable_buffer & b);
93527
93528
93529
93530 [endsect]
93531
93532
93533 [endsect]
93534
93535
93536 [section:operator_plus__eq_ mutable_buffer::operator+=]
93537
93538 [indexterm2 boost_asio.indexterm.mutable_buffer.operator_plus__eq_..operator+=..mutable_buffer] 
93539 Move the start of the buffer by the specified number of bytes. 
93540
93541
93542   mutable_buffer & operator+=(
93543       std::size_t n);
93544
93545
93546
93547 [endsect]
93548
93549
93550
93551 [section:size mutable_buffer::size]
93552
93553 [indexterm2 boost_asio.indexterm.mutable_buffer.size..size..mutable_buffer] 
93554 Get the size of the memory range. 
93555
93556
93557   std::size_t size() const;
93558
93559
93560
93561 [endsect]
93562
93563
93564
93565 [endsect]
93566
93567 [section:mutable_buffers_1 mutable_buffers_1]
93568
93569
93570 (Deprecated: Use [link boost_asio.reference.mutable_buffer `mutable_buffer`].) Adapts a single modifiable buffer so that it meets the requirements of the MutableBufferSequence concept. 
93571
93572
93573   class mutable_buffers_1 :
93574     public mutable_buffer
93575
93576
93577 [heading Types]
93578 [table
93579   [[Name][Description]]
93580
93581   [
93582
93583     [[link boost_asio.reference.mutable_buffers_1.const_iterator [*const_iterator]]]
93584     [A random-access iterator type that may be used to read elements. ]
93585   
93586   ]
93587
93588   [
93589
93590     [[link boost_asio.reference.mutable_buffers_1.value_type [*value_type]]]
93591     [The type for each element in the list of buffers. ]
93592   
93593   ]
93594
93595 ]
93596
93597 [heading Member Functions]
93598 [table
93599   [[Name][Description]]
93600
93601   [
93602     [[link boost_asio.reference.mutable_buffers_1.begin [*begin]]]
93603     [Get a random-access iterator to the first element. ]
93604   ]
93605   
93606   [
93607     [[link boost_asio.reference.mutable_buffers_1.data [*data]]]
93608     [Get a pointer to the beginning of the memory range. ]
93609   ]
93610   
93611   [
93612     [[link boost_asio.reference.mutable_buffers_1.end [*end]]]
93613     [Get a random-access iterator for one past the last element. ]
93614   ]
93615   
93616   [
93617     [[link boost_asio.reference.mutable_buffers_1.mutable_buffers_1 [*mutable_buffers_1]]]
93618     [Construct to represent a given memory range. 
93619      [hr]
93620      Construct to represent a single modifiable buffer. ]
93621   ]
93622   
93623   [
93624     [[link boost_asio.reference.mutable_buffers_1.operator_plus__eq_ [*operator+=]]]
93625     [Move the start of the buffer by the specified number of bytes. ]
93626   ]
93627   
93628   [
93629     [[link boost_asio.reference.mutable_buffers_1.size [*size]]]
93630     [Get the size of the memory range. ]
93631   ]
93632   
93633 ]
93634
93635 [heading Related Functions]
93636 [table
93637   [[Name][Description]]
93638
93639   [
93640     [[link boost_asio.reference.mutable_buffers_1.operator_plus_ [*operator+]]]
93641     [Create a new modifiable buffer that is offset from the start of another. ]
93642   ]
93643   
93644 ]
93645
93646 [heading Requirements]
93647
93648 ['Header: ][^boost/asio/buffer.hpp]
93649
93650 ['Convenience header: ][^boost/asio.hpp]
93651
93652
93653 [section:begin mutable_buffers_1::begin]
93654
93655 [indexterm2 boost_asio.indexterm.mutable_buffers_1.begin..begin..mutable_buffers_1] 
93656 Get a random-access iterator to the first element. 
93657
93658
93659   const_iterator begin() const;
93660
93661
93662
93663 [endsect]
93664
93665
93666
93667 [section:const_iterator mutable_buffers_1::const_iterator]
93668
93669 [indexterm2 boost_asio.indexterm.mutable_buffers_1.const_iterator..const_iterator..mutable_buffers_1] 
93670 A random-access iterator type that may be used to read elements. 
93671
93672
93673   typedef const mutable_buffer * const_iterator;
93674
93675
93676
93677 [heading Requirements]
93678
93679 ['Header: ][^boost/asio/buffer.hpp]
93680
93681 ['Convenience header: ][^boost/asio.hpp]
93682
93683
93684 [endsect]
93685
93686
93687
93688 [section:data mutable_buffers_1::data]
93689
93690
93691 ['Inherited from mutable_buffer.]
93692
93693 [indexterm2 boost_asio.indexterm.mutable_buffers_1.data..data..mutable_buffers_1] 
93694 Get a pointer to the beginning of the memory range. 
93695
93696
93697   void * data() const;
93698
93699
93700
93701 [endsect]
93702
93703
93704
93705 [section:end mutable_buffers_1::end]
93706
93707 [indexterm2 boost_asio.indexterm.mutable_buffers_1.end..end..mutable_buffers_1] 
93708 Get a random-access iterator for one past the last element. 
93709
93710
93711   const_iterator end() const;
93712
93713
93714
93715 [endsect]
93716
93717
93718 [section:mutable_buffers_1 mutable_buffers_1::mutable_buffers_1]
93719
93720 [indexterm2 boost_asio.indexterm.mutable_buffers_1.mutable_buffers_1..mutable_buffers_1..mutable_buffers_1] 
93721 Construct to represent a given memory range. 
93722
93723
93724   ``[link boost_asio.reference.mutable_buffers_1.mutable_buffers_1.overload1 mutable_buffers_1]``(
93725       void * data,
93726       std::size_t size);
93727   ``  [''''&raquo;''' [link boost_asio.reference.mutable_buffers_1.mutable_buffers_1.overload1 more...]]``
93728
93729
93730 Construct to represent a single modifiable buffer. 
93731
93732
93733   explicit ``[link boost_asio.reference.mutable_buffers_1.mutable_buffers_1.overload2 mutable_buffers_1]``(
93734       const mutable_buffer & b);
93735   ``  [''''&raquo;''' [link boost_asio.reference.mutable_buffers_1.mutable_buffers_1.overload2 more...]]``
93736
93737
93738 [section:overload1 mutable_buffers_1::mutable_buffers_1 (1 of 2 overloads)]
93739
93740
93741 Construct to represent a given memory range. 
93742
93743
93744   mutable_buffers_1(
93745       void * data,
93746       std::size_t size);
93747
93748
93749
93750 [endsect]
93751
93752
93753
93754 [section:overload2 mutable_buffers_1::mutable_buffers_1 (2 of 2 overloads)]
93755
93756
93757 Construct to represent a single modifiable buffer. 
93758
93759
93760   mutable_buffers_1(
93761       const mutable_buffer & b);
93762
93763
93764
93765 [endsect]
93766
93767
93768 [endsect]
93769
93770 [section:operator_plus_ mutable_buffers_1::operator+]
93771
93772 [indexterm2 boost_asio.indexterm.mutable_buffers_1.operator_plus_..operator+..mutable_buffers_1] 
93773 Create a new modifiable buffer that is offset from the start of another. 
93774
93775
93776   mutable_buffer ``[link boost_asio.reference.mutable_buffers_1.operator_plus_.overload1 operator+]``(
93777       const mutable_buffer & b,
93778       std::size_t n);
93779   ``  [''''&raquo;''' [link boost_asio.reference.mutable_buffers_1.operator_plus_.overload1 more...]]``
93780
93781   mutable_buffer ``[link boost_asio.reference.mutable_buffers_1.operator_plus_.overload2 operator+]``(
93782       std::size_t n,
93783       const mutable_buffer & b);
93784   ``  [''''&raquo;''' [link boost_asio.reference.mutable_buffers_1.operator_plus_.overload2 more...]]``
93785
93786
93787 [section:overload1 mutable_buffers_1::operator+ (1 of 2 overloads)]
93788
93789
93790 ['Inherited from mutable_buffer.]
93791
93792
93793 Create a new modifiable buffer that is offset from the start of another. 
93794
93795
93796   mutable_buffer operator+(
93797       const mutable_buffer & b,
93798       std::size_t n);
93799
93800
93801
93802 [endsect]
93803
93804
93805
93806 [section:overload2 mutable_buffers_1::operator+ (2 of 2 overloads)]
93807
93808
93809 ['Inherited from mutable_buffer.]
93810
93811
93812 Create a new modifiable buffer that is offset from the start of another. 
93813
93814
93815   mutable_buffer operator+(
93816       std::size_t n,
93817       const mutable_buffer & b);
93818
93819
93820
93821 [endsect]
93822
93823
93824 [endsect]
93825
93826
93827 [section:operator_plus__eq_ mutable_buffers_1::operator+=]
93828
93829
93830 ['Inherited from mutable_buffer.]
93831
93832 [indexterm2 boost_asio.indexterm.mutable_buffers_1.operator_plus__eq_..operator+=..mutable_buffers_1] 
93833 Move the start of the buffer by the specified number of bytes. 
93834
93835
93836   mutable_buffer & operator+=(
93837       std::size_t n);
93838
93839
93840
93841 [endsect]
93842
93843
93844
93845 [section:size mutable_buffers_1::size]
93846
93847
93848 ['Inherited from mutable_buffer.]
93849
93850 [indexterm2 boost_asio.indexterm.mutable_buffers_1.size..size..mutable_buffers_1] 
93851 Get the size of the memory range. 
93852
93853
93854   std::size_t size() const;
93855
93856
93857
93858 [endsect]
93859
93860
93861
93862 [section:value_type mutable_buffers_1::value_type]
93863
93864 [indexterm2 boost_asio.indexterm.mutable_buffers_1.value_type..value_type..mutable_buffers_1] 
93865 The type for each element in the list of buffers. 
93866
93867
93868   typedef mutable_buffer value_type;
93869
93870
93871 [heading Member Functions]
93872 [table
93873   [[Name][Description]]
93874
93875   [
93876     [[link boost_asio.reference.mutable_buffer.data [*data]]]
93877     [Get a pointer to the beginning of the memory range. ]
93878   ]
93879   
93880   [
93881     [[link boost_asio.reference.mutable_buffer.mutable_buffer [*mutable_buffer]]]
93882     [Construct an empty buffer. 
93883      [hr]
93884      Construct a buffer to represent a given memory range. ]
93885   ]
93886   
93887   [
93888     [[link boost_asio.reference.mutable_buffer.operator_plus__eq_ [*operator+=]]]
93889     [Move the start of the buffer by the specified number of bytes. ]
93890   ]
93891   
93892   [
93893     [[link boost_asio.reference.mutable_buffer.size [*size]]]
93894     [Get the size of the memory range. ]
93895   ]
93896   
93897 ]
93898
93899 [heading Related Functions]
93900 [table
93901   [[Name][Description]]
93902
93903   [
93904     [[link boost_asio.reference.mutable_buffer.operator_plus_ [*operator+]]]
93905     [Create a new modifiable buffer that is offset from the start of another. ]
93906   ]
93907   
93908 ]
93909
93910 The [link boost_asio.reference.mutable_buffer `mutable_buffer`] class provides a safe representation of a buffer that can be modified. It does not own the underlying data, and so is cheap to copy or assign.
93911
93912
93913 [heading Accessing Buffer Contents]
93914   
93915
93916
93917 The contents of a buffer may be accessed using the `data()` and `size()` member functions:
93918
93919
93920
93921    boost::asio::mutable_buffer b1 = ...;
93922    std::size_t s1 = b1.size();
93923    unsigned char* p1 = static_cast<unsigned char*>(b1.data());
93924
93925
93926
93927
93928 The `data()` member function permits violations of type safety, so uses of it in application code should be carefully considered. 
93929
93930
93931 [heading Requirements]
93932
93933 ['Header: ][^boost/asio/buffer.hpp]
93934
93935 ['Convenience header: ][^boost/asio.hpp]
93936
93937
93938 [endsect]
93939
93940
93941
93942 [endsect]
93943
93944 [section:null_buffers null_buffers]
93945
93946
93947 (Deprecated: Use the socket/descriptor wait() and async\_wait() member functions.) An implementation of both the ConstBufferSequence and MutableBufferSequence concepts to represent a null buffer sequence. 
93948
93949
93950   class null_buffers
93951
93952
93953 [heading Types]
93954 [table
93955   [[Name][Description]]
93956
93957   [
93958
93959     [[link boost_asio.reference.null_buffers.const_iterator [*const_iterator]]]
93960     [A random-access iterator type that may be used to read elements. ]
93961   
93962   ]
93963
93964   [
93965
93966     [[link boost_asio.reference.null_buffers.value_type [*value_type]]]
93967     [The type for each element in the list of buffers. ]
93968   
93969   ]
93970
93971 ]
93972
93973 [heading Member Functions]
93974 [table
93975   [[Name][Description]]
93976
93977   [
93978     [[link boost_asio.reference.null_buffers.begin [*begin]]]
93979     [Get a random-access iterator to the first element. ]
93980   ]
93981   
93982   [
93983     [[link boost_asio.reference.null_buffers.end [*end]]]
93984     [Get a random-access iterator for one past the last element. ]
93985   ]
93986   
93987 ]
93988
93989 [heading Requirements]
93990
93991 ['Header: ][^boost/asio/buffer.hpp]
93992
93993 ['Convenience header: ][^boost/asio.hpp]
93994
93995
93996 [section:begin null_buffers::begin]
93997
93998 [indexterm2 boost_asio.indexterm.null_buffers.begin..begin..null_buffers] 
93999 Get a random-access iterator to the first element. 
94000
94001
94002   const_iterator begin() const;
94003
94004
94005
94006 [endsect]
94007
94008
94009
94010 [section:const_iterator null_buffers::const_iterator]
94011
94012 [indexterm2 boost_asio.indexterm.null_buffers.const_iterator..const_iterator..null_buffers] 
94013 A random-access iterator type that may be used to read elements. 
94014
94015
94016   typedef const mutable_buffer * const_iterator;
94017
94018
94019
94020 [heading Requirements]
94021
94022 ['Header: ][^boost/asio/buffer.hpp]
94023
94024 ['Convenience header: ][^boost/asio.hpp]
94025
94026
94027 [endsect]
94028
94029
94030
94031 [section:end null_buffers::end]
94032
94033 [indexterm2 boost_asio.indexterm.null_buffers.end..end..null_buffers] 
94034 Get a random-access iterator for one past the last element. 
94035
94036
94037   const_iterator end() const;
94038
94039
94040
94041 [endsect]
94042
94043
94044
94045 [section:value_type null_buffers::value_type]
94046
94047 [indexterm2 boost_asio.indexterm.null_buffers.value_type..value_type..null_buffers] 
94048 The type for each element in the list of buffers. 
94049
94050
94051   typedef mutable_buffer value_type;
94052
94053
94054 [heading Member Functions]
94055 [table
94056   [[Name][Description]]
94057
94058   [
94059     [[link boost_asio.reference.mutable_buffer.data [*data]]]
94060     [Get a pointer to the beginning of the memory range. ]
94061   ]
94062   
94063   [
94064     [[link boost_asio.reference.mutable_buffer.mutable_buffer [*mutable_buffer]]]
94065     [Construct an empty buffer. 
94066      [hr]
94067      Construct a buffer to represent a given memory range. ]
94068   ]
94069   
94070   [
94071     [[link boost_asio.reference.mutable_buffer.operator_plus__eq_ [*operator+=]]]
94072     [Move the start of the buffer by the specified number of bytes. ]
94073   ]
94074   
94075   [
94076     [[link boost_asio.reference.mutable_buffer.size [*size]]]
94077     [Get the size of the memory range. ]
94078   ]
94079   
94080 ]
94081
94082 [heading Related Functions]
94083 [table
94084   [[Name][Description]]
94085
94086   [
94087     [[link boost_asio.reference.mutable_buffer.operator_plus_ [*operator+]]]
94088     [Create a new modifiable buffer that is offset from the start of another. ]
94089   ]
94090   
94091 ]
94092
94093 The [link boost_asio.reference.mutable_buffer `mutable_buffer`] class provides a safe representation of a buffer that can be modified. It does not own the underlying data, and so is cheap to copy or assign.
94094
94095
94096 [heading Accessing Buffer Contents]
94097   
94098
94099
94100 The contents of a buffer may be accessed using the `data()` and `size()` member functions:
94101
94102
94103
94104    boost::asio::mutable_buffer b1 = ...;
94105    std::size_t s1 = b1.size();
94106    unsigned char* p1 = static_cast<unsigned char*>(b1.data());
94107
94108
94109
94110
94111 The `data()` member function permits violations of type safety, so uses of it in application code should be carefully considered. 
94112
94113
94114 [heading Requirements]
94115
94116 ['Header: ][^boost/asio/buffer.hpp]
94117
94118 ['Convenience header: ][^boost/asio.hpp]
94119
94120
94121 [endsect]
94122
94123
94124
94125 [endsect]
94126
94127
94128 [section:placeholders__bytes_transferred placeholders::bytes_transferred]
94129
94130 [indexterm1 boost_asio.indexterm.placeholders__bytes_transferred..placeholders::bytes_transferred] 
94131 An argument placeholder, for use with boost::bind(), that corresponds to the bytes\_transferred argument of a handler for asynchronous functions such as `boost::asio::basic_stream_socket::async_write_some` or `boost::asio::async_write`. 
94132
94133
94134   unspecified bytes_transferred;
94135
94136
94137 [heading Requirements]
94138
94139 ['Header: ][^boost/asio/placeholders.hpp]
94140
94141 ['Convenience header: ][^boost/asio.hpp]
94142
94143
94144 [endsect]
94145
94146
94147
94148 [section:placeholders__endpoint placeholders::endpoint]
94149
94150 [indexterm1 boost_asio.indexterm.placeholders__endpoint..placeholders::endpoint] 
94151 An argument placeholder, for use with boost::bind(), that corresponds to the results argument of a handler for asynchronous functions such as `boost::asio::async_connect`. 
94152
94153
94154   unspecified endpoint;
94155
94156
94157 [heading Requirements]
94158
94159 ['Header: ][^boost/asio/placeholders.hpp]
94160
94161 ['Convenience header: ][^boost/asio.hpp]
94162
94163
94164 [endsect]
94165
94166
94167
94168 [section:placeholders__error placeholders::error]
94169
94170 [indexterm1 boost_asio.indexterm.placeholders__error..placeholders::error] 
94171 An argument placeholder, for use with boost::bind(), that corresponds to the error argument of a handler for any of the asynchronous functions. 
94172
94173
94174   unspecified error;
94175
94176
94177 [heading Requirements]
94178
94179 ['Header: ][^boost/asio/placeholders.hpp]
94180
94181 ['Convenience header: ][^boost/asio.hpp]
94182
94183
94184 [endsect]
94185
94186
94187
94188 [section:placeholders__iterator placeholders::iterator]
94189
94190 [indexterm1 boost_asio.indexterm.placeholders__iterator..placeholders::iterator] 
94191 An argument placeholder, for use with boost::bind(), that corresponds to the iterator argument of a handler for asynchronous functions such as `boost::asio::async_connect`. 
94192
94193
94194   unspecified iterator;
94195
94196
94197 [heading Requirements]
94198
94199 ['Header: ][^boost/asio/placeholders.hpp]
94200
94201 ['Convenience header: ][^boost/asio.hpp]
94202
94203
94204 [endsect]
94205
94206
94207
94208 [section:placeholders__results placeholders::results]
94209
94210 [indexterm1 boost_asio.indexterm.placeholders__results..placeholders::results] 
94211 An argument placeholder, for use with boost::bind(), that corresponds to the results argument of a handler for asynchronous functions such as boost::asio::basic\_resolver::async\_resolve. 
94212
94213
94214   unspecified results;
94215
94216
94217 [heading Requirements]
94218
94219 ['Header: ][^boost/asio/placeholders.hpp]
94220
94221 ['Convenience header: ][^boost/asio.hpp]
94222
94223
94224 [endsect]
94225
94226
94227
94228 [section:placeholders__signal_number placeholders::signal_number]
94229
94230 [indexterm1 boost_asio.indexterm.placeholders__signal_number..placeholders::signal_number] 
94231 An argument placeholder, for use with boost::bind(), that corresponds to the signal\_number argument of a handler for asynchronous functions such as `boost::asio::signal_set::async_wait`. 
94232
94233
94234   unspecified signal_number;
94235
94236
94237 [heading Requirements]
94238
94239 ['Header: ][^boost/asio/placeholders.hpp]
94240
94241 ['Convenience header: ][^boost/asio.hpp]
94242
94243
94244 [endsect]
94245
94246
94247 [section:posix__basic_descriptor posix::basic_descriptor]
94248
94249
94250 Provides POSIX descriptor functionality. 
94251
94252
94253   template<
94254       typename ``[link boost_asio.reference.Executor1 Executor]`` = executor>
94255   class basic_descriptor :
94256     public posix::descriptor_base
94257
94258
94259 [heading Types]
94260 [table
94261   [[Name][Description]]
94262
94263   [
94264
94265     [[link boost_asio.reference.posix__basic_descriptor__rebind_executor [*rebind_executor]]]
94266     [Rebinds the descriptor type to another executor. ]
94267   
94268   ]
94269
94270   [
94271
94272     [[link boost_asio.reference.posix__basic_descriptor.bytes_readable [*bytes_readable]]]
94273     [IO control command to get the amount of data that can be read without blocking. ]
94274   
94275   ]
94276
94277   [
94278
94279     [[link boost_asio.reference.posix__basic_descriptor.executor_type [*executor_type]]]
94280     [The type of the executor associated with the object. ]
94281   
94282   ]
94283
94284   [
94285
94286     [[link boost_asio.reference.posix__basic_descriptor.lowest_layer_type [*lowest_layer_type]]]
94287     [A descriptor is always the lowest layer. ]
94288   
94289   ]
94290
94291   [
94292
94293     [[link boost_asio.reference.posix__basic_descriptor.native_handle_type [*native_handle_type]]]
94294     [The native representation of a descriptor. ]
94295   
94296   ]
94297
94298   [
94299
94300     [[link boost_asio.reference.posix__basic_descriptor.wait_type [*wait_type]]]
94301     [Wait types. ]
94302   
94303   ]
94304
94305 ]
94306
94307 [heading Member Functions]
94308 [table
94309   [[Name][Description]]
94310
94311   [
94312     [[link boost_asio.reference.posix__basic_descriptor.assign [*assign]]]
94313     [Assign an existing native descriptor to the descriptor. ]
94314   ]
94315   
94316   [
94317     [[link boost_asio.reference.posix__basic_descriptor.async_wait [*async_wait]]]
94318     [Asynchronously wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
94319   ]
94320   
94321   [
94322     [[link boost_asio.reference.posix__basic_descriptor.basic_descriptor [*basic_descriptor]]]
94323     [Construct a descriptor without opening it. 
94324      [hr]
94325      Construct a descriptor on an existing native descriptor. 
94326      [hr]
94327      Move-construct a descriptor from another. ]
94328   ]
94329   
94330   [
94331     [[link boost_asio.reference.posix__basic_descriptor.cancel [*cancel]]]
94332     [Cancel all asynchronous operations associated with the descriptor. ]
94333   ]
94334   
94335   [
94336     [[link boost_asio.reference.posix__basic_descriptor.close [*close]]]
94337     [Close the descriptor. ]
94338   ]
94339   
94340   [
94341     [[link boost_asio.reference.posix__basic_descriptor.get_executor [*get_executor]]]
94342     [Get the executor associated with the object. ]
94343   ]
94344   
94345   [
94346     [[link boost_asio.reference.posix__basic_descriptor.io_control [*io_control]]]
94347     [Perform an IO control command on the descriptor. ]
94348   ]
94349   
94350   [
94351     [[link boost_asio.reference.posix__basic_descriptor.is_open [*is_open]]]
94352     [Determine whether the descriptor is open. ]
94353   ]
94354   
94355   [
94356     [[link boost_asio.reference.posix__basic_descriptor.lowest_layer [*lowest_layer]]]
94357     [Get a reference to the lowest layer. 
94358      [hr]
94359      Get a const reference to the lowest layer. ]
94360   ]
94361   
94362   [
94363     [[link boost_asio.reference.posix__basic_descriptor.native_handle [*native_handle]]]
94364     [Get the native descriptor representation. ]
94365   ]
94366   
94367   [
94368     [[link boost_asio.reference.posix__basic_descriptor.native_non_blocking [*native_non_blocking]]]
94369     [Gets the non-blocking mode of the native descriptor implementation. 
94370      [hr]
94371      Sets the non-blocking mode of the native descriptor implementation. ]
94372   ]
94373   
94374   [
94375     [[link boost_asio.reference.posix__basic_descriptor.non_blocking [*non_blocking]]]
94376     [Gets the non-blocking mode of the descriptor. 
94377      [hr]
94378      Sets the non-blocking mode of the descriptor. ]
94379   ]
94380   
94381   [
94382     [[link boost_asio.reference.posix__basic_descriptor.operator_eq_ [*operator=]]]
94383     [Move-assign a descriptor from another. ]
94384   ]
94385   
94386   [
94387     [[link boost_asio.reference.posix__basic_descriptor.release [*release]]]
94388     [Release ownership of the native descriptor implementation. ]
94389   ]
94390   
94391   [
94392     [[link boost_asio.reference.posix__basic_descriptor.wait [*wait]]]
94393     [Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
94394   ]
94395   
94396 ]
94397
94398 [heading Protected Member Functions]
94399 [table
94400   [[Name][Description]]
94401
94402   [
94403     [[link boost_asio.reference.posix__basic_descriptor._basic_descriptor [*~basic_descriptor]]]
94404     [Protected destructor to prevent deletion through this type. ]
94405   ]
94406   
94407 ]
94408
94409 [heading Protected Data Members]
94410 [table
94411   [[Name][Description]]
94412
94413   [
94414     [[link boost_asio.reference.posix__basic_descriptor.impl_ [*impl_]]]
94415     []
94416   ]
94417
94418 ]
94419
94420 The [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] class template provides the ability to wrap a POSIX descriptor.
94421
94422
94423 [heading Thread Safety]
94424   
94425 ['Distinct] ['objects:] Safe.
94426
94427 ['Shared] ['objects:] Unsafe. 
94428
94429
94430
94431 [heading Requirements]
94432
94433 ['Header: ][^boost/asio/posix/basic_descriptor.hpp]
94434
94435 ['Convenience header: ][^boost/asio.hpp]
94436
94437 [section:assign posix::basic_descriptor::assign]
94438
94439 [indexterm2 boost_asio.indexterm.posix__basic_descriptor.assign..assign..posix::basic_descriptor] 
94440 Assign an existing native descriptor to the descriptor. 
94441
94442
94443   void ``[link boost_asio.reference.posix__basic_descriptor.assign.overload1 assign]``(
94444       const native_handle_type & native_descriptor);
94445   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.assign.overload1 more...]]``
94446
94447   void ``[link boost_asio.reference.posix__basic_descriptor.assign.overload2 assign]``(
94448       const native_handle_type & native_descriptor,
94449       boost::system::error_code & ec);
94450   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.assign.overload2 more...]]``
94451
94452
94453 [section:overload1 posix::basic_descriptor::assign (1 of 2 overloads)]
94454
94455
94456 Assign an existing native descriptor to the descriptor. 
94457
94458
94459   void assign(
94460       const native_handle_type & native_descriptor);
94461
94462
94463
94464 [endsect]
94465
94466
94467
94468 [section:overload2 posix::basic_descriptor::assign (2 of 2 overloads)]
94469
94470
94471 Assign an existing native descriptor to the descriptor. 
94472
94473
94474   void assign(
94475       const native_handle_type & native_descriptor,
94476       boost::system::error_code & ec);
94477
94478
94479
94480 [endsect]
94481
94482
94483 [endsect]
94484
94485
94486 [section:async_wait posix::basic_descriptor::async_wait]
94487
94488 [indexterm2 boost_asio.indexterm.posix__basic_descriptor.async_wait..async_wait..posix::basic_descriptor] 
94489 Asynchronously wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. 
94490
94491
94492   template<
94493       typename ``[link boost_asio.reference.WaitHandler WaitHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
94494   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait(
94495       wait_type w,
94496       WaitHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
94497
94498
94499 This function is used to perform an asynchronous wait for a descriptor to enter a ready to read, write or error condition state.
94500
94501
94502 [heading Parameters]
94503     
94504
94505 [variablelist
94506   
94507 [[w][Specifies the desired descriptor state.]]
94508
94509 [[handler][The handler to be called when the wait operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
94510 ``
94511    void handler(
94512      const boost::system::error_code& error // Result of operation
94513    ); 
94514 ``
94515 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
94516
94517 ]
94518
94519
94520 [heading Example]
94521   
94522
94523
94524    void wait_handler(const boost::system::error_code& error)
94525    {
94526      if (!error)
94527      {
94528        // Wait succeeded.
94529      }
94530    }
94531
94532    ...
94533
94534    boost::asio::posix::stream_descriptor descriptor(my_context);
94535    ...
94536    descriptor.async_wait(
94537        boost::asio::posix::stream_descriptor::wait_read,
94538        wait_handler);
94539
94540
94541
94542
94543
94544
94545
94546 [endsect]
94547
94548
94549 [section:basic_descriptor posix::basic_descriptor::basic_descriptor]
94550
94551 [indexterm2 boost_asio.indexterm.posix__basic_descriptor.basic_descriptor..basic_descriptor..posix::basic_descriptor] 
94552 Construct a descriptor without opening it. 
94553
94554
94555   explicit ``[link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload1 basic_descriptor]``(
94556       const executor_type & ex);
94557   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload1 more...]]``
94558
94559   template<
94560       typename ExecutionContext>
94561   explicit ``[link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload2 basic_descriptor]``(
94562       ExecutionContext & context,
94563       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
94564   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload2 more...]]``
94565
94566
94567 Construct a descriptor on an existing native descriptor. 
94568
94569
94570   ``[link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload3 basic_descriptor]``(
94571       const executor_type & ex,
94572       const native_handle_type & native_descriptor);
94573   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload3 more...]]``
94574
94575   template<
94576       typename ExecutionContext>
94577   ``[link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload4 basic_descriptor]``(
94578       ExecutionContext & context,
94579       const native_handle_type & native_descriptor,
94580       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
94581   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload4 more...]]``
94582
94583
94584 Move-construct a descriptor from another. 
94585
94586
94587   ``[link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload5 basic_descriptor]``(
94588       basic_descriptor && other);
94589   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload5 more...]]``
94590
94591
94592 [section:overload1 posix::basic_descriptor::basic_descriptor (1 of 5 overloads)]
94593
94594
94595 Construct a descriptor without opening it. 
94596
94597
94598   basic_descriptor(
94599       const executor_type & ex);
94600
94601
94602 This constructor creates a descriptor without opening it.
94603
94604
94605 [heading Parameters]
94606     
94607
94608 [variablelist
94609   
94610 [[ex][The I/O executor that the descriptor will use, by default, to dispatch handlers for any asynchronous operations performed on the descriptor. ]]
94611
94612 ]
94613
94614
94615
94616
94617 [endsect]
94618
94619
94620
94621 [section:overload2 posix::basic_descriptor::basic_descriptor (2 of 5 overloads)]
94622
94623
94624 Construct a descriptor without opening it. 
94625
94626
94627   template<
94628       typename ExecutionContext>
94629   basic_descriptor(
94630       ExecutionContext & context,
94631       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
94632
94633
94634 This constructor creates a descriptor without opening it.
94635
94636
94637 [heading Parameters]
94638     
94639
94640 [variablelist
94641   
94642 [[context][An execution context which provides the I/O executor that the descriptor will use, by default, to dispatch handlers for any asynchronous operations performed on the descriptor. ]]
94643
94644 ]
94645
94646
94647
94648
94649 [endsect]
94650
94651
94652
94653 [section:overload3 posix::basic_descriptor::basic_descriptor (3 of 5 overloads)]
94654
94655
94656 Construct a descriptor on an existing native descriptor. 
94657
94658
94659   basic_descriptor(
94660       const executor_type & ex,
94661       const native_handle_type & native_descriptor);
94662
94663
94664 This constructor creates a descriptor object to hold an existing native descriptor.
94665
94666
94667 [heading Parameters]
94668     
94669
94670 [variablelist
94671   
94672 [[ex][The I/O executor that the descriptor will use, by default, to dispatch handlers for any asynchronous operations performed on the descriptor.]]
94673
94674 [[native_descriptor][A native descriptor.]]
94675
94676 ]
94677
94678
94679 [heading Exceptions]
94680     
94681
94682 [variablelist
94683   
94684 [[boost::system::system_error][Thrown on failure. ]]
94685
94686 ]
94687
94688
94689
94690
94691 [endsect]
94692
94693
94694
94695 [section:overload4 posix::basic_descriptor::basic_descriptor (4 of 5 overloads)]
94696
94697
94698 Construct a descriptor on an existing native descriptor. 
94699
94700
94701   template<
94702       typename ExecutionContext>
94703   basic_descriptor(
94704       ExecutionContext & context,
94705       const native_handle_type & native_descriptor,
94706       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
94707
94708
94709 This constructor creates a descriptor object to hold an existing native descriptor.
94710
94711
94712 [heading Parameters]
94713     
94714
94715 [variablelist
94716   
94717 [[context][An execution context which provides the I/O executor that the descriptor will use, by default, to dispatch handlers for any asynchronous operations performed on the descriptor.]]
94718
94719 [[native_descriptor][A native descriptor.]]
94720
94721 ]
94722
94723
94724 [heading Exceptions]
94725     
94726
94727 [variablelist
94728   
94729 [[boost::system::system_error][Thrown on failure. ]]
94730
94731 ]
94732
94733
94734
94735
94736 [endsect]
94737
94738
94739
94740 [section:overload5 posix::basic_descriptor::basic_descriptor (5 of 5 overloads)]
94741
94742
94743 Move-construct a descriptor from another. 
94744
94745
94746   basic_descriptor(
94747       basic_descriptor && other);
94748
94749
94750 This constructor moves a descriptor from one object to another.
94751
94752
94753 [heading Parameters]
94754     
94755
94756 [variablelist
94757   
94758 [[other][The other descriptor object from which the move will occur.]]
94759
94760 ]
94761
94762
94763 [heading Remarks]
94764       
94765 Following the move, the moved-from object is in the same state as if constructed using the `basic_descriptor(const executor_type&)` constructor. 
94766
94767
94768
94769
94770 [endsect]
94771
94772
94773 [endsect]
94774
94775
94776 [section:bytes_readable posix::basic_descriptor::bytes_readable]
94777
94778
94779 ['Inherited from posix::descriptor_base.]
94780
94781 [indexterm2 boost_asio.indexterm.posix__basic_descriptor.bytes_readable..bytes_readable..posix::basic_descriptor] 
94782 IO control command to get the amount of data that can be read without blocking. 
94783
94784
94785   typedef implementation_defined bytes_readable;
94786
94787
94788
94789 Implements the FIONREAD IO control command.
94790
94791
94792 [heading Example]
94793   
94794
94795
94796    boost::asio::posix::stream_descriptor descriptor(my_context);
94797    ...
94798    boost::asio::descriptor_base::bytes_readable command(true);
94799    descriptor.io_control(command);
94800    std::size_t bytes_readable = command.get();
94801
94802
94803
94804
94805
94806
94807
94808 [heading Requirements]
94809
94810 ['Header: ][^boost/asio/posix/basic_descriptor.hpp]
94811
94812 ['Convenience header: ][^boost/asio.hpp]
94813
94814
94815 [endsect]
94816
94817
94818 [section:cancel posix::basic_descriptor::cancel]
94819
94820 [indexterm2 boost_asio.indexterm.posix__basic_descriptor.cancel..cancel..posix::basic_descriptor] 
94821 Cancel all asynchronous operations associated with the descriptor. 
94822
94823
94824   void ``[link boost_asio.reference.posix__basic_descriptor.cancel.overload1 cancel]``();
94825   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.cancel.overload1 more...]]``
94826
94827   void ``[link boost_asio.reference.posix__basic_descriptor.cancel.overload2 cancel]``(
94828       boost::system::error_code & ec);
94829   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.cancel.overload2 more...]]``
94830
94831
94832 [section:overload1 posix::basic_descriptor::cancel (1 of 2 overloads)]
94833
94834
94835 Cancel all asynchronous operations associated with the descriptor. 
94836
94837
94838   void cancel();
94839
94840
94841 This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
94842
94843
94844 [heading Exceptions]
94845     
94846
94847 [variablelist
94848   
94849 [[boost::system::system_error][Thrown on failure. ]]
94850
94851 ]
94852
94853
94854
94855
94856 [endsect]
94857
94858
94859
94860 [section:overload2 posix::basic_descriptor::cancel (2 of 2 overloads)]
94861
94862
94863 Cancel all asynchronous operations associated with the descriptor. 
94864
94865
94866   void cancel(
94867       boost::system::error_code & ec);
94868
94869
94870 This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
94871
94872
94873 [heading Parameters]
94874     
94875
94876 [variablelist
94877   
94878 [[ec][Set to indicate what error occurred, if any. ]]
94879
94880 ]
94881
94882
94883
94884
94885 [endsect]
94886
94887
94888 [endsect]
94889
94890 [section:close posix::basic_descriptor::close]
94891
94892 [indexterm2 boost_asio.indexterm.posix__basic_descriptor.close..close..posix::basic_descriptor] 
94893 Close the descriptor. 
94894
94895
94896   void ``[link boost_asio.reference.posix__basic_descriptor.close.overload1 close]``();
94897   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.close.overload1 more...]]``
94898
94899   void ``[link boost_asio.reference.posix__basic_descriptor.close.overload2 close]``(
94900       boost::system::error_code & ec);
94901   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.close.overload2 more...]]``
94902
94903
94904 [section:overload1 posix::basic_descriptor::close (1 of 2 overloads)]
94905
94906
94907 Close the descriptor. 
94908
94909
94910   void close();
94911
94912
94913 This function is used to close the descriptor. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
94914
94915
94916 [heading Exceptions]
94917     
94918
94919 [variablelist
94920   
94921 [[boost::system::system_error][Thrown on failure. Note that, even if the function indicates an error, the underlying descriptor is closed. ]]
94922
94923 ]
94924
94925
94926
94927
94928 [endsect]
94929
94930
94931
94932 [section:overload2 posix::basic_descriptor::close (2 of 2 overloads)]
94933
94934
94935 Close the descriptor. 
94936
94937
94938   void close(
94939       boost::system::error_code & ec);
94940
94941
94942 This function is used to close the descriptor. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
94943
94944
94945 [heading Parameters]
94946     
94947
94948 [variablelist
94949   
94950 [[ec][Set to indicate what error occurred, if any. Note that, even if the function indicates an error, the underlying descriptor is closed. ]]
94951
94952 ]
94953
94954
94955
94956
94957 [endsect]
94958
94959
94960 [endsect]
94961
94962
94963 [section:executor_type posix::basic_descriptor::executor_type]
94964
94965 [indexterm2 boost_asio.indexterm.posix__basic_descriptor.executor_type..executor_type..posix::basic_descriptor] 
94966 The type of the executor associated with the object. 
94967
94968
94969   typedef Executor executor_type;
94970
94971
94972
94973 [heading Requirements]
94974
94975 ['Header: ][^boost/asio/posix/basic_descriptor.hpp]
94976
94977 ['Convenience header: ][^boost/asio.hpp]
94978
94979
94980 [endsect]
94981
94982
94983
94984 [section:get_executor posix::basic_descriptor::get_executor]
94985
94986 [indexterm2 boost_asio.indexterm.posix__basic_descriptor.get_executor..get_executor..posix::basic_descriptor] 
94987 Get the executor associated with the object. 
94988
94989
94990   executor_type get_executor();
94991
94992
94993
94994 [endsect]
94995
94996
94997
94998 [section:impl_ posix::basic_descriptor::impl_]
94999
95000 [indexterm2 boost_asio.indexterm.posix__basic_descriptor.impl_..impl_..posix::basic_descriptor] 
95001
95002   detail::io_object_impl< detail::reactive_descriptor_service, Executor > impl_;
95003
95004
95005
95006 [endsect]
95007
95008
95009 [section:io_control posix::basic_descriptor::io_control]
95010
95011 [indexterm2 boost_asio.indexterm.posix__basic_descriptor.io_control..io_control..posix::basic_descriptor] 
95012 Perform an IO control command on the descriptor. 
95013
95014
95015   template<
95016       typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
95017   void ``[link boost_asio.reference.posix__basic_descriptor.io_control.overload1 io_control]``(
95018       IoControlCommand & command);
95019   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.io_control.overload1 more...]]``
95020
95021   template<
95022       typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
95023   void ``[link boost_asio.reference.posix__basic_descriptor.io_control.overload2 io_control]``(
95024       IoControlCommand & command,
95025       boost::system::error_code & ec);
95026   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.io_control.overload2 more...]]``
95027
95028
95029 [section:overload1 posix::basic_descriptor::io_control (1 of 2 overloads)]
95030
95031
95032 Perform an IO control command on the descriptor. 
95033
95034
95035   template<
95036       typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
95037   void io_control(
95038       IoControlCommand & command);
95039
95040
95041 This function is used to execute an IO control command on the descriptor.
95042
95043
95044 [heading Parameters]
95045     
95046
95047 [variablelist
95048   
95049 [[command][The IO control command to be performed on the descriptor.]]
95050
95051 ]
95052
95053
95054 [heading Exceptions]
95055     
95056
95057 [variablelist
95058   
95059 [[boost::system::system_error][Thrown on failure.]]
95060
95061 ]
95062
95063
95064
95065 [heading Example]
95066   
95067 Getting the number of bytes ready to read: 
95068
95069    boost::asio::posix::stream_descriptor descriptor(my_context);
95070    ...
95071    boost::asio::posix::stream_descriptor::bytes_readable command;
95072    descriptor.io_control(command);
95073    std::size_t bytes_readable = command.get();
95074
95075
95076
95077
95078
95079
95080
95081 [endsect]
95082
95083
95084
95085 [section:overload2 posix::basic_descriptor::io_control (2 of 2 overloads)]
95086
95087
95088 Perform an IO control command on the descriptor. 
95089
95090
95091   template<
95092       typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
95093   void io_control(
95094       IoControlCommand & command,
95095       boost::system::error_code & ec);
95096
95097
95098 This function is used to execute an IO control command on the descriptor.
95099
95100
95101 [heading Parameters]
95102     
95103
95104 [variablelist
95105   
95106 [[command][The IO control command to be performed on the descriptor.]]
95107
95108 [[ec][Set to indicate what error occurred, if any.]]
95109
95110 ]
95111
95112
95113
95114 [heading Example]
95115   
95116 Getting the number of bytes ready to read: 
95117
95118    boost::asio::posix::stream_descriptor descriptor(my_context);
95119    ...
95120    boost::asio::posix::stream_descriptor::bytes_readable command;
95121    boost::system::error_code ec;
95122    descriptor.io_control(command, ec);
95123    if (ec)
95124    {
95125      // An error occurred.
95126    }
95127    std::size_t bytes_readable = command.get();
95128
95129
95130
95131
95132
95133
95134
95135 [endsect]
95136
95137
95138 [endsect]
95139
95140
95141 [section:is_open posix::basic_descriptor::is_open]
95142
95143 [indexterm2 boost_asio.indexterm.posix__basic_descriptor.is_open..is_open..posix::basic_descriptor] 
95144 Determine whether the descriptor is open. 
95145
95146
95147   bool is_open() const;
95148
95149
95150
95151 [endsect]
95152
95153
95154 [section:lowest_layer posix::basic_descriptor::lowest_layer]
95155
95156 [indexterm2 boost_asio.indexterm.posix__basic_descriptor.lowest_layer..lowest_layer..posix::basic_descriptor] 
95157 Get a reference to the lowest layer. 
95158
95159
95160   lowest_layer_type & ``[link boost_asio.reference.posix__basic_descriptor.lowest_layer.overload1 lowest_layer]``();
95161   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.lowest_layer.overload1 more...]]``
95162
95163
95164 Get a const reference to the lowest layer. 
95165
95166
95167   const lowest_layer_type & ``[link boost_asio.reference.posix__basic_descriptor.lowest_layer.overload2 lowest_layer]``() const;
95168   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.lowest_layer.overload2 more...]]``
95169
95170
95171 [section:overload1 posix::basic_descriptor::lowest_layer (1 of 2 overloads)]
95172
95173
95174 Get a reference to the lowest layer. 
95175
95176
95177   lowest_layer_type & lowest_layer();
95178
95179
95180 This function returns a reference to the lowest layer in a stack of layers. Since a descriptor cannot contain any further layers, it simply returns a reference to itself.
95181
95182
95183 [heading Return Value]
95184       
95185 A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 
95186
95187
95188
95189
95190 [endsect]
95191
95192
95193
95194 [section:overload2 posix::basic_descriptor::lowest_layer (2 of 2 overloads)]
95195
95196
95197 Get a const reference to the lowest layer. 
95198
95199
95200   const lowest_layer_type & lowest_layer() const;
95201
95202
95203 This function returns a const reference to the lowest layer in a stack of layers. Since a descriptor cannot contain any further layers, it simply returns a reference to itself.
95204
95205
95206 [heading Return Value]
95207       
95208 A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 
95209
95210
95211
95212
95213 [endsect]
95214
95215
95216 [endsect]
95217
95218
95219 [section:lowest_layer_type posix::basic_descriptor::lowest_layer_type]
95220
95221 [indexterm2 boost_asio.indexterm.posix__basic_descriptor.lowest_layer_type..lowest_layer_type..posix::basic_descriptor] 
95222 A descriptor is always the lowest layer. 
95223
95224
95225   typedef basic_descriptor lowest_layer_type;
95226
95227
95228 [heading Types]
95229 [table
95230   [[Name][Description]]
95231
95232   [
95233
95234     [[link boost_asio.reference.posix__basic_descriptor__rebind_executor [*rebind_executor]]]
95235     [Rebinds the descriptor type to another executor. ]
95236   
95237   ]
95238
95239   [
95240
95241     [[link boost_asio.reference.posix__basic_descriptor.bytes_readable [*bytes_readable]]]
95242     [IO control command to get the amount of data that can be read without blocking. ]
95243   
95244   ]
95245
95246   [
95247
95248     [[link boost_asio.reference.posix__basic_descriptor.executor_type [*executor_type]]]
95249     [The type of the executor associated with the object. ]
95250   
95251   ]
95252
95253   [
95254
95255     [[link boost_asio.reference.posix__basic_descriptor.lowest_layer_type [*lowest_layer_type]]]
95256     [A descriptor is always the lowest layer. ]
95257   
95258   ]
95259
95260   [
95261
95262     [[link boost_asio.reference.posix__basic_descriptor.native_handle_type [*native_handle_type]]]
95263     [The native representation of a descriptor. ]
95264   
95265   ]
95266
95267   [
95268
95269     [[link boost_asio.reference.posix__basic_descriptor.wait_type [*wait_type]]]
95270     [Wait types. ]
95271   
95272   ]
95273
95274 ]
95275
95276 [heading Member Functions]
95277 [table
95278   [[Name][Description]]
95279
95280   [
95281     [[link boost_asio.reference.posix__basic_descriptor.assign [*assign]]]
95282     [Assign an existing native descriptor to the descriptor. ]
95283   ]
95284   
95285   [
95286     [[link boost_asio.reference.posix__basic_descriptor.async_wait [*async_wait]]]
95287     [Asynchronously wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
95288   ]
95289   
95290   [
95291     [[link boost_asio.reference.posix__basic_descriptor.basic_descriptor [*basic_descriptor]]]
95292     [Construct a descriptor without opening it. 
95293      [hr]
95294      Construct a descriptor on an existing native descriptor. 
95295      [hr]
95296      Move-construct a descriptor from another. ]
95297   ]
95298   
95299   [
95300     [[link boost_asio.reference.posix__basic_descriptor.cancel [*cancel]]]
95301     [Cancel all asynchronous operations associated with the descriptor. ]
95302   ]
95303   
95304   [
95305     [[link boost_asio.reference.posix__basic_descriptor.close [*close]]]
95306     [Close the descriptor. ]
95307   ]
95308   
95309   [
95310     [[link boost_asio.reference.posix__basic_descriptor.get_executor [*get_executor]]]
95311     [Get the executor associated with the object. ]
95312   ]
95313   
95314   [
95315     [[link boost_asio.reference.posix__basic_descriptor.io_control [*io_control]]]
95316     [Perform an IO control command on the descriptor. ]
95317   ]
95318   
95319   [
95320     [[link boost_asio.reference.posix__basic_descriptor.is_open [*is_open]]]
95321     [Determine whether the descriptor is open. ]
95322   ]
95323   
95324   [
95325     [[link boost_asio.reference.posix__basic_descriptor.lowest_layer [*lowest_layer]]]
95326     [Get a reference to the lowest layer. 
95327      [hr]
95328      Get a const reference to the lowest layer. ]
95329   ]
95330   
95331   [
95332     [[link boost_asio.reference.posix__basic_descriptor.native_handle [*native_handle]]]
95333     [Get the native descriptor representation. ]
95334   ]
95335   
95336   [
95337     [[link boost_asio.reference.posix__basic_descriptor.native_non_blocking [*native_non_blocking]]]
95338     [Gets the non-blocking mode of the native descriptor implementation. 
95339      [hr]
95340      Sets the non-blocking mode of the native descriptor implementation. ]
95341   ]
95342   
95343   [
95344     [[link boost_asio.reference.posix__basic_descriptor.non_blocking [*non_blocking]]]
95345     [Gets the non-blocking mode of the descriptor. 
95346      [hr]
95347      Sets the non-blocking mode of the descriptor. ]
95348   ]
95349   
95350   [
95351     [[link boost_asio.reference.posix__basic_descriptor.operator_eq_ [*operator=]]]
95352     [Move-assign a descriptor from another. ]
95353   ]
95354   
95355   [
95356     [[link boost_asio.reference.posix__basic_descriptor.release [*release]]]
95357     [Release ownership of the native descriptor implementation. ]
95358   ]
95359   
95360   [
95361     [[link boost_asio.reference.posix__basic_descriptor.wait [*wait]]]
95362     [Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
95363   ]
95364   
95365 ]
95366
95367 [heading Protected Member Functions]
95368 [table
95369   [[Name][Description]]
95370
95371   [
95372     [[link boost_asio.reference.posix__basic_descriptor._basic_descriptor [*~basic_descriptor]]]
95373     [Protected destructor to prevent deletion through this type. ]
95374   ]
95375   
95376 ]
95377
95378 [heading Protected Data Members]
95379 [table
95380   [[Name][Description]]
95381
95382   [
95383     [[link boost_asio.reference.posix__basic_descriptor.impl_ [*impl_]]]
95384     []
95385   ]
95386
95387 ]
95388
95389 The [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] class template provides the ability to wrap a POSIX descriptor.
95390
95391
95392 [heading Thread Safety]
95393   
95394 ['Distinct] ['objects:] Safe.
95395
95396 ['Shared] ['objects:] Unsafe. 
95397
95398
95399
95400
95401 [heading Requirements]
95402
95403 ['Header: ][^boost/asio/posix/basic_descriptor.hpp]
95404
95405 ['Convenience header: ][^boost/asio.hpp]
95406
95407
95408 [endsect]
95409
95410
95411
95412 [section:native_handle posix::basic_descriptor::native_handle]
95413
95414 [indexterm2 boost_asio.indexterm.posix__basic_descriptor.native_handle..native_handle..posix::basic_descriptor] 
95415 Get the native descriptor representation. 
95416
95417
95418   native_handle_type native_handle();
95419
95420
95421 This function may be used to obtain the underlying representation of the descriptor. This is intended to allow access to native descriptor functionality that is not otherwise provided. 
95422
95423
95424 [endsect]
95425
95426
95427
95428 [section:native_handle_type posix::basic_descriptor::native_handle_type]
95429
95430 [indexterm2 boost_asio.indexterm.posix__basic_descriptor.native_handle_type..native_handle_type..posix::basic_descriptor] 
95431 The native representation of a descriptor. 
95432
95433
95434   typedef implementation_defined native_handle_type;
95435
95436
95437
95438 [heading Requirements]
95439
95440 ['Header: ][^boost/asio/posix/basic_descriptor.hpp]
95441
95442 ['Convenience header: ][^boost/asio.hpp]
95443
95444
95445 [endsect]
95446
95447
95448 [section:native_non_blocking posix::basic_descriptor::native_non_blocking]
95449
95450 [indexterm2 boost_asio.indexterm.posix__basic_descriptor.native_non_blocking..native_non_blocking..posix::basic_descriptor] 
95451 Gets the non-blocking mode of the native descriptor implementation. 
95452
95453
95454   bool ``[link boost_asio.reference.posix__basic_descriptor.native_non_blocking.overload1 native_non_blocking]``() const;
95455   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.native_non_blocking.overload1 more...]]``
95456
95457
95458 Sets the non-blocking mode of the native descriptor implementation. 
95459
95460
95461   void ``[link boost_asio.reference.posix__basic_descriptor.native_non_blocking.overload2 native_non_blocking]``(
95462       bool mode);
95463   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.native_non_blocking.overload2 more...]]``
95464
95465   void ``[link boost_asio.reference.posix__basic_descriptor.native_non_blocking.overload3 native_non_blocking]``(
95466       bool mode,
95467       boost::system::error_code & ec);
95468   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.native_non_blocking.overload3 more...]]``
95469
95470
95471 [section:overload1 posix::basic_descriptor::native_non_blocking (1 of 3 overloads)]
95472
95473
95474 Gets the non-blocking mode of the native descriptor implementation. 
95475
95476
95477   bool native_non_blocking() const;
95478
95479
95480 This function is used to retrieve the non-blocking mode of the underlying native descriptor. This mode has no effect on the behaviour of the descriptor object's synchronous operations.
95481
95482
95483 [heading Return Value]
95484       
95485 `true` if the underlying descriptor is in non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).
95486
95487
95488 [heading Remarks]
95489       
95490 The current non-blocking mode is cached by the descriptor object. Consequently, the return value may be incorrect if the non-blocking mode was set directly on the native descriptor. 
95491
95492
95493
95494
95495 [endsect]
95496
95497
95498
95499 [section:overload2 posix::basic_descriptor::native_non_blocking (2 of 3 overloads)]
95500
95501
95502 Sets the non-blocking mode of the native descriptor implementation. 
95503
95504
95505   void native_non_blocking(
95506       bool mode);
95507
95508
95509 This function is used to modify the non-blocking mode of the underlying native descriptor. It has no effect on the behaviour of the descriptor object's synchronous operations.
95510
95511
95512 [heading Parameters]
95513     
95514
95515 [variablelist
95516   
95517 [[mode][If `true`, the underlying descriptor is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]]
95518
95519 ]
95520
95521
95522 [heading Exceptions]
95523     
95524
95525 [variablelist
95526   
95527 [[boost::system::system_error][Thrown on failure. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense. ]]
95528
95529 ]
95530
95531
95532
95533
95534 [endsect]
95535
95536
95537
95538 [section:overload3 posix::basic_descriptor::native_non_blocking (3 of 3 overloads)]
95539
95540
95541 Sets the non-blocking mode of the native descriptor implementation. 
95542
95543
95544   void native_non_blocking(
95545       bool mode,
95546       boost::system::error_code & ec);
95547
95548
95549 This function is used to modify the non-blocking mode of the underlying native descriptor. It has no effect on the behaviour of the descriptor object's synchronous operations.
95550
95551
95552 [heading Parameters]
95553     
95554
95555 [variablelist
95556   
95557 [[mode][If `true`, the underlying descriptor is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]]
95558
95559 [[ec][Set to indicate what error occurred, if any. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense. ]]
95560
95561 ]
95562
95563
95564
95565
95566 [endsect]
95567
95568
95569 [endsect]
95570
95571 [section:non_blocking posix::basic_descriptor::non_blocking]
95572
95573 [indexterm2 boost_asio.indexterm.posix__basic_descriptor.non_blocking..non_blocking..posix::basic_descriptor] 
95574 Gets the non-blocking mode of the descriptor. 
95575
95576
95577   bool ``[link boost_asio.reference.posix__basic_descriptor.non_blocking.overload1 non_blocking]``() const;
95578   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.non_blocking.overload1 more...]]``
95579
95580
95581 Sets the non-blocking mode of the descriptor. 
95582
95583
95584   void ``[link boost_asio.reference.posix__basic_descriptor.non_blocking.overload2 non_blocking]``(
95585       bool mode);
95586   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.non_blocking.overload2 more...]]``
95587
95588   void ``[link boost_asio.reference.posix__basic_descriptor.non_blocking.overload3 non_blocking]``(
95589       bool mode,
95590       boost::system::error_code & ec);
95591   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.non_blocking.overload3 more...]]``
95592
95593
95594 [section:overload1 posix::basic_descriptor::non_blocking (1 of 3 overloads)]
95595
95596
95597 Gets the non-blocking mode of the descriptor. 
95598
95599
95600   bool non_blocking() const;
95601
95602
95603
95604 [heading Return Value]
95605       
95606 `true` if the descriptor's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.
95607
95608
95609 [heading Remarks]
95610       
95611 The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`. 
95612
95613
95614
95615
95616 [endsect]
95617
95618
95619
95620 [section:overload2 posix::basic_descriptor::non_blocking (2 of 3 overloads)]
95621
95622
95623 Sets the non-blocking mode of the descriptor. 
95624
95625
95626   void non_blocking(
95627       bool mode);
95628
95629
95630
95631 [heading Parameters]
95632     
95633
95634 [variablelist
95635   
95636 [[mode][If `true`, the descriptor's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]]
95637
95638 ]
95639
95640
95641 [heading Exceptions]
95642     
95643
95644 [variablelist
95645   
95646 [[boost::system::system_error][Thrown on failure.]]
95647
95648 ]
95649
95650
95651 [heading Remarks]
95652       
95653 The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`. 
95654
95655
95656
95657
95658 [endsect]
95659
95660
95661
95662 [section:overload3 posix::basic_descriptor::non_blocking (3 of 3 overloads)]
95663
95664
95665 Sets the non-blocking mode of the descriptor. 
95666
95667
95668   void non_blocking(
95669       bool mode,
95670       boost::system::error_code & ec);
95671
95672
95673
95674 [heading Parameters]
95675     
95676
95677 [variablelist
95678   
95679 [[mode][If `true`, the descriptor's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]]
95680
95681 [[ec][Set to indicate what error occurred, if any.]]
95682
95683 ]
95684
95685
95686 [heading Remarks]
95687       
95688 The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`. 
95689
95690
95691
95692
95693 [endsect]
95694
95695
95696 [endsect]
95697
95698
95699 [section:operator_eq_ posix::basic_descriptor::operator=]
95700
95701 [indexterm2 boost_asio.indexterm.posix__basic_descriptor.operator_eq_..operator=..posix::basic_descriptor] 
95702 Move-assign a descriptor from another. 
95703
95704
95705   basic_descriptor & operator=(
95706       basic_descriptor && other);
95707
95708
95709 This assignment operator moves a descriptor from one object to another.
95710
95711
95712 [heading Parameters]
95713     
95714
95715 [variablelist
95716   
95717 [[other][The other descriptor object from which the move will occur.]]
95718
95719 ]
95720
95721
95722 [heading Remarks]
95723       
95724 Following the move, the moved-from object is in the same state as if constructed using the `basic_descriptor(const executor_type&)` constructor. 
95725
95726
95727
95728
95729 [endsect]
95730
95731
95732
95733 [section:release posix::basic_descriptor::release]
95734
95735 [indexterm2 boost_asio.indexterm.posix__basic_descriptor.release..release..posix::basic_descriptor] 
95736 Release ownership of the native descriptor implementation. 
95737
95738
95739   native_handle_type release();
95740
95741
95742 This function may be used to obtain the underlying representation of the descriptor. After calling this function, `is_open()` returns false. The caller is responsible for closing the descriptor.
95743
95744 All outstanding asynchronous read or write operations will finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error. 
95745
95746
95747 [endsect]
95748
95749
95750 [section:wait posix::basic_descriptor::wait]
95751
95752 [indexterm2 boost_asio.indexterm.posix__basic_descriptor.wait..wait..posix::basic_descriptor] 
95753 Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. 
95754
95755
95756   void ``[link boost_asio.reference.posix__basic_descriptor.wait.overload1 wait]``(
95757       wait_type w);
95758   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.wait.overload1 more...]]``
95759
95760   void ``[link boost_asio.reference.posix__basic_descriptor.wait.overload2 wait]``(
95761       wait_type w,
95762       boost::system::error_code & ec);
95763   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.wait.overload2 more...]]``
95764
95765
95766 [section:overload1 posix::basic_descriptor::wait (1 of 2 overloads)]
95767
95768
95769 Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. 
95770
95771
95772   void wait(
95773       wait_type w);
95774
95775
95776 This function is used to perform a blocking wait for a descriptor to enter a ready to read, write or error condition state.
95777
95778
95779 [heading Parameters]
95780     
95781
95782 [variablelist
95783   
95784 [[w][Specifies the desired descriptor state.]]
95785
95786 ]
95787
95788
95789 [heading Example]
95790   
95791 Waiting for a descriptor to become readable. 
95792
95793    boost::asio::posix::stream_descriptor descriptor(my_context);
95794    ...
95795    descriptor.wait(boost::asio::posix::stream_descriptor::wait_read);
95796
95797
95798
95799
95800
95801
95802
95803 [endsect]
95804
95805
95806
95807 [section:overload2 posix::basic_descriptor::wait (2 of 2 overloads)]
95808
95809
95810 Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. 
95811
95812
95813   void wait(
95814       wait_type w,
95815       boost::system::error_code & ec);
95816
95817
95818 This function is used to perform a blocking wait for a descriptor to enter a ready to read, write or error condition state.
95819
95820
95821 [heading Parameters]
95822     
95823
95824 [variablelist
95825   
95826 [[w][Specifies the desired descriptor state.]]
95827
95828 [[ec][Set to indicate what error occurred, if any.]]
95829
95830 ]
95831
95832
95833 [heading Example]
95834   
95835 Waiting for a descriptor to become readable. 
95836
95837    boost::asio::posix::stream_descriptor descriptor(my_context);
95838    ...
95839    boost::system::error_code ec;
95840    descriptor.wait(boost::asio::posix::stream_descriptor::wait_read, ec);
95841
95842
95843
95844
95845
95846
95847
95848 [endsect]
95849
95850
95851 [endsect]
95852
95853
95854 [section:wait_type posix::basic_descriptor::wait_type]
95855
95856
95857 ['Inherited from posix::descriptor_base.]
95858
95859 [indexterm2 boost_asio.indexterm.posix__basic_descriptor.wait_type..wait_type..posix::basic_descriptor] 
95860 Wait types. 
95861
95862
95863   enum wait_type
95864
95865 [indexterm2 boost_asio.indexterm.posix__basic_descriptor.wait_type.wait_read..wait_read..posix::basic_descriptor]
95866 [indexterm2 boost_asio.indexterm.posix__basic_descriptor.wait_type.wait_write..wait_write..posix::basic_descriptor]
95867 [indexterm2 boost_asio.indexterm.posix__basic_descriptor.wait_type.wait_error..wait_error..posix::basic_descriptor]
95868
95869 [heading Values]
95870 [variablelist
95871
95872   [
95873     [wait_read]
95874     [Wait for a descriptor to become ready to read. ]
95875   ]
95876
95877   [
95878     [wait_write]
95879     [Wait for a descriptor to become ready to write. ]
95880   ]
95881
95882   [
95883     [wait_error]
95884     [Wait for a descriptor to have error conditions pending. ]
95885   ]
95886
95887 ]
95888
95889
95890 For use with `descriptor::wait()` and `descriptor::async_wait()`. 
95891
95892
95893 [endsect]
95894
95895
95896
95897 [section:_basic_descriptor posix::basic_descriptor::~basic_descriptor]
95898
95899 [indexterm2 boost_asio.indexterm.posix__basic_descriptor._basic_descriptor..~basic_descriptor..posix::basic_descriptor] 
95900 Protected destructor to prevent deletion through this type. 
95901
95902
95903   ~basic_descriptor();
95904
95905
95906 This function destroys the descriptor, cancelling any outstanding asynchronous wait operations associated with the descriptor as if by calling `cancel`. 
95907
95908
95909 [endsect]
95910
95911
95912
95913 [endsect]
95914
95915 [section:posix__basic_descriptor__rebind_executor posix::basic_descriptor::rebind_executor]
95916
95917
95918 Rebinds the descriptor type to another executor. 
95919
95920
95921   template<
95922       typename ``[link boost_asio.reference.Executor1 Executor1]``>
95923   struct rebind_executor
95924
95925
95926 [heading Types]
95927 [table
95928   [[Name][Description]]
95929
95930   [
95931
95932     [[link boost_asio.reference.posix__basic_descriptor__rebind_executor.other [*other]]]
95933     [The descriptor type when rebound to the specified executor. ]
95934   
95935   ]
95936
95937 ]
95938
95939 [heading Requirements]
95940
95941 ['Header: ][^boost/asio/posix/basic_descriptor.hpp]
95942
95943 ['Convenience header: ][^boost/asio.hpp]
95944
95945
95946 [section:other posix::basic_descriptor::rebind_executor::other]
95947
95948 [indexterm2 boost_asio.indexterm.posix__basic_descriptor__rebind_executor.other..other..posix::basic_descriptor::rebind_executor] 
95949 The descriptor type when rebound to the specified executor. 
95950
95951
95952   typedef basic_descriptor< Executor1 > other;
95953
95954
95955 [heading Types]
95956 [table
95957   [[Name][Description]]
95958
95959   [
95960
95961     [[link boost_asio.reference.posix__basic_descriptor__rebind_executor [*rebind_executor]]]
95962     [Rebinds the descriptor type to another executor. ]
95963   
95964   ]
95965
95966   [
95967
95968     [[link boost_asio.reference.posix__basic_descriptor.bytes_readable [*bytes_readable]]]
95969     [IO control command to get the amount of data that can be read without blocking. ]
95970   
95971   ]
95972
95973   [
95974
95975     [[link boost_asio.reference.posix__basic_descriptor.executor_type [*executor_type]]]
95976     [The type of the executor associated with the object. ]
95977   
95978   ]
95979
95980   [
95981
95982     [[link boost_asio.reference.posix__basic_descriptor.lowest_layer_type [*lowest_layer_type]]]
95983     [A descriptor is always the lowest layer. ]
95984   
95985   ]
95986
95987   [
95988
95989     [[link boost_asio.reference.posix__basic_descriptor.native_handle_type [*native_handle_type]]]
95990     [The native representation of a descriptor. ]
95991   
95992   ]
95993
95994   [
95995
95996     [[link boost_asio.reference.posix__basic_descriptor.wait_type [*wait_type]]]
95997     [Wait types. ]
95998   
95999   ]
96000
96001 ]
96002
96003 [heading Member Functions]
96004 [table
96005   [[Name][Description]]
96006
96007   [
96008     [[link boost_asio.reference.posix__basic_descriptor.assign [*assign]]]
96009     [Assign an existing native descriptor to the descriptor. ]
96010   ]
96011   
96012   [
96013     [[link boost_asio.reference.posix__basic_descriptor.async_wait [*async_wait]]]
96014     [Asynchronously wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
96015   ]
96016   
96017   [
96018     [[link boost_asio.reference.posix__basic_descriptor.basic_descriptor [*basic_descriptor]]]
96019     [Construct a descriptor without opening it. 
96020      [hr]
96021      Construct a descriptor on an existing native descriptor. 
96022      [hr]
96023      Move-construct a descriptor from another. ]
96024   ]
96025   
96026   [
96027     [[link boost_asio.reference.posix__basic_descriptor.cancel [*cancel]]]
96028     [Cancel all asynchronous operations associated with the descriptor. ]
96029   ]
96030   
96031   [
96032     [[link boost_asio.reference.posix__basic_descriptor.close [*close]]]
96033     [Close the descriptor. ]
96034   ]
96035   
96036   [
96037     [[link boost_asio.reference.posix__basic_descriptor.get_executor [*get_executor]]]
96038     [Get the executor associated with the object. ]
96039   ]
96040   
96041   [
96042     [[link boost_asio.reference.posix__basic_descriptor.io_control [*io_control]]]
96043     [Perform an IO control command on the descriptor. ]
96044   ]
96045   
96046   [
96047     [[link boost_asio.reference.posix__basic_descriptor.is_open [*is_open]]]
96048     [Determine whether the descriptor is open. ]
96049   ]
96050   
96051   [
96052     [[link boost_asio.reference.posix__basic_descriptor.lowest_layer [*lowest_layer]]]
96053     [Get a reference to the lowest layer. 
96054      [hr]
96055      Get a const reference to the lowest layer. ]
96056   ]
96057   
96058   [
96059     [[link boost_asio.reference.posix__basic_descriptor.native_handle [*native_handle]]]
96060     [Get the native descriptor representation. ]
96061   ]
96062   
96063   [
96064     [[link boost_asio.reference.posix__basic_descriptor.native_non_blocking [*native_non_blocking]]]
96065     [Gets the non-blocking mode of the native descriptor implementation. 
96066      [hr]
96067      Sets the non-blocking mode of the native descriptor implementation. ]
96068   ]
96069   
96070   [
96071     [[link boost_asio.reference.posix__basic_descriptor.non_blocking [*non_blocking]]]
96072     [Gets the non-blocking mode of the descriptor. 
96073      [hr]
96074      Sets the non-blocking mode of the descriptor. ]
96075   ]
96076   
96077   [
96078     [[link boost_asio.reference.posix__basic_descriptor.operator_eq_ [*operator=]]]
96079     [Move-assign a descriptor from another. ]
96080   ]
96081   
96082   [
96083     [[link boost_asio.reference.posix__basic_descriptor.release [*release]]]
96084     [Release ownership of the native descriptor implementation. ]
96085   ]
96086   
96087   [
96088     [[link boost_asio.reference.posix__basic_descriptor.wait [*wait]]]
96089     [Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
96090   ]
96091   
96092 ]
96093
96094 [heading Protected Member Functions]
96095 [table
96096   [[Name][Description]]
96097
96098   [
96099     [[link boost_asio.reference.posix__basic_descriptor._basic_descriptor [*~basic_descriptor]]]
96100     [Protected destructor to prevent deletion through this type. ]
96101   ]
96102   
96103 ]
96104
96105 [heading Protected Data Members]
96106 [table
96107   [[Name][Description]]
96108
96109   [
96110     [[link boost_asio.reference.posix__basic_descriptor.impl_ [*impl_]]]
96111     []
96112   ]
96113
96114 ]
96115
96116 The [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] class template provides the ability to wrap a POSIX descriptor.
96117
96118
96119 [heading Thread Safety]
96120   
96121 ['Distinct] ['objects:] Safe.
96122
96123 ['Shared] ['objects:] Unsafe. 
96124
96125
96126
96127
96128 [heading Requirements]
96129
96130 ['Header: ][^boost/asio/posix/basic_descriptor.hpp]
96131
96132 ['Convenience header: ][^boost/asio.hpp]
96133
96134
96135 [endsect]
96136
96137
96138
96139 [endsect]
96140
96141 [section:posix__basic_stream_descriptor posix::basic_stream_descriptor]
96142
96143
96144 Provides stream-oriented descriptor functionality. 
96145
96146
96147   template<
96148       typename ``[link boost_asio.reference.Executor1 Executor]`` = executor>
96149   class basic_stream_descriptor :
96150     public posix::basic_descriptor< Executor >
96151
96152
96153 [heading Types]
96154 [table
96155   [[Name][Description]]
96156
96157   [
96158
96159     [[link boost_asio.reference.posix__basic_stream_descriptor__rebind_executor [*rebind_executor]]]
96160     [Rebinds the descriptor type to another executor. ]
96161   
96162   ]
96163
96164   [
96165
96166     [[link boost_asio.reference.posix__basic_stream_descriptor.bytes_readable [*bytes_readable]]]
96167     [IO control command to get the amount of data that can be read without blocking. ]
96168   
96169   ]
96170
96171   [
96172
96173     [[link boost_asio.reference.posix__basic_stream_descriptor.executor_type [*executor_type]]]
96174     [The type of the executor associated with the object. ]
96175   
96176   ]
96177
96178   [
96179
96180     [[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer_type [*lowest_layer_type]]]
96181     [A descriptor is always the lowest layer. ]
96182   
96183   ]
96184
96185   [
96186
96187     [[link boost_asio.reference.posix__basic_stream_descriptor.native_handle_type [*native_handle_type]]]
96188     [The native representation of a descriptor. ]
96189   
96190   ]
96191
96192   [
96193
96194     [[link boost_asio.reference.posix__basic_stream_descriptor.wait_type [*wait_type]]]
96195     [Wait types. ]
96196   
96197   ]
96198
96199 ]
96200
96201 [heading Member Functions]
96202 [table
96203   [[Name][Description]]
96204
96205   [
96206     [[link boost_asio.reference.posix__basic_stream_descriptor.assign [*assign]]]
96207     [Assign an existing native descriptor to the descriptor. ]
96208   ]
96209   
96210   [
96211     [[link boost_asio.reference.posix__basic_stream_descriptor.async_read_some [*async_read_some]]]
96212     [Start an asynchronous read. ]
96213   ]
96214   
96215   [
96216     [[link boost_asio.reference.posix__basic_stream_descriptor.async_wait [*async_wait]]]
96217     [Asynchronously wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
96218   ]
96219   
96220   [
96221     [[link boost_asio.reference.posix__basic_stream_descriptor.async_write_some [*async_write_some]]]
96222     [Start an asynchronous write. ]
96223   ]
96224   
96225   [
96226     [[link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor [*basic_stream_descriptor]]]
96227     [Construct a stream descriptor without opening it. 
96228      [hr]
96229      Construct a stream descriptor on an existing native descriptor. 
96230      [hr]
96231      Move-construct a stream descriptor from another. ]
96232   ]
96233   
96234   [
96235     [[link boost_asio.reference.posix__basic_stream_descriptor.cancel [*cancel]]]
96236     [Cancel all asynchronous operations associated with the descriptor. ]
96237   ]
96238   
96239   [
96240     [[link boost_asio.reference.posix__basic_stream_descriptor.close [*close]]]
96241     [Close the descriptor. ]
96242   ]
96243   
96244   [
96245     [[link boost_asio.reference.posix__basic_stream_descriptor.get_executor [*get_executor]]]
96246     [Get the executor associated with the object. ]
96247   ]
96248   
96249   [
96250     [[link boost_asio.reference.posix__basic_stream_descriptor.io_control [*io_control]]]
96251     [Perform an IO control command on the descriptor. ]
96252   ]
96253   
96254   [
96255     [[link boost_asio.reference.posix__basic_stream_descriptor.is_open [*is_open]]]
96256     [Determine whether the descriptor is open. ]
96257   ]
96258   
96259   [
96260     [[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer [*lowest_layer]]]
96261     [Get a reference to the lowest layer. 
96262      [hr]
96263      Get a const reference to the lowest layer. ]
96264   ]
96265   
96266   [
96267     [[link boost_asio.reference.posix__basic_stream_descriptor.native_handle [*native_handle]]]
96268     [Get the native descriptor representation. ]
96269   ]
96270   
96271   [
96272     [[link boost_asio.reference.posix__basic_stream_descriptor.native_non_blocking [*native_non_blocking]]]
96273     [Gets the non-blocking mode of the native descriptor implementation. 
96274      [hr]
96275      Sets the non-blocking mode of the native descriptor implementation. ]
96276   ]
96277   
96278   [
96279     [[link boost_asio.reference.posix__basic_stream_descriptor.non_blocking [*non_blocking]]]
96280     [Gets the non-blocking mode of the descriptor. 
96281      [hr]
96282      Sets the non-blocking mode of the descriptor. ]
96283   ]
96284   
96285   [
96286     [[link boost_asio.reference.posix__basic_stream_descriptor.operator_eq_ [*operator=]]]
96287     [Move-assign a stream descriptor from another. ]
96288   ]
96289   
96290   [
96291     [[link boost_asio.reference.posix__basic_stream_descriptor.read_some [*read_some]]]
96292     [Read some data from the descriptor. ]
96293   ]
96294   
96295   [
96296     [[link boost_asio.reference.posix__basic_stream_descriptor.release [*release]]]
96297     [Release ownership of the native descriptor implementation. ]
96298   ]
96299   
96300   [
96301     [[link boost_asio.reference.posix__basic_stream_descriptor.wait [*wait]]]
96302     [Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
96303   ]
96304   
96305   [
96306     [[link boost_asio.reference.posix__basic_stream_descriptor.write_some [*write_some]]]
96307     [Write some data to the descriptor. ]
96308   ]
96309   
96310 ]
96311
96312 [heading Protected Data Members]
96313 [table
96314   [[Name][Description]]
96315
96316   [
96317     [[link boost_asio.reference.posix__basic_stream_descriptor.impl_ [*impl_]]]
96318     []
96319   ]
96320
96321 ]
96322
96323 The [link boost_asio.reference.posix__basic_stream_descriptor `posix::basic_stream_descriptor`] class template provides asynchronous and blocking stream-oriented descriptor functionality.
96324
96325
96326 [heading Thread Safety]
96327   
96328 ['Distinct] ['objects:] Safe.
96329
96330 ['Shared] ['objects:] Unsafe.
96331
96332
96333
96334
96335 [heading Requirements]
96336
96337 ['Header: ][^boost/asio/posix/basic_stream_descriptor.hpp]
96338
96339 ['Convenience header: ][^boost/asio.hpp]
96340
96341 [section:assign posix::basic_stream_descriptor::assign]
96342
96343 [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.assign..assign..posix::basic_stream_descriptor] 
96344 Assign an existing native descriptor to the descriptor. 
96345
96346
96347   void ``[link boost_asio.reference.posix__basic_stream_descriptor.assign.overload1 assign]``(
96348       const native_handle_type & native_descriptor);
96349   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.assign.overload1 more...]]``
96350
96351   void ``[link boost_asio.reference.posix__basic_stream_descriptor.assign.overload2 assign]``(
96352       const native_handle_type & native_descriptor,
96353       boost::system::error_code & ec);
96354   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.assign.overload2 more...]]``
96355
96356
96357 [section:overload1 posix::basic_stream_descriptor::assign (1 of 2 overloads)]
96358
96359
96360 ['Inherited from posix::basic_descriptor.]
96361
96362
96363 Assign an existing native descriptor to the descriptor. 
96364
96365
96366   void assign(
96367       const native_handle_type & native_descriptor);
96368
96369
96370
96371 [endsect]
96372
96373
96374
96375 [section:overload2 posix::basic_stream_descriptor::assign (2 of 2 overloads)]
96376
96377
96378 ['Inherited from posix::basic_descriptor.]
96379
96380
96381 Assign an existing native descriptor to the descriptor. 
96382
96383
96384   void assign(
96385       const native_handle_type & native_descriptor,
96386       boost::system::error_code & ec);
96387
96388
96389
96390 [endsect]
96391
96392
96393 [endsect]
96394
96395
96396 [section:async_read_some posix::basic_stream_descriptor::async_read_some]
96397
96398 [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.async_read_some..async_read_some..posix::basic_stream_descriptor] 
96399 Start an asynchronous read. 
96400
96401
96402   template<
96403       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
96404       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
96405   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_some(
96406       const MutableBufferSequence & buffers,
96407       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
96408
96409
96410 This function is used to asynchronously read data from the stream descriptor. The function call always returns immediately.
96411
96412
96413 [heading Parameters]
96414     
96415
96416 [variablelist
96417   
96418 [[buffers][One or more buffers into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
96419
96420 [[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
96421 ``
96422    void handler(
96423      const boost::system::error_code& error, // Result of operation.
96424      std::size_t bytes_transferred           // Number of bytes read.
96425    ); 
96426 ``
96427 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
96428
96429 ]
96430
96431
96432 [heading Remarks]
96433       
96434 The read operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.async_read `async_read`]  function if you need to ensure that the requested amount of data is read before the asynchronous operation completes.
96435
96436
96437 [heading Example]
96438   
96439 To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
96440
96441    descriptor.async_read_some(boost::asio::buffer(data, size), handler);
96442
96443
96444 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
96445
96446
96447
96448
96449 [endsect]
96450
96451
96452
96453 [section:async_wait posix::basic_stream_descriptor::async_wait]
96454
96455
96456 ['Inherited from posix::basic_descriptor.]
96457
96458 [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.async_wait..async_wait..posix::basic_stream_descriptor] 
96459 Asynchronously wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. 
96460
96461
96462   template<
96463       typename ``[link boost_asio.reference.WaitHandler WaitHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
96464   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait(
96465       wait_type w,
96466       WaitHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
96467
96468
96469 This function is used to perform an asynchronous wait for a descriptor to enter a ready to read, write or error condition state.
96470
96471
96472 [heading Parameters]
96473     
96474
96475 [variablelist
96476   
96477 [[w][Specifies the desired descriptor state.]]
96478
96479 [[handler][The handler to be called when the wait operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
96480 ``
96481    void handler(
96482      const boost::system::error_code& error // Result of operation
96483    ); 
96484 ``
96485 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
96486
96487 ]
96488
96489
96490 [heading Example]
96491   
96492
96493
96494    void wait_handler(const boost::system::error_code& error)
96495    {
96496      if (!error)
96497      {
96498        // Wait succeeded.
96499      }
96500    }
96501
96502    ...
96503
96504    boost::asio::posix::stream_descriptor descriptor(my_context);
96505    ...
96506    descriptor.async_wait(
96507        boost::asio::posix::stream_descriptor::wait_read,
96508        wait_handler);
96509
96510
96511
96512
96513
96514
96515
96516 [endsect]
96517
96518
96519
96520 [section:async_write_some posix::basic_stream_descriptor::async_write_some]
96521
96522 [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.async_write_some..async_write_some..posix::basic_stream_descriptor] 
96523 Start an asynchronous write. 
96524
96525
96526   template<
96527       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
96528       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
96529   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_some(
96530       const ConstBufferSequence & buffers,
96531       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
96532
96533
96534 This function is used to asynchronously write data to the stream descriptor. The function call always returns immediately.
96535
96536
96537 [heading Parameters]
96538     
96539
96540 [variablelist
96541   
96542 [[buffers][One or more data buffers to be written to the descriptor. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
96543
96544 [[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
96545 ``
96546    void handler(
96547      const boost::system::error_code& error, // Result of operation.
96548      std::size_t bytes_transferred           // Number of bytes written.
96549    ); 
96550 ``
96551 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
96552
96553 ]
96554
96555
96556 [heading Remarks]
96557       
96558 The write operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.async_write `async_write`]  function if you need to ensure that all data is written before the asynchronous operation completes.
96559
96560
96561 [heading Example]
96562   
96563 To write a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
96564
96565    descriptor.async_write_some(boost::asio::buffer(data, size), handler);
96566
96567
96568 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
96569
96570
96571
96572
96573 [endsect]
96574
96575
96576 [section:basic_stream_descriptor posix::basic_stream_descriptor::basic_stream_descriptor]
96577
96578 [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.basic_stream_descriptor..basic_stream_descriptor..posix::basic_stream_descriptor] 
96579 Construct a stream descriptor without opening it. 
96580
96581
96582   explicit ``[link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload1 basic_stream_descriptor]``(
96583       const executor_type & ex);
96584   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload1 more...]]``
96585
96586   template<
96587       typename ExecutionContext>
96588   explicit ``[link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload2 basic_stream_descriptor]``(
96589       ExecutionContext & context,
96590       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
96591   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload2 more...]]``
96592
96593
96594 Construct a stream descriptor on an existing native descriptor. 
96595
96596
96597   ``[link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload3 basic_stream_descriptor]``(
96598       const executor_type & ex,
96599       const native_handle_type & native_descriptor);
96600   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload3 more...]]``
96601
96602   template<
96603       typename ExecutionContext>
96604   ``[link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload4 basic_stream_descriptor]``(
96605       ExecutionContext & context,
96606       const native_handle_type & native_descriptor,
96607       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
96608   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload4 more...]]``
96609
96610
96611 Move-construct a stream descriptor from another. 
96612
96613
96614   ``[link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload5 basic_stream_descriptor]``(
96615       basic_stream_descriptor && other);
96616   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload5 more...]]``
96617
96618
96619 [section:overload1 posix::basic_stream_descriptor::basic_stream_descriptor (1 of 5 overloads)]
96620
96621
96622 Construct a stream descriptor without opening it. 
96623
96624
96625   basic_stream_descriptor(
96626       const executor_type & ex);
96627
96628
96629 This constructor creates a stream descriptor without opening it. The descriptor needs to be opened and then connected or accepted before data can be sent or received on it.
96630
96631
96632 [heading Parameters]
96633     
96634
96635 [variablelist
96636   
96637 [[ex][The I/O executor that the descriptor will use, by default, to dispatch handlers for any asynchronous operations performed on the descriptor. ]]
96638
96639 ]
96640
96641
96642
96643
96644 [endsect]
96645
96646
96647
96648 [section:overload2 posix::basic_stream_descriptor::basic_stream_descriptor (2 of 5 overloads)]
96649
96650
96651 Construct a stream descriptor without opening it. 
96652
96653
96654   template<
96655       typename ExecutionContext>
96656   basic_stream_descriptor(
96657       ExecutionContext & context,
96658       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
96659
96660
96661 This constructor creates a stream descriptor without opening it. The descriptor needs to be opened and then connected or accepted before data can be sent or received on it.
96662
96663
96664 [heading Parameters]
96665     
96666
96667 [variablelist
96668   
96669 [[context][An execution context which provides the I/O executor that the descriptor will use, by default, to dispatch handlers for any asynchronous operations performed on the descriptor. ]]
96670
96671 ]
96672
96673
96674
96675
96676 [endsect]
96677
96678
96679
96680 [section:overload3 posix::basic_stream_descriptor::basic_stream_descriptor (3 of 5 overloads)]
96681
96682
96683 Construct a stream descriptor on an existing native descriptor. 
96684
96685
96686   basic_stream_descriptor(
96687       const executor_type & ex,
96688       const native_handle_type & native_descriptor);
96689
96690
96691 This constructor creates a stream descriptor object to hold an existing native descriptor.
96692
96693
96694 [heading Parameters]
96695     
96696
96697 [variablelist
96698   
96699 [[ex][The I/O executor that the descriptor will use, by default, to dispatch handlers for any asynchronous operations performed on the descriptor.]]
96700
96701 [[native_descriptor][The new underlying descriptor implementation.]]
96702
96703 ]
96704
96705
96706 [heading Exceptions]
96707     
96708
96709 [variablelist
96710   
96711 [[boost::system::system_error][Thrown on failure. ]]
96712
96713 ]
96714
96715
96716
96717
96718 [endsect]
96719
96720
96721
96722 [section:overload4 posix::basic_stream_descriptor::basic_stream_descriptor (4 of 5 overloads)]
96723
96724
96725 Construct a stream descriptor on an existing native descriptor. 
96726
96727
96728   template<
96729       typename ExecutionContext>
96730   basic_stream_descriptor(
96731       ExecutionContext & context,
96732       const native_handle_type & native_descriptor,
96733       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
96734
96735
96736 This constructor creates a stream descriptor object to hold an existing native descriptor.
96737
96738
96739 [heading Parameters]
96740     
96741
96742 [variablelist
96743   
96744 [[context][An execution context which provides the I/O executor that the descriptor will use, by default, to dispatch handlers for any asynchronous operations performed on the descriptor.]]
96745
96746 [[native_descriptor][The new underlying descriptor implementation.]]
96747
96748 ]
96749
96750
96751 [heading Exceptions]
96752     
96753
96754 [variablelist
96755   
96756 [[boost::system::system_error][Thrown on failure. ]]
96757
96758 ]
96759
96760
96761
96762
96763 [endsect]
96764
96765
96766
96767 [section:overload5 posix::basic_stream_descriptor::basic_stream_descriptor (5 of 5 overloads)]
96768
96769
96770 Move-construct a stream descriptor from another. 
96771
96772
96773   basic_stream_descriptor(
96774       basic_stream_descriptor && other);
96775
96776
96777 This constructor moves a stream descriptor from one object to another.
96778
96779
96780 [heading Parameters]
96781     
96782
96783 [variablelist
96784   
96785 [[other][The other stream descriptor object from which the move will occur.]]
96786
96787 ]
96788
96789
96790 [heading Remarks]
96791       
96792 Following the move, the moved-from object is in the same state as if constructed using the `basic_stream_descriptor(const executor_type&)` constructor. 
96793
96794
96795
96796
96797 [endsect]
96798
96799
96800 [endsect]
96801
96802
96803 [section:bytes_readable posix::basic_stream_descriptor::bytes_readable]
96804
96805
96806 ['Inherited from posix::descriptor_base.]
96807
96808 [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.bytes_readable..bytes_readable..posix::basic_stream_descriptor] 
96809 IO control command to get the amount of data that can be read without blocking. 
96810
96811
96812   typedef implementation_defined bytes_readable;
96813
96814
96815
96816 Implements the FIONREAD IO control command.
96817
96818
96819 [heading Example]
96820   
96821
96822
96823    boost::asio::posix::stream_descriptor descriptor(my_context);
96824    ...
96825    boost::asio::descriptor_base::bytes_readable command(true);
96826    descriptor.io_control(command);
96827    std::size_t bytes_readable = command.get();
96828
96829
96830
96831
96832
96833
96834
96835 [heading Requirements]
96836
96837 ['Header: ][^boost/asio/posix/basic_stream_descriptor.hpp]
96838
96839 ['Convenience header: ][^boost/asio.hpp]
96840
96841
96842 [endsect]
96843
96844
96845 [section:cancel posix::basic_stream_descriptor::cancel]
96846
96847 [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.cancel..cancel..posix::basic_stream_descriptor] 
96848 Cancel all asynchronous operations associated with the descriptor. 
96849
96850
96851   void ``[link boost_asio.reference.posix__basic_stream_descriptor.cancel.overload1 cancel]``();
96852   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.cancel.overload1 more...]]``
96853
96854   void ``[link boost_asio.reference.posix__basic_stream_descriptor.cancel.overload2 cancel]``(
96855       boost::system::error_code & ec);
96856   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.cancel.overload2 more...]]``
96857
96858
96859 [section:overload1 posix::basic_stream_descriptor::cancel (1 of 2 overloads)]
96860
96861
96862 ['Inherited from posix::basic_descriptor.]
96863
96864
96865 Cancel all asynchronous operations associated with the descriptor. 
96866
96867
96868   void cancel();
96869
96870
96871 This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
96872
96873
96874 [heading Exceptions]
96875     
96876
96877 [variablelist
96878   
96879 [[boost::system::system_error][Thrown on failure. ]]
96880
96881 ]
96882
96883
96884
96885
96886 [endsect]
96887
96888
96889
96890 [section:overload2 posix::basic_stream_descriptor::cancel (2 of 2 overloads)]
96891
96892
96893 ['Inherited from posix::basic_descriptor.]
96894
96895
96896 Cancel all asynchronous operations associated with the descriptor. 
96897
96898
96899   void cancel(
96900       boost::system::error_code & ec);
96901
96902
96903 This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
96904
96905
96906 [heading Parameters]
96907     
96908
96909 [variablelist
96910   
96911 [[ec][Set to indicate what error occurred, if any. ]]
96912
96913 ]
96914
96915
96916
96917
96918 [endsect]
96919
96920
96921 [endsect]
96922
96923 [section:close posix::basic_stream_descriptor::close]
96924
96925 [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.close..close..posix::basic_stream_descriptor] 
96926 Close the descriptor. 
96927
96928
96929   void ``[link boost_asio.reference.posix__basic_stream_descriptor.close.overload1 close]``();
96930   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.close.overload1 more...]]``
96931
96932   void ``[link boost_asio.reference.posix__basic_stream_descriptor.close.overload2 close]``(
96933       boost::system::error_code & ec);
96934   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.close.overload2 more...]]``
96935
96936
96937 [section:overload1 posix::basic_stream_descriptor::close (1 of 2 overloads)]
96938
96939
96940 ['Inherited from posix::basic_descriptor.]
96941
96942
96943 Close the descriptor. 
96944
96945
96946   void close();
96947
96948
96949 This function is used to close the descriptor. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
96950
96951
96952 [heading Exceptions]
96953     
96954
96955 [variablelist
96956   
96957 [[boost::system::system_error][Thrown on failure. Note that, even if the function indicates an error, the underlying descriptor is closed. ]]
96958
96959 ]
96960
96961
96962
96963
96964 [endsect]
96965
96966
96967
96968 [section:overload2 posix::basic_stream_descriptor::close (2 of 2 overloads)]
96969
96970
96971 ['Inherited from posix::basic_descriptor.]
96972
96973
96974 Close the descriptor. 
96975
96976
96977   void close(
96978       boost::system::error_code & ec);
96979
96980
96981 This function is used to close the descriptor. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
96982
96983
96984 [heading Parameters]
96985     
96986
96987 [variablelist
96988   
96989 [[ec][Set to indicate what error occurred, if any. Note that, even if the function indicates an error, the underlying descriptor is closed. ]]
96990
96991 ]
96992
96993
96994
96995
96996 [endsect]
96997
96998
96999 [endsect]
97000
97001
97002 [section:executor_type posix::basic_stream_descriptor::executor_type]
97003
97004 [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.executor_type..executor_type..posix::basic_stream_descriptor] 
97005 The type of the executor associated with the object. 
97006
97007
97008   typedef Executor executor_type;
97009
97010
97011
97012 [heading Requirements]
97013
97014 ['Header: ][^boost/asio/posix/basic_stream_descriptor.hpp]
97015
97016 ['Convenience header: ][^boost/asio.hpp]
97017
97018
97019 [endsect]
97020
97021
97022
97023 [section:get_executor posix::basic_stream_descriptor::get_executor]
97024
97025
97026 ['Inherited from posix::basic_descriptor.]
97027
97028 [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.get_executor..get_executor..posix::basic_stream_descriptor] 
97029 Get the executor associated with the object. 
97030
97031
97032   executor_type get_executor();
97033
97034
97035
97036 [endsect]
97037
97038
97039
97040 [section:impl_ posix::basic_stream_descriptor::impl_]
97041
97042
97043 ['Inherited from posix::basic_descriptor.]
97044
97045 [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.impl_..impl_..posix::basic_stream_descriptor] 
97046
97047   detail::io_object_impl< detail::reactive_descriptor_service, Executor > impl_;
97048
97049
97050
97051 [endsect]
97052
97053
97054 [section:io_control posix::basic_stream_descriptor::io_control]
97055
97056 [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.io_control..io_control..posix::basic_stream_descriptor] 
97057 Perform an IO control command on the descriptor. 
97058
97059
97060   template<
97061       typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
97062   void ``[link boost_asio.reference.posix__basic_stream_descriptor.io_control.overload1 io_control]``(
97063       IoControlCommand & command);
97064   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.io_control.overload1 more...]]``
97065
97066   template<
97067       typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
97068   void ``[link boost_asio.reference.posix__basic_stream_descriptor.io_control.overload2 io_control]``(
97069       IoControlCommand & command,
97070       boost::system::error_code & ec);
97071   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.io_control.overload2 more...]]``
97072
97073
97074 [section:overload1 posix::basic_stream_descriptor::io_control (1 of 2 overloads)]
97075
97076
97077 ['Inherited from posix::basic_descriptor.]
97078
97079
97080 Perform an IO control command on the descriptor. 
97081
97082
97083   template<
97084       typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
97085   void io_control(
97086       IoControlCommand & command);
97087
97088
97089 This function is used to execute an IO control command on the descriptor.
97090
97091
97092 [heading Parameters]
97093     
97094
97095 [variablelist
97096   
97097 [[command][The IO control command to be performed on the descriptor.]]
97098
97099 ]
97100
97101
97102 [heading Exceptions]
97103     
97104
97105 [variablelist
97106   
97107 [[boost::system::system_error][Thrown on failure.]]
97108
97109 ]
97110
97111
97112
97113 [heading Example]
97114   
97115 Getting the number of bytes ready to read: 
97116
97117    boost::asio::posix::stream_descriptor descriptor(my_context);
97118    ...
97119    boost::asio::posix::stream_descriptor::bytes_readable command;
97120    descriptor.io_control(command);
97121    std::size_t bytes_readable = command.get();
97122
97123
97124
97125
97126
97127
97128
97129 [endsect]
97130
97131
97132
97133 [section:overload2 posix::basic_stream_descriptor::io_control (2 of 2 overloads)]
97134
97135
97136 ['Inherited from posix::basic_descriptor.]
97137
97138
97139 Perform an IO control command on the descriptor. 
97140
97141
97142   template<
97143       typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
97144   void io_control(
97145       IoControlCommand & command,
97146       boost::system::error_code & ec);
97147
97148
97149 This function is used to execute an IO control command on the descriptor.
97150
97151
97152 [heading Parameters]
97153     
97154
97155 [variablelist
97156   
97157 [[command][The IO control command to be performed on the descriptor.]]
97158
97159 [[ec][Set to indicate what error occurred, if any.]]
97160
97161 ]
97162
97163
97164
97165 [heading Example]
97166   
97167 Getting the number of bytes ready to read: 
97168
97169    boost::asio::posix::stream_descriptor descriptor(my_context);
97170    ...
97171    boost::asio::posix::stream_descriptor::bytes_readable command;
97172    boost::system::error_code ec;
97173    descriptor.io_control(command, ec);
97174    if (ec)
97175    {
97176      // An error occurred.
97177    }
97178    std::size_t bytes_readable = command.get();
97179
97180
97181
97182
97183
97184
97185
97186 [endsect]
97187
97188
97189 [endsect]
97190
97191
97192 [section:is_open posix::basic_stream_descriptor::is_open]
97193
97194
97195 ['Inherited from posix::basic_descriptor.]
97196
97197 [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.is_open..is_open..posix::basic_stream_descriptor] 
97198 Determine whether the descriptor is open. 
97199
97200
97201   bool is_open() const;
97202
97203
97204
97205 [endsect]
97206
97207
97208 [section:lowest_layer posix::basic_stream_descriptor::lowest_layer]
97209
97210 [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.lowest_layer..lowest_layer..posix::basic_stream_descriptor] 
97211 Get a reference to the lowest layer. 
97212
97213
97214   lowest_layer_type & ``[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer.overload1 lowest_layer]``();
97215   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer.overload1 more...]]``
97216
97217
97218 Get a const reference to the lowest layer. 
97219
97220
97221   const lowest_layer_type & ``[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer.overload2 lowest_layer]``() const;
97222   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer.overload2 more...]]``
97223
97224
97225 [section:overload1 posix::basic_stream_descriptor::lowest_layer (1 of 2 overloads)]
97226
97227
97228 ['Inherited from posix::basic_descriptor.]
97229
97230
97231 Get a reference to the lowest layer. 
97232
97233
97234   lowest_layer_type & lowest_layer();
97235
97236
97237 This function returns a reference to the lowest layer in a stack of layers. Since a descriptor cannot contain any further layers, it simply returns a reference to itself.
97238
97239
97240 [heading Return Value]
97241       
97242 A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 
97243
97244
97245
97246
97247 [endsect]
97248
97249
97250
97251 [section:overload2 posix::basic_stream_descriptor::lowest_layer (2 of 2 overloads)]
97252
97253
97254 ['Inherited from posix::basic_descriptor.]
97255
97256
97257 Get a const reference to the lowest layer. 
97258
97259
97260   const lowest_layer_type & lowest_layer() const;
97261
97262
97263 This function returns a const reference to the lowest layer in a stack of layers. Since a descriptor cannot contain any further layers, it simply returns a reference to itself.
97264
97265
97266 [heading Return Value]
97267       
97268 A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 
97269
97270
97271
97272
97273 [endsect]
97274
97275
97276 [endsect]
97277
97278
97279 [section:lowest_layer_type posix::basic_stream_descriptor::lowest_layer_type]
97280
97281
97282 ['Inherited from posix::basic_descriptor.]
97283
97284 [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.lowest_layer_type..lowest_layer_type..posix::basic_stream_descriptor] 
97285 A descriptor is always the lowest layer. 
97286
97287
97288   typedef basic_descriptor lowest_layer_type;
97289
97290
97291 [heading Types]
97292 [table
97293   [[Name][Description]]
97294
97295   [
97296
97297     [[link boost_asio.reference.posix__basic_descriptor__rebind_executor [*rebind_executor]]]
97298     [Rebinds the descriptor type to another executor. ]
97299   
97300   ]
97301
97302   [
97303
97304     [[link boost_asio.reference.posix__basic_descriptor.bytes_readable [*bytes_readable]]]
97305     [IO control command to get the amount of data that can be read without blocking. ]
97306   
97307   ]
97308
97309   [
97310
97311     [[link boost_asio.reference.posix__basic_descriptor.executor_type [*executor_type]]]
97312     [The type of the executor associated with the object. ]
97313   
97314   ]
97315
97316   [
97317
97318     [[link boost_asio.reference.posix__basic_descriptor.lowest_layer_type [*lowest_layer_type]]]
97319     [A descriptor is always the lowest layer. ]
97320   
97321   ]
97322
97323   [
97324
97325     [[link boost_asio.reference.posix__basic_descriptor.native_handle_type [*native_handle_type]]]
97326     [The native representation of a descriptor. ]
97327   
97328   ]
97329
97330   [
97331
97332     [[link boost_asio.reference.posix__basic_descriptor.wait_type [*wait_type]]]
97333     [Wait types. ]
97334   
97335   ]
97336
97337 ]
97338
97339 [heading Member Functions]
97340 [table
97341   [[Name][Description]]
97342
97343   [
97344     [[link boost_asio.reference.posix__basic_descriptor.assign [*assign]]]
97345     [Assign an existing native descriptor to the descriptor. ]
97346   ]
97347   
97348   [
97349     [[link boost_asio.reference.posix__basic_descriptor.async_wait [*async_wait]]]
97350     [Asynchronously wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
97351   ]
97352   
97353   [
97354     [[link boost_asio.reference.posix__basic_descriptor.basic_descriptor [*basic_descriptor]]]
97355     [Construct a descriptor without opening it. 
97356      [hr]
97357      Construct a descriptor on an existing native descriptor. 
97358      [hr]
97359      Move-construct a descriptor from another. ]
97360   ]
97361   
97362   [
97363     [[link boost_asio.reference.posix__basic_descriptor.cancel [*cancel]]]
97364     [Cancel all asynchronous operations associated with the descriptor. ]
97365   ]
97366   
97367   [
97368     [[link boost_asio.reference.posix__basic_descriptor.close [*close]]]
97369     [Close the descriptor. ]
97370   ]
97371   
97372   [
97373     [[link boost_asio.reference.posix__basic_descriptor.get_executor [*get_executor]]]
97374     [Get the executor associated with the object. ]
97375   ]
97376   
97377   [
97378     [[link boost_asio.reference.posix__basic_descriptor.io_control [*io_control]]]
97379     [Perform an IO control command on the descriptor. ]
97380   ]
97381   
97382   [
97383     [[link boost_asio.reference.posix__basic_descriptor.is_open [*is_open]]]
97384     [Determine whether the descriptor is open. ]
97385   ]
97386   
97387   [
97388     [[link boost_asio.reference.posix__basic_descriptor.lowest_layer [*lowest_layer]]]
97389     [Get a reference to the lowest layer. 
97390      [hr]
97391      Get a const reference to the lowest layer. ]
97392   ]
97393   
97394   [
97395     [[link boost_asio.reference.posix__basic_descriptor.native_handle [*native_handle]]]
97396     [Get the native descriptor representation. ]
97397   ]
97398   
97399   [
97400     [[link boost_asio.reference.posix__basic_descriptor.native_non_blocking [*native_non_blocking]]]
97401     [Gets the non-blocking mode of the native descriptor implementation. 
97402      [hr]
97403      Sets the non-blocking mode of the native descriptor implementation. ]
97404   ]
97405   
97406   [
97407     [[link boost_asio.reference.posix__basic_descriptor.non_blocking [*non_blocking]]]
97408     [Gets the non-blocking mode of the descriptor. 
97409      [hr]
97410      Sets the non-blocking mode of the descriptor. ]
97411   ]
97412   
97413   [
97414     [[link boost_asio.reference.posix__basic_descriptor.operator_eq_ [*operator=]]]
97415     [Move-assign a descriptor from another. ]
97416   ]
97417   
97418   [
97419     [[link boost_asio.reference.posix__basic_descriptor.release [*release]]]
97420     [Release ownership of the native descriptor implementation. ]
97421   ]
97422   
97423   [
97424     [[link boost_asio.reference.posix__basic_descriptor.wait [*wait]]]
97425     [Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
97426   ]
97427   
97428 ]
97429
97430 [heading Protected Member Functions]
97431 [table
97432   [[Name][Description]]
97433
97434   [
97435     [[link boost_asio.reference.posix__basic_descriptor._basic_descriptor [*~basic_descriptor]]]
97436     [Protected destructor to prevent deletion through this type. ]
97437   ]
97438   
97439 ]
97440
97441 [heading Protected Data Members]
97442 [table
97443   [[Name][Description]]
97444
97445   [
97446     [[link boost_asio.reference.posix__basic_descriptor.impl_ [*impl_]]]
97447     []
97448   ]
97449
97450 ]
97451
97452 The [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] class template provides the ability to wrap a POSIX descriptor.
97453
97454
97455 [heading Thread Safety]
97456   
97457 ['Distinct] ['objects:] Safe.
97458
97459 ['Shared] ['objects:] Unsafe. 
97460
97461
97462
97463
97464 [heading Requirements]
97465
97466 ['Header: ][^boost/asio/posix/basic_stream_descriptor.hpp]
97467
97468 ['Convenience header: ][^boost/asio.hpp]
97469
97470
97471 [endsect]
97472
97473
97474
97475 [section:native_handle posix::basic_stream_descriptor::native_handle]
97476
97477
97478 ['Inherited from posix::basic_descriptor.]
97479
97480 [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.native_handle..native_handle..posix::basic_stream_descriptor] 
97481 Get the native descriptor representation. 
97482
97483
97484   native_handle_type native_handle();
97485
97486
97487 This function may be used to obtain the underlying representation of the descriptor. This is intended to allow access to native descriptor functionality that is not otherwise provided. 
97488
97489
97490 [endsect]
97491
97492
97493
97494 [section:native_handle_type posix::basic_stream_descriptor::native_handle_type]
97495
97496 [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.native_handle_type..native_handle_type..posix::basic_stream_descriptor] 
97497 The native representation of a descriptor. 
97498
97499
97500   typedef basic_descriptor< Executor >::native_handle_type native_handle_type;
97501
97502
97503 [heading Types]
97504 [table
97505   [[Name][Description]]
97506
97507   [
97508
97509     [[link boost_asio.reference.posix__basic_descriptor__rebind_executor [*rebind_executor]]]
97510     [Rebinds the descriptor type to another executor. ]
97511   
97512   ]
97513
97514   [
97515
97516     [[link boost_asio.reference.posix__basic_descriptor.bytes_readable [*bytes_readable]]]
97517     [IO control command to get the amount of data that can be read without blocking. ]
97518   
97519   ]
97520
97521   [
97522
97523     [[link boost_asio.reference.posix__basic_descriptor.executor_type [*executor_type]]]
97524     [The type of the executor associated with the object. ]
97525   
97526   ]
97527
97528   [
97529
97530     [[link boost_asio.reference.posix__basic_descriptor.lowest_layer_type [*lowest_layer_type]]]
97531     [A descriptor is always the lowest layer. ]
97532   
97533   ]
97534
97535   [
97536
97537     [[link boost_asio.reference.posix__basic_descriptor.native_handle_type [*native_handle_type]]]
97538     [The native representation of a descriptor. ]
97539   
97540   ]
97541
97542   [
97543
97544     [[link boost_asio.reference.posix__basic_descriptor.wait_type [*wait_type]]]
97545     [Wait types. ]
97546   
97547   ]
97548
97549 ]
97550
97551 [heading Member Functions]
97552 [table
97553   [[Name][Description]]
97554
97555   [
97556     [[link boost_asio.reference.posix__basic_descriptor.assign [*assign]]]
97557     [Assign an existing native descriptor to the descriptor. ]
97558   ]
97559   
97560   [
97561     [[link boost_asio.reference.posix__basic_descriptor.async_wait [*async_wait]]]
97562     [Asynchronously wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
97563   ]
97564   
97565   [
97566     [[link boost_asio.reference.posix__basic_descriptor.basic_descriptor [*basic_descriptor]]]
97567     [Construct a descriptor without opening it. 
97568      [hr]
97569      Construct a descriptor on an existing native descriptor. 
97570      [hr]
97571      Move-construct a descriptor from another. ]
97572   ]
97573   
97574   [
97575     [[link boost_asio.reference.posix__basic_descriptor.cancel [*cancel]]]
97576     [Cancel all asynchronous operations associated with the descriptor. ]
97577   ]
97578   
97579   [
97580     [[link boost_asio.reference.posix__basic_descriptor.close [*close]]]
97581     [Close the descriptor. ]
97582   ]
97583   
97584   [
97585     [[link boost_asio.reference.posix__basic_descriptor.get_executor [*get_executor]]]
97586     [Get the executor associated with the object. ]
97587   ]
97588   
97589   [
97590     [[link boost_asio.reference.posix__basic_descriptor.io_control [*io_control]]]
97591     [Perform an IO control command on the descriptor. ]
97592   ]
97593   
97594   [
97595     [[link boost_asio.reference.posix__basic_descriptor.is_open [*is_open]]]
97596     [Determine whether the descriptor is open. ]
97597   ]
97598   
97599   [
97600     [[link boost_asio.reference.posix__basic_descriptor.lowest_layer [*lowest_layer]]]
97601     [Get a reference to the lowest layer. 
97602      [hr]
97603      Get a const reference to the lowest layer. ]
97604   ]
97605   
97606   [
97607     [[link boost_asio.reference.posix__basic_descriptor.native_handle [*native_handle]]]
97608     [Get the native descriptor representation. ]
97609   ]
97610   
97611   [
97612     [[link boost_asio.reference.posix__basic_descriptor.native_non_blocking [*native_non_blocking]]]
97613     [Gets the non-blocking mode of the native descriptor implementation. 
97614      [hr]
97615      Sets the non-blocking mode of the native descriptor implementation. ]
97616   ]
97617   
97618   [
97619     [[link boost_asio.reference.posix__basic_descriptor.non_blocking [*non_blocking]]]
97620     [Gets the non-blocking mode of the descriptor. 
97621      [hr]
97622      Sets the non-blocking mode of the descriptor. ]
97623   ]
97624   
97625   [
97626     [[link boost_asio.reference.posix__basic_descriptor.operator_eq_ [*operator=]]]
97627     [Move-assign a descriptor from another. ]
97628   ]
97629   
97630   [
97631     [[link boost_asio.reference.posix__basic_descriptor.release [*release]]]
97632     [Release ownership of the native descriptor implementation. ]
97633   ]
97634   
97635   [
97636     [[link boost_asio.reference.posix__basic_descriptor.wait [*wait]]]
97637     [Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
97638   ]
97639   
97640 ]
97641
97642 [heading Protected Member Functions]
97643 [table
97644   [[Name][Description]]
97645
97646   [
97647     [[link boost_asio.reference.posix__basic_descriptor._basic_descriptor [*~basic_descriptor]]]
97648     [Protected destructor to prevent deletion through this type. ]
97649   ]
97650   
97651 ]
97652
97653 [heading Protected Data Members]
97654 [table
97655   [[Name][Description]]
97656
97657   [
97658     [[link boost_asio.reference.posix__basic_descriptor.impl_ [*impl_]]]
97659     []
97660   ]
97661
97662 ]
97663
97664 The [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] class template provides the ability to wrap a POSIX descriptor.
97665
97666
97667 [heading Thread Safety]
97668   
97669 ['Distinct] ['objects:] Safe.
97670
97671 ['Shared] ['objects:] Unsafe. 
97672
97673
97674
97675
97676 [heading Requirements]
97677
97678 ['Header: ][^boost/asio/posix/basic_stream_descriptor.hpp]
97679
97680 ['Convenience header: ][^boost/asio.hpp]
97681
97682
97683 [endsect]
97684
97685
97686 [section:native_non_blocking posix::basic_stream_descriptor::native_non_blocking]
97687
97688 [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.native_non_blocking..native_non_blocking..posix::basic_stream_descriptor] 
97689 Gets the non-blocking mode of the native descriptor implementation. 
97690
97691
97692   bool ``[link boost_asio.reference.posix__basic_stream_descriptor.native_non_blocking.overload1 native_non_blocking]``() const;
97693   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.native_non_blocking.overload1 more...]]``
97694
97695
97696 Sets the non-blocking mode of the native descriptor implementation. 
97697
97698
97699   void ``[link boost_asio.reference.posix__basic_stream_descriptor.native_non_blocking.overload2 native_non_blocking]``(
97700       bool mode);
97701   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.native_non_blocking.overload2 more...]]``
97702
97703   void ``[link boost_asio.reference.posix__basic_stream_descriptor.native_non_blocking.overload3 native_non_blocking]``(
97704       bool mode,
97705       boost::system::error_code & ec);
97706   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.native_non_blocking.overload3 more...]]``
97707
97708
97709 [section:overload1 posix::basic_stream_descriptor::native_non_blocking (1 of 3 overloads)]
97710
97711
97712 ['Inherited from posix::basic_descriptor.]
97713
97714
97715 Gets the non-blocking mode of the native descriptor implementation. 
97716
97717
97718   bool native_non_blocking() const;
97719
97720
97721 This function is used to retrieve the non-blocking mode of the underlying native descriptor. This mode has no effect on the behaviour of the descriptor object's synchronous operations.
97722
97723
97724 [heading Return Value]
97725       
97726 `true` if the underlying descriptor is in non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).
97727
97728
97729 [heading Remarks]
97730       
97731 The current non-blocking mode is cached by the descriptor object. Consequently, the return value may be incorrect if the non-blocking mode was set directly on the native descriptor. 
97732
97733
97734
97735
97736 [endsect]
97737
97738
97739
97740 [section:overload2 posix::basic_stream_descriptor::native_non_blocking (2 of 3 overloads)]
97741
97742
97743 ['Inherited from posix::basic_descriptor.]
97744
97745
97746 Sets the non-blocking mode of the native descriptor implementation. 
97747
97748
97749   void native_non_blocking(
97750       bool mode);
97751
97752
97753 This function is used to modify the non-blocking mode of the underlying native descriptor. It has no effect on the behaviour of the descriptor object's synchronous operations.
97754
97755
97756 [heading Parameters]
97757     
97758
97759 [variablelist
97760   
97761 [[mode][If `true`, the underlying descriptor is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]]
97762
97763 ]
97764
97765
97766 [heading Exceptions]
97767     
97768
97769 [variablelist
97770   
97771 [[boost::system::system_error][Thrown on failure. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense. ]]
97772
97773 ]
97774
97775
97776
97777
97778 [endsect]
97779
97780
97781
97782 [section:overload3 posix::basic_stream_descriptor::native_non_blocking (3 of 3 overloads)]
97783
97784
97785 ['Inherited from posix::basic_descriptor.]
97786
97787
97788 Sets the non-blocking mode of the native descriptor implementation. 
97789
97790
97791   void native_non_blocking(
97792       bool mode,
97793       boost::system::error_code & ec);
97794
97795
97796 This function is used to modify the non-blocking mode of the underlying native descriptor. It has no effect on the behaviour of the descriptor object's synchronous operations.
97797
97798
97799 [heading Parameters]
97800     
97801
97802 [variablelist
97803   
97804 [[mode][If `true`, the underlying descriptor is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]]
97805
97806 [[ec][Set to indicate what error occurred, if any. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense. ]]
97807
97808 ]
97809
97810
97811
97812
97813 [endsect]
97814
97815
97816 [endsect]
97817
97818 [section:non_blocking posix::basic_stream_descriptor::non_blocking]
97819
97820 [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.non_blocking..non_blocking..posix::basic_stream_descriptor] 
97821 Gets the non-blocking mode of the descriptor. 
97822
97823
97824   bool ``[link boost_asio.reference.posix__basic_stream_descriptor.non_blocking.overload1 non_blocking]``() const;
97825   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.non_blocking.overload1 more...]]``
97826
97827
97828 Sets the non-blocking mode of the descriptor. 
97829
97830
97831   void ``[link boost_asio.reference.posix__basic_stream_descriptor.non_blocking.overload2 non_blocking]``(
97832       bool mode);
97833   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.non_blocking.overload2 more...]]``
97834
97835   void ``[link boost_asio.reference.posix__basic_stream_descriptor.non_blocking.overload3 non_blocking]``(
97836       bool mode,
97837       boost::system::error_code & ec);
97838   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.non_blocking.overload3 more...]]``
97839
97840
97841 [section:overload1 posix::basic_stream_descriptor::non_blocking (1 of 3 overloads)]
97842
97843
97844 ['Inherited from posix::basic_descriptor.]
97845
97846
97847 Gets the non-blocking mode of the descriptor. 
97848
97849
97850   bool non_blocking() const;
97851
97852
97853
97854 [heading Return Value]
97855       
97856 `true` if the descriptor's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.
97857
97858
97859 [heading Remarks]
97860       
97861 The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`. 
97862
97863
97864
97865
97866 [endsect]
97867
97868
97869
97870 [section:overload2 posix::basic_stream_descriptor::non_blocking (2 of 3 overloads)]
97871
97872
97873 ['Inherited from posix::basic_descriptor.]
97874
97875
97876 Sets the non-blocking mode of the descriptor. 
97877
97878
97879   void non_blocking(
97880       bool mode);
97881
97882
97883
97884 [heading Parameters]
97885     
97886
97887 [variablelist
97888   
97889 [[mode][If `true`, the descriptor's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]]
97890
97891 ]
97892
97893
97894 [heading Exceptions]
97895     
97896
97897 [variablelist
97898   
97899 [[boost::system::system_error][Thrown on failure.]]
97900
97901 ]
97902
97903
97904 [heading Remarks]
97905       
97906 The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`. 
97907
97908
97909
97910
97911 [endsect]
97912
97913
97914
97915 [section:overload3 posix::basic_stream_descriptor::non_blocking (3 of 3 overloads)]
97916
97917
97918 ['Inherited from posix::basic_descriptor.]
97919
97920
97921 Sets the non-blocking mode of the descriptor. 
97922
97923
97924   void non_blocking(
97925       bool mode,
97926       boost::system::error_code & ec);
97927
97928
97929
97930 [heading Parameters]
97931     
97932
97933 [variablelist
97934   
97935 [[mode][If `true`, the descriptor's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]]
97936
97937 [[ec][Set to indicate what error occurred, if any.]]
97938
97939 ]
97940
97941
97942 [heading Remarks]
97943       
97944 The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`. 
97945
97946
97947
97948
97949 [endsect]
97950
97951
97952 [endsect]
97953
97954
97955 [section:operator_eq_ posix::basic_stream_descriptor::operator=]
97956
97957 [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.operator_eq_..operator=..posix::basic_stream_descriptor] 
97958 Move-assign a stream descriptor from another. 
97959
97960
97961   basic_stream_descriptor & operator=(
97962       basic_stream_descriptor && other);
97963
97964
97965 This assignment operator moves a stream descriptor from one object to another.
97966
97967
97968 [heading Parameters]
97969     
97970
97971 [variablelist
97972   
97973 [[other][The other stream descriptor object from which the move will occur.]]
97974
97975 ]
97976
97977
97978 [heading Remarks]
97979       
97980 Following the move, the moved-from object is in the same state as if constructed using the `basic_stream_descriptor(const executor_type&)` constructor. 
97981
97982
97983
97984
97985 [endsect]
97986
97987
97988 [section:read_some posix::basic_stream_descriptor::read_some]
97989
97990 [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.read_some..read_some..posix::basic_stream_descriptor] 
97991 Read some data from the descriptor. 
97992
97993
97994   template<
97995       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
97996   std::size_t ``[link boost_asio.reference.posix__basic_stream_descriptor.read_some.overload1 read_some]``(
97997       const MutableBufferSequence & buffers);
97998   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.read_some.overload1 more...]]``
97999
98000   template<
98001       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
98002   std::size_t ``[link boost_asio.reference.posix__basic_stream_descriptor.read_some.overload2 read_some]``(
98003       const MutableBufferSequence & buffers,
98004       boost::system::error_code & ec);
98005   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.read_some.overload2 more...]]``
98006
98007
98008 [section:overload1 posix::basic_stream_descriptor::read_some (1 of 2 overloads)]
98009
98010
98011 Read some data from the descriptor. 
98012
98013
98014   template<
98015       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
98016   std::size_t read_some(
98017       const MutableBufferSequence & buffers);
98018
98019
98020 This function is used to read data from the stream descriptor. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
98021
98022
98023 [heading Parameters]
98024     
98025
98026 [variablelist
98027   
98028 [[buffers][One or more buffers into which the data will be read.]]
98029
98030 ]
98031
98032
98033 [heading Return Value]
98034       
98035 The number of bytes read.
98036
98037
98038 [heading Exceptions]
98039     
98040
98041 [variablelist
98042   
98043 [[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
98044
98045 ]
98046
98047
98048 [heading Remarks]
98049       
98050 The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`]  function if you need to ensure that the requested amount of data is read before the blocking operation completes.
98051
98052
98053 [heading Example]
98054   
98055 To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
98056
98057    descriptor.read_some(boost::asio::buffer(data, size));
98058
98059
98060 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
98061
98062
98063
98064
98065 [endsect]
98066
98067
98068
98069 [section:overload2 posix::basic_stream_descriptor::read_some (2 of 2 overloads)]
98070
98071
98072 Read some data from the descriptor. 
98073
98074
98075   template<
98076       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
98077   std::size_t read_some(
98078       const MutableBufferSequence & buffers,
98079       boost::system::error_code & ec);
98080
98081
98082 This function is used to read data from the stream descriptor. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
98083
98084
98085 [heading Parameters]
98086     
98087
98088 [variablelist
98089   
98090 [[buffers][One or more buffers into which the data will be read.]]
98091
98092 [[ec][Set to indicate what error occurred, if any.]]
98093
98094 ]
98095
98096
98097 [heading Return Value]
98098       
98099 The number of bytes read. Returns 0 if an error occurred.
98100
98101
98102 [heading Remarks]
98103       
98104 The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`]  function if you need to ensure that the requested amount of data is read before the blocking operation completes. 
98105
98106
98107
98108
98109 [endsect]
98110
98111
98112 [endsect]
98113
98114
98115 [section:release posix::basic_stream_descriptor::release]
98116
98117
98118 ['Inherited from posix::basic_descriptor.]
98119
98120 [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.release..release..posix::basic_stream_descriptor] 
98121 Release ownership of the native descriptor implementation. 
98122
98123
98124   native_handle_type release();
98125
98126
98127 This function may be used to obtain the underlying representation of the descriptor. After calling this function, `is_open()` returns false. The caller is responsible for closing the descriptor.
98128
98129 All outstanding asynchronous read or write operations will finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error. 
98130
98131
98132 [endsect]
98133
98134
98135 [section:wait posix::basic_stream_descriptor::wait]
98136
98137 [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.wait..wait..posix::basic_stream_descriptor] 
98138 Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. 
98139
98140
98141   void ``[link boost_asio.reference.posix__basic_stream_descriptor.wait.overload1 wait]``(
98142       wait_type w);
98143   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.wait.overload1 more...]]``
98144
98145   void ``[link boost_asio.reference.posix__basic_stream_descriptor.wait.overload2 wait]``(
98146       wait_type w,
98147       boost::system::error_code & ec);
98148   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.wait.overload2 more...]]``
98149
98150
98151 [section:overload1 posix::basic_stream_descriptor::wait (1 of 2 overloads)]
98152
98153
98154 ['Inherited from posix::basic_descriptor.]
98155
98156
98157 Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. 
98158
98159
98160   void wait(
98161       wait_type w);
98162
98163
98164 This function is used to perform a blocking wait for a descriptor to enter a ready to read, write or error condition state.
98165
98166
98167 [heading Parameters]
98168     
98169
98170 [variablelist
98171   
98172 [[w][Specifies the desired descriptor state.]]
98173
98174 ]
98175
98176
98177 [heading Example]
98178   
98179 Waiting for a descriptor to become readable. 
98180
98181    boost::asio::posix::stream_descriptor descriptor(my_context);
98182    ...
98183    descriptor.wait(boost::asio::posix::stream_descriptor::wait_read);
98184
98185
98186
98187
98188
98189
98190
98191 [endsect]
98192
98193
98194
98195 [section:overload2 posix::basic_stream_descriptor::wait (2 of 2 overloads)]
98196
98197
98198 ['Inherited from posix::basic_descriptor.]
98199
98200
98201 Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. 
98202
98203
98204   void wait(
98205       wait_type w,
98206       boost::system::error_code & ec);
98207
98208
98209 This function is used to perform a blocking wait for a descriptor to enter a ready to read, write or error condition state.
98210
98211
98212 [heading Parameters]
98213     
98214
98215 [variablelist
98216   
98217 [[w][Specifies the desired descriptor state.]]
98218
98219 [[ec][Set to indicate what error occurred, if any.]]
98220
98221 ]
98222
98223
98224 [heading Example]
98225   
98226 Waiting for a descriptor to become readable. 
98227
98228    boost::asio::posix::stream_descriptor descriptor(my_context);
98229    ...
98230    boost::system::error_code ec;
98231    descriptor.wait(boost::asio::posix::stream_descriptor::wait_read, ec);
98232
98233
98234
98235
98236
98237
98238
98239 [endsect]
98240
98241
98242 [endsect]
98243
98244
98245 [section:wait_type posix::basic_stream_descriptor::wait_type]
98246
98247
98248 ['Inherited from posix::descriptor_base.]
98249
98250 [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.wait_type..wait_type..posix::basic_stream_descriptor] 
98251 Wait types. 
98252
98253
98254   enum wait_type
98255
98256 [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.wait_type.wait_read..wait_read..posix::basic_stream_descriptor]
98257 [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.wait_type.wait_write..wait_write..posix::basic_stream_descriptor]
98258 [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.wait_type.wait_error..wait_error..posix::basic_stream_descriptor]
98259
98260 [heading Values]
98261 [variablelist
98262
98263   [
98264     [wait_read]
98265     [Wait for a descriptor to become ready to read. ]
98266   ]
98267
98268   [
98269     [wait_write]
98270     [Wait for a descriptor to become ready to write. ]
98271   ]
98272
98273   [
98274     [wait_error]
98275     [Wait for a descriptor to have error conditions pending. ]
98276   ]
98277
98278 ]
98279
98280
98281 For use with `descriptor::wait()` and `descriptor::async_wait()`. 
98282
98283
98284 [endsect]
98285
98286
98287 [section:write_some posix::basic_stream_descriptor::write_some]
98288
98289 [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.write_some..write_some..posix::basic_stream_descriptor] 
98290 Write some data to the descriptor. 
98291
98292
98293   template<
98294       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
98295   std::size_t ``[link boost_asio.reference.posix__basic_stream_descriptor.write_some.overload1 write_some]``(
98296       const ConstBufferSequence & buffers);
98297   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.write_some.overload1 more...]]``
98298
98299   template<
98300       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
98301   std::size_t ``[link boost_asio.reference.posix__basic_stream_descriptor.write_some.overload2 write_some]``(
98302       const ConstBufferSequence & buffers,
98303       boost::system::error_code & ec);
98304   ``  [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.write_some.overload2 more...]]``
98305
98306
98307 [section:overload1 posix::basic_stream_descriptor::write_some (1 of 2 overloads)]
98308
98309
98310 Write some data to the descriptor. 
98311
98312
98313   template<
98314       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
98315   std::size_t write_some(
98316       const ConstBufferSequence & buffers);
98317
98318
98319 This function is used to write data to the stream descriptor. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
98320
98321
98322 [heading Parameters]
98323     
98324
98325 [variablelist
98326   
98327 [[buffers][One or more data buffers to be written to the descriptor.]]
98328
98329 ]
98330
98331
98332 [heading Return Value]
98333       
98334 The number of bytes written.
98335
98336
98337 [heading Exceptions]
98338     
98339
98340 [variablelist
98341   
98342 [[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
98343
98344 ]
98345
98346
98347 [heading Remarks]
98348       
98349 The write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`]  function if you need to ensure that all data is written before the blocking operation completes.
98350
98351
98352 [heading Example]
98353   
98354 To write a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
98355
98356    descriptor.write_some(boost::asio::buffer(data, size));
98357
98358
98359 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
98360
98361
98362
98363
98364 [endsect]
98365
98366
98367
98368 [section:overload2 posix::basic_stream_descriptor::write_some (2 of 2 overloads)]
98369
98370
98371 Write some data to the descriptor. 
98372
98373
98374   template<
98375       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
98376   std::size_t write_some(
98377       const ConstBufferSequence & buffers,
98378       boost::system::error_code & ec);
98379
98380
98381 This function is used to write data to the stream descriptor. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
98382
98383
98384 [heading Parameters]
98385     
98386
98387 [variablelist
98388   
98389 [[buffers][One or more data buffers to be written to the descriptor.]]
98390
98391 [[ec][Set to indicate what error occurred, if any.]]
98392
98393 ]
98394
98395
98396 [heading Return Value]
98397       
98398 The number of bytes written. Returns 0 if an error occurred.
98399
98400
98401 [heading Remarks]
98402       
98403 The write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`]  function if you need to ensure that all data is written before the blocking operation completes. 
98404
98405
98406
98407
98408 [endsect]
98409
98410
98411 [endsect]
98412
98413
98414 [endsect]
98415
98416 [section:posix__basic_stream_descriptor__rebind_executor posix::basic_stream_descriptor::rebind_executor]
98417
98418
98419 Rebinds the descriptor type to another executor. 
98420
98421
98422   template<
98423       typename ``[link boost_asio.reference.Executor1 Executor1]``>
98424   struct rebind_executor
98425
98426
98427 [heading Types]
98428 [table
98429   [[Name][Description]]
98430
98431   [
98432
98433     [[link boost_asio.reference.posix__basic_stream_descriptor__rebind_executor.other [*other]]]
98434     [The descriptor type when rebound to the specified executor. ]
98435   
98436   ]
98437
98438 ]
98439
98440 [heading Requirements]
98441
98442 ['Header: ][^boost/asio/posix/basic_stream_descriptor.hpp]
98443
98444 ['Convenience header: ][^boost/asio.hpp]
98445
98446
98447 [section:other posix::basic_stream_descriptor::rebind_executor::other]
98448
98449 [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor__rebind_executor.other..other..posix::basic_stream_descriptor::rebind_executor] 
98450 The descriptor type when rebound to the specified executor. 
98451
98452
98453   typedef basic_stream_descriptor< Executor1 > other;
98454
98455
98456 [heading Types]
98457 [table
98458   [[Name][Description]]
98459
98460   [
98461
98462     [[link boost_asio.reference.posix__basic_stream_descriptor__rebind_executor [*rebind_executor]]]
98463     [Rebinds the descriptor type to another executor. ]
98464   
98465   ]
98466
98467   [
98468
98469     [[link boost_asio.reference.posix__basic_stream_descriptor.bytes_readable [*bytes_readable]]]
98470     [IO control command to get the amount of data that can be read without blocking. ]
98471   
98472   ]
98473
98474   [
98475
98476     [[link boost_asio.reference.posix__basic_stream_descriptor.executor_type [*executor_type]]]
98477     [The type of the executor associated with the object. ]
98478   
98479   ]
98480
98481   [
98482
98483     [[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer_type [*lowest_layer_type]]]
98484     [A descriptor is always the lowest layer. ]
98485   
98486   ]
98487
98488   [
98489
98490     [[link boost_asio.reference.posix__basic_stream_descriptor.native_handle_type [*native_handle_type]]]
98491     [The native representation of a descriptor. ]
98492   
98493   ]
98494
98495   [
98496
98497     [[link boost_asio.reference.posix__basic_stream_descriptor.wait_type [*wait_type]]]
98498     [Wait types. ]
98499   
98500   ]
98501
98502 ]
98503
98504 [heading Member Functions]
98505 [table
98506   [[Name][Description]]
98507
98508   [
98509     [[link boost_asio.reference.posix__basic_stream_descriptor.assign [*assign]]]
98510     [Assign an existing native descriptor to the descriptor. ]
98511   ]
98512   
98513   [
98514     [[link boost_asio.reference.posix__basic_stream_descriptor.async_read_some [*async_read_some]]]
98515     [Start an asynchronous read. ]
98516   ]
98517   
98518   [
98519     [[link boost_asio.reference.posix__basic_stream_descriptor.async_wait [*async_wait]]]
98520     [Asynchronously wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
98521   ]
98522   
98523   [
98524     [[link boost_asio.reference.posix__basic_stream_descriptor.async_write_some [*async_write_some]]]
98525     [Start an asynchronous write. ]
98526   ]
98527   
98528   [
98529     [[link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor [*basic_stream_descriptor]]]
98530     [Construct a stream descriptor without opening it. 
98531      [hr]
98532      Construct a stream descriptor on an existing native descriptor. 
98533      [hr]
98534      Move-construct a stream descriptor from another. ]
98535   ]
98536   
98537   [
98538     [[link boost_asio.reference.posix__basic_stream_descriptor.cancel [*cancel]]]
98539     [Cancel all asynchronous operations associated with the descriptor. ]
98540   ]
98541   
98542   [
98543     [[link boost_asio.reference.posix__basic_stream_descriptor.close [*close]]]
98544     [Close the descriptor. ]
98545   ]
98546   
98547   [
98548     [[link boost_asio.reference.posix__basic_stream_descriptor.get_executor [*get_executor]]]
98549     [Get the executor associated with the object. ]
98550   ]
98551   
98552   [
98553     [[link boost_asio.reference.posix__basic_stream_descriptor.io_control [*io_control]]]
98554     [Perform an IO control command on the descriptor. ]
98555   ]
98556   
98557   [
98558     [[link boost_asio.reference.posix__basic_stream_descriptor.is_open [*is_open]]]
98559     [Determine whether the descriptor is open. ]
98560   ]
98561   
98562   [
98563     [[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer [*lowest_layer]]]
98564     [Get a reference to the lowest layer. 
98565      [hr]
98566      Get a const reference to the lowest layer. ]
98567   ]
98568   
98569   [
98570     [[link boost_asio.reference.posix__basic_stream_descriptor.native_handle [*native_handle]]]
98571     [Get the native descriptor representation. ]
98572   ]
98573   
98574   [
98575     [[link boost_asio.reference.posix__basic_stream_descriptor.native_non_blocking [*native_non_blocking]]]
98576     [Gets the non-blocking mode of the native descriptor implementation. 
98577      [hr]
98578      Sets the non-blocking mode of the native descriptor implementation. ]
98579   ]
98580   
98581   [
98582     [[link boost_asio.reference.posix__basic_stream_descriptor.non_blocking [*non_blocking]]]
98583     [Gets the non-blocking mode of the descriptor. 
98584      [hr]
98585      Sets the non-blocking mode of the descriptor. ]
98586   ]
98587   
98588   [
98589     [[link boost_asio.reference.posix__basic_stream_descriptor.operator_eq_ [*operator=]]]
98590     [Move-assign a stream descriptor from another. ]
98591   ]
98592   
98593   [
98594     [[link boost_asio.reference.posix__basic_stream_descriptor.read_some [*read_some]]]
98595     [Read some data from the descriptor. ]
98596   ]
98597   
98598   [
98599     [[link boost_asio.reference.posix__basic_stream_descriptor.release [*release]]]
98600     [Release ownership of the native descriptor implementation. ]
98601   ]
98602   
98603   [
98604     [[link boost_asio.reference.posix__basic_stream_descriptor.wait [*wait]]]
98605     [Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
98606   ]
98607   
98608   [
98609     [[link boost_asio.reference.posix__basic_stream_descriptor.write_some [*write_some]]]
98610     [Write some data to the descriptor. ]
98611   ]
98612   
98613 ]
98614
98615 [heading Protected Data Members]
98616 [table
98617   [[Name][Description]]
98618
98619   [
98620     [[link boost_asio.reference.posix__basic_stream_descriptor.impl_ [*impl_]]]
98621     []
98622   ]
98623
98624 ]
98625
98626 The [link boost_asio.reference.posix__basic_stream_descriptor `posix::basic_stream_descriptor`] class template provides asynchronous and blocking stream-oriented descriptor functionality.
98627
98628
98629 [heading Thread Safety]
98630   
98631 ['Distinct] ['objects:] Safe.
98632
98633 ['Shared] ['objects:] Unsafe.
98634
98635
98636
98637
98638
98639 [heading Requirements]
98640
98641 ['Header: ][^boost/asio/posix/basic_stream_descriptor.hpp]
98642
98643 ['Convenience header: ][^boost/asio.hpp]
98644
98645
98646 [endsect]
98647
98648
98649
98650 [endsect]
98651
98652
98653 [section:posix__descriptor posix::descriptor]
98654
98655 [indexterm1 boost_asio.indexterm.posix__descriptor..posix::descriptor] 
98656 Typedef for the typical usage of [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`]. 
98657
98658
98659   typedef basic_descriptor descriptor;
98660
98661
98662 [heading Types]
98663 [table
98664   [[Name][Description]]
98665
98666   [
98667
98668     [[link boost_asio.reference.posix__basic_descriptor__rebind_executor [*rebind_executor]]]
98669     [Rebinds the descriptor type to another executor. ]
98670   
98671   ]
98672
98673   [
98674
98675     [[link boost_asio.reference.posix__basic_descriptor.bytes_readable [*bytes_readable]]]
98676     [IO control command to get the amount of data that can be read without blocking. ]
98677   
98678   ]
98679
98680   [
98681
98682     [[link boost_asio.reference.posix__basic_descriptor.executor_type [*executor_type]]]
98683     [The type of the executor associated with the object. ]
98684   
98685   ]
98686
98687   [
98688
98689     [[link boost_asio.reference.posix__basic_descriptor.lowest_layer_type [*lowest_layer_type]]]
98690     [A descriptor is always the lowest layer. ]
98691   
98692   ]
98693
98694   [
98695
98696     [[link boost_asio.reference.posix__basic_descriptor.native_handle_type [*native_handle_type]]]
98697     [The native representation of a descriptor. ]
98698   
98699   ]
98700
98701   [
98702
98703     [[link boost_asio.reference.posix__basic_descriptor.wait_type [*wait_type]]]
98704     [Wait types. ]
98705   
98706   ]
98707
98708 ]
98709
98710 [heading Member Functions]
98711 [table
98712   [[Name][Description]]
98713
98714   [
98715     [[link boost_asio.reference.posix__basic_descriptor.assign [*assign]]]
98716     [Assign an existing native descriptor to the descriptor. ]
98717   ]
98718   
98719   [
98720     [[link boost_asio.reference.posix__basic_descriptor.async_wait [*async_wait]]]
98721     [Asynchronously wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
98722   ]
98723   
98724   [
98725     [[link boost_asio.reference.posix__basic_descriptor.basic_descriptor [*basic_descriptor]]]
98726     [Construct a descriptor without opening it. 
98727      [hr]
98728      Construct a descriptor on an existing native descriptor. 
98729      [hr]
98730      Move-construct a descriptor from another. ]
98731   ]
98732   
98733   [
98734     [[link boost_asio.reference.posix__basic_descriptor.cancel [*cancel]]]
98735     [Cancel all asynchronous operations associated with the descriptor. ]
98736   ]
98737   
98738   [
98739     [[link boost_asio.reference.posix__basic_descriptor.close [*close]]]
98740     [Close the descriptor. ]
98741   ]
98742   
98743   [
98744     [[link boost_asio.reference.posix__basic_descriptor.get_executor [*get_executor]]]
98745     [Get the executor associated with the object. ]
98746   ]
98747   
98748   [
98749     [[link boost_asio.reference.posix__basic_descriptor.io_control [*io_control]]]
98750     [Perform an IO control command on the descriptor. ]
98751   ]
98752   
98753   [
98754     [[link boost_asio.reference.posix__basic_descriptor.is_open [*is_open]]]
98755     [Determine whether the descriptor is open. ]
98756   ]
98757   
98758   [
98759     [[link boost_asio.reference.posix__basic_descriptor.lowest_layer [*lowest_layer]]]
98760     [Get a reference to the lowest layer. 
98761      [hr]
98762      Get a const reference to the lowest layer. ]
98763   ]
98764   
98765   [
98766     [[link boost_asio.reference.posix__basic_descriptor.native_handle [*native_handle]]]
98767     [Get the native descriptor representation. ]
98768   ]
98769   
98770   [
98771     [[link boost_asio.reference.posix__basic_descriptor.native_non_blocking [*native_non_blocking]]]
98772     [Gets the non-blocking mode of the native descriptor implementation. 
98773      [hr]
98774      Sets the non-blocking mode of the native descriptor implementation. ]
98775   ]
98776   
98777   [
98778     [[link boost_asio.reference.posix__basic_descriptor.non_blocking [*non_blocking]]]
98779     [Gets the non-blocking mode of the descriptor. 
98780      [hr]
98781      Sets the non-blocking mode of the descriptor. ]
98782   ]
98783   
98784   [
98785     [[link boost_asio.reference.posix__basic_descriptor.operator_eq_ [*operator=]]]
98786     [Move-assign a descriptor from another. ]
98787   ]
98788   
98789   [
98790     [[link boost_asio.reference.posix__basic_descriptor.release [*release]]]
98791     [Release ownership of the native descriptor implementation. ]
98792   ]
98793   
98794   [
98795     [[link boost_asio.reference.posix__basic_descriptor.wait [*wait]]]
98796     [Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
98797   ]
98798   
98799 ]
98800
98801 [heading Protected Member Functions]
98802 [table
98803   [[Name][Description]]
98804
98805   [
98806     [[link boost_asio.reference.posix__basic_descriptor._basic_descriptor [*~basic_descriptor]]]
98807     [Protected destructor to prevent deletion through this type. ]
98808   ]
98809   
98810 ]
98811
98812 [heading Protected Data Members]
98813 [table
98814   [[Name][Description]]
98815
98816   [
98817     [[link boost_asio.reference.posix__basic_descriptor.impl_ [*impl_]]]
98818     []
98819   ]
98820
98821 ]
98822
98823 The [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] class template provides the ability to wrap a POSIX descriptor.
98824
98825
98826 [heading Thread Safety]
98827   
98828 ['Distinct] ['objects:] Safe.
98829
98830 ['Shared] ['objects:] Unsafe. 
98831
98832
98833
98834
98835 [heading Requirements]
98836
98837 ['Header: ][^boost/asio/posix/descriptor.hpp]
98838
98839 ['Convenience header: ][^boost/asio.hpp]
98840
98841
98842 [endsect]
98843
98844
98845 [section:posix__descriptor_base posix::descriptor_base]
98846
98847
98848 The [link boost_asio.reference.posix__descriptor_base `posix::descriptor_base`] class is used as a base for the descriptor class as a place to define the associated IO control commands. 
98849
98850
98851   class descriptor_base
98852
98853
98854 [heading Types]
98855 [table
98856   [[Name][Description]]
98857
98858   [
98859
98860     [[link boost_asio.reference.posix__descriptor_base.bytes_readable [*bytes_readable]]]
98861     [IO control command to get the amount of data that can be read without blocking. ]
98862   
98863   ]
98864
98865   [
98866
98867     [[link boost_asio.reference.posix__descriptor_base.wait_type [*wait_type]]]
98868     [Wait types. ]
98869   
98870   ]
98871
98872 ]
98873
98874 [heading Protected Member Functions]
98875 [table
98876   [[Name][Description]]
98877
98878   [
98879     [[link boost_asio.reference.posix__descriptor_base._descriptor_base [*~descriptor_base]]]
98880     [Protected destructor to prevent deletion through this type. ]
98881   ]
98882   
98883 ]
98884
98885 [heading Requirements]
98886
98887 ['Header: ][^boost/asio/posix/descriptor_base.hpp]
98888
98889 ['Convenience header: ][^boost/asio.hpp]
98890
98891
98892 [section:bytes_readable posix::descriptor_base::bytes_readable]
98893
98894 [indexterm2 boost_asio.indexterm.posix__descriptor_base.bytes_readable..bytes_readable..posix::descriptor_base] 
98895 IO control command to get the amount of data that can be read without blocking. 
98896
98897
98898   typedef implementation_defined bytes_readable;
98899
98900
98901
98902 Implements the FIONREAD IO control command.
98903
98904
98905 [heading Example]
98906   
98907
98908
98909    boost::asio::posix::stream_descriptor descriptor(my_context);
98910    ...
98911    boost::asio::descriptor_base::bytes_readable command(true);
98912    descriptor.io_control(command);
98913    std::size_t bytes_readable = command.get();
98914
98915
98916
98917
98918
98919
98920
98921 [heading Requirements]
98922
98923 ['Header: ][^boost/asio/posix/descriptor_base.hpp]
98924
98925 ['Convenience header: ][^boost/asio.hpp]
98926
98927
98928 [endsect]
98929
98930
98931
98932 [section:wait_type posix::descriptor_base::wait_type]
98933
98934 [indexterm2 boost_asio.indexterm.posix__descriptor_base.wait_type..wait_type..posix::descriptor_base] 
98935 Wait types. 
98936
98937
98938   enum wait_type
98939
98940 [indexterm2 boost_asio.indexterm.posix__descriptor_base.wait_type.wait_read..wait_read..posix::descriptor_base]
98941 [indexterm2 boost_asio.indexterm.posix__descriptor_base.wait_type.wait_write..wait_write..posix::descriptor_base]
98942 [indexterm2 boost_asio.indexterm.posix__descriptor_base.wait_type.wait_error..wait_error..posix::descriptor_base]
98943
98944 [heading Values]
98945 [variablelist
98946
98947   [
98948     [wait_read]
98949     [Wait for a descriptor to become ready to read. ]
98950   ]
98951
98952   [
98953     [wait_write]
98954     [Wait for a descriptor to become ready to write. ]
98955   ]
98956
98957   [
98958     [wait_error]
98959     [Wait for a descriptor to have error conditions pending. ]
98960   ]
98961
98962 ]
98963
98964
98965 For use with `descriptor::wait()` and `descriptor::async_wait()`. 
98966
98967
98968 [endsect]
98969
98970
98971
98972 [section:_descriptor_base posix::descriptor_base::~descriptor_base]
98973
98974 [indexterm2 boost_asio.indexterm.posix__descriptor_base._descriptor_base..~descriptor_base..posix::descriptor_base] 
98975 Protected destructor to prevent deletion through this type. 
98976
98977
98978   ~descriptor_base();
98979
98980
98981
98982 [endsect]
98983
98984
98985
98986 [endsect]
98987
98988
98989 [section:posix__stream_descriptor posix::stream_descriptor]
98990
98991 [indexterm1 boost_asio.indexterm.posix__stream_descriptor..posix::stream_descriptor] 
98992 Typedef for the typical usage of a stream-oriented descriptor. 
98993
98994
98995   typedef basic_stream_descriptor stream_descriptor;
98996
98997
98998 [heading Types]
98999 [table
99000   [[Name][Description]]
99001
99002   [
99003
99004     [[link boost_asio.reference.posix__basic_stream_descriptor__rebind_executor [*rebind_executor]]]
99005     [Rebinds the descriptor type to another executor. ]
99006   
99007   ]
99008
99009   [
99010
99011     [[link boost_asio.reference.posix__basic_stream_descriptor.bytes_readable [*bytes_readable]]]
99012     [IO control command to get the amount of data that can be read without blocking. ]
99013   
99014   ]
99015
99016   [
99017
99018     [[link boost_asio.reference.posix__basic_stream_descriptor.executor_type [*executor_type]]]
99019     [The type of the executor associated with the object. ]
99020   
99021   ]
99022
99023   [
99024
99025     [[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer_type [*lowest_layer_type]]]
99026     [A descriptor is always the lowest layer. ]
99027   
99028   ]
99029
99030   [
99031
99032     [[link boost_asio.reference.posix__basic_stream_descriptor.native_handle_type [*native_handle_type]]]
99033     [The native representation of a descriptor. ]
99034   
99035   ]
99036
99037   [
99038
99039     [[link boost_asio.reference.posix__basic_stream_descriptor.wait_type [*wait_type]]]
99040     [Wait types. ]
99041   
99042   ]
99043
99044 ]
99045
99046 [heading Member Functions]
99047 [table
99048   [[Name][Description]]
99049
99050   [
99051     [[link boost_asio.reference.posix__basic_stream_descriptor.assign [*assign]]]
99052     [Assign an existing native descriptor to the descriptor. ]
99053   ]
99054   
99055   [
99056     [[link boost_asio.reference.posix__basic_stream_descriptor.async_read_some [*async_read_some]]]
99057     [Start an asynchronous read. ]
99058   ]
99059   
99060   [
99061     [[link boost_asio.reference.posix__basic_stream_descriptor.async_wait [*async_wait]]]
99062     [Asynchronously wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
99063   ]
99064   
99065   [
99066     [[link boost_asio.reference.posix__basic_stream_descriptor.async_write_some [*async_write_some]]]
99067     [Start an asynchronous write. ]
99068   ]
99069   
99070   [
99071     [[link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor [*basic_stream_descriptor]]]
99072     [Construct a stream descriptor without opening it. 
99073      [hr]
99074      Construct a stream descriptor on an existing native descriptor. 
99075      [hr]
99076      Move-construct a stream descriptor from another. ]
99077   ]
99078   
99079   [
99080     [[link boost_asio.reference.posix__basic_stream_descriptor.cancel [*cancel]]]
99081     [Cancel all asynchronous operations associated with the descriptor. ]
99082   ]
99083   
99084   [
99085     [[link boost_asio.reference.posix__basic_stream_descriptor.close [*close]]]
99086     [Close the descriptor. ]
99087   ]
99088   
99089   [
99090     [[link boost_asio.reference.posix__basic_stream_descriptor.get_executor [*get_executor]]]
99091     [Get the executor associated with the object. ]
99092   ]
99093   
99094   [
99095     [[link boost_asio.reference.posix__basic_stream_descriptor.io_control [*io_control]]]
99096     [Perform an IO control command on the descriptor. ]
99097   ]
99098   
99099   [
99100     [[link boost_asio.reference.posix__basic_stream_descriptor.is_open [*is_open]]]
99101     [Determine whether the descriptor is open. ]
99102   ]
99103   
99104   [
99105     [[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer [*lowest_layer]]]
99106     [Get a reference to the lowest layer. 
99107      [hr]
99108      Get a const reference to the lowest layer. ]
99109   ]
99110   
99111   [
99112     [[link boost_asio.reference.posix__basic_stream_descriptor.native_handle [*native_handle]]]
99113     [Get the native descriptor representation. ]
99114   ]
99115   
99116   [
99117     [[link boost_asio.reference.posix__basic_stream_descriptor.native_non_blocking [*native_non_blocking]]]
99118     [Gets the non-blocking mode of the native descriptor implementation. 
99119      [hr]
99120      Sets the non-blocking mode of the native descriptor implementation. ]
99121   ]
99122   
99123   [
99124     [[link boost_asio.reference.posix__basic_stream_descriptor.non_blocking [*non_blocking]]]
99125     [Gets the non-blocking mode of the descriptor. 
99126      [hr]
99127      Sets the non-blocking mode of the descriptor. ]
99128   ]
99129   
99130   [
99131     [[link boost_asio.reference.posix__basic_stream_descriptor.operator_eq_ [*operator=]]]
99132     [Move-assign a stream descriptor from another. ]
99133   ]
99134   
99135   [
99136     [[link boost_asio.reference.posix__basic_stream_descriptor.read_some [*read_some]]]
99137     [Read some data from the descriptor. ]
99138   ]
99139   
99140   [
99141     [[link boost_asio.reference.posix__basic_stream_descriptor.release [*release]]]
99142     [Release ownership of the native descriptor implementation. ]
99143   ]
99144   
99145   [
99146     [[link boost_asio.reference.posix__basic_stream_descriptor.wait [*wait]]]
99147     [Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
99148   ]
99149   
99150   [
99151     [[link boost_asio.reference.posix__basic_stream_descriptor.write_some [*write_some]]]
99152     [Write some data to the descriptor. ]
99153   ]
99154   
99155 ]
99156
99157 [heading Protected Data Members]
99158 [table
99159   [[Name][Description]]
99160
99161   [
99162     [[link boost_asio.reference.posix__basic_stream_descriptor.impl_ [*impl_]]]
99163     []
99164   ]
99165
99166 ]
99167
99168 The [link boost_asio.reference.posix__basic_stream_descriptor `posix::basic_stream_descriptor`] class template provides asynchronous and blocking stream-oriented descriptor functionality.
99169
99170
99171 [heading Thread Safety]
99172   
99173 ['Distinct] ['objects:] Safe.
99174
99175 ['Shared] ['objects:] Unsafe.
99176
99177
99178
99179
99180
99181 [heading Requirements]
99182
99183 ['Header: ][^boost/asio/posix/stream_descriptor.hpp]
99184
99185 ['Convenience header: ][^boost/asio.hpp]
99186
99187
99188 [endsect]
99189
99190
99191 [section:post post]
99192
99193 [indexterm1 boost_asio.indexterm.post..post] 
99194 Submits a completion token or function object for execution. 
99195
99196   template<
99197       typename CompletionToken>
99198   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.post.overload1 post]``(
99199       CompletionToken && token);
99200   ``  [''''&raquo;''' [link boost_asio.reference.post.overload1 more...]]``
99201
99202   template<
99203       typename ``[link boost_asio.reference.Executor1 Executor]``,
99204       typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
99205   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.post.overload2 post]``(
99206       const Executor & ex,
99207       CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
99208       typename enable_if< is_executor< Executor >::value >::type *  = 0);
99209   ``  [''''&raquo;''' [link boost_asio.reference.post.overload2 more...]]``
99210
99211   template<
99212       typename ExecutionContext,
99213       typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
99214   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.post.overload3 post]``(
99215       ExecutionContext & ctx,
99216       CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
99217       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
99218   ``  [''''&raquo;''' [link boost_asio.reference.post.overload3 more...]]``
99219
99220 [heading Requirements]
99221
99222 ['Header: ][^boost/asio/post.hpp]
99223
99224 ['Convenience header: ][^boost/asio.hpp]
99225
99226
99227 [section:overload1 post (1 of 3 overloads)]
99228
99229
99230 Submits a completion token or function object for execution. 
99231
99232
99233   template<
99234       typename CompletionToken>
99235   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` post(
99236       CompletionToken && token);
99237
99238
99239 This function submits an object for execution using the object's associated executor. The function object is queued for execution, and is never called from the current thread prior to returning from `post()`.
99240
99241 The use of `post()`, rather than [link boost_asio.reference.defer `defer`] , indicates the caller's preference that the function object be eagerly queued for execution.
99242
99243 This function has the following effects:
99244
99245
99246 * Constructs a function object handler of type `Handler`, initialized with `handler(forward<CompletionToken>(token))`.
99247
99248
99249 * Constructs an object `result` of type `async_result<Handler>`, initializing the object as `result(handler)`.
99250
99251
99252 * Obtains the handler's associated executor object `ex` by performing `get_associated_executor(handler)`.
99253
99254
99255 * Obtains the handler's associated allocator object `alloc` by performing `get_associated_allocator(handler)`.
99256
99257
99258 * Performs `ex.post(std::move(handler), alloc)`.
99259
99260
99261 * Returns `result.get()`. 
99262
99263
99264
99265
99266 [endsect]
99267
99268
99269
99270 [section:overload2 post (2 of 3 overloads)]
99271
99272
99273 Submits a completion token or function object for execution. 
99274
99275
99276   template<
99277       typename ``[link boost_asio.reference.Executor1 Executor]``,
99278       typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
99279   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` post(
99280       const Executor & ex,
99281       CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
99282       typename enable_if< is_executor< Executor >::value >::type *  = 0);
99283
99284
99285 This function submits an object for execution using the specified executor. The function object is queued for execution, and is never called from the current thread prior to returning from `post()`.
99286
99287 The use of `post()`, rather than [link boost_asio.reference.defer `defer`] , indicates the caller's preference that the function object be eagerly queued for execution.
99288
99289 This function has the following effects:
99290
99291
99292 * Constructs a function object handler of type `Handler`, initialized with `handler(forward<CompletionToken>(token))`.
99293
99294
99295 * Constructs an object `result` of type `async_result<Handler>`, initializing the object as `result(handler)`.
99296
99297
99298 * Obtains the handler's associated executor object `ex1` by performing `get_associated_executor(handler)`.
99299
99300
99301 * Creates a work object `w` by performing `make_work(ex1)`.
99302
99303
99304 * Obtains the handler's associated allocator object `alloc` by performing `get_associated_allocator(handler)`.
99305
99306
99307 * Constructs a function object `f` with a function call operator that performs `ex1.dispatch(std::move(handler), alloc)` followed by `w.reset()`.
99308
99309
99310 * Performs `Executor(ex).post(std::move(f), alloc)`.
99311
99312
99313 * Returns `result.get()`. 
99314
99315
99316
99317
99318 [endsect]
99319
99320
99321
99322 [section:overload3 post (3 of 3 overloads)]
99323
99324
99325 Submits a completion token or function object for execution. 
99326
99327
99328   template<
99329       typename ExecutionContext,
99330       typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
99331   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` post(
99332       ExecutionContext & ctx,
99333       CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
99334       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
99335
99336
99337
99338 [heading Return Value]
99339       
99340 `post(ctx.get_executor(), forward<CompletionToken>(token))`. 
99341
99342
99343
99344
99345 [endsect]
99346
99347
99348 [endsect]
99349
99350 [section:read read]
99351
99352 [indexterm1 boost_asio.indexterm.read..read] 
99353 The `read` function is a composed operation that reads a certain amount of data from a stream before returning. 
99354
99355
99356 Attempt to read a certain amount of data from a stream before returning. 
99357
99358   template<
99359       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
99360       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
99361   std::size_t ``[link boost_asio.reference.read.overload1 read]``(
99362       SyncReadStream & s,
99363       const MutableBufferSequence & buffers,
99364       typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type *  = 0);
99365   ``  [''''&raquo;''' [link boost_asio.reference.read.overload1 more...]]``
99366
99367   template<
99368       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
99369       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
99370   std::size_t ``[link boost_asio.reference.read.overload2 read]``(
99371       SyncReadStream & s,
99372       const MutableBufferSequence & buffers,
99373       boost::system::error_code & ec,
99374       typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type *  = 0);
99375   ``  [''''&raquo;''' [link boost_asio.reference.read.overload2 more...]]``
99376
99377   template<
99378       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
99379       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
99380       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
99381   std::size_t ``[link boost_asio.reference.read.overload3 read]``(
99382       SyncReadStream & s,
99383       const MutableBufferSequence & buffers,
99384       CompletionCondition completion_condition,
99385       typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type *  = 0);
99386   ``  [''''&raquo;''' [link boost_asio.reference.read.overload3 more...]]``
99387
99388   template<
99389       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
99390       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
99391       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
99392   std::size_t ``[link boost_asio.reference.read.overload4 read]``(
99393       SyncReadStream & s,
99394       const MutableBufferSequence & buffers,
99395       CompletionCondition completion_condition,
99396       boost::system::error_code & ec,
99397       typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type *  = 0);
99398   ``  [''''&raquo;''' [link boost_asio.reference.read.overload4 more...]]``
99399
99400   template<
99401       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
99402       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
99403   std::size_t ``[link boost_asio.reference.read.overload5 read]``(
99404       SyncReadStream & s,
99405       DynamicBuffer_v1 && buffers,
99406       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
99407   ``  [''''&raquo;''' [link boost_asio.reference.read.overload5 more...]]``
99408
99409   template<
99410       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
99411       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
99412   std::size_t ``[link boost_asio.reference.read.overload6 read]``(
99413       SyncReadStream & s,
99414       DynamicBuffer_v1 && buffers,
99415       boost::system::error_code & ec,
99416       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
99417   ``  [''''&raquo;''' [link boost_asio.reference.read.overload6 more...]]``
99418
99419   template<
99420       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
99421       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
99422       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
99423   std::size_t ``[link boost_asio.reference.read.overload7 read]``(
99424       SyncReadStream & s,
99425       DynamicBuffer_v1 && buffers,
99426       CompletionCondition completion_condition,
99427       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
99428   ``  [''''&raquo;''' [link boost_asio.reference.read.overload7 more...]]``
99429
99430   template<
99431       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
99432       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
99433       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
99434   std::size_t ``[link boost_asio.reference.read.overload8 read]``(
99435       SyncReadStream & s,
99436       DynamicBuffer_v1 && buffers,
99437       CompletionCondition completion_condition,
99438       boost::system::error_code & ec,
99439       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
99440   ``  [''''&raquo;''' [link boost_asio.reference.read.overload8 more...]]``
99441
99442   template<
99443       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
99444       typename Allocator>
99445   std::size_t ``[link boost_asio.reference.read.overload9 read]``(
99446       SyncReadStream & s,
99447       basic_streambuf< Allocator > & b);
99448   ``  [''''&raquo;''' [link boost_asio.reference.read.overload9 more...]]``
99449
99450   template<
99451       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
99452       typename Allocator>
99453   std::size_t ``[link boost_asio.reference.read.overload10 read]``(
99454       SyncReadStream & s,
99455       basic_streambuf< Allocator > & b,
99456       boost::system::error_code & ec);
99457   ``  [''''&raquo;''' [link boost_asio.reference.read.overload10 more...]]``
99458
99459   template<
99460       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
99461       typename Allocator,
99462       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
99463   std::size_t ``[link boost_asio.reference.read.overload11 read]``(
99464       SyncReadStream & s,
99465       basic_streambuf< Allocator > & b,
99466       CompletionCondition completion_condition);
99467   ``  [''''&raquo;''' [link boost_asio.reference.read.overload11 more...]]``
99468
99469   template<
99470       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
99471       typename Allocator,
99472       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
99473   std::size_t ``[link boost_asio.reference.read.overload12 read]``(
99474       SyncReadStream & s,
99475       basic_streambuf< Allocator > & b,
99476       CompletionCondition completion_condition,
99477       boost::system::error_code & ec);
99478   ``  [''''&raquo;''' [link boost_asio.reference.read.overload12 more...]]``
99479
99480   template<
99481       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
99482       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
99483   std::size_t ``[link boost_asio.reference.read.overload13 read]``(
99484       SyncReadStream & s,
99485       DynamicBuffer_v2 buffers,
99486       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
99487   ``  [''''&raquo;''' [link boost_asio.reference.read.overload13 more...]]``
99488
99489   template<
99490       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
99491       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
99492   std::size_t ``[link boost_asio.reference.read.overload14 read]``(
99493       SyncReadStream & s,
99494       DynamicBuffer_v2 buffers,
99495       boost::system::error_code & ec,
99496       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
99497   ``  [''''&raquo;''' [link boost_asio.reference.read.overload14 more...]]``
99498
99499   template<
99500       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
99501       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
99502       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
99503   std::size_t ``[link boost_asio.reference.read.overload15 read]``(
99504       SyncReadStream & s,
99505       DynamicBuffer_v2 buffers,
99506       CompletionCondition completion_condition,
99507       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
99508   ``  [''''&raquo;''' [link boost_asio.reference.read.overload15 more...]]``
99509
99510   template<
99511       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
99512       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
99513       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
99514   std::size_t ``[link boost_asio.reference.read.overload16 read]``(
99515       SyncReadStream & s,
99516       DynamicBuffer_v2 buffers,
99517       CompletionCondition completion_condition,
99518       boost::system::error_code & ec,
99519       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
99520   ``  [''''&raquo;''' [link boost_asio.reference.read.overload16 more...]]``
99521
99522 [heading Requirements]
99523
99524 ['Header: ][^boost/asio/read.hpp]
99525
99526 ['Convenience header: ][^boost/asio.hpp]
99527
99528
99529 [section:overload1 read (1 of 16 overloads)]
99530
99531
99532 Attempt to read a certain amount of data from a stream before returning. 
99533
99534
99535   template<
99536       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
99537       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
99538   std::size_t read(
99539       SyncReadStream & s,
99540       const MutableBufferSequence & buffers,
99541       typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type *  = 0);
99542
99543
99544 This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
99545
99546
99547 * The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
99548
99549
99550 * An error occurred.
99551
99552 This operation is implemented in terms of zero or more calls to the stream's read\_some function.
99553
99554
99555 [heading Parameters]
99556     
99557
99558 [variablelist
99559   
99560 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
99561
99562 [[buffers][One or more buffers into which the data will be read. The sum of the buffer sizes indicates the maximum number of bytes to read from the stream.]]
99563
99564 ]
99565
99566
99567 [heading Return Value]
99568       
99569 The number of bytes transferred.
99570
99571
99572 [heading Exceptions]
99573     
99574
99575 [variablelist
99576   
99577 [[boost::system::system_error][Thrown on failure.]]
99578
99579 ]
99580
99581
99582 [heading Example]
99583   
99584 To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
99585
99586    boost::asio::read(s, boost::asio::buffer(data, size)); 
99587
99588
99589 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
99590
99591
99592 [heading Remarks]
99593       
99594 This overload is equivalent to calling: 
99595
99596    boost::asio::read(
99597        s, buffers,
99598        boost::asio::transfer_all()); 
99599
99600
99601
99602
99603
99604
99605
99606 [endsect]
99607
99608
99609
99610 [section:overload2 read (2 of 16 overloads)]
99611
99612
99613 Attempt to read a certain amount of data from a stream before returning. 
99614
99615
99616   template<
99617       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
99618       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
99619   std::size_t read(
99620       SyncReadStream & s,
99621       const MutableBufferSequence & buffers,
99622       boost::system::error_code & ec,
99623       typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type *  = 0);
99624
99625
99626 This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
99627
99628
99629 * The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
99630
99631
99632 * An error occurred.
99633
99634 This operation is implemented in terms of zero or more calls to the stream's read\_some function.
99635
99636
99637 [heading Parameters]
99638     
99639
99640 [variablelist
99641   
99642 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
99643
99644 [[buffers][One or more buffers into which the data will be read. The sum of the buffer sizes indicates the maximum number of bytes to read from the stream.]]
99645
99646 [[ec][Set to indicate what error occurred, if any.]]
99647
99648 ]
99649
99650
99651 [heading Return Value]
99652       
99653 The number of bytes transferred.
99654
99655
99656 [heading Example]
99657   
99658 To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
99659
99660    boost::asio::read(s, boost::asio::buffer(data, size), ec); 
99661
99662
99663 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
99664
99665
99666 [heading Remarks]
99667       
99668 This overload is equivalent to calling: 
99669
99670    boost::asio::read(
99671        s, buffers,
99672        boost::asio::transfer_all(), ec); 
99673
99674
99675
99676
99677
99678
99679
99680 [endsect]
99681
99682
99683
99684 [section:overload3 read (3 of 16 overloads)]
99685
99686
99687 Attempt to read a certain amount of data from a stream before returning. 
99688
99689
99690   template<
99691       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
99692       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
99693       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
99694   std::size_t read(
99695       SyncReadStream & s,
99696       const MutableBufferSequence & buffers,
99697       CompletionCondition completion_condition,
99698       typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type *  = 0);
99699
99700
99701 This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
99702
99703
99704 * The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
99705
99706
99707 * The completion\_condition function object returns 0.
99708
99709 This operation is implemented in terms of zero or more calls to the stream's read\_some function.
99710
99711
99712 [heading Parameters]
99713     
99714
99715 [variablelist
99716   
99717 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
99718
99719 [[buffers][One or more buffers into which the data will be read. The sum of the buffer sizes indicates the maximum number of bytes to read from the stream.]]
99720
99721 [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 
99722 ``
99723    std::size_t completion_condition(
99724      // Result of latest read_some operation.
99725      const boost::system::error_code& error,
99726
99727      // Number of bytes transferred so far.
99728      std::size_t bytes_transferred
99729    ); 
99730 ``
99731 A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's read\_some function.]]
99732
99733 ]
99734
99735
99736 [heading Return Value]
99737       
99738 The number of bytes transferred.
99739
99740
99741 [heading Exceptions]
99742     
99743
99744 [variablelist
99745   
99746 [[boost::system::system_error][Thrown on failure.]]
99747
99748 ]
99749
99750
99751 [heading Example]
99752   
99753 To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
99754
99755    boost::asio::read(s, boost::asio::buffer(data, size),
99756        boost::asio::transfer_at_least(32)); 
99757
99758
99759 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
99760
99761
99762
99763
99764 [endsect]
99765
99766
99767
99768 [section:overload4 read (4 of 16 overloads)]
99769
99770
99771 Attempt to read a certain amount of data from a stream before returning. 
99772
99773
99774   template<
99775       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
99776       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
99777       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
99778   std::size_t read(
99779       SyncReadStream & s,
99780       const MutableBufferSequence & buffers,
99781       CompletionCondition completion_condition,
99782       boost::system::error_code & ec,
99783       typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type *  = 0);
99784
99785
99786 This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
99787
99788
99789 * The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
99790
99791
99792 * The completion\_condition function object returns 0.
99793
99794 This operation is implemented in terms of zero or more calls to the stream's read\_some function.
99795
99796
99797 [heading Parameters]
99798     
99799
99800 [variablelist
99801   
99802 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
99803
99804 [[buffers][One or more buffers into which the data will be read. The sum of the buffer sizes indicates the maximum number of bytes to read from the stream.]]
99805
99806 [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 
99807 ``
99808    std::size_t completion_condition(
99809      // Result of latest read_some operation.
99810      const boost::system::error_code& error,
99811
99812      // Number of bytes transferred so far.
99813      std::size_t bytes_transferred
99814    ); 
99815 ``
99816 A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's read\_some function.]]
99817
99818 [[ec][Set to indicate what error occurred, if any.]]
99819
99820 ]
99821
99822
99823 [heading Return Value]
99824       
99825 The number of bytes read. If an error occurs, returns the total number of bytes successfully transferred prior to the error. 
99826
99827
99828
99829
99830 [endsect]
99831
99832
99833
99834 [section:overload5 read (5 of 16 overloads)]
99835
99836
99837 Attempt to read a certain amount of data from a stream before returning. 
99838
99839
99840   template<
99841       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
99842       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
99843   std::size_t read(
99844       SyncReadStream & s,
99845       DynamicBuffer_v1 && buffers,
99846       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
99847
99848
99849 This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
99850
99851
99852 * The specified dynamic buffer sequence is full (that is, it has reached maximum size).
99853
99854
99855 * An error occurred.
99856
99857 This operation is implemented in terms of zero or more calls to the stream's read\_some function.
99858
99859
99860 [heading Parameters]
99861     
99862
99863 [variablelist
99864   
99865 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
99866
99867 [[buffers][The dynamic buffer sequence into which the data will be read.]]
99868
99869 ]
99870
99871
99872 [heading Return Value]
99873       
99874 The number of bytes transferred.
99875
99876
99877 [heading Exceptions]
99878     
99879
99880 [variablelist
99881   
99882 [[boost::system::system_error][Thrown on failure.]]
99883
99884 ]
99885
99886
99887 [heading Remarks]
99888       
99889 This overload is equivalent to calling: 
99890
99891    boost::asio::read(
99892        s, buffers,
99893        boost::asio::transfer_all()); 
99894
99895
99896
99897
99898
99899
99900
99901 [endsect]
99902
99903
99904
99905 [section:overload6 read (6 of 16 overloads)]
99906
99907
99908 Attempt to read a certain amount of data from a stream before returning. 
99909
99910
99911   template<
99912       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
99913       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
99914   std::size_t read(
99915       SyncReadStream & s,
99916       DynamicBuffer_v1 && buffers,
99917       boost::system::error_code & ec,
99918       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
99919
99920
99921 This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
99922
99923
99924 * The supplied buffer is full (that is, it has reached maximum size).
99925
99926
99927 * An error occurred.
99928
99929 This operation is implemented in terms of zero or more calls to the stream's read\_some function.
99930
99931
99932 [heading Parameters]
99933     
99934
99935 [variablelist
99936   
99937 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
99938
99939 [[buffers][The dynamic buffer sequence into which the data will be read.]]
99940
99941 [[ec][Set to indicate what error occurred, if any.]]
99942
99943 ]
99944
99945
99946 [heading Return Value]
99947       
99948 The number of bytes transferred.
99949
99950
99951 [heading Remarks]
99952       
99953 This overload is equivalent to calling: 
99954
99955    boost::asio::read(
99956        s, buffers,
99957        boost::asio::transfer_all(), ec); 
99958
99959
99960
99961
99962
99963
99964
99965 [endsect]
99966
99967
99968
99969 [section:overload7 read (7 of 16 overloads)]
99970
99971
99972 Attempt to read a certain amount of data from a stream before returning. 
99973
99974
99975   template<
99976       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
99977       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
99978       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
99979   std::size_t read(
99980       SyncReadStream & s,
99981       DynamicBuffer_v1 && buffers,
99982       CompletionCondition completion_condition,
99983       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
99984
99985
99986 This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
99987
99988
99989 * The specified dynamic buffer sequence is full (that is, it has reached maximum size).
99990
99991
99992 * The completion\_condition function object returns 0.
99993
99994 This operation is implemented in terms of zero or more calls to the stream's read\_some function.
99995
99996
99997 [heading Parameters]
99998     
99999
100000 [variablelist
100001   
100002 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
100003
100004 [[buffers][The dynamic buffer sequence into which the data will be read.]]
100005
100006 [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 
100007 ``
100008    std::size_t completion_condition(
100009      // Result of latest read_some operation.
100010      const boost::system::error_code& error,
100011
100012      // Number of bytes transferred so far.
100013      std::size_t bytes_transferred
100014    ); 
100015 ``
100016 A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's read\_some function.]]
100017
100018 ]
100019
100020
100021 [heading Return Value]
100022       
100023 The number of bytes transferred.
100024
100025
100026 [heading Exceptions]
100027     
100028
100029 [variablelist
100030   
100031 [[boost::system::system_error][Thrown on failure. ]]
100032
100033 ]
100034
100035
100036
100037
100038 [endsect]
100039
100040
100041
100042 [section:overload8 read (8 of 16 overloads)]
100043
100044
100045 Attempt to read a certain amount of data from a stream before returning. 
100046
100047
100048   template<
100049       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
100050       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
100051       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
100052   std::size_t read(
100053       SyncReadStream & s,
100054       DynamicBuffer_v1 && buffers,
100055       CompletionCondition completion_condition,
100056       boost::system::error_code & ec,
100057       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
100058
100059
100060 This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
100061
100062
100063 * The specified dynamic buffer sequence is full (that is, it has reached maximum size).
100064
100065
100066 * The completion\_condition function object returns 0.
100067
100068 This operation is implemented in terms of zero or more calls to the stream's read\_some function.
100069
100070
100071 [heading Parameters]
100072     
100073
100074 [variablelist
100075   
100076 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
100077
100078 [[buffers][The dynamic buffer sequence into which the data will be read.]]
100079
100080 [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 
100081 ``
100082    std::size_t completion_condition(
100083      // Result of latest read_some operation.
100084      const boost::system::error_code& error,
100085
100086      // Number of bytes transferred so far.
100087      std::size_t bytes_transferred
100088    ); 
100089 ``
100090 A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's read\_some function.]]
100091
100092 [[ec][Set to indicate what error occurred, if any.]]
100093
100094 ]
100095
100096
100097 [heading Return Value]
100098       
100099 The number of bytes read. If an error occurs, returns the total number of bytes successfully transferred prior to the error. 
100100
100101
100102
100103
100104 [endsect]
100105
100106
100107
100108 [section:overload9 read (9 of 16 overloads)]
100109
100110
100111 Attempt to read a certain amount of data from a stream before returning. 
100112
100113
100114   template<
100115       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
100116       typename Allocator>
100117   std::size_t read(
100118       SyncReadStream & s,
100119       basic_streambuf< Allocator > & b);
100120
100121
100122 This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
100123
100124
100125 * The supplied buffer is full (that is, it has reached maximum size).
100126
100127
100128 * An error occurred.
100129
100130 This operation is implemented in terms of zero or more calls to the stream's read\_some function.
100131
100132
100133 [heading Parameters]
100134     
100135
100136 [variablelist
100137   
100138 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
100139
100140 [[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]]
100141
100142 ]
100143
100144
100145 [heading Return Value]
100146       
100147 The number of bytes transferred.
100148
100149
100150 [heading Exceptions]
100151     
100152
100153 [variablelist
100154   
100155 [[boost::system::system_error][Thrown on failure.]]
100156
100157 ]
100158
100159
100160 [heading Remarks]
100161       
100162 This overload is equivalent to calling: 
100163
100164    boost::asio::read(
100165        s, b,
100166        boost::asio::transfer_all()); 
100167
100168
100169
100170
100171
100172
100173
100174 [endsect]
100175
100176
100177
100178 [section:overload10 read (10 of 16 overloads)]
100179
100180
100181 Attempt to read a certain amount of data from a stream before returning. 
100182
100183
100184   template<
100185       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
100186       typename Allocator>
100187   std::size_t read(
100188       SyncReadStream & s,
100189       basic_streambuf< Allocator > & b,
100190       boost::system::error_code & ec);
100191
100192
100193 This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
100194
100195
100196 * The supplied buffer is full (that is, it has reached maximum size).
100197
100198
100199 * An error occurred.
100200
100201 This operation is implemented in terms of zero or more calls to the stream's read\_some function.
100202
100203
100204 [heading Parameters]
100205     
100206
100207 [variablelist
100208   
100209 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
100210
100211 [[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]]
100212
100213 [[ec][Set to indicate what error occurred, if any.]]
100214
100215 ]
100216
100217
100218 [heading Return Value]
100219       
100220 The number of bytes transferred.
100221
100222
100223 [heading Remarks]
100224       
100225 This overload is equivalent to calling: 
100226
100227    boost::asio::read(
100228        s, b,
100229        boost::asio::transfer_all(), ec); 
100230
100231
100232
100233
100234
100235
100236
100237 [endsect]
100238
100239
100240
100241 [section:overload11 read (11 of 16 overloads)]
100242
100243
100244 Attempt to read a certain amount of data from a stream before returning. 
100245
100246
100247   template<
100248       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
100249       typename Allocator,
100250       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
100251   std::size_t read(
100252       SyncReadStream & s,
100253       basic_streambuf< Allocator > & b,
100254       CompletionCondition completion_condition);
100255
100256
100257 This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
100258
100259
100260 * The supplied buffer is full (that is, it has reached maximum size).
100261
100262
100263 * The completion\_condition function object returns 0.
100264
100265 This operation is implemented in terms of zero or more calls to the stream's read\_some function.
100266
100267
100268 [heading Parameters]
100269     
100270
100271 [variablelist
100272   
100273 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
100274
100275 [[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]]
100276
100277 [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 
100278 ``
100279    std::size_t completion_condition(
100280      // Result of latest read_some operation.
100281      const boost::system::error_code& error,
100282
100283      // Number of bytes transferred so far.
100284      std::size_t bytes_transferred
100285    ); 
100286 ``
100287 A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's read\_some function.]]
100288
100289 ]
100290
100291
100292 [heading Return Value]
100293       
100294 The number of bytes transferred.
100295
100296
100297 [heading Exceptions]
100298     
100299
100300 [variablelist
100301   
100302 [[boost::system::system_error][Thrown on failure. ]]
100303
100304 ]
100305
100306
100307
100308
100309 [endsect]
100310
100311
100312
100313 [section:overload12 read (12 of 16 overloads)]
100314
100315
100316 Attempt to read a certain amount of data from a stream before returning. 
100317
100318
100319   template<
100320       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
100321       typename Allocator,
100322       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
100323   std::size_t read(
100324       SyncReadStream & s,
100325       basic_streambuf< Allocator > & b,
100326       CompletionCondition completion_condition,
100327       boost::system::error_code & ec);
100328
100329
100330 This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
100331
100332
100333 * The supplied buffer is full (that is, it has reached maximum size).
100334
100335
100336 * The completion\_condition function object returns 0.
100337
100338 This operation is implemented in terms of zero or more calls to the stream's read\_some function.
100339
100340
100341 [heading Parameters]
100342     
100343
100344 [variablelist
100345   
100346 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
100347
100348 [[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]]
100349
100350 [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 
100351 ``
100352    std::size_t completion_condition(
100353      // Result of latest read_some operation.
100354      const boost::system::error_code& error,
100355
100356      // Number of bytes transferred so far.
100357      std::size_t bytes_transferred
100358    ); 
100359 ``
100360 A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's read\_some function.]]
100361
100362 [[ec][Set to indicate what error occurred, if any.]]
100363
100364 ]
100365
100366
100367 [heading Return Value]
100368       
100369 The number of bytes read. If an error occurs, returns the total number of bytes successfully transferred prior to the error. 
100370
100371
100372
100373
100374 [endsect]
100375
100376
100377
100378 [section:overload13 read (13 of 16 overloads)]
100379
100380
100381 Attempt to read a certain amount of data from a stream before returning. 
100382
100383
100384   template<
100385       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
100386       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
100387   std::size_t read(
100388       SyncReadStream & s,
100389       DynamicBuffer_v2 buffers,
100390       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
100391
100392
100393 This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
100394
100395
100396 * The specified dynamic buffer sequence is full (that is, it has reached maximum size).
100397
100398
100399 * An error occurred.
100400
100401 This operation is implemented in terms of zero or more calls to the stream's read\_some function.
100402
100403
100404 [heading Parameters]
100405     
100406
100407 [variablelist
100408   
100409 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
100410
100411 [[buffers][The dynamic buffer sequence into which the data will be read.]]
100412
100413 ]
100414
100415
100416 [heading Return Value]
100417       
100418 The number of bytes transferred.
100419
100420
100421 [heading Exceptions]
100422     
100423
100424 [variablelist
100425   
100426 [[boost::system::system_error][Thrown on failure.]]
100427
100428 ]
100429
100430
100431 [heading Remarks]
100432       
100433 This overload is equivalent to calling: 
100434
100435    boost::asio::read(
100436        s, buffers,
100437        boost::asio::transfer_all()); 
100438
100439
100440
100441
100442
100443
100444
100445 [endsect]
100446
100447
100448
100449 [section:overload14 read (14 of 16 overloads)]
100450
100451
100452 Attempt to read a certain amount of data from a stream before returning. 
100453
100454
100455   template<
100456       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
100457       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
100458   std::size_t read(
100459       SyncReadStream & s,
100460       DynamicBuffer_v2 buffers,
100461       boost::system::error_code & ec,
100462       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
100463
100464
100465 This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
100466
100467
100468 * The supplied buffer is full (that is, it has reached maximum size).
100469
100470
100471 * An error occurred.
100472
100473 This operation is implemented in terms of zero or more calls to the stream's read\_some function.
100474
100475
100476 [heading Parameters]
100477     
100478
100479 [variablelist
100480   
100481 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
100482
100483 [[buffers][The dynamic buffer sequence into which the data will be read.]]
100484
100485 [[ec][Set to indicate what error occurred, if any.]]
100486
100487 ]
100488
100489
100490 [heading Return Value]
100491       
100492 The number of bytes transferred.
100493
100494
100495 [heading Remarks]
100496       
100497 This overload is equivalent to calling: 
100498
100499    boost::asio::read(
100500        s, buffers,
100501        boost::asio::transfer_all(), ec); 
100502
100503
100504
100505
100506
100507
100508
100509 [endsect]
100510
100511
100512
100513 [section:overload15 read (15 of 16 overloads)]
100514
100515
100516 Attempt to read a certain amount of data from a stream before returning. 
100517
100518
100519   template<
100520       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
100521       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
100522       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
100523   std::size_t read(
100524       SyncReadStream & s,
100525       DynamicBuffer_v2 buffers,
100526       CompletionCondition completion_condition,
100527       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
100528
100529
100530 This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
100531
100532
100533 * The specified dynamic buffer sequence is full (that is, it has reached maximum size).
100534
100535
100536 * The completion\_condition function object returns 0.
100537
100538 This operation is implemented in terms of zero or more calls to the stream's read\_some function.
100539
100540
100541 [heading Parameters]
100542     
100543
100544 [variablelist
100545   
100546 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
100547
100548 [[buffers][The dynamic buffer sequence into which the data will be read.]]
100549
100550 [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 
100551 ``
100552    std::size_t completion_condition(
100553      // Result of latest read_some operation.
100554      const boost::system::error_code& error,
100555
100556      // Number of bytes transferred so far.
100557      std::size_t bytes_transferred
100558    ); 
100559 ``
100560 A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's read\_some function.]]
100561
100562 ]
100563
100564
100565 [heading Return Value]
100566       
100567 The number of bytes transferred.
100568
100569
100570 [heading Exceptions]
100571     
100572
100573 [variablelist
100574   
100575 [[boost::system::system_error][Thrown on failure. ]]
100576
100577 ]
100578
100579
100580
100581
100582 [endsect]
100583
100584
100585
100586 [section:overload16 read (16 of 16 overloads)]
100587
100588
100589 Attempt to read a certain amount of data from a stream before returning. 
100590
100591
100592   template<
100593       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
100594       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
100595       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
100596   std::size_t read(
100597       SyncReadStream & s,
100598       DynamicBuffer_v2 buffers,
100599       CompletionCondition completion_condition,
100600       boost::system::error_code & ec,
100601       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
100602
100603
100604 This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
100605
100606
100607 * The specified dynamic buffer sequence is full (that is, it has reached maximum size).
100608
100609
100610 * The completion\_condition function object returns 0.
100611
100612 This operation is implemented in terms of zero or more calls to the stream's read\_some function.
100613
100614
100615 [heading Parameters]
100616     
100617
100618 [variablelist
100619   
100620 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
100621
100622 [[buffers][The dynamic buffer sequence into which the data will be read.]]
100623
100624 [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 
100625 ``
100626    std::size_t completion_condition(
100627      // Result of latest read_some operation.
100628      const boost::system::error_code& error,
100629
100630      // Number of bytes transferred so far.
100631      std::size_t bytes_transferred
100632    ); 
100633 ``
100634 A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's read\_some function.]]
100635
100636 [[ec][Set to indicate what error occurred, if any.]]
100637
100638 ]
100639
100640
100641 [heading Return Value]
100642       
100643 The number of bytes read. If an error occurs, returns the total number of bytes successfully transferred prior to the error. 
100644
100645
100646
100647
100648 [endsect]
100649
100650
100651 [endsect]
100652
100653 [section:read_at read_at]
100654
100655 [indexterm1 boost_asio.indexterm.read_at..read_at] 
100656 The `read_at` function is a composed operation that reads a certain amount of data at the specified offset before returning. 
100657
100658
100659 Attempt to read a certain amount of data at the specified offset before returning. 
100660
100661   template<
100662       typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
100663       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
100664   std::size_t ``[link boost_asio.reference.read_at.overload1 read_at]``(
100665       SyncRandomAccessReadDevice & d,
100666       uint64_t offset,
100667       const MutableBufferSequence & buffers);
100668   ``  [''''&raquo;''' [link boost_asio.reference.read_at.overload1 more...]]``
100669
100670   template<
100671       typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
100672       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
100673   std::size_t ``[link boost_asio.reference.read_at.overload2 read_at]``(
100674       SyncRandomAccessReadDevice & d,
100675       uint64_t offset,
100676       const MutableBufferSequence & buffers,
100677       boost::system::error_code & ec);
100678   ``  [''''&raquo;''' [link boost_asio.reference.read_at.overload2 more...]]``
100679
100680   template<
100681       typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
100682       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
100683       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
100684   std::size_t ``[link boost_asio.reference.read_at.overload3 read_at]``(
100685       SyncRandomAccessReadDevice & d,
100686       uint64_t offset,
100687       const MutableBufferSequence & buffers,
100688       CompletionCondition completion_condition);
100689   ``  [''''&raquo;''' [link boost_asio.reference.read_at.overload3 more...]]``
100690
100691   template<
100692       typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
100693       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
100694       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
100695   std::size_t ``[link boost_asio.reference.read_at.overload4 read_at]``(
100696       SyncRandomAccessReadDevice & d,
100697       uint64_t offset,
100698       const MutableBufferSequence & buffers,
100699       CompletionCondition completion_condition,
100700       boost::system::error_code & ec);
100701   ``  [''''&raquo;''' [link boost_asio.reference.read_at.overload4 more...]]``
100702
100703   template<
100704       typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
100705       typename Allocator>
100706   std::size_t ``[link boost_asio.reference.read_at.overload5 read_at]``(
100707       SyncRandomAccessReadDevice & d,
100708       uint64_t offset,
100709       basic_streambuf< Allocator > & b);
100710   ``  [''''&raquo;''' [link boost_asio.reference.read_at.overload5 more...]]``
100711
100712   template<
100713       typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
100714       typename Allocator>
100715   std::size_t ``[link boost_asio.reference.read_at.overload6 read_at]``(
100716       SyncRandomAccessReadDevice & d,
100717       uint64_t offset,
100718       basic_streambuf< Allocator > & b,
100719       boost::system::error_code & ec);
100720   ``  [''''&raquo;''' [link boost_asio.reference.read_at.overload6 more...]]``
100721
100722   template<
100723       typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
100724       typename Allocator,
100725       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
100726   std::size_t ``[link boost_asio.reference.read_at.overload7 read_at]``(
100727       SyncRandomAccessReadDevice & d,
100728       uint64_t offset,
100729       basic_streambuf< Allocator > & b,
100730       CompletionCondition completion_condition);
100731   ``  [''''&raquo;''' [link boost_asio.reference.read_at.overload7 more...]]``
100732
100733   template<
100734       typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
100735       typename Allocator,
100736       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
100737   std::size_t ``[link boost_asio.reference.read_at.overload8 read_at]``(
100738       SyncRandomAccessReadDevice & d,
100739       uint64_t offset,
100740       basic_streambuf< Allocator > & b,
100741       CompletionCondition completion_condition,
100742       boost::system::error_code & ec);
100743   ``  [''''&raquo;''' [link boost_asio.reference.read_at.overload8 more...]]``
100744
100745 [heading Requirements]
100746
100747 ['Header: ][^boost/asio/read_at.hpp]
100748
100749 ['Convenience header: ][^boost/asio.hpp]
100750
100751
100752 [section:overload1 read_at (1 of 8 overloads)]
100753
100754
100755 Attempt to read a certain amount of data at the specified offset before returning. 
100756
100757
100758   template<
100759       typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
100760       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
100761   std::size_t read_at(
100762       SyncRandomAccessReadDevice & d,
100763       uint64_t offset,
100764       const MutableBufferSequence & buffers);
100765
100766
100767 This function is used to read a certain number of bytes of data from a random access device at the specified offset. The call will block until one of the following conditions is true:
100768
100769
100770 * The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
100771
100772
100773 * An error occurred.
100774
100775 This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
100776
100777
100778 [heading Parameters]
100779     
100780
100781 [variablelist
100782   
100783 [[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]]
100784
100785 [[offset][The offset at which the data will be read.]]
100786
100787 [[buffers][One or more buffers into which the data will be read. The sum of the buffer sizes indicates the maximum number of bytes to read from the device.]]
100788
100789 ]
100790
100791
100792 [heading Return Value]
100793       
100794 The number of bytes transferred.
100795
100796
100797 [heading Exceptions]
100798     
100799
100800 [variablelist
100801   
100802 [[boost::system::system_error][Thrown on failure.]]
100803
100804 ]
100805
100806
100807 [heading Example]
100808   
100809 To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
100810
100811    boost::asio::read_at(d, 42, boost::asio::buffer(data, size)); 
100812
100813
100814 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
100815
100816
100817 [heading Remarks]
100818       
100819 This overload is equivalent to calling: 
100820
100821    boost::asio::read_at(
100822        d, 42, buffers,
100823        boost::asio::transfer_all()); 
100824
100825
100826
100827
100828
100829
100830
100831 [endsect]
100832
100833
100834
100835 [section:overload2 read_at (2 of 8 overloads)]
100836
100837
100838 Attempt to read a certain amount of data at the specified offset before returning. 
100839
100840
100841   template<
100842       typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
100843       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
100844   std::size_t read_at(
100845       SyncRandomAccessReadDevice & d,
100846       uint64_t offset,
100847       const MutableBufferSequence & buffers,
100848       boost::system::error_code & ec);
100849
100850
100851 This function is used to read a certain number of bytes of data from a random access device at the specified offset. The call will block until one of the following conditions is true:
100852
100853
100854 * The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
100855
100856
100857 * An error occurred.
100858
100859 This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
100860
100861
100862 [heading Parameters]
100863     
100864
100865 [variablelist
100866   
100867 [[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]]
100868
100869 [[offset][The offset at which the data will be read.]]
100870
100871 [[buffers][One or more buffers into which the data will be read. The sum of the buffer sizes indicates the maximum number of bytes to read from the device.]]
100872
100873 [[ec][Set to indicate what error occurred, if any.]]
100874
100875 ]
100876
100877
100878 [heading Return Value]
100879       
100880 The number of bytes transferred.
100881
100882
100883 [heading Example]
100884   
100885 To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
100886
100887    boost::asio::read_at(d, 42,
100888        boost::asio::buffer(data, size), ec); 
100889
100890
100891 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
100892
100893
100894 [heading Remarks]
100895       
100896 This overload is equivalent to calling: 
100897
100898    boost::asio::read_at(
100899        d, 42, buffers,
100900        boost::asio::transfer_all(), ec); 
100901
100902
100903
100904
100905
100906
100907
100908 [endsect]
100909
100910
100911
100912 [section:overload3 read_at (3 of 8 overloads)]
100913
100914
100915 Attempt to read a certain amount of data at the specified offset before returning. 
100916
100917
100918   template<
100919       typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
100920       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
100921       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
100922   std::size_t read_at(
100923       SyncRandomAccessReadDevice & d,
100924       uint64_t offset,
100925       const MutableBufferSequence & buffers,
100926       CompletionCondition completion_condition);
100927
100928
100929 This function is used to read a certain number of bytes of data from a random access device at the specified offset. The call will block until one of the following conditions is true:
100930
100931
100932 * The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
100933
100934
100935 * The completion\_condition function object returns 0.
100936
100937 This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
100938
100939
100940 [heading Parameters]
100941     
100942
100943 [variablelist
100944   
100945 [[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]]
100946
100947 [[offset][The offset at which the data will be read.]]
100948
100949 [[buffers][One or more buffers into which the data will be read. The sum of the buffer sizes indicates the maximum number of bytes to read from the device.]]
100950
100951 [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 
100952 ``
100953    std::size_t completion_condition(
100954      // Result of latest read_some_at operation.
100955      const boost::system::error_code& error,
100956
100957      // Number of bytes transferred so far.
100958      std::size_t bytes_transferred
100959    ); 
100960 ``
100961 A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the device's read\_some\_at function.]]
100962
100963 ]
100964
100965
100966 [heading Return Value]
100967       
100968 The number of bytes transferred.
100969
100970
100971 [heading Exceptions]
100972     
100973
100974 [variablelist
100975   
100976 [[boost::system::system_error][Thrown on failure.]]
100977
100978 ]
100979
100980
100981 [heading Example]
100982   
100983 To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
100984
100985    boost::asio::read_at(d, 42, boost::asio::buffer(data, size),
100986        boost::asio::transfer_at_least(32)); 
100987
100988
100989 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
100990
100991
100992
100993
100994 [endsect]
100995
100996
100997
100998 [section:overload4 read_at (4 of 8 overloads)]
100999
101000
101001 Attempt to read a certain amount of data at the specified offset before returning. 
101002
101003
101004   template<
101005       typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
101006       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
101007       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
101008   std::size_t read_at(
101009       SyncRandomAccessReadDevice & d,
101010       uint64_t offset,
101011       const MutableBufferSequence & buffers,
101012       CompletionCondition completion_condition,
101013       boost::system::error_code & ec);
101014
101015
101016 This function is used to read a certain number of bytes of data from a random access device at the specified offset. The call will block until one of the following conditions is true:
101017
101018
101019 * The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
101020
101021
101022 * The completion\_condition function object returns 0.
101023
101024 This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
101025
101026
101027 [heading Parameters]
101028     
101029
101030 [variablelist
101031   
101032 [[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]]
101033
101034 [[offset][The offset at which the data will be read.]]
101035
101036 [[buffers][One or more buffers into which the data will be read. The sum of the buffer sizes indicates the maximum number of bytes to read from the device.]]
101037
101038 [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 
101039 ``
101040    std::size_t completion_condition(
101041      // Result of latest read_some_at operation.
101042      const boost::system::error_code& error,
101043
101044      // Number of bytes transferred so far.
101045      std::size_t bytes_transferred
101046    ); 
101047 ``
101048 A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the device's read\_some\_at function.]]
101049
101050 [[ec][Set to indicate what error occurred, if any.]]
101051
101052 ]
101053
101054
101055 [heading Return Value]
101056       
101057 The number of bytes read. If an error occurs, returns the total number of bytes successfully transferred prior to the error. 
101058
101059
101060
101061
101062 [endsect]
101063
101064
101065
101066 [section:overload5 read_at (5 of 8 overloads)]
101067
101068
101069 Attempt to read a certain amount of data at the specified offset before returning. 
101070
101071
101072   template<
101073       typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
101074       typename Allocator>
101075   std::size_t read_at(
101076       SyncRandomAccessReadDevice & d,
101077       uint64_t offset,
101078       basic_streambuf< Allocator > & b);
101079
101080
101081 This function is used to read a certain number of bytes of data from a random access device at the specified offset. The call will block until one of the following conditions is true:
101082
101083
101084 * An error occurred.
101085
101086 This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
101087
101088
101089 [heading Parameters]
101090     
101091
101092 [variablelist
101093   
101094 [[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]]
101095
101096 [[offset][The offset at which the data will be read.]]
101097
101098 [[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]]
101099
101100 ]
101101
101102
101103 [heading Return Value]
101104       
101105 The number of bytes transferred.
101106
101107
101108 [heading Exceptions]
101109     
101110
101111 [variablelist
101112   
101113 [[boost::system::system_error][Thrown on failure.]]
101114
101115 ]
101116
101117
101118 [heading Remarks]
101119       
101120 This overload is equivalent to calling: 
101121
101122    boost::asio::read_at(
101123        d, 42, b,
101124        boost::asio::transfer_all()); 
101125
101126
101127
101128
101129
101130
101131
101132 [endsect]
101133
101134
101135
101136 [section:overload6 read_at (6 of 8 overloads)]
101137
101138
101139 Attempt to read a certain amount of data at the specified offset before returning. 
101140
101141
101142   template<
101143       typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
101144       typename Allocator>
101145   std::size_t read_at(
101146       SyncRandomAccessReadDevice & d,
101147       uint64_t offset,
101148       basic_streambuf< Allocator > & b,
101149       boost::system::error_code & ec);
101150
101151
101152 This function is used to read a certain number of bytes of data from a random access device at the specified offset. The call will block until one of the following conditions is true:
101153
101154
101155 * An error occurred.
101156
101157 This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
101158
101159
101160 [heading Parameters]
101161     
101162
101163 [variablelist
101164   
101165 [[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]]
101166
101167 [[offset][The offset at which the data will be read.]]
101168
101169 [[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]]
101170
101171 [[ec][Set to indicate what error occurred, if any.]]
101172
101173 ]
101174
101175
101176 [heading Return Value]
101177       
101178 The number of bytes transferred.
101179
101180
101181 [heading Remarks]
101182       
101183 This overload is equivalent to calling: 
101184
101185    boost::asio::read_at(
101186        d, 42, b,
101187        boost::asio::transfer_all(), ec); 
101188
101189
101190
101191
101192
101193
101194
101195 [endsect]
101196
101197
101198
101199 [section:overload7 read_at (7 of 8 overloads)]
101200
101201
101202 Attempt to read a certain amount of data at the specified offset before returning. 
101203
101204
101205   template<
101206       typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
101207       typename Allocator,
101208       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
101209   std::size_t read_at(
101210       SyncRandomAccessReadDevice & d,
101211       uint64_t offset,
101212       basic_streambuf< Allocator > & b,
101213       CompletionCondition completion_condition);
101214
101215
101216 This function is used to read a certain number of bytes of data from a random access device at the specified offset. The call will block until one of the following conditions is true:
101217
101218
101219 * The completion\_condition function object returns 0.
101220
101221 This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
101222
101223
101224 [heading Parameters]
101225     
101226
101227 [variablelist
101228   
101229 [[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]]
101230
101231 [[offset][The offset at which the data will be read.]]
101232
101233 [[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]]
101234
101235 [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 
101236 ``
101237    std::size_t completion_condition(
101238      // Result of latest read_some_at operation.
101239      const boost::system::error_code& error,
101240
101241      // Number of bytes transferred so far.
101242      std::size_t bytes_transferred
101243    ); 
101244 ``
101245 A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the device's read\_some\_at function.]]
101246
101247 ]
101248
101249
101250 [heading Return Value]
101251       
101252 The number of bytes transferred.
101253
101254
101255 [heading Exceptions]
101256     
101257
101258 [variablelist
101259   
101260 [[boost::system::system_error][Thrown on failure. ]]
101261
101262 ]
101263
101264
101265
101266
101267 [endsect]
101268
101269
101270
101271 [section:overload8 read_at (8 of 8 overloads)]
101272
101273
101274 Attempt to read a certain amount of data at the specified offset before returning. 
101275
101276
101277   template<
101278       typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
101279       typename Allocator,
101280       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
101281   std::size_t read_at(
101282       SyncRandomAccessReadDevice & d,
101283       uint64_t offset,
101284       basic_streambuf< Allocator > & b,
101285       CompletionCondition completion_condition,
101286       boost::system::error_code & ec);
101287
101288
101289 This function is used to read a certain number of bytes of data from a random access device at the specified offset. The call will block until one of the following conditions is true:
101290
101291
101292 * The completion\_condition function object returns 0.
101293
101294 This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
101295
101296
101297 [heading Parameters]
101298     
101299
101300 [variablelist
101301   
101302 [[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]]
101303
101304 [[offset][The offset at which the data will be read.]]
101305
101306 [[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]]
101307
101308 [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 
101309 ``
101310    std::size_t completion_condition(
101311      // Result of latest read_some_at operation.
101312      const boost::system::error_code& error,
101313
101314      // Number of bytes transferred so far.
101315      std::size_t bytes_transferred
101316    ); 
101317 ``
101318 A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the device's read\_some\_at function.]]
101319
101320 [[ec][Set to indicate what error occurred, if any.]]
101321
101322 ]
101323
101324
101325 [heading Return Value]
101326       
101327 The number of bytes read. If an error occurs, returns the total number of bytes successfully transferred prior to the error. 
101328
101329
101330
101331
101332 [endsect]
101333
101334
101335 [endsect]
101336
101337 [section:read_until read_until]
101338
101339 [indexterm1 boost_asio.indexterm.read_until..read_until] 
101340 The `read_until` function is a composed operation that reads data into a dynamic buffer sequence, or into a streambuf, until it contains a delimiter, matches a regular expression, or a function object indicates a match. 
101341
101342
101343 Read data into a dynamic buffer sequence until it contains a specified delimiter. 
101344
101345   template<
101346       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
101347       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
101348   std::size_t ``[link boost_asio.reference.read_until.overload1 read_until]``(
101349       SyncReadStream & s,
101350       DynamicBuffer_v1 && buffers,
101351       char delim,
101352       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
101353   ``  [''''&raquo;''' [link boost_asio.reference.read_until.overload1 more...]]``
101354
101355   template<
101356       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
101357       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
101358   std::size_t ``[link boost_asio.reference.read_until.overload2 read_until]``(
101359       SyncReadStream & s,
101360       DynamicBuffer_v1 && buffers,
101361       char delim,
101362       boost::system::error_code & ec,
101363       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
101364   ``  [''''&raquo;''' [link boost_asio.reference.read_until.overload2 more...]]``
101365
101366   template<
101367       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
101368       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
101369   std::size_t ``[link boost_asio.reference.read_until.overload3 read_until]``(
101370       SyncReadStream & s,
101371       DynamicBuffer_v1 && buffers,
101372       string_view delim,
101373       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
101374   ``  [''''&raquo;''' [link boost_asio.reference.read_until.overload3 more...]]``
101375
101376   template<
101377       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
101378       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
101379   std::size_t ``[link boost_asio.reference.read_until.overload4 read_until]``(
101380       SyncReadStream & s,
101381       DynamicBuffer_v1 && buffers,
101382       string_view delim,
101383       boost::system::error_code & ec,
101384       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
101385   ``  [''''&raquo;''' [link boost_asio.reference.read_until.overload4 more...]]``
101386
101387 Read data into a dynamic buffer sequence until some part of the data it contains matches a regular expression. 
101388
101389   template<
101390       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
101391       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
101392   std::size_t ``[link boost_asio.reference.read_until.overload5 read_until]``(
101393       SyncReadStream & s,
101394       DynamicBuffer_v1 && buffers,
101395       const boost::regex & expr,
101396       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
101397   ``  [''''&raquo;''' [link boost_asio.reference.read_until.overload5 more...]]``
101398
101399   template<
101400       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
101401       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
101402   std::size_t ``[link boost_asio.reference.read_until.overload6 read_until]``(
101403       SyncReadStream & s,
101404       DynamicBuffer_v1 && buffers,
101405       const boost::regex & expr,
101406       boost::system::error_code & ec,
101407       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
101408   ``  [''''&raquo;''' [link boost_asio.reference.read_until.overload6 more...]]``
101409
101410 Read data into a dynamic buffer sequence until a function object indicates a match. 
101411
101412   template<
101413       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
101414       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
101415       typename MatchCondition>
101416   std::size_t ``[link boost_asio.reference.read_until.overload7 read_until]``(
101417       SyncReadStream & s,
101418       DynamicBuffer_v1 && buffers,
101419       MatchCondition match_condition,
101420       typename enable_if< is_match_condition< MatchCondition >::value &&is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
101421   ``  [''''&raquo;''' [link boost_asio.reference.read_until.overload7 more...]]``
101422
101423   template<
101424       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
101425       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
101426       typename MatchCondition>
101427   std::size_t ``[link boost_asio.reference.read_until.overload8 read_until]``(
101428       SyncReadStream & s,
101429       DynamicBuffer_v1 && buffers,
101430       MatchCondition match_condition,
101431       boost::system::error_code & ec,
101432       typename enable_if< is_match_condition< MatchCondition >::value &&is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
101433   ``  [''''&raquo;''' [link boost_asio.reference.read_until.overload8 more...]]``
101434
101435 Read data into a streambuf until it contains a specified delimiter. 
101436
101437   template<
101438       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
101439       typename Allocator>
101440   std::size_t ``[link boost_asio.reference.read_until.overload9 read_until]``(
101441       SyncReadStream & s,
101442       boost::asio::basic_streambuf< Allocator > & b,
101443       char delim);
101444   ``  [''''&raquo;''' [link boost_asio.reference.read_until.overload9 more...]]``
101445
101446   template<
101447       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
101448       typename Allocator>
101449   std::size_t ``[link boost_asio.reference.read_until.overload10 read_until]``(
101450       SyncReadStream & s,
101451       boost::asio::basic_streambuf< Allocator > & b,
101452       char delim,
101453       boost::system::error_code & ec);
101454   ``  [''''&raquo;''' [link boost_asio.reference.read_until.overload10 more...]]``
101455
101456   template<
101457       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
101458       typename Allocator>
101459   std::size_t ``[link boost_asio.reference.read_until.overload11 read_until]``(
101460       SyncReadStream & s,
101461       boost::asio::basic_streambuf< Allocator > & b,
101462       string_view delim);
101463   ``  [''''&raquo;''' [link boost_asio.reference.read_until.overload11 more...]]``
101464
101465   template<
101466       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
101467       typename Allocator>
101468   std::size_t ``[link boost_asio.reference.read_until.overload12 read_until]``(
101469       SyncReadStream & s,
101470       boost::asio::basic_streambuf< Allocator > & b,
101471       string_view delim,
101472       boost::system::error_code & ec);
101473   ``  [''''&raquo;''' [link boost_asio.reference.read_until.overload12 more...]]``
101474
101475 Read data into a streambuf until some part of the data it contains matches a regular expression. 
101476
101477   template<
101478       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
101479       typename Allocator>
101480   std::size_t ``[link boost_asio.reference.read_until.overload13 read_until]``(
101481       SyncReadStream & s,
101482       boost::asio::basic_streambuf< Allocator > & b,
101483       const boost::regex & expr);
101484   ``  [''''&raquo;''' [link boost_asio.reference.read_until.overload13 more...]]``
101485
101486   template<
101487       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
101488       typename Allocator>
101489   std::size_t ``[link boost_asio.reference.read_until.overload14 read_until]``(
101490       SyncReadStream & s,
101491       boost::asio::basic_streambuf< Allocator > & b,
101492       const boost::regex & expr,
101493       boost::system::error_code & ec);
101494   ``  [''''&raquo;''' [link boost_asio.reference.read_until.overload14 more...]]``
101495
101496 Read data into a streambuf until a function object indicates a match. 
101497
101498   template<
101499       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
101500       typename Allocator,
101501       typename MatchCondition>
101502   std::size_t ``[link boost_asio.reference.read_until.overload15 read_until]``(
101503       SyncReadStream & s,
101504       boost::asio::basic_streambuf< Allocator > & b,
101505       MatchCondition match_condition,
101506       typename enable_if< is_match_condition< MatchCondition >::value >::type *  = 0);
101507   ``  [''''&raquo;''' [link boost_asio.reference.read_until.overload15 more...]]``
101508
101509   template<
101510       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
101511       typename Allocator,
101512       typename MatchCondition>
101513   std::size_t ``[link boost_asio.reference.read_until.overload16 read_until]``(
101514       SyncReadStream & s,
101515       boost::asio::basic_streambuf< Allocator > & b,
101516       MatchCondition match_condition,
101517       boost::system::error_code & ec,
101518       typename enable_if< is_match_condition< MatchCondition >::value >::type *  = 0);
101519   ``  [''''&raquo;''' [link boost_asio.reference.read_until.overload16 more...]]``
101520
101521 Read data into a dynamic buffer sequence until it contains a specified delimiter. 
101522
101523   template<
101524       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
101525       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
101526   std::size_t ``[link boost_asio.reference.read_until.overload17 read_until]``(
101527       SyncReadStream & s,
101528       DynamicBuffer_v2 buffers,
101529       char delim,
101530       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
101531   ``  [''''&raquo;''' [link boost_asio.reference.read_until.overload17 more...]]``
101532
101533   template<
101534       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
101535       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
101536   std::size_t ``[link boost_asio.reference.read_until.overload18 read_until]``(
101537       SyncReadStream & s,
101538       DynamicBuffer_v2 buffers,
101539       char delim,
101540       boost::system::error_code & ec,
101541       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
101542   ``  [''''&raquo;''' [link boost_asio.reference.read_until.overload18 more...]]``
101543
101544   template<
101545       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
101546       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
101547   std::size_t ``[link boost_asio.reference.read_until.overload19 read_until]``(
101548       SyncReadStream & s,
101549       DynamicBuffer_v2 buffers,
101550       string_view delim,
101551       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
101552   ``  [''''&raquo;''' [link boost_asio.reference.read_until.overload19 more...]]``
101553
101554   template<
101555       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
101556       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
101557   std::size_t ``[link boost_asio.reference.read_until.overload20 read_until]``(
101558       SyncReadStream & s,
101559       DynamicBuffer_v2 buffers,
101560       string_view delim,
101561       boost::system::error_code & ec,
101562       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
101563   ``  [''''&raquo;''' [link boost_asio.reference.read_until.overload20 more...]]``
101564
101565 Read data into a dynamic buffer sequence until some part of the data it contains matches a regular expression. 
101566
101567   template<
101568       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
101569       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
101570   std::size_t ``[link boost_asio.reference.read_until.overload21 read_until]``(
101571       SyncReadStream & s,
101572       DynamicBuffer_v2 buffers,
101573       const boost::regex & expr,
101574       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
101575   ``  [''''&raquo;''' [link boost_asio.reference.read_until.overload21 more...]]``
101576
101577   template<
101578       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
101579       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
101580   std::size_t ``[link boost_asio.reference.read_until.overload22 read_until]``(
101581       SyncReadStream & s,
101582       DynamicBuffer_v2 buffers,
101583       const boost::regex & expr,
101584       boost::system::error_code & ec,
101585       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
101586   ``  [''''&raquo;''' [link boost_asio.reference.read_until.overload22 more...]]``
101587
101588 Read data into a dynamic buffer sequence until a function object indicates a match. 
101589
101590   template<
101591       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
101592       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
101593       typename MatchCondition>
101594   std::size_t ``[link boost_asio.reference.read_until.overload23 read_until]``(
101595       SyncReadStream & s,
101596       DynamicBuffer_v2 buffers,
101597       MatchCondition match_condition,
101598       typename enable_if< is_match_condition< MatchCondition >::value &&is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
101599   ``  [''''&raquo;''' [link boost_asio.reference.read_until.overload23 more...]]``
101600
101601   template<
101602       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
101603       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
101604       typename MatchCondition>
101605   std::size_t ``[link boost_asio.reference.read_until.overload24 read_until]``(
101606       SyncReadStream & s,
101607       DynamicBuffer_v2 buffers,
101608       MatchCondition match_condition,
101609       boost::system::error_code & ec,
101610       typename enable_if< is_match_condition< MatchCondition >::value &&is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
101611   ``  [''''&raquo;''' [link boost_asio.reference.read_until.overload24 more...]]``
101612
101613 [heading Requirements]
101614
101615 ['Header: ][^boost/asio/read_until.hpp]
101616
101617 ['Convenience header: ][^boost/asio.hpp]
101618
101619
101620 [section:overload1 read_until (1 of 24 overloads)]
101621
101622
101623 Read data into a dynamic buffer sequence until it contains a specified delimiter. 
101624
101625
101626   template<
101627       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
101628       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
101629   std::size_t read_until(
101630       SyncReadStream & s,
101631       DynamicBuffer_v1 && buffers,
101632       char delim,
101633       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
101634
101635
101636 This function is used to read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains the specified delimiter. The call will block until one of the following conditions is true:
101637
101638
101639 * The get area of the dynamic buffer sequence contains the specified delimiter.
101640
101641
101642 * An error occurred.
101643
101644 This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the dynamic buffer sequence's get area already contains the delimiter, the function returns immediately.
101645
101646
101647 [heading Parameters]
101648     
101649
101650 [variablelist
101651   
101652 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
101653
101654 [[buffers][The dynamic buffer sequence into which the data will be read.]]
101655
101656 [[delim][The delimiter character.]]
101657
101658 ]
101659
101660
101661 [heading Return Value]
101662       
101663 The number of bytes in the dynamic buffer sequence's get area up to and including the delimiter.
101664
101665
101666 [heading Exceptions]
101667     
101668
101669 [variablelist
101670   
101671 [[boost::system::system_error][Thrown on failure.]]
101672
101673 ]
101674
101675
101676 [heading Remarks]
101677       
101678 After a successful read\_until operation, the dynamic buffer sequence may contain additional data beyond the delimiter. An application will typically leave that data in the dynamic buffer sequence for a subsequent read\_until operation to examine.
101679
101680
101681 [heading Example]
101682   
101683 To read data into a `std::string` until a newline is encountered: 
101684
101685    std::string data;
101686    std::string n = boost::asio::read_until(s,
101687        boost::asio::dynamic_buffer(data), '\n');
101688    std::string line = data.substr(0, n);
101689    data.erase(0, n); 
101690
101691
101692 After the `read_until` operation completes successfully, the string `data` contains the delimiter: 
101693
101694    { 'a', 'b', ..., 'c', '\n', 'd', 'e', ... } 
101695
101696
101697 The call to `substr` then extracts the data up to and including the delimiter, so that the string `line` contains: 
101698
101699    { 'a', 'b', ..., 'c', '\n' } 
101700
101701
101702 After the call to `erase`, the remaining data is left in the buffer `b` as follows: 
101703
101704    { 'd', 'e', ... } 
101705
101706
101707 This data may be the start of a new line, to be extracted by a subsequent `read_until` operation. 
101708
101709
101710
101711
101712 [endsect]
101713
101714
101715
101716 [section:overload2 read_until (2 of 24 overloads)]
101717
101718
101719 Read data into a dynamic buffer sequence until it contains a specified delimiter. 
101720
101721
101722   template<
101723       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
101724       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
101725   std::size_t read_until(
101726       SyncReadStream & s,
101727       DynamicBuffer_v1 && buffers,
101728       char delim,
101729       boost::system::error_code & ec,
101730       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
101731
101732
101733 This function is used to read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains the specified delimiter. The call will block until one of the following conditions is true:
101734
101735
101736 * The get area of the dynamic buffer sequence contains the specified delimiter.
101737
101738
101739 * An error occurred.
101740
101741 This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the dynamic buffer sequence's get area already contains the delimiter, the function returns immediately.
101742
101743
101744 [heading Parameters]
101745     
101746
101747 [variablelist
101748   
101749 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
101750
101751 [[buffers][The dynamic buffer sequence into which the data will be read.]]
101752
101753 [[delim][The delimiter character.]]
101754
101755 [[ec][Set to indicate what error occurred, if any.]]
101756
101757 ]
101758
101759
101760 [heading Return Value]
101761       
101762 The number of bytes in the dynamic buffer sequence's get area up to and including the delimiter. Returns 0 if an error occurred.
101763
101764
101765 [heading Remarks]
101766       
101767 After a successful read\_until operation, the dynamic buffer sequence may contain additional data beyond the delimiter. An application will typically leave that data in the dynamic buffer sequence for a subsequent read\_until operation to examine. 
101768
101769
101770
101771
101772 [endsect]
101773
101774
101775
101776 [section:overload3 read_until (3 of 24 overloads)]
101777
101778
101779 Read data into a dynamic buffer sequence until it contains a specified delimiter. 
101780
101781
101782   template<
101783       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
101784       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
101785   std::size_t read_until(
101786       SyncReadStream & s,
101787       DynamicBuffer_v1 && buffers,
101788       string_view delim,
101789       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
101790
101791
101792 This function is used to read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains the specified delimiter. The call will block until one of the following conditions is true:
101793
101794
101795 * The get area of the dynamic buffer sequence contains the specified delimiter.
101796
101797
101798 * An error occurred.
101799
101800 This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the dynamic buffer sequence's get area already contains the delimiter, the function returns immediately.
101801
101802
101803 [heading Parameters]
101804     
101805
101806 [variablelist
101807   
101808 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
101809
101810 [[buffers][The dynamic buffer sequence into which the data will be read.]]
101811
101812 [[delim][The delimiter string.]]
101813
101814 ]
101815
101816
101817 [heading Return Value]
101818       
101819 The number of bytes in the dynamic buffer sequence's get area up to and including the delimiter.
101820
101821
101822 [heading Remarks]
101823       
101824 After a successful read\_until operation, the dynamic buffer sequence may contain additional data beyond the delimiter. An application will typically leave that data in the dynamic buffer sequence for a subsequent read\_until operation to examine.
101825
101826
101827 [heading Example]
101828   
101829 To read data into a `std::string` until a CR-LF sequence is encountered: 
101830
101831    std::string data;
101832    std::string n = boost::asio::read_until(s,
101833        boost::asio::dynamic_buffer(data), "\r\n");
101834    std::string line = data.substr(0, n);
101835    data.erase(0, n); 
101836
101837
101838 After the `read_until` operation completes successfully, the string `data` contains the delimiter: 
101839
101840    { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } 
101841
101842
101843 The call to `substr` then extracts the data up to and including the delimiter, so that the string `line` contains: 
101844
101845    { 'a', 'b', ..., 'c', '\r', '\n' } 
101846
101847
101848 After the call to `erase`, the remaining data is left in the buffer `b` as follows: 
101849
101850    { 'd', 'e', ... } 
101851
101852
101853 This data may be the start of a new line, to be extracted by a subsequent `read_until` operation. 
101854
101855
101856
101857
101858 [endsect]
101859
101860
101861
101862 [section:overload4 read_until (4 of 24 overloads)]
101863
101864
101865 Read data into a dynamic buffer sequence until it contains a specified delimiter. 
101866
101867
101868   template<
101869       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
101870       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
101871   std::size_t read_until(
101872       SyncReadStream & s,
101873       DynamicBuffer_v1 && buffers,
101874       string_view delim,
101875       boost::system::error_code & ec,
101876       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
101877
101878
101879 This function is used to read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains the specified delimiter. The call will block until one of the following conditions is true:
101880
101881
101882 * The get area of the dynamic buffer sequence contains the specified delimiter.
101883
101884
101885 * An error occurred.
101886
101887 This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the dynamic buffer sequence's get area already contains the delimiter, the function returns immediately.
101888
101889
101890 [heading Parameters]
101891     
101892
101893 [variablelist
101894   
101895 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
101896
101897 [[buffers][The dynamic buffer sequence into which the data will be read.]]
101898
101899 [[delim][The delimiter string.]]
101900
101901 [[ec][Set to indicate what error occurred, if any.]]
101902
101903 ]
101904
101905
101906 [heading Return Value]
101907       
101908 The number of bytes in the dynamic buffer sequence's get area up to and including the delimiter. Returns 0 if an error occurred.
101909
101910
101911 [heading Remarks]
101912       
101913 After a successful read\_until operation, the dynamic buffer sequence may contain additional data beyond the delimiter. An application will typically leave that data in the dynamic buffer sequence for a subsequent read\_until operation to examine. 
101914
101915
101916
101917
101918 [endsect]
101919
101920
101921
101922 [section:overload5 read_until (5 of 24 overloads)]
101923
101924
101925 Read data into a dynamic buffer sequence until some part of the data it contains matches a regular expression. 
101926
101927
101928   template<
101929       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
101930       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
101931   std::size_t read_until(
101932       SyncReadStream & s,
101933       DynamicBuffer_v1 && buffers,
101934       const boost::regex & expr,
101935       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
101936
101937
101938 This function is used to read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains some data that matches a regular expression. The call will block until one of the following conditions is true:
101939
101940
101941 * A substring of the dynamic buffer sequence's get area matches the regular expression.
101942
101943
101944 * An error occurred.
101945
101946 This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the dynamic buffer sequence's get area already contains data that matches the regular expression, the function returns immediately.
101947
101948
101949 [heading Parameters]
101950     
101951
101952 [variablelist
101953   
101954 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
101955
101956 [[buffers][A dynamic buffer sequence into which the data will be read.]]
101957
101958 [[expr][The regular expression.]]
101959
101960 ]
101961
101962
101963 [heading Return Value]
101964       
101965 The number of bytes in the dynamic buffer sequence's get area up to and including the substring that matches the regular expression.
101966
101967
101968 [heading Exceptions]
101969     
101970
101971 [variablelist
101972   
101973 [[boost::system::system_error][Thrown on failure.]]
101974
101975 ]
101976
101977
101978 [heading Remarks]
101979       
101980 After a successful read\_until operation, the dynamic buffer sequence may contain additional data beyond that which matched the regular expression. An application will typically leave that data in the dynamic buffer sequence for a subsequent read\_until operation to examine.
101981
101982
101983 [heading Example]
101984   
101985 To read data into a `std::string` until a CR-LF sequence is encountered: 
101986
101987    std::string data;
101988    std::string n = boost::asio::read_until(s,
101989        boost::asio::dynamic_buffer(data), boost::regex("\r\n"));
101990    std::string line = data.substr(0, n);
101991    data.erase(0, n); 
101992
101993
101994 After the `read_until` operation completes successfully, the string `data` contains the delimiter: 
101995
101996    { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } 
101997
101998
101999 The call to `substr` then extracts the data up to and including the delimiter, so that the string `line` contains: 
102000
102001    { 'a', 'b', ..., 'c', '\r', '\n' } 
102002
102003
102004 After the call to `erase`, the remaining data is left in the buffer `b` as follows: 
102005
102006    { 'd', 'e', ... } 
102007
102008
102009 This data may be the start of a new line, to be extracted by a subsequent `read_until` operation. 
102010
102011
102012
102013
102014 [endsect]
102015
102016
102017
102018 [section:overload6 read_until (6 of 24 overloads)]
102019
102020
102021 Read data into a dynamic buffer sequence until some part of the data it contains matches a regular expression. 
102022
102023
102024   template<
102025       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
102026       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
102027   std::size_t read_until(
102028       SyncReadStream & s,
102029       DynamicBuffer_v1 && buffers,
102030       const boost::regex & expr,
102031       boost::system::error_code & ec,
102032       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
102033
102034
102035 This function is used to read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains some data that matches a regular expression. The call will block until one of the following conditions is true:
102036
102037
102038 * A substring of the dynamic buffer sequence's get area matches the regular expression.
102039
102040
102041 * An error occurred.
102042
102043 This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the dynamic buffer sequence's get area already contains data that matches the regular expression, the function returns immediately.
102044
102045
102046 [heading Parameters]
102047     
102048
102049 [variablelist
102050   
102051 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
102052
102053 [[buffers][A dynamic buffer sequence into which the data will be read.]]
102054
102055 [[expr][The regular expression.]]
102056
102057 [[ec][Set to indicate what error occurred, if any.]]
102058
102059 ]
102060
102061
102062 [heading Return Value]
102063       
102064 The number of bytes in the dynamic buffer sequence's get area up to and including the substring that matches the regular expression. Returns 0 if an error occurred.
102065
102066
102067 [heading Remarks]
102068       
102069 After a successful read\_until operation, the dynamic buffer sequence may contain additional data beyond that which matched the regular expression. An application will typically leave that data in the dynamic buffer sequence for a subsequent read\_until operation to examine. 
102070
102071
102072
102073
102074 [endsect]
102075
102076
102077
102078 [section:overload7 read_until (7 of 24 overloads)]
102079
102080
102081 Read data into a dynamic buffer sequence until a function object indicates a match. 
102082
102083
102084   template<
102085       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
102086       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
102087       typename MatchCondition>
102088   std::size_t read_until(
102089       SyncReadStream & s,
102090       DynamicBuffer_v1 && buffers,
102091       MatchCondition match_condition,
102092       typename enable_if< is_match_condition< MatchCondition >::value &&is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
102093
102094
102095 This function is used to read data into the specified dynamic buffer sequence until a user-defined match condition function object, when applied to the data contained in the dynamic buffer sequence, indicates a successful match. The call will block until one of the following conditions is true:
102096
102097
102098 * The match condition function object returns a std::pair where the second element evaluates to true.
102099
102100
102101 * An error occurred.
102102
102103 This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the match condition function object already indicates a match, the function returns immediately.
102104
102105
102106 [heading Parameters]
102107     
102108
102109 [variablelist
102110   
102111 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
102112
102113 [[buffers][A dynamic buffer sequence into which the data will be read.]]
102114
102115 [[match_condition][The function object to be called to determine whether a match exists. The signature of the function object must be: 
102116 ``
102117    pair<iterator, bool> match_condition(iterator begin, iterator end);
102118 ``
102119 where `iterator` represents the type: 
102120 ``
102121    buffers_iterator<typename DynamicBuffer_v1::const_buffers_type>
102122 ``
102123 The iterator parameters `begin` and `end` define the range of bytes to be scanned to determine whether there is a match. The `first` member of the return value is an iterator marking one-past-the-end of the bytes that have been consumed by the match function. This iterator is used to calculate the `begin` parameter for any subsequent invocation of the match condition. The `second` member of the return value is true if a match has been found, false otherwise.]]
102124
102125 ]
102126
102127
102128 [heading Return Value]
102129       
102130 The number of bytes in the dynamic\_buffer's get area that have been fully consumed by the match function.
102131
102132
102133 [heading Exceptions]
102134     
102135
102136 [variablelist
102137   
102138 [[boost::system::system_error][Thrown on failure.]]
102139
102140 ]
102141
102142
102143 [heading Remarks]
102144       
102145 After a successful read\_until operation, the dynamic buffer sequence may contain additional data beyond that which matched the function object. An application will typically leave that data in the dynamic buffer sequence for a subsequent read\_until operation to examine.
102146
102147 The default implementation of the `is_match_condition` type trait evaluates to true for function pointers and function objects with a `result_type` typedef. It must be specialised for other user-defined function objects.
102148
102149
102150 [heading Examples]
102151   
102152 To read data into a dynamic buffer sequence until whitespace is encountered: 
102153
102154    typedef boost::asio::buffers_iterator<
102155        boost::asio::const_buffers_1> iterator;
102156
102157    std::pair<iterator, bool>
102158    match_whitespace(iterator begin, iterator end)
102159    {
102160      iterator i = begin;
102161      while (i != end)
102162        if (std::isspace(*i++))
102163          return std::make_pair(i, true);
102164      return std::make_pair(i, false);
102165    }
102166    ...
102167    std::string data;
102168    boost::asio::read_until(s, data, match_whitespace);
102169
102170
102171
102172
102173 To read data into a `std::string` until a matching character is found: 
102174
102175    class match_char
102176    {
102177    public:
102178      explicit match_char(char c) : c_(c) {}
102179
102180      template <typename Iterator>
102181      std::pair<Iterator, bool> operator()(
102182          Iterator begin, Iterator end) const
102183      {
102184        Iterator i = begin;
102185        while (i != end)
102186          if (c_ == *i++)
102187            return std::make_pair(i, true);
102188        return std::make_pair(i, false);
102189      }
102190
102191    private:
102192      char c_;
102193    };
102194
102195    namespace asio {
102196      template <> struct is_match_condition<match_char>
102197        : public boost::true_type {};
102198    } // namespace asio
102199    ...
102200    std::string data;
102201    boost::asio::read_until(s, data, match_char('a'));
102202
102203
102204
102205
102206
102207 [endsect]
102208
102209
102210
102211 [section:overload8 read_until (8 of 24 overloads)]
102212
102213
102214 Read data into a dynamic buffer sequence until a function object indicates a match. 
102215
102216
102217   template<
102218       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
102219       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
102220       typename MatchCondition>
102221   std::size_t read_until(
102222       SyncReadStream & s,
102223       DynamicBuffer_v1 && buffers,
102224       MatchCondition match_condition,
102225       boost::system::error_code & ec,
102226       typename enable_if< is_match_condition< MatchCondition >::value &&is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
102227
102228
102229 This function is used to read data into the specified dynamic buffer sequence until a user-defined match condition function object, when applied to the data contained in the dynamic buffer sequence, indicates a successful match. The call will block until one of the following conditions is true:
102230
102231
102232 * The match condition function object returns a std::pair where the second element evaluates to true.
102233
102234
102235 * An error occurred.
102236
102237 This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the match condition function object already indicates a match, the function returns immediately.
102238
102239
102240 [heading Parameters]
102241     
102242
102243 [variablelist
102244   
102245 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
102246
102247 [[buffers][A dynamic buffer sequence into which the data will be read.]]
102248
102249 [[match_condition][The function object to be called to determine whether a match exists. The signature of the function object must be: 
102250 ``
102251    pair<iterator, bool> match_condition(iterator begin, iterator end);
102252 ``
102253 where `iterator` represents the type: 
102254 ``
102255    buffers_iterator<DynamicBuffer_v1::const_buffers_type>
102256 ``
102257 The iterator parameters `begin` and `end` define the range of bytes to be scanned to determine whether there is a match. The `first` member of the return value is an iterator marking one-past-the-end of the bytes that have been consumed by the match function. This iterator is used to calculate the `begin` parameter for any subsequent invocation of the match condition. The `second` member of the return value is true if a match has been found, false otherwise.]]
102258
102259 [[ec][Set to indicate what error occurred, if any.]]
102260
102261 ]
102262
102263
102264 [heading Return Value]
102265       
102266 The number of bytes in the dynamic buffer sequence's get area that have been fully consumed by the match function. Returns 0 if an error occurred.
102267
102268
102269 [heading Remarks]
102270       
102271 After a successful read\_until operation, the dynamic buffer sequence may contain additional data beyond that which matched the function object. An application will typically leave that data in the dynamic buffer sequence for a subsequent read\_until operation to examine.
102272
102273 The default implementation of the `is_match_condition` type trait evaluates to true for function pointers and function objects with a `result_type` typedef. It must be specialised for other user-defined function objects. 
102274
102275
102276
102277
102278 [endsect]
102279
102280
102281
102282 [section:overload9 read_until (9 of 24 overloads)]
102283
102284
102285 Read data into a streambuf until it contains a specified delimiter. 
102286
102287
102288   template<
102289       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
102290       typename Allocator>
102291   std::size_t read_until(
102292       SyncReadStream & s,
102293       boost::asio::basic_streambuf< Allocator > & b,
102294       char delim);
102295
102296
102297 This function is used to read data into the specified streambuf until the streambuf's get area contains the specified delimiter. The call will block until one of the following conditions is true:
102298
102299
102300 * The get area of the streambuf contains the specified delimiter.
102301
102302
102303 * An error occurred.
102304
102305 This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the streambuf's get area already contains the delimiter, the function returns immediately.
102306
102307
102308 [heading Parameters]
102309     
102310
102311 [variablelist
102312   
102313 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
102314
102315 [[b][A streambuf object into which the data will be read.]]
102316
102317 [[delim][The delimiter character.]]
102318
102319 ]
102320
102321
102322 [heading Return Value]
102323       
102324 The number of bytes in the streambuf's get area up to and including the delimiter.
102325
102326
102327 [heading Exceptions]
102328     
102329
102330 [variablelist
102331   
102332 [[boost::system::system_error][Thrown on failure.]]
102333
102334 ]
102335
102336
102337 [heading Remarks]
102338       
102339 After a successful read\_until operation, the streambuf may contain additional data beyond the delimiter. An application will typically leave that data in the streambuf for a subsequent read\_until operation to examine.
102340
102341
102342 [heading Example]
102343   
102344 To read data into a streambuf until a newline is encountered: 
102345
102346    boost::asio::streambuf b;
102347    boost::asio::read_until(s, b, '\n');
102348    std::istream is(&b);
102349    std::string line;
102350    std::getline(is, line); 
102351
102352
102353 After the `read_until` operation completes successfully, the buffer `b` contains the delimiter: 
102354
102355    { 'a', 'b', ..., 'c', '\n', 'd', 'e', ... } 
102356
102357
102358 The call to `std::getline` then extracts the data up to and including the newline (which is discarded), so that the string `line` contains: 
102359
102360    { 'a', 'b', ..., 'c' } 
102361
102362
102363 The remaining data is left in the buffer `b` as follows: 
102364
102365    { 'd', 'e', ... } 
102366
102367
102368 This data may be the start of a new line, to be extracted by a subsequent `read_until` operation. 
102369
102370
102371
102372
102373 [endsect]
102374
102375
102376
102377 [section:overload10 read_until (10 of 24 overloads)]
102378
102379
102380 Read data into a streambuf until it contains a specified delimiter. 
102381
102382
102383   template<
102384       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
102385       typename Allocator>
102386   std::size_t read_until(
102387       SyncReadStream & s,
102388       boost::asio::basic_streambuf< Allocator > & b,
102389       char delim,
102390       boost::system::error_code & ec);
102391
102392
102393 This function is used to read data into the specified streambuf until the streambuf's get area contains the specified delimiter. The call will block until one of the following conditions is true:
102394
102395
102396 * The get area of the streambuf contains the specified delimiter.
102397
102398
102399 * An error occurred.
102400
102401 This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the streambuf's get area already contains the delimiter, the function returns immediately.
102402
102403
102404 [heading Parameters]
102405     
102406
102407 [variablelist
102408   
102409 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
102410
102411 [[b][A streambuf object into which the data will be read.]]
102412
102413 [[delim][The delimiter character.]]
102414
102415 [[ec][Set to indicate what error occurred, if any.]]
102416
102417 ]
102418
102419
102420 [heading Return Value]
102421       
102422 The number of bytes in the streambuf's get area up to and including the delimiter. Returns 0 if an error occurred.
102423
102424
102425 [heading Remarks]
102426       
102427 After a successful read\_until operation, the streambuf may contain additional data beyond the delimiter. An application will typically leave that data in the streambuf for a subsequent read\_until operation to examine. 
102428
102429
102430
102431
102432 [endsect]
102433
102434
102435
102436 [section:overload11 read_until (11 of 24 overloads)]
102437
102438
102439 Read data into a streambuf until it contains a specified delimiter. 
102440
102441
102442   template<
102443       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
102444       typename Allocator>
102445   std::size_t read_until(
102446       SyncReadStream & s,
102447       boost::asio::basic_streambuf< Allocator > & b,
102448       string_view delim);
102449
102450
102451 This function is used to read data into the specified streambuf until the streambuf's get area contains the specified delimiter. The call will block until one of the following conditions is true:
102452
102453
102454 * The get area of the streambuf contains the specified delimiter.
102455
102456
102457 * An error occurred.
102458
102459 This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the streambuf's get area already contains the delimiter, the function returns immediately.
102460
102461
102462 [heading Parameters]
102463     
102464
102465 [variablelist
102466   
102467 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
102468
102469 [[b][A streambuf object into which the data will be read.]]
102470
102471 [[delim][The delimiter string.]]
102472
102473 ]
102474
102475
102476 [heading Return Value]
102477       
102478 The number of bytes in the streambuf's get area up to and including the delimiter.
102479
102480
102481 [heading Exceptions]
102482     
102483
102484 [variablelist
102485   
102486 [[boost::system::system_error][Thrown on failure.]]
102487
102488 ]
102489
102490
102491 [heading Remarks]
102492       
102493 After a successful read\_until operation, the streambuf may contain additional data beyond the delimiter. An application will typically leave that data in the streambuf for a subsequent read\_until operation to examine.
102494
102495
102496 [heading Example]
102497   
102498 To read data into a streambuf until a newline is encountered: 
102499
102500    boost::asio::streambuf b;
102501    boost::asio::read_until(s, b, "\r\n");
102502    std::istream is(&b);
102503    std::string line;
102504    std::getline(is, line); 
102505
102506
102507 After the `read_until` operation completes successfully, the buffer `b` contains the delimiter: 
102508
102509    { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } 
102510
102511
102512 The call to `std::getline` then extracts the data up to and including the newline (which is discarded), so that the string `line` contains: 
102513
102514    { 'a', 'b', ..., 'c', '\r' } 
102515
102516
102517 The remaining data is left in the buffer `b` as follows: 
102518
102519    { 'd', 'e', ... } 
102520
102521
102522 This data may be the start of a new line, to be extracted by a subsequent `read_until` operation. 
102523
102524
102525
102526
102527 [endsect]
102528
102529
102530
102531 [section:overload12 read_until (12 of 24 overloads)]
102532
102533
102534 Read data into a streambuf until it contains a specified delimiter. 
102535
102536
102537   template<
102538       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
102539       typename Allocator>
102540   std::size_t read_until(
102541       SyncReadStream & s,
102542       boost::asio::basic_streambuf< Allocator > & b,
102543       string_view delim,
102544       boost::system::error_code & ec);
102545
102546
102547 This function is used to read data into the specified streambuf until the streambuf's get area contains the specified delimiter. The call will block until one of the following conditions is true:
102548
102549
102550 * The get area of the streambuf contains the specified delimiter.
102551
102552
102553 * An error occurred.
102554
102555 This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the streambuf's get area already contains the delimiter, the function returns immediately.
102556
102557
102558 [heading Parameters]
102559     
102560
102561 [variablelist
102562   
102563 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
102564
102565 [[b][A streambuf object into which the data will be read.]]
102566
102567 [[delim][The delimiter string.]]
102568
102569 [[ec][Set to indicate what error occurred, if any.]]
102570
102571 ]
102572
102573
102574 [heading Return Value]
102575       
102576 The number of bytes in the streambuf's get area up to and including the delimiter. Returns 0 if an error occurred.
102577
102578
102579 [heading Remarks]
102580       
102581 After a successful read\_until operation, the streambuf may contain additional data beyond the delimiter. An application will typically leave that data in the streambuf for a subsequent read\_until operation to examine. 
102582
102583
102584
102585
102586 [endsect]
102587
102588
102589
102590 [section:overload13 read_until (13 of 24 overloads)]
102591
102592
102593 Read data into a streambuf until some part of the data it contains matches a regular expression. 
102594
102595
102596   template<
102597       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
102598       typename Allocator>
102599   std::size_t read_until(
102600       SyncReadStream & s,
102601       boost::asio::basic_streambuf< Allocator > & b,
102602       const boost::regex & expr);
102603
102604
102605 This function is used to read data into the specified streambuf until the streambuf's get area contains some data that matches a regular expression. The call will block until one of the following conditions is true:
102606
102607
102608 * A substring of the streambuf's get area matches the regular expression.
102609
102610
102611 * An error occurred.
102612
102613 This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the streambuf's get area already contains data that matches the regular expression, the function returns immediately.
102614
102615
102616 [heading Parameters]
102617     
102618
102619 [variablelist
102620   
102621 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
102622
102623 [[b][A streambuf object into which the data will be read.]]
102624
102625 [[expr][The regular expression.]]
102626
102627 ]
102628
102629
102630 [heading Return Value]
102631       
102632 The number of bytes in the streambuf's get area up to and including the substring that matches the regular expression.
102633
102634
102635 [heading Exceptions]
102636     
102637
102638 [variablelist
102639   
102640 [[boost::system::system_error][Thrown on failure.]]
102641
102642 ]
102643
102644
102645 [heading Remarks]
102646       
102647 After a successful read\_until operation, the streambuf may contain additional data beyond that which matched the regular expression. An application will typically leave that data in the streambuf for a subsequent read\_until operation to examine.
102648
102649
102650 [heading Example]
102651   
102652 To read data into a streambuf until a CR-LF sequence is encountered: 
102653
102654    boost::asio::streambuf b;
102655    boost::asio::read_until(s, b, boost::regex("\r\n"));
102656    std::istream is(&b);
102657    std::string line;
102658    std::getline(is, line); 
102659
102660
102661 After the `read_until` operation completes successfully, the buffer `b` contains the data which matched the regular expression: 
102662
102663    { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } 
102664
102665
102666 The call to `std::getline` then extracts the data up to and including the newline (which is discarded), so that the string `line` contains: 
102667
102668    { 'a', 'b', ..., 'c', '\r' } 
102669
102670
102671 The remaining data is left in the buffer `b` as follows: 
102672
102673    { 'd', 'e', ... } 
102674
102675
102676 This data may be the start of a new line, to be extracted by a subsequent `read_until` operation. 
102677
102678
102679
102680
102681 [endsect]
102682
102683
102684
102685 [section:overload14 read_until (14 of 24 overloads)]
102686
102687
102688 Read data into a streambuf until some part of the data it contains matches a regular expression. 
102689
102690
102691   template<
102692       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
102693       typename Allocator>
102694   std::size_t read_until(
102695       SyncReadStream & s,
102696       boost::asio::basic_streambuf< Allocator > & b,
102697       const boost::regex & expr,
102698       boost::system::error_code & ec);
102699
102700
102701 This function is used to read data into the specified streambuf until the streambuf's get area contains some data that matches a regular expression. The call will block until one of the following conditions is true:
102702
102703
102704 * A substring of the streambuf's get area matches the regular expression.
102705
102706
102707 * An error occurred.
102708
102709 This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the streambuf's get area already contains data that matches the regular expression, the function returns immediately.
102710
102711
102712 [heading Parameters]
102713     
102714
102715 [variablelist
102716   
102717 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
102718
102719 [[b][A streambuf object into which the data will be read.]]
102720
102721 [[expr][The regular expression.]]
102722
102723 [[ec][Set to indicate what error occurred, if any.]]
102724
102725 ]
102726
102727
102728 [heading Return Value]
102729       
102730 The number of bytes in the streambuf's get area up to and including the substring that matches the regular expression. Returns 0 if an error occurred.
102731
102732
102733 [heading Remarks]
102734       
102735 After a successful read\_until operation, the streambuf may contain additional data beyond that which matched the regular expression. An application will typically leave that data in the streambuf for a subsequent read\_until operation to examine. 
102736
102737
102738
102739
102740 [endsect]
102741
102742
102743
102744 [section:overload15 read_until (15 of 24 overloads)]
102745
102746
102747 Read data into a streambuf until a function object indicates a match. 
102748
102749
102750   template<
102751       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
102752       typename Allocator,
102753       typename MatchCondition>
102754   std::size_t read_until(
102755       SyncReadStream & s,
102756       boost::asio::basic_streambuf< Allocator > & b,
102757       MatchCondition match_condition,
102758       typename enable_if< is_match_condition< MatchCondition >::value >::type *  = 0);
102759
102760
102761 This function is used to read data into the specified streambuf until a user-defined match condition function object, when applied to the data contained in the streambuf, indicates a successful match. The call will block until one of the following conditions is true:
102762
102763
102764 * The match condition function object returns a std::pair where the second element evaluates to true.
102765
102766
102767 * An error occurred.
102768
102769 This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the match condition function object already indicates a match, the function returns immediately.
102770
102771
102772 [heading Parameters]
102773     
102774
102775 [variablelist
102776   
102777 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
102778
102779 [[b][A streambuf object into which the data will be read.]]
102780
102781 [[match_condition][The function object to be called to determine whether a match exists. The signature of the function object must be: 
102782 ``
102783    pair<iterator, bool> match_condition(iterator begin, iterator end);
102784 ``
102785 where `iterator` represents the type: 
102786 ``
102787    buffers_iterator<basic_streambuf<Allocator>::const_buffers_type>
102788 ``
102789 The iterator parameters `begin` and `end` define the range of bytes to be scanned to determine whether there is a match. The `first` member of the return value is an iterator marking one-past-the-end of the bytes that have been consumed by the match function. This iterator is used to calculate the `begin` parameter for any subsequent invocation of the match condition. The `second` member of the return value is true if a match has been found, false otherwise.]]
102790
102791 ]
102792
102793
102794 [heading Return Value]
102795       
102796 The number of bytes in the streambuf's get area that have been fully consumed by the match function.
102797
102798
102799 [heading Exceptions]
102800     
102801
102802 [variablelist
102803   
102804 [[boost::system::system_error][Thrown on failure.]]
102805
102806 ]
102807
102808
102809 [heading Remarks]
102810       
102811 After a successful read\_until operation, the streambuf may contain additional data beyond that which matched the function object. An application will typically leave that data in the streambuf for a subsequent read\_until operation to examine.
102812
102813 The default implementation of the `is_match_condition` type trait evaluates to true for function pointers and function objects with a `result_type` typedef. It must be specialised for other user-defined function objects.
102814
102815
102816 [heading Examples]
102817   
102818 To read data into a streambuf until whitespace is encountered: 
102819
102820    typedef boost::asio::buffers_iterator<
102821        boost::asio::streambuf::const_buffers_type> iterator;
102822
102823    std::pair<iterator, bool>
102824    match_whitespace(iterator begin, iterator end)
102825    {
102826      iterator i = begin;
102827      while (i != end)
102828        if (std::isspace(*i++))
102829          return std::make_pair(i, true);
102830      return std::make_pair(i, false);
102831    }
102832    ...
102833    boost::asio::streambuf b;
102834    boost::asio::read_until(s, b, match_whitespace);
102835
102836
102837
102838
102839 To read data into a streambuf until a matching character is found: 
102840
102841    class match_char
102842    {
102843    public:
102844      explicit match_char(char c) : c_(c) {}
102845
102846      template <typename Iterator>
102847      std::pair<Iterator, bool> operator()(
102848          Iterator begin, Iterator end) const
102849      {
102850        Iterator i = begin;
102851        while (i != end)
102852          if (c_ == *i++)
102853            return std::make_pair(i, true);
102854        return std::make_pair(i, false);
102855      }
102856
102857    private:
102858      char c_;
102859    };
102860
102861    namespace asio {
102862      template <> struct is_match_condition<match_char>
102863        : public boost::true_type {};
102864    } // namespace asio
102865    ...
102866    boost::asio::streambuf b;
102867    boost::asio::read_until(s, b, match_char('a'));
102868
102869
102870
102871
102872
102873 [endsect]
102874
102875
102876
102877 [section:overload16 read_until (16 of 24 overloads)]
102878
102879
102880 Read data into a streambuf until a function object indicates a match. 
102881
102882
102883   template<
102884       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
102885       typename Allocator,
102886       typename MatchCondition>
102887   std::size_t read_until(
102888       SyncReadStream & s,
102889       boost::asio::basic_streambuf< Allocator > & b,
102890       MatchCondition match_condition,
102891       boost::system::error_code & ec,
102892       typename enable_if< is_match_condition< MatchCondition >::value >::type *  = 0);
102893
102894
102895 This function is used to read data into the specified streambuf until a user-defined match condition function object, when applied to the data contained in the streambuf, indicates a successful match. The call will block until one of the following conditions is true:
102896
102897
102898 * The match condition function object returns a std::pair where the second element evaluates to true.
102899
102900
102901 * An error occurred.
102902
102903 This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the match condition function object already indicates a match, the function returns immediately.
102904
102905
102906 [heading Parameters]
102907     
102908
102909 [variablelist
102910   
102911 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
102912
102913 [[b][A streambuf object into which the data will be read.]]
102914
102915 [[match_condition][The function object to be called to determine whether a match exists. The signature of the function object must be: 
102916 ``
102917    pair<iterator, bool> match_condition(iterator begin, iterator end);
102918 ``
102919 where `iterator` represents the type: 
102920 ``
102921    buffers_iterator<basic_streambuf<Allocator>::const_buffers_type>
102922 ``
102923 The iterator parameters `begin` and `end` define the range of bytes to be scanned to determine whether there is a match. The `first` member of the return value is an iterator marking one-past-the-end of the bytes that have been consumed by the match function. This iterator is used to calculate the `begin` parameter for any subsequent invocation of the match condition. The `second` member of the return value is true if a match has been found, false otherwise.]]
102924
102925 [[ec][Set to indicate what error occurred, if any.]]
102926
102927 ]
102928
102929
102930 [heading Return Value]
102931       
102932 The number of bytes in the streambuf's get area that have been fully consumed by the match function. Returns 0 if an error occurred.
102933
102934
102935 [heading Remarks]
102936       
102937 After a successful read\_until operation, the streambuf may contain additional data beyond that which matched the function object. An application will typically leave that data in the streambuf for a subsequent read\_until operation to examine.
102938
102939 The default implementation of the `is_match_condition` type trait evaluates to true for function pointers and function objects with a `result_type` typedef. It must be specialised for other user-defined function objects. 
102940
102941
102942
102943
102944 [endsect]
102945
102946
102947
102948 [section:overload17 read_until (17 of 24 overloads)]
102949
102950
102951 Read data into a dynamic buffer sequence until it contains a specified delimiter. 
102952
102953
102954   template<
102955       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
102956       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
102957   std::size_t read_until(
102958       SyncReadStream & s,
102959       DynamicBuffer_v2 buffers,
102960       char delim,
102961       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
102962
102963
102964 This function is used to read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains the specified delimiter. The call will block until one of the following conditions is true:
102965
102966
102967 * The get area of the dynamic buffer sequence contains the specified delimiter.
102968
102969
102970 * An error occurred.
102971
102972 This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the dynamic buffer sequence's get area already contains the delimiter, the function returns immediately.
102973
102974
102975 [heading Parameters]
102976     
102977
102978 [variablelist
102979   
102980 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
102981
102982 [[buffers][The dynamic buffer sequence into which the data will be read.]]
102983
102984 [[delim][The delimiter character.]]
102985
102986 ]
102987
102988
102989 [heading Return Value]
102990       
102991 The number of bytes in the dynamic buffer sequence's get area up to and including the delimiter.
102992
102993
102994 [heading Exceptions]
102995     
102996
102997 [variablelist
102998   
102999 [[boost::system::system_error][Thrown on failure.]]
103000
103001 ]
103002
103003
103004 [heading Remarks]
103005       
103006 After a successful read\_until operation, the dynamic buffer sequence may contain additional data beyond the delimiter. An application will typically leave that data in the dynamic buffer sequence for a subsequent read\_until operation to examine.
103007
103008
103009 [heading Example]
103010   
103011 To read data into a `std::string` until a newline is encountered: 
103012
103013    std::string data;
103014    std::string n = boost::asio::read_until(s,
103015        boost::asio::dynamic_buffer(data), '\n');
103016    std::string line = data.substr(0, n);
103017    data.erase(0, n); 
103018
103019
103020 After the `read_until` operation completes successfully, the string `data` contains the delimiter: 
103021
103022    { 'a', 'b', ..., 'c', '\n', 'd', 'e', ... } 
103023
103024
103025 The call to `substr` then extracts the data up to and including the delimiter, so that the string `line` contains: 
103026
103027    { 'a', 'b', ..., 'c', '\n' } 
103028
103029
103030 After the call to `erase`, the remaining data is left in the buffer `b` as follows: 
103031
103032    { 'd', 'e', ... } 
103033
103034
103035 This data may be the start of a new line, to be extracted by a subsequent `read_until` operation. 
103036
103037
103038
103039
103040 [endsect]
103041
103042
103043
103044 [section:overload18 read_until (18 of 24 overloads)]
103045
103046
103047 Read data into a dynamic buffer sequence until it contains a specified delimiter. 
103048
103049
103050   template<
103051       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
103052       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
103053   std::size_t read_until(
103054       SyncReadStream & s,
103055       DynamicBuffer_v2 buffers,
103056       char delim,
103057       boost::system::error_code & ec,
103058       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
103059
103060
103061 This function is used to read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains the specified delimiter. The call will block until one of the following conditions is true:
103062
103063
103064 * The get area of the dynamic buffer sequence contains the specified delimiter.
103065
103066
103067 * An error occurred.
103068
103069 This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the dynamic buffer sequence's get area already contains the delimiter, the function returns immediately.
103070
103071
103072 [heading Parameters]
103073     
103074
103075 [variablelist
103076   
103077 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
103078
103079 [[buffers][The dynamic buffer sequence into which the data will be read.]]
103080
103081 [[delim][The delimiter character.]]
103082
103083 [[ec][Set to indicate what error occurred, if any.]]
103084
103085 ]
103086
103087
103088 [heading Return Value]
103089       
103090 The number of bytes in the dynamic buffer sequence's get area up to and including the delimiter. Returns 0 if an error occurred.
103091
103092
103093 [heading Remarks]
103094       
103095 After a successful read\_until operation, the dynamic buffer sequence may contain additional data beyond the delimiter. An application will typically leave that data in the dynamic buffer sequence for a subsequent read\_until operation to examine. 
103096
103097
103098
103099
103100 [endsect]
103101
103102
103103
103104 [section:overload19 read_until (19 of 24 overloads)]
103105
103106
103107 Read data into a dynamic buffer sequence until it contains a specified delimiter. 
103108
103109
103110   template<
103111       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
103112       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
103113   std::size_t read_until(
103114       SyncReadStream & s,
103115       DynamicBuffer_v2 buffers,
103116       string_view delim,
103117       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
103118
103119
103120 This function is used to read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains the specified delimiter. The call will block until one of the following conditions is true:
103121
103122
103123 * The get area of the dynamic buffer sequence contains the specified delimiter.
103124
103125
103126 * An error occurred.
103127
103128 This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the dynamic buffer sequence's get area already contains the delimiter, the function returns immediately.
103129
103130
103131 [heading Parameters]
103132     
103133
103134 [variablelist
103135   
103136 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
103137
103138 [[buffers][The dynamic buffer sequence into which the data will be read.]]
103139
103140 [[delim][The delimiter string.]]
103141
103142 ]
103143
103144
103145 [heading Return Value]
103146       
103147 The number of bytes in the dynamic buffer sequence's get area up to and including the delimiter.
103148
103149
103150 [heading Remarks]
103151       
103152 After a successful read\_until operation, the dynamic buffer sequence may contain additional data beyond the delimiter. An application will typically leave that data in the dynamic buffer sequence for a subsequent read\_until operation to examine.
103153
103154
103155 [heading Example]
103156   
103157 To read data into a `std::string` until a CR-LF sequence is encountered: 
103158
103159    std::string data;
103160    std::string n = boost::asio::read_until(s,
103161        boost::asio::dynamic_buffer(data), "\r\n");
103162    std::string line = data.substr(0, n);
103163    data.erase(0, n); 
103164
103165
103166 After the `read_until` operation completes successfully, the string `data` contains the delimiter: 
103167
103168    { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } 
103169
103170
103171 The call to `substr` then extracts the data up to and including the delimiter, so that the string `line` contains: 
103172
103173    { 'a', 'b', ..., 'c', '\r', '\n' } 
103174
103175
103176 After the call to `erase`, the remaining data is left in the buffer `b` as follows: 
103177
103178    { 'd', 'e', ... } 
103179
103180
103181 This data may be the start of a new line, to be extracted by a subsequent `read_until` operation. 
103182
103183
103184
103185
103186 [endsect]
103187
103188
103189
103190 [section:overload20 read_until (20 of 24 overloads)]
103191
103192
103193 Read data into a dynamic buffer sequence until it contains a specified delimiter. 
103194
103195
103196   template<
103197       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
103198       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
103199   std::size_t read_until(
103200       SyncReadStream & s,
103201       DynamicBuffer_v2 buffers,
103202       string_view delim,
103203       boost::system::error_code & ec,
103204       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
103205
103206
103207 This function is used to read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains the specified delimiter. The call will block until one of the following conditions is true:
103208
103209
103210 * The get area of the dynamic buffer sequence contains the specified delimiter.
103211
103212
103213 * An error occurred.
103214
103215 This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the dynamic buffer sequence's get area already contains the delimiter, the function returns immediately.
103216
103217
103218 [heading Parameters]
103219     
103220
103221 [variablelist
103222   
103223 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
103224
103225 [[buffers][The dynamic buffer sequence into which the data will be read.]]
103226
103227 [[delim][The delimiter string.]]
103228
103229 [[ec][Set to indicate what error occurred, if any.]]
103230
103231 ]
103232
103233
103234 [heading Return Value]
103235       
103236 The number of bytes in the dynamic buffer sequence's get area up to and including the delimiter. Returns 0 if an error occurred.
103237
103238
103239 [heading Remarks]
103240       
103241 After a successful read\_until operation, the dynamic buffer sequence may contain additional data beyond the delimiter. An application will typically leave that data in the dynamic buffer sequence for a subsequent read\_until operation to examine. 
103242
103243
103244
103245
103246 [endsect]
103247
103248
103249
103250 [section:overload21 read_until (21 of 24 overloads)]
103251
103252
103253 Read data into a dynamic buffer sequence until some part of the data it contains matches a regular expression. 
103254
103255
103256   template<
103257       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
103258       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
103259   std::size_t read_until(
103260       SyncReadStream & s,
103261       DynamicBuffer_v2 buffers,
103262       const boost::regex & expr,
103263       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
103264
103265
103266 This function is used to read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains some data that matches a regular expression. The call will block until one of the following conditions is true:
103267
103268
103269 * A substring of the dynamic buffer sequence's get area matches the regular expression.
103270
103271
103272 * An error occurred.
103273
103274 This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the dynamic buffer sequence's get area already contains data that matches the regular expression, the function returns immediately.
103275
103276
103277 [heading Parameters]
103278     
103279
103280 [variablelist
103281   
103282 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
103283
103284 [[buffers][A dynamic buffer sequence into which the data will be read.]]
103285
103286 [[expr][The regular expression.]]
103287
103288 ]
103289
103290
103291 [heading Return Value]
103292       
103293 The number of bytes in the dynamic buffer sequence's get area up to and including the substring that matches the regular expression.
103294
103295
103296 [heading Exceptions]
103297     
103298
103299 [variablelist
103300   
103301 [[boost::system::system_error][Thrown on failure.]]
103302
103303 ]
103304
103305
103306 [heading Remarks]
103307       
103308 After a successful read\_until operation, the dynamic buffer sequence may contain additional data beyond that which matched the regular expression. An application will typically leave that data in the dynamic buffer sequence for a subsequent read\_until operation to examine.
103309
103310
103311 [heading Example]
103312   
103313 To read data into a `std::string` until a CR-LF sequence is encountered: 
103314
103315    std::string data;
103316    std::string n = boost::asio::read_until(s,
103317        boost::asio::dynamic_buffer(data), boost::regex("\r\n"));
103318    std::string line = data.substr(0, n);
103319    data.erase(0, n); 
103320
103321
103322 After the `read_until` operation completes successfully, the string `data` contains the delimiter: 
103323
103324    { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } 
103325
103326
103327 The call to `substr` then extracts the data up to and including the delimiter, so that the string `line` contains: 
103328
103329    { 'a', 'b', ..., 'c', '\r', '\n' } 
103330
103331
103332 After the call to `erase`, the remaining data is left in the buffer `b` as follows: 
103333
103334    { 'd', 'e', ... } 
103335
103336
103337 This data may be the start of a new line, to be extracted by a subsequent `read_until` operation. 
103338
103339
103340
103341
103342 [endsect]
103343
103344
103345
103346 [section:overload22 read_until (22 of 24 overloads)]
103347
103348
103349 Read data into a dynamic buffer sequence until some part of the data it contains matches a regular expression. 
103350
103351
103352   template<
103353       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
103354       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
103355   std::size_t read_until(
103356       SyncReadStream & s,
103357       DynamicBuffer_v2 buffers,
103358       const boost::regex & expr,
103359       boost::system::error_code & ec,
103360       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
103361
103362
103363 This function is used to read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains some data that matches a regular expression. The call will block until one of the following conditions is true:
103364
103365
103366 * A substring of the dynamic buffer sequence's get area matches the regular expression.
103367
103368
103369 * An error occurred.
103370
103371 This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the dynamic buffer sequence's get area already contains data that matches the regular expression, the function returns immediately.
103372
103373
103374 [heading Parameters]
103375     
103376
103377 [variablelist
103378   
103379 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
103380
103381 [[buffers][A dynamic buffer sequence into which the data will be read.]]
103382
103383 [[expr][The regular expression.]]
103384
103385 [[ec][Set to indicate what error occurred, if any.]]
103386
103387 ]
103388
103389
103390 [heading Return Value]
103391       
103392 The number of bytes in the dynamic buffer sequence's get area up to and including the substring that matches the regular expression. Returns 0 if an error occurred.
103393
103394
103395 [heading Remarks]
103396       
103397 After a successful read\_until operation, the dynamic buffer sequence may contain additional data beyond that which matched the regular expression. An application will typically leave that data in the dynamic buffer sequence for a subsequent read\_until operation to examine. 
103398
103399
103400
103401
103402 [endsect]
103403
103404
103405
103406 [section:overload23 read_until (23 of 24 overloads)]
103407
103408
103409 Read data into a dynamic buffer sequence until a function object indicates a match. 
103410
103411
103412   template<
103413       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
103414       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
103415       typename MatchCondition>
103416   std::size_t read_until(
103417       SyncReadStream & s,
103418       DynamicBuffer_v2 buffers,
103419       MatchCondition match_condition,
103420       typename enable_if< is_match_condition< MatchCondition >::value &&is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
103421
103422
103423 This function is used to read data into the specified dynamic buffer sequence until a user-defined match condition function object, when applied to the data contained in the dynamic buffer sequence, indicates a successful match. The call will block until one of the following conditions is true:
103424
103425
103426 * The match condition function object returns a std::pair where the second element evaluates to true.
103427
103428
103429 * An error occurred.
103430
103431 This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the match condition function object already indicates a match, the function returns immediately.
103432
103433
103434 [heading Parameters]
103435     
103436
103437 [variablelist
103438   
103439 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
103440
103441 [[buffers][A dynamic buffer sequence into which the data will be read.]]
103442
103443 [[match_condition][The function object to be called to determine whether a match exists. The signature of the function object must be: 
103444 ``
103445    pair<iterator, bool> match_condition(iterator begin, iterator end);
103446 ``
103447 where `iterator` represents the type: 
103448 ``
103449    buffers_iterator<typename DynamicBuffer_v2::const_buffers_type>
103450 ``
103451 The iterator parameters `begin` and `end` define the range of bytes to be scanned to determine whether there is a match. The `first` member of the return value is an iterator marking one-past-the-end of the bytes that have been consumed by the match function. This iterator is used to calculate the `begin` parameter for any subsequent invocation of the match condition. The `second` member of the return value is true if a match has been found, false otherwise.]]
103452
103453 ]
103454
103455
103456 [heading Return Value]
103457       
103458 The number of bytes in the dynamic\_buffer's get area that have been fully consumed by the match function.
103459
103460
103461 [heading Exceptions]
103462     
103463
103464 [variablelist
103465   
103466 [[boost::system::system_error][Thrown on failure.]]
103467
103468 ]
103469
103470
103471 [heading Remarks]
103472       
103473 After a successful read\_until operation, the dynamic buffer sequence may contain additional data beyond that which matched the function object. An application will typically leave that data in the dynamic buffer sequence for a subsequent read\_until operation to examine.
103474
103475 The default implementation of the `is_match_condition` type trait evaluates to true for function pointers and function objects with a `result_type` typedef. It must be specialised for other user-defined function objects.
103476
103477
103478 [heading Examples]
103479   
103480 To read data into a dynamic buffer sequence until whitespace is encountered: 
103481
103482    typedef boost::asio::buffers_iterator<
103483        boost::asio::const_buffers_1> iterator;
103484
103485    std::pair<iterator, bool>
103486    match_whitespace(iterator begin, iterator end)
103487    {
103488      iterator i = begin;
103489      while (i != end)
103490        if (std::isspace(*i++))
103491          return std::make_pair(i, true);
103492      return std::make_pair(i, false);
103493    }
103494    ...
103495    std::string data;
103496    boost::asio::read_until(s, data, match_whitespace);
103497
103498
103499
103500
103501 To read data into a `std::string` until a matching character is found: 
103502
103503    class match_char
103504    {
103505    public:
103506      explicit match_char(char c) : c_(c) {}
103507
103508      template <typename Iterator>
103509      std::pair<Iterator, bool> operator()(
103510          Iterator begin, Iterator end) const
103511      {
103512        Iterator i = begin;
103513        while (i != end)
103514          if (c_ == *i++)
103515            return std::make_pair(i, true);
103516        return std::make_pair(i, false);
103517      }
103518
103519    private:
103520      char c_;
103521    };
103522
103523    namespace asio {
103524      template <> struct is_match_condition<match_char>
103525        : public boost::true_type {};
103526    } // namespace asio
103527    ...
103528    std::string data;
103529    boost::asio::read_until(s, data, match_char('a'));
103530
103531
103532
103533
103534
103535 [endsect]
103536
103537
103538
103539 [section:overload24 read_until (24 of 24 overloads)]
103540
103541
103542 Read data into a dynamic buffer sequence until a function object indicates a match. 
103543
103544
103545   template<
103546       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
103547       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
103548       typename MatchCondition>
103549   std::size_t read_until(
103550       SyncReadStream & s,
103551       DynamicBuffer_v2 buffers,
103552       MatchCondition match_condition,
103553       boost::system::error_code & ec,
103554       typename enable_if< is_match_condition< MatchCondition >::value &&is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
103555
103556
103557 This function is used to read data into the specified dynamic buffer sequence until a user-defined match condition function object, when applied to the data contained in the dynamic buffer sequence, indicates a successful match. The call will block until one of the following conditions is true:
103558
103559
103560 * The match condition function object returns a std::pair where the second element evaluates to true.
103561
103562
103563 * An error occurred.
103564
103565 This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the match condition function object already indicates a match, the function returns immediately.
103566
103567
103568 [heading Parameters]
103569     
103570
103571 [variablelist
103572   
103573 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
103574
103575 [[buffers][A dynamic buffer sequence into which the data will be read.]]
103576
103577 [[match_condition][The function object to be called to determine whether a match exists. The signature of the function object must be: 
103578 ``
103579    pair<iterator, bool> match_condition(iterator begin, iterator end);
103580 ``
103581 where `iterator` represents the type: 
103582 ``
103583    buffers_iterator<DynamicBuffer_v2::const_buffers_type>
103584 ``
103585 The iterator parameters `begin` and `end` define the range of bytes to be scanned to determine whether there is a match. The `first` member of the return value is an iterator marking one-past-the-end of the bytes that have been consumed by the match function. This iterator is used to calculate the `begin` parameter for any subsequent invocation of the match condition. The `second` member of the return value is true if a match has been found, false otherwise.]]
103586
103587 [[ec][Set to indicate what error occurred, if any.]]
103588
103589 ]
103590
103591
103592 [heading Return Value]
103593       
103594 The number of bytes in the dynamic buffer sequence's get area that have been fully consumed by the match function. Returns 0 if an error occurred.
103595
103596
103597 [heading Remarks]
103598       
103599 After a successful read\_until operation, the dynamic buffer sequence may contain additional data beyond that which matched the function object. An application will typically leave that data in the dynamic buffer sequence for a subsequent read\_until operation to examine.
103600
103601 The default implementation of the `is_match_condition` type trait evaluates to true for function pointers and function objects with a `result_type` typedef. It must be specialised for other user-defined function objects. 
103602
103603
103604
103605
103606 [endsect]
103607
103608
103609 [endsect]
103610
103611
103612 [section:redirect_error redirect_error]
103613
103614 [indexterm1 boost_asio.indexterm.redirect_error..redirect_error] 
103615 Create a completion token to capture error\_code values to a variable. 
103616
103617
103618   template<
103619       typename CompletionToken>
103620   redirect_error_t< typename decay< CompletionToken >::type > redirect_error(
103621       CompletionToken && completion_token,
103622       boost::system::error_code & ec);
103623
103624
103625 [heading Requirements]
103626
103627 ['Header: ][^boost/asio/redirect_error.hpp]
103628
103629 ['Convenience header: ][^boost/asio.hpp]
103630
103631
103632 [endsect]
103633
103634
103635 [section:redirect_error_t redirect_error_t]
103636
103637
103638 Completion token type used to specify that an error produced by an asynchronous operation is captured to an error\_code variable. 
103639
103640
103641   template<
103642       typename CompletionToken>
103643   class redirect_error_t
103644
103645
103646 [heading Member Functions]
103647 [table
103648   [[Name][Description]]
103649
103650   [
103651     [[link boost_asio.reference.redirect_error_t.redirect_error_t [*redirect_error_t]]]
103652     [Constructor. ]
103653   ]
103654   
103655 ]
103656
103657 [heading Data Members]
103658 [table
103659   [[Name][Description]]
103660
103661   [
103662     [[link boost_asio.reference.redirect_error_t.ec_ [*ec_]]]
103663     []
103664   ]
103665
103666   [
103667     [[link boost_asio.reference.redirect_error_t.token_ [*token_]]]
103668     []
103669   ]
103670
103671 ]
103672
103673 The [link boost_asio.reference.redirect_error_t `redirect_error_t`] class is used to indicate that any error\_code produced by an asynchronous operation is captured to a specified variable. 
103674
103675 [heading Requirements]
103676
103677 ['Header: ][^boost/asio/redirect_error.hpp]
103678
103679 ['Convenience header: ][^boost/asio.hpp]
103680
103681
103682 [section:ec_ redirect_error_t::ec_]
103683
103684 [indexterm2 boost_asio.indexterm.redirect_error_t.ec_..ec_..redirect_error_t] 
103685
103686   boost::system::error_code & ec_;
103687
103688
103689
103690 [endsect]
103691
103692
103693
103694 [section:redirect_error_t redirect_error_t::redirect_error_t]
103695
103696 [indexterm2 boost_asio.indexterm.redirect_error_t.redirect_error_t..redirect_error_t..redirect_error_t] 
103697 Constructor. 
103698
103699
103700   template<
103701       typename T>
103702   redirect_error_t(
103703       T && completion_token,
103704       boost::system::error_code & ec);
103705
103706
103707
103708 [endsect]
103709
103710
103711
103712 [section:token_ redirect_error_t::token_]
103713
103714 [indexterm2 boost_asio.indexterm.redirect_error_t.token_..token_..redirect_error_t] 
103715
103716   CompletionToken token_;
103717
103718
103719
103720 [endsect]
103721
103722
103723
103724 [endsect]
103725
103726
103727 [section:resolver_errc__try_again resolver_errc::try_again]
103728
103729 [indexterm1 boost_asio.indexterm.resolver_errc__try_again..resolver_errc::try_again] 
103730
103731   const error::netdb_errors try_again = error::host_not_found_try_again;
103732
103733
103734 [heading Requirements]
103735
103736 ['Header: ][^boost/asio/error.hpp]
103737
103738 ['Convenience header: ][^boost/asio.hpp]
103739
103740
103741 [endsect]
103742
103743
103744
103745 [section:serial_port serial_port]
103746
103747 [indexterm1 boost_asio.indexterm.serial_port..serial_port] 
103748 Typedef for the typical usage of a serial port. 
103749
103750
103751   typedef basic_serial_port serial_port;
103752
103753
103754 [heading Types]
103755 [table
103756   [[Name][Description]]
103757
103758   [
103759
103760     [[link boost_asio.reference.basic_serial_port__rebind_executor [*rebind_executor]]]
103761     [Rebinds the serial port type to another executor. ]
103762   
103763   ]
103764
103765   [
103766
103767     [[link boost_asio.reference.basic_serial_port.executor_type [*executor_type]]]
103768     [The type of the executor associated with the object. ]
103769   
103770   ]
103771
103772   [
103773
103774     [[link boost_asio.reference.basic_serial_port.lowest_layer_type [*lowest_layer_type]]]
103775     [A basic_basic_serial_port is always the lowest layer. ]
103776   
103777   ]
103778
103779   [
103780
103781     [[link boost_asio.reference.basic_serial_port.native_handle_type [*native_handle_type]]]
103782     [The native representation of a serial port. ]
103783   
103784   ]
103785
103786 ]
103787
103788 [heading Member Functions]
103789 [table
103790   [[Name][Description]]
103791
103792   [
103793     [[link boost_asio.reference.basic_serial_port.assign [*assign]]]
103794     [Assign an existing native serial port to the serial port. ]
103795   ]
103796   
103797   [
103798     [[link boost_asio.reference.basic_serial_port.async_read_some [*async_read_some]]]
103799     [Start an asynchronous read. ]
103800   ]
103801   
103802   [
103803     [[link boost_asio.reference.basic_serial_port.async_write_some [*async_write_some]]]
103804     [Start an asynchronous write. ]
103805   ]
103806   
103807   [
103808     [[link boost_asio.reference.basic_serial_port.basic_serial_port [*basic_serial_port]]]
103809     [Construct a basic_serial_port without opening it. 
103810      [hr]
103811      Construct and open a basic_serial_port. 
103812      [hr]
103813      Construct a basic_serial_port on an existing native serial port. 
103814      [hr]
103815      Move-construct a basic_serial_port from another. ]
103816   ]
103817   
103818   [
103819     [[link boost_asio.reference.basic_serial_port.cancel [*cancel]]]
103820     [Cancel all asynchronous operations associated with the serial port. ]
103821   ]
103822   
103823   [
103824     [[link boost_asio.reference.basic_serial_port.close [*close]]]
103825     [Close the serial port. ]
103826   ]
103827   
103828   [
103829     [[link boost_asio.reference.basic_serial_port.get_executor [*get_executor]]]
103830     [Get the executor associated with the object. ]
103831   ]
103832   
103833   [
103834     [[link boost_asio.reference.basic_serial_port.get_option [*get_option]]]
103835     [Get an option from the serial port. ]
103836   ]
103837   
103838   [
103839     [[link boost_asio.reference.basic_serial_port.is_open [*is_open]]]
103840     [Determine whether the serial port is open. ]
103841   ]
103842   
103843   [
103844     [[link boost_asio.reference.basic_serial_port.lowest_layer [*lowest_layer]]]
103845     [Get a reference to the lowest layer. 
103846      [hr]
103847      Get a const reference to the lowest layer. ]
103848   ]
103849   
103850   [
103851     [[link boost_asio.reference.basic_serial_port.native_handle [*native_handle]]]
103852     [Get the native serial port representation. ]
103853   ]
103854   
103855   [
103856     [[link boost_asio.reference.basic_serial_port.open [*open]]]
103857     [Open the serial port using the specified device name. ]
103858   ]
103859   
103860   [
103861     [[link boost_asio.reference.basic_serial_port.operator_eq_ [*operator=]]]
103862     [Move-assign a basic_serial_port from another. ]
103863   ]
103864   
103865   [
103866     [[link boost_asio.reference.basic_serial_port.read_some [*read_some]]]
103867     [Read some data from the serial port. ]
103868   ]
103869   
103870   [
103871     [[link boost_asio.reference.basic_serial_port.send_break [*send_break]]]
103872     [Send a break sequence to the serial port. ]
103873   ]
103874   
103875   [
103876     [[link boost_asio.reference.basic_serial_port.set_option [*set_option]]]
103877     [Set an option on the serial port. ]
103878   ]
103879   
103880   [
103881     [[link boost_asio.reference.basic_serial_port.write_some [*write_some]]]
103882     [Write some data to the serial port. ]
103883   ]
103884   
103885   [
103886     [[link boost_asio.reference.basic_serial_port._basic_serial_port [*~basic_serial_port]]]
103887     [Destroys the serial port. ]
103888   ]
103889   
103890 ]
103891
103892 The [link boost_asio.reference.basic_serial_port `basic_serial_port`] class provides a wrapper over serial port functionality.
103893
103894
103895 [heading Thread Safety]
103896   
103897 ['Distinct] ['objects:] Safe.
103898
103899 ['Shared] ['objects:] Unsafe. 
103900
103901
103902
103903
103904 [heading Requirements]
103905
103906 ['Header: ][^boost/asio/serial_port.hpp]
103907
103908 ['Convenience header: ][^boost/asio.hpp]
103909
103910
103911 [endsect]
103912
103913
103914 [section:serial_port_base serial_port_base]
103915
103916
103917 The [link boost_asio.reference.serial_port_base `serial_port_base`] class is used as a base for the [link boost_asio.reference.basic_serial_port `basic_serial_port`] class template so that we have a common place to define the serial port options. 
103918
103919
103920   class serial_port_base
103921
103922
103923 [heading Types]
103924 [table
103925   [[Name][Description]]
103926
103927   [
103928
103929     [[link boost_asio.reference.serial_port_base__baud_rate [*baud_rate]]]
103930     [Serial port option to permit changing the baud rate. ]
103931   
103932   ]
103933
103934   [
103935
103936     [[link boost_asio.reference.serial_port_base__character_size [*character_size]]]
103937     [Serial port option to permit changing the character size. ]
103938   
103939   ]
103940
103941   [
103942
103943     [[link boost_asio.reference.serial_port_base__flow_control [*flow_control]]]
103944     [Serial port option to permit changing the flow control. ]
103945   
103946   ]
103947
103948   [
103949
103950     [[link boost_asio.reference.serial_port_base__parity [*parity]]]
103951     [Serial port option to permit changing the parity. ]
103952   
103953   ]
103954
103955   [
103956
103957     [[link boost_asio.reference.serial_port_base__stop_bits [*stop_bits]]]
103958     [Serial port option to permit changing the number of stop bits. ]
103959   
103960   ]
103961
103962 ]
103963
103964 [heading Protected Member Functions]
103965 [table
103966   [[Name][Description]]
103967
103968   [
103969     [[link boost_asio.reference.serial_port_base._serial_port_base [*~serial_port_base]]]
103970     [Protected destructor to prevent deletion through this type. ]
103971   ]
103972   
103973 ]
103974
103975 [heading Requirements]
103976
103977 ['Header: ][^boost/asio/serial_port_base.hpp]
103978
103979 ['Convenience header: ][^boost/asio.hpp]
103980
103981
103982 [section:_serial_port_base serial_port_base::~serial_port_base]
103983
103984 [indexterm2 boost_asio.indexterm.serial_port_base._serial_port_base..~serial_port_base..serial_port_base] 
103985 Protected destructor to prevent deletion through this type. 
103986
103987
103988   ~serial_port_base();
103989
103990
103991
103992 [endsect]
103993
103994
103995
103996 [endsect]
103997
103998 [section:serial_port_base__baud_rate serial_port_base::baud_rate]
103999
104000
104001 Serial port option to permit changing the baud rate. 
104002
104003
104004   class baud_rate
104005
104006
104007 [heading Member Functions]
104008 [table
104009   [[Name][Description]]
104010
104011   [
104012     [[link boost_asio.reference.serial_port_base__baud_rate.baud_rate [*baud_rate]]]
104013     []
104014   ]
104015   
104016   [
104017     [[link boost_asio.reference.serial_port_base__baud_rate.load [*load]]]
104018     []
104019   ]
104020   
104021   [
104022     [[link boost_asio.reference.serial_port_base__baud_rate.store [*store]]]
104023     []
104024   ]
104025   
104026   [
104027     [[link boost_asio.reference.serial_port_base__baud_rate.value [*value]]]
104028     []
104029   ]
104030   
104031 ]
104032
104033 Implements changing the baud rate for a given serial port. 
104034
104035 [heading Requirements]
104036
104037 ['Header: ][^boost/asio/serial_port_base.hpp]
104038
104039 ['Convenience header: ][^boost/asio.hpp]
104040
104041
104042 [section:baud_rate serial_port_base::baud_rate::baud_rate]
104043
104044 [indexterm2 boost_asio.indexterm.serial_port_base__baud_rate.baud_rate..baud_rate..serial_port_base::baud_rate] 
104045
104046   baud_rate(
104047       unsigned int rate = 0);
104048
104049
104050
104051 [endsect]
104052
104053
104054
104055 [section:load serial_port_base::baud_rate::load]
104056
104057 [indexterm2 boost_asio.indexterm.serial_port_base__baud_rate.load..load..serial_port_base::baud_rate] 
104058
104059   void load(
104060       const BOOST_ASIO_OPTION_STORAGE & storage,
104061       boost::system::error_code & ec);
104062
104063
104064
104065 [endsect]
104066
104067
104068
104069 [section:store serial_port_base::baud_rate::store]
104070
104071 [indexterm2 boost_asio.indexterm.serial_port_base__baud_rate.store..store..serial_port_base::baud_rate] 
104072
104073   void store(
104074       BOOST_ASIO_OPTION_STORAGE & storage,
104075       boost::system::error_code & ec) const;
104076
104077
104078
104079 [endsect]
104080
104081
104082
104083 [section:value serial_port_base::baud_rate::value]
104084
104085 [indexterm2 boost_asio.indexterm.serial_port_base__baud_rate.value..value..serial_port_base::baud_rate] 
104086
104087   unsigned int value() const;
104088
104089
104090
104091 [endsect]
104092
104093
104094
104095 [endsect]
104096
104097 [section:serial_port_base__character_size serial_port_base::character_size]
104098
104099
104100 Serial port option to permit changing the character size. 
104101
104102
104103   class character_size
104104
104105
104106 [heading Member Functions]
104107 [table
104108   [[Name][Description]]
104109
104110   [
104111     [[link boost_asio.reference.serial_port_base__character_size.character_size [*character_size]]]
104112     []
104113   ]
104114   
104115   [
104116     [[link boost_asio.reference.serial_port_base__character_size.load [*load]]]
104117     []
104118   ]
104119   
104120   [
104121     [[link boost_asio.reference.serial_port_base__character_size.store [*store]]]
104122     []
104123   ]
104124   
104125   [
104126     [[link boost_asio.reference.serial_port_base__character_size.value [*value]]]
104127     []
104128   ]
104129   
104130 ]
104131
104132 Implements changing the character size for a given serial port. 
104133
104134 [heading Requirements]
104135
104136 ['Header: ][^boost/asio/serial_port_base.hpp]
104137
104138 ['Convenience header: ][^boost/asio.hpp]
104139
104140
104141 [section:character_size serial_port_base::character_size::character_size]
104142
104143 [indexterm2 boost_asio.indexterm.serial_port_base__character_size.character_size..character_size..serial_port_base::character_size] 
104144
104145   character_size(
104146       unsigned int t = 8);
104147
104148
104149
104150 [endsect]
104151
104152
104153
104154 [section:load serial_port_base::character_size::load]
104155
104156 [indexterm2 boost_asio.indexterm.serial_port_base__character_size.load..load..serial_port_base::character_size] 
104157
104158   void load(
104159       const BOOST_ASIO_OPTION_STORAGE & storage,
104160       boost::system::error_code & ec);
104161
104162
104163
104164 [endsect]
104165
104166
104167
104168 [section:store serial_port_base::character_size::store]
104169
104170 [indexterm2 boost_asio.indexterm.serial_port_base__character_size.store..store..serial_port_base::character_size] 
104171
104172   void store(
104173       BOOST_ASIO_OPTION_STORAGE & storage,
104174       boost::system::error_code & ec) const;
104175
104176
104177
104178 [endsect]
104179
104180
104181
104182 [section:value serial_port_base::character_size::value]
104183
104184 [indexterm2 boost_asio.indexterm.serial_port_base__character_size.value..value..serial_port_base::character_size] 
104185
104186   unsigned int value() const;
104187
104188
104189
104190 [endsect]
104191
104192
104193
104194 [endsect]
104195
104196 [section:serial_port_base__flow_control serial_port_base::flow_control]
104197
104198
104199 Serial port option to permit changing the flow control. 
104200
104201
104202   class flow_control
104203
104204
104205 [heading Types]
104206 [table
104207   [[Name][Description]]
104208
104209   [
104210
104211     [[link boost_asio.reference.serial_port_base__flow_control.type [*type]]]
104212     []
104213   
104214   ]
104215
104216 ]
104217
104218 [heading Member Functions]
104219 [table
104220   [[Name][Description]]
104221
104222   [
104223     [[link boost_asio.reference.serial_port_base__flow_control.flow_control [*flow_control]]]
104224     []
104225   ]
104226   
104227   [
104228     [[link boost_asio.reference.serial_port_base__flow_control.load [*load]]]
104229     []
104230   ]
104231   
104232   [
104233     [[link boost_asio.reference.serial_port_base__flow_control.store [*store]]]
104234     []
104235   ]
104236   
104237   [
104238     [[link boost_asio.reference.serial_port_base__flow_control.value [*value]]]
104239     []
104240   ]
104241   
104242 ]
104243
104244 Implements changing the flow control for a given serial port. 
104245
104246 [heading Requirements]
104247
104248 ['Header: ][^boost/asio/serial_port_base.hpp]
104249
104250 ['Convenience header: ][^boost/asio.hpp]
104251
104252
104253 [section:flow_control serial_port_base::flow_control::flow_control]
104254
104255 [indexterm2 boost_asio.indexterm.serial_port_base__flow_control.flow_control..flow_control..serial_port_base::flow_control] 
104256
104257   flow_control(
104258       type t = none);
104259
104260
104261
104262 [endsect]
104263
104264
104265
104266 [section:load serial_port_base::flow_control::load]
104267
104268 [indexterm2 boost_asio.indexterm.serial_port_base__flow_control.load..load..serial_port_base::flow_control] 
104269
104270   void load(
104271       const BOOST_ASIO_OPTION_STORAGE & storage,
104272       boost::system::error_code & ec);
104273
104274
104275
104276 [endsect]
104277
104278
104279
104280 [section:store serial_port_base::flow_control::store]
104281
104282 [indexterm2 boost_asio.indexterm.serial_port_base__flow_control.store..store..serial_port_base::flow_control] 
104283
104284   void store(
104285       BOOST_ASIO_OPTION_STORAGE & storage,
104286       boost::system::error_code & ec) const;
104287
104288
104289
104290 [endsect]
104291
104292
104293
104294 [section:type serial_port_base::flow_control::type]
104295
104296 [indexterm2 boost_asio.indexterm.serial_port_base__flow_control.type..type..serial_port_base::flow_control] 
104297
104298   enum type
104299
104300 [indexterm2 boost_asio.indexterm.serial_port_base__flow_control.type.none..none..serial_port_base::flow_control]
104301 [indexterm2 boost_asio.indexterm.serial_port_base__flow_control.type.software..software..serial_port_base::flow_control]
104302 [indexterm2 boost_asio.indexterm.serial_port_base__flow_control.type.hardware..hardware..serial_port_base::flow_control]
104303
104304 [heading Values]
104305 [variablelist
104306
104307   [
104308     [none]
104309     []
104310   ]
104311
104312   [
104313     [software]
104314     []
104315   ]
104316
104317   [
104318     [hardware]
104319     []
104320   ]
104321
104322 ]
104323
104324
104325
104326 [endsect]
104327
104328
104329
104330 [section:value serial_port_base::flow_control::value]
104331
104332 [indexterm2 boost_asio.indexterm.serial_port_base__flow_control.value..value..serial_port_base::flow_control] 
104333
104334   type value() const;
104335
104336
104337
104338 [endsect]
104339
104340
104341
104342 [endsect]
104343
104344 [section:serial_port_base__parity serial_port_base::parity]
104345
104346
104347 Serial port option to permit changing the parity. 
104348
104349
104350   class parity
104351
104352
104353 [heading Types]
104354 [table
104355   [[Name][Description]]
104356
104357   [
104358
104359     [[link boost_asio.reference.serial_port_base__parity.type [*type]]]
104360     []
104361   
104362   ]
104363
104364 ]
104365
104366 [heading Member Functions]
104367 [table
104368   [[Name][Description]]
104369
104370   [
104371     [[link boost_asio.reference.serial_port_base__parity.load [*load]]]
104372     []
104373   ]
104374   
104375   [
104376     [[link boost_asio.reference.serial_port_base__parity.parity [*parity]]]
104377     []
104378   ]
104379   
104380   [
104381     [[link boost_asio.reference.serial_port_base__parity.store [*store]]]
104382     []
104383   ]
104384   
104385   [
104386     [[link boost_asio.reference.serial_port_base__parity.value [*value]]]
104387     []
104388   ]
104389   
104390 ]
104391
104392 Implements changing the parity for a given serial port. 
104393
104394 [heading Requirements]
104395
104396 ['Header: ][^boost/asio/serial_port_base.hpp]
104397
104398 ['Convenience header: ][^boost/asio.hpp]
104399
104400
104401 [section:load serial_port_base::parity::load]
104402
104403 [indexterm2 boost_asio.indexterm.serial_port_base__parity.load..load..serial_port_base::parity] 
104404
104405   void load(
104406       const BOOST_ASIO_OPTION_STORAGE & storage,
104407       boost::system::error_code & ec);
104408
104409
104410
104411 [endsect]
104412
104413
104414
104415 [section:parity serial_port_base::parity::parity]
104416
104417 [indexterm2 boost_asio.indexterm.serial_port_base__parity.parity..parity..serial_port_base::parity] 
104418
104419   parity(
104420       type t = none);
104421
104422
104423
104424 [endsect]
104425
104426
104427
104428 [section:store serial_port_base::parity::store]
104429
104430 [indexterm2 boost_asio.indexterm.serial_port_base__parity.store..store..serial_port_base::parity] 
104431
104432   void store(
104433       BOOST_ASIO_OPTION_STORAGE & storage,
104434       boost::system::error_code & ec) const;
104435
104436
104437
104438 [endsect]
104439
104440
104441
104442 [section:type serial_port_base::parity::type]
104443
104444 [indexterm2 boost_asio.indexterm.serial_port_base__parity.type..type..serial_port_base::parity] 
104445
104446   enum type
104447
104448 [indexterm2 boost_asio.indexterm.serial_port_base__parity.type.none..none..serial_port_base::parity]
104449 [indexterm2 boost_asio.indexterm.serial_port_base__parity.type.odd..odd..serial_port_base::parity]
104450 [indexterm2 boost_asio.indexterm.serial_port_base__parity.type.even..even..serial_port_base::parity]
104451
104452 [heading Values]
104453 [variablelist
104454
104455   [
104456     [none]
104457     []
104458   ]
104459
104460   [
104461     [odd]
104462     []
104463   ]
104464
104465   [
104466     [even]
104467     []
104468   ]
104469
104470 ]
104471
104472
104473
104474 [endsect]
104475
104476
104477
104478 [section:value serial_port_base::parity::value]
104479
104480 [indexterm2 boost_asio.indexterm.serial_port_base__parity.value..value..serial_port_base::parity] 
104481
104482   type value() const;
104483
104484
104485
104486 [endsect]
104487
104488
104489
104490 [endsect]
104491
104492 [section:serial_port_base__stop_bits serial_port_base::stop_bits]
104493
104494
104495 Serial port option to permit changing the number of stop bits. 
104496
104497
104498   class stop_bits
104499
104500
104501 [heading Types]
104502 [table
104503   [[Name][Description]]
104504
104505   [
104506
104507     [[link boost_asio.reference.serial_port_base__stop_bits.type [*type]]]
104508     []
104509   
104510   ]
104511
104512 ]
104513
104514 [heading Member Functions]
104515 [table
104516   [[Name][Description]]
104517
104518   [
104519     [[link boost_asio.reference.serial_port_base__stop_bits.load [*load]]]
104520     []
104521   ]
104522   
104523   [
104524     [[link boost_asio.reference.serial_port_base__stop_bits.stop_bits [*stop_bits]]]
104525     []
104526   ]
104527   
104528   [
104529     [[link boost_asio.reference.serial_port_base__stop_bits.store [*store]]]
104530     []
104531   ]
104532   
104533   [
104534     [[link boost_asio.reference.serial_port_base__stop_bits.value [*value]]]
104535     []
104536   ]
104537   
104538 ]
104539
104540 Implements changing the number of stop bits for a given serial port. 
104541
104542 [heading Requirements]
104543
104544 ['Header: ][^boost/asio/serial_port_base.hpp]
104545
104546 ['Convenience header: ][^boost/asio.hpp]
104547
104548
104549 [section:load serial_port_base::stop_bits::load]
104550
104551 [indexterm2 boost_asio.indexterm.serial_port_base__stop_bits.load..load..serial_port_base::stop_bits] 
104552
104553   void load(
104554       const BOOST_ASIO_OPTION_STORAGE & storage,
104555       boost::system::error_code & ec);
104556
104557
104558
104559 [endsect]
104560
104561
104562
104563 [section:stop_bits serial_port_base::stop_bits::stop_bits]
104564
104565 [indexterm2 boost_asio.indexterm.serial_port_base__stop_bits.stop_bits..stop_bits..serial_port_base::stop_bits] 
104566
104567   stop_bits(
104568       type t = one);
104569
104570
104571
104572 [endsect]
104573
104574
104575
104576 [section:store serial_port_base::stop_bits::store]
104577
104578 [indexterm2 boost_asio.indexterm.serial_port_base__stop_bits.store..store..serial_port_base::stop_bits] 
104579
104580   void store(
104581       BOOST_ASIO_OPTION_STORAGE & storage,
104582       boost::system::error_code & ec) const;
104583
104584
104585
104586 [endsect]
104587
104588
104589
104590 [section:type serial_port_base::stop_bits::type]
104591
104592 [indexterm2 boost_asio.indexterm.serial_port_base__stop_bits.type..type..serial_port_base::stop_bits] 
104593
104594   enum type
104595
104596 [indexterm2 boost_asio.indexterm.serial_port_base__stop_bits.type.one..one..serial_port_base::stop_bits]
104597 [indexterm2 boost_asio.indexterm.serial_port_base__stop_bits.type.onepointfive..onepointfive..serial_port_base::stop_bits]
104598 [indexterm2 boost_asio.indexterm.serial_port_base__stop_bits.type.two..two..serial_port_base::stop_bits]
104599
104600 [heading Values]
104601 [variablelist
104602
104603   [
104604     [one]
104605     []
104606   ]
104607
104608   [
104609     [onepointfive]
104610     []
104611   ]
104612
104613   [
104614     [two]
104615     []
104616   ]
104617
104618 ]
104619
104620
104621
104622 [endsect]
104623
104624
104625
104626 [section:value serial_port_base::stop_bits::value]
104627
104628 [indexterm2 boost_asio.indexterm.serial_port_base__stop_bits.value..value..serial_port_base::stop_bits] 
104629
104630   type value() const;
104631
104632
104633
104634 [endsect]
104635
104636
104637
104638 [endsect]
104639
104640 [section:service_already_exists service_already_exists]
104641
104642
104643 Exception thrown when trying to add a duplicate service to an [link boost_asio.reference.execution_context `execution_context`]. 
104644
104645
104646   class service_already_exists
104647
104648
104649 [heading Member Functions]
104650 [table
104651   [[Name][Description]]
104652
104653   [
104654     [[link boost_asio.reference.service_already_exists.service_already_exists [*service_already_exists]]]
104655     []
104656   ]
104657   
104658 ]
104659
104660 [heading Requirements]
104661
104662 ['Header: ][^boost/asio/execution_context.hpp]
104663
104664 ['Convenience header: ][^boost/asio.hpp]
104665
104666
104667 [section:service_already_exists service_already_exists::service_already_exists]
104668
104669 [indexterm2 boost_asio.indexterm.service_already_exists.service_already_exists..service_already_exists..service_already_exists] 
104670
104671   service_already_exists();
104672
104673
104674
104675 [endsect]
104676
104677
104678
104679 [endsect]
104680
104681
104682 [section:signal_set signal_set]
104683
104684 [indexterm1 boost_asio.indexterm.signal_set..signal_set] 
104685 Typedef for the typical usage of a signal set. 
104686
104687
104688   typedef basic_signal_set signal_set;
104689
104690
104691 [heading Types]
104692 [table
104693   [[Name][Description]]
104694
104695   [
104696
104697     [[link boost_asio.reference.basic_signal_set__rebind_executor [*rebind_executor]]]
104698     [Rebinds the signal set type to another executor. ]
104699   
104700   ]
104701
104702   [
104703
104704     [[link boost_asio.reference.basic_signal_set.executor_type [*executor_type]]]
104705     [The type of the executor associated with the object. ]
104706   
104707   ]
104708
104709 ]
104710
104711 [heading Member Functions]
104712 [table
104713   [[Name][Description]]
104714
104715   [
104716     [[link boost_asio.reference.basic_signal_set.add [*add]]]
104717     [Add a signal to a signal_set. ]
104718   ]
104719   
104720   [
104721     [[link boost_asio.reference.basic_signal_set.async_wait [*async_wait]]]
104722     [Start an asynchronous operation to wait for a signal to be delivered. ]
104723   ]
104724   
104725   [
104726     [[link boost_asio.reference.basic_signal_set.basic_signal_set [*basic_signal_set]]]
104727     [Construct a signal set without adding any signals. 
104728      [hr]
104729      Construct a signal set and add one signal. 
104730      [hr]
104731      Construct a signal set and add two signals. 
104732      [hr]
104733      Construct a signal set and add three signals. ]
104734   ]
104735   
104736   [
104737     [[link boost_asio.reference.basic_signal_set.cancel [*cancel]]]
104738     [Cancel all operations associated with the signal set. ]
104739   ]
104740   
104741   [
104742     [[link boost_asio.reference.basic_signal_set.clear [*clear]]]
104743     [Remove all signals from a signal_set. ]
104744   ]
104745   
104746   [
104747     [[link boost_asio.reference.basic_signal_set.get_executor [*get_executor]]]
104748     [Get the executor associated with the object. ]
104749   ]
104750   
104751   [
104752     [[link boost_asio.reference.basic_signal_set.remove [*remove]]]
104753     [Remove a signal from a signal_set. ]
104754   ]
104755   
104756   [
104757     [[link boost_asio.reference.basic_signal_set._basic_signal_set [*~basic_signal_set]]]
104758     [Destroys the signal set. ]
104759   ]
104760   
104761 ]
104762
104763 The [link boost_asio.reference.basic_signal_set `basic_signal_set`] class provides the ability to perform an asynchronous wait for one or more signals to occur.
104764
104765
104766 [heading Thread Safety]
104767   
104768 ['Distinct] ['objects:] Safe.
104769
104770 ['Shared] ['objects:] Unsafe.
104771
104772
104773 [heading Example]
104774   
104775 Performing an asynchronous wait: 
104776
104777    void handler(
104778        const boost::system::error_code& error,
104779        int signal_number)
104780    {
104781      if (!error)
104782      {
104783        // A signal occurred.
104784      }
104785    }
104786
104787    ...
104788
104789    // Construct a signal set registered for process termination.
104790    boost::asio::signal_set signals(my_context, SIGINT, SIGTERM);
104791
104792    // Start an asynchronous wait for one of the signals to occur.
104793    signals.async_wait(handler);
104794
104795
104796
104797
104798
104799 [heading Queueing of signal notifications]
104800   
104801
104802
104803 If a signal is registered with a signal\_set, and the signal occurs when there are no waiting handlers, then the signal notification is queued. The next async\_wait operation on that signal\_set will dequeue the notification. If multiple notifications are queued, subsequent async\_wait operations dequeue them one at a time. Signal notifications are dequeued in order of ascending signal number.
104804
104805 If a signal number is removed from a signal\_set (using the `remove` or `erase` member functions) then any queued notifications for that signal are discarded.
104806
104807
104808 [heading Multiple registration of signals]
104809   
104810
104811
104812 The same signal number may be registered with different signal\_set objects. When the signal occurs, one handler is called for each signal\_set object.
104813
104814 Note that multiple registration only works for signals that are registered using Asio. The application must not also register a signal handler using functions such as `signal()` or `sigaction()`.
104815
104816
104817 [heading Signal masking on POSIX platforms]
104818   
104819
104820
104821 POSIX allows signals to be blocked using functions such as `sigprocmask()` and `pthread_sigmask()`. For signals to be delivered, programs must ensure that any signals registered using signal\_set objects are unblocked in at least one thread. 
104822
104823
104824 [heading Requirements]
104825
104826 ['Header: ][^boost/asio/signal_set.hpp]
104827
104828 ['Convenience header: ][^boost/asio.hpp]
104829
104830
104831 [endsect]
104832
104833
104834 [section:socket_base socket_base]
104835
104836
104837 The [link boost_asio.reference.socket_base `socket_base`] class is used as a base for the [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] and [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] class templates so that we have a common place to define the shutdown\_type and enum. 
104838
104839
104840   class socket_base
104841
104842
104843 [heading Types]
104844 [table
104845   [[Name][Description]]
104846
104847   [
104848
104849     [[link boost_asio.reference.socket_base.broadcast [*broadcast]]]
104850     [Socket option to permit sending of broadcast messages. ]
104851   
104852   ]
104853
104854   [
104855
104856     [[link boost_asio.reference.socket_base.bytes_readable [*bytes_readable]]]
104857     [IO control command to get the amount of data that can be read without blocking. ]
104858   
104859   ]
104860
104861   [
104862
104863     [[link boost_asio.reference.socket_base.debug [*debug]]]
104864     [Socket option to enable socket-level debugging. ]
104865   
104866   ]
104867
104868   [
104869
104870     [[link boost_asio.reference.socket_base.do_not_route [*do_not_route]]]
104871     [Socket option to prevent routing, use local interfaces only. ]
104872   
104873   ]
104874
104875   [
104876
104877     [[link boost_asio.reference.socket_base.enable_connection_aborted [*enable_connection_aborted]]]
104878     [Socket option to report aborted connections on accept. ]
104879   
104880   ]
104881
104882   [
104883
104884     [[link boost_asio.reference.socket_base.keep_alive [*keep_alive]]]
104885     [Socket option to send keep-alives. ]
104886   
104887   ]
104888
104889   [
104890
104891     [[link boost_asio.reference.socket_base.linger [*linger]]]
104892     [Socket option to specify whether the socket lingers on close if unsent data is present. ]
104893   
104894   ]
104895
104896   [
104897
104898     [[link boost_asio.reference.socket_base.message_flags [*message_flags]]]
104899     [Bitmask type for flags that can be passed to send and receive operations. ]
104900   
104901   ]
104902
104903   [
104904
104905     [[link boost_asio.reference.socket_base.out_of_band_inline [*out_of_band_inline]]]
104906     [Socket option for putting received out-of-band data inline. ]
104907   
104908   ]
104909
104910   [
104911
104912     [[link boost_asio.reference.socket_base.receive_buffer_size [*receive_buffer_size]]]
104913     [Socket option for the receive buffer size of a socket. ]
104914   
104915   ]
104916
104917   [
104918
104919     [[link boost_asio.reference.socket_base.receive_low_watermark [*receive_low_watermark]]]
104920     [Socket option for the receive low watermark. ]
104921   
104922   ]
104923
104924   [
104925
104926     [[link boost_asio.reference.socket_base.reuse_address [*reuse_address]]]
104927     [Socket option to allow the socket to be bound to an address that is already in use. ]
104928   
104929   ]
104930
104931   [
104932
104933     [[link boost_asio.reference.socket_base.send_buffer_size [*send_buffer_size]]]
104934     [Socket option for the send buffer size of a socket. ]
104935   
104936   ]
104937
104938   [
104939
104940     [[link boost_asio.reference.socket_base.send_low_watermark [*send_low_watermark]]]
104941     [Socket option for the send low watermark. ]
104942   
104943   ]
104944
104945   [
104946
104947     [[link boost_asio.reference.socket_base.shutdown_type [*shutdown_type]]]
104948     [Different ways a socket may be shutdown. ]
104949   
104950   ]
104951
104952   [
104953
104954     [[link boost_asio.reference.socket_base.wait_type [*wait_type]]]
104955     [Wait types. ]
104956   
104957   ]
104958
104959 ]
104960
104961 [heading Protected Member Functions]
104962 [table
104963   [[Name][Description]]
104964
104965   [
104966     [[link boost_asio.reference.socket_base._socket_base [*~socket_base]]]
104967     [Protected destructor to prevent deletion through this type. ]
104968   ]
104969   
104970 ]
104971
104972 [heading Data Members]
104973 [table
104974   [[Name][Description]]
104975
104976   [
104977     [[link boost_asio.reference.socket_base.max_connections [*max_connections]]]
104978     [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
104979   ]
104980
104981   [
104982     [[link boost_asio.reference.socket_base.max_listen_connections [*max_listen_connections]]]
104983     [The maximum length of the queue of pending incoming connections. ]
104984   ]
104985
104986   [
104987     [[link boost_asio.reference.socket_base.message_do_not_route [*message_do_not_route]]]
104988     [Specify that the data should not be subject to routing. ]
104989   ]
104990
104991   [
104992     [[link boost_asio.reference.socket_base.message_end_of_record [*message_end_of_record]]]
104993     [Specifies that the data marks the end of a record. ]
104994   ]
104995
104996   [
104997     [[link boost_asio.reference.socket_base.message_out_of_band [*message_out_of_band]]]
104998     [Process out-of-band data. ]
104999   ]
105000
105001   [
105002     [[link boost_asio.reference.socket_base.message_peek [*message_peek]]]
105003     [Peek at incoming data without removing it from the input queue. ]
105004   ]
105005
105006 ]
105007
105008 [heading Requirements]
105009
105010 ['Header: ][^boost/asio/socket_base.hpp]
105011
105012 ['Convenience header: ][^boost/asio.hpp]
105013
105014
105015 [section:broadcast socket_base::broadcast]
105016
105017 [indexterm2 boost_asio.indexterm.socket_base.broadcast..broadcast..socket_base] 
105018 Socket option to permit sending of broadcast messages. 
105019
105020
105021   typedef implementation_defined broadcast;
105022
105023
105024
105025 Implements the SOL\_SOCKET/SO\_BROADCAST socket option.
105026
105027
105028 [heading Examples]
105029   
105030 Setting the option: 
105031
105032    boost::asio::ip::udp::socket socket(my_context);
105033    ...
105034    boost::asio::socket_base::broadcast option(true);
105035    socket.set_option(option);
105036
105037
105038
105039
105040
105041 Getting the current option value: 
105042
105043    boost::asio::ip::udp::socket socket(my_context);
105044    ...
105045    boost::asio::socket_base::broadcast option;
105046    socket.get_option(option);
105047    bool is_set = option.value();
105048
105049
105050
105051
105052
105053
105054
105055 [heading Requirements]
105056
105057 ['Header: ][^boost/asio/socket_base.hpp]
105058
105059 ['Convenience header: ][^boost/asio.hpp]
105060
105061
105062 [endsect]
105063
105064
105065
105066 [section:bytes_readable socket_base::bytes_readable]
105067
105068 [indexterm2 boost_asio.indexterm.socket_base.bytes_readable..bytes_readable..socket_base] 
105069 IO control command to get the amount of data that can be read without blocking. 
105070
105071
105072   typedef implementation_defined bytes_readable;
105073
105074
105075
105076 Implements the FIONREAD IO control command.
105077
105078
105079 [heading Example]
105080   
105081
105082
105083    boost::asio::ip::tcp::socket socket(my_context);
105084    ...
105085    boost::asio::socket_base::bytes_readable command(true);
105086    socket.io_control(command);
105087    std::size_t bytes_readable = command.get();
105088
105089
105090
105091
105092
105093
105094
105095 [heading Requirements]
105096
105097 ['Header: ][^boost/asio/socket_base.hpp]
105098
105099 ['Convenience header: ][^boost/asio.hpp]
105100
105101
105102 [endsect]
105103
105104
105105
105106 [section:debug socket_base::debug]
105107
105108 [indexterm2 boost_asio.indexterm.socket_base.debug..debug..socket_base] 
105109 Socket option to enable socket-level debugging. 
105110
105111
105112   typedef implementation_defined debug;
105113
105114
105115
105116 Implements the SOL\_SOCKET/SO\_DEBUG socket option.
105117
105118
105119 [heading Examples]
105120   
105121 Setting the option: 
105122
105123    boost::asio::ip::tcp::socket socket(my_context);
105124    ...
105125    boost::asio::socket_base::debug option(true);
105126    socket.set_option(option);
105127
105128
105129
105130
105131
105132 Getting the current option value: 
105133
105134    boost::asio::ip::tcp::socket socket(my_context);
105135    ...
105136    boost::asio::socket_base::debug option;
105137    socket.get_option(option);
105138    bool is_set = option.value();
105139
105140
105141
105142
105143
105144
105145
105146 [heading Requirements]
105147
105148 ['Header: ][^boost/asio/socket_base.hpp]
105149
105150 ['Convenience header: ][^boost/asio.hpp]
105151
105152
105153 [endsect]
105154
105155
105156
105157 [section:do_not_route socket_base::do_not_route]
105158
105159 [indexterm2 boost_asio.indexterm.socket_base.do_not_route..do_not_route..socket_base] 
105160 Socket option to prevent routing, use local interfaces only. 
105161
105162
105163   typedef implementation_defined do_not_route;
105164
105165
105166
105167 Implements the SOL\_SOCKET/SO\_DONTROUTE socket option.
105168
105169
105170 [heading Examples]
105171   
105172 Setting the option: 
105173
105174    boost::asio::ip::udp::socket socket(my_context);
105175    ...
105176    boost::asio::socket_base::do_not_route option(true);
105177    socket.set_option(option);
105178
105179
105180
105181
105182
105183 Getting the current option value: 
105184
105185    boost::asio::ip::udp::socket socket(my_context);
105186    ...
105187    boost::asio::socket_base::do_not_route option;
105188    socket.get_option(option);
105189    bool is_set = option.value();
105190
105191
105192
105193
105194
105195
105196
105197 [heading Requirements]
105198
105199 ['Header: ][^boost/asio/socket_base.hpp]
105200
105201 ['Convenience header: ][^boost/asio.hpp]
105202
105203
105204 [endsect]
105205
105206
105207
105208 [section:enable_connection_aborted socket_base::enable_connection_aborted]
105209
105210 [indexterm2 boost_asio.indexterm.socket_base.enable_connection_aborted..enable_connection_aborted..socket_base] 
105211 Socket option to report aborted connections on accept. 
105212
105213
105214   typedef implementation_defined enable_connection_aborted;
105215
105216
105217
105218 Implements a custom socket option that determines whether or not an accept operation is permitted to fail with `boost::asio::error::connection_aborted`. By default the option is false.
105219
105220
105221 [heading Examples]
105222   
105223 Setting the option: 
105224
105225    boost::asio::ip::tcp::acceptor acceptor(my_context);
105226    ...
105227    boost::asio::socket_base::enable_connection_aborted option(true);
105228    acceptor.set_option(option);
105229
105230
105231
105232
105233
105234 Getting the current option value: 
105235
105236    boost::asio::ip::tcp::acceptor acceptor(my_context);
105237    ...
105238    boost::asio::socket_base::enable_connection_aborted option;
105239    acceptor.get_option(option);
105240    bool is_set = option.value();
105241
105242
105243
105244
105245
105246
105247
105248 [heading Requirements]
105249
105250 ['Header: ][^boost/asio/socket_base.hpp]
105251
105252 ['Convenience header: ][^boost/asio.hpp]
105253
105254
105255 [endsect]
105256
105257
105258
105259 [section:keep_alive socket_base::keep_alive]
105260
105261 [indexterm2 boost_asio.indexterm.socket_base.keep_alive..keep_alive..socket_base] 
105262 Socket option to send keep-alives. 
105263
105264
105265   typedef implementation_defined keep_alive;
105266
105267
105268
105269 Implements the SOL\_SOCKET/SO\_KEEPALIVE socket option.
105270
105271
105272 [heading Examples]
105273   
105274 Setting the option: 
105275
105276    boost::asio::ip::tcp::socket socket(my_context);
105277    ...
105278    boost::asio::socket_base::keep_alive option(true);
105279    socket.set_option(option);
105280
105281
105282
105283
105284
105285 Getting the current option value: 
105286
105287    boost::asio::ip::tcp::socket socket(my_context);
105288    ...
105289    boost::asio::socket_base::keep_alive option;
105290    socket.get_option(option);
105291    bool is_set = option.value();
105292
105293
105294
105295
105296
105297
105298
105299 [heading Requirements]
105300
105301 ['Header: ][^boost/asio/socket_base.hpp]
105302
105303 ['Convenience header: ][^boost/asio.hpp]
105304
105305
105306 [endsect]
105307
105308
105309
105310 [section:linger socket_base::linger]
105311
105312 [indexterm2 boost_asio.indexterm.socket_base.linger..linger..socket_base] 
105313 Socket option to specify whether the socket lingers on close if unsent data is present. 
105314
105315
105316   typedef implementation_defined linger;
105317
105318
105319
105320 Implements the SOL\_SOCKET/SO\_LINGER socket option.
105321
105322
105323 [heading Examples]
105324   
105325 Setting the option: 
105326
105327    boost::asio::ip::tcp::socket socket(my_context);
105328    ...
105329    boost::asio::socket_base::linger option(true, 30);
105330    socket.set_option(option);
105331
105332
105333
105334
105335
105336 Getting the current option value: 
105337
105338    boost::asio::ip::tcp::socket socket(my_context);
105339    ...
105340    boost::asio::socket_base::linger option;
105341    socket.get_option(option);
105342    bool is_set = option.enabled();
105343    unsigned short timeout = option.timeout();
105344
105345
105346
105347
105348
105349
105350
105351 [heading Requirements]
105352
105353 ['Header: ][^boost/asio/socket_base.hpp]
105354
105355 ['Convenience header: ][^boost/asio.hpp]
105356
105357
105358 [endsect]
105359
105360
105361
105362 [section:max_connections socket_base::max_connections]
105363
105364 [indexterm2 boost_asio.indexterm.socket_base.max_connections..max_connections..socket_base] 
105365 (Deprecated: Use max\_listen\_connections.) The maximum length of the queue of pending incoming connections. 
105366
105367
105368   static const int max_connections = implementation_defined;
105369
105370
105371
105372 [endsect]
105373
105374
105375
105376 [section:max_listen_connections socket_base::max_listen_connections]
105377
105378 [indexterm2 boost_asio.indexterm.socket_base.max_listen_connections..max_listen_connections..socket_base] 
105379 The maximum length of the queue of pending incoming connections. 
105380
105381
105382   static const int max_listen_connections = implementation_defined;
105383
105384
105385
105386 [endsect]
105387
105388
105389
105390 [section:message_do_not_route socket_base::message_do_not_route]
105391
105392 [indexterm2 boost_asio.indexterm.socket_base.message_do_not_route..message_do_not_route..socket_base] 
105393 Specify that the data should not be subject to routing. 
105394
105395
105396   static const int message_do_not_route = implementation_defined;
105397
105398
105399
105400 [endsect]
105401
105402
105403
105404 [section:message_end_of_record socket_base::message_end_of_record]
105405
105406 [indexterm2 boost_asio.indexterm.socket_base.message_end_of_record..message_end_of_record..socket_base] 
105407 Specifies that the data marks the end of a record. 
105408
105409
105410   static const int message_end_of_record = implementation_defined;
105411
105412
105413
105414 [endsect]
105415
105416
105417
105418 [section:message_flags socket_base::message_flags]
105419
105420 [indexterm2 boost_asio.indexterm.socket_base.message_flags..message_flags..socket_base] 
105421 Bitmask type for flags that can be passed to send and receive operations. 
105422
105423
105424   typedef int message_flags;
105425
105426
105427
105428 [heading Requirements]
105429
105430 ['Header: ][^boost/asio/socket_base.hpp]
105431
105432 ['Convenience header: ][^boost/asio.hpp]
105433
105434
105435 [endsect]
105436
105437
105438
105439 [section:message_out_of_band socket_base::message_out_of_band]
105440
105441 [indexterm2 boost_asio.indexterm.socket_base.message_out_of_band..message_out_of_band..socket_base] 
105442 Process out-of-band data. 
105443
105444
105445   static const int message_out_of_band = implementation_defined;
105446
105447
105448
105449 [endsect]
105450
105451
105452
105453 [section:message_peek socket_base::message_peek]
105454
105455 [indexterm2 boost_asio.indexterm.socket_base.message_peek..message_peek..socket_base] 
105456 Peek at incoming data without removing it from the input queue. 
105457
105458
105459   static const int message_peek = implementation_defined;
105460
105461
105462
105463 [endsect]
105464
105465
105466
105467 [section:out_of_band_inline socket_base::out_of_band_inline]
105468
105469 [indexterm2 boost_asio.indexterm.socket_base.out_of_band_inline..out_of_band_inline..socket_base] 
105470 Socket option for putting received out-of-band data inline. 
105471
105472
105473   typedef implementation_defined out_of_band_inline;
105474
105475
105476
105477 Implements the SOL\_SOCKET/SO\_OOBINLINE socket option.
105478
105479
105480 [heading Examples]
105481   
105482 Setting the option: 
105483
105484    boost::asio::ip::tcp::socket socket(my_context);
105485    ...
105486    boost::asio::socket_base::out_of_band_inline option(true);
105487    socket.set_option(option);
105488
105489
105490
105491
105492
105493 Getting the current option value: 
105494
105495    boost::asio::ip::tcp::socket socket(my_context);
105496    ...
105497    boost::asio::socket_base::out_of_band_inline option;
105498    socket.get_option(option);
105499    bool value = option.value();
105500
105501
105502
105503
105504
105505
105506
105507 [heading Requirements]
105508
105509 ['Header: ][^boost/asio/socket_base.hpp]
105510
105511 ['Convenience header: ][^boost/asio.hpp]
105512
105513
105514 [endsect]
105515
105516
105517
105518 [section:receive_buffer_size socket_base::receive_buffer_size]
105519
105520 [indexterm2 boost_asio.indexterm.socket_base.receive_buffer_size..receive_buffer_size..socket_base] 
105521 Socket option for the receive buffer size of a socket. 
105522
105523
105524   typedef implementation_defined receive_buffer_size;
105525
105526
105527
105528 Implements the SOL\_SOCKET/SO\_RCVBUF socket option.
105529
105530
105531 [heading Examples]
105532   
105533 Setting the option: 
105534
105535    boost::asio::ip::tcp::socket socket(my_context);
105536    ...
105537    boost::asio::socket_base::receive_buffer_size option(8192);
105538    socket.set_option(option);
105539
105540
105541
105542
105543
105544 Getting the current option value: 
105545
105546    boost::asio::ip::tcp::socket socket(my_context);
105547    ...
105548    boost::asio::socket_base::receive_buffer_size option;
105549    socket.get_option(option);
105550    int size = option.value();
105551
105552
105553
105554
105555
105556
105557
105558 [heading Requirements]
105559
105560 ['Header: ][^boost/asio/socket_base.hpp]
105561
105562 ['Convenience header: ][^boost/asio.hpp]
105563
105564
105565 [endsect]
105566
105567
105568
105569 [section:receive_low_watermark socket_base::receive_low_watermark]
105570
105571 [indexterm2 boost_asio.indexterm.socket_base.receive_low_watermark..receive_low_watermark..socket_base] 
105572 Socket option for the receive low watermark. 
105573
105574
105575   typedef implementation_defined receive_low_watermark;
105576
105577
105578
105579 Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option.
105580
105581
105582 [heading Examples]
105583   
105584 Setting the option: 
105585
105586    boost::asio::ip::tcp::socket socket(my_context);
105587    ...
105588    boost::asio::socket_base::receive_low_watermark option(1024);
105589    socket.set_option(option);
105590
105591
105592
105593
105594
105595 Getting the current option value: 
105596
105597    boost::asio::ip::tcp::socket socket(my_context);
105598    ...
105599    boost::asio::socket_base::receive_low_watermark option;
105600    socket.get_option(option);
105601    int size = option.value();
105602
105603
105604
105605
105606
105607
105608
105609 [heading Requirements]
105610
105611 ['Header: ][^boost/asio/socket_base.hpp]
105612
105613 ['Convenience header: ][^boost/asio.hpp]
105614
105615
105616 [endsect]
105617
105618
105619
105620 [section:reuse_address socket_base::reuse_address]
105621
105622 [indexterm2 boost_asio.indexterm.socket_base.reuse_address..reuse_address..socket_base] 
105623 Socket option to allow the socket to be bound to an address that is already in use. 
105624
105625
105626   typedef implementation_defined reuse_address;
105627
105628
105629
105630 Implements the SOL\_SOCKET/SO\_REUSEADDR socket option.
105631
105632
105633 [heading Examples]
105634   
105635 Setting the option: 
105636
105637    boost::asio::ip::tcp::acceptor acceptor(my_context);
105638    ...
105639    boost::asio::socket_base::reuse_address option(true);
105640    acceptor.set_option(option);
105641
105642
105643
105644
105645
105646 Getting the current option value: 
105647
105648    boost::asio::ip::tcp::acceptor acceptor(my_context);
105649    ...
105650    boost::asio::socket_base::reuse_address option;
105651    acceptor.get_option(option);
105652    bool is_set = option.value();
105653
105654
105655
105656
105657
105658
105659
105660 [heading Requirements]
105661
105662 ['Header: ][^boost/asio/socket_base.hpp]
105663
105664 ['Convenience header: ][^boost/asio.hpp]
105665
105666
105667 [endsect]
105668
105669
105670
105671 [section:send_buffer_size socket_base::send_buffer_size]
105672
105673 [indexterm2 boost_asio.indexterm.socket_base.send_buffer_size..send_buffer_size..socket_base] 
105674 Socket option for the send buffer size of a socket. 
105675
105676
105677   typedef implementation_defined send_buffer_size;
105678
105679
105680
105681 Implements the SOL\_SOCKET/SO\_SNDBUF socket option.
105682
105683
105684 [heading Examples]
105685   
105686 Setting the option: 
105687
105688    boost::asio::ip::tcp::socket socket(my_context);
105689    ...
105690    boost::asio::socket_base::send_buffer_size option(8192);
105691    socket.set_option(option);
105692
105693
105694
105695
105696
105697 Getting the current option value: 
105698
105699    boost::asio::ip::tcp::socket socket(my_context);
105700    ...
105701    boost::asio::socket_base::send_buffer_size option;
105702    socket.get_option(option);
105703    int size = option.value();
105704
105705
105706
105707
105708
105709
105710
105711 [heading Requirements]
105712
105713 ['Header: ][^boost/asio/socket_base.hpp]
105714
105715 ['Convenience header: ][^boost/asio.hpp]
105716
105717
105718 [endsect]
105719
105720
105721
105722 [section:send_low_watermark socket_base::send_low_watermark]
105723
105724 [indexterm2 boost_asio.indexterm.socket_base.send_low_watermark..send_low_watermark..socket_base] 
105725 Socket option for the send low watermark. 
105726
105727
105728   typedef implementation_defined send_low_watermark;
105729
105730
105731
105732 Implements the SOL\_SOCKET/SO\_SNDLOWAT socket option.
105733
105734
105735 [heading Examples]
105736   
105737 Setting the option: 
105738
105739    boost::asio::ip::tcp::socket socket(my_context);
105740    ...
105741    boost::asio::socket_base::send_low_watermark option(1024);
105742    socket.set_option(option);
105743
105744
105745
105746
105747
105748 Getting the current option value: 
105749
105750    boost::asio::ip::tcp::socket socket(my_context);
105751    ...
105752    boost::asio::socket_base::send_low_watermark option;
105753    socket.get_option(option);
105754    int size = option.value();
105755
105756
105757
105758
105759
105760
105761
105762 [heading Requirements]
105763
105764 ['Header: ][^boost/asio/socket_base.hpp]
105765
105766 ['Convenience header: ][^boost/asio.hpp]
105767
105768
105769 [endsect]
105770
105771
105772
105773 [section:shutdown_type socket_base::shutdown_type]
105774
105775 [indexterm2 boost_asio.indexterm.socket_base.shutdown_type..shutdown_type..socket_base] 
105776 Different ways a socket may be shutdown. 
105777
105778
105779   enum shutdown_type
105780
105781 [indexterm2 boost_asio.indexterm.socket_base.shutdown_type.shutdown_receive..shutdown_receive..socket_base]
105782 [indexterm2 boost_asio.indexterm.socket_base.shutdown_type.shutdown_send..shutdown_send..socket_base]
105783 [indexterm2 boost_asio.indexterm.socket_base.shutdown_type.shutdown_both..shutdown_both..socket_base]
105784
105785 [heading Values]
105786 [variablelist
105787
105788   [
105789     [shutdown_receive]
105790     [Shutdown the receive side of the socket. ]
105791   ]
105792
105793   [
105794     [shutdown_send]
105795     [Shutdown the send side of the socket. ]
105796   ]
105797
105798   [
105799     [shutdown_both]
105800     [Shutdown both send and receive on the socket. ]
105801   ]
105802
105803 ]
105804
105805
105806
105807 [endsect]
105808
105809
105810
105811 [section:wait_type socket_base::wait_type]
105812
105813 [indexterm2 boost_asio.indexterm.socket_base.wait_type..wait_type..socket_base] 
105814 Wait types. 
105815
105816
105817   enum wait_type
105818
105819 [indexterm2 boost_asio.indexterm.socket_base.wait_type.wait_read..wait_read..socket_base]
105820 [indexterm2 boost_asio.indexterm.socket_base.wait_type.wait_write..wait_write..socket_base]
105821 [indexterm2 boost_asio.indexterm.socket_base.wait_type.wait_error..wait_error..socket_base]
105822
105823 [heading Values]
105824 [variablelist
105825
105826   [
105827     [wait_read]
105828     [Wait for a socket to become ready to read. ]
105829   ]
105830
105831   [
105832     [wait_write]
105833     [Wait for a socket to become ready to write. ]
105834   ]
105835
105836   [
105837     [wait_error]
105838     [Wait for a socket to have error conditions pending. ]
105839   ]
105840
105841 ]
105842
105843
105844 For use with `basic_socket::wait()` and `basic_socket::async_wait()`. 
105845
105846
105847 [endsect]
105848
105849
105850
105851 [section:_socket_base socket_base::~socket_base]
105852
105853 [indexterm2 boost_asio.indexterm.socket_base._socket_base..~socket_base..socket_base] 
105854 Protected destructor to prevent deletion through this type. 
105855
105856
105857   ~socket_base();
105858
105859
105860
105861 [endsect]
105862
105863
105864
105865 [endsect]
105866
105867 [section:spawn spawn]
105868
105869 [indexterm1 boost_asio.indexterm.spawn..spawn] 
105870 Start a new stackful coroutine. 
105871
105872
105873 Start a new stackful coroutine, calling the specified handler when it completes. 
105874
105875   template<
105876       typename Function>
105877   void ``[link boost_asio.reference.spawn.overload1 spawn]``(
105878       Function && function,
105879       const boost::coroutines::attributes & attributes = boost::coroutines::attributes());
105880   ``  [''''&raquo;''' [link boost_asio.reference.spawn.overload1 more...]]``
105881
105882   template<
105883       typename ``[link boost_asio.reference.Handler Handler]``,
105884       typename Function>
105885   void ``[link boost_asio.reference.spawn.overload2 spawn]``(
105886       Handler && handler,
105887       Function && function,
105888       const boost::coroutines::attributes & attributes = boost::coroutines::attributes(),
105889       typename enable_if<!is_executor< typename decay< Handler >::type >::value &&!is_convertible< Handler &, execution_context & >::value >::type *  = 0);
105890   ``  [''''&raquo;''' [link boost_asio.reference.spawn.overload2 more...]]``
105891
105892 Start a new stackful coroutine, inheriting the execution context of another. 
105893
105894   template<
105895       typename ``[link boost_asio.reference.Handler Handler]``,
105896       typename Function>
105897   void ``[link boost_asio.reference.spawn.overload3 spawn]``(
105898       basic_yield_context< Handler > ctx,
105899       Function && function,
105900       const boost::coroutines::attributes & attributes = boost::coroutines::attributes());
105901   ``  [''''&raquo;''' [link boost_asio.reference.spawn.overload3 more...]]``
105902
105903 Start a new stackful coroutine that executes on a given executor. 
105904
105905   template<
105906       typename Function,
105907       typename ``[link boost_asio.reference.Executor1 Executor]``>
105908   void ``[link boost_asio.reference.spawn.overload4 spawn]``(
105909       const Executor & ex,
105910       Function && function,
105911       const boost::coroutines::attributes & attributes = boost::coroutines::attributes(),
105912       typename enable_if< is_executor< Executor >::value >::type *  = 0);
105913   ``  [''''&raquo;''' [link boost_asio.reference.spawn.overload4 more...]]``
105914
105915 Start a new stackful coroutine that executes on a given strand. 
105916
105917   template<
105918       typename Function,
105919       typename ``[link boost_asio.reference.Executor1 Executor]``>
105920   void ``[link boost_asio.reference.spawn.overload5 spawn]``(
105921       const strand< Executor > & ex,
105922       Function && function,
105923       const boost::coroutines::attributes & attributes = boost::coroutines::attributes());
105924   ``  [''''&raquo;''' [link boost_asio.reference.spawn.overload5 more...]]``
105925
105926 Start a new stackful coroutine that executes in the context of a strand. 
105927
105928   template<
105929       typename Function>
105930   void ``[link boost_asio.reference.spawn.overload6 spawn]``(
105931       const boost::asio::io_context::strand & s,
105932       Function && function,
105933       const boost::coroutines::attributes & attributes = boost::coroutines::attributes());
105934   ``  [''''&raquo;''' [link boost_asio.reference.spawn.overload6 more...]]``
105935
105936 Start a new stackful coroutine that executes on a given execution context. 
105937
105938   template<
105939       typename Function,
105940       typename ExecutionContext>
105941   void ``[link boost_asio.reference.spawn.overload7 spawn]``(
105942       ExecutionContext & ctx,
105943       Function && function,
105944       const boost::coroutines::attributes & attributes = boost::coroutines::attributes(),
105945       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
105946   ``  [''''&raquo;''' [link boost_asio.reference.spawn.overload7 more...]]``
105947
105948 The `spawn()` function is a high-level wrapper over the Boost.Coroutine library. This function enables programs to implement asynchronous logic in a synchronous manner, as illustrated by the following example:
105949
105950
105951
105952    boost::asio::spawn(my_strand, do_echo);
105953
105954    // ...
105955
105956    void do_echo(boost::asio::yield_context yield)
105957    {
105958      try
105959      {
105960        char data[128];
105961        for (;;)
105962        {
105963          std::size_t length =
105964            my_socket.async_read_some(
105965              boost::asio::buffer(data), yield);
105966
105967          boost::asio::async_write(my_socket,
105968              boost::asio::buffer(data, length), yield);
105969        }
105970      }
105971      catch (std::exception& e)
105972      {
105973        // ...
105974      }
105975    } 
105976
105977
105978
105979
105980 [heading Requirements]
105981
105982 ['Header: ][^boost/asio/spawn.hpp]
105983
105984 ['Convenience header: ]None
105985
105986
105987 [section:overload1 spawn (1 of 7 overloads)]
105988
105989
105990 Start a new stackful coroutine, calling the specified handler when it completes. 
105991
105992
105993   template<
105994       typename Function>
105995   void spawn(
105996       Function && function,
105997       const boost::coroutines::attributes & attributes = boost::coroutines::attributes());
105998
105999
106000 This function is used to launch a new coroutine.
106001
106002
106003 [heading Parameters]
106004     
106005
106006 [variablelist
106007   
106008 [[function][The coroutine function. The function must have the signature: 
106009 ``
106010    void function(basic_yield_context<Handler> yield); 
106011 ``
106012 ]]
106013
106014 [[attributes][Boost.Coroutine attributes used to customise the coroutine. ]]
106015
106016 ]
106017
106018
106019
106020
106021 [endsect]
106022
106023
106024
106025 [section:overload2 spawn (2 of 7 overloads)]
106026
106027
106028 Start a new stackful coroutine, calling the specified handler when it completes. 
106029
106030
106031   template<
106032       typename ``[link boost_asio.reference.Handler Handler]``,
106033       typename Function>
106034   void spawn(
106035       Handler && handler,
106036       Function && function,
106037       const boost::coroutines::attributes & attributes = boost::coroutines::attributes(),
106038       typename enable_if<!is_executor< typename decay< Handler >::type >::value &&!is_convertible< Handler &, execution_context & >::value >::type *  = 0);
106039
106040
106041 This function is used to launch a new coroutine.
106042
106043
106044 [heading Parameters]
106045     
106046
106047 [variablelist
106048   
106049 [[handler][A handler to be called when the coroutine exits. More importantly, the handler provides an execution context (via the the handler invocation hook) for the coroutine. The handler must have the signature: 
106050 ``
106051    void handler(); 
106052 ``
106053 ]]
106054
106055 [[function][The coroutine function. The function must have the signature: 
106056 ``
106057    void function(basic_yield_context<Handler> yield); 
106058 ``
106059 ]]
106060
106061 [[attributes][Boost.Coroutine attributes used to customise the coroutine. ]]
106062
106063 ]
106064
106065
106066
106067
106068 [endsect]
106069
106070
106071
106072 [section:overload3 spawn (3 of 7 overloads)]
106073
106074
106075 Start a new stackful coroutine, inheriting the execution context of another. 
106076
106077
106078   template<
106079       typename ``[link boost_asio.reference.Handler Handler]``,
106080       typename Function>
106081   void spawn(
106082       basic_yield_context< Handler > ctx,
106083       Function && function,
106084       const boost::coroutines::attributes & attributes = boost::coroutines::attributes());
106085
106086
106087 This function is used to launch a new coroutine.
106088
106089
106090 [heading Parameters]
106091     
106092
106093 [variablelist
106094   
106095 [[ctx][Identifies the current coroutine as a parent of the new coroutine. This specifies that the new coroutine should inherit the execution context of the parent. For example, if the parent coroutine is executing in a particular strand, then the new coroutine will execute in the same strand.]]
106096
106097 [[function][The coroutine function. The function must have the signature: 
106098 ``
106099    void function(basic_yield_context<Handler> yield); 
106100 ``
106101 ]]
106102
106103 [[attributes][Boost.Coroutine attributes used to customise the coroutine. ]]
106104
106105 ]
106106
106107
106108
106109
106110 [endsect]
106111
106112
106113
106114 [section:overload4 spawn (4 of 7 overloads)]
106115
106116
106117 Start a new stackful coroutine that executes on a given executor. 
106118
106119
106120   template<
106121       typename Function,
106122       typename ``[link boost_asio.reference.Executor1 Executor]``>
106123   void spawn(
106124       const Executor & ex,
106125       Function && function,
106126       const boost::coroutines::attributes & attributes = boost::coroutines::attributes(),
106127       typename enable_if< is_executor< Executor >::value >::type *  = 0);
106128
106129
106130 This function is used to launch a new coroutine.
106131
106132
106133 [heading Parameters]
106134     
106135
106136 [variablelist
106137   
106138 [[ex][Identifies the executor that will run the coroutine. The new coroutine is implicitly given its own strand within this executor.]]
106139
106140 [[function][The coroutine function. The function must have the signature: 
106141 ``
106142    void function(yield_context yield); 
106143 ``
106144 ]]
106145
106146 [[attributes][Boost.Coroutine attributes used to customise the coroutine. ]]
106147
106148 ]
106149
106150
106151
106152
106153 [endsect]
106154
106155
106156
106157 [section:overload5 spawn (5 of 7 overloads)]
106158
106159
106160 Start a new stackful coroutine that executes on a given strand. 
106161
106162
106163   template<
106164       typename Function,
106165       typename ``[link boost_asio.reference.Executor1 Executor]``>
106166   void spawn(
106167       const strand< Executor > & ex,
106168       Function && function,
106169       const boost::coroutines::attributes & attributes = boost::coroutines::attributes());
106170
106171
106172 This function is used to launch a new coroutine.
106173
106174
106175 [heading Parameters]
106176     
106177
106178 [variablelist
106179   
106180 [[ex][Identifies the strand that will run the coroutine.]]
106181
106182 [[function][The coroutine function. The function must have the signature: 
106183 ``
106184    void function(yield_context yield); 
106185 ``
106186 ]]
106187
106188 [[attributes][Boost.Coroutine attributes used to customise the coroutine. ]]
106189
106190 ]
106191
106192
106193
106194
106195 [endsect]
106196
106197
106198
106199 [section:overload6 spawn (6 of 7 overloads)]
106200
106201
106202 Start a new stackful coroutine that executes in the context of a strand. 
106203
106204
106205   template<
106206       typename Function>
106207   void spawn(
106208       const boost::asio::io_context::strand & s,
106209       Function && function,
106210       const boost::coroutines::attributes & attributes = boost::coroutines::attributes());
106211
106212
106213 This function is used to launch a new coroutine.
106214
106215
106216 [heading Parameters]
106217     
106218
106219 [variablelist
106220   
106221 [[s][Identifies a strand. By starting multiple coroutines on the same strand, the implementation ensures that none of those coroutines can execute simultaneously.]]
106222
106223 [[function][The coroutine function. The function must have the signature: 
106224 ``
106225    void function(yield_context yield); 
106226 ``
106227 ]]
106228
106229 [[attributes][Boost.Coroutine attributes used to customise the coroutine. ]]
106230
106231 ]
106232
106233
106234
106235
106236 [endsect]
106237
106238
106239
106240 [section:overload7 spawn (7 of 7 overloads)]
106241
106242
106243 Start a new stackful coroutine that executes on a given execution context. 
106244
106245
106246   template<
106247       typename Function,
106248       typename ExecutionContext>
106249   void spawn(
106250       ExecutionContext & ctx,
106251       Function && function,
106252       const boost::coroutines::attributes & attributes = boost::coroutines::attributes(),
106253       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
106254
106255
106256 This function is used to launch a new coroutine.
106257
106258
106259 [heading Parameters]
106260     
106261
106262 [variablelist
106263   
106264 [[ctx][Identifies the execution context that will run the coroutine. The new coroutine is implicitly given its own strand within this execution context.]]
106265
106266 [[function][The coroutine function. The function must have the signature: 
106267 ``
106268    void function(yield_context yield); 
106269 ``
106270 ]]
106271
106272 [[attributes][Boost.Coroutine attributes used to customise the coroutine. ]]
106273
106274 ]
106275
106276
106277
106278
106279 [endsect]
106280
106281
106282 [endsect]
106283
106284 [section:ssl__context ssl::context]
106285
106286
106287
106288   class context :
106289     public ssl::context_base,
106290     noncopyable
106291
106292
106293 [heading Types]
106294 [table
106295   [[Name][Description]]
106296
106297   [
106298
106299     [[link boost_asio.reference.ssl__context.file_format [*file_format]]]
106300     [File format types. ]
106301   
106302   ]
106303
106304   [
106305
106306     [[link boost_asio.reference.ssl__context.method [*method]]]
106307     [Different methods supported by a context. ]
106308   
106309   ]
106310
106311   [
106312
106313     [[link boost_asio.reference.ssl__context.native_handle_type [*native_handle_type]]]
106314     [The native handle type of the SSL context. ]
106315   
106316   ]
106317
106318   [
106319
106320     [[link boost_asio.reference.ssl__context.options [*options]]]
106321     [Bitmask type for SSL options. ]
106322   
106323   ]
106324
106325   [
106326
106327     [[link boost_asio.reference.ssl__context.password_purpose [*password_purpose]]]
106328     [Purpose of PEM password. ]
106329   
106330   ]
106331
106332 ]
106333
106334 [heading Member Functions]
106335 [table
106336   [[Name][Description]]
106337
106338   [
106339     [[link boost_asio.reference.ssl__context.add_certificate_authority [*add_certificate_authority]]]
106340     [Add certification authority for performing verification. ]
106341   ]
106342   
106343   [
106344     [[link boost_asio.reference.ssl__context.add_verify_path [*add_verify_path]]]
106345     [Add a directory containing certificate authority files to be used for performing verification. ]
106346   ]
106347   
106348   [
106349     [[link boost_asio.reference.ssl__context.clear_options [*clear_options]]]
106350     [Clear options on the context. ]
106351   ]
106352   
106353   [
106354     [[link boost_asio.reference.ssl__context.context [*context]]]
106355     [Constructor. 
106356      [hr]
106357      Move-construct a context from another. ]
106358   ]
106359   
106360   [
106361     [[link boost_asio.reference.ssl__context.load_verify_file [*load_verify_file]]]
106362     [Load a certification authority file for performing verification. ]
106363   ]
106364   
106365   [
106366     [[link boost_asio.reference.ssl__context.native_handle [*native_handle]]]
106367     [Get the underlying implementation in the native type. ]
106368   ]
106369   
106370   [
106371     [[link boost_asio.reference.ssl__context.operator_eq_ [*operator=]]]
106372     [Move-assign a context from another. ]
106373   ]
106374   
106375   [
106376     [[link boost_asio.reference.ssl__context.set_default_verify_paths [*set_default_verify_paths]]]
106377     [Configures the context to use the default directories for finding certification authority certificates. ]
106378   ]
106379   
106380   [
106381     [[link boost_asio.reference.ssl__context.set_options [*set_options]]]
106382     [Set options on the context. ]
106383   ]
106384   
106385   [
106386     [[link boost_asio.reference.ssl__context.set_password_callback [*set_password_callback]]]
106387     [Set the password callback. ]
106388   ]
106389   
106390   [
106391     [[link boost_asio.reference.ssl__context.set_verify_callback [*set_verify_callback]]]
106392     [Set the callback used to verify peer certificates. ]
106393   ]
106394   
106395   [
106396     [[link boost_asio.reference.ssl__context.set_verify_depth [*set_verify_depth]]]
106397     [Set the peer verification depth. ]
106398   ]
106399   
106400   [
106401     [[link boost_asio.reference.ssl__context.set_verify_mode [*set_verify_mode]]]
106402     [Set the peer verification mode. ]
106403   ]
106404   
106405   [
106406     [[link boost_asio.reference.ssl__context.use_certificate [*use_certificate]]]
106407     [Use a certificate from a memory buffer. ]
106408   ]
106409   
106410   [
106411     [[link boost_asio.reference.ssl__context.use_certificate_chain [*use_certificate_chain]]]
106412     [Use a certificate chain from a memory buffer. ]
106413   ]
106414   
106415   [
106416     [[link boost_asio.reference.ssl__context.use_certificate_chain_file [*use_certificate_chain_file]]]
106417     [Use a certificate chain from a file. ]
106418   ]
106419   
106420   [
106421     [[link boost_asio.reference.ssl__context.use_certificate_file [*use_certificate_file]]]
106422     [Use a certificate from a file. ]
106423   ]
106424   
106425   [
106426     [[link boost_asio.reference.ssl__context.use_private_key [*use_private_key]]]
106427     [Use a private key from a memory buffer. ]
106428   ]
106429   
106430   [
106431     [[link boost_asio.reference.ssl__context.use_private_key_file [*use_private_key_file]]]
106432     [Use a private key from a file. ]
106433   ]
106434   
106435   [
106436     [[link boost_asio.reference.ssl__context.use_rsa_private_key [*use_rsa_private_key]]]
106437     [Use an RSA private key from a memory buffer. ]
106438   ]
106439   
106440   [
106441     [[link boost_asio.reference.ssl__context.use_rsa_private_key_file [*use_rsa_private_key_file]]]
106442     [Use an RSA private key from a file. ]
106443   ]
106444   
106445   [
106446     [[link boost_asio.reference.ssl__context.use_tmp_dh [*use_tmp_dh]]]
106447     [Use the specified memory buffer to obtain the temporary Diffie-Hellman parameters. ]
106448   ]
106449   
106450   [
106451     [[link boost_asio.reference.ssl__context.use_tmp_dh_file [*use_tmp_dh_file]]]
106452     [Use the specified file to obtain the temporary Diffie-Hellman parameters. ]
106453   ]
106454   
106455   [
106456     [[link boost_asio.reference.ssl__context._context [*~context]]]
106457     [Destructor. ]
106458   ]
106459   
106460 ]
106461
106462 [heading Data Members]
106463 [table
106464   [[Name][Description]]
106465
106466   [
106467     [[link boost_asio.reference.ssl__context.default_workarounds [*default_workarounds]]]
106468     [Implement various bug workarounds. ]
106469   ]
106470
106471   [
106472     [[link boost_asio.reference.ssl__context.no_compression [*no_compression]]]
106473     [Disable compression. Compression is disabled by default. ]
106474   ]
106475
106476   [
106477     [[link boost_asio.reference.ssl__context.no_sslv2 [*no_sslv2]]]
106478     [Disable SSL v2. ]
106479   ]
106480
106481   [
106482     [[link boost_asio.reference.ssl__context.no_sslv3 [*no_sslv3]]]
106483     [Disable SSL v3. ]
106484   ]
106485
106486   [
106487     [[link boost_asio.reference.ssl__context.no_tlsv1 [*no_tlsv1]]]
106488     [Disable TLS v1. ]
106489   ]
106490
106491   [
106492     [[link boost_asio.reference.ssl__context.no_tlsv1_1 [*no_tlsv1_1]]]
106493     [Disable TLS v1.1. ]
106494   ]
106495
106496   [
106497     [[link boost_asio.reference.ssl__context.no_tlsv1_2 [*no_tlsv1_2]]]
106498     [Disable TLS v1.2. ]
106499   ]
106500
106501   [
106502     [[link boost_asio.reference.ssl__context.no_tlsv1_3 [*no_tlsv1_3]]]
106503     [Disable TLS v1.3. ]
106504   ]
106505
106506   [
106507     [[link boost_asio.reference.ssl__context.single_dh_use [*single_dh_use]]]
106508     [Always create a new key when using tmp_dh parameters. ]
106509   ]
106510
106511 ]
106512
106513 [heading Requirements]
106514
106515 ['Header: ][^boost/asio/ssl/context.hpp]
106516
106517 ['Convenience header: ][^boost/asio/ssl.hpp]
106518
106519 [section:add_certificate_authority ssl::context::add_certificate_authority]
106520
106521 [indexterm2 boost_asio.indexterm.ssl__context.add_certificate_authority..add_certificate_authority..ssl::context] 
106522 Add certification authority for performing verification. 
106523
106524
106525   void ``[link boost_asio.reference.ssl__context.add_certificate_authority.overload1 add_certificate_authority]``(
106526       const const_buffer & ca);
106527   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.add_certificate_authority.overload1 more...]]``
106528
106529   void ``[link boost_asio.reference.ssl__context.add_certificate_authority.overload2 add_certificate_authority]``(
106530       const const_buffer & ca,
106531       boost::system::error_code & ec);
106532   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.add_certificate_authority.overload2 more...]]``
106533
106534
106535 [section:overload1 ssl::context::add_certificate_authority (1 of 2 overloads)]
106536
106537
106538 Add certification authority for performing verification. 
106539
106540
106541   void add_certificate_authority(
106542       const const_buffer & ca);
106543
106544
106545 This function is used to add one trusted certification authority from a memory buffer.
106546
106547
106548 [heading Parameters]
106549     
106550
106551 [variablelist
106552   
106553 [[ca][The buffer containing the certification authority certificate. The certificate must use the PEM format.]]
106554
106555 ]
106556
106557
106558 [heading Exceptions]
106559     
106560
106561 [variablelist
106562   
106563 [[boost::system::system_error][Thrown on failure.]]
106564
106565 ]
106566
106567
106568 [heading Remarks]
106569       
106570 Calls `SSL_CTX_get_cert_store` and `X509_STORE_add_cert`. 
106571
106572
106573
106574
106575 [endsect]
106576
106577
106578
106579 [section:overload2 ssl::context::add_certificate_authority (2 of 2 overloads)]
106580
106581
106582 Add certification authority for performing verification. 
106583
106584
106585   void add_certificate_authority(
106586       const const_buffer & ca,
106587       boost::system::error_code & ec);
106588
106589
106590 This function is used to add one trusted certification authority from a memory buffer.
106591
106592
106593 [heading Parameters]
106594     
106595
106596 [variablelist
106597   
106598 [[ca][The buffer containing the certification authority certificate. The certificate must use the PEM format.]]
106599
106600 [[ec][Set to indicate what error occurred, if any.]]
106601
106602 ]
106603
106604
106605 [heading Remarks]
106606       
106607 Calls `SSL_CTX_get_cert_store` and `X509_STORE_add_cert`. 
106608
106609
106610
106611
106612 [endsect]
106613
106614
106615 [endsect]
106616
106617 [section:add_verify_path ssl::context::add_verify_path]
106618
106619 [indexterm2 boost_asio.indexterm.ssl__context.add_verify_path..add_verify_path..ssl::context] 
106620 Add a directory containing certificate authority files to be used for performing verification. 
106621
106622
106623   void ``[link boost_asio.reference.ssl__context.add_verify_path.overload1 add_verify_path]``(
106624       const std::string & path);
106625   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.add_verify_path.overload1 more...]]``
106626
106627   void ``[link boost_asio.reference.ssl__context.add_verify_path.overload2 add_verify_path]``(
106628       const std::string & path,
106629       boost::system::error_code & ec);
106630   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.add_verify_path.overload2 more...]]``
106631
106632
106633 [section:overload1 ssl::context::add_verify_path (1 of 2 overloads)]
106634
106635
106636 Add a directory containing certificate authority files to be used for performing verification. 
106637
106638
106639   void add_verify_path(
106640       const std::string & path);
106641
106642
106643 This function is used to specify the name of a directory containing certification authority certificates. Each file in the directory must contain a single certificate. The files must be named using the subject name's hash and an extension of ".0".
106644
106645
106646 [heading Parameters]
106647     
106648
106649 [variablelist
106650   
106651 [[path][The name of a directory containing the certificates.]]
106652
106653 ]
106654
106655
106656 [heading Exceptions]
106657     
106658
106659 [variablelist
106660   
106661 [[boost::system::system_error][Thrown on failure.]]
106662
106663 ]
106664
106665
106666 [heading Remarks]
106667       
106668 Calls `SSL_CTX_load_verify_locations`. 
106669
106670
106671
106672
106673 [endsect]
106674
106675
106676
106677 [section:overload2 ssl::context::add_verify_path (2 of 2 overloads)]
106678
106679
106680 Add a directory containing certificate authority files to be used for performing verification. 
106681
106682
106683   void add_verify_path(
106684       const std::string & path,
106685       boost::system::error_code & ec);
106686
106687
106688 This function is used to specify the name of a directory containing certification authority certificates. Each file in the directory must contain a single certificate. The files must be named using the subject name's hash and an extension of ".0".
106689
106690
106691 [heading Parameters]
106692     
106693
106694 [variablelist
106695   
106696 [[path][The name of a directory containing the certificates.]]
106697
106698 [[ec][Set to indicate what error occurred, if any.]]
106699
106700 ]
106701
106702
106703 [heading Remarks]
106704       
106705 Calls `SSL_CTX_load_verify_locations`. 
106706
106707
106708
106709
106710 [endsect]
106711
106712
106713 [endsect]
106714
106715 [section:clear_options ssl::context::clear_options]
106716
106717 [indexterm2 boost_asio.indexterm.ssl__context.clear_options..clear_options..ssl::context] 
106718 Clear options on the context. 
106719
106720
106721   void ``[link boost_asio.reference.ssl__context.clear_options.overload1 clear_options]``(
106722       options o);
106723   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.clear_options.overload1 more...]]``
106724
106725   void ``[link boost_asio.reference.ssl__context.clear_options.overload2 clear_options]``(
106726       options o,
106727       boost::system::error_code & ec);
106728   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.clear_options.overload2 more...]]``
106729
106730
106731 [section:overload1 ssl::context::clear_options (1 of 2 overloads)]
106732
106733
106734 Clear options on the context. 
106735
106736
106737   void clear_options(
106738       options o);
106739
106740
106741 This function may be used to configure the SSL options used by the context.
106742
106743
106744 [heading Parameters]
106745     
106746
106747 [variablelist
106748   
106749 [[o][A bitmask of options. The available option values are defined in the [link boost_asio.reference.ssl__context_base `ssl::context_base`] class. The specified options, if currently enabled on the context, are cleared.]]
106750
106751 ]
106752
106753
106754 [heading Exceptions]
106755     
106756
106757 [variablelist
106758   
106759 [[boost::system::system_error][Thrown on failure.]]
106760
106761 ]
106762
106763
106764 [heading Remarks]
106765       
106766 Calls `SSL_CTX_clear_options`. 
106767
106768
106769
106770
106771 [endsect]
106772
106773
106774
106775 [section:overload2 ssl::context::clear_options (2 of 2 overloads)]
106776
106777
106778 Clear options on the context. 
106779
106780
106781   void clear_options(
106782       options o,
106783       boost::system::error_code & ec);
106784
106785
106786 This function may be used to configure the SSL options used by the context.
106787
106788
106789 [heading Parameters]
106790     
106791
106792 [variablelist
106793   
106794 [[o][A bitmask of options. The available option values are defined in the [link boost_asio.reference.ssl__context_base `ssl::context_base`] class. The specified options, if currently enabled on the context, are cleared.]]
106795
106796 [[ec][Set to indicate what error occurred, if any.]]
106797
106798 ]
106799
106800
106801 [heading Remarks]
106802       
106803 Calls `SSL_CTX_clear_options`. 
106804
106805
106806
106807
106808 [endsect]
106809
106810
106811 [endsect]
106812
106813 [section:context ssl::context::context]
106814
106815 [indexterm2 boost_asio.indexterm.ssl__context.context..context..ssl::context] 
106816 Constructor. 
106817
106818
106819   explicit ``[link boost_asio.reference.ssl__context.context.overload1 context]``(
106820       method m);
106821   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.context.overload1 more...]]``
106822
106823
106824 Move-construct a context from another. 
106825
106826
106827   ``[link boost_asio.reference.ssl__context.context.overload2 context]``(
106828       context && other);
106829   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.context.overload2 more...]]``
106830
106831
106832 [section:overload1 ssl::context::context (1 of 2 overloads)]
106833
106834
106835 Constructor. 
106836
106837
106838   context(
106839       method m);
106840
106841
106842
106843 [endsect]
106844
106845
106846
106847 [section:overload2 ssl::context::context (2 of 2 overloads)]
106848
106849
106850 Move-construct a context from another. 
106851
106852
106853   context(
106854       context && other);
106855
106856
106857 This constructor moves an SSL context from one object to another.
106858
106859
106860 [heading Parameters]
106861     
106862
106863 [variablelist
106864   
106865 [[other][The other context object from which the move will occur.]]
106866
106867 ]
106868
106869
106870 [heading Remarks]
106871       
106872 Following the move, the following operations only are valid for the moved-from object: 
106873 * Destruction. 
106874
106875 * As a target for move-assignment. 
106876
106877
106878
106879
106880
106881
106882 [endsect]
106883
106884
106885 [endsect]
106886
106887
106888 [section:default_workarounds ssl::context::default_workarounds]
106889
106890 [indexterm2 boost_asio.indexterm.ssl__context.default_workarounds..default_workarounds..ssl::context] 
106891 Implement various bug workarounds. 
106892
106893
106894   static const long default_workarounds = implementation_defined;
106895
106896
106897
106898 [endsect]
106899
106900
106901
106902 [section:file_format ssl::context::file_format]
106903
106904 [indexterm2 boost_asio.indexterm.ssl__context.file_format..file_format..ssl::context] 
106905 File format types. 
106906
106907
106908   enum file_format
106909
106910 [indexterm2 boost_asio.indexterm.ssl__context.file_format.asn1..asn1..ssl::context]
106911 [indexterm2 boost_asio.indexterm.ssl__context.file_format.pem..pem..ssl::context]
106912
106913 [heading Values]
106914 [variablelist
106915
106916   [
106917     [asn1]
106918     [ASN.1 file. ]
106919   ]
106920
106921   [
106922     [pem]
106923     [PEM file. ]
106924   ]
106925
106926 ]
106927
106928
106929
106930 [endsect]
106931
106932
106933 [section:load_verify_file ssl::context::load_verify_file]
106934
106935 [indexterm2 boost_asio.indexterm.ssl__context.load_verify_file..load_verify_file..ssl::context] 
106936 Load a certification authority file for performing verification. 
106937
106938
106939   void ``[link boost_asio.reference.ssl__context.load_verify_file.overload1 load_verify_file]``(
106940       const std::string & filename);
106941   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.load_verify_file.overload1 more...]]``
106942
106943   void ``[link boost_asio.reference.ssl__context.load_verify_file.overload2 load_verify_file]``(
106944       const std::string & filename,
106945       boost::system::error_code & ec);
106946   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.load_verify_file.overload2 more...]]``
106947
106948
106949 [section:overload1 ssl::context::load_verify_file (1 of 2 overloads)]
106950
106951
106952 Load a certification authority file for performing verification. 
106953
106954
106955   void load_verify_file(
106956       const std::string & filename);
106957
106958
106959 This function is used to load one or more trusted certification authorities from a file.
106960
106961
106962 [heading Parameters]
106963     
106964
106965 [variablelist
106966   
106967 [[filename][The name of a file containing certification authority certificates in PEM format.]]
106968
106969 ]
106970
106971
106972 [heading Exceptions]
106973     
106974
106975 [variablelist
106976   
106977 [[boost::system::system_error][Thrown on failure.]]
106978
106979 ]
106980
106981
106982 [heading Remarks]
106983       
106984 Calls `SSL_CTX_load_verify_locations`. 
106985
106986
106987
106988
106989 [endsect]
106990
106991
106992
106993 [section:overload2 ssl::context::load_verify_file (2 of 2 overloads)]
106994
106995
106996 Load a certification authority file for performing verification. 
106997
106998
106999   void load_verify_file(
107000       const std::string & filename,
107001       boost::system::error_code & ec);
107002
107003
107004 This function is used to load the certificates for one or more trusted certification authorities from a file.
107005
107006
107007 [heading Parameters]
107008     
107009
107010 [variablelist
107011   
107012 [[filename][The name of a file containing certification authority certificates in PEM format.]]
107013
107014 [[ec][Set to indicate what error occurred, if any.]]
107015
107016 ]
107017
107018
107019 [heading Remarks]
107020       
107021 Calls `SSL_CTX_load_verify_locations`. 
107022
107023
107024
107025
107026 [endsect]
107027
107028
107029 [endsect]
107030
107031
107032 [section:method ssl::context::method]
107033
107034 [indexterm2 boost_asio.indexterm.ssl__context.method..method..ssl::context] 
107035 Different methods supported by a context. 
107036
107037
107038   enum method
107039
107040 [indexterm2 boost_asio.indexterm.ssl__context.method.sslv2..sslv2..ssl::context]
107041 [indexterm2 boost_asio.indexterm.ssl__context.method.sslv2_client..sslv2_client..ssl::context]
107042 [indexterm2 boost_asio.indexterm.ssl__context.method.sslv2_server..sslv2_server..ssl::context]
107043 [indexterm2 boost_asio.indexterm.ssl__context.method.sslv3..sslv3..ssl::context]
107044 [indexterm2 boost_asio.indexterm.ssl__context.method.sslv3_client..sslv3_client..ssl::context]
107045 [indexterm2 boost_asio.indexterm.ssl__context.method.sslv3_server..sslv3_server..ssl::context]
107046 [indexterm2 boost_asio.indexterm.ssl__context.method.tlsv1..tlsv1..ssl::context]
107047 [indexterm2 boost_asio.indexterm.ssl__context.method.tlsv1_client..tlsv1_client..ssl::context]
107048 [indexterm2 boost_asio.indexterm.ssl__context.method.tlsv1_server..tlsv1_server..ssl::context]
107049 [indexterm2 boost_asio.indexterm.ssl__context.method.sslv23..sslv23..ssl::context]
107050 [indexterm2 boost_asio.indexterm.ssl__context.method.sslv23_client..sslv23_client..ssl::context]
107051 [indexterm2 boost_asio.indexterm.ssl__context.method.sslv23_server..sslv23_server..ssl::context]
107052 [indexterm2 boost_asio.indexterm.ssl__context.method.tlsv11..tlsv11..ssl::context]
107053 [indexterm2 boost_asio.indexterm.ssl__context.method.tlsv11_client..tlsv11_client..ssl::context]
107054 [indexterm2 boost_asio.indexterm.ssl__context.method.tlsv11_server..tlsv11_server..ssl::context]
107055 [indexterm2 boost_asio.indexterm.ssl__context.method.tlsv12..tlsv12..ssl::context]
107056 [indexterm2 boost_asio.indexterm.ssl__context.method.tlsv12_client..tlsv12_client..ssl::context]
107057 [indexterm2 boost_asio.indexterm.ssl__context.method.tlsv12_server..tlsv12_server..ssl::context]
107058 [indexterm2 boost_asio.indexterm.ssl__context.method.tlsv13..tlsv13..ssl::context]
107059 [indexterm2 boost_asio.indexterm.ssl__context.method.tlsv13_client..tlsv13_client..ssl::context]
107060 [indexterm2 boost_asio.indexterm.ssl__context.method.tlsv13_server..tlsv13_server..ssl::context]
107061 [indexterm2 boost_asio.indexterm.ssl__context.method.tls..tls..ssl::context]
107062 [indexterm2 boost_asio.indexterm.ssl__context.method.tls_client..tls_client..ssl::context]
107063 [indexterm2 boost_asio.indexterm.ssl__context.method.tls_server..tls_server..ssl::context]
107064
107065 [heading Values]
107066 [variablelist
107067
107068   [
107069     [sslv2]
107070     [Generic SSL version 2. ]
107071   ]
107072
107073   [
107074     [sslv2_client]
107075     [SSL version 2 client. ]
107076   ]
107077
107078   [
107079     [sslv2_server]
107080     [SSL version 2 server. ]
107081   ]
107082
107083   [
107084     [sslv3]
107085     [Generic SSL version 3. ]
107086   ]
107087
107088   [
107089     [sslv3_client]
107090     [SSL version 3 client. ]
107091   ]
107092
107093   [
107094     [sslv3_server]
107095     [SSL version 3 server. ]
107096   ]
107097
107098   [
107099     [tlsv1]
107100     [Generic TLS version 1. ]
107101   ]
107102
107103   [
107104     [tlsv1_client]
107105     [TLS version 1 client. ]
107106   ]
107107
107108   [
107109     [tlsv1_server]
107110     [TLS version 1 server. ]
107111   ]
107112
107113   [
107114     [sslv23]
107115     [Generic SSL/TLS. ]
107116   ]
107117
107118   [
107119     [sslv23_client]
107120     [SSL/TLS client. ]
107121   ]
107122
107123   [
107124     [sslv23_server]
107125     [SSL/TLS server. ]
107126   ]
107127
107128   [
107129     [tlsv11]
107130     [Generic TLS version 1.1. ]
107131   ]
107132
107133   [
107134     [tlsv11_client]
107135     [TLS version 1.1 client. ]
107136   ]
107137
107138   [
107139     [tlsv11_server]
107140     [TLS version 1.1 server. ]
107141   ]
107142
107143   [
107144     [tlsv12]
107145     [Generic TLS version 1.2. ]
107146   ]
107147
107148   [
107149     [tlsv12_client]
107150     [TLS version 1.2 client. ]
107151   ]
107152
107153   [
107154     [tlsv12_server]
107155     [TLS version 1.2 server. ]
107156   ]
107157
107158   [
107159     [tlsv13]
107160     [Generic TLS version 1.3. ]
107161   ]
107162
107163   [
107164     [tlsv13_client]
107165     [TLS version 1.3 client. ]
107166   ]
107167
107168   [
107169     [tlsv13_server]
107170     [TLS version 1.3 server. ]
107171   ]
107172
107173   [
107174     [tls]
107175     [Generic TLS. ]
107176   ]
107177
107178   [
107179     [tls_client]
107180     [TLS client. ]
107181   ]
107182
107183   [
107184     [tls_server]
107185     [TLS server. ]
107186   ]
107187
107188 ]
107189
107190
107191
107192 [endsect]
107193
107194
107195
107196 [section:native_handle ssl::context::native_handle]
107197
107198 [indexterm2 boost_asio.indexterm.ssl__context.native_handle..native_handle..ssl::context] 
107199 Get the underlying implementation in the native type. 
107200
107201
107202   native_handle_type native_handle();
107203
107204
107205 This function may be used to obtain the underlying implementation of the context. This is intended to allow access to context functionality that is not otherwise provided. 
107206
107207
107208 [endsect]
107209
107210
107211
107212 [section:native_handle_type ssl::context::native_handle_type]
107213
107214 [indexterm2 boost_asio.indexterm.ssl__context.native_handle_type..native_handle_type..ssl::context] 
107215 The native handle type of the SSL context. 
107216
107217
107218   typedef SSL_CTX * native_handle_type;
107219
107220
107221
107222 [heading Requirements]
107223
107224 ['Header: ][^boost/asio/ssl/context.hpp]
107225
107226 ['Convenience header: ][^boost/asio/ssl.hpp]
107227
107228
107229 [endsect]
107230
107231
107232
107233 [section:no_compression ssl::context::no_compression]
107234
107235 [indexterm2 boost_asio.indexterm.ssl__context.no_compression..no_compression..ssl::context] 
107236 Disable compression. Compression is disabled by default. 
107237
107238
107239   static const long no_compression = implementation_defined;
107240
107241
107242
107243 [endsect]
107244
107245
107246
107247 [section:no_sslv2 ssl::context::no_sslv2]
107248
107249 [indexterm2 boost_asio.indexterm.ssl__context.no_sslv2..no_sslv2..ssl::context] 
107250 Disable SSL v2. 
107251
107252
107253   static const long no_sslv2 = implementation_defined;
107254
107255
107256
107257 [endsect]
107258
107259
107260
107261 [section:no_sslv3 ssl::context::no_sslv3]
107262
107263 [indexterm2 boost_asio.indexterm.ssl__context.no_sslv3..no_sslv3..ssl::context] 
107264 Disable SSL v3. 
107265
107266
107267   static const long no_sslv3 = implementation_defined;
107268
107269
107270
107271 [endsect]
107272
107273
107274
107275 [section:no_tlsv1 ssl::context::no_tlsv1]
107276
107277 [indexterm2 boost_asio.indexterm.ssl__context.no_tlsv1..no_tlsv1..ssl::context] 
107278 Disable TLS v1. 
107279
107280
107281   static const long no_tlsv1 = implementation_defined;
107282
107283
107284
107285 [endsect]
107286
107287
107288
107289 [section:no_tlsv1_1 ssl::context::no_tlsv1_1]
107290
107291 [indexterm2 boost_asio.indexterm.ssl__context.no_tlsv1_1..no_tlsv1_1..ssl::context] 
107292 Disable TLS v1.1. 
107293
107294
107295   static const long no_tlsv1_1 = implementation_defined;
107296
107297
107298
107299 [endsect]
107300
107301
107302
107303 [section:no_tlsv1_2 ssl::context::no_tlsv1_2]
107304
107305 [indexterm2 boost_asio.indexterm.ssl__context.no_tlsv1_2..no_tlsv1_2..ssl::context] 
107306 Disable TLS v1.2. 
107307
107308
107309   static const long no_tlsv1_2 = implementation_defined;
107310
107311
107312
107313 [endsect]
107314
107315
107316
107317 [section:no_tlsv1_3 ssl::context::no_tlsv1_3]
107318
107319 [indexterm2 boost_asio.indexterm.ssl__context.no_tlsv1_3..no_tlsv1_3..ssl::context] 
107320 Disable TLS v1.3. 
107321
107322
107323   static const long no_tlsv1_3 = implementation_defined;
107324
107325
107326
107327 [endsect]
107328
107329
107330
107331 [section:operator_eq_ ssl::context::operator=]
107332
107333 [indexterm2 boost_asio.indexterm.ssl__context.operator_eq_..operator=..ssl::context] 
107334 Move-assign a context from another. 
107335
107336
107337   context & operator=(
107338       context && other);
107339
107340
107341 This assignment operator moves an SSL context from one object to another.
107342
107343
107344 [heading Parameters]
107345     
107346
107347 [variablelist
107348   
107349 [[other][The other context object from which the move will occur.]]
107350
107351 ]
107352
107353
107354 [heading Remarks]
107355       
107356 Following the move, the following operations only are valid for the moved-from object: 
107357 * Destruction. 
107358
107359 * As a target for move-assignment. 
107360
107361
107362
107363
107364
107365
107366 [endsect]
107367
107368
107369
107370 [section:options ssl::context::options]
107371
107372 [indexterm2 boost_asio.indexterm.ssl__context.options..options..ssl::context] 
107373 Bitmask type for SSL options. 
107374
107375
107376   typedef long options;
107377
107378
107379
107380 [heading Requirements]
107381
107382 ['Header: ][^boost/asio/ssl/context.hpp]
107383
107384 ['Convenience header: ][^boost/asio/ssl.hpp]
107385
107386
107387 [endsect]
107388
107389
107390
107391 [section:password_purpose ssl::context::password_purpose]
107392
107393 [indexterm2 boost_asio.indexterm.ssl__context.password_purpose..password_purpose..ssl::context] 
107394 Purpose of PEM password. 
107395
107396
107397   enum password_purpose
107398
107399 [indexterm2 boost_asio.indexterm.ssl__context.password_purpose.for_reading..for_reading..ssl::context]
107400 [indexterm2 boost_asio.indexterm.ssl__context.password_purpose.for_writing..for_writing..ssl::context]
107401
107402 [heading Values]
107403 [variablelist
107404
107405   [
107406     [for_reading]
107407     [The password is needed for reading/decryption. ]
107408   ]
107409
107410   [
107411     [for_writing]
107412     [The password is needed for writing/encryption. ]
107413   ]
107414
107415 ]
107416
107417
107418
107419 [endsect]
107420
107421
107422 [section:set_default_verify_paths ssl::context::set_default_verify_paths]
107423
107424 [indexterm2 boost_asio.indexterm.ssl__context.set_default_verify_paths..set_default_verify_paths..ssl::context] 
107425 Configures the context to use the default directories for finding certification authority certificates. 
107426
107427
107428   void ``[link boost_asio.reference.ssl__context.set_default_verify_paths.overload1 set_default_verify_paths]``();
107429   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.set_default_verify_paths.overload1 more...]]``
107430
107431   void ``[link boost_asio.reference.ssl__context.set_default_verify_paths.overload2 set_default_verify_paths]``(
107432       boost::system::error_code & ec);
107433   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.set_default_verify_paths.overload2 more...]]``
107434
107435
107436 [section:overload1 ssl::context::set_default_verify_paths (1 of 2 overloads)]
107437
107438
107439 Configures the context to use the default directories for finding certification authority certificates. 
107440
107441
107442   void set_default_verify_paths();
107443
107444
107445 This function specifies that the context should use the default, system-dependent directories for locating certification authority certificates.
107446
107447
107448 [heading Exceptions]
107449     
107450
107451 [variablelist
107452   
107453 [[boost::system::system_error][Thrown on failure.]]
107454
107455 ]
107456
107457
107458 [heading Remarks]
107459       
107460 Calls `SSL_CTX_set_default_verify_paths`. 
107461
107462
107463
107464
107465 [endsect]
107466
107467
107468
107469 [section:overload2 ssl::context::set_default_verify_paths (2 of 2 overloads)]
107470
107471
107472 Configures the context to use the default directories for finding certification authority certificates. 
107473
107474
107475   void set_default_verify_paths(
107476       boost::system::error_code & ec);
107477
107478
107479 This function specifies that the context should use the default, system-dependent directories for locating certification authority certificates.
107480
107481
107482 [heading Parameters]
107483     
107484
107485 [variablelist
107486   
107487 [[ec][Set to indicate what error occurred, if any.]]
107488
107489 ]
107490
107491
107492 [heading Remarks]
107493       
107494 Calls `SSL_CTX_set_default_verify_paths`. 
107495
107496
107497
107498
107499 [endsect]
107500
107501
107502 [endsect]
107503
107504 [section:set_options ssl::context::set_options]
107505
107506 [indexterm2 boost_asio.indexterm.ssl__context.set_options..set_options..ssl::context] 
107507 Set options on the context. 
107508
107509
107510   void ``[link boost_asio.reference.ssl__context.set_options.overload1 set_options]``(
107511       options o);
107512   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.set_options.overload1 more...]]``
107513
107514   void ``[link boost_asio.reference.ssl__context.set_options.overload2 set_options]``(
107515       options o,
107516       boost::system::error_code & ec);
107517   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.set_options.overload2 more...]]``
107518
107519
107520 [section:overload1 ssl::context::set_options (1 of 2 overloads)]
107521
107522
107523 Set options on the context. 
107524
107525
107526   void set_options(
107527       options o);
107528
107529
107530 This function may be used to configure the SSL options used by the context.
107531
107532
107533 [heading Parameters]
107534     
107535
107536 [variablelist
107537   
107538 [[o][A bitmask of options. The available option values are defined in the [link boost_asio.reference.ssl__context_base `ssl::context_base`] class. The options are bitwise-ored with any existing value for the options.]]
107539
107540 ]
107541
107542
107543 [heading Exceptions]
107544     
107545
107546 [variablelist
107547   
107548 [[boost::system::system_error][Thrown on failure.]]
107549
107550 ]
107551
107552
107553 [heading Remarks]
107554       
107555 Calls `SSL_CTX_set_options`. 
107556
107557
107558
107559
107560 [endsect]
107561
107562
107563
107564 [section:overload2 ssl::context::set_options (2 of 2 overloads)]
107565
107566
107567 Set options on the context. 
107568
107569
107570   void set_options(
107571       options o,
107572       boost::system::error_code & ec);
107573
107574
107575 This function may be used to configure the SSL options used by the context.
107576
107577
107578 [heading Parameters]
107579     
107580
107581 [variablelist
107582   
107583 [[o][A bitmask of options. The available option values are defined in the [link boost_asio.reference.ssl__context_base `ssl::context_base`] class. The options are bitwise-ored with any existing value for the options.]]
107584
107585 [[ec][Set to indicate what error occurred, if any.]]
107586
107587 ]
107588
107589
107590 [heading Remarks]
107591       
107592 Calls `SSL_CTX_set_options`. 
107593
107594
107595
107596
107597 [endsect]
107598
107599
107600 [endsect]
107601
107602 [section:set_password_callback ssl::context::set_password_callback]
107603
107604 [indexterm2 boost_asio.indexterm.ssl__context.set_password_callback..set_password_callback..ssl::context] 
107605 Set the password callback. 
107606
107607
107608   template<
107609       typename PasswordCallback>
107610   void ``[link boost_asio.reference.ssl__context.set_password_callback.overload1 set_password_callback]``(
107611       PasswordCallback callback);
107612   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.set_password_callback.overload1 more...]]``
107613
107614   template<
107615       typename PasswordCallback>
107616   void ``[link boost_asio.reference.ssl__context.set_password_callback.overload2 set_password_callback]``(
107617       PasswordCallback callback,
107618       boost::system::error_code & ec);
107619   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.set_password_callback.overload2 more...]]``
107620
107621
107622 [section:overload1 ssl::context::set_password_callback (1 of 2 overloads)]
107623
107624
107625 Set the password callback. 
107626
107627
107628   template<
107629       typename PasswordCallback>
107630   void set_password_callback(
107631       PasswordCallback callback);
107632
107633
107634 This function is used to specify a callback function to obtain password information about an encrypted key in PEM format.
107635
107636
107637 [heading Parameters]
107638     
107639
107640 [variablelist
107641   
107642 [[callback][The function object to be used for obtaining the password. The function signature of the handler must be: 
107643 ``
107644    std::string password_callback(
107645      std::size_t max_length,  // The maximum size for a password.
107646      password_purpose purpose // Whether password is for reading or writing.
107647    ); 
107648 ``
107649 The return value of the callback is a string containing the password.]]
107650
107651 ]
107652
107653
107654 [heading Exceptions]
107655     
107656
107657 [variablelist
107658   
107659 [[boost::system::system_error][Thrown on failure.]]
107660
107661 ]
107662
107663
107664 [heading Remarks]
107665       
107666 Calls `SSL_CTX_set_default_passwd_cb`. 
107667
107668
107669
107670
107671 [endsect]
107672
107673
107674
107675 [section:overload2 ssl::context::set_password_callback (2 of 2 overloads)]
107676
107677
107678 Set the password callback. 
107679
107680
107681   template<
107682       typename PasswordCallback>
107683   void set_password_callback(
107684       PasswordCallback callback,
107685       boost::system::error_code & ec);
107686
107687
107688 This function is used to specify a callback function to obtain password information about an encrypted key in PEM format.
107689
107690
107691 [heading Parameters]
107692     
107693
107694 [variablelist
107695   
107696 [[callback][The function object to be used for obtaining the password. The function signature of the handler must be: 
107697 ``
107698    std::string password_callback(
107699      std::size_t max_length,  // The maximum size for a password.
107700      password_purpose purpose // Whether password is for reading or writing.
107701    ); 
107702 ``
107703 The return value of the callback is a string containing the password.]]
107704
107705 [[ec][Set to indicate what error occurred, if any.]]
107706
107707 ]
107708
107709
107710 [heading Remarks]
107711       
107712 Calls `SSL_CTX_set_default_passwd_cb`. 
107713
107714
107715
107716
107717 [endsect]
107718
107719
107720 [endsect]
107721
107722 [section:set_verify_callback ssl::context::set_verify_callback]
107723
107724 [indexterm2 boost_asio.indexterm.ssl__context.set_verify_callback..set_verify_callback..ssl::context] 
107725 Set the callback used to verify peer certificates. 
107726
107727
107728   template<
107729       typename VerifyCallback>
107730   void ``[link boost_asio.reference.ssl__context.set_verify_callback.overload1 set_verify_callback]``(
107731       VerifyCallback callback);
107732   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.set_verify_callback.overload1 more...]]``
107733
107734   template<
107735       typename VerifyCallback>
107736   void ``[link boost_asio.reference.ssl__context.set_verify_callback.overload2 set_verify_callback]``(
107737       VerifyCallback callback,
107738       boost::system::error_code & ec);
107739   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.set_verify_callback.overload2 more...]]``
107740
107741
107742 [section:overload1 ssl::context::set_verify_callback (1 of 2 overloads)]
107743
107744
107745 Set the callback used to verify peer certificates. 
107746
107747
107748   template<
107749       typename VerifyCallback>
107750   void set_verify_callback(
107751       VerifyCallback callback);
107752
107753
107754 This function is used to specify a callback function that will be called by the implementation when it needs to verify a peer certificate.
107755
107756
107757 [heading Parameters]
107758     
107759
107760 [variablelist
107761   
107762 [[callback][The function object to be used for verifying a certificate. The function signature of the handler must be: 
107763 ``
107764    bool verify_callback(
107765      bool preverified, // True if the certificate passed pre-verification.
107766      verify_context& ctx // The peer certificate and other context.
107767    ); 
107768 ``
107769 The return value of the callback is true if the certificate has passed verification, false otherwise.]]
107770
107771 ]
107772
107773
107774 [heading Exceptions]
107775     
107776
107777 [variablelist
107778   
107779 [[boost::system::system_error][Thrown on failure.]]
107780
107781 ]
107782
107783
107784 [heading Remarks]
107785       
107786 Calls `SSL_CTX_set_verify`. 
107787
107788
107789
107790
107791 [endsect]
107792
107793
107794
107795 [section:overload2 ssl::context::set_verify_callback (2 of 2 overloads)]
107796
107797
107798 Set the callback used to verify peer certificates. 
107799
107800
107801   template<
107802       typename VerifyCallback>
107803   void set_verify_callback(
107804       VerifyCallback callback,
107805       boost::system::error_code & ec);
107806
107807
107808 This function is used to specify a callback function that will be called by the implementation when it needs to verify a peer certificate.
107809
107810
107811 [heading Parameters]
107812     
107813
107814 [variablelist
107815   
107816 [[callback][The function object to be used for verifying a certificate. The function signature of the handler must be: 
107817 ``
107818    bool verify_callback(
107819      bool preverified, // True if the certificate passed pre-verification.
107820      verify_context& ctx // The peer certificate and other context.
107821    ); 
107822 ``
107823 The return value of the callback is true if the certificate has passed verification, false otherwise.]]
107824
107825 [[ec][Set to indicate what error occurred, if any.]]
107826
107827 ]
107828
107829
107830 [heading Remarks]
107831       
107832 Calls `SSL_CTX_set_verify`. 
107833
107834
107835
107836
107837 [endsect]
107838
107839
107840 [endsect]
107841
107842 [section:set_verify_depth ssl::context::set_verify_depth]
107843
107844 [indexterm2 boost_asio.indexterm.ssl__context.set_verify_depth..set_verify_depth..ssl::context] 
107845 Set the peer verification depth. 
107846
107847
107848   void ``[link boost_asio.reference.ssl__context.set_verify_depth.overload1 set_verify_depth]``(
107849       int depth);
107850   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.set_verify_depth.overload1 more...]]``
107851
107852   void ``[link boost_asio.reference.ssl__context.set_verify_depth.overload2 set_verify_depth]``(
107853       int depth,
107854       boost::system::error_code & ec);
107855   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.set_verify_depth.overload2 more...]]``
107856
107857
107858 [section:overload1 ssl::context::set_verify_depth (1 of 2 overloads)]
107859
107860
107861 Set the peer verification depth. 
107862
107863
107864   void set_verify_depth(
107865       int depth);
107866
107867
107868 This function may be used to configure the maximum verification depth allowed by the context.
107869
107870
107871 [heading Parameters]
107872     
107873
107874 [variablelist
107875   
107876 [[depth][Maximum depth for the certificate chain verification that shall be allowed.]]
107877
107878 ]
107879
107880
107881 [heading Exceptions]
107882     
107883
107884 [variablelist
107885   
107886 [[boost::system::system_error][Thrown on failure.]]
107887
107888 ]
107889
107890
107891 [heading Remarks]
107892       
107893 Calls `SSL_CTX_set_verify_depth`. 
107894
107895
107896
107897
107898 [endsect]
107899
107900
107901
107902 [section:overload2 ssl::context::set_verify_depth (2 of 2 overloads)]
107903
107904
107905 Set the peer verification depth. 
107906
107907
107908   void set_verify_depth(
107909       int depth,
107910       boost::system::error_code & ec);
107911
107912
107913 This function may be used to configure the maximum verification depth allowed by the context.
107914
107915
107916 [heading Parameters]
107917     
107918
107919 [variablelist
107920   
107921 [[depth][Maximum depth for the certificate chain verification that shall be allowed.]]
107922
107923 [[ec][Set to indicate what error occurred, if any.]]
107924
107925 ]
107926
107927
107928 [heading Remarks]
107929       
107930 Calls `SSL_CTX_set_verify_depth`. 
107931
107932
107933
107934
107935 [endsect]
107936
107937
107938 [endsect]
107939
107940 [section:set_verify_mode ssl::context::set_verify_mode]
107941
107942 [indexterm2 boost_asio.indexterm.ssl__context.set_verify_mode..set_verify_mode..ssl::context] 
107943 Set the peer verification mode. 
107944
107945
107946   void ``[link boost_asio.reference.ssl__context.set_verify_mode.overload1 set_verify_mode]``(
107947       verify_mode v);
107948   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.set_verify_mode.overload1 more...]]``
107949
107950   void ``[link boost_asio.reference.ssl__context.set_verify_mode.overload2 set_verify_mode]``(
107951       verify_mode v,
107952       boost::system::error_code & ec);
107953   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.set_verify_mode.overload2 more...]]``
107954
107955
107956 [section:overload1 ssl::context::set_verify_mode (1 of 2 overloads)]
107957
107958
107959 Set the peer verification mode. 
107960
107961
107962   void set_verify_mode(
107963       verify_mode v);
107964
107965
107966 This function may be used to configure the peer verification mode used by the context.
107967
107968
107969 [heading Parameters]
107970     
107971
107972 [variablelist
107973   
107974 [[v][A bitmask of peer verification modes. See [link boost_asio.reference.ssl__verify_mode `ssl::verify_mode`]  for available values.]]
107975
107976 ]
107977
107978
107979 [heading Exceptions]
107980     
107981
107982 [variablelist
107983   
107984 [[boost::system::system_error][Thrown on failure.]]
107985
107986 ]
107987
107988
107989 [heading Remarks]
107990       
107991 Calls `SSL_CTX_set_verify`. 
107992
107993
107994
107995
107996 [endsect]
107997
107998
107999
108000 [section:overload2 ssl::context::set_verify_mode (2 of 2 overloads)]
108001
108002
108003 Set the peer verification mode. 
108004
108005
108006   void set_verify_mode(
108007       verify_mode v,
108008       boost::system::error_code & ec);
108009
108010
108011 This function may be used to configure the peer verification mode used by the context.
108012
108013
108014 [heading Parameters]
108015     
108016
108017 [variablelist
108018   
108019 [[v][A bitmask of peer verification modes. See [link boost_asio.reference.ssl__verify_mode `ssl::verify_mode`]  for available values.]]
108020
108021 [[ec][Set to indicate what error occurred, if any.]]
108022
108023 ]
108024
108025
108026 [heading Remarks]
108027       
108028 Calls `SSL_CTX_set_verify`. 
108029
108030
108031
108032
108033 [endsect]
108034
108035
108036 [endsect]
108037
108038
108039 [section:single_dh_use ssl::context::single_dh_use]
108040
108041 [indexterm2 boost_asio.indexterm.ssl__context.single_dh_use..single_dh_use..ssl::context] 
108042 Always create a new key when using tmp\_dh parameters. 
108043
108044
108045   static const long single_dh_use = implementation_defined;
108046
108047
108048
108049 [endsect]
108050
108051
108052 [section:use_certificate ssl::context::use_certificate]
108053
108054 [indexterm2 boost_asio.indexterm.ssl__context.use_certificate..use_certificate..ssl::context] 
108055 Use a certificate from a memory buffer. 
108056
108057
108058   void ``[link boost_asio.reference.ssl__context.use_certificate.overload1 use_certificate]``(
108059       const const_buffer & certificate,
108060       file_format format);
108061   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.use_certificate.overload1 more...]]``
108062
108063   void ``[link boost_asio.reference.ssl__context.use_certificate.overload2 use_certificate]``(
108064       const const_buffer & certificate,
108065       file_format format,
108066       boost::system::error_code & ec);
108067   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.use_certificate.overload2 more...]]``
108068
108069
108070 [section:overload1 ssl::context::use_certificate (1 of 2 overloads)]
108071
108072
108073 Use a certificate from a memory buffer. 
108074
108075
108076   void use_certificate(
108077       const const_buffer & certificate,
108078       file_format format);
108079
108080
108081 This function is used to load a certificate into the context from a buffer.
108082
108083
108084 [heading Parameters]
108085     
108086
108087 [variablelist
108088   
108089 [[certificate][The buffer containing the certificate.]]
108090
108091 [[format][The certificate format (ASN.1 or PEM).]]
108092
108093 ]
108094
108095
108096 [heading Exceptions]
108097     
108098
108099 [variablelist
108100   
108101 [[boost::system::system_error][Thrown on failure.]]
108102
108103 ]
108104
108105
108106 [heading Remarks]
108107       
108108 Calls `SSL_CTX_use_certificate` or SSL\_CTX\_use\_certificate\_ASN1. 
108109
108110
108111
108112
108113 [endsect]
108114
108115
108116
108117 [section:overload2 ssl::context::use_certificate (2 of 2 overloads)]
108118
108119
108120 Use a certificate from a memory buffer. 
108121
108122
108123   void use_certificate(
108124       const const_buffer & certificate,
108125       file_format format,
108126       boost::system::error_code & ec);
108127
108128
108129 This function is used to load a certificate into the context from a buffer.
108130
108131
108132 [heading Parameters]
108133     
108134
108135 [variablelist
108136   
108137 [[certificate][The buffer containing the certificate.]]
108138
108139 [[format][The certificate format (ASN.1 or PEM).]]
108140
108141 [[ec][Set to indicate what error occurred, if any.]]
108142
108143 ]
108144
108145
108146 [heading Remarks]
108147       
108148 Calls `SSL_CTX_use_certificate` or SSL\_CTX\_use\_certificate\_ASN1. 
108149
108150
108151
108152
108153 [endsect]
108154
108155
108156 [endsect]
108157
108158 [section:use_certificate_chain ssl::context::use_certificate_chain]
108159
108160 [indexterm2 boost_asio.indexterm.ssl__context.use_certificate_chain..use_certificate_chain..ssl::context] 
108161 Use a certificate chain from a memory buffer. 
108162
108163
108164   void ``[link boost_asio.reference.ssl__context.use_certificate_chain.overload1 use_certificate_chain]``(
108165       const const_buffer & chain);
108166   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.use_certificate_chain.overload1 more...]]``
108167
108168   void ``[link boost_asio.reference.ssl__context.use_certificate_chain.overload2 use_certificate_chain]``(
108169       const const_buffer & chain,
108170       boost::system::error_code & ec);
108171   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.use_certificate_chain.overload2 more...]]``
108172
108173
108174 [section:overload1 ssl::context::use_certificate_chain (1 of 2 overloads)]
108175
108176
108177 Use a certificate chain from a memory buffer. 
108178
108179
108180   void use_certificate_chain(
108181       const const_buffer & chain);
108182
108183
108184 This function is used to load a certificate chain into the context from a buffer.
108185
108186
108187 [heading Parameters]
108188     
108189
108190 [variablelist
108191   
108192 [[chain][The buffer containing the certificate chain. The certificate chain must use the PEM format.]]
108193
108194 ]
108195
108196
108197 [heading Exceptions]
108198     
108199
108200 [variablelist
108201   
108202 [[boost::system::system_error][Thrown on failure.]]
108203
108204 ]
108205
108206
108207 [heading Remarks]
108208       
108209 Calls `SSL_CTX_use_certificate` and SSL\_CTX\_add\_extra\_chain\_cert. 
108210
108211
108212
108213
108214 [endsect]
108215
108216
108217
108218 [section:overload2 ssl::context::use_certificate_chain (2 of 2 overloads)]
108219
108220
108221 Use a certificate chain from a memory buffer. 
108222
108223
108224   void use_certificate_chain(
108225       const const_buffer & chain,
108226       boost::system::error_code & ec);
108227
108228
108229 This function is used to load a certificate chain into the context from a buffer.
108230
108231
108232 [heading Parameters]
108233     
108234
108235 [variablelist
108236   
108237 [[chain][The buffer containing the certificate chain. The certificate chain must use the PEM format.]]
108238
108239 [[ec][Set to indicate what error occurred, if any.]]
108240
108241 ]
108242
108243
108244 [heading Remarks]
108245       
108246 Calls `SSL_CTX_use_certificate` and SSL\_CTX\_add\_extra\_chain\_cert. 
108247
108248
108249
108250
108251 [endsect]
108252
108253
108254 [endsect]
108255
108256 [section:use_certificate_chain_file ssl::context::use_certificate_chain_file]
108257
108258 [indexterm2 boost_asio.indexterm.ssl__context.use_certificate_chain_file..use_certificate_chain_file..ssl::context] 
108259 Use a certificate chain from a file. 
108260
108261
108262   void ``[link boost_asio.reference.ssl__context.use_certificate_chain_file.overload1 use_certificate_chain_file]``(
108263       const std::string & filename);
108264   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.use_certificate_chain_file.overload1 more...]]``
108265
108266   void ``[link boost_asio.reference.ssl__context.use_certificate_chain_file.overload2 use_certificate_chain_file]``(
108267       const std::string & filename,
108268       boost::system::error_code & ec);
108269   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.use_certificate_chain_file.overload2 more...]]``
108270
108271
108272 [section:overload1 ssl::context::use_certificate_chain_file (1 of 2 overloads)]
108273
108274
108275 Use a certificate chain from a file. 
108276
108277
108278   void use_certificate_chain_file(
108279       const std::string & filename);
108280
108281
108282 This function is used to load a certificate chain into the context from a file.
108283
108284
108285 [heading Parameters]
108286     
108287
108288 [variablelist
108289   
108290 [[filename][The name of the file containing the certificate. The file must use the PEM format.]]
108291
108292 ]
108293
108294
108295 [heading Exceptions]
108296     
108297
108298 [variablelist
108299   
108300 [[boost::system::system_error][Thrown on failure.]]
108301
108302 ]
108303
108304
108305 [heading Remarks]
108306       
108307 Calls `SSL_CTX_use_certificate_chain_file`. 
108308
108309
108310
108311
108312 [endsect]
108313
108314
108315
108316 [section:overload2 ssl::context::use_certificate_chain_file (2 of 2 overloads)]
108317
108318
108319 Use a certificate chain from a file. 
108320
108321
108322   void use_certificate_chain_file(
108323       const std::string & filename,
108324       boost::system::error_code & ec);
108325
108326
108327 This function is used to load a certificate chain into the context from a file.
108328
108329
108330 [heading Parameters]
108331     
108332
108333 [variablelist
108334   
108335 [[filename][The name of the file containing the certificate. The file must use the PEM format.]]
108336
108337 [[ec][Set to indicate what error occurred, if any.]]
108338
108339 ]
108340
108341
108342 [heading Remarks]
108343       
108344 Calls `SSL_CTX_use_certificate_chain_file`. 
108345
108346
108347
108348
108349 [endsect]
108350
108351
108352 [endsect]
108353
108354 [section:use_certificate_file ssl::context::use_certificate_file]
108355
108356 [indexterm2 boost_asio.indexterm.ssl__context.use_certificate_file..use_certificate_file..ssl::context] 
108357 Use a certificate from a file. 
108358
108359
108360   void ``[link boost_asio.reference.ssl__context.use_certificate_file.overload1 use_certificate_file]``(
108361       const std::string & filename,
108362       file_format format);
108363   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.use_certificate_file.overload1 more...]]``
108364
108365   void ``[link boost_asio.reference.ssl__context.use_certificate_file.overload2 use_certificate_file]``(
108366       const std::string & filename,
108367       file_format format,
108368       boost::system::error_code & ec);
108369   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.use_certificate_file.overload2 more...]]``
108370
108371
108372 [section:overload1 ssl::context::use_certificate_file (1 of 2 overloads)]
108373
108374
108375 Use a certificate from a file. 
108376
108377
108378   void use_certificate_file(
108379       const std::string & filename,
108380       file_format format);
108381
108382
108383 This function is used to load a certificate into the context from a file.
108384
108385
108386 [heading Parameters]
108387     
108388
108389 [variablelist
108390   
108391 [[filename][The name of the file containing the certificate.]]
108392
108393 [[format][The file format (ASN.1 or PEM).]]
108394
108395 ]
108396
108397
108398 [heading Exceptions]
108399     
108400
108401 [variablelist
108402   
108403 [[boost::system::system_error][Thrown on failure.]]
108404
108405 ]
108406
108407
108408 [heading Remarks]
108409       
108410 Calls `SSL_CTX_use_certificate_file`. 
108411
108412
108413
108414
108415 [endsect]
108416
108417
108418
108419 [section:overload2 ssl::context::use_certificate_file (2 of 2 overloads)]
108420
108421
108422 Use a certificate from a file. 
108423
108424
108425   void use_certificate_file(
108426       const std::string & filename,
108427       file_format format,
108428       boost::system::error_code & ec);
108429
108430
108431 This function is used to load a certificate into the context from a file.
108432
108433
108434 [heading Parameters]
108435     
108436
108437 [variablelist
108438   
108439 [[filename][The name of the file containing the certificate.]]
108440
108441 [[format][The file format (ASN.1 or PEM).]]
108442
108443 [[ec][Set to indicate what error occurred, if any.]]
108444
108445 ]
108446
108447
108448 [heading Remarks]
108449       
108450 Calls `SSL_CTX_use_certificate_file`. 
108451
108452
108453
108454
108455 [endsect]
108456
108457
108458 [endsect]
108459
108460 [section:use_private_key ssl::context::use_private_key]
108461
108462 [indexterm2 boost_asio.indexterm.ssl__context.use_private_key..use_private_key..ssl::context] 
108463 Use a private key from a memory buffer. 
108464
108465
108466   void ``[link boost_asio.reference.ssl__context.use_private_key.overload1 use_private_key]``(
108467       const const_buffer & private_key,
108468       file_format format);
108469   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.use_private_key.overload1 more...]]``
108470
108471   void ``[link boost_asio.reference.ssl__context.use_private_key.overload2 use_private_key]``(
108472       const const_buffer & private_key,
108473       file_format format,
108474       boost::system::error_code & ec);
108475   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.use_private_key.overload2 more...]]``
108476
108477
108478 [section:overload1 ssl::context::use_private_key (1 of 2 overloads)]
108479
108480
108481 Use a private key from a memory buffer. 
108482
108483
108484   void use_private_key(
108485       const const_buffer & private_key,
108486       file_format format);
108487
108488
108489 This function is used to load a private key into the context from a buffer.
108490
108491
108492 [heading Parameters]
108493     
108494
108495 [variablelist
108496   
108497 [[private_key][The buffer containing the private key.]]
108498
108499 [[format][The private key format (ASN.1 or PEM).]]
108500
108501 ]
108502
108503
108504 [heading Exceptions]
108505     
108506
108507 [variablelist
108508   
108509 [[boost::system::system_error][Thrown on failure.]]
108510
108511 ]
108512
108513
108514 [heading Remarks]
108515       
108516 Calls `SSL_CTX_use_PrivateKey` or SSL\_CTX\_use\_PrivateKey\_ASN1. 
108517
108518
108519
108520
108521 [endsect]
108522
108523
108524
108525 [section:overload2 ssl::context::use_private_key (2 of 2 overloads)]
108526
108527
108528 Use a private key from a memory buffer. 
108529
108530
108531   void use_private_key(
108532       const const_buffer & private_key,
108533       file_format format,
108534       boost::system::error_code & ec);
108535
108536
108537 This function is used to load a private key into the context from a buffer.
108538
108539
108540 [heading Parameters]
108541     
108542
108543 [variablelist
108544   
108545 [[private_key][The buffer containing the private key.]]
108546
108547 [[format][The private key format (ASN.1 or PEM).]]
108548
108549 [[ec][Set to indicate what error occurred, if any.]]
108550
108551 ]
108552
108553
108554 [heading Remarks]
108555       
108556 Calls `SSL_CTX_use_PrivateKey` or SSL\_CTX\_use\_PrivateKey\_ASN1. 
108557
108558
108559
108560
108561 [endsect]
108562
108563
108564 [endsect]
108565
108566 [section:use_private_key_file ssl::context::use_private_key_file]
108567
108568 [indexterm2 boost_asio.indexterm.ssl__context.use_private_key_file..use_private_key_file..ssl::context] 
108569 Use a private key from a file. 
108570
108571
108572   void ``[link boost_asio.reference.ssl__context.use_private_key_file.overload1 use_private_key_file]``(
108573       const std::string & filename,
108574       file_format format);
108575   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.use_private_key_file.overload1 more...]]``
108576
108577   void ``[link boost_asio.reference.ssl__context.use_private_key_file.overload2 use_private_key_file]``(
108578       const std::string & filename,
108579       file_format format,
108580       boost::system::error_code & ec);
108581   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.use_private_key_file.overload2 more...]]``
108582
108583
108584 [section:overload1 ssl::context::use_private_key_file (1 of 2 overloads)]
108585
108586
108587 Use a private key from a file. 
108588
108589
108590   void use_private_key_file(
108591       const std::string & filename,
108592       file_format format);
108593
108594
108595 This function is used to load a private key into the context from a file.
108596
108597
108598 [heading Parameters]
108599     
108600
108601 [variablelist
108602   
108603 [[filename][The name of the file containing the private key.]]
108604
108605 [[format][The file format (ASN.1 or PEM).]]
108606
108607 ]
108608
108609
108610 [heading Exceptions]
108611     
108612
108613 [variablelist
108614   
108615 [[boost::system::system_error][Thrown on failure.]]
108616
108617 ]
108618
108619
108620 [heading Remarks]
108621       
108622 Calls `SSL_CTX_use_PrivateKey_file`. 
108623
108624
108625
108626
108627 [endsect]
108628
108629
108630
108631 [section:overload2 ssl::context::use_private_key_file (2 of 2 overloads)]
108632
108633
108634 Use a private key from a file. 
108635
108636
108637   void use_private_key_file(
108638       const std::string & filename,
108639       file_format format,
108640       boost::system::error_code & ec);
108641
108642
108643 This function is used to load a private key into the context from a file.
108644
108645
108646 [heading Parameters]
108647     
108648
108649 [variablelist
108650   
108651 [[filename][The name of the file containing the private key.]]
108652
108653 [[format][The file format (ASN.1 or PEM).]]
108654
108655 [[ec][Set to indicate what error occurred, if any.]]
108656
108657 ]
108658
108659
108660 [heading Remarks]
108661       
108662 Calls `SSL_CTX_use_PrivateKey_file`. 
108663
108664
108665
108666
108667 [endsect]
108668
108669
108670 [endsect]
108671
108672 [section:use_rsa_private_key ssl::context::use_rsa_private_key]
108673
108674 [indexterm2 boost_asio.indexterm.ssl__context.use_rsa_private_key..use_rsa_private_key..ssl::context] 
108675 Use an RSA private key from a memory buffer. 
108676
108677
108678   void ``[link boost_asio.reference.ssl__context.use_rsa_private_key.overload1 use_rsa_private_key]``(
108679       const const_buffer & private_key,
108680       file_format format);
108681   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.use_rsa_private_key.overload1 more...]]``
108682
108683   void ``[link boost_asio.reference.ssl__context.use_rsa_private_key.overload2 use_rsa_private_key]``(
108684       const const_buffer & private_key,
108685       file_format format,
108686       boost::system::error_code & ec);
108687   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.use_rsa_private_key.overload2 more...]]``
108688
108689
108690 [section:overload1 ssl::context::use_rsa_private_key (1 of 2 overloads)]
108691
108692
108693 Use an RSA private key from a memory buffer. 
108694
108695
108696   void use_rsa_private_key(
108697       const const_buffer & private_key,
108698       file_format format);
108699
108700
108701 This function is used to load an RSA private key into the context from a buffer.
108702
108703
108704 [heading Parameters]
108705     
108706
108707 [variablelist
108708   
108709 [[private_key][The buffer containing the RSA private key.]]
108710
108711 [[format][The private key format (ASN.1 or PEM).]]
108712
108713 ]
108714
108715
108716 [heading Exceptions]
108717     
108718
108719 [variablelist
108720   
108721 [[boost::system::system_error][Thrown on failure.]]
108722
108723 ]
108724
108725
108726 [heading Remarks]
108727       
108728 Calls `SSL_CTX_use_RSAPrivateKey` or SSL\_CTX\_use\_RSAPrivateKey\_ASN1. 
108729
108730
108731
108732
108733 [endsect]
108734
108735
108736
108737 [section:overload2 ssl::context::use_rsa_private_key (2 of 2 overloads)]
108738
108739
108740 Use an RSA private key from a memory buffer. 
108741
108742
108743   void use_rsa_private_key(
108744       const const_buffer & private_key,
108745       file_format format,
108746       boost::system::error_code & ec);
108747
108748
108749 This function is used to load an RSA private key into the context from a buffer.
108750
108751
108752 [heading Parameters]
108753     
108754
108755 [variablelist
108756   
108757 [[private_key][The buffer containing the RSA private key.]]
108758
108759 [[format][The private key format (ASN.1 or PEM).]]
108760
108761 [[ec][Set to indicate what error occurred, if any.]]
108762
108763 ]
108764
108765
108766 [heading Remarks]
108767       
108768 Calls `SSL_CTX_use_RSAPrivateKey` or SSL\_CTX\_use\_RSAPrivateKey\_ASN1. 
108769
108770
108771
108772
108773 [endsect]
108774
108775
108776 [endsect]
108777
108778 [section:use_rsa_private_key_file ssl::context::use_rsa_private_key_file]
108779
108780 [indexterm2 boost_asio.indexterm.ssl__context.use_rsa_private_key_file..use_rsa_private_key_file..ssl::context] 
108781 Use an RSA private key from a file. 
108782
108783
108784   void ``[link boost_asio.reference.ssl__context.use_rsa_private_key_file.overload1 use_rsa_private_key_file]``(
108785       const std::string & filename,
108786       file_format format);
108787   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.use_rsa_private_key_file.overload1 more...]]``
108788
108789   void ``[link boost_asio.reference.ssl__context.use_rsa_private_key_file.overload2 use_rsa_private_key_file]``(
108790       const std::string & filename,
108791       file_format format,
108792       boost::system::error_code & ec);
108793   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.use_rsa_private_key_file.overload2 more...]]``
108794
108795
108796 [section:overload1 ssl::context::use_rsa_private_key_file (1 of 2 overloads)]
108797
108798
108799 Use an RSA private key from a file. 
108800
108801
108802   void use_rsa_private_key_file(
108803       const std::string & filename,
108804       file_format format);
108805
108806
108807 This function is used to load an RSA private key into the context from a file.
108808
108809
108810 [heading Parameters]
108811     
108812
108813 [variablelist
108814   
108815 [[filename][The name of the file containing the RSA private key.]]
108816
108817 [[format][The file format (ASN.1 or PEM).]]
108818
108819 ]
108820
108821
108822 [heading Exceptions]
108823     
108824
108825 [variablelist
108826   
108827 [[boost::system::system_error][Thrown on failure.]]
108828
108829 ]
108830
108831
108832 [heading Remarks]
108833       
108834 Calls `SSL_CTX_use_RSAPrivateKey_file`. 
108835
108836
108837
108838
108839 [endsect]
108840
108841
108842
108843 [section:overload2 ssl::context::use_rsa_private_key_file (2 of 2 overloads)]
108844
108845
108846 Use an RSA private key from a file. 
108847
108848
108849   void use_rsa_private_key_file(
108850       const std::string & filename,
108851       file_format format,
108852       boost::system::error_code & ec);
108853
108854
108855 This function is used to load an RSA private key into the context from a file.
108856
108857
108858 [heading Parameters]
108859     
108860
108861 [variablelist
108862   
108863 [[filename][The name of the file containing the RSA private key.]]
108864
108865 [[format][The file format (ASN.1 or PEM).]]
108866
108867 [[ec][Set to indicate what error occurred, if any.]]
108868
108869 ]
108870
108871
108872 [heading Remarks]
108873       
108874 Calls `SSL_CTX_use_RSAPrivateKey_file`. 
108875
108876
108877
108878
108879 [endsect]
108880
108881
108882 [endsect]
108883
108884 [section:use_tmp_dh ssl::context::use_tmp_dh]
108885
108886 [indexterm2 boost_asio.indexterm.ssl__context.use_tmp_dh..use_tmp_dh..ssl::context] 
108887 Use the specified memory buffer to obtain the temporary Diffie-Hellman parameters. 
108888
108889
108890   void ``[link boost_asio.reference.ssl__context.use_tmp_dh.overload1 use_tmp_dh]``(
108891       const const_buffer & dh);
108892   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.use_tmp_dh.overload1 more...]]``
108893
108894   void ``[link boost_asio.reference.ssl__context.use_tmp_dh.overload2 use_tmp_dh]``(
108895       const const_buffer & dh,
108896       boost::system::error_code & ec);
108897   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.use_tmp_dh.overload2 more...]]``
108898
108899
108900 [section:overload1 ssl::context::use_tmp_dh (1 of 2 overloads)]
108901
108902
108903 Use the specified memory buffer to obtain the temporary Diffie-Hellman parameters. 
108904
108905
108906   void use_tmp_dh(
108907       const const_buffer & dh);
108908
108909
108910 This function is used to load Diffie-Hellman parameters into the context from a buffer.
108911
108912
108913 [heading Parameters]
108914     
108915
108916 [variablelist
108917   
108918 [[dh][The memory buffer containing the Diffie-Hellman parameters. The buffer must use the PEM format.]]
108919
108920 ]
108921
108922
108923 [heading Exceptions]
108924     
108925
108926 [variablelist
108927   
108928 [[boost::system::system_error][Thrown on failure.]]
108929
108930 ]
108931
108932
108933 [heading Remarks]
108934       
108935 Calls `SSL_CTX_set_tmp_dh`. 
108936
108937
108938
108939
108940 [endsect]
108941
108942
108943
108944 [section:overload2 ssl::context::use_tmp_dh (2 of 2 overloads)]
108945
108946
108947 Use the specified memory buffer to obtain the temporary Diffie-Hellman parameters. 
108948
108949
108950   void use_tmp_dh(
108951       const const_buffer & dh,
108952       boost::system::error_code & ec);
108953
108954
108955 This function is used to load Diffie-Hellman parameters into the context from a buffer.
108956
108957
108958 [heading Parameters]
108959     
108960
108961 [variablelist
108962   
108963 [[dh][The memory buffer containing the Diffie-Hellman parameters. The buffer must use the PEM format.]]
108964
108965 [[ec][Set to indicate what error occurred, if any.]]
108966
108967 ]
108968
108969
108970 [heading Remarks]
108971       
108972 Calls `SSL_CTX_set_tmp_dh`. 
108973
108974
108975
108976
108977 [endsect]
108978
108979
108980 [endsect]
108981
108982 [section:use_tmp_dh_file ssl::context::use_tmp_dh_file]
108983
108984 [indexterm2 boost_asio.indexterm.ssl__context.use_tmp_dh_file..use_tmp_dh_file..ssl::context] 
108985 Use the specified file to obtain the temporary Diffie-Hellman parameters. 
108986
108987
108988   void ``[link boost_asio.reference.ssl__context.use_tmp_dh_file.overload1 use_tmp_dh_file]``(
108989       const std::string & filename);
108990   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.use_tmp_dh_file.overload1 more...]]``
108991
108992   void ``[link boost_asio.reference.ssl__context.use_tmp_dh_file.overload2 use_tmp_dh_file]``(
108993       const std::string & filename,
108994       boost::system::error_code & ec);
108995   ``  [''''&raquo;''' [link boost_asio.reference.ssl__context.use_tmp_dh_file.overload2 more...]]``
108996
108997
108998 [section:overload1 ssl::context::use_tmp_dh_file (1 of 2 overloads)]
108999
109000
109001 Use the specified file to obtain the temporary Diffie-Hellman parameters. 
109002
109003
109004   void use_tmp_dh_file(
109005       const std::string & filename);
109006
109007
109008 This function is used to load Diffie-Hellman parameters into the context from a file.
109009
109010
109011 [heading Parameters]
109012     
109013
109014 [variablelist
109015   
109016 [[filename][The name of the file containing the Diffie-Hellman parameters. The file must use the PEM format.]]
109017
109018 ]
109019
109020
109021 [heading Exceptions]
109022     
109023
109024 [variablelist
109025   
109026 [[boost::system::system_error][Thrown on failure.]]
109027
109028 ]
109029
109030
109031 [heading Remarks]
109032       
109033 Calls `SSL_CTX_set_tmp_dh`. 
109034
109035
109036
109037
109038 [endsect]
109039
109040
109041
109042 [section:overload2 ssl::context::use_tmp_dh_file (2 of 2 overloads)]
109043
109044
109045 Use the specified file to obtain the temporary Diffie-Hellman parameters. 
109046
109047
109048   void use_tmp_dh_file(
109049       const std::string & filename,
109050       boost::system::error_code & ec);
109051
109052
109053 This function is used to load Diffie-Hellman parameters into the context from a file.
109054
109055
109056 [heading Parameters]
109057     
109058
109059 [variablelist
109060   
109061 [[filename][The name of the file containing the Diffie-Hellman parameters. The file must use the PEM format.]]
109062
109063 [[ec][Set to indicate what error occurred, if any.]]
109064
109065 ]
109066
109067
109068 [heading Remarks]
109069       
109070 Calls `SSL_CTX_set_tmp_dh`. 
109071
109072
109073
109074
109075 [endsect]
109076
109077
109078 [endsect]
109079
109080
109081 [section:_context ssl::context::~context]
109082
109083 [indexterm2 boost_asio.indexterm.ssl__context._context..~context..ssl::context] 
109084 Destructor. 
109085
109086
109087   ~context();
109088
109089
109090
109091 [endsect]
109092
109093
109094
109095 [endsect]
109096
109097 [section:ssl__context_base ssl::context_base]
109098
109099
109100 The [link boost_asio.reference.ssl__context_base `ssl::context_base`] class is used as a base for the basic\_context class template so that we have a common place to define various enums. 
109101
109102
109103   class context_base
109104
109105
109106 [heading Types]
109107 [table
109108   [[Name][Description]]
109109
109110   [
109111
109112     [[link boost_asio.reference.ssl__context_base.file_format [*file_format]]]
109113     [File format types. ]
109114   
109115   ]
109116
109117   [
109118
109119     [[link boost_asio.reference.ssl__context_base.method [*method]]]
109120     [Different methods supported by a context. ]
109121   
109122   ]
109123
109124   [
109125
109126     [[link boost_asio.reference.ssl__context_base.options [*options]]]
109127     [Bitmask type for SSL options. ]
109128   
109129   ]
109130
109131   [
109132
109133     [[link boost_asio.reference.ssl__context_base.password_purpose [*password_purpose]]]
109134     [Purpose of PEM password. ]
109135   
109136   ]
109137
109138 ]
109139
109140 [heading Protected Member Functions]
109141 [table
109142   [[Name][Description]]
109143
109144   [
109145     [[link boost_asio.reference.ssl__context_base._context_base [*~context_base]]]
109146     [Protected destructor to prevent deletion through this type. ]
109147   ]
109148   
109149 ]
109150
109151 [heading Data Members]
109152 [table
109153   [[Name][Description]]
109154
109155   [
109156     [[link boost_asio.reference.ssl__context_base.default_workarounds [*default_workarounds]]]
109157     [Implement various bug workarounds. ]
109158   ]
109159
109160   [
109161     [[link boost_asio.reference.ssl__context_base.no_compression [*no_compression]]]
109162     [Disable compression. Compression is disabled by default. ]
109163   ]
109164
109165   [
109166     [[link boost_asio.reference.ssl__context_base.no_sslv2 [*no_sslv2]]]
109167     [Disable SSL v2. ]
109168   ]
109169
109170   [
109171     [[link boost_asio.reference.ssl__context_base.no_sslv3 [*no_sslv3]]]
109172     [Disable SSL v3. ]
109173   ]
109174
109175   [
109176     [[link boost_asio.reference.ssl__context_base.no_tlsv1 [*no_tlsv1]]]
109177     [Disable TLS v1. ]
109178   ]
109179
109180   [
109181     [[link boost_asio.reference.ssl__context_base.no_tlsv1_1 [*no_tlsv1_1]]]
109182     [Disable TLS v1.1. ]
109183   ]
109184
109185   [
109186     [[link boost_asio.reference.ssl__context_base.no_tlsv1_2 [*no_tlsv1_2]]]
109187     [Disable TLS v1.2. ]
109188   ]
109189
109190   [
109191     [[link boost_asio.reference.ssl__context_base.no_tlsv1_3 [*no_tlsv1_3]]]
109192     [Disable TLS v1.3. ]
109193   ]
109194
109195   [
109196     [[link boost_asio.reference.ssl__context_base.single_dh_use [*single_dh_use]]]
109197     [Always create a new key when using tmp_dh parameters. ]
109198   ]
109199
109200 ]
109201
109202 [heading Requirements]
109203
109204 ['Header: ][^boost/asio/ssl/context_base.hpp]
109205
109206 ['Convenience header: ][^boost/asio/ssl.hpp]
109207
109208
109209 [section:default_workarounds ssl::context_base::default_workarounds]
109210
109211 [indexterm2 boost_asio.indexterm.ssl__context_base.default_workarounds..default_workarounds..ssl::context_base] 
109212 Implement various bug workarounds. 
109213
109214
109215   static const long default_workarounds = implementation_defined;
109216
109217
109218
109219 [endsect]
109220
109221
109222
109223 [section:file_format ssl::context_base::file_format]
109224
109225 [indexterm2 boost_asio.indexterm.ssl__context_base.file_format..file_format..ssl::context_base] 
109226 File format types. 
109227
109228
109229   enum file_format
109230
109231 [indexterm2 boost_asio.indexterm.ssl__context_base.file_format.asn1..asn1..ssl::context_base]
109232 [indexterm2 boost_asio.indexterm.ssl__context_base.file_format.pem..pem..ssl::context_base]
109233
109234 [heading Values]
109235 [variablelist
109236
109237   [
109238     [asn1]
109239     [ASN.1 file. ]
109240   ]
109241
109242   [
109243     [pem]
109244     [PEM file. ]
109245   ]
109246
109247 ]
109248
109249
109250
109251 [endsect]
109252
109253
109254
109255 [section:method ssl::context_base::method]
109256
109257 [indexterm2 boost_asio.indexterm.ssl__context_base.method..method..ssl::context_base] 
109258 Different methods supported by a context. 
109259
109260
109261   enum method
109262
109263 [indexterm2 boost_asio.indexterm.ssl__context_base.method.sslv2..sslv2..ssl::context_base]
109264 [indexterm2 boost_asio.indexterm.ssl__context_base.method.sslv2_client..sslv2_client..ssl::context_base]
109265 [indexterm2 boost_asio.indexterm.ssl__context_base.method.sslv2_server..sslv2_server..ssl::context_base]
109266 [indexterm2 boost_asio.indexterm.ssl__context_base.method.sslv3..sslv3..ssl::context_base]
109267 [indexterm2 boost_asio.indexterm.ssl__context_base.method.sslv3_client..sslv3_client..ssl::context_base]
109268 [indexterm2 boost_asio.indexterm.ssl__context_base.method.sslv3_server..sslv3_server..ssl::context_base]
109269 [indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv1..tlsv1..ssl::context_base]
109270 [indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv1_client..tlsv1_client..ssl::context_base]
109271 [indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv1_server..tlsv1_server..ssl::context_base]
109272 [indexterm2 boost_asio.indexterm.ssl__context_base.method.sslv23..sslv23..ssl::context_base]
109273 [indexterm2 boost_asio.indexterm.ssl__context_base.method.sslv23_client..sslv23_client..ssl::context_base]
109274 [indexterm2 boost_asio.indexterm.ssl__context_base.method.sslv23_server..sslv23_server..ssl::context_base]
109275 [indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv11..tlsv11..ssl::context_base]
109276 [indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv11_client..tlsv11_client..ssl::context_base]
109277 [indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv11_server..tlsv11_server..ssl::context_base]
109278 [indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv12..tlsv12..ssl::context_base]
109279 [indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv12_client..tlsv12_client..ssl::context_base]
109280 [indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv12_server..tlsv12_server..ssl::context_base]
109281 [indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv13..tlsv13..ssl::context_base]
109282 [indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv13_client..tlsv13_client..ssl::context_base]
109283 [indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv13_server..tlsv13_server..ssl::context_base]
109284 [indexterm2 boost_asio.indexterm.ssl__context_base.method.tls..tls..ssl::context_base]
109285 [indexterm2 boost_asio.indexterm.ssl__context_base.method.tls_client..tls_client..ssl::context_base]
109286 [indexterm2 boost_asio.indexterm.ssl__context_base.method.tls_server..tls_server..ssl::context_base]
109287
109288 [heading Values]
109289 [variablelist
109290
109291   [
109292     [sslv2]
109293     [Generic SSL version 2. ]
109294   ]
109295
109296   [
109297     [sslv2_client]
109298     [SSL version 2 client. ]
109299   ]
109300
109301   [
109302     [sslv2_server]
109303     [SSL version 2 server. ]
109304   ]
109305
109306   [
109307     [sslv3]
109308     [Generic SSL version 3. ]
109309   ]
109310
109311   [
109312     [sslv3_client]
109313     [SSL version 3 client. ]
109314   ]
109315
109316   [
109317     [sslv3_server]
109318     [SSL version 3 server. ]
109319   ]
109320
109321   [
109322     [tlsv1]
109323     [Generic TLS version 1. ]
109324   ]
109325
109326   [
109327     [tlsv1_client]
109328     [TLS version 1 client. ]
109329   ]
109330
109331   [
109332     [tlsv1_server]
109333     [TLS version 1 server. ]
109334   ]
109335
109336   [
109337     [sslv23]
109338     [Generic SSL/TLS. ]
109339   ]
109340
109341   [
109342     [sslv23_client]
109343     [SSL/TLS client. ]
109344   ]
109345
109346   [
109347     [sslv23_server]
109348     [SSL/TLS server. ]
109349   ]
109350
109351   [
109352     [tlsv11]
109353     [Generic TLS version 1.1. ]
109354   ]
109355
109356   [
109357     [tlsv11_client]
109358     [TLS version 1.1 client. ]
109359   ]
109360
109361   [
109362     [tlsv11_server]
109363     [TLS version 1.1 server. ]
109364   ]
109365
109366   [
109367     [tlsv12]
109368     [Generic TLS version 1.2. ]
109369   ]
109370
109371   [
109372     [tlsv12_client]
109373     [TLS version 1.2 client. ]
109374   ]
109375
109376   [
109377     [tlsv12_server]
109378     [TLS version 1.2 server. ]
109379   ]
109380
109381   [
109382     [tlsv13]
109383     [Generic TLS version 1.3. ]
109384   ]
109385
109386   [
109387     [tlsv13_client]
109388     [TLS version 1.3 client. ]
109389   ]
109390
109391   [
109392     [tlsv13_server]
109393     [TLS version 1.3 server. ]
109394   ]
109395
109396   [
109397     [tls]
109398     [Generic TLS. ]
109399   ]
109400
109401   [
109402     [tls_client]
109403     [TLS client. ]
109404   ]
109405
109406   [
109407     [tls_server]
109408     [TLS server. ]
109409   ]
109410
109411 ]
109412
109413
109414
109415 [endsect]
109416
109417
109418
109419 [section:no_compression ssl::context_base::no_compression]
109420
109421 [indexterm2 boost_asio.indexterm.ssl__context_base.no_compression..no_compression..ssl::context_base] 
109422 Disable compression. Compression is disabled by default. 
109423
109424
109425   static const long no_compression = implementation_defined;
109426
109427
109428
109429 [endsect]
109430
109431
109432
109433 [section:no_sslv2 ssl::context_base::no_sslv2]
109434
109435 [indexterm2 boost_asio.indexterm.ssl__context_base.no_sslv2..no_sslv2..ssl::context_base] 
109436 Disable SSL v2. 
109437
109438
109439   static const long no_sslv2 = implementation_defined;
109440
109441
109442
109443 [endsect]
109444
109445
109446
109447 [section:no_sslv3 ssl::context_base::no_sslv3]
109448
109449 [indexterm2 boost_asio.indexterm.ssl__context_base.no_sslv3..no_sslv3..ssl::context_base] 
109450 Disable SSL v3. 
109451
109452
109453   static const long no_sslv3 = implementation_defined;
109454
109455
109456
109457 [endsect]
109458
109459
109460
109461 [section:no_tlsv1 ssl::context_base::no_tlsv1]
109462
109463 [indexterm2 boost_asio.indexterm.ssl__context_base.no_tlsv1..no_tlsv1..ssl::context_base] 
109464 Disable TLS v1. 
109465
109466
109467   static const long no_tlsv1 = implementation_defined;
109468
109469
109470
109471 [endsect]
109472
109473
109474
109475 [section:no_tlsv1_1 ssl::context_base::no_tlsv1_1]
109476
109477 [indexterm2 boost_asio.indexterm.ssl__context_base.no_tlsv1_1..no_tlsv1_1..ssl::context_base] 
109478 Disable TLS v1.1. 
109479
109480
109481   static const long no_tlsv1_1 = implementation_defined;
109482
109483
109484
109485 [endsect]
109486
109487
109488
109489 [section:no_tlsv1_2 ssl::context_base::no_tlsv1_2]
109490
109491 [indexterm2 boost_asio.indexterm.ssl__context_base.no_tlsv1_2..no_tlsv1_2..ssl::context_base] 
109492 Disable TLS v1.2. 
109493
109494
109495   static const long no_tlsv1_2 = implementation_defined;
109496
109497
109498
109499 [endsect]
109500
109501
109502
109503 [section:no_tlsv1_3 ssl::context_base::no_tlsv1_3]
109504
109505 [indexterm2 boost_asio.indexterm.ssl__context_base.no_tlsv1_3..no_tlsv1_3..ssl::context_base] 
109506 Disable TLS v1.3. 
109507
109508
109509   static const long no_tlsv1_3 = implementation_defined;
109510
109511
109512
109513 [endsect]
109514
109515
109516
109517 [section:options ssl::context_base::options]
109518
109519 [indexterm2 boost_asio.indexterm.ssl__context_base.options..options..ssl::context_base] 
109520 Bitmask type for SSL options. 
109521
109522
109523   typedef long options;
109524
109525
109526
109527 [heading Requirements]
109528
109529 ['Header: ][^boost/asio/ssl/context_base.hpp]
109530
109531 ['Convenience header: ][^boost/asio/ssl.hpp]
109532
109533
109534 [endsect]
109535
109536
109537
109538 [section:password_purpose ssl::context_base::password_purpose]
109539
109540 [indexterm2 boost_asio.indexterm.ssl__context_base.password_purpose..password_purpose..ssl::context_base] 
109541 Purpose of PEM password. 
109542
109543
109544   enum password_purpose
109545
109546 [indexterm2 boost_asio.indexterm.ssl__context_base.password_purpose.for_reading..for_reading..ssl::context_base]
109547 [indexterm2 boost_asio.indexterm.ssl__context_base.password_purpose.for_writing..for_writing..ssl::context_base]
109548
109549 [heading Values]
109550 [variablelist
109551
109552   [
109553     [for_reading]
109554     [The password is needed for reading/decryption. ]
109555   ]
109556
109557   [
109558     [for_writing]
109559     [The password is needed for writing/encryption. ]
109560   ]
109561
109562 ]
109563
109564
109565
109566 [endsect]
109567
109568
109569
109570 [section:single_dh_use ssl::context_base::single_dh_use]
109571
109572 [indexterm2 boost_asio.indexterm.ssl__context_base.single_dh_use..single_dh_use..ssl::context_base] 
109573 Always create a new key when using tmp\_dh parameters. 
109574
109575
109576   static const long single_dh_use = implementation_defined;
109577
109578
109579
109580 [endsect]
109581
109582
109583
109584 [section:_context_base ssl::context_base::~context_base]
109585
109586 [indexterm2 boost_asio.indexterm.ssl__context_base._context_base..~context_base..ssl::context_base] 
109587 Protected destructor to prevent deletion through this type. 
109588
109589
109590   ~context_base();
109591
109592
109593
109594 [endsect]
109595
109596
109597
109598 [endsect]
109599
109600
109601 [section:ssl__error__get_stream_category ssl::error::get_stream_category]
109602
109603 [indexterm1 boost_asio.indexterm.ssl__error__get_stream_category..ssl::error::get_stream_category] 
109604
109605   const boost::system::error_category & get_stream_category();
109606
109607
109608 [heading Requirements]
109609
109610 ['Header: ][^boost/asio/ssl/error.hpp]
109611
109612 ['Convenience header: ][^boost/asio/ssl.hpp]
109613
109614
109615 [endsect]
109616
109617
109618
109619 [section:ssl__error__make_error_code ssl::error::make_error_code]
109620
109621 [indexterm1 boost_asio.indexterm.ssl__error__make_error_code..ssl::error::make_error_code] 
109622
109623   boost::system::error_code make_error_code(
109624       stream_errors e);
109625
109626
109627 [heading Requirements]
109628
109629 ['Header: ][^boost/asio/ssl/error.hpp]
109630
109631 ['Convenience header: ][^boost/asio/ssl.hpp]
109632
109633
109634 [endsect]
109635
109636
109637
109638 [section:ssl__error__stream_category ssl::error::stream_category]
109639
109640 [indexterm1 boost_asio.indexterm.ssl__error__stream_category..ssl::error::stream_category] 
109641
109642   static const boost::system::error_category & stream_category = boost::asio::ssl::error::get_stream_category();
109643
109644
109645 [heading Requirements]
109646
109647 ['Header: ][^boost/asio/ssl/error.hpp]
109648
109649 ['Convenience header: ][^boost/asio/ssl.hpp]
109650
109651
109652 [endsect]
109653
109654
109655
109656 [section:ssl__error__stream_errors ssl::error::stream_errors]
109657
109658 [indexterm1 boost_asio.indexterm.ssl__error__stream_errors..ssl::error::stream_errors] 
109659
109660   enum stream_errors
109661
109662 [indexterm2 boost_asio.indexterm.ssl__error__stream_errors.stream_truncated..stream_truncated..ssl::error::stream_errors]
109663 [indexterm2 boost_asio.indexterm.ssl__error__stream_errors.unspecified_system_error..unspecified_system_error..ssl::error::stream_errors]
109664 [indexterm2 boost_asio.indexterm.ssl__error__stream_errors.unexpected_result..unexpected_result..ssl::error::stream_errors]
109665
109666 [heading Values]
109667 [variablelist
109668
109669   [
109670     [stream_truncated]
109671     [The underlying stream closed before the ssl stream gracefully shut down. ]
109672   ]
109673
109674   [
109675     [unspecified_system_error]
109676     [The underlying SSL library returned a system error without providing further information. ]
109677   ]
109678
109679   [
109680     [unexpected_result]
109681     [The underlying SSL library generated an unexpected result from a function call. ]
109682   ]
109683
109684 ]
109685
109686
109687 [heading Requirements]
109688
109689 ['Header: ][^boost/asio/ssl/error.hpp]
109690
109691 ['Convenience header: ][^boost/asio/ssl.hpp]
109692
109693
109694 [endsect]
109695
109696
109697 [section:ssl__rfc2818_verification ssl::rfc2818_verification]
109698
109699
109700 Verifies a certificate against a hostname according to the rules described in RFC 2818. 
109701
109702
109703   class rfc2818_verification
109704
109705
109706 [heading Types]
109707 [table
109708   [[Name][Description]]
109709
109710   [
109711
109712     [[link boost_asio.reference.ssl__rfc2818_verification.result_type [*result_type]]]
109713     [The type of the function object's result. ]
109714   
109715   ]
109716
109717 ]
109718
109719 [heading Member Functions]
109720 [table
109721   [[Name][Description]]
109722
109723   [
109724     [[link boost_asio.reference.ssl__rfc2818_verification.operator_lp__rp_ [*operator()]]]
109725     [Perform certificate verification. ]
109726   ]
109727   
109728   [
109729     [[link boost_asio.reference.ssl__rfc2818_verification.rfc2818_verification [*rfc2818_verification]]]
109730     [Constructor. ]
109731   ]
109732   
109733 ]
109734
109735
109736 [heading Example]
109737   
109738 The following example shows how to synchronously open a secure connection to a given host name: 
109739
109740    using boost::asio::ip::tcp;
109741    namespace ssl = boost::asio::ssl;
109742    typedef ssl::stream<tcp::socket> ssl_socket;
109743
109744    // Create a context that uses the default paths for finding CA certificates.
109745    ssl::context ctx(ssl::context::sslv23);
109746    ctx.set_default_verify_paths();
109747
109748    // Open a socket and connect it to the remote host.
109749    boost::asio::io_context io_context;
109750    ssl_socket sock(io_context, ctx);
109751    tcp::resolver resolver(io_context);
109752    tcp::resolver::query query("host.name", "https");
109753    boost::asio::connect(sock.lowest_layer(), resolver.resolve(query));
109754    sock.lowest_layer().set_option(tcp::no_delay(true));
109755
109756    // Perform SSL handshake and verify the remote host's certificate.
109757    sock.set_verify_mode(ssl::verify_peer);
109758    sock.set_verify_callback(ssl::rfc2818_verification("host.name"));
109759    sock.handshake(ssl_socket::client);
109760
109761    // ... read and write as normal ...
109762
109763
109764
109765
109766
109767
109768 [heading Requirements]
109769
109770 ['Header: ][^boost/asio/ssl/rfc2818_verification.hpp]
109771
109772 ['Convenience header: ][^boost/asio/ssl.hpp]
109773
109774
109775 [section:operator_lp__rp_ ssl::rfc2818_verification::operator()]
109776
109777 [indexterm2 boost_asio.indexterm.ssl__rfc2818_verification.operator_lp__rp_..operator()..ssl::rfc2818_verification] 
109778 Perform certificate verification. 
109779
109780
109781   bool operator()(
109782       bool preverified,
109783       verify_context & ctx) const;
109784
109785
109786
109787 [endsect]
109788
109789
109790
109791 [section:result_type ssl::rfc2818_verification::result_type]
109792
109793 [indexterm2 boost_asio.indexterm.ssl__rfc2818_verification.result_type..result_type..ssl::rfc2818_verification] 
109794 The type of the function object's result. 
109795
109796
109797   typedef bool result_type;
109798
109799
109800
109801 [heading Requirements]
109802
109803 ['Header: ][^boost/asio/ssl/rfc2818_verification.hpp]
109804
109805 ['Convenience header: ][^boost/asio/ssl.hpp]
109806
109807
109808 [endsect]
109809
109810
109811
109812 [section:rfc2818_verification ssl::rfc2818_verification::rfc2818_verification]
109813
109814 [indexterm2 boost_asio.indexterm.ssl__rfc2818_verification.rfc2818_verification..rfc2818_verification..ssl::rfc2818_verification] 
109815 Constructor. 
109816
109817
109818   rfc2818_verification(
109819       const std::string & host);
109820
109821
109822
109823 [endsect]
109824
109825
109826
109827 [endsect]
109828
109829 [section:ssl__stream ssl::stream]
109830
109831
109832 Provides stream-oriented functionality using SSL. 
109833
109834
109835   template<
109836       typename Stream>
109837   class stream :
109838     public ssl::stream_base,
109839     noncopyable
109840
109841
109842 [heading Types]
109843 [table
109844   [[Name][Description]]
109845
109846   [
109847
109848     [[link boost_asio.reference.ssl__stream__impl_struct [*impl_struct]]]
109849     [Structure for use with deprecated impl_type. ]
109850   
109851   ]
109852
109853   [
109854
109855     [[link boost_asio.reference.ssl__stream.executor_type [*executor_type]]]
109856     [The type of the executor associated with the object. ]
109857   
109858   ]
109859
109860   [
109861
109862     [[link boost_asio.reference.ssl__stream.handshake_type [*handshake_type]]]
109863     [Different handshake types. ]
109864   
109865   ]
109866
109867   [
109868
109869     [[link boost_asio.reference.ssl__stream.lowest_layer_type [*lowest_layer_type]]]
109870     [The type of the lowest layer. ]
109871   
109872   ]
109873
109874   [
109875
109876     [[link boost_asio.reference.ssl__stream.native_handle_type [*native_handle_type]]]
109877     [The native handle type of the SSL stream. ]
109878   
109879   ]
109880
109881   [
109882
109883     [[link boost_asio.reference.ssl__stream.next_layer_type [*next_layer_type]]]
109884     [The type of the next layer. ]
109885   
109886   ]
109887
109888 ]
109889
109890 [heading Member Functions]
109891 [table
109892   [[Name][Description]]
109893
109894   [
109895     [[link boost_asio.reference.ssl__stream.async_handshake [*async_handshake]]]
109896     [Start an asynchronous SSL handshake. ]
109897   ]
109898   
109899   [
109900     [[link boost_asio.reference.ssl__stream.async_read_some [*async_read_some]]]
109901     [Start an asynchronous read. ]
109902   ]
109903   
109904   [
109905     [[link boost_asio.reference.ssl__stream.async_shutdown [*async_shutdown]]]
109906     [Asynchronously shut down SSL on the stream. ]
109907   ]
109908   
109909   [
109910     [[link boost_asio.reference.ssl__stream.async_write_some [*async_write_some]]]
109911     [Start an asynchronous write. ]
109912   ]
109913   
109914   [
109915     [[link boost_asio.reference.ssl__stream.get_executor [*get_executor]]]
109916     [Get the executor associated with the object. ]
109917   ]
109918   
109919   [
109920     [[link boost_asio.reference.ssl__stream.handshake [*handshake]]]
109921     [Perform SSL handshaking. ]
109922   ]
109923   
109924   [
109925     [[link boost_asio.reference.ssl__stream.lowest_layer [*lowest_layer]]]
109926     [Get a reference to the lowest layer. ]
109927   ]
109928   
109929   [
109930     [[link boost_asio.reference.ssl__stream.native_handle [*native_handle]]]
109931     [Get the underlying implementation in the native type. ]
109932   ]
109933   
109934   [
109935     [[link boost_asio.reference.ssl__stream.next_layer [*next_layer]]]
109936     [Get a reference to the next layer. ]
109937   ]
109938   
109939   [
109940     [[link boost_asio.reference.ssl__stream.read_some [*read_some]]]
109941     [Read some data from the stream. ]
109942   ]
109943   
109944   [
109945     [[link boost_asio.reference.ssl__stream.set_verify_callback [*set_verify_callback]]]
109946     [Set the callback used to verify peer certificates. ]
109947   ]
109948   
109949   [
109950     [[link boost_asio.reference.ssl__stream.set_verify_depth [*set_verify_depth]]]
109951     [Set the peer verification depth. ]
109952   ]
109953   
109954   [
109955     [[link boost_asio.reference.ssl__stream.set_verify_mode [*set_verify_mode]]]
109956     [Set the peer verification mode. ]
109957   ]
109958   
109959   [
109960     [[link boost_asio.reference.ssl__stream.shutdown [*shutdown]]]
109961     [Shut down SSL on the stream. ]
109962   ]
109963   
109964   [
109965     [[link boost_asio.reference.ssl__stream.stream [*stream]]]
109966     [Construct a stream. ]
109967   ]
109968   
109969   [
109970     [[link boost_asio.reference.ssl__stream.write_some [*write_some]]]
109971     [Write some data to the stream. ]
109972   ]
109973   
109974   [
109975     [[link boost_asio.reference.ssl__stream._stream [*~stream]]]
109976     [Destructor. ]
109977   ]
109978   
109979 ]
109980
109981 The stream class template provides asynchronous and blocking stream-oriented functionality using SSL.
109982
109983
109984 [heading Thread Safety]
109985   
109986 ['Distinct] ['objects:] Safe.
109987
109988 ['Shared] ['objects:] Unsafe. The application must also ensure that all asynchronous operations are performed within the same implicit or explicit strand.
109989
109990
109991 [heading Example]
109992   
109993 To use the SSL stream template with an `ip::tcp::socket`, you would write: 
109994
109995    boost::asio::io_context my_context;
109996    boost::asio::ssl::context ctx(boost::asio::ssl::context::sslv23);
109997    boost::asio::ssl::stream<asio:ip::tcp::socket> sock(my_context, ctx);
109998
109999
110000
110001
110002
110003
110004
110005 [heading Requirements]
110006
110007 ['Header: ][^boost/asio/ssl/stream.hpp]
110008
110009 ['Convenience header: ][^boost/asio/ssl.hpp]
110010
110011 [section:async_handshake ssl::stream::async_handshake]
110012
110013 [indexterm2 boost_asio.indexterm.ssl__stream.async_handshake..async_handshake..ssl::stream] 
110014 Start an asynchronous SSL handshake. 
110015
110016
110017   template<
110018       typename ``[link boost_asio.reference.HandshakeHandler HandshakeHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
110019   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.ssl__stream.async_handshake.overload1 async_handshake]``(
110020       handshake_type type,
110021       HandshakeHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
110022   ``  [''''&raquo;''' [link boost_asio.reference.ssl__stream.async_handshake.overload1 more...]]``
110023
110024   template<
110025       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
110026       typename ``[link boost_asio.reference.BufferedHandshakeHandler BufferedHandshakeHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
110027   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.ssl__stream.async_handshake.overload2 async_handshake]``(
110028       handshake_type type,
110029       const ConstBufferSequence & buffers,
110030       BufferedHandshakeHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
110031   ``  [''''&raquo;''' [link boost_asio.reference.ssl__stream.async_handshake.overload2 more...]]``
110032
110033
110034 [section:overload1 ssl::stream::async_handshake (1 of 2 overloads)]
110035
110036
110037 Start an asynchronous SSL handshake. 
110038
110039
110040   template<
110041       typename ``[link boost_asio.reference.HandshakeHandler HandshakeHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
110042   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_handshake(
110043       handshake_type type,
110044       HandshakeHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
110045
110046
110047 This function is used to asynchronously perform an SSL handshake on the stream. This function call always returns immediately.
110048
110049
110050 [heading Parameters]
110051     
110052
110053 [variablelist
110054   
110055 [[type][The type of handshaking to be performed, i.e. as a client or as a server.]]
110056
110057 [[handler][The handler to be called when the handshake operation completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be: 
110058 ``
110059    void handler(
110060      const boost::system::error_code& error // Result of operation.
110061    ); 
110062 ``
110063 ]]
110064
110065 ]
110066
110067
110068
110069
110070 [endsect]
110071
110072
110073
110074 [section:overload2 ssl::stream::async_handshake (2 of 2 overloads)]
110075
110076
110077 Start an asynchronous SSL handshake. 
110078
110079
110080   template<
110081       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
110082       typename ``[link boost_asio.reference.BufferedHandshakeHandler BufferedHandshakeHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
110083   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_handshake(
110084       handshake_type type,
110085       const ConstBufferSequence & buffers,
110086       BufferedHandshakeHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
110087
110088
110089 This function is used to asynchronously perform an SSL handshake on the stream. This function call always returns immediately.
110090
110091
110092 [heading Parameters]
110093     
110094
110095 [variablelist
110096   
110097 [[type][The type of handshaking to be performed, i.e. as a client or as a server.]]
110098
110099 [[buffers][The buffered data to be reused for the handshake. Although the buffers object may be copied as necessary, ownership of the underlying buffers is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
110100
110101 [[handler][The handler to be called when the handshake operation completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be: 
110102 ``
110103    void handler(
110104      const boost::system::error_code& error, // Result of operation.
110105      std::size_t bytes_transferred // Amount of buffers used in handshake.
110106    ); 
110107 ``
110108 ]]
110109
110110 ]
110111
110112
110113
110114
110115 [endsect]
110116
110117
110118 [endsect]
110119
110120
110121 [section:async_read_some ssl::stream::async_read_some]
110122
110123 [indexterm2 boost_asio.indexterm.ssl__stream.async_read_some..async_read_some..ssl::stream] 
110124 Start an asynchronous read. 
110125
110126
110127   template<
110128       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
110129       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
110130   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_some(
110131       const MutableBufferSequence & buffers,
110132       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
110133
110134
110135 This function is used to asynchronously read one or more bytes of data from the stream. The function call always returns immediately.
110136
110137
110138 [heading Parameters]
110139     
110140
110141 [variablelist
110142   
110143 [[buffers][The buffers into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying buffers is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
110144
110145 [[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be: 
110146 ``
110147    void handler(
110148      const boost::system::error_code& error, // Result of operation.
110149      std::size_t bytes_transferred           // Number of bytes read.
110150    ); 
110151 ``
110152 ]]
110153
110154 ]
110155
110156
110157 [heading Remarks]
110158       
110159 The async\_read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.async_read `async_read`]  function if you need to ensure that the requested amount of data is read before the asynchronous operation completes. 
110160
110161
110162
110163
110164 [endsect]
110165
110166
110167
110168 [section:async_shutdown ssl::stream::async_shutdown]
110169
110170 [indexterm2 boost_asio.indexterm.ssl__stream.async_shutdown..async_shutdown..ssl::stream] 
110171 Asynchronously shut down SSL on the stream. 
110172
110173
110174   template<
110175       typename ``[link boost_asio.reference.ShutdownHandler ShutdownHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
110176   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_shutdown(
110177       ShutdownHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
110178
110179
110180 This function is used to asynchronously shut down SSL on the stream. This function call always returns immediately.
110181
110182
110183 [heading Parameters]
110184     
110185
110186 [variablelist
110187   
110188 [[handler][The handler to be called when the handshake operation completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be: 
110189 ``
110190    void handler(
110191      const boost::system::error_code& error // Result of operation.
110192    ); 
110193 ``
110194 ]]
110195
110196 ]
110197
110198
110199
110200
110201 [endsect]
110202
110203
110204
110205 [section:async_write_some ssl::stream::async_write_some]
110206
110207 [indexterm2 boost_asio.indexterm.ssl__stream.async_write_some..async_write_some..ssl::stream] 
110208 Start an asynchronous write. 
110209
110210
110211   template<
110212       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
110213       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
110214   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_some(
110215       const ConstBufferSequence & buffers,
110216       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
110217
110218
110219 This function is used to asynchronously write one or more bytes of data to the stream. The function call always returns immediately.
110220
110221
110222 [heading Parameters]
110223     
110224
110225 [variablelist
110226   
110227 [[buffers][The data to be written to the stream. Although the buffers object may be copied as necessary, ownership of the underlying buffers is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
110228
110229 [[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be: 
110230 ``
110231    void handler(
110232      const boost::system::error_code& error, // Result of operation.
110233      std::size_t bytes_transferred           // Number of bytes written.
110234    ); 
110235 ``
110236 ]]
110237
110238 ]
110239
110240
110241 [heading Remarks]
110242       
110243 The async\_write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.async_write `async_write`]  function if you need to ensure that all data is written before the asynchronous operation completes. 
110244
110245
110246
110247
110248 [endsect]
110249
110250
110251
110252 [section:executor_type ssl::stream::executor_type]
110253
110254 [indexterm2 boost_asio.indexterm.ssl__stream.executor_type..executor_type..ssl::stream] 
110255 The type of the executor associated with the object. 
110256
110257
110258   typedef lowest_layer_type::executor_type executor_type;
110259
110260
110261
110262 [heading Requirements]
110263
110264 ['Header: ][^boost/asio/ssl/stream.hpp]
110265
110266 ['Convenience header: ][^boost/asio/ssl.hpp]
110267
110268
110269 [endsect]
110270
110271
110272
110273 [section:get_executor ssl::stream::get_executor]
110274
110275 [indexterm2 boost_asio.indexterm.ssl__stream.get_executor..get_executor..ssl::stream] 
110276 Get the executor associated with the object. 
110277
110278
110279   executor_type get_executor();
110280
110281
110282 This function may be used to obtain the executor object that the stream uses to dispatch handlers for asynchronous operations.
110283
110284
110285 [heading Return Value]
110286       
110287 A copy of the executor that stream will use to dispatch handlers. 
110288
110289
110290
110291
110292 [endsect]
110293
110294
110295 [section:handshake ssl::stream::handshake]
110296
110297 [indexterm2 boost_asio.indexterm.ssl__stream.handshake..handshake..ssl::stream] 
110298 Perform SSL handshaking. 
110299
110300
110301   void ``[link boost_asio.reference.ssl__stream.handshake.overload1 handshake]``(
110302       handshake_type type);
110303   ``  [''''&raquo;''' [link boost_asio.reference.ssl__stream.handshake.overload1 more...]]``
110304
110305   void ``[link boost_asio.reference.ssl__stream.handshake.overload2 handshake]``(
110306       handshake_type type,
110307       boost::system::error_code & ec);
110308   ``  [''''&raquo;''' [link boost_asio.reference.ssl__stream.handshake.overload2 more...]]``
110309
110310   template<
110311       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
110312   void ``[link boost_asio.reference.ssl__stream.handshake.overload3 handshake]``(
110313       handshake_type type,
110314       const ConstBufferSequence & buffers);
110315   ``  [''''&raquo;''' [link boost_asio.reference.ssl__stream.handshake.overload3 more...]]``
110316
110317   template<
110318       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
110319   void ``[link boost_asio.reference.ssl__stream.handshake.overload4 handshake]``(
110320       handshake_type type,
110321       const ConstBufferSequence & buffers,
110322       boost::system::error_code & ec);
110323   ``  [''''&raquo;''' [link boost_asio.reference.ssl__stream.handshake.overload4 more...]]``
110324
110325
110326 [section:overload1 ssl::stream::handshake (1 of 4 overloads)]
110327
110328
110329 Perform SSL handshaking. 
110330
110331
110332   void handshake(
110333       handshake_type type);
110334
110335
110336 This function is used to perform SSL handshaking on the stream. The function call will block until handshaking is complete or an error occurs.
110337
110338
110339 [heading Parameters]
110340     
110341
110342 [variablelist
110343   
110344 [[type][The type of handshaking to be performed, i.e. as a client or as a server.]]
110345
110346 ]
110347
110348
110349 [heading Exceptions]
110350     
110351
110352 [variablelist
110353   
110354 [[boost::system::system_error][Thrown on failure. ]]
110355
110356 ]
110357
110358
110359
110360
110361 [endsect]
110362
110363
110364
110365 [section:overload2 ssl::stream::handshake (2 of 4 overloads)]
110366
110367
110368 Perform SSL handshaking. 
110369
110370
110371   void handshake(
110372       handshake_type type,
110373       boost::system::error_code & ec);
110374
110375
110376 This function is used to perform SSL handshaking on the stream. The function call will block until handshaking is complete or an error occurs.
110377
110378
110379 [heading Parameters]
110380     
110381
110382 [variablelist
110383   
110384 [[type][The type of handshaking to be performed, i.e. as a client or as a server.]]
110385
110386 [[ec][Set to indicate what error occurred, if any. ]]
110387
110388 ]
110389
110390
110391
110392
110393 [endsect]
110394
110395
110396
110397 [section:overload3 ssl::stream::handshake (3 of 4 overloads)]
110398
110399
110400 Perform SSL handshaking. 
110401
110402
110403   template<
110404       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
110405   void handshake(
110406       handshake_type type,
110407       const ConstBufferSequence & buffers);
110408
110409
110410 This function is used to perform SSL handshaking on the stream. The function call will block until handshaking is complete or an error occurs.
110411
110412
110413 [heading Parameters]
110414     
110415
110416 [variablelist
110417   
110418 [[type][The type of handshaking to be performed, i.e. as a client or as a server.]]
110419
110420 [[buffers][The buffered data to be reused for the handshake.]]
110421
110422 ]
110423
110424
110425 [heading Exceptions]
110426     
110427
110428 [variablelist
110429   
110430 [[boost::system::system_error][Thrown on failure. ]]
110431
110432 ]
110433
110434
110435
110436
110437 [endsect]
110438
110439
110440
110441 [section:overload4 ssl::stream::handshake (4 of 4 overloads)]
110442
110443
110444 Perform SSL handshaking. 
110445
110446
110447   template<
110448       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
110449   void handshake(
110450       handshake_type type,
110451       const ConstBufferSequence & buffers,
110452       boost::system::error_code & ec);
110453
110454
110455 This function is used to perform SSL handshaking on the stream. The function call will block until handshaking is complete or an error occurs.
110456
110457
110458 [heading Parameters]
110459     
110460
110461 [variablelist
110462   
110463 [[type][The type of handshaking to be performed, i.e. as a client or as a server.]]
110464
110465 [[buffers][The buffered data to be reused for the handshake.]]
110466
110467 [[ec][Set to indicate what error occurred, if any. ]]
110468
110469 ]
110470
110471
110472
110473
110474 [endsect]
110475
110476
110477 [endsect]
110478
110479
110480 [section:handshake_type ssl::stream::handshake_type]
110481
110482 [indexterm2 boost_asio.indexterm.ssl__stream.handshake_type..handshake_type..ssl::stream] 
110483 Different handshake types. 
110484
110485
110486   enum handshake_type
110487
110488 [indexterm2 boost_asio.indexterm.ssl__stream.handshake_type.client..client..ssl::stream]
110489 [indexterm2 boost_asio.indexterm.ssl__stream.handshake_type.server..server..ssl::stream]
110490
110491 [heading Values]
110492 [variablelist
110493
110494   [
110495     [client]
110496     [Perform handshaking as a client. ]
110497   ]
110498
110499   [
110500     [server]
110501     [Perform handshaking as a server. ]
110502   ]
110503
110504 ]
110505
110506
110507
110508 [endsect]
110509
110510
110511 [section:lowest_layer ssl::stream::lowest_layer]
110512
110513 [indexterm2 boost_asio.indexterm.ssl__stream.lowest_layer..lowest_layer..ssl::stream] 
110514 Get a reference to the lowest layer. 
110515
110516
110517   lowest_layer_type & ``[link boost_asio.reference.ssl__stream.lowest_layer.overload1 lowest_layer]``();
110518   ``  [''''&raquo;''' [link boost_asio.reference.ssl__stream.lowest_layer.overload1 more...]]``
110519
110520   const lowest_layer_type & ``[link boost_asio.reference.ssl__stream.lowest_layer.overload2 lowest_layer]``() const;
110521   ``  [''''&raquo;''' [link boost_asio.reference.ssl__stream.lowest_layer.overload2 more...]]``
110522
110523
110524 [section:overload1 ssl::stream::lowest_layer (1 of 2 overloads)]
110525
110526
110527 Get a reference to the lowest layer. 
110528
110529
110530   lowest_layer_type & lowest_layer();
110531
110532
110533 This function returns a reference to the lowest layer in a stack of stream layers.
110534
110535
110536 [heading Return Value]
110537       
110538 A reference to the lowest layer in the stack of stream layers. Ownership is not transferred to the caller. 
110539
110540
110541
110542
110543 [endsect]
110544
110545
110546
110547 [section:overload2 ssl::stream::lowest_layer (2 of 2 overloads)]
110548
110549
110550 Get a reference to the lowest layer. 
110551
110552
110553   const lowest_layer_type & lowest_layer() const;
110554
110555
110556 This function returns a reference to the lowest layer in a stack of stream layers.
110557
110558
110559 [heading Return Value]
110560       
110561 A reference to the lowest layer in the stack of stream layers. Ownership is not transferred to the caller. 
110562
110563
110564
110565
110566 [endsect]
110567
110568
110569 [endsect]
110570
110571
110572 [section:lowest_layer_type ssl::stream::lowest_layer_type]
110573
110574 [indexterm2 boost_asio.indexterm.ssl__stream.lowest_layer_type..lowest_layer_type..ssl::stream] 
110575 The type of the lowest layer. 
110576
110577
110578   typedef next_layer_type::lowest_layer_type lowest_layer_type;
110579
110580
110581
110582 [heading Requirements]
110583
110584 ['Header: ][^boost/asio/ssl/stream.hpp]
110585
110586 ['Convenience header: ][^boost/asio/ssl.hpp]
110587
110588
110589 [endsect]
110590
110591
110592
110593 [section:native_handle ssl::stream::native_handle]
110594
110595 [indexterm2 boost_asio.indexterm.ssl__stream.native_handle..native_handle..ssl::stream] 
110596 Get the underlying implementation in the native type. 
110597
110598
110599   native_handle_type native_handle();
110600
110601
110602 This function may be used to obtain the underlying implementation of the context. This is intended to allow access to context functionality that is not otherwise provided.
110603
110604
110605 [heading Example]
110606   
110607 The `native_handle()` function returns a pointer of type `SSL*` that is suitable for passing to functions such as `SSL_get_verify_result` and `SSL_get_peer_certificate:` 
110608
110609    boost::asio::ssl::stream<asio:ip::tcp::socket> sock(my_context, ctx);
110610
110611    // ... establish connection and perform handshake ...
110612
110613    if (X509* cert = SSL_get_peer_certificate(sock.native_handle()))
110614    {
110615      if (SSL_get_verify_result(sock.native_handle()) == X509_V_OK)
110616      {
110617        // ...
110618      }
110619    }
110620
110621
110622
110623
110624
110625
110626
110627 [endsect]
110628
110629
110630
110631 [section:native_handle_type ssl::stream::native_handle_type]
110632
110633 [indexterm2 boost_asio.indexterm.ssl__stream.native_handle_type..native_handle_type..ssl::stream] 
110634 The native handle type of the SSL stream. 
110635
110636
110637   typedef SSL * native_handle_type;
110638
110639
110640
110641 [heading Requirements]
110642
110643 ['Header: ][^boost/asio/ssl/stream.hpp]
110644
110645 ['Convenience header: ][^boost/asio/ssl.hpp]
110646
110647
110648 [endsect]
110649
110650
110651 [section:next_layer ssl::stream::next_layer]
110652
110653 [indexterm2 boost_asio.indexterm.ssl__stream.next_layer..next_layer..ssl::stream] 
110654 Get a reference to the next layer. 
110655
110656
110657   const next_layer_type & ``[link boost_asio.reference.ssl__stream.next_layer.overload1 next_layer]``() const;
110658   ``  [''''&raquo;''' [link boost_asio.reference.ssl__stream.next_layer.overload1 more...]]``
110659
110660   next_layer_type & ``[link boost_asio.reference.ssl__stream.next_layer.overload2 next_layer]``();
110661   ``  [''''&raquo;''' [link boost_asio.reference.ssl__stream.next_layer.overload2 more...]]``
110662
110663
110664 [section:overload1 ssl::stream::next_layer (1 of 2 overloads)]
110665
110666
110667 Get a reference to the next layer. 
110668
110669
110670   const next_layer_type & next_layer() const;
110671
110672
110673 This function returns a reference to the next layer in a stack of stream layers.
110674
110675
110676 [heading Return Value]
110677       
110678 A reference to the next layer in the stack of stream layers. Ownership is not transferred to the caller. 
110679
110680
110681
110682
110683 [endsect]
110684
110685
110686
110687 [section:overload2 ssl::stream::next_layer (2 of 2 overloads)]
110688
110689
110690 Get a reference to the next layer. 
110691
110692
110693   next_layer_type & next_layer();
110694
110695
110696 This function returns a reference to the next layer in a stack of stream layers.
110697
110698
110699 [heading Return Value]
110700       
110701 A reference to the next layer in the stack of stream layers. Ownership is not transferred to the caller. 
110702
110703
110704
110705
110706 [endsect]
110707
110708
110709 [endsect]
110710
110711
110712 [section:next_layer_type ssl::stream::next_layer_type]
110713
110714 [indexterm2 boost_asio.indexterm.ssl__stream.next_layer_type..next_layer_type..ssl::stream] 
110715 The type of the next layer. 
110716
110717
110718   typedef remove_reference< Stream >::type next_layer_type;
110719
110720
110721
110722 [heading Requirements]
110723
110724 ['Header: ][^boost/asio/ssl/stream.hpp]
110725
110726 ['Convenience header: ][^boost/asio/ssl.hpp]
110727
110728
110729 [endsect]
110730
110731
110732 [section:read_some ssl::stream::read_some]
110733
110734 [indexterm2 boost_asio.indexterm.ssl__stream.read_some..read_some..ssl::stream] 
110735 Read some data from the stream. 
110736
110737
110738   template<
110739       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
110740   std::size_t ``[link boost_asio.reference.ssl__stream.read_some.overload1 read_some]``(
110741       const MutableBufferSequence & buffers);
110742   ``  [''''&raquo;''' [link boost_asio.reference.ssl__stream.read_some.overload1 more...]]``
110743
110744   template<
110745       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
110746   std::size_t ``[link boost_asio.reference.ssl__stream.read_some.overload2 read_some]``(
110747       const MutableBufferSequence & buffers,
110748       boost::system::error_code & ec);
110749   ``  [''''&raquo;''' [link boost_asio.reference.ssl__stream.read_some.overload2 more...]]``
110750
110751
110752 [section:overload1 ssl::stream::read_some (1 of 2 overloads)]
110753
110754
110755 Read some data from the stream. 
110756
110757
110758   template<
110759       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
110760   std::size_t read_some(
110761       const MutableBufferSequence & buffers);
110762
110763
110764 This function is used to read data from the stream. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
110765
110766
110767 [heading Parameters]
110768     
110769
110770 [variablelist
110771   
110772 [[buffers][The buffers into which the data will be read.]]
110773
110774 ]
110775
110776
110777 [heading Return Value]
110778       
110779 The number of bytes read.
110780
110781
110782 [heading Exceptions]
110783     
110784
110785 [variablelist
110786   
110787 [[boost::system::system_error][Thrown on failure.]]
110788
110789 ]
110790
110791
110792 [heading Remarks]
110793       
110794 The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`]  function if you need to ensure that the requested amount of data is read before the blocking operation completes. 
110795
110796
110797
110798
110799 [endsect]
110800
110801
110802
110803 [section:overload2 ssl::stream::read_some (2 of 2 overloads)]
110804
110805
110806 Read some data from the stream. 
110807
110808
110809   template<
110810       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
110811   std::size_t read_some(
110812       const MutableBufferSequence & buffers,
110813       boost::system::error_code & ec);
110814
110815
110816 This function is used to read data from the stream. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
110817
110818
110819 [heading Parameters]
110820     
110821
110822 [variablelist
110823   
110824 [[buffers][The buffers into which the data will be read.]]
110825
110826 [[ec][Set to indicate what error occurred, if any.]]
110827
110828 ]
110829
110830
110831 [heading Return Value]
110832       
110833 The number of bytes read. Returns 0 if an error occurred.
110834
110835
110836 [heading Remarks]
110837       
110838 The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`]  function if you need to ensure that the requested amount of data is read before the blocking operation completes. 
110839
110840
110841
110842
110843 [endsect]
110844
110845
110846 [endsect]
110847
110848 [section:set_verify_callback ssl::stream::set_verify_callback]
110849
110850 [indexterm2 boost_asio.indexterm.ssl__stream.set_verify_callback..set_verify_callback..ssl::stream] 
110851 Set the callback used to verify peer certificates. 
110852
110853
110854   template<
110855       typename VerifyCallback>
110856   void ``[link boost_asio.reference.ssl__stream.set_verify_callback.overload1 set_verify_callback]``(
110857       VerifyCallback callback);
110858   ``  [''''&raquo;''' [link boost_asio.reference.ssl__stream.set_verify_callback.overload1 more...]]``
110859
110860   template<
110861       typename VerifyCallback>
110862   void ``[link boost_asio.reference.ssl__stream.set_verify_callback.overload2 set_verify_callback]``(
110863       VerifyCallback callback,
110864       boost::system::error_code & ec);
110865   ``  [''''&raquo;''' [link boost_asio.reference.ssl__stream.set_verify_callback.overload2 more...]]``
110866
110867
110868 [section:overload1 ssl::stream::set_verify_callback (1 of 2 overloads)]
110869
110870
110871 Set the callback used to verify peer certificates. 
110872
110873
110874   template<
110875       typename VerifyCallback>
110876   void set_verify_callback(
110877       VerifyCallback callback);
110878
110879
110880 This function is used to specify a callback function that will be called by the implementation when it needs to verify a peer certificate.
110881
110882
110883 [heading Parameters]
110884     
110885
110886 [variablelist
110887   
110888 [[callback][The function object to be used for verifying a certificate. The function signature of the handler must be: 
110889 ``
110890    bool verify_callback(
110891      bool preverified, // True if the certificate passed pre-verification.
110892      verify_context& ctx // The peer certificate and other context.
110893    ); 
110894 ``
110895 The return value of the callback is true if the certificate has passed verification, false otherwise.]]
110896
110897 ]
110898
110899
110900 [heading Exceptions]
110901     
110902
110903 [variablelist
110904   
110905 [[boost::system::system_error][Thrown on failure.]]
110906
110907 ]
110908
110909
110910 [heading Remarks]
110911       
110912 Calls `SSL_set_verify`. 
110913
110914
110915
110916
110917 [endsect]
110918
110919
110920
110921 [section:overload2 ssl::stream::set_verify_callback (2 of 2 overloads)]
110922
110923
110924 Set the callback used to verify peer certificates. 
110925
110926
110927   template<
110928       typename VerifyCallback>
110929   void set_verify_callback(
110930       VerifyCallback callback,
110931       boost::system::error_code & ec);
110932
110933
110934 This function is used to specify a callback function that will be called by the implementation when it needs to verify a peer certificate.
110935
110936
110937 [heading Parameters]
110938     
110939
110940 [variablelist
110941   
110942 [[callback][The function object to be used for verifying a certificate. The function signature of the handler must be: 
110943 ``
110944    bool verify_callback(
110945      bool preverified, // True if the certificate passed pre-verification.
110946      verify_context& ctx // The peer certificate and other context.
110947    ); 
110948 ``
110949 The return value of the callback is true if the certificate has passed verification, false otherwise.]]
110950
110951 [[ec][Set to indicate what error occurred, if any.]]
110952
110953 ]
110954
110955
110956 [heading Remarks]
110957       
110958 Calls `SSL_set_verify`. 
110959
110960
110961
110962
110963 [endsect]
110964
110965
110966 [endsect]
110967
110968 [section:set_verify_depth ssl::stream::set_verify_depth]
110969
110970 [indexterm2 boost_asio.indexterm.ssl__stream.set_verify_depth..set_verify_depth..ssl::stream] 
110971 Set the peer verification depth. 
110972
110973
110974   void ``[link boost_asio.reference.ssl__stream.set_verify_depth.overload1 set_verify_depth]``(
110975       int depth);
110976   ``  [''''&raquo;''' [link boost_asio.reference.ssl__stream.set_verify_depth.overload1 more...]]``
110977
110978   void ``[link boost_asio.reference.ssl__stream.set_verify_depth.overload2 set_verify_depth]``(
110979       int depth,
110980       boost::system::error_code & ec);
110981   ``  [''''&raquo;''' [link boost_asio.reference.ssl__stream.set_verify_depth.overload2 more...]]``
110982
110983
110984 [section:overload1 ssl::stream::set_verify_depth (1 of 2 overloads)]
110985
110986
110987 Set the peer verification depth. 
110988
110989
110990   void set_verify_depth(
110991       int depth);
110992
110993
110994 This function may be used to configure the maximum verification depth allowed by the stream.
110995
110996
110997 [heading Parameters]
110998     
110999
111000 [variablelist
111001   
111002 [[depth][Maximum depth for the certificate chain verification that shall be allowed.]]
111003
111004 ]
111005
111006
111007 [heading Exceptions]
111008     
111009
111010 [variablelist
111011   
111012 [[boost::system::system_error][Thrown on failure.]]
111013
111014 ]
111015
111016
111017 [heading Remarks]
111018       
111019 Calls `SSL_set_verify_depth`. 
111020
111021
111022
111023
111024 [endsect]
111025
111026
111027
111028 [section:overload2 ssl::stream::set_verify_depth (2 of 2 overloads)]
111029
111030
111031 Set the peer verification depth. 
111032
111033
111034   void set_verify_depth(
111035       int depth,
111036       boost::system::error_code & ec);
111037
111038
111039 This function may be used to configure the maximum verification depth allowed by the stream.
111040
111041
111042 [heading Parameters]
111043     
111044
111045 [variablelist
111046   
111047 [[depth][Maximum depth for the certificate chain verification that shall be allowed.]]
111048
111049 [[ec][Set to indicate what error occurred, if any.]]
111050
111051 ]
111052
111053
111054 [heading Remarks]
111055       
111056 Calls `SSL_set_verify_depth`. 
111057
111058
111059
111060
111061 [endsect]
111062
111063
111064 [endsect]
111065
111066 [section:set_verify_mode ssl::stream::set_verify_mode]
111067
111068 [indexterm2 boost_asio.indexterm.ssl__stream.set_verify_mode..set_verify_mode..ssl::stream] 
111069 Set the peer verification mode. 
111070
111071
111072   void ``[link boost_asio.reference.ssl__stream.set_verify_mode.overload1 set_verify_mode]``(
111073       verify_mode v);
111074   ``  [''''&raquo;''' [link boost_asio.reference.ssl__stream.set_verify_mode.overload1 more...]]``
111075
111076   void ``[link boost_asio.reference.ssl__stream.set_verify_mode.overload2 set_verify_mode]``(
111077       verify_mode v,
111078       boost::system::error_code & ec);
111079   ``  [''''&raquo;''' [link boost_asio.reference.ssl__stream.set_verify_mode.overload2 more...]]``
111080
111081
111082 [section:overload1 ssl::stream::set_verify_mode (1 of 2 overloads)]
111083
111084
111085 Set the peer verification mode. 
111086
111087
111088   void set_verify_mode(
111089       verify_mode v);
111090
111091
111092 This function may be used to configure the peer verification mode used by the stream. The new mode will override the mode inherited from the context.
111093
111094
111095 [heading Parameters]
111096     
111097
111098 [variablelist
111099   
111100 [[v][A bitmask of peer verification modes. See [link boost_asio.reference.ssl__verify_mode `ssl::verify_mode`]  for available values.]]
111101
111102 ]
111103
111104
111105 [heading Exceptions]
111106     
111107
111108 [variablelist
111109   
111110 [[boost::system::system_error][Thrown on failure.]]
111111
111112 ]
111113
111114
111115 [heading Remarks]
111116       
111117 Calls `SSL_set_verify`. 
111118
111119
111120
111121
111122 [endsect]
111123
111124
111125
111126 [section:overload2 ssl::stream::set_verify_mode (2 of 2 overloads)]
111127
111128
111129 Set the peer verification mode. 
111130
111131
111132   void set_verify_mode(
111133       verify_mode v,
111134       boost::system::error_code & ec);
111135
111136
111137 This function may be used to configure the peer verification mode used by the stream. The new mode will override the mode inherited from the context.
111138
111139
111140 [heading Parameters]
111141     
111142
111143 [variablelist
111144   
111145 [[v][A bitmask of peer verification modes. See [link boost_asio.reference.ssl__verify_mode `ssl::verify_mode`]  for available values.]]
111146
111147 [[ec][Set to indicate what error occurred, if any.]]
111148
111149 ]
111150
111151
111152 [heading Remarks]
111153       
111154 Calls `SSL_set_verify`. 
111155
111156
111157
111158
111159 [endsect]
111160
111161
111162 [endsect]
111163
111164 [section:shutdown ssl::stream::shutdown]
111165
111166 [indexterm2 boost_asio.indexterm.ssl__stream.shutdown..shutdown..ssl::stream] 
111167 Shut down SSL on the stream. 
111168
111169
111170   void ``[link boost_asio.reference.ssl__stream.shutdown.overload1 shutdown]``();
111171   ``  [''''&raquo;''' [link boost_asio.reference.ssl__stream.shutdown.overload1 more...]]``
111172
111173   void ``[link boost_asio.reference.ssl__stream.shutdown.overload2 shutdown]``(
111174       boost::system::error_code & ec);
111175   ``  [''''&raquo;''' [link boost_asio.reference.ssl__stream.shutdown.overload2 more...]]``
111176
111177
111178 [section:overload1 ssl::stream::shutdown (1 of 2 overloads)]
111179
111180
111181 Shut down SSL on the stream. 
111182
111183
111184   void shutdown();
111185
111186
111187 This function is used to shut down SSL on the stream. The function call will block until SSL has been shut down or an error occurs.
111188
111189
111190 [heading Exceptions]
111191     
111192
111193 [variablelist
111194   
111195 [[boost::system::system_error][Thrown on failure. ]]
111196
111197 ]
111198
111199
111200
111201
111202 [endsect]
111203
111204
111205
111206 [section:overload2 ssl::stream::shutdown (2 of 2 overloads)]
111207
111208
111209 Shut down SSL on the stream. 
111210
111211
111212   void shutdown(
111213       boost::system::error_code & ec);
111214
111215
111216 This function is used to shut down SSL on the stream. The function call will block until SSL has been shut down or an error occurs.
111217
111218
111219 [heading Parameters]
111220     
111221
111222 [variablelist
111223   
111224 [[ec][Set to indicate what error occurred, if any. ]]
111225
111226 ]
111227
111228
111229
111230
111231 [endsect]
111232
111233
111234 [endsect]
111235
111236
111237 [section:stream ssl::stream::stream]
111238
111239 [indexterm2 boost_asio.indexterm.ssl__stream.stream..stream..ssl::stream] 
111240 Construct a stream. 
111241
111242
111243   template<
111244       typename Arg>
111245   stream(
111246       Arg && arg,
111247       context & ctx);
111248
111249
111250 This constructor creates a stream and initialises the underlying stream object.
111251
111252
111253 [heading Parameters]
111254     
111255
111256 [variablelist
111257   
111258 [[arg][The argument to be passed to initialise the underlying stream.]]
111259
111260 [[ctx][The SSL context to be used for the stream. ]]
111261
111262 ]
111263
111264
111265
111266
111267 [endsect]
111268
111269
111270 [section:write_some ssl::stream::write_some]
111271
111272 [indexterm2 boost_asio.indexterm.ssl__stream.write_some..write_some..ssl::stream] 
111273 Write some data to the stream. 
111274
111275
111276   template<
111277       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
111278   std::size_t ``[link boost_asio.reference.ssl__stream.write_some.overload1 write_some]``(
111279       const ConstBufferSequence & buffers);
111280   ``  [''''&raquo;''' [link boost_asio.reference.ssl__stream.write_some.overload1 more...]]``
111281
111282   template<
111283       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
111284   std::size_t ``[link boost_asio.reference.ssl__stream.write_some.overload2 write_some]``(
111285       const ConstBufferSequence & buffers,
111286       boost::system::error_code & ec);
111287   ``  [''''&raquo;''' [link boost_asio.reference.ssl__stream.write_some.overload2 more...]]``
111288
111289
111290 [section:overload1 ssl::stream::write_some (1 of 2 overloads)]
111291
111292
111293 Write some data to the stream. 
111294
111295
111296   template<
111297       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
111298   std::size_t write_some(
111299       const ConstBufferSequence & buffers);
111300
111301
111302 This function is used to write data on the stream. The function call will block until one or more bytes of data has been written successfully, or until an error occurs.
111303
111304
111305 [heading Parameters]
111306     
111307
111308 [variablelist
111309   
111310 [[buffers][The data to be written.]]
111311
111312 ]
111313
111314
111315 [heading Return Value]
111316       
111317 The number of bytes written.
111318
111319
111320 [heading Exceptions]
111321     
111322
111323 [variablelist
111324   
111325 [[boost::system::system_error][Thrown on failure.]]
111326
111327 ]
111328
111329
111330 [heading Remarks]
111331       
111332 The write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`]  function if you need to ensure that all data is written before the blocking operation completes. 
111333
111334
111335
111336
111337 [endsect]
111338
111339
111340
111341 [section:overload2 ssl::stream::write_some (2 of 2 overloads)]
111342
111343
111344 Write some data to the stream. 
111345
111346
111347   template<
111348       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
111349   std::size_t write_some(
111350       const ConstBufferSequence & buffers,
111351       boost::system::error_code & ec);
111352
111353
111354 This function is used to write data on the stream. The function call will block until one or more bytes of data has been written successfully, or until an error occurs.
111355
111356
111357 [heading Parameters]
111358     
111359
111360 [variablelist
111361   
111362 [[buffers][The data to be written to the stream.]]
111363
111364 [[ec][Set to indicate what error occurred, if any.]]
111365
111366 ]
111367
111368
111369 [heading Return Value]
111370       
111371 The number of bytes written. Returns 0 if an error occurred.
111372
111373
111374 [heading Remarks]
111375       
111376 The write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`]  function if you need to ensure that all data is written before the blocking operation completes. 
111377
111378
111379
111380
111381 [endsect]
111382
111383
111384 [endsect]
111385
111386
111387 [section:_stream ssl::stream::~stream]
111388
111389 [indexterm2 boost_asio.indexterm.ssl__stream._stream..~stream..ssl::stream] 
111390 Destructor. 
111391
111392
111393   ~stream();
111394
111395
111396
111397 [heading Remarks]
111398       
111399 A `stream` object must not be destroyed while there are pending asynchronous operations associated with it. 
111400
111401
111402
111403
111404 [endsect]
111405
111406
111407
111408 [endsect]
111409
111410 [section:ssl__stream__impl_struct ssl::stream::impl_struct]
111411
111412
111413 Structure for use with deprecated impl\_type. 
111414
111415
111416   struct impl_struct
111417
111418
111419 [heading Data Members]
111420 [table
111421   [[Name][Description]]
111422
111423   [
111424     [[link boost_asio.reference.ssl__stream__impl_struct.ssl [*ssl]]]
111425     []
111426   ]
111427
111428 ]
111429
111430 [heading Requirements]
111431
111432 ['Header: ][^boost/asio/ssl/stream.hpp]
111433
111434 ['Convenience header: ][^boost/asio/ssl.hpp]
111435
111436
111437 [section:ssl ssl::stream::impl_struct::ssl]
111438
111439 [indexterm2 boost_asio.indexterm.ssl__stream__impl_struct.ssl..ssl..ssl::stream::impl_struct] 
111440
111441   SSL * ssl;
111442
111443
111444
111445 [endsect]
111446
111447
111448
111449 [endsect]
111450
111451 [section:ssl__stream_base ssl::stream_base]
111452
111453
111454 The [link boost_asio.reference.ssl__stream_base `ssl::stream_base`] class is used as a base for the [link boost_asio.reference.ssl__stream `ssl::stream`] class template so that we have a common place to define various enums. 
111455
111456
111457   class stream_base
111458
111459
111460 [heading Types]
111461 [table
111462   [[Name][Description]]
111463
111464   [
111465
111466     [[link boost_asio.reference.ssl__stream_base.handshake_type [*handshake_type]]]
111467     [Different handshake types. ]
111468   
111469   ]
111470
111471 ]
111472
111473 [heading Protected Member Functions]
111474 [table
111475   [[Name][Description]]
111476
111477   [
111478     [[link boost_asio.reference.ssl__stream_base._stream_base [*~stream_base]]]
111479     [Protected destructor to prevent deletion through this type. ]
111480   ]
111481   
111482 ]
111483
111484 [heading Requirements]
111485
111486 ['Header: ][^boost/asio/ssl/stream_base.hpp]
111487
111488 ['Convenience header: ][^boost/asio/ssl.hpp]
111489
111490
111491 [section:handshake_type ssl::stream_base::handshake_type]
111492
111493 [indexterm2 boost_asio.indexterm.ssl__stream_base.handshake_type..handshake_type..ssl::stream_base] 
111494 Different handshake types. 
111495
111496
111497   enum handshake_type
111498
111499 [indexterm2 boost_asio.indexterm.ssl__stream_base.handshake_type.client..client..ssl::stream_base]
111500 [indexterm2 boost_asio.indexterm.ssl__stream_base.handshake_type.server..server..ssl::stream_base]
111501
111502 [heading Values]
111503 [variablelist
111504
111505   [
111506     [client]
111507     [Perform handshaking as a client. ]
111508   ]
111509
111510   [
111511     [server]
111512     [Perform handshaking as a server. ]
111513   ]
111514
111515 ]
111516
111517
111518
111519 [endsect]
111520
111521
111522
111523 [section:_stream_base ssl::stream_base::~stream_base]
111524
111525 [indexterm2 boost_asio.indexterm.ssl__stream_base._stream_base..~stream_base..ssl::stream_base] 
111526 Protected destructor to prevent deletion through this type. 
111527
111528
111529   ~stream_base();
111530
111531
111532
111533 [endsect]
111534
111535
111536
111537 [endsect]
111538
111539
111540 [section:ssl__verify_client_once ssl::verify_client_once]
111541
111542 [indexterm1 boost_asio.indexterm.ssl__verify_client_once..ssl::verify_client_once] 
111543 Do not request client certificate on renegotiation. Ignored unless [link boost_asio.reference.ssl__verify_peer `ssl::verify_peer`]  is set. 
111544
111545
111546   const int verify_client_once = implementation_defined;
111547
111548
111549 [heading Requirements]
111550
111551 ['Header: ][^boost/asio/ssl/verify_mode.hpp]
111552
111553 ['Convenience header: ][^boost/asio/ssl.hpp]
111554
111555
111556 [endsect]
111557
111558
111559 [section:ssl__verify_context ssl::verify_context]
111560
111561
111562 A simple wrapper around the X509\_STORE\_CTX type, used during verification of a peer certificate. 
111563
111564
111565   class verify_context :
111566     noncopyable
111567
111568
111569 [heading Types]
111570 [table
111571   [[Name][Description]]
111572
111573   [
111574
111575     [[link boost_asio.reference.ssl__verify_context.native_handle_type [*native_handle_type]]]
111576     [The native handle type of the verification context. ]
111577   
111578   ]
111579
111580 ]
111581
111582 [heading Member Functions]
111583 [table
111584   [[Name][Description]]
111585
111586   [
111587     [[link boost_asio.reference.ssl__verify_context.native_handle [*native_handle]]]
111588     [Get the underlying implementation in the native type. ]
111589   ]
111590   
111591   [
111592     [[link boost_asio.reference.ssl__verify_context.verify_context [*verify_context]]]
111593     [Constructor. ]
111594   ]
111595   
111596 ]
111597
111598
111599 [heading Remarks]
111600       
111601 The [link boost_asio.reference.ssl__verify_context `ssl::verify_context`] does not own the underlying X509\_STORE\_CTX object. 
111602
111603
111604
111605 [heading Requirements]
111606
111607 ['Header: ][^boost/asio/ssl/verify_context.hpp]
111608
111609 ['Convenience header: ][^boost/asio/ssl.hpp]
111610
111611
111612 [section:native_handle ssl::verify_context::native_handle]
111613
111614 [indexterm2 boost_asio.indexterm.ssl__verify_context.native_handle..native_handle..ssl::verify_context] 
111615 Get the underlying implementation in the native type. 
111616
111617
111618   native_handle_type native_handle();
111619
111620
111621 This function may be used to obtain the underlying implementation of the context. This is intended to allow access to context functionality that is not otherwise provided. 
111622
111623
111624 [endsect]
111625
111626
111627
111628 [section:native_handle_type ssl::verify_context::native_handle_type]
111629
111630 [indexterm2 boost_asio.indexterm.ssl__verify_context.native_handle_type..native_handle_type..ssl::verify_context] 
111631 The native handle type of the verification context. 
111632
111633
111634   typedef X509_STORE_CTX * native_handle_type;
111635
111636
111637
111638 [heading Requirements]
111639
111640 ['Header: ][^boost/asio/ssl/verify_context.hpp]
111641
111642 ['Convenience header: ][^boost/asio/ssl.hpp]
111643
111644
111645 [endsect]
111646
111647
111648
111649 [section:verify_context ssl::verify_context::verify_context]
111650
111651 [indexterm2 boost_asio.indexterm.ssl__verify_context.verify_context..verify_context..ssl::verify_context] 
111652 Constructor. 
111653
111654
111655   verify_context(
111656       native_handle_type handle);
111657
111658
111659
111660 [endsect]
111661
111662
111663
111664 [endsect]
111665
111666
111667 [section:ssl__verify_fail_if_no_peer_cert ssl::verify_fail_if_no_peer_cert]
111668
111669 [indexterm1 boost_asio.indexterm.ssl__verify_fail_if_no_peer_cert..ssl::verify_fail_if_no_peer_cert] 
111670 Fail verification if the peer has no certificate. Ignored unless [link boost_asio.reference.ssl__verify_peer `ssl::verify_peer`]  is set. 
111671
111672
111673   const int verify_fail_if_no_peer_cert = implementation_defined;
111674
111675
111676 [heading Requirements]
111677
111678 ['Header: ][^boost/asio/ssl/verify_mode.hpp]
111679
111680 ['Convenience header: ][^boost/asio/ssl.hpp]
111681
111682
111683 [endsect]
111684
111685
111686
111687 [section:ssl__verify_mode ssl::verify_mode]
111688
111689 [indexterm1 boost_asio.indexterm.ssl__verify_mode..ssl::verify_mode] 
111690 Bitmask type for peer verification. 
111691
111692
111693   typedef int verify_mode;
111694
111695
111696
111697 Possible values are:
111698
111699
111700 * [link boost_asio.reference.ssl__verify_none `ssl::verify_none`]  
111701
111702 * [link boost_asio.reference.ssl__verify_peer `ssl::verify_peer`]  
111703
111704 * [link boost_asio.reference.ssl__verify_fail_if_no_peer_cert `ssl::verify_fail_if_no_peer_cert`]  
111705
111706 * [link boost_asio.reference.ssl__verify_client_once `ssl::verify_client_once`]  
111707
111708
111709
111710 [heading Requirements]
111711
111712 ['Header: ][^boost/asio/ssl/verify_mode.hpp]
111713
111714 ['Convenience header: ][^boost/asio/ssl.hpp]
111715
111716
111717 [endsect]
111718
111719
111720
111721 [section:ssl__verify_none ssl::verify_none]
111722
111723 [indexterm1 boost_asio.indexterm.ssl__verify_none..ssl::verify_none] 
111724 No verification. 
111725
111726
111727   const int verify_none = implementation_defined;
111728
111729
111730 [heading Requirements]
111731
111732 ['Header: ][^boost/asio/ssl/verify_mode.hpp]
111733
111734 ['Convenience header: ][^boost/asio/ssl.hpp]
111735
111736
111737 [endsect]
111738
111739
111740
111741 [section:ssl__verify_peer ssl::verify_peer]
111742
111743 [indexterm1 boost_asio.indexterm.ssl__verify_peer..ssl::verify_peer] 
111744 Verify the peer. 
111745
111746
111747   const int verify_peer = implementation_defined;
111748
111749
111750 [heading Requirements]
111751
111752 ['Header: ][^boost/asio/ssl/verify_mode.hpp]
111753
111754 ['Convenience header: ][^boost/asio/ssl.hpp]
111755
111756
111757 [endsect]
111758
111759
111760
111761 [section:steady_timer steady_timer]
111762
111763 [indexterm1 boost_asio.indexterm.steady_timer..steady_timer] 
111764 Typedef for a timer based on the steady clock. 
111765
111766
111767   typedef basic_waitable_timer< chrono::steady_clock > steady_timer;
111768
111769
111770 [heading Types]
111771 [table
111772   [[Name][Description]]
111773
111774   [
111775
111776     [[link boost_asio.reference.basic_waitable_timer__rebind_executor [*rebind_executor]]]
111777     [Rebinds the timer type to another executor. ]
111778   
111779   ]
111780
111781   [
111782
111783     [[link boost_asio.reference.basic_waitable_timer.clock_type [*clock_type]]]
111784     [The clock type. ]
111785   
111786   ]
111787
111788   [
111789
111790     [[link boost_asio.reference.basic_waitable_timer.duration [*duration]]]
111791     [The duration type of the clock. ]
111792   
111793   ]
111794
111795   [
111796
111797     [[link boost_asio.reference.basic_waitable_timer.executor_type [*executor_type]]]
111798     [The type of the executor associated with the object. ]
111799   
111800   ]
111801
111802   [
111803
111804     [[link boost_asio.reference.basic_waitable_timer.time_point [*time_point]]]
111805     [The time point type of the clock. ]
111806   
111807   ]
111808
111809   [
111810
111811     [[link boost_asio.reference.basic_waitable_timer.traits_type [*traits_type]]]
111812     [The wait traits type. ]
111813   
111814   ]
111815
111816 ]
111817
111818 [heading Member Functions]
111819 [table
111820   [[Name][Description]]
111821
111822   [
111823     [[link boost_asio.reference.basic_waitable_timer.async_wait [*async_wait]]]
111824     [Start an asynchronous wait on the timer. ]
111825   ]
111826   
111827   [
111828     [[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer [*basic_waitable_timer]]]
111829     [Constructor. 
111830      [hr]
111831      Constructor to set a particular expiry time as an absolute time. 
111832      [hr]
111833      Constructor to set a particular expiry time relative to now. 
111834      [hr]
111835      Move-construct a basic_waitable_timer from another. ]
111836   ]
111837   
111838   [
111839     [[link boost_asio.reference.basic_waitable_timer.cancel [*cancel]]]
111840     [Cancel any asynchronous operations that are waiting on the timer. 
111841      [hr]
111842      (Deprecated: Use non-error_code overload.) Cancel any asynchronous operations that are waiting on the timer. ]
111843   ]
111844   
111845   [
111846     [[link boost_asio.reference.basic_waitable_timer.cancel_one [*cancel_one]]]
111847     [Cancels one asynchronous operation that is waiting on the timer. 
111848      [hr]
111849      (Deprecated: Use non-error_code overload.) Cancels one asynchronous operation that is waiting on the timer. ]
111850   ]
111851   
111852   [
111853     [[link boost_asio.reference.basic_waitable_timer.expires_after [*expires_after]]]
111854     [Set the timer's expiry time relative to now. ]
111855   ]
111856   
111857   [
111858     [[link boost_asio.reference.basic_waitable_timer.expires_at [*expires_at]]]
111859     [(Deprecated: Use expiry().) Get the timer's expiry time as an absolute time. 
111860      [hr]
111861      Set the timer's expiry time as an absolute time. 
111862      [hr]
111863      (Deprecated: Use non-error_code overload.) Set the timer's expiry time as an absolute time. ]
111864   ]
111865   
111866   [
111867     [[link boost_asio.reference.basic_waitable_timer.expires_from_now [*expires_from_now]]]
111868     [(Deprecated: Use expiry().) Get the timer's expiry time relative to now. 
111869      [hr]
111870      (Deprecated: Use expires_after().) Set the timer's expiry time relative to now. ]
111871   ]
111872   
111873   [
111874     [[link boost_asio.reference.basic_waitable_timer.expiry [*expiry]]]
111875     [Get the timer's expiry time as an absolute time. ]
111876   ]
111877   
111878   [
111879     [[link boost_asio.reference.basic_waitable_timer.get_executor [*get_executor]]]
111880     [Get the executor associated with the object. ]
111881   ]
111882   
111883   [
111884     [[link boost_asio.reference.basic_waitable_timer.operator_eq_ [*operator=]]]
111885     [Move-assign a basic_waitable_timer from another. ]
111886   ]
111887   
111888   [
111889     [[link boost_asio.reference.basic_waitable_timer.wait [*wait]]]
111890     [Perform a blocking wait on the timer. ]
111891   ]
111892   
111893   [
111894     [[link boost_asio.reference.basic_waitable_timer._basic_waitable_timer [*~basic_waitable_timer]]]
111895     [Destroys the timer. ]
111896   ]
111897   
111898 ]
111899
111900 The [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] class template provides the ability to perform a blocking or asynchronous wait for a timer to expire.
111901
111902 A waitable timer is always in one of two states: "expired" or "not expired". If the `wait()` or `async_wait()` function is called on an expired timer, the wait operation will complete immediately.
111903
111904 Most applications will use one of the [link boost_asio.reference.steady_timer `steady_timer`], [link boost_asio.reference.system_timer `system_timer`] or [link boost_asio.reference.high_resolution_timer `high_resolution_timer`] typedefs.
111905
111906
111907 [heading Remarks]
111908       
111909 This waitable timer functionality is for use with the C++11 standard library's `<chrono>` facility, or with the Boost.Chrono library.
111910
111911
111912 [heading Thread Safety]
111913   
111914 ['Distinct] ['objects:] Safe.
111915
111916 ['Shared] ['objects:] Unsafe.
111917
111918
111919 [heading Examples]
111920   
111921 Performing a blocking wait (C++11): 
111922
111923    // Construct a timer without setting an expiry time.
111924    boost::asio::steady_timer timer(my_context);
111925
111926    // Set an expiry time relative to now.
111927    timer.expires_after(std::chrono::seconds(5));
111928
111929    // Wait for the timer to expire.
111930    timer.wait();
111931
111932
111933
111934
111935
111936 Performing an asynchronous wait (C++11): 
111937
111938    void handler(const boost::system::error_code& error)
111939    {
111940      if (!error)
111941      {
111942        // Timer expired.
111943      }
111944    }
111945
111946    ...
111947
111948    // Construct a timer with an absolute expiry time.
111949    boost::asio::steady_timer timer(my_context,
111950        std::chrono::steady_clock::now() + std::chrono::seconds(60));
111951
111952    // Start an asynchronous wait.
111953    timer.async_wait(handler);
111954
111955
111956
111957
111958
111959 [heading Changing an active waitable timer's expiry time]
111960   
111961
111962
111963 Changing the expiry time of a timer while there are pending asynchronous waits causes those wait operations to be cancelled. To ensure that the action associated with the timer is performed only once, use something like this: used:
111964
111965
111966
111967    void on_some_event()
111968    {
111969      if (my_timer.expires_after(seconds(5)) > 0)
111970      {
111971        // We managed to cancel the timer. Start new asynchronous wait.
111972        my_timer.async_wait(on_timeout);
111973      }
111974      else
111975      {
111976        // Too late, timer has already expired!
111977      }
111978    }
111979
111980    void on_timeout(const boost::system::error_code& e)
111981    {
111982      if (e != boost::asio::error::operation_aborted)
111983      {
111984        // Timer was not cancelled, take necessary action.
111985      }
111986    }
111987
111988
111989
111990
111991
111992 * The `boost::asio::basic_waitable_timer::expires_after()` function cancels any pending asynchronous waits, and returns the number of asynchronous waits that were cancelled. If it returns 0 then you were too late and the wait handler has already been executed, or will soon be executed. If it returns 1 then the wait handler was successfully cancelled.
111993
111994
111995 * If a wait handler is cancelled, the boost::system::error\_code passed to it contains the value `boost::asio::error::operation_aborted`. 
111996
111997
111998
111999
112000 This typedef uses the C++11 `<chrono>` standard library facility, if available. Otherwise, it may use the Boost.Chrono library. To explicitly utilise Boost.Chrono, use the [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] template directly: 
112001
112002    typedef basic_waitable_timer<boost::chrono::steady_clock> timer;
112003
112004
112005
112006
112007 [heading Requirements]
112008
112009 ['Header: ][^boost/asio/steady_timer.hpp]
112010
112011 ['Convenience header: ][^boost/asio.hpp]
112012
112013
112014 [endsect]
112015
112016
112017 [section:strand strand]
112018
112019
112020 Provides serialised function invocation for any executor type. 
112021
112022
112023   template<
112024       typename ``[link boost_asio.reference.Executor1 Executor]``>
112025   class strand
112026
112027
112028 [heading Types]
112029 [table
112030   [[Name][Description]]
112031
112032   [
112033
112034     [[link boost_asio.reference.strand.inner_executor_type [*inner_executor_type]]]
112035     [The type of the underlying executor. ]
112036   
112037   ]
112038
112039 ]
112040
112041 [heading Member Functions]
112042 [table
112043   [[Name][Description]]
112044
112045   [
112046     [[link boost_asio.reference.strand.context [*context]]]
112047     [Obtain the underlying execution context. ]
112048   ]
112049   
112050   [
112051     [[link boost_asio.reference.strand.defer [*defer]]]
112052     [Request the strand to invoke the given function object. ]
112053   ]
112054   
112055   [
112056     [[link boost_asio.reference.strand.dispatch [*dispatch]]]
112057     [Request the strand to invoke the given function object. ]
112058   ]
112059   
112060   [
112061     [[link boost_asio.reference.strand.get_inner_executor [*get_inner_executor]]]
112062     [Obtain the underlying executor. ]
112063   ]
112064   
112065   [
112066     [[link boost_asio.reference.strand.on_work_finished [*on_work_finished]]]
112067     [Inform the strand that some work is no longer outstanding. ]
112068   ]
112069   
112070   [
112071     [[link boost_asio.reference.strand.on_work_started [*on_work_started]]]
112072     [Inform the strand that it has some outstanding work to do. ]
112073   ]
112074   
112075   [
112076     [[link boost_asio.reference.strand.operator_eq_ [*operator=]]]
112077     [Assignment operator. 
112078      [hr]
112079      Converting assignment operator. 
112080      [hr]
112081      Move assignment operator. 
112082      [hr]
112083      Converting move assignment operator. ]
112084   ]
112085   
112086   [
112087     [[link boost_asio.reference.strand.post [*post]]]
112088     [Request the strand to invoke the given function object. ]
112089   ]
112090   
112091   [
112092     [[link boost_asio.reference.strand.running_in_this_thread [*running_in_this_thread]]]
112093     [Determine whether the strand is running in the current thread. ]
112094   ]
112095   
112096   [
112097     [[link boost_asio.reference.strand.strand [*strand]]]
112098     [Default constructor. 
112099      [hr]
112100      Construct a strand for the specified executor. 
112101      [hr]
112102      Copy constructor. 
112103      [hr]
112104      Converting constructor. 
112105      [hr]
112106      Move constructor. 
112107      [hr]
112108      Converting move constructor. ]
112109   ]
112110   
112111   [
112112     [[link boost_asio.reference.strand._strand [*~strand]]]
112113     [Destructor. ]
112114   ]
112115   
112116 ]
112117
112118 [heading Friends]
112119 [table
112120   [[Name][Description]]
112121
112122   [
112123     [[link boost_asio.reference.strand.operator_not__eq_ [*operator!=]]]
112124     [Compare two strands for inequality. ]
112125   ]
112126   
112127   [
112128     [[link boost_asio.reference.strand.operator_eq__eq_ [*operator==]]]
112129     [Compare two strands for equality. ]
112130   ]
112131   
112132 ]
112133
112134 [heading Requirements]
112135
112136 ['Header: ][^boost/asio/strand.hpp]
112137
112138 ['Convenience header: ][^boost/asio.hpp]
112139
112140
112141 [section:context strand::context]
112142
112143 [indexterm2 boost_asio.indexterm.strand.context..context..strand] 
112144 Obtain the underlying execution context. 
112145
112146
112147   execution_context & context() const;
112148
112149
112150
112151 [endsect]
112152
112153
112154
112155 [section:defer strand::defer]
112156
112157 [indexterm2 boost_asio.indexterm.strand.defer..defer..strand] 
112158 Request the strand to invoke the given function object. 
112159
112160
112161   template<
112162       typename Function,
112163       typename Allocator>
112164   void defer(
112165       Function && f,
112166       const Allocator & a) const;
112167
112168
112169 This function is used to ask the executor to execute the given function object. The function object will never be executed inside this function. Instead, it will be scheduled by the underlying executor's defer function.
112170
112171
112172 [heading Parameters]
112173     
112174
112175 [variablelist
112176   
112177 [[f][The function object to be called. The executor will make a copy of the handler object as required. The function signature of the function object must be:
112178 ``
112179    void function(); 
112180 ``
112181 ]]
112182
112183 [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
112184
112185 ]
112186
112187
112188
112189
112190 [endsect]
112191
112192
112193
112194 [section:dispatch strand::dispatch]
112195
112196 [indexterm2 boost_asio.indexterm.strand.dispatch..dispatch..strand] 
112197 Request the strand to invoke the given function object. 
112198
112199
112200   template<
112201       typename Function,
112202       typename Allocator>
112203   void dispatch(
112204       Function && f,
112205       const Allocator & a) const;
112206
112207
112208 This function is used to ask the strand to execute the given function object on its underlying executor. The function object will be executed inside this function if the strand is not otherwise busy and if the underlying executor's `dispatch()` function is also able to execute the function before returning.
112209
112210
112211 [heading Parameters]
112212     
112213
112214 [variablelist
112215   
112216 [[f][The function object to be called. The executor will make a copy of the handler object as required. The function signature of the function object must be:
112217 ``
112218    void function(); 
112219 ``
112220 ]]
112221
112222 [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
112223
112224 ]
112225
112226
112227
112228
112229 [endsect]
112230
112231
112232
112233 [section:get_inner_executor strand::get_inner_executor]
112234
112235 [indexterm2 boost_asio.indexterm.strand.get_inner_executor..get_inner_executor..strand] 
112236 Obtain the underlying executor. 
112237
112238
112239   inner_executor_type get_inner_executor() const;
112240
112241
112242
112243 [endsect]
112244
112245
112246
112247 [section:inner_executor_type strand::inner_executor_type]
112248
112249 [indexterm2 boost_asio.indexterm.strand.inner_executor_type..inner_executor_type..strand] 
112250 The type of the underlying executor. 
112251
112252
112253   typedef Executor inner_executor_type;
112254
112255
112256
112257 [heading Requirements]
112258
112259 ['Header: ][^boost/asio/strand.hpp]
112260
112261 ['Convenience header: ][^boost/asio.hpp]
112262
112263
112264 [endsect]
112265
112266
112267
112268 [section:on_work_finished strand::on_work_finished]
112269
112270 [indexterm2 boost_asio.indexterm.strand.on_work_finished..on_work_finished..strand] 
112271 Inform the strand that some work is no longer outstanding. 
112272
112273
112274   void on_work_finished() const;
112275
112276
112277 The strand delegates this call to its underlying executor. 
112278
112279
112280 [endsect]
112281
112282
112283
112284 [section:on_work_started strand::on_work_started]
112285
112286 [indexterm2 boost_asio.indexterm.strand.on_work_started..on_work_started..strand] 
112287 Inform the strand that it has some outstanding work to do. 
112288
112289
112290   void on_work_started() const;
112291
112292
112293 The strand delegates this call to its underlying executor. 
112294
112295
112296 [endsect]
112297
112298
112299
112300 [section:operator_not__eq_ strand::operator!=]
112301
112302 [indexterm2 boost_asio.indexterm.strand.operator_not__eq_..operator!=..strand] 
112303 Compare two strands for inequality. 
112304
112305
112306   friend bool operator!=(
112307       const strand & a,
112308       const strand & b);
112309
112310
112311 Two strands are equal if they refer to the same ordered, non-concurrent state. 
112312
112313 [heading Requirements]
112314
112315 ['Header: ][^boost/asio/strand.hpp]
112316
112317 ['Convenience header: ][^boost/asio.hpp]
112318
112319
112320 [endsect]
112321
112322
112323 [section:operator_eq_ strand::operator=]
112324
112325 [indexterm2 boost_asio.indexterm.strand.operator_eq_..operator=..strand] 
112326 Assignment operator. 
112327
112328
112329   strand & ``[link boost_asio.reference.strand.operator_eq_.overload1 operator=]``(
112330       const strand & other);
112331   ``  [''''&raquo;''' [link boost_asio.reference.strand.operator_eq_.overload1 more...]]``
112332
112333
112334 Converting assignment operator. 
112335
112336
112337   template<
112338       class ``[link boost_asio.reference.Executor1 OtherExecutor]``>
112339   strand & ``[link boost_asio.reference.strand.operator_eq_.overload2 operator=]``(
112340       const strand< OtherExecutor > & other);
112341   ``  [''''&raquo;''' [link boost_asio.reference.strand.operator_eq_.overload2 more...]]``
112342
112343
112344 Move assignment operator. 
112345
112346
112347   strand & ``[link boost_asio.reference.strand.operator_eq_.overload3 operator=]``(
112348       strand && other);
112349   ``  [''''&raquo;''' [link boost_asio.reference.strand.operator_eq_.overload3 more...]]``
112350
112351
112352 Converting move assignment operator. 
112353
112354
112355   template<
112356       class ``[link boost_asio.reference.Executor1 OtherExecutor]``>
112357   strand & ``[link boost_asio.reference.strand.operator_eq_.overload4 operator=]``(
112358       const strand< OtherExecutor > && other);
112359   ``  [''''&raquo;''' [link boost_asio.reference.strand.operator_eq_.overload4 more...]]``
112360
112361
112362 [section:overload1 strand::operator= (1 of 4 overloads)]
112363
112364
112365 Assignment operator. 
112366
112367
112368   strand & operator=(
112369       const strand & other);
112370
112371
112372
112373 [endsect]
112374
112375
112376
112377 [section:overload2 strand::operator= (2 of 4 overloads)]
112378
112379
112380 Converting assignment operator. 
112381
112382
112383   template<
112384       class ``[link boost_asio.reference.Executor1 OtherExecutor]``>
112385   strand & operator=(
112386       const strand< OtherExecutor > & other);
112387
112388
112389 This assignment operator is only valid if the `OtherExecutor` type is convertible to `Executor`. 
112390
112391
112392 [endsect]
112393
112394
112395
112396 [section:overload3 strand::operator= (3 of 4 overloads)]
112397
112398
112399 Move assignment operator. 
112400
112401
112402   strand & operator=(
112403       strand && other);
112404
112405
112406
112407 [endsect]
112408
112409
112410
112411 [section:overload4 strand::operator= (4 of 4 overloads)]
112412
112413
112414 Converting move assignment operator. 
112415
112416
112417   template<
112418       class ``[link boost_asio.reference.Executor1 OtherExecutor]``>
112419   strand & operator=(
112420       const strand< OtherExecutor > && other);
112421
112422
112423 This assignment operator is only valid if the `OtherExecutor` type is convertible to `Executor`. 
112424
112425
112426 [endsect]
112427
112428
112429 [endsect]
112430
112431
112432 [section:operator_eq__eq_ strand::operator==]
112433
112434 [indexterm2 boost_asio.indexterm.strand.operator_eq__eq_..operator==..strand] 
112435 Compare two strands for equality. 
112436
112437
112438   friend bool operator==(
112439       const strand & a,
112440       const strand & b);
112441
112442
112443 Two strands are equal if they refer to the same ordered, non-concurrent state. 
112444
112445 [heading Requirements]
112446
112447 ['Header: ][^boost/asio/strand.hpp]
112448
112449 ['Convenience header: ][^boost/asio.hpp]
112450
112451
112452 [endsect]
112453
112454
112455
112456 [section:post strand::post]
112457
112458 [indexterm2 boost_asio.indexterm.strand.post..post..strand] 
112459 Request the strand to invoke the given function object. 
112460
112461
112462   template<
112463       typename Function,
112464       typename Allocator>
112465   void post(
112466       Function && f,
112467       const Allocator & a) const;
112468
112469
112470 This function is used to ask the executor to execute the given function object. The function object will never be executed inside this function. Instead, it will be scheduled by the underlying executor's defer function.
112471
112472
112473 [heading Parameters]
112474     
112475
112476 [variablelist
112477   
112478 [[f][The function object to be called. The executor will make a copy of the handler object as required. The function signature of the function object must be:
112479 ``
112480    void function(); 
112481 ``
112482 ]]
112483
112484 [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
112485
112486 ]
112487
112488
112489
112490
112491 [endsect]
112492
112493
112494
112495 [section:running_in_this_thread strand::running_in_this_thread]
112496
112497 [indexterm2 boost_asio.indexterm.strand.running_in_this_thread..running_in_this_thread..strand] 
112498 Determine whether the strand is running in the current thread. 
112499
112500
112501   bool running_in_this_thread() const;
112502
112503
112504
112505 [heading Return Value]
112506       
112507 `true` if the current thread is executing a function that was submitted to the strand using `post()`, `dispatch()` or `defer()`. Otherwise returns `false`. 
112508
112509
112510
112511
112512 [endsect]
112513
112514
112515 [section:strand strand::strand]
112516
112517 [indexterm2 boost_asio.indexterm.strand.strand..strand..strand] 
112518 Default constructor. 
112519
112520
112521   ``[link boost_asio.reference.strand.strand.overload1 strand]``();
112522   ``  [''''&raquo;''' [link boost_asio.reference.strand.strand.overload1 more...]]``
112523
112524
112525 Construct a strand for the specified executor. 
112526
112527
112528   explicit ``[link boost_asio.reference.strand.strand.overload2 strand]``(
112529       const Executor & e);
112530   ``  [''''&raquo;''' [link boost_asio.reference.strand.strand.overload2 more...]]``
112531
112532
112533 Copy constructor. 
112534
112535
112536   ``[link boost_asio.reference.strand.strand.overload3 strand]``(
112537       const strand & other);
112538   ``  [''''&raquo;''' [link boost_asio.reference.strand.strand.overload3 more...]]``
112539
112540
112541 Converting constructor. 
112542
112543
112544   template<
112545       class ``[link boost_asio.reference.Executor1 OtherExecutor]``>
112546   ``[link boost_asio.reference.strand.strand.overload4 strand]``(
112547       const strand< OtherExecutor > & other);
112548   ``  [''''&raquo;''' [link boost_asio.reference.strand.strand.overload4 more...]]``
112549
112550
112551 Move constructor. 
112552
112553
112554   ``[link boost_asio.reference.strand.strand.overload5 strand]``(
112555       strand && other);
112556   ``  [''''&raquo;''' [link boost_asio.reference.strand.strand.overload5 more...]]``
112557
112558
112559 Converting move constructor. 
112560
112561
112562   template<
112563       class ``[link boost_asio.reference.Executor1 OtherExecutor]``>
112564   ``[link boost_asio.reference.strand.strand.overload6 strand]``(
112565       strand< OtherExecutor > && other);
112566   ``  [''''&raquo;''' [link boost_asio.reference.strand.strand.overload6 more...]]``
112567
112568
112569 [section:overload1 strand::strand (1 of 6 overloads)]
112570
112571
112572 Default constructor. 
112573
112574
112575   strand();
112576
112577
112578 This constructor is only valid if the underlying executor type is default constructible. 
112579
112580
112581 [endsect]
112582
112583
112584
112585 [section:overload2 strand::strand (2 of 6 overloads)]
112586
112587
112588 Construct a strand for the specified executor. 
112589
112590
112591   strand(
112592       const Executor & e);
112593
112594
112595
112596 [endsect]
112597
112598
112599
112600 [section:overload3 strand::strand (3 of 6 overloads)]
112601
112602
112603 Copy constructor. 
112604
112605
112606   strand(
112607       const strand & other);
112608
112609
112610
112611 [endsect]
112612
112613
112614
112615 [section:overload4 strand::strand (4 of 6 overloads)]
112616
112617
112618 Converting constructor. 
112619
112620
112621   template<
112622       class ``[link boost_asio.reference.Executor1 OtherExecutor]``>
112623   strand(
112624       const strand< OtherExecutor > & other);
112625
112626
112627 This constructor is only valid if the `OtherExecutor` type is convertible to `Executor`. 
112628
112629
112630 [endsect]
112631
112632
112633
112634 [section:overload5 strand::strand (5 of 6 overloads)]
112635
112636
112637 Move constructor. 
112638
112639
112640   strand(
112641       strand && other);
112642
112643
112644
112645 [endsect]
112646
112647
112648
112649 [section:overload6 strand::strand (6 of 6 overloads)]
112650
112651
112652 Converting move constructor. 
112653
112654
112655   template<
112656       class ``[link boost_asio.reference.Executor1 OtherExecutor]``>
112657   strand(
112658       strand< OtherExecutor > && other);
112659
112660
112661 This constructor is only valid if the `OtherExecutor` type is convertible to `Executor`. 
112662
112663
112664 [endsect]
112665
112666
112667 [endsect]
112668
112669
112670 [section:_strand strand::~strand]
112671
112672 [indexterm2 boost_asio.indexterm.strand._strand..~strand..strand] 
112673 Destructor. 
112674
112675
112676   ~strand();
112677
112678
112679
112680 [endsect]
112681
112682
112683
112684 [endsect]
112685
112686
112687 [section:streambuf streambuf]
112688
112689 [indexterm1 boost_asio.indexterm.streambuf..streambuf] 
112690 Typedef for the typical usage of [link boost_asio.reference.basic_streambuf `basic_streambuf`]. 
112691
112692
112693   typedef basic_streambuf streambuf;
112694
112695
112696 [heading Types]
112697 [table
112698   [[Name][Description]]
112699
112700   [
112701
112702     [[link boost_asio.reference.basic_streambuf.const_buffers_type [*const_buffers_type]]]
112703     [The type used to represent the input sequence as a list of buffers. ]
112704   
112705   ]
112706
112707   [
112708
112709     [[link boost_asio.reference.basic_streambuf.mutable_buffers_type [*mutable_buffers_type]]]
112710     [The type used to represent the output sequence as a list of buffers. ]
112711   
112712   ]
112713
112714 ]
112715
112716 [heading Member Functions]
112717 [table
112718   [[Name][Description]]
112719
112720   [
112721     [[link boost_asio.reference.basic_streambuf.basic_streambuf [*basic_streambuf]]]
112722     [Construct a basic_streambuf object. ]
112723   ]
112724   
112725   [
112726     [[link boost_asio.reference.basic_streambuf.capacity [*capacity]]]
112727     [Get the current capacity of the basic_streambuf. ]
112728   ]
112729   
112730   [
112731     [[link boost_asio.reference.basic_streambuf.commit [*commit]]]
112732     [Move characters from the output sequence to the input sequence. ]
112733   ]
112734   
112735   [
112736     [[link boost_asio.reference.basic_streambuf.consume [*consume]]]
112737     [Remove characters from the input sequence. ]
112738   ]
112739   
112740   [
112741     [[link boost_asio.reference.basic_streambuf.data [*data]]]
112742     [Get a list of buffers that represents the input sequence. ]
112743   ]
112744   
112745   [
112746     [[link boost_asio.reference.basic_streambuf.max_size [*max_size]]]
112747     [Get the maximum size of the basic_streambuf. ]
112748   ]
112749   
112750   [
112751     [[link boost_asio.reference.basic_streambuf.prepare [*prepare]]]
112752     [Get a list of buffers that represents the output sequence, with the given size. ]
112753   ]
112754   
112755   [
112756     [[link boost_asio.reference.basic_streambuf.size [*size]]]
112757     [Get the size of the input sequence. ]
112758   ]
112759   
112760 ]
112761
112762 [heading Protected Member Functions]
112763 [table
112764   [[Name][Description]]
112765
112766   [
112767     [[link boost_asio.reference.basic_streambuf.overflow [*overflow]]]
112768     [Override std::streambuf behaviour. ]
112769   ]
112770   
112771   [
112772     [[link boost_asio.reference.basic_streambuf.reserve [*reserve]]]
112773     []
112774   ]
112775   
112776   [
112777     [[link boost_asio.reference.basic_streambuf.underflow [*underflow]]]
112778     [Override std::streambuf behaviour. ]
112779   ]
112780   
112781 ]
112782
112783 The `basic_streambuf` class is derived from `std::streambuf` to associate the streambuf's input and output sequences with one or more character arrays. These character arrays are internal to the `basic_streambuf` object, but direct access to the array elements is provided to permit them to be used efficiently with I/O operations. Characters written to the output sequence of a `basic_streambuf` object are appended to the input sequence of the same object.
112784
112785 The `basic_streambuf` class's public interface is intended to permit the following implementation strategies:
112786
112787
112788 * A single contiguous character array, which is reallocated as necessary to accommodate changes in the size of the character sequence. This is the implementation approach currently used in Asio.
112789
112790
112791 * A sequence of one or more character arrays, where each array is of the same size. Additional character array objects are appended to the sequence to accommodate changes in the size of the character sequence.
112792
112793
112794 * A sequence of one or more character arrays of varying sizes. Additional character array objects are appended to the sequence to accommodate changes in the size of the character sequence.
112795
112796 The constructor for [link boost_asio.reference.basic_streambuf `basic_streambuf`] accepts a `size_t` argument specifying the maximum of the sum of the sizes of the input sequence and output sequence. During the lifetime of the `basic_streambuf` object, the following invariant holds: 
112797
112798    size() <= max_size()
112799
112800
112801 Any member function that would, if successful, cause the invariant to be violated shall throw an exception of class `std::length_error`.
112802
112803 The constructor for `basic_streambuf` takes an Allocator argument. A copy of this argument is used for any memory allocation performed, by the constructor and by all member functions, during the lifetime of each `basic_streambuf` object.
112804
112805
112806 [heading Examples]
112807   
112808 Writing directly from an streambuf to a socket: 
112809
112810    boost::asio::streambuf b;
112811    std::ostream os(&b);
112812    os << "Hello, World!\n";
112813
112814    // try sending some data in input sequence
112815    size_t n = sock.send(b.data());
112816
112817    b.consume(n); // sent data is removed from input sequence
112818
112819
112820
112821
112822 Reading from a socket directly into a streambuf: 
112823
112824    boost::asio::streambuf b;
112825
112826    // reserve 512 bytes in output sequence
112827    boost::asio::streambuf::mutable_buffers_type bufs = b.prepare(512);
112828
112829    size_t n = sock.receive(bufs);
112830
112831    // received data is "committed" from output sequence to input sequence
112832    b.commit(n);
112833
112834    std::istream is(&b);
112835    std::string s;
112836    is >> s;
112837
112838
112839
112840
112841
112842 [heading Requirements]
112843
112844 ['Header: ][^boost/asio/streambuf.hpp]
112845
112846 ['Convenience header: ][^boost/asio.hpp]
112847
112848
112849 [endsect]
112850
112851
112852 [section:system_context system_context]
112853
112854
112855 The executor context for the system executor. 
112856
112857
112858   class system_context :
112859     public execution_context
112860
112861
112862 [heading Types]
112863 [table
112864   [[Name][Description]]
112865
112866   [
112867
112868     [[link boost_asio.reference.system_context.executor_type [*executor_type]]]
112869     [The executor type associated with the context. ]
112870   
112871   ]
112872
112873   [
112874
112875     [[link boost_asio.reference.system_context.fork_event [*fork_event]]]
112876     [Fork-related event notifications. ]
112877   
112878   ]
112879
112880 ]
112881
112882 [heading Member Functions]
112883 [table
112884   [[Name][Description]]
112885
112886   [
112887     [[link boost_asio.reference.system_context.get_executor [*get_executor]]]
112888     [Obtain an executor for the context. ]
112889   ]
112890   
112891   [
112892     [[link boost_asio.reference.system_context.join [*join]]]
112893     [Join all threads in the system thread pool. ]
112894   ]
112895   
112896   [
112897     [[link boost_asio.reference.system_context.notify_fork [*notify_fork]]]
112898     [Notify the execution_context of a fork-related event. ]
112899   ]
112900   
112901   [
112902     [[link boost_asio.reference.system_context.stop [*stop]]]
112903     [Signal all threads in the system thread pool to stop. ]
112904   ]
112905   
112906   [
112907     [[link boost_asio.reference.system_context.stopped [*stopped]]]
112908     [Determine whether the system thread pool has been stopped. ]
112909   ]
112910   
112911   [
112912     [[link boost_asio.reference.system_context._system_context [*~system_context]]]
112913     [Destructor shuts down all threads in the system thread pool. ]
112914   ]
112915   
112916 ]
112917
112918 [heading Protected Member Functions]
112919 [table
112920   [[Name][Description]]
112921
112922   [
112923     [[link boost_asio.reference.system_context.destroy [*destroy]]]
112924     [Destroys all services in the context. ]
112925   ]
112926   
112927   [
112928     [[link boost_asio.reference.system_context.shutdown [*shutdown]]]
112929     [Shuts down all services in the context. ]
112930   ]
112931   
112932 ]
112933
112934 [heading Friends]
112935 [table
112936   [[Name][Description]]
112937
112938   [
112939     [[link boost_asio.reference.system_context.add_service [*add_service]]]
112940     [(Deprecated: Use make_service().) Add a service object to the execution_context. ]
112941   ]
112942   
112943   [
112944     [[link boost_asio.reference.system_context.has_service [*has_service]]]
112945     [Determine if an execution_context contains a specified service type. ]
112946   ]
112947   
112948   [
112949     [[link boost_asio.reference.system_context.make_service [*make_service]]]
112950     [Creates a service object and adds it to the execution_context. ]
112951   ]
112952   
112953   [
112954     [[link boost_asio.reference.system_context.use_service [*use_service]]]
112955     [Obtain the service object corresponding to the given type. ]
112956   ]
112957   
112958 ]
112959
112960 [heading Requirements]
112961
112962 ['Header: ][^boost/asio/system_context.hpp]
112963
112964 ['Convenience header: ][^boost/asio.hpp]
112965
112966
112967 [section:add_service system_context::add_service]
112968
112969
112970 ['Inherited from execution_context.]
112971
112972 [indexterm2 boost_asio.indexterm.system_context.add_service..add_service..system_context] 
112973 (Deprecated: Use `make_service()`.) Add a service object to the [link boost_asio.reference.execution_context `execution_context`]. 
112974
112975
112976   template<
112977       typename ``[link boost_asio.reference.Service Service]``>
112978   friend void add_service(
112979       execution_context & e,
112980       Service * svc);
112981
112982
112983 This function is used to add a service to the [link boost_asio.reference.execution_context `execution_context`].
112984
112985
112986 [heading Parameters]
112987     
112988
112989 [variablelist
112990   
112991 [[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]]
112992
112993 [[svc][The service object. On success, ownership of the service object is transferred to the [link boost_asio.reference.execution_context `execution_context`]. When the [link boost_asio.reference.execution_context `execution_context`] object is destroyed, it will destroy the service object by performing:
112994 ``
112995    delete static_cast<execution_context::service*>(svc) 
112996 ``
112997 ]]
112998
112999 ]
113000
113001
113002 [heading Exceptions]
113003     
113004
113005 [variablelist
113006   
113007 [[boost::asio::service_already_exists][Thrown if a service of the given type is already present in the [link boost_asio.reference.execution_context `execution_context`].]]
113008
113009 [[boost::asio::invalid_service_owner][Thrown if the service's owning [link boost_asio.reference.execution_context `execution_context`] is not the [link boost_asio.reference.execution_context `execution_context`] object specified by the `e` parameter. ]]
113010
113011 ]
113012
113013
113014
113015 [heading Requirements]
113016
113017 ['Header: ][^boost/asio/system_context.hpp]
113018
113019 ['Convenience header: ][^boost/asio.hpp]
113020
113021
113022 [endsect]
113023
113024
113025
113026 [section:destroy system_context::destroy]
113027
113028
113029 ['Inherited from execution_context.]
113030
113031 [indexterm2 boost_asio.indexterm.system_context.destroy..destroy..system_context] 
113032 Destroys all services in the context. 
113033
113034
113035   void destroy();
113036
113037
113038 This function is implemented as follows:
113039
113040
113041 * For each service object `svc` in the [link boost_asio.reference.execution_context `execution_context`] set, in reverse order * of the beginning of service object lifetime, performs `delete static_cast<execution_context::service*>(svc)`. 
113042
113043
113044
113045
113046 [endsect]
113047
113048
113049
113050 [section:executor_type system_context::executor_type]
113051
113052 [indexterm2 boost_asio.indexterm.system_context.executor_type..executor_type..system_context] 
113053 The executor type associated with the context. 
113054
113055
113056   typedef system_executor executor_type;
113057
113058
113059 [heading Member Functions]
113060 [table
113061   [[Name][Description]]
113062
113063   [
113064     [[link boost_asio.reference.system_executor.context [*context]]]
113065     [Obtain the underlying execution context. ]
113066   ]
113067   
113068   [
113069     [[link boost_asio.reference.system_executor.defer [*defer]]]
113070     [Request the system executor to invoke the given function object. ]
113071   ]
113072   
113073   [
113074     [[link boost_asio.reference.system_executor.dispatch [*dispatch]]]
113075     [Request the system executor to invoke the given function object. ]
113076   ]
113077   
113078   [
113079     [[link boost_asio.reference.system_executor.on_work_finished [*on_work_finished]]]
113080     [Inform the executor that some work is no longer outstanding. ]
113081   ]
113082   
113083   [
113084     [[link boost_asio.reference.system_executor.on_work_started [*on_work_started]]]
113085     [Inform the executor that it has some outstanding work to do. ]
113086   ]
113087   
113088   [
113089     [[link boost_asio.reference.system_executor.post [*post]]]
113090     [Request the system executor to invoke the given function object. ]
113091   ]
113092   
113093 ]
113094
113095 [heading Friends]
113096 [table
113097   [[Name][Description]]
113098
113099   [
113100     [[link boost_asio.reference.system_executor.operator_not__eq_ [*operator!=]]]
113101     [Compare two executors for inequality. ]
113102   ]
113103   
113104   [
113105     [[link boost_asio.reference.system_executor.operator_eq__eq_ [*operator==]]]
113106     [Compare two executors for equality. ]
113107   ]
113108   
113109 ]
113110
113111 The system executor represents an execution context where functions are permitted to run on arbitrary threads. The `post()` and `defer()` functions schedule the function to run on an unspecified system thread pool, and `dispatch()` invokes the function immediately. 
113112
113113
113114 [heading Requirements]
113115
113116 ['Header: ][^boost/asio/system_context.hpp]
113117
113118 ['Convenience header: ][^boost/asio.hpp]
113119
113120
113121 [endsect]
113122
113123
113124
113125 [section:fork_event system_context::fork_event]
113126
113127
113128 ['Inherited from execution_context.]
113129
113130 [indexterm2 boost_asio.indexterm.system_context.fork_event..fork_event..system_context] 
113131 Fork-related event notifications. 
113132
113133
113134   enum fork_event
113135
113136 [indexterm2 boost_asio.indexterm.system_context.fork_event.fork_prepare..fork_prepare..system_context]
113137 [indexterm2 boost_asio.indexterm.system_context.fork_event.fork_parent..fork_parent..system_context]
113138 [indexterm2 boost_asio.indexterm.system_context.fork_event.fork_child..fork_child..system_context]
113139
113140 [heading Values]
113141 [variablelist
113142
113143   [
113144     [fork_prepare]
113145     [Notify the context that the process is about to fork. ]
113146   ]
113147
113148   [
113149     [fork_parent]
113150     [Notify the context that the process has forked and is the parent. ]
113151   ]
113152
113153   [
113154     [fork_child]
113155     [Notify the context that the process has forked and is the child. ]
113156   ]
113157
113158 ]
113159
113160
113161
113162 [endsect]
113163
113164
113165
113166 [section:get_executor system_context::get_executor]
113167
113168 [indexterm2 boost_asio.indexterm.system_context.get_executor..get_executor..system_context] 
113169 Obtain an executor for the context. 
113170
113171
113172   executor_type get_executor();
113173
113174
113175
113176 [endsect]
113177
113178
113179
113180 [section:has_service system_context::has_service]
113181
113182
113183 ['Inherited from execution_context.]
113184
113185 [indexterm2 boost_asio.indexterm.system_context.has_service..has_service..system_context] 
113186 Determine if an [link boost_asio.reference.execution_context `execution_context`] contains a specified service type. 
113187
113188
113189   template<
113190       typename ``[link boost_asio.reference.Service Service]``>
113191   friend bool has_service(
113192       execution_context & e);
113193
113194
113195 This function is used to determine whether the [link boost_asio.reference.execution_context `execution_context`] contains a service object corresponding to the given service type.
113196
113197
113198 [heading Parameters]
113199     
113200
113201 [variablelist
113202   
113203 [[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]]
113204
113205 ]
113206
113207
113208 [heading Return Value]
113209       
113210 A boolean indicating whether the [link boost_asio.reference.execution_context `execution_context`] contains the service. 
113211
113212
113213
113214 [heading Requirements]
113215
113216 ['Header: ][^boost/asio/system_context.hpp]
113217
113218 ['Convenience header: ][^boost/asio.hpp]
113219
113220
113221 [endsect]
113222
113223
113224
113225 [section:join system_context::join]
113226
113227 [indexterm2 boost_asio.indexterm.system_context.join..join..system_context] 
113228 Join all threads in the system thread pool. 
113229
113230
113231   void join();
113232
113233
113234
113235 [endsect]
113236
113237
113238
113239 [section:make_service system_context::make_service]
113240
113241
113242 ['Inherited from execution_context.]
113243
113244 [indexterm2 boost_asio.indexterm.system_context.make_service..make_service..system_context] 
113245 Creates a service object and adds it to the [link boost_asio.reference.execution_context `execution_context`]. 
113246
113247
113248   template<
113249       typename ``[link boost_asio.reference.Service Service]``,
113250       typename... Args>
113251   friend Service & make_service(
113252       execution_context & e,
113253       Args &&... args);
113254
113255
113256 This function is used to add a service to the [link boost_asio.reference.execution_context `execution_context`].
113257
113258
113259 [heading Parameters]
113260     
113261
113262 [variablelist
113263   
113264 [[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]]
113265
113266 [[args][Zero or more arguments to be passed to the service constructor.]]
113267
113268 ]
113269
113270
113271 [heading Exceptions]
113272     
113273
113274 [variablelist
113275   
113276 [[boost::asio::service_already_exists][Thrown if a service of the given type is already present in the [link boost_asio.reference.execution_context `execution_context`]. ]]
113277
113278 ]
113279
113280
113281
113282 [heading Requirements]
113283
113284 ['Header: ][^boost/asio/system_context.hpp]
113285
113286 ['Convenience header: ][^boost/asio.hpp]
113287
113288
113289 [endsect]
113290
113291
113292
113293 [section:notify_fork system_context::notify_fork]
113294
113295
113296 ['Inherited from execution_context.]
113297
113298 [indexterm2 boost_asio.indexterm.system_context.notify_fork..notify_fork..system_context] 
113299 Notify the [link boost_asio.reference.execution_context `execution_context`] of a fork-related event. 
113300
113301
113302   void notify_fork(
113303       fork_event event);
113304
113305
113306 This function is used to inform the [link boost_asio.reference.execution_context `execution_context`] that the process is about to fork, or has just forked. This allows the [link boost_asio.reference.execution_context `execution_context`], and the services it contains, to perform any necessary housekeeping to ensure correct operation following a fork.
113307
113308 This function must not be called while any other [link boost_asio.reference.execution_context `execution_context`] function, or any function associated with the execution\_context's derived class, is being called in another thread. It is, however, safe to call this function from within a completion handler, provided no other thread is accessing the [link boost_asio.reference.execution_context `execution_context`] or its derived class.
113309
113310
113311 [heading Parameters]
113312     
113313
113314 [variablelist
113315   
113316 [[event][A fork-related event.]]
113317
113318 ]
113319
113320
113321 [heading Exceptions]
113322     
113323
113324 [variablelist
113325   
113326 [[boost::system::system_error][Thrown on failure. If the notification fails the [link boost_asio.reference.execution_context `execution_context`] object should no longer be used and should be destroyed.]]
113327
113328 ]
113329
113330
113331 [heading Example]
113332   
113333 The following code illustrates how to incorporate the `notify_fork()` function: 
113334
113335    my_execution_context.notify_fork(execution_context::fork_prepare);
113336    if (fork() == 0)
113337    {
113338      // This is the child process.
113339      my_execution_context.notify_fork(execution_context::fork_child);
113340    }
113341    else
113342    {
113343      // This is the parent process.
113344      my_execution_context.notify_fork(execution_context::fork_parent);
113345    } 
113346
113347
113348
113349
113350
113351 [heading Remarks]
113352       
113353 For each service object `svc` in the [link boost_asio.reference.execution_context `execution_context`] set, performs `svc->notify_fork();`. When processing the fork\_prepare event, services are visited in reverse order of the beginning of service object lifetime. Otherwise, services are visited in order of the beginning of service object lifetime. 
113354
113355
113356
113357
113358 [endsect]
113359
113360
113361
113362 [section:shutdown system_context::shutdown]
113363
113364
113365 ['Inherited from execution_context.]
113366
113367 [indexterm2 boost_asio.indexterm.system_context.shutdown..shutdown..system_context] 
113368 Shuts down all services in the context. 
113369
113370
113371   void shutdown();
113372
113373
113374 This function is implemented as follows:
113375
113376
113377 * For each service object `svc` in the [link boost_asio.reference.execution_context `execution_context`] set, in reverse order of the beginning of service object lifetime, performs `svc->shutdown()`. 
113378
113379
113380
113381
113382 [endsect]
113383
113384
113385
113386 [section:stop system_context::stop]
113387
113388 [indexterm2 boost_asio.indexterm.system_context.stop..stop..system_context] 
113389 Signal all threads in the system thread pool to stop. 
113390
113391
113392   void stop();
113393
113394
113395
113396 [endsect]
113397
113398
113399
113400 [section:stopped system_context::stopped]
113401
113402 [indexterm2 boost_asio.indexterm.system_context.stopped..stopped..system_context] 
113403 Determine whether the system thread pool has been stopped. 
113404
113405
113406   bool stopped() const;
113407
113408
113409
113410 [endsect]
113411
113412
113413 [section:use_service system_context::use_service]
113414
113415 [indexterm2 boost_asio.indexterm.system_context.use_service..use_service..system_context] 
113416 Obtain the service object corresponding to the given type. 
113417
113418
113419   template<
113420       typename ``[link boost_asio.reference.Service Service]``>
113421   friend Service & ``[link boost_asio.reference.system_context.use_service.overload1 use_service]``(
113422       execution_context & e);
113423   ``  [''''&raquo;''' [link boost_asio.reference.system_context.use_service.overload1 more...]]``
113424
113425   template<
113426       typename ``[link boost_asio.reference.Service Service]``>
113427   friend Service & ``[link boost_asio.reference.system_context.use_service.overload2 use_service]``(
113428       io_context & ioc);
113429   ``  [''''&raquo;''' [link boost_asio.reference.system_context.use_service.overload2 more...]]``
113430
113431
113432 [section:overload1 system_context::use_service (1 of 2 overloads)]
113433
113434
113435 ['Inherited from execution_context.]
113436
113437
113438 Obtain the service object corresponding to the given type. 
113439
113440
113441   template<
113442       typename ``[link boost_asio.reference.Service Service]``>
113443   friend Service & use_service(
113444       execution_context & e);
113445
113446
113447 This function is used to locate a service object that corresponds to the given service type. If there is no existing implementation of the service, then the [link boost_asio.reference.execution_context `execution_context`] will create a new instance of the service.
113448
113449
113450 [heading Parameters]
113451     
113452
113453 [variablelist
113454   
113455 [[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]]
113456
113457 ]
113458
113459
113460 [heading Return Value]
113461       
113462 The service interface implementing the specified service type. Ownership of the service interface is not transferred to the caller. 
113463
113464
113465
113466 [heading Requirements]
113467
113468 ['Header: ][^boost/asio/system_context.hpp]
113469
113470 ['Convenience header: ][^boost/asio.hpp]
113471
113472
113473 [endsect]
113474
113475
113476
113477 [section:overload2 system_context::use_service (2 of 2 overloads)]
113478
113479
113480 ['Inherited from execution_context.]
113481
113482
113483 Obtain the service object corresponding to the given type. 
113484
113485
113486   template<
113487       typename ``[link boost_asio.reference.Service Service]``>
113488   friend Service & use_service(
113489       io_context & ioc);
113490
113491
113492 This function is used to locate a service object that corresponds to the given service type. If there is no existing implementation of the service, then the [link boost_asio.reference.io_context `io_context`] will create a new instance of the service.
113493
113494
113495 [heading Parameters]
113496     
113497
113498 [variablelist
113499   
113500 [[ioc][The [link boost_asio.reference.io_context `io_context`] object that owns the service.]]
113501
113502 ]
113503
113504
113505 [heading Return Value]
113506       
113507 The service interface implementing the specified service type. Ownership of the service interface is not transferred to the caller.
113508
113509
113510 [heading Remarks]
113511       
113512 This overload is preserved for backwards compatibility with services that inherit from [link boost_asio.reference.io_context__service `io_context::service`]. 
113513
113514
113515
113516 [heading Requirements]
113517
113518 ['Header: ][^boost/asio/system_context.hpp]
113519
113520 ['Convenience header: ][^boost/asio.hpp]
113521
113522
113523 [endsect]
113524
113525
113526 [endsect]
113527
113528
113529 [section:_system_context system_context::~system_context]
113530
113531 [indexterm2 boost_asio.indexterm.system_context._system_context..~system_context..system_context] 
113532 Destructor shuts down all threads in the system thread pool. 
113533
113534
113535   ~system_context();
113536
113537
113538
113539 [endsect]
113540
113541
113542
113543 [endsect]
113544
113545 [section:system_executor system_executor]
113546
113547
113548 An executor that uses arbitrary threads. 
113549
113550
113551   class system_executor
113552
113553
113554 [heading Member Functions]
113555 [table
113556   [[Name][Description]]
113557
113558   [
113559     [[link boost_asio.reference.system_executor.context [*context]]]
113560     [Obtain the underlying execution context. ]
113561   ]
113562   
113563   [
113564     [[link boost_asio.reference.system_executor.defer [*defer]]]
113565     [Request the system executor to invoke the given function object. ]
113566   ]
113567   
113568   [
113569     [[link boost_asio.reference.system_executor.dispatch [*dispatch]]]
113570     [Request the system executor to invoke the given function object. ]
113571   ]
113572   
113573   [
113574     [[link boost_asio.reference.system_executor.on_work_finished [*on_work_finished]]]
113575     [Inform the executor that some work is no longer outstanding. ]
113576   ]
113577   
113578   [
113579     [[link boost_asio.reference.system_executor.on_work_started [*on_work_started]]]
113580     [Inform the executor that it has some outstanding work to do. ]
113581   ]
113582   
113583   [
113584     [[link boost_asio.reference.system_executor.post [*post]]]
113585     [Request the system executor to invoke the given function object. ]
113586   ]
113587   
113588 ]
113589
113590 [heading Friends]
113591 [table
113592   [[Name][Description]]
113593
113594   [
113595     [[link boost_asio.reference.system_executor.operator_not__eq_ [*operator!=]]]
113596     [Compare two executors for inequality. ]
113597   ]
113598   
113599   [
113600     [[link boost_asio.reference.system_executor.operator_eq__eq_ [*operator==]]]
113601     [Compare two executors for equality. ]
113602   ]
113603   
113604 ]
113605
113606 The system executor represents an execution context where functions are permitted to run on arbitrary threads. The `post()` and `defer()` functions schedule the function to run on an unspecified system thread pool, and `dispatch()` invokes the function immediately. 
113607
113608 [heading Requirements]
113609
113610 ['Header: ][^boost/asio/system_executor.hpp]
113611
113612 ['Convenience header: ][^boost/asio.hpp]
113613
113614
113615 [section:context system_executor::context]
113616
113617 [indexterm2 boost_asio.indexterm.system_executor.context..context..system_executor] 
113618 Obtain the underlying execution context. 
113619
113620
113621   system_context & context() const;
113622
113623
113624
113625 [endsect]
113626
113627
113628
113629 [section:defer system_executor::defer]
113630
113631 [indexterm2 boost_asio.indexterm.system_executor.defer..defer..system_executor] 
113632 Request the system executor to invoke the given function object. 
113633
113634
113635   template<
113636       typename Function,
113637       typename Allocator>
113638   void defer(
113639       Function && f,
113640       const Allocator & a) const;
113641
113642
113643 This function is used to ask the executor to execute the given function object. The function object will never be executed inside this function. Instead, it will be scheduled to run on an unspecified system thread pool.
113644
113645
113646 [heading Parameters]
113647     
113648
113649 [variablelist
113650   
113651 [[f][The function object to be called. The executor will make a copy of the handler object as required. The function signature of the function object must be:
113652 ``
113653    void function(); 
113654 ``
113655 ]]
113656
113657 [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
113658
113659 ]
113660
113661
113662
113663
113664 [endsect]
113665
113666
113667
113668 [section:dispatch system_executor::dispatch]
113669
113670 [indexterm2 boost_asio.indexterm.system_executor.dispatch..dispatch..system_executor] 
113671 Request the system executor to invoke the given function object. 
113672
113673
113674   template<
113675       typename Function,
113676       typename Allocator>
113677   void dispatch(
113678       Function && f,
113679       const Allocator & a) const;
113680
113681
113682 This function is used to ask the executor to execute the given function object. The function object will always be executed inside this function.
113683
113684
113685 [heading Parameters]
113686     
113687
113688 [variablelist
113689   
113690 [[f][The function object to be called. The executor will make a copy of the handler object as required. The function signature of the function object must be:
113691 ``
113692    void function(); 
113693 ``
113694 ]]
113695
113696 [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
113697
113698 ]
113699
113700
113701
113702
113703 [endsect]
113704
113705
113706
113707 [section:on_work_finished system_executor::on_work_finished]
113708
113709 [indexterm2 boost_asio.indexterm.system_executor.on_work_finished..on_work_finished..system_executor] 
113710 Inform the executor that some work is no longer outstanding. 
113711
113712
113713   void on_work_finished() const;
113714
113715
113716 For the system executor, this is a no-op. 
113717
113718
113719 [endsect]
113720
113721
113722
113723 [section:on_work_started system_executor::on_work_started]
113724
113725 [indexterm2 boost_asio.indexterm.system_executor.on_work_started..on_work_started..system_executor] 
113726 Inform the executor that it has some outstanding work to do. 
113727
113728
113729   void on_work_started() const;
113730
113731
113732 For the system executor, this is a no-op. 
113733
113734
113735 [endsect]
113736
113737
113738
113739 [section:operator_not__eq_ system_executor::operator!=]
113740
113741 [indexterm2 boost_asio.indexterm.system_executor.operator_not__eq_..operator!=..system_executor] 
113742 Compare two executors for inequality. 
113743
113744
113745   friend bool operator!=(
113746       const system_executor & ,
113747       const system_executor & );
113748
113749
113750 System executors always compare equal. 
113751
113752 [heading Requirements]
113753
113754 ['Header: ][^boost/asio/system_executor.hpp]
113755
113756 ['Convenience header: ][^boost/asio.hpp]
113757
113758
113759 [endsect]
113760
113761
113762
113763 [section:operator_eq__eq_ system_executor::operator==]
113764
113765 [indexterm2 boost_asio.indexterm.system_executor.operator_eq__eq_..operator==..system_executor] 
113766 Compare two executors for equality. 
113767
113768
113769   friend bool operator==(
113770       const system_executor & ,
113771       const system_executor & );
113772
113773
113774 System executors always compare equal. 
113775
113776 [heading Requirements]
113777
113778 ['Header: ][^boost/asio/system_executor.hpp]
113779
113780 ['Convenience header: ][^boost/asio.hpp]
113781
113782
113783 [endsect]
113784
113785
113786
113787 [section:post system_executor::post]
113788
113789 [indexterm2 boost_asio.indexterm.system_executor.post..post..system_executor] 
113790 Request the system executor to invoke the given function object. 
113791
113792
113793   template<
113794       typename Function,
113795       typename Allocator>
113796   void post(
113797       Function && f,
113798       const Allocator & a) const;
113799
113800
113801 This function is used to ask the executor to execute the given function object. The function object will never be executed inside this function. Instead, it will be scheduled to run on an unspecified system thread pool.
113802
113803
113804 [heading Parameters]
113805     
113806
113807 [variablelist
113808   
113809 [[f][The function object to be called. The executor will make a copy of the handler object as required. The function signature of the function object must be:
113810 ``
113811    void function(); 
113812 ``
113813 ]]
113814
113815 [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
113816
113817 ]
113818
113819
113820
113821
113822 [endsect]
113823
113824
113825
113826 [endsect]
113827
113828
113829 [section:system_timer system_timer]
113830
113831 [indexterm1 boost_asio.indexterm.system_timer..system_timer] 
113832 Typedef for a timer based on the system clock. 
113833
113834
113835   typedef basic_waitable_timer< chrono::system_clock > system_timer;
113836
113837
113838 [heading Types]
113839 [table
113840   [[Name][Description]]
113841
113842   [
113843
113844     [[link boost_asio.reference.basic_waitable_timer__rebind_executor [*rebind_executor]]]
113845     [Rebinds the timer type to another executor. ]
113846   
113847   ]
113848
113849   [
113850
113851     [[link boost_asio.reference.basic_waitable_timer.clock_type [*clock_type]]]
113852     [The clock type. ]
113853   
113854   ]
113855
113856   [
113857
113858     [[link boost_asio.reference.basic_waitable_timer.duration [*duration]]]
113859     [The duration type of the clock. ]
113860   
113861   ]
113862
113863   [
113864
113865     [[link boost_asio.reference.basic_waitable_timer.executor_type [*executor_type]]]
113866     [The type of the executor associated with the object. ]
113867   
113868   ]
113869
113870   [
113871
113872     [[link boost_asio.reference.basic_waitable_timer.time_point [*time_point]]]
113873     [The time point type of the clock. ]
113874   
113875   ]
113876
113877   [
113878
113879     [[link boost_asio.reference.basic_waitable_timer.traits_type [*traits_type]]]
113880     [The wait traits type. ]
113881   
113882   ]
113883
113884 ]
113885
113886 [heading Member Functions]
113887 [table
113888   [[Name][Description]]
113889
113890   [
113891     [[link boost_asio.reference.basic_waitable_timer.async_wait [*async_wait]]]
113892     [Start an asynchronous wait on the timer. ]
113893   ]
113894   
113895   [
113896     [[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer [*basic_waitable_timer]]]
113897     [Constructor. 
113898      [hr]
113899      Constructor to set a particular expiry time as an absolute time. 
113900      [hr]
113901      Constructor to set a particular expiry time relative to now. 
113902      [hr]
113903      Move-construct a basic_waitable_timer from another. ]
113904   ]
113905   
113906   [
113907     [[link boost_asio.reference.basic_waitable_timer.cancel [*cancel]]]
113908     [Cancel any asynchronous operations that are waiting on the timer. 
113909      [hr]
113910      (Deprecated: Use non-error_code overload.) Cancel any asynchronous operations that are waiting on the timer. ]
113911   ]
113912   
113913   [
113914     [[link boost_asio.reference.basic_waitable_timer.cancel_one [*cancel_one]]]
113915     [Cancels one asynchronous operation that is waiting on the timer. 
113916      [hr]
113917      (Deprecated: Use non-error_code overload.) Cancels one asynchronous operation that is waiting on the timer. ]
113918   ]
113919   
113920   [
113921     [[link boost_asio.reference.basic_waitable_timer.expires_after [*expires_after]]]
113922     [Set the timer's expiry time relative to now. ]
113923   ]
113924   
113925   [
113926     [[link boost_asio.reference.basic_waitable_timer.expires_at [*expires_at]]]
113927     [(Deprecated: Use expiry().) Get the timer's expiry time as an absolute time. 
113928      [hr]
113929      Set the timer's expiry time as an absolute time. 
113930      [hr]
113931      (Deprecated: Use non-error_code overload.) Set the timer's expiry time as an absolute time. ]
113932   ]
113933   
113934   [
113935     [[link boost_asio.reference.basic_waitable_timer.expires_from_now [*expires_from_now]]]
113936     [(Deprecated: Use expiry().) Get the timer's expiry time relative to now. 
113937      [hr]
113938      (Deprecated: Use expires_after().) Set the timer's expiry time relative to now. ]
113939   ]
113940   
113941   [
113942     [[link boost_asio.reference.basic_waitable_timer.expiry [*expiry]]]
113943     [Get the timer's expiry time as an absolute time. ]
113944   ]
113945   
113946   [
113947     [[link boost_asio.reference.basic_waitable_timer.get_executor [*get_executor]]]
113948     [Get the executor associated with the object. ]
113949   ]
113950   
113951   [
113952     [[link boost_asio.reference.basic_waitable_timer.operator_eq_ [*operator=]]]
113953     [Move-assign a basic_waitable_timer from another. ]
113954   ]
113955   
113956   [
113957     [[link boost_asio.reference.basic_waitable_timer.wait [*wait]]]
113958     [Perform a blocking wait on the timer. ]
113959   ]
113960   
113961   [
113962     [[link boost_asio.reference.basic_waitable_timer._basic_waitable_timer [*~basic_waitable_timer]]]
113963     [Destroys the timer. ]
113964   ]
113965   
113966 ]
113967
113968 The [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] class template provides the ability to perform a blocking or asynchronous wait for a timer to expire.
113969
113970 A waitable timer is always in one of two states: "expired" or "not expired". If the `wait()` or `async_wait()` function is called on an expired timer, the wait operation will complete immediately.
113971
113972 Most applications will use one of the [link boost_asio.reference.steady_timer `steady_timer`], [link boost_asio.reference.system_timer `system_timer`] or [link boost_asio.reference.high_resolution_timer `high_resolution_timer`] typedefs.
113973
113974
113975 [heading Remarks]
113976       
113977 This waitable timer functionality is for use with the C++11 standard library's `<chrono>` facility, or with the Boost.Chrono library.
113978
113979
113980 [heading Thread Safety]
113981   
113982 ['Distinct] ['objects:] Safe.
113983
113984 ['Shared] ['objects:] Unsafe.
113985
113986
113987 [heading Examples]
113988   
113989 Performing a blocking wait (C++11): 
113990
113991    // Construct a timer without setting an expiry time.
113992    boost::asio::steady_timer timer(my_context);
113993
113994    // Set an expiry time relative to now.
113995    timer.expires_after(std::chrono::seconds(5));
113996
113997    // Wait for the timer to expire.
113998    timer.wait();
113999
114000
114001
114002
114003
114004 Performing an asynchronous wait (C++11): 
114005
114006    void handler(const boost::system::error_code& error)
114007    {
114008      if (!error)
114009      {
114010        // Timer expired.
114011      }
114012    }
114013
114014    ...
114015
114016    // Construct a timer with an absolute expiry time.
114017    boost::asio::steady_timer timer(my_context,
114018        std::chrono::steady_clock::now() + std::chrono::seconds(60));
114019
114020    // Start an asynchronous wait.
114021    timer.async_wait(handler);
114022
114023
114024
114025
114026
114027 [heading Changing an active waitable timer's expiry time]
114028   
114029
114030
114031 Changing the expiry time of a timer while there are pending asynchronous waits causes those wait operations to be cancelled. To ensure that the action associated with the timer is performed only once, use something like this: used:
114032
114033
114034
114035    void on_some_event()
114036    {
114037      if (my_timer.expires_after(seconds(5)) > 0)
114038      {
114039        // We managed to cancel the timer. Start new asynchronous wait.
114040        my_timer.async_wait(on_timeout);
114041      }
114042      else
114043      {
114044        // Too late, timer has already expired!
114045      }
114046    }
114047
114048    void on_timeout(const boost::system::error_code& e)
114049    {
114050      if (e != boost::asio::error::operation_aborted)
114051      {
114052        // Timer was not cancelled, take necessary action.
114053      }
114054    }
114055
114056
114057
114058
114059
114060 * The `boost::asio::basic_waitable_timer::expires_after()` function cancels any pending asynchronous waits, and returns the number of asynchronous waits that were cancelled. If it returns 0 then you were too late and the wait handler has already been executed, or will soon be executed. If it returns 1 then the wait handler was successfully cancelled.
114061
114062
114063 * If a wait handler is cancelled, the boost::system::error\_code passed to it contains the value `boost::asio::error::operation_aborted`. 
114064
114065
114066
114067
114068 This typedef uses the C++11 `<chrono>` standard library facility, if available. Otherwise, it may use the Boost.Chrono library. To explicitly utilise Boost.Chrono, use the [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] template directly: 
114069
114070    typedef basic_waitable_timer<boost::chrono::system_clock> timer;
114071
114072
114073
114074
114075 [heading Requirements]
114076
114077 ['Header: ][^boost/asio/system_timer.hpp]
114078
114079 ['Convenience header: ][^boost/asio.hpp]
114080
114081
114082 [endsect]
114083
114084
114085
114086 [section:this_coro__executor this_coro::executor]
114087
114088 [indexterm1 boost_asio.indexterm.this_coro__executor..this_coro::executor] 
114089 Awaitable object that returns the executor of the current coroutine. 
114090
114091
114092   constexpr executor_t executor;
114093
114094
114095 [heading Requirements]
114096
114097 ['Header: ][^boost/asio/this_coro.hpp]
114098
114099 ['Convenience header: ][^boost/asio.hpp]
114100
114101
114102 [endsect]
114103
114104
114105 [section:this_coro__executor_t this_coro::executor_t]
114106
114107
114108 Awaitable type that returns the executor of the current coroutine. 
114109
114110
114111   struct executor_t
114112
114113
114114 [heading Member Functions]
114115 [table
114116   [[Name][Description]]
114117
114118   [
114119     [[link boost_asio.reference.this_coro__executor_t.executor_t [*executor_t]]]
114120     []
114121   ]
114122   
114123 ]
114124
114125 [heading Requirements]
114126
114127 ['Header: ][^boost/asio/this_coro.hpp]
114128
114129 ['Convenience header: ][^boost/asio.hpp]
114130
114131
114132 [section:executor_t this_coro::executor_t::executor_t]
114133
114134 [indexterm2 boost_asio.indexterm.this_coro__executor_t.executor_t..executor_t..this_coro::executor_t] 
114135
114136   constexpr executor_t();
114137
114138
114139
114140 [endsect]
114141
114142
114143
114144 [endsect]
114145
114146 [section:thread_pool thread_pool]
114147
114148
114149 A simple fixed-size thread pool. 
114150
114151
114152   class thread_pool :
114153     public execution_context
114154
114155
114156 [heading Types]
114157 [table
114158   [[Name][Description]]
114159
114160   [
114161
114162     [[link boost_asio.reference.thread_pool__executor_type [*executor_type]]]
114163     [Executor used to submit functions to a thread pool. ]
114164   
114165   ]
114166
114167   [
114168
114169     [[link boost_asio.reference.thread_pool.fork_event [*fork_event]]]
114170     [Fork-related event notifications. ]
114171   
114172   ]
114173
114174 ]
114175
114176 [heading Member Functions]
114177 [table
114178   [[Name][Description]]
114179
114180   [
114181     [[link boost_asio.reference.thread_pool.get_executor [*get_executor]]]
114182     [Obtains the executor associated with the pool. ]
114183   ]
114184   
114185   [
114186     [[link boost_asio.reference.thread_pool.join [*join]]]
114187     [Joins the threads. ]
114188   ]
114189   
114190   [
114191     [[link boost_asio.reference.thread_pool.notify_fork [*notify_fork]]]
114192     [Notify the execution_context of a fork-related event. ]
114193   ]
114194   
114195   [
114196     [[link boost_asio.reference.thread_pool.stop [*stop]]]
114197     [Stops the threads. ]
114198   ]
114199   
114200   [
114201     [[link boost_asio.reference.thread_pool.thread_pool [*thread_pool]]]
114202     [Constructs a pool with an automatically determined number of threads. 
114203      [hr]
114204      Constructs a pool with a specified number of threads. ]
114205   ]
114206   
114207   [
114208     [[link boost_asio.reference.thread_pool._thread_pool [*~thread_pool]]]
114209     [Destructor. ]
114210   ]
114211   
114212 ]
114213
114214 [heading Protected Member Functions]
114215 [table
114216   [[Name][Description]]
114217
114218   [
114219     [[link boost_asio.reference.thread_pool.destroy [*destroy]]]
114220     [Destroys all services in the context. ]
114221   ]
114222   
114223   [
114224     [[link boost_asio.reference.thread_pool.shutdown [*shutdown]]]
114225     [Shuts down all services in the context. ]
114226   ]
114227   
114228 ]
114229
114230 [heading Friends]
114231 [table
114232   [[Name][Description]]
114233
114234   [
114235     [[link boost_asio.reference.thread_pool.add_service [*add_service]]]
114236     [(Deprecated: Use make_service().) Add a service object to the execution_context. ]
114237   ]
114238   
114239   [
114240     [[link boost_asio.reference.thread_pool.has_service [*has_service]]]
114241     [Determine if an execution_context contains a specified service type. ]
114242   ]
114243   
114244   [
114245     [[link boost_asio.reference.thread_pool.make_service [*make_service]]]
114246     [Creates a service object and adds it to the execution_context. ]
114247   ]
114248   
114249   [
114250     [[link boost_asio.reference.thread_pool.use_service [*use_service]]]
114251     [Obtain the service object corresponding to the given type. ]
114252   ]
114253   
114254 ]
114255
114256 The thread pool class is an execution context where functions are permitted to run on one of a fixed number of threads.
114257
114258
114259 [heading Submitting tasks to the pool]
114260   
114261
114262
114263 To submit functions to the [link boost_asio.reference.thread_pool `thread_pool`], use the [link boost_asio.reference.dispatch `dispatch`] , [link boost_asio.reference.post `post`]  or [link boost_asio.reference.defer `defer`]  free functions.
114264
114265 For example:
114266
114267
114268
114269    void my_task()
114270    {
114271      ...
114272    }
114273
114274    ...
114275
114276    // Launch the pool with four threads.
114277    boost::asio::thread_pool pool(4);
114278
114279    // Submit a function to the pool.
114280    boost::asio::post(pool, my_task);
114281
114282    // Submit a lambda object to the pool.
114283    boost::asio::post(pool,
114284        []()
114285        {
114286          ...
114287        });
114288
114289    // Wait for all tasks in the pool to complete.
114290    pool.join(); 
114291
114292
114293
114294
114295 [heading Requirements]
114296
114297 ['Header: ][^boost/asio/thread_pool.hpp]
114298
114299 ['Convenience header: ][^boost/asio.hpp]
114300
114301
114302 [section:add_service thread_pool::add_service]
114303
114304
114305 ['Inherited from execution_context.]
114306
114307 [indexterm2 boost_asio.indexterm.thread_pool.add_service..add_service..thread_pool] 
114308 (Deprecated: Use `make_service()`.) Add a service object to the [link boost_asio.reference.execution_context `execution_context`]. 
114309
114310
114311   template<
114312       typename ``[link boost_asio.reference.Service Service]``>
114313   friend void add_service(
114314       execution_context & e,
114315       Service * svc);
114316
114317
114318 This function is used to add a service to the [link boost_asio.reference.execution_context `execution_context`].
114319
114320
114321 [heading Parameters]
114322     
114323
114324 [variablelist
114325   
114326 [[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]]
114327
114328 [[svc][The service object. On success, ownership of the service object is transferred to the [link boost_asio.reference.execution_context `execution_context`]. When the [link boost_asio.reference.execution_context `execution_context`] object is destroyed, it will destroy the service object by performing:
114329 ``
114330    delete static_cast<execution_context::service*>(svc) 
114331 ``
114332 ]]
114333
114334 ]
114335
114336
114337 [heading Exceptions]
114338     
114339
114340 [variablelist
114341   
114342 [[boost::asio::service_already_exists][Thrown if a service of the given type is already present in the [link boost_asio.reference.execution_context `execution_context`].]]
114343
114344 [[boost::asio::invalid_service_owner][Thrown if the service's owning [link boost_asio.reference.execution_context `execution_context`] is not the [link boost_asio.reference.execution_context `execution_context`] object specified by the `e` parameter. ]]
114345
114346 ]
114347
114348
114349
114350 [heading Requirements]
114351
114352 ['Header: ][^boost/asio/thread_pool.hpp]
114353
114354 ['Convenience header: ][^boost/asio.hpp]
114355
114356
114357 [endsect]
114358
114359
114360
114361 [section:destroy thread_pool::destroy]
114362
114363
114364 ['Inherited from execution_context.]
114365
114366 [indexterm2 boost_asio.indexterm.thread_pool.destroy..destroy..thread_pool] 
114367 Destroys all services in the context. 
114368
114369
114370   void destroy();
114371
114372
114373 This function is implemented as follows:
114374
114375
114376 * For each service object `svc` in the [link boost_asio.reference.execution_context `execution_context`] set, in reverse order * of the beginning of service object lifetime, performs `delete static_cast<execution_context::service*>(svc)`. 
114377
114378
114379
114380
114381 [endsect]
114382
114383
114384
114385 [section:fork_event thread_pool::fork_event]
114386
114387
114388 ['Inherited from execution_context.]
114389
114390 [indexterm2 boost_asio.indexterm.thread_pool.fork_event..fork_event..thread_pool] 
114391 Fork-related event notifications. 
114392
114393
114394   enum fork_event
114395
114396 [indexterm2 boost_asio.indexterm.thread_pool.fork_event.fork_prepare..fork_prepare..thread_pool]
114397 [indexterm2 boost_asio.indexterm.thread_pool.fork_event.fork_parent..fork_parent..thread_pool]
114398 [indexterm2 boost_asio.indexterm.thread_pool.fork_event.fork_child..fork_child..thread_pool]
114399
114400 [heading Values]
114401 [variablelist
114402
114403   [
114404     [fork_prepare]
114405     [Notify the context that the process is about to fork. ]
114406   ]
114407
114408   [
114409     [fork_parent]
114410     [Notify the context that the process has forked and is the parent. ]
114411   ]
114412
114413   [
114414     [fork_child]
114415     [Notify the context that the process has forked and is the child. ]
114416   ]
114417
114418 ]
114419
114420
114421
114422 [endsect]
114423
114424
114425
114426 [section:get_executor thread_pool::get_executor]
114427
114428 [indexterm2 boost_asio.indexterm.thread_pool.get_executor..get_executor..thread_pool] 
114429 Obtains the executor associated with the pool. 
114430
114431
114432   executor_type get_executor();
114433
114434
114435
114436 [endsect]
114437
114438
114439
114440 [section:has_service thread_pool::has_service]
114441
114442
114443 ['Inherited from execution_context.]
114444
114445 [indexterm2 boost_asio.indexterm.thread_pool.has_service..has_service..thread_pool] 
114446 Determine if an [link boost_asio.reference.execution_context `execution_context`] contains a specified service type. 
114447
114448
114449   template<
114450       typename ``[link boost_asio.reference.Service Service]``>
114451   friend bool has_service(
114452       execution_context & e);
114453
114454
114455 This function is used to determine whether the [link boost_asio.reference.execution_context `execution_context`] contains a service object corresponding to the given service type.
114456
114457
114458 [heading Parameters]
114459     
114460
114461 [variablelist
114462   
114463 [[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]]
114464
114465 ]
114466
114467
114468 [heading Return Value]
114469       
114470 A boolean indicating whether the [link boost_asio.reference.execution_context `execution_context`] contains the service. 
114471
114472
114473
114474 [heading Requirements]
114475
114476 ['Header: ][^boost/asio/thread_pool.hpp]
114477
114478 ['Convenience header: ][^boost/asio.hpp]
114479
114480
114481 [endsect]
114482
114483
114484
114485 [section:join thread_pool::join]
114486
114487 [indexterm2 boost_asio.indexterm.thread_pool.join..join..thread_pool] 
114488 Joins the threads. 
114489
114490
114491   void join();
114492
114493
114494 This function blocks until the threads in the pool have completed. If `stop()` is not called prior to `join()`, the `join()` call will wait until the pool has no more outstanding work. 
114495
114496
114497 [endsect]
114498
114499
114500
114501 [section:make_service thread_pool::make_service]
114502
114503
114504 ['Inherited from execution_context.]
114505
114506 [indexterm2 boost_asio.indexterm.thread_pool.make_service..make_service..thread_pool] 
114507 Creates a service object and adds it to the [link boost_asio.reference.execution_context `execution_context`]. 
114508
114509
114510   template<
114511       typename ``[link boost_asio.reference.Service Service]``,
114512       typename... Args>
114513   friend Service & make_service(
114514       execution_context & e,
114515       Args &&... args);
114516
114517
114518 This function is used to add a service to the [link boost_asio.reference.execution_context `execution_context`].
114519
114520
114521 [heading Parameters]
114522     
114523
114524 [variablelist
114525   
114526 [[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]]
114527
114528 [[args][Zero or more arguments to be passed to the service constructor.]]
114529
114530 ]
114531
114532
114533 [heading Exceptions]
114534     
114535
114536 [variablelist
114537   
114538 [[boost::asio::service_already_exists][Thrown if a service of the given type is already present in the [link boost_asio.reference.execution_context `execution_context`]. ]]
114539
114540 ]
114541
114542
114543
114544 [heading Requirements]
114545
114546 ['Header: ][^boost/asio/thread_pool.hpp]
114547
114548 ['Convenience header: ][^boost/asio.hpp]
114549
114550
114551 [endsect]
114552
114553
114554
114555 [section:notify_fork thread_pool::notify_fork]
114556
114557
114558 ['Inherited from execution_context.]
114559
114560 [indexterm2 boost_asio.indexterm.thread_pool.notify_fork..notify_fork..thread_pool] 
114561 Notify the [link boost_asio.reference.execution_context `execution_context`] of a fork-related event. 
114562
114563
114564   void notify_fork(
114565       fork_event event);
114566
114567
114568 This function is used to inform the [link boost_asio.reference.execution_context `execution_context`] that the process is about to fork, or has just forked. This allows the [link boost_asio.reference.execution_context `execution_context`], and the services it contains, to perform any necessary housekeeping to ensure correct operation following a fork.
114569
114570 This function must not be called while any other [link boost_asio.reference.execution_context `execution_context`] function, or any function associated with the execution\_context's derived class, is being called in another thread. It is, however, safe to call this function from within a completion handler, provided no other thread is accessing the [link boost_asio.reference.execution_context `execution_context`] or its derived class.
114571
114572
114573 [heading Parameters]
114574     
114575
114576 [variablelist
114577   
114578 [[event][A fork-related event.]]
114579
114580 ]
114581
114582
114583 [heading Exceptions]
114584     
114585
114586 [variablelist
114587   
114588 [[boost::system::system_error][Thrown on failure. If the notification fails the [link boost_asio.reference.execution_context `execution_context`] object should no longer be used and should be destroyed.]]
114589
114590 ]
114591
114592
114593 [heading Example]
114594   
114595 The following code illustrates how to incorporate the `notify_fork()` function: 
114596
114597    my_execution_context.notify_fork(execution_context::fork_prepare);
114598    if (fork() == 0)
114599    {
114600      // This is the child process.
114601      my_execution_context.notify_fork(execution_context::fork_child);
114602    }
114603    else
114604    {
114605      // This is the parent process.
114606      my_execution_context.notify_fork(execution_context::fork_parent);
114607    } 
114608
114609
114610
114611
114612
114613 [heading Remarks]
114614       
114615 For each service object `svc` in the [link boost_asio.reference.execution_context `execution_context`] set, performs `svc->notify_fork();`. When processing the fork\_prepare event, services are visited in reverse order of the beginning of service object lifetime. Otherwise, services are visited in order of the beginning of service object lifetime. 
114616
114617
114618
114619
114620 [endsect]
114621
114622
114623
114624 [section:shutdown thread_pool::shutdown]
114625
114626
114627 ['Inherited from execution_context.]
114628
114629 [indexterm2 boost_asio.indexterm.thread_pool.shutdown..shutdown..thread_pool] 
114630 Shuts down all services in the context. 
114631
114632
114633   void shutdown();
114634
114635
114636 This function is implemented as follows:
114637
114638
114639 * For each service object `svc` in the [link boost_asio.reference.execution_context `execution_context`] set, in reverse order of the beginning of service object lifetime, performs `svc->shutdown()`. 
114640
114641
114642
114643
114644 [endsect]
114645
114646
114647
114648 [section:stop thread_pool::stop]
114649
114650 [indexterm2 boost_asio.indexterm.thread_pool.stop..stop..thread_pool] 
114651 Stops the threads. 
114652
114653
114654   void stop();
114655
114656
114657 This function stops the threads as soon as possible. As a result of calling `stop()`, pending function objects may be never be invoked. 
114658
114659
114660 [endsect]
114661
114662
114663 [section:thread_pool thread_pool::thread_pool]
114664
114665 [indexterm2 boost_asio.indexterm.thread_pool.thread_pool..thread_pool..thread_pool] 
114666 Constructs a pool with an automatically determined number of threads. 
114667
114668
114669   ``[link boost_asio.reference.thread_pool.thread_pool.overload1 thread_pool]``();
114670   ``  [''''&raquo;''' [link boost_asio.reference.thread_pool.thread_pool.overload1 more...]]``
114671
114672
114673 Constructs a pool with a specified number of threads. 
114674
114675
114676   ``[link boost_asio.reference.thread_pool.thread_pool.overload2 thread_pool]``(
114677       std::size_t num_threads);
114678   ``  [''''&raquo;''' [link boost_asio.reference.thread_pool.thread_pool.overload2 more...]]``
114679
114680
114681 [section:overload1 thread_pool::thread_pool (1 of 2 overloads)]
114682
114683
114684 Constructs a pool with an automatically determined number of threads. 
114685
114686
114687   thread_pool();
114688
114689
114690
114691 [endsect]
114692
114693
114694
114695 [section:overload2 thread_pool::thread_pool (2 of 2 overloads)]
114696
114697
114698 Constructs a pool with a specified number of threads. 
114699
114700
114701   thread_pool(
114702       std::size_t num_threads);
114703
114704
114705
114706 [endsect]
114707
114708
114709 [endsect]
114710
114711 [section:use_service thread_pool::use_service]
114712
114713 [indexterm2 boost_asio.indexterm.thread_pool.use_service..use_service..thread_pool] 
114714 Obtain the service object corresponding to the given type. 
114715
114716
114717   template<
114718       typename ``[link boost_asio.reference.Service Service]``>
114719   friend Service & ``[link boost_asio.reference.thread_pool.use_service.overload1 use_service]``(
114720       execution_context & e);
114721   ``  [''''&raquo;''' [link boost_asio.reference.thread_pool.use_service.overload1 more...]]``
114722
114723   template<
114724       typename ``[link boost_asio.reference.Service Service]``>
114725   friend Service & ``[link boost_asio.reference.thread_pool.use_service.overload2 use_service]``(
114726       io_context & ioc);
114727   ``  [''''&raquo;''' [link boost_asio.reference.thread_pool.use_service.overload2 more...]]``
114728
114729
114730 [section:overload1 thread_pool::use_service (1 of 2 overloads)]
114731
114732
114733 ['Inherited from execution_context.]
114734
114735
114736 Obtain the service object corresponding to the given type. 
114737
114738
114739   template<
114740       typename ``[link boost_asio.reference.Service Service]``>
114741   friend Service & use_service(
114742       execution_context & e);
114743
114744
114745 This function is used to locate a service object that corresponds to the given service type. If there is no existing implementation of the service, then the [link boost_asio.reference.execution_context `execution_context`] will create a new instance of the service.
114746
114747
114748 [heading Parameters]
114749     
114750
114751 [variablelist
114752   
114753 [[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]]
114754
114755 ]
114756
114757
114758 [heading Return Value]
114759       
114760 The service interface implementing the specified service type. Ownership of the service interface is not transferred to the caller. 
114761
114762
114763
114764 [heading Requirements]
114765
114766 ['Header: ][^boost/asio/thread_pool.hpp]
114767
114768 ['Convenience header: ][^boost/asio.hpp]
114769
114770
114771 [endsect]
114772
114773
114774
114775 [section:overload2 thread_pool::use_service (2 of 2 overloads)]
114776
114777
114778 ['Inherited from execution_context.]
114779
114780
114781 Obtain the service object corresponding to the given type. 
114782
114783
114784   template<
114785       typename ``[link boost_asio.reference.Service Service]``>
114786   friend Service & use_service(
114787       io_context & ioc);
114788
114789
114790 This function is used to locate a service object that corresponds to the given service type. If there is no existing implementation of the service, then the [link boost_asio.reference.io_context `io_context`] will create a new instance of the service.
114791
114792
114793 [heading Parameters]
114794     
114795
114796 [variablelist
114797   
114798 [[ioc][The [link boost_asio.reference.io_context `io_context`] object that owns the service.]]
114799
114800 ]
114801
114802
114803 [heading Return Value]
114804       
114805 The service interface implementing the specified service type. Ownership of the service interface is not transferred to the caller.
114806
114807
114808 [heading Remarks]
114809       
114810 This overload is preserved for backwards compatibility with services that inherit from [link boost_asio.reference.io_context__service `io_context::service`]. 
114811
114812
114813
114814 [heading Requirements]
114815
114816 ['Header: ][^boost/asio/thread_pool.hpp]
114817
114818 ['Convenience header: ][^boost/asio.hpp]
114819
114820
114821 [endsect]
114822
114823
114824 [endsect]
114825
114826
114827 [section:_thread_pool thread_pool::~thread_pool]
114828
114829 [indexterm2 boost_asio.indexterm.thread_pool._thread_pool..~thread_pool..thread_pool] 
114830 Destructor. 
114831
114832
114833   ~thread_pool();
114834
114835
114836 Automatically stops and joins the pool, if not explicitly done beforehand. 
114837
114838
114839 [endsect]
114840
114841
114842
114843 [endsect]
114844
114845 [section:thread_pool__executor_type thread_pool::executor_type]
114846
114847
114848 Executor used to submit functions to a thread pool. 
114849
114850
114851   class executor_type
114852
114853
114854 [heading Member Functions]
114855 [table
114856   [[Name][Description]]
114857
114858   [
114859     [[link boost_asio.reference.thread_pool__executor_type.context [*context]]]
114860     [Obtain the underlying execution context. ]
114861   ]
114862   
114863   [
114864     [[link boost_asio.reference.thread_pool__executor_type.defer [*defer]]]
114865     [Request the thread pool to invoke the given function object. ]
114866   ]
114867   
114868   [
114869     [[link boost_asio.reference.thread_pool__executor_type.dispatch [*dispatch]]]
114870     [Request the thread pool to invoke the given function object. ]
114871   ]
114872   
114873   [
114874     [[link boost_asio.reference.thread_pool__executor_type.on_work_finished [*on_work_finished]]]
114875     [Inform the thread pool that some work is no longer outstanding. ]
114876   ]
114877   
114878   [
114879     [[link boost_asio.reference.thread_pool__executor_type.on_work_started [*on_work_started]]]
114880     [Inform the thread pool that it has some outstanding work to do. ]
114881   ]
114882   
114883   [
114884     [[link boost_asio.reference.thread_pool__executor_type.post [*post]]]
114885     [Request the thread pool to invoke the given function object. ]
114886   ]
114887   
114888   [
114889     [[link boost_asio.reference.thread_pool__executor_type.running_in_this_thread [*running_in_this_thread]]]
114890     [Determine whether the thread pool is running in the current thread. ]
114891   ]
114892   
114893 ]
114894
114895 [heading Friends]
114896 [table
114897   [[Name][Description]]
114898
114899   [
114900     [[link boost_asio.reference.thread_pool__executor_type.operator_not__eq_ [*operator!=]]]
114901     [Compare two executors for inequality. ]
114902   ]
114903   
114904   [
114905     [[link boost_asio.reference.thread_pool__executor_type.operator_eq__eq_ [*operator==]]]
114906     [Compare two executors for equality. ]
114907   ]
114908   
114909 ]
114910
114911 [heading Requirements]
114912
114913 ['Header: ][^boost/asio/thread_pool.hpp]
114914
114915 ['Convenience header: ][^boost/asio.hpp]
114916
114917
114918 [section:context thread_pool::executor_type::context]
114919
114920 [indexterm2 boost_asio.indexterm.thread_pool__executor_type.context..context..thread_pool::executor_type] 
114921 Obtain the underlying execution context. 
114922
114923
114924   thread_pool & context() const;
114925
114926
114927
114928 [endsect]
114929
114930
114931
114932 [section:defer thread_pool::executor_type::defer]
114933
114934 [indexterm2 boost_asio.indexterm.thread_pool__executor_type.defer..defer..thread_pool::executor_type] 
114935 Request the thread pool to invoke the given function object. 
114936
114937
114938   template<
114939       typename Function,
114940       typename Allocator>
114941   void defer(
114942       Function && f,
114943       const Allocator & a) const;
114944
114945
114946 This function is used to ask the thread pool to execute the given function object. The function object will never be executed inside `defer()`. Instead, it will be scheduled to run on the thread pool.
114947
114948 If the current thread belongs to the thread pool, `defer()` will delay scheduling the function object until the current thread returns control to the pool.
114949
114950
114951 [heading Parameters]
114952     
114953
114954 [variablelist
114955   
114956 [[f][The function object to be called. The executor will make a copy of the handler object as required. The function signature of the function object must be:
114957 ``
114958    void function(); 
114959 ``
114960 ]]
114961
114962 [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
114963
114964 ]
114965
114966
114967
114968
114969 [endsect]
114970
114971
114972
114973 [section:dispatch thread_pool::executor_type::dispatch]
114974
114975 [indexterm2 boost_asio.indexterm.thread_pool__executor_type.dispatch..dispatch..thread_pool::executor_type] 
114976 Request the thread pool to invoke the given function object. 
114977
114978
114979   template<
114980       typename Function,
114981       typename Allocator>
114982   void dispatch(
114983       Function && f,
114984       const Allocator & a) const;
114985
114986
114987 This function is used to ask the thread pool to execute the given function object. If the current thread belongs to the pool, `dispatch()` executes the function before returning. Otherwise, the function will be scheduled to run on the thread pool.
114988
114989
114990 [heading Parameters]
114991     
114992
114993 [variablelist
114994   
114995 [[f][The function object to be called. The executor will make a copy of the handler object as required. The function signature of the function object must be:
114996 ``
114997    void function(); 
114998 ``
114999 ]]
115000
115001 [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
115002
115003 ]
115004
115005
115006
115007
115008 [endsect]
115009
115010
115011
115012 [section:on_work_finished thread_pool::executor_type::on_work_finished]
115013
115014 [indexterm2 boost_asio.indexterm.thread_pool__executor_type.on_work_finished..on_work_finished..thread_pool::executor_type] 
115015 Inform the thread pool that some work is no longer outstanding. 
115016
115017
115018   void on_work_finished() const;
115019
115020
115021 This function is used to inform the thread pool that some work has finished. Once the count of unfinished work reaches zero, the thread pool's `join()` function is permitted to exit. 
115022
115023
115024 [endsect]
115025
115026
115027
115028 [section:on_work_started thread_pool::executor_type::on_work_started]
115029
115030 [indexterm2 boost_asio.indexterm.thread_pool__executor_type.on_work_started..on_work_started..thread_pool::executor_type] 
115031 Inform the thread pool that it has some outstanding work to do. 
115032
115033
115034   void on_work_started() const;
115035
115036
115037 This function is used to inform the thread pool that some work has begun. This ensures that the thread pool's `join()` function will not return while the work is underway. 
115038
115039
115040 [endsect]
115041
115042
115043
115044 [section:operator_not__eq_ thread_pool::executor_type::operator!=]
115045
115046 [indexterm2 boost_asio.indexterm.thread_pool__executor_type.operator_not__eq_..operator!=..thread_pool::executor_type] 
115047 Compare two executors for inequality. 
115048
115049
115050   friend bool operator!=(
115051       const executor_type & a,
115052       const executor_type & b);
115053
115054
115055 Two executors are equal if they refer to the same underlying thread pool. 
115056
115057 [heading Requirements]
115058
115059 ['Header: ][^boost/asio/thread_pool.hpp]
115060
115061 ['Convenience header: ][^boost/asio.hpp]
115062
115063
115064 [endsect]
115065
115066
115067
115068 [section:operator_eq__eq_ thread_pool::executor_type::operator==]
115069
115070 [indexterm2 boost_asio.indexterm.thread_pool__executor_type.operator_eq__eq_..operator==..thread_pool::executor_type] 
115071 Compare two executors for equality. 
115072
115073
115074   friend bool operator==(
115075       const executor_type & a,
115076       const executor_type & b);
115077
115078
115079 Two executors are equal if they refer to the same underlying thread pool. 
115080
115081 [heading Requirements]
115082
115083 ['Header: ][^boost/asio/thread_pool.hpp]
115084
115085 ['Convenience header: ][^boost/asio.hpp]
115086
115087
115088 [endsect]
115089
115090
115091
115092 [section:post thread_pool::executor_type::post]
115093
115094 [indexterm2 boost_asio.indexterm.thread_pool__executor_type.post..post..thread_pool::executor_type] 
115095 Request the thread pool to invoke the given function object. 
115096
115097
115098   template<
115099       typename Function,
115100       typename Allocator>
115101   void post(
115102       Function && f,
115103       const Allocator & a) const;
115104
115105
115106 This function is used to ask the thread pool to execute the given function object. The function object will never be executed inside `post()`. Instead, it will be scheduled to run on the thread pool.
115107
115108
115109 [heading Parameters]
115110     
115111
115112 [variablelist
115113   
115114 [[f][The function object to be called. The executor will make a copy of the handler object as required. The function signature of the function object must be:
115115 ``
115116    void function(); 
115117 ``
115118 ]]
115119
115120 [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
115121
115122 ]
115123
115124
115125
115126
115127 [endsect]
115128
115129
115130
115131 [section:running_in_this_thread thread_pool::executor_type::running_in_this_thread]
115132
115133 [indexterm2 boost_asio.indexterm.thread_pool__executor_type.running_in_this_thread..running_in_this_thread..thread_pool::executor_type] 
115134 Determine whether the thread pool is running in the current thread. 
115135
115136
115137   bool running_in_this_thread() const;
115138
115139
115140
115141 [heading Return Value]
115142       
115143 `true` if the current thread belongs to the pool. Otherwise returns `false`. 
115144
115145
115146
115147
115148 [endsect]
115149
115150
115151
115152 [endsect]
115153
115154 [section:time_traits_lt__ptime__gt_ time_traits< boost::posix_time::ptime >]
115155
115156
115157 Time traits specialised for posix\_time. 
115158
115159
115160   template<>
115161   struct time_traits< boost::posix_time::ptime >
115162
115163
115164 [heading Types]
115165 [table
115166   [[Name][Description]]
115167
115168   [
115169
115170     [[link boost_asio.reference.time_traits_lt__ptime__gt_.duration_type [*duration_type]]]
115171     [The duration type. ]
115172   
115173   ]
115174
115175   [
115176
115177     [[link boost_asio.reference.time_traits_lt__ptime__gt_.time_type [*time_type]]]
115178     [The time type. ]
115179   
115180   ]
115181
115182 ]
115183
115184 [heading Member Functions]
115185 [table
115186   [[Name][Description]]
115187
115188   [
115189     [[link boost_asio.reference.time_traits_lt__ptime__gt_.add [*add]]]
115190     [Add a duration to a time. ]
115191   ]
115192   
115193   [
115194     [[link boost_asio.reference.time_traits_lt__ptime__gt_.less_than [*less_than]]]
115195     [Test whether one time is less than another. ]
115196   ]
115197   
115198   [
115199     [[link boost_asio.reference.time_traits_lt__ptime__gt_.now [*now]]]
115200     [Get the current time. ]
115201   ]
115202   
115203   [
115204     [[link boost_asio.reference.time_traits_lt__ptime__gt_.subtract [*subtract]]]
115205     [Subtract one time from another. ]
115206   ]
115207   
115208   [
115209     [[link boost_asio.reference.time_traits_lt__ptime__gt_.to_posix_duration [*to_posix_duration]]]
115210     [Convert to POSIX duration type. ]
115211   ]
115212   
115213 ]
115214
115215 [heading Requirements]
115216
115217 ['Header: ][^boost/asio/time_traits.hpp]
115218
115219 ['Convenience header: ][^boost/asio.hpp]
115220
115221
115222 [section:add time_traits< boost::posix_time::ptime >::add]
115223
115224 [indexterm2 boost_asio.indexterm.time_traits_lt__ptime__gt_.add..add..time_traits< boost::posix_time::ptime >] 
115225 Add a duration to a time. 
115226
115227
115228   static time_type add(
115229       const time_type & t,
115230       const duration_type & d);
115231
115232
115233
115234 [endsect]
115235
115236
115237
115238 [section:duration_type time_traits< boost::posix_time::ptime >::duration_type]
115239
115240 [indexterm2 boost_asio.indexterm.time_traits_lt__ptime__gt_.duration_type..duration_type..time_traits< boost::posix_time::ptime >] 
115241 The duration type. 
115242
115243
115244   typedef boost::posix_time::time_duration duration_type;
115245
115246
115247
115248 [heading Requirements]
115249
115250 ['Header: ][^boost/asio/time_traits.hpp]
115251
115252 ['Convenience header: ][^boost/asio.hpp]
115253
115254
115255 [endsect]
115256
115257
115258
115259 [section:less_than time_traits< boost::posix_time::ptime >::less_than]
115260
115261 [indexterm2 boost_asio.indexterm.time_traits_lt__ptime__gt_.less_than..less_than..time_traits< boost::posix_time::ptime >] 
115262 Test whether one time is less than another. 
115263
115264
115265   static bool less_than(
115266       const time_type & t1,
115267       const time_type & t2);
115268
115269
115270
115271 [endsect]
115272
115273
115274
115275 [section:now time_traits< boost::posix_time::ptime >::now]
115276
115277 [indexterm2 boost_asio.indexterm.time_traits_lt__ptime__gt_.now..now..time_traits< boost::posix_time::ptime >] 
115278 Get the current time. 
115279
115280
115281   static time_type now();
115282
115283
115284
115285 [endsect]
115286
115287
115288
115289 [section:subtract time_traits< boost::posix_time::ptime >::subtract]
115290
115291 [indexterm2 boost_asio.indexterm.time_traits_lt__ptime__gt_.subtract..subtract..time_traits< boost::posix_time::ptime >] 
115292 Subtract one time from another. 
115293
115294
115295   static duration_type subtract(
115296       const time_type & t1,
115297       const time_type & t2);
115298
115299
115300
115301 [endsect]
115302
115303
115304
115305 [section:time_type time_traits< boost::posix_time::ptime >::time_type]
115306
115307 [indexterm2 boost_asio.indexterm.time_traits_lt__ptime__gt_.time_type..time_type..time_traits< boost::posix_time::ptime >] 
115308 The time type. 
115309
115310
115311   typedef boost::posix_time::ptime time_type;
115312
115313
115314
115315 [heading Requirements]
115316
115317 ['Header: ][^boost/asio/time_traits.hpp]
115318
115319 ['Convenience header: ][^boost/asio.hpp]
115320
115321
115322 [endsect]
115323
115324
115325
115326 [section:to_posix_duration time_traits< boost::posix_time::ptime >::to_posix_duration]
115327
115328 [indexterm2 boost_asio.indexterm.time_traits_lt__ptime__gt_.to_posix_duration..to_posix_duration..time_traits< boost::posix_time::ptime >] 
115329 Convert to POSIX duration type. 
115330
115331
115332   static boost::posix_time::time_duration to_posix_duration(
115333       const duration_type & d);
115334
115335
115336
115337 [endsect]
115338
115339
115340
115341 [endsect]
115342
115343
115344 [section:transfer_all transfer_all]
115345
115346 [indexterm1 boost_asio.indexterm.transfer_all..transfer_all] 
115347 Return a completion condition function object that indicates that a read or write operation should continue until all of the data has been transferred, or until an error occurs. 
115348
115349
115350   unspecified transfer_all();
115351
115352
115353 This function is used to create an object, of unspecified type, that meets CompletionCondition requirements.
115354
115355
115356 [heading Example]
115357   
115358 Reading until a buffer is full: 
115359
115360    boost::array<char, 128> buf;
115361    boost::system::error_code ec;
115362    std::size_t n = boost::asio::read(
115363        sock, boost::asio::buffer(buf),
115364        boost::asio::transfer_all(), ec);
115365    if (ec)
115366    {
115367      // An error occurred.
115368    }
115369    else
115370    {
115371      // n == 128
115372    }
115373
115374
115375
115376
115377
115378
115379 [heading Requirements]
115380
115381 ['Header: ][^boost/asio/completion_condition.hpp]
115382
115383 ['Convenience header: ][^boost/asio.hpp]
115384
115385
115386 [endsect]
115387
115388
115389
115390 [section:transfer_at_least transfer_at_least]
115391
115392 [indexterm1 boost_asio.indexterm.transfer_at_least..transfer_at_least] 
115393 Return a completion condition function object that indicates that a read or write operation should continue until a minimum number of bytes has been transferred, or until an error occurs. 
115394
115395
115396   unspecified transfer_at_least(
115397       std::size_t minimum);
115398
115399
115400 This function is used to create an object, of unspecified type, that meets CompletionCondition requirements.
115401
115402
115403 [heading Example]
115404   
115405 Reading until a buffer is full or contains at least 64 bytes: 
115406
115407    boost::array<char, 128> buf;
115408    boost::system::error_code ec;
115409    std::size_t n = boost::asio::read(
115410        sock, boost::asio::buffer(buf),
115411        boost::asio::transfer_at_least(64), ec);
115412    if (ec)
115413    {
115414      // An error occurred.
115415    }
115416    else
115417    {
115418      // n >= 64 && n <= 128
115419    }
115420
115421
115422
115423
115424
115425
115426 [heading Requirements]
115427
115428 ['Header: ][^boost/asio/completion_condition.hpp]
115429
115430 ['Convenience header: ][^boost/asio.hpp]
115431
115432
115433 [endsect]
115434
115435
115436
115437 [section:transfer_exactly transfer_exactly]
115438
115439 [indexterm1 boost_asio.indexterm.transfer_exactly..transfer_exactly] 
115440 Return a completion condition function object that indicates that a read or write operation should continue until an exact number of bytes has been transferred, or until an error occurs. 
115441
115442
115443   unspecified transfer_exactly(
115444       std::size_t size);
115445
115446
115447 This function is used to create an object, of unspecified type, that meets CompletionCondition requirements.
115448
115449
115450 [heading Example]
115451   
115452 Reading until a buffer is full or contains exactly 64 bytes: 
115453
115454    boost::array<char, 128> buf;
115455    boost::system::error_code ec;
115456    std::size_t n = boost::asio::read(
115457        sock, boost::asio::buffer(buf),
115458        boost::asio::transfer_exactly(64), ec);
115459    if (ec)
115460    {
115461      // An error occurred.
115462    }
115463    else
115464    {
115465      // n == 64
115466    }
115467
115468
115469
115470
115471
115472
115473 [heading Requirements]
115474
115475 ['Header: ][^boost/asio/completion_condition.hpp]
115476
115477 ['Convenience header: ][^boost/asio.hpp]
115478
115479
115480 [endsect]
115481
115482
115483
115484 [section:use_awaitable use_awaitable]
115485
115486 [indexterm1 boost_asio.indexterm.use_awaitable..use_awaitable] 
115487 A completion token object that represents the currently executing coroutine. 
115488
115489
115490   constexpr use_awaitable_t use_awaitable;
115491
115492
115493 See the documentation for [link boost_asio.reference.use_awaitable_t `use_awaitable_t`] for a usage example. 
115494
115495 [heading Requirements]
115496
115497 ['Header: ][^boost/asio/use_awaitable.hpp]
115498
115499 ['Convenience header: ][^boost/asio.hpp]
115500
115501
115502 [endsect]
115503
115504
115505 [section:use_awaitable_t use_awaitable_t]
115506
115507
115508 A completion token that represents the currently executing coroutine. 
115509
115510
115511   template<
115512       typename ``[link boost_asio.reference.Executor1 Executor]`` = executor>
115513   struct use_awaitable_t
115514
115515
115516 [heading Types]
115517 [table
115518   [[Name][Description]]
115519
115520   [
115521
115522     [[link boost_asio.reference.use_awaitable_t__executor_with_default [*executor_with_default]]]
115523     [Adapts an executor to add the use_awaitable_t completion token as the default. ]
115524   
115525   ]
115526
115527 ]
115528
115529 [heading Member Functions]
115530 [table
115531   [[Name][Description]]
115532
115533   [
115534     [[link boost_asio.reference.use_awaitable_t.as_default_on [*as_default_on]]]
115535     [Function helper to adapt an I/O object to use use_awaitable_t as its default completion token type. ]
115536   ]
115537   
115538   [
115539     [[link boost_asio.reference.use_awaitable_t.use_awaitable_t [*use_awaitable_t]]]
115540     [Default constructor. ]
115541   ]
115542   
115543 ]
115544
115545 The `use_awaitable_t` class, with its value `use_awaitable`, is used to represent the currently executing coroutine. This completion token may be passed as a handler to an asynchronous operation. For example:
115546
115547
115548
115549    awaitable<void> my_coroutine()
115550    {
115551      std::size_t n = co_await my_socket.async_read_some(buffer, use_awaitable);
115552      ...
115553    } 
115554
115555
115556
115557
115558 When used with co\_await, the initiating function (`async_read_some` in the above example) suspends the current coroutine. The coroutine is resumed when the asynchronous operation completes, and the result of the operation is returned. 
115559
115560 [heading Requirements]
115561
115562 ['Header: ][^boost/asio/use_awaitable.hpp]
115563
115564 ['Convenience header: ][^boost/asio.hpp]
115565
115566
115567 [section:as_default_on use_awaitable_t::as_default_on]
115568
115569 [indexterm2 boost_asio.indexterm.use_awaitable_t.as_default_on..as_default_on..use_awaitable_t] 
115570 Function helper to adapt an I/O object to use `use_awaitable_t` as its default completion token type. 
115571
115572
115573   template<
115574       typename T>
115575   static T::template rebind_executor< executor_with_default< typename T::executor_type > >::other as_default_on(
115576       T && object);
115577
115578
115579
115580 [endsect]
115581
115582
115583
115584 [section:use_awaitable_t use_awaitable_t::use_awaitable_t]
115585
115586 [indexterm2 boost_asio.indexterm.use_awaitable_t.use_awaitable_t..use_awaitable_t..use_awaitable_t] 
115587 Default constructor. 
115588
115589
115590   constexpr use_awaitable_t();
115591
115592
115593
115594 [endsect]
115595
115596
115597
115598 [endsect]
115599
115600 [section:use_awaitable_t__executor_with_default use_awaitable_t::executor_with_default]
115601
115602
115603 Adapts an executor to add the `use_awaitable_t` completion token as the default. 
115604
115605
115606   template<
115607       typename ``[link boost_asio.reference.Executor1 InnerExecutor]``>
115608   struct executor_with_default
115609
115610
115611 [heading Types]
115612 [table
115613   [[Name][Description]]
115614
115615   [
115616
115617     [[link boost_asio.reference.use_awaitable_t__executor_with_default.default_completion_token_type [*default_completion_token_type]]]
115618     [Specify use_awaitable_t as the default completion token type. ]
115619   
115620   ]
115621
115622 ]
115623
115624 [heading Member Functions]
115625 [table
115626   [[Name][Description]]
115627
115628   [
115629     [[link boost_asio.reference.use_awaitable_t__executor_with_default.executor_with_default [*executor_with_default]]]
115630     [Construct the adapted executor from the inner executor type. ]
115631   ]
115632   
115633 ]
115634
115635 [heading Requirements]
115636
115637 ['Header: ][^boost/asio/use_awaitable.hpp]
115638
115639 ['Convenience header: ][^boost/asio.hpp]
115640
115641
115642 [section:default_completion_token_type use_awaitable_t::executor_with_default::default_completion_token_type]
115643
115644 [indexterm2 boost_asio.indexterm.use_awaitable_t__executor_with_default.default_completion_token_type..default_completion_token_type..use_awaitable_t::executor_with_default] 
115645 Specify `use_awaitable_t` as the default completion token type. 
115646
115647
115648   typedef use_awaitable_t default_completion_token_type;
115649
115650
115651 [heading Types]
115652 [table
115653   [[Name][Description]]
115654
115655   [
115656
115657     [[link boost_asio.reference.use_awaitable_t__executor_with_default [*executor_with_default]]]
115658     [Adapts an executor to add the use_awaitable_t completion token as the default. ]
115659   
115660   ]
115661
115662 ]
115663
115664 [heading Member Functions]
115665 [table
115666   [[Name][Description]]
115667
115668   [
115669     [[link boost_asio.reference.use_awaitable_t.as_default_on [*as_default_on]]]
115670     [Function helper to adapt an I/O object to use use_awaitable_t as its default completion token type. ]
115671   ]
115672   
115673   [
115674     [[link boost_asio.reference.use_awaitable_t.use_awaitable_t [*use_awaitable_t]]]
115675     [Default constructor. ]
115676   ]
115677   
115678 ]
115679
115680 The `use_awaitable_t` class, with its value `use_awaitable`, is used to represent the currently executing coroutine. This completion token may be passed as a handler to an asynchronous operation. For example:
115681
115682
115683
115684    awaitable<void> my_coroutine()
115685    {
115686      std::size_t n = co_await my_socket.async_read_some(buffer, use_awaitable);
115687      ...
115688    } 
115689
115690
115691
115692
115693 When used with co\_await, the initiating function (`async_read_some` in the above example) suspends the current coroutine. The coroutine is resumed when the asynchronous operation completes, and the result of the operation is returned. 
115694
115695
115696 [heading Requirements]
115697
115698 ['Header: ][^boost/asio/use_awaitable.hpp]
115699
115700 ['Convenience header: ][^boost/asio.hpp]
115701
115702
115703 [endsect]
115704
115705
115706
115707 [section:executor_with_default use_awaitable_t::executor_with_default::executor_with_default]
115708
115709 [indexterm2 boost_asio.indexterm.use_awaitable_t__executor_with_default.executor_with_default..executor_with_default..use_awaitable_t::executor_with_default] 
115710 Construct the adapted executor from the inner executor type. 
115711
115712
115713   executor_with_default(
115714       const InnerExecutor & ex);
115715
115716
115717
115718 [endsect]
115719
115720
115721
115722 [endsect]
115723
115724
115725 [section:use_future use_future]
115726
115727 [indexterm1 boost_asio.indexterm.use_future..use_future] 
115728 A special value, similar to std::nothrow. 
115729
115730
115731   constexpr use_future_t use_future;
115732
115733
115734 See the documentation for [link boost_asio.reference.use_future_t `use_future_t`] for a usage example. 
115735
115736 [heading Requirements]
115737
115738 ['Header: ][^boost/asio/use_future.hpp]
115739
115740 ['Convenience header: ][^boost/asio.hpp]
115741
115742
115743 [endsect]
115744
115745
115746 [section:use_future_t use_future_t]
115747
115748
115749 Class used to specify that an asynchronous operation should return a future. 
115750
115751
115752   template<
115753       typename Allocator = std::allocator<void>>
115754   class use_future_t
115755
115756
115757 [heading Types]
115758 [table
115759   [[Name][Description]]
115760
115761   [
115762
115763     [[link boost_asio.reference.use_future_t.allocator_type [*allocator_type]]]
115764     [The allocator type. The allocator is used when constructing the std::promise object for a given asynchronous operation. ]
115765   
115766   ]
115767
115768 ]
115769
115770 [heading Member Functions]
115771 [table
115772   [[Name][Description]]
115773
115774   [
115775     [[link boost_asio.reference.use_future_t.get_allocator [*get_allocator]]]
115776     [Obtain allocator. ]
115777   ]
115778   
115779   [
115780     [[link boost_asio.reference.use_future_t.operator_lp__rp_ [*operator()]]]
115781     [Wrap a function object in a packaged task. ]
115782   ]
115783   
115784   [
115785     [[link boost_asio.reference.use_future_t.operator_lb__rb_ [*operator\[\]]]]
115786     [(Deprecated: Use rebind().) Specify an alternate allocator. ]
115787   ]
115788   
115789   [
115790     [[link boost_asio.reference.use_future_t.rebind [*rebind]]]
115791     [Specify an alternate allocator. ]
115792   ]
115793   
115794   [
115795     [[link boost_asio.reference.use_future_t.use_future_t [*use_future_t]]]
115796     [Construct using default-constructed allocator. 
115797      [hr]
115798      Construct using specified allocator. ]
115799   ]
115800   
115801 ]
115802
115803 The [link boost_asio.reference.use_future_t `use_future_t`] class is used to indicate that an asynchronous operation should return a std::future object. A [link boost_asio.reference.use_future_t `use_future_t`] object may be passed as a handler to an asynchronous operation, typically using the special value `boost::asio::use_future`. For example:
115804
115805
115806
115807    std::future<std::size_t> my_future
115808      = my_socket.async_read_some(my_buffer, boost::asio::use_future); 
115809
115810
115811
115812
115813 The initiating function (async\_read\_some in the above example) returns a future that will receive the result of the operation. If the operation completes with an error\_code indicating failure, it is converted into a system\_error and passed back to the caller via the future. 
115814
115815 [heading Requirements]
115816
115817 ['Header: ][^boost/asio/use_future.hpp]
115818
115819 ['Convenience header: ][^boost/asio.hpp]
115820
115821
115822 [section:allocator_type use_future_t::allocator_type]
115823
115824 [indexterm2 boost_asio.indexterm.use_future_t.allocator_type..allocator_type..use_future_t] 
115825 The allocator type. The allocator is used when constructing the `std::promise` object for a given asynchronous operation. 
115826
115827
115828   typedef Allocator allocator_type;
115829
115830
115831
115832 [heading Requirements]
115833
115834 ['Header: ][^boost/asio/use_future.hpp]
115835
115836 ['Convenience header: ][^boost/asio.hpp]
115837
115838
115839 [endsect]
115840
115841
115842
115843 [section:get_allocator use_future_t::get_allocator]
115844
115845 [indexterm2 boost_asio.indexterm.use_future_t.get_allocator..get_allocator..use_future_t] 
115846 Obtain allocator. 
115847
115848
115849   allocator_type get_allocator() const;
115850
115851
115852
115853 [endsect]
115854
115855
115856
115857 [section:operator_lp__rp_ use_future_t::operator()]
115858
115859 [indexterm2 boost_asio.indexterm.use_future_t.operator_lp__rp_..operator()..use_future_t] 
115860 Wrap a function object in a packaged task. 
115861
115862
115863   template<
115864       typename Function>
115865   unspecified operator()(
115866       Function && f) const;
115867
115868
115869 The `package` function is used to adapt a function object as a packaged task. When this adapter is passed as a completion token to an asynchronous operation, the result of the function object is retuned via a std::future.
115870
115871
115872 [heading Example]
115873   
115874
115875
115876
115877
115878    std::future<std::size_t> fut =
115879      my_socket.async_read_some(buffer,
115880        use_future([](boost::system::error_code ec, std::size_t n)
115881          {
115882            return ec ? 0 : n;
115883          }));
115884    ...
115885    std::size_t n = fut.get(); 
115886
115887
115888
115889
115890
115891 [endsect]
115892
115893
115894
115895 [section:operator_lb__rb_ use_future_t::operator\[\]]
115896
115897 [indexterm2 boost_asio.indexterm.use_future_t.operator_lb__rb_..operator\[\]..use_future_t] 
115898 (Deprecated: Use `rebind()`.) Specify an alternate allocator. 
115899
115900
115901   template<
115902       typename OtherAllocator>
115903   use_future_t< OtherAllocator > operator[](
115904       const OtherAllocator & allocator) const;
115905
115906
115907
115908 [endsect]
115909
115910
115911
115912 [section:rebind use_future_t::rebind]
115913
115914 [indexterm2 boost_asio.indexterm.use_future_t.rebind..rebind..use_future_t] 
115915 Specify an alternate allocator. 
115916
115917
115918   template<
115919       typename OtherAllocator>
115920   use_future_t< OtherAllocator > rebind(
115921       const OtherAllocator & allocator) const;
115922
115923
115924
115925 [endsect]
115926
115927
115928 [section:use_future_t use_future_t::use_future_t]
115929
115930 [indexterm2 boost_asio.indexterm.use_future_t.use_future_t..use_future_t..use_future_t] 
115931 Construct using default-constructed allocator. 
115932
115933
115934   constexpr ``[link boost_asio.reference.use_future_t.use_future_t.overload1 use_future_t]``();
115935   ``  [''''&raquo;''' [link boost_asio.reference.use_future_t.use_future_t.overload1 more...]]``
115936
115937
115938 Construct using specified allocator. 
115939
115940
115941   explicit ``[link boost_asio.reference.use_future_t.use_future_t.overload2 use_future_t]``(
115942       const Allocator & allocator);
115943   ``  [''''&raquo;''' [link boost_asio.reference.use_future_t.use_future_t.overload2 more...]]``
115944
115945
115946 [section:overload1 use_future_t::use_future_t (1 of 2 overloads)]
115947
115948
115949 Construct using default-constructed allocator. 
115950
115951
115952   constexpr use_future_t();
115953
115954
115955
115956 [endsect]
115957
115958
115959
115960 [section:overload2 use_future_t::use_future_t (2 of 2 overloads)]
115961
115962
115963 Construct using specified allocator. 
115964
115965
115966   use_future_t(
115967       const Allocator & allocator);
115968
115969
115970
115971 [endsect]
115972
115973
115974 [endsect]
115975
115976
115977 [endsect]
115978
115979 [section:uses_executor uses_executor]
115980
115981
115982 The [link boost_asio.reference.uses_executor `uses_executor`] trait detects whether a type T has an associated executor that is convertible from type Executor. 
115983
115984
115985   template<
115986       typename T,
115987       typename ``[link boost_asio.reference.Executor1 Executor]``>
115988   struct uses_executor
115989
115990
115991 Meets the BinaryTypeTrait requirements. The Asio library provides a definition that is derived from false\_type. A program may specialize this template to derive from true\_type for a user-defined type T that can be constructed with an executor, where the first argument of a constructor has type [link boost_asio.reference.executor_arg_t `executor_arg_t`] and the second argument is convertible from type Executor. 
115992
115993 [heading Requirements]
115994
115995 ['Header: ][^boost/asio/uses_executor.hpp]
115996
115997 ['Convenience header: ][^boost/asio.hpp]
115998
115999
116000 [endsect]
116001
116002 [section:wait_traits wait_traits]
116003
116004
116005 Wait traits suitable for use with the [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] class template. 
116006
116007
116008   template<
116009       typename Clock>
116010   struct wait_traits
116011
116012
116013 [heading Member Functions]
116014 [table
116015   [[Name][Description]]
116016
116017   [
116018     [[link boost_asio.reference.wait_traits.to_wait_duration [*to_wait_duration]]]
116019     [Convert a clock duration into a duration used for waiting. ]
116020   ]
116021   
116022 ]
116023
116024 [heading Requirements]
116025
116026 ['Header: ][^boost/asio/wait_traits.hpp]
116027
116028 ['Convenience header: ][^boost/asio.hpp]
116029
116030 [section:to_wait_duration wait_traits::to_wait_duration]
116031
116032 [indexterm2 boost_asio.indexterm.wait_traits.to_wait_duration..to_wait_duration..wait_traits] 
116033 Convert a clock duration into a duration used for waiting. 
116034
116035
116036   static Clock::duration ``[link boost_asio.reference.wait_traits.to_wait_duration.overload1 to_wait_duration]``(
116037       const typename Clock::duration & d);
116038   ``  [''''&raquo;''' [link boost_asio.reference.wait_traits.to_wait_duration.overload1 more...]]``
116039
116040   static Clock::duration ``[link boost_asio.reference.wait_traits.to_wait_duration.overload2 to_wait_duration]``(
116041       const typename Clock::time_point & t);
116042   ``  [''''&raquo;''' [link boost_asio.reference.wait_traits.to_wait_duration.overload2 more...]]``
116043
116044
116045 [section:overload1 wait_traits::to_wait_duration (1 of 2 overloads)]
116046
116047
116048 Convert a clock duration into a duration used for waiting. 
116049
116050
116051   static Clock::duration to_wait_duration(
116052       const typename Clock::duration & d);
116053
116054
116055
116056 [heading Return Value]
116057       
116058 `d`. 
116059
116060
116061
116062
116063 [endsect]
116064
116065
116066
116067 [section:overload2 wait_traits::to_wait_duration (2 of 2 overloads)]
116068
116069
116070 Convert a clock duration into a duration used for waiting. 
116071
116072
116073   static Clock::duration to_wait_duration(
116074       const typename Clock::time_point & t);
116075
116076
116077
116078 [heading Return Value]
116079       
116080 `d`. 
116081
116082
116083
116084
116085 [endsect]
116086
116087
116088 [endsect]
116089
116090
116091 [endsect]
116092
116093 [section:windows__basic_object_handle windows::basic_object_handle]
116094
116095
116096 Provides object-oriented handle functionality. 
116097
116098
116099   template<
116100       typename ``[link boost_asio.reference.Executor1 Executor]`` = executor>
116101   class basic_object_handle
116102
116103
116104 [heading Types]
116105 [table
116106   [[Name][Description]]
116107
116108   [
116109
116110     [[link boost_asio.reference.windows__basic_object_handle__rebind_executor [*rebind_executor]]]
116111     [Rebinds the handle type to another executor. ]
116112   
116113   ]
116114
116115   [
116116
116117     [[link boost_asio.reference.windows__basic_object_handle.executor_type [*executor_type]]]
116118     [The type of the executor associated with the object. ]
116119   
116120   ]
116121
116122   [
116123
116124     [[link boost_asio.reference.windows__basic_object_handle.lowest_layer_type [*lowest_layer_type]]]
116125     [An object handle is always the lowest layer. ]
116126   
116127   ]
116128
116129   [
116130
116131     [[link boost_asio.reference.windows__basic_object_handle.native_handle_type [*native_handle_type]]]
116132     [The native representation of a handle. ]
116133   
116134   ]
116135
116136 ]
116137
116138 [heading Member Functions]
116139 [table
116140   [[Name][Description]]
116141
116142   [
116143     [[link boost_asio.reference.windows__basic_object_handle.assign [*assign]]]
116144     [Assign an existing native handle to the handle. ]
116145   ]
116146   
116147   [
116148     [[link boost_asio.reference.windows__basic_object_handle.async_wait [*async_wait]]]
116149     [Start an asynchronous wait on the object handle. ]
116150   ]
116151   
116152   [
116153     [[link boost_asio.reference.windows__basic_object_handle.basic_object_handle [*basic_object_handle]]]
116154     [Construct an object handle without opening it. 
116155      [hr]
116156      Construct an object handle on an existing native handle. 
116157      [hr]
116158      Move-construct an object handle from another. ]
116159   ]
116160   
116161   [
116162     [[link boost_asio.reference.windows__basic_object_handle.cancel [*cancel]]]
116163     [Cancel all asynchronous operations associated with the handle. ]
116164   ]
116165   
116166   [
116167     [[link boost_asio.reference.windows__basic_object_handle.close [*close]]]
116168     [Close the handle. ]
116169   ]
116170   
116171   [
116172     [[link boost_asio.reference.windows__basic_object_handle.get_executor [*get_executor]]]
116173     [Get the executor associated with the object. ]
116174   ]
116175   
116176   [
116177     [[link boost_asio.reference.windows__basic_object_handle.is_open [*is_open]]]
116178     [Determine whether the handle is open. ]
116179   ]
116180   
116181   [
116182     [[link boost_asio.reference.windows__basic_object_handle.lowest_layer [*lowest_layer]]]
116183     [Get a reference to the lowest layer. 
116184      [hr]
116185      Get a const reference to the lowest layer. ]
116186   ]
116187   
116188   [
116189     [[link boost_asio.reference.windows__basic_object_handle.native_handle [*native_handle]]]
116190     [Get the native handle representation. ]
116191   ]
116192   
116193   [
116194     [[link boost_asio.reference.windows__basic_object_handle.operator_eq_ [*operator=]]]
116195     [Move-assign an object handle from another. ]
116196   ]
116197   
116198   [
116199     [[link boost_asio.reference.windows__basic_object_handle.wait [*wait]]]
116200     [Perform a blocking wait on the object handle. ]
116201   ]
116202   
116203 ]
116204
116205 The [link boost_asio.reference.windows__basic_object_handle `windows::basic_object_handle`] class provides asynchronous and blocking object-oriented handle functionality.
116206
116207
116208 [heading Thread Safety]
116209   
116210 ['Distinct] ['objects:] Safe.
116211
116212 ['Shared] ['objects:] Unsafe. 
116213
116214
116215
116216 [heading Requirements]
116217
116218 ['Header: ][^boost/asio/windows/basic_object_handle.hpp]
116219
116220 ['Convenience header: ][^boost/asio.hpp]
116221
116222 [section:assign windows::basic_object_handle::assign]
116223
116224 [indexterm2 boost_asio.indexterm.windows__basic_object_handle.assign..assign..windows::basic_object_handle] 
116225 Assign an existing native handle to the handle. 
116226
116227
116228   void ``[link boost_asio.reference.windows__basic_object_handle.assign.overload1 assign]``(
116229       const native_handle_type & handle);
116230   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_object_handle.assign.overload1 more...]]``
116231
116232   void ``[link boost_asio.reference.windows__basic_object_handle.assign.overload2 assign]``(
116233       const native_handle_type & handle,
116234       boost::system::error_code & ec);
116235   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_object_handle.assign.overload2 more...]]``
116236
116237
116238 [section:overload1 windows::basic_object_handle::assign (1 of 2 overloads)]
116239
116240
116241 Assign an existing native handle to the handle. 
116242
116243
116244   void assign(
116245       const native_handle_type & handle);
116246
116247
116248
116249 [endsect]
116250
116251
116252
116253 [section:overload2 windows::basic_object_handle::assign (2 of 2 overloads)]
116254
116255
116256 Assign an existing native handle to the handle. 
116257
116258
116259   void assign(
116260       const native_handle_type & handle,
116261       boost::system::error_code & ec);
116262
116263
116264
116265 [endsect]
116266
116267
116268 [endsect]
116269
116270
116271 [section:async_wait windows::basic_object_handle::async_wait]
116272
116273 [indexterm2 boost_asio.indexterm.windows__basic_object_handle.async_wait..async_wait..windows::basic_object_handle] 
116274 Start an asynchronous wait on the object handle. 
116275
116276
116277   template<
116278       typename ``[link boost_asio.reference.WaitHandler WaitHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
116279   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait(
116280       WaitHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
116281
116282
116283 This function is be used to initiate an asynchronous wait against the object handle. It always returns immediately.
116284
116285
116286 [heading Parameters]
116287     
116288
116289 [variablelist
116290   
116291 [[handler][The handler to be called when the object handle is set to the signalled state. Copies will be made of the handler as required. The function signature of the handler must be: 
116292 ``
116293    void handler(
116294      const boost::system::error_code& error // Result of operation.
116295    ); 
116296 ``
116297 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
116298
116299 ]
116300
116301
116302
116303
116304 [endsect]
116305
116306
116307 [section:basic_object_handle windows::basic_object_handle::basic_object_handle]
116308
116309 [indexterm2 boost_asio.indexterm.windows__basic_object_handle.basic_object_handle..basic_object_handle..windows::basic_object_handle] 
116310 Construct an object handle without opening it. 
116311
116312
116313   explicit ``[link boost_asio.reference.windows__basic_object_handle.basic_object_handle.overload1 basic_object_handle]``(
116314       const executor_type & ex);
116315   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_object_handle.basic_object_handle.overload1 more...]]``
116316
116317   template<
116318       typename ExecutionContext>
116319   explicit ``[link boost_asio.reference.windows__basic_object_handle.basic_object_handle.overload2 basic_object_handle]``(
116320       ExecutionContext & context,
116321       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value, basic_object_handle >::type *  = 0);
116322   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_object_handle.basic_object_handle.overload2 more...]]``
116323
116324
116325 Construct an object handle on an existing native handle. 
116326
116327
116328   ``[link boost_asio.reference.windows__basic_object_handle.basic_object_handle.overload3 basic_object_handle]``(
116329       const executor_type & ex,
116330       const native_handle_type & native_handle);
116331   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_object_handle.basic_object_handle.overload3 more...]]``
116332
116333   template<
116334       typename ExecutionContext>
116335   ``[link boost_asio.reference.windows__basic_object_handle.basic_object_handle.overload4 basic_object_handle]``(
116336       ExecutionContext & context,
116337       const native_handle_type & native_handle,
116338       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
116339   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_object_handle.basic_object_handle.overload4 more...]]``
116340
116341
116342 Move-construct an object handle from another. 
116343
116344
116345   ``[link boost_asio.reference.windows__basic_object_handle.basic_object_handle.overload5 basic_object_handle]``(
116346       basic_object_handle && other);
116347   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_object_handle.basic_object_handle.overload5 more...]]``
116348
116349
116350 [section:overload1 windows::basic_object_handle::basic_object_handle (1 of 5 overloads)]
116351
116352
116353 Construct an object handle without opening it. 
116354
116355
116356   basic_object_handle(
116357       const executor_type & ex);
116358
116359
116360 This constructor creates an object handle without opening it.
116361
116362
116363 [heading Parameters]
116364     
116365
116366 [variablelist
116367   
116368 [[ex][The I/O executor that the object handle will use, by default, to dispatch handlers for any asynchronous operations performed on the object handle. ]]
116369
116370 ]
116371
116372
116373
116374
116375 [endsect]
116376
116377
116378
116379 [section:overload2 windows::basic_object_handle::basic_object_handle (2 of 5 overloads)]
116380
116381
116382 Construct an object handle without opening it. 
116383
116384
116385   template<
116386       typename ExecutionContext>
116387   basic_object_handle(
116388       ExecutionContext & context,
116389       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value, basic_object_handle >::type *  = 0);
116390
116391
116392 This constructor creates an object handle without opening it.
116393
116394
116395 [heading Parameters]
116396     
116397
116398 [variablelist
116399   
116400 [[context][An execution context which provides the I/O executor that the object handle will use, by default, to dispatch handlers for any asynchronous operations performed on the object handle. ]]
116401
116402 ]
116403
116404
116405
116406
116407 [endsect]
116408
116409
116410
116411 [section:overload3 windows::basic_object_handle::basic_object_handle (3 of 5 overloads)]
116412
116413
116414 Construct an object handle on an existing native handle. 
116415
116416
116417   basic_object_handle(
116418       const executor_type & ex,
116419       const native_handle_type & native_handle);
116420
116421
116422 This constructor creates an object handle object to hold an existing native handle.
116423
116424
116425 [heading Parameters]
116426     
116427
116428 [variablelist
116429   
116430 [[ex][The I/O executor that the object handle will use, by default, to dispatch handlers for any asynchronous operations performed on the object handle.]]
116431
116432 [[native_handle][The new underlying handle implementation.]]
116433
116434 ]
116435
116436
116437 [heading Exceptions]
116438     
116439
116440 [variablelist
116441   
116442 [[boost::system::system_error][Thrown on failure. ]]
116443
116444 ]
116445
116446
116447
116448
116449 [endsect]
116450
116451
116452
116453 [section:overload4 windows::basic_object_handle::basic_object_handle (4 of 5 overloads)]
116454
116455
116456 Construct an object handle on an existing native handle. 
116457
116458
116459   template<
116460       typename ExecutionContext>
116461   basic_object_handle(
116462       ExecutionContext & context,
116463       const native_handle_type & native_handle,
116464       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
116465
116466
116467 This constructor creates an object handle object to hold an existing native handle.
116468
116469
116470 [heading Parameters]
116471     
116472
116473 [variablelist
116474   
116475 [[context][An execution context which provides the I/O executor that the object handle will use, by default, to dispatch handlers for any asynchronous operations performed on the object handle.]]
116476
116477 [[native_handle][The new underlying handle implementation.]]
116478
116479 ]
116480
116481
116482 [heading Exceptions]
116483     
116484
116485 [variablelist
116486   
116487 [[boost::system::system_error][Thrown on failure. ]]
116488
116489 ]
116490
116491
116492
116493
116494 [endsect]
116495
116496
116497
116498 [section:overload5 windows::basic_object_handle::basic_object_handle (5 of 5 overloads)]
116499
116500
116501 Move-construct an object handle from another. 
116502
116503
116504   basic_object_handle(
116505       basic_object_handle && other);
116506
116507
116508 This constructor moves an object handle from one object to another.
116509
116510
116511 [heading Parameters]
116512     
116513
116514 [variablelist
116515   
116516 [[other][The other object handle object from which the move will occur.]]
116517
116518 ]
116519
116520
116521 [heading Remarks]
116522       
116523 Following the move, the moved-from object is in the same state as if constructed using the `basic_object_handle(const executor_type&)` constructor. 
116524
116525
116526
116527
116528 [endsect]
116529
116530
116531 [endsect]
116532
116533 [section:cancel windows::basic_object_handle::cancel]
116534
116535 [indexterm2 boost_asio.indexterm.windows__basic_object_handle.cancel..cancel..windows::basic_object_handle] 
116536 Cancel all asynchronous operations associated with the handle. 
116537
116538
116539   void ``[link boost_asio.reference.windows__basic_object_handle.cancel.overload1 cancel]``();
116540   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_object_handle.cancel.overload1 more...]]``
116541
116542   void ``[link boost_asio.reference.windows__basic_object_handle.cancel.overload2 cancel]``(
116543       boost::system::error_code & ec);
116544   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_object_handle.cancel.overload2 more...]]``
116545
116546
116547 [section:overload1 windows::basic_object_handle::cancel (1 of 2 overloads)]
116548
116549
116550 Cancel all asynchronous operations associated with the handle. 
116551
116552
116553   void cancel();
116554
116555
116556 This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
116557
116558
116559 [heading Exceptions]
116560     
116561
116562 [variablelist
116563   
116564 [[boost::system::system_error][Thrown on failure. ]]
116565
116566 ]
116567
116568
116569
116570
116571 [endsect]
116572
116573
116574
116575 [section:overload2 windows::basic_object_handle::cancel (2 of 2 overloads)]
116576
116577
116578 Cancel all asynchronous operations associated with the handle. 
116579
116580
116581   void cancel(
116582       boost::system::error_code & ec);
116583
116584
116585 This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
116586
116587
116588 [heading Parameters]
116589     
116590
116591 [variablelist
116592   
116593 [[ec][Set to indicate what error occurred, if any. ]]
116594
116595 ]
116596
116597
116598
116599
116600 [endsect]
116601
116602
116603 [endsect]
116604
116605 [section:close windows::basic_object_handle::close]
116606
116607 [indexterm2 boost_asio.indexterm.windows__basic_object_handle.close..close..windows::basic_object_handle] 
116608 Close the handle. 
116609
116610
116611   void ``[link boost_asio.reference.windows__basic_object_handle.close.overload1 close]``();
116612   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_object_handle.close.overload1 more...]]``
116613
116614   void ``[link boost_asio.reference.windows__basic_object_handle.close.overload2 close]``(
116615       boost::system::error_code & ec);
116616   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_object_handle.close.overload2 more...]]``
116617
116618
116619 [section:overload1 windows::basic_object_handle::close (1 of 2 overloads)]
116620
116621
116622 Close the handle. 
116623
116624
116625   void close();
116626
116627
116628 This function is used to close the handle. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
116629
116630
116631 [heading Exceptions]
116632     
116633
116634 [variablelist
116635   
116636 [[boost::system::system_error][Thrown on failure. ]]
116637
116638 ]
116639
116640
116641
116642
116643 [endsect]
116644
116645
116646
116647 [section:overload2 windows::basic_object_handle::close (2 of 2 overloads)]
116648
116649
116650 Close the handle. 
116651
116652
116653   void close(
116654       boost::system::error_code & ec);
116655
116656
116657 This function is used to close the handle. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
116658
116659
116660 [heading Parameters]
116661     
116662
116663 [variablelist
116664   
116665 [[ec][Set to indicate what error occurred, if any. ]]
116666
116667 ]
116668
116669
116670
116671
116672 [endsect]
116673
116674
116675 [endsect]
116676
116677
116678 [section:executor_type windows::basic_object_handle::executor_type]
116679
116680 [indexterm2 boost_asio.indexterm.windows__basic_object_handle.executor_type..executor_type..windows::basic_object_handle] 
116681 The type of the executor associated with the object. 
116682
116683
116684   typedef Executor executor_type;
116685
116686
116687
116688 [heading Requirements]
116689
116690 ['Header: ][^boost/asio/windows/basic_object_handle.hpp]
116691
116692 ['Convenience header: ][^boost/asio.hpp]
116693
116694
116695 [endsect]
116696
116697
116698
116699 [section:get_executor windows::basic_object_handle::get_executor]
116700
116701 [indexterm2 boost_asio.indexterm.windows__basic_object_handle.get_executor..get_executor..windows::basic_object_handle] 
116702 Get the executor associated with the object. 
116703
116704
116705   executor_type get_executor();
116706
116707
116708
116709 [endsect]
116710
116711
116712
116713 [section:is_open windows::basic_object_handle::is_open]
116714
116715 [indexterm2 boost_asio.indexterm.windows__basic_object_handle.is_open..is_open..windows::basic_object_handle] 
116716 Determine whether the handle is open. 
116717
116718
116719   bool is_open() const;
116720
116721
116722
116723 [endsect]
116724
116725
116726 [section:lowest_layer windows::basic_object_handle::lowest_layer]
116727
116728 [indexterm2 boost_asio.indexterm.windows__basic_object_handle.lowest_layer..lowest_layer..windows::basic_object_handle] 
116729 Get a reference to the lowest layer. 
116730
116731
116732   lowest_layer_type & ``[link boost_asio.reference.windows__basic_object_handle.lowest_layer.overload1 lowest_layer]``();
116733   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_object_handle.lowest_layer.overload1 more...]]``
116734
116735
116736 Get a const reference to the lowest layer. 
116737
116738
116739   const lowest_layer_type & ``[link boost_asio.reference.windows__basic_object_handle.lowest_layer.overload2 lowest_layer]``() const;
116740   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_object_handle.lowest_layer.overload2 more...]]``
116741
116742
116743 [section:overload1 windows::basic_object_handle::lowest_layer (1 of 2 overloads)]
116744
116745
116746 Get a reference to the lowest layer. 
116747
116748
116749   lowest_layer_type & lowest_layer();
116750
116751
116752 This function returns a reference to the lowest layer in a stack of layers. Since an object handle cannot contain any further layers, it simply returns a reference to itself.
116753
116754
116755 [heading Return Value]
116756       
116757 A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 
116758
116759
116760
116761
116762 [endsect]
116763
116764
116765
116766 [section:overload2 windows::basic_object_handle::lowest_layer (2 of 2 overloads)]
116767
116768
116769 Get a const reference to the lowest layer. 
116770
116771
116772   const lowest_layer_type & lowest_layer() const;
116773
116774
116775 This function returns a const reference to the lowest layer in a stack of layers. Since an object handle cannot contain any further layers, it simply returns a reference to itself.
116776
116777
116778 [heading Return Value]
116779       
116780 A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 
116781
116782
116783
116784
116785 [endsect]
116786
116787
116788 [endsect]
116789
116790
116791 [section:lowest_layer_type windows::basic_object_handle::lowest_layer_type]
116792
116793 [indexterm2 boost_asio.indexterm.windows__basic_object_handle.lowest_layer_type..lowest_layer_type..windows::basic_object_handle] 
116794 An object handle is always the lowest layer. 
116795
116796
116797   typedef basic_object_handle lowest_layer_type;
116798
116799
116800 [heading Types]
116801 [table
116802   [[Name][Description]]
116803
116804   [
116805
116806     [[link boost_asio.reference.windows__basic_object_handle__rebind_executor [*rebind_executor]]]
116807     [Rebinds the handle type to another executor. ]
116808   
116809   ]
116810
116811   [
116812
116813     [[link boost_asio.reference.windows__basic_object_handle.executor_type [*executor_type]]]
116814     [The type of the executor associated with the object. ]
116815   
116816   ]
116817
116818   [
116819
116820     [[link boost_asio.reference.windows__basic_object_handle.lowest_layer_type [*lowest_layer_type]]]
116821     [An object handle is always the lowest layer. ]
116822   
116823   ]
116824
116825   [
116826
116827     [[link boost_asio.reference.windows__basic_object_handle.native_handle_type [*native_handle_type]]]
116828     [The native representation of a handle. ]
116829   
116830   ]
116831
116832 ]
116833
116834 [heading Member Functions]
116835 [table
116836   [[Name][Description]]
116837
116838   [
116839     [[link boost_asio.reference.windows__basic_object_handle.assign [*assign]]]
116840     [Assign an existing native handle to the handle. ]
116841   ]
116842   
116843   [
116844     [[link boost_asio.reference.windows__basic_object_handle.async_wait [*async_wait]]]
116845     [Start an asynchronous wait on the object handle. ]
116846   ]
116847   
116848   [
116849     [[link boost_asio.reference.windows__basic_object_handle.basic_object_handle [*basic_object_handle]]]
116850     [Construct an object handle without opening it. 
116851      [hr]
116852      Construct an object handle on an existing native handle. 
116853      [hr]
116854      Move-construct an object handle from another. ]
116855   ]
116856   
116857   [
116858     [[link boost_asio.reference.windows__basic_object_handle.cancel [*cancel]]]
116859     [Cancel all asynchronous operations associated with the handle. ]
116860   ]
116861   
116862   [
116863     [[link boost_asio.reference.windows__basic_object_handle.close [*close]]]
116864     [Close the handle. ]
116865   ]
116866   
116867   [
116868     [[link boost_asio.reference.windows__basic_object_handle.get_executor [*get_executor]]]
116869     [Get the executor associated with the object. ]
116870   ]
116871   
116872   [
116873     [[link boost_asio.reference.windows__basic_object_handle.is_open [*is_open]]]
116874     [Determine whether the handle is open. ]
116875   ]
116876   
116877   [
116878     [[link boost_asio.reference.windows__basic_object_handle.lowest_layer [*lowest_layer]]]
116879     [Get a reference to the lowest layer. 
116880      [hr]
116881      Get a const reference to the lowest layer. ]
116882   ]
116883   
116884   [
116885     [[link boost_asio.reference.windows__basic_object_handle.native_handle [*native_handle]]]
116886     [Get the native handle representation. ]
116887   ]
116888   
116889   [
116890     [[link boost_asio.reference.windows__basic_object_handle.operator_eq_ [*operator=]]]
116891     [Move-assign an object handle from another. ]
116892   ]
116893   
116894   [
116895     [[link boost_asio.reference.windows__basic_object_handle.wait [*wait]]]
116896     [Perform a blocking wait on the object handle. ]
116897   ]
116898   
116899 ]
116900
116901 The [link boost_asio.reference.windows__basic_object_handle `windows::basic_object_handle`] class provides asynchronous and blocking object-oriented handle functionality.
116902
116903
116904 [heading Thread Safety]
116905   
116906 ['Distinct] ['objects:] Safe.
116907
116908 ['Shared] ['objects:] Unsafe. 
116909
116910
116911
116912
116913 [heading Requirements]
116914
116915 ['Header: ][^boost/asio/windows/basic_object_handle.hpp]
116916
116917 ['Convenience header: ][^boost/asio.hpp]
116918
116919
116920 [endsect]
116921
116922
116923
116924 [section:native_handle windows::basic_object_handle::native_handle]
116925
116926 [indexterm2 boost_asio.indexterm.windows__basic_object_handle.native_handle..native_handle..windows::basic_object_handle] 
116927 Get the native handle representation. 
116928
116929
116930   native_handle_type native_handle();
116931
116932
116933 This function may be used to obtain the underlying representation of the handle. This is intended to allow access to native handle functionality that is not otherwise provided. 
116934
116935
116936 [endsect]
116937
116938
116939
116940 [section:native_handle_type windows::basic_object_handle::native_handle_type]
116941
116942 [indexterm2 boost_asio.indexterm.windows__basic_object_handle.native_handle_type..native_handle_type..windows::basic_object_handle] 
116943 The native representation of a handle. 
116944
116945
116946   typedef implementation_defined native_handle_type;
116947
116948
116949
116950 [heading Requirements]
116951
116952 ['Header: ][^boost/asio/windows/basic_object_handle.hpp]
116953
116954 ['Convenience header: ][^boost/asio.hpp]
116955
116956
116957 [endsect]
116958
116959
116960
116961 [section:operator_eq_ windows::basic_object_handle::operator=]
116962
116963 [indexterm2 boost_asio.indexterm.windows__basic_object_handle.operator_eq_..operator=..windows::basic_object_handle] 
116964 Move-assign an object handle from another. 
116965
116966
116967   basic_object_handle & operator=(
116968       basic_object_handle && other);
116969
116970
116971 This assignment operator moves an object handle from one object to another.
116972
116973
116974 [heading Parameters]
116975     
116976
116977 [variablelist
116978   
116979 [[other][The other object handle object from which the move will occur.]]
116980
116981 ]
116982
116983
116984 [heading Remarks]
116985       
116986 Following the move, the moved-from object is in the same state as if constructed using the `basic_object_handle(const executor_type&)` constructor. 
116987
116988
116989
116990
116991 [endsect]
116992
116993
116994 [section:wait windows::basic_object_handle::wait]
116995
116996 [indexterm2 boost_asio.indexterm.windows__basic_object_handle.wait..wait..windows::basic_object_handle] 
116997 Perform a blocking wait on the object handle. 
116998
116999
117000   void ``[link boost_asio.reference.windows__basic_object_handle.wait.overload1 wait]``();
117001   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_object_handle.wait.overload1 more...]]``
117002
117003   void ``[link boost_asio.reference.windows__basic_object_handle.wait.overload2 wait]``(
117004       boost::system::error_code & ec);
117005   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_object_handle.wait.overload2 more...]]``
117006
117007
117008 [section:overload1 windows::basic_object_handle::wait (1 of 2 overloads)]
117009
117010
117011 Perform a blocking wait on the object handle. 
117012
117013
117014   void wait();
117015
117016
117017 This function is used to wait for the object handle to be set to the signalled state. This function blocks and does not return until the object handle has been set to the signalled state.
117018
117019
117020 [heading Exceptions]
117021     
117022
117023 [variablelist
117024   
117025 [[boost::system::system_error][Thrown on failure. ]]
117026
117027 ]
117028
117029
117030
117031
117032 [endsect]
117033
117034
117035
117036 [section:overload2 windows::basic_object_handle::wait (2 of 2 overloads)]
117037
117038
117039 Perform a blocking wait on the object handle. 
117040
117041
117042   void wait(
117043       boost::system::error_code & ec);
117044
117045
117046 This function is used to wait for the object handle to be set to the signalled state. This function blocks and does not return until the object handle has been set to the signalled state.
117047
117048
117049 [heading Parameters]
117050     
117051
117052 [variablelist
117053   
117054 [[ec][Set to indicate what error occurred, if any. ]]
117055
117056 ]
117057
117058
117059
117060
117061 [endsect]
117062
117063
117064 [endsect]
117065
117066
117067 [endsect]
117068
117069 [section:windows__basic_object_handle__rebind_executor windows::basic_object_handle::rebind_executor]
117070
117071
117072 Rebinds the handle type to another executor. 
117073
117074
117075   template<
117076       typename ``[link boost_asio.reference.Executor1 Executor1]``>
117077   struct rebind_executor
117078
117079
117080 [heading Types]
117081 [table
117082   [[Name][Description]]
117083
117084   [
117085
117086     [[link boost_asio.reference.windows__basic_object_handle__rebind_executor.other [*other]]]
117087     [The handle type when rebound to the specified executor. ]
117088   
117089   ]
117090
117091 ]
117092
117093 [heading Requirements]
117094
117095 ['Header: ][^boost/asio/windows/basic_object_handle.hpp]
117096
117097 ['Convenience header: ][^boost/asio.hpp]
117098
117099
117100 [section:other windows::basic_object_handle::rebind_executor::other]
117101
117102 [indexterm2 boost_asio.indexterm.windows__basic_object_handle__rebind_executor.other..other..windows::basic_object_handle::rebind_executor] 
117103 The handle type when rebound to the specified executor. 
117104
117105
117106   typedef basic_object_handle< Executor1 > other;
117107
117108
117109 [heading Types]
117110 [table
117111   [[Name][Description]]
117112
117113   [
117114
117115     [[link boost_asio.reference.windows__basic_object_handle__rebind_executor [*rebind_executor]]]
117116     [Rebinds the handle type to another executor. ]
117117   
117118   ]
117119
117120   [
117121
117122     [[link boost_asio.reference.windows__basic_object_handle.executor_type [*executor_type]]]
117123     [The type of the executor associated with the object. ]
117124   
117125   ]
117126
117127   [
117128
117129     [[link boost_asio.reference.windows__basic_object_handle.lowest_layer_type [*lowest_layer_type]]]
117130     [An object handle is always the lowest layer. ]
117131   
117132   ]
117133
117134   [
117135
117136     [[link boost_asio.reference.windows__basic_object_handle.native_handle_type [*native_handle_type]]]
117137     [The native representation of a handle. ]
117138   
117139   ]
117140
117141 ]
117142
117143 [heading Member Functions]
117144 [table
117145   [[Name][Description]]
117146
117147   [
117148     [[link boost_asio.reference.windows__basic_object_handle.assign [*assign]]]
117149     [Assign an existing native handle to the handle. ]
117150   ]
117151   
117152   [
117153     [[link boost_asio.reference.windows__basic_object_handle.async_wait [*async_wait]]]
117154     [Start an asynchronous wait on the object handle. ]
117155   ]
117156   
117157   [
117158     [[link boost_asio.reference.windows__basic_object_handle.basic_object_handle [*basic_object_handle]]]
117159     [Construct an object handle without opening it. 
117160      [hr]
117161      Construct an object handle on an existing native handle. 
117162      [hr]
117163      Move-construct an object handle from another. ]
117164   ]
117165   
117166   [
117167     [[link boost_asio.reference.windows__basic_object_handle.cancel [*cancel]]]
117168     [Cancel all asynchronous operations associated with the handle. ]
117169   ]
117170   
117171   [
117172     [[link boost_asio.reference.windows__basic_object_handle.close [*close]]]
117173     [Close the handle. ]
117174   ]
117175   
117176   [
117177     [[link boost_asio.reference.windows__basic_object_handle.get_executor [*get_executor]]]
117178     [Get the executor associated with the object. ]
117179   ]
117180   
117181   [
117182     [[link boost_asio.reference.windows__basic_object_handle.is_open [*is_open]]]
117183     [Determine whether the handle is open. ]
117184   ]
117185   
117186   [
117187     [[link boost_asio.reference.windows__basic_object_handle.lowest_layer [*lowest_layer]]]
117188     [Get a reference to the lowest layer. 
117189      [hr]
117190      Get a const reference to the lowest layer. ]
117191   ]
117192   
117193   [
117194     [[link boost_asio.reference.windows__basic_object_handle.native_handle [*native_handle]]]
117195     [Get the native handle representation. ]
117196   ]
117197   
117198   [
117199     [[link boost_asio.reference.windows__basic_object_handle.operator_eq_ [*operator=]]]
117200     [Move-assign an object handle from another. ]
117201   ]
117202   
117203   [
117204     [[link boost_asio.reference.windows__basic_object_handle.wait [*wait]]]
117205     [Perform a blocking wait on the object handle. ]
117206   ]
117207   
117208 ]
117209
117210 The [link boost_asio.reference.windows__basic_object_handle `windows::basic_object_handle`] class provides asynchronous and blocking object-oriented handle functionality.
117211
117212
117213 [heading Thread Safety]
117214   
117215 ['Distinct] ['objects:] Safe.
117216
117217 ['Shared] ['objects:] Unsafe. 
117218
117219
117220
117221
117222 [heading Requirements]
117223
117224 ['Header: ][^boost/asio/windows/basic_object_handle.hpp]
117225
117226 ['Convenience header: ][^boost/asio.hpp]
117227
117228
117229 [endsect]
117230
117231
117232
117233 [endsect]
117234
117235 [section:windows__basic_overlapped_handle windows::basic_overlapped_handle]
117236
117237
117238 Provides Windows handle functionality for objects that support overlapped I/O. 
117239
117240
117241   template<
117242       typename ``[link boost_asio.reference.Executor1 Executor]`` = executor>
117243   class basic_overlapped_handle
117244
117245
117246 [heading Types]
117247 [table
117248   [[Name][Description]]
117249
117250   [
117251
117252     [[link boost_asio.reference.windows__basic_overlapped_handle__rebind_executor [*rebind_executor]]]
117253     [Rebinds the handle type to another executor. ]
117254   
117255   ]
117256
117257   [
117258
117259     [[link boost_asio.reference.windows__basic_overlapped_handle.executor_type [*executor_type]]]
117260     [The type of the executor associated with the object. ]
117261   
117262   ]
117263
117264   [
117265
117266     [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer_type [*lowest_layer_type]]]
117267     [An overlapped_handle is always the lowest layer. ]
117268   
117269   ]
117270
117271   [
117272
117273     [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle_type [*native_handle_type]]]
117274     [The native representation of a handle. ]
117275   
117276   ]
117277
117278 ]
117279
117280 [heading Member Functions]
117281 [table
117282   [[Name][Description]]
117283
117284   [
117285     [[link boost_asio.reference.windows__basic_overlapped_handle.assign [*assign]]]
117286     [Assign an existing native handle to the handle. ]
117287   ]
117288   
117289   [
117290     [[link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle [*basic_overlapped_handle]]]
117291     [Construct an overlapped handle without opening it. 
117292      [hr]
117293      Construct an overlapped handle on an existing native handle. 
117294      [hr]
117295      Move-construct an overlapped handle from another. ]
117296   ]
117297   
117298   [
117299     [[link boost_asio.reference.windows__basic_overlapped_handle.cancel [*cancel]]]
117300     [Cancel all asynchronous operations associated with the handle. ]
117301   ]
117302   
117303   [
117304     [[link boost_asio.reference.windows__basic_overlapped_handle.close [*close]]]
117305     [Close the handle. ]
117306   ]
117307   
117308   [
117309     [[link boost_asio.reference.windows__basic_overlapped_handle.get_executor [*get_executor]]]
117310     [Get the executor associated with the object. ]
117311   ]
117312   
117313   [
117314     [[link boost_asio.reference.windows__basic_overlapped_handle.is_open [*is_open]]]
117315     [Determine whether the handle is open. ]
117316   ]
117317   
117318   [
117319     [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer [*lowest_layer]]]
117320     [Get a reference to the lowest layer. 
117321      [hr]
117322      Get a const reference to the lowest layer. ]
117323   ]
117324   
117325   [
117326     [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle [*native_handle]]]
117327     [Get the native handle representation. ]
117328   ]
117329   
117330   [
117331     [[link boost_asio.reference.windows__basic_overlapped_handle.operator_eq_ [*operator=]]]
117332     [Move-assign an overlapped handle from another. ]
117333   ]
117334   
117335 ]
117336
117337 [heading Protected Member Functions]
117338 [table
117339   [[Name][Description]]
117340
117341   [
117342     [[link boost_asio.reference.windows__basic_overlapped_handle._basic_overlapped_handle [*~basic_overlapped_handle]]]
117343     [Protected destructor to prevent deletion through this type. ]
117344   ]
117345   
117346 ]
117347
117348 [heading Protected Data Members]
117349 [table
117350   [[Name][Description]]
117351
117352   [
117353     [[link boost_asio.reference.windows__basic_overlapped_handle.impl_ [*impl_]]]
117354     []
117355   ]
117356
117357 ]
117358
117359 The [link boost_asio.reference.windows__overlapped_handle `windows::overlapped_handle`] class provides the ability to wrap a Windows handle. The underlying object referred to by the handle must support overlapped I/O.
117360
117361
117362 [heading Thread Safety]
117363   
117364 ['Distinct] ['objects:] Safe.
117365
117366 ['Shared] ['objects:] Unsafe. 
117367
117368
117369
117370 [heading Requirements]
117371
117372 ['Header: ][^boost/asio/windows/basic_overlapped_handle.hpp]
117373
117374 ['Convenience header: ][^boost/asio.hpp]
117375
117376 [section:assign windows::basic_overlapped_handle::assign]
117377
117378 [indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.assign..assign..windows::basic_overlapped_handle] 
117379 Assign an existing native handle to the handle. 
117380
117381
117382   void ``[link boost_asio.reference.windows__basic_overlapped_handle.assign.overload1 assign]``(
117383       const native_handle_type & handle);
117384   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_overlapped_handle.assign.overload1 more...]]``
117385
117386   void ``[link boost_asio.reference.windows__basic_overlapped_handle.assign.overload2 assign]``(
117387       const native_handle_type & handle,
117388       boost::system::error_code & ec);
117389   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_overlapped_handle.assign.overload2 more...]]``
117390
117391
117392 [section:overload1 windows::basic_overlapped_handle::assign (1 of 2 overloads)]
117393
117394
117395 Assign an existing native handle to the handle. 
117396
117397
117398   void assign(
117399       const native_handle_type & handle);
117400
117401
117402
117403 [endsect]
117404
117405
117406
117407 [section:overload2 windows::basic_overlapped_handle::assign (2 of 2 overloads)]
117408
117409
117410 Assign an existing native handle to the handle. 
117411
117412
117413   void assign(
117414       const native_handle_type & handle,
117415       boost::system::error_code & ec);
117416
117417
117418
117419 [endsect]
117420
117421
117422 [endsect]
117423
117424 [section:basic_overlapped_handle windows::basic_overlapped_handle::basic_overlapped_handle]
117425
117426 [indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.basic_overlapped_handle..basic_overlapped_handle..windows::basic_overlapped_handle] 
117427 Construct an overlapped handle without opening it. 
117428
117429
117430   explicit ``[link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle.overload1 basic_overlapped_handle]``(
117431       const executor_type & ex);
117432   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle.overload1 more...]]``
117433
117434   template<
117435       typename ExecutionContext>
117436   explicit ``[link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle.overload2 basic_overlapped_handle]``(
117437       ExecutionContext & context,
117438       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value, basic_overlapped_handle >::type *  = 0);
117439   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle.overload2 more...]]``
117440
117441
117442 Construct an overlapped handle on an existing native handle. 
117443
117444
117445   ``[link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle.overload3 basic_overlapped_handle]``(
117446       const executor_type & ex,
117447       const native_handle_type & native_handle);
117448   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle.overload3 more...]]``
117449
117450   template<
117451       typename ExecutionContext>
117452   ``[link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle.overload4 basic_overlapped_handle]``(
117453       ExecutionContext & context,
117454       const native_handle_type & native_handle,
117455       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
117456   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle.overload4 more...]]``
117457
117458
117459 Move-construct an overlapped handle from another. 
117460
117461
117462   ``[link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle.overload5 basic_overlapped_handle]``(
117463       basic_overlapped_handle && other);
117464   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle.overload5 more...]]``
117465
117466
117467 [section:overload1 windows::basic_overlapped_handle::basic_overlapped_handle (1 of 5 overloads)]
117468
117469
117470 Construct an overlapped handle without opening it. 
117471
117472
117473   basic_overlapped_handle(
117474       const executor_type & ex);
117475
117476
117477 This constructor creates an overlapped handle without opening it.
117478
117479
117480 [heading Parameters]
117481     
117482
117483 [variablelist
117484   
117485 [[ex][The I/O executor that the overlapped handle will use, by default, to dispatch handlers for any asynchronous operations performed on the overlapped handle. ]]
117486
117487 ]
117488
117489
117490
117491
117492 [endsect]
117493
117494
117495
117496 [section:overload2 windows::basic_overlapped_handle::basic_overlapped_handle (2 of 5 overloads)]
117497
117498
117499 Construct an overlapped handle without opening it. 
117500
117501
117502   template<
117503       typename ExecutionContext>
117504   basic_overlapped_handle(
117505       ExecutionContext & context,
117506       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value, basic_overlapped_handle >::type *  = 0);
117507
117508
117509 This constructor creates an overlapped handle without opening it.
117510
117511
117512 [heading Parameters]
117513     
117514
117515 [variablelist
117516   
117517 [[context][An execution context which provides the I/O executor that the overlapped handle will use, by default, to dispatch handlers for any asynchronous operations performed on the overlapped handle. ]]
117518
117519 ]
117520
117521
117522
117523
117524 [endsect]
117525
117526
117527
117528 [section:overload3 windows::basic_overlapped_handle::basic_overlapped_handle (3 of 5 overloads)]
117529
117530
117531 Construct an overlapped handle on an existing native handle. 
117532
117533
117534   basic_overlapped_handle(
117535       const executor_type & ex,
117536       const native_handle_type & native_handle);
117537
117538
117539 This constructor creates an overlapped handle object to hold an existing native handle.
117540
117541
117542 [heading Parameters]
117543     
117544
117545 [variablelist
117546   
117547 [[ex][The I/O executor that the overlapped handle will use, by default, to dispatch handlers for any asynchronous operations performed on the overlapped handle.]]
117548
117549 [[native_handle][The new underlying handle implementation.]]
117550
117551 ]
117552
117553
117554 [heading Exceptions]
117555     
117556
117557 [variablelist
117558   
117559 [[boost::system::system_error][Thrown on failure. ]]
117560
117561 ]
117562
117563
117564
117565
117566 [endsect]
117567
117568
117569
117570 [section:overload4 windows::basic_overlapped_handle::basic_overlapped_handle (4 of 5 overloads)]
117571
117572
117573 Construct an overlapped handle on an existing native handle. 
117574
117575
117576   template<
117577       typename ExecutionContext>
117578   basic_overlapped_handle(
117579       ExecutionContext & context,
117580       const native_handle_type & native_handle,
117581       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
117582
117583
117584 This constructor creates an overlapped handle object to hold an existing native handle.
117585
117586
117587 [heading Parameters]
117588     
117589
117590 [variablelist
117591   
117592 [[context][An execution context which provides the I/O executor that the overlapped handle will use, by default, to dispatch handlers for any asynchronous operations performed on the overlapped handle.]]
117593
117594 [[native_handle][The new underlying handle implementation.]]
117595
117596 ]
117597
117598
117599 [heading Exceptions]
117600     
117601
117602 [variablelist
117603   
117604 [[boost::system::system_error][Thrown on failure. ]]
117605
117606 ]
117607
117608
117609
117610
117611 [endsect]
117612
117613
117614
117615 [section:overload5 windows::basic_overlapped_handle::basic_overlapped_handle (5 of 5 overloads)]
117616
117617
117618 Move-construct an overlapped handle from another. 
117619
117620
117621   basic_overlapped_handle(
117622       basic_overlapped_handle && other);
117623
117624
117625 This constructor moves a handle from one object to another.
117626
117627
117628 [heading Parameters]
117629     
117630
117631 [variablelist
117632   
117633 [[other][The other overlapped handle object from which the move will occur.]]
117634
117635 ]
117636
117637
117638 [heading Remarks]
117639       
117640 Following the move, the moved-from object is in the same state as if constructed using the `overlapped_handle(const executor_type&)` constructor. 
117641
117642
117643
117644
117645 [endsect]
117646
117647
117648 [endsect]
117649
117650 [section:cancel windows::basic_overlapped_handle::cancel]
117651
117652 [indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.cancel..cancel..windows::basic_overlapped_handle] 
117653 Cancel all asynchronous operations associated with the handle. 
117654
117655
117656   void ``[link boost_asio.reference.windows__basic_overlapped_handle.cancel.overload1 cancel]``();
117657   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_overlapped_handle.cancel.overload1 more...]]``
117658
117659   void ``[link boost_asio.reference.windows__basic_overlapped_handle.cancel.overload2 cancel]``(
117660       boost::system::error_code & ec);
117661   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_overlapped_handle.cancel.overload2 more...]]``
117662
117663
117664 [section:overload1 windows::basic_overlapped_handle::cancel (1 of 2 overloads)]
117665
117666
117667 Cancel all asynchronous operations associated with the handle. 
117668
117669
117670   void cancel();
117671
117672
117673 This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
117674
117675
117676 [heading Exceptions]
117677     
117678
117679 [variablelist
117680   
117681 [[boost::system::system_error][Thrown on failure. ]]
117682
117683 ]
117684
117685
117686
117687
117688 [endsect]
117689
117690
117691
117692 [section:overload2 windows::basic_overlapped_handle::cancel (2 of 2 overloads)]
117693
117694
117695 Cancel all asynchronous operations associated with the handle. 
117696
117697
117698   void cancel(
117699       boost::system::error_code & ec);
117700
117701
117702 This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
117703
117704
117705 [heading Parameters]
117706     
117707
117708 [variablelist
117709   
117710 [[ec][Set to indicate what error occurred, if any. ]]
117711
117712 ]
117713
117714
117715
117716
117717 [endsect]
117718
117719
117720 [endsect]
117721
117722 [section:close windows::basic_overlapped_handle::close]
117723
117724 [indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.close..close..windows::basic_overlapped_handle] 
117725 Close the handle. 
117726
117727
117728   void ``[link boost_asio.reference.windows__basic_overlapped_handle.close.overload1 close]``();
117729   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_overlapped_handle.close.overload1 more...]]``
117730
117731   void ``[link boost_asio.reference.windows__basic_overlapped_handle.close.overload2 close]``(
117732       boost::system::error_code & ec);
117733   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_overlapped_handle.close.overload2 more...]]``
117734
117735
117736 [section:overload1 windows::basic_overlapped_handle::close (1 of 2 overloads)]
117737
117738
117739 Close the handle. 
117740
117741
117742   void close();
117743
117744
117745 This function is used to close the handle. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
117746
117747
117748 [heading Exceptions]
117749     
117750
117751 [variablelist
117752   
117753 [[boost::system::system_error][Thrown on failure. ]]
117754
117755 ]
117756
117757
117758
117759
117760 [endsect]
117761
117762
117763
117764 [section:overload2 windows::basic_overlapped_handle::close (2 of 2 overloads)]
117765
117766
117767 Close the handle. 
117768
117769
117770   void close(
117771       boost::system::error_code & ec);
117772
117773
117774 This function is used to close the handle. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
117775
117776
117777 [heading Parameters]
117778     
117779
117780 [variablelist
117781   
117782 [[ec][Set to indicate what error occurred, if any. ]]
117783
117784 ]
117785
117786
117787
117788
117789 [endsect]
117790
117791
117792 [endsect]
117793
117794
117795 [section:executor_type windows::basic_overlapped_handle::executor_type]
117796
117797 [indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.executor_type..executor_type..windows::basic_overlapped_handle] 
117798 The type of the executor associated with the object. 
117799
117800
117801   typedef Executor executor_type;
117802
117803
117804
117805 [heading Requirements]
117806
117807 ['Header: ][^boost/asio/windows/basic_overlapped_handle.hpp]
117808
117809 ['Convenience header: ][^boost/asio.hpp]
117810
117811
117812 [endsect]
117813
117814
117815
117816 [section:get_executor windows::basic_overlapped_handle::get_executor]
117817
117818 [indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.get_executor..get_executor..windows::basic_overlapped_handle] 
117819 Get the executor associated with the object. 
117820
117821
117822   executor_type get_executor();
117823
117824
117825
117826 [endsect]
117827
117828
117829
117830 [section:impl_ windows::basic_overlapped_handle::impl_]
117831
117832 [indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.impl_..impl_..windows::basic_overlapped_handle] 
117833
117834   boost::asio::detail::io_object_impl< boost::asio::detail::win_iocp_handle_service, Executor > impl_;
117835
117836
117837
117838 [endsect]
117839
117840
117841
117842 [section:is_open windows::basic_overlapped_handle::is_open]
117843
117844 [indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.is_open..is_open..windows::basic_overlapped_handle] 
117845 Determine whether the handle is open. 
117846
117847
117848   bool is_open() const;
117849
117850
117851
117852 [endsect]
117853
117854
117855 [section:lowest_layer windows::basic_overlapped_handle::lowest_layer]
117856
117857 [indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.lowest_layer..lowest_layer..windows::basic_overlapped_handle] 
117858 Get a reference to the lowest layer. 
117859
117860
117861   lowest_layer_type & ``[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer.overload1 lowest_layer]``();
117862   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer.overload1 more...]]``
117863
117864
117865 Get a const reference to the lowest layer. 
117866
117867
117868   const lowest_layer_type & ``[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer.overload2 lowest_layer]``() const;
117869   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer.overload2 more...]]``
117870
117871
117872 [section:overload1 windows::basic_overlapped_handle::lowest_layer (1 of 2 overloads)]
117873
117874
117875 Get a reference to the lowest layer. 
117876
117877
117878   lowest_layer_type & lowest_layer();
117879
117880
117881 This function returns a reference to the lowest layer in a stack of layers. Since an overlapped\_handle cannot contain any further layers, it simply returns a reference to itself.
117882
117883
117884 [heading Return Value]
117885       
117886 A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 
117887
117888
117889
117890
117891 [endsect]
117892
117893
117894
117895 [section:overload2 windows::basic_overlapped_handle::lowest_layer (2 of 2 overloads)]
117896
117897
117898 Get a const reference to the lowest layer. 
117899
117900
117901   const lowest_layer_type & lowest_layer() const;
117902
117903
117904 This function returns a const reference to the lowest layer in a stack of layers. Since an overlapped\_handle cannot contain any further layers, it simply returns a reference to itself.
117905
117906
117907 [heading Return Value]
117908       
117909 A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 
117910
117911
117912
117913
117914 [endsect]
117915
117916
117917 [endsect]
117918
117919
117920 [section:lowest_layer_type windows::basic_overlapped_handle::lowest_layer_type]
117921
117922 [indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.lowest_layer_type..lowest_layer_type..windows::basic_overlapped_handle] 
117923 An overlapped\_handle is always the lowest layer. 
117924
117925
117926   typedef basic_overlapped_handle lowest_layer_type;
117927
117928
117929 [heading Types]
117930 [table
117931   [[Name][Description]]
117932
117933   [
117934
117935     [[link boost_asio.reference.windows__basic_overlapped_handle__rebind_executor [*rebind_executor]]]
117936     [Rebinds the handle type to another executor. ]
117937   
117938   ]
117939
117940   [
117941
117942     [[link boost_asio.reference.windows__basic_overlapped_handle.executor_type [*executor_type]]]
117943     [The type of the executor associated with the object. ]
117944   
117945   ]
117946
117947   [
117948
117949     [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer_type [*lowest_layer_type]]]
117950     [An overlapped_handle is always the lowest layer. ]
117951   
117952   ]
117953
117954   [
117955
117956     [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle_type [*native_handle_type]]]
117957     [The native representation of a handle. ]
117958   
117959   ]
117960
117961 ]
117962
117963 [heading Member Functions]
117964 [table
117965   [[Name][Description]]
117966
117967   [
117968     [[link boost_asio.reference.windows__basic_overlapped_handle.assign [*assign]]]
117969     [Assign an existing native handle to the handle. ]
117970   ]
117971   
117972   [
117973     [[link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle [*basic_overlapped_handle]]]
117974     [Construct an overlapped handle without opening it. 
117975      [hr]
117976      Construct an overlapped handle on an existing native handle. 
117977      [hr]
117978      Move-construct an overlapped handle from another. ]
117979   ]
117980   
117981   [
117982     [[link boost_asio.reference.windows__basic_overlapped_handle.cancel [*cancel]]]
117983     [Cancel all asynchronous operations associated with the handle. ]
117984   ]
117985   
117986   [
117987     [[link boost_asio.reference.windows__basic_overlapped_handle.close [*close]]]
117988     [Close the handle. ]
117989   ]
117990   
117991   [
117992     [[link boost_asio.reference.windows__basic_overlapped_handle.get_executor [*get_executor]]]
117993     [Get the executor associated with the object. ]
117994   ]
117995   
117996   [
117997     [[link boost_asio.reference.windows__basic_overlapped_handle.is_open [*is_open]]]
117998     [Determine whether the handle is open. ]
117999   ]
118000   
118001   [
118002     [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer [*lowest_layer]]]
118003     [Get a reference to the lowest layer. 
118004      [hr]
118005      Get a const reference to the lowest layer. ]
118006   ]
118007   
118008   [
118009     [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle [*native_handle]]]
118010     [Get the native handle representation. ]
118011   ]
118012   
118013   [
118014     [[link boost_asio.reference.windows__basic_overlapped_handle.operator_eq_ [*operator=]]]
118015     [Move-assign an overlapped handle from another. ]
118016   ]
118017   
118018 ]
118019
118020 [heading Protected Member Functions]
118021 [table
118022   [[Name][Description]]
118023
118024   [
118025     [[link boost_asio.reference.windows__basic_overlapped_handle._basic_overlapped_handle [*~basic_overlapped_handle]]]
118026     [Protected destructor to prevent deletion through this type. ]
118027   ]
118028   
118029 ]
118030
118031 [heading Protected Data Members]
118032 [table
118033   [[Name][Description]]
118034
118035   [
118036     [[link boost_asio.reference.windows__basic_overlapped_handle.impl_ [*impl_]]]
118037     []
118038   ]
118039
118040 ]
118041
118042 The [link boost_asio.reference.windows__overlapped_handle `windows::overlapped_handle`] class provides the ability to wrap a Windows handle. The underlying object referred to by the handle must support overlapped I/O.
118043
118044
118045 [heading Thread Safety]
118046   
118047 ['Distinct] ['objects:] Safe.
118048
118049 ['Shared] ['objects:] Unsafe. 
118050
118051
118052
118053
118054 [heading Requirements]
118055
118056 ['Header: ][^boost/asio/windows/basic_overlapped_handle.hpp]
118057
118058 ['Convenience header: ][^boost/asio.hpp]
118059
118060
118061 [endsect]
118062
118063
118064
118065 [section:native_handle windows::basic_overlapped_handle::native_handle]
118066
118067 [indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.native_handle..native_handle..windows::basic_overlapped_handle] 
118068 Get the native handle representation. 
118069
118070
118071   native_handle_type native_handle();
118072
118073
118074 This function may be used to obtain the underlying representation of the handle. This is intended to allow access to native handle functionality that is not otherwise provided. 
118075
118076
118077 [endsect]
118078
118079
118080
118081 [section:native_handle_type windows::basic_overlapped_handle::native_handle_type]
118082
118083 [indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.native_handle_type..native_handle_type..windows::basic_overlapped_handle] 
118084 The native representation of a handle. 
118085
118086
118087   typedef implementation_defined native_handle_type;
118088
118089
118090
118091 [heading Requirements]
118092
118093 ['Header: ][^boost/asio/windows/basic_overlapped_handle.hpp]
118094
118095 ['Convenience header: ][^boost/asio.hpp]
118096
118097
118098 [endsect]
118099
118100
118101
118102 [section:operator_eq_ windows::basic_overlapped_handle::operator=]
118103
118104 [indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.operator_eq_..operator=..windows::basic_overlapped_handle] 
118105 Move-assign an overlapped handle from another. 
118106
118107
118108   basic_overlapped_handle & operator=(
118109       basic_overlapped_handle && other);
118110
118111
118112 This assignment operator moves a handle from one object to another.
118113
118114
118115 [heading Parameters]
118116     
118117
118118 [variablelist
118119   
118120 [[other][The other overlapped handle object from which the move will occur.]]
118121
118122 ]
118123
118124
118125 [heading Remarks]
118126       
118127 Following the move, the moved-from object is in the same state as if constructed using the `overlapped_handle(const executor_type&)` constructor. 
118128
118129
118130
118131
118132 [endsect]
118133
118134
118135
118136 [section:_basic_overlapped_handle windows::basic_overlapped_handle::~basic_overlapped_handle]
118137
118138 [indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle._basic_overlapped_handle..~basic_overlapped_handle..windows::basic_overlapped_handle] 
118139 Protected destructor to prevent deletion through this type. 
118140
118141
118142   ~basic_overlapped_handle();
118143
118144
118145 This function destroys the handle, cancelling any outstanding asynchronous wait operations associated with the handle as if by calling `cancel`. 
118146
118147
118148 [endsect]
118149
118150
118151
118152 [endsect]
118153
118154 [section:windows__basic_overlapped_handle__rebind_executor windows::basic_overlapped_handle::rebind_executor]
118155
118156
118157 Rebinds the handle type to another executor. 
118158
118159
118160   template<
118161       typename ``[link boost_asio.reference.Executor1 Executor1]``>
118162   struct rebind_executor
118163
118164
118165 [heading Types]
118166 [table
118167   [[Name][Description]]
118168
118169   [
118170
118171     [[link boost_asio.reference.windows__basic_overlapped_handle__rebind_executor.other [*other]]]
118172     [The handle type when rebound to the specified executor. ]
118173   
118174   ]
118175
118176 ]
118177
118178 [heading Requirements]
118179
118180 ['Header: ][^boost/asio/windows/basic_overlapped_handle.hpp]
118181
118182 ['Convenience header: ][^boost/asio.hpp]
118183
118184
118185 [section:other windows::basic_overlapped_handle::rebind_executor::other]
118186
118187 [indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle__rebind_executor.other..other..windows::basic_overlapped_handle::rebind_executor] 
118188 The handle type when rebound to the specified executor. 
118189
118190
118191   typedef basic_overlapped_handle< Executor1 > other;
118192
118193
118194 [heading Types]
118195 [table
118196   [[Name][Description]]
118197
118198   [
118199
118200     [[link boost_asio.reference.windows__basic_overlapped_handle__rebind_executor [*rebind_executor]]]
118201     [Rebinds the handle type to another executor. ]
118202   
118203   ]
118204
118205   [
118206
118207     [[link boost_asio.reference.windows__basic_overlapped_handle.executor_type [*executor_type]]]
118208     [The type of the executor associated with the object. ]
118209   
118210   ]
118211
118212   [
118213
118214     [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer_type [*lowest_layer_type]]]
118215     [An overlapped_handle is always the lowest layer. ]
118216   
118217   ]
118218
118219   [
118220
118221     [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle_type [*native_handle_type]]]
118222     [The native representation of a handle. ]
118223   
118224   ]
118225
118226 ]
118227
118228 [heading Member Functions]
118229 [table
118230   [[Name][Description]]
118231
118232   [
118233     [[link boost_asio.reference.windows__basic_overlapped_handle.assign [*assign]]]
118234     [Assign an existing native handle to the handle. ]
118235   ]
118236   
118237   [
118238     [[link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle [*basic_overlapped_handle]]]
118239     [Construct an overlapped handle without opening it. 
118240      [hr]
118241      Construct an overlapped handle on an existing native handle. 
118242      [hr]
118243      Move-construct an overlapped handle from another. ]
118244   ]
118245   
118246   [
118247     [[link boost_asio.reference.windows__basic_overlapped_handle.cancel [*cancel]]]
118248     [Cancel all asynchronous operations associated with the handle. ]
118249   ]
118250   
118251   [
118252     [[link boost_asio.reference.windows__basic_overlapped_handle.close [*close]]]
118253     [Close the handle. ]
118254   ]
118255   
118256   [
118257     [[link boost_asio.reference.windows__basic_overlapped_handle.get_executor [*get_executor]]]
118258     [Get the executor associated with the object. ]
118259   ]
118260   
118261   [
118262     [[link boost_asio.reference.windows__basic_overlapped_handle.is_open [*is_open]]]
118263     [Determine whether the handle is open. ]
118264   ]
118265   
118266   [
118267     [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer [*lowest_layer]]]
118268     [Get a reference to the lowest layer. 
118269      [hr]
118270      Get a const reference to the lowest layer. ]
118271   ]
118272   
118273   [
118274     [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle [*native_handle]]]
118275     [Get the native handle representation. ]
118276   ]
118277   
118278   [
118279     [[link boost_asio.reference.windows__basic_overlapped_handle.operator_eq_ [*operator=]]]
118280     [Move-assign an overlapped handle from another. ]
118281   ]
118282   
118283 ]
118284
118285 [heading Protected Member Functions]
118286 [table
118287   [[Name][Description]]
118288
118289   [
118290     [[link boost_asio.reference.windows__basic_overlapped_handle._basic_overlapped_handle [*~basic_overlapped_handle]]]
118291     [Protected destructor to prevent deletion through this type. ]
118292   ]
118293   
118294 ]
118295
118296 [heading Protected Data Members]
118297 [table
118298   [[Name][Description]]
118299
118300   [
118301     [[link boost_asio.reference.windows__basic_overlapped_handle.impl_ [*impl_]]]
118302     []
118303   ]
118304
118305 ]
118306
118307 The [link boost_asio.reference.windows__overlapped_handle `windows::overlapped_handle`] class provides the ability to wrap a Windows handle. The underlying object referred to by the handle must support overlapped I/O.
118308
118309
118310 [heading Thread Safety]
118311   
118312 ['Distinct] ['objects:] Safe.
118313
118314 ['Shared] ['objects:] Unsafe. 
118315
118316
118317
118318
118319 [heading Requirements]
118320
118321 ['Header: ][^boost/asio/windows/basic_overlapped_handle.hpp]
118322
118323 ['Convenience header: ][^boost/asio.hpp]
118324
118325
118326 [endsect]
118327
118328
118329
118330 [endsect]
118331
118332 [section:windows__basic_random_access_handle windows::basic_random_access_handle]
118333
118334
118335 Provides random-access handle functionality. 
118336
118337
118338   template<
118339       typename ``[link boost_asio.reference.Executor1 Executor]`` = executor>
118340   class basic_random_access_handle :
118341     public windows::basic_overlapped_handle< Executor >
118342
118343
118344 [heading Types]
118345 [table
118346   [[Name][Description]]
118347
118348   [
118349
118350     [[link boost_asio.reference.windows__basic_random_access_handle__rebind_executor [*rebind_executor]]]
118351     [Rebinds the handle type to another executor. ]
118352   
118353   ]
118354
118355   [
118356
118357     [[link boost_asio.reference.windows__basic_random_access_handle.executor_type [*executor_type]]]
118358     [The type of the executor associated with the object. ]
118359   
118360   ]
118361
118362   [
118363
118364     [[link boost_asio.reference.windows__basic_random_access_handle.lowest_layer_type [*lowest_layer_type]]]
118365     [An overlapped_handle is always the lowest layer. ]
118366   
118367   ]
118368
118369   [
118370
118371     [[link boost_asio.reference.windows__basic_random_access_handle.native_handle_type [*native_handle_type]]]
118372     [The native representation of a handle. ]
118373   
118374   ]
118375
118376 ]
118377
118378 [heading Member Functions]
118379 [table
118380   [[Name][Description]]
118381
118382   [
118383     [[link boost_asio.reference.windows__basic_random_access_handle.assign [*assign]]]
118384     [Assign an existing native handle to the handle. ]
118385   ]
118386   
118387   [
118388     [[link boost_asio.reference.windows__basic_random_access_handle.async_read_some_at [*async_read_some_at]]]
118389     [Start an asynchronous read at the specified offset. ]
118390   ]
118391   
118392   [
118393     [[link boost_asio.reference.windows__basic_random_access_handle.async_write_some_at [*async_write_some_at]]]
118394     [Start an asynchronous write at the specified offset. ]
118395   ]
118396   
118397   [
118398     [[link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle [*basic_random_access_handle]]]
118399     [Construct a random-access handle without opening it. 
118400      [hr]
118401      Construct a random-access handle on an existing native handle. 
118402      [hr]
118403      Move-construct a random-access handle from another. ]
118404   ]
118405   
118406   [
118407     [[link boost_asio.reference.windows__basic_random_access_handle.cancel [*cancel]]]
118408     [Cancel all asynchronous operations associated with the handle. ]
118409   ]
118410   
118411   [
118412     [[link boost_asio.reference.windows__basic_random_access_handle.close [*close]]]
118413     [Close the handle. ]
118414   ]
118415   
118416   [
118417     [[link boost_asio.reference.windows__basic_random_access_handle.get_executor [*get_executor]]]
118418     [Get the executor associated with the object. ]
118419   ]
118420   
118421   [
118422     [[link boost_asio.reference.windows__basic_random_access_handle.is_open [*is_open]]]
118423     [Determine whether the handle is open. ]
118424   ]
118425   
118426   [
118427     [[link boost_asio.reference.windows__basic_random_access_handle.lowest_layer [*lowest_layer]]]
118428     [Get a reference to the lowest layer. 
118429      [hr]
118430      Get a const reference to the lowest layer. ]
118431   ]
118432   
118433   [
118434     [[link boost_asio.reference.windows__basic_random_access_handle.native_handle [*native_handle]]]
118435     [Get the native handle representation. ]
118436   ]
118437   
118438   [
118439     [[link boost_asio.reference.windows__basic_random_access_handle.operator_eq_ [*operator=]]]
118440     [Move-assign a random-access handle from another. ]
118441   ]
118442   
118443   [
118444     [[link boost_asio.reference.windows__basic_random_access_handle.read_some_at [*read_some_at]]]
118445     [Read some data from the handle at the specified offset. ]
118446   ]
118447   
118448   [
118449     [[link boost_asio.reference.windows__basic_random_access_handle.write_some_at [*write_some_at]]]
118450     [Write some data to the handle at the specified offset. ]
118451   ]
118452   
118453 ]
118454
118455 [heading Protected Data Members]
118456 [table
118457   [[Name][Description]]
118458
118459   [
118460     [[link boost_asio.reference.windows__basic_random_access_handle.impl_ [*impl_]]]
118461     []
118462   ]
118463
118464 ]
118465
118466 The [link boost_asio.reference.windows__basic_random_access_handle `windows::basic_random_access_handle`] class provides asynchronous and blocking random-access handle functionality.
118467
118468
118469 [heading Thread Safety]
118470   
118471 ['Distinct] ['objects:] Safe.
118472
118473 ['Shared] ['objects:] Unsafe. 
118474
118475
118476
118477 [heading Requirements]
118478
118479 ['Header: ][^boost/asio/windows/basic_random_access_handle.hpp]
118480
118481 ['Convenience header: ][^boost/asio.hpp]
118482
118483 [section:assign windows::basic_random_access_handle::assign]
118484
118485 [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.assign..assign..windows::basic_random_access_handle] 
118486 Assign an existing native handle to the handle. 
118487
118488
118489   void ``[link boost_asio.reference.windows__basic_random_access_handle.assign.overload1 assign]``(
118490       const native_handle_type & handle);
118491   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.assign.overload1 more...]]``
118492
118493   void ``[link boost_asio.reference.windows__basic_random_access_handle.assign.overload2 assign]``(
118494       const native_handle_type & handle,
118495       boost::system::error_code & ec);
118496   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.assign.overload2 more...]]``
118497
118498
118499 [section:overload1 windows::basic_random_access_handle::assign (1 of 2 overloads)]
118500
118501
118502 ['Inherited from windows::basic_overlapped_handle.]
118503
118504
118505 Assign an existing native handle to the handle. 
118506
118507
118508   void assign(
118509       const native_handle_type & handle);
118510
118511
118512
118513 [endsect]
118514
118515
118516
118517 [section:overload2 windows::basic_random_access_handle::assign (2 of 2 overloads)]
118518
118519
118520 ['Inherited from windows::basic_overlapped_handle.]
118521
118522
118523 Assign an existing native handle to the handle. 
118524
118525
118526   void assign(
118527       const native_handle_type & handle,
118528       boost::system::error_code & ec);
118529
118530
118531
118532 [endsect]
118533
118534
118535 [endsect]
118536
118537
118538 [section:async_read_some_at windows::basic_random_access_handle::async_read_some_at]
118539
118540 [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.async_read_some_at..async_read_some_at..windows::basic_random_access_handle] 
118541 Start an asynchronous read at the specified offset. 
118542
118543
118544   template<
118545       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
118546       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
118547   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_some_at(
118548       uint64_t offset,
118549       const MutableBufferSequence & buffers,
118550       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
118551
118552
118553 This function is used to asynchronously read data from the random-access handle. The function call always returns immediately.
118554
118555
118556 [heading Parameters]
118557     
118558
118559 [variablelist
118560   
118561 [[offset][The offset at which the data will be read.]]
118562
118563 [[buffers][One or more buffers into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
118564
118565 [[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
118566 ``
118567    void handler(
118568      const boost::system::error_code& error, // Result of operation.
118569      std::size_t bytes_transferred           // Number of bytes read.
118570    ); 
118571 ``
118572 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
118573
118574 ]
118575
118576
118577 [heading Remarks]
118578       
118579 The read operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.async_read_at `async_read_at`]  function if you need to ensure that the requested amount of data is read before the asynchronous operation completes.
118580
118581
118582 [heading Example]
118583   
118584 To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
118585
118586    handle.async_read_some_at(42, boost::asio::buffer(data, size), handler);
118587
118588
118589 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
118590
118591
118592
118593
118594 [endsect]
118595
118596
118597
118598 [section:async_write_some_at windows::basic_random_access_handle::async_write_some_at]
118599
118600 [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.async_write_some_at..async_write_some_at..windows::basic_random_access_handle] 
118601 Start an asynchronous write at the specified offset. 
118602
118603
118604   template<
118605       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
118606       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
118607   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_some_at(
118608       uint64_t offset,
118609       const ConstBufferSequence & buffers,
118610       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
118611
118612
118613 This function is used to asynchronously write data to the random-access handle. The function call always returns immediately.
118614
118615
118616 [heading Parameters]
118617     
118618
118619 [variablelist
118620   
118621 [[offset][The offset at which the data will be written.]]
118622
118623 [[buffers][One or more data buffers to be written to the handle. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
118624
118625 [[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
118626 ``
118627    void handler(
118628      const boost::system::error_code& error, // Result of operation.
118629      std::size_t bytes_transferred           // Number of bytes written.
118630    ); 
118631 ``
118632 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
118633
118634 ]
118635
118636
118637 [heading Remarks]
118638       
118639 The write operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.async_write_at `async_write_at`]  function if you need to ensure that all data is written before the asynchronous operation completes.
118640
118641
118642 [heading Example]
118643   
118644 To write a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
118645
118646    handle.async_write_some_at(42, boost::asio::buffer(data, size), handler);
118647
118648
118649 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
118650
118651
118652
118653
118654 [endsect]
118655
118656
118657 [section:basic_random_access_handle windows::basic_random_access_handle::basic_random_access_handle]
118658
118659 [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.basic_random_access_handle..basic_random_access_handle..windows::basic_random_access_handle] 
118660 Construct a random-access handle without opening it. 
118661
118662
118663   explicit ``[link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle.overload1 basic_random_access_handle]``(
118664       const executor_type & ex);
118665   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle.overload1 more...]]``
118666
118667   template<
118668       typename ExecutionContext>
118669   explicit ``[link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle.overload2 basic_random_access_handle]``(
118670       ExecutionContext & context,
118671       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value, basic_random_access_handle >::type *  = 0);
118672   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle.overload2 more...]]``
118673
118674
118675 Construct a random-access handle on an existing native handle. 
118676
118677
118678   ``[link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle.overload3 basic_random_access_handle]``(
118679       const executor_type & ex,
118680       const native_handle_type & handle);
118681   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle.overload3 more...]]``
118682
118683   template<
118684       typename ExecutionContext>
118685   ``[link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle.overload4 basic_random_access_handle]``(
118686       ExecutionContext & context,
118687       const native_handle_type & handle,
118688       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
118689   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle.overload4 more...]]``
118690
118691
118692 Move-construct a random-access handle from another. 
118693
118694
118695   ``[link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle.overload5 basic_random_access_handle]``(
118696       basic_random_access_handle && other);
118697   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle.overload5 more...]]``
118698
118699
118700 [section:overload1 windows::basic_random_access_handle::basic_random_access_handle (1 of 5 overloads)]
118701
118702
118703 Construct a random-access handle without opening it. 
118704
118705
118706   basic_random_access_handle(
118707       const executor_type & ex);
118708
118709
118710 This constructor creates a random-access handle without opening it.
118711
118712
118713 [heading Parameters]
118714     
118715
118716 [variablelist
118717   
118718 [[ex][The I/O executor that the random-access handle will use, by default, to dispatch handlers for any asynchronous operations performed on the random-access handle. ]]
118719
118720 ]
118721
118722
118723
118724
118725 [endsect]
118726
118727
118728
118729 [section:overload2 windows::basic_random_access_handle::basic_random_access_handle (2 of 5 overloads)]
118730
118731
118732 Construct a random-access handle without opening it. 
118733
118734
118735   template<
118736       typename ExecutionContext>
118737   basic_random_access_handle(
118738       ExecutionContext & context,
118739       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value, basic_random_access_handle >::type *  = 0);
118740
118741
118742 This constructor creates a random-access handle without opening it. The handle needs to be opened or assigned before data can be sent or received on it.
118743
118744
118745 [heading Parameters]
118746     
118747
118748 [variablelist
118749   
118750 [[context][An execution context which provides the I/O executor that the random-access handle will use, by default, to dispatch handlers for any asynchronous operations performed on the random-access handle. ]]
118751
118752 ]
118753
118754
118755
118756
118757 [endsect]
118758
118759
118760
118761 [section:overload3 windows::basic_random_access_handle::basic_random_access_handle (3 of 5 overloads)]
118762
118763
118764 Construct a random-access handle on an existing native handle. 
118765
118766
118767   basic_random_access_handle(
118768       const executor_type & ex,
118769       const native_handle_type & handle);
118770
118771
118772 This constructor creates a random-access handle object to hold an existing native handle.
118773
118774
118775 [heading Parameters]
118776     
118777
118778 [variablelist
118779   
118780 [[ex][The I/O executor that the random-access handle will use, by default, to dispatch handlers for any asynchronous operations performed on the random-access handle.]]
118781
118782 [[handle][The new underlying handle implementation.]]
118783
118784 ]
118785
118786
118787 [heading Exceptions]
118788     
118789
118790 [variablelist
118791   
118792 [[boost::system::system_error][Thrown on failure. ]]
118793
118794 ]
118795
118796
118797
118798
118799 [endsect]
118800
118801
118802
118803 [section:overload4 windows::basic_random_access_handle::basic_random_access_handle (4 of 5 overloads)]
118804
118805
118806 Construct a random-access handle on an existing native handle. 
118807
118808
118809   template<
118810       typename ExecutionContext>
118811   basic_random_access_handle(
118812       ExecutionContext & context,
118813       const native_handle_type & handle,
118814       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
118815
118816
118817 This constructor creates a random-access handle object to hold an existing native handle.
118818
118819
118820 [heading Parameters]
118821     
118822
118823 [variablelist
118824   
118825 [[context][An execution context which provides the I/O executor that the random-access handle will use, by default, to dispatch handlers for any asynchronous operations performed on the random-access handle.]]
118826
118827 [[handle][The new underlying handle implementation.]]
118828
118829 ]
118830
118831
118832 [heading Exceptions]
118833     
118834
118835 [variablelist
118836   
118837 [[boost::system::system_error][Thrown on failure. ]]
118838
118839 ]
118840
118841
118842
118843
118844 [endsect]
118845
118846
118847
118848 [section:overload5 windows::basic_random_access_handle::basic_random_access_handle (5 of 5 overloads)]
118849
118850
118851 Move-construct a random-access handle from another. 
118852
118853
118854   basic_random_access_handle(
118855       basic_random_access_handle && other);
118856
118857
118858 This constructor moves a random-access handle from one object to another.
118859
118860
118861 [heading Parameters]
118862     
118863
118864 [variablelist
118865   
118866 [[other][The other random-access handle object from which the move will occur.]]
118867
118868 ]
118869
118870
118871 [heading Remarks]
118872       
118873 Following the move, the moved-from object is in the same state as if constructed using the `basic_random_access_handle(const executor_type&)` constructor. 
118874
118875
118876
118877
118878 [endsect]
118879
118880
118881 [endsect]
118882
118883 [section:cancel windows::basic_random_access_handle::cancel]
118884
118885 [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.cancel..cancel..windows::basic_random_access_handle] 
118886 Cancel all asynchronous operations associated with the handle. 
118887
118888
118889   void ``[link boost_asio.reference.windows__basic_random_access_handle.cancel.overload1 cancel]``();
118890   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.cancel.overload1 more...]]``
118891
118892   void ``[link boost_asio.reference.windows__basic_random_access_handle.cancel.overload2 cancel]``(
118893       boost::system::error_code & ec);
118894   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.cancel.overload2 more...]]``
118895
118896
118897 [section:overload1 windows::basic_random_access_handle::cancel (1 of 2 overloads)]
118898
118899
118900 ['Inherited from windows::basic_overlapped_handle.]
118901
118902
118903 Cancel all asynchronous operations associated with the handle. 
118904
118905
118906   void cancel();
118907
118908
118909 This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
118910
118911
118912 [heading Exceptions]
118913     
118914
118915 [variablelist
118916   
118917 [[boost::system::system_error][Thrown on failure. ]]
118918
118919 ]
118920
118921
118922
118923
118924 [endsect]
118925
118926
118927
118928 [section:overload2 windows::basic_random_access_handle::cancel (2 of 2 overloads)]
118929
118930
118931 ['Inherited from windows::basic_overlapped_handle.]
118932
118933
118934 Cancel all asynchronous operations associated with the handle. 
118935
118936
118937   void cancel(
118938       boost::system::error_code & ec);
118939
118940
118941 This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
118942
118943
118944 [heading Parameters]
118945     
118946
118947 [variablelist
118948   
118949 [[ec][Set to indicate what error occurred, if any. ]]
118950
118951 ]
118952
118953
118954
118955
118956 [endsect]
118957
118958
118959 [endsect]
118960
118961 [section:close windows::basic_random_access_handle::close]
118962
118963 [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.close..close..windows::basic_random_access_handle] 
118964 Close the handle. 
118965
118966
118967   void ``[link boost_asio.reference.windows__basic_random_access_handle.close.overload1 close]``();
118968   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.close.overload1 more...]]``
118969
118970   void ``[link boost_asio.reference.windows__basic_random_access_handle.close.overload2 close]``(
118971       boost::system::error_code & ec);
118972   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.close.overload2 more...]]``
118973
118974
118975 [section:overload1 windows::basic_random_access_handle::close (1 of 2 overloads)]
118976
118977
118978 ['Inherited from windows::basic_overlapped_handle.]
118979
118980
118981 Close the handle. 
118982
118983
118984   void close();
118985
118986
118987 This function is used to close the handle. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
118988
118989
118990 [heading Exceptions]
118991     
118992
118993 [variablelist
118994   
118995 [[boost::system::system_error][Thrown on failure. ]]
118996
118997 ]
118998
118999
119000
119001
119002 [endsect]
119003
119004
119005
119006 [section:overload2 windows::basic_random_access_handle::close (2 of 2 overloads)]
119007
119008
119009 ['Inherited from windows::basic_overlapped_handle.]
119010
119011
119012 Close the handle. 
119013
119014
119015   void close(
119016       boost::system::error_code & ec);
119017
119018
119019 This function is used to close the handle. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
119020
119021
119022 [heading Parameters]
119023     
119024
119025 [variablelist
119026   
119027 [[ec][Set to indicate what error occurred, if any. ]]
119028
119029 ]
119030
119031
119032
119033
119034 [endsect]
119035
119036
119037 [endsect]
119038
119039
119040 [section:executor_type windows::basic_random_access_handle::executor_type]
119041
119042 [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.executor_type..executor_type..windows::basic_random_access_handle] 
119043 The type of the executor associated with the object. 
119044
119045
119046   typedef Executor executor_type;
119047
119048
119049
119050 [heading Requirements]
119051
119052 ['Header: ][^boost/asio/windows/basic_random_access_handle.hpp]
119053
119054 ['Convenience header: ][^boost/asio.hpp]
119055
119056
119057 [endsect]
119058
119059
119060
119061 [section:get_executor windows::basic_random_access_handle::get_executor]
119062
119063
119064 ['Inherited from windows::basic_overlapped_handle.]
119065
119066 [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.get_executor..get_executor..windows::basic_random_access_handle] 
119067 Get the executor associated with the object. 
119068
119069
119070   executor_type get_executor();
119071
119072
119073
119074 [endsect]
119075
119076
119077
119078 [section:impl_ windows::basic_random_access_handle::impl_]
119079
119080
119081 ['Inherited from windows::basic_overlapped_handle.]
119082
119083 [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.impl_..impl_..windows::basic_random_access_handle] 
119084
119085   boost::asio::detail::io_object_impl< boost::asio::detail::win_iocp_handle_service, Executor > impl_;
119086
119087
119088
119089 [endsect]
119090
119091
119092
119093 [section:is_open windows::basic_random_access_handle::is_open]
119094
119095
119096 ['Inherited from windows::basic_overlapped_handle.]
119097
119098 [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.is_open..is_open..windows::basic_random_access_handle] 
119099 Determine whether the handle is open. 
119100
119101
119102   bool is_open() const;
119103
119104
119105
119106 [endsect]
119107
119108
119109 [section:lowest_layer windows::basic_random_access_handle::lowest_layer]
119110
119111 [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.lowest_layer..lowest_layer..windows::basic_random_access_handle] 
119112 Get a reference to the lowest layer. 
119113
119114
119115   lowest_layer_type & ``[link boost_asio.reference.windows__basic_random_access_handle.lowest_layer.overload1 lowest_layer]``();
119116   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.lowest_layer.overload1 more...]]``
119117
119118
119119 Get a const reference to the lowest layer. 
119120
119121
119122   const lowest_layer_type & ``[link boost_asio.reference.windows__basic_random_access_handle.lowest_layer.overload2 lowest_layer]``() const;
119123   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.lowest_layer.overload2 more...]]``
119124
119125
119126 [section:overload1 windows::basic_random_access_handle::lowest_layer (1 of 2 overloads)]
119127
119128
119129 ['Inherited from windows::basic_overlapped_handle.]
119130
119131
119132 Get a reference to the lowest layer. 
119133
119134
119135   lowest_layer_type & lowest_layer();
119136
119137
119138 This function returns a reference to the lowest layer in a stack of layers. Since an overlapped\_handle cannot contain any further layers, it simply returns a reference to itself.
119139
119140
119141 [heading Return Value]
119142       
119143 A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 
119144
119145
119146
119147
119148 [endsect]
119149
119150
119151
119152 [section:overload2 windows::basic_random_access_handle::lowest_layer (2 of 2 overloads)]
119153
119154
119155 ['Inherited from windows::basic_overlapped_handle.]
119156
119157
119158 Get a const reference to the lowest layer. 
119159
119160
119161   const lowest_layer_type & lowest_layer() const;
119162
119163
119164 This function returns a const reference to the lowest layer in a stack of layers. Since an overlapped\_handle cannot contain any further layers, it simply returns a reference to itself.
119165
119166
119167 [heading Return Value]
119168       
119169 A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 
119170
119171
119172
119173
119174 [endsect]
119175
119176
119177 [endsect]
119178
119179
119180 [section:lowest_layer_type windows::basic_random_access_handle::lowest_layer_type]
119181
119182
119183 ['Inherited from windows::basic_overlapped_handle.]
119184
119185 [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.lowest_layer_type..lowest_layer_type..windows::basic_random_access_handle] 
119186 An overlapped\_handle is always the lowest layer. 
119187
119188
119189   typedef basic_overlapped_handle lowest_layer_type;
119190
119191
119192 [heading Types]
119193 [table
119194   [[Name][Description]]
119195
119196   [
119197
119198     [[link boost_asio.reference.windows__basic_overlapped_handle__rebind_executor [*rebind_executor]]]
119199     [Rebinds the handle type to another executor. ]
119200   
119201   ]
119202
119203   [
119204
119205     [[link boost_asio.reference.windows__basic_overlapped_handle.executor_type [*executor_type]]]
119206     [The type of the executor associated with the object. ]
119207   
119208   ]
119209
119210   [
119211
119212     [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer_type [*lowest_layer_type]]]
119213     [An overlapped_handle is always the lowest layer. ]
119214   
119215   ]
119216
119217   [
119218
119219     [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle_type [*native_handle_type]]]
119220     [The native representation of a handle. ]
119221   
119222   ]
119223
119224 ]
119225
119226 [heading Member Functions]
119227 [table
119228   [[Name][Description]]
119229
119230   [
119231     [[link boost_asio.reference.windows__basic_overlapped_handle.assign [*assign]]]
119232     [Assign an existing native handle to the handle. ]
119233   ]
119234   
119235   [
119236     [[link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle [*basic_overlapped_handle]]]
119237     [Construct an overlapped handle without opening it. 
119238      [hr]
119239      Construct an overlapped handle on an existing native handle. 
119240      [hr]
119241      Move-construct an overlapped handle from another. ]
119242   ]
119243   
119244   [
119245     [[link boost_asio.reference.windows__basic_overlapped_handle.cancel [*cancel]]]
119246     [Cancel all asynchronous operations associated with the handle. ]
119247   ]
119248   
119249   [
119250     [[link boost_asio.reference.windows__basic_overlapped_handle.close [*close]]]
119251     [Close the handle. ]
119252   ]
119253   
119254   [
119255     [[link boost_asio.reference.windows__basic_overlapped_handle.get_executor [*get_executor]]]
119256     [Get the executor associated with the object. ]
119257   ]
119258   
119259   [
119260     [[link boost_asio.reference.windows__basic_overlapped_handle.is_open [*is_open]]]
119261     [Determine whether the handle is open. ]
119262   ]
119263   
119264   [
119265     [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer [*lowest_layer]]]
119266     [Get a reference to the lowest layer. 
119267      [hr]
119268      Get a const reference to the lowest layer. ]
119269   ]
119270   
119271   [
119272     [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle [*native_handle]]]
119273     [Get the native handle representation. ]
119274   ]
119275   
119276   [
119277     [[link boost_asio.reference.windows__basic_overlapped_handle.operator_eq_ [*operator=]]]
119278     [Move-assign an overlapped handle from another. ]
119279   ]
119280   
119281 ]
119282
119283 [heading Protected Member Functions]
119284 [table
119285   [[Name][Description]]
119286
119287   [
119288     [[link boost_asio.reference.windows__basic_overlapped_handle._basic_overlapped_handle [*~basic_overlapped_handle]]]
119289     [Protected destructor to prevent deletion through this type. ]
119290   ]
119291   
119292 ]
119293
119294 [heading Protected Data Members]
119295 [table
119296   [[Name][Description]]
119297
119298   [
119299     [[link boost_asio.reference.windows__basic_overlapped_handle.impl_ [*impl_]]]
119300     []
119301   ]
119302
119303 ]
119304
119305 The [link boost_asio.reference.windows__overlapped_handle `windows::overlapped_handle`] class provides the ability to wrap a Windows handle. The underlying object referred to by the handle must support overlapped I/O.
119306
119307
119308 [heading Thread Safety]
119309   
119310 ['Distinct] ['objects:] Safe.
119311
119312 ['Shared] ['objects:] Unsafe. 
119313
119314
119315
119316
119317 [heading Requirements]
119318
119319 ['Header: ][^boost/asio/windows/basic_random_access_handle.hpp]
119320
119321 ['Convenience header: ][^boost/asio.hpp]
119322
119323
119324 [endsect]
119325
119326
119327
119328 [section:native_handle windows::basic_random_access_handle::native_handle]
119329
119330
119331 ['Inherited from windows::basic_overlapped_handle.]
119332
119333 [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.native_handle..native_handle..windows::basic_random_access_handle] 
119334 Get the native handle representation. 
119335
119336
119337   native_handle_type native_handle();
119338
119339
119340 This function may be used to obtain the underlying representation of the handle. This is intended to allow access to native handle functionality that is not otherwise provided. 
119341
119342
119343 [endsect]
119344
119345
119346
119347 [section:native_handle_type windows::basic_random_access_handle::native_handle_type]
119348
119349 [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.native_handle_type..native_handle_type..windows::basic_random_access_handle] 
119350 The native representation of a handle. 
119351
119352
119353   typedef implementation_defined native_handle_type;
119354
119355
119356
119357 [heading Requirements]
119358
119359 ['Header: ][^boost/asio/windows/basic_random_access_handle.hpp]
119360
119361 ['Convenience header: ][^boost/asio.hpp]
119362
119363
119364 [endsect]
119365
119366
119367
119368 [section:operator_eq_ windows::basic_random_access_handle::operator=]
119369
119370 [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.operator_eq_..operator=..windows::basic_random_access_handle] 
119371 Move-assign a random-access handle from another. 
119372
119373
119374   basic_random_access_handle & operator=(
119375       basic_random_access_handle && other);
119376
119377
119378 This assignment operator moves a random-access handle from one object to another.
119379
119380
119381 [heading Parameters]
119382     
119383
119384 [variablelist
119385   
119386 [[other][The other random-access handle object from which the move will occur.]]
119387
119388 ]
119389
119390
119391 [heading Remarks]
119392       
119393 Following the move, the moved-from object is in the same state as if constructed using the `basic_random_access_handle(const executor_type&)` constructor. 
119394
119395
119396
119397
119398 [endsect]
119399
119400
119401 [section:read_some_at windows::basic_random_access_handle::read_some_at]
119402
119403 [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.read_some_at..read_some_at..windows::basic_random_access_handle] 
119404 Read some data from the handle at the specified offset. 
119405
119406
119407   template<
119408       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
119409   std::size_t ``[link boost_asio.reference.windows__basic_random_access_handle.read_some_at.overload1 read_some_at]``(
119410       uint64_t offset,
119411       const MutableBufferSequence & buffers);
119412   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.read_some_at.overload1 more...]]``
119413
119414   template<
119415       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
119416   std::size_t ``[link boost_asio.reference.windows__basic_random_access_handle.read_some_at.overload2 read_some_at]``(
119417       uint64_t offset,
119418       const MutableBufferSequence & buffers,
119419       boost::system::error_code & ec);
119420   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.read_some_at.overload2 more...]]``
119421
119422
119423 [section:overload1 windows::basic_random_access_handle::read_some_at (1 of 2 overloads)]
119424
119425
119426 Read some data from the handle at the specified offset. 
119427
119428
119429   template<
119430       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
119431   std::size_t read_some_at(
119432       uint64_t offset,
119433       const MutableBufferSequence & buffers);
119434
119435
119436 This function is used to read data from the random-access handle. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
119437
119438
119439 [heading Parameters]
119440     
119441
119442 [variablelist
119443   
119444 [[offset][The offset at which the data will be read.]]
119445
119446 [[buffers][One or more buffers into which the data will be read.]]
119447
119448 ]
119449
119450
119451 [heading Return Value]
119452       
119453 The number of bytes read.
119454
119455
119456 [heading Exceptions]
119457     
119458
119459 [variablelist
119460   
119461 [[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
119462
119463 ]
119464
119465
119466 [heading Remarks]
119467       
119468 The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read_at `read_at`]  function if you need to ensure that the requested amount of data is read before the blocking operation completes.
119469
119470
119471 [heading Example]
119472   
119473 To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
119474
119475    handle.read_some_at(42, boost::asio::buffer(data, size));
119476
119477
119478 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
119479
119480
119481
119482
119483 [endsect]
119484
119485
119486
119487 [section:overload2 windows::basic_random_access_handle::read_some_at (2 of 2 overloads)]
119488
119489
119490 Read some data from the handle at the specified offset. 
119491
119492
119493   template<
119494       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
119495   std::size_t read_some_at(
119496       uint64_t offset,
119497       const MutableBufferSequence & buffers,
119498       boost::system::error_code & ec);
119499
119500
119501 This function is used to read data from the random-access handle. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
119502
119503
119504 [heading Parameters]
119505     
119506
119507 [variablelist
119508   
119509 [[offset][The offset at which the data will be read.]]
119510
119511 [[buffers][One or more buffers into which the data will be read.]]
119512
119513 [[ec][Set to indicate what error occurred, if any.]]
119514
119515 ]
119516
119517
119518 [heading Return Value]
119519       
119520 The number of bytes read. Returns 0 if an error occurred.
119521
119522
119523 [heading Remarks]
119524       
119525 The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read_at `read_at`]  function if you need to ensure that the requested amount of data is read before the blocking operation completes. 
119526
119527
119528
119529
119530 [endsect]
119531
119532
119533 [endsect]
119534
119535 [section:write_some_at windows::basic_random_access_handle::write_some_at]
119536
119537 [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.write_some_at..write_some_at..windows::basic_random_access_handle] 
119538 Write some data to the handle at the specified offset. 
119539
119540
119541   template<
119542       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
119543   std::size_t ``[link boost_asio.reference.windows__basic_random_access_handle.write_some_at.overload1 write_some_at]``(
119544       uint64_t offset,
119545       const ConstBufferSequence & buffers);
119546   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.write_some_at.overload1 more...]]``
119547
119548   template<
119549       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
119550   std::size_t ``[link boost_asio.reference.windows__basic_random_access_handle.write_some_at.overload2 write_some_at]``(
119551       uint64_t offset,
119552       const ConstBufferSequence & buffers,
119553       boost::system::error_code & ec);
119554   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.write_some_at.overload2 more...]]``
119555
119556
119557 [section:overload1 windows::basic_random_access_handle::write_some_at (1 of 2 overloads)]
119558
119559
119560 Write some data to the handle at the specified offset. 
119561
119562
119563   template<
119564       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
119565   std::size_t write_some_at(
119566       uint64_t offset,
119567       const ConstBufferSequence & buffers);
119568
119569
119570 This function is used to write data to the random-access handle. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
119571
119572
119573 [heading Parameters]
119574     
119575
119576 [variablelist
119577   
119578 [[offset][The offset at which the data will be written.]]
119579
119580 [[buffers][One or more data buffers to be written to the handle.]]
119581
119582 ]
119583
119584
119585 [heading Return Value]
119586       
119587 The number of bytes written.
119588
119589
119590 [heading Exceptions]
119591     
119592
119593 [variablelist
119594   
119595 [[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
119596
119597 ]
119598
119599
119600 [heading Remarks]
119601       
119602 The write\_some\_at operation may not write all of the data. Consider using the [link boost_asio.reference.write_at `write_at`]  function if you need to ensure that all data is written before the blocking operation completes.
119603
119604
119605 [heading Example]
119606   
119607 To write a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
119608
119609    handle.write_some_at(42, boost::asio::buffer(data, size));
119610
119611
119612 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
119613
119614
119615
119616
119617 [endsect]
119618
119619
119620
119621 [section:overload2 windows::basic_random_access_handle::write_some_at (2 of 2 overloads)]
119622
119623
119624 Write some data to the handle at the specified offset. 
119625
119626
119627   template<
119628       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
119629   std::size_t write_some_at(
119630       uint64_t offset,
119631       const ConstBufferSequence & buffers,
119632       boost::system::error_code & ec);
119633
119634
119635 This function is used to write data to the random-access handle. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
119636
119637
119638 [heading Parameters]
119639     
119640
119641 [variablelist
119642   
119643 [[offset][The offset at which the data will be written.]]
119644
119645 [[buffers][One or more data buffers to be written to the handle.]]
119646
119647 [[ec][Set to indicate what error occurred, if any.]]
119648
119649 ]
119650
119651
119652 [heading Return Value]
119653       
119654 The number of bytes written. Returns 0 if an error occurred.
119655
119656
119657 [heading Remarks]
119658       
119659 The write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write_at `write_at`]  function if you need to ensure that all data is written before the blocking operation completes. 
119660
119661
119662
119663
119664 [endsect]
119665
119666
119667 [endsect]
119668
119669
119670 [endsect]
119671
119672 [section:windows__basic_random_access_handle__rebind_executor windows::basic_random_access_handle::rebind_executor]
119673
119674
119675 Rebinds the handle type to another executor. 
119676
119677
119678   template<
119679       typename ``[link boost_asio.reference.Executor1 Executor1]``>
119680   struct rebind_executor
119681
119682
119683 [heading Types]
119684 [table
119685   [[Name][Description]]
119686
119687   [
119688
119689     [[link boost_asio.reference.windows__basic_random_access_handle__rebind_executor.other [*other]]]
119690     [The handle type when rebound to the specified executor. ]
119691   
119692   ]
119693
119694 ]
119695
119696 [heading Requirements]
119697
119698 ['Header: ][^boost/asio/windows/basic_random_access_handle.hpp]
119699
119700 ['Convenience header: ][^boost/asio.hpp]
119701
119702
119703 [section:other windows::basic_random_access_handle::rebind_executor::other]
119704
119705 [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle__rebind_executor.other..other..windows::basic_random_access_handle::rebind_executor] 
119706 The handle type when rebound to the specified executor. 
119707
119708
119709   typedef basic_random_access_handle< Executor1 > other;
119710
119711
119712 [heading Types]
119713 [table
119714   [[Name][Description]]
119715
119716   [
119717
119718     [[link boost_asio.reference.windows__basic_random_access_handle__rebind_executor [*rebind_executor]]]
119719     [Rebinds the handle type to another executor. ]
119720   
119721   ]
119722
119723   [
119724
119725     [[link boost_asio.reference.windows__basic_random_access_handle.executor_type [*executor_type]]]
119726     [The type of the executor associated with the object. ]
119727   
119728   ]
119729
119730   [
119731
119732     [[link boost_asio.reference.windows__basic_random_access_handle.lowest_layer_type [*lowest_layer_type]]]
119733     [An overlapped_handle is always the lowest layer. ]
119734   
119735   ]
119736
119737   [
119738
119739     [[link boost_asio.reference.windows__basic_random_access_handle.native_handle_type [*native_handle_type]]]
119740     [The native representation of a handle. ]
119741   
119742   ]
119743
119744 ]
119745
119746 [heading Member Functions]
119747 [table
119748   [[Name][Description]]
119749
119750   [
119751     [[link boost_asio.reference.windows__basic_random_access_handle.assign [*assign]]]
119752     [Assign an existing native handle to the handle. ]
119753   ]
119754   
119755   [
119756     [[link boost_asio.reference.windows__basic_random_access_handle.async_read_some_at [*async_read_some_at]]]
119757     [Start an asynchronous read at the specified offset. ]
119758   ]
119759   
119760   [
119761     [[link boost_asio.reference.windows__basic_random_access_handle.async_write_some_at [*async_write_some_at]]]
119762     [Start an asynchronous write at the specified offset. ]
119763   ]
119764   
119765   [
119766     [[link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle [*basic_random_access_handle]]]
119767     [Construct a random-access handle without opening it. 
119768      [hr]
119769      Construct a random-access handle on an existing native handle. 
119770      [hr]
119771      Move-construct a random-access handle from another. ]
119772   ]
119773   
119774   [
119775     [[link boost_asio.reference.windows__basic_random_access_handle.cancel [*cancel]]]
119776     [Cancel all asynchronous operations associated with the handle. ]
119777   ]
119778   
119779   [
119780     [[link boost_asio.reference.windows__basic_random_access_handle.close [*close]]]
119781     [Close the handle. ]
119782   ]
119783   
119784   [
119785     [[link boost_asio.reference.windows__basic_random_access_handle.get_executor [*get_executor]]]
119786     [Get the executor associated with the object. ]
119787   ]
119788   
119789   [
119790     [[link boost_asio.reference.windows__basic_random_access_handle.is_open [*is_open]]]
119791     [Determine whether the handle is open. ]
119792   ]
119793   
119794   [
119795     [[link boost_asio.reference.windows__basic_random_access_handle.lowest_layer [*lowest_layer]]]
119796     [Get a reference to the lowest layer. 
119797      [hr]
119798      Get a const reference to the lowest layer. ]
119799   ]
119800   
119801   [
119802     [[link boost_asio.reference.windows__basic_random_access_handle.native_handle [*native_handle]]]
119803     [Get the native handle representation. ]
119804   ]
119805   
119806   [
119807     [[link boost_asio.reference.windows__basic_random_access_handle.operator_eq_ [*operator=]]]
119808     [Move-assign a random-access handle from another. ]
119809   ]
119810   
119811   [
119812     [[link boost_asio.reference.windows__basic_random_access_handle.read_some_at [*read_some_at]]]
119813     [Read some data from the handle at the specified offset. ]
119814   ]
119815   
119816   [
119817     [[link boost_asio.reference.windows__basic_random_access_handle.write_some_at [*write_some_at]]]
119818     [Write some data to the handle at the specified offset. ]
119819   ]
119820   
119821 ]
119822
119823 [heading Protected Data Members]
119824 [table
119825   [[Name][Description]]
119826
119827   [
119828     [[link boost_asio.reference.windows__basic_random_access_handle.impl_ [*impl_]]]
119829     []
119830   ]
119831
119832 ]
119833
119834 The [link boost_asio.reference.windows__basic_random_access_handle `windows::basic_random_access_handle`] class provides asynchronous and blocking random-access handle functionality.
119835
119836
119837 [heading Thread Safety]
119838   
119839 ['Distinct] ['objects:] Safe.
119840
119841 ['Shared] ['objects:] Unsafe. 
119842
119843
119844
119845
119846 [heading Requirements]
119847
119848 ['Header: ][^boost/asio/windows/basic_random_access_handle.hpp]
119849
119850 ['Convenience header: ][^boost/asio.hpp]
119851
119852
119853 [endsect]
119854
119855
119856
119857 [endsect]
119858
119859 [section:windows__basic_stream_handle windows::basic_stream_handle]
119860
119861
119862 Provides stream-oriented handle functionality. 
119863
119864
119865   template<
119866       typename ``[link boost_asio.reference.Executor1 Executor]`` = executor>
119867   class basic_stream_handle :
119868     public windows::basic_overlapped_handle< Executor >
119869
119870
119871 [heading Types]
119872 [table
119873   [[Name][Description]]
119874
119875   [
119876
119877     [[link boost_asio.reference.windows__basic_stream_handle__rebind_executor [*rebind_executor]]]
119878     [Rebinds the handle type to another executor. ]
119879   
119880   ]
119881
119882   [
119883
119884     [[link boost_asio.reference.windows__basic_stream_handle.executor_type [*executor_type]]]
119885     [The type of the executor associated with the object. ]
119886   
119887   ]
119888
119889   [
119890
119891     [[link boost_asio.reference.windows__basic_stream_handle.lowest_layer_type [*lowest_layer_type]]]
119892     [An overlapped_handle is always the lowest layer. ]
119893   
119894   ]
119895
119896   [
119897
119898     [[link boost_asio.reference.windows__basic_stream_handle.native_handle_type [*native_handle_type]]]
119899     [The native representation of a handle. ]
119900   
119901   ]
119902
119903 ]
119904
119905 [heading Member Functions]
119906 [table
119907   [[Name][Description]]
119908
119909   [
119910     [[link boost_asio.reference.windows__basic_stream_handle.assign [*assign]]]
119911     [Assign an existing native handle to the handle. ]
119912   ]
119913   
119914   [
119915     [[link boost_asio.reference.windows__basic_stream_handle.async_read_some [*async_read_some]]]
119916     [Start an asynchronous read. ]
119917   ]
119918   
119919   [
119920     [[link boost_asio.reference.windows__basic_stream_handle.async_write_some [*async_write_some]]]
119921     [Start an asynchronous write. ]
119922   ]
119923   
119924   [
119925     [[link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle [*basic_stream_handle]]]
119926     [Construct a stream handle without opening it. 
119927      [hr]
119928      Construct a stream handle on an existing native handle. 
119929      [hr]
119930      Move-construct a stream handle from another. ]
119931   ]
119932   
119933   [
119934     [[link boost_asio.reference.windows__basic_stream_handle.cancel [*cancel]]]
119935     [Cancel all asynchronous operations associated with the handle. ]
119936   ]
119937   
119938   [
119939     [[link boost_asio.reference.windows__basic_stream_handle.close [*close]]]
119940     [Close the handle. ]
119941   ]
119942   
119943   [
119944     [[link boost_asio.reference.windows__basic_stream_handle.get_executor [*get_executor]]]
119945     [Get the executor associated with the object. ]
119946   ]
119947   
119948   [
119949     [[link boost_asio.reference.windows__basic_stream_handle.is_open [*is_open]]]
119950     [Determine whether the handle is open. ]
119951   ]
119952   
119953   [
119954     [[link boost_asio.reference.windows__basic_stream_handle.lowest_layer [*lowest_layer]]]
119955     [Get a reference to the lowest layer. 
119956      [hr]
119957      Get a const reference to the lowest layer. ]
119958   ]
119959   
119960   [
119961     [[link boost_asio.reference.windows__basic_stream_handle.native_handle [*native_handle]]]
119962     [Get the native handle representation. ]
119963   ]
119964   
119965   [
119966     [[link boost_asio.reference.windows__basic_stream_handle.operator_eq_ [*operator=]]]
119967     [Move-assign a stream handle from another. ]
119968   ]
119969   
119970   [
119971     [[link boost_asio.reference.windows__basic_stream_handle.read_some [*read_some]]]
119972     [Read some data from the handle. ]
119973   ]
119974   
119975   [
119976     [[link boost_asio.reference.windows__basic_stream_handle.write_some [*write_some]]]
119977     [Write some data to the handle. ]
119978   ]
119979   
119980 ]
119981
119982 [heading Protected Data Members]
119983 [table
119984   [[Name][Description]]
119985
119986   [
119987     [[link boost_asio.reference.windows__basic_stream_handle.impl_ [*impl_]]]
119988     []
119989   ]
119990
119991 ]
119992
119993 The [link boost_asio.reference.windows__basic_stream_handle `windows::basic_stream_handle`] class provides asynchronous and blocking stream-oriented handle functionality.
119994
119995
119996 [heading Thread Safety]
119997   
119998 ['Distinct] ['objects:] Safe.
119999
120000 ['Shared] ['objects:] Unsafe.
120001
120002
120003
120004
120005 [heading Requirements]
120006
120007 ['Header: ][^boost/asio/windows/basic_stream_handle.hpp]
120008
120009 ['Convenience header: ][^boost/asio.hpp]
120010
120011 [section:assign windows::basic_stream_handle::assign]
120012
120013 [indexterm2 boost_asio.indexterm.windows__basic_stream_handle.assign..assign..windows::basic_stream_handle] 
120014 Assign an existing native handle to the handle. 
120015
120016
120017   void ``[link boost_asio.reference.windows__basic_stream_handle.assign.overload1 assign]``(
120018       const native_handle_type & handle);
120019   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.assign.overload1 more...]]``
120020
120021   void ``[link boost_asio.reference.windows__basic_stream_handle.assign.overload2 assign]``(
120022       const native_handle_type & handle,
120023       boost::system::error_code & ec);
120024   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.assign.overload2 more...]]``
120025
120026
120027 [section:overload1 windows::basic_stream_handle::assign (1 of 2 overloads)]
120028
120029
120030 ['Inherited from windows::basic_overlapped_handle.]
120031
120032
120033 Assign an existing native handle to the handle. 
120034
120035
120036   void assign(
120037       const native_handle_type & handle);
120038
120039
120040
120041 [endsect]
120042
120043
120044
120045 [section:overload2 windows::basic_stream_handle::assign (2 of 2 overloads)]
120046
120047
120048 ['Inherited from windows::basic_overlapped_handle.]
120049
120050
120051 Assign an existing native handle to the handle. 
120052
120053
120054   void assign(
120055       const native_handle_type & handle,
120056       boost::system::error_code & ec);
120057
120058
120059
120060 [endsect]
120061
120062
120063 [endsect]
120064
120065
120066 [section:async_read_some windows::basic_stream_handle::async_read_some]
120067
120068 [indexterm2 boost_asio.indexterm.windows__basic_stream_handle.async_read_some..async_read_some..windows::basic_stream_handle] 
120069 Start an asynchronous read. 
120070
120071
120072   template<
120073       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
120074       typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
120075   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_some(
120076       const MutableBufferSequence & buffers,
120077       ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
120078
120079
120080 This function is used to asynchronously read data from the stream handle. The function call always returns immediately.
120081
120082
120083 [heading Parameters]
120084     
120085
120086 [variablelist
120087   
120088 [[buffers][One or more buffers into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
120089
120090 [[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
120091 ``
120092    void handler(
120093      const boost::system::error_code& error, // Result of operation.
120094      std::size_t bytes_transferred           // Number of bytes read.
120095    ); 
120096 ``
120097 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
120098
120099 ]
120100
120101
120102 [heading Remarks]
120103       
120104 The read operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.async_read `async_read`]  function if you need to ensure that the requested amount of data is read before the asynchronous operation completes.
120105
120106
120107 [heading Example]
120108   
120109 To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
120110
120111    handle.async_read_some(boost::asio::buffer(data, size), handler);
120112
120113
120114 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
120115
120116
120117
120118
120119 [endsect]
120120
120121
120122
120123 [section:async_write_some windows::basic_stream_handle::async_write_some]
120124
120125 [indexterm2 boost_asio.indexterm.windows__basic_stream_handle.async_write_some..async_write_some..windows::basic_stream_handle] 
120126 Start an asynchronous write. 
120127
120128
120129   template<
120130       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
120131       typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
120132   ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_some(
120133       const ConstBufferSequence & buffers,
120134       WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
120135
120136
120137 This function is used to asynchronously write data to the stream handle. The function call always returns immediately.
120138
120139
120140 [heading Parameters]
120141     
120142
120143 [variablelist
120144   
120145 [[buffers][One or more data buffers to be written to the handle. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
120146
120147 [[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be: 
120148 ``
120149    void handler(
120150      const boost::system::error_code& error, // Result of operation.
120151      std::size_t bytes_transferred           // Number of bytes written.
120152    ); 
120153 ``
120154 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
120155
120156 ]
120157
120158
120159 [heading Remarks]
120160       
120161 The write operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.async_write `async_write`]  function if you need to ensure that all data is written before the asynchronous operation completes.
120162
120163
120164 [heading Example]
120165   
120166 To write a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
120167
120168    handle.async_write_some(boost::asio::buffer(data, size), handler);
120169
120170
120171 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
120172
120173
120174
120175
120176 [endsect]
120177
120178
120179 [section:basic_stream_handle windows::basic_stream_handle::basic_stream_handle]
120180
120181 [indexterm2 boost_asio.indexterm.windows__basic_stream_handle.basic_stream_handle..basic_stream_handle..windows::basic_stream_handle] 
120182 Construct a stream handle without opening it. 
120183
120184
120185   explicit ``[link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle.overload1 basic_stream_handle]``(
120186       const executor_type & ex);
120187   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle.overload1 more...]]``
120188
120189   template<
120190       typename ExecutionContext>
120191   explicit ``[link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle.overload2 basic_stream_handle]``(
120192       ExecutionContext & context,
120193       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value, basic_stream_handle >::type *  = 0);
120194   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle.overload2 more...]]``
120195
120196
120197 Construct a stream handle on an existing native handle. 
120198
120199
120200   ``[link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle.overload3 basic_stream_handle]``(
120201       const executor_type & ex,
120202       const native_handle_type & handle);
120203   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle.overload3 more...]]``
120204
120205   template<
120206       typename ExecutionContext>
120207   ``[link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle.overload4 basic_stream_handle]``(
120208       ExecutionContext & context,
120209       const native_handle_type & handle,
120210       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
120211   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle.overload4 more...]]``
120212
120213
120214 Move-construct a stream handle from another. 
120215
120216
120217   ``[link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle.overload5 basic_stream_handle]``(
120218       basic_stream_handle && other);
120219   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle.overload5 more...]]``
120220
120221
120222 [section:overload1 windows::basic_stream_handle::basic_stream_handle (1 of 5 overloads)]
120223
120224
120225 Construct a stream handle without opening it. 
120226
120227
120228   basic_stream_handle(
120229       const executor_type & ex);
120230
120231
120232 This constructor creates a stream handle without opening it.
120233
120234
120235 [heading Parameters]
120236     
120237
120238 [variablelist
120239   
120240 [[ex][The I/O executor that the stream handle will use, by default, to dispatch handlers for any asynchronous operations performed on the stream handle. ]]
120241
120242 ]
120243
120244
120245
120246
120247 [endsect]
120248
120249
120250
120251 [section:overload2 windows::basic_stream_handle::basic_stream_handle (2 of 5 overloads)]
120252
120253
120254 Construct a stream handle without opening it. 
120255
120256
120257   template<
120258       typename ExecutionContext>
120259   basic_stream_handle(
120260       ExecutionContext & context,
120261       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value, basic_stream_handle >::type *  = 0);
120262
120263
120264 This constructor creates a stream handle without opening it. The handle needs to be opened or assigned before data can be sent or received on it.
120265
120266
120267 [heading Parameters]
120268     
120269
120270 [variablelist
120271   
120272 [[context][An execution context which provides the I/O executor that the stream handle will use, by default, to dispatch handlers for any asynchronous operations performed on the stream handle. ]]
120273
120274 ]
120275
120276
120277
120278
120279 [endsect]
120280
120281
120282
120283 [section:overload3 windows::basic_stream_handle::basic_stream_handle (3 of 5 overloads)]
120284
120285
120286 Construct a stream handle on an existing native handle. 
120287
120288
120289   basic_stream_handle(
120290       const executor_type & ex,
120291       const native_handle_type & handle);
120292
120293
120294 This constructor creates a stream handle object to hold an existing native handle.
120295
120296
120297 [heading Parameters]
120298     
120299
120300 [variablelist
120301   
120302 [[ex][The I/O executor that the stream handle will use, by default, to dispatch handlers for any asynchronous operations performed on the stream handle.]]
120303
120304 [[handle][The new underlying handle implementation.]]
120305
120306 ]
120307
120308
120309 [heading Exceptions]
120310     
120311
120312 [variablelist
120313   
120314 [[boost::system::system_error][Thrown on failure. ]]
120315
120316 ]
120317
120318
120319
120320
120321 [endsect]
120322
120323
120324
120325 [section:overload4 windows::basic_stream_handle::basic_stream_handle (4 of 5 overloads)]
120326
120327
120328 Construct a stream handle on an existing native handle. 
120329
120330
120331   template<
120332       typename ExecutionContext>
120333   basic_stream_handle(
120334       ExecutionContext & context,
120335       const native_handle_type & handle,
120336       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
120337
120338
120339 This constructor creates a stream handle object to hold an existing native handle.
120340
120341
120342 [heading Parameters]
120343     
120344
120345 [variablelist
120346   
120347 [[context][An execution context which provides the I/O executor that the stream handle will use, by default, to dispatch handlers for any asynchronous operations performed on the stream handle.]]
120348
120349 [[handle][The new underlying handle implementation.]]
120350
120351 ]
120352
120353
120354 [heading Exceptions]
120355     
120356
120357 [variablelist
120358   
120359 [[boost::system::system_error][Thrown on failure. ]]
120360
120361 ]
120362
120363
120364
120365
120366 [endsect]
120367
120368
120369
120370 [section:overload5 windows::basic_stream_handle::basic_stream_handle (5 of 5 overloads)]
120371
120372
120373 Move-construct a stream handle from another. 
120374
120375
120376   basic_stream_handle(
120377       basic_stream_handle && other);
120378
120379
120380 This constructor moves a stream handle from one object to another.
120381
120382
120383 [heading Parameters]
120384     
120385
120386 [variablelist
120387   
120388 [[other][The other stream handle object from which the move will occur.]]
120389
120390 ]
120391
120392
120393 [heading Remarks]
120394       
120395 Following the move, the moved-from object is in the same state as if constructed using the `basic_stream_handle(const executor_type&)` constructor. 
120396
120397
120398
120399
120400 [endsect]
120401
120402
120403 [endsect]
120404
120405 [section:cancel windows::basic_stream_handle::cancel]
120406
120407 [indexterm2 boost_asio.indexterm.windows__basic_stream_handle.cancel..cancel..windows::basic_stream_handle] 
120408 Cancel all asynchronous operations associated with the handle. 
120409
120410
120411   void ``[link boost_asio.reference.windows__basic_stream_handle.cancel.overload1 cancel]``();
120412   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.cancel.overload1 more...]]``
120413
120414   void ``[link boost_asio.reference.windows__basic_stream_handle.cancel.overload2 cancel]``(
120415       boost::system::error_code & ec);
120416   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.cancel.overload2 more...]]``
120417
120418
120419 [section:overload1 windows::basic_stream_handle::cancel (1 of 2 overloads)]
120420
120421
120422 ['Inherited from windows::basic_overlapped_handle.]
120423
120424
120425 Cancel all asynchronous operations associated with the handle. 
120426
120427
120428   void cancel();
120429
120430
120431 This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
120432
120433
120434 [heading Exceptions]
120435     
120436
120437 [variablelist
120438   
120439 [[boost::system::system_error][Thrown on failure. ]]
120440
120441 ]
120442
120443
120444
120445
120446 [endsect]
120447
120448
120449
120450 [section:overload2 windows::basic_stream_handle::cancel (2 of 2 overloads)]
120451
120452
120453 ['Inherited from windows::basic_overlapped_handle.]
120454
120455
120456 Cancel all asynchronous operations associated with the handle. 
120457
120458
120459   void cancel(
120460       boost::system::error_code & ec);
120461
120462
120463 This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
120464
120465
120466 [heading Parameters]
120467     
120468
120469 [variablelist
120470   
120471 [[ec][Set to indicate what error occurred, if any. ]]
120472
120473 ]
120474
120475
120476
120477
120478 [endsect]
120479
120480
120481 [endsect]
120482
120483 [section:close windows::basic_stream_handle::close]
120484
120485 [indexterm2 boost_asio.indexterm.windows__basic_stream_handle.close..close..windows::basic_stream_handle] 
120486 Close the handle. 
120487
120488
120489   void ``[link boost_asio.reference.windows__basic_stream_handle.close.overload1 close]``();
120490   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.close.overload1 more...]]``
120491
120492   void ``[link boost_asio.reference.windows__basic_stream_handle.close.overload2 close]``(
120493       boost::system::error_code & ec);
120494   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.close.overload2 more...]]``
120495
120496
120497 [section:overload1 windows::basic_stream_handle::close (1 of 2 overloads)]
120498
120499
120500 ['Inherited from windows::basic_overlapped_handle.]
120501
120502
120503 Close the handle. 
120504
120505
120506   void close();
120507
120508
120509 This function is used to close the handle. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
120510
120511
120512 [heading Exceptions]
120513     
120514
120515 [variablelist
120516   
120517 [[boost::system::system_error][Thrown on failure. ]]
120518
120519 ]
120520
120521
120522
120523
120524 [endsect]
120525
120526
120527
120528 [section:overload2 windows::basic_stream_handle::close (2 of 2 overloads)]
120529
120530
120531 ['Inherited from windows::basic_overlapped_handle.]
120532
120533
120534 Close the handle. 
120535
120536
120537   void close(
120538       boost::system::error_code & ec);
120539
120540
120541 This function is used to close the handle. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
120542
120543
120544 [heading Parameters]
120545     
120546
120547 [variablelist
120548   
120549 [[ec][Set to indicate what error occurred, if any. ]]
120550
120551 ]
120552
120553
120554
120555
120556 [endsect]
120557
120558
120559 [endsect]
120560
120561
120562 [section:executor_type windows::basic_stream_handle::executor_type]
120563
120564 [indexterm2 boost_asio.indexterm.windows__basic_stream_handle.executor_type..executor_type..windows::basic_stream_handle] 
120565 The type of the executor associated with the object. 
120566
120567
120568   typedef Executor executor_type;
120569
120570
120571
120572 [heading Requirements]
120573
120574 ['Header: ][^boost/asio/windows/basic_stream_handle.hpp]
120575
120576 ['Convenience header: ][^boost/asio.hpp]
120577
120578
120579 [endsect]
120580
120581
120582
120583 [section:get_executor windows::basic_stream_handle::get_executor]
120584
120585
120586 ['Inherited from windows::basic_overlapped_handle.]
120587
120588 [indexterm2 boost_asio.indexterm.windows__basic_stream_handle.get_executor..get_executor..windows::basic_stream_handle] 
120589 Get the executor associated with the object. 
120590
120591
120592   executor_type get_executor();
120593
120594
120595
120596 [endsect]
120597
120598
120599
120600 [section:impl_ windows::basic_stream_handle::impl_]
120601
120602
120603 ['Inherited from windows::basic_overlapped_handle.]
120604
120605 [indexterm2 boost_asio.indexterm.windows__basic_stream_handle.impl_..impl_..windows::basic_stream_handle] 
120606
120607   boost::asio::detail::io_object_impl< boost::asio::detail::win_iocp_handle_service, Executor > impl_;
120608
120609
120610
120611 [endsect]
120612
120613
120614
120615 [section:is_open windows::basic_stream_handle::is_open]
120616
120617
120618 ['Inherited from windows::basic_overlapped_handle.]
120619
120620 [indexterm2 boost_asio.indexterm.windows__basic_stream_handle.is_open..is_open..windows::basic_stream_handle] 
120621 Determine whether the handle is open. 
120622
120623
120624   bool is_open() const;
120625
120626
120627
120628 [endsect]
120629
120630
120631 [section:lowest_layer windows::basic_stream_handle::lowest_layer]
120632
120633 [indexterm2 boost_asio.indexterm.windows__basic_stream_handle.lowest_layer..lowest_layer..windows::basic_stream_handle] 
120634 Get a reference to the lowest layer. 
120635
120636
120637   lowest_layer_type & ``[link boost_asio.reference.windows__basic_stream_handle.lowest_layer.overload1 lowest_layer]``();
120638   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.lowest_layer.overload1 more...]]``
120639
120640
120641 Get a const reference to the lowest layer. 
120642
120643
120644   const lowest_layer_type & ``[link boost_asio.reference.windows__basic_stream_handle.lowest_layer.overload2 lowest_layer]``() const;
120645   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.lowest_layer.overload2 more...]]``
120646
120647
120648 [section:overload1 windows::basic_stream_handle::lowest_layer (1 of 2 overloads)]
120649
120650
120651 ['Inherited from windows::basic_overlapped_handle.]
120652
120653
120654 Get a reference to the lowest layer. 
120655
120656
120657   lowest_layer_type & lowest_layer();
120658
120659
120660 This function returns a reference to the lowest layer in a stack of layers. Since an overlapped\_handle cannot contain any further layers, it simply returns a reference to itself.
120661
120662
120663 [heading Return Value]
120664       
120665 A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 
120666
120667
120668
120669
120670 [endsect]
120671
120672
120673
120674 [section:overload2 windows::basic_stream_handle::lowest_layer (2 of 2 overloads)]
120675
120676
120677 ['Inherited from windows::basic_overlapped_handle.]
120678
120679
120680 Get a const reference to the lowest layer. 
120681
120682
120683   const lowest_layer_type & lowest_layer() const;
120684
120685
120686 This function returns a const reference to the lowest layer in a stack of layers. Since an overlapped\_handle cannot contain any further layers, it simply returns a reference to itself.
120687
120688
120689 [heading Return Value]
120690       
120691 A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 
120692
120693
120694
120695
120696 [endsect]
120697
120698
120699 [endsect]
120700
120701
120702 [section:lowest_layer_type windows::basic_stream_handle::lowest_layer_type]
120703
120704
120705 ['Inherited from windows::basic_overlapped_handle.]
120706
120707 [indexterm2 boost_asio.indexterm.windows__basic_stream_handle.lowest_layer_type..lowest_layer_type..windows::basic_stream_handle] 
120708 An overlapped\_handle is always the lowest layer. 
120709
120710
120711   typedef basic_overlapped_handle lowest_layer_type;
120712
120713
120714 [heading Types]
120715 [table
120716   [[Name][Description]]
120717
120718   [
120719
120720     [[link boost_asio.reference.windows__basic_overlapped_handle__rebind_executor [*rebind_executor]]]
120721     [Rebinds the handle type to another executor. ]
120722   
120723   ]
120724
120725   [
120726
120727     [[link boost_asio.reference.windows__basic_overlapped_handle.executor_type [*executor_type]]]
120728     [The type of the executor associated with the object. ]
120729   
120730   ]
120731
120732   [
120733
120734     [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer_type [*lowest_layer_type]]]
120735     [An overlapped_handle is always the lowest layer. ]
120736   
120737   ]
120738
120739   [
120740
120741     [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle_type [*native_handle_type]]]
120742     [The native representation of a handle. ]
120743   
120744   ]
120745
120746 ]
120747
120748 [heading Member Functions]
120749 [table
120750   [[Name][Description]]
120751
120752   [
120753     [[link boost_asio.reference.windows__basic_overlapped_handle.assign [*assign]]]
120754     [Assign an existing native handle to the handle. ]
120755   ]
120756   
120757   [
120758     [[link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle [*basic_overlapped_handle]]]
120759     [Construct an overlapped handle without opening it. 
120760      [hr]
120761      Construct an overlapped handle on an existing native handle. 
120762      [hr]
120763      Move-construct an overlapped handle from another. ]
120764   ]
120765   
120766   [
120767     [[link boost_asio.reference.windows__basic_overlapped_handle.cancel [*cancel]]]
120768     [Cancel all asynchronous operations associated with the handle. ]
120769   ]
120770   
120771   [
120772     [[link boost_asio.reference.windows__basic_overlapped_handle.close [*close]]]
120773     [Close the handle. ]
120774   ]
120775   
120776   [
120777     [[link boost_asio.reference.windows__basic_overlapped_handle.get_executor [*get_executor]]]
120778     [Get the executor associated with the object. ]
120779   ]
120780   
120781   [
120782     [[link boost_asio.reference.windows__basic_overlapped_handle.is_open [*is_open]]]
120783     [Determine whether the handle is open. ]
120784   ]
120785   
120786   [
120787     [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer [*lowest_layer]]]
120788     [Get a reference to the lowest layer. 
120789      [hr]
120790      Get a const reference to the lowest layer. ]
120791   ]
120792   
120793   [
120794     [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle [*native_handle]]]
120795     [Get the native handle representation. ]
120796   ]
120797   
120798   [
120799     [[link boost_asio.reference.windows__basic_overlapped_handle.operator_eq_ [*operator=]]]
120800     [Move-assign an overlapped handle from another. ]
120801   ]
120802   
120803 ]
120804
120805 [heading Protected Member Functions]
120806 [table
120807   [[Name][Description]]
120808
120809   [
120810     [[link boost_asio.reference.windows__basic_overlapped_handle._basic_overlapped_handle [*~basic_overlapped_handle]]]
120811     [Protected destructor to prevent deletion through this type. ]
120812   ]
120813   
120814 ]
120815
120816 [heading Protected Data Members]
120817 [table
120818   [[Name][Description]]
120819
120820   [
120821     [[link boost_asio.reference.windows__basic_overlapped_handle.impl_ [*impl_]]]
120822     []
120823   ]
120824
120825 ]
120826
120827 The [link boost_asio.reference.windows__overlapped_handle `windows::overlapped_handle`] class provides the ability to wrap a Windows handle. The underlying object referred to by the handle must support overlapped I/O.
120828
120829
120830 [heading Thread Safety]
120831   
120832 ['Distinct] ['objects:] Safe.
120833
120834 ['Shared] ['objects:] Unsafe. 
120835
120836
120837
120838
120839 [heading Requirements]
120840
120841 ['Header: ][^boost/asio/windows/basic_stream_handle.hpp]
120842
120843 ['Convenience header: ][^boost/asio.hpp]
120844
120845
120846 [endsect]
120847
120848
120849
120850 [section:native_handle windows::basic_stream_handle::native_handle]
120851
120852
120853 ['Inherited from windows::basic_overlapped_handle.]
120854
120855 [indexterm2 boost_asio.indexterm.windows__basic_stream_handle.native_handle..native_handle..windows::basic_stream_handle] 
120856 Get the native handle representation. 
120857
120858
120859   native_handle_type native_handle();
120860
120861
120862 This function may be used to obtain the underlying representation of the handle. This is intended to allow access to native handle functionality that is not otherwise provided. 
120863
120864
120865 [endsect]
120866
120867
120868
120869 [section:native_handle_type windows::basic_stream_handle::native_handle_type]
120870
120871 [indexterm2 boost_asio.indexterm.windows__basic_stream_handle.native_handle_type..native_handle_type..windows::basic_stream_handle] 
120872 The native representation of a handle. 
120873
120874
120875   typedef implementation_defined native_handle_type;
120876
120877
120878
120879 [heading Requirements]
120880
120881 ['Header: ][^boost/asio/windows/basic_stream_handle.hpp]
120882
120883 ['Convenience header: ][^boost/asio.hpp]
120884
120885
120886 [endsect]
120887
120888
120889
120890 [section:operator_eq_ windows::basic_stream_handle::operator=]
120891
120892 [indexterm2 boost_asio.indexterm.windows__basic_stream_handle.operator_eq_..operator=..windows::basic_stream_handle] 
120893 Move-assign a stream handle from another. 
120894
120895
120896   basic_stream_handle & operator=(
120897       basic_stream_handle && other);
120898
120899
120900 This assignment operator moves a stream handle from one object to another.
120901
120902
120903 [heading Parameters]
120904     
120905
120906 [variablelist
120907   
120908 [[other][The other stream handle object from which the move will occur.]]
120909
120910 ]
120911
120912
120913 [heading Remarks]
120914       
120915 Following the move, the moved-from object is in the same state as if constructed using the `basic_stream_handle(const executor_type&)` constructor. 
120916
120917
120918
120919
120920 [endsect]
120921
120922
120923 [section:read_some windows::basic_stream_handle::read_some]
120924
120925 [indexterm2 boost_asio.indexterm.windows__basic_stream_handle.read_some..read_some..windows::basic_stream_handle] 
120926 Read some data from the handle. 
120927
120928
120929   template<
120930       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
120931   std::size_t ``[link boost_asio.reference.windows__basic_stream_handle.read_some.overload1 read_some]``(
120932       const MutableBufferSequence & buffers);
120933   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.read_some.overload1 more...]]``
120934
120935   template<
120936       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
120937   std::size_t ``[link boost_asio.reference.windows__basic_stream_handle.read_some.overload2 read_some]``(
120938       const MutableBufferSequence & buffers,
120939       boost::system::error_code & ec);
120940   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.read_some.overload2 more...]]``
120941
120942
120943 [section:overload1 windows::basic_stream_handle::read_some (1 of 2 overloads)]
120944
120945
120946 Read some data from the handle. 
120947
120948
120949   template<
120950       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
120951   std::size_t read_some(
120952       const MutableBufferSequence & buffers);
120953
120954
120955 This function is used to read data from the stream handle. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
120956
120957
120958 [heading Parameters]
120959     
120960
120961 [variablelist
120962   
120963 [[buffers][One or more buffers into which the data will be read.]]
120964
120965 ]
120966
120967
120968 [heading Return Value]
120969       
120970 The number of bytes read.
120971
120972
120973 [heading Exceptions]
120974     
120975
120976 [variablelist
120977   
120978 [[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
120979
120980 ]
120981
120982
120983 [heading Remarks]
120984       
120985 The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`]  function if you need to ensure that the requested amount of data is read before the blocking operation completes.
120986
120987
120988 [heading Example]
120989   
120990 To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
120991
120992    handle.read_some(boost::asio::buffer(data, size));
120993
120994
120995 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
120996
120997
120998
120999
121000 [endsect]
121001
121002
121003
121004 [section:overload2 windows::basic_stream_handle::read_some (2 of 2 overloads)]
121005
121006
121007 Read some data from the handle. 
121008
121009
121010   template<
121011       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
121012   std::size_t read_some(
121013       const MutableBufferSequence & buffers,
121014       boost::system::error_code & ec);
121015
121016
121017 This function is used to read data from the stream handle. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
121018
121019
121020 [heading Parameters]
121021     
121022
121023 [variablelist
121024   
121025 [[buffers][One or more buffers into which the data will be read.]]
121026
121027 [[ec][Set to indicate what error occurred, if any.]]
121028
121029 ]
121030
121031
121032 [heading Return Value]
121033       
121034 The number of bytes read. Returns 0 if an error occurred.
121035
121036
121037 [heading Remarks]
121038       
121039 The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`]  function if you need to ensure that the requested amount of data is read before the blocking operation completes. 
121040
121041
121042
121043
121044 [endsect]
121045
121046
121047 [endsect]
121048
121049 [section:write_some windows::basic_stream_handle::write_some]
121050
121051 [indexterm2 boost_asio.indexterm.windows__basic_stream_handle.write_some..write_some..windows::basic_stream_handle] 
121052 Write some data to the handle. 
121053
121054
121055   template<
121056       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
121057   std::size_t ``[link boost_asio.reference.windows__basic_stream_handle.write_some.overload1 write_some]``(
121058       const ConstBufferSequence & buffers);
121059   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.write_some.overload1 more...]]``
121060
121061   template<
121062       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
121063   std::size_t ``[link boost_asio.reference.windows__basic_stream_handle.write_some.overload2 write_some]``(
121064       const ConstBufferSequence & buffers,
121065       boost::system::error_code & ec);
121066   ``  [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.write_some.overload2 more...]]``
121067
121068
121069 [section:overload1 windows::basic_stream_handle::write_some (1 of 2 overloads)]
121070
121071
121072 Write some data to the handle. 
121073
121074
121075   template<
121076       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
121077   std::size_t write_some(
121078       const ConstBufferSequence & buffers);
121079
121080
121081 This function is used to write data to the stream handle. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
121082
121083
121084 [heading Parameters]
121085     
121086
121087 [variablelist
121088   
121089 [[buffers][One or more data buffers to be written to the handle.]]
121090
121091 ]
121092
121093
121094 [heading Return Value]
121095       
121096 The number of bytes written.
121097
121098
121099 [heading Exceptions]
121100     
121101
121102 [variablelist
121103   
121104 [[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
121105
121106 ]
121107
121108
121109 [heading Remarks]
121110       
121111 The write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`]  function if you need to ensure that all data is written before the blocking operation completes.
121112
121113
121114 [heading Example]
121115   
121116 To write a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
121117
121118    handle.write_some(boost::asio::buffer(data, size));
121119
121120
121121 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
121122
121123
121124
121125
121126 [endsect]
121127
121128
121129
121130 [section:overload2 windows::basic_stream_handle::write_some (2 of 2 overloads)]
121131
121132
121133 Write some data to the handle. 
121134
121135
121136   template<
121137       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
121138   std::size_t write_some(
121139       const ConstBufferSequence & buffers,
121140       boost::system::error_code & ec);
121141
121142
121143 This function is used to write data to the stream handle. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
121144
121145
121146 [heading Parameters]
121147     
121148
121149 [variablelist
121150   
121151 [[buffers][One or more data buffers to be written to the handle.]]
121152
121153 [[ec][Set to indicate what error occurred, if any.]]
121154
121155 ]
121156
121157
121158 [heading Return Value]
121159       
121160 The number of bytes written. Returns 0 if an error occurred.
121161
121162
121163 [heading Remarks]
121164       
121165 The write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`]  function if you need to ensure that all data is written before the blocking operation completes. 
121166
121167
121168
121169
121170 [endsect]
121171
121172
121173 [endsect]
121174
121175
121176 [endsect]
121177
121178 [section:windows__basic_stream_handle__rebind_executor windows::basic_stream_handle::rebind_executor]
121179
121180
121181 Rebinds the handle type to another executor. 
121182
121183
121184   template<
121185       typename ``[link boost_asio.reference.Executor1 Executor1]``>
121186   struct rebind_executor
121187
121188
121189 [heading Types]
121190 [table
121191   [[Name][Description]]
121192
121193   [
121194
121195     [[link boost_asio.reference.windows__basic_stream_handle__rebind_executor.other [*other]]]
121196     [The handle type when rebound to the specified executor. ]
121197   
121198   ]
121199
121200 ]
121201
121202 [heading Requirements]
121203
121204 ['Header: ][^boost/asio/windows/basic_stream_handle.hpp]
121205
121206 ['Convenience header: ][^boost/asio.hpp]
121207
121208
121209 [section:other windows::basic_stream_handle::rebind_executor::other]
121210
121211 [indexterm2 boost_asio.indexterm.windows__basic_stream_handle__rebind_executor.other..other..windows::basic_stream_handle::rebind_executor] 
121212 The handle type when rebound to the specified executor. 
121213
121214
121215   typedef basic_stream_handle< Executor1 > other;
121216
121217
121218 [heading Types]
121219 [table
121220   [[Name][Description]]
121221
121222   [
121223
121224     [[link boost_asio.reference.windows__basic_stream_handle__rebind_executor [*rebind_executor]]]
121225     [Rebinds the handle type to another executor. ]
121226   
121227   ]
121228
121229   [
121230
121231     [[link boost_asio.reference.windows__basic_stream_handle.executor_type [*executor_type]]]
121232     [The type of the executor associated with the object. ]
121233   
121234   ]
121235
121236   [
121237
121238     [[link boost_asio.reference.windows__basic_stream_handle.lowest_layer_type [*lowest_layer_type]]]
121239     [An overlapped_handle is always the lowest layer. ]
121240   
121241   ]
121242
121243   [
121244
121245     [[link boost_asio.reference.windows__basic_stream_handle.native_handle_type [*native_handle_type]]]
121246     [The native representation of a handle. ]
121247   
121248   ]
121249
121250 ]
121251
121252 [heading Member Functions]
121253 [table
121254   [[Name][Description]]
121255
121256   [
121257     [[link boost_asio.reference.windows__basic_stream_handle.assign [*assign]]]
121258     [Assign an existing native handle to the handle. ]
121259   ]
121260   
121261   [
121262     [[link boost_asio.reference.windows__basic_stream_handle.async_read_some [*async_read_some]]]
121263     [Start an asynchronous read. ]
121264   ]
121265   
121266   [
121267     [[link boost_asio.reference.windows__basic_stream_handle.async_write_some [*async_write_some]]]
121268     [Start an asynchronous write. ]
121269   ]
121270   
121271   [
121272     [[link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle [*basic_stream_handle]]]
121273     [Construct a stream handle without opening it. 
121274      [hr]
121275      Construct a stream handle on an existing native handle. 
121276      [hr]
121277      Move-construct a stream handle from another. ]
121278   ]
121279   
121280   [
121281     [[link boost_asio.reference.windows__basic_stream_handle.cancel [*cancel]]]
121282     [Cancel all asynchronous operations associated with the handle. ]
121283   ]
121284   
121285   [
121286     [[link boost_asio.reference.windows__basic_stream_handle.close [*close]]]
121287     [Close the handle. ]
121288   ]
121289   
121290   [
121291     [[link boost_asio.reference.windows__basic_stream_handle.get_executor [*get_executor]]]
121292     [Get the executor associated with the object. ]
121293   ]
121294   
121295   [
121296     [[link boost_asio.reference.windows__basic_stream_handle.is_open [*is_open]]]
121297     [Determine whether the handle is open. ]
121298   ]
121299   
121300   [
121301     [[link boost_asio.reference.windows__basic_stream_handle.lowest_layer [*lowest_layer]]]
121302     [Get a reference to the lowest layer. 
121303      [hr]
121304      Get a const reference to the lowest layer. ]
121305   ]
121306   
121307   [
121308     [[link boost_asio.reference.windows__basic_stream_handle.native_handle [*native_handle]]]
121309     [Get the native handle representation. ]
121310   ]
121311   
121312   [
121313     [[link boost_asio.reference.windows__basic_stream_handle.operator_eq_ [*operator=]]]
121314     [Move-assign a stream handle from another. ]
121315   ]
121316   
121317   [
121318     [[link boost_asio.reference.windows__basic_stream_handle.read_some [*read_some]]]
121319     [Read some data from the handle. ]
121320   ]
121321   
121322   [
121323     [[link boost_asio.reference.windows__basic_stream_handle.write_some [*write_some]]]
121324     [Write some data to the handle. ]
121325   ]
121326   
121327 ]
121328
121329 [heading Protected Data Members]
121330 [table
121331   [[Name][Description]]
121332
121333   [
121334     [[link boost_asio.reference.windows__basic_stream_handle.impl_ [*impl_]]]
121335     []
121336   ]
121337
121338 ]
121339
121340 The [link boost_asio.reference.windows__basic_stream_handle `windows::basic_stream_handle`] class provides asynchronous and blocking stream-oriented handle functionality.
121341
121342
121343 [heading Thread Safety]
121344   
121345 ['Distinct] ['objects:] Safe.
121346
121347 ['Shared] ['objects:] Unsafe.
121348
121349
121350
121351
121352
121353 [heading Requirements]
121354
121355 ['Header: ][^boost/asio/windows/basic_stream_handle.hpp]
121356
121357 ['Convenience header: ][^boost/asio.hpp]
121358
121359
121360 [endsect]
121361
121362
121363
121364 [endsect]
121365
121366
121367 [section:windows__object_handle windows::object_handle]
121368
121369 [indexterm1 boost_asio.indexterm.windows__object_handle..windows::object_handle] 
121370 Typedef for the typical usage of an object handle. 
121371
121372
121373   typedef basic_object_handle object_handle;
121374
121375
121376 [heading Types]
121377 [table
121378   [[Name][Description]]
121379
121380   [
121381
121382     [[link boost_asio.reference.windows__basic_object_handle__rebind_executor [*rebind_executor]]]
121383     [Rebinds the handle type to another executor. ]
121384   
121385   ]
121386
121387   [
121388
121389     [[link boost_asio.reference.windows__basic_object_handle.executor_type [*executor_type]]]
121390     [The type of the executor associated with the object. ]
121391   
121392   ]
121393
121394   [
121395
121396     [[link boost_asio.reference.windows__basic_object_handle.lowest_layer_type [*lowest_layer_type]]]
121397     [An object handle is always the lowest layer. ]
121398   
121399   ]
121400
121401   [
121402
121403     [[link boost_asio.reference.windows__basic_object_handle.native_handle_type [*native_handle_type]]]
121404     [The native representation of a handle. ]
121405   
121406   ]
121407
121408 ]
121409
121410 [heading Member Functions]
121411 [table
121412   [[Name][Description]]
121413
121414   [
121415     [[link boost_asio.reference.windows__basic_object_handle.assign [*assign]]]
121416     [Assign an existing native handle to the handle. ]
121417   ]
121418   
121419   [
121420     [[link boost_asio.reference.windows__basic_object_handle.async_wait [*async_wait]]]
121421     [Start an asynchronous wait on the object handle. ]
121422   ]
121423   
121424   [
121425     [[link boost_asio.reference.windows__basic_object_handle.basic_object_handle [*basic_object_handle]]]
121426     [Construct an object handle without opening it. 
121427      [hr]
121428      Construct an object handle on an existing native handle. 
121429      [hr]
121430      Move-construct an object handle from another. ]
121431   ]
121432   
121433   [
121434     [[link boost_asio.reference.windows__basic_object_handle.cancel [*cancel]]]
121435     [Cancel all asynchronous operations associated with the handle. ]
121436   ]
121437   
121438   [
121439     [[link boost_asio.reference.windows__basic_object_handle.close [*close]]]
121440     [Close the handle. ]
121441   ]
121442   
121443   [
121444     [[link boost_asio.reference.windows__basic_object_handle.get_executor [*get_executor]]]
121445     [Get the executor associated with the object. ]
121446   ]
121447   
121448   [
121449     [[link boost_asio.reference.windows__basic_object_handle.is_open [*is_open]]]
121450     [Determine whether the handle is open. ]
121451   ]
121452   
121453   [
121454     [[link boost_asio.reference.windows__basic_object_handle.lowest_layer [*lowest_layer]]]
121455     [Get a reference to the lowest layer. 
121456      [hr]
121457      Get a const reference to the lowest layer. ]
121458   ]
121459   
121460   [
121461     [[link boost_asio.reference.windows__basic_object_handle.native_handle [*native_handle]]]
121462     [Get the native handle representation. ]
121463   ]
121464   
121465   [
121466     [[link boost_asio.reference.windows__basic_object_handle.operator_eq_ [*operator=]]]
121467     [Move-assign an object handle from another. ]
121468   ]
121469   
121470   [
121471     [[link boost_asio.reference.windows__basic_object_handle.wait [*wait]]]
121472     [Perform a blocking wait on the object handle. ]
121473   ]
121474   
121475 ]
121476
121477 The [link boost_asio.reference.windows__basic_object_handle `windows::basic_object_handle`] class provides asynchronous and blocking object-oriented handle functionality.
121478
121479
121480 [heading Thread Safety]
121481   
121482 ['Distinct] ['objects:] Safe.
121483
121484 ['Shared] ['objects:] Unsafe. 
121485
121486
121487
121488
121489 [heading Requirements]
121490
121491 ['Header: ][^boost/asio/windows/object_handle.hpp]
121492
121493 ['Convenience header: ][^boost/asio.hpp]
121494
121495
121496 [endsect]
121497
121498
121499
121500 [section:windows__overlapped_handle windows::overlapped_handle]
121501
121502 [indexterm1 boost_asio.indexterm.windows__overlapped_handle..windows::overlapped_handle] 
121503 Typedef for the typical usage of an overlapped handle. 
121504
121505
121506   typedef basic_overlapped_handle overlapped_handle;
121507
121508
121509 [heading Types]
121510 [table
121511   [[Name][Description]]
121512
121513   [
121514
121515     [[link boost_asio.reference.windows__basic_overlapped_handle__rebind_executor [*rebind_executor]]]
121516     [Rebinds the handle type to another executor. ]
121517   
121518   ]
121519
121520   [
121521
121522     [[link boost_asio.reference.windows__basic_overlapped_handle.executor_type [*executor_type]]]
121523     [The type of the executor associated with the object. ]
121524   
121525   ]
121526
121527   [
121528
121529     [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer_type [*lowest_layer_type]]]
121530     [An overlapped_handle is always the lowest layer. ]
121531   
121532   ]
121533
121534   [
121535
121536     [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle_type [*native_handle_type]]]
121537     [The native representation of a handle. ]
121538   
121539   ]
121540
121541 ]
121542
121543 [heading Member Functions]
121544 [table
121545   [[Name][Description]]
121546
121547   [
121548     [[link boost_asio.reference.windows__basic_overlapped_handle.assign [*assign]]]
121549     [Assign an existing native handle to the handle. ]
121550   ]
121551   
121552   [
121553     [[link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle [*basic_overlapped_handle]]]
121554     [Construct an overlapped handle without opening it. 
121555      [hr]
121556      Construct an overlapped handle on an existing native handle. 
121557      [hr]
121558      Move-construct an overlapped handle from another. ]
121559   ]
121560   
121561   [
121562     [[link boost_asio.reference.windows__basic_overlapped_handle.cancel [*cancel]]]
121563     [Cancel all asynchronous operations associated with the handle. ]
121564   ]
121565   
121566   [
121567     [[link boost_asio.reference.windows__basic_overlapped_handle.close [*close]]]
121568     [Close the handle. ]
121569   ]
121570   
121571   [
121572     [[link boost_asio.reference.windows__basic_overlapped_handle.get_executor [*get_executor]]]
121573     [Get the executor associated with the object. ]
121574   ]
121575   
121576   [
121577     [[link boost_asio.reference.windows__basic_overlapped_handle.is_open [*is_open]]]
121578     [Determine whether the handle is open. ]
121579   ]
121580   
121581   [
121582     [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer [*lowest_layer]]]
121583     [Get a reference to the lowest layer. 
121584      [hr]
121585      Get a const reference to the lowest layer. ]
121586   ]
121587   
121588   [
121589     [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle [*native_handle]]]
121590     [Get the native handle representation. ]
121591   ]
121592   
121593   [
121594     [[link boost_asio.reference.windows__basic_overlapped_handle.operator_eq_ [*operator=]]]
121595     [Move-assign an overlapped handle from another. ]
121596   ]
121597   
121598 ]
121599
121600 [heading Protected Member Functions]
121601 [table
121602   [[Name][Description]]
121603
121604   [
121605     [[link boost_asio.reference.windows__basic_overlapped_handle._basic_overlapped_handle [*~basic_overlapped_handle]]]
121606     [Protected destructor to prevent deletion through this type. ]
121607   ]
121608   
121609 ]
121610
121611 [heading Protected Data Members]
121612 [table
121613   [[Name][Description]]
121614
121615   [
121616     [[link boost_asio.reference.windows__basic_overlapped_handle.impl_ [*impl_]]]
121617     []
121618   ]
121619
121620 ]
121621
121622 The [link boost_asio.reference.windows__overlapped_handle `windows::overlapped_handle`] class provides the ability to wrap a Windows handle. The underlying object referred to by the handle must support overlapped I/O.
121623
121624
121625 [heading Thread Safety]
121626   
121627 ['Distinct] ['objects:] Safe.
121628
121629 ['Shared] ['objects:] Unsafe. 
121630
121631
121632
121633
121634 [heading Requirements]
121635
121636 ['Header: ][^boost/asio/windows/overlapped_handle.hpp]
121637
121638 ['Convenience header: ][^boost/asio.hpp]
121639
121640
121641 [endsect]
121642
121643
121644 [section:windows__overlapped_ptr windows::overlapped_ptr]
121645
121646
121647 Wraps a handler to create an OVERLAPPED object for use with overlapped I/O. 
121648
121649
121650   class overlapped_ptr :
121651     noncopyable
121652
121653
121654 [heading Member Functions]
121655 [table
121656   [[Name][Description]]
121657
121658   [
121659     [[link boost_asio.reference.windows__overlapped_ptr.complete [*complete]]]
121660     [Post completion notification for overlapped operation. Releases ownership. ]
121661   ]
121662   
121663   [
121664     [[link boost_asio.reference.windows__overlapped_ptr.get [*get]]]
121665     [Get the contained OVERLAPPED object. ]
121666   ]
121667   
121668   [
121669     [[link boost_asio.reference.windows__overlapped_ptr.overlapped_ptr [*overlapped_ptr]]]
121670     [Construct an empty overlapped_ptr. 
121671      [hr]
121672      Construct an overlapped_ptr to contain the specified handler. ]
121673   ]
121674   
121675   [
121676     [[link boost_asio.reference.windows__overlapped_ptr.release [*release]]]
121677     [Release ownership of the OVERLAPPED object. ]
121678   ]
121679   
121680   [
121681     [[link boost_asio.reference.windows__overlapped_ptr.reset [*reset]]]
121682     [Reset to empty. 
121683      [hr]
121684      Reset to contain the specified handler, freeing any current OVERLAPPED object. ]
121685   ]
121686   
121687   [
121688     [[link boost_asio.reference.windows__overlapped_ptr._overlapped_ptr [*~overlapped_ptr]]]
121689     [Destructor automatically frees the OVERLAPPED object unless released. ]
121690   ]
121691   
121692 ]
121693
121694 A special-purpose smart pointer used to wrap an application handler so that it can be passed as the LPOVERLAPPED argument to overlapped I/O functions.
121695
121696
121697 [heading Thread Safety]
121698   
121699 ['Distinct] ['objects:] Safe.
121700
121701 ['Shared] ['objects:] Unsafe. 
121702
121703
121704
121705 [heading Requirements]
121706
121707 ['Header: ][^boost/asio/windows/overlapped_ptr.hpp]
121708
121709 ['Convenience header: ][^boost/asio.hpp]
121710
121711
121712 [section:complete windows::overlapped_ptr::complete]
121713
121714 [indexterm2 boost_asio.indexterm.windows__overlapped_ptr.complete..complete..windows::overlapped_ptr] 
121715 Post completion notification for overlapped operation. Releases ownership. 
121716
121717
121718   void complete(
121719       const boost::system::error_code & ec,
121720       std::size_t bytes_transferred);
121721
121722
121723
121724 [endsect]
121725
121726
121727 [section:get windows::overlapped_ptr::get]
121728
121729 [indexterm2 boost_asio.indexterm.windows__overlapped_ptr.get..get..windows::overlapped_ptr] 
121730 Get the contained OVERLAPPED object. 
121731
121732
121733   OVERLAPPED * ``[link boost_asio.reference.windows__overlapped_ptr.get.overload1 get]``();
121734   ``  [''''&raquo;''' [link boost_asio.reference.windows__overlapped_ptr.get.overload1 more...]]``
121735
121736   const OVERLAPPED * ``[link boost_asio.reference.windows__overlapped_ptr.get.overload2 get]``() const;
121737   ``  [''''&raquo;''' [link boost_asio.reference.windows__overlapped_ptr.get.overload2 more...]]``
121738
121739
121740 [section:overload1 windows::overlapped_ptr::get (1 of 2 overloads)]
121741
121742
121743 Get the contained OVERLAPPED object. 
121744
121745
121746   OVERLAPPED * get();
121747
121748
121749
121750 [endsect]
121751
121752
121753
121754 [section:overload2 windows::overlapped_ptr::get (2 of 2 overloads)]
121755
121756
121757 Get the contained OVERLAPPED object. 
121758
121759
121760   const OVERLAPPED * get() const;
121761
121762
121763
121764 [endsect]
121765
121766
121767 [endsect]
121768
121769 [section:overlapped_ptr windows::overlapped_ptr::overlapped_ptr]
121770
121771 [indexterm2 boost_asio.indexterm.windows__overlapped_ptr.overlapped_ptr..overlapped_ptr..windows::overlapped_ptr] 
121772 Construct an empty [link boost_asio.reference.windows__overlapped_ptr `windows::overlapped_ptr`]. 
121773
121774
121775   ``[link boost_asio.reference.windows__overlapped_ptr.overlapped_ptr.overload1 overlapped_ptr]``();
121776   ``  [''''&raquo;''' [link boost_asio.reference.windows__overlapped_ptr.overlapped_ptr.overload1 more...]]``
121777
121778
121779 Construct an [link boost_asio.reference.windows__overlapped_ptr `windows::overlapped_ptr`] to contain the specified handler. 
121780
121781
121782   template<
121783       typename ExecutionContext,
121784       typename ``[link boost_asio.reference.Handler Handler]``>
121785   explicit ``[link boost_asio.reference.windows__overlapped_ptr.overlapped_ptr.overload2 overlapped_ptr]``(
121786       ExecutionContext & context,
121787       Handler && handler,
121788       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
121789   ``  [''''&raquo;''' [link boost_asio.reference.windows__overlapped_ptr.overlapped_ptr.overload2 more...]]``
121790
121791   template<
121792       typename ``[link boost_asio.reference.Executor1 Executor]``,
121793       typename ``[link boost_asio.reference.Handler Handler]``>
121794   explicit ``[link boost_asio.reference.windows__overlapped_ptr.overlapped_ptr.overload3 overlapped_ptr]``(
121795       const Executor & ex,
121796       Handler && handler,
121797       typename enable_if< is_executor< Executor >::value >::type *  = 0);
121798   ``  [''''&raquo;''' [link boost_asio.reference.windows__overlapped_ptr.overlapped_ptr.overload3 more...]]``
121799
121800
121801 [section:overload1 windows::overlapped_ptr::overlapped_ptr (1 of 3 overloads)]
121802
121803
121804 Construct an empty [link boost_asio.reference.windows__overlapped_ptr `windows::overlapped_ptr`]. 
121805
121806
121807   overlapped_ptr();
121808
121809
121810
121811 [endsect]
121812
121813
121814
121815 [section:overload2 windows::overlapped_ptr::overlapped_ptr (2 of 3 overloads)]
121816
121817
121818 Construct an [link boost_asio.reference.windows__overlapped_ptr `windows::overlapped_ptr`] to contain the specified handler. 
121819
121820
121821   template<
121822       typename ExecutionContext,
121823       typename ``[link boost_asio.reference.Handler Handler]``>
121824   overlapped_ptr(
121825       ExecutionContext & context,
121826       Handler && handler,
121827       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
121828
121829
121830
121831 [endsect]
121832
121833
121834
121835 [section:overload3 windows::overlapped_ptr::overlapped_ptr (3 of 3 overloads)]
121836
121837
121838 Construct an [link boost_asio.reference.windows__overlapped_ptr `windows::overlapped_ptr`] to contain the specified handler. 
121839
121840
121841   template<
121842       typename ``[link boost_asio.reference.Executor1 Executor]``,
121843       typename ``[link boost_asio.reference.Handler Handler]``>
121844   overlapped_ptr(
121845       const Executor & ex,
121846       Handler && handler,
121847       typename enable_if< is_executor< Executor >::value >::type *  = 0);
121848
121849
121850
121851 [endsect]
121852
121853
121854 [endsect]
121855
121856
121857 [section:release windows::overlapped_ptr::release]
121858
121859 [indexterm2 boost_asio.indexterm.windows__overlapped_ptr.release..release..windows::overlapped_ptr] 
121860 Release ownership of the OVERLAPPED object. 
121861
121862
121863   OVERLAPPED * release();
121864
121865
121866
121867 [endsect]
121868
121869
121870 [section:reset windows::overlapped_ptr::reset]
121871
121872 [indexterm2 boost_asio.indexterm.windows__overlapped_ptr.reset..reset..windows::overlapped_ptr] 
121873 Reset to empty. 
121874
121875
121876   void ``[link boost_asio.reference.windows__overlapped_ptr.reset.overload1 reset]``();
121877   ``  [''''&raquo;''' [link boost_asio.reference.windows__overlapped_ptr.reset.overload1 more...]]``
121878
121879
121880 Reset to contain the specified handler, freeing any current OVERLAPPED object. 
121881
121882
121883   template<
121884       typename ExecutionContext,
121885       typename ``[link boost_asio.reference.Handler Handler]``>
121886   void ``[link boost_asio.reference.windows__overlapped_ptr.reset.overload2 reset]``(
121887       ExecutionContext & context,
121888       Handler && handler,
121889       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
121890   ``  [''''&raquo;''' [link boost_asio.reference.windows__overlapped_ptr.reset.overload2 more...]]``
121891
121892   template<
121893       typename ``[link boost_asio.reference.Executor1 Executor]``,
121894       typename ``[link boost_asio.reference.Handler Handler]``>
121895   void ``[link boost_asio.reference.windows__overlapped_ptr.reset.overload3 reset]``(
121896       const Executor & ex,
121897       Handler && handler,
121898       typename enable_if< is_executor< Executor >::value >::type *  = 0);
121899   ``  [''''&raquo;''' [link boost_asio.reference.windows__overlapped_ptr.reset.overload3 more...]]``
121900
121901
121902 [section:overload1 windows::overlapped_ptr::reset (1 of 3 overloads)]
121903
121904
121905 Reset to empty. 
121906
121907
121908   void reset();
121909
121910
121911
121912 [endsect]
121913
121914
121915
121916 [section:overload2 windows::overlapped_ptr::reset (2 of 3 overloads)]
121917
121918
121919 Reset to contain the specified handler, freeing any current OVERLAPPED object. 
121920
121921
121922   template<
121923       typename ExecutionContext,
121924       typename ``[link boost_asio.reference.Handler Handler]``>
121925   void reset(
121926       ExecutionContext & context,
121927       Handler && handler,
121928       typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *  = 0);
121929
121930
121931
121932 [endsect]
121933
121934
121935
121936 [section:overload3 windows::overlapped_ptr::reset (3 of 3 overloads)]
121937
121938
121939 Reset to contain the specified handler, freeing any current OVERLAPPED object. 
121940
121941
121942   template<
121943       typename ``[link boost_asio.reference.Executor1 Executor]``,
121944       typename ``[link boost_asio.reference.Handler Handler]``>
121945   void reset(
121946       const Executor & ex,
121947       Handler && handler,
121948       typename enable_if< is_executor< Executor >::value >::type *  = 0);
121949
121950
121951
121952 [endsect]
121953
121954
121955 [endsect]
121956
121957
121958 [section:_overlapped_ptr windows::overlapped_ptr::~overlapped_ptr]
121959
121960 [indexterm2 boost_asio.indexterm.windows__overlapped_ptr._overlapped_ptr..~overlapped_ptr..windows::overlapped_ptr] 
121961 Destructor automatically frees the OVERLAPPED object unless released. 
121962
121963
121964   ~overlapped_ptr();
121965
121966
121967
121968 [endsect]
121969
121970
121971
121972 [endsect]
121973
121974
121975 [section:windows__random_access_handle windows::random_access_handle]
121976
121977 [indexterm1 boost_asio.indexterm.windows__random_access_handle..windows::random_access_handle] 
121978 Typedef for the typical usage of a random-access handle. 
121979
121980
121981   typedef basic_random_access_handle random_access_handle;
121982
121983
121984 [heading Types]
121985 [table
121986   [[Name][Description]]
121987
121988   [
121989
121990     [[link boost_asio.reference.windows__basic_random_access_handle__rebind_executor [*rebind_executor]]]
121991     [Rebinds the handle type to another executor. ]
121992   
121993   ]
121994
121995   [
121996
121997     [[link boost_asio.reference.windows__basic_random_access_handle.executor_type [*executor_type]]]
121998     [The type of the executor associated with the object. ]
121999   
122000   ]
122001
122002   [
122003
122004     [[link boost_asio.reference.windows__basic_random_access_handle.lowest_layer_type [*lowest_layer_type]]]
122005     [An overlapped_handle is always the lowest layer. ]
122006   
122007   ]
122008
122009   [
122010
122011     [[link boost_asio.reference.windows__basic_random_access_handle.native_handle_type [*native_handle_type]]]
122012     [The native representation of a handle. ]
122013   
122014   ]
122015
122016 ]
122017
122018 [heading Member Functions]
122019 [table
122020   [[Name][Description]]
122021
122022   [
122023     [[link boost_asio.reference.windows__basic_random_access_handle.assign [*assign]]]
122024     [Assign an existing native handle to the handle. ]
122025   ]
122026   
122027   [
122028     [[link boost_asio.reference.windows__basic_random_access_handle.async_read_some_at [*async_read_some_at]]]
122029     [Start an asynchronous read at the specified offset. ]
122030   ]
122031   
122032   [
122033     [[link boost_asio.reference.windows__basic_random_access_handle.async_write_some_at [*async_write_some_at]]]
122034     [Start an asynchronous write at the specified offset. ]
122035   ]
122036   
122037   [
122038     [[link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle [*basic_random_access_handle]]]
122039     [Construct a random-access handle without opening it. 
122040      [hr]
122041      Construct a random-access handle on an existing native handle. 
122042      [hr]
122043      Move-construct a random-access handle from another. ]
122044   ]
122045   
122046   [
122047     [[link boost_asio.reference.windows__basic_random_access_handle.cancel [*cancel]]]
122048     [Cancel all asynchronous operations associated with the handle. ]
122049   ]
122050   
122051   [
122052     [[link boost_asio.reference.windows__basic_random_access_handle.close [*close]]]
122053     [Close the handle. ]
122054   ]
122055   
122056   [
122057     [[link boost_asio.reference.windows__basic_random_access_handle.get_executor [*get_executor]]]
122058     [Get the executor associated with the object. ]
122059   ]
122060   
122061   [
122062     [[link boost_asio.reference.windows__basic_random_access_handle.is_open [*is_open]]]
122063     [Determine whether the handle is open. ]
122064   ]
122065   
122066   [
122067     [[link boost_asio.reference.windows__basic_random_access_handle.lowest_layer [*lowest_layer]]]
122068     [Get a reference to the lowest layer. 
122069      [hr]
122070      Get a const reference to the lowest layer. ]
122071   ]
122072   
122073   [
122074     [[link boost_asio.reference.windows__basic_random_access_handle.native_handle [*native_handle]]]
122075     [Get the native handle representation. ]
122076   ]
122077   
122078   [
122079     [[link boost_asio.reference.windows__basic_random_access_handle.operator_eq_ [*operator=]]]
122080     [Move-assign a random-access handle from another. ]
122081   ]
122082   
122083   [
122084     [[link boost_asio.reference.windows__basic_random_access_handle.read_some_at [*read_some_at]]]
122085     [Read some data from the handle at the specified offset. ]
122086   ]
122087   
122088   [
122089     [[link boost_asio.reference.windows__basic_random_access_handle.write_some_at [*write_some_at]]]
122090     [Write some data to the handle at the specified offset. ]
122091   ]
122092   
122093 ]
122094
122095 [heading Protected Data Members]
122096 [table
122097   [[Name][Description]]
122098
122099   [
122100     [[link boost_asio.reference.windows__basic_random_access_handle.impl_ [*impl_]]]
122101     []
122102   ]
122103
122104 ]
122105
122106 The [link boost_asio.reference.windows__basic_random_access_handle `windows::basic_random_access_handle`] class provides asynchronous and blocking random-access handle functionality.
122107
122108
122109 [heading Thread Safety]
122110   
122111 ['Distinct] ['objects:] Safe.
122112
122113 ['Shared] ['objects:] Unsafe. 
122114
122115
122116
122117
122118 [heading Requirements]
122119
122120 ['Header: ][^boost/asio/windows/random_access_handle.hpp]
122121
122122 ['Convenience header: ][^boost/asio.hpp]
122123
122124
122125 [endsect]
122126
122127
122128
122129 [section:windows__stream_handle windows::stream_handle]
122130
122131 [indexterm1 boost_asio.indexterm.windows__stream_handle..windows::stream_handle] 
122132 Typedef for the typical usage of a stream-oriented handle. 
122133
122134
122135   typedef basic_stream_handle stream_handle;
122136
122137
122138 [heading Types]
122139 [table
122140   [[Name][Description]]
122141
122142   [
122143
122144     [[link boost_asio.reference.windows__basic_stream_handle__rebind_executor [*rebind_executor]]]
122145     [Rebinds the handle type to another executor. ]
122146   
122147   ]
122148
122149   [
122150
122151     [[link boost_asio.reference.windows__basic_stream_handle.executor_type [*executor_type]]]
122152     [The type of the executor associated with the object. ]
122153   
122154   ]
122155
122156   [
122157
122158     [[link boost_asio.reference.windows__basic_stream_handle.lowest_layer_type [*lowest_layer_type]]]
122159     [An overlapped_handle is always the lowest layer. ]
122160   
122161   ]
122162
122163   [
122164
122165     [[link boost_asio.reference.windows__basic_stream_handle.native_handle_type [*native_handle_type]]]
122166     [The native representation of a handle. ]
122167   
122168   ]
122169
122170 ]
122171
122172 [heading Member Functions]
122173 [table
122174   [[Name][Description]]
122175
122176   [
122177     [[link boost_asio.reference.windows__basic_stream_handle.assign [*assign]]]
122178     [Assign an existing native handle to the handle. ]
122179   ]
122180   
122181   [
122182     [[link boost_asio.reference.windows__basic_stream_handle.async_read_some [*async_read_some]]]
122183     [Start an asynchronous read. ]
122184   ]
122185   
122186   [
122187     [[link boost_asio.reference.windows__basic_stream_handle.async_write_some [*async_write_some]]]
122188     [Start an asynchronous write. ]
122189   ]
122190   
122191   [
122192     [[link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle [*basic_stream_handle]]]
122193     [Construct a stream handle without opening it. 
122194      [hr]
122195      Construct a stream handle on an existing native handle. 
122196      [hr]
122197      Move-construct a stream handle from another. ]
122198   ]
122199   
122200   [
122201     [[link boost_asio.reference.windows__basic_stream_handle.cancel [*cancel]]]
122202     [Cancel all asynchronous operations associated with the handle. ]
122203   ]
122204   
122205   [
122206     [[link boost_asio.reference.windows__basic_stream_handle.close [*close]]]
122207     [Close the handle. ]
122208   ]
122209   
122210   [
122211     [[link boost_asio.reference.windows__basic_stream_handle.get_executor [*get_executor]]]
122212     [Get the executor associated with the object. ]
122213   ]
122214   
122215   [
122216     [[link boost_asio.reference.windows__basic_stream_handle.is_open [*is_open]]]
122217     [Determine whether the handle is open. ]
122218   ]
122219   
122220   [
122221     [[link boost_asio.reference.windows__basic_stream_handle.lowest_layer [*lowest_layer]]]
122222     [Get a reference to the lowest layer. 
122223      [hr]
122224      Get a const reference to the lowest layer. ]
122225   ]
122226   
122227   [
122228     [[link boost_asio.reference.windows__basic_stream_handle.native_handle [*native_handle]]]
122229     [Get the native handle representation. ]
122230   ]
122231   
122232   [
122233     [[link boost_asio.reference.windows__basic_stream_handle.operator_eq_ [*operator=]]]
122234     [Move-assign a stream handle from another. ]
122235   ]
122236   
122237   [
122238     [[link boost_asio.reference.windows__basic_stream_handle.read_some [*read_some]]]
122239     [Read some data from the handle. ]
122240   ]
122241   
122242   [
122243     [[link boost_asio.reference.windows__basic_stream_handle.write_some [*write_some]]]
122244     [Write some data to the handle. ]
122245   ]
122246   
122247 ]
122248
122249 [heading Protected Data Members]
122250 [table
122251   [[Name][Description]]
122252
122253   [
122254     [[link boost_asio.reference.windows__basic_stream_handle.impl_ [*impl_]]]
122255     []
122256   ]
122257
122258 ]
122259
122260 The [link boost_asio.reference.windows__basic_stream_handle `windows::basic_stream_handle`] class provides asynchronous and blocking stream-oriented handle functionality.
122261
122262
122263 [heading Thread Safety]
122264   
122265 ['Distinct] ['objects:] Safe.
122266
122267 ['Shared] ['objects:] Unsafe.
122268
122269
122270
122271
122272
122273 [heading Requirements]
122274
122275 ['Header: ][^boost/asio/windows/stream_handle.hpp]
122276
122277 ['Convenience header: ][^boost/asio.hpp]
122278
122279
122280 [endsect]
122281
122282
122283 [section:write write]
122284
122285 [indexterm1 boost_asio.indexterm.write..write] 
122286 The `write` function is a composed operation that writes a certain amount of data to a stream before returning. 
122287
122288
122289 Write all of the supplied data to a stream before returning. 
122290
122291   template<
122292       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
122293       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
122294   std::size_t ``[link boost_asio.reference.write.overload1 write]``(
122295       SyncWriteStream & s,
122296       const ConstBufferSequence & buffers,
122297       typename enable_if< is_const_buffer_sequence< ConstBufferSequence >::value >::type *  = 0);
122298   ``  [''''&raquo;''' [link boost_asio.reference.write.overload1 more...]]``
122299
122300   template<
122301       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
122302       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
122303   std::size_t ``[link boost_asio.reference.write.overload2 write]``(
122304       SyncWriteStream & s,
122305       const ConstBufferSequence & buffers,
122306       boost::system::error_code & ec,
122307       typename enable_if< is_const_buffer_sequence< ConstBufferSequence >::value >::type *  = 0);
122308   ``  [''''&raquo;''' [link boost_asio.reference.write.overload2 more...]]``
122309
122310 Write a certain amount of data to a stream before returning. 
122311
122312   template<
122313       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
122314       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
122315       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
122316   std::size_t ``[link boost_asio.reference.write.overload3 write]``(
122317       SyncWriteStream & s,
122318       const ConstBufferSequence & buffers,
122319       CompletionCondition completion_condition,
122320       typename enable_if< is_const_buffer_sequence< ConstBufferSequence >::value >::type *  = 0);
122321   ``  [''''&raquo;''' [link boost_asio.reference.write.overload3 more...]]``
122322
122323   template<
122324       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
122325       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
122326       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
122327   std::size_t ``[link boost_asio.reference.write.overload4 write]``(
122328       SyncWriteStream & s,
122329       const ConstBufferSequence & buffers,
122330       CompletionCondition completion_condition,
122331       boost::system::error_code & ec,
122332       typename enable_if< is_const_buffer_sequence< ConstBufferSequence >::value >::type *  = 0);
122333   ``  [''''&raquo;''' [link boost_asio.reference.write.overload4 more...]]``
122334
122335 Write all of the supplied data to a stream before returning. 
122336
122337   template<
122338       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
122339       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
122340   std::size_t ``[link boost_asio.reference.write.overload5 write]``(
122341       SyncWriteStream & s,
122342       DynamicBuffer_v1 && buffers,
122343       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
122344   ``  [''''&raquo;''' [link boost_asio.reference.write.overload5 more...]]``
122345
122346   template<
122347       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
122348       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
122349   std::size_t ``[link boost_asio.reference.write.overload6 write]``(
122350       SyncWriteStream & s,
122351       DynamicBuffer_v1 && buffers,
122352       boost::system::error_code & ec,
122353       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
122354   ``  [''''&raquo;''' [link boost_asio.reference.write.overload6 more...]]``
122355
122356 Write a certain amount of data to a stream before returning. 
122357
122358   template<
122359       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
122360       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
122361       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
122362   std::size_t ``[link boost_asio.reference.write.overload7 write]``(
122363       SyncWriteStream & s,
122364       DynamicBuffer_v1 && buffers,
122365       CompletionCondition completion_condition,
122366       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
122367   ``  [''''&raquo;''' [link boost_asio.reference.write.overload7 more...]]``
122368
122369   template<
122370       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
122371       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
122372       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
122373   std::size_t ``[link boost_asio.reference.write.overload8 write]``(
122374       SyncWriteStream & s,
122375       DynamicBuffer_v1 && buffers,
122376       CompletionCondition completion_condition,
122377       boost::system::error_code & ec,
122378       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
122379   ``  [''''&raquo;''' [link boost_asio.reference.write.overload8 more...]]``
122380
122381 Write all of the supplied data to a stream before returning. 
122382
122383   template<
122384       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
122385       typename Allocator>
122386   std::size_t ``[link boost_asio.reference.write.overload9 write]``(
122387       SyncWriteStream & s,
122388       basic_streambuf< Allocator > & b);
122389   ``  [''''&raquo;''' [link boost_asio.reference.write.overload9 more...]]``
122390
122391   template<
122392       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
122393       typename Allocator>
122394   std::size_t ``[link boost_asio.reference.write.overload10 write]``(
122395       SyncWriteStream & s,
122396       basic_streambuf< Allocator > & b,
122397       boost::system::error_code & ec);
122398   ``  [''''&raquo;''' [link boost_asio.reference.write.overload10 more...]]``
122399
122400 Write a certain amount of data to a stream before returning. 
122401
122402   template<
122403       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
122404       typename Allocator,
122405       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
122406   std::size_t ``[link boost_asio.reference.write.overload11 write]``(
122407       SyncWriteStream & s,
122408       basic_streambuf< Allocator > & b,
122409       CompletionCondition completion_condition);
122410   ``  [''''&raquo;''' [link boost_asio.reference.write.overload11 more...]]``
122411
122412   template<
122413       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
122414       typename Allocator,
122415       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
122416   std::size_t ``[link boost_asio.reference.write.overload12 write]``(
122417       SyncWriteStream & s,
122418       basic_streambuf< Allocator > & b,
122419       CompletionCondition completion_condition,
122420       boost::system::error_code & ec);
122421   ``  [''''&raquo;''' [link boost_asio.reference.write.overload12 more...]]``
122422
122423 Write all of the supplied data to a stream before returning. 
122424
122425   template<
122426       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
122427       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
122428   std::size_t ``[link boost_asio.reference.write.overload13 write]``(
122429       SyncWriteStream & s,
122430       DynamicBuffer_v2 buffers,
122431       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
122432   ``  [''''&raquo;''' [link boost_asio.reference.write.overload13 more...]]``
122433
122434   template<
122435       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
122436       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
122437   std::size_t ``[link boost_asio.reference.write.overload14 write]``(
122438       SyncWriteStream & s,
122439       DynamicBuffer_v2 buffers,
122440       boost::system::error_code & ec,
122441       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
122442   ``  [''''&raquo;''' [link boost_asio.reference.write.overload14 more...]]``
122443
122444 Write a certain amount of data to a stream before returning. 
122445
122446   template<
122447       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
122448       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
122449       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
122450   std::size_t ``[link boost_asio.reference.write.overload15 write]``(
122451       SyncWriteStream & s,
122452       DynamicBuffer_v2 buffers,
122453       CompletionCondition completion_condition,
122454       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
122455   ``  [''''&raquo;''' [link boost_asio.reference.write.overload15 more...]]``
122456
122457   template<
122458       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
122459       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
122460       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
122461   std::size_t ``[link boost_asio.reference.write.overload16 write]``(
122462       SyncWriteStream & s,
122463       DynamicBuffer_v2 buffers,
122464       CompletionCondition completion_condition,
122465       boost::system::error_code & ec,
122466       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
122467   ``  [''''&raquo;''' [link boost_asio.reference.write.overload16 more...]]``
122468
122469 [heading Requirements]
122470
122471 ['Header: ][^boost/asio/write.hpp]
122472
122473 ['Convenience header: ][^boost/asio.hpp]
122474
122475
122476 [section:overload1 write (1 of 16 overloads)]
122477
122478
122479 Write all of the supplied data to a stream before returning. 
122480
122481
122482   template<
122483       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
122484       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
122485   std::size_t write(
122486       SyncWriteStream & s,
122487       const ConstBufferSequence & buffers,
122488       typename enable_if< is_const_buffer_sequence< ConstBufferSequence >::value >::type *  = 0);
122489
122490
122491 This function is used to write a certain number of bytes of data to a stream. The call will block until one of the following conditions is true:
122492
122493
122494 * All of the data in the supplied buffers has been written. That is, the bytes transferred is equal to the sum of the buffer sizes.
122495
122496
122497 * An error occurred.
122498
122499 This operation is implemented in terms of zero or more calls to the stream's write\_some function.
122500
122501
122502 [heading Parameters]
122503     
122504
122505 [variablelist
122506   
122507 [[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]]
122508
122509 [[buffers][One or more buffers containing the data to be written. The sum of the buffer sizes indicates the maximum number of bytes to write to the stream.]]
122510
122511 ]
122512
122513
122514 [heading Return Value]
122515       
122516 The number of bytes transferred.
122517
122518
122519 [heading Exceptions]
122520     
122521
122522 [variablelist
122523   
122524 [[boost::system::system_error][Thrown on failure.]]
122525
122526 ]
122527
122528
122529 [heading Example]
122530   
122531 To write a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
122532
122533    boost::asio::write(s, boost::asio::buffer(data, size)); 
122534
122535
122536 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
122537
122538
122539 [heading Remarks]
122540       
122541 This overload is equivalent to calling: 
122542
122543    boost::asio::write(
122544        s, buffers,
122545        boost::asio::transfer_all()); 
122546
122547
122548
122549
122550
122551
122552
122553 [endsect]
122554
122555
122556
122557 [section:overload2 write (2 of 16 overloads)]
122558
122559
122560 Write all of the supplied data to a stream before returning. 
122561
122562
122563   template<
122564       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
122565       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
122566   std::size_t write(
122567       SyncWriteStream & s,
122568       const ConstBufferSequence & buffers,
122569       boost::system::error_code & ec,
122570       typename enable_if< is_const_buffer_sequence< ConstBufferSequence >::value >::type *  = 0);
122571
122572
122573 This function is used to write a certain number of bytes of data to a stream. The call will block until one of the following conditions is true:
122574
122575
122576 * All of the data in the supplied buffers has been written. That is, the bytes transferred is equal to the sum of the buffer sizes.
122577
122578
122579 * An error occurred.
122580
122581 This operation is implemented in terms of zero or more calls to the stream's write\_some function.
122582
122583
122584 [heading Parameters]
122585     
122586
122587 [variablelist
122588   
122589 [[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]]
122590
122591 [[buffers][One or more buffers containing the data to be written. The sum of the buffer sizes indicates the maximum number of bytes to write to the stream.]]
122592
122593 [[ec][Set to indicate what error occurred, if any.]]
122594
122595 ]
122596
122597
122598 [heading Return Value]
122599       
122600 The number of bytes transferred.
122601
122602
122603 [heading Example]
122604   
122605 To write a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
122606
122607    boost::asio::write(s, boost::asio::buffer(data, size), ec); 
122608
122609
122610 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
122611
122612
122613 [heading Remarks]
122614       
122615 This overload is equivalent to calling: 
122616
122617    boost::asio::write(
122618        s, buffers,
122619        boost::asio::transfer_all(), ec); 
122620
122621
122622
122623
122624
122625
122626
122627 [endsect]
122628
122629
122630
122631 [section:overload3 write (3 of 16 overloads)]
122632
122633
122634 Write a certain amount of data to a stream before returning. 
122635
122636
122637   template<
122638       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
122639       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
122640       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
122641   std::size_t write(
122642       SyncWriteStream & s,
122643       const ConstBufferSequence & buffers,
122644       CompletionCondition completion_condition,
122645       typename enable_if< is_const_buffer_sequence< ConstBufferSequence >::value >::type *  = 0);
122646
122647
122648 This function is used to write a certain number of bytes of data to a stream. The call will block until one of the following conditions is true:
122649
122650
122651 * All of the data in the supplied buffers has been written. That is, the bytes transferred is equal to the sum of the buffer sizes.
122652
122653
122654 * The completion\_condition function object returns 0.
122655
122656 This operation is implemented in terms of zero or more calls to the stream's write\_some function.
122657
122658
122659 [heading Parameters]
122660     
122661
122662 [variablelist
122663   
122664 [[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]]
122665
122666 [[buffers][One or more buffers containing the data to be written. The sum of the buffer sizes indicates the maximum number of bytes to write to the stream.]]
122667
122668 [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 
122669 ``
122670    std::size_t completion_condition(
122671      // Result of latest write_some operation.
122672      const boost::system::error_code& error,
122673
122674      // Number of bytes transferred so far.
122675      std::size_t bytes_transferred
122676    ); 
122677 ``
122678 A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the stream's write\_some function.]]
122679
122680 ]
122681
122682
122683 [heading Return Value]
122684       
122685 The number of bytes transferred.
122686
122687
122688 [heading Exceptions]
122689     
122690
122691 [variablelist
122692   
122693 [[boost::system::system_error][Thrown on failure.]]
122694
122695 ]
122696
122697
122698 [heading Example]
122699   
122700 To write a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
122701
122702    boost::asio::write(s, boost::asio::buffer(data, size),
122703        boost::asio::transfer_at_least(32)); 
122704
122705
122706 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
122707
122708
122709
122710
122711 [endsect]
122712
122713
122714
122715 [section:overload4 write (4 of 16 overloads)]
122716
122717
122718 Write a certain amount of data to a stream before returning. 
122719
122720
122721   template<
122722       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
122723       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
122724       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
122725   std::size_t write(
122726       SyncWriteStream & s,
122727       const ConstBufferSequence & buffers,
122728       CompletionCondition completion_condition,
122729       boost::system::error_code & ec,
122730       typename enable_if< is_const_buffer_sequence< ConstBufferSequence >::value >::type *  = 0);
122731
122732
122733 This function is used to write a certain number of bytes of data to a stream. The call will block until one of the following conditions is true:
122734
122735
122736 * All of the data in the supplied buffers has been written. That is, the bytes transferred is equal to the sum of the buffer sizes.
122737
122738
122739 * The completion\_condition function object returns 0.
122740
122741 This operation is implemented in terms of zero or more calls to the stream's write\_some function.
122742
122743
122744 [heading Parameters]
122745     
122746
122747 [variablelist
122748   
122749 [[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]]
122750
122751 [[buffers][One or more buffers containing the data to be written. The sum of the buffer sizes indicates the maximum number of bytes to write to the stream.]]
122752
122753 [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 
122754 ``
122755    std::size_t completion_condition(
122756      // Result of latest write_some operation.
122757      const boost::system::error_code& error,
122758
122759      // Number of bytes transferred so far.
122760      std::size_t bytes_transferred
122761    ); 
122762 ``
122763 A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the stream's write\_some function.]]
122764
122765 [[ec][Set to indicate what error occurred, if any.]]
122766
122767 ]
122768
122769
122770 [heading Return Value]
122771       
122772 The number of bytes written. If an error occurs, returns the total number of bytes successfully transferred prior to the error. 
122773
122774
122775
122776
122777 [endsect]
122778
122779
122780
122781 [section:overload5 write (5 of 16 overloads)]
122782
122783
122784 Write all of the supplied data to a stream before returning. 
122785
122786
122787   template<
122788       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
122789       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
122790   std::size_t write(
122791       SyncWriteStream & s,
122792       DynamicBuffer_v1 && buffers,
122793       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
122794
122795
122796 This function is used to write a certain number of bytes of data to a stream. The call will block until one of the following conditions is true:
122797
122798
122799 * All of the data in the supplied dynamic buffer sequence has been written.
122800
122801
122802 * An error occurred.
122803
122804 This operation is implemented in terms of zero or more calls to the stream's write\_some function.
122805
122806
122807 [heading Parameters]
122808     
122809
122810 [variablelist
122811   
122812 [[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]]
122813
122814 [[buffers][The dynamic buffer sequence from which data will be written. Successfully written data is automatically consumed from the buffers.]]
122815
122816 ]
122817
122818
122819 [heading Return Value]
122820       
122821 The number of bytes transferred.
122822
122823
122824 [heading Exceptions]
122825     
122826
122827 [variablelist
122828   
122829 [[boost::system::system_error][Thrown on failure.]]
122830
122831 ]
122832
122833
122834 [heading Remarks]
122835       
122836 This overload is equivalent to calling: 
122837
122838    boost::asio::write(
122839        s, buffers,
122840        boost::asio::transfer_all()); 
122841
122842
122843
122844
122845
122846
122847
122848 [endsect]
122849
122850
122851
122852 [section:overload6 write (6 of 16 overloads)]
122853
122854
122855 Write all of the supplied data to a stream before returning. 
122856
122857
122858   template<
122859       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
122860       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
122861   std::size_t write(
122862       SyncWriteStream & s,
122863       DynamicBuffer_v1 && buffers,
122864       boost::system::error_code & ec,
122865       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
122866
122867
122868 This function is used to write a certain number of bytes of data to a stream. The call will block until one of the following conditions is true:
122869
122870
122871 * All of the data in the supplied dynamic buffer sequence has been written.
122872
122873
122874 * An error occurred.
122875
122876 This operation is implemented in terms of zero or more calls to the stream's write\_some function.
122877
122878
122879 [heading Parameters]
122880     
122881
122882 [variablelist
122883   
122884 [[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]]
122885
122886 [[buffers][The dynamic buffer sequence from which data will be written. Successfully written data is automatically consumed from the buffers.]]
122887
122888 [[ec][Set to indicate what error occurred, if any.]]
122889
122890 ]
122891
122892
122893 [heading Return Value]
122894       
122895 The number of bytes transferred.
122896
122897
122898 [heading Remarks]
122899       
122900 This overload is equivalent to calling: 
122901
122902    boost::asio::write(
122903        s, buffers,
122904        boost::asio::transfer_all(), ec); 
122905
122906
122907
122908
122909
122910
122911
122912 [endsect]
122913
122914
122915
122916 [section:overload7 write (7 of 16 overloads)]
122917
122918
122919 Write a certain amount of data to a stream before returning. 
122920
122921
122922   template<
122923       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
122924       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
122925       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
122926   std::size_t write(
122927       SyncWriteStream & s,
122928       DynamicBuffer_v1 && buffers,
122929       CompletionCondition completion_condition,
122930       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
122931
122932
122933 This function is used to write a certain number of bytes of data to a stream. The call will block until one of the following conditions is true:
122934
122935
122936 * All of the data in the supplied dynamic buffer sequence has been written.
122937
122938
122939 * The completion\_condition function object returns 0.
122940
122941 This operation is implemented in terms of zero or more calls to the stream's write\_some function.
122942
122943
122944 [heading Parameters]
122945     
122946
122947 [variablelist
122948   
122949 [[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]]
122950
122951 [[buffers][The dynamic buffer sequence from which data will be written. Successfully written data is automatically consumed from the buffers.]]
122952
122953 [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 
122954 ``
122955    std::size_t completion_condition(
122956      // Result of latest write_some operation.
122957      const boost::system::error_code& error,
122958
122959      // Number of bytes transferred so far.
122960      std::size_t bytes_transferred
122961    ); 
122962 ``
122963 A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the stream's write\_some function.]]
122964
122965 ]
122966
122967
122968 [heading Return Value]
122969       
122970 The number of bytes transferred.
122971
122972
122973 [heading Exceptions]
122974     
122975
122976 [variablelist
122977   
122978 [[boost::system::system_error][Thrown on failure. ]]
122979
122980 ]
122981
122982
122983
122984
122985 [endsect]
122986
122987
122988
122989 [section:overload8 write (8 of 16 overloads)]
122990
122991
122992 Write a certain amount of data to a stream before returning. 
122993
122994
122995   template<
122996       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
122997       typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
122998       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
122999   std::size_t write(
123000       SyncWriteStream & s,
123001       DynamicBuffer_v1 && buffers,
123002       CompletionCondition completion_condition,
123003       boost::system::error_code & ec,
123004       typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type *  = 0);
123005
123006
123007 This function is used to write a certain number of bytes of data to a stream. The call will block until one of the following conditions is true:
123008
123009
123010 * All of the data in the supplied dynamic buffer sequence has been written.
123011
123012
123013 * The completion\_condition function object returns 0.
123014
123015 This operation is implemented in terms of zero or more calls to the stream's write\_some function.
123016
123017
123018 [heading Parameters]
123019     
123020
123021 [variablelist
123022   
123023 [[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]]
123024
123025 [[buffers][The dynamic buffer sequence from which data will be written. Successfully written data is automatically consumed from the buffers.]]
123026
123027 [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 
123028 ``
123029    std::size_t completion_condition(
123030      // Result of latest write_some operation.
123031      const boost::system::error_code& error,
123032
123033      // Number of bytes transferred so far.
123034      std::size_t bytes_transferred
123035    ); 
123036 ``
123037 A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the stream's write\_some function.]]
123038
123039 [[ec][Set to indicate what error occurred, if any.]]
123040
123041 ]
123042
123043
123044 [heading Return Value]
123045       
123046 The number of bytes written. If an error occurs, returns the total number of bytes successfully transferred prior to the error. 
123047
123048
123049
123050
123051 [endsect]
123052
123053
123054
123055 [section:overload9 write (9 of 16 overloads)]
123056
123057
123058 Write all of the supplied data to a stream before returning. 
123059
123060
123061   template<
123062       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
123063       typename Allocator>
123064   std::size_t write(
123065       SyncWriteStream & s,
123066       basic_streambuf< Allocator > & b);
123067
123068
123069 This function is used to write a certain number of bytes of data to a stream. The call will block until one of the following conditions is true:
123070
123071
123072 * All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written.
123073
123074
123075 * An error occurred.
123076
123077 This operation is implemented in terms of zero or more calls to the stream's write\_some function.
123078
123079
123080 [heading Parameters]
123081     
123082
123083 [variablelist
123084   
123085 [[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]]
123086
123087 [[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object from which data will be written.]]
123088
123089 ]
123090
123091
123092 [heading Return Value]
123093       
123094 The number of bytes transferred.
123095
123096
123097 [heading Exceptions]
123098     
123099
123100 [variablelist
123101   
123102 [[boost::system::system_error][Thrown on failure.]]
123103
123104 ]
123105
123106
123107 [heading Remarks]
123108       
123109 This overload is equivalent to calling: 
123110
123111    boost::asio::write(
123112        s, b,
123113        boost::asio::transfer_all()); 
123114
123115
123116
123117
123118
123119
123120
123121 [endsect]
123122
123123
123124
123125 [section:overload10 write (10 of 16 overloads)]
123126
123127
123128 Write all of the supplied data to a stream before returning. 
123129
123130
123131   template<
123132       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
123133       typename Allocator>
123134   std::size_t write(
123135       SyncWriteStream & s,
123136       basic_streambuf< Allocator > & b,
123137       boost::system::error_code & ec);
123138
123139
123140 This function is used to write a certain number of bytes of data to a stream. The call will block until one of the following conditions is true:
123141
123142
123143 * All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written.
123144
123145
123146 * An error occurred.
123147
123148 This operation is implemented in terms of zero or more calls to the stream's write\_some function.
123149
123150
123151 [heading Parameters]
123152     
123153
123154 [variablelist
123155   
123156 [[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]]
123157
123158 [[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object from which data will be written.]]
123159
123160 [[ec][Set to indicate what error occurred, if any.]]
123161
123162 ]
123163
123164
123165 [heading Return Value]
123166       
123167 The number of bytes transferred.
123168
123169
123170 [heading Remarks]
123171       
123172 This overload is equivalent to calling: 
123173
123174    boost::asio::write(
123175        s, b,
123176        boost::asio::transfer_all(), ec); 
123177
123178
123179
123180
123181
123182
123183
123184 [endsect]
123185
123186
123187
123188 [section:overload11 write (11 of 16 overloads)]
123189
123190
123191 Write a certain amount of data to a stream before returning. 
123192
123193
123194   template<
123195       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
123196       typename Allocator,
123197       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
123198   std::size_t write(
123199       SyncWriteStream & s,
123200       basic_streambuf< Allocator > & b,
123201       CompletionCondition completion_condition);
123202
123203
123204 This function is used to write a certain number of bytes of data to a stream. The call will block until one of the following conditions is true:
123205
123206
123207 * All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written.
123208
123209
123210 * The completion\_condition function object returns 0.
123211
123212 This operation is implemented in terms of zero or more calls to the stream's write\_some function.
123213
123214
123215 [heading Parameters]
123216     
123217
123218 [variablelist
123219   
123220 [[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]]
123221
123222 [[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object from which data will be written.]]
123223
123224 [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 
123225 ``
123226    std::size_t completion_condition(
123227      // Result of latest write_some operation.
123228      const boost::system::error_code& error,
123229
123230      // Number of bytes transferred so far.
123231      std::size_t bytes_transferred
123232    ); 
123233 ``
123234 A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the stream's write\_some function.]]
123235
123236 ]
123237
123238
123239 [heading Return Value]
123240       
123241 The number of bytes transferred.
123242
123243
123244 [heading Exceptions]
123245     
123246
123247 [variablelist
123248   
123249 [[boost::system::system_error][Thrown on failure. ]]
123250
123251 ]
123252
123253
123254
123255
123256 [endsect]
123257
123258
123259
123260 [section:overload12 write (12 of 16 overloads)]
123261
123262
123263 Write a certain amount of data to a stream before returning. 
123264
123265
123266   template<
123267       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
123268       typename Allocator,
123269       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
123270   std::size_t write(
123271       SyncWriteStream & s,
123272       basic_streambuf< Allocator > & b,
123273       CompletionCondition completion_condition,
123274       boost::system::error_code & ec);
123275
123276
123277 This function is used to write a certain number of bytes of data to a stream. The call will block until one of the following conditions is true:
123278
123279
123280 * All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written.
123281
123282
123283 * The completion\_condition function object returns 0.
123284
123285 This operation is implemented in terms of zero or more calls to the stream's write\_some function.
123286
123287
123288 [heading Parameters]
123289     
123290
123291 [variablelist
123292   
123293 [[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]]
123294
123295 [[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object from which data will be written.]]
123296
123297 [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 
123298 ``
123299    std::size_t completion_condition(
123300      // Result of latest write_some operation.
123301      const boost::system::error_code& error,
123302
123303      // Number of bytes transferred so far.
123304      std::size_t bytes_transferred
123305    ); 
123306 ``
123307 A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the stream's write\_some function.]]
123308
123309 [[ec][Set to indicate what error occurred, if any.]]
123310
123311 ]
123312
123313
123314 [heading Return Value]
123315       
123316 The number of bytes written. If an error occurs, returns the total number of bytes successfully transferred prior to the error. 
123317
123318
123319
123320
123321 [endsect]
123322
123323
123324
123325 [section:overload13 write (13 of 16 overloads)]
123326
123327
123328 Write all of the supplied data to a stream before returning. 
123329
123330
123331   template<
123332       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
123333       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
123334   std::size_t write(
123335       SyncWriteStream & s,
123336       DynamicBuffer_v2 buffers,
123337       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
123338
123339
123340 This function is used to write a certain number of bytes of data to a stream. The call will block until one of the following conditions is true:
123341
123342
123343 * All of the data in the supplied dynamic buffer sequence has been written.
123344
123345
123346 * An error occurred.
123347
123348 This operation is implemented in terms of zero or more calls to the stream's write\_some function.
123349
123350
123351 [heading Parameters]
123352     
123353
123354 [variablelist
123355   
123356 [[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]]
123357
123358 [[buffers][The dynamic buffer sequence from which data will be written. Successfully written data is automatically consumed from the buffers.]]
123359
123360 ]
123361
123362
123363 [heading Return Value]
123364       
123365 The number of bytes transferred.
123366
123367
123368 [heading Exceptions]
123369     
123370
123371 [variablelist
123372   
123373 [[boost::system::system_error][Thrown on failure.]]
123374
123375 ]
123376
123377
123378 [heading Remarks]
123379       
123380 This overload is equivalent to calling: 
123381
123382    boost::asio::write(
123383        s, buffers,
123384        boost::asio::transfer_all()); 
123385
123386
123387
123388
123389
123390
123391
123392 [endsect]
123393
123394
123395
123396 [section:overload14 write (14 of 16 overloads)]
123397
123398
123399 Write all of the supplied data to a stream before returning. 
123400
123401
123402   template<
123403       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
123404       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
123405   std::size_t write(
123406       SyncWriteStream & s,
123407       DynamicBuffer_v2 buffers,
123408       boost::system::error_code & ec,
123409       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
123410
123411
123412 This function is used to write a certain number of bytes of data to a stream. The call will block until one of the following conditions is true:
123413
123414
123415 * All of the data in the supplied dynamic buffer sequence has been written.
123416
123417
123418 * An error occurred.
123419
123420 This operation is implemented in terms of zero or more calls to the stream's write\_some function.
123421
123422
123423 [heading Parameters]
123424     
123425
123426 [variablelist
123427   
123428 [[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]]
123429
123430 [[buffers][The dynamic buffer sequence from which data will be written. Successfully written data is automatically consumed from the buffers.]]
123431
123432 [[ec][Set to indicate what error occurred, if any.]]
123433
123434 ]
123435
123436
123437 [heading Return Value]
123438       
123439 The number of bytes transferred.
123440
123441
123442 [heading Remarks]
123443       
123444 This overload is equivalent to calling: 
123445
123446    boost::asio::write(
123447        s, buffers,
123448        boost::asio::transfer_all(), ec); 
123449
123450
123451
123452
123453
123454
123455
123456 [endsect]
123457
123458
123459
123460 [section:overload15 write (15 of 16 overloads)]
123461
123462
123463 Write a certain amount of data to a stream before returning. 
123464
123465
123466   template<
123467       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
123468       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
123469       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
123470   std::size_t write(
123471       SyncWriteStream & s,
123472       DynamicBuffer_v2 buffers,
123473       CompletionCondition completion_condition,
123474       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
123475
123476
123477 This function is used to write a certain number of bytes of data to a stream. The call will block until one of the following conditions is true:
123478
123479
123480 * All of the data in the supplied dynamic buffer sequence has been written.
123481
123482
123483 * The completion\_condition function object returns 0.
123484
123485 This operation is implemented in terms of zero or more calls to the stream's write\_some function.
123486
123487
123488 [heading Parameters]
123489     
123490
123491 [variablelist
123492   
123493 [[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]]
123494
123495 [[buffers][The dynamic buffer sequence from which data will be written. Successfully written data is automatically consumed from the buffers.]]
123496
123497 [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 
123498 ``
123499    std::size_t completion_condition(
123500      // Result of latest write_some operation.
123501      const boost::system::error_code& error,
123502
123503      // Number of bytes transferred so far.
123504      std::size_t bytes_transferred
123505    ); 
123506 ``
123507 A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the stream's write\_some function.]]
123508
123509 ]
123510
123511
123512 [heading Return Value]
123513       
123514 The number of bytes transferred.
123515
123516
123517 [heading Exceptions]
123518     
123519
123520 [variablelist
123521   
123522 [[boost::system::system_error][Thrown on failure. ]]
123523
123524 ]
123525
123526
123527
123528
123529 [endsect]
123530
123531
123532
123533 [section:overload16 write (16 of 16 overloads)]
123534
123535
123536 Write a certain amount of data to a stream before returning. 
123537
123538
123539   template<
123540       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
123541       typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
123542       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
123543   std::size_t write(
123544       SyncWriteStream & s,
123545       DynamicBuffer_v2 buffers,
123546       CompletionCondition completion_condition,
123547       boost::system::error_code & ec,
123548       typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type *  = 0);
123549
123550
123551 This function is used to write a certain number of bytes of data to a stream. The call will block until one of the following conditions is true:
123552
123553
123554 * All of the data in the supplied dynamic buffer sequence has been written.
123555
123556
123557 * The completion\_condition function object returns 0.
123558
123559 This operation is implemented in terms of zero or more calls to the stream's write\_some function.
123560
123561
123562 [heading Parameters]
123563     
123564
123565 [variablelist
123566   
123567 [[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]]
123568
123569 [[buffers][The dynamic buffer sequence from which data will be written. Successfully written data is automatically consumed from the buffers.]]
123570
123571 [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 
123572 ``
123573    std::size_t completion_condition(
123574      // Result of latest write_some operation.
123575      const boost::system::error_code& error,
123576
123577      // Number of bytes transferred so far.
123578      std::size_t bytes_transferred
123579    ); 
123580 ``
123581 A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the stream's write\_some function.]]
123582
123583 [[ec][Set to indicate what error occurred, if any.]]
123584
123585 ]
123586
123587
123588 [heading Return Value]
123589       
123590 The number of bytes written. If an error occurs, returns the total number of bytes successfully transferred prior to the error. 
123591
123592
123593
123594
123595 [endsect]
123596
123597
123598 [endsect]
123599
123600 [section:write_at write_at]
123601
123602 [indexterm1 boost_asio.indexterm.write_at..write_at] 
123603 The `write_at` function is a composed operation that writes a certain amount of data at a specified offset before returning. 
123604
123605
123606 Write all of the supplied data at the specified offset before returning. 
123607
123608   template<
123609       typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
123610       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
123611   std::size_t ``[link boost_asio.reference.write_at.overload1 write_at]``(
123612       SyncRandomAccessWriteDevice & d,
123613       uint64_t offset,
123614       const ConstBufferSequence & buffers);
123615   ``  [''''&raquo;''' [link boost_asio.reference.write_at.overload1 more...]]``
123616
123617   template<
123618       typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
123619       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
123620   std::size_t ``[link boost_asio.reference.write_at.overload2 write_at]``(
123621       SyncRandomAccessWriteDevice & d,
123622       uint64_t offset,
123623       const ConstBufferSequence & buffers,
123624       boost::system::error_code & ec);
123625   ``  [''''&raquo;''' [link boost_asio.reference.write_at.overload2 more...]]``
123626
123627 Write a certain amount of data at a specified offset before returning. 
123628
123629   template<
123630       typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
123631       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
123632       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
123633   std::size_t ``[link boost_asio.reference.write_at.overload3 write_at]``(
123634       SyncRandomAccessWriteDevice & d,
123635       uint64_t offset,
123636       const ConstBufferSequence & buffers,
123637       CompletionCondition completion_condition);
123638   ``  [''''&raquo;''' [link boost_asio.reference.write_at.overload3 more...]]``
123639
123640   template<
123641       typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
123642       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
123643       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
123644   std::size_t ``[link boost_asio.reference.write_at.overload4 write_at]``(
123645       SyncRandomAccessWriteDevice & d,
123646       uint64_t offset,
123647       const ConstBufferSequence & buffers,
123648       CompletionCondition completion_condition,
123649       boost::system::error_code & ec);
123650   ``  [''''&raquo;''' [link boost_asio.reference.write_at.overload4 more...]]``
123651
123652 Write all of the supplied data at the specified offset before returning. 
123653
123654   template<
123655       typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
123656       typename Allocator>
123657   std::size_t ``[link boost_asio.reference.write_at.overload5 write_at]``(
123658       SyncRandomAccessWriteDevice & d,
123659       uint64_t offset,
123660       basic_streambuf< Allocator > & b);
123661   ``  [''''&raquo;''' [link boost_asio.reference.write_at.overload5 more...]]``
123662
123663   template<
123664       typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
123665       typename Allocator>
123666   std::size_t ``[link boost_asio.reference.write_at.overload6 write_at]``(
123667       SyncRandomAccessWriteDevice & d,
123668       uint64_t offset,
123669       basic_streambuf< Allocator > & b,
123670       boost::system::error_code & ec);
123671   ``  [''''&raquo;''' [link boost_asio.reference.write_at.overload6 more...]]``
123672
123673 Write a certain amount of data at a specified offset before returning. 
123674
123675   template<
123676       typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
123677       typename Allocator,
123678       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
123679   std::size_t ``[link boost_asio.reference.write_at.overload7 write_at]``(
123680       SyncRandomAccessWriteDevice & d,
123681       uint64_t offset,
123682       basic_streambuf< Allocator > & b,
123683       CompletionCondition completion_condition);
123684   ``  [''''&raquo;''' [link boost_asio.reference.write_at.overload7 more...]]``
123685
123686   template<
123687       typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
123688       typename Allocator,
123689       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
123690   std::size_t ``[link boost_asio.reference.write_at.overload8 write_at]``(
123691       SyncRandomAccessWriteDevice & d,
123692       uint64_t offset,
123693       basic_streambuf< Allocator > & b,
123694       CompletionCondition completion_condition,
123695       boost::system::error_code & ec);
123696   ``  [''''&raquo;''' [link boost_asio.reference.write_at.overload8 more...]]``
123697
123698 [heading Requirements]
123699
123700 ['Header: ][^boost/asio/write_at.hpp]
123701
123702 ['Convenience header: ][^boost/asio.hpp]
123703
123704
123705 [section:overload1 write_at (1 of 8 overloads)]
123706
123707
123708 Write all of the supplied data at the specified offset before returning. 
123709
123710
123711   template<
123712       typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
123713       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
123714   std::size_t write_at(
123715       SyncRandomAccessWriteDevice & d,
123716       uint64_t offset,
123717       const ConstBufferSequence & buffers);
123718
123719
123720 This function is used to write a certain number of bytes of data to a random access device at a specified offset. The call will block until one of the following conditions is true:
123721
123722
123723 * All of the data in the supplied buffers has been written. That is, the bytes transferred is equal to the sum of the buffer sizes.
123724
123725
123726 * An error occurred.
123727
123728 This operation is implemented in terms of zero or more calls to the device's write\_some\_at function.
123729
123730
123731 [heading Parameters]
123732     
123733
123734 [variablelist
123735   
123736 [[d][The device to which the data is to be written. The type must support the SyncRandomAccessWriteDevice concept.]]
123737
123738 [[offset][The offset at which the data will be written.]]
123739
123740 [[buffers][One or more buffers containing the data to be written. The sum of the buffer sizes indicates the maximum number of bytes to write to the device.]]
123741
123742 ]
123743
123744
123745 [heading Return Value]
123746       
123747 The number of bytes transferred.
123748
123749
123750 [heading Exceptions]
123751     
123752
123753 [variablelist
123754   
123755 [[boost::system::system_error][Thrown on failure.]]
123756
123757 ]
123758
123759
123760 [heading Example]
123761   
123762 To write a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
123763
123764    boost::asio::write_at(d, 42, boost::asio::buffer(data, size)); 
123765
123766
123767 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
123768
123769
123770 [heading Remarks]
123771       
123772 This overload is equivalent to calling: 
123773
123774    boost::asio::write_at(
123775        d, offset, buffers,
123776        boost::asio::transfer_all()); 
123777
123778
123779
123780
123781
123782
123783
123784 [endsect]
123785
123786
123787
123788 [section:overload2 write_at (2 of 8 overloads)]
123789
123790
123791 Write all of the supplied data at the specified offset before returning. 
123792
123793
123794   template<
123795       typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
123796       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
123797   std::size_t write_at(
123798       SyncRandomAccessWriteDevice & d,
123799       uint64_t offset,
123800       const ConstBufferSequence & buffers,
123801       boost::system::error_code & ec);
123802
123803
123804 This function is used to write a certain number of bytes of data to a random access device at a specified offset. The call will block until one of the following conditions is true:
123805
123806
123807 * All of the data in the supplied buffers has been written. That is, the bytes transferred is equal to the sum of the buffer sizes.
123808
123809
123810 * An error occurred.
123811
123812 This operation is implemented in terms of zero or more calls to the device's write\_some\_at function.
123813
123814
123815 [heading Parameters]
123816     
123817
123818 [variablelist
123819   
123820 [[d][The device to which the data is to be written. The type must support the SyncRandomAccessWriteDevice concept.]]
123821
123822 [[offset][The offset at which the data will be written.]]
123823
123824 [[buffers][One or more buffers containing the data to be written. The sum of the buffer sizes indicates the maximum number of bytes to write to the device.]]
123825
123826 [[ec][Set to indicate what error occurred, if any.]]
123827
123828 ]
123829
123830
123831 [heading Return Value]
123832       
123833 The number of bytes transferred.
123834
123835
123836 [heading Example]
123837   
123838 To write a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
123839
123840    boost::asio::write_at(d, 42,
123841        boost::asio::buffer(data, size), ec); 
123842
123843
123844 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
123845
123846
123847 [heading Remarks]
123848       
123849 This overload is equivalent to calling: 
123850
123851    boost::asio::write_at(
123852        d, offset, buffers,
123853        boost::asio::transfer_all(), ec); 
123854
123855
123856
123857
123858
123859
123860
123861 [endsect]
123862
123863
123864
123865 [section:overload3 write_at (3 of 8 overloads)]
123866
123867
123868 Write a certain amount of data at a specified offset before returning. 
123869
123870
123871   template<
123872       typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
123873       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
123874       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
123875   std::size_t write_at(
123876       SyncRandomAccessWriteDevice & d,
123877       uint64_t offset,
123878       const ConstBufferSequence & buffers,
123879       CompletionCondition completion_condition);
123880
123881
123882 This function is used to write a certain number of bytes of data to a random access device at a specified offset. The call will block until one of the following conditions is true:
123883
123884
123885 * All of the data in the supplied buffers has been written. That is, the bytes transferred is equal to the sum of the buffer sizes.
123886
123887
123888 * The completion\_condition function object returns 0.
123889
123890 This operation is implemented in terms of zero or more calls to the device's write\_some\_at function.
123891
123892
123893 [heading Parameters]
123894     
123895
123896 [variablelist
123897   
123898 [[d][The device to which the data is to be written. The type must support the SyncRandomAccessWriteDevice concept.]]
123899
123900 [[offset][The offset at which the data will be written.]]
123901
123902 [[buffers][One or more buffers containing the data to be written. The sum of the buffer sizes indicates the maximum number of bytes to write to the device.]]
123903
123904 [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 
123905 ``
123906    std::size_t completion_condition(
123907      // Result of latest write_some_at operation.
123908      const boost::system::error_code& error,
123909
123910      // Number of bytes transferred so far.
123911      std::size_t bytes_transferred
123912    ); 
123913 ``
123914 A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the device's write\_some\_at function.]]
123915
123916 ]
123917
123918
123919 [heading Return Value]
123920       
123921 The number of bytes transferred.
123922
123923
123924 [heading Exceptions]
123925     
123926
123927 [variablelist
123928   
123929 [[boost::system::system_error][Thrown on failure.]]
123930
123931 ]
123932
123933
123934 [heading Example]
123935   
123936 To write a single data buffer use the [link boost_asio.reference.buffer `buffer`]  function as follows: 
123937
123938    boost::asio::write_at(d, 42, boost::asio::buffer(data, size),
123939        boost::asio::transfer_at_least(32)); 
123940
123941
123942 See the [link boost_asio.reference.buffer `buffer`]  documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. 
123943
123944
123945
123946
123947 [endsect]
123948
123949
123950
123951 [section:overload4 write_at (4 of 8 overloads)]
123952
123953
123954 Write a certain amount of data at a specified offset before returning. 
123955
123956
123957   template<
123958       typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
123959       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
123960       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
123961   std::size_t write_at(
123962       SyncRandomAccessWriteDevice & d,
123963       uint64_t offset,
123964       const ConstBufferSequence & buffers,
123965       CompletionCondition completion_condition,
123966       boost::system::error_code & ec);
123967
123968
123969 This function is used to write a certain number of bytes of data to a random access device at a specified offset. The call will block until one of the following conditions is true:
123970
123971
123972 * All of the data in the supplied buffers has been written. That is, the bytes transferred is equal to the sum of the buffer sizes.
123973
123974
123975 * The completion\_condition function object returns 0.
123976
123977 This operation is implemented in terms of zero or more calls to the device's write\_some\_at function.
123978
123979
123980 [heading Parameters]
123981     
123982
123983 [variablelist
123984   
123985 [[d][The device to which the data is to be written. The type must support the SyncRandomAccessWriteDevice concept.]]
123986
123987 [[offset][The offset at which the data will be written.]]
123988
123989 [[buffers][One or more buffers containing the data to be written. The sum of the buffer sizes indicates the maximum number of bytes to write to the device.]]
123990
123991 [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 
123992 ``
123993    std::size_t completion_condition(
123994      // Result of latest write_some_at operation.
123995      const boost::system::error_code& error,
123996
123997      // Number of bytes transferred so far.
123998      std::size_t bytes_transferred
123999    ); 
124000 ``
124001 A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the device's write\_some\_at function.]]
124002
124003 [[ec][Set to indicate what error occurred, if any.]]
124004
124005 ]
124006
124007
124008 [heading Return Value]
124009       
124010 The number of bytes written. If an error occurs, returns the total number of bytes successfully transferred prior to the error. 
124011
124012
124013
124014
124015 [endsect]
124016
124017
124018
124019 [section:overload5 write_at (5 of 8 overloads)]
124020
124021
124022 Write all of the supplied data at the specified offset before returning. 
124023
124024
124025   template<
124026       typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
124027       typename Allocator>
124028   std::size_t write_at(
124029       SyncRandomAccessWriteDevice & d,
124030       uint64_t offset,
124031       basic_streambuf< Allocator > & b);
124032
124033
124034 This function is used to write a certain number of bytes of data to a random access device at a specified offset. The call will block until one of the following conditions is true:
124035
124036
124037 * All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written.
124038
124039
124040 * An error occurred.
124041
124042 This operation is implemented in terms of zero or more calls to the device's write\_some\_at function.
124043
124044
124045 [heading Parameters]
124046     
124047
124048 [variablelist
124049   
124050 [[d][The device to which the data is to be written. The type must support the SyncRandomAccessWriteDevice concept.]]
124051
124052 [[offset][The offset at which the data will be written.]]
124053
124054 [[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object from which data will be written.]]
124055
124056 ]
124057
124058
124059 [heading Return Value]
124060       
124061 The number of bytes transferred.
124062
124063
124064 [heading Exceptions]
124065     
124066
124067 [variablelist
124068   
124069 [[boost::system::system_error][Thrown on failure.]]
124070
124071 ]
124072
124073
124074 [heading Remarks]
124075       
124076 This overload is equivalent to calling: 
124077
124078    boost::asio::write_at(
124079        d, 42, b,
124080        boost::asio::transfer_all()); 
124081
124082
124083
124084
124085
124086
124087
124088 [endsect]
124089
124090
124091
124092 [section:overload6 write_at (6 of 8 overloads)]
124093
124094
124095 Write all of the supplied data at the specified offset before returning. 
124096
124097
124098   template<
124099       typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
124100       typename Allocator>
124101   std::size_t write_at(
124102       SyncRandomAccessWriteDevice & d,
124103       uint64_t offset,
124104       basic_streambuf< Allocator > & b,
124105       boost::system::error_code & ec);
124106
124107
124108 This function is used to write a certain number of bytes of data to a random access device at a specified offset. The call will block until one of the following conditions is true:
124109
124110
124111 * All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written.
124112
124113
124114 * An error occurred.
124115
124116 This operation is implemented in terms of zero or more calls to the device's write\_some\_at function.
124117
124118
124119 [heading Parameters]
124120     
124121
124122 [variablelist
124123   
124124 [[d][The device to which the data is to be written. The type must support the SyncRandomAccessWriteDevice concept.]]
124125
124126 [[offset][The offset at which the data will be written.]]
124127
124128 [[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object from which data will be written.]]
124129
124130 [[ec][Set to indicate what error occurred, if any.]]
124131
124132 ]
124133
124134
124135 [heading Return Value]
124136       
124137 The number of bytes transferred.
124138
124139
124140 [heading Remarks]
124141       
124142 This overload is equivalent to calling: 
124143
124144    boost::asio::write_at(
124145        d, 42, b,
124146        boost::asio::transfer_all(), ec); 
124147
124148
124149
124150
124151
124152
124153
124154 [endsect]
124155
124156
124157
124158 [section:overload7 write_at (7 of 8 overloads)]
124159
124160
124161 Write a certain amount of data at a specified offset before returning. 
124162
124163
124164   template<
124165       typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
124166       typename Allocator,
124167       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
124168   std::size_t write_at(
124169       SyncRandomAccessWriteDevice & d,
124170       uint64_t offset,
124171       basic_streambuf< Allocator > & b,
124172       CompletionCondition completion_condition);
124173
124174
124175 This function is used to write a certain number of bytes of data to a random access device at a specified offset. The call will block until one of the following conditions is true:
124176
124177
124178 * All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written.
124179
124180
124181 * The completion\_condition function object returns 0.
124182
124183 This operation is implemented in terms of zero or more calls to the device's write\_some\_at function.
124184
124185
124186 [heading Parameters]
124187     
124188
124189 [variablelist
124190   
124191 [[d][The device to which the data is to be written. The type must support the SyncRandomAccessWriteDevice concept.]]
124192
124193 [[offset][The offset at which the data will be written.]]
124194
124195 [[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object from which data will be written.]]
124196
124197 [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 
124198 ``
124199    std::size_t completion_condition(
124200      // Result of latest write_some_at operation.
124201      const boost::system::error_code& error,
124202
124203      // Number of bytes transferred so far.
124204      std::size_t bytes_transferred
124205    ); 
124206 ``
124207 A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the device's write\_some\_at function.]]
124208
124209 ]
124210
124211
124212 [heading Return Value]
124213       
124214 The number of bytes transferred.
124215
124216
124217 [heading Exceptions]
124218     
124219
124220 [variablelist
124221   
124222 [[boost::system::system_error][Thrown on failure. ]]
124223
124224 ]
124225
124226
124227
124228
124229 [endsect]
124230
124231
124232
124233 [section:overload8 write_at (8 of 8 overloads)]
124234
124235
124236 Write a certain amount of data at a specified offset before returning. 
124237
124238
124239   template<
124240       typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
124241       typename Allocator,
124242       typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
124243   std::size_t write_at(
124244       SyncRandomAccessWriteDevice & d,
124245       uint64_t offset,
124246       basic_streambuf< Allocator > & b,
124247       CompletionCondition completion_condition,
124248       boost::system::error_code & ec);
124249
124250
124251 This function is used to write a certain number of bytes of data to a random access device at a specified offset. The call will block until one of the following conditions is true:
124252
124253
124254 * All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written.
124255
124256
124257 * The completion\_condition function object returns 0.
124258
124259 This operation is implemented in terms of zero or more calls to the device's write\_some\_at function.
124260
124261
124262 [heading Parameters]
124263     
124264
124265 [variablelist
124266   
124267 [[d][The device to which the data is to be written. The type must support the SyncRandomAccessWriteDevice concept.]]
124268
124269 [[offset][The offset at which the data will be written.]]
124270
124271 [[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object from which data will be written.]]
124272
124273 [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 
124274 ``
124275    std::size_t completion_condition(
124276      // Result of latest write_some_at operation.
124277      const boost::system::error_code& error,
124278
124279      // Number of bytes transferred so far.
124280      std::size_t bytes_transferred
124281    ); 
124282 ``
124283 A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the device's write\_some\_at function.]]
124284
124285 [[ec][Set to indicate what error occurred, if any.]]
124286
124287 ]
124288
124289
124290 [heading Return Value]
124291       
124292 The number of bytes written. If an error occurs, returns the total number of bytes successfully transferred prior to the error. 
124293
124294
124295
124296
124297 [endsect]
124298
124299
124300 [endsect]
124301
124302
124303 [section:yield_context yield_context]
124304
124305 [indexterm1 boost_asio.indexterm.yield_context..yield_context] 
124306 Context object that represents the currently executing coroutine. 
124307
124308
124309   typedef basic_yield_context< unspecified > yield_context;
124310
124311
124312 [heading Types]
124313 [table
124314   [[Name][Description]]
124315
124316   [
124317
124318     [[link boost_asio.reference.basic_yield_context.callee_type [*callee_type]]]
124319     [The coroutine callee type, used by the implementation. ]
124320   
124321   ]
124322
124323   [
124324
124325     [[link boost_asio.reference.basic_yield_context.caller_type [*caller_type]]]
124326     [The coroutine caller type, used by the implementation. ]
124327   
124328   ]
124329
124330 ]
124331
124332 [heading Member Functions]
124333 [table
124334   [[Name][Description]]
124335
124336   [
124337     [[link boost_asio.reference.basic_yield_context.basic_yield_context [*basic_yield_context]]]
124338     [Construct a yield context to represent the specified coroutine. 
124339      [hr]
124340      Construct a yield context from another yield context type. ]
124341   ]
124342   
124343   [
124344     [[link boost_asio.reference.basic_yield_context.operator_lb__rb_ [*operator\[\]]]]
124345     [Return a yield context that sets the specified error_code. ]
124346   ]
124347   
124348 ]
124349
124350 The [link boost_asio.reference.basic_yield_context `basic_yield_context`] class is used to represent the currently executing stackful coroutine. A [link boost_asio.reference.basic_yield_context `basic_yield_context`] may be passed as a handler to an asynchronous operation. For example:
124351
124352
124353
124354    template <typename Handler>
124355    void my_coroutine(basic_yield_context<Handler> yield)
124356    {
124357      ...
124358      std::size_t n = my_socket.async_read_some(buffer, yield);
124359      ...
124360    } 
124361
124362
124363
124364
124365 The initiating function (async\_read\_some in the above example) suspends the current coroutine. The coroutine is resumed when the asynchronous operation completes, and the result of the operation is returned. 
124366
124367
124368 [heading Requirements]
124369
124370 ['Header: ][^boost/asio/spawn.hpp]
124371
124372 ['Convenience header: ]None
124373
124374
124375 [endsect]
124376
124377
124378 [section:is_error_code_enum_lt__addrinfo_errors__gt_ boost::system::is_error_code_enum< boost::asio::error::addrinfo_errors >]
124379
124380
124381
124382   template<>
124383   struct boost::system::is_error_code_enum< boost::asio::error::addrinfo_errors >
124384
124385
124386 [heading Data Members]
124387 [table
124388   [[Name][Description]]
124389
124390   [
124391     [[link boost_asio.reference.is_error_code_enum_lt__addrinfo_errors__gt_.value [*value]]]
124392     []
124393   ]
124394
124395 ]
124396
124397 [heading Requirements]
124398
124399 ['Header: ][^boost/asio/error.hpp]
124400
124401 ['Convenience header: ][^boost/asio.hpp]
124402
124403
124404 [section:value boost::system::is_error_code_enum< boost::asio::error::addrinfo_errors >::value]
124405
124406 [indexterm2 boost_asio.indexterm.is_error_code_enum_lt__addrinfo_errors__gt_.value..value..boost::system::is_error_code_enum< boost::asio::error::addrinfo_errors >] 
124407
124408   static const bool value = true;
124409
124410
124411
124412 [endsect]
124413
124414
124415
124416 [endsect]
124417
124418 [section:is_error_code_enum_lt__basic_errors__gt_ boost::system::is_error_code_enum< boost::asio::error::basic_errors >]
124419
124420
124421
124422   template<>
124423   struct boost::system::is_error_code_enum< boost::asio::error::basic_errors >
124424
124425
124426 [heading Data Members]
124427 [table
124428   [[Name][Description]]
124429
124430   [
124431     [[link boost_asio.reference.is_error_code_enum_lt__basic_errors__gt_.value [*value]]]
124432     []
124433   ]
124434
124435 ]
124436
124437 [heading Requirements]
124438
124439 ['Header: ][^boost/asio/error.hpp]
124440
124441 ['Convenience header: ][^boost/asio.hpp]
124442
124443
124444 [section:value boost::system::is_error_code_enum< boost::asio::error::basic_errors >::value]
124445
124446 [indexterm2 boost_asio.indexterm.is_error_code_enum_lt__basic_errors__gt_.value..value..boost::system::is_error_code_enum< boost::asio::error::basic_errors >] 
124447
124448   static const bool value = true;
124449
124450
124451
124452 [endsect]
124453
124454
124455
124456 [endsect]
124457
124458 [section:is_error_code_enum_lt__misc_errors__gt_ boost::system::is_error_code_enum< boost::asio::error::misc_errors >]
124459
124460
124461
124462   template<>
124463   struct boost::system::is_error_code_enum< boost::asio::error::misc_errors >
124464
124465
124466 [heading Data Members]
124467 [table
124468   [[Name][Description]]
124469
124470   [
124471     [[link boost_asio.reference.is_error_code_enum_lt__misc_errors__gt_.value [*value]]]
124472     []
124473   ]
124474
124475 ]
124476
124477 [heading Requirements]
124478
124479 ['Header: ][^boost/asio/error.hpp]
124480
124481 ['Convenience header: ][^boost/asio.hpp]
124482
124483
124484 [section:value boost::system::is_error_code_enum< boost::asio::error::misc_errors >::value]
124485
124486 [indexterm2 boost_asio.indexterm.is_error_code_enum_lt__misc_errors__gt_.value..value..boost::system::is_error_code_enum< boost::asio::error::misc_errors >] 
124487
124488   static const bool value = true;
124489
124490
124491
124492 [endsect]
124493
124494
124495
124496 [endsect]
124497
124498 [section:is_error_code_enum_lt__netdb_errors__gt_ boost::system::is_error_code_enum< boost::asio::error::netdb_errors >]
124499
124500
124501
124502   template<>
124503   struct boost::system::is_error_code_enum< boost::asio::error::netdb_errors >
124504
124505
124506 [heading Data Members]
124507 [table
124508   [[Name][Description]]
124509
124510   [
124511     [[link boost_asio.reference.is_error_code_enum_lt__netdb_errors__gt_.value [*value]]]
124512     []
124513   ]
124514
124515 ]
124516
124517 [heading Requirements]
124518
124519 ['Header: ][^boost/asio/error.hpp]
124520
124521 ['Convenience header: ][^boost/asio.hpp]
124522
124523
124524 [section:value boost::system::is_error_code_enum< boost::asio::error::netdb_errors >::value]
124525
124526 [indexterm2 boost_asio.indexterm.is_error_code_enum_lt__netdb_errors__gt_.value..value..boost::system::is_error_code_enum< boost::asio::error::netdb_errors >] 
124527
124528   static const bool value = true;
124529
124530
124531
124532 [endsect]
124533
124534
124535
124536 [endsect]
124537
124538 [section:is_error_code_enum_lt__ssl_errors__gt_ boost::system::is_error_code_enum< boost::asio::error::ssl_errors >]
124539
124540
124541
124542   template<>
124543   struct boost::system::is_error_code_enum< boost::asio::error::ssl_errors >
124544
124545
124546 [heading Data Members]
124547 [table
124548   [[Name][Description]]
124549
124550   [
124551     [[link boost_asio.reference.is_error_code_enum_lt__ssl_errors__gt_.value [*value]]]
124552     []
124553   ]
124554
124555 ]
124556
124557 [heading Requirements]
124558
124559 ['Header: ][^boost/asio/ssl/error.hpp]
124560
124561 ['Convenience header: ][^boost/asio/ssl.hpp]
124562
124563
124564 [section:value boost::system::is_error_code_enum< boost::asio::error::ssl_errors >::value]
124565
124566 [indexterm2 boost_asio.indexterm.is_error_code_enum_lt__ssl_errors__gt_.value..value..boost::system::is_error_code_enum< boost::asio::error::ssl_errors >] 
124567
124568   static const bool value = true;
124569
124570
124571
124572 [endsect]
124573
124574
124575
124576 [endsect]
124577
124578 [section:is_error_code_enum_lt__boost__asio__ssl__error__stream_errors__gt_ boost::system::is_error_code_enum< boost::asio::ssl::error::stream_errors >]
124579
124580
124581
124582   template<>
124583   struct boost::system::is_error_code_enum< boost::asio::ssl::error::stream_errors >
124584
124585
124586 [heading Data Members]
124587 [table
124588   [[Name][Description]]
124589
124590   [
124591     [[link boost_asio.reference.is_error_code_enum_lt__boost__asio__ssl__error__stream_errors__gt_.value [*value]]]
124592     []
124593   ]
124594
124595 ]
124596
124597 [heading Requirements]
124598
124599 ['Header: ][^boost/asio/ssl/error.hpp]
124600
124601 ['Convenience header: ][^boost/asio/ssl.hpp]
124602
124603
124604 [section:value boost::system::is_error_code_enum< boost::asio::ssl::error::stream_errors >::value]
124605
124606 [indexterm2 boost_asio.indexterm.is_error_code_enum_lt__boost__asio__ssl__error__stream_errors__gt_.value..value..boost::system::is_error_code_enum< boost::asio::ssl::error::stream_errors >] 
124607
124608   static const bool value = true;
124609
124610
124611
124612 [endsect]
124613
124614
124615
124616 [endsect]
124617
124618 [endsect]