1[/ 2 / Copyright (c) 2003-2021 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/OperationState.qbk] 47[include requirements/ProtoAllocator.qbk] 48[include requirements/Protocol.qbk] 49[include requirements/RangeConnectHandler.qbk] 50[include requirements/ReadHandler.qbk] 51[include requirements/Receiver.qbk] 52[include requirements/ResolveHandler.qbk] 53[include requirements/Scheduler.qbk] 54[include requirements/Sender.qbk] 55[include requirements/Service.qbk] 56[include requirements/SettableSerialPortOption.qbk] 57[include requirements/SettableSocketOption.qbk] 58[include requirements/ShutdownHandler.qbk] 59[include requirements/SignalHandler.qbk] 60[include requirements/SyncRandomAccessReadDevice.qbk] 61[include requirements/SyncRandomAccessWriteDevice.qbk] 62[include requirements/SyncReadStream.qbk] 63[include requirements/SyncWriteStream.qbk] 64[include requirements/TimeTraits.qbk] 65[include requirements/WaitHandler.qbk] 66[include requirements/WaitTraits.qbk] 67[include requirements/WriteHandler.qbk] 68 69 70[section:any_io_executor any_io_executor] 71 72[indexterm1 boost_asio.indexterm.any_io_executor..any_io_executor] 73 74 75Polymorphic executor type for use with I/O objects. 76 77 78 class any_io_executor : 79 public execution::any_executor< SupportableProperties > 80 81 82[heading Member Functions] 83[table 84 [[Name][Description]] 85 86 [ 87 [[link boost_asio.reference.any_io_executor.any_io_executor [*any_io_executor]] [constructor]] 88 [Default constructor. 89 [hr] 90 Construct in an empty state. Equivalent effects to default constructor. 91 [hr] 92 Copy constructor. 93 [hr] 94 Move constructor. 95 [hr] 96 Construct to point to the same target as another any_executor. 97 [hr] 98 Construct a polymorphic wrapper for the specified executor. ] 99 ] 100 101 [ 102 [[link boost_asio.reference.any_io_executor.context [*context]]] 103 [Obtain the underlying execution context. ] 104 ] 105 106 [ 107 [[link boost_asio.reference.any_io_executor.execute [*execute]]] 108 [Execute the function on the target executor. ] 109 ] 110 111 [ 112 [[link boost_asio.reference.any_io_executor.operator_bool [*operator bool]]] 113 [Determine whether the wrapper has a target executor. ] 114 ] 115 116 [ 117 [[link boost_asio.reference.any_io_executor.operator_eq_ [*operator=]]] 118 [Assignment operator. 119 [hr] 120 Move assignment operator. 121 [hr] 122 Assignment operator that sets the polymorphic wrapper to the empty state. ] 123 ] 124 125 [ 126 [[link boost_asio.reference.any_io_executor.prefer [*prefer]]] 127 [Obtain a polymorphic wrapper with the specified property. ] 128 ] 129 130 [ 131 [[link boost_asio.reference.any_io_executor.query [*query]]] 132 [Obtain the value associated with the specified property. ] 133 ] 134 135 [ 136 [[link boost_asio.reference.any_io_executor.require [*require]]] 137 [Obtain a polymorphic wrapper with the specified property. ] 138 ] 139 140 [ 141 [[link boost_asio.reference.any_io_executor.swap [*swap]]] 142 [Swap targets with another polymorphic wrapper. ] 143 ] 144 145 [ 146 [[link boost_asio.reference.any_io_executor.target [*target]]] 147 [Get a pointer to the target executor. ] 148 ] 149 150 [ 151 [[link boost_asio.reference.any_io_executor.target_type [*target_type]]] 152 [Get the type of the target executor. ] 153 ] 154 155 [ 156 [[link boost_asio.reference.any_io_executor._any_io_executor [*~any_io_executor]] [destructor]] 157 [Destructor. ] 158 ] 159 160] 161 162[heading Related Functions] 163[table 164 [[Name][Description]] 165 166 [ 167 [[link boost_asio.reference.any_io_executor.operator_not__eq_ [*operator!=]]] 168 [Inequality operator. ] 169 ] 170 171 [ 172 [[link boost_asio.reference.any_io_executor.operator_eq__eq_ [*operator==]]] 173 [Equality operator. ] 174 ] 175 176] 177 178The `any_io_executor` type is a polymorphic executor that supports the set of properties required by I/O objects. It is defined as the [link boost_asio.reference.execution__any_executor `execution::any_executor`] class template parameterised as follows: 179 180 execution::any_executor< 181 execution::context_as_t<execution_context&>, 182 execution::blocking_t::never_t, 183 execution::prefer_only<execution::blocking_t::possibly_t>, 184 execution::prefer_only<execution::outstanding_work_t::tracked_t>, 185 execution::prefer_only<execution::outstanding_work_t::untracked_t>, 186 execution::prefer_only<execution::relationship_t::fork_t>, 187 execution::prefer_only<execution::relationship_t::continuation_t> 188 > 189 190 191 192 193[heading Requirements] 194 195['Header: ][^boost/asio/any_io_executor.hpp] 196 197['Convenience header: ][^boost/asio.hpp] 198 199[section:any_io_executor any_io_executor::any_io_executor] 200 201[indexterm2 boost_asio.indexterm.any_io_executor.any_io_executor..any_io_executor..any_io_executor] 202Default constructor. 203 204 205 ``[link boost_asio.reference.any_io_executor.any_io_executor.overload1 any_io_executor]``(); 206 `` [''''»''' [link boost_asio.reference.any_io_executor.any_io_executor.overload1 more...]]`` 207 208 209Construct in an empty state. Equivalent effects to default constructor. 210 211 212 ``[link boost_asio.reference.any_io_executor.any_io_executor.overload2 any_io_executor]``( 213 nullptr_t ); 214 `` [''''»''' [link boost_asio.reference.any_io_executor.any_io_executor.overload2 more...]]`` 215 216 217Copy constructor. 218 219 220 ``[link boost_asio.reference.any_io_executor.any_io_executor.overload3 any_io_executor]``( 221 const any_io_executor & e); 222 `` [''''»''' [link boost_asio.reference.any_io_executor.any_io_executor.overload3 more...]]`` 223 224 225Move constructor. 226 227 228 ``[link boost_asio.reference.any_io_executor.any_io_executor.overload4 any_io_executor]``( 229 any_io_executor && e); 230 `` [''''»''' [link boost_asio.reference.any_io_executor.any_io_executor.overload4 more...]]`` 231 232 233Construct to point to the same target as another any\_executor. 234 235 236 template< 237 class... OtherSupportableProperties> 238 ``[link boost_asio.reference.any_io_executor.any_io_executor.overload5 any_io_executor]``( 239 execution::any_executor< OtherSupportableProperties...> e); 240 `` [''''»''' [link boost_asio.reference.any_io_executor.any_io_executor.overload5 more...]]`` 241 242 243Construct a polymorphic wrapper for the specified executor. 244 245 246 template< 247 BOOST_ASIO_EXECUTION_EXECUTOR ``[link boost_asio.reference.Executor1 Executor]``> 248 ``[link boost_asio.reference.any_io_executor.any_io_executor.overload6 any_io_executor]``( 249 Executor e); 250 `` [''''»''' [link boost_asio.reference.any_io_executor.any_io_executor.overload6 more...]]`` 251 252 253[section:overload1 any_io_executor::any_io_executor (1 of 6 overloads)] 254 255 256Default constructor. 257 258 259 any_io_executor(); 260 261 262 263[endsect] 264 265 266 267[section:overload2 any_io_executor::any_io_executor (2 of 6 overloads)] 268 269 270Construct in an empty state. Equivalent effects to default constructor. 271 272 273 any_io_executor( 274 nullptr_t ); 275 276 277 278[endsect] 279 280 281 282[section:overload3 any_io_executor::any_io_executor (3 of 6 overloads)] 283 284 285Copy constructor. 286 287 288 any_io_executor( 289 const any_io_executor & e); 290 291 292 293[endsect] 294 295 296 297[section:overload4 any_io_executor::any_io_executor (4 of 6 overloads)] 298 299 300Move constructor. 301 302 303 any_io_executor( 304 any_io_executor && e); 305 306 307 308[endsect] 309 310 311 312[section:overload5 any_io_executor::any_io_executor (5 of 6 overloads)] 313 314 315Construct to point to the same target as another any\_executor. 316 317 318 template< 319 class... OtherSupportableProperties> 320 any_io_executor( 321 execution::any_executor< OtherSupportableProperties...> e); 322 323 324 325[endsect] 326 327 328 329[section:overload6 any_io_executor::any_io_executor (6 of 6 overloads)] 330 331 332Construct a polymorphic wrapper for the specified executor. 333 334 335 template< 336 BOOST_ASIO_EXECUTION_EXECUTOR ``[link boost_asio.reference.Executor1 Executor]``> 337 any_io_executor( 338 Executor e); 339 340 341 342[endsect] 343 344 345[endsect] 346 347 348[section:context any_io_executor::context] 349 350 351['Inherited from execution::any_executor.] 352 353[indexterm2 boost_asio.indexterm.any_io_executor.context..context..any_io_executor] 354Obtain the underlying execution context. 355 356 357 automatically_determined context() const; 358 359 360This function is provided for backward compatibility. It is automatically defined when the `SupportableProperties`... list includes a property of type `execution::context_as<U>`, for some type `U`. 361 362 363[endsect] 364 365 366 367[section:execute any_io_executor::execute] 368 369 370['Inherited from execution::any_executor.] 371 372[indexterm2 boost_asio.indexterm.any_io_executor.execute..execute..any_io_executor] 373Execute the function on the target executor. 374 375 376 template< 377 typename Function> 378 void execute( 379 Function && f) const; 380 381 382Do not call this function directly. It is intended for use with the [link boost_asio.reference.execution__execute `execution::execute`] customisation point. 383 384For example: 385 386 execution::any_executor<> ex = ...; 387 execution::execute(ex, my_function_object); 388 389 390 391 392Throws [link boost_asio.reference.bad_executor `bad_executor`] if the polymorphic wrapper has no target. 393 394 395[endsect] 396 397 398 399[section:operator_bool any_io_executor::operator bool] 400 401 402['Inherited from execution::any_executor.] 403 404[indexterm2 boost_asio.indexterm.any_io_executor.operator_bool..operator bool..any_io_executor] 405Determine whether the wrapper has a target executor. 406 407 408 operator bool() const; 409 410 411 412[heading Return Value] 413 414`true` if the polymorphic wrapper has a target executor, otherwise false. 415 416 417 418 419[endsect] 420 421 422[section:operator_not__eq_ any_io_executor::operator!=] 423 424[indexterm2 boost_asio.indexterm.any_io_executor.operator_not__eq_..operator!=..any_io_executor] 425Inequality operator. 426 427 428 bool ``[link boost_asio.reference.any_io_executor.operator_not__eq_.overload1 operator!=]``( 429 const any_executor< SupportableProperties...> & a, 430 const any_executor< SupportableProperties...> & b); 431 `` [''''»''' [link boost_asio.reference.any_io_executor.operator_not__eq_.overload1 more...]]`` 432 433 bool ``[link boost_asio.reference.any_io_executor.operator_not__eq_.overload2 operator!=]``( 434 const any_executor< SupportableProperties...> & a, 435 nullptr_t ); 436 `` [''''»''' [link boost_asio.reference.any_io_executor.operator_not__eq_.overload2 more...]]`` 437 438 bool ``[link boost_asio.reference.any_io_executor.operator_not__eq_.overload3 operator!=]``( 439 nullptr_t , 440 const any_executor< SupportableProperties...> & b); 441 `` [''''»''' [link boost_asio.reference.any_io_executor.operator_not__eq_.overload3 more...]]`` 442 443 444[section:overload1 any_io_executor::operator!= (1 of 3 overloads)] 445 446 447['Inherited from execution::any_executor.] 448 449 450Inequality operator. 451 452 453 bool operator!=( 454 const any_executor< SupportableProperties...> & a, 455 const any_executor< SupportableProperties...> & b); 456 457 458 459[endsect] 460 461 462 463[section:overload2 any_io_executor::operator!= (2 of 3 overloads)] 464 465 466['Inherited from execution::any_executor.] 467 468 469Inequality operator. 470 471 472 bool operator!=( 473 const any_executor< SupportableProperties...> & a, 474 nullptr_t ); 475 476 477 478[endsect] 479 480 481 482[section:overload3 any_io_executor::operator!= (3 of 3 overloads)] 483 484 485['Inherited from execution::any_executor.] 486 487 488Inequality operator. 489 490 491 bool operator!=( 492 nullptr_t , 493 const any_executor< SupportableProperties...> & b); 494 495 496 497[endsect] 498 499 500[endsect] 501 502[section:operator_eq_ any_io_executor::operator=] 503 504[indexterm2 boost_asio.indexterm.any_io_executor.operator_eq_..operator=..any_io_executor] 505Assignment operator. 506 507 508 any_io_executor & ``[link boost_asio.reference.any_io_executor.operator_eq_.overload1 operator=]``( 509 const any_io_executor & e); 510 `` [''''»''' [link boost_asio.reference.any_io_executor.operator_eq_.overload1 more...]]`` 511 512 513Move assignment operator. 514 515 516 any_io_executor & ``[link boost_asio.reference.any_io_executor.operator_eq_.overload2 operator=]``( 517 any_io_executor && e); 518 `` [''''»''' [link boost_asio.reference.any_io_executor.operator_eq_.overload2 more...]]`` 519 520 521Assignment operator that sets the polymorphic wrapper to the empty state. 522 523 524 any_io_executor & ``[link boost_asio.reference.any_io_executor.operator_eq_.overload3 operator=]``( 525 nullptr_t ); 526 `` [''''»''' [link boost_asio.reference.any_io_executor.operator_eq_.overload3 more...]]`` 527 528 529[section:overload1 any_io_executor::operator= (1 of 3 overloads)] 530 531 532Assignment operator. 533 534 535 any_io_executor & operator=( 536 const any_io_executor & e); 537 538 539 540[endsect] 541 542 543 544[section:overload2 any_io_executor::operator= (2 of 3 overloads)] 545 546 547Move assignment operator. 548 549 550 any_io_executor & operator=( 551 any_io_executor && e); 552 553 554 555[endsect] 556 557 558 559[section:overload3 any_io_executor::operator= (3 of 3 overloads)] 560 561 562Assignment operator that sets the polymorphic wrapper to the empty state. 563 564 565 any_io_executor & operator=( 566 nullptr_t ); 567 568 569 570[endsect] 571 572 573[endsect] 574 575[section:operator_eq__eq_ any_io_executor::operator==] 576 577[indexterm2 boost_asio.indexterm.any_io_executor.operator_eq__eq_..operator==..any_io_executor] 578Equality operator. 579 580 581 bool ``[link boost_asio.reference.any_io_executor.operator_eq__eq_.overload1 operator==]``( 582 const any_executor< SupportableProperties...> & a, 583 const any_executor< SupportableProperties...> & b); 584 `` [''''»''' [link boost_asio.reference.any_io_executor.operator_eq__eq_.overload1 more...]]`` 585 586 bool ``[link boost_asio.reference.any_io_executor.operator_eq__eq_.overload2 operator==]``( 587 const any_executor< SupportableProperties...> & a, 588 nullptr_t ); 589 `` [''''»''' [link boost_asio.reference.any_io_executor.operator_eq__eq_.overload2 more...]]`` 590 591 bool ``[link boost_asio.reference.any_io_executor.operator_eq__eq_.overload3 operator==]``( 592 nullptr_t , 593 const any_executor< SupportableProperties...> & b); 594 `` [''''»''' [link boost_asio.reference.any_io_executor.operator_eq__eq_.overload3 more...]]`` 595 596 597[section:overload1 any_io_executor::operator== (1 of 3 overloads)] 598 599 600['Inherited from execution::any_executor.] 601 602 603Equality operator. 604 605 606 bool operator==( 607 const any_executor< SupportableProperties...> & a, 608 const any_executor< SupportableProperties...> & b); 609 610 611 612[endsect] 613 614 615 616[section:overload2 any_io_executor::operator== (2 of 3 overloads)] 617 618 619['Inherited from execution::any_executor.] 620 621 622Equality operator. 623 624 625 bool operator==( 626 const any_executor< SupportableProperties...> & a, 627 nullptr_t ); 628 629 630 631[endsect] 632 633 634 635[section:overload3 any_io_executor::operator== (3 of 3 overloads)] 636 637 638['Inherited from execution::any_executor.] 639 640 641Equality operator. 642 643 644 bool operator==( 645 nullptr_t , 646 const any_executor< SupportableProperties...> & b); 647 648 649 650[endsect] 651 652 653[endsect] 654 655[section:prefer any_io_executor::prefer] 656 657[indexterm2 boost_asio.indexterm.any_io_executor.prefer..prefer..any_io_executor] 658Obtain a polymorphic wrapper with the specified property. 659 660 661 template< 662 typename Property> 663 any_io_executor ``[link boost_asio.reference.any_io_executor.prefer.overload1 prefer]``( 664 const Property & p, 665 typename constraint< traits::prefer_member< const base_type &, const Property & >::is_valid >::type = 0) const; 666 `` [''''»''' [link boost_asio.reference.any_io_executor.prefer.overload1 more...]]`` 667 668 template< 669 typename Property> 670 any_executor ``[link boost_asio.reference.any_io_executor.prefer.overload2 prefer]``( 671 Property ) const; 672 `` [''''»''' [link boost_asio.reference.any_io_executor.prefer.overload2 more...]]`` 673 674 675[section:overload1 any_io_executor::prefer (1 of 2 overloads)] 676 677 678Obtain a polymorphic wrapper with the specified property. 679 680 681 template< 682 typename Property> 683 any_io_executor prefer( 684 const Property & p, 685 typename constraint< traits::prefer_member< const base_type &, const Property & >::is_valid >::type = 0) const; 686 687 688Do not call this function directly. It is intended for use with the [link boost_asio.reference.prefer `prefer`] customisation point. 689 690For example: 691 692 any_io_executor ex = ...; 693 auto ex2 = boost::asio::prefer(ex, execution::blocking.possibly); 694 695 696 697 698 699[endsect] 700 701 702 703[section:overload2 any_io_executor::prefer (2 of 2 overloads)] 704 705 706['Inherited from execution::any_executor.] 707 708 709Obtain a polymorphic wrapper with the specified property. 710 711 712 template< 713 typename Property> 714 any_executor prefer( 715 Property ) const; 716 717 718Do not call this function directly. It is intended for use with the [link boost_asio.reference.prefer `prefer`] customisation point. 719 720For example: 721 722 execution::any_executor<execution::blocking_t::possibly_t> ex = ...; 723 auto ex2 = boost::asio::prefer(ex, execution::blocking.possibly); 724 725 726 727 728 729[endsect] 730 731 732[endsect] 733 734 735[section:query any_io_executor::query] 736 737 738['Inherited from execution::any_executor.] 739 740[indexterm2 boost_asio.indexterm.any_io_executor.query..query..any_io_executor] 741Obtain the value associated with the specified property. 742 743 744 template< 745 typename Property> 746 Property::polymorphic_query_result_type query( 747 Property ) const; 748 749 750Do not call this function directly. It is intended for use with the [link boost_asio.reference.query `query`] customisation point. 751 752For example: 753 754 execution::any_executor<execution::occupancy_t> ex = ...; 755 size_t n = boost::asio::query(ex, execution::occupancy); 756 757 758 759 760 761[endsect] 762 763 764[section:require any_io_executor::require] 765 766[indexterm2 boost_asio.indexterm.any_io_executor.require..require..any_io_executor] 767Obtain a polymorphic wrapper with the specified property. 768 769 770 template< 771 typename Property> 772 any_io_executor ``[link boost_asio.reference.any_io_executor.require.overload1 require]``( 773 const Property & p, 774 typename constraint< traits::require_member< const base_type &, const Property & >::is_valid >::type = 0) const; 775 `` [''''»''' [link boost_asio.reference.any_io_executor.require.overload1 more...]]`` 776 777 template< 778 typename Property> 779 any_executor ``[link boost_asio.reference.any_io_executor.require.overload2 require]``( 780 Property ) const; 781 `` [''''»''' [link boost_asio.reference.any_io_executor.require.overload2 more...]]`` 782 783 784[section:overload1 any_io_executor::require (1 of 2 overloads)] 785 786 787Obtain a polymorphic wrapper with the specified property. 788 789 790 template< 791 typename Property> 792 any_io_executor require( 793 const Property & p, 794 typename constraint< traits::require_member< const base_type &, const Property & >::is_valid >::type = 0) const; 795 796 797Do not call this function directly. It is intended for use with the [link boost_asio.reference.require `require`] and [link boost_asio.reference.prefer `prefer`] customisation points. 798 799For example: 800 801 any_io_executor ex = ...; 802 auto ex2 = boost::asio::require(ex, execution::blocking.possibly); 803 804 805 806 807 808[endsect] 809 810 811 812[section:overload2 any_io_executor::require (2 of 2 overloads)] 813 814 815['Inherited from execution::any_executor.] 816 817 818Obtain a polymorphic wrapper with the specified property. 819 820 821 template< 822 typename Property> 823 any_executor require( 824 Property ) const; 825 826 827Do not call this function directly. It is intended for use with the [link boost_asio.reference.require `require`] and [link boost_asio.reference.prefer `prefer`] customisation points. 828 829For example: 830 831 execution::any_executor<execution::blocking_t::possibly_t> ex = ...; 832 auto ex2 = boost::asio::requre(ex, execution::blocking.possibly); 833 834 835 836 837 838[endsect] 839 840 841[endsect] 842 843[section:swap any_io_executor::swap] 844 845[indexterm2 boost_asio.indexterm.any_io_executor.swap..swap..any_io_executor] 846Swap targets with another polymorphic wrapper. 847 848 849 void ``[link boost_asio.reference.any_io_executor.swap.overload1 swap]``( 850 any_io_executor & other); 851 `` [''''»''' [link boost_asio.reference.any_io_executor.swap.overload1 more...]]`` 852 853 void ``[link boost_asio.reference.any_io_executor.swap.overload2 swap]``( 854 any_executor & other); 855 `` [''''»''' [link boost_asio.reference.any_io_executor.swap.overload2 more...]]`` 856 857 858[section:overload1 any_io_executor::swap (1 of 2 overloads)] 859 860 861Swap targets with another polymorphic wrapper. 862 863 864 void swap( 865 any_io_executor & other); 866 867 868 869[endsect] 870 871 872 873[section:overload2 any_io_executor::swap (2 of 2 overloads)] 874 875 876['Inherited from execution::any_executor.] 877 878 879Swap targets with another polymorphic wrapper. 880 881 882 void swap( 883 any_executor & other); 884 885 886 887[endsect] 888 889 890[endsect] 891 892[section:target any_io_executor::target] 893 894[indexterm2 boost_asio.indexterm.any_io_executor.target..target..any_io_executor] 895Get a pointer to the target executor. 896 897 898 template< 899 typename ``[link boost_asio.reference.Executor1 Executor]``> 900 Executor * ``[link boost_asio.reference.any_io_executor.target.overload1 target]``(); 901 `` [''''»''' [link boost_asio.reference.any_io_executor.target.overload1 more...]]`` 902 903 template< 904 typename ``[link boost_asio.reference.Executor1 Executor]``> 905 const Executor * ``[link boost_asio.reference.any_io_executor.target.overload2 target]``() const; 906 `` [''''»''' [link boost_asio.reference.any_io_executor.target.overload2 more...]]`` 907 908 909[section:overload1 any_io_executor::target (1 of 2 overloads)] 910 911 912['Inherited from execution::any_executor.] 913 914 915Get a pointer to the target executor. 916 917 918 template< 919 typename ``[link boost_asio.reference.Executor1 Executor]``> 920 Executor * target(); 921 922 923 924[endsect] 925 926 927 928[section:overload2 any_io_executor::target (2 of 2 overloads)] 929 930 931['Inherited from execution::any_executor.] 932 933 934Get a pointer to the target executor. 935 936 937 template< 938 typename ``[link boost_asio.reference.Executor1 Executor]``> 939 const Executor * target() const; 940 941 942 943[endsect] 944 945 946[endsect] 947 948 949[section:target_type any_io_executor::target_type] 950 951 952['Inherited from execution::any_executor.] 953 954[indexterm2 boost_asio.indexterm.any_io_executor.target_type..target_type..any_io_executor] 955Get the type of the target executor. 956 957 958 const type_info & target_type() const; 959 960 961 962[endsect] 963 964 965 966[section:_any_io_executor any_io_executor::~any_io_executor] 967 968[indexterm2 boost_asio.indexterm.any_io_executor._any_io_executor..~any_io_executor..any_io_executor] 969Destructor. 970 971 972 ~any_io_executor(); 973 974 975 976[endsect] 977 978 979 980[endsect] 981 982 983[section:asio_handler_allocate asio_handler_allocate] 984 985[indexterm1 boost_asio.indexterm.asio_handler_allocate..asio_handler_allocate] 986(Deprecated: Use the [link boost_asio.reference.associated_allocator `associated_allocator`] trait.) Default allocation function for handlers. 987 988 989 asio_handler_allocate_is_deprecated asio_handler_allocate( 990 std::size_t size, 991 ... ); 992 993 994Asynchronous 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. 995 996Implement asio\_handler\_allocate and asio\_handler\_deallocate for your own handlers to provide custom allocation for these temporary objects. 997 998The default implementation of these allocation hooks uses `operator new` and `operator delete`. 999 1000 1001[heading Remarks] 1002 1003All 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. 1004 1005 1006[heading Example] 1007 1008 1009 1010 class my_handler; 1011 1012 void* asio_handler_allocate(std::size_t size, my_handler* context) 1013 { 1014 return ::operator new(size); 1015 } 1016 1017 void asio_handler_deallocate(void* pointer, std::size_t size, 1018 my_handler* context) 1019 { 1020 ::operator delete(pointer); 1021 } 1022 1023 1024 1025 1026 1027 1028[heading Requirements] 1029 1030['Header: ][^boost/asio/handler_alloc_hook.hpp] 1031 1032['Convenience header: ][^boost/asio.hpp] 1033 1034 1035[endsect] 1036 1037 1038 1039[section:asio_handler_deallocate asio_handler_deallocate] 1040 1041[indexterm1 boost_asio.indexterm.asio_handler_deallocate..asio_handler_deallocate] 1042Default deallocation function for handlers. 1043 1044 1045 asio_handler_deallocate_is_deprecated asio_handler_deallocate( 1046 void * pointer, 1047 std::size_t size, 1048 ... ); 1049 1050 1051Implement asio\_handler\_allocate and asio\_handler\_deallocate for your own handlers to provide custom allocation for the associated temporary objects. 1052 1053The default implementation of these allocation hooks uses `operator new` and `operator delete`. 1054 1055 1056 1057 1058[heading Requirements] 1059 1060['Header: ][^boost/asio/handler_alloc_hook.hpp] 1061 1062['Convenience header: ][^boost/asio.hpp] 1063 1064 1065[endsect] 1066 1067 1068[section:asio_handler_invoke asio_handler_invoke] 1069 1070[indexterm1 boost_asio.indexterm.asio_handler_invoke..asio_handler_invoke] 1071(Deprecated: Use the [link boost_asio.reference.associated_executor `associated_executor`] trait.) Default invoke function for handlers. 1072 1073 1074Default handler invocation hook used for non-const function objects. 1075 1076 template< 1077 typename Function> 1078 asio_handler_invoke_is_deprecated ``[link boost_asio.reference.asio_handler_invoke.overload1 asio_handler_invoke]``( 1079 Function & function, 1080 ... ); 1081 `` [''''»''' [link boost_asio.reference.asio_handler_invoke.overload1 more...]]`` 1082 1083Default handler invocation hook used for const function objects. 1084 1085 template< 1086 typename Function> 1087 asio_handler_invoke_is_deprecated ``[link boost_asio.reference.asio_handler_invoke.overload2 asio_handler_invoke]``( 1088 const Function & function, 1089 ... ); 1090 `` [''''»''' [link boost_asio.reference.asio_handler_invoke.overload2 more...]]`` 1091 1092Completion 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. 1093 1094When 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. 1095 1096Implement asio\_handler\_invoke for your own handlers to specify a custom invocation strategy. 1097 1098This default implementation invokes the function object like so: 1099 1100 function(); 1101 1102 1103If necessary, the default implementation makes a copy of the function object so that the non-const operator() can be used. 1104 1105 1106[heading Example] 1107 1108 1109 1110 class my_handler; 1111 1112 template <typename Function> 1113 void asio_handler_invoke(Function function, my_handler* context) 1114 { 1115 context->strand_.dispatch(function); 1116 } 1117 1118 1119 1120 1121 1122 1123[heading Requirements] 1124 1125['Header: ][^boost/asio/handler_invoke_hook.hpp] 1126 1127['Convenience header: ][^boost/asio.hpp] 1128 1129 1130[section:overload1 asio_handler_invoke (1 of 2 overloads)] 1131 1132 1133Default handler invocation hook used for non-const function objects. 1134 1135 1136 template< 1137 typename Function> 1138 asio_handler_invoke_is_deprecated asio_handler_invoke( 1139 Function & function, 1140 ... ); 1141 1142 1143 1144[endsect] 1145 1146 1147 1148[section:overload2 asio_handler_invoke (2 of 2 overloads)] 1149 1150 1151Default handler invocation hook used for const function objects. 1152 1153 1154 template< 1155 typename Function> 1156 asio_handler_invoke_is_deprecated asio_handler_invoke( 1157 const Function & function, 1158 ... ); 1159 1160 1161 1162[endsect] 1163 1164 1165[endsect] 1166 1167 1168[section:asio_handler_is_continuation asio_handler_is_continuation] 1169 1170[indexterm1 boost_asio.indexterm.asio_handler_is_continuation..asio_handler_is_continuation] 1171Default continuation function for handlers. 1172 1173 1174 bool asio_handler_is_continuation( 1175 ... ); 1176 1177 1178Asynchronous 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. 1179 1180Implement asio\_handler\_is\_continuation for your own handlers to indicate when a handler represents a continuation. 1181 1182The default implementation of the continuation hook returns `false`. 1183 1184 1185[heading Example] 1186 1187 1188 1189 class my_handler; 1190 1191 bool asio_handler_is_continuation(my_handler* context) 1192 { 1193 return true; 1194 } 1195 1196 1197 1198 1199 1200 1201[heading Requirements] 1202 1203['Header: ][^boost/asio/handler_continuation_hook.hpp] 1204 1205['Convenience header: ][^boost/asio.hpp] 1206 1207 1208[endsect] 1209 1210 1211[section:associated_allocator associated_allocator] 1212 1213[indexterm1 boost_asio.indexterm.associated_allocator..associated_allocator] 1214 1215 1216Traits type used to obtain the allocator associated with an object. 1217 1218 1219 template< 1220 typename T, 1221 typename Allocator = std::allocator<void>> 1222 struct associated_allocator 1223 1224 1225[heading Types] 1226[table 1227 [[Name][Description]] 1228 1229 [ 1230 1231 [[link boost_asio.reference.associated_allocator.type [*type]]] 1232 [If T has a nested type allocator_type, T::allocator_type. Otherwise Allocator. ] 1233 1234 ] 1235 1236] 1237 1238[heading Member Functions] 1239[table 1240 [[Name][Description]] 1241 1242 [ 1243 [[link boost_asio.reference.associated_allocator.get [*get]] [static]] 1244 [If T has a nested type allocator_type, returns t.get_allocator(). Otherwise returns a. ] 1245 ] 1246 1247] 1248 1249A 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. 1250 1251Specialisations 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`. 1252 1253 1254* Provide a nested typedef `type` that identifies a type meeting the Allocator requirements. 1255 1256 1257* Provide a noexcept static member function named `get`, callable as `get(t)` and with return type `type`. 1258 1259 1260* Provide a noexcept static member function named `get`, callable as `get(t,a)` and with return type `type`. 1261 1262 1263 1264[heading Requirements] 1265 1266['Header: ][^boost/asio/associated_allocator.hpp] 1267 1268['Convenience header: ][^boost/asio.hpp] 1269 1270 1271[section:get associated_allocator::get] 1272 1273[indexterm2 boost_asio.indexterm.associated_allocator.get..get..associated_allocator] 1274If `T` has a nested type `allocator_type`, returns `t.get_allocator()`. Otherwise returns `a`. 1275 1276 1277 static type get( 1278 const T & t, 1279 const Allocator & a = Allocator()); 1280 1281 1282 1283[endsect] 1284 1285 1286 1287[section:type associated_allocator::type] 1288 1289[indexterm2 boost_asio.indexterm.associated_allocator.type..type..associated_allocator] 1290If `T` has a nested type `allocator_type`, `T::allocator_type`. Otherwise `Allocator`. 1291 1292 1293 typedef see_below type; 1294 1295 1296 1297[heading Requirements] 1298 1299['Header: ][^boost/asio/associated_allocator.hpp] 1300 1301['Convenience header: ][^boost/asio.hpp] 1302 1303 1304[endsect] 1305 1306 1307 1308[endsect] 1309 1310[section:associated_executor associated_executor] 1311 1312[indexterm1 boost_asio.indexterm.associated_executor..associated_executor] 1313 1314 1315Traits type used to obtain the executor associated with an object. 1316 1317 1318 template< 1319 typename T, 1320 typename ``[link boost_asio.reference.Executor1 Executor]`` = system_executor> 1321 struct associated_executor 1322 1323 1324[heading Types] 1325[table 1326 [[Name][Description]] 1327 1328 [ 1329 1330 [[link boost_asio.reference.associated_executor.type [*type]]] 1331 [If T has a nested type executor_type, T::executor_type. Otherwise Executor. ] 1332 1333 ] 1334 1335] 1336 1337[heading Member Functions] 1338[table 1339 [[Name][Description]] 1340 1341 [ 1342 [[link boost_asio.reference.associated_executor.get [*get]] [static]] 1343 [If T has a nested type executor_type, returns t.get_executor(). Otherwise returns ex. ] 1344 ] 1345 1346] 1347 1348A 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. 1349 1350Specialisations 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`. 1351 1352 1353* Provide a nested typedef `type` that identifies a type meeting the Executor requirements. 1354 1355 1356* Provide a noexcept static member function named `get`, callable as `get(t)` and with return type `type`. 1357 1358 1359* Provide a noexcept static member function named `get`, callable as `get(t,e)` and with return type `type`. 1360 1361 1362 1363[heading Requirements] 1364 1365['Header: ][^boost/asio/associated_executor.hpp] 1366 1367['Convenience header: ][^boost/asio.hpp] 1368 1369 1370[section:get associated_executor::get] 1371 1372[indexterm2 boost_asio.indexterm.associated_executor.get..get..associated_executor] 1373If `T` has a nested type `executor_type`, returns `t.get_executor()`. Otherwise returns `ex`. 1374 1375 1376 static type get( 1377 const T & t, 1378 const Executor & ex = Executor()); 1379 1380 1381 1382[endsect] 1383 1384 1385 1386[section:type associated_executor::type] 1387 1388[indexterm2 boost_asio.indexterm.associated_executor.type..type..associated_executor] 1389If `T` has a nested type `executor_type`, `T::executor_type`. Otherwise `Executor`. 1390 1391 1392 typedef see_below type; 1393 1394 1395 1396[heading Requirements] 1397 1398['Header: ][^boost/asio/associated_executor.hpp] 1399 1400['Convenience header: ][^boost/asio.hpp] 1401 1402 1403[endsect] 1404 1405 1406 1407[endsect] 1408 1409[section:async_completion async_completion] 1410 1411[indexterm1 boost_asio.indexterm.async_completion..async_completion] 1412 1413 1414Helper 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. 1415 1416 1417 template< 1418 typename CompletionToken, 1419 typename Signature> 1420 struct async_completion 1421 1422 1423[heading Types] 1424[table 1425 [[Name][Description]] 1426 1427 [ 1428 1429 [[link boost_asio.reference.async_completion.completion_handler_type [*completion_handler_type]]] 1430 [The real handler type to be used for the asynchronous operation. ] 1431 1432 ] 1433 1434] 1435 1436[heading Member Functions] 1437[table 1438 [[Name][Description]] 1439 1440 [ 1441 [[link boost_asio.reference.async_completion.async_completion [*async_completion]] [constructor]] 1442 [Constructor. ] 1443 ] 1444 1445] 1446 1447[heading Data Members] 1448[table 1449 [[Name][Description]] 1450 1451 [ 1452 [[link boost_asio.reference.async_completion.completion_handler [*completion_handler]]] 1453 [A copy of, or reference to, a real handler object. ] 1454 ] 1455 1456 [ 1457 [[link boost_asio.reference.async_completion.result [*result]]] 1458 [The result of the asynchronous operation's initiating function. ] 1459 ] 1460 1461] 1462 1463[heading Requirements] 1464 1465['Header: ][^boost/asio/async_result.hpp] 1466 1467['Convenience header: ][^boost/asio.hpp] 1468 1469 1470[section:async_completion async_completion::async_completion] 1471 1472[indexterm2 boost_asio.indexterm.async_completion.async_completion..async_completion..async_completion] 1473Constructor. 1474 1475 1476 async_completion( 1477 CompletionToken & token); 1478 1479 1480The constructor creates the concrete completion handler and makes the link between the handler and the asynchronous result. 1481 1482 1483[endsect] 1484 1485 1486 1487[section:completion_handler async_completion::completion_handler] 1488 1489[indexterm2 boost_asio.indexterm.async_completion.completion_handler..completion_handler..async_completion] 1490A copy of, or reference to, a real handler object. 1491 1492 1493 conditional< is_same< CompletionToken, completion_handler_type >::value, completion_handler_type &, completion_handler_type >::type completion_handler; 1494 1495 1496 1497[endsect] 1498 1499 1500 1501[section:completion_handler_type async_completion::completion_handler_type] 1502 1503[indexterm2 boost_asio.indexterm.async_completion.completion_handler_type..completion_handler_type..async_completion] 1504The real handler type to be used for the asynchronous operation. 1505 1506 1507 typedef boost::asio::async_result< typename decay< CompletionToken >::type, Signature >::completion_handler_type completion_handler_type; 1508 1509 1510[heading Types] 1511[table 1512 [[Name][Description]] 1513 1514 [ 1515 1516 [[link boost_asio.reference.async_result.completion_handler_type [*completion_handler_type]]] 1517 [The concrete completion handler type for the specific signature. ] 1518 1519 ] 1520 1521 [ 1522 1523 [[link boost_asio.reference.async_result.return_type [*return_type]]] 1524 [The return type of the initiating function. ] 1525 1526 ] 1527 1528] 1529 1530[heading Member Functions] 1531[table 1532 [[Name][Description]] 1533 1534 [ 1535 [[link boost_asio.reference.async_result.async_result [*async_result]] [constructor]] 1536 [Construct an async result from a given handler. ] 1537 ] 1538 1539 [ 1540 [[link boost_asio.reference.async_result.get [*get]]] 1541 [Obtain the value to be returned from the initiating function. ] 1542 ] 1543 1544 [ 1545 [[link boost_asio.reference.async_result.initiate [*initiate]] [static]] 1546 [Initiate the asynchronous operation that will produce the result, and obtain the value to be returned from the initiating function. ] 1547 ] 1548 1549] 1550 1551The [link boost_asio.reference.async_result `async_result`] traits class is used for determining: 1552 1553 1554* the concrete completion handler type to be called at the end of the asynchronous operation; 1555 1556 1557* the initiating function return type; and 1558 1559 1560* how the return value of the initiating function is obtained. 1561 1562The trait allows the handler and return types to be determined at the point where the specific completion handler signature is known. 1563 1564This template may be specialised for user-defined completion token types. The primary template assumes that the CompletionToken is the completion handler. 1565 1566 1567[heading Requirements] 1568 1569['Header: ][^boost/asio/async_result.hpp] 1570 1571['Convenience header: ][^boost/asio.hpp] 1572 1573 1574[endsect] 1575 1576 1577 1578[section:result async_completion::result] 1579 1580[indexterm2 boost_asio.indexterm.async_completion.result..result..async_completion] 1581The result of the asynchronous operation's initiating function. 1582 1583 1584 async_result< typename decay< CompletionToken >::type, Signature > result; 1585 1586 1587 1588[endsect] 1589 1590 1591 1592[endsect] 1593 1594 1595[section:async_compose async_compose] 1596 1597[indexterm1 boost_asio.indexterm.async_compose..async_compose] 1598Launch an asynchronous operation with a stateful implementation. 1599 1600 1601 template< 1602 typename CompletionToken, 1603 typename Signature, 1604 typename Implementation, 1605 typename... IoObjectsOrExecutors> 1606 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_compose( 1607 Implementation && implementation, 1608 CompletionToken & token, 1609 IoObjectsOrExecutors &&... io_objects_or_executors); 1610 1611 1612The async\_compose function simplifies the implementation of composed asynchronous operations automatically wrapping a stateful function object with a conforming intermediate completion handler. 1613 1614 1615[heading Parameters] 1616 1617 1618[variablelist 1619 1620[[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.]] 1621 1622[[token][The completion token.]] 1623 1624[[io_objects_or_executors][Zero or more I/O objects or I/O executors for which outstanding work must be maintained.]] 1625 1626] 1627 1628 1629[heading Example:] 1630 1631 1632 1633 1634 1635 struct async_echo_implementation 1636 { 1637 tcp::socket& socket_; 1638 boost::asio::mutable_buffer buffer_; 1639 enum { starting, reading, writing } state_; 1640 1641 template <typename Self> 1642 void operator()(Self& self, 1643 boost::system::error_code error = {}, 1644 std::size_t n = 0) 1645 { 1646 switch (state_) 1647 { 1648 case starting: 1649 state_ = reading; 1650 socket_.async_read_some( 1651 buffer_, std::move(self)); 1652 break; 1653 case reading: 1654 if (error) 1655 { 1656 self.complete(error, 0); 1657 } 1658 else 1659 { 1660 state_ = writing; 1661 boost::asio::async_write(socket_, buffer_, 1662 boost::asio::transfer_exactly(n), 1663 std::move(self)); 1664 } 1665 break; 1666 case writing: 1667 self.complete(error, n); 1668 break; 1669 } 1670 } 1671 }; 1672 1673 template <typename CompletionToken> 1674 auto async_echo(tcp::socket& socket, 1675 boost::asio::mutable_buffer buffer, 1676 CompletionToken&& token) -> 1677 typename boost::asio::async_result< 1678 typename std::decay<CompletionToken>::type, 1679 void(boost::system::error_code, std::size_t)>::return_type 1680 { 1681 return boost::asio::async_compose<CompletionToken, 1682 void(boost::system::error_code, std::size_t)>( 1683 async_echo_implementation{socket, buffer, 1684 async_echo_implementation::starting}, 1685 token, socket); 1686 } 1687 1688 1689 1690 1691[heading Requirements] 1692 1693['Header: ][^boost/asio/compose.hpp] 1694 1695['Convenience header: ][^boost/asio.hpp] 1696 1697 1698[endsect] 1699 1700 1701[section:async_connect async_connect] 1702 1703[indexterm1 boost_asio.indexterm.async_connect..async_connect] 1704The `async_connect` function is a composed asynchronous operation that establishes a socket connection by trying each endpoint in a sequence. 1705 1706 1707Asynchronously establishes a socket connection by trying each endpoint in a sequence. 1708 1709 template< 1710 typename ``[link boost_asio.reference.Protocol Protocol]``, 1711 typename ``[link boost_asio.reference.Executor1 Executor]``, 1712 typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``, 1713 typename ``[link boost_asio.reference.RangeConnectHandler RangeConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 1714 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_connect.overload1 async_connect]``( 1715 basic_socket< Protocol, Executor > & s, 1716 const EndpointSequence & endpoints, 1717 RangeConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 1718 typename constraint< is_endpoint_sequence< EndpointSequence >::value >::type = 0); 1719 `` [''''»''' [link boost_asio.reference.async_connect.overload1 more...]]`` 1720 1721(Deprecated: Use range overload.) Asynchronously establishes a socket connection by trying each endpoint in a sequence. 1722 1723 template< 1724 typename ``[link boost_asio.reference.Protocol Protocol]``, 1725 typename ``[link boost_asio.reference.Executor1 Executor]``, 1726 typename Iterator, 1727 typename ``[link boost_asio.reference.IteratorConnectHandler IteratorConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 1728 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_connect.overload2 async_connect]``( 1729 basic_socket< Protocol, Executor > & s, 1730 Iterator begin, 1731 IteratorConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 1732 typename constraint<!is_endpoint_sequence< Iterator >::value >::type = 0); 1733 `` [''''»''' [link boost_asio.reference.async_connect.overload2 more...]]`` 1734 1735Asynchronously establishes a socket connection by trying each endpoint in a sequence. 1736 1737 template< 1738 typename ``[link boost_asio.reference.Protocol Protocol]``, 1739 typename ``[link boost_asio.reference.Executor1 Executor]``, 1740 typename Iterator, 1741 typename ``[link boost_asio.reference.IteratorConnectHandler IteratorConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 1742 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_connect.overload3 async_connect]``( 1743 basic_socket< Protocol, Executor > & s, 1744 Iterator begin, 1745 Iterator end, 1746 IteratorConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 1747 `` [''''»''' [link boost_asio.reference.async_connect.overload3 more...]]`` 1748 1749 template< 1750 typename ``[link boost_asio.reference.Protocol Protocol]``, 1751 typename ``[link boost_asio.reference.Executor1 Executor]``, 1752 typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``, 1753 typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``, 1754 typename ``[link boost_asio.reference.RangeConnectHandler RangeConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 1755 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_connect.overload4 async_connect]``( 1756 basic_socket< Protocol, Executor > & s, 1757 const EndpointSequence & endpoints, 1758 ConnectCondition connect_condition, 1759 RangeConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 1760 typename constraint< is_endpoint_sequence< EndpointSequence >::value >::type = 0); 1761 `` [''''»''' [link boost_asio.reference.async_connect.overload4 more...]]`` 1762 1763(Deprecated: Use range overload.) Asynchronously establishes a socket connection by trying each endpoint in a sequence. 1764 1765 template< 1766 typename ``[link boost_asio.reference.Protocol Protocol]``, 1767 typename ``[link boost_asio.reference.Executor1 Executor]``, 1768 typename Iterator, 1769 typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``, 1770 typename ``[link boost_asio.reference.IteratorConnectHandler IteratorConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 1771 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_connect.overload5 async_connect]``( 1772 basic_socket< Protocol, Executor > & s, 1773 Iterator begin, 1774 ConnectCondition connect_condition, 1775 IteratorConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 1776 typename constraint<!is_endpoint_sequence< Iterator >::value >::type = 0); 1777 `` [''''»''' [link boost_asio.reference.async_connect.overload5 more...]]`` 1778 1779Asynchronously establishes a socket connection by trying each endpoint in a sequence. 1780 1781 template< 1782 typename ``[link boost_asio.reference.Protocol Protocol]``, 1783 typename ``[link boost_asio.reference.Executor1 Executor]``, 1784 typename Iterator, 1785 typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``, 1786 typename ``[link boost_asio.reference.IteratorConnectHandler IteratorConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 1787 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_connect.overload6 async_connect]``( 1788 basic_socket< Protocol, Executor > & s, 1789 Iterator begin, 1790 Iterator end, 1791 ConnectCondition connect_condition, 1792 IteratorConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 1793 `` [''''»''' [link boost_asio.reference.async_connect.overload6 more...]]`` 1794 1795[heading Requirements] 1796 1797['Header: ][^boost/asio/connect.hpp] 1798 1799['Convenience header: ][^boost/asio.hpp] 1800 1801 1802[section:overload1 async_connect (1 of 6 overloads)] 1803 1804 1805Asynchronously establishes a socket connection by trying each endpoint in a sequence. 1806 1807 1808 template< 1809 typename ``[link boost_asio.reference.Protocol Protocol]``, 1810 typename ``[link boost_asio.reference.Executor1 Executor]``, 1811 typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``, 1812 typename ``[link boost_asio.reference.RangeConnectHandler RangeConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 1813 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect( 1814 basic_socket< Protocol, Executor > & s, 1815 const EndpointSequence & endpoints, 1816 RangeConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 1817 typename constraint< is_endpoint_sequence< EndpointSequence >::value >::type = 0); 1818 1819 1820This 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. 1821 1822 1823[heading Parameters] 1824 1825 1826[variablelist 1827 1828[[s][The socket to be connected. If the socket is already open, it will be closed.]] 1829 1830[[endpoints][A sequence of endpoints.]] 1831 1832[[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: 1833`` 1834 void handler( 1835 // Result of operation. if the sequence is empty, set to 1836 // boost::asio::error::not_found. Otherwise, contains the 1837 // error from the last connection attempt. 1838 const boost::system::error_code& error, 1839 1840 // On success, the successfully connected endpoint. 1841 // Otherwise, a default-constructed endpoint. 1842 const typename Protocol::endpoint& endpoint 1843 ); 1844`` 1845Regardless 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`].]] 1846 1847] 1848 1849 1850[heading Example] 1851 1852 1853 1854 tcp::resolver r(my_context); 1855 tcp::resolver::query q("host", "service"); 1856 tcp::socket s(my_context); 1857 1858 // ... 1859 1860 r.async_resolve(q, resolve_handler); 1861 1862 // ... 1863 1864 void resolve_handler( 1865 const boost::system::error_code& ec, 1866 tcp::resolver::results_type results) 1867 { 1868 if (!ec) 1869 { 1870 boost::asio::async_connect(s, results, connect_handler); 1871 } 1872 } 1873 1874 // ... 1875 1876 void connect_handler( 1877 const boost::system::error_code& ec, 1878 const tcp::endpoint& endpoint) 1879 { 1880 // ... 1881 } 1882 1883 1884 1885 1886 1887 1888 1889[endsect] 1890 1891 1892 1893[section:overload2 async_connect (2 of 6 overloads)] 1894 1895 1896(Deprecated: Use range overload.) Asynchronously establishes a socket connection by trying each endpoint in a sequence. 1897 1898 1899 template< 1900 typename ``[link boost_asio.reference.Protocol Protocol]``, 1901 typename ``[link boost_asio.reference.Executor1 Executor]``, 1902 typename Iterator, 1903 typename ``[link boost_asio.reference.IteratorConnectHandler IteratorConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 1904 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect( 1905 basic_socket< Protocol, Executor > & s, 1906 Iterator begin, 1907 IteratorConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 1908 typename constraint<!is_endpoint_sequence< Iterator >::value >::type = 0); 1909 1910 1911This 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. 1912 1913 1914[heading Parameters] 1915 1916 1917[variablelist 1918 1919[[s][The socket to be connected. If the socket is already open, it will be closed.]] 1920 1921[[begin][An iterator pointing to the start of a sequence of endpoints.]] 1922 1923[[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: 1924`` 1925 void handler( 1926 // Result of operation. if the sequence is empty, set to 1927 // boost::asio::error::not_found. Otherwise, contains the 1928 // error from the last connection attempt. 1929 const boost::system::error_code& error, 1930 1931 // On success, an iterator denoting the successfully 1932 // connected endpoint. Otherwise, the end iterator. 1933 Iterator iterator 1934 ); 1935`` 1936Regardless 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`].]] 1937 1938] 1939 1940 1941[heading Remarks] 1942 1943This 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`. 1944 1945 1946 1947 1948[endsect] 1949 1950 1951 1952[section:overload3 async_connect (3 of 6 overloads)] 1953 1954 1955Asynchronously establishes a socket connection by trying each endpoint in a sequence. 1956 1957 1958 template< 1959 typename ``[link boost_asio.reference.Protocol Protocol]``, 1960 typename ``[link boost_asio.reference.Executor1 Executor]``, 1961 typename Iterator, 1962 typename ``[link boost_asio.reference.IteratorConnectHandler IteratorConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 1963 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect( 1964 basic_socket< Protocol, Executor > & s, 1965 Iterator begin, 1966 Iterator end, 1967 IteratorConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 1968 1969 1970This 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. 1971 1972 1973[heading Parameters] 1974 1975 1976[variablelist 1977 1978[[s][The socket to be connected. If the socket is already open, it will be closed.]] 1979 1980[[begin][An iterator pointing to the start of a sequence of endpoints.]] 1981 1982[[end][An iterator pointing to the end of a sequence of endpoints.]] 1983 1984[[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: 1985`` 1986 void handler( 1987 // Result of operation. if the sequence is empty, set to 1988 // boost::asio::error::not_found. Otherwise, contains the 1989 // error from the last connection attempt. 1990 const boost::system::error_code& error, 1991 1992 // On success, an iterator denoting the successfully 1993 // connected endpoint. Otherwise, the end iterator. 1994 Iterator iterator 1995 ); 1996`` 1997Regardless 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`].]] 1998 1999] 2000 2001 2002[heading Example] 2003 2004 2005 2006 std::vector<tcp::endpoint> endpoints = ...; 2007 tcp::socket s(my_context); 2008 boost::asio::async_connect(s, 2009 endpoints.begin(), endpoints.end(), 2010 connect_handler); 2011 2012 // ... 2013 2014 void connect_handler( 2015 const boost::system::error_code& ec, 2016 std::vector<tcp::endpoint>::iterator i) 2017 { 2018 // ... 2019 } 2020 2021 2022 2023 2024 2025 2026 2027[endsect] 2028 2029 2030 2031[section:overload4 async_connect (4 of 6 overloads)] 2032 2033 2034Asynchronously establishes a socket connection by trying each endpoint in a sequence. 2035 2036 2037 template< 2038 typename ``[link boost_asio.reference.Protocol Protocol]``, 2039 typename ``[link boost_asio.reference.Executor1 Executor]``, 2040 typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``, 2041 typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``, 2042 typename ``[link boost_asio.reference.RangeConnectHandler RangeConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 2043 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect( 2044 basic_socket< Protocol, Executor > & s, 2045 const EndpointSequence & endpoints, 2046 ConnectCondition connect_condition, 2047 RangeConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 2048 typename constraint< is_endpoint_sequence< EndpointSequence >::value >::type = 0); 2049 2050 2051This 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. 2052 2053 2054[heading Parameters] 2055 2056 2057[variablelist 2058 2059[[s][The socket to be connected. If the socket is already open, it will be closed.]] 2060 2061[[endpoints][A sequence of endpoints.]] 2062 2063[[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be: 2064`` 2065 bool connect_condition( 2066 const boost::system::error_code& ec, 2067 const typename Protocol::endpoint& next); 2068`` 2069The `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.]] 2070 2071[[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: 2072`` 2073 void handler( 2074 // Result of operation. if the sequence is empty, set to 2075 // boost::asio::error::not_found. Otherwise, contains the 2076 // error from the last connection attempt. 2077 const boost::system::error_code& error, 2078 2079 // On success, an iterator denoting the successfully 2080 // connected endpoint. Otherwise, the end iterator. 2081 Iterator iterator 2082 ); 2083`` 2084Regardless 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`].]] 2085 2086] 2087 2088 2089[heading Example] 2090 2091The following connect condition function object can be used to output information about the individual connection attempts: 2092 2093 struct my_connect_condition 2094 { 2095 bool operator()( 2096 const boost::system::error_code& ec, 2097 const::tcp::endpoint& next) 2098 { 2099 if (ec) std::cout << "Error: " << ec.message() << std::endl; 2100 std::cout << "Trying: " << next << std::endl; 2101 return true; 2102 } 2103 }; 2104 2105 2106It would be used with the `boost::asio::connect` function as follows: 2107 2108 tcp::resolver r(my_context); 2109 tcp::resolver::query q("host", "service"); 2110 tcp::socket s(my_context); 2111 2112 // ... 2113 2114 r.async_resolve(q, resolve_handler); 2115 2116 // ... 2117 2118 void resolve_handler( 2119 const boost::system::error_code& ec, 2120 tcp::resolver::results_type results) 2121 { 2122 if (!ec) 2123 { 2124 boost::asio::async_connect(s, results, 2125 my_connect_condition(), 2126 connect_handler); 2127 } 2128 } 2129 2130 // ... 2131 2132 void connect_handler( 2133 const boost::system::error_code& ec, 2134 const tcp::endpoint& endpoint) 2135 { 2136 if (ec) 2137 { 2138 // An error occurred. 2139 } 2140 else 2141 { 2142 std::cout << "Connected to: " << endpoint << std::endl; 2143 } 2144 } 2145 2146 2147 2148 2149 2150 2151 2152[endsect] 2153 2154 2155 2156[section:overload5 async_connect (5 of 6 overloads)] 2157 2158 2159(Deprecated: Use range overload.) Asynchronously establishes a socket connection by trying each endpoint in a sequence. 2160 2161 2162 template< 2163 typename ``[link boost_asio.reference.Protocol Protocol]``, 2164 typename ``[link boost_asio.reference.Executor1 Executor]``, 2165 typename Iterator, 2166 typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``, 2167 typename ``[link boost_asio.reference.IteratorConnectHandler IteratorConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 2168 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect( 2169 basic_socket< Protocol, Executor > & s, 2170 Iterator begin, 2171 ConnectCondition connect_condition, 2172 IteratorConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 2173 typename constraint<!is_endpoint_sequence< Iterator >::value >::type = 0); 2174 2175 2176This 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. 2177 2178 2179[heading Parameters] 2180 2181 2182[variablelist 2183 2184[[s][The socket to be connected. If the socket is already open, it will be closed.]] 2185 2186[[begin][An iterator pointing to the start of a sequence of endpoints.]] 2187 2188[[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be: 2189`` 2190 bool connect_condition( 2191 const boost::system::error_code& ec, 2192 const typename Protocol::endpoint& next); 2193`` 2194The `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.]] 2195 2196[[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: 2197`` 2198 void handler( 2199 // Result of operation. if the sequence is empty, set to 2200 // boost::asio::error::not_found. Otherwise, contains the 2201 // error from the last connection attempt. 2202 const boost::system::error_code& error, 2203 2204 // On success, an iterator denoting the successfully 2205 // connected endpoint. Otherwise, the end iterator. 2206 Iterator iterator 2207 ); 2208`` 2209Regardless 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`].]] 2210 2211] 2212 2213 2214[heading Remarks] 2215 2216This 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`. 2217 2218 2219 2220 2221[endsect] 2222 2223 2224 2225[section:overload6 async_connect (6 of 6 overloads)] 2226 2227 2228Asynchronously establishes a socket connection by trying each endpoint in a sequence. 2229 2230 2231 template< 2232 typename ``[link boost_asio.reference.Protocol Protocol]``, 2233 typename ``[link boost_asio.reference.Executor1 Executor]``, 2234 typename Iterator, 2235 typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``, 2236 typename ``[link boost_asio.reference.IteratorConnectHandler IteratorConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 2237 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect( 2238 basic_socket< Protocol, Executor > & s, 2239 Iterator begin, 2240 Iterator end, 2241 ConnectCondition connect_condition, 2242 IteratorConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 2243 2244 2245This 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. 2246 2247 2248[heading Parameters] 2249 2250 2251[variablelist 2252 2253[[s][The socket to be connected. If the socket is already open, it will be closed.]] 2254 2255[[begin][An iterator pointing to the start of a sequence of endpoints.]] 2256 2257[[end][An iterator pointing to the end of a sequence of endpoints.]] 2258 2259[[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be: 2260`` 2261 bool connect_condition( 2262 const boost::system::error_code& ec, 2263 const typename Protocol::endpoint& next); 2264`` 2265The `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.]] 2266 2267[[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: 2268`` 2269 void handler( 2270 // Result of operation. if the sequence is empty, set to 2271 // boost::asio::error::not_found. Otherwise, contains the 2272 // error from the last connection attempt. 2273 const boost::system::error_code& error, 2274 2275 // On success, an iterator denoting the successfully 2276 // connected endpoint. Otherwise, the end iterator. 2277 Iterator iterator 2278 ); 2279`` 2280Regardless 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`].]] 2281 2282] 2283 2284 2285[heading Example] 2286 2287The following connect condition function object can be used to output information about the individual connection attempts: 2288 2289 struct my_connect_condition 2290 { 2291 bool operator()( 2292 const boost::system::error_code& ec, 2293 const::tcp::endpoint& next) 2294 { 2295 if (ec) std::cout << "Error: " << ec.message() << std::endl; 2296 std::cout << "Trying: " << next << std::endl; 2297 return true; 2298 } 2299 }; 2300 2301 2302It would be used with the `boost::asio::connect` function as follows: 2303 2304 tcp::resolver r(my_context); 2305 tcp::resolver::query q("host", "service"); 2306 tcp::socket s(my_context); 2307 2308 // ... 2309 2310 r.async_resolve(q, resolve_handler); 2311 2312 // ... 2313 2314 void resolve_handler( 2315 const boost::system::error_code& ec, 2316 tcp::resolver::iterator i) 2317 { 2318 if (!ec) 2319 { 2320 tcp::resolver::iterator end; 2321 boost::asio::async_connect(s, i, end, 2322 my_connect_condition(), 2323 connect_handler); 2324 } 2325 } 2326 2327 // ... 2328 2329 void connect_handler( 2330 const boost::system::error_code& ec, 2331 tcp::resolver::iterator i) 2332 { 2333 if (ec) 2334 { 2335 // An error occurred. 2336 } 2337 else 2338 { 2339 std::cout << "Connected to: " << i->endpoint() << std::endl; 2340 } 2341 } 2342 2343 2344 2345 2346 2347 2348 2349[endsect] 2350 2351 2352[endsect] 2353 2354 2355[section:async_initiate async_initiate] 2356 2357[indexterm1 boost_asio.indexterm.async_initiate..async_initiate] 2358 2359 template< 2360 typename CompletionToken, 2361 completion_signature Signature, 2362 typename Initiation, 2363 typename... Args> 2364 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_initiate( 2365 Initiation && initiation, 2366 CompletionToken & , 2367 Args &&... args); 2368 2369 2370[heading Requirements] 2371 2372['Header: ][^boost/asio/async_result.hpp] 2373 2374['Convenience header: ][^boost/asio.hpp] 2375 2376 2377[endsect] 2378 2379 2380[section:async_read async_read] 2381 2382[indexterm1 boost_asio.indexterm.async_read..async_read] 2383The `async_read` function is a composed asynchronous operation that reads a certain amount of data from a stream before completion. 2384 2385 2386Start an asynchronous operation to read a certain amount of data from a stream. 2387 2388 template< 2389 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 2390 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 2391 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 2392 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read.overload1 async_read]``( 2393 AsyncReadStream & s, 2394 const MutableBufferSequence & buffers, 2395 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 2396 typename constraint< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type = 0); 2397 `` [''''»''' [link boost_asio.reference.async_read.overload1 more...]]`` 2398 2399 template< 2400 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 2401 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 2402 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, 2403 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 2404 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read.overload2 async_read]``( 2405 AsyncReadStream & s, 2406 const MutableBufferSequence & buffers, 2407 CompletionCondition completion_condition, 2408 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 2409 typename constraint< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type = 0); 2410 `` [''''»''' [link boost_asio.reference.async_read.overload2 more...]]`` 2411 2412 template< 2413 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 2414 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``, 2415 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 2416 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read.overload3 async_read]``( 2417 AsyncReadStream & s, 2418 DynamicBuffer_v1 && buffers, 2419 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 2420 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 2421 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 2422 `` [''''»''' [link boost_asio.reference.async_read.overload3 more...]]`` 2423 2424 template< 2425 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 2426 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``, 2427 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, 2428 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 2429 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read.overload4 async_read]``( 2430 AsyncReadStream & s, 2431 DynamicBuffer_v1 && buffers, 2432 CompletionCondition completion_condition, 2433 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 2434 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 2435 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 2436 `` [''''»''' [link boost_asio.reference.async_read.overload4 more...]]`` 2437 2438 template< 2439 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 2440 typename Allocator, 2441 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 2442 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read.overload5 async_read]``( 2443 AsyncReadStream & s, 2444 basic_streambuf< Allocator > & b, 2445 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 2446 `` [''''»''' [link boost_asio.reference.async_read.overload5 more...]]`` 2447 2448 template< 2449 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 2450 typename Allocator, 2451 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, 2452 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 2453 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read.overload6 async_read]``( 2454 AsyncReadStream & s, 2455 basic_streambuf< Allocator > & b, 2456 CompletionCondition completion_condition, 2457 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 2458 `` [''''»''' [link boost_asio.reference.async_read.overload6 more...]]`` 2459 2460 template< 2461 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 2462 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``, 2463 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 2464 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read.overload7 async_read]``( 2465 AsyncReadStream & s, 2466 DynamicBuffer_v2 buffers, 2467 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 2468 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 2469 `` [''''»''' [link boost_asio.reference.async_read.overload7 more...]]`` 2470 2471 template< 2472 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 2473 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``, 2474 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, 2475 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 2476 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read.overload8 async_read]``( 2477 AsyncReadStream & s, 2478 DynamicBuffer_v2 buffers, 2479 CompletionCondition completion_condition, 2480 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 2481 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 2482 `` [''''»''' [link boost_asio.reference.async_read.overload8 more...]]`` 2483 2484[heading Requirements] 2485 2486['Header: ][^boost/asio/read.hpp] 2487 2488['Convenience header: ][^boost/asio.hpp] 2489 2490 2491[section:overload1 async_read (1 of 8 overloads)] 2492 2493 2494Start an asynchronous operation to read a certain amount of data from a stream. 2495 2496 2497 template< 2498 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 2499 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 2500 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 2501 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read( 2502 AsyncReadStream & s, 2503 const MutableBufferSequence & buffers, 2504 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 2505 typename constraint< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type = 0); 2506 2507 2508This 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: 2509 2510 2511* The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes. 2512 2513 2514* An error occurred. 2515 2516This 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. 2517 2518 2519[heading Parameters] 2520 2521 2522[variablelist 2523 2524[[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]] 2525 2526[[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.]] 2527 2528[[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: 2529`` 2530 void handler( 2531 const boost::system::error_code& error, // Result of operation. 2532 2533 std::size_t bytes_transferred // Number of bytes copied into the 2534 // buffers. If an error occurred, 2535 // this will be the number of 2536 // bytes successfully transferred 2537 // prior to the error. 2538 ); 2539`` 2540Regardless 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`].]] 2541 2542] 2543 2544 2545[heading Example] 2546 2547To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 2548 2549 boost::asio::async_read(s, boost::asio::buffer(data, size), handler); 2550 2551 2552See 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. 2553 2554 2555[heading Remarks] 2556 2557This overload is equivalent to calling: 2558 2559 boost::asio::async_read( 2560 s, buffers, 2561 boost::asio::transfer_all(), 2562 handler); 2563 2564 2565 2566 2567 2568 2569 2570[endsect] 2571 2572 2573 2574[section:overload2 async_read (2 of 8 overloads)] 2575 2576 2577Start an asynchronous operation to read a certain amount of data from a stream. 2578 2579 2580 template< 2581 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 2582 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 2583 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, 2584 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 2585 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read( 2586 AsyncReadStream & s, 2587 const MutableBufferSequence & buffers, 2588 CompletionCondition completion_condition, 2589 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 2590 typename constraint< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type = 0); 2591 2592 2593This 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: 2594 2595 2596* The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes. 2597 2598 2599* The completion\_condition function object returns 0. 2600 2601 2602[heading Parameters] 2603 2604 2605[variablelist 2606 2607[[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]] 2608 2609[[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.]] 2610 2611[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 2612`` 2613 std::size_t completion_condition( 2614 // Result of latest async_read_some operation. 2615 const boost::system::error_code& error, 2616 2617 // Number of bytes transferred so far. 2618 std::size_t bytes_transferred 2619 ); 2620`` 2621A 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.]] 2622 2623[[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: 2624`` 2625 void handler( 2626 const boost::system::error_code& error, // Result of operation. 2627 2628 std::size_t bytes_transferred // Number of bytes copied into the 2629 // buffers. If an error occurred, 2630 // this will be the number of 2631 // bytes successfully transferred 2632 // prior to the error. 2633 ); 2634`` 2635Regardless 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`].]] 2636 2637] 2638 2639 2640[heading Example] 2641 2642To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 2643 2644 boost::asio::async_read(s, 2645 boost::asio::buffer(data, size), 2646 boost::asio::transfer_at_least(32), 2647 handler); 2648 2649 2650See 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. 2651 2652 2653 2654 2655[endsect] 2656 2657 2658 2659[section:overload3 async_read (3 of 8 overloads)] 2660 2661 2662Start an asynchronous operation to read a certain amount of data from a stream. 2663 2664 2665 template< 2666 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 2667 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``, 2668 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 2669 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read( 2670 AsyncReadStream & s, 2671 DynamicBuffer_v1 && buffers, 2672 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 2673 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 2674 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 2675 2676 2677This 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: 2678 2679 2680* The specified dynamic buffer sequence is full (that is, it has reached maximum size). 2681 2682 2683* An error occurred. 2684 2685This 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. 2686 2687 2688[heading Parameters] 2689 2690 2691[variablelist 2692 2693[[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]] 2694 2695[[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.]] 2696 2697[[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: 2698`` 2699 void handler( 2700 const boost::system::error_code& error, // Result of operation. 2701 2702 std::size_t bytes_transferred // Number of bytes copied into the 2703 // buffers. If an error occurred, 2704 // this will be the number of 2705 // bytes successfully transferred 2706 // prior to the error. 2707 ); 2708`` 2709Regardless 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`].]] 2710 2711] 2712 2713 2714[heading Remarks] 2715 2716This overload is equivalent to calling: 2717 2718 boost::asio::async_read( 2719 s, buffers, 2720 boost::asio::transfer_all(), 2721 handler); 2722 2723 2724 2725 2726 2727 2728 2729[endsect] 2730 2731 2732 2733[section:overload4 async_read (4 of 8 overloads)] 2734 2735 2736Start an asynchronous operation to read a certain amount of data from a stream. 2737 2738 2739 template< 2740 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 2741 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``, 2742 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, 2743 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 2744 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read( 2745 AsyncReadStream & s, 2746 DynamicBuffer_v1 && buffers, 2747 CompletionCondition completion_condition, 2748 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 2749 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 2750 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 2751 2752 2753This 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: 2754 2755 2756* The specified dynamic buffer sequence is full (that is, it has reached maximum size). 2757 2758 2759* The completion\_condition function object returns 0. 2760 2761This 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. 2762 2763 2764[heading Parameters] 2765 2766 2767[variablelist 2768 2769[[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]] 2770 2771[[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.]] 2772 2773[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 2774`` 2775 std::size_t completion_condition( 2776 // Result of latest async_read_some operation. 2777 const boost::system::error_code& error, 2778 2779 // Number of bytes transferred so far. 2780 std::size_t bytes_transferred 2781 ); 2782`` 2783A 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.]] 2784 2785[[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: 2786`` 2787 void handler( 2788 const boost::system::error_code& error, // Result of operation. 2789 2790 std::size_t bytes_transferred // Number of bytes copied into the 2791 // buffers. If an error occurred, 2792 // this will be the number of 2793 // bytes successfully transferred 2794 // prior to the error. 2795 ); 2796`` 2797Regardless 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`]. ]] 2798 2799] 2800 2801 2802 2803 2804[endsect] 2805 2806 2807 2808[section:overload5 async_read (5 of 8 overloads)] 2809 2810 2811Start an asynchronous operation to read a certain amount of data from a stream. 2812 2813 2814 template< 2815 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 2816 typename Allocator, 2817 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 2818 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read( 2819 AsyncReadStream & s, 2820 basic_streambuf< Allocator > & b, 2821 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 2822 2823 2824This 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: 2825 2826 2827* The supplied buffer is full (that is, it has reached maximum size). 2828 2829 2830* An error occurred. 2831 2832This 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. 2833 2834 2835[heading Parameters] 2836 2837 2838[variablelist 2839 2840[[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]] 2841 2842[[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.]] 2843 2844[[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: 2845`` 2846 void handler( 2847 const boost::system::error_code& error, // Result of operation. 2848 2849 std::size_t bytes_transferred // Number of bytes copied into the 2850 // buffers. If an error occurred, 2851 // this will be the number of 2852 // bytes successfully transferred 2853 // prior to the error. 2854 ); 2855`` 2856Regardless 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`].]] 2857 2858] 2859 2860 2861[heading Remarks] 2862 2863This overload is equivalent to calling: 2864 2865 boost::asio::async_read( 2866 s, b, 2867 boost::asio::transfer_all(), 2868 handler); 2869 2870 2871 2872 2873 2874 2875 2876[endsect] 2877 2878 2879 2880[section:overload6 async_read (6 of 8 overloads)] 2881 2882 2883Start an asynchronous operation to read a certain amount of data from a stream. 2884 2885 2886 template< 2887 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 2888 typename Allocator, 2889 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, 2890 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 2891 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read( 2892 AsyncReadStream & s, 2893 basic_streambuf< Allocator > & b, 2894 CompletionCondition completion_condition, 2895 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 2896 2897 2898This 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: 2899 2900 2901* The supplied buffer is full (that is, it has reached maximum size). 2902 2903 2904* The completion\_condition function object returns 0. 2905 2906This 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. 2907 2908 2909[heading Parameters] 2910 2911 2912[variablelist 2913 2914[[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]] 2915 2916[[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.]] 2917 2918[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 2919`` 2920 std::size_t completion_condition( 2921 // Result of latest async_read_some operation. 2922 const boost::system::error_code& error, 2923 2924 // Number of bytes transferred so far. 2925 std::size_t bytes_transferred 2926 ); 2927`` 2928A 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.]] 2929 2930[[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: 2931`` 2932 void handler( 2933 const boost::system::error_code& error, // Result of operation. 2934 2935 std::size_t bytes_transferred // Number of bytes copied into the 2936 // buffers. If an error occurred, 2937 // this will be the number of 2938 // bytes successfully transferred 2939 // prior to the error. 2940 ); 2941`` 2942Regardless 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`]. ]] 2943 2944] 2945 2946 2947 2948 2949[endsect] 2950 2951 2952 2953[section:overload7 async_read (7 of 8 overloads)] 2954 2955 2956Start an asynchronous operation to read a certain amount of data from a stream. 2957 2958 2959 template< 2960 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 2961 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``, 2962 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 2963 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read( 2964 AsyncReadStream & s, 2965 DynamicBuffer_v2 buffers, 2966 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 2967 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 2968 2969 2970This 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: 2971 2972 2973* The specified dynamic buffer sequence is full (that is, it has reached maximum size). 2974 2975 2976* An error occurred. 2977 2978This 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. 2979 2980 2981[heading Parameters] 2982 2983 2984[variablelist 2985 2986[[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]] 2987 2988[[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.]] 2989 2990[[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: 2991`` 2992 void handler( 2993 const boost::system::error_code& error, // Result of operation. 2994 2995 std::size_t bytes_transferred // Number of bytes copied into the 2996 // buffers. If an error occurred, 2997 // this will be the number of 2998 // bytes successfully transferred 2999 // prior to the error. 3000 ); 3001`` 3002Regardless 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`].]] 3003 3004] 3005 3006 3007[heading Remarks] 3008 3009This overload is equivalent to calling: 3010 3011 boost::asio::async_read( 3012 s, buffers, 3013 boost::asio::transfer_all(), 3014 handler); 3015 3016 3017 3018 3019 3020 3021 3022[endsect] 3023 3024 3025 3026[section:overload8 async_read (8 of 8 overloads)] 3027 3028 3029Start an asynchronous operation to read a certain amount of data from a stream. 3030 3031 3032 template< 3033 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 3034 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``, 3035 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, 3036 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 3037 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read( 3038 AsyncReadStream & s, 3039 DynamicBuffer_v2 buffers, 3040 CompletionCondition completion_condition, 3041 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 3042 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 3043 3044 3045This 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: 3046 3047 3048* The specified dynamic buffer sequence is full (that is, it has reached maximum size). 3049 3050 3051* The completion\_condition function object returns 0. 3052 3053This 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. 3054 3055 3056[heading Parameters] 3057 3058 3059[variablelist 3060 3061[[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]] 3062 3063[[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.]] 3064 3065[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 3066`` 3067 std::size_t completion_condition( 3068 // Result of latest async_read_some operation. 3069 const boost::system::error_code& error, 3070 3071 // Number of bytes transferred so far. 3072 std::size_t bytes_transferred 3073 ); 3074`` 3075A 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.]] 3076 3077[[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: 3078`` 3079 void handler( 3080 const boost::system::error_code& error, // Result of operation. 3081 3082 std::size_t bytes_transferred // Number of bytes copied into the 3083 // buffers. If an error occurred, 3084 // this will be the number of 3085 // bytes successfully transferred 3086 // prior to the error. 3087 ); 3088`` 3089Regardless 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`]. ]] 3090 3091] 3092 3093 3094 3095 3096[endsect] 3097 3098 3099[endsect] 3100 3101[section:async_read_at async_read_at] 3102 3103[indexterm1 boost_asio.indexterm.async_read_at..async_read_at] 3104The `async_read_at` function is a composed asynchronous operation that reads a certain amount of data at the specified offset. 3105 3106 3107Start an asynchronous operation to read a certain amount of data at the specified offset. 3108 3109 template< 3110 typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``, 3111 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 3112 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 3113 ``[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]``( 3114 AsyncRandomAccessReadDevice & d, 3115 uint64_t offset, 3116 const MutableBufferSequence & buffers, 3117 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 3118 `` [''''»''' [link boost_asio.reference.async_read_at.overload1 more...]]`` 3119 3120 template< 3121 typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``, 3122 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 3123 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, 3124 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 3125 ``[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]``( 3126 AsyncRandomAccessReadDevice & d, 3127 uint64_t offset, 3128 const MutableBufferSequence & buffers, 3129 CompletionCondition completion_condition, 3130 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 3131 `` [''''»''' [link boost_asio.reference.async_read_at.overload2 more...]]`` 3132 3133 template< 3134 typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``, 3135 typename Allocator, 3136 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 3137 ``[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]``( 3138 AsyncRandomAccessReadDevice & d, 3139 uint64_t offset, 3140 basic_streambuf< Allocator > & b, 3141 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 3142 `` [''''»''' [link boost_asio.reference.async_read_at.overload3 more...]]`` 3143 3144 template< 3145 typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``, 3146 typename Allocator, 3147 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, 3148 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 3149 ``[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]``( 3150 AsyncRandomAccessReadDevice & d, 3151 uint64_t offset, 3152 basic_streambuf< Allocator > & b, 3153 CompletionCondition completion_condition, 3154 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 3155 `` [''''»''' [link boost_asio.reference.async_read_at.overload4 more...]]`` 3156 3157[heading Requirements] 3158 3159['Header: ][^boost/asio/read_at.hpp] 3160 3161['Convenience header: ][^boost/asio.hpp] 3162 3163 3164[section:overload1 async_read_at (1 of 4 overloads)] 3165 3166 3167Start an asynchronous operation to read a certain amount of data at the specified offset. 3168 3169 3170 template< 3171 typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``, 3172 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 3173 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 3174 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_at( 3175 AsyncRandomAccessReadDevice & d, 3176 uint64_t offset, 3177 const MutableBufferSequence & buffers, 3178 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 3179 3180 3181This 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: 3182 3183 3184* The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes. 3185 3186 3187* An error occurred. 3188 3189This operation is implemented in terms of zero or more calls to the device's async\_read\_some\_at function. 3190 3191 3192[heading Parameters] 3193 3194 3195[variablelist 3196 3197[[d][The device from which the data is to be read. The type must support the AsyncRandomAccessReadDevice concept.]] 3198 3199[[offset][The offset at which the data will be read.]] 3200 3201[[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.]] 3202 3203[[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: 3204`` 3205 void handler( 3206 // Result of operation. 3207 const boost::system::error_code& error, 3208 3209 // Number of bytes copied into the buffers. If an error 3210 // occurred, this will be the number of bytes successfully 3211 // transferred prior to the error. 3212 std::size_t bytes_transferred 3213 ); 3214`` 3215Regardless 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`].]] 3216 3217] 3218 3219 3220[heading Example] 3221 3222To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 3223 3224 boost::asio::async_read_at(d, 42, boost::asio::buffer(data, size), handler); 3225 3226 3227See 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. 3228 3229 3230[heading Remarks] 3231 3232This overload is equivalent to calling: 3233 3234 boost::asio::async_read_at( 3235 d, 42, buffers, 3236 boost::asio::transfer_all(), 3237 handler); 3238 3239 3240 3241 3242 3243 3244 3245[endsect] 3246 3247 3248 3249[section:overload2 async_read_at (2 of 4 overloads)] 3250 3251 3252Start an asynchronous operation to read a certain amount of data at the specified offset. 3253 3254 3255 template< 3256 typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``, 3257 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 3258 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, 3259 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 3260 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_at( 3261 AsyncRandomAccessReadDevice & d, 3262 uint64_t offset, 3263 const MutableBufferSequence & buffers, 3264 CompletionCondition completion_condition, 3265 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 3266 3267 3268This 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: 3269 3270 3271* The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes. 3272 3273 3274* The completion\_condition function object returns 0. 3275 3276 3277[heading Parameters] 3278 3279 3280[variablelist 3281 3282[[d][The device from which the data is to be read. The type must support the AsyncRandomAccessReadDevice concept.]] 3283 3284[[offset][The offset at which the data will be read.]] 3285 3286[[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.]] 3287 3288[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 3289`` 3290 std::size_t completion_condition( 3291 // Result of latest async_read_some_at operation. 3292 const boost::system::error_code& error, 3293 3294 // Number of bytes transferred so far. 3295 std::size_t bytes_transferred 3296 ); 3297`` 3298A 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.]] 3299 3300[[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: 3301`` 3302 void handler( 3303 // Result of operation. 3304 const boost::system::error_code& error, 3305 3306 // Number of bytes copied into the buffers. If an error 3307 // occurred, this will be the number of bytes successfully 3308 // transferred prior to the error. 3309 std::size_t bytes_transferred 3310 ); 3311`` 3312Regardless 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`].]] 3313 3314] 3315 3316 3317[heading Example] 3318 3319To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 3320 3321 boost::asio::async_read_at(d, 42, 3322 boost::asio::buffer(data, size), 3323 boost::asio::transfer_at_least(32), 3324 handler); 3325 3326 3327See 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. 3328 3329 3330 3331 3332[endsect] 3333 3334 3335 3336[section:overload3 async_read_at (3 of 4 overloads)] 3337 3338 3339Start an asynchronous operation to read a certain amount of data at the specified offset. 3340 3341 3342 template< 3343 typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``, 3344 typename Allocator, 3345 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 3346 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_at( 3347 AsyncRandomAccessReadDevice & d, 3348 uint64_t offset, 3349 basic_streambuf< Allocator > & b, 3350 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 3351 3352 3353This 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: 3354 3355 3356* An error occurred. 3357 3358This operation is implemented in terms of zero or more calls to the device's async\_read\_some\_at function. 3359 3360 3361[heading Parameters] 3362 3363 3364[variablelist 3365 3366[[d][The device from which the data is to be read. The type must support the AsyncRandomAccessReadDevice concept.]] 3367 3368[[offset][The offset at which the data will be read.]] 3369 3370[[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.]] 3371 3372[[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: 3373`` 3374 void handler( 3375 // Result of operation. 3376 const boost::system::error_code& error, 3377 3378 // Number of bytes copied into the buffers. If an error 3379 // occurred, this will be the number of bytes successfully 3380 // transferred prior to the error. 3381 std::size_t bytes_transferred 3382 ); 3383`` 3384Regardless 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`].]] 3385 3386] 3387 3388 3389[heading Remarks] 3390 3391This overload is equivalent to calling: 3392 3393 boost::asio::async_read_at( 3394 d, 42, b, 3395 boost::asio::transfer_all(), 3396 handler); 3397 3398 3399 3400 3401 3402 3403 3404[endsect] 3405 3406 3407 3408[section:overload4 async_read_at (4 of 4 overloads)] 3409 3410 3411Start an asynchronous operation to read a certain amount of data at the specified offset. 3412 3413 3414 template< 3415 typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``, 3416 typename Allocator, 3417 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, 3418 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 3419 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_at( 3420 AsyncRandomAccessReadDevice & d, 3421 uint64_t offset, 3422 basic_streambuf< Allocator > & b, 3423 CompletionCondition completion_condition, 3424 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 3425 3426 3427This 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: 3428 3429 3430* The completion\_condition function object returns 0. 3431 3432This operation is implemented in terms of zero or more calls to the device's async\_read\_some\_at function. 3433 3434 3435[heading Parameters] 3436 3437 3438[variablelist 3439 3440[[d][The device from which the data is to be read. The type must support the AsyncRandomAccessReadDevice concept.]] 3441 3442[[offset][The offset at which the data will be read.]] 3443 3444[[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.]] 3445 3446[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 3447`` 3448 std::size_t completion_condition( 3449 // Result of latest async_read_some_at operation. 3450 const boost::system::error_code& error, 3451 3452 // Number of bytes transferred so far. 3453 std::size_t bytes_transferred 3454 ); 3455`` 3456A 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.]] 3457 3458[[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: 3459`` 3460 void handler( 3461 // Result of operation. 3462 const boost::system::error_code& error, 3463 3464 // Number of bytes copied into the buffers. If an error 3465 // occurred, this will be the number of bytes successfully 3466 // transferred prior to the error. 3467 std::size_t bytes_transferred 3468 ); 3469`` 3470Regardless 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`]. ]] 3471 3472] 3473 3474 3475 3476 3477[endsect] 3478 3479 3480[endsect] 3481 3482[section:async_read_until async_read_until] 3483 3484[indexterm1 boost_asio.indexterm.async_read_until..async_read_until] 3485The `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. 3486 3487 3488Start an asynchronous operation to read data into a dynamic buffer sequence until it contains a specified delimiter. 3489 3490 template< 3491 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 3492 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``, 3493 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 3494 ``[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]``( 3495 AsyncReadStream & s, 3496 DynamicBuffer_v1 && buffers, 3497 char delim, 3498 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 3499 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 3500 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 3501 `` [''''»''' [link boost_asio.reference.async_read_until.overload1 more...]]`` 3502 3503 template< 3504 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 3505 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``, 3506 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 3507 ``[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]``( 3508 AsyncReadStream & s, 3509 DynamicBuffer_v1 && buffers, 3510 string_view delim, 3511 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 3512 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 3513 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 3514 `` [''''»''' [link boost_asio.reference.async_read_until.overload2 more...]]`` 3515 3516Start an asynchronous operation to read data into a dynamic buffer sequence until some part of its data matches a regular expression. 3517 3518 template< 3519 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 3520 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``, 3521 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 3522 ``[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]``( 3523 AsyncReadStream & s, 3524 DynamicBuffer_v1 && buffers, 3525 const boost::regex & expr, 3526 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 3527 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 3528 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 3529 `` [''''»''' [link boost_asio.reference.async_read_until.overload3 more...]]`` 3530 3531Start an asynchronous operation to read data into a dynamic buffer sequence until a function object indicates a match. 3532 3533 template< 3534 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 3535 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``, 3536 typename MatchCondition, 3537 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 3538 ``[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]``( 3539 AsyncReadStream & s, 3540 DynamicBuffer_v1 && buffers, 3541 MatchCondition match_condition, 3542 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 3543 typename constraint< is_match_condition< MatchCondition >::value >::type = 0, 3544 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 3545 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 3546 `` [''''»''' [link boost_asio.reference.async_read_until.overload4 more...]]`` 3547 3548Start an asynchronous operation to read data into a streambuf until it contains a specified delimiter. 3549 3550 template< 3551 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 3552 typename Allocator, 3553 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 3554 ``[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]``( 3555 AsyncReadStream & s, 3556 boost::asio::basic_streambuf< Allocator > & b, 3557 char delim, 3558 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 3559 `` [''''»''' [link boost_asio.reference.async_read_until.overload5 more...]]`` 3560 3561 template< 3562 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 3563 typename Allocator, 3564 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 3565 ``[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]``( 3566 AsyncReadStream & s, 3567 boost::asio::basic_streambuf< Allocator > & b, 3568 string_view delim, 3569 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 3570 `` [''''»''' [link boost_asio.reference.async_read_until.overload6 more...]]`` 3571 3572Start an asynchronous operation to read data into a streambuf until some part of its data matches a regular expression. 3573 3574 template< 3575 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 3576 typename Allocator, 3577 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 3578 ``[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]``( 3579 AsyncReadStream & s, 3580 boost::asio::basic_streambuf< Allocator > & b, 3581 const boost::regex & expr, 3582 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 3583 `` [''''»''' [link boost_asio.reference.async_read_until.overload7 more...]]`` 3584 3585Start an asynchronous operation to read data into a streambuf until a function object indicates a match. 3586 3587 template< 3588 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 3589 typename Allocator, 3590 typename MatchCondition, 3591 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 3592 ``[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]``( 3593 AsyncReadStream & s, 3594 boost::asio::basic_streambuf< Allocator > & b, 3595 MatchCondition match_condition, 3596 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 3597 typename constraint< is_match_condition< MatchCondition >::value >::type = 0); 3598 `` [''''»''' [link boost_asio.reference.async_read_until.overload8 more...]]`` 3599 3600Start an asynchronous operation to read data into a dynamic buffer sequence until it contains a specified delimiter. 3601 3602 template< 3603 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 3604 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``, 3605 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 3606 ``[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]``( 3607 AsyncReadStream & s, 3608 DynamicBuffer_v2 buffers, 3609 char delim, 3610 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 3611 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 3612 `` [''''»''' [link boost_asio.reference.async_read_until.overload9 more...]]`` 3613 3614 template< 3615 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 3616 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``, 3617 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 3618 ``[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]``( 3619 AsyncReadStream & s, 3620 DynamicBuffer_v2 buffers, 3621 string_view delim, 3622 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 3623 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 3624 `` [''''»''' [link boost_asio.reference.async_read_until.overload10 more...]]`` 3625 3626Start an asynchronous operation to read data into a dynamic buffer sequence until some part of its data matches a regular expression. 3627 3628 template< 3629 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 3630 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``, 3631 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 3632 ``[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]``( 3633 AsyncReadStream & s, 3634 DynamicBuffer_v2 buffers, 3635 const boost::regex & expr, 3636 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 3637 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 3638 `` [''''»''' [link boost_asio.reference.async_read_until.overload11 more...]]`` 3639 3640Start an asynchronous operation to read data into a dynamic buffer sequence until a function object indicates a match. 3641 3642 template< 3643 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 3644 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``, 3645 typename MatchCondition, 3646 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 3647 ``[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]``( 3648 AsyncReadStream & s, 3649 DynamicBuffer_v2 buffers, 3650 MatchCondition match_condition, 3651 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 3652 typename constraint< is_match_condition< MatchCondition >::value >::type = 0, 3653 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 3654 `` [''''»''' [link boost_asio.reference.async_read_until.overload12 more...]]`` 3655 3656[heading Requirements] 3657 3658['Header: ][^boost/asio/read_until.hpp] 3659 3660['Convenience header: ][^boost/asio.hpp] 3661 3662 3663[section:overload1 async_read_until (1 of 12 overloads)] 3664 3665 3666Start an asynchronous operation to read data into a dynamic buffer sequence until it contains a specified delimiter. 3667 3668 3669 template< 3670 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 3671 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``, 3672 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 3673 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until( 3674 AsyncReadStream & s, 3675 DynamicBuffer_v1 && buffers, 3676 char delim, 3677 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 3678 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 3679 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 3680 3681 3682This 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: 3683 3684 3685* The get area of the dynamic buffer sequence contains the specified delimiter. 3686 3687 3688* An error occurred. 3689 3690This 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. 3691 3692 3693[heading Parameters] 3694 3695 3696[variablelist 3697 3698[[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]] 3699 3700[[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.]] 3701 3702[[delim][The delimiter character.]] 3703 3704[[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: 3705`` 3706 void handler( 3707 // Result of operation. 3708 const boost::system::error_code& error, 3709 3710 // The number of bytes in the dynamic buffer sequence's 3711 // get area up to and including the delimiter. 3712 // 0 if an error occurred. 3713 std::size_t bytes_transferred 3714 ); 3715`` 3716Regardless 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`].]] 3717 3718] 3719 3720 3721[heading Remarks] 3722 3723After 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. 3724 3725 3726[heading Example] 3727 3728To asynchronously read data into a `std::string` until a newline is encountered: 3729 3730 std::string data; 3731 ... 3732 void handler(const boost::system::error_code& e, std::size_t size) 3733 { 3734 if (!e) 3735 { 3736 std::string line = data.substr(0, n); 3737 data.erase(0, n); 3738 ... 3739 } 3740 } 3741 ... 3742 boost::asio::async_read_until(s, data, '\n', handler); 3743 3744 3745After the `async_read_until` operation completes successfully, the buffer `data` contains the delimiter: 3746 3747 { 'a', 'b', ..., 'c', '\n', 'd', 'e', ... } 3748 3749 3750The call to `substr` then extracts the data up to and including the delimiter, so that the string `line` contains: 3751 3752 { 'a', 'b', ..., 'c', '\n' } 3753 3754 3755After the call to `erase`, the remaining data is left in the buffer `data` as follows: 3756 3757 { 'd', 'e', ... } 3758 3759 3760This data may be the start of a new line, to be extracted by a subsequent `async_read_until` operation. 3761 3762 3763 3764 3765[endsect] 3766 3767 3768 3769[section:overload2 async_read_until (2 of 12 overloads)] 3770 3771 3772Start an asynchronous operation to read data into a dynamic buffer sequence until it contains a specified delimiter. 3773 3774 3775 template< 3776 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 3777 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``, 3778 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 3779 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until( 3780 AsyncReadStream & s, 3781 DynamicBuffer_v1 && buffers, 3782 string_view delim, 3783 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 3784 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 3785 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 3786 3787 3788This 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: 3789 3790 3791* The get area of the dynamic buffer sequence contains the specified delimiter. 3792 3793 3794* An error occurred. 3795 3796This 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. 3797 3798 3799[heading Parameters] 3800 3801 3802[variablelist 3803 3804[[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]] 3805 3806[[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.]] 3807 3808[[delim][The delimiter string.]] 3809 3810[[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: 3811`` 3812 void handler( 3813 // Result of operation. 3814 const boost::system::error_code& error, 3815 3816 // The number of bytes in the dynamic buffer sequence's 3817 // get area up to and including the delimiter. 3818 // 0 if an error occurred. 3819 std::size_t bytes_transferred 3820 ); 3821`` 3822Regardless 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`].]] 3823 3824] 3825 3826 3827[heading Remarks] 3828 3829After 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. 3830 3831 3832[heading Example] 3833 3834To asynchronously read data into a `std::string` until a CR-LF sequence is encountered: 3835 3836 std::string data; 3837 ... 3838 void handler(const boost::system::error_code& e, std::size_t size) 3839 { 3840 if (!e) 3841 { 3842 std::string line = data.substr(0, n); 3843 data.erase(0, n); 3844 ... 3845 } 3846 } 3847 ... 3848 boost::asio::async_read_until(s, data, "\r\n", handler); 3849 3850 3851After the `async_read_until` operation completes successfully, the string `data` contains the delimiter: 3852 3853 { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } 3854 3855 3856The call to `substr` then extracts the data up to and including the delimiter, so that the string `line` contains: 3857 3858 { 'a', 'b', ..., 'c', '\r', '\n' } 3859 3860 3861After the call to `erase`, the remaining data is left in the string `data` as follows: 3862 3863 { 'd', 'e', ... } 3864 3865 3866This data may be the start of a new line, to be extracted by a subsequent `async_read_until` operation. 3867 3868 3869 3870 3871[endsect] 3872 3873 3874 3875[section:overload3 async_read_until (3 of 12 overloads)] 3876 3877 3878Start an asynchronous operation to read data into a dynamic buffer sequence until some part of its data matches a regular expression. 3879 3880 3881 template< 3882 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 3883 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``, 3884 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 3885 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until( 3886 AsyncReadStream & s, 3887 DynamicBuffer_v1 && buffers, 3888 const boost::regex & expr, 3889 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 3890 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 3891 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 3892 3893 3894This 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: 3895 3896 3897* A substring of the dynamic buffer sequence's get area matches the regular expression. 3898 3899 3900* An error occurred. 3901 3902This 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. 3903 3904 3905[heading Parameters] 3906 3907 3908[variablelist 3909 3910[[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]] 3911 3912[[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.]] 3913 3914[[expr][The regular expression.]] 3915 3916[[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: 3917`` 3918 void handler( 3919 // Result of operation. 3920 const boost::system::error_code& error, 3921 3922 // The number of bytes in the dynamic buffer 3923 // sequence's get area up to and including the 3924 // substring that matches the regular expression. 3925 // 0 if an error occurred. 3926 std::size_t bytes_transferred 3927 ); 3928`` 3929Regardless 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`].]] 3930 3931] 3932 3933 3934[heading Remarks] 3935 3936After 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. 3937 3938 3939[heading Example] 3940 3941To asynchronously read data into a `std::string` until a CR-LF sequence is encountered: 3942 3943 std::string data; 3944 ... 3945 void handler(const boost::system::error_code& e, std::size_t size) 3946 { 3947 if (!e) 3948 { 3949 std::string line = data.substr(0, n); 3950 data.erase(0, n); 3951 ... 3952 } 3953 } 3954 ... 3955 boost::asio::async_read_until(s, data, 3956 boost::regex("\r\n"), handler); 3957 3958 3959After the `async_read_until` operation completes successfully, the string `data` contains the data which matched the regular expression: 3960 3961 { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } 3962 3963 3964The call to `substr` then extracts the data up to and including the match, so that the string `line` contains: 3965 3966 { 'a', 'b', ..., 'c', '\r', '\n' } 3967 3968 3969After the call to `erase`, the remaining data is left in the string `data` as follows: 3970 3971 { 'd', 'e', ... } 3972 3973 3974This data may be the start of a new line, to be extracted by a subsequent `async_read_until` operation. 3975 3976 3977 3978 3979[endsect] 3980 3981 3982 3983[section:overload4 async_read_until (4 of 12 overloads)] 3984 3985 3986Start an asynchronous operation to read data into a dynamic buffer sequence until a function object indicates a match. 3987 3988 3989 template< 3990 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 3991 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``, 3992 typename MatchCondition, 3993 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 3994 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until( 3995 AsyncReadStream & s, 3996 DynamicBuffer_v1 && buffers, 3997 MatchCondition match_condition, 3998 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 3999 typename constraint< is_match_condition< MatchCondition >::value >::type = 0, 4000 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 4001 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 4002 4003 4004This 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: 4005 4006 4007* The match condition function object returns a std::pair where the second element evaluates to true. 4008 4009 4010* An error occurred. 4011 4012This 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. 4013 4014 4015[heading Parameters] 4016 4017 4018[variablelist 4019 4020[[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]] 4021 4022[[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.]] 4023 4024[[match_condition][The function object to be called to determine whether a match exists. The signature of the function object must be: 4025`` 4026 pair<iterator, bool> match_condition(iterator begin, iterator end); 4027`` 4028where `iterator` represents the type: 4029`` 4030 buffers_iterator<typename DynamicBuffer_v1::const_buffers_type> 4031`` 4032The 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.]] 4033 4034[[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: 4035`` 4036 void handler( 4037 // Result of operation. 4038 const boost::system::error_code& error, 4039 4040 // The number of bytes in the dynamic buffer sequence's 4041 // get area that have been fully consumed by the match 4042 // function. O if an error occurred. 4043 std::size_t bytes_transferred 4044 ); 4045`` 4046Regardless 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`].]] 4047 4048] 4049 4050 4051[heading Remarks] 4052 4053After 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. 4054 4055The 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. 4056 4057 4058[heading Examples] 4059 4060To asynchronously read data into a `std::string` until whitespace is encountered: 4061 4062 typedef boost::asio::buffers_iterator< 4063 boost::asio::const_buffers_1> iterator; 4064 4065 std::pair<iterator, bool> 4066 match_whitespace(iterator begin, iterator end) 4067 { 4068 iterator i = begin; 4069 while (i != end) 4070 if (std::isspace(*i++)) 4071 return std::make_pair(i, true); 4072 return std::make_pair(i, false); 4073 } 4074 ... 4075 void handler(const boost::system::error_code& e, std::size_t size); 4076 ... 4077 std::string data; 4078 boost::asio::async_read_until(s, data, match_whitespace, handler); 4079 4080 4081 4082 4083To asynchronously read data into a `std::string` until a matching character is found: 4084 4085 class match_char 4086 { 4087 public: 4088 explicit match_char(char c) : c_(c) {} 4089 4090 template <typename Iterator> 4091 std::pair<Iterator, bool> operator()( 4092 Iterator begin, Iterator end) const 4093 { 4094 Iterator i = begin; 4095 while (i != end) 4096 if (c_ == *i++) 4097 return std::make_pair(i, true); 4098 return std::make_pair(i, false); 4099 } 4100 4101 private: 4102 char c_; 4103 }; 4104 4105 namespace asio { 4106 template <> struct is_match_condition<match_char> 4107 : public boost::true_type {}; 4108 } // namespace asio 4109 ... 4110 void handler(const boost::system::error_code& e, std::size_t size); 4111 ... 4112 std::string data; 4113 boost::asio::async_read_until(s, data, match_char('a'), handler); 4114 4115 4116 4117 4118 4119[endsect] 4120 4121 4122 4123[section:overload5 async_read_until (5 of 12 overloads)] 4124 4125 4126Start an asynchronous operation to read data into a streambuf until it contains a specified delimiter. 4127 4128 4129 template< 4130 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 4131 typename Allocator, 4132 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 4133 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until( 4134 AsyncReadStream & s, 4135 boost::asio::basic_streambuf< Allocator > & b, 4136 char delim, 4137 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 4138 4139 4140This 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: 4141 4142 4143* The get area of the streambuf contains the specified delimiter. 4144 4145 4146* An error occurred. 4147 4148This 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. 4149 4150 4151[heading Parameters] 4152 4153 4154[variablelist 4155 4156[[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]] 4157 4158[[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.]] 4159 4160[[delim][The delimiter character.]] 4161 4162[[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: 4163`` 4164 void handler( 4165 // Result of operation. 4166 const boost::system::error_code& error, 4167 4168 // The number of bytes in the streambuf's get 4169 // area up to and including the delimiter. 4170 // 0 if an error occurred. 4171 std::size_t bytes_transferred 4172 ); 4173`` 4174Regardless 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`].]] 4175 4176] 4177 4178 4179[heading Remarks] 4180 4181After 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. 4182 4183 4184[heading Example] 4185 4186To asynchronously read data into a streambuf until a newline is encountered: 4187 4188 boost::asio::streambuf b; 4189 ... 4190 void handler(const boost::system::error_code& e, std::size_t size) 4191 { 4192 if (!e) 4193 { 4194 std::istream is(&b); 4195 std::string line; 4196 std::getline(is, line); 4197 ... 4198 } 4199 } 4200 ... 4201 boost::asio::async_read_until(s, b, '\n', handler); 4202 4203 4204After the `async_read_until` operation completes successfully, the buffer `b` contains the delimiter: 4205 4206 { 'a', 'b', ..., 'c', '\n', 'd', 'e', ... } 4207 4208 4209The call to `std::getline` then extracts the data up to and including the newline (which is discarded), so that the string `line` contains: 4210 4211 { 'a', 'b', ..., 'c' } 4212 4213 4214The remaining data is left in the buffer `b` as follows: 4215 4216 { 'd', 'e', ... } 4217 4218 4219This data may be the start of a new line, to be extracted by a subsequent `async_read_until` operation. 4220 4221 4222 4223 4224[endsect] 4225 4226 4227 4228[section:overload6 async_read_until (6 of 12 overloads)] 4229 4230 4231Start an asynchronous operation to read data into a streambuf until it contains a specified delimiter. 4232 4233 4234 template< 4235 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 4236 typename Allocator, 4237 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 4238 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until( 4239 AsyncReadStream & s, 4240 boost::asio::basic_streambuf< Allocator > & b, 4241 string_view delim, 4242 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 4243 4244 4245This 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: 4246 4247 4248* The get area of the streambuf contains the specified delimiter. 4249 4250 4251* An error occurred. 4252 4253This 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. 4254 4255 4256[heading Parameters] 4257 4258 4259[variablelist 4260 4261[[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]] 4262 4263[[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.]] 4264 4265[[delim][The delimiter string.]] 4266 4267[[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: 4268`` 4269 void handler( 4270 // Result of operation. 4271 const boost::system::error_code& error, 4272 4273 // The number of bytes in the streambuf's get 4274 // area up to and including the delimiter. 4275 // 0 if an error occurred. 4276 std::size_t bytes_transferred 4277 ); 4278`` 4279Regardless 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`].]] 4280 4281] 4282 4283 4284[heading Remarks] 4285 4286After 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. 4287 4288 4289[heading Example] 4290 4291To asynchronously read data into a streambuf until a newline is encountered: 4292 4293 boost::asio::streambuf b; 4294 ... 4295 void handler(const boost::system::error_code& e, std::size_t size) 4296 { 4297 if (!e) 4298 { 4299 std::istream is(&b); 4300 std::string line; 4301 std::getline(is, line); 4302 ... 4303 } 4304 } 4305 ... 4306 boost::asio::async_read_until(s, b, "\r\n", handler); 4307 4308 4309After the `async_read_until` operation completes successfully, the buffer `b` contains the delimiter: 4310 4311 { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } 4312 4313 4314The call to `std::getline` then extracts the data up to and including the newline (which is discarded), so that the string `line` contains: 4315 4316 { 'a', 'b', ..., 'c', '\r' } 4317 4318 4319The remaining data is left in the buffer `b` as follows: 4320 4321 { 'd', 'e', ... } 4322 4323 4324This data may be the start of a new line, to be extracted by a subsequent `async_read_until` operation. 4325 4326 4327 4328 4329[endsect] 4330 4331 4332 4333[section:overload7 async_read_until (7 of 12 overloads)] 4334 4335 4336Start an asynchronous operation to read data into a streambuf until some part of its data matches a regular expression. 4337 4338 4339 template< 4340 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 4341 typename Allocator, 4342 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 4343 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until( 4344 AsyncReadStream & s, 4345 boost::asio::basic_streambuf< Allocator > & b, 4346 const boost::regex & expr, 4347 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 4348 4349 4350This 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: 4351 4352 4353* A substring of the streambuf's get area matches the regular expression. 4354 4355 4356* An error occurred. 4357 4358This 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. 4359 4360 4361[heading Parameters] 4362 4363 4364[variablelist 4365 4366[[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]] 4367 4368[[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.]] 4369 4370[[expr][The regular expression.]] 4371 4372[[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: 4373`` 4374 void handler( 4375 // Result of operation. 4376 const boost::system::error_code& error, 4377 4378 // The number of bytes in the streambuf's get 4379 // area up to and including the substring 4380 // that matches the regular. expression. 4381 // 0 if an error occurred. 4382 std::size_t bytes_transferred 4383 ); 4384`` 4385Regardless 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`].]] 4386 4387] 4388 4389 4390[heading Remarks] 4391 4392After 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. 4393 4394 4395[heading Example] 4396 4397To asynchronously read data into a streambuf until a CR-LF sequence is encountered: 4398 4399 boost::asio::streambuf b; 4400 ... 4401 void handler(const boost::system::error_code& e, std::size_t size) 4402 { 4403 if (!e) 4404 { 4405 std::istream is(&b); 4406 std::string line; 4407 std::getline(is, line); 4408 ... 4409 } 4410 } 4411 ... 4412 boost::asio::async_read_until(s, b, boost::regex("\r\n"), handler); 4413 4414 4415After the `async_read_until` operation completes successfully, the buffer `b` contains the data which matched the regular expression: 4416 4417 { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } 4418 4419 4420The call to `std::getline` then extracts the data up to and including the newline (which is discarded), so that the string `line` contains: 4421 4422 { 'a', 'b', ..., 'c', '\r' } 4423 4424 4425The remaining data is left in the buffer `b` as follows: 4426 4427 { 'd', 'e', ... } 4428 4429 4430This data may be the start of a new line, to be extracted by a subsequent `async_read_until` operation. 4431 4432 4433 4434 4435[endsect] 4436 4437 4438 4439[section:overload8 async_read_until (8 of 12 overloads)] 4440 4441 4442Start an asynchronous operation to read data into a streambuf until a function object indicates a match. 4443 4444 4445 template< 4446 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 4447 typename Allocator, 4448 typename MatchCondition, 4449 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 4450 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until( 4451 AsyncReadStream & s, 4452 boost::asio::basic_streambuf< Allocator > & b, 4453 MatchCondition match_condition, 4454 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 4455 typename constraint< is_match_condition< MatchCondition >::value >::type = 0); 4456 4457 4458This 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: 4459 4460 4461* The match condition function object returns a std::pair where the second element evaluates to true. 4462 4463 4464* An error occurred. 4465 4466This 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. 4467 4468 4469[heading Parameters] 4470 4471 4472[variablelist 4473 4474[[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]] 4475 4476[[b][A streambuf object into which the data will be read.]] 4477 4478[[match_condition][The function object to be called to determine whether a match exists. The signature of the function object must be: 4479`` 4480 pair<iterator, bool> match_condition(iterator begin, iterator end); 4481`` 4482where `iterator` represents the type: 4483`` 4484 buffers_iterator<basic_streambuf<Allocator>::const_buffers_type> 4485`` 4486The 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.]] 4487 4488[[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: 4489`` 4490 void handler( 4491 // Result of operation. 4492 const boost::system::error_code& error, 4493 4494 // The number of bytes in the streambuf's get 4495 // area that have been fully consumed by the 4496 // match function. O if an error occurred. 4497 std::size_t bytes_transferred 4498 ); 4499`` 4500Regardless 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`].]] 4501 4502] 4503 4504 4505[heading Remarks] 4506 4507After 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. 4508 4509The 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. 4510 4511 4512[heading Examples] 4513 4514To asynchronously read data into a streambuf until whitespace is encountered: 4515 4516 typedef boost::asio::buffers_iterator< 4517 boost::asio::streambuf::const_buffers_type> iterator; 4518 4519 std::pair<iterator, bool> 4520 match_whitespace(iterator begin, iterator end) 4521 { 4522 iterator i = begin; 4523 while (i != end) 4524 if (std::isspace(*i++)) 4525 return std::make_pair(i, true); 4526 return std::make_pair(i, false); 4527 } 4528 ... 4529 void handler(const boost::system::error_code& e, std::size_t size); 4530 ... 4531 boost::asio::streambuf b; 4532 boost::asio::async_read_until(s, b, match_whitespace, handler); 4533 4534 4535 4536 4537To asynchronously read data into a streambuf until a matching character is found: 4538 4539 class match_char 4540 { 4541 public: 4542 explicit match_char(char c) : c_(c) {} 4543 4544 template <typename Iterator> 4545 std::pair<Iterator, bool> operator()( 4546 Iterator begin, Iterator end) const 4547 { 4548 Iterator i = begin; 4549 while (i != end) 4550 if (c_ == *i++) 4551 return std::make_pair(i, true); 4552 return std::make_pair(i, false); 4553 } 4554 4555 private: 4556 char c_; 4557 }; 4558 4559 namespace asio { 4560 template <> struct is_match_condition<match_char> 4561 : public boost::true_type {}; 4562 } // namespace asio 4563 ... 4564 void handler(const boost::system::error_code& e, std::size_t size); 4565 ... 4566 boost::asio::streambuf b; 4567 boost::asio::async_read_until(s, b, match_char('a'), handler); 4568 4569 4570 4571 4572 4573[endsect] 4574 4575 4576 4577[section:overload9 async_read_until (9 of 12 overloads)] 4578 4579 4580Start an asynchronous operation to read data into a dynamic buffer sequence until it contains a specified delimiter. 4581 4582 4583 template< 4584 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 4585 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``, 4586 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 4587 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until( 4588 AsyncReadStream & s, 4589 DynamicBuffer_v2 buffers, 4590 char delim, 4591 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 4592 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 4593 4594 4595This 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: 4596 4597 4598* The get area of the dynamic buffer sequence contains the specified delimiter. 4599 4600 4601* An error occurred. 4602 4603This 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. 4604 4605 4606[heading Parameters] 4607 4608 4609[variablelist 4610 4611[[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]] 4612 4613[[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.]] 4614 4615[[delim][The delimiter character.]] 4616 4617[[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: 4618`` 4619 void handler( 4620 // Result of operation. 4621 const boost::system::error_code& error, 4622 4623 // The number of bytes in the dynamic buffer sequence's 4624 // get area up to and including the delimiter. 4625 // 0 if an error occurred. 4626 std::size_t bytes_transferred 4627 ); 4628`` 4629Regardless 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`].]] 4630 4631] 4632 4633 4634[heading Remarks] 4635 4636After 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. 4637 4638 4639[heading Example] 4640 4641To asynchronously read data into a `std::string` until a newline is encountered: 4642 4643 std::string data; 4644 ... 4645 void handler(const boost::system::error_code& e, std::size_t size) 4646 { 4647 if (!e) 4648 { 4649 std::string line = data.substr(0, n); 4650 data.erase(0, n); 4651 ... 4652 } 4653 } 4654 ... 4655 boost::asio::async_read_until(s, data, '\n', handler); 4656 4657 4658After the `async_read_until` operation completes successfully, the buffer `data` contains the delimiter: 4659 4660 { 'a', 'b', ..., 'c', '\n', 'd', 'e', ... } 4661 4662 4663The call to `substr` then extracts the data up to and including the delimiter, so that the string `line` contains: 4664 4665 { 'a', 'b', ..., 'c', '\n' } 4666 4667 4668After the call to `erase`, the remaining data is left in the buffer `data` as follows: 4669 4670 { 'd', 'e', ... } 4671 4672 4673This data may be the start of a new line, to be extracted by a subsequent `async_read_until` operation. 4674 4675 4676 4677 4678[endsect] 4679 4680 4681 4682[section:overload10 async_read_until (10 of 12 overloads)] 4683 4684 4685Start an asynchronous operation to read data into a dynamic buffer sequence until it contains a specified delimiter. 4686 4687 4688 template< 4689 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 4690 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``, 4691 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 4692 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until( 4693 AsyncReadStream & s, 4694 DynamicBuffer_v2 buffers, 4695 string_view delim, 4696 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 4697 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 4698 4699 4700This 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: 4701 4702 4703* The get area of the dynamic buffer sequence contains the specified delimiter. 4704 4705 4706* An error occurred. 4707 4708This 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. 4709 4710 4711[heading Parameters] 4712 4713 4714[variablelist 4715 4716[[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]] 4717 4718[[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.]] 4719 4720[[delim][The delimiter string.]] 4721 4722[[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: 4723`` 4724 void handler( 4725 // Result of operation. 4726 const boost::system::error_code& error, 4727 4728 // The number of bytes in the dynamic buffer sequence's 4729 // get area up to and including the delimiter. 4730 // 0 if an error occurred. 4731 std::size_t bytes_transferred 4732 ); 4733`` 4734Regardless 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`].]] 4735 4736] 4737 4738 4739[heading Remarks] 4740 4741After 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. 4742 4743 4744[heading Example] 4745 4746To asynchronously read data into a `std::string` until a CR-LF sequence is encountered: 4747 4748 std::string data; 4749 ... 4750 void handler(const boost::system::error_code& e, std::size_t size) 4751 { 4752 if (!e) 4753 { 4754 std::string line = data.substr(0, n); 4755 data.erase(0, n); 4756 ... 4757 } 4758 } 4759 ... 4760 boost::asio::async_read_until(s, data, "\r\n", handler); 4761 4762 4763After the `async_read_until` operation completes successfully, the string `data` contains the delimiter: 4764 4765 { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } 4766 4767 4768The call to `substr` then extracts the data up to and including the delimiter, so that the string `line` contains: 4769 4770 { 'a', 'b', ..., 'c', '\r', '\n' } 4771 4772 4773After the call to `erase`, the remaining data is left in the string `data` as follows: 4774 4775 { 'd', 'e', ... } 4776 4777 4778This data may be the start of a new line, to be extracted by a subsequent `async_read_until` operation. 4779 4780 4781 4782 4783[endsect] 4784 4785 4786 4787[section:overload11 async_read_until (11 of 12 overloads)] 4788 4789 4790Start an asynchronous operation to read data into a dynamic buffer sequence until some part of its data matches a regular expression. 4791 4792 4793 template< 4794 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 4795 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``, 4796 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 4797 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until( 4798 AsyncReadStream & s, 4799 DynamicBuffer_v2 buffers, 4800 const boost::regex & expr, 4801 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 4802 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 4803 4804 4805This 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: 4806 4807 4808* A substring of the dynamic buffer sequence's get area matches the regular expression. 4809 4810 4811* An error occurred. 4812 4813This 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. 4814 4815 4816[heading Parameters] 4817 4818 4819[variablelist 4820 4821[[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]] 4822 4823[[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.]] 4824 4825[[expr][The regular expression.]] 4826 4827[[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: 4828`` 4829 void handler( 4830 // Result of operation. 4831 const boost::system::error_code& error, 4832 4833 // The number of bytes in the dynamic buffer 4834 // sequence's get area up to and including the 4835 // substring that matches the regular expression. 4836 // 0 if an error occurred. 4837 std::size_t bytes_transferred 4838 ); 4839`` 4840Regardless 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`].]] 4841 4842] 4843 4844 4845[heading Remarks] 4846 4847After 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. 4848 4849 4850[heading Example] 4851 4852To asynchronously read data into a `std::string` until a CR-LF sequence is encountered: 4853 4854 std::string data; 4855 ... 4856 void handler(const boost::system::error_code& e, std::size_t size) 4857 { 4858 if (!e) 4859 { 4860 std::string line = data.substr(0, n); 4861 data.erase(0, n); 4862 ... 4863 } 4864 } 4865 ... 4866 boost::asio::async_read_until(s, data, 4867 boost::regex("\r\n"), handler); 4868 4869 4870After the `async_read_until` operation completes successfully, the string `data` contains the data which matched the regular expression: 4871 4872 { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } 4873 4874 4875The call to `substr` then extracts the data up to and including the match, so that the string `line` contains: 4876 4877 { 'a', 'b', ..., 'c', '\r', '\n' } 4878 4879 4880After the call to `erase`, the remaining data is left in the string `data` as follows: 4881 4882 { 'd', 'e', ... } 4883 4884 4885This data may be the start of a new line, to be extracted by a subsequent `async_read_until` operation. 4886 4887 4888 4889 4890[endsect] 4891 4892 4893 4894[section:overload12 async_read_until (12 of 12 overloads)] 4895 4896 4897Start an asynchronous operation to read data into a dynamic buffer sequence until a function object indicates a match. 4898 4899 4900 template< 4901 typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, 4902 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``, 4903 typename MatchCondition, 4904 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 4905 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until( 4906 AsyncReadStream & s, 4907 DynamicBuffer_v2 buffers, 4908 MatchCondition match_condition, 4909 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 4910 typename constraint< is_match_condition< MatchCondition >::value >::type = 0, 4911 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 4912 4913 4914This 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: 4915 4916 4917* The match condition function object returns a std::pair where the second element evaluates to true. 4918 4919 4920* An error occurred. 4921 4922This 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. 4923 4924 4925[heading Parameters] 4926 4927 4928[variablelist 4929 4930[[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]] 4931 4932[[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.]] 4933 4934[[match_condition][The function object to be called to determine whether a match exists. The signature of the function object must be: 4935`` 4936 pair<iterator, bool> match_condition(iterator begin, iterator end); 4937`` 4938where `iterator` represents the type: 4939`` 4940 buffers_iterator<typename DynamicBuffer_v2::const_buffers_type> 4941`` 4942The 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.]] 4943 4944[[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: 4945`` 4946 void handler( 4947 // Result of operation. 4948 const boost::system::error_code& error, 4949 4950 // The number of bytes in the dynamic buffer sequence's 4951 // get area that have been fully consumed by the match 4952 // function. O if an error occurred. 4953 std::size_t bytes_transferred 4954 ); 4955`` 4956Regardless 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`].]] 4957 4958] 4959 4960 4961[heading Remarks] 4962 4963After 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. 4964 4965The 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. 4966 4967 4968[heading Examples] 4969 4970To asynchronously read data into a `std::string` until whitespace is encountered: 4971 4972 typedef boost::asio::buffers_iterator< 4973 boost::asio::const_buffers_1> iterator; 4974 4975 std::pair<iterator, bool> 4976 match_whitespace(iterator begin, iterator end) 4977 { 4978 iterator i = begin; 4979 while (i != end) 4980 if (std::isspace(*i++)) 4981 return std::make_pair(i, true); 4982 return std::make_pair(i, false); 4983 } 4984 ... 4985 void handler(const boost::system::error_code& e, std::size_t size); 4986 ... 4987 std::string data; 4988 boost::asio::async_read_until(s, data, match_whitespace, handler); 4989 4990 4991 4992 4993To asynchronously read data into a `std::string` until a matching character is found: 4994 4995 class match_char 4996 { 4997 public: 4998 explicit match_char(char c) : c_(c) {} 4999 5000 template <typename Iterator> 5001 std::pair<Iterator, bool> operator()( 5002 Iterator begin, Iterator end) const 5003 { 5004 Iterator i = begin; 5005 while (i != end) 5006 if (c_ == *i++) 5007 return std::make_pair(i, true); 5008 return std::make_pair(i, false); 5009 } 5010 5011 private: 5012 char c_; 5013 }; 5014 5015 namespace asio { 5016 template <> struct is_match_condition<match_char> 5017 : public boost::true_type {}; 5018 } // namespace asio 5019 ... 5020 void handler(const boost::system::error_code& e, std::size_t size); 5021 ... 5022 std::string data; 5023 boost::asio::async_read_until(s, data, match_char('a'), handler); 5024 5025 5026 5027 5028 5029[endsect] 5030 5031 5032[endsect] 5033 5034[section:async_result async_result] 5035 5036[indexterm1 boost_asio.indexterm.async_result..async_result] 5037 5038 5039An interface for customising the behaviour of an initiating function. 5040 5041 5042 template< 5043 typename CompletionToken, 5044 typename Signature> 5045 class async_result 5046 5047 5048[heading Types] 5049[table 5050 [[Name][Description]] 5051 5052 [ 5053 5054 [[link boost_asio.reference.async_result.completion_handler_type [*completion_handler_type]]] 5055 [The concrete completion handler type for the specific signature. ] 5056 5057 ] 5058 5059 [ 5060 5061 [[link boost_asio.reference.async_result.return_type [*return_type]]] 5062 [The return type of the initiating function. ] 5063 5064 ] 5065 5066] 5067 5068[heading Member Functions] 5069[table 5070 [[Name][Description]] 5071 5072 [ 5073 [[link boost_asio.reference.async_result.async_result [*async_result]] [constructor]] 5074 [Construct an async result from a given handler. ] 5075 ] 5076 5077 [ 5078 [[link boost_asio.reference.async_result.get [*get]]] 5079 [Obtain the value to be returned from the initiating function. ] 5080 ] 5081 5082 [ 5083 [[link boost_asio.reference.async_result.initiate [*initiate]] [static]] 5084 [Initiate the asynchronous operation that will produce the result, and obtain the value to be returned from the initiating function. ] 5085 ] 5086 5087] 5088 5089The [link boost_asio.reference.async_result `async_result`] traits class is used for determining: 5090 5091 5092* the concrete completion handler type to be called at the end of the asynchronous operation; 5093 5094 5095* the initiating function return type; and 5096 5097 5098* how the return value of the initiating function is obtained. 5099 5100The trait allows the handler and return types to be determined at the point where the specific completion handler signature is known. 5101 5102This template may be specialised for user-defined completion token types. The primary template assumes that the CompletionToken is the completion handler. 5103 5104[heading Requirements] 5105 5106['Header: ][^boost/asio/async_result.hpp] 5107 5108['Convenience header: ][^boost/asio.hpp] 5109 5110 5111[section:async_result async_result::async_result] 5112 5113[indexterm2 boost_asio.indexterm.async_result.async_result..async_result..async_result] 5114Construct an async result from a given handler. 5115 5116 5117 async_result( 5118 completion_handler_type & h); 5119 5120 5121When 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. 5122 5123 5124[endsect] 5125 5126 5127 5128[section:completion_handler_type async_result::completion_handler_type] 5129 5130[indexterm2 boost_asio.indexterm.async_result.completion_handler_type..completion_handler_type..async_result] 5131The concrete completion handler type for the specific signature. 5132 5133 5134 typedef CompletionToken completion_handler_type; 5135 5136 5137 5138[heading Requirements] 5139 5140['Header: ][^boost/asio/async_result.hpp] 5141 5142['Convenience header: ][^boost/asio.hpp] 5143 5144 5145[endsect] 5146 5147 5148 5149[section:get async_result::get] 5150 5151[indexterm2 boost_asio.indexterm.async_result.get..get..async_result] 5152Obtain the value to be returned from the initiating function. 5153 5154 5155 return_type get(); 5156 5157 5158 5159[endsect] 5160 5161 5162 5163[section:initiate async_result::initiate] 5164 5165[indexterm2 boost_asio.indexterm.async_result.initiate..initiate..async_result] 5166Initiate the asynchronous operation that will produce the result, and obtain the value to be returned from the initiating function. 5167 5168 5169 template< 5170 typename Initiation, 5171 typename RawCompletionToken, 5172 typename... Args> 5173 static return_type initiate( 5174 Initiation && initiation, 5175 RawCompletionToken && token, 5176 Args &&... args); 5177 5178 5179 5180[endsect] 5181 5182 5183 5184[section:return_type async_result::return_type] 5185 5186[indexterm2 boost_asio.indexterm.async_result.return_type..return_type..async_result] 5187The return type of the initiating function. 5188 5189 5190 typedef void return_type; 5191 5192 5193 5194[heading Requirements] 5195 5196['Header: ][^boost/asio/async_result.hpp] 5197 5198['Convenience header: ][^boost/asio.hpp] 5199 5200 5201[endsect] 5202 5203 5204 5205[endsect] 5206 5207[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 >] 5208 5209[indexterm1 boost_asio.indexterm.async_result_lt__std__packaged_task_lt__Result_lp_Args_ellipsis__rp__gt__comma__Signature__gt_..async_result< std::packaged_task< Result(Args\.\.\.)>, Signature >] 5210 5211 5212Partial specialisation of `async_result` for `std::packaged_task`. 5213 5214 5215 template< 5216 typename Result, 5217 typename... Args, 5218 typename Signature> 5219 class async_result< std::packaged_task< Result(Args...)>, Signature > 5220 5221 5222[heading Types] 5223[table 5224 [[Name][Description]] 5225 5226 [ 5227 5228 [[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]]] 5229 [The packaged task is the concrete completion handler type. ] 5230 5231 ] 5232 5233 [ 5234 5235 [[link boost_asio.reference.async_result_lt__std__packaged_task_lt__Result_lp_Args_ellipsis__rp__gt__comma__Signature__gt_.return_type [*return_type]]] 5236 [The return type of the initiating function is the future obtained from the packaged task. ] 5237 5238 ] 5239 5240] 5241 5242[heading Member Functions] 5243[table 5244 [[Name][Description]] 5245 5246 [ 5247 [[link boost_asio.reference.async_result_lt__std__packaged_task_lt__Result_lp_Args_ellipsis__rp__gt__comma__Signature__gt_.async_result [*async_result]]] 5248 [The constructor extracts the future from the packaged task. ] 5249 ] 5250 5251 [ 5252 [[link boost_asio.reference.async_result_lt__std__packaged_task_lt__Result_lp_Args_ellipsis__rp__gt__comma__Signature__gt_.get [*get]]] 5253 [Returns the packaged task's future. ] 5254 ] 5255 5256] 5257 5258[heading Requirements] 5259 5260['Header: ][^boost/asio/packaged_task.hpp] 5261 5262['Convenience header: ][^boost/asio.hpp] 5263 5264 5265[section:async_result async_result< std::packaged_task< Result(Args...)>, Signature >::async_result] 5266 5267[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 >] 5268The constructor extracts the future from the packaged task. 5269 5270 5271 async_result( 5272 completion_handler_type & h); 5273 5274 5275 5276[endsect] 5277 5278 5279 5280[section:completion_handler_type async_result< std::packaged_task< Result(Args...)>, Signature >::completion_handler_type] 5281 5282[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 >] 5283The packaged task is the concrete completion handler type. 5284 5285 5286 typedef std::packaged_task< Result(Args...)> completion_handler_type; 5287 5288 5289 5290[heading Requirements] 5291 5292['Header: ][^boost/asio/packaged_task.hpp] 5293 5294['Convenience header: ][^boost/asio.hpp] 5295 5296 5297[endsect] 5298 5299 5300 5301[section:get async_result< std::packaged_task< Result(Args...)>, Signature >::get] 5302 5303[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 >] 5304Returns the packaged task's future. 5305 5306 5307 return_type get(); 5308 5309 5310 5311[endsect] 5312 5313 5314 5315[section:return_type async_result< std::packaged_task< Result(Args...)>, Signature >::return_type] 5316 5317[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 >] 5318The return type of the initiating function is the future obtained from the packaged task. 5319 5320 5321 typedef std::future< Result > return_type; 5322 5323 5324 5325[heading Requirements] 5326 5327['Header: ][^boost/asio/packaged_task.hpp] 5328 5329['Convenience header: ][^boost/asio.hpp] 5330 5331 5332[endsect] 5333 5334 5335 5336[endsect] 5337 5338[section:async_write async_write] 5339 5340[indexterm1 boost_asio.indexterm.async_write..async_write] 5341The `async_write` function is a composed asynchronous operation that writes a certain amount of data to a stream before completion. 5342 5343 5344Start an asynchronous operation to write all of the supplied data to a stream. 5345 5346 template< 5347 typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``, 5348 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 5349 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 5350 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write.overload1 async_write]``( 5351 AsyncWriteStream & s, 5352 const ConstBufferSequence & buffers, 5353 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 5354 typename constraint< is_const_buffer_sequence< ConstBufferSequence >::value >::type = 0); 5355 `` [''''»''' [link boost_asio.reference.async_write.overload1 more...]]`` 5356 5357Start an asynchronous operation to write a certain amount of data to a stream. 5358 5359 template< 5360 typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``, 5361 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 5362 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, 5363 typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> 5364 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write.overload2 async_write]``( 5365 AsyncWriteStream & s, 5366 const ConstBufferSequence & buffers, 5367 CompletionCondition completion_condition, 5368 WriteHandler && handler, 5369 typename constraint< is_const_buffer_sequence< ConstBufferSequence >::value >::type = 0); 5370 `` [''''»''' [link boost_asio.reference.async_write.overload2 more...]]`` 5371 5372Start an asynchronous operation to write all of the supplied data to a stream. 5373 5374 template< 5375 typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``, 5376 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``, 5377 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 5378 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write.overload3 async_write]``( 5379 AsyncWriteStream & s, 5380 DynamicBuffer_v1 && buffers, 5381 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 5382 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 5383 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 5384 `` [''''»''' [link boost_asio.reference.async_write.overload3 more...]]`` 5385 5386Start an asynchronous operation to write a certain amount of data to a stream. 5387 5388 template< 5389 typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``, 5390 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``, 5391 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, 5392 typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> 5393 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write.overload4 async_write]``( 5394 AsyncWriteStream & s, 5395 DynamicBuffer_v1 && buffers, 5396 CompletionCondition completion_condition, 5397 WriteHandler && handler, 5398 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 5399 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 5400 `` [''''»''' [link boost_asio.reference.async_write.overload4 more...]]`` 5401 5402Start an asynchronous operation to write all of the supplied data to a stream. 5403 5404 template< 5405 typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``, 5406 typename Allocator, 5407 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 5408 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write.overload5 async_write]``( 5409 AsyncWriteStream & s, 5410 basic_streambuf< Allocator > & b, 5411 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 5412 `` [''''»''' [link boost_asio.reference.async_write.overload5 more...]]`` 5413 5414Start an asynchronous operation to write a certain amount of data to a stream. 5415 5416 template< 5417 typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``, 5418 typename Allocator, 5419 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, 5420 typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> 5421 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write.overload6 async_write]``( 5422 AsyncWriteStream & s, 5423 basic_streambuf< Allocator > & b, 5424 CompletionCondition completion_condition, 5425 WriteHandler && handler); 5426 `` [''''»''' [link boost_asio.reference.async_write.overload6 more...]]`` 5427 5428Start an asynchronous operation to write all of the supplied data to a stream. 5429 5430 template< 5431 typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``, 5432 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``, 5433 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 5434 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write.overload7 async_write]``( 5435 AsyncWriteStream & s, 5436 DynamicBuffer_v2 buffers, 5437 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 5438 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 5439 `` [''''»''' [link boost_asio.reference.async_write.overload7 more...]]`` 5440 5441Start an asynchronous operation to write a certain amount of data to a stream. 5442 5443 template< 5444 typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``, 5445 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``, 5446 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, 5447 typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> 5448 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write.overload8 async_write]``( 5449 AsyncWriteStream & s, 5450 DynamicBuffer_v2 buffers, 5451 CompletionCondition completion_condition, 5452 WriteHandler && handler, 5453 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 5454 `` [''''»''' [link boost_asio.reference.async_write.overload8 more...]]`` 5455 5456[heading Requirements] 5457 5458['Header: ][^boost/asio/write.hpp] 5459 5460['Convenience header: ][^boost/asio.hpp] 5461 5462 5463[section:overload1 async_write (1 of 8 overloads)] 5464 5465 5466Start an asynchronous operation to write all of the supplied data to a stream. 5467 5468 5469 template< 5470 typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``, 5471 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 5472 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 5473 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write( 5474 AsyncWriteStream & s, 5475 const ConstBufferSequence & buffers, 5476 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 5477 typename constraint< is_const_buffer_sequence< ConstBufferSequence >::value >::type = 0); 5478 5479 5480This 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: 5481 5482 5483* 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. 5484 5485 5486* An error occurred. 5487 5488This 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. 5489 5490 5491[heading Parameters] 5492 5493 5494[variablelist 5495 5496[[s][The stream to which the data is to be written. The type must support the AsyncWriteStream concept.]] 5497 5498[[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.]] 5499 5500[[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: 5501`` 5502 void handler( 5503 const boost::system::error_code& error, // Result of operation. 5504 5505 std::size_t bytes_transferred // Number of bytes written from the 5506 // buffers. If an error occurred, 5507 // this will be less than the sum 5508 // of the buffer sizes. 5509 ); 5510`` 5511Regardless 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`].]] 5512 5513] 5514 5515 5516[heading Example] 5517 5518To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 5519 5520 boost::asio::async_write(s, boost::asio::buffer(data, size), handler); 5521 5522 5523See 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. 5524 5525 5526 5527 5528[endsect] 5529 5530 5531 5532[section:overload2 async_write (2 of 8 overloads)] 5533 5534 5535Start an asynchronous operation to write a certain amount of data to a stream. 5536 5537 5538 template< 5539 typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``, 5540 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 5541 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, 5542 typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> 5543 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write( 5544 AsyncWriteStream & s, 5545 const ConstBufferSequence & buffers, 5546 CompletionCondition completion_condition, 5547 WriteHandler && handler, 5548 typename constraint< is_const_buffer_sequence< ConstBufferSequence >::value >::type = 0); 5549 5550 5551This 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: 5552 5553 5554* 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. 5555 5556 5557* The completion\_condition function object returns 0. 5558 5559This 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. 5560 5561 5562[heading Parameters] 5563 5564 5565[variablelist 5566 5567[[s][The stream to which the data is to be written. The type must support the AsyncWriteStream concept.]] 5568 5569[[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.]] 5570 5571[[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 5572`` 5573 std::size_t completion_condition( 5574 // Result of latest async_write_some operation. 5575 const boost::system::error_code& error, 5576 5577 // Number of bytes transferred so far. 5578 std::size_t bytes_transferred 5579 ); 5580`` 5581A 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.]] 5582 5583[[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: 5584`` 5585 void handler( 5586 const boost::system::error_code& error, // Result of operation. 5587 5588 std::size_t bytes_transferred // Number of bytes written from the 5589 // buffers. If an error occurred, 5590 // this will be less than the sum 5591 // of the buffer sizes. 5592 ); 5593`` 5594Regardless 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`].]] 5595 5596] 5597 5598 5599[heading Example] 5600 5601To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 5602 5603 boost::asio::async_write(s, 5604 boost::asio::buffer(data, size), 5605 boost::asio::transfer_at_least(32), 5606 handler); 5607 5608 5609See 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. 5610 5611 5612 5613 5614[endsect] 5615 5616 5617 5618[section:overload3 async_write (3 of 8 overloads)] 5619 5620 5621Start an asynchronous operation to write all of the supplied data to a stream. 5622 5623 5624 template< 5625 typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``, 5626 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``, 5627 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 5628 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write( 5629 AsyncWriteStream & s, 5630 DynamicBuffer_v1 && buffers, 5631 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 5632 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 5633 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 5634 5635 5636This 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: 5637 5638 5639* All of the data in the supplied dynamic buffer sequence has been written. 5640 5641 5642* An error occurred. 5643 5644This 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. 5645 5646 5647[heading Parameters] 5648 5649 5650[variablelist 5651 5652[[s][The stream to which the data is to be written. The type must support the AsyncWriteStream concept.]] 5653 5654[[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.]] 5655 5656[[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: 5657`` 5658 void handler( 5659 const boost::system::error_code& error, // Result of operation. 5660 5661 std::size_t bytes_transferred // Number of bytes written from the 5662 // buffers. If an error occurred, 5663 // this will be less than the sum 5664 // of the buffer sizes. 5665 ); 5666`` 5667Regardless 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`]. ]] 5668 5669] 5670 5671 5672 5673 5674[endsect] 5675 5676 5677 5678[section:overload4 async_write (4 of 8 overloads)] 5679 5680 5681Start an asynchronous operation to write a certain amount of data to a stream. 5682 5683 5684 template< 5685 typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``, 5686 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``, 5687 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, 5688 typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> 5689 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write( 5690 AsyncWriteStream & s, 5691 DynamicBuffer_v1 && buffers, 5692 CompletionCondition completion_condition, 5693 WriteHandler && handler, 5694 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 5695 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 5696 5697 5698This 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: 5699 5700 5701* All of the data in the supplied dynamic buffer sequence has been written. 5702 5703 5704* The completion\_condition function object returns 0. 5705 5706This 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. 5707 5708 5709[heading Parameters] 5710 5711 5712[variablelist 5713 5714[[s][The stream to which the data is to be written. The type must support the AsyncWriteStream concept.]] 5715 5716[[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.]] 5717 5718[[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 5719`` 5720 std::size_t completion_condition( 5721 // Result of latest async_write_some operation. 5722 const boost::system::error_code& error, 5723 5724 // Number of bytes transferred so far. 5725 std::size_t bytes_transferred 5726 ); 5727`` 5728A 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.]] 5729 5730[[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: 5731`` 5732 void handler( 5733 const boost::system::error_code& error, // Result of operation. 5734 5735 std::size_t bytes_transferred // Number of bytes written from the 5736 // buffers. If an error occurred, 5737 // this will be less than the sum 5738 // of the buffer sizes. 5739 ); 5740`` 5741Regardless 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`]. ]] 5742 5743] 5744 5745 5746 5747 5748[endsect] 5749 5750 5751 5752[section:overload5 async_write (5 of 8 overloads)] 5753 5754 5755Start an asynchronous operation to write all of the supplied data to a stream. 5756 5757 5758 template< 5759 typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``, 5760 typename Allocator, 5761 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 5762 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write( 5763 AsyncWriteStream & s, 5764 basic_streambuf< Allocator > & b, 5765 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 5766 5767 5768This 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: 5769 5770 5771* All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written. 5772 5773 5774* An error occurred. 5775 5776This 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. 5777 5778 5779[heading Parameters] 5780 5781 5782[variablelist 5783 5784[[s][The stream to which the data is to be written. The type must support the AsyncWriteStream concept.]] 5785 5786[[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.]] 5787 5788[[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: 5789`` 5790 void handler( 5791 const boost::system::error_code& error, // Result of operation. 5792 5793 std::size_t bytes_transferred // Number of bytes written from the 5794 // buffers. If an error occurred, 5795 // this will be less than the sum 5796 // of the buffer sizes. 5797 ); 5798`` 5799Regardless 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`]. ]] 5800 5801] 5802 5803 5804 5805 5806[endsect] 5807 5808 5809 5810[section:overload6 async_write (6 of 8 overloads)] 5811 5812 5813Start an asynchronous operation to write a certain amount of data to a stream. 5814 5815 5816 template< 5817 typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``, 5818 typename Allocator, 5819 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, 5820 typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> 5821 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write( 5822 AsyncWriteStream & s, 5823 basic_streambuf< Allocator > & b, 5824 CompletionCondition completion_condition, 5825 WriteHandler && handler); 5826 5827 5828This 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: 5829 5830 5831* All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written. 5832 5833 5834* The completion\_condition function object returns 0. 5835 5836This 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. 5837 5838 5839[heading Parameters] 5840 5841 5842[variablelist 5843 5844[[s][The stream to which the data is to be written. The type must support the AsyncWriteStream concept.]] 5845 5846[[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.]] 5847 5848[[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 5849`` 5850 std::size_t completion_condition( 5851 // Result of latest async_write_some operation. 5852 const boost::system::error_code& error, 5853 5854 // Number of bytes transferred so far. 5855 std::size_t bytes_transferred 5856 ); 5857`` 5858A 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.]] 5859 5860[[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: 5861`` 5862 void handler( 5863 const boost::system::error_code& error, // Result of operation. 5864 5865 std::size_t bytes_transferred // Number of bytes written from the 5866 // buffers. If an error occurred, 5867 // this will be less than the sum 5868 // of the buffer sizes. 5869 ); 5870`` 5871Regardless 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`]. ]] 5872 5873] 5874 5875 5876 5877 5878[endsect] 5879 5880 5881 5882[section:overload7 async_write (7 of 8 overloads)] 5883 5884 5885Start an asynchronous operation to write all of the supplied data to a stream. 5886 5887 5888 template< 5889 typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``, 5890 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``, 5891 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 5892 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write( 5893 AsyncWriteStream & s, 5894 DynamicBuffer_v2 buffers, 5895 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 5896 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 5897 5898 5899This 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: 5900 5901 5902* All of the data in the supplied dynamic buffer sequence has been written. 5903 5904 5905* An error occurred. 5906 5907This 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. 5908 5909 5910[heading Parameters] 5911 5912 5913[variablelist 5914 5915[[s][The stream to which the data is to be written. The type must support the AsyncWriteStream concept.]] 5916 5917[[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.]] 5918 5919[[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: 5920`` 5921 void handler( 5922 const boost::system::error_code& error, // Result of operation. 5923 5924 std::size_t bytes_transferred // Number of bytes written from the 5925 // buffers. If an error occurred, 5926 // this will be less than the sum 5927 // of the buffer sizes. 5928 ); 5929`` 5930Regardless 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`]. ]] 5931 5932] 5933 5934 5935 5936 5937[endsect] 5938 5939 5940 5941[section:overload8 async_write (8 of 8 overloads)] 5942 5943 5944Start an asynchronous operation to write a certain amount of data to a stream. 5945 5946 5947 template< 5948 typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``, 5949 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``, 5950 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, 5951 typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> 5952 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write( 5953 AsyncWriteStream & s, 5954 DynamicBuffer_v2 buffers, 5955 CompletionCondition completion_condition, 5956 WriteHandler && handler, 5957 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 5958 5959 5960This 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: 5961 5962 5963* All of the data in the supplied dynamic buffer sequence has been written. 5964 5965 5966* The completion\_condition function object returns 0. 5967 5968This 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. 5969 5970 5971[heading Parameters] 5972 5973 5974[variablelist 5975 5976[[s][The stream to which the data is to be written. The type must support the AsyncWriteStream concept.]] 5977 5978[[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.]] 5979 5980[[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 5981`` 5982 std::size_t completion_condition( 5983 // Result of latest async_write_some operation. 5984 const boost::system::error_code& error, 5985 5986 // Number of bytes transferred so far. 5987 std::size_t bytes_transferred 5988 ); 5989`` 5990A 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.]] 5991 5992[[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: 5993`` 5994 void handler( 5995 const boost::system::error_code& error, // Result of operation. 5996 5997 std::size_t bytes_transferred // Number of bytes written from the 5998 // buffers. If an error occurred, 5999 // this will be less than the sum 6000 // of the buffer sizes. 6001 ); 6002`` 6003Regardless 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`]. ]] 6004 6005] 6006 6007 6008 6009 6010[endsect] 6011 6012 6013[endsect] 6014 6015[section:async_write_at async_write_at] 6016 6017[indexterm1 boost_asio.indexterm.async_write_at..async_write_at] 6018The `async_write_at` function is a composed asynchronous operation that writes a certain amount of data at the specified offset before completion. 6019 6020 6021Start an asynchronous operation to write all of the supplied data at the specified offset. 6022 6023 template< 6024 typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``, 6025 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 6026 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 6027 ``[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]``( 6028 AsyncRandomAccessWriteDevice & d, 6029 uint64_t offset, 6030 const ConstBufferSequence & buffers, 6031 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 6032 `` [''''»''' [link boost_asio.reference.async_write_at.overload1 more...]]`` 6033 6034Start an asynchronous operation to write a certain amount of data at the specified offset. 6035 6036 template< 6037 typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``, 6038 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 6039 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, 6040 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 6041 ``[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]``( 6042 AsyncRandomAccessWriteDevice & d, 6043 uint64_t offset, 6044 const ConstBufferSequence & buffers, 6045 CompletionCondition completion_condition, 6046 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 6047 `` [''''»''' [link boost_asio.reference.async_write_at.overload2 more...]]`` 6048 6049Start an asynchronous operation to write all of the supplied data at the specified offset. 6050 6051 template< 6052 typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``, 6053 typename Allocator, 6054 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 6055 ``[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]``( 6056 AsyncRandomAccessWriteDevice & d, 6057 uint64_t offset, 6058 basic_streambuf< Allocator > & b, 6059 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 6060 `` [''''»''' [link boost_asio.reference.async_write_at.overload3 more...]]`` 6061 6062Start an asynchronous operation to write a certain amount of data at the specified offset. 6063 6064 template< 6065 typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``, 6066 typename Allocator, 6067 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, 6068 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 6069 ``[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]``( 6070 AsyncRandomAccessWriteDevice & d, 6071 uint64_t offset, 6072 basic_streambuf< Allocator > & b, 6073 CompletionCondition completion_condition, 6074 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 6075 `` [''''»''' [link boost_asio.reference.async_write_at.overload4 more...]]`` 6076 6077[heading Requirements] 6078 6079['Header: ][^boost/asio/write_at.hpp] 6080 6081['Convenience header: ][^boost/asio.hpp] 6082 6083 6084[section:overload1 async_write_at (1 of 4 overloads)] 6085 6086 6087Start an asynchronous operation to write all of the supplied data at the specified offset. 6088 6089 6090 template< 6091 typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``, 6092 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 6093 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 6094 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_at( 6095 AsyncRandomAccessWriteDevice & d, 6096 uint64_t offset, 6097 const ConstBufferSequence & buffers, 6098 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 6099 6100 6101This 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: 6102 6103 6104* 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. 6105 6106 6107* An error occurred. 6108 6109This 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. 6110 6111 6112[heading Parameters] 6113 6114 6115[variablelist 6116 6117[[d][The device to which the data is to be written. The type must support the AsyncRandomAccessWriteDevice concept.]] 6118 6119[[offset][The offset at which the data will be written.]] 6120 6121[[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.]] 6122 6123[[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: 6124`` 6125 void handler( 6126 // Result of operation. 6127 const boost::system::error_code& error, 6128 6129 // Number of bytes written from the buffers. If an error 6130 // occurred, this will be less than the sum of the buffer sizes. 6131 std::size_t bytes_transferred 6132 ); 6133`` 6134Regardless 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`].]] 6135 6136] 6137 6138 6139[heading Example] 6140 6141To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 6142 6143 boost::asio::async_write_at(d, 42, boost::asio::buffer(data, size), handler); 6144 6145 6146See 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. 6147 6148 6149 6150 6151[endsect] 6152 6153 6154 6155[section:overload2 async_write_at (2 of 4 overloads)] 6156 6157 6158Start an asynchronous operation to write a certain amount of data at the specified offset. 6159 6160 6161 template< 6162 typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``, 6163 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 6164 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, 6165 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 6166 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_at( 6167 AsyncRandomAccessWriteDevice & d, 6168 uint64_t offset, 6169 const ConstBufferSequence & buffers, 6170 CompletionCondition completion_condition, 6171 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 6172 6173 6174This 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: 6175 6176 6177* 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. 6178 6179 6180* The completion\_condition function object returns 0. 6181 6182This 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. 6183 6184 6185[heading Parameters] 6186 6187 6188[variablelist 6189 6190[[d][The device to which the data is to be written. The type must support the AsyncRandomAccessWriteDevice concept.]] 6191 6192[[offset][The offset at which the data will be written.]] 6193 6194[[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.]] 6195 6196[[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 6197`` 6198 std::size_t completion_condition( 6199 // Result of latest async_write_some_at operation. 6200 const boost::system::error_code& error, 6201 6202 // Number of bytes transferred so far. 6203 std::size_t bytes_transferred 6204 ); 6205`` 6206A 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.]] 6207 6208[[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: 6209`` 6210 void handler( 6211 // Result of operation. 6212 const boost::system::error_code& error, 6213 6214 // Number of bytes written from the buffers. If an error 6215 // occurred, this will be less than the sum of the buffer sizes. 6216 std::size_t bytes_transferred 6217 ); 6218`` 6219Regardless 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`].]] 6220 6221] 6222 6223 6224[heading Example] 6225 6226To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 6227 6228 boost::asio::async_write_at(d, 42, 6229 boost::asio::buffer(data, size), 6230 boost::asio::transfer_at_least(32), 6231 handler); 6232 6233 6234See 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. 6235 6236 6237 6238 6239[endsect] 6240 6241 6242 6243[section:overload3 async_write_at (3 of 4 overloads)] 6244 6245 6246Start an asynchronous operation to write all of the supplied data at the specified offset. 6247 6248 6249 template< 6250 typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``, 6251 typename Allocator, 6252 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 6253 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_at( 6254 AsyncRandomAccessWriteDevice & d, 6255 uint64_t offset, 6256 basic_streambuf< Allocator > & b, 6257 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 6258 6259 6260This 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: 6261 6262 6263* All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written. 6264 6265 6266* An error occurred. 6267 6268This 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. 6269 6270 6271[heading Parameters] 6272 6273 6274[variablelist 6275 6276[[d][The device to which the data is to be written. The type must support the AsyncRandomAccessWriteDevice concept.]] 6277 6278[[offset][The offset at which the data will be written.]] 6279 6280[[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.]] 6281 6282[[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: 6283`` 6284 void handler( 6285 // Result of operation. 6286 const boost::system::error_code& error, 6287 6288 // Number of bytes written from the buffers. If an error 6289 // occurred, this will be less than the sum of the buffer sizes. 6290 std::size_t bytes_transferred 6291 ); 6292`` 6293Regardless 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`]. ]] 6294 6295] 6296 6297 6298 6299 6300[endsect] 6301 6302 6303 6304[section:overload4 async_write_at (4 of 4 overloads)] 6305 6306 6307Start an asynchronous operation to write a certain amount of data at the specified offset. 6308 6309 6310 template< 6311 typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``, 6312 typename Allocator, 6313 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, 6314 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 6315 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_at( 6316 AsyncRandomAccessWriteDevice & d, 6317 uint64_t offset, 6318 basic_streambuf< Allocator > & b, 6319 CompletionCondition completion_condition, 6320 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 6321 6322 6323This 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: 6324 6325 6326* All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written. 6327 6328 6329* The completion\_condition function object returns 0. 6330 6331This 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. 6332 6333 6334[heading Parameters] 6335 6336 6337[variablelist 6338 6339[[d][The device to which the data is to be written. The type must support the AsyncRandomAccessWriteDevice concept.]] 6340 6341[[offset][The offset at which the data will be written.]] 6342 6343[[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.]] 6344 6345[[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 6346`` 6347 std::size_t completion_condition( 6348 // Result of latest async_write_some_at operation. 6349 const boost::system::error_code& error, 6350 6351 // Number of bytes transferred so far. 6352 std::size_t bytes_transferred 6353 ); 6354`` 6355A 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.]] 6356 6357[[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: 6358`` 6359 void handler( 6360 // Result of operation. 6361 const boost::system::error_code& error, 6362 6363 // Number of bytes written from the buffers. If an error 6364 // occurred, this will be less than the sum of the buffer sizes. 6365 std::size_t bytes_transferred 6366 ); 6367`` 6368Regardless 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`]. ]] 6369 6370] 6371 6372 6373 6374 6375[endsect] 6376 6377 6378[endsect] 6379 6380[section:awaitable awaitable] 6381 6382[indexterm1 boost_asio.indexterm.awaitable..awaitable] 6383 6384 6385The return type of a coroutine or asynchronous operation. 6386 6387 6388 template< 6389 typename T, 6390 typename ``[link boost_asio.reference.Executor1 Executor]`` = any_io_executor> 6391 class awaitable 6392 6393 6394[heading Types] 6395[table 6396 [[Name][Description]] 6397 6398 [ 6399 6400 [[link boost_asio.reference.awaitable.executor_type [*executor_type]]] 6401 [The executor type that will be used for the coroutine. ] 6402 6403 ] 6404 6405 [ 6406 6407 [[link boost_asio.reference.awaitable.value_type [*value_type]]] 6408 [The type of the awaited value. ] 6409 6410 ] 6411 6412] 6413 6414[heading Member Functions] 6415[table 6416 [[Name][Description]] 6417 6418 [ 6419 [[link boost_asio.reference.awaitable.awaitable [*awaitable]] [constructor]] 6420 [Default constructor. 6421 [hr] 6422 Move constructor. ] 6423 ] 6424 6425 [ 6426 [[link boost_asio.reference.awaitable.valid [*valid]]] 6427 [Checks if the awaitable refers to a future result. ] 6428 ] 6429 6430 [ 6431 [[link boost_asio.reference.awaitable._awaitable [*~awaitable]] [destructor]] 6432 [Destructor. ] 6433 ] 6434 6435] 6436 6437[heading Requirements] 6438 6439['Header: ][^boost/asio/awaitable.hpp] 6440 6441['Convenience header: ][^boost/asio.hpp] 6442 6443[section:awaitable awaitable::awaitable] 6444 6445[indexterm2 boost_asio.indexterm.awaitable.awaitable..awaitable..awaitable] 6446Default constructor. 6447 6448 6449 constexpr ``[link boost_asio.reference.awaitable.awaitable.overload1 awaitable]``(); 6450 `` [''''»''' [link boost_asio.reference.awaitable.awaitable.overload1 more...]]`` 6451 6452 6453Move constructor. 6454 6455 6456 ``[link boost_asio.reference.awaitable.awaitable.overload2 awaitable]``( 6457 awaitable && other); 6458 `` [''''»''' [link boost_asio.reference.awaitable.awaitable.overload2 more...]]`` 6459 6460 6461[section:overload1 awaitable::awaitable (1 of 2 overloads)] 6462 6463 6464Default constructor. 6465 6466 6467 constexpr awaitable(); 6468 6469 6470 6471[endsect] 6472 6473 6474 6475[section:overload2 awaitable::awaitable (2 of 2 overloads)] 6476 6477 6478Move constructor. 6479 6480 6481 awaitable( 6482 awaitable && other); 6483 6484 6485 6486[endsect] 6487 6488 6489[endsect] 6490 6491 6492[section:executor_type awaitable::executor_type] 6493 6494[indexterm2 boost_asio.indexterm.awaitable.executor_type..executor_type..awaitable] 6495The executor type that will be used for the coroutine. 6496 6497 6498 typedef Executor executor_type; 6499 6500 6501 6502[heading Requirements] 6503 6504['Header: ][^boost/asio/awaitable.hpp] 6505 6506['Convenience header: ][^boost/asio.hpp] 6507 6508 6509[endsect] 6510 6511 6512 6513[section:valid awaitable::valid] 6514 6515[indexterm2 boost_asio.indexterm.awaitable.valid..valid..awaitable] 6516Checks if the awaitable refers to a future result. 6517 6518 6519 bool valid() const; 6520 6521 6522 6523[endsect] 6524 6525 6526 6527[section:value_type awaitable::value_type] 6528 6529[indexterm2 boost_asio.indexterm.awaitable.value_type..value_type..awaitable] 6530The type of the awaited value. 6531 6532 6533 typedef T value_type; 6534 6535 6536 6537[heading Requirements] 6538 6539['Header: ][^boost/asio/awaitable.hpp] 6540 6541['Convenience header: ][^boost/asio.hpp] 6542 6543 6544[endsect] 6545 6546 6547 6548[section:_awaitable awaitable::~awaitable] 6549 6550[indexterm2 boost_asio.indexterm.awaitable._awaitable..~awaitable..awaitable] 6551Destructor. 6552 6553 6554 ~awaitable(); 6555 6556 6557 6558[endsect] 6559 6560 6561 6562[endsect] 6563 6564[section:bad_executor bad_executor] 6565 6566[indexterm1 boost_asio.indexterm.bad_executor..bad_executor] 6567 6568 6569Exception thrown when trying to access an empty polymorphic executor. 6570 6571 6572 class bad_executor : 6573 public std::exception 6574 6575 6576[heading Member Functions] 6577[table 6578 [[Name][Description]] 6579 6580 [ 6581 [[link boost_asio.reference.bad_executor.bad_executor [*bad_executor]] [constructor]] 6582 [Constructor. ] 6583 ] 6584 6585 [ 6586 [[link boost_asio.reference.bad_executor.what [*what]]] 6587 [Obtain message associated with exception. ] 6588 ] 6589 6590] 6591 6592[heading Requirements] 6593 6594['Header: ][^boost/asio/executor.hpp] 6595 6596['Convenience header: ][^boost/asio.hpp] 6597 6598 6599[section:bad_executor bad_executor::bad_executor] 6600 6601[indexterm2 boost_asio.indexterm.bad_executor.bad_executor..bad_executor..bad_executor] 6602Constructor. 6603 6604 6605 bad_executor(); 6606 6607 6608 6609[endsect] 6610 6611 6612 6613[section:what bad_executor::what] 6614 6615[indexterm2 boost_asio.indexterm.bad_executor.what..what..bad_executor] 6616Obtain message associated with exception. 6617 6618 6619 virtual const char * what() const; 6620 6621 6622 6623[endsect] 6624 6625 6626 6627[endsect] 6628 6629[section:basic_datagram_socket basic_datagram_socket] 6630 6631[indexterm1 boost_asio.indexterm.basic_datagram_socket..basic_datagram_socket] 6632 6633 6634Provides datagram-oriented socket functionality. 6635 6636 6637 template< 6638 typename ``[link boost_asio.reference.Protocol Protocol]``, 6639 typename ``[link boost_asio.reference.Executor1 Executor]``> 6640 class basic_datagram_socket : 6641 public basic_socket< Protocol, Executor > 6642 6643 6644[heading Types] 6645[table 6646 [[Name][Description]] 6647 6648 [ 6649 6650 [[link boost_asio.reference.basic_datagram_socket__rebind_executor [*rebind_executor]]] 6651 [Rebinds the socket type to another executor. ] 6652 6653 ] 6654 6655 [ 6656 6657 [[link boost_asio.reference.basic_datagram_socket.broadcast [*broadcast]]] 6658 [Socket option to permit sending of broadcast messages. ] 6659 6660 ] 6661 6662 [ 6663 6664 [[link boost_asio.reference.basic_datagram_socket.bytes_readable [*bytes_readable]]] 6665 [IO control command to get the amount of data that can be read without blocking. ] 6666 6667 ] 6668 6669 [ 6670 6671 [[link boost_asio.reference.basic_datagram_socket.debug [*debug]]] 6672 [Socket option to enable socket-level debugging. ] 6673 6674 ] 6675 6676 [ 6677 6678 [[link boost_asio.reference.basic_datagram_socket.do_not_route [*do_not_route]]] 6679 [Socket option to prevent routing, use local interfaces only. ] 6680 6681 ] 6682 6683 [ 6684 6685 [[link boost_asio.reference.basic_datagram_socket.enable_connection_aborted [*enable_connection_aborted]]] 6686 [Socket option to report aborted connections on accept. ] 6687 6688 ] 6689 6690 [ 6691 6692 [[link boost_asio.reference.basic_datagram_socket.endpoint_type [*endpoint_type]]] 6693 [The endpoint type. ] 6694 6695 ] 6696 6697 [ 6698 6699 [[link boost_asio.reference.basic_datagram_socket.executor_type [*executor_type]]] 6700 [The type of the executor associated with the object. ] 6701 6702 ] 6703 6704 [ 6705 6706 [[link boost_asio.reference.basic_datagram_socket.keep_alive [*keep_alive]]] 6707 [Socket option to send keep-alives. ] 6708 6709 ] 6710 6711 [ 6712 6713 [[link boost_asio.reference.basic_datagram_socket.linger [*linger]]] 6714 [Socket option to specify whether the socket lingers on close if unsent data is present. ] 6715 6716 ] 6717 6718 [ 6719 6720 [[link boost_asio.reference.basic_datagram_socket.lowest_layer_type [*lowest_layer_type]]] 6721 [A basic_socket is always the lowest layer. ] 6722 6723 ] 6724 6725 [ 6726 6727 [[link boost_asio.reference.basic_datagram_socket.message_flags [*message_flags]]] 6728 [Bitmask type for flags that can be passed to send and receive operations. ] 6729 6730 ] 6731 6732 [ 6733 6734 [[link boost_asio.reference.basic_datagram_socket.native_handle_type [*native_handle_type]]] 6735 [The native representation of a socket. ] 6736 6737 ] 6738 6739 [ 6740 6741 [[link boost_asio.reference.basic_datagram_socket.out_of_band_inline [*out_of_band_inline]]] 6742 [Socket option for putting received out-of-band data inline. ] 6743 6744 ] 6745 6746 [ 6747 6748 [[link boost_asio.reference.basic_datagram_socket.protocol_type [*protocol_type]]] 6749 [The protocol type. ] 6750 6751 ] 6752 6753 [ 6754 6755 [[link boost_asio.reference.basic_datagram_socket.receive_buffer_size [*receive_buffer_size]]] 6756 [Socket option for the receive buffer size of a socket. ] 6757 6758 ] 6759 6760 [ 6761 6762 [[link boost_asio.reference.basic_datagram_socket.receive_low_watermark [*receive_low_watermark]]] 6763 [Socket option for the receive low watermark. ] 6764 6765 ] 6766 6767 [ 6768 6769 [[link boost_asio.reference.basic_datagram_socket.reuse_address [*reuse_address]]] 6770 [Socket option to allow the socket to be bound to an address that is already in use. ] 6771 6772 ] 6773 6774 [ 6775 6776 [[link boost_asio.reference.basic_datagram_socket.send_buffer_size [*send_buffer_size]]] 6777 [Socket option for the send buffer size of a socket. ] 6778 6779 ] 6780 6781 [ 6782 6783 [[link boost_asio.reference.basic_datagram_socket.send_low_watermark [*send_low_watermark]]] 6784 [Socket option for the send low watermark. ] 6785 6786 ] 6787 6788 [ 6789 6790 [[link boost_asio.reference.basic_datagram_socket.shutdown_type [*shutdown_type]]] 6791 [Different ways a socket may be shutdown. ] 6792 6793 ] 6794 6795 [ 6796 6797 [[link boost_asio.reference.basic_datagram_socket.wait_type [*wait_type]]] 6798 [Wait types. ] 6799 6800 ] 6801 6802] 6803 6804[heading Member Functions] 6805[table 6806 [[Name][Description]] 6807 6808 [ 6809 [[link boost_asio.reference.basic_datagram_socket.assign [*assign]]] 6810 [Assign an existing native socket to the socket. ] 6811 ] 6812 6813 [ 6814 [[link boost_asio.reference.basic_datagram_socket.async_connect [*async_connect]]] 6815 [Start an asynchronous connect. ] 6816 ] 6817 6818 [ 6819 [[link boost_asio.reference.basic_datagram_socket.async_receive [*async_receive]]] 6820 [Start an asynchronous receive on a connected socket. ] 6821 ] 6822 6823 [ 6824 [[link boost_asio.reference.basic_datagram_socket.async_receive_from [*async_receive_from]]] 6825 [Start an asynchronous receive. ] 6826 ] 6827 6828 [ 6829 [[link boost_asio.reference.basic_datagram_socket.async_send [*async_send]]] 6830 [Start an asynchronous send on a connected socket. ] 6831 ] 6832 6833 [ 6834 [[link boost_asio.reference.basic_datagram_socket.async_send_to [*async_send_to]]] 6835 [Start an asynchronous send. ] 6836 ] 6837 6838 [ 6839 [[link boost_asio.reference.basic_datagram_socket.async_wait [*async_wait]]] 6840 [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 6841 ] 6842 6843 [ 6844 [[link boost_asio.reference.basic_datagram_socket.at_mark [*at_mark]]] 6845 [Determine whether the socket is at the out-of-band data mark. ] 6846 ] 6847 6848 [ 6849 [[link boost_asio.reference.basic_datagram_socket.available [*available]]] 6850 [Determine the number of bytes available for reading. ] 6851 ] 6852 6853 [ 6854 [[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket [*basic_datagram_socket]] [constructor]] 6855 [Construct a basic_datagram_socket without opening it. 6856 [hr] 6857 Construct and open a basic_datagram_socket. 6858 [hr] 6859 Construct a basic_datagram_socket, opening it and binding it to the given local endpoint. 6860 [hr] 6861 Construct a basic_datagram_socket on an existing native socket. 6862 [hr] 6863 Move-construct a basic_datagram_socket from another. 6864 [hr] 6865 Move-construct a basic_datagram_socket from a socket of another protocol type. ] 6866 ] 6867 6868 [ 6869 [[link boost_asio.reference.basic_datagram_socket.bind [*bind]]] 6870 [Bind the socket to the given local endpoint. ] 6871 ] 6872 6873 [ 6874 [[link boost_asio.reference.basic_datagram_socket.cancel [*cancel]]] 6875 [Cancel all asynchronous operations associated with the socket. ] 6876 ] 6877 6878 [ 6879 [[link boost_asio.reference.basic_datagram_socket.close [*close]]] 6880 [Close the socket. ] 6881 ] 6882 6883 [ 6884 [[link boost_asio.reference.basic_datagram_socket.connect [*connect]]] 6885 [Connect the socket to the specified endpoint. ] 6886 ] 6887 6888 [ 6889 [[link boost_asio.reference.basic_datagram_socket.get_executor [*get_executor]]] 6890 [Get the executor associated with the object. ] 6891 ] 6892 6893 [ 6894 [[link boost_asio.reference.basic_datagram_socket.get_option [*get_option]]] 6895 [Get an option from the socket. ] 6896 ] 6897 6898 [ 6899 [[link boost_asio.reference.basic_datagram_socket.io_control [*io_control]]] 6900 [Perform an IO control command on the socket. ] 6901 ] 6902 6903 [ 6904 [[link boost_asio.reference.basic_datagram_socket.is_open [*is_open]]] 6905 [Determine whether the socket is open. ] 6906 ] 6907 6908 [ 6909 [[link boost_asio.reference.basic_datagram_socket.local_endpoint [*local_endpoint]]] 6910 [Get the local endpoint of the socket. ] 6911 ] 6912 6913 [ 6914 [[link boost_asio.reference.basic_datagram_socket.lowest_layer [*lowest_layer]]] 6915 [Get a reference to the lowest layer. 6916 [hr] 6917 Get a const reference to the lowest layer. ] 6918 ] 6919 6920 [ 6921 [[link boost_asio.reference.basic_datagram_socket.native_handle [*native_handle]]] 6922 [Get the native socket representation. ] 6923 ] 6924 6925 [ 6926 [[link boost_asio.reference.basic_datagram_socket.native_non_blocking [*native_non_blocking]]] 6927 [Gets the non-blocking mode of the native socket implementation. 6928 [hr] 6929 Sets the non-blocking mode of the native socket implementation. ] 6930 ] 6931 6932 [ 6933 [[link boost_asio.reference.basic_datagram_socket.non_blocking [*non_blocking]]] 6934 [Gets the non-blocking mode of the socket. 6935 [hr] 6936 Sets the non-blocking mode of the socket. ] 6937 ] 6938 6939 [ 6940 [[link boost_asio.reference.basic_datagram_socket.open [*open]]] 6941 [Open the socket using the specified protocol. ] 6942 ] 6943 6944 [ 6945 [[link boost_asio.reference.basic_datagram_socket.operator_eq_ [*operator=]]] 6946 [Move-assign a basic_datagram_socket from another. 6947 [hr] 6948 Move-assign a basic_datagram_socket from a socket of another protocol type. ] 6949 ] 6950 6951 [ 6952 [[link boost_asio.reference.basic_datagram_socket.receive [*receive]]] 6953 [Receive some data on a connected socket. ] 6954 ] 6955 6956 [ 6957 [[link boost_asio.reference.basic_datagram_socket.receive_from [*receive_from]]] 6958 [Receive a datagram with the endpoint of the sender. ] 6959 ] 6960 6961 [ 6962 [[link boost_asio.reference.basic_datagram_socket.release [*release]]] 6963 [Release ownership of the underlying native socket. ] 6964 ] 6965 6966 [ 6967 [[link boost_asio.reference.basic_datagram_socket.remote_endpoint [*remote_endpoint]]] 6968 [Get the remote endpoint of the socket. ] 6969 ] 6970 6971 [ 6972 [[link boost_asio.reference.basic_datagram_socket.send [*send]]] 6973 [Send some data on a connected socket. ] 6974 ] 6975 6976 [ 6977 [[link boost_asio.reference.basic_datagram_socket.send_to [*send_to]]] 6978 [Send a datagram to the specified endpoint. ] 6979 ] 6980 6981 [ 6982 [[link boost_asio.reference.basic_datagram_socket.set_option [*set_option]]] 6983 [Set an option on the socket. ] 6984 ] 6985 6986 [ 6987 [[link boost_asio.reference.basic_datagram_socket.shutdown [*shutdown]]] 6988 [Disable sends or receives on the socket. ] 6989 ] 6990 6991 [ 6992 [[link boost_asio.reference.basic_datagram_socket.wait [*wait]]] 6993 [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 6994 ] 6995 6996 [ 6997 [[link boost_asio.reference.basic_datagram_socket._basic_datagram_socket [*~basic_datagram_socket]] [destructor]] 6998 [Destroys the socket. ] 6999 ] 7000 7001] 7002 7003[heading Data Members] 7004[table 7005 [[Name][Description]] 7006 7007 [ 7008 [[link boost_asio.reference.basic_datagram_socket.max_connections [*max_connections]] [static]] 7009 [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ] 7010 ] 7011 7012 [ 7013 [[link boost_asio.reference.basic_datagram_socket.max_listen_connections [*max_listen_connections]] [static]] 7014 [The maximum length of the queue of pending incoming connections. ] 7015 ] 7016 7017 [ 7018 [[link boost_asio.reference.basic_datagram_socket.message_do_not_route [*message_do_not_route]] [static]] 7019 [Specify that the data should not be subject to routing. ] 7020 ] 7021 7022 [ 7023 [[link boost_asio.reference.basic_datagram_socket.message_end_of_record [*message_end_of_record]] [static]] 7024 [Specifies that the data marks the end of a record. ] 7025 ] 7026 7027 [ 7028 [[link boost_asio.reference.basic_datagram_socket.message_out_of_band [*message_out_of_band]] [static]] 7029 [Process out-of-band data. ] 7030 ] 7031 7032 [ 7033 [[link boost_asio.reference.basic_datagram_socket.message_peek [*message_peek]] [static]] 7034 [Peek at incoming data without removing it from the input queue. ] 7035 ] 7036 7037] 7038 7039The [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] class template provides asynchronous and blocking datagram-oriented socket functionality. 7040 7041 7042[heading Thread Safety] 7043 7044['Distinct] ['objects:] Safe. 7045 7046['Shared] ['objects:] Unsafe. 7047 7048Synchronous `send`, `send_to`, `receive`, `receive_from`, and `connect` operations are thread safe with respect to each other, if the underlying operating system calls are also thread safe. This means that it is permitted to perform concurrent calls to these synchronous operations on a single socket object. Other synchronous operations, such as `open` or `close`, are not thread safe. 7049 7050[heading Requirements] 7051 7052['Header: ][^boost/asio/basic_datagram_socket.hpp] 7053 7054['Convenience header: ][^boost/asio.hpp] 7055 7056[section:assign basic_datagram_socket::assign] 7057 7058[indexterm2 boost_asio.indexterm.basic_datagram_socket.assign..assign..basic_datagram_socket] 7059Assign an existing native socket to the socket. 7060 7061 7062 void ``[link boost_asio.reference.basic_datagram_socket.assign.overload1 assign]``( 7063 const protocol_type & protocol, 7064 const native_handle_type & native_socket); 7065 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.assign.overload1 more...]]`` 7066 7067 void ``[link boost_asio.reference.basic_datagram_socket.assign.overload2 assign]``( 7068 const protocol_type & protocol, 7069 const native_handle_type & native_socket, 7070 boost::system::error_code & ec); 7071 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.assign.overload2 more...]]`` 7072 7073 7074[section:overload1 basic_datagram_socket::assign (1 of 2 overloads)] 7075 7076 7077['Inherited from basic_socket.] 7078 7079 7080Assign an existing native socket to the socket. 7081 7082 7083 void assign( 7084 const protocol_type & protocol, 7085 const native_handle_type & native_socket); 7086 7087 7088 7089[endsect] 7090 7091 7092 7093[section:overload2 basic_datagram_socket::assign (2 of 2 overloads)] 7094 7095 7096['Inherited from basic_socket.] 7097 7098 7099Assign an existing native socket to the socket. 7100 7101 7102 void assign( 7103 const protocol_type & protocol, 7104 const native_handle_type & native_socket, 7105 boost::system::error_code & ec); 7106 7107 7108 7109[endsect] 7110 7111 7112[endsect] 7113 7114 7115[section:async_connect basic_datagram_socket::async_connect] 7116 7117 7118['Inherited from basic_socket.] 7119 7120[indexterm2 boost_asio.indexterm.basic_datagram_socket.async_connect..async_connect..basic_datagram_socket] 7121Start an asynchronous connect. 7122 7123 7124 template< 7125 typename ``[link boost_asio.reference.ConnectHandler ConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 7126 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect( 7127 const endpoint_type & peer_endpoint, 7128 ConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 7129 7130 7131This function is used to asynchronously connect a socket to the specified remote endpoint. The function call always returns immediately. 7132 7133The 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. 7134 7135 7136[heading Parameters] 7137 7138 7139[variablelist 7140 7141[[peer_endpoint][The remote endpoint to which the socket will be connected. Copies will be made of the endpoint object as required.]] 7142 7143[[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: 7144`` 7145 void handler( 7146 const boost::system::error_code& error // Result of operation 7147 ); 7148`` 7149Regardless 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`].]] 7150 7151] 7152 7153 7154[heading Example] 7155 7156 7157 7158 void connect_handler(const boost::system::error_code& error) 7159 { 7160 if (!error) 7161 { 7162 // Connect succeeded. 7163 } 7164 } 7165 7166 ... 7167 7168 boost::asio::ip::tcp::socket socket(my_context); 7169 boost::asio::ip::tcp::endpoint endpoint( 7170 boost::asio::ip::address::from_string("1.2.3.4"), 12345); 7171 socket.async_connect(endpoint, connect_handler); 7172 7173 7174 7175 7176 7177 7178 7179[endsect] 7180 7181 7182[section:async_receive basic_datagram_socket::async_receive] 7183 7184[indexterm2 boost_asio.indexterm.basic_datagram_socket.async_receive..async_receive..basic_datagram_socket] 7185Start an asynchronous receive on a connected socket. 7186 7187 7188 template< 7189 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 7190 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 7191 ``[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]``( 7192 const MutableBufferSequence & buffers, 7193 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 7194 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.async_receive.overload1 more...]]`` 7195 7196 template< 7197 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 7198 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 7199 ``[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]``( 7200 const MutableBufferSequence & buffers, 7201 socket_base::message_flags flags, 7202 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 7203 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.async_receive.overload2 more...]]`` 7204 7205 7206[section:overload1 basic_datagram_socket::async_receive (1 of 2 overloads)] 7207 7208 7209Start an asynchronous receive on a connected socket. 7210 7211 7212 template< 7213 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 7214 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 7215 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive( 7216 const MutableBufferSequence & buffers, 7217 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 7218 7219 7220This function is used to asynchronously receive data from the datagram socket. The function call always returns immediately. 7221 7222 7223[heading Parameters] 7224 7225 7226[variablelist 7227 7228[[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.]] 7229 7230[[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: 7231`` 7232 void handler( 7233 const boost::system::error_code& error, // Result of operation. 7234 std::size_t bytes_transferred // Number of bytes received. 7235 ); 7236`` 7237Regardless 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`].]] 7238 7239] 7240 7241 7242[heading Remarks] 7243 7244The 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. 7245 7246 7247[heading Example] 7248 7249To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 7250 7251 socket.async_receive(boost::asio::buffer(data, size), handler); 7252 7253 7254See 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. 7255 7256 7257 7258 7259[endsect] 7260 7261 7262 7263[section:overload2 basic_datagram_socket::async_receive (2 of 2 overloads)] 7264 7265 7266Start an asynchronous receive on a connected socket. 7267 7268 7269 template< 7270 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 7271 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 7272 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive( 7273 const MutableBufferSequence & buffers, 7274 socket_base::message_flags flags, 7275 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 7276 7277 7278This function is used to asynchronously receive data from the datagram socket. The function call always returns immediately. 7279 7280 7281[heading Parameters] 7282 7283 7284[variablelist 7285 7286[[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.]] 7287 7288[[flags][Flags specifying how the receive call is to be made.]] 7289 7290[[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: 7291`` 7292 void handler( 7293 const boost::system::error_code& error, // Result of operation. 7294 std::size_t bytes_transferred // Number of bytes received. 7295 ); 7296`` 7297Regardless 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`].]] 7298 7299] 7300 7301 7302[heading Remarks] 7303 7304The 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. 7305 7306 7307 7308 7309[endsect] 7310 7311 7312[endsect] 7313 7314[section:async_receive_from basic_datagram_socket::async_receive_from] 7315 7316[indexterm2 boost_asio.indexterm.basic_datagram_socket.async_receive_from..async_receive_from..basic_datagram_socket] 7317Start an asynchronous receive. 7318 7319 7320 template< 7321 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 7322 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 7323 ``[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]``( 7324 const MutableBufferSequence & buffers, 7325 endpoint_type & sender_endpoint, 7326 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 7327 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.async_receive_from.overload1 more...]]`` 7328 7329 template< 7330 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 7331 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 7332 ``[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]``( 7333 const MutableBufferSequence & buffers, 7334 endpoint_type & sender_endpoint, 7335 socket_base::message_flags flags, 7336 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 7337 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.async_receive_from.overload2 more...]]`` 7338 7339 7340[section:overload1 basic_datagram_socket::async_receive_from (1 of 2 overloads)] 7341 7342 7343Start an asynchronous receive. 7344 7345 7346 template< 7347 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 7348 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 7349 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive_from( 7350 const MutableBufferSequence & buffers, 7351 endpoint_type & sender_endpoint, 7352 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 7353 7354 7355This function is used to asynchronously receive a datagram. The function call always returns immediately. 7356 7357 7358[heading Parameters] 7359 7360 7361[variablelist 7362 7363[[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.]] 7364 7365[[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.]] 7366 7367[[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: 7368`` 7369 void handler( 7370 const boost::system::error_code& error, // Result of operation. 7371 std::size_t bytes_transferred // Number of bytes received. 7372 ); 7373`` 7374Regardless 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`].]] 7375 7376] 7377 7378 7379[heading Example] 7380 7381To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 7382 7383 socket.async_receive_from( 7384 boost::asio::buffer(data, size), sender_endpoint, handler); 7385 7386 7387See 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. 7388 7389 7390 7391 7392[endsect] 7393 7394 7395 7396[section:overload2 basic_datagram_socket::async_receive_from (2 of 2 overloads)] 7397 7398 7399Start an asynchronous receive. 7400 7401 7402 template< 7403 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 7404 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 7405 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive_from( 7406 const MutableBufferSequence & buffers, 7407 endpoint_type & sender_endpoint, 7408 socket_base::message_flags flags, 7409 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 7410 7411 7412This function is used to asynchronously receive a datagram. The function call always returns immediately. 7413 7414 7415[heading Parameters] 7416 7417 7418[variablelist 7419 7420[[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.]] 7421 7422[[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.]] 7423 7424[[flags][Flags specifying how the receive call is to be made.]] 7425 7426[[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: 7427`` 7428 void handler( 7429 const boost::system::error_code& error, // Result of operation. 7430 std::size_t bytes_transferred // Number of bytes received. 7431 ); 7432`` 7433Regardless 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`]. ]] 7434 7435] 7436 7437 7438 7439 7440[endsect] 7441 7442 7443[endsect] 7444 7445[section:async_send basic_datagram_socket::async_send] 7446 7447[indexterm2 boost_asio.indexterm.basic_datagram_socket.async_send..async_send..basic_datagram_socket] 7448Start an asynchronous send on a connected socket. 7449 7450 7451 template< 7452 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 7453 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 7454 ``[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]``( 7455 const ConstBufferSequence & buffers, 7456 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 7457 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.async_send.overload1 more...]]`` 7458 7459 template< 7460 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 7461 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 7462 ``[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]``( 7463 const ConstBufferSequence & buffers, 7464 socket_base::message_flags flags, 7465 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 7466 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.async_send.overload2 more...]]`` 7467 7468 7469[section:overload1 basic_datagram_socket::async_send (1 of 2 overloads)] 7470 7471 7472Start an asynchronous send on a connected socket. 7473 7474 7475 template< 7476 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 7477 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 7478 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send( 7479 const ConstBufferSequence & buffers, 7480 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 7481 7482 7483This function is used to asynchronously send data on the datagram socket. The function call always returns immediately. 7484 7485 7486[heading Parameters] 7487 7488 7489[variablelist 7490 7491[[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.]] 7492 7493[[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: 7494`` 7495 void handler( 7496 const boost::system::error_code& error, // Result of operation. 7497 std::size_t bytes_transferred // Number of bytes sent. 7498 ); 7499`` 7500Regardless 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`].]] 7501 7502] 7503 7504 7505[heading Remarks] 7506 7507The 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. 7508 7509 7510[heading Example] 7511 7512To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 7513 7514 socket.async_send(boost::asio::buffer(data, size), handler); 7515 7516 7517See 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. 7518 7519 7520 7521 7522[endsect] 7523 7524 7525 7526[section:overload2 basic_datagram_socket::async_send (2 of 2 overloads)] 7527 7528 7529Start an asynchronous send on a connected socket. 7530 7531 7532 template< 7533 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 7534 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 7535 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send( 7536 const ConstBufferSequence & buffers, 7537 socket_base::message_flags flags, 7538 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 7539 7540 7541This function is used to asynchronously send data on the datagram socket. The function call always returns immediately. 7542 7543 7544[heading Parameters] 7545 7546 7547[variablelist 7548 7549[[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.]] 7550 7551[[flags][Flags specifying how the send call is to be made.]] 7552 7553[[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: 7554`` 7555 void handler( 7556 const boost::system::error_code& error, // Result of operation. 7557 std::size_t bytes_transferred // Number of bytes sent. 7558 ); 7559`` 7560Regardless 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`].]] 7561 7562] 7563 7564 7565[heading Remarks] 7566 7567The 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. 7568 7569 7570 7571 7572[endsect] 7573 7574 7575[endsect] 7576 7577[section:async_send_to basic_datagram_socket::async_send_to] 7578 7579[indexterm2 boost_asio.indexterm.basic_datagram_socket.async_send_to..async_send_to..basic_datagram_socket] 7580Start an asynchronous send. 7581 7582 7583 template< 7584 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 7585 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 7586 ``[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]``( 7587 const ConstBufferSequence & buffers, 7588 const endpoint_type & destination, 7589 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 7590 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.async_send_to.overload1 more...]]`` 7591 7592 template< 7593 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 7594 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 7595 ``[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]``( 7596 const ConstBufferSequence & buffers, 7597 const endpoint_type & destination, 7598 socket_base::message_flags flags, 7599 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 7600 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.async_send_to.overload2 more...]]`` 7601 7602 7603[section:overload1 basic_datagram_socket::async_send_to (1 of 2 overloads)] 7604 7605 7606Start an asynchronous send. 7607 7608 7609 template< 7610 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 7611 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 7612 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send_to( 7613 const ConstBufferSequence & buffers, 7614 const endpoint_type & destination, 7615 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 7616 7617 7618This function is used to asynchronously send a datagram to the specified remote endpoint. The function call always returns immediately. 7619 7620 7621[heading Parameters] 7622 7623 7624[variablelist 7625 7626[[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.]] 7627 7628[[destination][The remote endpoint to which the data will be sent. Copies will be made of the endpoint as required.]] 7629 7630[[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: 7631`` 7632 void handler( 7633 const boost::system::error_code& error, // Result of operation. 7634 std::size_t bytes_transferred // Number of bytes sent. 7635 ); 7636`` 7637Regardless 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`].]] 7638 7639] 7640 7641 7642[heading Example] 7643 7644To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 7645 7646 boost::asio::ip::udp::endpoint destination( 7647 boost::asio::ip::address::from_string("1.2.3.4"), 12345); 7648 socket.async_send_to( 7649 boost::asio::buffer(data, size), destination, handler); 7650 7651 7652See 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. 7653 7654 7655 7656 7657[endsect] 7658 7659 7660 7661[section:overload2 basic_datagram_socket::async_send_to (2 of 2 overloads)] 7662 7663 7664Start an asynchronous send. 7665 7666 7667 template< 7668 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 7669 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 7670 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send_to( 7671 const ConstBufferSequence & buffers, 7672 const endpoint_type & destination, 7673 socket_base::message_flags flags, 7674 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 7675 7676 7677This function is used to asynchronously send a datagram to the specified remote endpoint. The function call always returns immediately. 7678 7679 7680[heading Parameters] 7681 7682 7683[variablelist 7684 7685[[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.]] 7686 7687[[flags][Flags specifying how the send call is to be made.]] 7688 7689[[destination][The remote endpoint to which the data will be sent. Copies will be made of the endpoint as required.]] 7690 7691[[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: 7692`` 7693 void handler( 7694 const boost::system::error_code& error, // Result of operation. 7695 std::size_t bytes_transferred // Number of bytes sent. 7696 ); 7697`` 7698Regardless 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`]. ]] 7699 7700] 7701 7702 7703 7704 7705[endsect] 7706 7707 7708[endsect] 7709 7710 7711[section:async_wait basic_datagram_socket::async_wait] 7712 7713 7714['Inherited from basic_socket.] 7715 7716[indexterm2 boost_asio.indexterm.basic_datagram_socket.async_wait..async_wait..basic_datagram_socket] 7717Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. 7718 7719 7720 template< 7721 typename ``[link boost_asio.reference.WaitHandler WaitHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 7722 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait( 7723 wait_type w, 7724 WaitHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 7725 7726 7727This function is used to perform an asynchronous wait for a socket to enter a ready to read, write or error condition state. 7728 7729 7730[heading Parameters] 7731 7732 7733[variablelist 7734 7735[[w][Specifies the desired socket state.]] 7736 7737[[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: 7738`` 7739 void handler( 7740 const boost::system::error_code& error // Result of operation 7741 ); 7742`` 7743Regardless 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`].]] 7744 7745] 7746 7747 7748[heading Example] 7749 7750 7751 7752 void wait_handler(const boost::system::error_code& error) 7753 { 7754 if (!error) 7755 { 7756 // Wait succeeded. 7757 } 7758 } 7759 7760 ... 7761 7762 boost::asio::ip::tcp::socket socket(my_context); 7763 ... 7764 socket.async_wait(boost::asio::ip::tcp::socket::wait_read, wait_handler); 7765 7766 7767 7768 7769 7770 7771 7772[endsect] 7773 7774 7775[section:at_mark basic_datagram_socket::at_mark] 7776 7777[indexterm2 boost_asio.indexterm.basic_datagram_socket.at_mark..at_mark..basic_datagram_socket] 7778Determine whether the socket is at the out-of-band data mark. 7779 7780 7781 bool ``[link boost_asio.reference.basic_datagram_socket.at_mark.overload1 at_mark]``() const; 7782 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.at_mark.overload1 more...]]`` 7783 7784 bool ``[link boost_asio.reference.basic_datagram_socket.at_mark.overload2 at_mark]``( 7785 boost::system::error_code & ec) const; 7786 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.at_mark.overload2 more...]]`` 7787 7788 7789[section:overload1 basic_datagram_socket::at_mark (1 of 2 overloads)] 7790 7791 7792['Inherited from basic_socket.] 7793 7794 7795Determine whether the socket is at the out-of-band data mark. 7796 7797 7798 bool at_mark() const; 7799 7800 7801This function is used to check whether the socket input is currently positioned at the out-of-band data mark. 7802 7803 7804[heading Return Value] 7805 7806A bool indicating whether the socket is at the out-of-band data mark. 7807 7808 7809[heading Exceptions] 7810 7811 7812[variablelist 7813 7814[[boost::system::system_error][Thrown on failure. ]] 7815 7816] 7817 7818 7819 7820 7821[endsect] 7822 7823 7824 7825[section:overload2 basic_datagram_socket::at_mark (2 of 2 overloads)] 7826 7827 7828['Inherited from basic_socket.] 7829 7830 7831Determine whether the socket is at the out-of-band data mark. 7832 7833 7834 bool at_mark( 7835 boost::system::error_code & ec) const; 7836 7837 7838This function is used to check whether the socket input is currently positioned at the out-of-band data mark. 7839 7840 7841[heading Parameters] 7842 7843 7844[variablelist 7845 7846[[ec][Set to indicate what error occurred, if any.]] 7847 7848] 7849 7850 7851[heading Return Value] 7852 7853A bool indicating whether the socket is at the out-of-band data mark. 7854 7855 7856 7857 7858[endsect] 7859 7860 7861[endsect] 7862 7863[section:available basic_datagram_socket::available] 7864 7865[indexterm2 boost_asio.indexterm.basic_datagram_socket.available..available..basic_datagram_socket] 7866Determine the number of bytes available for reading. 7867 7868 7869 std::size_t ``[link boost_asio.reference.basic_datagram_socket.available.overload1 available]``() const; 7870 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.available.overload1 more...]]`` 7871 7872 std::size_t ``[link boost_asio.reference.basic_datagram_socket.available.overload2 available]``( 7873 boost::system::error_code & ec) const; 7874 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.available.overload2 more...]]`` 7875 7876 7877[section:overload1 basic_datagram_socket::available (1 of 2 overloads)] 7878 7879 7880['Inherited from basic_socket.] 7881 7882 7883Determine the number of bytes available for reading. 7884 7885 7886 std::size_t available() const; 7887 7888 7889This function is used to determine the number of bytes that may be read without blocking. 7890 7891 7892[heading Return Value] 7893 7894The number of bytes that may be read without blocking, or 0 if an error occurs. 7895 7896 7897[heading Exceptions] 7898 7899 7900[variablelist 7901 7902[[boost::system::system_error][Thrown on failure. ]] 7903 7904] 7905 7906 7907 7908 7909[endsect] 7910 7911 7912 7913[section:overload2 basic_datagram_socket::available (2 of 2 overloads)] 7914 7915 7916['Inherited from basic_socket.] 7917 7918 7919Determine the number of bytes available for reading. 7920 7921 7922 std::size_t available( 7923 boost::system::error_code & ec) const; 7924 7925 7926This function is used to determine the number of bytes that may be read without blocking. 7927 7928 7929[heading Parameters] 7930 7931 7932[variablelist 7933 7934[[ec][Set to indicate what error occurred, if any.]] 7935 7936] 7937 7938 7939[heading Return Value] 7940 7941The number of bytes that may be read without blocking, or 0 if an error occurs. 7942 7943 7944 7945 7946[endsect] 7947 7948 7949[endsect] 7950 7951[section:basic_datagram_socket basic_datagram_socket::basic_datagram_socket] 7952 7953[indexterm2 boost_asio.indexterm.basic_datagram_socket.basic_datagram_socket..basic_datagram_socket..basic_datagram_socket] 7954Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] without opening it. 7955 7956 7957 explicit ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload1 basic_datagram_socket]``( 7958 const executor_type & ex); 7959 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload1 more...]]`` 7960 7961 template< 7962 typename ExecutionContext> 7963 explicit ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload2 basic_datagram_socket]``( 7964 ExecutionContext & context, 7965 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 7966 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload2 more...]]`` 7967 7968 7969Construct and open a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`]. 7970 7971 7972 ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload3 basic_datagram_socket]``( 7973 const executor_type & ex, 7974 const protocol_type & protocol); 7975 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload3 more...]]`` 7976 7977 template< 7978 typename ExecutionContext> 7979 ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload4 basic_datagram_socket]``( 7980 ExecutionContext & context, 7981 const protocol_type & protocol, 7982 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value, defaulted_constraint >::type = defaulted_constraint()); 7983 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload4 more...]]`` 7984 7985 7986Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`], opening it and binding it to the given local endpoint. 7987 7988 7989 ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload5 basic_datagram_socket]``( 7990 const executor_type & ex, 7991 const endpoint_type & endpoint); 7992 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload5 more...]]`` 7993 7994 template< 7995 typename ExecutionContext> 7996 ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload6 basic_datagram_socket]``( 7997 ExecutionContext & context, 7998 const endpoint_type & endpoint, 7999 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 8000 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload6 more...]]`` 8001 8002 8003Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] on an existing native socket. 8004 8005 8006 ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload7 basic_datagram_socket]``( 8007 const executor_type & ex, 8008 const protocol_type & protocol, 8009 const native_handle_type & native_socket); 8010 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload7 more...]]`` 8011 8012 template< 8013 typename ExecutionContext> 8014 ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload8 basic_datagram_socket]``( 8015 ExecutionContext & context, 8016 const protocol_type & protocol, 8017 const native_handle_type & native_socket, 8018 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 8019 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload8 more...]]`` 8020 8021 8022Move-construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] from another. 8023 8024 8025 ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload9 basic_datagram_socket]``( 8026 basic_datagram_socket && other); 8027 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload9 more...]]`` 8028 8029 8030Move-construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] from a socket of another protocol type. 8031 8032 8033 template< 8034 typename ``[link boost_asio.reference.Protocol Protocol1]``, 8035 typename ``[link boost_asio.reference.Executor1 Executor1]``> 8036 ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload10 basic_datagram_socket]``( 8037 basic_datagram_socket< Protocol1, Executor1 > && other, 8038 typename constraint< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type = 0); 8039 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload10 more...]]`` 8040 8041 8042[section:overload1 basic_datagram_socket::basic_datagram_socket (1 of 10 overloads)] 8043 8044 8045Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] without opening it. 8046 8047 8048 basic_datagram_socket( 8049 const executor_type & ex); 8050 8051 8052This constructor creates a datagram socket without opening it. The `open()` function must be called before data can be sent or received on the socket. 8053 8054 8055[heading Parameters] 8056 8057 8058[variablelist 8059 8060[[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket. ]] 8061 8062] 8063 8064 8065 8066 8067[endsect] 8068 8069 8070 8071[section:overload2 basic_datagram_socket::basic_datagram_socket (2 of 10 overloads)] 8072 8073 8074Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] without opening it. 8075 8076 8077 template< 8078 typename ExecutionContext> 8079 basic_datagram_socket( 8080 ExecutionContext & context, 8081 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 8082 8083 8084This constructor creates a datagram socket without opening it. The `open()` function must be called before data can be sent or received on the socket. 8085 8086 8087[heading Parameters] 8088 8089 8090[variablelist 8091 8092[[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. ]] 8093 8094] 8095 8096 8097 8098 8099[endsect] 8100 8101 8102 8103[section:overload3 basic_datagram_socket::basic_datagram_socket (3 of 10 overloads)] 8104 8105 8106Construct and open a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`]. 8107 8108 8109 basic_datagram_socket( 8110 const executor_type & ex, 8111 const protocol_type & protocol); 8112 8113 8114This constructor creates and opens a datagram socket. 8115 8116 8117[heading Parameters] 8118 8119 8120[variablelist 8121 8122[[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]] 8123 8124[[protocol][An object specifying protocol parameters to be used.]] 8125 8126] 8127 8128 8129[heading Exceptions] 8130 8131 8132[variablelist 8133 8134[[boost::system::system_error][Thrown on failure. ]] 8135 8136] 8137 8138 8139 8140 8141[endsect] 8142 8143 8144 8145[section:overload4 basic_datagram_socket::basic_datagram_socket (4 of 10 overloads)] 8146 8147 8148Construct and open a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`]. 8149 8150 8151 template< 8152 typename ExecutionContext> 8153 basic_datagram_socket( 8154 ExecutionContext & context, 8155 const protocol_type & protocol, 8156 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value, defaulted_constraint >::type = defaulted_constraint()); 8157 8158 8159This constructor creates and opens a datagram socket. 8160 8161 8162[heading Parameters] 8163 8164 8165[variablelist 8166 8167[[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.]] 8168 8169[[protocol][An object specifying protocol parameters to be used.]] 8170 8171] 8172 8173 8174[heading Exceptions] 8175 8176 8177[variablelist 8178 8179[[boost::system::system_error][Thrown on failure. ]] 8180 8181] 8182 8183 8184 8185 8186[endsect] 8187 8188 8189 8190[section:overload5 basic_datagram_socket::basic_datagram_socket (5 of 10 overloads)] 8191 8192 8193Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`], opening it and binding it to the given local endpoint. 8194 8195 8196 basic_datagram_socket( 8197 const executor_type & ex, 8198 const endpoint_type & endpoint); 8199 8200 8201This 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. 8202 8203 8204[heading Parameters] 8205 8206 8207[variablelist 8208 8209[[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]] 8210 8211[[endpoint][An endpoint on the local machine to which the datagram socket will be bound.]] 8212 8213] 8214 8215 8216[heading Exceptions] 8217 8218 8219[variablelist 8220 8221[[boost::system::system_error][Thrown on failure. ]] 8222 8223] 8224 8225 8226 8227 8228[endsect] 8229 8230 8231 8232[section:overload6 basic_datagram_socket::basic_datagram_socket (6 of 10 overloads)] 8233 8234 8235Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`], opening it and binding it to the given local endpoint. 8236 8237 8238 template< 8239 typename ExecutionContext> 8240 basic_datagram_socket( 8241 ExecutionContext & context, 8242 const endpoint_type & endpoint, 8243 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 8244 8245 8246This 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. 8247 8248 8249[heading Parameters] 8250 8251 8252[variablelist 8253 8254[[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.]] 8255 8256[[endpoint][An endpoint on the local machine to which the datagram socket will be bound.]] 8257 8258] 8259 8260 8261[heading Exceptions] 8262 8263 8264[variablelist 8265 8266[[boost::system::system_error][Thrown on failure. ]] 8267 8268] 8269 8270 8271 8272 8273[endsect] 8274 8275 8276 8277[section:overload7 basic_datagram_socket::basic_datagram_socket (7 of 10 overloads)] 8278 8279 8280Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] on an existing native socket. 8281 8282 8283 basic_datagram_socket( 8284 const executor_type & ex, 8285 const protocol_type & protocol, 8286 const native_handle_type & native_socket); 8287 8288 8289This constructor creates a datagram socket object to hold an existing native socket. 8290 8291 8292[heading Parameters] 8293 8294 8295[variablelist 8296 8297[[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]] 8298 8299[[protocol][An object specifying protocol parameters to be used.]] 8300 8301[[native_socket][The new underlying socket implementation.]] 8302 8303] 8304 8305 8306[heading Exceptions] 8307 8308 8309[variablelist 8310 8311[[boost::system::system_error][Thrown on failure. ]] 8312 8313] 8314 8315 8316 8317 8318[endsect] 8319 8320 8321 8322[section:overload8 basic_datagram_socket::basic_datagram_socket (8 of 10 overloads)] 8323 8324 8325Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] on an existing native socket. 8326 8327 8328 template< 8329 typename ExecutionContext> 8330 basic_datagram_socket( 8331 ExecutionContext & context, 8332 const protocol_type & protocol, 8333 const native_handle_type & native_socket, 8334 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 8335 8336 8337This constructor creates a datagram socket object to hold an existing native socket. 8338 8339 8340[heading Parameters] 8341 8342 8343[variablelist 8344 8345[[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.]] 8346 8347[[protocol][An object specifying protocol parameters to be used.]] 8348 8349[[native_socket][The new underlying socket implementation.]] 8350 8351] 8352 8353 8354[heading Exceptions] 8355 8356 8357[variablelist 8358 8359[[boost::system::system_error][Thrown on failure. ]] 8360 8361] 8362 8363 8364 8365 8366[endsect] 8367 8368 8369 8370[section:overload9 basic_datagram_socket::basic_datagram_socket (9 of 10 overloads)] 8371 8372 8373Move-construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] from another. 8374 8375 8376 basic_datagram_socket( 8377 basic_datagram_socket && other); 8378 8379 8380This constructor moves a datagram socket from one object to another. 8381 8382 8383[heading Parameters] 8384 8385 8386[variablelist 8387 8388[[other][The other [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] object from which the move will occur.]] 8389 8390] 8391 8392 8393[heading Remarks] 8394 8395Following the move, the moved-from object is in the same state as if constructed using the `basic_datagram_socket(const executor_type&)` constructor. 8396 8397 8398 8399 8400[endsect] 8401 8402 8403 8404[section:overload10 basic_datagram_socket::basic_datagram_socket (10 of 10 overloads)] 8405 8406 8407Move-construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] from a socket of another protocol type. 8408 8409 8410 template< 8411 typename ``[link boost_asio.reference.Protocol Protocol1]``, 8412 typename ``[link boost_asio.reference.Executor1 Executor1]``> 8413 basic_datagram_socket( 8414 basic_datagram_socket< Protocol1, Executor1 > && other, 8415 typename constraint< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type = 0); 8416 8417 8418This constructor moves a datagram socket from one object to another. 8419 8420 8421[heading Parameters] 8422 8423 8424[variablelist 8425 8426[[other][The other [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] object from which the move will occur.]] 8427 8428] 8429 8430 8431[heading Remarks] 8432 8433Following the move, the moved-from object is in the same state as if constructed using the `basic_datagram_socket(const executor_type&)` constructor. 8434 8435 8436 8437 8438[endsect] 8439 8440 8441[endsect] 8442 8443[section:bind basic_datagram_socket::bind] 8444 8445[indexterm2 boost_asio.indexterm.basic_datagram_socket.bind..bind..basic_datagram_socket] 8446Bind the socket to the given local endpoint. 8447 8448 8449 void ``[link boost_asio.reference.basic_datagram_socket.bind.overload1 bind]``( 8450 const endpoint_type & endpoint); 8451 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.bind.overload1 more...]]`` 8452 8453 void ``[link boost_asio.reference.basic_datagram_socket.bind.overload2 bind]``( 8454 const endpoint_type & endpoint, 8455 boost::system::error_code & ec); 8456 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.bind.overload2 more...]]`` 8457 8458 8459[section:overload1 basic_datagram_socket::bind (1 of 2 overloads)] 8460 8461 8462['Inherited from basic_socket.] 8463 8464 8465Bind the socket to the given local endpoint. 8466 8467 8468 void bind( 8469 const endpoint_type & endpoint); 8470 8471 8472This function binds the socket to the specified endpoint on the local machine. 8473 8474 8475[heading Parameters] 8476 8477 8478[variablelist 8479 8480[[endpoint][An endpoint on the local machine to which the socket will be bound.]] 8481 8482] 8483 8484 8485[heading Exceptions] 8486 8487 8488[variablelist 8489 8490[[boost::system::system_error][Thrown on failure.]] 8491 8492] 8493 8494 8495[heading Example] 8496 8497 8498 8499 boost::asio::ip::tcp::socket socket(my_context); 8500 socket.open(boost::asio::ip::tcp::v4()); 8501 socket.bind(boost::asio::ip::tcp::endpoint( 8502 boost::asio::ip::tcp::v4(), 12345)); 8503 8504 8505 8506 8507 8508 8509 8510[endsect] 8511 8512 8513 8514[section:overload2 basic_datagram_socket::bind (2 of 2 overloads)] 8515 8516 8517['Inherited from basic_socket.] 8518 8519 8520Bind the socket to the given local endpoint. 8521 8522 8523 void bind( 8524 const endpoint_type & endpoint, 8525 boost::system::error_code & ec); 8526 8527 8528This function binds the socket to the specified endpoint on the local machine. 8529 8530 8531[heading Parameters] 8532 8533 8534[variablelist 8535 8536[[endpoint][An endpoint on the local machine to which the socket will be bound.]] 8537 8538[[ec][Set to indicate what error occurred, if any.]] 8539 8540] 8541 8542 8543[heading Example] 8544 8545 8546 8547 boost::asio::ip::tcp::socket socket(my_context); 8548 socket.open(boost::asio::ip::tcp::v4()); 8549 boost::system::error_code ec; 8550 socket.bind(boost::asio::ip::tcp::endpoint( 8551 boost::asio::ip::tcp::v4(), 12345), ec); 8552 if (ec) 8553 { 8554 // An error occurred. 8555 } 8556 8557 8558 8559 8560 8561 8562 8563[endsect] 8564 8565 8566[endsect] 8567 8568 8569[section:broadcast basic_datagram_socket::broadcast] 8570 8571 8572['Inherited from socket_base.] 8573 8574[indexterm2 boost_asio.indexterm.basic_datagram_socket.broadcast..broadcast..basic_datagram_socket] 8575Socket option to permit sending of broadcast messages. 8576 8577 8578 typedef implementation_defined broadcast; 8579 8580 8581 8582Implements the SOL\_SOCKET/SO\_BROADCAST socket option. 8583 8584 8585[heading Examples] 8586 8587Setting the option: 8588 8589 boost::asio::ip::udp::socket socket(my_context); 8590 ... 8591 boost::asio::socket_base::broadcast option(true); 8592 socket.set_option(option); 8593 8594 8595 8596 8597 8598Getting the current option value: 8599 8600 boost::asio::ip::udp::socket socket(my_context); 8601 ... 8602 boost::asio::socket_base::broadcast option; 8603 socket.get_option(option); 8604 bool is_set = option.value(); 8605 8606 8607 8608 8609 8610 8611 8612[heading Requirements] 8613 8614['Header: ][^boost/asio/basic_datagram_socket.hpp] 8615 8616['Convenience header: ][^boost/asio.hpp] 8617 8618 8619[endsect] 8620 8621 8622 8623[section:bytes_readable basic_datagram_socket::bytes_readable] 8624 8625 8626['Inherited from socket_base.] 8627 8628[indexterm2 boost_asio.indexterm.basic_datagram_socket.bytes_readable..bytes_readable..basic_datagram_socket] 8629IO control command to get the amount of data that can be read without blocking. 8630 8631 8632 typedef implementation_defined bytes_readable; 8633 8634 8635 8636Implements the FIONREAD IO control command. 8637 8638 8639[heading Example] 8640 8641 8642 8643 boost::asio::ip::tcp::socket socket(my_context); 8644 ... 8645 boost::asio::socket_base::bytes_readable command(true); 8646 socket.io_control(command); 8647 std::size_t bytes_readable = command.get(); 8648 8649 8650 8651 8652 8653 8654 8655[heading Requirements] 8656 8657['Header: ][^boost/asio/basic_datagram_socket.hpp] 8658 8659['Convenience header: ][^boost/asio.hpp] 8660 8661 8662[endsect] 8663 8664 8665[section:cancel basic_datagram_socket::cancel] 8666 8667[indexterm2 boost_asio.indexterm.basic_datagram_socket.cancel..cancel..basic_datagram_socket] 8668Cancel all asynchronous operations associated with the socket. 8669 8670 8671 void ``[link boost_asio.reference.basic_datagram_socket.cancel.overload1 cancel]``(); 8672 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.cancel.overload1 more...]]`` 8673 8674 void ``[link boost_asio.reference.basic_datagram_socket.cancel.overload2 cancel]``( 8675 boost::system::error_code & ec); 8676 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.cancel.overload2 more...]]`` 8677 8678 8679[section:overload1 basic_datagram_socket::cancel (1 of 2 overloads)] 8680 8681 8682['Inherited from basic_socket.] 8683 8684 8685Cancel all asynchronous operations associated with the socket. 8686 8687 8688 void cancel(); 8689 8690 8691This 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. 8692 8693 8694[heading Exceptions] 8695 8696 8697[variablelist 8698 8699[[boost::system::system_error][Thrown on failure.]] 8700 8701] 8702 8703 8704[heading Remarks] 8705 8706Calls 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: 8707 8708 8709* It will only cancel asynchronous operations that were initiated in the current thread. 8710 8711 8712* 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. 8713 8714For portable cancellation, consider using one of the following alternatives: 8715 8716 8717* Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP. 8718 8719 8720* Use the `close()` function to simultaneously cancel the outstanding operations and close the socket. 8721 8722When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above. 8723 8724 8725[endsect] 8726 8727 8728 8729[section:overload2 basic_datagram_socket::cancel (2 of 2 overloads)] 8730 8731 8732['Inherited from basic_socket.] 8733 8734 8735Cancel all asynchronous operations associated with the socket. 8736 8737 8738 void cancel( 8739 boost::system::error_code & ec); 8740 8741 8742This 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. 8743 8744 8745[heading Parameters] 8746 8747 8748[variablelist 8749 8750[[ec][Set to indicate what error occurred, if any.]] 8751 8752] 8753 8754 8755[heading Remarks] 8756 8757Calls 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: 8758 8759 8760* It will only cancel asynchronous operations that were initiated in the current thread. 8761 8762 8763* 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. 8764 8765For portable cancellation, consider using one of the following alternatives: 8766 8767 8768* Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP. 8769 8770 8771* Use the `close()` function to simultaneously cancel the outstanding operations and close the socket. 8772 8773When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above. 8774 8775 8776[endsect] 8777 8778 8779[endsect] 8780 8781[section:close basic_datagram_socket::close] 8782 8783[indexterm2 boost_asio.indexterm.basic_datagram_socket.close..close..basic_datagram_socket] 8784Close the socket. 8785 8786 8787 void ``[link boost_asio.reference.basic_datagram_socket.close.overload1 close]``(); 8788 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.close.overload1 more...]]`` 8789 8790 void ``[link boost_asio.reference.basic_datagram_socket.close.overload2 close]``( 8791 boost::system::error_code & ec); 8792 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.close.overload2 more...]]`` 8793 8794 8795[section:overload1 basic_datagram_socket::close (1 of 2 overloads)] 8796 8797 8798['Inherited from basic_socket.] 8799 8800 8801Close the socket. 8802 8803 8804 void close(); 8805 8806 8807This 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. 8808 8809 8810[heading Exceptions] 8811 8812 8813[variablelist 8814 8815[[boost::system::system_error][Thrown on failure. Note that, even if the function indicates an error, the underlying descriptor is closed.]] 8816 8817] 8818 8819 8820[heading Remarks] 8821 8822For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket. 8823 8824 8825 8826 8827[endsect] 8828 8829 8830 8831[section:overload2 basic_datagram_socket::close (2 of 2 overloads)] 8832 8833 8834['Inherited from basic_socket.] 8835 8836 8837Close the socket. 8838 8839 8840 void close( 8841 boost::system::error_code & ec); 8842 8843 8844This 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. 8845 8846 8847[heading Parameters] 8848 8849 8850[variablelist 8851 8852[[ec][Set to indicate what error occurred, if any. Note that, even if the function indicates an error, the underlying descriptor is closed.]] 8853 8854] 8855 8856 8857[heading Example] 8858 8859 8860 8861 boost::asio::ip::tcp::socket socket(my_context); 8862 ... 8863 boost::system::error_code ec; 8864 socket.close(ec); 8865 if (ec) 8866 { 8867 // An error occurred. 8868 } 8869 8870 8871 8872 8873 8874[heading Remarks] 8875 8876For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket. 8877 8878 8879 8880 8881[endsect] 8882 8883 8884[endsect] 8885 8886[section:connect basic_datagram_socket::connect] 8887 8888[indexterm2 boost_asio.indexterm.basic_datagram_socket.connect..connect..basic_datagram_socket] 8889Connect the socket to the specified endpoint. 8890 8891 8892 void ``[link boost_asio.reference.basic_datagram_socket.connect.overload1 connect]``( 8893 const endpoint_type & peer_endpoint); 8894 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.connect.overload1 more...]]`` 8895 8896 void ``[link boost_asio.reference.basic_datagram_socket.connect.overload2 connect]``( 8897 const endpoint_type & peer_endpoint, 8898 boost::system::error_code & ec); 8899 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.connect.overload2 more...]]`` 8900 8901 8902[section:overload1 basic_datagram_socket::connect (1 of 2 overloads)] 8903 8904 8905['Inherited from basic_socket.] 8906 8907 8908Connect the socket to the specified endpoint. 8909 8910 8911 void connect( 8912 const endpoint_type & peer_endpoint); 8913 8914 8915This 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. 8916 8917The 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. 8918 8919 8920[heading Parameters] 8921 8922 8923[variablelist 8924 8925[[peer_endpoint][The remote endpoint to which the socket will be connected.]] 8926 8927] 8928 8929 8930[heading Exceptions] 8931 8932 8933[variablelist 8934 8935[[boost::system::system_error][Thrown on failure.]] 8936 8937] 8938 8939 8940[heading Example] 8941 8942 8943 8944 boost::asio::ip::tcp::socket socket(my_context); 8945 boost::asio::ip::tcp::endpoint endpoint( 8946 boost::asio::ip::address::from_string("1.2.3.4"), 12345); 8947 socket.connect(endpoint); 8948 8949 8950 8951 8952 8953 8954 8955[endsect] 8956 8957 8958 8959[section:overload2 basic_datagram_socket::connect (2 of 2 overloads)] 8960 8961 8962['Inherited from basic_socket.] 8963 8964 8965Connect the socket to the specified endpoint. 8966 8967 8968 void connect( 8969 const endpoint_type & peer_endpoint, 8970 boost::system::error_code & ec); 8971 8972 8973This 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. 8974 8975The 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. 8976 8977 8978[heading Parameters] 8979 8980 8981[variablelist 8982 8983[[peer_endpoint][The remote endpoint to which the socket will be connected.]] 8984 8985[[ec][Set to indicate what error occurred, if any.]] 8986 8987] 8988 8989 8990[heading Example] 8991 8992 8993 8994 boost::asio::ip::tcp::socket socket(my_context); 8995 boost::asio::ip::tcp::endpoint endpoint( 8996 boost::asio::ip::address::from_string("1.2.3.4"), 12345); 8997 boost::system::error_code ec; 8998 socket.connect(endpoint, ec); 8999 if (ec) 9000 { 9001 // An error occurred. 9002 } 9003 9004 9005 9006 9007 9008 9009 9010[endsect] 9011 9012 9013[endsect] 9014 9015 9016[section:debug basic_datagram_socket::debug] 9017 9018 9019['Inherited from socket_base.] 9020 9021[indexterm2 boost_asio.indexterm.basic_datagram_socket.debug..debug..basic_datagram_socket] 9022Socket option to enable socket-level debugging. 9023 9024 9025 typedef implementation_defined debug; 9026 9027 9028 9029Implements the SOL\_SOCKET/SO\_DEBUG socket option. 9030 9031 9032[heading Examples] 9033 9034Setting the option: 9035 9036 boost::asio::ip::tcp::socket socket(my_context); 9037 ... 9038 boost::asio::socket_base::debug option(true); 9039 socket.set_option(option); 9040 9041 9042 9043 9044 9045Getting the current option value: 9046 9047 boost::asio::ip::tcp::socket socket(my_context); 9048 ... 9049 boost::asio::socket_base::debug option; 9050 socket.get_option(option); 9051 bool is_set = option.value(); 9052 9053 9054 9055 9056 9057 9058 9059[heading Requirements] 9060 9061['Header: ][^boost/asio/basic_datagram_socket.hpp] 9062 9063['Convenience header: ][^boost/asio.hpp] 9064 9065 9066[endsect] 9067 9068 9069 9070[section:do_not_route basic_datagram_socket::do_not_route] 9071 9072 9073['Inherited from socket_base.] 9074 9075[indexterm2 boost_asio.indexterm.basic_datagram_socket.do_not_route..do_not_route..basic_datagram_socket] 9076Socket option to prevent routing, use local interfaces only. 9077 9078 9079 typedef implementation_defined do_not_route; 9080 9081 9082 9083Implements the SOL\_SOCKET/SO\_DONTROUTE socket option. 9084 9085 9086[heading Examples] 9087 9088Setting the option: 9089 9090 boost::asio::ip::udp::socket socket(my_context); 9091 ... 9092 boost::asio::socket_base::do_not_route option(true); 9093 socket.set_option(option); 9094 9095 9096 9097 9098 9099Getting the current option value: 9100 9101 boost::asio::ip::udp::socket socket(my_context); 9102 ... 9103 boost::asio::socket_base::do_not_route option; 9104 socket.get_option(option); 9105 bool is_set = option.value(); 9106 9107 9108 9109 9110 9111 9112 9113[heading Requirements] 9114 9115['Header: ][^boost/asio/basic_datagram_socket.hpp] 9116 9117['Convenience header: ][^boost/asio.hpp] 9118 9119 9120[endsect] 9121 9122 9123 9124[section:enable_connection_aborted basic_datagram_socket::enable_connection_aborted] 9125 9126 9127['Inherited from socket_base.] 9128 9129[indexterm2 boost_asio.indexterm.basic_datagram_socket.enable_connection_aborted..enable_connection_aborted..basic_datagram_socket] 9130Socket option to report aborted connections on accept. 9131 9132 9133 typedef implementation_defined enable_connection_aborted; 9134 9135 9136 9137Implements 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. 9138 9139 9140[heading Examples] 9141 9142Setting the option: 9143 9144 boost::asio::ip::tcp::acceptor acceptor(my_context); 9145 ... 9146 boost::asio::socket_base::enable_connection_aborted option(true); 9147 acceptor.set_option(option); 9148 9149 9150 9151 9152 9153Getting the current option value: 9154 9155 boost::asio::ip::tcp::acceptor acceptor(my_context); 9156 ... 9157 boost::asio::socket_base::enable_connection_aborted option; 9158 acceptor.get_option(option); 9159 bool is_set = option.value(); 9160 9161 9162 9163 9164 9165 9166 9167[heading Requirements] 9168 9169['Header: ][^boost/asio/basic_datagram_socket.hpp] 9170 9171['Convenience header: ][^boost/asio.hpp] 9172 9173 9174[endsect] 9175 9176 9177 9178[section:endpoint_type basic_datagram_socket::endpoint_type] 9179 9180[indexterm2 boost_asio.indexterm.basic_datagram_socket.endpoint_type..endpoint_type..basic_datagram_socket] 9181The endpoint type. 9182 9183 9184 typedef Protocol::endpoint endpoint_type; 9185 9186 9187 9188[heading Requirements] 9189 9190['Header: ][^boost/asio/basic_datagram_socket.hpp] 9191 9192['Convenience header: ][^boost/asio.hpp] 9193 9194 9195[endsect] 9196 9197 9198 9199[section:executor_type basic_datagram_socket::executor_type] 9200 9201[indexterm2 boost_asio.indexterm.basic_datagram_socket.executor_type..executor_type..basic_datagram_socket] 9202The type of the executor associated with the object. 9203 9204 9205 typedef Executor executor_type; 9206 9207 9208 9209[heading Requirements] 9210 9211['Header: ][^boost/asio/basic_datagram_socket.hpp] 9212 9213['Convenience header: ][^boost/asio.hpp] 9214 9215 9216[endsect] 9217 9218 9219 9220[section:get_executor basic_datagram_socket::get_executor] 9221 9222 9223['Inherited from basic_socket.] 9224 9225[indexterm2 boost_asio.indexterm.basic_datagram_socket.get_executor..get_executor..basic_datagram_socket] 9226Get the executor associated with the object. 9227 9228 9229 executor_type get_executor(); 9230 9231 9232 9233[endsect] 9234 9235 9236[section:get_option basic_datagram_socket::get_option] 9237 9238[indexterm2 boost_asio.indexterm.basic_datagram_socket.get_option..get_option..basic_datagram_socket] 9239Get an option from the socket. 9240 9241 9242 template< 9243 typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``> 9244 void ``[link boost_asio.reference.basic_datagram_socket.get_option.overload1 get_option]``( 9245 GettableSocketOption & option) const; 9246 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.get_option.overload1 more...]]`` 9247 9248 template< 9249 typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``> 9250 void ``[link boost_asio.reference.basic_datagram_socket.get_option.overload2 get_option]``( 9251 GettableSocketOption & option, 9252 boost::system::error_code & ec) const; 9253 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.get_option.overload2 more...]]`` 9254 9255 9256[section:overload1 basic_datagram_socket::get_option (1 of 2 overloads)] 9257 9258 9259['Inherited from basic_socket.] 9260 9261 9262Get an option from the socket. 9263 9264 9265 template< 9266 typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``> 9267 void get_option( 9268 GettableSocketOption & option) const; 9269 9270 9271This function is used to get the current value of an option on the socket. 9272 9273 9274[heading Parameters] 9275 9276 9277[variablelist 9278 9279[[option][The option value to be obtained from the socket.]] 9280 9281] 9282 9283 9284[heading Exceptions] 9285 9286 9287[variablelist 9288 9289[[boost::system::system_error][Thrown on failure.]] 9290 9291] 9292 9293 9294 9295[heading Example] 9296 9297Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option: 9298 9299 boost::asio::ip::tcp::socket socket(my_context); 9300 ... 9301 boost::asio::ip::tcp::socket::keep_alive option; 9302 socket.get_option(option); 9303 bool is_set = option.value(); 9304 9305 9306 9307 9308 9309 9310 9311[endsect] 9312 9313 9314 9315[section:overload2 basic_datagram_socket::get_option (2 of 2 overloads)] 9316 9317 9318['Inherited from basic_socket.] 9319 9320 9321Get an option from the socket. 9322 9323 9324 template< 9325 typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``> 9326 void get_option( 9327 GettableSocketOption & option, 9328 boost::system::error_code & ec) const; 9329 9330 9331This function is used to get the current value of an option on the socket. 9332 9333 9334[heading Parameters] 9335 9336 9337[variablelist 9338 9339[[option][The option value to be obtained from the socket.]] 9340 9341[[ec][Set to indicate what error occurred, if any.]] 9342 9343] 9344 9345 9346 9347[heading Example] 9348 9349Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option: 9350 9351 boost::asio::ip::tcp::socket socket(my_context); 9352 ... 9353 boost::asio::ip::tcp::socket::keep_alive option; 9354 boost::system::error_code ec; 9355 socket.get_option(option, ec); 9356 if (ec) 9357 { 9358 // An error occurred. 9359 } 9360 bool is_set = option.value(); 9361 9362 9363 9364 9365 9366 9367 9368[endsect] 9369 9370 9371[endsect] 9372 9373[section:io_control basic_datagram_socket::io_control] 9374 9375[indexterm2 boost_asio.indexterm.basic_datagram_socket.io_control..io_control..basic_datagram_socket] 9376Perform an IO control command on the socket. 9377 9378 9379 template< 9380 typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> 9381 void ``[link boost_asio.reference.basic_datagram_socket.io_control.overload1 io_control]``( 9382 IoControlCommand & command); 9383 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.io_control.overload1 more...]]`` 9384 9385 template< 9386 typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> 9387 void ``[link boost_asio.reference.basic_datagram_socket.io_control.overload2 io_control]``( 9388 IoControlCommand & command, 9389 boost::system::error_code & ec); 9390 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.io_control.overload2 more...]]`` 9391 9392 9393[section:overload1 basic_datagram_socket::io_control (1 of 2 overloads)] 9394 9395 9396['Inherited from basic_socket.] 9397 9398 9399Perform an IO control command on the socket. 9400 9401 9402 template< 9403 typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> 9404 void io_control( 9405 IoControlCommand & command); 9406 9407 9408This function is used to execute an IO control command on the socket. 9409 9410 9411[heading Parameters] 9412 9413 9414[variablelist 9415 9416[[command][The IO control command to be performed on the socket.]] 9417 9418] 9419 9420 9421[heading Exceptions] 9422 9423 9424[variablelist 9425 9426[[boost::system::system_error][Thrown on failure.]] 9427 9428] 9429 9430 9431 9432[heading Example] 9433 9434Getting the number of bytes ready to read: 9435 9436 boost::asio::ip::tcp::socket socket(my_context); 9437 ... 9438 boost::asio::ip::tcp::socket::bytes_readable command; 9439 socket.io_control(command); 9440 std::size_t bytes_readable = command.get(); 9441 9442 9443 9444 9445 9446 9447 9448[endsect] 9449 9450 9451 9452[section:overload2 basic_datagram_socket::io_control (2 of 2 overloads)] 9453 9454 9455['Inherited from basic_socket.] 9456 9457 9458Perform an IO control command on the socket. 9459 9460 9461 template< 9462 typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> 9463 void io_control( 9464 IoControlCommand & command, 9465 boost::system::error_code & ec); 9466 9467 9468This function is used to execute an IO control command on the socket. 9469 9470 9471[heading Parameters] 9472 9473 9474[variablelist 9475 9476[[command][The IO control command to be performed on the socket.]] 9477 9478[[ec][Set to indicate what error occurred, if any.]] 9479 9480] 9481 9482 9483 9484[heading Example] 9485 9486Getting the number of bytes ready to read: 9487 9488 boost::asio::ip::tcp::socket socket(my_context); 9489 ... 9490 boost::asio::ip::tcp::socket::bytes_readable command; 9491 boost::system::error_code ec; 9492 socket.io_control(command, ec); 9493 if (ec) 9494 { 9495 // An error occurred. 9496 } 9497 std::size_t bytes_readable = command.get(); 9498 9499 9500 9501 9502 9503 9504 9505[endsect] 9506 9507 9508[endsect] 9509 9510 9511[section:is_open basic_datagram_socket::is_open] 9512 9513 9514['Inherited from basic_socket.] 9515 9516[indexterm2 boost_asio.indexterm.basic_datagram_socket.is_open..is_open..basic_datagram_socket] 9517Determine whether the socket is open. 9518 9519 9520 bool is_open() const; 9521 9522 9523 9524[endsect] 9525 9526 9527 9528[section:keep_alive basic_datagram_socket::keep_alive] 9529 9530 9531['Inherited from socket_base.] 9532 9533[indexterm2 boost_asio.indexterm.basic_datagram_socket.keep_alive..keep_alive..basic_datagram_socket] 9534Socket option to send keep-alives. 9535 9536 9537 typedef implementation_defined keep_alive; 9538 9539 9540 9541Implements the SOL\_SOCKET/SO\_KEEPALIVE socket option. 9542 9543 9544[heading Examples] 9545 9546Setting the option: 9547 9548 boost::asio::ip::tcp::socket socket(my_context); 9549 ... 9550 boost::asio::socket_base::keep_alive option(true); 9551 socket.set_option(option); 9552 9553 9554 9555 9556 9557Getting the current option value: 9558 9559 boost::asio::ip::tcp::socket socket(my_context); 9560 ... 9561 boost::asio::socket_base::keep_alive option; 9562 socket.get_option(option); 9563 bool is_set = option.value(); 9564 9565 9566 9567 9568 9569 9570 9571[heading Requirements] 9572 9573['Header: ][^boost/asio/basic_datagram_socket.hpp] 9574 9575['Convenience header: ][^boost/asio.hpp] 9576 9577 9578[endsect] 9579 9580 9581 9582[section:linger basic_datagram_socket::linger] 9583 9584 9585['Inherited from socket_base.] 9586 9587[indexterm2 boost_asio.indexterm.basic_datagram_socket.linger..linger..basic_datagram_socket] 9588Socket option to specify whether the socket lingers on close if unsent data is present. 9589 9590 9591 typedef implementation_defined linger; 9592 9593 9594 9595Implements the SOL\_SOCKET/SO\_LINGER socket option. 9596 9597 9598[heading Examples] 9599 9600Setting the option: 9601 9602 boost::asio::ip::tcp::socket socket(my_context); 9603 ... 9604 boost::asio::socket_base::linger option(true, 30); 9605 socket.set_option(option); 9606 9607 9608 9609 9610 9611Getting the current option value: 9612 9613 boost::asio::ip::tcp::socket socket(my_context); 9614 ... 9615 boost::asio::socket_base::linger option; 9616 socket.get_option(option); 9617 bool is_set = option.enabled(); 9618 unsigned short timeout = option.timeout(); 9619 9620 9621 9622 9623 9624 9625 9626[heading Requirements] 9627 9628['Header: ][^boost/asio/basic_datagram_socket.hpp] 9629 9630['Convenience header: ][^boost/asio.hpp] 9631 9632 9633[endsect] 9634 9635 9636[section:local_endpoint basic_datagram_socket::local_endpoint] 9637 9638[indexterm2 boost_asio.indexterm.basic_datagram_socket.local_endpoint..local_endpoint..basic_datagram_socket] 9639Get the local endpoint of the socket. 9640 9641 9642 endpoint_type ``[link boost_asio.reference.basic_datagram_socket.local_endpoint.overload1 local_endpoint]``() const; 9643 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.local_endpoint.overload1 more...]]`` 9644 9645 endpoint_type ``[link boost_asio.reference.basic_datagram_socket.local_endpoint.overload2 local_endpoint]``( 9646 boost::system::error_code & ec) const; 9647 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.local_endpoint.overload2 more...]]`` 9648 9649 9650[section:overload1 basic_datagram_socket::local_endpoint (1 of 2 overloads)] 9651 9652 9653['Inherited from basic_socket.] 9654 9655 9656Get the local endpoint of the socket. 9657 9658 9659 endpoint_type local_endpoint() const; 9660 9661 9662This function is used to obtain the locally bound endpoint of the socket. 9663 9664 9665[heading Return Value] 9666 9667An object that represents the local endpoint of the socket. 9668 9669 9670[heading Exceptions] 9671 9672 9673[variablelist 9674 9675[[boost::system::system_error][Thrown on failure.]] 9676 9677] 9678 9679 9680[heading Example] 9681 9682 9683 9684 boost::asio::ip::tcp::socket socket(my_context); 9685 ... 9686 boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint(); 9687 9688 9689 9690 9691 9692 9693 9694[endsect] 9695 9696 9697 9698[section:overload2 basic_datagram_socket::local_endpoint (2 of 2 overloads)] 9699 9700 9701['Inherited from basic_socket.] 9702 9703 9704Get the local endpoint of the socket. 9705 9706 9707 endpoint_type local_endpoint( 9708 boost::system::error_code & ec) const; 9709 9710 9711This function is used to obtain the locally bound endpoint of the socket. 9712 9713 9714[heading Parameters] 9715 9716 9717[variablelist 9718 9719[[ec][Set to indicate what error occurred, if any.]] 9720 9721] 9722 9723 9724[heading Return Value] 9725 9726An object that represents the local endpoint of the socket. Returns a default-constructed endpoint object if an error occurred. 9727 9728 9729[heading Example] 9730 9731 9732 9733 boost::asio::ip::tcp::socket socket(my_context); 9734 ... 9735 boost::system::error_code ec; 9736 boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint(ec); 9737 if (ec) 9738 { 9739 // An error occurred. 9740 } 9741 9742 9743 9744 9745 9746 9747 9748[endsect] 9749 9750 9751[endsect] 9752 9753[section:lowest_layer basic_datagram_socket::lowest_layer] 9754 9755[indexterm2 boost_asio.indexterm.basic_datagram_socket.lowest_layer..lowest_layer..basic_datagram_socket] 9756Get a reference to the lowest layer. 9757 9758 9759 lowest_layer_type & ``[link boost_asio.reference.basic_datagram_socket.lowest_layer.overload1 lowest_layer]``(); 9760 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.lowest_layer.overload1 more...]]`` 9761 9762 9763Get a const reference to the lowest layer. 9764 9765 9766 const lowest_layer_type & ``[link boost_asio.reference.basic_datagram_socket.lowest_layer.overload2 lowest_layer]``() const; 9767 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.lowest_layer.overload2 more...]]`` 9768 9769 9770[section:overload1 basic_datagram_socket::lowest_layer (1 of 2 overloads)] 9771 9772 9773['Inherited from basic_socket.] 9774 9775 9776Get a reference to the lowest layer. 9777 9778 9779 lowest_layer_type & lowest_layer(); 9780 9781 9782This 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. 9783 9784 9785[heading Return Value] 9786 9787A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 9788 9789 9790 9791 9792[endsect] 9793 9794 9795 9796[section:overload2 basic_datagram_socket::lowest_layer (2 of 2 overloads)] 9797 9798 9799['Inherited from basic_socket.] 9800 9801 9802Get a const reference to the lowest layer. 9803 9804 9805 const lowest_layer_type & lowest_layer() const; 9806 9807 9808This 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. 9809 9810 9811[heading Return Value] 9812 9813A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 9814 9815 9816 9817 9818[endsect] 9819 9820 9821[endsect] 9822 9823 9824[section:lowest_layer_type basic_datagram_socket::lowest_layer_type] 9825 9826 9827['Inherited from basic_socket.] 9828 9829[indexterm2 boost_asio.indexterm.basic_datagram_socket.lowest_layer_type..lowest_layer_type..basic_datagram_socket] 9830A [link boost_asio.reference.basic_socket `basic_socket`] is always the lowest layer. 9831 9832 9833 typedef basic_socket< Protocol, Executor > lowest_layer_type; 9834 9835 9836[heading Types] 9837[table 9838 [[Name][Description]] 9839 9840 [ 9841 9842 [[link boost_asio.reference.basic_socket__rebind_executor [*rebind_executor]]] 9843 [Rebinds the socket type to another executor. ] 9844 9845 ] 9846 9847 [ 9848 9849 [[link boost_asio.reference.basic_socket.broadcast [*broadcast]]] 9850 [Socket option to permit sending of broadcast messages. ] 9851 9852 ] 9853 9854 [ 9855 9856 [[link boost_asio.reference.basic_socket.bytes_readable [*bytes_readable]]] 9857 [IO control command to get the amount of data that can be read without blocking. ] 9858 9859 ] 9860 9861 [ 9862 9863 [[link boost_asio.reference.basic_socket.debug [*debug]]] 9864 [Socket option to enable socket-level debugging. ] 9865 9866 ] 9867 9868 [ 9869 9870 [[link boost_asio.reference.basic_socket.do_not_route [*do_not_route]]] 9871 [Socket option to prevent routing, use local interfaces only. ] 9872 9873 ] 9874 9875 [ 9876 9877 [[link boost_asio.reference.basic_socket.enable_connection_aborted [*enable_connection_aborted]]] 9878 [Socket option to report aborted connections on accept. ] 9879 9880 ] 9881 9882 [ 9883 9884 [[link boost_asio.reference.basic_socket.endpoint_type [*endpoint_type]]] 9885 [The endpoint type. ] 9886 9887 ] 9888 9889 [ 9890 9891 [[link boost_asio.reference.basic_socket.executor_type [*executor_type]]] 9892 [The type of the executor associated with the object. ] 9893 9894 ] 9895 9896 [ 9897 9898 [[link boost_asio.reference.basic_socket.keep_alive [*keep_alive]]] 9899 [Socket option to send keep-alives. ] 9900 9901 ] 9902 9903 [ 9904 9905 [[link boost_asio.reference.basic_socket.linger [*linger]]] 9906 [Socket option to specify whether the socket lingers on close if unsent data is present. ] 9907 9908 ] 9909 9910 [ 9911 9912 [[link boost_asio.reference.basic_socket.lowest_layer_type [*lowest_layer_type]]] 9913 [A basic_socket is always the lowest layer. ] 9914 9915 ] 9916 9917 [ 9918 9919 [[link boost_asio.reference.basic_socket.message_flags [*message_flags]]] 9920 [Bitmask type for flags that can be passed to send and receive operations. ] 9921 9922 ] 9923 9924 [ 9925 9926 [[link boost_asio.reference.basic_socket.native_handle_type [*native_handle_type]]] 9927 [The native representation of a socket. ] 9928 9929 ] 9930 9931 [ 9932 9933 [[link boost_asio.reference.basic_socket.out_of_band_inline [*out_of_band_inline]]] 9934 [Socket option for putting received out-of-band data inline. ] 9935 9936 ] 9937 9938 [ 9939 9940 [[link boost_asio.reference.basic_socket.protocol_type [*protocol_type]]] 9941 [The protocol type. ] 9942 9943 ] 9944 9945 [ 9946 9947 [[link boost_asio.reference.basic_socket.receive_buffer_size [*receive_buffer_size]]] 9948 [Socket option for the receive buffer size of a socket. ] 9949 9950 ] 9951 9952 [ 9953 9954 [[link boost_asio.reference.basic_socket.receive_low_watermark [*receive_low_watermark]]] 9955 [Socket option for the receive low watermark. ] 9956 9957 ] 9958 9959 [ 9960 9961 [[link boost_asio.reference.basic_socket.reuse_address [*reuse_address]]] 9962 [Socket option to allow the socket to be bound to an address that is already in use. ] 9963 9964 ] 9965 9966 [ 9967 9968 [[link boost_asio.reference.basic_socket.send_buffer_size [*send_buffer_size]]] 9969 [Socket option for the send buffer size of a socket. ] 9970 9971 ] 9972 9973 [ 9974 9975 [[link boost_asio.reference.basic_socket.send_low_watermark [*send_low_watermark]]] 9976 [Socket option for the send low watermark. ] 9977 9978 ] 9979 9980 [ 9981 9982 [[link boost_asio.reference.basic_socket.shutdown_type [*shutdown_type]]] 9983 [Different ways a socket may be shutdown. ] 9984 9985 ] 9986 9987 [ 9988 9989 [[link boost_asio.reference.basic_socket.wait_type [*wait_type]]] 9990 [Wait types. ] 9991 9992 ] 9993 9994] 9995 9996[heading Member Functions] 9997[table 9998 [[Name][Description]] 9999 10000 [ 10001 [[link boost_asio.reference.basic_socket.assign [*assign]]] 10002 [Assign an existing native socket to the socket. ] 10003 ] 10004 10005 [ 10006 [[link boost_asio.reference.basic_socket.async_connect [*async_connect]]] 10007 [Start an asynchronous connect. ] 10008 ] 10009 10010 [ 10011 [[link boost_asio.reference.basic_socket.async_wait [*async_wait]]] 10012 [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 10013 ] 10014 10015 [ 10016 [[link boost_asio.reference.basic_socket.at_mark [*at_mark]]] 10017 [Determine whether the socket is at the out-of-band data mark. ] 10018 ] 10019 10020 [ 10021 [[link boost_asio.reference.basic_socket.available [*available]]] 10022 [Determine the number of bytes available for reading. ] 10023 ] 10024 10025 [ 10026 [[link boost_asio.reference.basic_socket.basic_socket [*basic_socket]] [constructor]] 10027 [Construct a basic_socket without opening it. 10028 [hr] 10029 Construct and open a basic_socket. 10030 [hr] 10031 Construct a basic_socket, opening it and binding it to the given local endpoint. 10032 [hr] 10033 Construct a basic_socket on an existing native socket. 10034 [hr] 10035 Move-construct a basic_socket from another. 10036 [hr] 10037 Move-construct a basic_socket from a socket of another protocol type. ] 10038 ] 10039 10040 [ 10041 [[link boost_asio.reference.basic_socket.bind [*bind]]] 10042 [Bind the socket to the given local endpoint. ] 10043 ] 10044 10045 [ 10046 [[link boost_asio.reference.basic_socket.cancel [*cancel]]] 10047 [Cancel all asynchronous operations associated with the socket. ] 10048 ] 10049 10050 [ 10051 [[link boost_asio.reference.basic_socket.close [*close]]] 10052 [Close the socket. ] 10053 ] 10054 10055 [ 10056 [[link boost_asio.reference.basic_socket.connect [*connect]]] 10057 [Connect the socket to the specified endpoint. ] 10058 ] 10059 10060 [ 10061 [[link boost_asio.reference.basic_socket.get_executor [*get_executor]]] 10062 [Get the executor associated with the object. ] 10063 ] 10064 10065 [ 10066 [[link boost_asio.reference.basic_socket.get_option [*get_option]]] 10067 [Get an option from the socket. ] 10068 ] 10069 10070 [ 10071 [[link boost_asio.reference.basic_socket.io_control [*io_control]]] 10072 [Perform an IO control command on the socket. ] 10073 ] 10074 10075 [ 10076 [[link boost_asio.reference.basic_socket.is_open [*is_open]]] 10077 [Determine whether the socket is open. ] 10078 ] 10079 10080 [ 10081 [[link boost_asio.reference.basic_socket.local_endpoint [*local_endpoint]]] 10082 [Get the local endpoint of the socket. ] 10083 ] 10084 10085 [ 10086 [[link boost_asio.reference.basic_socket.lowest_layer [*lowest_layer]]] 10087 [Get a reference to the lowest layer. 10088 [hr] 10089 Get a const reference to the lowest layer. ] 10090 ] 10091 10092 [ 10093 [[link boost_asio.reference.basic_socket.native_handle [*native_handle]]] 10094 [Get the native socket representation. ] 10095 ] 10096 10097 [ 10098 [[link boost_asio.reference.basic_socket.native_non_blocking [*native_non_blocking]]] 10099 [Gets the non-blocking mode of the native socket implementation. 10100 [hr] 10101 Sets the non-blocking mode of the native socket implementation. ] 10102 ] 10103 10104 [ 10105 [[link boost_asio.reference.basic_socket.non_blocking [*non_blocking]]] 10106 [Gets the non-blocking mode of the socket. 10107 [hr] 10108 Sets the non-blocking mode of the socket. ] 10109 ] 10110 10111 [ 10112 [[link boost_asio.reference.basic_socket.open [*open]]] 10113 [Open the socket using the specified protocol. ] 10114 ] 10115 10116 [ 10117 [[link boost_asio.reference.basic_socket.operator_eq_ [*operator=]]] 10118 [Move-assign a basic_socket from another. 10119 [hr] 10120 Move-assign a basic_socket from a socket of another protocol type. ] 10121 ] 10122 10123 [ 10124 [[link boost_asio.reference.basic_socket.release [*release]]] 10125 [Release ownership of the underlying native socket. ] 10126 ] 10127 10128 [ 10129 [[link boost_asio.reference.basic_socket.remote_endpoint [*remote_endpoint]]] 10130 [Get the remote endpoint of the socket. ] 10131 ] 10132 10133 [ 10134 [[link boost_asio.reference.basic_socket.set_option [*set_option]]] 10135 [Set an option on the socket. ] 10136 ] 10137 10138 [ 10139 [[link boost_asio.reference.basic_socket.shutdown [*shutdown]]] 10140 [Disable sends or receives on the socket. ] 10141 ] 10142 10143 [ 10144 [[link boost_asio.reference.basic_socket.wait [*wait]]] 10145 [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 10146 ] 10147 10148] 10149 10150[heading Protected Member Functions] 10151[table 10152 [[Name][Description]] 10153 10154 [ 10155 [[link boost_asio.reference.basic_socket._basic_socket [*~basic_socket]] [destructor]] 10156 [Protected destructor to prevent deletion through this type. ] 10157 ] 10158 10159] 10160 10161[heading Data Members] 10162[table 10163 [[Name][Description]] 10164 10165 [ 10166 [[link boost_asio.reference.basic_socket.max_connections [*max_connections]] [static]] 10167 [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ] 10168 ] 10169 10170 [ 10171 [[link boost_asio.reference.basic_socket.max_listen_connections [*max_listen_connections]] [static]] 10172 [The maximum length of the queue of pending incoming connections. ] 10173 ] 10174 10175 [ 10176 [[link boost_asio.reference.basic_socket.message_do_not_route [*message_do_not_route]] [static]] 10177 [Specify that the data should not be subject to routing. ] 10178 ] 10179 10180 [ 10181 [[link boost_asio.reference.basic_socket.message_end_of_record [*message_end_of_record]] [static]] 10182 [Specifies that the data marks the end of a record. ] 10183 ] 10184 10185 [ 10186 [[link boost_asio.reference.basic_socket.message_out_of_band [*message_out_of_band]] [static]] 10187 [Process out-of-band data. ] 10188 ] 10189 10190 [ 10191 [[link boost_asio.reference.basic_socket.message_peek [*message_peek]] [static]] 10192 [Peek at incoming data without removing it from the input queue. ] 10193 ] 10194 10195] 10196 10197The [link boost_asio.reference.basic_socket `basic_socket`] class template provides functionality that is common to both stream-oriented and datagram-oriented sockets. 10198 10199 10200[heading Thread Safety] 10201 10202['Distinct] ['objects:] Safe. 10203 10204['Shared] ['objects:] Unsafe. 10205 10206 10207 10208 10209[heading Requirements] 10210 10211['Header: ][^boost/asio/basic_datagram_socket.hpp] 10212 10213['Convenience header: ][^boost/asio.hpp] 10214 10215 10216[endsect] 10217 10218 10219 10220[section:max_connections basic_datagram_socket::max_connections] 10221 10222 10223['Inherited from socket_base.] 10224 10225[indexterm2 boost_asio.indexterm.basic_datagram_socket.max_connections..max_connections..basic_datagram_socket] 10226(Deprecated: Use max\_listen\_connections.) The maximum length of the queue of pending incoming connections. 10227 10228 10229 static const int max_connections = implementation_defined; 10230 10231 10232 10233[endsect] 10234 10235 10236 10237[section:max_listen_connections basic_datagram_socket::max_listen_connections] 10238 10239 10240['Inherited from socket_base.] 10241 10242[indexterm2 boost_asio.indexterm.basic_datagram_socket.max_listen_connections..max_listen_connections..basic_datagram_socket] 10243The maximum length of the queue of pending incoming connections. 10244 10245 10246 static const int max_listen_connections = implementation_defined; 10247 10248 10249 10250[endsect] 10251 10252 10253 10254[section:message_do_not_route basic_datagram_socket::message_do_not_route] 10255 10256 10257['Inherited from socket_base.] 10258 10259[indexterm2 boost_asio.indexterm.basic_datagram_socket.message_do_not_route..message_do_not_route..basic_datagram_socket] 10260Specify that the data should not be subject to routing. 10261 10262 10263 static const int message_do_not_route = implementation_defined; 10264 10265 10266 10267[endsect] 10268 10269 10270 10271[section:message_end_of_record basic_datagram_socket::message_end_of_record] 10272 10273 10274['Inherited from socket_base.] 10275 10276[indexterm2 boost_asio.indexterm.basic_datagram_socket.message_end_of_record..message_end_of_record..basic_datagram_socket] 10277Specifies that the data marks the end of a record. 10278 10279 10280 static const int message_end_of_record = implementation_defined; 10281 10282 10283 10284[endsect] 10285 10286 10287 10288[section:message_flags basic_datagram_socket::message_flags] 10289 10290 10291['Inherited from socket_base.] 10292 10293[indexterm2 boost_asio.indexterm.basic_datagram_socket.message_flags..message_flags..basic_datagram_socket] 10294Bitmask type for flags that can be passed to send and receive operations. 10295 10296 10297 typedef int message_flags; 10298 10299 10300 10301[heading Requirements] 10302 10303['Header: ][^boost/asio/basic_datagram_socket.hpp] 10304 10305['Convenience header: ][^boost/asio.hpp] 10306 10307 10308[endsect] 10309 10310 10311 10312[section:message_out_of_band basic_datagram_socket::message_out_of_band] 10313 10314 10315['Inherited from socket_base.] 10316 10317[indexterm2 boost_asio.indexterm.basic_datagram_socket.message_out_of_band..message_out_of_band..basic_datagram_socket] 10318Process out-of-band data. 10319 10320 10321 static const int message_out_of_band = implementation_defined; 10322 10323 10324 10325[endsect] 10326 10327 10328 10329[section:message_peek basic_datagram_socket::message_peek] 10330 10331 10332['Inherited from socket_base.] 10333 10334[indexterm2 boost_asio.indexterm.basic_datagram_socket.message_peek..message_peek..basic_datagram_socket] 10335Peek at incoming data without removing it from the input queue. 10336 10337 10338 static const int message_peek = implementation_defined; 10339 10340 10341 10342[endsect] 10343 10344 10345 10346[section:native_handle basic_datagram_socket::native_handle] 10347 10348 10349['Inherited from basic_socket.] 10350 10351[indexterm2 boost_asio.indexterm.basic_datagram_socket.native_handle..native_handle..basic_datagram_socket] 10352Get the native socket representation. 10353 10354 10355 native_handle_type native_handle(); 10356 10357 10358This 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. 10359 10360 10361[endsect] 10362 10363 10364 10365[section:native_handle_type basic_datagram_socket::native_handle_type] 10366 10367[indexterm2 boost_asio.indexterm.basic_datagram_socket.native_handle_type..native_handle_type..basic_datagram_socket] 10368The native representation of a socket. 10369 10370 10371 typedef implementation_defined native_handle_type; 10372 10373 10374 10375[heading Requirements] 10376 10377['Header: ][^boost/asio/basic_datagram_socket.hpp] 10378 10379['Convenience header: ][^boost/asio.hpp] 10380 10381 10382[endsect] 10383 10384 10385[section:native_non_blocking basic_datagram_socket::native_non_blocking] 10386 10387[indexterm2 boost_asio.indexterm.basic_datagram_socket.native_non_blocking..native_non_blocking..basic_datagram_socket] 10388Gets the non-blocking mode of the native socket implementation. 10389 10390 10391 bool ``[link boost_asio.reference.basic_datagram_socket.native_non_blocking.overload1 native_non_blocking]``() const; 10392 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.native_non_blocking.overload1 more...]]`` 10393 10394 10395Sets the non-blocking mode of the native socket implementation. 10396 10397 10398 void ``[link boost_asio.reference.basic_datagram_socket.native_non_blocking.overload2 native_non_blocking]``( 10399 bool mode); 10400 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.native_non_blocking.overload2 more...]]`` 10401 10402 void ``[link boost_asio.reference.basic_datagram_socket.native_non_blocking.overload3 native_non_blocking]``( 10403 bool mode, 10404 boost::system::error_code & ec); 10405 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.native_non_blocking.overload3 more...]]`` 10406 10407 10408[section:overload1 basic_datagram_socket::native_non_blocking (1 of 3 overloads)] 10409 10410 10411['Inherited from basic_socket.] 10412 10413 10414Gets the non-blocking mode of the native socket implementation. 10415 10416 10417 bool native_non_blocking() const; 10418 10419 10420This 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. 10421 10422 10423[heading Return Value] 10424 10425`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). 10426 10427 10428[heading Remarks] 10429 10430The 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. 10431 10432 10433[heading Example] 10434 10435This 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: 10436 10437 template <typename Handler> 10438 struct sendfile_op 10439 { 10440 tcp::socket& sock_; 10441 int fd_; 10442 Handler handler_; 10443 off_t offset_; 10444 std::size_t total_bytes_transferred_; 10445 10446 // Function call operator meeting WriteHandler requirements. 10447 // Used as the handler for the async_write_some operation. 10448 void operator()(boost::system::error_code ec, std::size_t) 10449 { 10450 // Put the underlying socket into non-blocking mode. 10451 if (!ec) 10452 if (!sock_.native_non_blocking()) 10453 sock_.native_non_blocking(true, ec); 10454 10455 if (!ec) 10456 { 10457 for (;;) 10458 { 10459 // Try the system call. 10460 errno = 0; 10461 int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536); 10462 ec = boost::system::error_code(n < 0 ? errno : 0, 10463 boost::asio::error::get_system_category()); 10464 total_bytes_transferred_ += ec ? 0 : n; 10465 10466 // Retry operation immediately if interrupted by signal. 10467 if (ec == boost::asio::error::interrupted) 10468 continue; 10469 10470 // Check if we need to run the operation again. 10471 if (ec == boost::asio::error::would_block 10472 || ec == boost::asio::error::try_again) 10473 { 10474 // We have to wait for the socket to become ready again. 10475 sock_.async_wait(tcp::socket::wait_write, *this); 10476 return; 10477 } 10478 10479 if (ec || n == 0) 10480 { 10481 // An error occurred, or we have reached the end of the file. 10482 // Either way we must exit the loop so we can call the handler. 10483 break; 10484 } 10485 10486 // Loop around to try calling sendfile again. 10487 } 10488 } 10489 10490 // Pass result back to user's handler. 10491 handler_(ec, total_bytes_transferred_); 10492 } 10493 }; 10494 10495 template <typename Handler> 10496 void async_sendfile(tcp::socket& sock, int fd, Handler h) 10497 { 10498 sendfile_op<Handler> op = { sock, fd, h, 0, 0 }; 10499 sock.async_wait(tcp::socket::wait_write, op); 10500 } 10501 10502 10503 10504 10505 10506 10507 10508[endsect] 10509 10510 10511 10512[section:overload2 basic_datagram_socket::native_non_blocking (2 of 3 overloads)] 10513 10514 10515['Inherited from basic_socket.] 10516 10517 10518Sets the non-blocking mode of the native socket implementation. 10519 10520 10521 void native_non_blocking( 10522 bool mode); 10523 10524 10525This 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. 10526 10527 10528[heading Parameters] 10529 10530 10531[variablelist 10532 10533[[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).]] 10534 10535] 10536 10537 10538[heading Exceptions] 10539 10540 10541[variablelist 10542 10543[[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.]] 10544 10545] 10546 10547 10548[heading Example] 10549 10550This 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: 10551 10552 template <typename Handler> 10553 struct sendfile_op 10554 { 10555 tcp::socket& sock_; 10556 int fd_; 10557 Handler handler_; 10558 off_t offset_; 10559 std::size_t total_bytes_transferred_; 10560 10561 // Function call operator meeting WriteHandler requirements. 10562 // Used as the handler for the async_write_some operation. 10563 void operator()(boost::system::error_code ec, std::size_t) 10564 { 10565 // Put the underlying socket into non-blocking mode. 10566 if (!ec) 10567 if (!sock_.native_non_blocking()) 10568 sock_.native_non_blocking(true, ec); 10569 10570 if (!ec) 10571 { 10572 for (;;) 10573 { 10574 // Try the system call. 10575 errno = 0; 10576 int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536); 10577 ec = boost::system::error_code(n < 0 ? errno : 0, 10578 boost::asio::error::get_system_category()); 10579 total_bytes_transferred_ += ec ? 0 : n; 10580 10581 // Retry operation immediately if interrupted by signal. 10582 if (ec == boost::asio::error::interrupted) 10583 continue; 10584 10585 // Check if we need to run the operation again. 10586 if (ec == boost::asio::error::would_block 10587 || ec == boost::asio::error::try_again) 10588 { 10589 // We have to wait for the socket to become ready again. 10590 sock_.async_wait(tcp::socket::wait_write, *this); 10591 return; 10592 } 10593 10594 if (ec || n == 0) 10595 { 10596 // An error occurred, or we have reached the end of the file. 10597 // Either way we must exit the loop so we can call the handler. 10598 break; 10599 } 10600 10601 // Loop around to try calling sendfile again. 10602 } 10603 } 10604 10605 // Pass result back to user's handler. 10606 handler_(ec, total_bytes_transferred_); 10607 } 10608 }; 10609 10610 template <typename Handler> 10611 void async_sendfile(tcp::socket& sock, int fd, Handler h) 10612 { 10613 sendfile_op<Handler> op = { sock, fd, h, 0, 0 }; 10614 sock.async_wait(tcp::socket::wait_write, op); 10615 } 10616 10617 10618 10619 10620 10621 10622 10623[endsect] 10624 10625 10626 10627[section:overload3 basic_datagram_socket::native_non_blocking (3 of 3 overloads)] 10628 10629 10630['Inherited from basic_socket.] 10631 10632 10633Sets the non-blocking mode of the native socket implementation. 10634 10635 10636 void native_non_blocking( 10637 bool mode, 10638 boost::system::error_code & ec); 10639 10640 10641This 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. 10642 10643 10644[heading Parameters] 10645 10646 10647[variablelist 10648 10649[[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).]] 10650 10651[[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.]] 10652 10653] 10654 10655 10656[heading Example] 10657 10658This 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: 10659 10660 template <typename Handler> 10661 struct sendfile_op 10662 { 10663 tcp::socket& sock_; 10664 int fd_; 10665 Handler handler_; 10666 off_t offset_; 10667 std::size_t total_bytes_transferred_; 10668 10669 // Function call operator meeting WriteHandler requirements. 10670 // Used as the handler for the async_write_some operation. 10671 void operator()(boost::system::error_code ec, std::size_t) 10672 { 10673 // Put the underlying socket into non-blocking mode. 10674 if (!ec) 10675 if (!sock_.native_non_blocking()) 10676 sock_.native_non_blocking(true, ec); 10677 10678 if (!ec) 10679 { 10680 for (;;) 10681 { 10682 // Try the system call. 10683 errno = 0; 10684 int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536); 10685 ec = boost::system::error_code(n < 0 ? errno : 0, 10686 boost::asio::error::get_system_category()); 10687 total_bytes_transferred_ += ec ? 0 : n; 10688 10689 // Retry operation immediately if interrupted by signal. 10690 if (ec == boost::asio::error::interrupted) 10691 continue; 10692 10693 // Check if we need to run the operation again. 10694 if (ec == boost::asio::error::would_block 10695 || ec == boost::asio::error::try_again) 10696 { 10697 // We have to wait for the socket to become ready again. 10698 sock_.async_wait(tcp::socket::wait_write, *this); 10699 return; 10700 } 10701 10702 if (ec || n == 0) 10703 { 10704 // An error occurred, or we have reached the end of the file. 10705 // Either way we must exit the loop so we can call the handler. 10706 break; 10707 } 10708 10709 // Loop around to try calling sendfile again. 10710 } 10711 } 10712 10713 // Pass result back to user's handler. 10714 handler_(ec, total_bytes_transferred_); 10715 } 10716 }; 10717 10718 template <typename Handler> 10719 void async_sendfile(tcp::socket& sock, int fd, Handler h) 10720 { 10721 sendfile_op<Handler> op = { sock, fd, h, 0, 0 }; 10722 sock.async_wait(tcp::socket::wait_write, op); 10723 } 10724 10725 10726 10727 10728 10729 10730 10731[endsect] 10732 10733 10734[endsect] 10735 10736[section:non_blocking basic_datagram_socket::non_blocking] 10737 10738[indexterm2 boost_asio.indexterm.basic_datagram_socket.non_blocking..non_blocking..basic_datagram_socket] 10739Gets the non-blocking mode of the socket. 10740 10741 10742 bool ``[link boost_asio.reference.basic_datagram_socket.non_blocking.overload1 non_blocking]``() const; 10743 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.non_blocking.overload1 more...]]`` 10744 10745 10746Sets the non-blocking mode of the socket. 10747 10748 10749 void ``[link boost_asio.reference.basic_datagram_socket.non_blocking.overload2 non_blocking]``( 10750 bool mode); 10751 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.non_blocking.overload2 more...]]`` 10752 10753 void ``[link boost_asio.reference.basic_datagram_socket.non_blocking.overload3 non_blocking]``( 10754 bool mode, 10755 boost::system::error_code & ec); 10756 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.non_blocking.overload3 more...]]`` 10757 10758 10759[section:overload1 basic_datagram_socket::non_blocking (1 of 3 overloads)] 10760 10761 10762['Inherited from basic_socket.] 10763 10764 10765Gets the non-blocking mode of the socket. 10766 10767 10768 bool non_blocking() const; 10769 10770 10771 10772[heading Return Value] 10773 10774`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. 10775 10776 10777[heading Remarks] 10778 10779The 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`. 10780 10781 10782 10783 10784[endsect] 10785 10786 10787 10788[section:overload2 basic_datagram_socket::non_blocking (2 of 3 overloads)] 10789 10790 10791['Inherited from basic_socket.] 10792 10793 10794Sets the non-blocking mode of the socket. 10795 10796 10797 void non_blocking( 10798 bool mode); 10799 10800 10801 10802[heading Parameters] 10803 10804 10805[variablelist 10806 10807[[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.]] 10808 10809] 10810 10811 10812[heading Exceptions] 10813 10814 10815[variablelist 10816 10817[[boost::system::system_error][Thrown on failure.]] 10818 10819] 10820 10821 10822[heading Remarks] 10823 10824The 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`. 10825 10826 10827 10828 10829[endsect] 10830 10831 10832 10833[section:overload3 basic_datagram_socket::non_blocking (3 of 3 overloads)] 10834 10835 10836['Inherited from basic_socket.] 10837 10838 10839Sets the non-blocking mode of the socket. 10840 10841 10842 void non_blocking( 10843 bool mode, 10844 boost::system::error_code & ec); 10845 10846 10847 10848[heading Parameters] 10849 10850 10851[variablelist 10852 10853[[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.]] 10854 10855[[ec][Set to indicate what error occurred, if any.]] 10856 10857] 10858 10859 10860[heading Remarks] 10861 10862The 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`. 10863 10864 10865 10866 10867[endsect] 10868 10869 10870[endsect] 10871 10872[section:open basic_datagram_socket::open] 10873 10874[indexterm2 boost_asio.indexterm.basic_datagram_socket.open..open..basic_datagram_socket] 10875Open the socket using the specified protocol. 10876 10877 10878 void ``[link boost_asio.reference.basic_datagram_socket.open.overload1 open]``( 10879 const protocol_type & protocol = protocol_type()); 10880 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.open.overload1 more...]]`` 10881 10882 void ``[link boost_asio.reference.basic_datagram_socket.open.overload2 open]``( 10883 const protocol_type & protocol, 10884 boost::system::error_code & ec); 10885 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.open.overload2 more...]]`` 10886 10887 10888[section:overload1 basic_datagram_socket::open (1 of 2 overloads)] 10889 10890 10891['Inherited from basic_socket.] 10892 10893 10894Open the socket using the specified protocol. 10895 10896 10897 void open( 10898 const protocol_type & protocol = protocol_type()); 10899 10900 10901This function opens the socket so that it will use the specified protocol. 10902 10903 10904[heading Parameters] 10905 10906 10907[variablelist 10908 10909[[protocol][An object specifying protocol parameters to be used.]] 10910 10911] 10912 10913 10914[heading Exceptions] 10915 10916 10917[variablelist 10918 10919[[boost::system::system_error][Thrown on failure.]] 10920 10921] 10922 10923 10924[heading Example] 10925 10926 10927 10928 boost::asio::ip::tcp::socket socket(my_context); 10929 socket.open(boost::asio::ip::tcp::v4()); 10930 10931 10932 10933 10934 10935 10936 10937[endsect] 10938 10939 10940 10941[section:overload2 basic_datagram_socket::open (2 of 2 overloads)] 10942 10943 10944['Inherited from basic_socket.] 10945 10946 10947Open the socket using the specified protocol. 10948 10949 10950 void open( 10951 const protocol_type & protocol, 10952 boost::system::error_code & ec); 10953 10954 10955This function opens the socket so that it will use the specified protocol. 10956 10957 10958[heading Parameters] 10959 10960 10961[variablelist 10962 10963[[protocol][An object specifying which protocol is to be used.]] 10964 10965[[ec][Set to indicate what error occurred, if any.]] 10966 10967] 10968 10969 10970[heading Example] 10971 10972 10973 10974 boost::asio::ip::tcp::socket socket(my_context); 10975 boost::system::error_code ec; 10976 socket.open(boost::asio::ip::tcp::v4(), ec); 10977 if (ec) 10978 { 10979 // An error occurred. 10980 } 10981 10982 10983 10984 10985 10986 10987 10988[endsect] 10989 10990 10991[endsect] 10992 10993[section:operator_eq_ basic_datagram_socket::operator=] 10994 10995[indexterm2 boost_asio.indexterm.basic_datagram_socket.operator_eq_..operator=..basic_datagram_socket] 10996Move-assign a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] from another. 10997 10998 10999 basic_datagram_socket & ``[link boost_asio.reference.basic_datagram_socket.operator_eq_.overload1 operator=]``( 11000 basic_datagram_socket && other); 11001 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.operator_eq_.overload1 more...]]`` 11002 11003 11004Move-assign a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] from a socket of another protocol type. 11005 11006 11007 template< 11008 typename ``[link boost_asio.reference.Protocol Protocol1]``, 11009 typename ``[link boost_asio.reference.Executor1 Executor1]``> 11010 constraint< 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=]``( 11011 basic_datagram_socket< Protocol1, Executor1 > && other); 11012 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.operator_eq_.overload2 more...]]`` 11013 11014 11015[section:overload1 basic_datagram_socket::operator= (1 of 2 overloads)] 11016 11017 11018Move-assign a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] from another. 11019 11020 11021 basic_datagram_socket & operator=( 11022 basic_datagram_socket && other); 11023 11024 11025This assignment operator moves a datagram socket from one object to another. 11026 11027 11028[heading Parameters] 11029 11030 11031[variablelist 11032 11033[[other][The other [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] object from which the move will occur.]] 11034 11035] 11036 11037 11038[heading Remarks] 11039 11040Following the move, the moved-from object is in the same state as if constructed using the `basic_datagram_socket(const executor_type&)` constructor. 11041 11042 11043 11044 11045[endsect] 11046 11047 11048 11049[section:overload2 basic_datagram_socket::operator= (2 of 2 overloads)] 11050 11051 11052Move-assign a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] from a socket of another protocol type. 11053 11054 11055 template< 11056 typename ``[link boost_asio.reference.Protocol Protocol1]``, 11057 typename ``[link boost_asio.reference.Executor1 Executor1]``> 11058 constraint< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value, basic_datagram_socket & >::type operator=( 11059 basic_datagram_socket< Protocol1, Executor1 > && other); 11060 11061 11062This assignment operator moves a datagram socket from one object to another. 11063 11064 11065[heading Parameters] 11066 11067 11068[variablelist 11069 11070[[other][The other [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] object from which the move will occur.]] 11071 11072] 11073 11074 11075[heading Remarks] 11076 11077Following the move, the moved-from object is in the same state as if constructed using the `basic_datagram_socket(const executor_type&)` constructor. 11078 11079 11080 11081 11082[endsect] 11083 11084 11085[endsect] 11086 11087 11088[section:out_of_band_inline basic_datagram_socket::out_of_band_inline] 11089 11090 11091['Inherited from socket_base.] 11092 11093[indexterm2 boost_asio.indexterm.basic_datagram_socket.out_of_band_inline..out_of_band_inline..basic_datagram_socket] 11094Socket option for putting received out-of-band data inline. 11095 11096 11097 typedef implementation_defined out_of_band_inline; 11098 11099 11100 11101Implements the SOL\_SOCKET/SO\_OOBINLINE socket option. 11102 11103 11104[heading Examples] 11105 11106Setting the option: 11107 11108 boost::asio::ip::tcp::socket socket(my_context); 11109 ... 11110 boost::asio::socket_base::out_of_band_inline option(true); 11111 socket.set_option(option); 11112 11113 11114 11115 11116 11117Getting the current option value: 11118 11119 boost::asio::ip::tcp::socket socket(my_context); 11120 ... 11121 boost::asio::socket_base::out_of_band_inline option; 11122 socket.get_option(option); 11123 bool value = option.value(); 11124 11125 11126 11127 11128 11129 11130 11131[heading Requirements] 11132 11133['Header: ][^boost/asio/basic_datagram_socket.hpp] 11134 11135['Convenience header: ][^boost/asio.hpp] 11136 11137 11138[endsect] 11139 11140 11141 11142[section:protocol_type basic_datagram_socket::protocol_type] 11143 11144[indexterm2 boost_asio.indexterm.basic_datagram_socket.protocol_type..protocol_type..basic_datagram_socket] 11145The protocol type. 11146 11147 11148 typedef Protocol protocol_type; 11149 11150 11151 11152[heading Requirements] 11153 11154['Header: ][^boost/asio/basic_datagram_socket.hpp] 11155 11156['Convenience header: ][^boost/asio.hpp] 11157 11158 11159[endsect] 11160 11161 11162[section:receive basic_datagram_socket::receive] 11163 11164[indexterm2 boost_asio.indexterm.basic_datagram_socket.receive..receive..basic_datagram_socket] 11165Receive some data on a connected socket. 11166 11167 11168 template< 11169 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 11170 std::size_t ``[link boost_asio.reference.basic_datagram_socket.receive.overload1 receive]``( 11171 const MutableBufferSequence & buffers); 11172 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.receive.overload1 more...]]`` 11173 11174 template< 11175 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 11176 std::size_t ``[link boost_asio.reference.basic_datagram_socket.receive.overload2 receive]``( 11177 const MutableBufferSequence & buffers, 11178 socket_base::message_flags flags); 11179 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.receive.overload2 more...]]`` 11180 11181 template< 11182 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 11183 std::size_t ``[link boost_asio.reference.basic_datagram_socket.receive.overload3 receive]``( 11184 const MutableBufferSequence & buffers, 11185 socket_base::message_flags flags, 11186 boost::system::error_code & ec); 11187 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.receive.overload3 more...]]`` 11188 11189 11190[section:overload1 basic_datagram_socket::receive (1 of 3 overloads)] 11191 11192 11193Receive some data on a connected socket. 11194 11195 11196 template< 11197 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 11198 std::size_t receive( 11199 const MutableBufferSequence & buffers); 11200 11201 11202This 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. 11203 11204 11205[heading Parameters] 11206 11207 11208[variablelist 11209 11210[[buffers][One or more buffers into which the data will be received.]] 11211 11212] 11213 11214 11215[heading Return Value] 11216 11217The number of bytes received. 11218 11219 11220[heading Exceptions] 11221 11222 11223[variablelist 11224 11225[[boost::system::system_error][Thrown on failure.]] 11226 11227] 11228 11229 11230[heading Remarks] 11231 11232The receive operation can only be used with a connected socket. Use the receive\_from function to receive data on an unconnected datagram socket. 11233 11234 11235[heading Example] 11236 11237To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 11238 11239 socket.receive(boost::asio::buffer(data, size)); 11240 11241 11242See 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. 11243 11244 11245 11246 11247[endsect] 11248 11249 11250 11251[section:overload2 basic_datagram_socket::receive (2 of 3 overloads)] 11252 11253 11254Receive some data on a connected socket. 11255 11256 11257 template< 11258 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 11259 std::size_t receive( 11260 const MutableBufferSequence & buffers, 11261 socket_base::message_flags flags); 11262 11263 11264This 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. 11265 11266 11267[heading Parameters] 11268 11269 11270[variablelist 11271 11272[[buffers][One or more buffers into which the data will be received.]] 11273 11274[[flags][Flags specifying how the receive call is to be made.]] 11275 11276] 11277 11278 11279[heading Return Value] 11280 11281The number of bytes received. 11282 11283 11284[heading Exceptions] 11285 11286 11287[variablelist 11288 11289[[boost::system::system_error][Thrown on failure.]] 11290 11291] 11292 11293 11294[heading Remarks] 11295 11296The receive operation can only be used with a connected socket. Use the receive\_from function to receive data on an unconnected datagram socket. 11297 11298 11299 11300 11301[endsect] 11302 11303 11304 11305[section:overload3 basic_datagram_socket::receive (3 of 3 overloads)] 11306 11307 11308Receive some data on a connected socket. 11309 11310 11311 template< 11312 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 11313 std::size_t receive( 11314 const MutableBufferSequence & buffers, 11315 socket_base::message_flags flags, 11316 boost::system::error_code & ec); 11317 11318 11319This 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. 11320 11321 11322[heading Parameters] 11323 11324 11325[variablelist 11326 11327[[buffers][One or more buffers into which the data will be received.]] 11328 11329[[flags][Flags specifying how the receive call is to be made.]] 11330 11331[[ec][Set to indicate what error occurred, if any.]] 11332 11333] 11334 11335 11336[heading Return Value] 11337 11338The number of bytes received. 11339 11340 11341[heading Remarks] 11342 11343The receive operation can only be used with a connected socket. Use the receive\_from function to receive data on an unconnected datagram socket. 11344 11345 11346 11347 11348[endsect] 11349 11350 11351[endsect] 11352 11353 11354[section:receive_buffer_size basic_datagram_socket::receive_buffer_size] 11355 11356 11357['Inherited from socket_base.] 11358 11359[indexterm2 boost_asio.indexterm.basic_datagram_socket.receive_buffer_size..receive_buffer_size..basic_datagram_socket] 11360Socket option for the receive buffer size of a socket. 11361 11362 11363 typedef implementation_defined receive_buffer_size; 11364 11365 11366 11367Implements the SOL\_SOCKET/SO\_RCVBUF socket option. 11368 11369 11370[heading Examples] 11371 11372Setting the option: 11373 11374 boost::asio::ip::tcp::socket socket(my_context); 11375 ... 11376 boost::asio::socket_base::receive_buffer_size option(8192); 11377 socket.set_option(option); 11378 11379 11380 11381 11382 11383Getting the current option value: 11384 11385 boost::asio::ip::tcp::socket socket(my_context); 11386 ... 11387 boost::asio::socket_base::receive_buffer_size option; 11388 socket.get_option(option); 11389 int size = option.value(); 11390 11391 11392 11393 11394 11395 11396 11397[heading Requirements] 11398 11399['Header: ][^boost/asio/basic_datagram_socket.hpp] 11400 11401['Convenience header: ][^boost/asio.hpp] 11402 11403 11404[endsect] 11405 11406 11407[section:receive_from basic_datagram_socket::receive_from] 11408 11409[indexterm2 boost_asio.indexterm.basic_datagram_socket.receive_from..receive_from..basic_datagram_socket] 11410Receive a datagram with the endpoint of the sender. 11411 11412 11413 template< 11414 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 11415 std::size_t ``[link boost_asio.reference.basic_datagram_socket.receive_from.overload1 receive_from]``( 11416 const MutableBufferSequence & buffers, 11417 endpoint_type & sender_endpoint); 11418 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.receive_from.overload1 more...]]`` 11419 11420 template< 11421 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 11422 std::size_t ``[link boost_asio.reference.basic_datagram_socket.receive_from.overload2 receive_from]``( 11423 const MutableBufferSequence & buffers, 11424 endpoint_type & sender_endpoint, 11425 socket_base::message_flags flags); 11426 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.receive_from.overload2 more...]]`` 11427 11428 template< 11429 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 11430 std::size_t ``[link boost_asio.reference.basic_datagram_socket.receive_from.overload3 receive_from]``( 11431 const MutableBufferSequence & buffers, 11432 endpoint_type & sender_endpoint, 11433 socket_base::message_flags flags, 11434 boost::system::error_code & ec); 11435 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.receive_from.overload3 more...]]`` 11436 11437 11438[section:overload1 basic_datagram_socket::receive_from (1 of 3 overloads)] 11439 11440 11441Receive a datagram with the endpoint of the sender. 11442 11443 11444 template< 11445 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 11446 std::size_t receive_from( 11447 const MutableBufferSequence & buffers, 11448 endpoint_type & sender_endpoint); 11449 11450 11451This function is used to receive a datagram. The function call will block until data has been received successfully or an error occurs. 11452 11453 11454[heading Parameters] 11455 11456 11457[variablelist 11458 11459[[buffers][One or more buffers into which the data will be received.]] 11460 11461[[sender_endpoint][An endpoint object that receives the endpoint of the remote sender of the datagram.]] 11462 11463] 11464 11465 11466[heading Return Value] 11467 11468The number of bytes received. 11469 11470 11471[heading Exceptions] 11472 11473 11474[variablelist 11475 11476[[boost::system::system_error][Thrown on failure.]] 11477 11478] 11479 11480 11481[heading Example] 11482 11483To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 11484 11485 boost::asio::ip::udp::endpoint sender_endpoint; 11486 socket.receive_from( 11487 boost::asio::buffer(data, size), sender_endpoint); 11488 11489 11490See 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. 11491 11492 11493 11494 11495[endsect] 11496 11497 11498 11499[section:overload2 basic_datagram_socket::receive_from (2 of 3 overloads)] 11500 11501 11502Receive a datagram with the endpoint of the sender. 11503 11504 11505 template< 11506 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 11507 std::size_t receive_from( 11508 const MutableBufferSequence & buffers, 11509 endpoint_type & sender_endpoint, 11510 socket_base::message_flags flags); 11511 11512 11513This function is used to receive a datagram. The function call will block until data has been received successfully or an error occurs. 11514 11515 11516[heading Parameters] 11517 11518 11519[variablelist 11520 11521[[buffers][One or more buffers into which the data will be received.]] 11522 11523[[sender_endpoint][An endpoint object that receives the endpoint of the remote sender of the datagram.]] 11524 11525[[flags][Flags specifying how the receive call is to be made.]] 11526 11527] 11528 11529 11530[heading Return Value] 11531 11532The number of bytes received. 11533 11534 11535[heading Exceptions] 11536 11537 11538[variablelist 11539 11540[[boost::system::system_error][Thrown on failure. ]] 11541 11542] 11543 11544 11545 11546 11547[endsect] 11548 11549 11550 11551[section:overload3 basic_datagram_socket::receive_from (3 of 3 overloads)] 11552 11553 11554Receive a datagram with the endpoint of the sender. 11555 11556 11557 template< 11558 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 11559 std::size_t receive_from( 11560 const MutableBufferSequence & buffers, 11561 endpoint_type & sender_endpoint, 11562 socket_base::message_flags flags, 11563 boost::system::error_code & ec); 11564 11565 11566This function is used to receive a datagram. The function call will block until data has been received successfully or an error occurs. 11567 11568 11569[heading Parameters] 11570 11571 11572[variablelist 11573 11574[[buffers][One or more buffers into which the data will be received.]] 11575 11576[[sender_endpoint][An endpoint object that receives the endpoint of the remote sender of the datagram.]] 11577 11578[[flags][Flags specifying how the receive call is to be made.]] 11579 11580[[ec][Set to indicate what error occurred, if any.]] 11581 11582] 11583 11584 11585[heading Return Value] 11586 11587The number of bytes received. 11588 11589 11590 11591 11592[endsect] 11593 11594 11595[endsect] 11596 11597 11598[section:receive_low_watermark basic_datagram_socket::receive_low_watermark] 11599 11600 11601['Inherited from socket_base.] 11602 11603[indexterm2 boost_asio.indexterm.basic_datagram_socket.receive_low_watermark..receive_low_watermark..basic_datagram_socket] 11604Socket option for the receive low watermark. 11605 11606 11607 typedef implementation_defined receive_low_watermark; 11608 11609 11610 11611Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option. 11612 11613 11614[heading Examples] 11615 11616Setting the option: 11617 11618 boost::asio::ip::tcp::socket socket(my_context); 11619 ... 11620 boost::asio::socket_base::receive_low_watermark option(1024); 11621 socket.set_option(option); 11622 11623 11624 11625 11626 11627Getting the current option value: 11628 11629 boost::asio::ip::tcp::socket socket(my_context); 11630 ... 11631 boost::asio::socket_base::receive_low_watermark option; 11632 socket.get_option(option); 11633 int size = option.value(); 11634 11635 11636 11637 11638 11639 11640 11641[heading Requirements] 11642 11643['Header: ][^boost/asio/basic_datagram_socket.hpp] 11644 11645['Convenience header: ][^boost/asio.hpp] 11646 11647 11648[endsect] 11649 11650 11651[section:release basic_datagram_socket::release] 11652 11653[indexterm2 boost_asio.indexterm.basic_datagram_socket.release..release..basic_datagram_socket] 11654Release ownership of the underlying native socket. 11655 11656 11657 native_handle_type ``[link boost_asio.reference.basic_datagram_socket.release.overload1 release]``(); 11658 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.release.overload1 more...]]`` 11659 11660 native_handle_type ``[link boost_asio.reference.basic_datagram_socket.release.overload2 release]``( 11661 boost::system::error_code & ec); 11662 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.release.overload2 more...]]`` 11663 11664 11665[section:overload1 basic_datagram_socket::release (1 of 2 overloads)] 11666 11667 11668['Inherited from basic_socket.] 11669 11670 11671Release ownership of the underlying native socket. 11672 11673 11674 native_handle_type release(); 11675 11676 11677This 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. 11678 11679 11680[heading Exceptions] 11681 11682 11683[variablelist 11684 11685[[boost::system::system_error][Thrown on failure.]] 11686 11687] 11688 11689 11690[heading Remarks] 11691 11692This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms. 11693 11694 11695 11696 11697[endsect] 11698 11699 11700 11701[section:overload2 basic_datagram_socket::release (2 of 2 overloads)] 11702 11703 11704['Inherited from basic_socket.] 11705 11706 11707Release ownership of the underlying native socket. 11708 11709 11710 native_handle_type release( 11711 boost::system::error_code & ec); 11712 11713 11714This 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. 11715 11716 11717[heading Parameters] 11718 11719 11720[variablelist 11721 11722[[ec][Set to indicate what error occurred, if any.]] 11723 11724] 11725 11726 11727[heading Remarks] 11728 11729This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms. 11730 11731 11732 11733 11734[endsect] 11735 11736 11737[endsect] 11738 11739[section:remote_endpoint basic_datagram_socket::remote_endpoint] 11740 11741[indexterm2 boost_asio.indexterm.basic_datagram_socket.remote_endpoint..remote_endpoint..basic_datagram_socket] 11742Get the remote endpoint of the socket. 11743 11744 11745 endpoint_type ``[link boost_asio.reference.basic_datagram_socket.remote_endpoint.overload1 remote_endpoint]``() const; 11746 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.remote_endpoint.overload1 more...]]`` 11747 11748 endpoint_type ``[link boost_asio.reference.basic_datagram_socket.remote_endpoint.overload2 remote_endpoint]``( 11749 boost::system::error_code & ec) const; 11750 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.remote_endpoint.overload2 more...]]`` 11751 11752 11753[section:overload1 basic_datagram_socket::remote_endpoint (1 of 2 overloads)] 11754 11755 11756['Inherited from basic_socket.] 11757 11758 11759Get the remote endpoint of the socket. 11760 11761 11762 endpoint_type remote_endpoint() const; 11763 11764 11765This function is used to obtain the remote endpoint of the socket. 11766 11767 11768[heading Return Value] 11769 11770An object that represents the remote endpoint of the socket. 11771 11772 11773[heading Exceptions] 11774 11775 11776[variablelist 11777 11778[[boost::system::system_error][Thrown on failure.]] 11779 11780] 11781 11782 11783[heading Example] 11784 11785 11786 11787 boost::asio::ip::tcp::socket socket(my_context); 11788 ... 11789 boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(); 11790 11791 11792 11793 11794 11795 11796 11797[endsect] 11798 11799 11800 11801[section:overload2 basic_datagram_socket::remote_endpoint (2 of 2 overloads)] 11802 11803 11804['Inherited from basic_socket.] 11805 11806 11807Get the remote endpoint of the socket. 11808 11809 11810 endpoint_type remote_endpoint( 11811 boost::system::error_code & ec) const; 11812 11813 11814This function is used to obtain the remote endpoint of the socket. 11815 11816 11817[heading Parameters] 11818 11819 11820[variablelist 11821 11822[[ec][Set to indicate what error occurred, if any.]] 11823 11824] 11825 11826 11827[heading Return Value] 11828 11829An object that represents the remote endpoint of the socket. Returns a default-constructed endpoint object if an error occurred. 11830 11831 11832[heading Example] 11833 11834 11835 11836 boost::asio::ip::tcp::socket socket(my_context); 11837 ... 11838 boost::system::error_code ec; 11839 boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(ec); 11840 if (ec) 11841 { 11842 // An error occurred. 11843 } 11844 11845 11846 11847 11848 11849 11850 11851[endsect] 11852 11853 11854[endsect] 11855 11856 11857[section:reuse_address basic_datagram_socket::reuse_address] 11858 11859 11860['Inherited from socket_base.] 11861 11862[indexterm2 boost_asio.indexterm.basic_datagram_socket.reuse_address..reuse_address..basic_datagram_socket] 11863Socket option to allow the socket to be bound to an address that is already in use. 11864 11865 11866 typedef implementation_defined reuse_address; 11867 11868 11869 11870Implements the SOL\_SOCKET/SO\_REUSEADDR socket option. 11871 11872 11873[heading Examples] 11874 11875Setting the option: 11876 11877 boost::asio::ip::tcp::acceptor acceptor(my_context); 11878 ... 11879 boost::asio::socket_base::reuse_address option(true); 11880 acceptor.set_option(option); 11881 11882 11883 11884 11885 11886Getting the current option value: 11887 11888 boost::asio::ip::tcp::acceptor acceptor(my_context); 11889 ... 11890 boost::asio::socket_base::reuse_address option; 11891 acceptor.get_option(option); 11892 bool is_set = option.value(); 11893 11894 11895 11896 11897 11898 11899 11900[heading Requirements] 11901 11902['Header: ][^boost/asio/basic_datagram_socket.hpp] 11903 11904['Convenience header: ][^boost/asio.hpp] 11905 11906 11907[endsect] 11908 11909 11910[section:send basic_datagram_socket::send] 11911 11912[indexterm2 boost_asio.indexterm.basic_datagram_socket.send..send..basic_datagram_socket] 11913Send some data on a connected socket. 11914 11915 11916 template< 11917 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 11918 std::size_t ``[link boost_asio.reference.basic_datagram_socket.send.overload1 send]``( 11919 const ConstBufferSequence & buffers); 11920 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.send.overload1 more...]]`` 11921 11922 template< 11923 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 11924 std::size_t ``[link boost_asio.reference.basic_datagram_socket.send.overload2 send]``( 11925 const ConstBufferSequence & buffers, 11926 socket_base::message_flags flags); 11927 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.send.overload2 more...]]`` 11928 11929 template< 11930 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 11931 std::size_t ``[link boost_asio.reference.basic_datagram_socket.send.overload3 send]``( 11932 const ConstBufferSequence & buffers, 11933 socket_base::message_flags flags, 11934 boost::system::error_code & ec); 11935 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.send.overload3 more...]]`` 11936 11937 11938[section:overload1 basic_datagram_socket::send (1 of 3 overloads)] 11939 11940 11941Send some data on a connected socket. 11942 11943 11944 template< 11945 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 11946 std::size_t send( 11947 const ConstBufferSequence & buffers); 11948 11949 11950This 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. 11951 11952 11953[heading Parameters] 11954 11955 11956[variablelist 11957 11958[[buffers][One ore more data buffers to be sent on the socket.]] 11959 11960] 11961 11962 11963[heading Return Value] 11964 11965The number of bytes sent. 11966 11967 11968[heading Exceptions] 11969 11970 11971[variablelist 11972 11973[[boost::system::system_error][Thrown on failure.]] 11974 11975] 11976 11977 11978[heading Remarks] 11979 11980The send operation can only be used with a connected socket. Use the send\_to function to send data on an unconnected datagram socket. 11981 11982 11983[heading Example] 11984 11985To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 11986 11987 socket.send(boost::asio::buffer(data, size)); 11988 11989 11990See 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. 11991 11992 11993 11994 11995[endsect] 11996 11997 11998 11999[section:overload2 basic_datagram_socket::send (2 of 3 overloads)] 12000 12001 12002Send some data on a connected socket. 12003 12004 12005 template< 12006 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 12007 std::size_t send( 12008 const ConstBufferSequence & buffers, 12009 socket_base::message_flags flags); 12010 12011 12012This 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. 12013 12014 12015[heading Parameters] 12016 12017 12018[variablelist 12019 12020[[buffers][One ore more data buffers to be sent on the socket.]] 12021 12022[[flags][Flags specifying how the send call is to be made.]] 12023 12024] 12025 12026 12027[heading Return Value] 12028 12029The number of bytes sent. 12030 12031 12032[heading Exceptions] 12033 12034 12035[variablelist 12036 12037[[boost::system::system_error][Thrown on failure.]] 12038 12039] 12040 12041 12042[heading Remarks] 12043 12044The send operation can only be used with a connected socket. Use the send\_to function to send data on an unconnected datagram socket. 12045 12046 12047 12048 12049[endsect] 12050 12051 12052 12053[section:overload3 basic_datagram_socket::send (3 of 3 overloads)] 12054 12055 12056Send some data on a connected socket. 12057 12058 12059 template< 12060 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 12061 std::size_t send( 12062 const ConstBufferSequence & buffers, 12063 socket_base::message_flags flags, 12064 boost::system::error_code & ec); 12065 12066 12067This 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. 12068 12069 12070[heading Parameters] 12071 12072 12073[variablelist 12074 12075[[buffers][One or more data buffers to be sent on the socket.]] 12076 12077[[flags][Flags specifying how the send call is to be made.]] 12078 12079[[ec][Set to indicate what error occurred, if any.]] 12080 12081] 12082 12083 12084[heading Return Value] 12085 12086The number of bytes sent. 12087 12088 12089[heading Remarks] 12090 12091The send operation can only be used with a connected socket. Use the send\_to function to send data on an unconnected datagram socket. 12092 12093 12094 12095 12096[endsect] 12097 12098 12099[endsect] 12100 12101 12102[section:send_buffer_size basic_datagram_socket::send_buffer_size] 12103 12104 12105['Inherited from socket_base.] 12106 12107[indexterm2 boost_asio.indexterm.basic_datagram_socket.send_buffer_size..send_buffer_size..basic_datagram_socket] 12108Socket option for the send buffer size of a socket. 12109 12110 12111 typedef implementation_defined send_buffer_size; 12112 12113 12114 12115Implements the SOL\_SOCKET/SO\_SNDBUF socket option. 12116 12117 12118[heading Examples] 12119 12120Setting the option: 12121 12122 boost::asio::ip::tcp::socket socket(my_context); 12123 ... 12124 boost::asio::socket_base::send_buffer_size option(8192); 12125 socket.set_option(option); 12126 12127 12128 12129 12130 12131Getting the current option value: 12132 12133 boost::asio::ip::tcp::socket socket(my_context); 12134 ... 12135 boost::asio::socket_base::send_buffer_size option; 12136 socket.get_option(option); 12137 int size = option.value(); 12138 12139 12140 12141 12142 12143 12144 12145[heading Requirements] 12146 12147['Header: ][^boost/asio/basic_datagram_socket.hpp] 12148 12149['Convenience header: ][^boost/asio.hpp] 12150 12151 12152[endsect] 12153 12154 12155 12156[section:send_low_watermark basic_datagram_socket::send_low_watermark] 12157 12158 12159['Inherited from socket_base.] 12160 12161[indexterm2 boost_asio.indexterm.basic_datagram_socket.send_low_watermark..send_low_watermark..basic_datagram_socket] 12162Socket option for the send low watermark. 12163 12164 12165 typedef implementation_defined send_low_watermark; 12166 12167 12168 12169Implements the SOL\_SOCKET/SO\_SNDLOWAT socket option. 12170 12171 12172[heading Examples] 12173 12174Setting the option: 12175 12176 boost::asio::ip::tcp::socket socket(my_context); 12177 ... 12178 boost::asio::socket_base::send_low_watermark option(1024); 12179 socket.set_option(option); 12180 12181 12182 12183 12184 12185Getting the current option value: 12186 12187 boost::asio::ip::tcp::socket socket(my_context); 12188 ... 12189 boost::asio::socket_base::send_low_watermark option; 12190 socket.get_option(option); 12191 int size = option.value(); 12192 12193 12194 12195 12196 12197 12198 12199[heading Requirements] 12200 12201['Header: ][^boost/asio/basic_datagram_socket.hpp] 12202 12203['Convenience header: ][^boost/asio.hpp] 12204 12205 12206[endsect] 12207 12208 12209[section:send_to basic_datagram_socket::send_to] 12210 12211[indexterm2 boost_asio.indexterm.basic_datagram_socket.send_to..send_to..basic_datagram_socket] 12212Send a datagram to the specified endpoint. 12213 12214 12215 template< 12216 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 12217 std::size_t ``[link boost_asio.reference.basic_datagram_socket.send_to.overload1 send_to]``( 12218 const ConstBufferSequence & buffers, 12219 const endpoint_type & destination); 12220 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.send_to.overload1 more...]]`` 12221 12222 template< 12223 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 12224 std::size_t ``[link boost_asio.reference.basic_datagram_socket.send_to.overload2 send_to]``( 12225 const ConstBufferSequence & buffers, 12226 const endpoint_type & destination, 12227 socket_base::message_flags flags); 12228 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.send_to.overload2 more...]]`` 12229 12230 template< 12231 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 12232 std::size_t ``[link boost_asio.reference.basic_datagram_socket.send_to.overload3 send_to]``( 12233 const ConstBufferSequence & buffers, 12234 const endpoint_type & destination, 12235 socket_base::message_flags flags, 12236 boost::system::error_code & ec); 12237 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.send_to.overload3 more...]]`` 12238 12239 12240[section:overload1 basic_datagram_socket::send_to (1 of 3 overloads)] 12241 12242 12243Send a datagram to the specified endpoint. 12244 12245 12246 template< 12247 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 12248 std::size_t send_to( 12249 const ConstBufferSequence & buffers, 12250 const endpoint_type & destination); 12251 12252 12253This 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. 12254 12255 12256[heading Parameters] 12257 12258 12259[variablelist 12260 12261[[buffers][One or more data buffers to be sent to the remote endpoint.]] 12262 12263[[destination][The remote endpoint to which the data will be sent.]] 12264 12265] 12266 12267 12268[heading Return Value] 12269 12270The number of bytes sent. 12271 12272 12273[heading Exceptions] 12274 12275 12276[variablelist 12277 12278[[boost::system::system_error][Thrown on failure.]] 12279 12280] 12281 12282 12283[heading Example] 12284 12285To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 12286 12287 boost::asio::ip::udp::endpoint destination( 12288 boost::asio::ip::address::from_string("1.2.3.4"), 12345); 12289 socket.send_to(boost::asio::buffer(data, size), destination); 12290 12291 12292See 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. 12293 12294 12295 12296 12297[endsect] 12298 12299 12300 12301[section:overload2 basic_datagram_socket::send_to (2 of 3 overloads)] 12302 12303 12304Send a datagram to the specified endpoint. 12305 12306 12307 template< 12308 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 12309 std::size_t send_to( 12310 const ConstBufferSequence & buffers, 12311 const endpoint_type & destination, 12312 socket_base::message_flags flags); 12313 12314 12315This 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. 12316 12317 12318[heading Parameters] 12319 12320 12321[variablelist 12322 12323[[buffers][One or more data buffers to be sent to the remote endpoint.]] 12324 12325[[destination][The remote endpoint to which the data will be sent.]] 12326 12327[[flags][Flags specifying how the send call is to be made.]] 12328 12329] 12330 12331 12332[heading Return Value] 12333 12334The number of bytes sent. 12335 12336 12337[heading Exceptions] 12338 12339 12340[variablelist 12341 12342[[boost::system::system_error][Thrown on failure. ]] 12343 12344] 12345 12346 12347 12348 12349[endsect] 12350 12351 12352 12353[section:overload3 basic_datagram_socket::send_to (3 of 3 overloads)] 12354 12355 12356Send a datagram to the specified endpoint. 12357 12358 12359 template< 12360 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 12361 std::size_t send_to( 12362 const ConstBufferSequence & buffers, 12363 const endpoint_type & destination, 12364 socket_base::message_flags flags, 12365 boost::system::error_code & ec); 12366 12367 12368This 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. 12369 12370 12371[heading Parameters] 12372 12373 12374[variablelist 12375 12376[[buffers][One or more data buffers to be sent to the remote endpoint.]] 12377 12378[[destination][The remote endpoint to which the data will be sent.]] 12379 12380[[flags][Flags specifying how the send call is to be made.]] 12381 12382[[ec][Set to indicate what error occurred, if any.]] 12383 12384] 12385 12386 12387[heading Return Value] 12388 12389The number of bytes sent. 12390 12391 12392 12393 12394[endsect] 12395 12396 12397[endsect] 12398 12399[section:set_option basic_datagram_socket::set_option] 12400 12401[indexterm2 boost_asio.indexterm.basic_datagram_socket.set_option..set_option..basic_datagram_socket] 12402Set an option on the socket. 12403 12404 12405 template< 12406 typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``> 12407 void ``[link boost_asio.reference.basic_datagram_socket.set_option.overload1 set_option]``( 12408 const SettableSocketOption & option); 12409 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.set_option.overload1 more...]]`` 12410 12411 template< 12412 typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``> 12413 void ``[link boost_asio.reference.basic_datagram_socket.set_option.overload2 set_option]``( 12414 const SettableSocketOption & option, 12415 boost::system::error_code & ec); 12416 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.set_option.overload2 more...]]`` 12417 12418 12419[section:overload1 basic_datagram_socket::set_option (1 of 2 overloads)] 12420 12421 12422['Inherited from basic_socket.] 12423 12424 12425Set an option on the socket. 12426 12427 12428 template< 12429 typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``> 12430 void set_option( 12431 const SettableSocketOption & option); 12432 12433 12434This function is used to set an option on the socket. 12435 12436 12437[heading Parameters] 12438 12439 12440[variablelist 12441 12442[[option][The new option value to be set on the socket.]] 12443 12444] 12445 12446 12447[heading Exceptions] 12448 12449 12450[variablelist 12451 12452[[boost::system::system_error][Thrown on failure.]] 12453 12454] 12455 12456 12457 12458[heading Example] 12459 12460Setting the IPPROTO\_TCP/TCP\_NODELAY option: 12461 12462 boost::asio::ip::tcp::socket socket(my_context); 12463 ... 12464 boost::asio::ip::tcp::no_delay option(true); 12465 socket.set_option(option); 12466 12467 12468 12469 12470 12471 12472 12473[endsect] 12474 12475 12476 12477[section:overload2 basic_datagram_socket::set_option (2 of 2 overloads)] 12478 12479 12480['Inherited from basic_socket.] 12481 12482 12483Set an option on the socket. 12484 12485 12486 template< 12487 typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``> 12488 void set_option( 12489 const SettableSocketOption & option, 12490 boost::system::error_code & ec); 12491 12492 12493This function is used to set an option on the socket. 12494 12495 12496[heading Parameters] 12497 12498 12499[variablelist 12500 12501[[option][The new option value to be set on the socket.]] 12502 12503[[ec][Set to indicate what error occurred, if any.]] 12504 12505] 12506 12507 12508 12509[heading Example] 12510 12511Setting the IPPROTO\_TCP/TCP\_NODELAY option: 12512 12513 boost::asio::ip::tcp::socket socket(my_context); 12514 ... 12515 boost::asio::ip::tcp::no_delay option(true); 12516 boost::system::error_code ec; 12517 socket.set_option(option, ec); 12518 if (ec) 12519 { 12520 // An error occurred. 12521 } 12522 12523 12524 12525 12526 12527 12528 12529[endsect] 12530 12531 12532[endsect] 12533 12534[section:shutdown basic_datagram_socket::shutdown] 12535 12536[indexterm2 boost_asio.indexterm.basic_datagram_socket.shutdown..shutdown..basic_datagram_socket] 12537Disable sends or receives on the socket. 12538 12539 12540 void ``[link boost_asio.reference.basic_datagram_socket.shutdown.overload1 shutdown]``( 12541 shutdown_type what); 12542 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.shutdown.overload1 more...]]`` 12543 12544 void ``[link boost_asio.reference.basic_datagram_socket.shutdown.overload2 shutdown]``( 12545 shutdown_type what, 12546 boost::system::error_code & ec); 12547 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.shutdown.overload2 more...]]`` 12548 12549 12550[section:overload1 basic_datagram_socket::shutdown (1 of 2 overloads)] 12551 12552 12553['Inherited from basic_socket.] 12554 12555 12556Disable sends or receives on the socket. 12557 12558 12559 void shutdown( 12560 shutdown_type what); 12561 12562 12563This function is used to disable send operations, receive operations, or both. 12564 12565 12566[heading Parameters] 12567 12568 12569[variablelist 12570 12571[[what][Determines what types of operation will no longer be allowed.]] 12572 12573] 12574 12575 12576[heading Exceptions] 12577 12578 12579[variablelist 12580 12581[[boost::system::system_error][Thrown on failure.]] 12582 12583] 12584 12585 12586[heading Example] 12587 12588Shutting down the send side of the socket: 12589 12590 boost::asio::ip::tcp::socket socket(my_context); 12591 ... 12592 socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send); 12593 12594 12595 12596 12597 12598 12599 12600[endsect] 12601 12602 12603 12604[section:overload2 basic_datagram_socket::shutdown (2 of 2 overloads)] 12605 12606 12607['Inherited from basic_socket.] 12608 12609 12610Disable sends or receives on the socket. 12611 12612 12613 void shutdown( 12614 shutdown_type what, 12615 boost::system::error_code & ec); 12616 12617 12618This function is used to disable send operations, receive operations, or both. 12619 12620 12621[heading Parameters] 12622 12623 12624[variablelist 12625 12626[[what][Determines what types of operation will no longer be allowed.]] 12627 12628[[ec][Set to indicate what error occurred, if any.]] 12629 12630] 12631 12632 12633[heading Example] 12634 12635Shutting down the send side of the socket: 12636 12637 boost::asio::ip::tcp::socket socket(my_context); 12638 ... 12639 boost::system::error_code ec; 12640 socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send, ec); 12641 if (ec) 12642 { 12643 // An error occurred. 12644 } 12645 12646 12647 12648 12649 12650 12651 12652[endsect] 12653 12654 12655[endsect] 12656 12657 12658[section:shutdown_type basic_datagram_socket::shutdown_type] 12659 12660 12661['Inherited from socket_base.] 12662 12663[indexterm2 boost_asio.indexterm.basic_datagram_socket.shutdown_type..shutdown_type..basic_datagram_socket] 12664Different ways a socket may be shutdown. 12665 12666 12667 enum shutdown_type 12668 12669[indexterm2 boost_asio.indexterm.basic_datagram_socket.shutdown_type.shutdown_receive..shutdown_receive..basic_datagram_socket] 12670[indexterm2 boost_asio.indexterm.basic_datagram_socket.shutdown_type.shutdown_send..shutdown_send..basic_datagram_socket] 12671[indexterm2 boost_asio.indexterm.basic_datagram_socket.shutdown_type.shutdown_both..shutdown_both..basic_datagram_socket] 12672 12673[heading Values] 12674[variablelist 12675 12676 [ 12677 [shutdown_receive] 12678 [Shutdown the receive side of the socket. ] 12679 ] 12680 12681 [ 12682 [shutdown_send] 12683 [Shutdown the send side of the socket. ] 12684 ] 12685 12686 [ 12687 [shutdown_both] 12688 [Shutdown both send and receive on the socket. ] 12689 ] 12690 12691] 12692 12693 12694 12695[endsect] 12696 12697 12698[section:wait basic_datagram_socket::wait] 12699 12700[indexterm2 boost_asio.indexterm.basic_datagram_socket.wait..wait..basic_datagram_socket] 12701Wait for the socket to become ready to read, ready to write, or to have pending error conditions. 12702 12703 12704 void ``[link boost_asio.reference.basic_datagram_socket.wait.overload1 wait]``( 12705 wait_type w); 12706 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.wait.overload1 more...]]`` 12707 12708 void ``[link boost_asio.reference.basic_datagram_socket.wait.overload2 wait]``( 12709 wait_type w, 12710 boost::system::error_code & ec); 12711 `` [''''»''' [link boost_asio.reference.basic_datagram_socket.wait.overload2 more...]]`` 12712 12713 12714[section:overload1 basic_datagram_socket::wait (1 of 2 overloads)] 12715 12716 12717['Inherited from basic_socket.] 12718 12719 12720Wait for the socket to become ready to read, ready to write, or to have pending error conditions. 12721 12722 12723 void wait( 12724 wait_type w); 12725 12726 12727This function is used to perform a blocking wait for a socket to enter a ready to read, write or error condition state. 12728 12729 12730[heading Parameters] 12731 12732 12733[variablelist 12734 12735[[w][Specifies the desired socket state.]] 12736 12737] 12738 12739 12740[heading Example] 12741 12742Waiting for a socket to become readable. 12743 12744 boost::asio::ip::tcp::socket socket(my_context); 12745 ... 12746 socket.wait(boost::asio::ip::tcp::socket::wait_read); 12747 12748 12749 12750 12751 12752 12753 12754[endsect] 12755 12756 12757 12758[section:overload2 basic_datagram_socket::wait (2 of 2 overloads)] 12759 12760 12761['Inherited from basic_socket.] 12762 12763 12764Wait for the socket to become ready to read, ready to write, or to have pending error conditions. 12765 12766 12767 void wait( 12768 wait_type w, 12769 boost::system::error_code & ec); 12770 12771 12772This function is used to perform a blocking wait for a socket to enter a ready to read, write or error condition state. 12773 12774 12775[heading Parameters] 12776 12777 12778[variablelist 12779 12780[[w][Specifies the desired socket state.]] 12781 12782[[ec][Set to indicate what error occurred, if any.]] 12783 12784] 12785 12786 12787[heading Example] 12788 12789Waiting for a socket to become readable. 12790 12791 boost::asio::ip::tcp::socket socket(my_context); 12792 ... 12793 boost::system::error_code ec; 12794 socket.wait(boost::asio::ip::tcp::socket::wait_read, ec); 12795 12796 12797 12798 12799 12800 12801 12802[endsect] 12803 12804 12805[endsect] 12806 12807 12808[section:wait_type basic_datagram_socket::wait_type] 12809 12810 12811['Inherited from socket_base.] 12812 12813[indexterm2 boost_asio.indexterm.basic_datagram_socket.wait_type..wait_type..basic_datagram_socket] 12814Wait types. 12815 12816 12817 enum wait_type 12818 12819[indexterm2 boost_asio.indexterm.basic_datagram_socket.wait_type.wait_read..wait_read..basic_datagram_socket] 12820[indexterm2 boost_asio.indexterm.basic_datagram_socket.wait_type.wait_write..wait_write..basic_datagram_socket] 12821[indexterm2 boost_asio.indexterm.basic_datagram_socket.wait_type.wait_error..wait_error..basic_datagram_socket] 12822 12823[heading Values] 12824[variablelist 12825 12826 [ 12827 [wait_read] 12828 [Wait for a socket to become ready to read. ] 12829 ] 12830 12831 [ 12832 [wait_write] 12833 [Wait for a socket to become ready to write. ] 12834 ] 12835 12836 [ 12837 [wait_error] 12838 [Wait for a socket to have error conditions pending. ] 12839 ] 12840 12841] 12842 12843 12844For use with `basic_socket::wait()` and `basic_socket::async_wait()`. 12845 12846 12847[endsect] 12848 12849 12850 12851[section:_basic_datagram_socket basic_datagram_socket::~basic_datagram_socket] 12852 12853[indexterm2 boost_asio.indexterm.basic_datagram_socket._basic_datagram_socket..~basic_datagram_socket..basic_datagram_socket] 12854Destroys the socket. 12855 12856 12857 ~basic_datagram_socket(); 12858 12859 12860This function destroys the socket, cancelling any outstanding asynchronous operations associated with the socket as if by calling `cancel`. 12861 12862 12863[endsect] 12864 12865 12866 12867[endsect] 12868 12869[section:basic_datagram_socket__rebind_executor basic_datagram_socket::rebind_executor] 12870 12871[indexterm1 boost_asio.indexterm.basic_datagram_socket__rebind_executor..basic_datagram_socket::rebind_executor] 12872 12873 12874Rebinds the socket type to another executor. 12875 12876 12877 template< 12878 typename ``[link boost_asio.reference.Executor1 Executor1]``> 12879 struct rebind_executor 12880 12881 12882[heading Types] 12883[table 12884 [[Name][Description]] 12885 12886 [ 12887 12888 [[link boost_asio.reference.basic_datagram_socket__rebind_executor.other [*other]]] 12889 [The socket type when rebound to the specified executor. ] 12890 12891 ] 12892 12893] 12894 12895[heading Requirements] 12896 12897['Header: ][^boost/asio/basic_datagram_socket.hpp] 12898 12899['Convenience header: ][^boost/asio.hpp] 12900 12901 12902[section:other basic_datagram_socket::rebind_executor::other] 12903 12904[indexterm2 boost_asio.indexterm.basic_datagram_socket__rebind_executor.other..other..basic_datagram_socket::rebind_executor] 12905The socket type when rebound to the specified executor. 12906 12907 12908 typedef basic_datagram_socket< Protocol, Executor1 > other; 12909 12910 12911[heading Types] 12912[table 12913 [[Name][Description]] 12914 12915 [ 12916 12917 [[link boost_asio.reference.basic_datagram_socket__rebind_executor [*rebind_executor]]] 12918 [Rebinds the socket type to another executor. ] 12919 12920 ] 12921 12922 [ 12923 12924 [[link boost_asio.reference.basic_datagram_socket.broadcast [*broadcast]]] 12925 [Socket option to permit sending of broadcast messages. ] 12926 12927 ] 12928 12929 [ 12930 12931 [[link boost_asio.reference.basic_datagram_socket.bytes_readable [*bytes_readable]]] 12932 [IO control command to get the amount of data that can be read without blocking. ] 12933 12934 ] 12935 12936 [ 12937 12938 [[link boost_asio.reference.basic_datagram_socket.debug [*debug]]] 12939 [Socket option to enable socket-level debugging. ] 12940 12941 ] 12942 12943 [ 12944 12945 [[link boost_asio.reference.basic_datagram_socket.do_not_route [*do_not_route]]] 12946 [Socket option to prevent routing, use local interfaces only. ] 12947 12948 ] 12949 12950 [ 12951 12952 [[link boost_asio.reference.basic_datagram_socket.enable_connection_aborted [*enable_connection_aborted]]] 12953 [Socket option to report aborted connections on accept. ] 12954 12955 ] 12956 12957 [ 12958 12959 [[link boost_asio.reference.basic_datagram_socket.endpoint_type [*endpoint_type]]] 12960 [The endpoint type. ] 12961 12962 ] 12963 12964 [ 12965 12966 [[link boost_asio.reference.basic_datagram_socket.executor_type [*executor_type]]] 12967 [The type of the executor associated with the object. ] 12968 12969 ] 12970 12971 [ 12972 12973 [[link boost_asio.reference.basic_datagram_socket.keep_alive [*keep_alive]]] 12974 [Socket option to send keep-alives. ] 12975 12976 ] 12977 12978 [ 12979 12980 [[link boost_asio.reference.basic_datagram_socket.linger [*linger]]] 12981 [Socket option to specify whether the socket lingers on close if unsent data is present. ] 12982 12983 ] 12984 12985 [ 12986 12987 [[link boost_asio.reference.basic_datagram_socket.lowest_layer_type [*lowest_layer_type]]] 12988 [A basic_socket is always the lowest layer. ] 12989 12990 ] 12991 12992 [ 12993 12994 [[link boost_asio.reference.basic_datagram_socket.message_flags [*message_flags]]] 12995 [Bitmask type for flags that can be passed to send and receive operations. ] 12996 12997 ] 12998 12999 [ 13000 13001 [[link boost_asio.reference.basic_datagram_socket.native_handle_type [*native_handle_type]]] 13002 [The native representation of a socket. ] 13003 13004 ] 13005 13006 [ 13007 13008 [[link boost_asio.reference.basic_datagram_socket.out_of_band_inline [*out_of_band_inline]]] 13009 [Socket option for putting received out-of-band data inline. ] 13010 13011 ] 13012 13013 [ 13014 13015 [[link boost_asio.reference.basic_datagram_socket.protocol_type [*protocol_type]]] 13016 [The protocol type. ] 13017 13018 ] 13019 13020 [ 13021 13022 [[link boost_asio.reference.basic_datagram_socket.receive_buffer_size [*receive_buffer_size]]] 13023 [Socket option for the receive buffer size of a socket. ] 13024 13025 ] 13026 13027 [ 13028 13029 [[link boost_asio.reference.basic_datagram_socket.receive_low_watermark [*receive_low_watermark]]] 13030 [Socket option for the receive low watermark. ] 13031 13032 ] 13033 13034 [ 13035 13036 [[link boost_asio.reference.basic_datagram_socket.reuse_address [*reuse_address]]] 13037 [Socket option to allow the socket to be bound to an address that is already in use. ] 13038 13039 ] 13040 13041 [ 13042 13043 [[link boost_asio.reference.basic_datagram_socket.send_buffer_size [*send_buffer_size]]] 13044 [Socket option for the send buffer size of a socket. ] 13045 13046 ] 13047 13048 [ 13049 13050 [[link boost_asio.reference.basic_datagram_socket.send_low_watermark [*send_low_watermark]]] 13051 [Socket option for the send low watermark. ] 13052 13053 ] 13054 13055 [ 13056 13057 [[link boost_asio.reference.basic_datagram_socket.shutdown_type [*shutdown_type]]] 13058 [Different ways a socket may be shutdown. ] 13059 13060 ] 13061 13062 [ 13063 13064 [[link boost_asio.reference.basic_datagram_socket.wait_type [*wait_type]]] 13065 [Wait types. ] 13066 13067 ] 13068 13069] 13070 13071[heading Member Functions] 13072[table 13073 [[Name][Description]] 13074 13075 [ 13076 [[link boost_asio.reference.basic_datagram_socket.assign [*assign]]] 13077 [Assign an existing native socket to the socket. ] 13078 ] 13079 13080 [ 13081 [[link boost_asio.reference.basic_datagram_socket.async_connect [*async_connect]]] 13082 [Start an asynchronous connect. ] 13083 ] 13084 13085 [ 13086 [[link boost_asio.reference.basic_datagram_socket.async_receive [*async_receive]]] 13087 [Start an asynchronous receive on a connected socket. ] 13088 ] 13089 13090 [ 13091 [[link boost_asio.reference.basic_datagram_socket.async_receive_from [*async_receive_from]]] 13092 [Start an asynchronous receive. ] 13093 ] 13094 13095 [ 13096 [[link boost_asio.reference.basic_datagram_socket.async_send [*async_send]]] 13097 [Start an asynchronous send on a connected socket. ] 13098 ] 13099 13100 [ 13101 [[link boost_asio.reference.basic_datagram_socket.async_send_to [*async_send_to]]] 13102 [Start an asynchronous send. ] 13103 ] 13104 13105 [ 13106 [[link boost_asio.reference.basic_datagram_socket.async_wait [*async_wait]]] 13107 [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 13108 ] 13109 13110 [ 13111 [[link boost_asio.reference.basic_datagram_socket.at_mark [*at_mark]]] 13112 [Determine whether the socket is at the out-of-band data mark. ] 13113 ] 13114 13115 [ 13116 [[link boost_asio.reference.basic_datagram_socket.available [*available]]] 13117 [Determine the number of bytes available for reading. ] 13118 ] 13119 13120 [ 13121 [[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket [*basic_datagram_socket]] [constructor]] 13122 [Construct a basic_datagram_socket without opening it. 13123 [hr] 13124 Construct and open a basic_datagram_socket. 13125 [hr] 13126 Construct a basic_datagram_socket, opening it and binding it to the given local endpoint. 13127 [hr] 13128 Construct a basic_datagram_socket on an existing native socket. 13129 [hr] 13130 Move-construct a basic_datagram_socket from another. 13131 [hr] 13132 Move-construct a basic_datagram_socket from a socket of another protocol type. ] 13133 ] 13134 13135 [ 13136 [[link boost_asio.reference.basic_datagram_socket.bind [*bind]]] 13137 [Bind the socket to the given local endpoint. ] 13138 ] 13139 13140 [ 13141 [[link boost_asio.reference.basic_datagram_socket.cancel [*cancel]]] 13142 [Cancel all asynchronous operations associated with the socket. ] 13143 ] 13144 13145 [ 13146 [[link boost_asio.reference.basic_datagram_socket.close [*close]]] 13147 [Close the socket. ] 13148 ] 13149 13150 [ 13151 [[link boost_asio.reference.basic_datagram_socket.connect [*connect]]] 13152 [Connect the socket to the specified endpoint. ] 13153 ] 13154 13155 [ 13156 [[link boost_asio.reference.basic_datagram_socket.get_executor [*get_executor]]] 13157 [Get the executor associated with the object. ] 13158 ] 13159 13160 [ 13161 [[link boost_asio.reference.basic_datagram_socket.get_option [*get_option]]] 13162 [Get an option from the socket. ] 13163 ] 13164 13165 [ 13166 [[link boost_asio.reference.basic_datagram_socket.io_control [*io_control]]] 13167 [Perform an IO control command on the socket. ] 13168 ] 13169 13170 [ 13171 [[link boost_asio.reference.basic_datagram_socket.is_open [*is_open]]] 13172 [Determine whether the socket is open. ] 13173 ] 13174 13175 [ 13176 [[link boost_asio.reference.basic_datagram_socket.local_endpoint [*local_endpoint]]] 13177 [Get the local endpoint of the socket. ] 13178 ] 13179 13180 [ 13181 [[link boost_asio.reference.basic_datagram_socket.lowest_layer [*lowest_layer]]] 13182 [Get a reference to the lowest layer. 13183 [hr] 13184 Get a const reference to the lowest layer. ] 13185 ] 13186 13187 [ 13188 [[link boost_asio.reference.basic_datagram_socket.native_handle [*native_handle]]] 13189 [Get the native socket representation. ] 13190 ] 13191 13192 [ 13193 [[link boost_asio.reference.basic_datagram_socket.native_non_blocking [*native_non_blocking]]] 13194 [Gets the non-blocking mode of the native socket implementation. 13195 [hr] 13196 Sets the non-blocking mode of the native socket implementation. ] 13197 ] 13198 13199 [ 13200 [[link boost_asio.reference.basic_datagram_socket.non_blocking [*non_blocking]]] 13201 [Gets the non-blocking mode of the socket. 13202 [hr] 13203 Sets the non-blocking mode of the socket. ] 13204 ] 13205 13206 [ 13207 [[link boost_asio.reference.basic_datagram_socket.open [*open]]] 13208 [Open the socket using the specified protocol. ] 13209 ] 13210 13211 [ 13212 [[link boost_asio.reference.basic_datagram_socket.operator_eq_ [*operator=]]] 13213 [Move-assign a basic_datagram_socket from another. 13214 [hr] 13215 Move-assign a basic_datagram_socket from a socket of another protocol type. ] 13216 ] 13217 13218 [ 13219 [[link boost_asio.reference.basic_datagram_socket.receive [*receive]]] 13220 [Receive some data on a connected socket. ] 13221 ] 13222 13223 [ 13224 [[link boost_asio.reference.basic_datagram_socket.receive_from [*receive_from]]] 13225 [Receive a datagram with the endpoint of the sender. ] 13226 ] 13227 13228 [ 13229 [[link boost_asio.reference.basic_datagram_socket.release [*release]]] 13230 [Release ownership of the underlying native socket. ] 13231 ] 13232 13233 [ 13234 [[link boost_asio.reference.basic_datagram_socket.remote_endpoint [*remote_endpoint]]] 13235 [Get the remote endpoint of the socket. ] 13236 ] 13237 13238 [ 13239 [[link boost_asio.reference.basic_datagram_socket.send [*send]]] 13240 [Send some data on a connected socket. ] 13241 ] 13242 13243 [ 13244 [[link boost_asio.reference.basic_datagram_socket.send_to [*send_to]]] 13245 [Send a datagram to the specified endpoint. ] 13246 ] 13247 13248 [ 13249 [[link boost_asio.reference.basic_datagram_socket.set_option [*set_option]]] 13250 [Set an option on the socket. ] 13251 ] 13252 13253 [ 13254 [[link boost_asio.reference.basic_datagram_socket.shutdown [*shutdown]]] 13255 [Disable sends or receives on the socket. ] 13256 ] 13257 13258 [ 13259 [[link boost_asio.reference.basic_datagram_socket.wait [*wait]]] 13260 [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 13261 ] 13262 13263 [ 13264 [[link boost_asio.reference.basic_datagram_socket._basic_datagram_socket [*~basic_datagram_socket]] [destructor]] 13265 [Destroys the socket. ] 13266 ] 13267 13268] 13269 13270[heading Data Members] 13271[table 13272 [[Name][Description]] 13273 13274 [ 13275 [[link boost_asio.reference.basic_datagram_socket.max_connections [*max_connections]] [static]] 13276 [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ] 13277 ] 13278 13279 [ 13280 [[link boost_asio.reference.basic_datagram_socket.max_listen_connections [*max_listen_connections]] [static]] 13281 [The maximum length of the queue of pending incoming connections. ] 13282 ] 13283 13284 [ 13285 [[link boost_asio.reference.basic_datagram_socket.message_do_not_route [*message_do_not_route]] [static]] 13286 [Specify that the data should not be subject to routing. ] 13287 ] 13288 13289 [ 13290 [[link boost_asio.reference.basic_datagram_socket.message_end_of_record [*message_end_of_record]] [static]] 13291 [Specifies that the data marks the end of a record. ] 13292 ] 13293 13294 [ 13295 [[link boost_asio.reference.basic_datagram_socket.message_out_of_band [*message_out_of_band]] [static]] 13296 [Process out-of-band data. ] 13297 ] 13298 13299 [ 13300 [[link boost_asio.reference.basic_datagram_socket.message_peek [*message_peek]] [static]] 13301 [Peek at incoming data without removing it from the input queue. ] 13302 ] 13303 13304] 13305 13306The [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] class template provides asynchronous and blocking datagram-oriented socket functionality. 13307 13308 13309[heading Thread Safety] 13310 13311['Distinct] ['objects:] Safe. 13312 13313['Shared] ['objects:] Unsafe. 13314 13315Synchronous `send`, `send_to`, `receive`, `receive_from`, and `connect` operations are thread safe with respect to each other, if the underlying operating system calls are also thread safe. This means that it is permitted to perform concurrent calls to these synchronous operations on a single socket object. Other synchronous operations, such as `open` or `close`, are not thread safe. 13316 13317 13318[heading Requirements] 13319 13320['Header: ][^boost/asio/basic_datagram_socket.hpp] 13321 13322['Convenience header: ][^boost/asio.hpp] 13323 13324 13325[endsect] 13326 13327 13328 13329[endsect] 13330 13331[section:basic_deadline_timer basic_deadline_timer] 13332 13333[indexterm1 boost_asio.indexterm.basic_deadline_timer..basic_deadline_timer] 13334 13335 13336Provides waitable timer functionality. 13337 13338 13339 template< 13340 typename Time, 13341 typename ``[link boost_asio.reference.TimeTraits TimeTraits]`` = boost::asio::time_traits<Time>, 13342 typename ``[link boost_asio.reference.Executor1 Executor]`` = any_io_executor> 13343 class basic_deadline_timer 13344 13345 13346[heading Types] 13347[table 13348 [[Name][Description]] 13349 13350 [ 13351 13352 [[link boost_asio.reference.basic_deadline_timer__rebind_executor [*rebind_executor]]] 13353 [Rebinds the timer type to another executor. ] 13354 13355 ] 13356 13357 [ 13358 13359 [[link boost_asio.reference.basic_deadline_timer.duration_type [*duration_type]]] 13360 [The duration type. ] 13361 13362 ] 13363 13364 [ 13365 13366 [[link boost_asio.reference.basic_deadline_timer.executor_type [*executor_type]]] 13367 [The type of the executor associated with the object. ] 13368 13369 ] 13370 13371 [ 13372 13373 [[link boost_asio.reference.basic_deadline_timer.time_type [*time_type]]] 13374 [The time type. ] 13375 13376 ] 13377 13378 [ 13379 13380 [[link boost_asio.reference.basic_deadline_timer.traits_type [*traits_type]]] 13381 [The time traits type. ] 13382 13383 ] 13384 13385] 13386 13387[heading Member Functions] 13388[table 13389 [[Name][Description]] 13390 13391 [ 13392 [[link boost_asio.reference.basic_deadline_timer.async_wait [*async_wait]]] 13393 [Start an asynchronous wait on the timer. ] 13394 ] 13395 13396 [ 13397 [[link boost_asio.reference.basic_deadline_timer.basic_deadline_timer [*basic_deadline_timer]] [constructor]] 13398 [Constructor. 13399 [hr] 13400 Constructor to set a particular expiry time as an absolute time. 13401 [hr] 13402 Constructor to set a particular expiry time relative to now. 13403 [hr] 13404 Move-construct a basic_deadline_timer from another. ] 13405 ] 13406 13407 [ 13408 [[link boost_asio.reference.basic_deadline_timer.cancel [*cancel]]] 13409 [Cancel any asynchronous operations that are waiting on the timer. ] 13410 ] 13411 13412 [ 13413 [[link boost_asio.reference.basic_deadline_timer.cancel_one [*cancel_one]]] 13414 [Cancels one asynchronous operation that is waiting on the timer. ] 13415 ] 13416 13417 [ 13418 [[link boost_asio.reference.basic_deadline_timer.expires_at [*expires_at]]] 13419 [Get the timer's expiry time as an absolute time. 13420 [hr] 13421 Set the timer's expiry time as an absolute time. ] 13422 ] 13423 13424 [ 13425 [[link boost_asio.reference.basic_deadline_timer.expires_from_now [*expires_from_now]]] 13426 [Get the timer's expiry time relative to now. 13427 [hr] 13428 Set the timer's expiry time relative to now. ] 13429 ] 13430 13431 [ 13432 [[link boost_asio.reference.basic_deadline_timer.get_executor [*get_executor]]] 13433 [Get the executor associated with the object. ] 13434 ] 13435 13436 [ 13437 [[link boost_asio.reference.basic_deadline_timer.operator_eq_ [*operator=]]] 13438 [Move-assign a basic_deadline_timer from another. ] 13439 ] 13440 13441 [ 13442 [[link boost_asio.reference.basic_deadline_timer.wait [*wait]]] 13443 [Perform a blocking wait on the timer. ] 13444 ] 13445 13446 [ 13447 [[link boost_asio.reference.basic_deadline_timer._basic_deadline_timer [*~basic_deadline_timer]] [destructor]] 13448 [Destroys the timer. ] 13449 ] 13450 13451] 13452 13453The [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. 13454 13455A 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. 13456 13457Most applications will use the [link boost_asio.reference.deadline_timer `deadline_timer`] typedef. 13458 13459 13460[heading Thread Safety] 13461 13462['Distinct] ['objects:] Safe. 13463 13464['Shared] ['objects:] Unsafe. 13465 13466 13467[heading Examples] 13468 13469Performing a blocking wait: 13470 13471 // Construct a timer without setting an expiry time. 13472 boost::asio::deadline_timer timer(my_context); 13473 13474 // Set an expiry time relative to now. 13475 timer.expires_from_now(boost::posix_time::seconds(5)); 13476 13477 // Wait for the timer to expire. 13478 timer.wait(); 13479 13480 13481 13482 13483 13484Performing an asynchronous wait: 13485 13486 void handler(const boost::system::error_code& error) 13487 { 13488 if (!error) 13489 { 13490 // Timer expired. 13491 } 13492 } 13493 13494 ... 13495 13496 // Construct a timer with an absolute expiry time. 13497 boost::asio::deadline_timer timer(my_context, 13498 boost::posix_time::time_from_string("2005-12-07 23:59:59.000")); 13499 13500 // Start an asynchronous wait. 13501 timer.async_wait(handler); 13502 13503 13504 13505 13506 13507[heading Changing an active deadline_timer's expiry time] 13508 13509 13510 13511Changing 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: 13512 13513 13514 13515 void on_some_event() 13516 { 13517 if (my_timer.expires_from_now(seconds(5)) > 0) 13518 { 13519 // We managed to cancel the timer. Start new asynchronous wait. 13520 my_timer.async_wait(on_timeout); 13521 } 13522 else 13523 { 13524 // Too late, timer has already expired! 13525 } 13526 } 13527 13528 void on_timeout(const boost::system::error_code& e) 13529 { 13530 if (e != boost::asio::error::operation_aborted) 13531 { 13532 // Timer was not cancelled, take necessary action. 13533 } 13534 } 13535 13536 13537 13538 13539 13540* 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. 13541 13542 13543* If a wait handler is cancelled, the boost::system::error\_code passed to it contains the value `boost::asio::error::operation_aborted`. 13544 13545 13546 13547[heading Requirements] 13548 13549['Header: ][^boost/asio/basic_deadline_timer.hpp] 13550 13551['Convenience header: ][^boost/asio.hpp] 13552 13553 13554[section:async_wait basic_deadline_timer::async_wait] 13555 13556[indexterm2 boost_asio.indexterm.basic_deadline_timer.async_wait..async_wait..basic_deadline_timer] 13557Start an asynchronous wait on the timer. 13558 13559 13560 template< 13561 typename ``[link boost_asio.reference.WaitHandler WaitHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 13562 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait( 13563 WaitHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 13564 13565 13566This function may be used to initiate an asynchronous wait against the timer. It always returns immediately. 13567 13568For each call to `async_wait()`, the supplied handler will be called exactly once. The handler will be called when: 13569 13570 13571* The timer has expired. 13572 13573 13574* The timer was cancelled, in which case the handler is passed the error code `boost::asio::error::operation_aborted`. 13575 13576 13577[heading Parameters] 13578 13579 13580[variablelist 13581 13582[[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: 13583`` 13584 void handler( 13585 const boost::system::error_code& error // Result of operation. 13586 ); 13587`` 13588Regardless 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`]. ]] 13589 13590] 13591 13592 13593 13594 13595[endsect] 13596 13597 13598[section:basic_deadline_timer basic_deadline_timer::basic_deadline_timer] 13599 13600[indexterm2 boost_asio.indexterm.basic_deadline_timer.basic_deadline_timer..basic_deadline_timer..basic_deadline_timer] 13601Constructor. 13602 13603 13604 explicit ``[link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload1 basic_deadline_timer]``( 13605 const executor_type & ex); 13606 `` [''''»''' [link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload1 more...]]`` 13607 13608 template< 13609 typename ExecutionContext> 13610 explicit ``[link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload2 basic_deadline_timer]``( 13611 ExecutionContext & context, 13612 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 13613 `` [''''»''' [link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload2 more...]]`` 13614 13615 13616Constructor to set a particular expiry time as an absolute time. 13617 13618 13619 ``[link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload3 basic_deadline_timer]``( 13620 const executor_type & ex, 13621 const time_type & expiry_time); 13622 `` [''''»''' [link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload3 more...]]`` 13623 13624 template< 13625 typename ExecutionContext> 13626 ``[link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload4 basic_deadline_timer]``( 13627 ExecutionContext & context, 13628 const time_type & expiry_time, 13629 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 13630 `` [''''»''' [link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload4 more...]]`` 13631 13632 13633Constructor to set a particular expiry time relative to now. 13634 13635 13636 ``[link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload5 basic_deadline_timer]``( 13637 const executor_type & ex, 13638 const duration_type & expiry_time); 13639 `` [''''»''' [link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload5 more...]]`` 13640 13641 template< 13642 typename ExecutionContext> 13643 ``[link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload6 basic_deadline_timer]``( 13644 ExecutionContext & context, 13645 const duration_type & expiry_time, 13646 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 13647 `` [''''»''' [link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload6 more...]]`` 13648 13649 13650Move-construct a [link boost_asio.reference.basic_deadline_timer `basic_deadline_timer`] from another. 13651 13652 13653 ``[link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload7 basic_deadline_timer]``( 13654 basic_deadline_timer && other); 13655 `` [''''»''' [link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload7 more...]]`` 13656 13657 13658[section:overload1 basic_deadline_timer::basic_deadline_timer (1 of 7 overloads)] 13659 13660 13661Constructor. 13662 13663 13664 basic_deadline_timer( 13665 const executor_type & ex); 13666 13667 13668This 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. 13669 13670 13671[heading Parameters] 13672 13673 13674[variablelist 13675 13676[[ex][The I/O executor that the timer will use, by default, to dispatch handlers for any asynchronous operations performed on the timer. ]] 13677 13678] 13679 13680 13681 13682 13683[endsect] 13684 13685 13686 13687[section:overload2 basic_deadline_timer::basic_deadline_timer (2 of 7 overloads)] 13688 13689 13690Constructor. 13691 13692 13693 template< 13694 typename ExecutionContext> 13695 basic_deadline_timer( 13696 ExecutionContext & context, 13697 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 13698 13699 13700This 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. 13701 13702 13703[heading Parameters] 13704 13705 13706[variablelist 13707 13708[[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. ]] 13709 13710] 13711 13712 13713 13714 13715[endsect] 13716 13717 13718 13719[section:overload3 basic_deadline_timer::basic_deadline_timer (3 of 7 overloads)] 13720 13721 13722Constructor to set a particular expiry time as an absolute time. 13723 13724 13725 basic_deadline_timer( 13726 const executor_type & ex, 13727 const time_type & expiry_time); 13728 13729 13730This constructor creates a timer and sets the expiry time. 13731 13732 13733[heading Parameters] 13734 13735 13736[variablelist 13737 13738[[ex][The I/O executor that the timer will use, by default, to dispatch handlers for any asynchronous operations performed on the timer.]] 13739 13740[[expiry_time][The expiry time to be used for the timer, expressed as an absolute time. ]] 13741 13742] 13743 13744 13745 13746 13747[endsect] 13748 13749 13750 13751[section:overload4 basic_deadline_timer::basic_deadline_timer (4 of 7 overloads)] 13752 13753 13754Constructor to set a particular expiry time as an absolute time. 13755 13756 13757 template< 13758 typename ExecutionContext> 13759 basic_deadline_timer( 13760 ExecutionContext & context, 13761 const time_type & expiry_time, 13762 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 13763 13764 13765This constructor creates a timer and sets the expiry time. 13766 13767 13768[heading Parameters] 13769 13770 13771[variablelist 13772 13773[[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.]] 13774 13775[[expiry_time][The expiry time to be used for the timer, expressed as an absolute time. ]] 13776 13777] 13778 13779 13780 13781 13782[endsect] 13783 13784 13785 13786[section:overload5 basic_deadline_timer::basic_deadline_timer (5 of 7 overloads)] 13787 13788 13789Constructor to set a particular expiry time relative to now. 13790 13791 13792 basic_deadline_timer( 13793 const executor_type & ex, 13794 const duration_type & expiry_time); 13795 13796 13797This constructor creates a timer and sets the expiry time. 13798 13799 13800[heading Parameters] 13801 13802 13803[variablelist 13804 13805[[ex][The I/O executor that the timer will use, by default, to dispatch handlers for any asynchronous operations performed on the timer.]] 13806 13807[[expiry_time][The expiry time to be used for the timer, relative to now. ]] 13808 13809] 13810 13811 13812 13813 13814[endsect] 13815 13816 13817 13818[section:overload6 basic_deadline_timer::basic_deadline_timer (6 of 7 overloads)] 13819 13820 13821Constructor to set a particular expiry time relative to now. 13822 13823 13824 template< 13825 typename ExecutionContext> 13826 basic_deadline_timer( 13827 ExecutionContext & context, 13828 const duration_type & expiry_time, 13829 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 13830 13831 13832This constructor creates a timer and sets the expiry time. 13833 13834 13835[heading Parameters] 13836 13837 13838[variablelist 13839 13840[[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.]] 13841 13842[[expiry_time][The expiry time to be used for the timer, relative to now. ]] 13843 13844] 13845 13846 13847 13848 13849[endsect] 13850 13851 13852 13853[section:overload7 basic_deadline_timer::basic_deadline_timer (7 of 7 overloads)] 13854 13855 13856Move-construct a [link boost_asio.reference.basic_deadline_timer `basic_deadline_timer`] from another. 13857 13858 13859 basic_deadline_timer( 13860 basic_deadline_timer && other); 13861 13862 13863This constructor moves a timer from one object to another. 13864 13865 13866[heading Parameters] 13867 13868 13869[variablelist 13870 13871[[other][The other [link boost_asio.reference.basic_deadline_timer `basic_deadline_timer`] object from which the move will occur.]] 13872 13873] 13874 13875 13876[heading Remarks] 13877 13878Following the move, the moved-from object is in the same state as if constructed using the `basic_deadline_timer(const executor_type&)` constructor. 13879 13880 13881 13882 13883[endsect] 13884 13885 13886[endsect] 13887 13888[section:cancel basic_deadline_timer::cancel] 13889 13890[indexterm2 boost_asio.indexterm.basic_deadline_timer.cancel..cancel..basic_deadline_timer] 13891Cancel any asynchronous operations that are waiting on the timer. 13892 13893 13894 std::size_t ``[link boost_asio.reference.basic_deadline_timer.cancel.overload1 cancel]``(); 13895 `` [''''»''' [link boost_asio.reference.basic_deadline_timer.cancel.overload1 more...]]`` 13896 13897 std::size_t ``[link boost_asio.reference.basic_deadline_timer.cancel.overload2 cancel]``( 13898 boost::system::error_code & ec); 13899 `` [''''»''' [link boost_asio.reference.basic_deadline_timer.cancel.overload2 more...]]`` 13900 13901 13902[section:overload1 basic_deadline_timer::cancel (1 of 2 overloads)] 13903 13904 13905Cancel any asynchronous operations that are waiting on the timer. 13906 13907 13908 std::size_t cancel(); 13909 13910 13911This 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. 13912 13913Cancelling the timer does not change the expiry time. 13914 13915 13916[heading Return Value] 13917 13918The number of asynchronous operations that were cancelled. 13919 13920 13921[heading Exceptions] 13922 13923 13924[variablelist 13925 13926[[boost::system::system_error][Thrown on failure.]] 13927 13928] 13929 13930 13931[heading Remarks] 13932 13933If the timer has already expired when `cancel()` is called, then the handlers for asynchronous wait operations will: 13934 13935 13936* have already been invoked; or 13937 13938 13939* have been queued for invocation in the near future. 13940 13941These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 13942 13943 13944[endsect] 13945 13946 13947 13948[section:overload2 basic_deadline_timer::cancel (2 of 2 overloads)] 13949 13950 13951Cancel any asynchronous operations that are waiting on the timer. 13952 13953 13954 std::size_t cancel( 13955 boost::system::error_code & ec); 13956 13957 13958This 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. 13959 13960Cancelling the timer does not change the expiry time. 13961 13962 13963[heading Parameters] 13964 13965 13966[variablelist 13967 13968[[ec][Set to indicate what error occurred, if any.]] 13969 13970] 13971 13972 13973[heading Return Value] 13974 13975The number of asynchronous operations that were cancelled. 13976 13977 13978[heading Remarks] 13979 13980If the timer has already expired when `cancel()` is called, then the handlers for asynchronous wait operations will: 13981 13982 13983* have already been invoked; or 13984 13985 13986* have been queued for invocation in the near future. 13987 13988These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 13989 13990 13991[endsect] 13992 13993 13994[endsect] 13995 13996[section:cancel_one basic_deadline_timer::cancel_one] 13997 13998[indexterm2 boost_asio.indexterm.basic_deadline_timer.cancel_one..cancel_one..basic_deadline_timer] 13999Cancels one asynchronous operation that is waiting on the timer. 14000 14001 14002 std::size_t ``[link boost_asio.reference.basic_deadline_timer.cancel_one.overload1 cancel_one]``(); 14003 `` [''''»''' [link boost_asio.reference.basic_deadline_timer.cancel_one.overload1 more...]]`` 14004 14005 std::size_t ``[link boost_asio.reference.basic_deadline_timer.cancel_one.overload2 cancel_one]``( 14006 boost::system::error_code & ec); 14007 `` [''''»''' [link boost_asio.reference.basic_deadline_timer.cancel_one.overload2 more...]]`` 14008 14009 14010[section:overload1 basic_deadline_timer::cancel_one (1 of 2 overloads)] 14011 14012 14013Cancels one asynchronous operation that is waiting on the timer. 14014 14015 14016 std::size_t cancel_one(); 14017 14018 14019This 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. 14020 14021Cancelling the timer does not change the expiry time. 14022 14023 14024[heading Return Value] 14025 14026The number of asynchronous operations that were cancelled. That is, either 0 or 1. 14027 14028 14029[heading Exceptions] 14030 14031 14032[variablelist 14033 14034[[boost::system::system_error][Thrown on failure.]] 14035 14036] 14037 14038 14039[heading Remarks] 14040 14041If the timer has already expired when `cancel_one()` is called, then the handlers for asynchronous wait operations will: 14042 14043 14044* have already been invoked; or 14045 14046 14047* have been queued for invocation in the near future. 14048 14049These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 14050 14051 14052[endsect] 14053 14054 14055 14056[section:overload2 basic_deadline_timer::cancel_one (2 of 2 overloads)] 14057 14058 14059Cancels one asynchronous operation that is waiting on the timer. 14060 14061 14062 std::size_t cancel_one( 14063 boost::system::error_code & ec); 14064 14065 14066This 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. 14067 14068Cancelling the timer does not change the expiry time. 14069 14070 14071[heading Parameters] 14072 14073 14074[variablelist 14075 14076[[ec][Set to indicate what error occurred, if any.]] 14077 14078] 14079 14080 14081[heading Return Value] 14082 14083The number of asynchronous operations that were cancelled. That is, either 0 or 1. 14084 14085 14086[heading Remarks] 14087 14088If the timer has already expired when `cancel_one()` is called, then the handlers for asynchronous wait operations will: 14089 14090 14091* have already been invoked; or 14092 14093 14094* have been queued for invocation in the near future. 14095 14096These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 14097 14098 14099[endsect] 14100 14101 14102[endsect] 14103 14104 14105[section:duration_type basic_deadline_timer::duration_type] 14106 14107[indexterm2 boost_asio.indexterm.basic_deadline_timer.duration_type..duration_type..basic_deadline_timer] 14108The duration type. 14109 14110 14111 typedef traits_type::duration_type duration_type; 14112 14113 14114 14115[heading Requirements] 14116 14117['Header: ][^boost/asio/basic_deadline_timer.hpp] 14118 14119['Convenience header: ][^boost/asio.hpp] 14120 14121 14122[endsect] 14123 14124 14125 14126[section:executor_type basic_deadline_timer::executor_type] 14127 14128[indexterm2 boost_asio.indexterm.basic_deadline_timer.executor_type..executor_type..basic_deadline_timer] 14129The type of the executor associated with the object. 14130 14131 14132 typedef Executor executor_type; 14133 14134 14135 14136[heading Requirements] 14137 14138['Header: ][^boost/asio/basic_deadline_timer.hpp] 14139 14140['Convenience header: ][^boost/asio.hpp] 14141 14142 14143[endsect] 14144 14145 14146[section:expires_at basic_deadline_timer::expires_at] 14147 14148[indexterm2 boost_asio.indexterm.basic_deadline_timer.expires_at..expires_at..basic_deadline_timer] 14149Get the timer's expiry time as an absolute time. 14150 14151 14152 time_type ``[link boost_asio.reference.basic_deadline_timer.expires_at.overload1 expires_at]``() const; 14153 `` [''''»''' [link boost_asio.reference.basic_deadline_timer.expires_at.overload1 more...]]`` 14154 14155 14156Set the timer's expiry time as an absolute time. 14157 14158 14159 std::size_t ``[link boost_asio.reference.basic_deadline_timer.expires_at.overload2 expires_at]``( 14160 const time_type & expiry_time); 14161 `` [''''»''' [link boost_asio.reference.basic_deadline_timer.expires_at.overload2 more...]]`` 14162 14163 std::size_t ``[link boost_asio.reference.basic_deadline_timer.expires_at.overload3 expires_at]``( 14164 const time_type & expiry_time, 14165 boost::system::error_code & ec); 14166 `` [''''»''' [link boost_asio.reference.basic_deadline_timer.expires_at.overload3 more...]]`` 14167 14168 14169[section:overload1 basic_deadline_timer::expires_at (1 of 3 overloads)] 14170 14171 14172Get the timer's expiry time as an absolute time. 14173 14174 14175 time_type expires_at() const; 14176 14177 14178This function may be used to obtain the timer's current expiry time. Whether the timer has expired or not does not affect this value. 14179 14180 14181[endsect] 14182 14183 14184 14185[section:overload2 basic_deadline_timer::expires_at (2 of 3 overloads)] 14186 14187 14188Set the timer's expiry time as an absolute time. 14189 14190 14191 std::size_t expires_at( 14192 const time_type & expiry_time); 14193 14194 14195This 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. 14196 14197 14198[heading Parameters] 14199 14200 14201[variablelist 14202 14203[[expiry_time][The expiry time to be used for the timer.]] 14204 14205] 14206 14207 14208[heading Return Value] 14209 14210The number of asynchronous operations that were cancelled. 14211 14212 14213[heading Exceptions] 14214 14215 14216[variablelist 14217 14218[[boost::system::system_error][Thrown on failure.]] 14219 14220] 14221 14222 14223[heading Remarks] 14224 14225If the timer has already expired when `expires_at()` is called, then the handlers for asynchronous wait operations will: 14226 14227 14228* have already been invoked; or 14229 14230 14231* have been queued for invocation in the near future. 14232 14233These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 14234 14235 14236[endsect] 14237 14238 14239 14240[section:overload3 basic_deadline_timer::expires_at (3 of 3 overloads)] 14241 14242 14243Set the timer's expiry time as an absolute time. 14244 14245 14246 std::size_t expires_at( 14247 const time_type & expiry_time, 14248 boost::system::error_code & ec); 14249 14250 14251This 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. 14252 14253 14254[heading Parameters] 14255 14256 14257[variablelist 14258 14259[[expiry_time][The expiry time to be used for the timer.]] 14260 14261[[ec][Set to indicate what error occurred, if any.]] 14262 14263] 14264 14265 14266[heading Return Value] 14267 14268The number of asynchronous operations that were cancelled. 14269 14270 14271[heading Remarks] 14272 14273If the timer has already expired when `expires_at()` is called, then the handlers for asynchronous wait operations will: 14274 14275 14276* have already been invoked; or 14277 14278 14279* have been queued for invocation in the near future. 14280 14281These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 14282 14283 14284[endsect] 14285 14286 14287[endsect] 14288 14289[section:expires_from_now basic_deadline_timer::expires_from_now] 14290 14291[indexterm2 boost_asio.indexterm.basic_deadline_timer.expires_from_now..expires_from_now..basic_deadline_timer] 14292Get the timer's expiry time relative to now. 14293 14294 14295 duration_type ``[link boost_asio.reference.basic_deadline_timer.expires_from_now.overload1 expires_from_now]``() const; 14296 `` [''''»''' [link boost_asio.reference.basic_deadline_timer.expires_from_now.overload1 more...]]`` 14297 14298 14299Set the timer's expiry time relative to now. 14300 14301 14302 std::size_t ``[link boost_asio.reference.basic_deadline_timer.expires_from_now.overload2 expires_from_now]``( 14303 const duration_type & expiry_time); 14304 `` [''''»''' [link boost_asio.reference.basic_deadline_timer.expires_from_now.overload2 more...]]`` 14305 14306 std::size_t ``[link boost_asio.reference.basic_deadline_timer.expires_from_now.overload3 expires_from_now]``( 14307 const duration_type & expiry_time, 14308 boost::system::error_code & ec); 14309 `` [''''»''' [link boost_asio.reference.basic_deadline_timer.expires_from_now.overload3 more...]]`` 14310 14311 14312[section:overload1 basic_deadline_timer::expires_from_now (1 of 3 overloads)] 14313 14314 14315Get the timer's expiry time relative to now. 14316 14317 14318 duration_type expires_from_now() const; 14319 14320 14321This function may be used to obtain the timer's current expiry time. Whether the timer has expired or not does not affect this value. 14322 14323 14324[endsect] 14325 14326 14327 14328[section:overload2 basic_deadline_timer::expires_from_now (2 of 3 overloads)] 14329 14330 14331Set the timer's expiry time relative to now. 14332 14333 14334 std::size_t expires_from_now( 14335 const duration_type & expiry_time); 14336 14337 14338This 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. 14339 14340 14341[heading Parameters] 14342 14343 14344[variablelist 14345 14346[[expiry_time][The expiry time to be used for the timer.]] 14347 14348] 14349 14350 14351[heading Return Value] 14352 14353The number of asynchronous operations that were cancelled. 14354 14355 14356[heading Exceptions] 14357 14358 14359[variablelist 14360 14361[[boost::system::system_error][Thrown on failure.]] 14362 14363] 14364 14365 14366[heading Remarks] 14367 14368If the timer has already expired when `expires_from_now()` is called, then the handlers for asynchronous wait operations will: 14369 14370 14371* have already been invoked; or 14372 14373 14374* have been queued for invocation in the near future. 14375 14376These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 14377 14378 14379[endsect] 14380 14381 14382 14383[section:overload3 basic_deadline_timer::expires_from_now (3 of 3 overloads)] 14384 14385 14386Set the timer's expiry time relative to now. 14387 14388 14389 std::size_t expires_from_now( 14390 const duration_type & expiry_time, 14391 boost::system::error_code & ec); 14392 14393 14394This 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. 14395 14396 14397[heading Parameters] 14398 14399 14400[variablelist 14401 14402[[expiry_time][The expiry time to be used for the timer.]] 14403 14404[[ec][Set to indicate what error occurred, if any.]] 14405 14406] 14407 14408 14409[heading Return Value] 14410 14411The number of asynchronous operations that were cancelled. 14412 14413 14414[heading Remarks] 14415 14416If the timer has already expired when `expires_from_now()` is called, then the handlers for asynchronous wait operations will: 14417 14418 14419* have already been invoked; or 14420 14421 14422* have been queued for invocation in the near future. 14423 14424These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 14425 14426 14427[endsect] 14428 14429 14430[endsect] 14431 14432 14433[section:get_executor basic_deadline_timer::get_executor] 14434 14435[indexterm2 boost_asio.indexterm.basic_deadline_timer.get_executor..get_executor..basic_deadline_timer] 14436Get the executor associated with the object. 14437 14438 14439 executor_type get_executor(); 14440 14441 14442 14443[endsect] 14444 14445 14446 14447[section:operator_eq_ basic_deadline_timer::operator=] 14448 14449[indexterm2 boost_asio.indexterm.basic_deadline_timer.operator_eq_..operator=..basic_deadline_timer] 14450Move-assign a [link boost_asio.reference.basic_deadline_timer `basic_deadline_timer`] from another. 14451 14452 14453 basic_deadline_timer & operator=( 14454 basic_deadline_timer && other); 14455 14456 14457This assignment operator moves a timer from one object to another. Cancels any outstanding asynchronous operations associated with the target object. 14458 14459 14460[heading Parameters] 14461 14462 14463[variablelist 14464 14465[[other][The other [link boost_asio.reference.basic_deadline_timer `basic_deadline_timer`] object from which the move will occur.]] 14466 14467] 14468 14469 14470[heading Remarks] 14471 14472Following the move, the moved-from object is in the same state as if constructed using the `basic_deadline_timer(const executor_type&)` constructor. 14473 14474 14475 14476 14477[endsect] 14478 14479 14480 14481[section:time_type basic_deadline_timer::time_type] 14482 14483[indexterm2 boost_asio.indexterm.basic_deadline_timer.time_type..time_type..basic_deadline_timer] 14484The time type. 14485 14486 14487 typedef traits_type::time_type time_type; 14488 14489 14490 14491[heading Requirements] 14492 14493['Header: ][^boost/asio/basic_deadline_timer.hpp] 14494 14495['Convenience header: ][^boost/asio.hpp] 14496 14497 14498[endsect] 14499 14500 14501 14502[section:traits_type basic_deadline_timer::traits_type] 14503 14504[indexterm2 boost_asio.indexterm.basic_deadline_timer.traits_type..traits_type..basic_deadline_timer] 14505The time traits type. 14506 14507 14508 typedef TimeTraits traits_type; 14509 14510 14511 14512[heading Requirements] 14513 14514['Header: ][^boost/asio/basic_deadline_timer.hpp] 14515 14516['Convenience header: ][^boost/asio.hpp] 14517 14518 14519[endsect] 14520 14521 14522[section:wait basic_deadline_timer::wait] 14523 14524[indexterm2 boost_asio.indexterm.basic_deadline_timer.wait..wait..basic_deadline_timer] 14525Perform a blocking wait on the timer. 14526 14527 14528 void ``[link boost_asio.reference.basic_deadline_timer.wait.overload1 wait]``(); 14529 `` [''''»''' [link boost_asio.reference.basic_deadline_timer.wait.overload1 more...]]`` 14530 14531 void ``[link boost_asio.reference.basic_deadline_timer.wait.overload2 wait]``( 14532 boost::system::error_code & ec); 14533 `` [''''»''' [link boost_asio.reference.basic_deadline_timer.wait.overload2 more...]]`` 14534 14535 14536[section:overload1 basic_deadline_timer::wait (1 of 2 overloads)] 14537 14538 14539Perform a blocking wait on the timer. 14540 14541 14542 void wait(); 14543 14544 14545This function is used to wait for the timer to expire. This function blocks and does not return until the timer has expired. 14546 14547 14548[heading Exceptions] 14549 14550 14551[variablelist 14552 14553[[boost::system::system_error][Thrown on failure. ]] 14554 14555] 14556 14557 14558 14559 14560[endsect] 14561 14562 14563 14564[section:overload2 basic_deadline_timer::wait (2 of 2 overloads)] 14565 14566 14567Perform a blocking wait on the timer. 14568 14569 14570 void wait( 14571 boost::system::error_code & ec); 14572 14573 14574This function is used to wait for the timer to expire. This function blocks and does not return until the timer has expired. 14575 14576 14577[heading Parameters] 14578 14579 14580[variablelist 14581 14582[[ec][Set to indicate what error occurred, if any. ]] 14583 14584] 14585 14586 14587 14588 14589[endsect] 14590 14591 14592[endsect] 14593 14594 14595[section:_basic_deadline_timer basic_deadline_timer::~basic_deadline_timer] 14596 14597[indexterm2 boost_asio.indexterm.basic_deadline_timer._basic_deadline_timer..~basic_deadline_timer..basic_deadline_timer] 14598Destroys the timer. 14599 14600 14601 ~basic_deadline_timer(); 14602 14603 14604This function destroys the timer, cancelling any outstanding asynchronous wait operations associated with the timer as if by calling `cancel`. 14605 14606 14607[endsect] 14608 14609 14610 14611[endsect] 14612 14613[section:basic_deadline_timer__rebind_executor basic_deadline_timer::rebind_executor] 14614 14615[indexterm1 boost_asio.indexterm.basic_deadline_timer__rebind_executor..basic_deadline_timer::rebind_executor] 14616 14617 14618Rebinds the timer type to another executor. 14619 14620 14621 template< 14622 typename ``[link boost_asio.reference.Executor1 Executor1]``> 14623 struct rebind_executor 14624 14625 14626[heading Types] 14627[table 14628 [[Name][Description]] 14629 14630 [ 14631 14632 [[link boost_asio.reference.basic_deadline_timer__rebind_executor.other [*other]]] 14633 [The timer type when rebound to the specified executor. ] 14634 14635 ] 14636 14637] 14638 14639[heading Requirements] 14640 14641['Header: ][^boost/asio/basic_deadline_timer.hpp] 14642 14643['Convenience header: ][^boost/asio.hpp] 14644 14645 14646[section:other basic_deadline_timer::rebind_executor::other] 14647 14648[indexterm2 boost_asio.indexterm.basic_deadline_timer__rebind_executor.other..other..basic_deadline_timer::rebind_executor] 14649The timer type when rebound to the specified executor. 14650 14651 14652 typedef basic_deadline_timer< Time, TimeTraits, Executor1 > other; 14653 14654 14655[heading Types] 14656[table 14657 [[Name][Description]] 14658 14659 [ 14660 14661 [[link boost_asio.reference.basic_deadline_timer__rebind_executor [*rebind_executor]]] 14662 [Rebinds the timer type to another executor. ] 14663 14664 ] 14665 14666 [ 14667 14668 [[link boost_asio.reference.basic_deadline_timer.duration_type [*duration_type]]] 14669 [The duration type. ] 14670 14671 ] 14672 14673 [ 14674 14675 [[link boost_asio.reference.basic_deadline_timer.executor_type [*executor_type]]] 14676 [The type of the executor associated with the object. ] 14677 14678 ] 14679 14680 [ 14681 14682 [[link boost_asio.reference.basic_deadline_timer.time_type [*time_type]]] 14683 [The time type. ] 14684 14685 ] 14686 14687 [ 14688 14689 [[link boost_asio.reference.basic_deadline_timer.traits_type [*traits_type]]] 14690 [The time traits type. ] 14691 14692 ] 14693 14694] 14695 14696[heading Member Functions] 14697[table 14698 [[Name][Description]] 14699 14700 [ 14701 [[link boost_asio.reference.basic_deadline_timer.async_wait [*async_wait]]] 14702 [Start an asynchronous wait on the timer. ] 14703 ] 14704 14705 [ 14706 [[link boost_asio.reference.basic_deadline_timer.basic_deadline_timer [*basic_deadline_timer]] [constructor]] 14707 [Constructor. 14708 [hr] 14709 Constructor to set a particular expiry time as an absolute time. 14710 [hr] 14711 Constructor to set a particular expiry time relative to now. 14712 [hr] 14713 Move-construct a basic_deadline_timer from another. ] 14714 ] 14715 14716 [ 14717 [[link boost_asio.reference.basic_deadline_timer.cancel [*cancel]]] 14718 [Cancel any asynchronous operations that are waiting on the timer. ] 14719 ] 14720 14721 [ 14722 [[link boost_asio.reference.basic_deadline_timer.cancel_one [*cancel_one]]] 14723 [Cancels one asynchronous operation that is waiting on the timer. ] 14724 ] 14725 14726 [ 14727 [[link boost_asio.reference.basic_deadline_timer.expires_at [*expires_at]]] 14728 [Get the timer's expiry time as an absolute time. 14729 [hr] 14730 Set the timer's expiry time as an absolute time. ] 14731 ] 14732 14733 [ 14734 [[link boost_asio.reference.basic_deadline_timer.expires_from_now [*expires_from_now]]] 14735 [Get the timer's expiry time relative to now. 14736 [hr] 14737 Set the timer's expiry time relative to now. ] 14738 ] 14739 14740 [ 14741 [[link boost_asio.reference.basic_deadline_timer.get_executor [*get_executor]]] 14742 [Get the executor associated with the object. ] 14743 ] 14744 14745 [ 14746 [[link boost_asio.reference.basic_deadline_timer.operator_eq_ [*operator=]]] 14747 [Move-assign a basic_deadline_timer from another. ] 14748 ] 14749 14750 [ 14751 [[link boost_asio.reference.basic_deadline_timer.wait [*wait]]] 14752 [Perform a blocking wait on the timer. ] 14753 ] 14754 14755 [ 14756 [[link boost_asio.reference.basic_deadline_timer._basic_deadline_timer [*~basic_deadline_timer]] [destructor]] 14757 [Destroys the timer. ] 14758 ] 14759 14760] 14761 14762The [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. 14763 14764A 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. 14765 14766Most applications will use the [link boost_asio.reference.deadline_timer `deadline_timer`] typedef. 14767 14768 14769[heading Thread Safety] 14770 14771['Distinct] ['objects:] Safe. 14772 14773['Shared] ['objects:] Unsafe. 14774 14775 14776[heading Examples] 14777 14778Performing a blocking wait: 14779 14780 // Construct a timer without setting an expiry time. 14781 boost::asio::deadline_timer timer(my_context); 14782 14783 // Set an expiry time relative to now. 14784 timer.expires_from_now(boost::posix_time::seconds(5)); 14785 14786 // Wait for the timer to expire. 14787 timer.wait(); 14788 14789 14790 14791 14792 14793Performing an asynchronous wait: 14794 14795 void handler(const boost::system::error_code& error) 14796 { 14797 if (!error) 14798 { 14799 // Timer expired. 14800 } 14801 } 14802 14803 ... 14804 14805 // Construct a timer with an absolute expiry time. 14806 boost::asio::deadline_timer timer(my_context, 14807 boost::posix_time::time_from_string("2005-12-07 23:59:59.000")); 14808 14809 // Start an asynchronous wait. 14810 timer.async_wait(handler); 14811 14812 14813 14814 14815 14816[heading Changing an active deadline_timer's expiry time] 14817 14818 14819 14820Changing 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: 14821 14822 14823 14824 void on_some_event() 14825 { 14826 if (my_timer.expires_from_now(seconds(5)) > 0) 14827 { 14828 // We managed to cancel the timer. Start new asynchronous wait. 14829 my_timer.async_wait(on_timeout); 14830 } 14831 else 14832 { 14833 // Too late, timer has already expired! 14834 } 14835 } 14836 14837 void on_timeout(const boost::system::error_code& e) 14838 { 14839 if (e != boost::asio::error::operation_aborted) 14840 { 14841 // Timer was not cancelled, take necessary action. 14842 } 14843 } 14844 14845 14846 14847 14848 14849* 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. 14850 14851 14852* If a wait handler is cancelled, the boost::system::error\_code passed to it contains the value `boost::asio::error::operation_aborted`. 14853 14854 14855 14856 14857[heading Requirements] 14858 14859['Header: ][^boost/asio/basic_deadline_timer.hpp] 14860 14861['Convenience header: ][^boost/asio.hpp] 14862 14863 14864[endsect] 14865 14866 14867 14868[endsect] 14869 14870[section:basic_io_object basic_io_object] 14871 14872[indexterm1 boost_asio.indexterm.basic_io_object..basic_io_object] 14873 14874 14875Base class for all I/O objects. 14876 14877 14878 template< 14879 typename ``[link boost_asio.reference.IoObjectService IoObjectService]``> 14880 class basic_io_object 14881 14882 14883[heading Types] 14884[table 14885 [[Name][Description]] 14886 14887 [ 14888 14889 [[link boost_asio.reference.basic_io_object.executor_type [*executor_type]]] 14890 [The type of the executor associated with the object. ] 14891 14892 ] 14893 14894 [ 14895 14896 [[link boost_asio.reference.basic_io_object.implementation_type [*implementation_type]]] 14897 [The underlying implementation type of I/O object. ] 14898 14899 ] 14900 14901 [ 14902 14903 [[link boost_asio.reference.basic_io_object.service_type [*service_type]]] 14904 [The type of the service that will be used to provide I/O operations. ] 14905 14906 ] 14907 14908] 14909 14910[heading Member Functions] 14911[table 14912 [[Name][Description]] 14913 14914 [ 14915 [[link boost_asio.reference.basic_io_object.get_executor [*get_executor]]] 14916 [Get the executor associated with the object. ] 14917 ] 14918 14919 [ 14920 [[link boost_asio.reference.basic_io_object.get_io_context [*get_io_context]]] 14921 [(Deprecated: Use get_executor().) Get the io_context associated with the object. ] 14922 ] 14923 14924 [ 14925 [[link boost_asio.reference.basic_io_object.get_io_service [*get_io_service]]] 14926 [(Deprecated: Use get_executor().) Get the io_context associated with the object. ] 14927 ] 14928 14929] 14930 14931[heading Protected Member Functions] 14932[table 14933 [[Name][Description]] 14934 14935 [ 14936 [[link boost_asio.reference.basic_io_object.basic_io_object [*basic_io_object]] [constructor]] 14937 [Construct a basic_io_object. 14938 [hr] 14939 Move-construct a basic_io_object. 14940 [hr] 14941 Perform a converting move-construction of a basic_io_object. ] 14942 ] 14943 14944 [ 14945 [[link boost_asio.reference.basic_io_object.get_implementation [*get_implementation]]] 14946 [Get the underlying implementation of the I/O object. ] 14947 ] 14948 14949 [ 14950 [[link boost_asio.reference.basic_io_object.get_service [*get_service]]] 14951 [Get the service associated with the I/O object. ] 14952 ] 14953 14954 [ 14955 [[link boost_asio.reference.basic_io_object.operator_eq_ [*operator=]]] 14956 [Move-assign a basic_io_object. ] 14957 ] 14958 14959 [ 14960 [[link boost_asio.reference.basic_io_object._basic_io_object [*~basic_io_object]] [destructor]] 14961 [Protected destructor to prevent deletion through this type. ] 14962 ] 14963 14964] 14965 14966 14967[heading Remarks] 14968 14969All I/O objects are non-copyable. However, when using C++0x, certain I/O objects do support move construction and move assignment. 14970 14971 14972 14973[heading Requirements] 14974 14975['Header: ][^boost/asio/basic_io_object.hpp] 14976 14977['Convenience header: ][^boost/asio.hpp] 14978 14979[section:basic_io_object basic_io_object::basic_io_object] 14980 14981[indexterm2 boost_asio.indexterm.basic_io_object.basic_io_object..basic_io_object..basic_io_object] 14982Construct a [link boost_asio.reference.basic_io_object `basic_io_object`]. 14983 14984 14985 explicit ``[link boost_asio.reference.basic_io_object.basic_io_object.overload1 basic_io_object]``( 14986 boost::asio::io_context & io_context); 14987 `` [''''»''' [link boost_asio.reference.basic_io_object.basic_io_object.overload1 more...]]`` 14988 14989 14990Move-construct a [link boost_asio.reference.basic_io_object `basic_io_object`]. 14991 14992 14993 ``[link boost_asio.reference.basic_io_object.basic_io_object.overload2 basic_io_object]``( 14994 basic_io_object && other); 14995 `` [''''»''' [link boost_asio.reference.basic_io_object.basic_io_object.overload2 more...]]`` 14996 14997 14998Perform a converting move-construction of a [link boost_asio.reference.basic_io_object `basic_io_object`]. 14999 15000 15001 template< 15002 typename ``[link boost_asio.reference.IoObjectService IoObjectService1]``> 15003 ``[link boost_asio.reference.basic_io_object.basic_io_object.overload3 basic_io_object]``( 15004 IoObjectService1 & other_service, 15005 typename IoObjectService1::implementation_type & other_implementation); 15006 `` [''''»''' [link boost_asio.reference.basic_io_object.basic_io_object.overload3 more...]]`` 15007 15008 15009[section:overload1 basic_io_object::basic_io_object (1 of 3 overloads)] 15010 15011 15012Construct a [link boost_asio.reference.basic_io_object `basic_io_object`]. 15013 15014 15015 basic_io_object( 15016 boost::asio::io_context & io_context); 15017 15018 15019Performs: 15020 15021 get_service().construct(get_implementation()); 15022 15023 15024 15025 15026 15027[endsect] 15028 15029 15030 15031[section:overload2 basic_io_object::basic_io_object (2 of 3 overloads)] 15032 15033 15034Move-construct a [link boost_asio.reference.basic_io_object `basic_io_object`]. 15035 15036 15037 basic_io_object( 15038 basic_io_object && other); 15039 15040 15041Performs: 15042 15043 get_service().move_construct( 15044 get_implementation(), other.get_implementation()); 15045 15046 15047 15048 15049 15050[heading Remarks] 15051 15052Available only for services that support movability, 15053 15054 15055 15056 15057[endsect] 15058 15059 15060 15061[section:overload3 basic_io_object::basic_io_object (3 of 3 overloads)] 15062 15063 15064Perform a converting move-construction of a [link boost_asio.reference.basic_io_object `basic_io_object`]. 15065 15066 15067 template< 15068 typename ``[link boost_asio.reference.IoObjectService IoObjectService1]``> 15069 basic_io_object( 15070 IoObjectService1 & other_service, 15071 typename IoObjectService1::implementation_type & other_implementation); 15072 15073 15074 15075[endsect] 15076 15077 15078[endsect] 15079 15080 15081[section:executor_type basic_io_object::executor_type] 15082 15083[indexterm2 boost_asio.indexterm.basic_io_object.executor_type..executor_type..basic_io_object] 15084The type of the executor associated with the object. 15085 15086 15087 typedef boost::asio::io_context::executor_type executor_type; 15088 15089 15090 15091[heading Requirements] 15092 15093['Header: ][^boost/asio/basic_io_object.hpp] 15094 15095['Convenience header: ][^boost/asio.hpp] 15096 15097 15098[endsect] 15099 15100 15101 15102[section:get_executor basic_io_object::get_executor] 15103 15104[indexterm2 boost_asio.indexterm.basic_io_object.get_executor..get_executor..basic_io_object] 15105Get the executor associated with the object. 15106 15107 15108 executor_type get_executor(); 15109 15110 15111 15112[endsect] 15113 15114 15115[section:get_implementation basic_io_object::get_implementation] 15116 15117[indexterm2 boost_asio.indexterm.basic_io_object.get_implementation..get_implementation..basic_io_object] 15118Get the underlying implementation of the I/O object. 15119 15120 15121 implementation_type & ``[link boost_asio.reference.basic_io_object.get_implementation.overload1 get_implementation]``(); 15122 `` [''''»''' [link boost_asio.reference.basic_io_object.get_implementation.overload1 more...]]`` 15123 15124 const implementation_type & ``[link boost_asio.reference.basic_io_object.get_implementation.overload2 get_implementation]``() const; 15125 `` [''''»''' [link boost_asio.reference.basic_io_object.get_implementation.overload2 more...]]`` 15126 15127 15128[section:overload1 basic_io_object::get_implementation (1 of 2 overloads)] 15129 15130 15131Get the underlying implementation of the I/O object. 15132 15133 15134 implementation_type & get_implementation(); 15135 15136 15137 15138[endsect] 15139 15140 15141 15142[section:overload2 basic_io_object::get_implementation (2 of 2 overloads)] 15143 15144 15145Get the underlying implementation of the I/O object. 15146 15147 15148 const implementation_type & get_implementation() const; 15149 15150 15151 15152[endsect] 15153 15154 15155[endsect] 15156 15157 15158[section:get_io_context basic_io_object::get_io_context] 15159 15160[indexterm2 boost_asio.indexterm.basic_io_object.get_io_context..get_io_context..basic_io_object] 15161(Deprecated: Use `get_executor()`.) Get the [link boost_asio.reference.io_context `io_context`] associated with the object. 15162 15163 15164 boost::asio::io_context & get_io_context(); 15165 15166 15167This 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. 15168 15169 15170[heading Return Value] 15171 15172A 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. 15173 15174 15175 15176 15177[endsect] 15178 15179 15180 15181[section:get_io_service basic_io_object::get_io_service] 15182 15183[indexterm2 boost_asio.indexterm.basic_io_object.get_io_service..get_io_service..basic_io_object] 15184(Deprecated: Use `get_executor()`.) Get the [link boost_asio.reference.io_context `io_context`] associated with the object. 15185 15186 15187 boost::asio::io_context & get_io_service(); 15188 15189 15190This 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. 15191 15192 15193[heading Return Value] 15194 15195A 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. 15196 15197 15198 15199 15200[endsect] 15201 15202 15203[section:get_service basic_io_object::get_service] 15204 15205[indexterm2 boost_asio.indexterm.basic_io_object.get_service..get_service..basic_io_object] 15206Get the service associated with the I/O object. 15207 15208 15209 service_type & ``[link boost_asio.reference.basic_io_object.get_service.overload1 get_service]``(); 15210 `` [''''»''' [link boost_asio.reference.basic_io_object.get_service.overload1 more...]]`` 15211 15212 const service_type & ``[link boost_asio.reference.basic_io_object.get_service.overload2 get_service]``() const; 15213 `` [''''»''' [link boost_asio.reference.basic_io_object.get_service.overload2 more...]]`` 15214 15215 15216[section:overload1 basic_io_object::get_service (1 of 2 overloads)] 15217 15218 15219Get the service associated with the I/O object. 15220 15221 15222 service_type & get_service(); 15223 15224 15225 15226[endsect] 15227 15228 15229 15230[section:overload2 basic_io_object::get_service (2 of 2 overloads)] 15231 15232 15233Get the service associated with the I/O object. 15234 15235 15236 const service_type & get_service() const; 15237 15238 15239 15240[endsect] 15241 15242 15243[endsect] 15244 15245 15246[section:implementation_type basic_io_object::implementation_type] 15247 15248[indexterm2 boost_asio.indexterm.basic_io_object.implementation_type..implementation_type..basic_io_object] 15249The underlying implementation type of I/O object. 15250 15251 15252 typedef service_type::implementation_type implementation_type; 15253 15254 15255 15256[heading Requirements] 15257 15258['Header: ][^boost/asio/basic_io_object.hpp] 15259 15260['Convenience header: ][^boost/asio.hpp] 15261 15262 15263[endsect] 15264 15265 15266 15267[section:operator_eq_ basic_io_object::operator=] 15268 15269[indexterm2 boost_asio.indexterm.basic_io_object.operator_eq_..operator=..basic_io_object] 15270Move-assign a [link boost_asio.reference.basic_io_object `basic_io_object`]. 15271 15272 15273 basic_io_object & operator=( 15274 basic_io_object && other); 15275 15276 15277Performs: 15278 15279 get_service().move_assign(get_implementation(), 15280 other.get_service(), other.get_implementation()); 15281 15282 15283 15284 15285 15286[heading Remarks] 15287 15288Available only for services that support movability, 15289 15290 15291 15292 15293[endsect] 15294 15295 15296 15297[section:service_type basic_io_object::service_type] 15298 15299[indexterm2 boost_asio.indexterm.basic_io_object.service_type..service_type..basic_io_object] 15300The type of the service that will be used to provide I/O operations. 15301 15302 15303 typedef IoObjectService service_type; 15304 15305 15306 15307[heading Requirements] 15308 15309['Header: ][^boost/asio/basic_io_object.hpp] 15310 15311['Convenience header: ][^boost/asio.hpp] 15312 15313 15314[endsect] 15315 15316 15317 15318[section:_basic_io_object basic_io_object::~basic_io_object] 15319 15320[indexterm2 boost_asio.indexterm.basic_io_object._basic_io_object..~basic_io_object..basic_io_object] 15321Protected destructor to prevent deletion through this type. 15322 15323 15324 ~basic_io_object(); 15325 15326 15327Performs: 15328 15329 get_service().destroy(get_implementation()); 15330 15331 15332 15333 15334 15335[endsect] 15336 15337 15338 15339[endsect] 15340 15341[section:basic_raw_socket basic_raw_socket] 15342 15343[indexterm1 boost_asio.indexterm.basic_raw_socket..basic_raw_socket] 15344 15345 15346Provides raw-oriented socket functionality. 15347 15348 15349 template< 15350 typename ``[link boost_asio.reference.Protocol Protocol]``, 15351 typename ``[link boost_asio.reference.Executor1 Executor]``> 15352 class basic_raw_socket : 15353 public basic_socket< Protocol, Executor > 15354 15355 15356[heading Types] 15357[table 15358 [[Name][Description]] 15359 15360 [ 15361 15362 [[link boost_asio.reference.basic_raw_socket__rebind_executor [*rebind_executor]]] 15363 [Rebinds the socket type to another executor. ] 15364 15365 ] 15366 15367 [ 15368 15369 [[link boost_asio.reference.basic_raw_socket.broadcast [*broadcast]]] 15370 [Socket option to permit sending of broadcast messages. ] 15371 15372 ] 15373 15374 [ 15375 15376 [[link boost_asio.reference.basic_raw_socket.bytes_readable [*bytes_readable]]] 15377 [IO control command to get the amount of data that can be read without blocking. ] 15378 15379 ] 15380 15381 [ 15382 15383 [[link boost_asio.reference.basic_raw_socket.debug [*debug]]] 15384 [Socket option to enable socket-level debugging. ] 15385 15386 ] 15387 15388 [ 15389 15390 [[link boost_asio.reference.basic_raw_socket.do_not_route [*do_not_route]]] 15391 [Socket option to prevent routing, use local interfaces only. ] 15392 15393 ] 15394 15395 [ 15396 15397 [[link boost_asio.reference.basic_raw_socket.enable_connection_aborted [*enable_connection_aborted]]] 15398 [Socket option to report aborted connections on accept. ] 15399 15400 ] 15401 15402 [ 15403 15404 [[link boost_asio.reference.basic_raw_socket.endpoint_type [*endpoint_type]]] 15405 [The endpoint type. ] 15406 15407 ] 15408 15409 [ 15410 15411 [[link boost_asio.reference.basic_raw_socket.executor_type [*executor_type]]] 15412 [The type of the executor associated with the object. ] 15413 15414 ] 15415 15416 [ 15417 15418 [[link boost_asio.reference.basic_raw_socket.keep_alive [*keep_alive]]] 15419 [Socket option to send keep-alives. ] 15420 15421 ] 15422 15423 [ 15424 15425 [[link boost_asio.reference.basic_raw_socket.linger [*linger]]] 15426 [Socket option to specify whether the socket lingers on close if unsent data is present. ] 15427 15428 ] 15429 15430 [ 15431 15432 [[link boost_asio.reference.basic_raw_socket.lowest_layer_type [*lowest_layer_type]]] 15433 [A basic_socket is always the lowest layer. ] 15434 15435 ] 15436 15437 [ 15438 15439 [[link boost_asio.reference.basic_raw_socket.message_flags [*message_flags]]] 15440 [Bitmask type for flags that can be passed to send and receive operations. ] 15441 15442 ] 15443 15444 [ 15445 15446 [[link boost_asio.reference.basic_raw_socket.native_handle_type [*native_handle_type]]] 15447 [The native representation of a socket. ] 15448 15449 ] 15450 15451 [ 15452 15453 [[link boost_asio.reference.basic_raw_socket.out_of_band_inline [*out_of_band_inline]]] 15454 [Socket option for putting received out-of-band data inline. ] 15455 15456 ] 15457 15458 [ 15459 15460 [[link boost_asio.reference.basic_raw_socket.protocol_type [*protocol_type]]] 15461 [The protocol type. ] 15462 15463 ] 15464 15465 [ 15466 15467 [[link boost_asio.reference.basic_raw_socket.receive_buffer_size [*receive_buffer_size]]] 15468 [Socket option for the receive buffer size of a socket. ] 15469 15470 ] 15471 15472 [ 15473 15474 [[link boost_asio.reference.basic_raw_socket.receive_low_watermark [*receive_low_watermark]]] 15475 [Socket option for the receive low watermark. ] 15476 15477 ] 15478 15479 [ 15480 15481 [[link boost_asio.reference.basic_raw_socket.reuse_address [*reuse_address]]] 15482 [Socket option to allow the socket to be bound to an address that is already in use. ] 15483 15484 ] 15485 15486 [ 15487 15488 [[link boost_asio.reference.basic_raw_socket.send_buffer_size [*send_buffer_size]]] 15489 [Socket option for the send buffer size of a socket. ] 15490 15491 ] 15492 15493 [ 15494 15495 [[link boost_asio.reference.basic_raw_socket.send_low_watermark [*send_low_watermark]]] 15496 [Socket option for the send low watermark. ] 15497 15498 ] 15499 15500 [ 15501 15502 [[link boost_asio.reference.basic_raw_socket.shutdown_type [*shutdown_type]]] 15503 [Different ways a socket may be shutdown. ] 15504 15505 ] 15506 15507 [ 15508 15509 [[link boost_asio.reference.basic_raw_socket.wait_type [*wait_type]]] 15510 [Wait types. ] 15511 15512 ] 15513 15514] 15515 15516[heading Member Functions] 15517[table 15518 [[Name][Description]] 15519 15520 [ 15521 [[link boost_asio.reference.basic_raw_socket.assign [*assign]]] 15522 [Assign an existing native socket to the socket. ] 15523 ] 15524 15525 [ 15526 [[link boost_asio.reference.basic_raw_socket.async_connect [*async_connect]]] 15527 [Start an asynchronous connect. ] 15528 ] 15529 15530 [ 15531 [[link boost_asio.reference.basic_raw_socket.async_receive [*async_receive]]] 15532 [Start an asynchronous receive on a connected socket. ] 15533 ] 15534 15535 [ 15536 [[link boost_asio.reference.basic_raw_socket.async_receive_from [*async_receive_from]]] 15537 [Start an asynchronous receive. ] 15538 ] 15539 15540 [ 15541 [[link boost_asio.reference.basic_raw_socket.async_send [*async_send]]] 15542 [Start an asynchronous send on a connected socket. ] 15543 ] 15544 15545 [ 15546 [[link boost_asio.reference.basic_raw_socket.async_send_to [*async_send_to]]] 15547 [Start an asynchronous send. ] 15548 ] 15549 15550 [ 15551 [[link boost_asio.reference.basic_raw_socket.async_wait [*async_wait]]] 15552 [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 15553 ] 15554 15555 [ 15556 [[link boost_asio.reference.basic_raw_socket.at_mark [*at_mark]]] 15557 [Determine whether the socket is at the out-of-band data mark. ] 15558 ] 15559 15560 [ 15561 [[link boost_asio.reference.basic_raw_socket.available [*available]]] 15562 [Determine the number of bytes available for reading. ] 15563 ] 15564 15565 [ 15566 [[link boost_asio.reference.basic_raw_socket.basic_raw_socket [*basic_raw_socket]] [constructor]] 15567 [Construct a basic_raw_socket without opening it. 15568 [hr] 15569 Construct and open a basic_raw_socket. 15570 [hr] 15571 Construct a basic_raw_socket, opening it and binding it to the given local endpoint. 15572 [hr] 15573 Construct a basic_raw_socket on an existing native socket. 15574 [hr] 15575 Move-construct a basic_raw_socket from another. 15576 [hr] 15577 Move-construct a basic_raw_socket from a socket of another protocol type. ] 15578 ] 15579 15580 [ 15581 [[link boost_asio.reference.basic_raw_socket.bind [*bind]]] 15582 [Bind the socket to the given local endpoint. ] 15583 ] 15584 15585 [ 15586 [[link boost_asio.reference.basic_raw_socket.cancel [*cancel]]] 15587 [Cancel all asynchronous operations associated with the socket. ] 15588 ] 15589 15590 [ 15591 [[link boost_asio.reference.basic_raw_socket.close [*close]]] 15592 [Close the socket. ] 15593 ] 15594 15595 [ 15596 [[link boost_asio.reference.basic_raw_socket.connect [*connect]]] 15597 [Connect the socket to the specified endpoint. ] 15598 ] 15599 15600 [ 15601 [[link boost_asio.reference.basic_raw_socket.get_executor [*get_executor]]] 15602 [Get the executor associated with the object. ] 15603 ] 15604 15605 [ 15606 [[link boost_asio.reference.basic_raw_socket.get_option [*get_option]]] 15607 [Get an option from the socket. ] 15608 ] 15609 15610 [ 15611 [[link boost_asio.reference.basic_raw_socket.io_control [*io_control]]] 15612 [Perform an IO control command on the socket. ] 15613 ] 15614 15615 [ 15616 [[link boost_asio.reference.basic_raw_socket.is_open [*is_open]]] 15617 [Determine whether the socket is open. ] 15618 ] 15619 15620 [ 15621 [[link boost_asio.reference.basic_raw_socket.local_endpoint [*local_endpoint]]] 15622 [Get the local endpoint of the socket. ] 15623 ] 15624 15625 [ 15626 [[link boost_asio.reference.basic_raw_socket.lowest_layer [*lowest_layer]]] 15627 [Get a reference to the lowest layer. 15628 [hr] 15629 Get a const reference to the lowest layer. ] 15630 ] 15631 15632 [ 15633 [[link boost_asio.reference.basic_raw_socket.native_handle [*native_handle]]] 15634 [Get the native socket representation. ] 15635 ] 15636 15637 [ 15638 [[link boost_asio.reference.basic_raw_socket.native_non_blocking [*native_non_blocking]]] 15639 [Gets the non-blocking mode of the native socket implementation. 15640 [hr] 15641 Sets the non-blocking mode of the native socket implementation. ] 15642 ] 15643 15644 [ 15645 [[link boost_asio.reference.basic_raw_socket.non_blocking [*non_blocking]]] 15646 [Gets the non-blocking mode of the socket. 15647 [hr] 15648 Sets the non-blocking mode of the socket. ] 15649 ] 15650 15651 [ 15652 [[link boost_asio.reference.basic_raw_socket.open [*open]]] 15653 [Open the socket using the specified protocol. ] 15654 ] 15655 15656 [ 15657 [[link boost_asio.reference.basic_raw_socket.operator_eq_ [*operator=]]] 15658 [Move-assign a basic_raw_socket from another. 15659 [hr] 15660 Move-assign a basic_raw_socket from a socket of another protocol type. ] 15661 ] 15662 15663 [ 15664 [[link boost_asio.reference.basic_raw_socket.receive [*receive]]] 15665 [Receive some data on a connected socket. ] 15666 ] 15667 15668 [ 15669 [[link boost_asio.reference.basic_raw_socket.receive_from [*receive_from]]] 15670 [Receive raw data with the endpoint of the sender. ] 15671 ] 15672 15673 [ 15674 [[link boost_asio.reference.basic_raw_socket.release [*release]]] 15675 [Release ownership of the underlying native socket. ] 15676 ] 15677 15678 [ 15679 [[link boost_asio.reference.basic_raw_socket.remote_endpoint [*remote_endpoint]]] 15680 [Get the remote endpoint of the socket. ] 15681 ] 15682 15683 [ 15684 [[link boost_asio.reference.basic_raw_socket.send [*send]]] 15685 [Send some data on a connected socket. ] 15686 ] 15687 15688 [ 15689 [[link boost_asio.reference.basic_raw_socket.send_to [*send_to]]] 15690 [Send raw data to the specified endpoint. ] 15691 ] 15692 15693 [ 15694 [[link boost_asio.reference.basic_raw_socket.set_option [*set_option]]] 15695 [Set an option on the socket. ] 15696 ] 15697 15698 [ 15699 [[link boost_asio.reference.basic_raw_socket.shutdown [*shutdown]]] 15700 [Disable sends or receives on the socket. ] 15701 ] 15702 15703 [ 15704 [[link boost_asio.reference.basic_raw_socket.wait [*wait]]] 15705 [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 15706 ] 15707 15708 [ 15709 [[link boost_asio.reference.basic_raw_socket._basic_raw_socket [*~basic_raw_socket]] [destructor]] 15710 [Destroys the socket. ] 15711 ] 15712 15713] 15714 15715[heading Data Members] 15716[table 15717 [[Name][Description]] 15718 15719 [ 15720 [[link boost_asio.reference.basic_raw_socket.max_connections [*max_connections]] [static]] 15721 [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ] 15722 ] 15723 15724 [ 15725 [[link boost_asio.reference.basic_raw_socket.max_listen_connections [*max_listen_connections]] [static]] 15726 [The maximum length of the queue of pending incoming connections. ] 15727 ] 15728 15729 [ 15730 [[link boost_asio.reference.basic_raw_socket.message_do_not_route [*message_do_not_route]] [static]] 15731 [Specify that the data should not be subject to routing. ] 15732 ] 15733 15734 [ 15735 [[link boost_asio.reference.basic_raw_socket.message_end_of_record [*message_end_of_record]] [static]] 15736 [Specifies that the data marks the end of a record. ] 15737 ] 15738 15739 [ 15740 [[link boost_asio.reference.basic_raw_socket.message_out_of_band [*message_out_of_band]] [static]] 15741 [Process out-of-band data. ] 15742 ] 15743 15744 [ 15745 [[link boost_asio.reference.basic_raw_socket.message_peek [*message_peek]] [static]] 15746 [Peek at incoming data without removing it from the input queue. ] 15747 ] 15748 15749] 15750 15751The [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] class template provides asynchronous and blocking raw-oriented socket functionality. 15752 15753 15754[heading Thread Safety] 15755 15756['Distinct] ['objects:] Safe. 15757 15758['Shared] ['objects:] Unsafe. 15759 15760Synchronous `send`, `send_to`, `receive`, `receive_from`, and `connect` operations are thread safe with respect to each other, if the underlying operating system calls are also thread safe. This means that it is permitted to perform concurrent calls to these synchronous operations on a single socket object. Other synchronous operations, such as `open` or `close`, are not thread safe. 15761 15762[heading Requirements] 15763 15764['Header: ][^boost/asio/basic_raw_socket.hpp] 15765 15766['Convenience header: ][^boost/asio.hpp] 15767 15768[section:assign basic_raw_socket::assign] 15769 15770[indexterm2 boost_asio.indexterm.basic_raw_socket.assign..assign..basic_raw_socket] 15771Assign an existing native socket to the socket. 15772 15773 15774 void ``[link boost_asio.reference.basic_raw_socket.assign.overload1 assign]``( 15775 const protocol_type & protocol, 15776 const native_handle_type & native_socket); 15777 `` [''''»''' [link boost_asio.reference.basic_raw_socket.assign.overload1 more...]]`` 15778 15779 void ``[link boost_asio.reference.basic_raw_socket.assign.overload2 assign]``( 15780 const protocol_type & protocol, 15781 const native_handle_type & native_socket, 15782 boost::system::error_code & ec); 15783 `` [''''»''' [link boost_asio.reference.basic_raw_socket.assign.overload2 more...]]`` 15784 15785 15786[section:overload1 basic_raw_socket::assign (1 of 2 overloads)] 15787 15788 15789['Inherited from basic_socket.] 15790 15791 15792Assign an existing native socket to the socket. 15793 15794 15795 void assign( 15796 const protocol_type & protocol, 15797 const native_handle_type & native_socket); 15798 15799 15800 15801[endsect] 15802 15803 15804 15805[section:overload2 basic_raw_socket::assign (2 of 2 overloads)] 15806 15807 15808['Inherited from basic_socket.] 15809 15810 15811Assign an existing native socket to the socket. 15812 15813 15814 void assign( 15815 const protocol_type & protocol, 15816 const native_handle_type & native_socket, 15817 boost::system::error_code & ec); 15818 15819 15820 15821[endsect] 15822 15823 15824[endsect] 15825 15826 15827[section:async_connect basic_raw_socket::async_connect] 15828 15829 15830['Inherited from basic_socket.] 15831 15832[indexterm2 boost_asio.indexterm.basic_raw_socket.async_connect..async_connect..basic_raw_socket] 15833Start an asynchronous connect. 15834 15835 15836 template< 15837 typename ``[link boost_asio.reference.ConnectHandler ConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 15838 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect( 15839 const endpoint_type & peer_endpoint, 15840 ConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 15841 15842 15843This function is used to asynchronously connect a socket to the specified remote endpoint. The function call always returns immediately. 15844 15845The 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. 15846 15847 15848[heading Parameters] 15849 15850 15851[variablelist 15852 15853[[peer_endpoint][The remote endpoint to which the socket will be connected. Copies will be made of the endpoint object as required.]] 15854 15855[[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: 15856`` 15857 void handler( 15858 const boost::system::error_code& error // Result of operation 15859 ); 15860`` 15861Regardless 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`].]] 15862 15863] 15864 15865 15866[heading Example] 15867 15868 15869 15870 void connect_handler(const boost::system::error_code& error) 15871 { 15872 if (!error) 15873 { 15874 // Connect succeeded. 15875 } 15876 } 15877 15878 ... 15879 15880 boost::asio::ip::tcp::socket socket(my_context); 15881 boost::asio::ip::tcp::endpoint endpoint( 15882 boost::asio::ip::address::from_string("1.2.3.4"), 12345); 15883 socket.async_connect(endpoint, connect_handler); 15884 15885 15886 15887 15888 15889 15890 15891[endsect] 15892 15893 15894[section:async_receive basic_raw_socket::async_receive] 15895 15896[indexterm2 boost_asio.indexterm.basic_raw_socket.async_receive..async_receive..basic_raw_socket] 15897Start an asynchronous receive on a connected socket. 15898 15899 15900 template< 15901 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 15902 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 15903 ``[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]``( 15904 const MutableBufferSequence & buffers, 15905 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 15906 `` [''''»''' [link boost_asio.reference.basic_raw_socket.async_receive.overload1 more...]]`` 15907 15908 template< 15909 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 15910 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 15911 ``[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]``( 15912 const MutableBufferSequence & buffers, 15913 socket_base::message_flags flags, 15914 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 15915 `` [''''»''' [link boost_asio.reference.basic_raw_socket.async_receive.overload2 more...]]`` 15916 15917 15918[section:overload1 basic_raw_socket::async_receive (1 of 2 overloads)] 15919 15920 15921Start an asynchronous receive on a connected socket. 15922 15923 15924 template< 15925 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 15926 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 15927 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive( 15928 const MutableBufferSequence & buffers, 15929 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 15930 15931 15932This function is used to asynchronously receive data from the raw socket. The function call always returns immediately. 15933 15934 15935[heading Parameters] 15936 15937 15938[variablelist 15939 15940[[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.]] 15941 15942[[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: 15943`` 15944 void handler( 15945 const boost::system::error_code& error, // Result of operation. 15946 std::size_t bytes_transferred // Number of bytes received. 15947 ); 15948`` 15949Regardless 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`].]] 15950 15951] 15952 15953 15954[heading Remarks] 15955 15956The 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. 15957 15958 15959[heading Example] 15960 15961To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 15962 15963 socket.async_receive(boost::asio::buffer(data, size), handler); 15964 15965 15966See 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. 15967 15968 15969 15970 15971[endsect] 15972 15973 15974 15975[section:overload2 basic_raw_socket::async_receive (2 of 2 overloads)] 15976 15977 15978Start an asynchronous receive on a connected socket. 15979 15980 15981 template< 15982 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 15983 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 15984 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive( 15985 const MutableBufferSequence & buffers, 15986 socket_base::message_flags flags, 15987 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 15988 15989 15990This function is used to asynchronously receive data from the raw socket. The function call always returns immediately. 15991 15992 15993[heading Parameters] 15994 15995 15996[variablelist 15997 15998[[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.]] 15999 16000[[flags][Flags specifying how the receive call is to be made.]] 16001 16002[[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: 16003`` 16004 void handler( 16005 const boost::system::error_code& error, // Result of operation. 16006 std::size_t bytes_transferred // Number of bytes received. 16007 ); 16008`` 16009Regardless 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`].]] 16010 16011] 16012 16013 16014[heading Remarks] 16015 16016The 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. 16017 16018 16019 16020 16021[endsect] 16022 16023 16024[endsect] 16025 16026[section:async_receive_from basic_raw_socket::async_receive_from] 16027 16028[indexterm2 boost_asio.indexterm.basic_raw_socket.async_receive_from..async_receive_from..basic_raw_socket] 16029Start an asynchronous receive. 16030 16031 16032 template< 16033 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 16034 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 16035 ``[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]``( 16036 const MutableBufferSequence & buffers, 16037 endpoint_type & sender_endpoint, 16038 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 16039 `` [''''»''' [link boost_asio.reference.basic_raw_socket.async_receive_from.overload1 more...]]`` 16040 16041 template< 16042 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 16043 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 16044 ``[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]``( 16045 const MutableBufferSequence & buffers, 16046 endpoint_type & sender_endpoint, 16047 socket_base::message_flags flags, 16048 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 16049 `` [''''»''' [link boost_asio.reference.basic_raw_socket.async_receive_from.overload2 more...]]`` 16050 16051 16052[section:overload1 basic_raw_socket::async_receive_from (1 of 2 overloads)] 16053 16054 16055Start an asynchronous receive. 16056 16057 16058 template< 16059 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 16060 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 16061 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive_from( 16062 const MutableBufferSequence & buffers, 16063 endpoint_type & sender_endpoint, 16064 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 16065 16066 16067This function is used to asynchronously receive raw data. The function call always returns immediately. 16068 16069 16070[heading Parameters] 16071 16072 16073[variablelist 16074 16075[[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.]] 16076 16077[[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.]] 16078 16079[[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: 16080`` 16081 void handler( 16082 const boost::system::error_code& error, // Result of operation. 16083 std::size_t bytes_transferred // Number of bytes received. 16084 ); 16085`` 16086Regardless 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`].]] 16087 16088] 16089 16090 16091[heading Example] 16092 16093To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 16094 16095 socket.async_receive_from( 16096 boost::asio::buffer(data, size), 0, sender_endpoint, handler); 16097 16098 16099See 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. 16100 16101 16102 16103 16104[endsect] 16105 16106 16107 16108[section:overload2 basic_raw_socket::async_receive_from (2 of 2 overloads)] 16109 16110 16111Start an asynchronous receive. 16112 16113 16114 template< 16115 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 16116 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 16117 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive_from( 16118 const MutableBufferSequence & buffers, 16119 endpoint_type & sender_endpoint, 16120 socket_base::message_flags flags, 16121 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 16122 16123 16124This function is used to asynchronously receive raw data. The function call always returns immediately. 16125 16126 16127[heading Parameters] 16128 16129 16130[variablelist 16131 16132[[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.]] 16133 16134[[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.]] 16135 16136[[flags][Flags specifying how the receive call is to be made.]] 16137 16138[[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: 16139`` 16140 void handler( 16141 const boost::system::error_code& error, // Result of operation. 16142 std::size_t bytes_transferred // Number of bytes received. 16143 ); 16144`` 16145Regardless 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`]. ]] 16146 16147] 16148 16149 16150 16151 16152[endsect] 16153 16154 16155[endsect] 16156 16157[section:async_send basic_raw_socket::async_send] 16158 16159[indexterm2 boost_asio.indexterm.basic_raw_socket.async_send..async_send..basic_raw_socket] 16160Start an asynchronous send on a connected socket. 16161 16162 16163 template< 16164 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 16165 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 16166 ``[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]``( 16167 const ConstBufferSequence & buffers, 16168 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 16169 `` [''''»''' [link boost_asio.reference.basic_raw_socket.async_send.overload1 more...]]`` 16170 16171 template< 16172 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 16173 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 16174 ``[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]``( 16175 const ConstBufferSequence & buffers, 16176 socket_base::message_flags flags, 16177 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 16178 `` [''''»''' [link boost_asio.reference.basic_raw_socket.async_send.overload2 more...]]`` 16179 16180 16181[section:overload1 basic_raw_socket::async_send (1 of 2 overloads)] 16182 16183 16184Start an asynchronous send on a connected socket. 16185 16186 16187 template< 16188 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 16189 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 16190 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send( 16191 const ConstBufferSequence & buffers, 16192 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 16193 16194 16195This 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. 16196 16197 16198[heading Parameters] 16199 16200 16201[variablelist 16202 16203[[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.]] 16204 16205[[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: 16206`` 16207 void handler( 16208 const boost::system::error_code& error, // Result of operation. 16209 std::size_t bytes_transferred // Number of bytes sent. 16210 ); 16211`` 16212Regardless 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`].]] 16213 16214] 16215 16216 16217[heading Remarks] 16218 16219The 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. 16220 16221 16222[heading Example] 16223 16224To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 16225 16226 socket.async_send(boost::asio::buffer(data, size), handler); 16227 16228 16229See 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. 16230 16231 16232 16233 16234[endsect] 16235 16236 16237 16238[section:overload2 basic_raw_socket::async_send (2 of 2 overloads)] 16239 16240 16241Start an asynchronous send on a connected socket. 16242 16243 16244 template< 16245 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 16246 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 16247 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send( 16248 const ConstBufferSequence & buffers, 16249 socket_base::message_flags flags, 16250 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 16251 16252 16253This 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. 16254 16255 16256[heading Parameters] 16257 16258 16259[variablelist 16260 16261[[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.]] 16262 16263[[flags][Flags specifying how the send call is to be made.]] 16264 16265[[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: 16266`` 16267 void handler( 16268 const boost::system::error_code& error, // Result of operation. 16269 std::size_t bytes_transferred // Number of bytes sent. 16270 ); 16271`` 16272Regardless 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`].]] 16273 16274] 16275 16276 16277[heading Remarks] 16278 16279The 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. 16280 16281 16282 16283 16284[endsect] 16285 16286 16287[endsect] 16288 16289[section:async_send_to basic_raw_socket::async_send_to] 16290 16291[indexterm2 boost_asio.indexterm.basic_raw_socket.async_send_to..async_send_to..basic_raw_socket] 16292Start an asynchronous send. 16293 16294 16295 template< 16296 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 16297 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 16298 ``[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]``( 16299 const ConstBufferSequence & buffers, 16300 const endpoint_type & destination, 16301 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 16302 `` [''''»''' [link boost_asio.reference.basic_raw_socket.async_send_to.overload1 more...]]`` 16303 16304 template< 16305 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 16306 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 16307 ``[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]``( 16308 const ConstBufferSequence & buffers, 16309 const endpoint_type & destination, 16310 socket_base::message_flags flags, 16311 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 16312 `` [''''»''' [link boost_asio.reference.basic_raw_socket.async_send_to.overload2 more...]]`` 16313 16314 16315[section:overload1 basic_raw_socket::async_send_to (1 of 2 overloads)] 16316 16317 16318Start an asynchronous send. 16319 16320 16321 template< 16322 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 16323 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 16324 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send_to( 16325 const ConstBufferSequence & buffers, 16326 const endpoint_type & destination, 16327 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 16328 16329 16330This function is used to asynchronously send raw data to the specified remote endpoint. The function call always returns immediately. 16331 16332 16333[heading Parameters] 16334 16335 16336[variablelist 16337 16338[[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.]] 16339 16340[[destination][The remote endpoint to which the data will be sent. Copies will be made of the endpoint as required.]] 16341 16342[[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: 16343`` 16344 void handler( 16345 const boost::system::error_code& error, // Result of operation. 16346 std::size_t bytes_transferred // Number of bytes sent. 16347 ); 16348`` 16349Regardless 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`].]] 16350 16351] 16352 16353 16354[heading Example] 16355 16356To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 16357 16358 boost::asio::ip::udp::endpoint destination( 16359 boost::asio::ip::address::from_string("1.2.3.4"), 12345); 16360 socket.async_send_to( 16361 boost::asio::buffer(data, size), destination, handler); 16362 16363 16364See 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. 16365 16366 16367 16368 16369[endsect] 16370 16371 16372 16373[section:overload2 basic_raw_socket::async_send_to (2 of 2 overloads)] 16374 16375 16376Start an asynchronous send. 16377 16378 16379 template< 16380 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 16381 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 16382 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send_to( 16383 const ConstBufferSequence & buffers, 16384 const endpoint_type & destination, 16385 socket_base::message_flags flags, 16386 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 16387 16388 16389This function is used to asynchronously send raw data to the specified remote endpoint. The function call always returns immediately. 16390 16391 16392[heading Parameters] 16393 16394 16395[variablelist 16396 16397[[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.]] 16398 16399[[flags][Flags specifying how the send call is to be made.]] 16400 16401[[destination][The remote endpoint to which the data will be sent. Copies will be made of the endpoint as required.]] 16402 16403[[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: 16404`` 16405 void handler( 16406 const boost::system::error_code& error, // Result of operation. 16407 std::size_t bytes_transferred // Number of bytes sent. 16408 ); 16409`` 16410Regardless 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`]. ]] 16411 16412] 16413 16414 16415 16416 16417[endsect] 16418 16419 16420[endsect] 16421 16422 16423[section:async_wait basic_raw_socket::async_wait] 16424 16425 16426['Inherited from basic_socket.] 16427 16428[indexterm2 boost_asio.indexterm.basic_raw_socket.async_wait..async_wait..basic_raw_socket] 16429Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. 16430 16431 16432 template< 16433 typename ``[link boost_asio.reference.WaitHandler WaitHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 16434 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait( 16435 wait_type w, 16436 WaitHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 16437 16438 16439This function is used to perform an asynchronous wait for a socket to enter a ready to read, write or error condition state. 16440 16441 16442[heading Parameters] 16443 16444 16445[variablelist 16446 16447[[w][Specifies the desired socket state.]] 16448 16449[[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: 16450`` 16451 void handler( 16452 const boost::system::error_code& error // Result of operation 16453 ); 16454`` 16455Regardless 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`].]] 16456 16457] 16458 16459 16460[heading Example] 16461 16462 16463 16464 void wait_handler(const boost::system::error_code& error) 16465 { 16466 if (!error) 16467 { 16468 // Wait succeeded. 16469 } 16470 } 16471 16472 ... 16473 16474 boost::asio::ip::tcp::socket socket(my_context); 16475 ... 16476 socket.async_wait(boost::asio::ip::tcp::socket::wait_read, wait_handler); 16477 16478 16479 16480 16481 16482 16483 16484[endsect] 16485 16486 16487[section:at_mark basic_raw_socket::at_mark] 16488 16489[indexterm2 boost_asio.indexterm.basic_raw_socket.at_mark..at_mark..basic_raw_socket] 16490Determine whether the socket is at the out-of-band data mark. 16491 16492 16493 bool ``[link boost_asio.reference.basic_raw_socket.at_mark.overload1 at_mark]``() const; 16494 `` [''''»''' [link boost_asio.reference.basic_raw_socket.at_mark.overload1 more...]]`` 16495 16496 bool ``[link boost_asio.reference.basic_raw_socket.at_mark.overload2 at_mark]``( 16497 boost::system::error_code & ec) const; 16498 `` [''''»''' [link boost_asio.reference.basic_raw_socket.at_mark.overload2 more...]]`` 16499 16500 16501[section:overload1 basic_raw_socket::at_mark (1 of 2 overloads)] 16502 16503 16504['Inherited from basic_socket.] 16505 16506 16507Determine whether the socket is at the out-of-band data mark. 16508 16509 16510 bool at_mark() const; 16511 16512 16513This function is used to check whether the socket input is currently positioned at the out-of-band data mark. 16514 16515 16516[heading Return Value] 16517 16518A bool indicating whether the socket is at the out-of-band data mark. 16519 16520 16521[heading Exceptions] 16522 16523 16524[variablelist 16525 16526[[boost::system::system_error][Thrown on failure. ]] 16527 16528] 16529 16530 16531 16532 16533[endsect] 16534 16535 16536 16537[section:overload2 basic_raw_socket::at_mark (2 of 2 overloads)] 16538 16539 16540['Inherited from basic_socket.] 16541 16542 16543Determine whether the socket is at the out-of-band data mark. 16544 16545 16546 bool at_mark( 16547 boost::system::error_code & ec) const; 16548 16549 16550This function is used to check whether the socket input is currently positioned at the out-of-band data mark. 16551 16552 16553[heading Parameters] 16554 16555 16556[variablelist 16557 16558[[ec][Set to indicate what error occurred, if any.]] 16559 16560] 16561 16562 16563[heading Return Value] 16564 16565A bool indicating whether the socket is at the out-of-band data mark. 16566 16567 16568 16569 16570[endsect] 16571 16572 16573[endsect] 16574 16575[section:available basic_raw_socket::available] 16576 16577[indexterm2 boost_asio.indexterm.basic_raw_socket.available..available..basic_raw_socket] 16578Determine the number of bytes available for reading. 16579 16580 16581 std::size_t ``[link boost_asio.reference.basic_raw_socket.available.overload1 available]``() const; 16582 `` [''''»''' [link boost_asio.reference.basic_raw_socket.available.overload1 more...]]`` 16583 16584 std::size_t ``[link boost_asio.reference.basic_raw_socket.available.overload2 available]``( 16585 boost::system::error_code & ec) const; 16586 `` [''''»''' [link boost_asio.reference.basic_raw_socket.available.overload2 more...]]`` 16587 16588 16589[section:overload1 basic_raw_socket::available (1 of 2 overloads)] 16590 16591 16592['Inherited from basic_socket.] 16593 16594 16595Determine the number of bytes available for reading. 16596 16597 16598 std::size_t available() const; 16599 16600 16601This function is used to determine the number of bytes that may be read without blocking. 16602 16603 16604[heading Return Value] 16605 16606The number of bytes that may be read without blocking, or 0 if an error occurs. 16607 16608 16609[heading Exceptions] 16610 16611 16612[variablelist 16613 16614[[boost::system::system_error][Thrown on failure. ]] 16615 16616] 16617 16618 16619 16620 16621[endsect] 16622 16623 16624 16625[section:overload2 basic_raw_socket::available (2 of 2 overloads)] 16626 16627 16628['Inherited from basic_socket.] 16629 16630 16631Determine the number of bytes available for reading. 16632 16633 16634 std::size_t available( 16635 boost::system::error_code & ec) const; 16636 16637 16638This function is used to determine the number of bytes that may be read without blocking. 16639 16640 16641[heading Parameters] 16642 16643 16644[variablelist 16645 16646[[ec][Set to indicate what error occurred, if any.]] 16647 16648] 16649 16650 16651[heading Return Value] 16652 16653The number of bytes that may be read without blocking, or 0 if an error occurs. 16654 16655 16656 16657 16658[endsect] 16659 16660 16661[endsect] 16662 16663[section:basic_raw_socket basic_raw_socket::basic_raw_socket] 16664 16665[indexterm2 boost_asio.indexterm.basic_raw_socket.basic_raw_socket..basic_raw_socket..basic_raw_socket] 16666Construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] without opening it. 16667 16668 16669 explicit ``[link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload1 basic_raw_socket]``( 16670 const executor_type & ex); 16671 `` [''''»''' [link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload1 more...]]`` 16672 16673 template< 16674 typename ExecutionContext> 16675 explicit ``[link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload2 basic_raw_socket]``( 16676 ExecutionContext & context, 16677 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 16678 `` [''''»''' [link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload2 more...]]`` 16679 16680 16681Construct and open a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`]. 16682 16683 16684 ``[link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload3 basic_raw_socket]``( 16685 const executor_type & ex, 16686 const protocol_type & protocol); 16687 `` [''''»''' [link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload3 more...]]`` 16688 16689 template< 16690 typename ExecutionContext> 16691 ``[link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload4 basic_raw_socket]``( 16692 ExecutionContext & context, 16693 const protocol_type & protocol, 16694 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value, defaulted_constraint >::type = defaulted_constraint()); 16695 `` [''''»''' [link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload4 more...]]`` 16696 16697 16698Construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`], opening it and binding it to the given local endpoint. 16699 16700 16701 ``[link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload5 basic_raw_socket]``( 16702 const executor_type & ex, 16703 const endpoint_type & endpoint); 16704 `` [''''»''' [link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload5 more...]]`` 16705 16706 template< 16707 typename ExecutionContext> 16708 ``[link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload6 basic_raw_socket]``( 16709 ExecutionContext & context, 16710 const endpoint_type & endpoint, 16711 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 16712 `` [''''»''' [link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload6 more...]]`` 16713 16714 16715Construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] on an existing native socket. 16716 16717 16718 ``[link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload7 basic_raw_socket]``( 16719 const executor_type & ex, 16720 const protocol_type & protocol, 16721 const native_handle_type & native_socket); 16722 `` [''''»''' [link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload7 more...]]`` 16723 16724 template< 16725 typename ExecutionContext> 16726 ``[link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload8 basic_raw_socket]``( 16727 ExecutionContext & context, 16728 const protocol_type & protocol, 16729 const native_handle_type & native_socket, 16730 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 16731 `` [''''»''' [link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload8 more...]]`` 16732 16733 16734Move-construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] from another. 16735 16736 16737 ``[link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload9 basic_raw_socket]``( 16738 basic_raw_socket && other); 16739 `` [''''»''' [link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload9 more...]]`` 16740 16741 16742Move-construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] from a socket of another protocol type. 16743 16744 16745 template< 16746 typename ``[link boost_asio.reference.Protocol Protocol1]``, 16747 typename ``[link boost_asio.reference.Executor1 Executor1]``> 16748 ``[link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload10 basic_raw_socket]``( 16749 basic_raw_socket< Protocol1, Executor1 > && other, 16750 typename constraint< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type = 0); 16751 `` [''''»''' [link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload10 more...]]`` 16752 16753 16754[section:overload1 basic_raw_socket::basic_raw_socket (1 of 10 overloads)] 16755 16756 16757Construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] without opening it. 16758 16759 16760 basic_raw_socket( 16761 const executor_type & ex); 16762 16763 16764This constructor creates a raw socket without opening it. The `open()` function must be called before data can be sent or received on the socket. 16765 16766 16767[heading Parameters] 16768 16769 16770[variablelist 16771 16772[[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket. ]] 16773 16774] 16775 16776 16777 16778 16779[endsect] 16780 16781 16782 16783[section:overload2 basic_raw_socket::basic_raw_socket (2 of 10 overloads)] 16784 16785 16786Construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] without opening it. 16787 16788 16789 template< 16790 typename ExecutionContext> 16791 basic_raw_socket( 16792 ExecutionContext & context, 16793 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 16794 16795 16796This constructor creates a raw socket without opening it. The `open()` function must be called before data can be sent or received on the socket. 16797 16798 16799[heading Parameters] 16800 16801 16802[variablelist 16803 16804[[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. ]] 16805 16806] 16807 16808 16809 16810 16811[endsect] 16812 16813 16814 16815[section:overload3 basic_raw_socket::basic_raw_socket (3 of 10 overloads)] 16816 16817 16818Construct and open a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`]. 16819 16820 16821 basic_raw_socket( 16822 const executor_type & ex, 16823 const protocol_type & protocol); 16824 16825 16826This constructor creates and opens a raw socket. 16827 16828 16829[heading Parameters] 16830 16831 16832[variablelist 16833 16834[[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]] 16835 16836[[protocol][An object specifying protocol parameters to be used.]] 16837 16838] 16839 16840 16841[heading Exceptions] 16842 16843 16844[variablelist 16845 16846[[boost::system::system_error][Thrown on failure. ]] 16847 16848] 16849 16850 16851 16852 16853[endsect] 16854 16855 16856 16857[section:overload4 basic_raw_socket::basic_raw_socket (4 of 10 overloads)] 16858 16859 16860Construct and open a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`]. 16861 16862 16863 template< 16864 typename ExecutionContext> 16865 basic_raw_socket( 16866 ExecutionContext & context, 16867 const protocol_type & protocol, 16868 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value, defaulted_constraint >::type = defaulted_constraint()); 16869 16870 16871This constructor creates and opens a raw socket. 16872 16873 16874[heading Parameters] 16875 16876 16877[variablelist 16878 16879[[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.]] 16880 16881[[protocol][An object specifying protocol parameters to be used.]] 16882 16883] 16884 16885 16886[heading Exceptions] 16887 16888 16889[variablelist 16890 16891[[boost::system::system_error][Thrown on failure. ]] 16892 16893] 16894 16895 16896 16897 16898[endsect] 16899 16900 16901 16902[section:overload5 basic_raw_socket::basic_raw_socket (5 of 10 overloads)] 16903 16904 16905Construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`], opening it and binding it to the given local endpoint. 16906 16907 16908 basic_raw_socket( 16909 const executor_type & ex, 16910 const endpoint_type & endpoint); 16911 16912 16913This 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. 16914 16915 16916[heading Parameters] 16917 16918 16919[variablelist 16920 16921[[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]] 16922 16923[[endpoint][An endpoint on the local machine to which the raw socket will be bound.]] 16924 16925] 16926 16927 16928[heading Exceptions] 16929 16930 16931[variablelist 16932 16933[[boost::system::system_error][Thrown on failure. ]] 16934 16935] 16936 16937 16938 16939 16940[endsect] 16941 16942 16943 16944[section:overload6 basic_raw_socket::basic_raw_socket (6 of 10 overloads)] 16945 16946 16947Construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`], opening it and binding it to the given local endpoint. 16948 16949 16950 template< 16951 typename ExecutionContext> 16952 basic_raw_socket( 16953 ExecutionContext & context, 16954 const endpoint_type & endpoint, 16955 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 16956 16957 16958This 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. 16959 16960 16961[heading Parameters] 16962 16963 16964[variablelist 16965 16966[[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.]] 16967 16968[[endpoint][An endpoint on the local machine to which the raw socket will be bound.]] 16969 16970] 16971 16972 16973[heading Exceptions] 16974 16975 16976[variablelist 16977 16978[[boost::system::system_error][Thrown on failure. ]] 16979 16980] 16981 16982 16983 16984 16985[endsect] 16986 16987 16988 16989[section:overload7 basic_raw_socket::basic_raw_socket (7 of 10 overloads)] 16990 16991 16992Construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] on an existing native socket. 16993 16994 16995 basic_raw_socket( 16996 const executor_type & ex, 16997 const protocol_type & protocol, 16998 const native_handle_type & native_socket); 16999 17000 17001This constructor creates a raw socket object to hold an existing native socket. 17002 17003 17004[heading Parameters] 17005 17006 17007[variablelist 17008 17009[[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]] 17010 17011[[protocol][An object specifying protocol parameters to be used.]] 17012 17013[[native_socket][The new underlying socket implementation.]] 17014 17015] 17016 17017 17018[heading Exceptions] 17019 17020 17021[variablelist 17022 17023[[boost::system::system_error][Thrown on failure. ]] 17024 17025] 17026 17027 17028 17029 17030[endsect] 17031 17032 17033 17034[section:overload8 basic_raw_socket::basic_raw_socket (8 of 10 overloads)] 17035 17036 17037Construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] on an existing native socket. 17038 17039 17040 template< 17041 typename ExecutionContext> 17042 basic_raw_socket( 17043 ExecutionContext & context, 17044 const protocol_type & protocol, 17045 const native_handle_type & native_socket, 17046 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 17047 17048 17049This constructor creates a raw socket object to hold an existing native socket. 17050 17051 17052[heading Parameters] 17053 17054 17055[variablelist 17056 17057[[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.]] 17058 17059[[protocol][An object specifying protocol parameters to be used.]] 17060 17061[[native_socket][The new underlying socket implementation.]] 17062 17063] 17064 17065 17066[heading Exceptions] 17067 17068 17069[variablelist 17070 17071[[boost::system::system_error][Thrown on failure. ]] 17072 17073] 17074 17075 17076 17077 17078[endsect] 17079 17080 17081 17082[section:overload9 basic_raw_socket::basic_raw_socket (9 of 10 overloads)] 17083 17084 17085Move-construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] from another. 17086 17087 17088 basic_raw_socket( 17089 basic_raw_socket && other); 17090 17091 17092This constructor moves a raw socket from one object to another. 17093 17094 17095[heading Parameters] 17096 17097 17098[variablelist 17099 17100[[other][The other [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] object from which the move will occur.]] 17101 17102] 17103 17104 17105[heading Remarks] 17106 17107Following the move, the moved-from object is in the same state as if constructed using the `basic_raw_socket(const executor_type&)` constructor. 17108 17109 17110 17111 17112[endsect] 17113 17114 17115 17116[section:overload10 basic_raw_socket::basic_raw_socket (10 of 10 overloads)] 17117 17118 17119Move-construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] from a socket of another protocol type. 17120 17121 17122 template< 17123 typename ``[link boost_asio.reference.Protocol Protocol1]``, 17124 typename ``[link boost_asio.reference.Executor1 Executor1]``> 17125 basic_raw_socket( 17126 basic_raw_socket< Protocol1, Executor1 > && other, 17127 typename constraint< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type = 0); 17128 17129 17130This constructor moves a raw socket from one object to another. 17131 17132 17133[heading Parameters] 17134 17135 17136[variablelist 17137 17138[[other][The other [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] object from which the move will occur.]] 17139 17140] 17141 17142 17143[heading Remarks] 17144 17145Following the move, the moved-from object is in the same state as if constructed using the `basic_raw_socket(const executor_type&)` constructor. 17146 17147 17148 17149 17150[endsect] 17151 17152 17153[endsect] 17154 17155[section:bind basic_raw_socket::bind] 17156 17157[indexterm2 boost_asio.indexterm.basic_raw_socket.bind..bind..basic_raw_socket] 17158Bind the socket to the given local endpoint. 17159 17160 17161 void ``[link boost_asio.reference.basic_raw_socket.bind.overload1 bind]``( 17162 const endpoint_type & endpoint); 17163 `` [''''»''' [link boost_asio.reference.basic_raw_socket.bind.overload1 more...]]`` 17164 17165 void ``[link boost_asio.reference.basic_raw_socket.bind.overload2 bind]``( 17166 const endpoint_type & endpoint, 17167 boost::system::error_code & ec); 17168 `` [''''»''' [link boost_asio.reference.basic_raw_socket.bind.overload2 more...]]`` 17169 17170 17171[section:overload1 basic_raw_socket::bind (1 of 2 overloads)] 17172 17173 17174['Inherited from basic_socket.] 17175 17176 17177Bind the socket to the given local endpoint. 17178 17179 17180 void bind( 17181 const endpoint_type & endpoint); 17182 17183 17184This function binds the socket to the specified endpoint on the local machine. 17185 17186 17187[heading Parameters] 17188 17189 17190[variablelist 17191 17192[[endpoint][An endpoint on the local machine to which the socket will be bound.]] 17193 17194] 17195 17196 17197[heading Exceptions] 17198 17199 17200[variablelist 17201 17202[[boost::system::system_error][Thrown on failure.]] 17203 17204] 17205 17206 17207[heading Example] 17208 17209 17210 17211 boost::asio::ip::tcp::socket socket(my_context); 17212 socket.open(boost::asio::ip::tcp::v4()); 17213 socket.bind(boost::asio::ip::tcp::endpoint( 17214 boost::asio::ip::tcp::v4(), 12345)); 17215 17216 17217 17218 17219 17220 17221 17222[endsect] 17223 17224 17225 17226[section:overload2 basic_raw_socket::bind (2 of 2 overloads)] 17227 17228 17229['Inherited from basic_socket.] 17230 17231 17232Bind the socket to the given local endpoint. 17233 17234 17235 void bind( 17236 const endpoint_type & endpoint, 17237 boost::system::error_code & ec); 17238 17239 17240This function binds the socket to the specified endpoint on the local machine. 17241 17242 17243[heading Parameters] 17244 17245 17246[variablelist 17247 17248[[endpoint][An endpoint on the local machine to which the socket will be bound.]] 17249 17250[[ec][Set to indicate what error occurred, if any.]] 17251 17252] 17253 17254 17255[heading Example] 17256 17257 17258 17259 boost::asio::ip::tcp::socket socket(my_context); 17260 socket.open(boost::asio::ip::tcp::v4()); 17261 boost::system::error_code ec; 17262 socket.bind(boost::asio::ip::tcp::endpoint( 17263 boost::asio::ip::tcp::v4(), 12345), ec); 17264 if (ec) 17265 { 17266 // An error occurred. 17267 } 17268 17269 17270 17271 17272 17273 17274 17275[endsect] 17276 17277 17278[endsect] 17279 17280 17281[section:broadcast basic_raw_socket::broadcast] 17282 17283 17284['Inherited from socket_base.] 17285 17286[indexterm2 boost_asio.indexterm.basic_raw_socket.broadcast..broadcast..basic_raw_socket] 17287Socket option to permit sending of broadcast messages. 17288 17289 17290 typedef implementation_defined broadcast; 17291 17292 17293 17294Implements the SOL\_SOCKET/SO\_BROADCAST socket option. 17295 17296 17297[heading Examples] 17298 17299Setting the option: 17300 17301 boost::asio::ip::udp::socket socket(my_context); 17302 ... 17303 boost::asio::socket_base::broadcast option(true); 17304 socket.set_option(option); 17305 17306 17307 17308 17309 17310Getting the current option value: 17311 17312 boost::asio::ip::udp::socket socket(my_context); 17313 ... 17314 boost::asio::socket_base::broadcast option; 17315 socket.get_option(option); 17316 bool is_set = option.value(); 17317 17318 17319 17320 17321 17322 17323 17324[heading Requirements] 17325 17326['Header: ][^boost/asio/basic_raw_socket.hpp] 17327 17328['Convenience header: ][^boost/asio.hpp] 17329 17330 17331[endsect] 17332 17333 17334 17335[section:bytes_readable basic_raw_socket::bytes_readable] 17336 17337 17338['Inherited from socket_base.] 17339 17340[indexterm2 boost_asio.indexterm.basic_raw_socket.bytes_readable..bytes_readable..basic_raw_socket] 17341IO control command to get the amount of data that can be read without blocking. 17342 17343 17344 typedef implementation_defined bytes_readable; 17345 17346 17347 17348Implements the FIONREAD IO control command. 17349 17350 17351[heading Example] 17352 17353 17354 17355 boost::asio::ip::tcp::socket socket(my_context); 17356 ... 17357 boost::asio::socket_base::bytes_readable command(true); 17358 socket.io_control(command); 17359 std::size_t bytes_readable = command.get(); 17360 17361 17362 17363 17364 17365 17366 17367[heading Requirements] 17368 17369['Header: ][^boost/asio/basic_raw_socket.hpp] 17370 17371['Convenience header: ][^boost/asio.hpp] 17372 17373 17374[endsect] 17375 17376 17377[section:cancel basic_raw_socket::cancel] 17378 17379[indexterm2 boost_asio.indexterm.basic_raw_socket.cancel..cancel..basic_raw_socket] 17380Cancel all asynchronous operations associated with the socket. 17381 17382 17383 void ``[link boost_asio.reference.basic_raw_socket.cancel.overload1 cancel]``(); 17384 `` [''''»''' [link boost_asio.reference.basic_raw_socket.cancel.overload1 more...]]`` 17385 17386 void ``[link boost_asio.reference.basic_raw_socket.cancel.overload2 cancel]``( 17387 boost::system::error_code & ec); 17388 `` [''''»''' [link boost_asio.reference.basic_raw_socket.cancel.overload2 more...]]`` 17389 17390 17391[section:overload1 basic_raw_socket::cancel (1 of 2 overloads)] 17392 17393 17394['Inherited from basic_socket.] 17395 17396 17397Cancel all asynchronous operations associated with the socket. 17398 17399 17400 void cancel(); 17401 17402 17403This 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. 17404 17405 17406[heading Exceptions] 17407 17408 17409[variablelist 17410 17411[[boost::system::system_error][Thrown on failure.]] 17412 17413] 17414 17415 17416[heading Remarks] 17417 17418Calls 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: 17419 17420 17421* It will only cancel asynchronous operations that were initiated in the current thread. 17422 17423 17424* 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. 17425 17426For portable cancellation, consider using one of the following alternatives: 17427 17428 17429* Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP. 17430 17431 17432* Use the `close()` function to simultaneously cancel the outstanding operations and close the socket. 17433 17434When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above. 17435 17436 17437[endsect] 17438 17439 17440 17441[section:overload2 basic_raw_socket::cancel (2 of 2 overloads)] 17442 17443 17444['Inherited from basic_socket.] 17445 17446 17447Cancel all asynchronous operations associated with the socket. 17448 17449 17450 void cancel( 17451 boost::system::error_code & ec); 17452 17453 17454This 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. 17455 17456 17457[heading Parameters] 17458 17459 17460[variablelist 17461 17462[[ec][Set to indicate what error occurred, if any.]] 17463 17464] 17465 17466 17467[heading Remarks] 17468 17469Calls 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: 17470 17471 17472* It will only cancel asynchronous operations that were initiated in the current thread. 17473 17474 17475* 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. 17476 17477For portable cancellation, consider using one of the following alternatives: 17478 17479 17480* Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP. 17481 17482 17483* Use the `close()` function to simultaneously cancel the outstanding operations and close the socket. 17484 17485When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above. 17486 17487 17488[endsect] 17489 17490 17491[endsect] 17492 17493[section:close basic_raw_socket::close] 17494 17495[indexterm2 boost_asio.indexterm.basic_raw_socket.close..close..basic_raw_socket] 17496Close the socket. 17497 17498 17499 void ``[link boost_asio.reference.basic_raw_socket.close.overload1 close]``(); 17500 `` [''''»''' [link boost_asio.reference.basic_raw_socket.close.overload1 more...]]`` 17501 17502 void ``[link boost_asio.reference.basic_raw_socket.close.overload2 close]``( 17503 boost::system::error_code & ec); 17504 `` [''''»''' [link boost_asio.reference.basic_raw_socket.close.overload2 more...]]`` 17505 17506 17507[section:overload1 basic_raw_socket::close (1 of 2 overloads)] 17508 17509 17510['Inherited from basic_socket.] 17511 17512 17513Close the socket. 17514 17515 17516 void close(); 17517 17518 17519This 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. 17520 17521 17522[heading Exceptions] 17523 17524 17525[variablelist 17526 17527[[boost::system::system_error][Thrown on failure. Note that, even if the function indicates an error, the underlying descriptor is closed.]] 17528 17529] 17530 17531 17532[heading Remarks] 17533 17534For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket. 17535 17536 17537 17538 17539[endsect] 17540 17541 17542 17543[section:overload2 basic_raw_socket::close (2 of 2 overloads)] 17544 17545 17546['Inherited from basic_socket.] 17547 17548 17549Close the socket. 17550 17551 17552 void close( 17553 boost::system::error_code & ec); 17554 17555 17556This 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. 17557 17558 17559[heading Parameters] 17560 17561 17562[variablelist 17563 17564[[ec][Set to indicate what error occurred, if any. Note that, even if the function indicates an error, the underlying descriptor is closed.]] 17565 17566] 17567 17568 17569[heading Example] 17570 17571 17572 17573 boost::asio::ip::tcp::socket socket(my_context); 17574 ... 17575 boost::system::error_code ec; 17576 socket.close(ec); 17577 if (ec) 17578 { 17579 // An error occurred. 17580 } 17581 17582 17583 17584 17585 17586[heading Remarks] 17587 17588For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket. 17589 17590 17591 17592 17593[endsect] 17594 17595 17596[endsect] 17597 17598[section:connect basic_raw_socket::connect] 17599 17600[indexterm2 boost_asio.indexterm.basic_raw_socket.connect..connect..basic_raw_socket] 17601Connect the socket to the specified endpoint. 17602 17603 17604 void ``[link boost_asio.reference.basic_raw_socket.connect.overload1 connect]``( 17605 const endpoint_type & peer_endpoint); 17606 `` [''''»''' [link boost_asio.reference.basic_raw_socket.connect.overload1 more...]]`` 17607 17608 void ``[link boost_asio.reference.basic_raw_socket.connect.overload2 connect]``( 17609 const endpoint_type & peer_endpoint, 17610 boost::system::error_code & ec); 17611 `` [''''»''' [link boost_asio.reference.basic_raw_socket.connect.overload2 more...]]`` 17612 17613 17614[section:overload1 basic_raw_socket::connect (1 of 2 overloads)] 17615 17616 17617['Inherited from basic_socket.] 17618 17619 17620Connect the socket to the specified endpoint. 17621 17622 17623 void connect( 17624 const endpoint_type & peer_endpoint); 17625 17626 17627This 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. 17628 17629The 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. 17630 17631 17632[heading Parameters] 17633 17634 17635[variablelist 17636 17637[[peer_endpoint][The remote endpoint to which the socket will be connected.]] 17638 17639] 17640 17641 17642[heading Exceptions] 17643 17644 17645[variablelist 17646 17647[[boost::system::system_error][Thrown on failure.]] 17648 17649] 17650 17651 17652[heading Example] 17653 17654 17655 17656 boost::asio::ip::tcp::socket socket(my_context); 17657 boost::asio::ip::tcp::endpoint endpoint( 17658 boost::asio::ip::address::from_string("1.2.3.4"), 12345); 17659 socket.connect(endpoint); 17660 17661 17662 17663 17664 17665 17666 17667[endsect] 17668 17669 17670 17671[section:overload2 basic_raw_socket::connect (2 of 2 overloads)] 17672 17673 17674['Inherited from basic_socket.] 17675 17676 17677Connect the socket to the specified endpoint. 17678 17679 17680 void connect( 17681 const endpoint_type & peer_endpoint, 17682 boost::system::error_code & ec); 17683 17684 17685This 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. 17686 17687The 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. 17688 17689 17690[heading Parameters] 17691 17692 17693[variablelist 17694 17695[[peer_endpoint][The remote endpoint to which the socket will be connected.]] 17696 17697[[ec][Set to indicate what error occurred, if any.]] 17698 17699] 17700 17701 17702[heading Example] 17703 17704 17705 17706 boost::asio::ip::tcp::socket socket(my_context); 17707 boost::asio::ip::tcp::endpoint endpoint( 17708 boost::asio::ip::address::from_string("1.2.3.4"), 12345); 17709 boost::system::error_code ec; 17710 socket.connect(endpoint, ec); 17711 if (ec) 17712 { 17713 // An error occurred. 17714 } 17715 17716 17717 17718 17719 17720 17721 17722[endsect] 17723 17724 17725[endsect] 17726 17727 17728[section:debug basic_raw_socket::debug] 17729 17730 17731['Inherited from socket_base.] 17732 17733[indexterm2 boost_asio.indexterm.basic_raw_socket.debug..debug..basic_raw_socket] 17734Socket option to enable socket-level debugging. 17735 17736 17737 typedef implementation_defined debug; 17738 17739 17740 17741Implements the SOL\_SOCKET/SO\_DEBUG socket option. 17742 17743 17744[heading Examples] 17745 17746Setting the option: 17747 17748 boost::asio::ip::tcp::socket socket(my_context); 17749 ... 17750 boost::asio::socket_base::debug option(true); 17751 socket.set_option(option); 17752 17753 17754 17755 17756 17757Getting the current option value: 17758 17759 boost::asio::ip::tcp::socket socket(my_context); 17760 ... 17761 boost::asio::socket_base::debug option; 17762 socket.get_option(option); 17763 bool is_set = option.value(); 17764 17765 17766 17767 17768 17769 17770 17771[heading Requirements] 17772 17773['Header: ][^boost/asio/basic_raw_socket.hpp] 17774 17775['Convenience header: ][^boost/asio.hpp] 17776 17777 17778[endsect] 17779 17780 17781 17782[section:do_not_route basic_raw_socket::do_not_route] 17783 17784 17785['Inherited from socket_base.] 17786 17787[indexterm2 boost_asio.indexterm.basic_raw_socket.do_not_route..do_not_route..basic_raw_socket] 17788Socket option to prevent routing, use local interfaces only. 17789 17790 17791 typedef implementation_defined do_not_route; 17792 17793 17794 17795Implements the SOL\_SOCKET/SO\_DONTROUTE socket option. 17796 17797 17798[heading Examples] 17799 17800Setting the option: 17801 17802 boost::asio::ip::udp::socket socket(my_context); 17803 ... 17804 boost::asio::socket_base::do_not_route option(true); 17805 socket.set_option(option); 17806 17807 17808 17809 17810 17811Getting the current option value: 17812 17813 boost::asio::ip::udp::socket socket(my_context); 17814 ... 17815 boost::asio::socket_base::do_not_route option; 17816 socket.get_option(option); 17817 bool is_set = option.value(); 17818 17819 17820 17821 17822 17823 17824 17825[heading Requirements] 17826 17827['Header: ][^boost/asio/basic_raw_socket.hpp] 17828 17829['Convenience header: ][^boost/asio.hpp] 17830 17831 17832[endsect] 17833 17834 17835 17836[section:enable_connection_aborted basic_raw_socket::enable_connection_aborted] 17837 17838 17839['Inherited from socket_base.] 17840 17841[indexterm2 boost_asio.indexterm.basic_raw_socket.enable_connection_aborted..enable_connection_aborted..basic_raw_socket] 17842Socket option to report aborted connections on accept. 17843 17844 17845 typedef implementation_defined enable_connection_aborted; 17846 17847 17848 17849Implements 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. 17850 17851 17852[heading Examples] 17853 17854Setting the option: 17855 17856 boost::asio::ip::tcp::acceptor acceptor(my_context); 17857 ... 17858 boost::asio::socket_base::enable_connection_aborted option(true); 17859 acceptor.set_option(option); 17860 17861 17862 17863 17864 17865Getting the current option value: 17866 17867 boost::asio::ip::tcp::acceptor acceptor(my_context); 17868 ... 17869 boost::asio::socket_base::enable_connection_aborted option; 17870 acceptor.get_option(option); 17871 bool is_set = option.value(); 17872 17873 17874 17875 17876 17877 17878 17879[heading Requirements] 17880 17881['Header: ][^boost/asio/basic_raw_socket.hpp] 17882 17883['Convenience header: ][^boost/asio.hpp] 17884 17885 17886[endsect] 17887 17888 17889 17890[section:endpoint_type basic_raw_socket::endpoint_type] 17891 17892[indexterm2 boost_asio.indexterm.basic_raw_socket.endpoint_type..endpoint_type..basic_raw_socket] 17893The endpoint type. 17894 17895 17896 typedef Protocol::endpoint endpoint_type; 17897 17898 17899 17900[heading Requirements] 17901 17902['Header: ][^boost/asio/basic_raw_socket.hpp] 17903 17904['Convenience header: ][^boost/asio.hpp] 17905 17906 17907[endsect] 17908 17909 17910 17911[section:executor_type basic_raw_socket::executor_type] 17912 17913[indexterm2 boost_asio.indexterm.basic_raw_socket.executor_type..executor_type..basic_raw_socket] 17914The type of the executor associated with the object. 17915 17916 17917 typedef Executor executor_type; 17918 17919 17920 17921[heading Requirements] 17922 17923['Header: ][^boost/asio/basic_raw_socket.hpp] 17924 17925['Convenience header: ][^boost/asio.hpp] 17926 17927 17928[endsect] 17929 17930 17931 17932[section:get_executor basic_raw_socket::get_executor] 17933 17934 17935['Inherited from basic_socket.] 17936 17937[indexterm2 boost_asio.indexterm.basic_raw_socket.get_executor..get_executor..basic_raw_socket] 17938Get the executor associated with the object. 17939 17940 17941 executor_type get_executor(); 17942 17943 17944 17945[endsect] 17946 17947 17948[section:get_option basic_raw_socket::get_option] 17949 17950[indexterm2 boost_asio.indexterm.basic_raw_socket.get_option..get_option..basic_raw_socket] 17951Get an option from the socket. 17952 17953 17954 template< 17955 typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``> 17956 void ``[link boost_asio.reference.basic_raw_socket.get_option.overload1 get_option]``( 17957 GettableSocketOption & option) const; 17958 `` [''''»''' [link boost_asio.reference.basic_raw_socket.get_option.overload1 more...]]`` 17959 17960 template< 17961 typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``> 17962 void ``[link boost_asio.reference.basic_raw_socket.get_option.overload2 get_option]``( 17963 GettableSocketOption & option, 17964 boost::system::error_code & ec) const; 17965 `` [''''»''' [link boost_asio.reference.basic_raw_socket.get_option.overload2 more...]]`` 17966 17967 17968[section:overload1 basic_raw_socket::get_option (1 of 2 overloads)] 17969 17970 17971['Inherited from basic_socket.] 17972 17973 17974Get an option from the socket. 17975 17976 17977 template< 17978 typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``> 17979 void get_option( 17980 GettableSocketOption & option) const; 17981 17982 17983This function is used to get the current value of an option on the socket. 17984 17985 17986[heading Parameters] 17987 17988 17989[variablelist 17990 17991[[option][The option value to be obtained from the socket.]] 17992 17993] 17994 17995 17996[heading Exceptions] 17997 17998 17999[variablelist 18000 18001[[boost::system::system_error][Thrown on failure.]] 18002 18003] 18004 18005 18006 18007[heading Example] 18008 18009Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option: 18010 18011 boost::asio::ip::tcp::socket socket(my_context); 18012 ... 18013 boost::asio::ip::tcp::socket::keep_alive option; 18014 socket.get_option(option); 18015 bool is_set = option.value(); 18016 18017 18018 18019 18020 18021 18022 18023[endsect] 18024 18025 18026 18027[section:overload2 basic_raw_socket::get_option (2 of 2 overloads)] 18028 18029 18030['Inherited from basic_socket.] 18031 18032 18033Get an option from the socket. 18034 18035 18036 template< 18037 typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``> 18038 void get_option( 18039 GettableSocketOption & option, 18040 boost::system::error_code & ec) const; 18041 18042 18043This function is used to get the current value of an option on the socket. 18044 18045 18046[heading Parameters] 18047 18048 18049[variablelist 18050 18051[[option][The option value to be obtained from the socket.]] 18052 18053[[ec][Set to indicate what error occurred, if any.]] 18054 18055] 18056 18057 18058 18059[heading Example] 18060 18061Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option: 18062 18063 boost::asio::ip::tcp::socket socket(my_context); 18064 ... 18065 boost::asio::ip::tcp::socket::keep_alive option; 18066 boost::system::error_code ec; 18067 socket.get_option(option, ec); 18068 if (ec) 18069 { 18070 // An error occurred. 18071 } 18072 bool is_set = option.value(); 18073 18074 18075 18076 18077 18078 18079 18080[endsect] 18081 18082 18083[endsect] 18084 18085[section:io_control basic_raw_socket::io_control] 18086 18087[indexterm2 boost_asio.indexterm.basic_raw_socket.io_control..io_control..basic_raw_socket] 18088Perform an IO control command on the socket. 18089 18090 18091 template< 18092 typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> 18093 void ``[link boost_asio.reference.basic_raw_socket.io_control.overload1 io_control]``( 18094 IoControlCommand & command); 18095 `` [''''»''' [link boost_asio.reference.basic_raw_socket.io_control.overload1 more...]]`` 18096 18097 template< 18098 typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> 18099 void ``[link boost_asio.reference.basic_raw_socket.io_control.overload2 io_control]``( 18100 IoControlCommand & command, 18101 boost::system::error_code & ec); 18102 `` [''''»''' [link boost_asio.reference.basic_raw_socket.io_control.overload2 more...]]`` 18103 18104 18105[section:overload1 basic_raw_socket::io_control (1 of 2 overloads)] 18106 18107 18108['Inherited from basic_socket.] 18109 18110 18111Perform an IO control command on the socket. 18112 18113 18114 template< 18115 typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> 18116 void io_control( 18117 IoControlCommand & command); 18118 18119 18120This function is used to execute an IO control command on the socket. 18121 18122 18123[heading Parameters] 18124 18125 18126[variablelist 18127 18128[[command][The IO control command to be performed on the socket.]] 18129 18130] 18131 18132 18133[heading Exceptions] 18134 18135 18136[variablelist 18137 18138[[boost::system::system_error][Thrown on failure.]] 18139 18140] 18141 18142 18143 18144[heading Example] 18145 18146Getting the number of bytes ready to read: 18147 18148 boost::asio::ip::tcp::socket socket(my_context); 18149 ... 18150 boost::asio::ip::tcp::socket::bytes_readable command; 18151 socket.io_control(command); 18152 std::size_t bytes_readable = command.get(); 18153 18154 18155 18156 18157 18158 18159 18160[endsect] 18161 18162 18163 18164[section:overload2 basic_raw_socket::io_control (2 of 2 overloads)] 18165 18166 18167['Inherited from basic_socket.] 18168 18169 18170Perform an IO control command on the socket. 18171 18172 18173 template< 18174 typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> 18175 void io_control( 18176 IoControlCommand & command, 18177 boost::system::error_code & ec); 18178 18179 18180This function is used to execute an IO control command on the socket. 18181 18182 18183[heading Parameters] 18184 18185 18186[variablelist 18187 18188[[command][The IO control command to be performed on the socket.]] 18189 18190[[ec][Set to indicate what error occurred, if any.]] 18191 18192] 18193 18194 18195 18196[heading Example] 18197 18198Getting the number of bytes ready to read: 18199 18200 boost::asio::ip::tcp::socket socket(my_context); 18201 ... 18202 boost::asio::ip::tcp::socket::bytes_readable command; 18203 boost::system::error_code ec; 18204 socket.io_control(command, ec); 18205 if (ec) 18206 { 18207 // An error occurred. 18208 } 18209 std::size_t bytes_readable = command.get(); 18210 18211 18212 18213 18214 18215 18216 18217[endsect] 18218 18219 18220[endsect] 18221 18222 18223[section:is_open basic_raw_socket::is_open] 18224 18225 18226['Inherited from basic_socket.] 18227 18228[indexterm2 boost_asio.indexterm.basic_raw_socket.is_open..is_open..basic_raw_socket] 18229Determine whether the socket is open. 18230 18231 18232 bool is_open() const; 18233 18234 18235 18236[endsect] 18237 18238 18239 18240[section:keep_alive basic_raw_socket::keep_alive] 18241 18242 18243['Inherited from socket_base.] 18244 18245[indexterm2 boost_asio.indexterm.basic_raw_socket.keep_alive..keep_alive..basic_raw_socket] 18246Socket option to send keep-alives. 18247 18248 18249 typedef implementation_defined keep_alive; 18250 18251 18252 18253Implements the SOL\_SOCKET/SO\_KEEPALIVE socket option. 18254 18255 18256[heading Examples] 18257 18258Setting the option: 18259 18260 boost::asio::ip::tcp::socket socket(my_context); 18261 ... 18262 boost::asio::socket_base::keep_alive option(true); 18263 socket.set_option(option); 18264 18265 18266 18267 18268 18269Getting the current option value: 18270 18271 boost::asio::ip::tcp::socket socket(my_context); 18272 ... 18273 boost::asio::socket_base::keep_alive option; 18274 socket.get_option(option); 18275 bool is_set = option.value(); 18276 18277 18278 18279 18280 18281 18282 18283[heading Requirements] 18284 18285['Header: ][^boost/asio/basic_raw_socket.hpp] 18286 18287['Convenience header: ][^boost/asio.hpp] 18288 18289 18290[endsect] 18291 18292 18293 18294[section:linger basic_raw_socket::linger] 18295 18296 18297['Inherited from socket_base.] 18298 18299[indexterm2 boost_asio.indexterm.basic_raw_socket.linger..linger..basic_raw_socket] 18300Socket option to specify whether the socket lingers on close if unsent data is present. 18301 18302 18303 typedef implementation_defined linger; 18304 18305 18306 18307Implements the SOL\_SOCKET/SO\_LINGER socket option. 18308 18309 18310[heading Examples] 18311 18312Setting the option: 18313 18314 boost::asio::ip::tcp::socket socket(my_context); 18315 ... 18316 boost::asio::socket_base::linger option(true, 30); 18317 socket.set_option(option); 18318 18319 18320 18321 18322 18323Getting the current option value: 18324 18325 boost::asio::ip::tcp::socket socket(my_context); 18326 ... 18327 boost::asio::socket_base::linger option; 18328 socket.get_option(option); 18329 bool is_set = option.enabled(); 18330 unsigned short timeout = option.timeout(); 18331 18332 18333 18334 18335 18336 18337 18338[heading Requirements] 18339 18340['Header: ][^boost/asio/basic_raw_socket.hpp] 18341 18342['Convenience header: ][^boost/asio.hpp] 18343 18344 18345[endsect] 18346 18347 18348[section:local_endpoint basic_raw_socket::local_endpoint] 18349 18350[indexterm2 boost_asio.indexterm.basic_raw_socket.local_endpoint..local_endpoint..basic_raw_socket] 18351Get the local endpoint of the socket. 18352 18353 18354 endpoint_type ``[link boost_asio.reference.basic_raw_socket.local_endpoint.overload1 local_endpoint]``() const; 18355 `` [''''»''' [link boost_asio.reference.basic_raw_socket.local_endpoint.overload1 more...]]`` 18356 18357 endpoint_type ``[link boost_asio.reference.basic_raw_socket.local_endpoint.overload2 local_endpoint]``( 18358 boost::system::error_code & ec) const; 18359 `` [''''»''' [link boost_asio.reference.basic_raw_socket.local_endpoint.overload2 more...]]`` 18360 18361 18362[section:overload1 basic_raw_socket::local_endpoint (1 of 2 overloads)] 18363 18364 18365['Inherited from basic_socket.] 18366 18367 18368Get the local endpoint of the socket. 18369 18370 18371 endpoint_type local_endpoint() const; 18372 18373 18374This function is used to obtain the locally bound endpoint of the socket. 18375 18376 18377[heading Return Value] 18378 18379An object that represents the local endpoint of the socket. 18380 18381 18382[heading Exceptions] 18383 18384 18385[variablelist 18386 18387[[boost::system::system_error][Thrown on failure.]] 18388 18389] 18390 18391 18392[heading Example] 18393 18394 18395 18396 boost::asio::ip::tcp::socket socket(my_context); 18397 ... 18398 boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint(); 18399 18400 18401 18402 18403 18404 18405 18406[endsect] 18407 18408 18409 18410[section:overload2 basic_raw_socket::local_endpoint (2 of 2 overloads)] 18411 18412 18413['Inherited from basic_socket.] 18414 18415 18416Get the local endpoint of the socket. 18417 18418 18419 endpoint_type local_endpoint( 18420 boost::system::error_code & ec) const; 18421 18422 18423This function is used to obtain the locally bound endpoint of the socket. 18424 18425 18426[heading Parameters] 18427 18428 18429[variablelist 18430 18431[[ec][Set to indicate what error occurred, if any.]] 18432 18433] 18434 18435 18436[heading Return Value] 18437 18438An object that represents the local endpoint of the socket. Returns a default-constructed endpoint object if an error occurred. 18439 18440 18441[heading Example] 18442 18443 18444 18445 boost::asio::ip::tcp::socket socket(my_context); 18446 ... 18447 boost::system::error_code ec; 18448 boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint(ec); 18449 if (ec) 18450 { 18451 // An error occurred. 18452 } 18453 18454 18455 18456 18457 18458 18459 18460[endsect] 18461 18462 18463[endsect] 18464 18465[section:lowest_layer basic_raw_socket::lowest_layer] 18466 18467[indexterm2 boost_asio.indexterm.basic_raw_socket.lowest_layer..lowest_layer..basic_raw_socket] 18468Get a reference to the lowest layer. 18469 18470 18471 lowest_layer_type & ``[link boost_asio.reference.basic_raw_socket.lowest_layer.overload1 lowest_layer]``(); 18472 `` [''''»''' [link boost_asio.reference.basic_raw_socket.lowest_layer.overload1 more...]]`` 18473 18474 18475Get a const reference to the lowest layer. 18476 18477 18478 const lowest_layer_type & ``[link boost_asio.reference.basic_raw_socket.lowest_layer.overload2 lowest_layer]``() const; 18479 `` [''''»''' [link boost_asio.reference.basic_raw_socket.lowest_layer.overload2 more...]]`` 18480 18481 18482[section:overload1 basic_raw_socket::lowest_layer (1 of 2 overloads)] 18483 18484 18485['Inherited from basic_socket.] 18486 18487 18488Get a reference to the lowest layer. 18489 18490 18491 lowest_layer_type & lowest_layer(); 18492 18493 18494This 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. 18495 18496 18497[heading Return Value] 18498 18499A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 18500 18501 18502 18503 18504[endsect] 18505 18506 18507 18508[section:overload2 basic_raw_socket::lowest_layer (2 of 2 overloads)] 18509 18510 18511['Inherited from basic_socket.] 18512 18513 18514Get a const reference to the lowest layer. 18515 18516 18517 const lowest_layer_type & lowest_layer() const; 18518 18519 18520This 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. 18521 18522 18523[heading Return Value] 18524 18525A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 18526 18527 18528 18529 18530[endsect] 18531 18532 18533[endsect] 18534 18535 18536[section:lowest_layer_type basic_raw_socket::lowest_layer_type] 18537 18538 18539['Inherited from basic_socket.] 18540 18541[indexterm2 boost_asio.indexterm.basic_raw_socket.lowest_layer_type..lowest_layer_type..basic_raw_socket] 18542A [link boost_asio.reference.basic_socket `basic_socket`] is always the lowest layer. 18543 18544 18545 typedef basic_socket< Protocol, Executor > lowest_layer_type; 18546 18547 18548[heading Types] 18549[table 18550 [[Name][Description]] 18551 18552 [ 18553 18554 [[link boost_asio.reference.basic_socket__rebind_executor [*rebind_executor]]] 18555 [Rebinds the socket type to another executor. ] 18556 18557 ] 18558 18559 [ 18560 18561 [[link boost_asio.reference.basic_socket.broadcast [*broadcast]]] 18562 [Socket option to permit sending of broadcast messages. ] 18563 18564 ] 18565 18566 [ 18567 18568 [[link boost_asio.reference.basic_socket.bytes_readable [*bytes_readable]]] 18569 [IO control command to get the amount of data that can be read without blocking. ] 18570 18571 ] 18572 18573 [ 18574 18575 [[link boost_asio.reference.basic_socket.debug [*debug]]] 18576 [Socket option to enable socket-level debugging. ] 18577 18578 ] 18579 18580 [ 18581 18582 [[link boost_asio.reference.basic_socket.do_not_route [*do_not_route]]] 18583 [Socket option to prevent routing, use local interfaces only. ] 18584 18585 ] 18586 18587 [ 18588 18589 [[link boost_asio.reference.basic_socket.enable_connection_aborted [*enable_connection_aborted]]] 18590 [Socket option to report aborted connections on accept. ] 18591 18592 ] 18593 18594 [ 18595 18596 [[link boost_asio.reference.basic_socket.endpoint_type [*endpoint_type]]] 18597 [The endpoint type. ] 18598 18599 ] 18600 18601 [ 18602 18603 [[link boost_asio.reference.basic_socket.executor_type [*executor_type]]] 18604 [The type of the executor associated with the object. ] 18605 18606 ] 18607 18608 [ 18609 18610 [[link boost_asio.reference.basic_socket.keep_alive [*keep_alive]]] 18611 [Socket option to send keep-alives. ] 18612 18613 ] 18614 18615 [ 18616 18617 [[link boost_asio.reference.basic_socket.linger [*linger]]] 18618 [Socket option to specify whether the socket lingers on close if unsent data is present. ] 18619 18620 ] 18621 18622 [ 18623 18624 [[link boost_asio.reference.basic_socket.lowest_layer_type [*lowest_layer_type]]] 18625 [A basic_socket is always the lowest layer. ] 18626 18627 ] 18628 18629 [ 18630 18631 [[link boost_asio.reference.basic_socket.message_flags [*message_flags]]] 18632 [Bitmask type for flags that can be passed to send and receive operations. ] 18633 18634 ] 18635 18636 [ 18637 18638 [[link boost_asio.reference.basic_socket.native_handle_type [*native_handle_type]]] 18639 [The native representation of a socket. ] 18640 18641 ] 18642 18643 [ 18644 18645 [[link boost_asio.reference.basic_socket.out_of_band_inline [*out_of_band_inline]]] 18646 [Socket option for putting received out-of-band data inline. ] 18647 18648 ] 18649 18650 [ 18651 18652 [[link boost_asio.reference.basic_socket.protocol_type [*protocol_type]]] 18653 [The protocol type. ] 18654 18655 ] 18656 18657 [ 18658 18659 [[link boost_asio.reference.basic_socket.receive_buffer_size [*receive_buffer_size]]] 18660 [Socket option for the receive buffer size of a socket. ] 18661 18662 ] 18663 18664 [ 18665 18666 [[link boost_asio.reference.basic_socket.receive_low_watermark [*receive_low_watermark]]] 18667 [Socket option for the receive low watermark. ] 18668 18669 ] 18670 18671 [ 18672 18673 [[link boost_asio.reference.basic_socket.reuse_address [*reuse_address]]] 18674 [Socket option to allow the socket to be bound to an address that is already in use. ] 18675 18676 ] 18677 18678 [ 18679 18680 [[link boost_asio.reference.basic_socket.send_buffer_size [*send_buffer_size]]] 18681 [Socket option for the send buffer size of a socket. ] 18682 18683 ] 18684 18685 [ 18686 18687 [[link boost_asio.reference.basic_socket.send_low_watermark [*send_low_watermark]]] 18688 [Socket option for the send low watermark. ] 18689 18690 ] 18691 18692 [ 18693 18694 [[link boost_asio.reference.basic_socket.shutdown_type [*shutdown_type]]] 18695 [Different ways a socket may be shutdown. ] 18696 18697 ] 18698 18699 [ 18700 18701 [[link boost_asio.reference.basic_socket.wait_type [*wait_type]]] 18702 [Wait types. ] 18703 18704 ] 18705 18706] 18707 18708[heading Member Functions] 18709[table 18710 [[Name][Description]] 18711 18712 [ 18713 [[link boost_asio.reference.basic_socket.assign [*assign]]] 18714 [Assign an existing native socket to the socket. ] 18715 ] 18716 18717 [ 18718 [[link boost_asio.reference.basic_socket.async_connect [*async_connect]]] 18719 [Start an asynchronous connect. ] 18720 ] 18721 18722 [ 18723 [[link boost_asio.reference.basic_socket.async_wait [*async_wait]]] 18724 [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 18725 ] 18726 18727 [ 18728 [[link boost_asio.reference.basic_socket.at_mark [*at_mark]]] 18729 [Determine whether the socket is at the out-of-band data mark. ] 18730 ] 18731 18732 [ 18733 [[link boost_asio.reference.basic_socket.available [*available]]] 18734 [Determine the number of bytes available for reading. ] 18735 ] 18736 18737 [ 18738 [[link boost_asio.reference.basic_socket.basic_socket [*basic_socket]] [constructor]] 18739 [Construct a basic_socket without opening it. 18740 [hr] 18741 Construct and open a basic_socket. 18742 [hr] 18743 Construct a basic_socket, opening it and binding it to the given local endpoint. 18744 [hr] 18745 Construct a basic_socket on an existing native socket. 18746 [hr] 18747 Move-construct a basic_socket from another. 18748 [hr] 18749 Move-construct a basic_socket from a socket of another protocol type. ] 18750 ] 18751 18752 [ 18753 [[link boost_asio.reference.basic_socket.bind [*bind]]] 18754 [Bind the socket to the given local endpoint. ] 18755 ] 18756 18757 [ 18758 [[link boost_asio.reference.basic_socket.cancel [*cancel]]] 18759 [Cancel all asynchronous operations associated with the socket. ] 18760 ] 18761 18762 [ 18763 [[link boost_asio.reference.basic_socket.close [*close]]] 18764 [Close the socket. ] 18765 ] 18766 18767 [ 18768 [[link boost_asio.reference.basic_socket.connect [*connect]]] 18769 [Connect the socket to the specified endpoint. ] 18770 ] 18771 18772 [ 18773 [[link boost_asio.reference.basic_socket.get_executor [*get_executor]]] 18774 [Get the executor associated with the object. ] 18775 ] 18776 18777 [ 18778 [[link boost_asio.reference.basic_socket.get_option [*get_option]]] 18779 [Get an option from the socket. ] 18780 ] 18781 18782 [ 18783 [[link boost_asio.reference.basic_socket.io_control [*io_control]]] 18784 [Perform an IO control command on the socket. ] 18785 ] 18786 18787 [ 18788 [[link boost_asio.reference.basic_socket.is_open [*is_open]]] 18789 [Determine whether the socket is open. ] 18790 ] 18791 18792 [ 18793 [[link boost_asio.reference.basic_socket.local_endpoint [*local_endpoint]]] 18794 [Get the local endpoint of the socket. ] 18795 ] 18796 18797 [ 18798 [[link boost_asio.reference.basic_socket.lowest_layer [*lowest_layer]]] 18799 [Get a reference to the lowest layer. 18800 [hr] 18801 Get a const reference to the lowest layer. ] 18802 ] 18803 18804 [ 18805 [[link boost_asio.reference.basic_socket.native_handle [*native_handle]]] 18806 [Get the native socket representation. ] 18807 ] 18808 18809 [ 18810 [[link boost_asio.reference.basic_socket.native_non_blocking [*native_non_blocking]]] 18811 [Gets the non-blocking mode of the native socket implementation. 18812 [hr] 18813 Sets the non-blocking mode of the native socket implementation. ] 18814 ] 18815 18816 [ 18817 [[link boost_asio.reference.basic_socket.non_blocking [*non_blocking]]] 18818 [Gets the non-blocking mode of the socket. 18819 [hr] 18820 Sets the non-blocking mode of the socket. ] 18821 ] 18822 18823 [ 18824 [[link boost_asio.reference.basic_socket.open [*open]]] 18825 [Open the socket using the specified protocol. ] 18826 ] 18827 18828 [ 18829 [[link boost_asio.reference.basic_socket.operator_eq_ [*operator=]]] 18830 [Move-assign a basic_socket from another. 18831 [hr] 18832 Move-assign a basic_socket from a socket of another protocol type. ] 18833 ] 18834 18835 [ 18836 [[link boost_asio.reference.basic_socket.release [*release]]] 18837 [Release ownership of the underlying native socket. ] 18838 ] 18839 18840 [ 18841 [[link boost_asio.reference.basic_socket.remote_endpoint [*remote_endpoint]]] 18842 [Get the remote endpoint of the socket. ] 18843 ] 18844 18845 [ 18846 [[link boost_asio.reference.basic_socket.set_option [*set_option]]] 18847 [Set an option on the socket. ] 18848 ] 18849 18850 [ 18851 [[link boost_asio.reference.basic_socket.shutdown [*shutdown]]] 18852 [Disable sends or receives on the socket. ] 18853 ] 18854 18855 [ 18856 [[link boost_asio.reference.basic_socket.wait [*wait]]] 18857 [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 18858 ] 18859 18860] 18861 18862[heading Protected Member Functions] 18863[table 18864 [[Name][Description]] 18865 18866 [ 18867 [[link boost_asio.reference.basic_socket._basic_socket [*~basic_socket]] [destructor]] 18868 [Protected destructor to prevent deletion through this type. ] 18869 ] 18870 18871] 18872 18873[heading Data Members] 18874[table 18875 [[Name][Description]] 18876 18877 [ 18878 [[link boost_asio.reference.basic_socket.max_connections [*max_connections]] [static]] 18879 [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ] 18880 ] 18881 18882 [ 18883 [[link boost_asio.reference.basic_socket.max_listen_connections [*max_listen_connections]] [static]] 18884 [The maximum length of the queue of pending incoming connections. ] 18885 ] 18886 18887 [ 18888 [[link boost_asio.reference.basic_socket.message_do_not_route [*message_do_not_route]] [static]] 18889 [Specify that the data should not be subject to routing. ] 18890 ] 18891 18892 [ 18893 [[link boost_asio.reference.basic_socket.message_end_of_record [*message_end_of_record]] [static]] 18894 [Specifies that the data marks the end of a record. ] 18895 ] 18896 18897 [ 18898 [[link boost_asio.reference.basic_socket.message_out_of_band [*message_out_of_band]] [static]] 18899 [Process out-of-band data. ] 18900 ] 18901 18902 [ 18903 [[link boost_asio.reference.basic_socket.message_peek [*message_peek]] [static]] 18904 [Peek at incoming data without removing it from the input queue. ] 18905 ] 18906 18907] 18908 18909The [link boost_asio.reference.basic_socket `basic_socket`] class template provides functionality that is common to both stream-oriented and datagram-oriented sockets. 18910 18911 18912[heading Thread Safety] 18913 18914['Distinct] ['objects:] Safe. 18915 18916['Shared] ['objects:] Unsafe. 18917 18918 18919 18920 18921[heading Requirements] 18922 18923['Header: ][^boost/asio/basic_raw_socket.hpp] 18924 18925['Convenience header: ][^boost/asio.hpp] 18926 18927 18928[endsect] 18929 18930 18931 18932[section:max_connections basic_raw_socket::max_connections] 18933 18934 18935['Inherited from socket_base.] 18936 18937[indexterm2 boost_asio.indexterm.basic_raw_socket.max_connections..max_connections..basic_raw_socket] 18938(Deprecated: Use max\_listen\_connections.) The maximum length of the queue of pending incoming connections. 18939 18940 18941 static const int max_connections = implementation_defined; 18942 18943 18944 18945[endsect] 18946 18947 18948 18949[section:max_listen_connections basic_raw_socket::max_listen_connections] 18950 18951 18952['Inherited from socket_base.] 18953 18954[indexterm2 boost_asio.indexterm.basic_raw_socket.max_listen_connections..max_listen_connections..basic_raw_socket] 18955The maximum length of the queue of pending incoming connections. 18956 18957 18958 static const int max_listen_connections = implementation_defined; 18959 18960 18961 18962[endsect] 18963 18964 18965 18966[section:message_do_not_route basic_raw_socket::message_do_not_route] 18967 18968 18969['Inherited from socket_base.] 18970 18971[indexterm2 boost_asio.indexterm.basic_raw_socket.message_do_not_route..message_do_not_route..basic_raw_socket] 18972Specify that the data should not be subject to routing. 18973 18974 18975 static const int message_do_not_route = implementation_defined; 18976 18977 18978 18979[endsect] 18980 18981 18982 18983[section:message_end_of_record basic_raw_socket::message_end_of_record] 18984 18985 18986['Inherited from socket_base.] 18987 18988[indexterm2 boost_asio.indexterm.basic_raw_socket.message_end_of_record..message_end_of_record..basic_raw_socket] 18989Specifies that the data marks the end of a record. 18990 18991 18992 static const int message_end_of_record = implementation_defined; 18993 18994 18995 18996[endsect] 18997 18998 18999 19000[section:message_flags basic_raw_socket::message_flags] 19001 19002 19003['Inherited from socket_base.] 19004 19005[indexterm2 boost_asio.indexterm.basic_raw_socket.message_flags..message_flags..basic_raw_socket] 19006Bitmask type for flags that can be passed to send and receive operations. 19007 19008 19009 typedef int message_flags; 19010 19011 19012 19013[heading Requirements] 19014 19015['Header: ][^boost/asio/basic_raw_socket.hpp] 19016 19017['Convenience header: ][^boost/asio.hpp] 19018 19019 19020[endsect] 19021 19022 19023 19024[section:message_out_of_band basic_raw_socket::message_out_of_band] 19025 19026 19027['Inherited from socket_base.] 19028 19029[indexterm2 boost_asio.indexterm.basic_raw_socket.message_out_of_band..message_out_of_band..basic_raw_socket] 19030Process out-of-band data. 19031 19032 19033 static const int message_out_of_band = implementation_defined; 19034 19035 19036 19037[endsect] 19038 19039 19040 19041[section:message_peek basic_raw_socket::message_peek] 19042 19043 19044['Inherited from socket_base.] 19045 19046[indexterm2 boost_asio.indexterm.basic_raw_socket.message_peek..message_peek..basic_raw_socket] 19047Peek at incoming data without removing it from the input queue. 19048 19049 19050 static const int message_peek = implementation_defined; 19051 19052 19053 19054[endsect] 19055 19056 19057 19058[section:native_handle basic_raw_socket::native_handle] 19059 19060 19061['Inherited from basic_socket.] 19062 19063[indexterm2 boost_asio.indexterm.basic_raw_socket.native_handle..native_handle..basic_raw_socket] 19064Get the native socket representation. 19065 19066 19067 native_handle_type native_handle(); 19068 19069 19070This 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. 19071 19072 19073[endsect] 19074 19075 19076 19077[section:native_handle_type basic_raw_socket::native_handle_type] 19078 19079[indexterm2 boost_asio.indexterm.basic_raw_socket.native_handle_type..native_handle_type..basic_raw_socket] 19080The native representation of a socket. 19081 19082 19083 typedef implementation_defined native_handle_type; 19084 19085 19086 19087[heading Requirements] 19088 19089['Header: ][^boost/asio/basic_raw_socket.hpp] 19090 19091['Convenience header: ][^boost/asio.hpp] 19092 19093 19094[endsect] 19095 19096 19097[section:native_non_blocking basic_raw_socket::native_non_blocking] 19098 19099[indexterm2 boost_asio.indexterm.basic_raw_socket.native_non_blocking..native_non_blocking..basic_raw_socket] 19100Gets the non-blocking mode of the native socket implementation. 19101 19102 19103 bool ``[link boost_asio.reference.basic_raw_socket.native_non_blocking.overload1 native_non_blocking]``() const; 19104 `` [''''»''' [link boost_asio.reference.basic_raw_socket.native_non_blocking.overload1 more...]]`` 19105 19106 19107Sets the non-blocking mode of the native socket implementation. 19108 19109 19110 void ``[link boost_asio.reference.basic_raw_socket.native_non_blocking.overload2 native_non_blocking]``( 19111 bool mode); 19112 `` [''''»''' [link boost_asio.reference.basic_raw_socket.native_non_blocking.overload2 more...]]`` 19113 19114 void ``[link boost_asio.reference.basic_raw_socket.native_non_blocking.overload3 native_non_blocking]``( 19115 bool mode, 19116 boost::system::error_code & ec); 19117 `` [''''»''' [link boost_asio.reference.basic_raw_socket.native_non_blocking.overload3 more...]]`` 19118 19119 19120[section:overload1 basic_raw_socket::native_non_blocking (1 of 3 overloads)] 19121 19122 19123['Inherited from basic_socket.] 19124 19125 19126Gets the non-blocking mode of the native socket implementation. 19127 19128 19129 bool native_non_blocking() const; 19130 19131 19132This 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. 19133 19134 19135[heading Return Value] 19136 19137`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). 19138 19139 19140[heading Remarks] 19141 19142The 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. 19143 19144 19145[heading Example] 19146 19147This 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: 19148 19149 template <typename Handler> 19150 struct sendfile_op 19151 { 19152 tcp::socket& sock_; 19153 int fd_; 19154 Handler handler_; 19155 off_t offset_; 19156 std::size_t total_bytes_transferred_; 19157 19158 // Function call operator meeting WriteHandler requirements. 19159 // Used as the handler for the async_write_some operation. 19160 void operator()(boost::system::error_code ec, std::size_t) 19161 { 19162 // Put the underlying socket into non-blocking mode. 19163 if (!ec) 19164 if (!sock_.native_non_blocking()) 19165 sock_.native_non_blocking(true, ec); 19166 19167 if (!ec) 19168 { 19169 for (;;) 19170 { 19171 // Try the system call. 19172 errno = 0; 19173 int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536); 19174 ec = boost::system::error_code(n < 0 ? errno : 0, 19175 boost::asio::error::get_system_category()); 19176 total_bytes_transferred_ += ec ? 0 : n; 19177 19178 // Retry operation immediately if interrupted by signal. 19179 if (ec == boost::asio::error::interrupted) 19180 continue; 19181 19182 // Check if we need to run the operation again. 19183 if (ec == boost::asio::error::would_block 19184 || ec == boost::asio::error::try_again) 19185 { 19186 // We have to wait for the socket to become ready again. 19187 sock_.async_wait(tcp::socket::wait_write, *this); 19188 return; 19189 } 19190 19191 if (ec || n == 0) 19192 { 19193 // An error occurred, or we have reached the end of the file. 19194 // Either way we must exit the loop so we can call the handler. 19195 break; 19196 } 19197 19198 // Loop around to try calling sendfile again. 19199 } 19200 } 19201 19202 // Pass result back to user's handler. 19203 handler_(ec, total_bytes_transferred_); 19204 } 19205 }; 19206 19207 template <typename Handler> 19208 void async_sendfile(tcp::socket& sock, int fd, Handler h) 19209 { 19210 sendfile_op<Handler> op = { sock, fd, h, 0, 0 }; 19211 sock.async_wait(tcp::socket::wait_write, op); 19212 } 19213 19214 19215 19216 19217 19218 19219 19220[endsect] 19221 19222 19223 19224[section:overload2 basic_raw_socket::native_non_blocking (2 of 3 overloads)] 19225 19226 19227['Inherited from basic_socket.] 19228 19229 19230Sets the non-blocking mode of the native socket implementation. 19231 19232 19233 void native_non_blocking( 19234 bool mode); 19235 19236 19237This 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. 19238 19239 19240[heading Parameters] 19241 19242 19243[variablelist 19244 19245[[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).]] 19246 19247] 19248 19249 19250[heading Exceptions] 19251 19252 19253[variablelist 19254 19255[[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.]] 19256 19257] 19258 19259 19260[heading Example] 19261 19262This 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: 19263 19264 template <typename Handler> 19265 struct sendfile_op 19266 { 19267 tcp::socket& sock_; 19268 int fd_; 19269 Handler handler_; 19270 off_t offset_; 19271 std::size_t total_bytes_transferred_; 19272 19273 // Function call operator meeting WriteHandler requirements. 19274 // Used as the handler for the async_write_some operation. 19275 void operator()(boost::system::error_code ec, std::size_t) 19276 { 19277 // Put the underlying socket into non-blocking mode. 19278 if (!ec) 19279 if (!sock_.native_non_blocking()) 19280 sock_.native_non_blocking(true, ec); 19281 19282 if (!ec) 19283 { 19284 for (;;) 19285 { 19286 // Try the system call. 19287 errno = 0; 19288 int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536); 19289 ec = boost::system::error_code(n < 0 ? errno : 0, 19290 boost::asio::error::get_system_category()); 19291 total_bytes_transferred_ += ec ? 0 : n; 19292 19293 // Retry operation immediately if interrupted by signal. 19294 if (ec == boost::asio::error::interrupted) 19295 continue; 19296 19297 // Check if we need to run the operation again. 19298 if (ec == boost::asio::error::would_block 19299 || ec == boost::asio::error::try_again) 19300 { 19301 // We have to wait for the socket to become ready again. 19302 sock_.async_wait(tcp::socket::wait_write, *this); 19303 return; 19304 } 19305 19306 if (ec || n == 0) 19307 { 19308 // An error occurred, or we have reached the end of the file. 19309 // Either way we must exit the loop so we can call the handler. 19310 break; 19311 } 19312 19313 // Loop around to try calling sendfile again. 19314 } 19315 } 19316 19317 // Pass result back to user's handler. 19318 handler_(ec, total_bytes_transferred_); 19319 } 19320 }; 19321 19322 template <typename Handler> 19323 void async_sendfile(tcp::socket& sock, int fd, Handler h) 19324 { 19325 sendfile_op<Handler> op = { sock, fd, h, 0, 0 }; 19326 sock.async_wait(tcp::socket::wait_write, op); 19327 } 19328 19329 19330 19331 19332 19333 19334 19335[endsect] 19336 19337 19338 19339[section:overload3 basic_raw_socket::native_non_blocking (3 of 3 overloads)] 19340 19341 19342['Inherited from basic_socket.] 19343 19344 19345Sets the non-blocking mode of the native socket implementation. 19346 19347 19348 void native_non_blocking( 19349 bool mode, 19350 boost::system::error_code & ec); 19351 19352 19353This 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. 19354 19355 19356[heading Parameters] 19357 19358 19359[variablelist 19360 19361[[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).]] 19362 19363[[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.]] 19364 19365] 19366 19367 19368[heading Example] 19369 19370This 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: 19371 19372 template <typename Handler> 19373 struct sendfile_op 19374 { 19375 tcp::socket& sock_; 19376 int fd_; 19377 Handler handler_; 19378 off_t offset_; 19379 std::size_t total_bytes_transferred_; 19380 19381 // Function call operator meeting WriteHandler requirements. 19382 // Used as the handler for the async_write_some operation. 19383 void operator()(boost::system::error_code ec, std::size_t) 19384 { 19385 // Put the underlying socket into non-blocking mode. 19386 if (!ec) 19387 if (!sock_.native_non_blocking()) 19388 sock_.native_non_blocking(true, ec); 19389 19390 if (!ec) 19391 { 19392 for (;;) 19393 { 19394 // Try the system call. 19395 errno = 0; 19396 int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536); 19397 ec = boost::system::error_code(n < 0 ? errno : 0, 19398 boost::asio::error::get_system_category()); 19399 total_bytes_transferred_ += ec ? 0 : n; 19400 19401 // Retry operation immediately if interrupted by signal. 19402 if (ec == boost::asio::error::interrupted) 19403 continue; 19404 19405 // Check if we need to run the operation again. 19406 if (ec == boost::asio::error::would_block 19407 || ec == boost::asio::error::try_again) 19408 { 19409 // We have to wait for the socket to become ready again. 19410 sock_.async_wait(tcp::socket::wait_write, *this); 19411 return; 19412 } 19413 19414 if (ec || n == 0) 19415 { 19416 // An error occurred, or we have reached the end of the file. 19417 // Either way we must exit the loop so we can call the handler. 19418 break; 19419 } 19420 19421 // Loop around to try calling sendfile again. 19422 } 19423 } 19424 19425 // Pass result back to user's handler. 19426 handler_(ec, total_bytes_transferred_); 19427 } 19428 }; 19429 19430 template <typename Handler> 19431 void async_sendfile(tcp::socket& sock, int fd, Handler h) 19432 { 19433 sendfile_op<Handler> op = { sock, fd, h, 0, 0 }; 19434 sock.async_wait(tcp::socket::wait_write, op); 19435 } 19436 19437 19438 19439 19440 19441 19442 19443[endsect] 19444 19445 19446[endsect] 19447 19448[section:non_blocking basic_raw_socket::non_blocking] 19449 19450[indexterm2 boost_asio.indexterm.basic_raw_socket.non_blocking..non_blocking..basic_raw_socket] 19451Gets the non-blocking mode of the socket. 19452 19453 19454 bool ``[link boost_asio.reference.basic_raw_socket.non_blocking.overload1 non_blocking]``() const; 19455 `` [''''»''' [link boost_asio.reference.basic_raw_socket.non_blocking.overload1 more...]]`` 19456 19457 19458Sets the non-blocking mode of the socket. 19459 19460 19461 void ``[link boost_asio.reference.basic_raw_socket.non_blocking.overload2 non_blocking]``( 19462 bool mode); 19463 `` [''''»''' [link boost_asio.reference.basic_raw_socket.non_blocking.overload2 more...]]`` 19464 19465 void ``[link boost_asio.reference.basic_raw_socket.non_blocking.overload3 non_blocking]``( 19466 bool mode, 19467 boost::system::error_code & ec); 19468 `` [''''»''' [link boost_asio.reference.basic_raw_socket.non_blocking.overload3 more...]]`` 19469 19470 19471[section:overload1 basic_raw_socket::non_blocking (1 of 3 overloads)] 19472 19473 19474['Inherited from basic_socket.] 19475 19476 19477Gets the non-blocking mode of the socket. 19478 19479 19480 bool non_blocking() const; 19481 19482 19483 19484[heading Return Value] 19485 19486`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. 19487 19488 19489[heading Remarks] 19490 19491The 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`. 19492 19493 19494 19495 19496[endsect] 19497 19498 19499 19500[section:overload2 basic_raw_socket::non_blocking (2 of 3 overloads)] 19501 19502 19503['Inherited from basic_socket.] 19504 19505 19506Sets the non-blocking mode of the socket. 19507 19508 19509 void non_blocking( 19510 bool mode); 19511 19512 19513 19514[heading Parameters] 19515 19516 19517[variablelist 19518 19519[[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.]] 19520 19521] 19522 19523 19524[heading Exceptions] 19525 19526 19527[variablelist 19528 19529[[boost::system::system_error][Thrown on failure.]] 19530 19531] 19532 19533 19534[heading Remarks] 19535 19536The 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`. 19537 19538 19539 19540 19541[endsect] 19542 19543 19544 19545[section:overload3 basic_raw_socket::non_blocking (3 of 3 overloads)] 19546 19547 19548['Inherited from basic_socket.] 19549 19550 19551Sets the non-blocking mode of the socket. 19552 19553 19554 void non_blocking( 19555 bool mode, 19556 boost::system::error_code & ec); 19557 19558 19559 19560[heading Parameters] 19561 19562 19563[variablelist 19564 19565[[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.]] 19566 19567[[ec][Set to indicate what error occurred, if any.]] 19568 19569] 19570 19571 19572[heading Remarks] 19573 19574The 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`. 19575 19576 19577 19578 19579[endsect] 19580 19581 19582[endsect] 19583 19584[section:open basic_raw_socket::open] 19585 19586[indexterm2 boost_asio.indexterm.basic_raw_socket.open..open..basic_raw_socket] 19587Open the socket using the specified protocol. 19588 19589 19590 void ``[link boost_asio.reference.basic_raw_socket.open.overload1 open]``( 19591 const protocol_type & protocol = protocol_type()); 19592 `` [''''»''' [link boost_asio.reference.basic_raw_socket.open.overload1 more...]]`` 19593 19594 void ``[link boost_asio.reference.basic_raw_socket.open.overload2 open]``( 19595 const protocol_type & protocol, 19596 boost::system::error_code & ec); 19597 `` [''''»''' [link boost_asio.reference.basic_raw_socket.open.overload2 more...]]`` 19598 19599 19600[section:overload1 basic_raw_socket::open (1 of 2 overloads)] 19601 19602 19603['Inherited from basic_socket.] 19604 19605 19606Open the socket using the specified protocol. 19607 19608 19609 void open( 19610 const protocol_type & protocol = protocol_type()); 19611 19612 19613This function opens the socket so that it will use the specified protocol. 19614 19615 19616[heading Parameters] 19617 19618 19619[variablelist 19620 19621[[protocol][An object specifying protocol parameters to be used.]] 19622 19623] 19624 19625 19626[heading Exceptions] 19627 19628 19629[variablelist 19630 19631[[boost::system::system_error][Thrown on failure.]] 19632 19633] 19634 19635 19636[heading Example] 19637 19638 19639 19640 boost::asio::ip::tcp::socket socket(my_context); 19641 socket.open(boost::asio::ip::tcp::v4()); 19642 19643 19644 19645 19646 19647 19648 19649[endsect] 19650 19651 19652 19653[section:overload2 basic_raw_socket::open (2 of 2 overloads)] 19654 19655 19656['Inherited from basic_socket.] 19657 19658 19659Open the socket using the specified protocol. 19660 19661 19662 void open( 19663 const protocol_type & protocol, 19664 boost::system::error_code & ec); 19665 19666 19667This function opens the socket so that it will use the specified protocol. 19668 19669 19670[heading Parameters] 19671 19672 19673[variablelist 19674 19675[[protocol][An object specifying which protocol is to be used.]] 19676 19677[[ec][Set to indicate what error occurred, if any.]] 19678 19679] 19680 19681 19682[heading Example] 19683 19684 19685 19686 boost::asio::ip::tcp::socket socket(my_context); 19687 boost::system::error_code ec; 19688 socket.open(boost::asio::ip::tcp::v4(), ec); 19689 if (ec) 19690 { 19691 // An error occurred. 19692 } 19693 19694 19695 19696 19697 19698 19699 19700[endsect] 19701 19702 19703[endsect] 19704 19705[section:operator_eq_ basic_raw_socket::operator=] 19706 19707[indexterm2 boost_asio.indexterm.basic_raw_socket.operator_eq_..operator=..basic_raw_socket] 19708Move-assign a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] from another. 19709 19710 19711 basic_raw_socket & ``[link boost_asio.reference.basic_raw_socket.operator_eq_.overload1 operator=]``( 19712 basic_raw_socket && other); 19713 `` [''''»''' [link boost_asio.reference.basic_raw_socket.operator_eq_.overload1 more...]]`` 19714 19715 19716Move-assign a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] from a socket of another protocol type. 19717 19718 19719 template< 19720 typename ``[link boost_asio.reference.Protocol Protocol1]``, 19721 typename ``[link boost_asio.reference.Executor1 Executor1]``> 19722 constraint< 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=]``( 19723 basic_raw_socket< Protocol1, Executor1 > && other); 19724 `` [''''»''' [link boost_asio.reference.basic_raw_socket.operator_eq_.overload2 more...]]`` 19725 19726 19727[section:overload1 basic_raw_socket::operator= (1 of 2 overloads)] 19728 19729 19730Move-assign a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] from another. 19731 19732 19733 basic_raw_socket & operator=( 19734 basic_raw_socket && other); 19735 19736 19737This assignment operator moves a raw socket from one object to another. 19738 19739 19740[heading Parameters] 19741 19742 19743[variablelist 19744 19745[[other][The other [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] object from which the move will occur.]] 19746 19747] 19748 19749 19750[heading Remarks] 19751 19752Following the move, the moved-from object is in the same state as if constructed using the `basic_raw_socket(const executor_type&)` constructor. 19753 19754 19755 19756 19757[endsect] 19758 19759 19760 19761[section:overload2 basic_raw_socket::operator= (2 of 2 overloads)] 19762 19763 19764Move-assign a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] from a socket of another protocol type. 19765 19766 19767 template< 19768 typename ``[link boost_asio.reference.Protocol Protocol1]``, 19769 typename ``[link boost_asio.reference.Executor1 Executor1]``> 19770 constraint< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value, basic_raw_socket & >::type operator=( 19771 basic_raw_socket< Protocol1, Executor1 > && other); 19772 19773 19774This assignment operator moves a raw socket from one object to another. 19775 19776 19777[heading Parameters] 19778 19779 19780[variablelist 19781 19782[[other][The other [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] object from which the move will occur.]] 19783 19784] 19785 19786 19787[heading Remarks] 19788 19789Following the move, the moved-from object is in the same state as if constructed using the `basic_raw_socket(const executor_type&)` constructor. 19790 19791 19792 19793 19794[endsect] 19795 19796 19797[endsect] 19798 19799 19800[section:out_of_band_inline basic_raw_socket::out_of_band_inline] 19801 19802 19803['Inherited from socket_base.] 19804 19805[indexterm2 boost_asio.indexterm.basic_raw_socket.out_of_band_inline..out_of_band_inline..basic_raw_socket] 19806Socket option for putting received out-of-band data inline. 19807 19808 19809 typedef implementation_defined out_of_band_inline; 19810 19811 19812 19813Implements the SOL\_SOCKET/SO\_OOBINLINE socket option. 19814 19815 19816[heading Examples] 19817 19818Setting the option: 19819 19820 boost::asio::ip::tcp::socket socket(my_context); 19821 ... 19822 boost::asio::socket_base::out_of_band_inline option(true); 19823 socket.set_option(option); 19824 19825 19826 19827 19828 19829Getting the current option value: 19830 19831 boost::asio::ip::tcp::socket socket(my_context); 19832 ... 19833 boost::asio::socket_base::out_of_band_inline option; 19834 socket.get_option(option); 19835 bool value = option.value(); 19836 19837 19838 19839 19840 19841 19842 19843[heading Requirements] 19844 19845['Header: ][^boost/asio/basic_raw_socket.hpp] 19846 19847['Convenience header: ][^boost/asio.hpp] 19848 19849 19850[endsect] 19851 19852 19853 19854[section:protocol_type basic_raw_socket::protocol_type] 19855 19856[indexterm2 boost_asio.indexterm.basic_raw_socket.protocol_type..protocol_type..basic_raw_socket] 19857The protocol type. 19858 19859 19860 typedef Protocol protocol_type; 19861 19862 19863 19864[heading Requirements] 19865 19866['Header: ][^boost/asio/basic_raw_socket.hpp] 19867 19868['Convenience header: ][^boost/asio.hpp] 19869 19870 19871[endsect] 19872 19873 19874[section:receive basic_raw_socket::receive] 19875 19876[indexterm2 boost_asio.indexterm.basic_raw_socket.receive..receive..basic_raw_socket] 19877Receive some data on a connected socket. 19878 19879 19880 template< 19881 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 19882 std::size_t ``[link boost_asio.reference.basic_raw_socket.receive.overload1 receive]``( 19883 const MutableBufferSequence & buffers); 19884 `` [''''»''' [link boost_asio.reference.basic_raw_socket.receive.overload1 more...]]`` 19885 19886 template< 19887 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 19888 std::size_t ``[link boost_asio.reference.basic_raw_socket.receive.overload2 receive]``( 19889 const MutableBufferSequence & buffers, 19890 socket_base::message_flags flags); 19891 `` [''''»''' [link boost_asio.reference.basic_raw_socket.receive.overload2 more...]]`` 19892 19893 template< 19894 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 19895 std::size_t ``[link boost_asio.reference.basic_raw_socket.receive.overload3 receive]``( 19896 const MutableBufferSequence & buffers, 19897 socket_base::message_flags flags, 19898 boost::system::error_code & ec); 19899 `` [''''»''' [link boost_asio.reference.basic_raw_socket.receive.overload3 more...]]`` 19900 19901 19902[section:overload1 basic_raw_socket::receive (1 of 3 overloads)] 19903 19904 19905Receive some data on a connected socket. 19906 19907 19908 template< 19909 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 19910 std::size_t receive( 19911 const MutableBufferSequence & buffers); 19912 19913 19914This 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. 19915 19916 19917[heading Parameters] 19918 19919 19920[variablelist 19921 19922[[buffers][One or more buffers into which the data will be received.]] 19923 19924] 19925 19926 19927[heading Return Value] 19928 19929The number of bytes received. 19930 19931 19932[heading Exceptions] 19933 19934 19935[variablelist 19936 19937[[boost::system::system_error][Thrown on failure.]] 19938 19939] 19940 19941 19942[heading Remarks] 19943 19944The receive operation can only be used with a connected socket. Use the receive\_from function to receive data on an unconnected raw socket. 19945 19946 19947[heading Example] 19948 19949To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 19950 19951 socket.receive(boost::asio::buffer(data, size)); 19952 19953 19954See 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. 19955 19956 19957 19958 19959[endsect] 19960 19961 19962 19963[section:overload2 basic_raw_socket::receive (2 of 3 overloads)] 19964 19965 19966Receive some data on a connected socket. 19967 19968 19969 template< 19970 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 19971 std::size_t receive( 19972 const MutableBufferSequence & buffers, 19973 socket_base::message_flags flags); 19974 19975 19976This 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. 19977 19978 19979[heading Parameters] 19980 19981 19982[variablelist 19983 19984[[buffers][One or more buffers into which the data will be received.]] 19985 19986[[flags][Flags specifying how the receive call is to be made.]] 19987 19988] 19989 19990 19991[heading Return Value] 19992 19993The number of bytes received. 19994 19995 19996[heading Exceptions] 19997 19998 19999[variablelist 20000 20001[[boost::system::system_error][Thrown on failure.]] 20002 20003] 20004 20005 20006[heading Remarks] 20007 20008The receive operation can only be used with a connected socket. Use the receive\_from function to receive data on an unconnected raw socket. 20009 20010 20011 20012 20013[endsect] 20014 20015 20016 20017[section:overload3 basic_raw_socket::receive (3 of 3 overloads)] 20018 20019 20020Receive some data on a connected socket. 20021 20022 20023 template< 20024 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 20025 std::size_t receive( 20026 const MutableBufferSequence & buffers, 20027 socket_base::message_flags flags, 20028 boost::system::error_code & ec); 20029 20030 20031This 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. 20032 20033 20034[heading Parameters] 20035 20036 20037[variablelist 20038 20039[[buffers][One or more buffers into which the data will be received.]] 20040 20041[[flags][Flags specifying how the receive call is to be made.]] 20042 20043[[ec][Set to indicate what error occurred, if any.]] 20044 20045] 20046 20047 20048[heading Return Value] 20049 20050The number of bytes received. 20051 20052 20053[heading Remarks] 20054 20055The receive operation can only be used with a connected socket. Use the receive\_from function to receive data on an unconnected raw socket. 20056 20057 20058 20059 20060[endsect] 20061 20062 20063[endsect] 20064 20065 20066[section:receive_buffer_size basic_raw_socket::receive_buffer_size] 20067 20068 20069['Inherited from socket_base.] 20070 20071[indexterm2 boost_asio.indexterm.basic_raw_socket.receive_buffer_size..receive_buffer_size..basic_raw_socket] 20072Socket option for the receive buffer size of a socket. 20073 20074 20075 typedef implementation_defined receive_buffer_size; 20076 20077 20078 20079Implements the SOL\_SOCKET/SO\_RCVBUF socket option. 20080 20081 20082[heading Examples] 20083 20084Setting the option: 20085 20086 boost::asio::ip::tcp::socket socket(my_context); 20087 ... 20088 boost::asio::socket_base::receive_buffer_size option(8192); 20089 socket.set_option(option); 20090 20091 20092 20093 20094 20095Getting the current option value: 20096 20097 boost::asio::ip::tcp::socket socket(my_context); 20098 ... 20099 boost::asio::socket_base::receive_buffer_size option; 20100 socket.get_option(option); 20101 int size = option.value(); 20102 20103 20104 20105 20106 20107 20108 20109[heading Requirements] 20110 20111['Header: ][^boost/asio/basic_raw_socket.hpp] 20112 20113['Convenience header: ][^boost/asio.hpp] 20114 20115 20116[endsect] 20117 20118 20119[section:receive_from basic_raw_socket::receive_from] 20120 20121[indexterm2 boost_asio.indexterm.basic_raw_socket.receive_from..receive_from..basic_raw_socket] 20122Receive raw data with the endpoint of the sender. 20123 20124 20125 template< 20126 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 20127 std::size_t ``[link boost_asio.reference.basic_raw_socket.receive_from.overload1 receive_from]``( 20128 const MutableBufferSequence & buffers, 20129 endpoint_type & sender_endpoint); 20130 `` [''''»''' [link boost_asio.reference.basic_raw_socket.receive_from.overload1 more...]]`` 20131 20132 template< 20133 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 20134 std::size_t ``[link boost_asio.reference.basic_raw_socket.receive_from.overload2 receive_from]``( 20135 const MutableBufferSequence & buffers, 20136 endpoint_type & sender_endpoint, 20137 socket_base::message_flags flags); 20138 `` [''''»''' [link boost_asio.reference.basic_raw_socket.receive_from.overload2 more...]]`` 20139 20140 template< 20141 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 20142 std::size_t ``[link boost_asio.reference.basic_raw_socket.receive_from.overload3 receive_from]``( 20143 const MutableBufferSequence & buffers, 20144 endpoint_type & sender_endpoint, 20145 socket_base::message_flags flags, 20146 boost::system::error_code & ec); 20147 `` [''''»''' [link boost_asio.reference.basic_raw_socket.receive_from.overload3 more...]]`` 20148 20149 20150[section:overload1 basic_raw_socket::receive_from (1 of 3 overloads)] 20151 20152 20153Receive raw data with the endpoint of the sender. 20154 20155 20156 template< 20157 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 20158 std::size_t receive_from( 20159 const MutableBufferSequence & buffers, 20160 endpoint_type & sender_endpoint); 20161 20162 20163This function is used to receive raw data. The function call will block until data has been received successfully or an error occurs. 20164 20165 20166[heading Parameters] 20167 20168 20169[variablelist 20170 20171[[buffers][One or more buffers into which the data will be received.]] 20172 20173[[sender_endpoint][An endpoint object that receives the endpoint of the remote sender of the data.]] 20174 20175] 20176 20177 20178[heading Return Value] 20179 20180The number of bytes received. 20181 20182 20183[heading Exceptions] 20184 20185 20186[variablelist 20187 20188[[boost::system::system_error][Thrown on failure.]] 20189 20190] 20191 20192 20193[heading Example] 20194 20195To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 20196 20197 boost::asio::ip::udp::endpoint sender_endpoint; 20198 socket.receive_from( 20199 boost::asio::buffer(data, size), sender_endpoint); 20200 20201 20202See 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. 20203 20204 20205 20206 20207[endsect] 20208 20209 20210 20211[section:overload2 basic_raw_socket::receive_from (2 of 3 overloads)] 20212 20213 20214Receive raw data with the endpoint of the sender. 20215 20216 20217 template< 20218 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 20219 std::size_t receive_from( 20220 const MutableBufferSequence & buffers, 20221 endpoint_type & sender_endpoint, 20222 socket_base::message_flags flags); 20223 20224 20225This function is used to receive raw data. The function call will block until data has been received successfully or an error occurs. 20226 20227 20228[heading Parameters] 20229 20230 20231[variablelist 20232 20233[[buffers][One or more buffers into which the data will be received.]] 20234 20235[[sender_endpoint][An endpoint object that receives the endpoint of the remote sender of the data.]] 20236 20237[[flags][Flags specifying how the receive call is to be made.]] 20238 20239] 20240 20241 20242[heading Return Value] 20243 20244The number of bytes received. 20245 20246 20247[heading Exceptions] 20248 20249 20250[variablelist 20251 20252[[boost::system::system_error][Thrown on failure. ]] 20253 20254] 20255 20256 20257 20258 20259[endsect] 20260 20261 20262 20263[section:overload3 basic_raw_socket::receive_from (3 of 3 overloads)] 20264 20265 20266Receive raw data with the endpoint of the sender. 20267 20268 20269 template< 20270 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 20271 std::size_t receive_from( 20272 const MutableBufferSequence & buffers, 20273 endpoint_type & sender_endpoint, 20274 socket_base::message_flags flags, 20275 boost::system::error_code & ec); 20276 20277 20278This function is used to receive raw data. The function call will block until data has been received successfully or an error occurs. 20279 20280 20281[heading Parameters] 20282 20283 20284[variablelist 20285 20286[[buffers][One or more buffers into which the data will be received.]] 20287 20288[[sender_endpoint][An endpoint object that receives the endpoint of the remote sender of the data.]] 20289 20290[[flags][Flags specifying how the receive call is to be made.]] 20291 20292[[ec][Set to indicate what error occurred, if any.]] 20293 20294] 20295 20296 20297[heading Return Value] 20298 20299The number of bytes received. 20300 20301 20302 20303 20304[endsect] 20305 20306 20307[endsect] 20308 20309 20310[section:receive_low_watermark basic_raw_socket::receive_low_watermark] 20311 20312 20313['Inherited from socket_base.] 20314 20315[indexterm2 boost_asio.indexterm.basic_raw_socket.receive_low_watermark..receive_low_watermark..basic_raw_socket] 20316Socket option for the receive low watermark. 20317 20318 20319 typedef implementation_defined receive_low_watermark; 20320 20321 20322 20323Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option. 20324 20325 20326[heading Examples] 20327 20328Setting the option: 20329 20330 boost::asio::ip::tcp::socket socket(my_context); 20331 ... 20332 boost::asio::socket_base::receive_low_watermark option(1024); 20333 socket.set_option(option); 20334 20335 20336 20337 20338 20339Getting the current option value: 20340 20341 boost::asio::ip::tcp::socket socket(my_context); 20342 ... 20343 boost::asio::socket_base::receive_low_watermark option; 20344 socket.get_option(option); 20345 int size = option.value(); 20346 20347 20348 20349 20350 20351 20352 20353[heading Requirements] 20354 20355['Header: ][^boost/asio/basic_raw_socket.hpp] 20356 20357['Convenience header: ][^boost/asio.hpp] 20358 20359 20360[endsect] 20361 20362 20363[section:release basic_raw_socket::release] 20364 20365[indexterm2 boost_asio.indexterm.basic_raw_socket.release..release..basic_raw_socket] 20366Release ownership of the underlying native socket. 20367 20368 20369 native_handle_type ``[link boost_asio.reference.basic_raw_socket.release.overload1 release]``(); 20370 `` [''''»''' [link boost_asio.reference.basic_raw_socket.release.overload1 more...]]`` 20371 20372 native_handle_type ``[link boost_asio.reference.basic_raw_socket.release.overload2 release]``( 20373 boost::system::error_code & ec); 20374 `` [''''»''' [link boost_asio.reference.basic_raw_socket.release.overload2 more...]]`` 20375 20376 20377[section:overload1 basic_raw_socket::release (1 of 2 overloads)] 20378 20379 20380['Inherited from basic_socket.] 20381 20382 20383Release ownership of the underlying native socket. 20384 20385 20386 native_handle_type release(); 20387 20388 20389This 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. 20390 20391 20392[heading Exceptions] 20393 20394 20395[variablelist 20396 20397[[boost::system::system_error][Thrown on failure.]] 20398 20399] 20400 20401 20402[heading Remarks] 20403 20404This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms. 20405 20406 20407 20408 20409[endsect] 20410 20411 20412 20413[section:overload2 basic_raw_socket::release (2 of 2 overloads)] 20414 20415 20416['Inherited from basic_socket.] 20417 20418 20419Release ownership of the underlying native socket. 20420 20421 20422 native_handle_type release( 20423 boost::system::error_code & ec); 20424 20425 20426This 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. 20427 20428 20429[heading Parameters] 20430 20431 20432[variablelist 20433 20434[[ec][Set to indicate what error occurred, if any.]] 20435 20436] 20437 20438 20439[heading Remarks] 20440 20441This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms. 20442 20443 20444 20445 20446[endsect] 20447 20448 20449[endsect] 20450 20451[section:remote_endpoint basic_raw_socket::remote_endpoint] 20452 20453[indexterm2 boost_asio.indexterm.basic_raw_socket.remote_endpoint..remote_endpoint..basic_raw_socket] 20454Get the remote endpoint of the socket. 20455 20456 20457 endpoint_type ``[link boost_asio.reference.basic_raw_socket.remote_endpoint.overload1 remote_endpoint]``() const; 20458 `` [''''»''' [link boost_asio.reference.basic_raw_socket.remote_endpoint.overload1 more...]]`` 20459 20460 endpoint_type ``[link boost_asio.reference.basic_raw_socket.remote_endpoint.overload2 remote_endpoint]``( 20461 boost::system::error_code & ec) const; 20462 `` [''''»''' [link boost_asio.reference.basic_raw_socket.remote_endpoint.overload2 more...]]`` 20463 20464 20465[section:overload1 basic_raw_socket::remote_endpoint (1 of 2 overloads)] 20466 20467 20468['Inherited from basic_socket.] 20469 20470 20471Get the remote endpoint of the socket. 20472 20473 20474 endpoint_type remote_endpoint() const; 20475 20476 20477This function is used to obtain the remote endpoint of the socket. 20478 20479 20480[heading Return Value] 20481 20482An object that represents the remote endpoint of the socket. 20483 20484 20485[heading Exceptions] 20486 20487 20488[variablelist 20489 20490[[boost::system::system_error][Thrown on failure.]] 20491 20492] 20493 20494 20495[heading Example] 20496 20497 20498 20499 boost::asio::ip::tcp::socket socket(my_context); 20500 ... 20501 boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(); 20502 20503 20504 20505 20506 20507 20508 20509[endsect] 20510 20511 20512 20513[section:overload2 basic_raw_socket::remote_endpoint (2 of 2 overloads)] 20514 20515 20516['Inherited from basic_socket.] 20517 20518 20519Get the remote endpoint of the socket. 20520 20521 20522 endpoint_type remote_endpoint( 20523 boost::system::error_code & ec) const; 20524 20525 20526This function is used to obtain the remote endpoint of the socket. 20527 20528 20529[heading Parameters] 20530 20531 20532[variablelist 20533 20534[[ec][Set to indicate what error occurred, if any.]] 20535 20536] 20537 20538 20539[heading Return Value] 20540 20541An object that represents the remote endpoint of the socket. Returns a default-constructed endpoint object if an error occurred. 20542 20543 20544[heading Example] 20545 20546 20547 20548 boost::asio::ip::tcp::socket socket(my_context); 20549 ... 20550 boost::system::error_code ec; 20551 boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(ec); 20552 if (ec) 20553 { 20554 // An error occurred. 20555 } 20556 20557 20558 20559 20560 20561 20562 20563[endsect] 20564 20565 20566[endsect] 20567 20568 20569[section:reuse_address basic_raw_socket::reuse_address] 20570 20571 20572['Inherited from socket_base.] 20573 20574[indexterm2 boost_asio.indexterm.basic_raw_socket.reuse_address..reuse_address..basic_raw_socket] 20575Socket option to allow the socket to be bound to an address that is already in use. 20576 20577 20578 typedef implementation_defined reuse_address; 20579 20580 20581 20582Implements the SOL\_SOCKET/SO\_REUSEADDR socket option. 20583 20584 20585[heading Examples] 20586 20587Setting the option: 20588 20589 boost::asio::ip::tcp::acceptor acceptor(my_context); 20590 ... 20591 boost::asio::socket_base::reuse_address option(true); 20592 acceptor.set_option(option); 20593 20594 20595 20596 20597 20598Getting the current option value: 20599 20600 boost::asio::ip::tcp::acceptor acceptor(my_context); 20601 ... 20602 boost::asio::socket_base::reuse_address option; 20603 acceptor.get_option(option); 20604 bool is_set = option.value(); 20605 20606 20607 20608 20609 20610 20611 20612[heading Requirements] 20613 20614['Header: ][^boost/asio/basic_raw_socket.hpp] 20615 20616['Convenience header: ][^boost/asio.hpp] 20617 20618 20619[endsect] 20620 20621 20622[section:send basic_raw_socket::send] 20623 20624[indexterm2 boost_asio.indexterm.basic_raw_socket.send..send..basic_raw_socket] 20625Send some data on a connected socket. 20626 20627 20628 template< 20629 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 20630 std::size_t ``[link boost_asio.reference.basic_raw_socket.send.overload1 send]``( 20631 const ConstBufferSequence & buffers); 20632 `` [''''»''' [link boost_asio.reference.basic_raw_socket.send.overload1 more...]]`` 20633 20634 template< 20635 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 20636 std::size_t ``[link boost_asio.reference.basic_raw_socket.send.overload2 send]``( 20637 const ConstBufferSequence & buffers, 20638 socket_base::message_flags flags); 20639 `` [''''»''' [link boost_asio.reference.basic_raw_socket.send.overload2 more...]]`` 20640 20641 template< 20642 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 20643 std::size_t ``[link boost_asio.reference.basic_raw_socket.send.overload3 send]``( 20644 const ConstBufferSequence & buffers, 20645 socket_base::message_flags flags, 20646 boost::system::error_code & ec); 20647 `` [''''»''' [link boost_asio.reference.basic_raw_socket.send.overload3 more...]]`` 20648 20649 20650[section:overload1 basic_raw_socket::send (1 of 3 overloads)] 20651 20652 20653Send some data on a connected socket. 20654 20655 20656 template< 20657 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 20658 std::size_t send( 20659 const ConstBufferSequence & buffers); 20660 20661 20662This 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. 20663 20664 20665[heading Parameters] 20666 20667 20668[variablelist 20669 20670[[buffers][One ore more data buffers to be sent on the socket.]] 20671 20672] 20673 20674 20675[heading Return Value] 20676 20677The number of bytes sent. 20678 20679 20680[heading Exceptions] 20681 20682 20683[variablelist 20684 20685[[boost::system::system_error][Thrown on failure.]] 20686 20687] 20688 20689 20690[heading Remarks] 20691 20692The send operation can only be used with a connected socket. Use the send\_to function to send data on an unconnected raw socket. 20693 20694 20695[heading Example] 20696 20697To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 20698 20699 socket.send(boost::asio::buffer(data, size)); 20700 20701 20702See 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. 20703 20704 20705 20706 20707[endsect] 20708 20709 20710 20711[section:overload2 basic_raw_socket::send (2 of 3 overloads)] 20712 20713 20714Send some data on a connected socket. 20715 20716 20717 template< 20718 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 20719 std::size_t send( 20720 const ConstBufferSequence & buffers, 20721 socket_base::message_flags flags); 20722 20723 20724This 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. 20725 20726 20727[heading Parameters] 20728 20729 20730[variablelist 20731 20732[[buffers][One ore more data buffers to be sent on the socket.]] 20733 20734[[flags][Flags specifying how the send call is to be made.]] 20735 20736] 20737 20738 20739[heading Return Value] 20740 20741The number of bytes sent. 20742 20743 20744[heading Exceptions] 20745 20746 20747[variablelist 20748 20749[[boost::system::system_error][Thrown on failure.]] 20750 20751] 20752 20753 20754[heading Remarks] 20755 20756The send operation can only be used with a connected socket. Use the send\_to function to send data on an unconnected raw socket. 20757 20758 20759 20760 20761[endsect] 20762 20763 20764 20765[section:overload3 basic_raw_socket::send (3 of 3 overloads)] 20766 20767 20768Send some data on a connected socket. 20769 20770 20771 template< 20772 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 20773 std::size_t send( 20774 const ConstBufferSequence & buffers, 20775 socket_base::message_flags flags, 20776 boost::system::error_code & ec); 20777 20778 20779This 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. 20780 20781 20782[heading Parameters] 20783 20784 20785[variablelist 20786 20787[[buffers][One or more data buffers to be sent on the socket.]] 20788 20789[[flags][Flags specifying how the send call is to be made.]] 20790 20791[[ec][Set to indicate what error occurred, if any.]] 20792 20793] 20794 20795 20796[heading Return Value] 20797 20798The number of bytes sent. 20799 20800 20801[heading Remarks] 20802 20803The send operation can only be used with a connected socket. Use the send\_to function to send data on an unconnected raw socket. 20804 20805 20806 20807 20808[endsect] 20809 20810 20811[endsect] 20812 20813 20814[section:send_buffer_size basic_raw_socket::send_buffer_size] 20815 20816 20817['Inherited from socket_base.] 20818 20819[indexterm2 boost_asio.indexterm.basic_raw_socket.send_buffer_size..send_buffer_size..basic_raw_socket] 20820Socket option for the send buffer size of a socket. 20821 20822 20823 typedef implementation_defined send_buffer_size; 20824 20825 20826 20827Implements the SOL\_SOCKET/SO\_SNDBUF socket option. 20828 20829 20830[heading Examples] 20831 20832Setting the option: 20833 20834 boost::asio::ip::tcp::socket socket(my_context); 20835 ... 20836 boost::asio::socket_base::send_buffer_size option(8192); 20837 socket.set_option(option); 20838 20839 20840 20841 20842 20843Getting the current option value: 20844 20845 boost::asio::ip::tcp::socket socket(my_context); 20846 ... 20847 boost::asio::socket_base::send_buffer_size option; 20848 socket.get_option(option); 20849 int size = option.value(); 20850 20851 20852 20853 20854 20855 20856 20857[heading Requirements] 20858 20859['Header: ][^boost/asio/basic_raw_socket.hpp] 20860 20861['Convenience header: ][^boost/asio.hpp] 20862 20863 20864[endsect] 20865 20866 20867 20868[section:send_low_watermark basic_raw_socket::send_low_watermark] 20869 20870 20871['Inherited from socket_base.] 20872 20873[indexterm2 boost_asio.indexterm.basic_raw_socket.send_low_watermark..send_low_watermark..basic_raw_socket] 20874Socket option for the send low watermark. 20875 20876 20877 typedef implementation_defined send_low_watermark; 20878 20879 20880 20881Implements the SOL\_SOCKET/SO\_SNDLOWAT socket option. 20882 20883 20884[heading Examples] 20885 20886Setting the option: 20887 20888 boost::asio::ip::tcp::socket socket(my_context); 20889 ... 20890 boost::asio::socket_base::send_low_watermark option(1024); 20891 socket.set_option(option); 20892 20893 20894 20895 20896 20897Getting the current option value: 20898 20899 boost::asio::ip::tcp::socket socket(my_context); 20900 ... 20901 boost::asio::socket_base::send_low_watermark option; 20902 socket.get_option(option); 20903 int size = option.value(); 20904 20905 20906 20907 20908 20909 20910 20911[heading Requirements] 20912 20913['Header: ][^boost/asio/basic_raw_socket.hpp] 20914 20915['Convenience header: ][^boost/asio.hpp] 20916 20917 20918[endsect] 20919 20920 20921[section:send_to basic_raw_socket::send_to] 20922 20923[indexterm2 boost_asio.indexterm.basic_raw_socket.send_to..send_to..basic_raw_socket] 20924Send raw data to the specified endpoint. 20925 20926 20927 template< 20928 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 20929 std::size_t ``[link boost_asio.reference.basic_raw_socket.send_to.overload1 send_to]``( 20930 const ConstBufferSequence & buffers, 20931 const endpoint_type & destination); 20932 `` [''''»''' [link boost_asio.reference.basic_raw_socket.send_to.overload1 more...]]`` 20933 20934 template< 20935 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 20936 std::size_t ``[link boost_asio.reference.basic_raw_socket.send_to.overload2 send_to]``( 20937 const ConstBufferSequence & buffers, 20938 const endpoint_type & destination, 20939 socket_base::message_flags flags); 20940 `` [''''»''' [link boost_asio.reference.basic_raw_socket.send_to.overload2 more...]]`` 20941 20942 template< 20943 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 20944 std::size_t ``[link boost_asio.reference.basic_raw_socket.send_to.overload3 send_to]``( 20945 const ConstBufferSequence & buffers, 20946 const endpoint_type & destination, 20947 socket_base::message_flags flags, 20948 boost::system::error_code & ec); 20949 `` [''''»''' [link boost_asio.reference.basic_raw_socket.send_to.overload3 more...]]`` 20950 20951 20952[section:overload1 basic_raw_socket::send_to (1 of 3 overloads)] 20953 20954 20955Send raw data to the specified endpoint. 20956 20957 20958 template< 20959 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 20960 std::size_t send_to( 20961 const ConstBufferSequence & buffers, 20962 const endpoint_type & destination); 20963 20964 20965This 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. 20966 20967 20968[heading Parameters] 20969 20970 20971[variablelist 20972 20973[[buffers][One or more data buffers to be sent to the remote endpoint.]] 20974 20975[[destination][The remote endpoint to which the data will be sent.]] 20976 20977] 20978 20979 20980[heading Return Value] 20981 20982The number of bytes sent. 20983 20984 20985[heading Exceptions] 20986 20987 20988[variablelist 20989 20990[[boost::system::system_error][Thrown on failure.]] 20991 20992] 20993 20994 20995[heading Example] 20996 20997To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 20998 20999 boost::asio::ip::udp::endpoint destination( 21000 boost::asio::ip::address::from_string("1.2.3.4"), 12345); 21001 socket.send_to(boost::asio::buffer(data, size), destination); 21002 21003 21004See 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. 21005 21006 21007 21008 21009[endsect] 21010 21011 21012 21013[section:overload2 basic_raw_socket::send_to (2 of 3 overloads)] 21014 21015 21016Send raw data to the specified endpoint. 21017 21018 21019 template< 21020 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 21021 std::size_t send_to( 21022 const ConstBufferSequence & buffers, 21023 const endpoint_type & destination, 21024 socket_base::message_flags flags); 21025 21026 21027This 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. 21028 21029 21030[heading Parameters] 21031 21032 21033[variablelist 21034 21035[[buffers][One or more data buffers to be sent to the remote endpoint.]] 21036 21037[[destination][The remote endpoint to which the data will be sent.]] 21038 21039[[flags][Flags specifying how the send call is to be made.]] 21040 21041] 21042 21043 21044[heading Return Value] 21045 21046The number of bytes sent. 21047 21048 21049[heading Exceptions] 21050 21051 21052[variablelist 21053 21054[[boost::system::system_error][Thrown on failure. ]] 21055 21056] 21057 21058 21059 21060 21061[endsect] 21062 21063 21064 21065[section:overload3 basic_raw_socket::send_to (3 of 3 overloads)] 21066 21067 21068Send raw data to the specified endpoint. 21069 21070 21071 template< 21072 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 21073 std::size_t send_to( 21074 const ConstBufferSequence & buffers, 21075 const endpoint_type & destination, 21076 socket_base::message_flags flags, 21077 boost::system::error_code & ec); 21078 21079 21080This 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. 21081 21082 21083[heading Parameters] 21084 21085 21086[variablelist 21087 21088[[buffers][One or more data buffers to be sent to the remote endpoint.]] 21089 21090[[destination][The remote endpoint to which the data will be sent.]] 21091 21092[[flags][Flags specifying how the send call is to be made.]] 21093 21094[[ec][Set to indicate what error occurred, if any.]] 21095 21096] 21097 21098 21099[heading Return Value] 21100 21101The number of bytes sent. 21102 21103 21104 21105 21106[endsect] 21107 21108 21109[endsect] 21110 21111[section:set_option basic_raw_socket::set_option] 21112 21113[indexterm2 boost_asio.indexterm.basic_raw_socket.set_option..set_option..basic_raw_socket] 21114Set an option on the socket. 21115 21116 21117 template< 21118 typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``> 21119 void ``[link boost_asio.reference.basic_raw_socket.set_option.overload1 set_option]``( 21120 const SettableSocketOption & option); 21121 `` [''''»''' [link boost_asio.reference.basic_raw_socket.set_option.overload1 more...]]`` 21122 21123 template< 21124 typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``> 21125 void ``[link boost_asio.reference.basic_raw_socket.set_option.overload2 set_option]``( 21126 const SettableSocketOption & option, 21127 boost::system::error_code & ec); 21128 `` [''''»''' [link boost_asio.reference.basic_raw_socket.set_option.overload2 more...]]`` 21129 21130 21131[section:overload1 basic_raw_socket::set_option (1 of 2 overloads)] 21132 21133 21134['Inherited from basic_socket.] 21135 21136 21137Set an option on the socket. 21138 21139 21140 template< 21141 typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``> 21142 void set_option( 21143 const SettableSocketOption & option); 21144 21145 21146This function is used to set an option on the socket. 21147 21148 21149[heading Parameters] 21150 21151 21152[variablelist 21153 21154[[option][The new option value to be set on the socket.]] 21155 21156] 21157 21158 21159[heading Exceptions] 21160 21161 21162[variablelist 21163 21164[[boost::system::system_error][Thrown on failure.]] 21165 21166] 21167 21168 21169 21170[heading Example] 21171 21172Setting the IPPROTO\_TCP/TCP\_NODELAY option: 21173 21174 boost::asio::ip::tcp::socket socket(my_context); 21175 ... 21176 boost::asio::ip::tcp::no_delay option(true); 21177 socket.set_option(option); 21178 21179 21180 21181 21182 21183 21184 21185[endsect] 21186 21187 21188 21189[section:overload2 basic_raw_socket::set_option (2 of 2 overloads)] 21190 21191 21192['Inherited from basic_socket.] 21193 21194 21195Set an option on the socket. 21196 21197 21198 template< 21199 typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``> 21200 void set_option( 21201 const SettableSocketOption & option, 21202 boost::system::error_code & ec); 21203 21204 21205This function is used to set an option on the socket. 21206 21207 21208[heading Parameters] 21209 21210 21211[variablelist 21212 21213[[option][The new option value to be set on the socket.]] 21214 21215[[ec][Set to indicate what error occurred, if any.]] 21216 21217] 21218 21219 21220 21221[heading Example] 21222 21223Setting the IPPROTO\_TCP/TCP\_NODELAY option: 21224 21225 boost::asio::ip::tcp::socket socket(my_context); 21226 ... 21227 boost::asio::ip::tcp::no_delay option(true); 21228 boost::system::error_code ec; 21229 socket.set_option(option, ec); 21230 if (ec) 21231 { 21232 // An error occurred. 21233 } 21234 21235 21236 21237 21238 21239 21240 21241[endsect] 21242 21243 21244[endsect] 21245 21246[section:shutdown basic_raw_socket::shutdown] 21247 21248[indexterm2 boost_asio.indexterm.basic_raw_socket.shutdown..shutdown..basic_raw_socket] 21249Disable sends or receives on the socket. 21250 21251 21252 void ``[link boost_asio.reference.basic_raw_socket.shutdown.overload1 shutdown]``( 21253 shutdown_type what); 21254 `` [''''»''' [link boost_asio.reference.basic_raw_socket.shutdown.overload1 more...]]`` 21255 21256 void ``[link boost_asio.reference.basic_raw_socket.shutdown.overload2 shutdown]``( 21257 shutdown_type what, 21258 boost::system::error_code & ec); 21259 `` [''''»''' [link boost_asio.reference.basic_raw_socket.shutdown.overload2 more...]]`` 21260 21261 21262[section:overload1 basic_raw_socket::shutdown (1 of 2 overloads)] 21263 21264 21265['Inherited from basic_socket.] 21266 21267 21268Disable sends or receives on the socket. 21269 21270 21271 void shutdown( 21272 shutdown_type what); 21273 21274 21275This function is used to disable send operations, receive operations, or both. 21276 21277 21278[heading Parameters] 21279 21280 21281[variablelist 21282 21283[[what][Determines what types of operation will no longer be allowed.]] 21284 21285] 21286 21287 21288[heading Exceptions] 21289 21290 21291[variablelist 21292 21293[[boost::system::system_error][Thrown on failure.]] 21294 21295] 21296 21297 21298[heading Example] 21299 21300Shutting down the send side of the socket: 21301 21302 boost::asio::ip::tcp::socket socket(my_context); 21303 ... 21304 socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send); 21305 21306 21307 21308 21309 21310 21311 21312[endsect] 21313 21314 21315 21316[section:overload2 basic_raw_socket::shutdown (2 of 2 overloads)] 21317 21318 21319['Inherited from basic_socket.] 21320 21321 21322Disable sends or receives on the socket. 21323 21324 21325 void shutdown( 21326 shutdown_type what, 21327 boost::system::error_code & ec); 21328 21329 21330This function is used to disable send operations, receive operations, or both. 21331 21332 21333[heading Parameters] 21334 21335 21336[variablelist 21337 21338[[what][Determines what types of operation will no longer be allowed.]] 21339 21340[[ec][Set to indicate what error occurred, if any.]] 21341 21342] 21343 21344 21345[heading Example] 21346 21347Shutting down the send side of the socket: 21348 21349 boost::asio::ip::tcp::socket socket(my_context); 21350 ... 21351 boost::system::error_code ec; 21352 socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send, ec); 21353 if (ec) 21354 { 21355 // An error occurred. 21356 } 21357 21358 21359 21360 21361 21362 21363 21364[endsect] 21365 21366 21367[endsect] 21368 21369 21370[section:shutdown_type basic_raw_socket::shutdown_type] 21371 21372 21373['Inherited from socket_base.] 21374 21375[indexterm2 boost_asio.indexterm.basic_raw_socket.shutdown_type..shutdown_type..basic_raw_socket] 21376Different ways a socket may be shutdown. 21377 21378 21379 enum shutdown_type 21380 21381[indexterm2 boost_asio.indexterm.basic_raw_socket.shutdown_type.shutdown_receive..shutdown_receive..basic_raw_socket] 21382[indexterm2 boost_asio.indexterm.basic_raw_socket.shutdown_type.shutdown_send..shutdown_send..basic_raw_socket] 21383[indexterm2 boost_asio.indexterm.basic_raw_socket.shutdown_type.shutdown_both..shutdown_both..basic_raw_socket] 21384 21385[heading Values] 21386[variablelist 21387 21388 [ 21389 [shutdown_receive] 21390 [Shutdown the receive side of the socket. ] 21391 ] 21392 21393 [ 21394 [shutdown_send] 21395 [Shutdown the send side of the socket. ] 21396 ] 21397 21398 [ 21399 [shutdown_both] 21400 [Shutdown both send and receive on the socket. ] 21401 ] 21402 21403] 21404 21405 21406 21407[endsect] 21408 21409 21410[section:wait basic_raw_socket::wait] 21411 21412[indexterm2 boost_asio.indexterm.basic_raw_socket.wait..wait..basic_raw_socket] 21413Wait for the socket to become ready to read, ready to write, or to have pending error conditions. 21414 21415 21416 void ``[link boost_asio.reference.basic_raw_socket.wait.overload1 wait]``( 21417 wait_type w); 21418 `` [''''»''' [link boost_asio.reference.basic_raw_socket.wait.overload1 more...]]`` 21419 21420 void ``[link boost_asio.reference.basic_raw_socket.wait.overload2 wait]``( 21421 wait_type w, 21422 boost::system::error_code & ec); 21423 `` [''''»''' [link boost_asio.reference.basic_raw_socket.wait.overload2 more...]]`` 21424 21425 21426[section:overload1 basic_raw_socket::wait (1 of 2 overloads)] 21427 21428 21429['Inherited from basic_socket.] 21430 21431 21432Wait for the socket to become ready to read, ready to write, or to have pending error conditions. 21433 21434 21435 void wait( 21436 wait_type w); 21437 21438 21439This function is used to perform a blocking wait for a socket to enter a ready to read, write or error condition state. 21440 21441 21442[heading Parameters] 21443 21444 21445[variablelist 21446 21447[[w][Specifies the desired socket state.]] 21448 21449] 21450 21451 21452[heading Example] 21453 21454Waiting for a socket to become readable. 21455 21456 boost::asio::ip::tcp::socket socket(my_context); 21457 ... 21458 socket.wait(boost::asio::ip::tcp::socket::wait_read); 21459 21460 21461 21462 21463 21464 21465 21466[endsect] 21467 21468 21469 21470[section:overload2 basic_raw_socket::wait (2 of 2 overloads)] 21471 21472 21473['Inherited from basic_socket.] 21474 21475 21476Wait for the socket to become ready to read, ready to write, or to have pending error conditions. 21477 21478 21479 void wait( 21480 wait_type w, 21481 boost::system::error_code & ec); 21482 21483 21484This function is used to perform a blocking wait for a socket to enter a ready to read, write or error condition state. 21485 21486 21487[heading Parameters] 21488 21489 21490[variablelist 21491 21492[[w][Specifies the desired socket state.]] 21493 21494[[ec][Set to indicate what error occurred, if any.]] 21495 21496] 21497 21498 21499[heading Example] 21500 21501Waiting for a socket to become readable. 21502 21503 boost::asio::ip::tcp::socket socket(my_context); 21504 ... 21505 boost::system::error_code ec; 21506 socket.wait(boost::asio::ip::tcp::socket::wait_read, ec); 21507 21508 21509 21510 21511 21512 21513 21514[endsect] 21515 21516 21517[endsect] 21518 21519 21520[section:wait_type basic_raw_socket::wait_type] 21521 21522 21523['Inherited from socket_base.] 21524 21525[indexterm2 boost_asio.indexterm.basic_raw_socket.wait_type..wait_type..basic_raw_socket] 21526Wait types. 21527 21528 21529 enum wait_type 21530 21531[indexterm2 boost_asio.indexterm.basic_raw_socket.wait_type.wait_read..wait_read..basic_raw_socket] 21532[indexterm2 boost_asio.indexterm.basic_raw_socket.wait_type.wait_write..wait_write..basic_raw_socket] 21533[indexterm2 boost_asio.indexterm.basic_raw_socket.wait_type.wait_error..wait_error..basic_raw_socket] 21534 21535[heading Values] 21536[variablelist 21537 21538 [ 21539 [wait_read] 21540 [Wait for a socket to become ready to read. ] 21541 ] 21542 21543 [ 21544 [wait_write] 21545 [Wait for a socket to become ready to write. ] 21546 ] 21547 21548 [ 21549 [wait_error] 21550 [Wait for a socket to have error conditions pending. ] 21551 ] 21552 21553] 21554 21555 21556For use with `basic_socket::wait()` and `basic_socket::async_wait()`. 21557 21558 21559[endsect] 21560 21561 21562 21563[section:_basic_raw_socket basic_raw_socket::~basic_raw_socket] 21564 21565[indexterm2 boost_asio.indexterm.basic_raw_socket._basic_raw_socket..~basic_raw_socket..basic_raw_socket] 21566Destroys the socket. 21567 21568 21569 ~basic_raw_socket(); 21570 21571 21572This function destroys the socket, cancelling any outstanding asynchronous operations associated with the socket as if by calling `cancel`. 21573 21574 21575[endsect] 21576 21577 21578 21579[endsect] 21580 21581[section:basic_raw_socket__rebind_executor basic_raw_socket::rebind_executor] 21582 21583[indexterm1 boost_asio.indexterm.basic_raw_socket__rebind_executor..basic_raw_socket::rebind_executor] 21584 21585 21586Rebinds the socket type to another executor. 21587 21588 21589 template< 21590 typename ``[link boost_asio.reference.Executor1 Executor1]``> 21591 struct rebind_executor 21592 21593 21594[heading Types] 21595[table 21596 [[Name][Description]] 21597 21598 [ 21599 21600 [[link boost_asio.reference.basic_raw_socket__rebind_executor.other [*other]]] 21601 [The socket type when rebound to the specified executor. ] 21602 21603 ] 21604 21605] 21606 21607[heading Requirements] 21608 21609['Header: ][^boost/asio/basic_raw_socket.hpp] 21610 21611['Convenience header: ][^boost/asio.hpp] 21612 21613 21614[section:other basic_raw_socket::rebind_executor::other] 21615 21616[indexterm2 boost_asio.indexterm.basic_raw_socket__rebind_executor.other..other..basic_raw_socket::rebind_executor] 21617The socket type when rebound to the specified executor. 21618 21619 21620 typedef basic_raw_socket< Protocol, Executor1 > other; 21621 21622 21623[heading Types] 21624[table 21625 [[Name][Description]] 21626 21627 [ 21628 21629 [[link boost_asio.reference.basic_raw_socket__rebind_executor [*rebind_executor]]] 21630 [Rebinds the socket type to another executor. ] 21631 21632 ] 21633 21634 [ 21635 21636 [[link boost_asio.reference.basic_raw_socket.broadcast [*broadcast]]] 21637 [Socket option to permit sending of broadcast messages. ] 21638 21639 ] 21640 21641 [ 21642 21643 [[link boost_asio.reference.basic_raw_socket.bytes_readable [*bytes_readable]]] 21644 [IO control command to get the amount of data that can be read without blocking. ] 21645 21646 ] 21647 21648 [ 21649 21650 [[link boost_asio.reference.basic_raw_socket.debug [*debug]]] 21651 [Socket option to enable socket-level debugging. ] 21652 21653 ] 21654 21655 [ 21656 21657 [[link boost_asio.reference.basic_raw_socket.do_not_route [*do_not_route]]] 21658 [Socket option to prevent routing, use local interfaces only. ] 21659 21660 ] 21661 21662 [ 21663 21664 [[link boost_asio.reference.basic_raw_socket.enable_connection_aborted [*enable_connection_aborted]]] 21665 [Socket option to report aborted connections on accept. ] 21666 21667 ] 21668 21669 [ 21670 21671 [[link boost_asio.reference.basic_raw_socket.endpoint_type [*endpoint_type]]] 21672 [The endpoint type. ] 21673 21674 ] 21675 21676 [ 21677 21678 [[link boost_asio.reference.basic_raw_socket.executor_type [*executor_type]]] 21679 [The type of the executor associated with the object. ] 21680 21681 ] 21682 21683 [ 21684 21685 [[link boost_asio.reference.basic_raw_socket.keep_alive [*keep_alive]]] 21686 [Socket option to send keep-alives. ] 21687 21688 ] 21689 21690 [ 21691 21692 [[link boost_asio.reference.basic_raw_socket.linger [*linger]]] 21693 [Socket option to specify whether the socket lingers on close if unsent data is present. ] 21694 21695 ] 21696 21697 [ 21698 21699 [[link boost_asio.reference.basic_raw_socket.lowest_layer_type [*lowest_layer_type]]] 21700 [A basic_socket is always the lowest layer. ] 21701 21702 ] 21703 21704 [ 21705 21706 [[link boost_asio.reference.basic_raw_socket.message_flags [*message_flags]]] 21707 [Bitmask type for flags that can be passed to send and receive operations. ] 21708 21709 ] 21710 21711 [ 21712 21713 [[link boost_asio.reference.basic_raw_socket.native_handle_type [*native_handle_type]]] 21714 [The native representation of a socket. ] 21715 21716 ] 21717 21718 [ 21719 21720 [[link boost_asio.reference.basic_raw_socket.out_of_band_inline [*out_of_band_inline]]] 21721 [Socket option for putting received out-of-band data inline. ] 21722 21723 ] 21724 21725 [ 21726 21727 [[link boost_asio.reference.basic_raw_socket.protocol_type [*protocol_type]]] 21728 [The protocol type. ] 21729 21730 ] 21731 21732 [ 21733 21734 [[link boost_asio.reference.basic_raw_socket.receive_buffer_size [*receive_buffer_size]]] 21735 [Socket option for the receive buffer size of a socket. ] 21736 21737 ] 21738 21739 [ 21740 21741 [[link boost_asio.reference.basic_raw_socket.receive_low_watermark [*receive_low_watermark]]] 21742 [Socket option for the receive low watermark. ] 21743 21744 ] 21745 21746 [ 21747 21748 [[link boost_asio.reference.basic_raw_socket.reuse_address [*reuse_address]]] 21749 [Socket option to allow the socket to be bound to an address that is already in use. ] 21750 21751 ] 21752 21753 [ 21754 21755 [[link boost_asio.reference.basic_raw_socket.send_buffer_size [*send_buffer_size]]] 21756 [Socket option for the send buffer size of a socket. ] 21757 21758 ] 21759 21760 [ 21761 21762 [[link boost_asio.reference.basic_raw_socket.send_low_watermark [*send_low_watermark]]] 21763 [Socket option for the send low watermark. ] 21764 21765 ] 21766 21767 [ 21768 21769 [[link boost_asio.reference.basic_raw_socket.shutdown_type [*shutdown_type]]] 21770 [Different ways a socket may be shutdown. ] 21771 21772 ] 21773 21774 [ 21775 21776 [[link boost_asio.reference.basic_raw_socket.wait_type [*wait_type]]] 21777 [Wait types. ] 21778 21779 ] 21780 21781] 21782 21783[heading Member Functions] 21784[table 21785 [[Name][Description]] 21786 21787 [ 21788 [[link boost_asio.reference.basic_raw_socket.assign [*assign]]] 21789 [Assign an existing native socket to the socket. ] 21790 ] 21791 21792 [ 21793 [[link boost_asio.reference.basic_raw_socket.async_connect [*async_connect]]] 21794 [Start an asynchronous connect. ] 21795 ] 21796 21797 [ 21798 [[link boost_asio.reference.basic_raw_socket.async_receive [*async_receive]]] 21799 [Start an asynchronous receive on a connected socket. ] 21800 ] 21801 21802 [ 21803 [[link boost_asio.reference.basic_raw_socket.async_receive_from [*async_receive_from]]] 21804 [Start an asynchronous receive. ] 21805 ] 21806 21807 [ 21808 [[link boost_asio.reference.basic_raw_socket.async_send [*async_send]]] 21809 [Start an asynchronous send on a connected socket. ] 21810 ] 21811 21812 [ 21813 [[link boost_asio.reference.basic_raw_socket.async_send_to [*async_send_to]]] 21814 [Start an asynchronous send. ] 21815 ] 21816 21817 [ 21818 [[link boost_asio.reference.basic_raw_socket.async_wait [*async_wait]]] 21819 [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 21820 ] 21821 21822 [ 21823 [[link boost_asio.reference.basic_raw_socket.at_mark [*at_mark]]] 21824 [Determine whether the socket is at the out-of-band data mark. ] 21825 ] 21826 21827 [ 21828 [[link boost_asio.reference.basic_raw_socket.available [*available]]] 21829 [Determine the number of bytes available for reading. ] 21830 ] 21831 21832 [ 21833 [[link boost_asio.reference.basic_raw_socket.basic_raw_socket [*basic_raw_socket]] [constructor]] 21834 [Construct a basic_raw_socket without opening it. 21835 [hr] 21836 Construct and open a basic_raw_socket. 21837 [hr] 21838 Construct a basic_raw_socket, opening it and binding it to the given local endpoint. 21839 [hr] 21840 Construct a basic_raw_socket on an existing native socket. 21841 [hr] 21842 Move-construct a basic_raw_socket from another. 21843 [hr] 21844 Move-construct a basic_raw_socket from a socket of another protocol type. ] 21845 ] 21846 21847 [ 21848 [[link boost_asio.reference.basic_raw_socket.bind [*bind]]] 21849 [Bind the socket to the given local endpoint. ] 21850 ] 21851 21852 [ 21853 [[link boost_asio.reference.basic_raw_socket.cancel [*cancel]]] 21854 [Cancel all asynchronous operations associated with the socket. ] 21855 ] 21856 21857 [ 21858 [[link boost_asio.reference.basic_raw_socket.close [*close]]] 21859 [Close the socket. ] 21860 ] 21861 21862 [ 21863 [[link boost_asio.reference.basic_raw_socket.connect [*connect]]] 21864 [Connect the socket to the specified endpoint. ] 21865 ] 21866 21867 [ 21868 [[link boost_asio.reference.basic_raw_socket.get_executor [*get_executor]]] 21869 [Get the executor associated with the object. ] 21870 ] 21871 21872 [ 21873 [[link boost_asio.reference.basic_raw_socket.get_option [*get_option]]] 21874 [Get an option from the socket. ] 21875 ] 21876 21877 [ 21878 [[link boost_asio.reference.basic_raw_socket.io_control [*io_control]]] 21879 [Perform an IO control command on the socket. ] 21880 ] 21881 21882 [ 21883 [[link boost_asio.reference.basic_raw_socket.is_open [*is_open]]] 21884 [Determine whether the socket is open. ] 21885 ] 21886 21887 [ 21888 [[link boost_asio.reference.basic_raw_socket.local_endpoint [*local_endpoint]]] 21889 [Get the local endpoint of the socket. ] 21890 ] 21891 21892 [ 21893 [[link boost_asio.reference.basic_raw_socket.lowest_layer [*lowest_layer]]] 21894 [Get a reference to the lowest layer. 21895 [hr] 21896 Get a const reference to the lowest layer. ] 21897 ] 21898 21899 [ 21900 [[link boost_asio.reference.basic_raw_socket.native_handle [*native_handle]]] 21901 [Get the native socket representation. ] 21902 ] 21903 21904 [ 21905 [[link boost_asio.reference.basic_raw_socket.native_non_blocking [*native_non_blocking]]] 21906 [Gets the non-blocking mode of the native socket implementation. 21907 [hr] 21908 Sets the non-blocking mode of the native socket implementation. ] 21909 ] 21910 21911 [ 21912 [[link boost_asio.reference.basic_raw_socket.non_blocking [*non_blocking]]] 21913 [Gets the non-blocking mode of the socket. 21914 [hr] 21915 Sets the non-blocking mode of the socket. ] 21916 ] 21917 21918 [ 21919 [[link boost_asio.reference.basic_raw_socket.open [*open]]] 21920 [Open the socket using the specified protocol. ] 21921 ] 21922 21923 [ 21924 [[link boost_asio.reference.basic_raw_socket.operator_eq_ [*operator=]]] 21925 [Move-assign a basic_raw_socket from another. 21926 [hr] 21927 Move-assign a basic_raw_socket from a socket of another protocol type. ] 21928 ] 21929 21930 [ 21931 [[link boost_asio.reference.basic_raw_socket.receive [*receive]]] 21932 [Receive some data on a connected socket. ] 21933 ] 21934 21935 [ 21936 [[link boost_asio.reference.basic_raw_socket.receive_from [*receive_from]]] 21937 [Receive raw data with the endpoint of the sender. ] 21938 ] 21939 21940 [ 21941 [[link boost_asio.reference.basic_raw_socket.release [*release]]] 21942 [Release ownership of the underlying native socket. ] 21943 ] 21944 21945 [ 21946 [[link boost_asio.reference.basic_raw_socket.remote_endpoint [*remote_endpoint]]] 21947 [Get the remote endpoint of the socket. ] 21948 ] 21949 21950 [ 21951 [[link boost_asio.reference.basic_raw_socket.send [*send]]] 21952 [Send some data on a connected socket. ] 21953 ] 21954 21955 [ 21956 [[link boost_asio.reference.basic_raw_socket.send_to [*send_to]]] 21957 [Send raw data to the specified endpoint. ] 21958 ] 21959 21960 [ 21961 [[link boost_asio.reference.basic_raw_socket.set_option [*set_option]]] 21962 [Set an option on the socket. ] 21963 ] 21964 21965 [ 21966 [[link boost_asio.reference.basic_raw_socket.shutdown [*shutdown]]] 21967 [Disable sends or receives on the socket. ] 21968 ] 21969 21970 [ 21971 [[link boost_asio.reference.basic_raw_socket.wait [*wait]]] 21972 [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 21973 ] 21974 21975 [ 21976 [[link boost_asio.reference.basic_raw_socket._basic_raw_socket [*~basic_raw_socket]] [destructor]] 21977 [Destroys the socket. ] 21978 ] 21979 21980] 21981 21982[heading Data Members] 21983[table 21984 [[Name][Description]] 21985 21986 [ 21987 [[link boost_asio.reference.basic_raw_socket.max_connections [*max_connections]] [static]] 21988 [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ] 21989 ] 21990 21991 [ 21992 [[link boost_asio.reference.basic_raw_socket.max_listen_connections [*max_listen_connections]] [static]] 21993 [The maximum length of the queue of pending incoming connections. ] 21994 ] 21995 21996 [ 21997 [[link boost_asio.reference.basic_raw_socket.message_do_not_route [*message_do_not_route]] [static]] 21998 [Specify that the data should not be subject to routing. ] 21999 ] 22000 22001 [ 22002 [[link boost_asio.reference.basic_raw_socket.message_end_of_record [*message_end_of_record]] [static]] 22003 [Specifies that the data marks the end of a record. ] 22004 ] 22005 22006 [ 22007 [[link boost_asio.reference.basic_raw_socket.message_out_of_band [*message_out_of_band]] [static]] 22008 [Process out-of-band data. ] 22009 ] 22010 22011 [ 22012 [[link boost_asio.reference.basic_raw_socket.message_peek [*message_peek]] [static]] 22013 [Peek at incoming data without removing it from the input queue. ] 22014 ] 22015 22016] 22017 22018The [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] class template provides asynchronous and blocking raw-oriented socket functionality. 22019 22020 22021[heading Thread Safety] 22022 22023['Distinct] ['objects:] Safe. 22024 22025['Shared] ['objects:] Unsafe. 22026 22027Synchronous `send`, `send_to`, `receive`, `receive_from`, and `connect` operations are thread safe with respect to each other, if the underlying operating system calls are also thread safe. This means that it is permitted to perform concurrent calls to these synchronous operations on a single socket object. Other synchronous operations, such as `open` or `close`, are not thread safe. 22028 22029 22030[heading Requirements] 22031 22032['Header: ][^boost/asio/basic_raw_socket.hpp] 22033 22034['Convenience header: ][^boost/asio.hpp] 22035 22036 22037[endsect] 22038 22039 22040 22041[endsect] 22042 22043[section:basic_seq_packet_socket basic_seq_packet_socket] 22044 22045[indexterm1 boost_asio.indexterm.basic_seq_packet_socket..basic_seq_packet_socket] 22046 22047 22048Provides sequenced packet socket functionality. 22049 22050 22051 template< 22052 typename ``[link boost_asio.reference.Protocol Protocol]``, 22053 typename ``[link boost_asio.reference.Executor1 Executor]``> 22054 class basic_seq_packet_socket : 22055 public basic_socket< Protocol, Executor > 22056 22057 22058[heading Types] 22059[table 22060 [[Name][Description]] 22061 22062 [ 22063 22064 [[link boost_asio.reference.basic_seq_packet_socket__rebind_executor [*rebind_executor]]] 22065 [Rebinds the socket type to another executor. ] 22066 22067 ] 22068 22069 [ 22070 22071 [[link boost_asio.reference.basic_seq_packet_socket.broadcast [*broadcast]]] 22072 [Socket option to permit sending of broadcast messages. ] 22073 22074 ] 22075 22076 [ 22077 22078 [[link boost_asio.reference.basic_seq_packet_socket.bytes_readable [*bytes_readable]]] 22079 [IO control command to get the amount of data that can be read without blocking. ] 22080 22081 ] 22082 22083 [ 22084 22085 [[link boost_asio.reference.basic_seq_packet_socket.debug [*debug]]] 22086 [Socket option to enable socket-level debugging. ] 22087 22088 ] 22089 22090 [ 22091 22092 [[link boost_asio.reference.basic_seq_packet_socket.do_not_route [*do_not_route]]] 22093 [Socket option to prevent routing, use local interfaces only. ] 22094 22095 ] 22096 22097 [ 22098 22099 [[link boost_asio.reference.basic_seq_packet_socket.enable_connection_aborted [*enable_connection_aborted]]] 22100 [Socket option to report aborted connections on accept. ] 22101 22102 ] 22103 22104 [ 22105 22106 [[link boost_asio.reference.basic_seq_packet_socket.endpoint_type [*endpoint_type]]] 22107 [The endpoint type. ] 22108 22109 ] 22110 22111 [ 22112 22113 [[link boost_asio.reference.basic_seq_packet_socket.executor_type [*executor_type]]] 22114 [The type of the executor associated with the object. ] 22115 22116 ] 22117 22118 [ 22119 22120 [[link boost_asio.reference.basic_seq_packet_socket.keep_alive [*keep_alive]]] 22121 [Socket option to send keep-alives. ] 22122 22123 ] 22124 22125 [ 22126 22127 [[link boost_asio.reference.basic_seq_packet_socket.linger [*linger]]] 22128 [Socket option to specify whether the socket lingers on close if unsent data is present. ] 22129 22130 ] 22131 22132 [ 22133 22134 [[link boost_asio.reference.basic_seq_packet_socket.lowest_layer_type [*lowest_layer_type]]] 22135 [A basic_socket is always the lowest layer. ] 22136 22137 ] 22138 22139 [ 22140 22141 [[link boost_asio.reference.basic_seq_packet_socket.message_flags [*message_flags]]] 22142 [Bitmask type for flags that can be passed to send and receive operations. ] 22143 22144 ] 22145 22146 [ 22147 22148 [[link boost_asio.reference.basic_seq_packet_socket.native_handle_type [*native_handle_type]]] 22149 [The native representation of a socket. ] 22150 22151 ] 22152 22153 [ 22154 22155 [[link boost_asio.reference.basic_seq_packet_socket.out_of_band_inline [*out_of_band_inline]]] 22156 [Socket option for putting received out-of-band data inline. ] 22157 22158 ] 22159 22160 [ 22161 22162 [[link boost_asio.reference.basic_seq_packet_socket.protocol_type [*protocol_type]]] 22163 [The protocol type. ] 22164 22165 ] 22166 22167 [ 22168 22169 [[link boost_asio.reference.basic_seq_packet_socket.receive_buffer_size [*receive_buffer_size]]] 22170 [Socket option for the receive buffer size of a socket. ] 22171 22172 ] 22173 22174 [ 22175 22176 [[link boost_asio.reference.basic_seq_packet_socket.receive_low_watermark [*receive_low_watermark]]] 22177 [Socket option for the receive low watermark. ] 22178 22179 ] 22180 22181 [ 22182 22183 [[link boost_asio.reference.basic_seq_packet_socket.reuse_address [*reuse_address]]] 22184 [Socket option to allow the socket to be bound to an address that is already in use. ] 22185 22186 ] 22187 22188 [ 22189 22190 [[link boost_asio.reference.basic_seq_packet_socket.send_buffer_size [*send_buffer_size]]] 22191 [Socket option for the send buffer size of a socket. ] 22192 22193 ] 22194 22195 [ 22196 22197 [[link boost_asio.reference.basic_seq_packet_socket.send_low_watermark [*send_low_watermark]]] 22198 [Socket option for the send low watermark. ] 22199 22200 ] 22201 22202 [ 22203 22204 [[link boost_asio.reference.basic_seq_packet_socket.shutdown_type [*shutdown_type]]] 22205 [Different ways a socket may be shutdown. ] 22206 22207 ] 22208 22209 [ 22210 22211 [[link boost_asio.reference.basic_seq_packet_socket.wait_type [*wait_type]]] 22212 [Wait types. ] 22213 22214 ] 22215 22216] 22217 22218[heading Member Functions] 22219[table 22220 [[Name][Description]] 22221 22222 [ 22223 [[link boost_asio.reference.basic_seq_packet_socket.assign [*assign]]] 22224 [Assign an existing native socket to the socket. ] 22225 ] 22226 22227 [ 22228 [[link boost_asio.reference.basic_seq_packet_socket.async_connect [*async_connect]]] 22229 [Start an asynchronous connect. ] 22230 ] 22231 22232 [ 22233 [[link boost_asio.reference.basic_seq_packet_socket.async_receive [*async_receive]]] 22234 [Start an asynchronous receive. ] 22235 ] 22236 22237 [ 22238 [[link boost_asio.reference.basic_seq_packet_socket.async_send [*async_send]]] 22239 [Start an asynchronous send. ] 22240 ] 22241 22242 [ 22243 [[link boost_asio.reference.basic_seq_packet_socket.async_wait [*async_wait]]] 22244 [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 22245 ] 22246 22247 [ 22248 [[link boost_asio.reference.basic_seq_packet_socket.at_mark [*at_mark]]] 22249 [Determine whether the socket is at the out-of-band data mark. ] 22250 ] 22251 22252 [ 22253 [[link boost_asio.reference.basic_seq_packet_socket.available [*available]]] 22254 [Determine the number of bytes available for reading. ] 22255 ] 22256 22257 [ 22258 [[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket [*basic_seq_packet_socket]] [constructor]] 22259 [Construct a basic_seq_packet_socket without opening it. 22260 [hr] 22261 Construct and open a basic_seq_packet_socket. 22262 [hr] 22263 Construct a basic_seq_packet_socket, opening it and binding it to the given local endpoint. 22264 [hr] 22265 Construct a basic_seq_packet_socket on an existing native socket. 22266 [hr] 22267 Move-construct a basic_seq_packet_socket from another. 22268 [hr] 22269 Move-construct a basic_seq_packet_socket from a socket of another protocol type. ] 22270 ] 22271 22272 [ 22273 [[link boost_asio.reference.basic_seq_packet_socket.bind [*bind]]] 22274 [Bind the socket to the given local endpoint. ] 22275 ] 22276 22277 [ 22278 [[link boost_asio.reference.basic_seq_packet_socket.cancel [*cancel]]] 22279 [Cancel all asynchronous operations associated with the socket. ] 22280 ] 22281 22282 [ 22283 [[link boost_asio.reference.basic_seq_packet_socket.close [*close]]] 22284 [Close the socket. ] 22285 ] 22286 22287 [ 22288 [[link boost_asio.reference.basic_seq_packet_socket.connect [*connect]]] 22289 [Connect the socket to the specified endpoint. ] 22290 ] 22291 22292 [ 22293 [[link boost_asio.reference.basic_seq_packet_socket.get_executor [*get_executor]]] 22294 [Get the executor associated with the object. ] 22295 ] 22296 22297 [ 22298 [[link boost_asio.reference.basic_seq_packet_socket.get_option [*get_option]]] 22299 [Get an option from the socket. ] 22300 ] 22301 22302 [ 22303 [[link boost_asio.reference.basic_seq_packet_socket.io_control [*io_control]]] 22304 [Perform an IO control command on the socket. ] 22305 ] 22306 22307 [ 22308 [[link boost_asio.reference.basic_seq_packet_socket.is_open [*is_open]]] 22309 [Determine whether the socket is open. ] 22310 ] 22311 22312 [ 22313 [[link boost_asio.reference.basic_seq_packet_socket.local_endpoint [*local_endpoint]]] 22314 [Get the local endpoint of the socket. ] 22315 ] 22316 22317 [ 22318 [[link boost_asio.reference.basic_seq_packet_socket.lowest_layer [*lowest_layer]]] 22319 [Get a reference to the lowest layer. 22320 [hr] 22321 Get a const reference to the lowest layer. ] 22322 ] 22323 22324 [ 22325 [[link boost_asio.reference.basic_seq_packet_socket.native_handle [*native_handle]]] 22326 [Get the native socket representation. ] 22327 ] 22328 22329 [ 22330 [[link boost_asio.reference.basic_seq_packet_socket.native_non_blocking [*native_non_blocking]]] 22331 [Gets the non-blocking mode of the native socket implementation. 22332 [hr] 22333 Sets the non-blocking mode of the native socket implementation. ] 22334 ] 22335 22336 [ 22337 [[link boost_asio.reference.basic_seq_packet_socket.non_blocking [*non_blocking]]] 22338 [Gets the non-blocking mode of the socket. 22339 [hr] 22340 Sets the non-blocking mode of the socket. ] 22341 ] 22342 22343 [ 22344 [[link boost_asio.reference.basic_seq_packet_socket.open [*open]]] 22345 [Open the socket using the specified protocol. ] 22346 ] 22347 22348 [ 22349 [[link boost_asio.reference.basic_seq_packet_socket.operator_eq_ [*operator=]]] 22350 [Move-assign a basic_seq_packet_socket from another. 22351 [hr] 22352 Move-assign a basic_seq_packet_socket from a socket of another protocol type. ] 22353 ] 22354 22355 [ 22356 [[link boost_asio.reference.basic_seq_packet_socket.receive [*receive]]] 22357 [Receive some data on the socket. 22358 [hr] 22359 Receive some data on a connected socket. ] 22360 ] 22361 22362 [ 22363 [[link boost_asio.reference.basic_seq_packet_socket.release [*release]]] 22364 [Release ownership of the underlying native socket. ] 22365 ] 22366 22367 [ 22368 [[link boost_asio.reference.basic_seq_packet_socket.remote_endpoint [*remote_endpoint]]] 22369 [Get the remote endpoint of the socket. ] 22370 ] 22371 22372 [ 22373 [[link boost_asio.reference.basic_seq_packet_socket.send [*send]]] 22374 [Send some data on the socket. ] 22375 ] 22376 22377 [ 22378 [[link boost_asio.reference.basic_seq_packet_socket.set_option [*set_option]]] 22379 [Set an option on the socket. ] 22380 ] 22381 22382 [ 22383 [[link boost_asio.reference.basic_seq_packet_socket.shutdown [*shutdown]]] 22384 [Disable sends or receives on the socket. ] 22385 ] 22386 22387 [ 22388 [[link boost_asio.reference.basic_seq_packet_socket.wait [*wait]]] 22389 [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 22390 ] 22391 22392 [ 22393 [[link boost_asio.reference.basic_seq_packet_socket._basic_seq_packet_socket [*~basic_seq_packet_socket]] [destructor]] 22394 [Destroys the socket. ] 22395 ] 22396 22397] 22398 22399[heading Data Members] 22400[table 22401 [[Name][Description]] 22402 22403 [ 22404 [[link boost_asio.reference.basic_seq_packet_socket.max_connections [*max_connections]] [static]] 22405 [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ] 22406 ] 22407 22408 [ 22409 [[link boost_asio.reference.basic_seq_packet_socket.max_listen_connections [*max_listen_connections]] [static]] 22410 [The maximum length of the queue of pending incoming connections. ] 22411 ] 22412 22413 [ 22414 [[link boost_asio.reference.basic_seq_packet_socket.message_do_not_route [*message_do_not_route]] [static]] 22415 [Specify that the data should not be subject to routing. ] 22416 ] 22417 22418 [ 22419 [[link boost_asio.reference.basic_seq_packet_socket.message_end_of_record [*message_end_of_record]] [static]] 22420 [Specifies that the data marks the end of a record. ] 22421 ] 22422 22423 [ 22424 [[link boost_asio.reference.basic_seq_packet_socket.message_out_of_band [*message_out_of_band]] [static]] 22425 [Process out-of-band data. ] 22426 ] 22427 22428 [ 22429 [[link boost_asio.reference.basic_seq_packet_socket.message_peek [*message_peek]] [static]] 22430 [Peek at incoming data without removing it from the input queue. ] 22431 ] 22432 22433] 22434 22435The [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] class template provides asynchronous and blocking sequenced packet socket functionality. 22436 22437 22438[heading Thread Safety] 22439 22440['Distinct] ['objects:] Safe. 22441 22442['Shared] ['objects:] Unsafe. 22443 22444Synchronous `send`, `receive`, and `connect` operations are thread safe with respect to each other, if the underlying operating system calls are also thread safe. This means that it is permitted to perform concurrent calls to these synchronous operations on a single socket object. Other synchronous operations, such as `open` or `close`, are not thread safe. 22445 22446[heading Requirements] 22447 22448['Header: ][^boost/asio/basic_seq_packet_socket.hpp] 22449 22450['Convenience header: ][^boost/asio.hpp] 22451 22452[section:assign basic_seq_packet_socket::assign] 22453 22454[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.assign..assign..basic_seq_packet_socket] 22455Assign an existing native socket to the socket. 22456 22457 22458 void ``[link boost_asio.reference.basic_seq_packet_socket.assign.overload1 assign]``( 22459 const protocol_type & protocol, 22460 const native_handle_type & native_socket); 22461 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.assign.overload1 more...]]`` 22462 22463 void ``[link boost_asio.reference.basic_seq_packet_socket.assign.overload2 assign]``( 22464 const protocol_type & protocol, 22465 const native_handle_type & native_socket, 22466 boost::system::error_code & ec); 22467 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.assign.overload2 more...]]`` 22468 22469 22470[section:overload1 basic_seq_packet_socket::assign (1 of 2 overloads)] 22471 22472 22473['Inherited from basic_socket.] 22474 22475 22476Assign an existing native socket to the socket. 22477 22478 22479 void assign( 22480 const protocol_type & protocol, 22481 const native_handle_type & native_socket); 22482 22483 22484 22485[endsect] 22486 22487 22488 22489[section:overload2 basic_seq_packet_socket::assign (2 of 2 overloads)] 22490 22491 22492['Inherited from basic_socket.] 22493 22494 22495Assign an existing native socket to the socket. 22496 22497 22498 void assign( 22499 const protocol_type & protocol, 22500 const native_handle_type & native_socket, 22501 boost::system::error_code & ec); 22502 22503 22504 22505[endsect] 22506 22507 22508[endsect] 22509 22510 22511[section:async_connect basic_seq_packet_socket::async_connect] 22512 22513 22514['Inherited from basic_socket.] 22515 22516[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.async_connect..async_connect..basic_seq_packet_socket] 22517Start an asynchronous connect. 22518 22519 22520 template< 22521 typename ``[link boost_asio.reference.ConnectHandler ConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 22522 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect( 22523 const endpoint_type & peer_endpoint, 22524 ConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 22525 22526 22527This function is used to asynchronously connect a socket to the specified remote endpoint. The function call always returns immediately. 22528 22529The 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. 22530 22531 22532[heading Parameters] 22533 22534 22535[variablelist 22536 22537[[peer_endpoint][The remote endpoint to which the socket will be connected. Copies will be made of the endpoint object as required.]] 22538 22539[[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: 22540`` 22541 void handler( 22542 const boost::system::error_code& error // Result of operation 22543 ); 22544`` 22545Regardless 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`].]] 22546 22547] 22548 22549 22550[heading Example] 22551 22552 22553 22554 void connect_handler(const boost::system::error_code& error) 22555 { 22556 if (!error) 22557 { 22558 // Connect succeeded. 22559 } 22560 } 22561 22562 ... 22563 22564 boost::asio::ip::tcp::socket socket(my_context); 22565 boost::asio::ip::tcp::endpoint endpoint( 22566 boost::asio::ip::address::from_string("1.2.3.4"), 12345); 22567 socket.async_connect(endpoint, connect_handler); 22568 22569 22570 22571 22572 22573 22574 22575[endsect] 22576 22577 22578[section:async_receive basic_seq_packet_socket::async_receive] 22579 22580[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.async_receive..async_receive..basic_seq_packet_socket] 22581Start an asynchronous receive. 22582 22583 22584 template< 22585 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 22586 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 22587 ``[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]``( 22588 const MutableBufferSequence & buffers, 22589 socket_base::message_flags & out_flags, 22590 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 22591 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.async_receive.overload1 more...]]`` 22592 22593 template< 22594 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 22595 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 22596 ``[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]``( 22597 const MutableBufferSequence & buffers, 22598 socket_base::message_flags in_flags, 22599 socket_base::message_flags & out_flags, 22600 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 22601 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.async_receive.overload2 more...]]`` 22602 22603 22604[section:overload1 basic_seq_packet_socket::async_receive (1 of 2 overloads)] 22605 22606 22607Start an asynchronous receive. 22608 22609 22610 template< 22611 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 22612 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 22613 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive( 22614 const MutableBufferSequence & buffers, 22615 socket_base::message_flags & out_flags, 22616 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 22617 22618 22619This function is used to asynchronously receive data from the sequenced packet socket. The function call always returns immediately. 22620 22621 22622[heading Parameters] 22623 22624 22625[variablelist 22626 22627[[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.]] 22628 22629[[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.]] 22630 22631[[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: 22632`` 22633 void handler( 22634 const boost::system::error_code& error, // Result of operation. 22635 std::size_t bytes_transferred // Number of bytes received. 22636 ); 22637`` 22638Regardless 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`].]] 22639 22640] 22641 22642 22643[heading Example] 22644 22645To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 22646 22647 socket.async_receive(boost::asio::buffer(data, size), out_flags, handler); 22648 22649 22650See 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. 22651 22652 22653 22654 22655[endsect] 22656 22657 22658 22659[section:overload2 basic_seq_packet_socket::async_receive (2 of 2 overloads)] 22660 22661 22662Start an asynchronous receive. 22663 22664 22665 template< 22666 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 22667 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 22668 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive( 22669 const MutableBufferSequence & buffers, 22670 socket_base::message_flags in_flags, 22671 socket_base::message_flags & out_flags, 22672 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 22673 22674 22675This function is used to asynchronously receive data from the sequenced data socket. The function call always returns immediately. 22676 22677 22678[heading Parameters] 22679 22680 22681[variablelist 22682 22683[[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.]] 22684 22685[[in_flags][Flags specifying how the receive call is to be made.]] 22686 22687[[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.]] 22688 22689[[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: 22690`` 22691 void handler( 22692 const boost::system::error_code& error, // Result of operation. 22693 std::size_t bytes_transferred // Number of bytes received. 22694 ); 22695`` 22696Regardless 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`].]] 22697 22698] 22699 22700 22701[heading Example] 22702 22703To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 22704 22705 socket.async_receive( 22706 boost::asio::buffer(data, size), 22707 0, out_flags, handler); 22708 22709 22710See 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. 22711 22712 22713 22714 22715[endsect] 22716 22717 22718[endsect] 22719 22720 22721[section:async_send basic_seq_packet_socket::async_send] 22722 22723[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.async_send..async_send..basic_seq_packet_socket] 22724Start an asynchronous send. 22725 22726 22727 template< 22728 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 22729 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 22730 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send( 22731 const ConstBufferSequence & buffers, 22732 socket_base::message_flags flags, 22733 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 22734 22735 22736This function is used to asynchronously send data on the sequenced packet socket. The function call always returns immediately. 22737 22738 22739[heading Parameters] 22740 22741 22742[variablelist 22743 22744[[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.]] 22745 22746[[flags][Flags specifying how the send call is to be made.]] 22747 22748[[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: 22749`` 22750 void handler( 22751 const boost::system::error_code& error, // Result of operation. 22752 std::size_t bytes_transferred // Number of bytes sent. 22753 ); 22754`` 22755Regardless 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`].]] 22756 22757] 22758 22759 22760[heading Example] 22761 22762To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 22763 22764 socket.async_send(boost::asio::buffer(data, size), 0, handler); 22765 22766 22767See 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. 22768 22769 22770 22771 22772[endsect] 22773 22774 22775 22776[section:async_wait basic_seq_packet_socket::async_wait] 22777 22778 22779['Inherited from basic_socket.] 22780 22781[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.async_wait..async_wait..basic_seq_packet_socket] 22782Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. 22783 22784 22785 template< 22786 typename ``[link boost_asio.reference.WaitHandler WaitHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 22787 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait( 22788 wait_type w, 22789 WaitHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 22790 22791 22792This function is used to perform an asynchronous wait for a socket to enter a ready to read, write or error condition state. 22793 22794 22795[heading Parameters] 22796 22797 22798[variablelist 22799 22800[[w][Specifies the desired socket state.]] 22801 22802[[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: 22803`` 22804 void handler( 22805 const boost::system::error_code& error // Result of operation 22806 ); 22807`` 22808Regardless 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`].]] 22809 22810] 22811 22812 22813[heading Example] 22814 22815 22816 22817 void wait_handler(const boost::system::error_code& error) 22818 { 22819 if (!error) 22820 { 22821 // Wait succeeded. 22822 } 22823 } 22824 22825 ... 22826 22827 boost::asio::ip::tcp::socket socket(my_context); 22828 ... 22829 socket.async_wait(boost::asio::ip::tcp::socket::wait_read, wait_handler); 22830 22831 22832 22833 22834 22835 22836 22837[endsect] 22838 22839 22840[section:at_mark basic_seq_packet_socket::at_mark] 22841 22842[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.at_mark..at_mark..basic_seq_packet_socket] 22843Determine whether the socket is at the out-of-band data mark. 22844 22845 22846 bool ``[link boost_asio.reference.basic_seq_packet_socket.at_mark.overload1 at_mark]``() const; 22847 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.at_mark.overload1 more...]]`` 22848 22849 bool ``[link boost_asio.reference.basic_seq_packet_socket.at_mark.overload2 at_mark]``( 22850 boost::system::error_code & ec) const; 22851 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.at_mark.overload2 more...]]`` 22852 22853 22854[section:overload1 basic_seq_packet_socket::at_mark (1 of 2 overloads)] 22855 22856 22857['Inherited from basic_socket.] 22858 22859 22860Determine whether the socket is at the out-of-band data mark. 22861 22862 22863 bool at_mark() const; 22864 22865 22866This function is used to check whether the socket input is currently positioned at the out-of-band data mark. 22867 22868 22869[heading Return Value] 22870 22871A bool indicating whether the socket is at the out-of-band data mark. 22872 22873 22874[heading Exceptions] 22875 22876 22877[variablelist 22878 22879[[boost::system::system_error][Thrown on failure. ]] 22880 22881] 22882 22883 22884 22885 22886[endsect] 22887 22888 22889 22890[section:overload2 basic_seq_packet_socket::at_mark (2 of 2 overloads)] 22891 22892 22893['Inherited from basic_socket.] 22894 22895 22896Determine whether the socket is at the out-of-band data mark. 22897 22898 22899 bool at_mark( 22900 boost::system::error_code & ec) const; 22901 22902 22903This function is used to check whether the socket input is currently positioned at the out-of-band data mark. 22904 22905 22906[heading Parameters] 22907 22908 22909[variablelist 22910 22911[[ec][Set to indicate what error occurred, if any.]] 22912 22913] 22914 22915 22916[heading Return Value] 22917 22918A bool indicating whether the socket is at the out-of-band data mark. 22919 22920 22921 22922 22923[endsect] 22924 22925 22926[endsect] 22927 22928[section:available basic_seq_packet_socket::available] 22929 22930[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.available..available..basic_seq_packet_socket] 22931Determine the number of bytes available for reading. 22932 22933 22934 std::size_t ``[link boost_asio.reference.basic_seq_packet_socket.available.overload1 available]``() const; 22935 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.available.overload1 more...]]`` 22936 22937 std::size_t ``[link boost_asio.reference.basic_seq_packet_socket.available.overload2 available]``( 22938 boost::system::error_code & ec) const; 22939 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.available.overload2 more...]]`` 22940 22941 22942[section:overload1 basic_seq_packet_socket::available (1 of 2 overloads)] 22943 22944 22945['Inherited from basic_socket.] 22946 22947 22948Determine the number of bytes available for reading. 22949 22950 22951 std::size_t available() const; 22952 22953 22954This function is used to determine the number of bytes that may be read without blocking. 22955 22956 22957[heading Return Value] 22958 22959The number of bytes that may be read without blocking, or 0 if an error occurs. 22960 22961 22962[heading Exceptions] 22963 22964 22965[variablelist 22966 22967[[boost::system::system_error][Thrown on failure. ]] 22968 22969] 22970 22971 22972 22973 22974[endsect] 22975 22976 22977 22978[section:overload2 basic_seq_packet_socket::available (2 of 2 overloads)] 22979 22980 22981['Inherited from basic_socket.] 22982 22983 22984Determine the number of bytes available for reading. 22985 22986 22987 std::size_t available( 22988 boost::system::error_code & ec) const; 22989 22990 22991This function is used to determine the number of bytes that may be read without blocking. 22992 22993 22994[heading Parameters] 22995 22996 22997[variablelist 22998 22999[[ec][Set to indicate what error occurred, if any.]] 23000 23001] 23002 23003 23004[heading Return Value] 23005 23006The number of bytes that may be read without blocking, or 0 if an error occurs. 23007 23008 23009 23010 23011[endsect] 23012 23013 23014[endsect] 23015 23016[section:basic_seq_packet_socket basic_seq_packet_socket::basic_seq_packet_socket] 23017 23018[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.basic_seq_packet_socket..basic_seq_packet_socket..basic_seq_packet_socket] 23019Construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] without opening it. 23020 23021 23022 explicit ``[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload1 basic_seq_packet_socket]``( 23023 const executor_type & ex); 23024 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload1 more...]]`` 23025 23026 template< 23027 typename ExecutionContext> 23028 explicit ``[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload2 basic_seq_packet_socket]``( 23029 ExecutionContext & context, 23030 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 23031 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload2 more...]]`` 23032 23033 23034Construct and open a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`]. 23035 23036 23037 ``[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload3 basic_seq_packet_socket]``( 23038 const executor_type & ex, 23039 const protocol_type & protocol); 23040 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload3 more...]]`` 23041 23042 template< 23043 typename ExecutionContext> 23044 ``[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload4 basic_seq_packet_socket]``( 23045 ExecutionContext & context, 23046 const protocol_type & protocol, 23047 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value, defaulted_constraint >::type = defaulted_constraint()); 23048 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload4 more...]]`` 23049 23050 23051Construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`], opening it and binding it to the given local endpoint. 23052 23053 23054 ``[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload5 basic_seq_packet_socket]``( 23055 const executor_type & ex, 23056 const endpoint_type & endpoint); 23057 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload5 more...]]`` 23058 23059 template< 23060 typename ExecutionContext> 23061 ``[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload6 basic_seq_packet_socket]``( 23062 ExecutionContext & context, 23063 const endpoint_type & endpoint, 23064 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 23065 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload6 more...]]`` 23066 23067 23068Construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] on an existing native socket. 23069 23070 23071 ``[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload7 basic_seq_packet_socket]``( 23072 const executor_type & ex, 23073 const protocol_type & protocol, 23074 const native_handle_type & native_socket); 23075 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload7 more...]]`` 23076 23077 template< 23078 typename ExecutionContext> 23079 ``[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload8 basic_seq_packet_socket]``( 23080 ExecutionContext & context, 23081 const protocol_type & protocol, 23082 const native_handle_type & native_socket, 23083 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 23084 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload8 more...]]`` 23085 23086 23087Move-construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] from another. 23088 23089 23090 ``[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload9 basic_seq_packet_socket]``( 23091 basic_seq_packet_socket && other); 23092 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload9 more...]]`` 23093 23094 23095Move-construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] from a socket of another protocol type. 23096 23097 23098 template< 23099 typename ``[link boost_asio.reference.Protocol Protocol1]``, 23100 typename ``[link boost_asio.reference.Executor1 Executor1]``> 23101 ``[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload10 basic_seq_packet_socket]``( 23102 basic_seq_packet_socket< Protocol1, Executor1 > && other, 23103 typename constraint< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type = 0); 23104 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload10 more...]]`` 23105 23106 23107[section:overload1 basic_seq_packet_socket::basic_seq_packet_socket (1 of 10 overloads)] 23108 23109 23110Construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] without opening it. 23111 23112 23113 basic_seq_packet_socket( 23114 const executor_type & ex); 23115 23116 23117This 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. 23118 23119 23120[heading Parameters] 23121 23122 23123[variablelist 23124 23125[[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket. ]] 23126 23127] 23128 23129 23130 23131 23132[endsect] 23133 23134 23135 23136[section:overload2 basic_seq_packet_socket::basic_seq_packet_socket (2 of 10 overloads)] 23137 23138 23139Construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] without opening it. 23140 23141 23142 template< 23143 typename ExecutionContext> 23144 basic_seq_packet_socket( 23145 ExecutionContext & context, 23146 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 23147 23148 23149This 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. 23150 23151 23152[heading Parameters] 23153 23154 23155[variablelist 23156 23157[[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. ]] 23158 23159] 23160 23161 23162 23163 23164[endsect] 23165 23166 23167 23168[section:overload3 basic_seq_packet_socket::basic_seq_packet_socket (3 of 10 overloads)] 23169 23170 23171Construct and open a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`]. 23172 23173 23174 basic_seq_packet_socket( 23175 const executor_type & ex, 23176 const protocol_type & protocol); 23177 23178 23179This 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. 23180 23181 23182[heading Parameters] 23183 23184 23185[variablelist 23186 23187[[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]] 23188 23189[[protocol][An object specifying protocol parameters to be used.]] 23190 23191] 23192 23193 23194[heading Exceptions] 23195 23196 23197[variablelist 23198 23199[[boost::system::system_error][Thrown on failure. ]] 23200 23201] 23202 23203 23204 23205 23206[endsect] 23207 23208 23209 23210[section:overload4 basic_seq_packet_socket::basic_seq_packet_socket (4 of 10 overloads)] 23211 23212 23213Construct and open a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`]. 23214 23215 23216 template< 23217 typename ExecutionContext> 23218 basic_seq_packet_socket( 23219 ExecutionContext & context, 23220 const protocol_type & protocol, 23221 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value, defaulted_constraint >::type = defaulted_constraint()); 23222 23223 23224This 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. 23225 23226 23227[heading Parameters] 23228 23229 23230[variablelist 23231 23232[[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.]] 23233 23234[[protocol][An object specifying protocol parameters to be used.]] 23235 23236] 23237 23238 23239[heading Exceptions] 23240 23241 23242[variablelist 23243 23244[[boost::system::system_error][Thrown on failure. ]] 23245 23246] 23247 23248 23249 23250 23251[endsect] 23252 23253 23254 23255[section:overload5 basic_seq_packet_socket::basic_seq_packet_socket (5 of 10 overloads)] 23256 23257 23258Construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`], opening it and binding it to the given local endpoint. 23259 23260 23261 basic_seq_packet_socket( 23262 const executor_type & ex, 23263 const endpoint_type & endpoint); 23264 23265 23266This 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. 23267 23268 23269[heading Parameters] 23270 23271 23272[variablelist 23273 23274[[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]] 23275 23276[[endpoint][An endpoint on the local machine to which the sequenced packet socket will be bound.]] 23277 23278] 23279 23280 23281[heading Exceptions] 23282 23283 23284[variablelist 23285 23286[[boost::system::system_error][Thrown on failure. ]] 23287 23288] 23289 23290 23291 23292 23293[endsect] 23294 23295 23296 23297[section:overload6 basic_seq_packet_socket::basic_seq_packet_socket (6 of 10 overloads)] 23298 23299 23300Construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`], opening it and binding it to the given local endpoint. 23301 23302 23303 template< 23304 typename ExecutionContext> 23305 basic_seq_packet_socket( 23306 ExecutionContext & context, 23307 const endpoint_type & endpoint, 23308 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 23309 23310 23311This 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. 23312 23313 23314[heading Parameters] 23315 23316 23317[variablelist 23318 23319[[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.]] 23320 23321[[endpoint][An endpoint on the local machine to which the sequenced packet socket will be bound.]] 23322 23323] 23324 23325 23326[heading Exceptions] 23327 23328 23329[variablelist 23330 23331[[boost::system::system_error][Thrown on failure. ]] 23332 23333] 23334 23335 23336 23337 23338[endsect] 23339 23340 23341 23342[section:overload7 basic_seq_packet_socket::basic_seq_packet_socket (7 of 10 overloads)] 23343 23344 23345Construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] on an existing native socket. 23346 23347 23348 basic_seq_packet_socket( 23349 const executor_type & ex, 23350 const protocol_type & protocol, 23351 const native_handle_type & native_socket); 23352 23353 23354This constructor creates a sequenced packet socket object to hold an existing native socket. 23355 23356 23357[heading Parameters] 23358 23359 23360[variablelist 23361 23362[[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]] 23363 23364[[protocol][An object specifying protocol parameters to be used.]] 23365 23366[[native_socket][The new underlying socket implementation.]] 23367 23368] 23369 23370 23371[heading Exceptions] 23372 23373 23374[variablelist 23375 23376[[boost::system::system_error][Thrown on failure. ]] 23377 23378] 23379 23380 23381 23382 23383[endsect] 23384 23385 23386 23387[section:overload8 basic_seq_packet_socket::basic_seq_packet_socket (8 of 10 overloads)] 23388 23389 23390Construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] on an existing native socket. 23391 23392 23393 template< 23394 typename ExecutionContext> 23395 basic_seq_packet_socket( 23396 ExecutionContext & context, 23397 const protocol_type & protocol, 23398 const native_handle_type & native_socket, 23399 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 23400 23401 23402This constructor creates a sequenced packet socket object to hold an existing native socket. 23403 23404 23405[heading Parameters] 23406 23407 23408[variablelist 23409 23410[[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.]] 23411 23412[[protocol][An object specifying protocol parameters to be used.]] 23413 23414[[native_socket][The new underlying socket implementation.]] 23415 23416] 23417 23418 23419[heading Exceptions] 23420 23421 23422[variablelist 23423 23424[[boost::system::system_error][Thrown on failure. ]] 23425 23426] 23427 23428 23429 23430 23431[endsect] 23432 23433 23434 23435[section:overload9 basic_seq_packet_socket::basic_seq_packet_socket (9 of 10 overloads)] 23436 23437 23438Move-construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] from another. 23439 23440 23441 basic_seq_packet_socket( 23442 basic_seq_packet_socket && other); 23443 23444 23445This constructor moves a sequenced packet socket from one object to another. 23446 23447 23448[heading Parameters] 23449 23450 23451[variablelist 23452 23453[[other][The other [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] object from which the move will occur.]] 23454 23455] 23456 23457 23458[heading Remarks] 23459 23460Following the move, the moved-from object is in the same state as if constructed using the `basic_seq_packet_socket(const executor_type&)` constructor. 23461 23462 23463 23464 23465[endsect] 23466 23467 23468 23469[section:overload10 basic_seq_packet_socket::basic_seq_packet_socket (10 of 10 overloads)] 23470 23471 23472Move-construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] from a socket of another protocol type. 23473 23474 23475 template< 23476 typename ``[link boost_asio.reference.Protocol Protocol1]``, 23477 typename ``[link boost_asio.reference.Executor1 Executor1]``> 23478 basic_seq_packet_socket( 23479 basic_seq_packet_socket< Protocol1, Executor1 > && other, 23480 typename constraint< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type = 0); 23481 23482 23483This constructor moves a sequenced packet socket from one object to another. 23484 23485 23486[heading Parameters] 23487 23488 23489[variablelist 23490 23491[[other][The other [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] object from which the move will occur.]] 23492 23493] 23494 23495 23496[heading Remarks] 23497 23498Following the move, the moved-from object is in the same state as if constructed using the `basic_seq_packet_socket(const executor_type&)` constructor. 23499 23500 23501 23502 23503[endsect] 23504 23505 23506[endsect] 23507 23508[section:bind basic_seq_packet_socket::bind] 23509 23510[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.bind..bind..basic_seq_packet_socket] 23511Bind the socket to the given local endpoint. 23512 23513 23514 void ``[link boost_asio.reference.basic_seq_packet_socket.bind.overload1 bind]``( 23515 const endpoint_type & endpoint); 23516 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.bind.overload1 more...]]`` 23517 23518 void ``[link boost_asio.reference.basic_seq_packet_socket.bind.overload2 bind]``( 23519 const endpoint_type & endpoint, 23520 boost::system::error_code & ec); 23521 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.bind.overload2 more...]]`` 23522 23523 23524[section:overload1 basic_seq_packet_socket::bind (1 of 2 overloads)] 23525 23526 23527['Inherited from basic_socket.] 23528 23529 23530Bind the socket to the given local endpoint. 23531 23532 23533 void bind( 23534 const endpoint_type & endpoint); 23535 23536 23537This function binds the socket to the specified endpoint on the local machine. 23538 23539 23540[heading Parameters] 23541 23542 23543[variablelist 23544 23545[[endpoint][An endpoint on the local machine to which the socket will be bound.]] 23546 23547] 23548 23549 23550[heading Exceptions] 23551 23552 23553[variablelist 23554 23555[[boost::system::system_error][Thrown on failure.]] 23556 23557] 23558 23559 23560[heading Example] 23561 23562 23563 23564 boost::asio::ip::tcp::socket socket(my_context); 23565 socket.open(boost::asio::ip::tcp::v4()); 23566 socket.bind(boost::asio::ip::tcp::endpoint( 23567 boost::asio::ip::tcp::v4(), 12345)); 23568 23569 23570 23571 23572 23573 23574 23575[endsect] 23576 23577 23578 23579[section:overload2 basic_seq_packet_socket::bind (2 of 2 overloads)] 23580 23581 23582['Inherited from basic_socket.] 23583 23584 23585Bind the socket to the given local endpoint. 23586 23587 23588 void bind( 23589 const endpoint_type & endpoint, 23590 boost::system::error_code & ec); 23591 23592 23593This function binds the socket to the specified endpoint on the local machine. 23594 23595 23596[heading Parameters] 23597 23598 23599[variablelist 23600 23601[[endpoint][An endpoint on the local machine to which the socket will be bound.]] 23602 23603[[ec][Set to indicate what error occurred, if any.]] 23604 23605] 23606 23607 23608[heading Example] 23609 23610 23611 23612 boost::asio::ip::tcp::socket socket(my_context); 23613 socket.open(boost::asio::ip::tcp::v4()); 23614 boost::system::error_code ec; 23615 socket.bind(boost::asio::ip::tcp::endpoint( 23616 boost::asio::ip::tcp::v4(), 12345), ec); 23617 if (ec) 23618 { 23619 // An error occurred. 23620 } 23621 23622 23623 23624 23625 23626 23627 23628[endsect] 23629 23630 23631[endsect] 23632 23633 23634[section:broadcast basic_seq_packet_socket::broadcast] 23635 23636 23637['Inherited from socket_base.] 23638 23639[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.broadcast..broadcast..basic_seq_packet_socket] 23640Socket option to permit sending of broadcast messages. 23641 23642 23643 typedef implementation_defined broadcast; 23644 23645 23646 23647Implements the SOL\_SOCKET/SO\_BROADCAST socket option. 23648 23649 23650[heading Examples] 23651 23652Setting the option: 23653 23654 boost::asio::ip::udp::socket socket(my_context); 23655 ... 23656 boost::asio::socket_base::broadcast option(true); 23657 socket.set_option(option); 23658 23659 23660 23661 23662 23663Getting the current option value: 23664 23665 boost::asio::ip::udp::socket socket(my_context); 23666 ... 23667 boost::asio::socket_base::broadcast option; 23668 socket.get_option(option); 23669 bool is_set = option.value(); 23670 23671 23672 23673 23674 23675 23676 23677[heading Requirements] 23678 23679['Header: ][^boost/asio/basic_seq_packet_socket.hpp] 23680 23681['Convenience header: ][^boost/asio.hpp] 23682 23683 23684[endsect] 23685 23686 23687 23688[section:bytes_readable basic_seq_packet_socket::bytes_readable] 23689 23690 23691['Inherited from socket_base.] 23692 23693[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.bytes_readable..bytes_readable..basic_seq_packet_socket] 23694IO control command to get the amount of data that can be read without blocking. 23695 23696 23697 typedef implementation_defined bytes_readable; 23698 23699 23700 23701Implements the FIONREAD IO control command. 23702 23703 23704[heading Example] 23705 23706 23707 23708 boost::asio::ip::tcp::socket socket(my_context); 23709 ... 23710 boost::asio::socket_base::bytes_readable command(true); 23711 socket.io_control(command); 23712 std::size_t bytes_readable = command.get(); 23713 23714 23715 23716 23717 23718 23719 23720[heading Requirements] 23721 23722['Header: ][^boost/asio/basic_seq_packet_socket.hpp] 23723 23724['Convenience header: ][^boost/asio.hpp] 23725 23726 23727[endsect] 23728 23729 23730[section:cancel basic_seq_packet_socket::cancel] 23731 23732[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.cancel..cancel..basic_seq_packet_socket] 23733Cancel all asynchronous operations associated with the socket. 23734 23735 23736 void ``[link boost_asio.reference.basic_seq_packet_socket.cancel.overload1 cancel]``(); 23737 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.cancel.overload1 more...]]`` 23738 23739 void ``[link boost_asio.reference.basic_seq_packet_socket.cancel.overload2 cancel]``( 23740 boost::system::error_code & ec); 23741 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.cancel.overload2 more...]]`` 23742 23743 23744[section:overload1 basic_seq_packet_socket::cancel (1 of 2 overloads)] 23745 23746 23747['Inherited from basic_socket.] 23748 23749 23750Cancel all asynchronous operations associated with the socket. 23751 23752 23753 void cancel(); 23754 23755 23756This 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. 23757 23758 23759[heading Exceptions] 23760 23761 23762[variablelist 23763 23764[[boost::system::system_error][Thrown on failure.]] 23765 23766] 23767 23768 23769[heading Remarks] 23770 23771Calls 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: 23772 23773 23774* It will only cancel asynchronous operations that were initiated in the current thread. 23775 23776 23777* 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. 23778 23779For portable cancellation, consider using one of the following alternatives: 23780 23781 23782* Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP. 23783 23784 23785* Use the `close()` function to simultaneously cancel the outstanding operations and close the socket. 23786 23787When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above. 23788 23789 23790[endsect] 23791 23792 23793 23794[section:overload2 basic_seq_packet_socket::cancel (2 of 2 overloads)] 23795 23796 23797['Inherited from basic_socket.] 23798 23799 23800Cancel all asynchronous operations associated with the socket. 23801 23802 23803 void cancel( 23804 boost::system::error_code & ec); 23805 23806 23807This 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. 23808 23809 23810[heading Parameters] 23811 23812 23813[variablelist 23814 23815[[ec][Set to indicate what error occurred, if any.]] 23816 23817] 23818 23819 23820[heading Remarks] 23821 23822Calls 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: 23823 23824 23825* It will only cancel asynchronous operations that were initiated in the current thread. 23826 23827 23828* 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. 23829 23830For portable cancellation, consider using one of the following alternatives: 23831 23832 23833* Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP. 23834 23835 23836* Use the `close()` function to simultaneously cancel the outstanding operations and close the socket. 23837 23838When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above. 23839 23840 23841[endsect] 23842 23843 23844[endsect] 23845 23846[section:close basic_seq_packet_socket::close] 23847 23848[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.close..close..basic_seq_packet_socket] 23849Close the socket. 23850 23851 23852 void ``[link boost_asio.reference.basic_seq_packet_socket.close.overload1 close]``(); 23853 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.close.overload1 more...]]`` 23854 23855 void ``[link boost_asio.reference.basic_seq_packet_socket.close.overload2 close]``( 23856 boost::system::error_code & ec); 23857 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.close.overload2 more...]]`` 23858 23859 23860[section:overload1 basic_seq_packet_socket::close (1 of 2 overloads)] 23861 23862 23863['Inherited from basic_socket.] 23864 23865 23866Close the socket. 23867 23868 23869 void close(); 23870 23871 23872This 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. 23873 23874 23875[heading Exceptions] 23876 23877 23878[variablelist 23879 23880[[boost::system::system_error][Thrown on failure. Note that, even if the function indicates an error, the underlying descriptor is closed.]] 23881 23882] 23883 23884 23885[heading Remarks] 23886 23887For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket. 23888 23889 23890 23891 23892[endsect] 23893 23894 23895 23896[section:overload2 basic_seq_packet_socket::close (2 of 2 overloads)] 23897 23898 23899['Inherited from basic_socket.] 23900 23901 23902Close the socket. 23903 23904 23905 void close( 23906 boost::system::error_code & ec); 23907 23908 23909This 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. 23910 23911 23912[heading Parameters] 23913 23914 23915[variablelist 23916 23917[[ec][Set to indicate what error occurred, if any. Note that, even if the function indicates an error, the underlying descriptor is closed.]] 23918 23919] 23920 23921 23922[heading Example] 23923 23924 23925 23926 boost::asio::ip::tcp::socket socket(my_context); 23927 ... 23928 boost::system::error_code ec; 23929 socket.close(ec); 23930 if (ec) 23931 { 23932 // An error occurred. 23933 } 23934 23935 23936 23937 23938 23939[heading Remarks] 23940 23941For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket. 23942 23943 23944 23945 23946[endsect] 23947 23948 23949[endsect] 23950 23951[section:connect basic_seq_packet_socket::connect] 23952 23953[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.connect..connect..basic_seq_packet_socket] 23954Connect the socket to the specified endpoint. 23955 23956 23957 void ``[link boost_asio.reference.basic_seq_packet_socket.connect.overload1 connect]``( 23958 const endpoint_type & peer_endpoint); 23959 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.connect.overload1 more...]]`` 23960 23961 void ``[link boost_asio.reference.basic_seq_packet_socket.connect.overload2 connect]``( 23962 const endpoint_type & peer_endpoint, 23963 boost::system::error_code & ec); 23964 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.connect.overload2 more...]]`` 23965 23966 23967[section:overload1 basic_seq_packet_socket::connect (1 of 2 overloads)] 23968 23969 23970['Inherited from basic_socket.] 23971 23972 23973Connect the socket to the specified endpoint. 23974 23975 23976 void connect( 23977 const endpoint_type & peer_endpoint); 23978 23979 23980This 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. 23981 23982The 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. 23983 23984 23985[heading Parameters] 23986 23987 23988[variablelist 23989 23990[[peer_endpoint][The remote endpoint to which the socket will be connected.]] 23991 23992] 23993 23994 23995[heading Exceptions] 23996 23997 23998[variablelist 23999 24000[[boost::system::system_error][Thrown on failure.]] 24001 24002] 24003 24004 24005[heading Example] 24006 24007 24008 24009 boost::asio::ip::tcp::socket socket(my_context); 24010 boost::asio::ip::tcp::endpoint endpoint( 24011 boost::asio::ip::address::from_string("1.2.3.4"), 12345); 24012 socket.connect(endpoint); 24013 24014 24015 24016 24017 24018 24019 24020[endsect] 24021 24022 24023 24024[section:overload2 basic_seq_packet_socket::connect (2 of 2 overloads)] 24025 24026 24027['Inherited from basic_socket.] 24028 24029 24030Connect the socket to the specified endpoint. 24031 24032 24033 void connect( 24034 const endpoint_type & peer_endpoint, 24035 boost::system::error_code & ec); 24036 24037 24038This 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. 24039 24040The 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. 24041 24042 24043[heading Parameters] 24044 24045 24046[variablelist 24047 24048[[peer_endpoint][The remote endpoint to which the socket will be connected.]] 24049 24050[[ec][Set to indicate what error occurred, if any.]] 24051 24052] 24053 24054 24055[heading Example] 24056 24057 24058 24059 boost::asio::ip::tcp::socket socket(my_context); 24060 boost::asio::ip::tcp::endpoint endpoint( 24061 boost::asio::ip::address::from_string("1.2.3.4"), 12345); 24062 boost::system::error_code ec; 24063 socket.connect(endpoint, ec); 24064 if (ec) 24065 { 24066 // An error occurred. 24067 } 24068 24069 24070 24071 24072 24073 24074 24075[endsect] 24076 24077 24078[endsect] 24079 24080 24081[section:debug basic_seq_packet_socket::debug] 24082 24083 24084['Inherited from socket_base.] 24085 24086[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.debug..debug..basic_seq_packet_socket] 24087Socket option to enable socket-level debugging. 24088 24089 24090 typedef implementation_defined debug; 24091 24092 24093 24094Implements the SOL\_SOCKET/SO\_DEBUG socket option. 24095 24096 24097[heading Examples] 24098 24099Setting the option: 24100 24101 boost::asio::ip::tcp::socket socket(my_context); 24102 ... 24103 boost::asio::socket_base::debug option(true); 24104 socket.set_option(option); 24105 24106 24107 24108 24109 24110Getting the current option value: 24111 24112 boost::asio::ip::tcp::socket socket(my_context); 24113 ... 24114 boost::asio::socket_base::debug option; 24115 socket.get_option(option); 24116 bool is_set = option.value(); 24117 24118 24119 24120 24121 24122 24123 24124[heading Requirements] 24125 24126['Header: ][^boost/asio/basic_seq_packet_socket.hpp] 24127 24128['Convenience header: ][^boost/asio.hpp] 24129 24130 24131[endsect] 24132 24133 24134 24135[section:do_not_route basic_seq_packet_socket::do_not_route] 24136 24137 24138['Inherited from socket_base.] 24139 24140[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.do_not_route..do_not_route..basic_seq_packet_socket] 24141Socket option to prevent routing, use local interfaces only. 24142 24143 24144 typedef implementation_defined do_not_route; 24145 24146 24147 24148Implements the SOL\_SOCKET/SO\_DONTROUTE socket option. 24149 24150 24151[heading Examples] 24152 24153Setting the option: 24154 24155 boost::asio::ip::udp::socket socket(my_context); 24156 ... 24157 boost::asio::socket_base::do_not_route option(true); 24158 socket.set_option(option); 24159 24160 24161 24162 24163 24164Getting the current option value: 24165 24166 boost::asio::ip::udp::socket socket(my_context); 24167 ... 24168 boost::asio::socket_base::do_not_route option; 24169 socket.get_option(option); 24170 bool is_set = option.value(); 24171 24172 24173 24174 24175 24176 24177 24178[heading Requirements] 24179 24180['Header: ][^boost/asio/basic_seq_packet_socket.hpp] 24181 24182['Convenience header: ][^boost/asio.hpp] 24183 24184 24185[endsect] 24186 24187 24188 24189[section:enable_connection_aborted basic_seq_packet_socket::enable_connection_aborted] 24190 24191 24192['Inherited from socket_base.] 24193 24194[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.enable_connection_aborted..enable_connection_aborted..basic_seq_packet_socket] 24195Socket option to report aborted connections on accept. 24196 24197 24198 typedef implementation_defined enable_connection_aborted; 24199 24200 24201 24202Implements 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. 24203 24204 24205[heading Examples] 24206 24207Setting the option: 24208 24209 boost::asio::ip::tcp::acceptor acceptor(my_context); 24210 ... 24211 boost::asio::socket_base::enable_connection_aborted option(true); 24212 acceptor.set_option(option); 24213 24214 24215 24216 24217 24218Getting the current option value: 24219 24220 boost::asio::ip::tcp::acceptor acceptor(my_context); 24221 ... 24222 boost::asio::socket_base::enable_connection_aborted option; 24223 acceptor.get_option(option); 24224 bool is_set = option.value(); 24225 24226 24227 24228 24229 24230 24231 24232[heading Requirements] 24233 24234['Header: ][^boost/asio/basic_seq_packet_socket.hpp] 24235 24236['Convenience header: ][^boost/asio.hpp] 24237 24238 24239[endsect] 24240 24241 24242 24243[section:endpoint_type basic_seq_packet_socket::endpoint_type] 24244 24245[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.endpoint_type..endpoint_type..basic_seq_packet_socket] 24246The endpoint type. 24247 24248 24249 typedef Protocol::endpoint endpoint_type; 24250 24251 24252 24253[heading Requirements] 24254 24255['Header: ][^boost/asio/basic_seq_packet_socket.hpp] 24256 24257['Convenience header: ][^boost/asio.hpp] 24258 24259 24260[endsect] 24261 24262 24263 24264[section:executor_type basic_seq_packet_socket::executor_type] 24265 24266[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.executor_type..executor_type..basic_seq_packet_socket] 24267The type of the executor associated with the object. 24268 24269 24270 typedef Executor executor_type; 24271 24272 24273 24274[heading Requirements] 24275 24276['Header: ][^boost/asio/basic_seq_packet_socket.hpp] 24277 24278['Convenience header: ][^boost/asio.hpp] 24279 24280 24281[endsect] 24282 24283 24284 24285[section:get_executor basic_seq_packet_socket::get_executor] 24286 24287 24288['Inherited from basic_socket.] 24289 24290[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.get_executor..get_executor..basic_seq_packet_socket] 24291Get the executor associated with the object. 24292 24293 24294 executor_type get_executor(); 24295 24296 24297 24298[endsect] 24299 24300 24301[section:get_option basic_seq_packet_socket::get_option] 24302 24303[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.get_option..get_option..basic_seq_packet_socket] 24304Get an option from the socket. 24305 24306 24307 template< 24308 typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``> 24309 void ``[link boost_asio.reference.basic_seq_packet_socket.get_option.overload1 get_option]``( 24310 GettableSocketOption & option) const; 24311 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.get_option.overload1 more...]]`` 24312 24313 template< 24314 typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``> 24315 void ``[link boost_asio.reference.basic_seq_packet_socket.get_option.overload2 get_option]``( 24316 GettableSocketOption & option, 24317 boost::system::error_code & ec) const; 24318 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.get_option.overload2 more...]]`` 24319 24320 24321[section:overload1 basic_seq_packet_socket::get_option (1 of 2 overloads)] 24322 24323 24324['Inherited from basic_socket.] 24325 24326 24327Get an option from the socket. 24328 24329 24330 template< 24331 typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``> 24332 void get_option( 24333 GettableSocketOption & option) const; 24334 24335 24336This function is used to get the current value of an option on the socket. 24337 24338 24339[heading Parameters] 24340 24341 24342[variablelist 24343 24344[[option][The option value to be obtained from the socket.]] 24345 24346] 24347 24348 24349[heading Exceptions] 24350 24351 24352[variablelist 24353 24354[[boost::system::system_error][Thrown on failure.]] 24355 24356] 24357 24358 24359 24360[heading Example] 24361 24362Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option: 24363 24364 boost::asio::ip::tcp::socket socket(my_context); 24365 ... 24366 boost::asio::ip::tcp::socket::keep_alive option; 24367 socket.get_option(option); 24368 bool is_set = option.value(); 24369 24370 24371 24372 24373 24374 24375 24376[endsect] 24377 24378 24379 24380[section:overload2 basic_seq_packet_socket::get_option (2 of 2 overloads)] 24381 24382 24383['Inherited from basic_socket.] 24384 24385 24386Get an option from the socket. 24387 24388 24389 template< 24390 typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``> 24391 void get_option( 24392 GettableSocketOption & option, 24393 boost::system::error_code & ec) const; 24394 24395 24396This function is used to get the current value of an option on the socket. 24397 24398 24399[heading Parameters] 24400 24401 24402[variablelist 24403 24404[[option][The option value to be obtained from the socket.]] 24405 24406[[ec][Set to indicate what error occurred, if any.]] 24407 24408] 24409 24410 24411 24412[heading Example] 24413 24414Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option: 24415 24416 boost::asio::ip::tcp::socket socket(my_context); 24417 ... 24418 boost::asio::ip::tcp::socket::keep_alive option; 24419 boost::system::error_code ec; 24420 socket.get_option(option, ec); 24421 if (ec) 24422 { 24423 // An error occurred. 24424 } 24425 bool is_set = option.value(); 24426 24427 24428 24429 24430 24431 24432 24433[endsect] 24434 24435 24436[endsect] 24437 24438[section:io_control basic_seq_packet_socket::io_control] 24439 24440[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.io_control..io_control..basic_seq_packet_socket] 24441Perform an IO control command on the socket. 24442 24443 24444 template< 24445 typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> 24446 void ``[link boost_asio.reference.basic_seq_packet_socket.io_control.overload1 io_control]``( 24447 IoControlCommand & command); 24448 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.io_control.overload1 more...]]`` 24449 24450 template< 24451 typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> 24452 void ``[link boost_asio.reference.basic_seq_packet_socket.io_control.overload2 io_control]``( 24453 IoControlCommand & command, 24454 boost::system::error_code & ec); 24455 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.io_control.overload2 more...]]`` 24456 24457 24458[section:overload1 basic_seq_packet_socket::io_control (1 of 2 overloads)] 24459 24460 24461['Inherited from basic_socket.] 24462 24463 24464Perform an IO control command on the socket. 24465 24466 24467 template< 24468 typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> 24469 void io_control( 24470 IoControlCommand & command); 24471 24472 24473This function is used to execute an IO control command on the socket. 24474 24475 24476[heading Parameters] 24477 24478 24479[variablelist 24480 24481[[command][The IO control command to be performed on the socket.]] 24482 24483] 24484 24485 24486[heading Exceptions] 24487 24488 24489[variablelist 24490 24491[[boost::system::system_error][Thrown on failure.]] 24492 24493] 24494 24495 24496 24497[heading Example] 24498 24499Getting the number of bytes ready to read: 24500 24501 boost::asio::ip::tcp::socket socket(my_context); 24502 ... 24503 boost::asio::ip::tcp::socket::bytes_readable command; 24504 socket.io_control(command); 24505 std::size_t bytes_readable = command.get(); 24506 24507 24508 24509 24510 24511 24512 24513[endsect] 24514 24515 24516 24517[section:overload2 basic_seq_packet_socket::io_control (2 of 2 overloads)] 24518 24519 24520['Inherited from basic_socket.] 24521 24522 24523Perform an IO control command on the socket. 24524 24525 24526 template< 24527 typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> 24528 void io_control( 24529 IoControlCommand & command, 24530 boost::system::error_code & ec); 24531 24532 24533This function is used to execute an IO control command on the socket. 24534 24535 24536[heading Parameters] 24537 24538 24539[variablelist 24540 24541[[command][The IO control command to be performed on the socket.]] 24542 24543[[ec][Set to indicate what error occurred, if any.]] 24544 24545] 24546 24547 24548 24549[heading Example] 24550 24551Getting the number of bytes ready to read: 24552 24553 boost::asio::ip::tcp::socket socket(my_context); 24554 ... 24555 boost::asio::ip::tcp::socket::bytes_readable command; 24556 boost::system::error_code ec; 24557 socket.io_control(command, ec); 24558 if (ec) 24559 { 24560 // An error occurred. 24561 } 24562 std::size_t bytes_readable = command.get(); 24563 24564 24565 24566 24567 24568 24569 24570[endsect] 24571 24572 24573[endsect] 24574 24575 24576[section:is_open basic_seq_packet_socket::is_open] 24577 24578 24579['Inherited from basic_socket.] 24580 24581[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.is_open..is_open..basic_seq_packet_socket] 24582Determine whether the socket is open. 24583 24584 24585 bool is_open() const; 24586 24587 24588 24589[endsect] 24590 24591 24592 24593[section:keep_alive basic_seq_packet_socket::keep_alive] 24594 24595 24596['Inherited from socket_base.] 24597 24598[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.keep_alive..keep_alive..basic_seq_packet_socket] 24599Socket option to send keep-alives. 24600 24601 24602 typedef implementation_defined keep_alive; 24603 24604 24605 24606Implements the SOL\_SOCKET/SO\_KEEPALIVE socket option. 24607 24608 24609[heading Examples] 24610 24611Setting the option: 24612 24613 boost::asio::ip::tcp::socket socket(my_context); 24614 ... 24615 boost::asio::socket_base::keep_alive option(true); 24616 socket.set_option(option); 24617 24618 24619 24620 24621 24622Getting the current option value: 24623 24624 boost::asio::ip::tcp::socket socket(my_context); 24625 ... 24626 boost::asio::socket_base::keep_alive option; 24627 socket.get_option(option); 24628 bool is_set = option.value(); 24629 24630 24631 24632 24633 24634 24635 24636[heading Requirements] 24637 24638['Header: ][^boost/asio/basic_seq_packet_socket.hpp] 24639 24640['Convenience header: ][^boost/asio.hpp] 24641 24642 24643[endsect] 24644 24645 24646 24647[section:linger basic_seq_packet_socket::linger] 24648 24649 24650['Inherited from socket_base.] 24651 24652[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.linger..linger..basic_seq_packet_socket] 24653Socket option to specify whether the socket lingers on close if unsent data is present. 24654 24655 24656 typedef implementation_defined linger; 24657 24658 24659 24660Implements the SOL\_SOCKET/SO\_LINGER socket option. 24661 24662 24663[heading Examples] 24664 24665Setting the option: 24666 24667 boost::asio::ip::tcp::socket socket(my_context); 24668 ... 24669 boost::asio::socket_base::linger option(true, 30); 24670 socket.set_option(option); 24671 24672 24673 24674 24675 24676Getting the current option value: 24677 24678 boost::asio::ip::tcp::socket socket(my_context); 24679 ... 24680 boost::asio::socket_base::linger option; 24681 socket.get_option(option); 24682 bool is_set = option.enabled(); 24683 unsigned short timeout = option.timeout(); 24684 24685 24686 24687 24688 24689 24690 24691[heading Requirements] 24692 24693['Header: ][^boost/asio/basic_seq_packet_socket.hpp] 24694 24695['Convenience header: ][^boost/asio.hpp] 24696 24697 24698[endsect] 24699 24700 24701[section:local_endpoint basic_seq_packet_socket::local_endpoint] 24702 24703[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.local_endpoint..local_endpoint..basic_seq_packet_socket] 24704Get the local endpoint of the socket. 24705 24706 24707 endpoint_type ``[link boost_asio.reference.basic_seq_packet_socket.local_endpoint.overload1 local_endpoint]``() const; 24708 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.local_endpoint.overload1 more...]]`` 24709 24710 endpoint_type ``[link boost_asio.reference.basic_seq_packet_socket.local_endpoint.overload2 local_endpoint]``( 24711 boost::system::error_code & ec) const; 24712 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.local_endpoint.overload2 more...]]`` 24713 24714 24715[section:overload1 basic_seq_packet_socket::local_endpoint (1 of 2 overloads)] 24716 24717 24718['Inherited from basic_socket.] 24719 24720 24721Get the local endpoint of the socket. 24722 24723 24724 endpoint_type local_endpoint() const; 24725 24726 24727This function is used to obtain the locally bound endpoint of the socket. 24728 24729 24730[heading Return Value] 24731 24732An object that represents the local endpoint of the socket. 24733 24734 24735[heading Exceptions] 24736 24737 24738[variablelist 24739 24740[[boost::system::system_error][Thrown on failure.]] 24741 24742] 24743 24744 24745[heading Example] 24746 24747 24748 24749 boost::asio::ip::tcp::socket socket(my_context); 24750 ... 24751 boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint(); 24752 24753 24754 24755 24756 24757 24758 24759[endsect] 24760 24761 24762 24763[section:overload2 basic_seq_packet_socket::local_endpoint (2 of 2 overloads)] 24764 24765 24766['Inherited from basic_socket.] 24767 24768 24769Get the local endpoint of the socket. 24770 24771 24772 endpoint_type local_endpoint( 24773 boost::system::error_code & ec) const; 24774 24775 24776This function is used to obtain the locally bound endpoint of the socket. 24777 24778 24779[heading Parameters] 24780 24781 24782[variablelist 24783 24784[[ec][Set to indicate what error occurred, if any.]] 24785 24786] 24787 24788 24789[heading Return Value] 24790 24791An object that represents the local endpoint of the socket. Returns a default-constructed endpoint object if an error occurred. 24792 24793 24794[heading Example] 24795 24796 24797 24798 boost::asio::ip::tcp::socket socket(my_context); 24799 ... 24800 boost::system::error_code ec; 24801 boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint(ec); 24802 if (ec) 24803 { 24804 // An error occurred. 24805 } 24806 24807 24808 24809 24810 24811 24812 24813[endsect] 24814 24815 24816[endsect] 24817 24818[section:lowest_layer basic_seq_packet_socket::lowest_layer] 24819 24820[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.lowest_layer..lowest_layer..basic_seq_packet_socket] 24821Get a reference to the lowest layer. 24822 24823 24824 lowest_layer_type & ``[link boost_asio.reference.basic_seq_packet_socket.lowest_layer.overload1 lowest_layer]``(); 24825 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.lowest_layer.overload1 more...]]`` 24826 24827 24828Get a const reference to the lowest layer. 24829 24830 24831 const lowest_layer_type & ``[link boost_asio.reference.basic_seq_packet_socket.lowest_layer.overload2 lowest_layer]``() const; 24832 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.lowest_layer.overload2 more...]]`` 24833 24834 24835[section:overload1 basic_seq_packet_socket::lowest_layer (1 of 2 overloads)] 24836 24837 24838['Inherited from basic_socket.] 24839 24840 24841Get a reference to the lowest layer. 24842 24843 24844 lowest_layer_type & lowest_layer(); 24845 24846 24847This 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. 24848 24849 24850[heading Return Value] 24851 24852A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 24853 24854 24855 24856 24857[endsect] 24858 24859 24860 24861[section:overload2 basic_seq_packet_socket::lowest_layer (2 of 2 overloads)] 24862 24863 24864['Inherited from basic_socket.] 24865 24866 24867Get a const reference to the lowest layer. 24868 24869 24870 const lowest_layer_type & lowest_layer() const; 24871 24872 24873This 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. 24874 24875 24876[heading Return Value] 24877 24878A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 24879 24880 24881 24882 24883[endsect] 24884 24885 24886[endsect] 24887 24888 24889[section:lowest_layer_type basic_seq_packet_socket::lowest_layer_type] 24890 24891 24892['Inherited from basic_socket.] 24893 24894[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.lowest_layer_type..lowest_layer_type..basic_seq_packet_socket] 24895A [link boost_asio.reference.basic_socket `basic_socket`] is always the lowest layer. 24896 24897 24898 typedef basic_socket< Protocol, Executor > lowest_layer_type; 24899 24900 24901[heading Types] 24902[table 24903 [[Name][Description]] 24904 24905 [ 24906 24907 [[link boost_asio.reference.basic_socket__rebind_executor [*rebind_executor]]] 24908 [Rebinds the socket type to another executor. ] 24909 24910 ] 24911 24912 [ 24913 24914 [[link boost_asio.reference.basic_socket.broadcast [*broadcast]]] 24915 [Socket option to permit sending of broadcast messages. ] 24916 24917 ] 24918 24919 [ 24920 24921 [[link boost_asio.reference.basic_socket.bytes_readable [*bytes_readable]]] 24922 [IO control command to get the amount of data that can be read without blocking. ] 24923 24924 ] 24925 24926 [ 24927 24928 [[link boost_asio.reference.basic_socket.debug [*debug]]] 24929 [Socket option to enable socket-level debugging. ] 24930 24931 ] 24932 24933 [ 24934 24935 [[link boost_asio.reference.basic_socket.do_not_route [*do_not_route]]] 24936 [Socket option to prevent routing, use local interfaces only. ] 24937 24938 ] 24939 24940 [ 24941 24942 [[link boost_asio.reference.basic_socket.enable_connection_aborted [*enable_connection_aborted]]] 24943 [Socket option to report aborted connections on accept. ] 24944 24945 ] 24946 24947 [ 24948 24949 [[link boost_asio.reference.basic_socket.endpoint_type [*endpoint_type]]] 24950 [The endpoint type. ] 24951 24952 ] 24953 24954 [ 24955 24956 [[link boost_asio.reference.basic_socket.executor_type [*executor_type]]] 24957 [The type of the executor associated with the object. ] 24958 24959 ] 24960 24961 [ 24962 24963 [[link boost_asio.reference.basic_socket.keep_alive [*keep_alive]]] 24964 [Socket option to send keep-alives. ] 24965 24966 ] 24967 24968 [ 24969 24970 [[link boost_asio.reference.basic_socket.linger [*linger]]] 24971 [Socket option to specify whether the socket lingers on close if unsent data is present. ] 24972 24973 ] 24974 24975 [ 24976 24977 [[link boost_asio.reference.basic_socket.lowest_layer_type [*lowest_layer_type]]] 24978 [A basic_socket is always the lowest layer. ] 24979 24980 ] 24981 24982 [ 24983 24984 [[link boost_asio.reference.basic_socket.message_flags [*message_flags]]] 24985 [Bitmask type for flags that can be passed to send and receive operations. ] 24986 24987 ] 24988 24989 [ 24990 24991 [[link boost_asio.reference.basic_socket.native_handle_type [*native_handle_type]]] 24992 [The native representation of a socket. ] 24993 24994 ] 24995 24996 [ 24997 24998 [[link boost_asio.reference.basic_socket.out_of_band_inline [*out_of_band_inline]]] 24999 [Socket option for putting received out-of-band data inline. ] 25000 25001 ] 25002 25003 [ 25004 25005 [[link boost_asio.reference.basic_socket.protocol_type [*protocol_type]]] 25006 [The protocol type. ] 25007 25008 ] 25009 25010 [ 25011 25012 [[link boost_asio.reference.basic_socket.receive_buffer_size [*receive_buffer_size]]] 25013 [Socket option for the receive buffer size of a socket. ] 25014 25015 ] 25016 25017 [ 25018 25019 [[link boost_asio.reference.basic_socket.receive_low_watermark [*receive_low_watermark]]] 25020 [Socket option for the receive low watermark. ] 25021 25022 ] 25023 25024 [ 25025 25026 [[link boost_asio.reference.basic_socket.reuse_address [*reuse_address]]] 25027 [Socket option to allow the socket to be bound to an address that is already in use. ] 25028 25029 ] 25030 25031 [ 25032 25033 [[link boost_asio.reference.basic_socket.send_buffer_size [*send_buffer_size]]] 25034 [Socket option for the send buffer size of a socket. ] 25035 25036 ] 25037 25038 [ 25039 25040 [[link boost_asio.reference.basic_socket.send_low_watermark [*send_low_watermark]]] 25041 [Socket option for the send low watermark. ] 25042 25043 ] 25044 25045 [ 25046 25047 [[link boost_asio.reference.basic_socket.shutdown_type [*shutdown_type]]] 25048 [Different ways a socket may be shutdown. ] 25049 25050 ] 25051 25052 [ 25053 25054 [[link boost_asio.reference.basic_socket.wait_type [*wait_type]]] 25055 [Wait types. ] 25056 25057 ] 25058 25059] 25060 25061[heading Member Functions] 25062[table 25063 [[Name][Description]] 25064 25065 [ 25066 [[link boost_asio.reference.basic_socket.assign [*assign]]] 25067 [Assign an existing native socket to the socket. ] 25068 ] 25069 25070 [ 25071 [[link boost_asio.reference.basic_socket.async_connect [*async_connect]]] 25072 [Start an asynchronous connect. ] 25073 ] 25074 25075 [ 25076 [[link boost_asio.reference.basic_socket.async_wait [*async_wait]]] 25077 [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 25078 ] 25079 25080 [ 25081 [[link boost_asio.reference.basic_socket.at_mark [*at_mark]]] 25082 [Determine whether the socket is at the out-of-band data mark. ] 25083 ] 25084 25085 [ 25086 [[link boost_asio.reference.basic_socket.available [*available]]] 25087 [Determine the number of bytes available for reading. ] 25088 ] 25089 25090 [ 25091 [[link boost_asio.reference.basic_socket.basic_socket [*basic_socket]] [constructor]] 25092 [Construct a basic_socket without opening it. 25093 [hr] 25094 Construct and open a basic_socket. 25095 [hr] 25096 Construct a basic_socket, opening it and binding it to the given local endpoint. 25097 [hr] 25098 Construct a basic_socket on an existing native socket. 25099 [hr] 25100 Move-construct a basic_socket from another. 25101 [hr] 25102 Move-construct a basic_socket from a socket of another protocol type. ] 25103 ] 25104 25105 [ 25106 [[link boost_asio.reference.basic_socket.bind [*bind]]] 25107 [Bind the socket to the given local endpoint. ] 25108 ] 25109 25110 [ 25111 [[link boost_asio.reference.basic_socket.cancel [*cancel]]] 25112 [Cancel all asynchronous operations associated with the socket. ] 25113 ] 25114 25115 [ 25116 [[link boost_asio.reference.basic_socket.close [*close]]] 25117 [Close the socket. ] 25118 ] 25119 25120 [ 25121 [[link boost_asio.reference.basic_socket.connect [*connect]]] 25122 [Connect the socket to the specified endpoint. ] 25123 ] 25124 25125 [ 25126 [[link boost_asio.reference.basic_socket.get_executor [*get_executor]]] 25127 [Get the executor associated with the object. ] 25128 ] 25129 25130 [ 25131 [[link boost_asio.reference.basic_socket.get_option [*get_option]]] 25132 [Get an option from the socket. ] 25133 ] 25134 25135 [ 25136 [[link boost_asio.reference.basic_socket.io_control [*io_control]]] 25137 [Perform an IO control command on the socket. ] 25138 ] 25139 25140 [ 25141 [[link boost_asio.reference.basic_socket.is_open [*is_open]]] 25142 [Determine whether the socket is open. ] 25143 ] 25144 25145 [ 25146 [[link boost_asio.reference.basic_socket.local_endpoint [*local_endpoint]]] 25147 [Get the local endpoint of the socket. ] 25148 ] 25149 25150 [ 25151 [[link boost_asio.reference.basic_socket.lowest_layer [*lowest_layer]]] 25152 [Get a reference to the lowest layer. 25153 [hr] 25154 Get a const reference to the lowest layer. ] 25155 ] 25156 25157 [ 25158 [[link boost_asio.reference.basic_socket.native_handle [*native_handle]]] 25159 [Get the native socket representation. ] 25160 ] 25161 25162 [ 25163 [[link boost_asio.reference.basic_socket.native_non_blocking [*native_non_blocking]]] 25164 [Gets the non-blocking mode of the native socket implementation. 25165 [hr] 25166 Sets the non-blocking mode of the native socket implementation. ] 25167 ] 25168 25169 [ 25170 [[link boost_asio.reference.basic_socket.non_blocking [*non_blocking]]] 25171 [Gets the non-blocking mode of the socket. 25172 [hr] 25173 Sets the non-blocking mode of the socket. ] 25174 ] 25175 25176 [ 25177 [[link boost_asio.reference.basic_socket.open [*open]]] 25178 [Open the socket using the specified protocol. ] 25179 ] 25180 25181 [ 25182 [[link boost_asio.reference.basic_socket.operator_eq_ [*operator=]]] 25183 [Move-assign a basic_socket from another. 25184 [hr] 25185 Move-assign a basic_socket from a socket of another protocol type. ] 25186 ] 25187 25188 [ 25189 [[link boost_asio.reference.basic_socket.release [*release]]] 25190 [Release ownership of the underlying native socket. ] 25191 ] 25192 25193 [ 25194 [[link boost_asio.reference.basic_socket.remote_endpoint [*remote_endpoint]]] 25195 [Get the remote endpoint of the socket. ] 25196 ] 25197 25198 [ 25199 [[link boost_asio.reference.basic_socket.set_option [*set_option]]] 25200 [Set an option on the socket. ] 25201 ] 25202 25203 [ 25204 [[link boost_asio.reference.basic_socket.shutdown [*shutdown]]] 25205 [Disable sends or receives on the socket. ] 25206 ] 25207 25208 [ 25209 [[link boost_asio.reference.basic_socket.wait [*wait]]] 25210 [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 25211 ] 25212 25213] 25214 25215[heading Protected Member Functions] 25216[table 25217 [[Name][Description]] 25218 25219 [ 25220 [[link boost_asio.reference.basic_socket._basic_socket [*~basic_socket]] [destructor]] 25221 [Protected destructor to prevent deletion through this type. ] 25222 ] 25223 25224] 25225 25226[heading Data Members] 25227[table 25228 [[Name][Description]] 25229 25230 [ 25231 [[link boost_asio.reference.basic_socket.max_connections [*max_connections]] [static]] 25232 [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ] 25233 ] 25234 25235 [ 25236 [[link boost_asio.reference.basic_socket.max_listen_connections [*max_listen_connections]] [static]] 25237 [The maximum length of the queue of pending incoming connections. ] 25238 ] 25239 25240 [ 25241 [[link boost_asio.reference.basic_socket.message_do_not_route [*message_do_not_route]] [static]] 25242 [Specify that the data should not be subject to routing. ] 25243 ] 25244 25245 [ 25246 [[link boost_asio.reference.basic_socket.message_end_of_record [*message_end_of_record]] [static]] 25247 [Specifies that the data marks the end of a record. ] 25248 ] 25249 25250 [ 25251 [[link boost_asio.reference.basic_socket.message_out_of_band [*message_out_of_band]] [static]] 25252 [Process out-of-band data. ] 25253 ] 25254 25255 [ 25256 [[link boost_asio.reference.basic_socket.message_peek [*message_peek]] [static]] 25257 [Peek at incoming data without removing it from the input queue. ] 25258 ] 25259 25260] 25261 25262The [link boost_asio.reference.basic_socket `basic_socket`] class template provides functionality that is common to both stream-oriented and datagram-oriented sockets. 25263 25264 25265[heading Thread Safety] 25266 25267['Distinct] ['objects:] Safe. 25268 25269['Shared] ['objects:] Unsafe. 25270 25271 25272 25273 25274[heading Requirements] 25275 25276['Header: ][^boost/asio/basic_seq_packet_socket.hpp] 25277 25278['Convenience header: ][^boost/asio.hpp] 25279 25280 25281[endsect] 25282 25283 25284 25285[section:max_connections basic_seq_packet_socket::max_connections] 25286 25287 25288['Inherited from socket_base.] 25289 25290[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.max_connections..max_connections..basic_seq_packet_socket] 25291(Deprecated: Use max\_listen\_connections.) The maximum length of the queue of pending incoming connections. 25292 25293 25294 static const int max_connections = implementation_defined; 25295 25296 25297 25298[endsect] 25299 25300 25301 25302[section:max_listen_connections basic_seq_packet_socket::max_listen_connections] 25303 25304 25305['Inherited from socket_base.] 25306 25307[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.max_listen_connections..max_listen_connections..basic_seq_packet_socket] 25308The maximum length of the queue of pending incoming connections. 25309 25310 25311 static const int max_listen_connections = implementation_defined; 25312 25313 25314 25315[endsect] 25316 25317 25318 25319[section:message_do_not_route basic_seq_packet_socket::message_do_not_route] 25320 25321 25322['Inherited from socket_base.] 25323 25324[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.message_do_not_route..message_do_not_route..basic_seq_packet_socket] 25325Specify that the data should not be subject to routing. 25326 25327 25328 static const int message_do_not_route = implementation_defined; 25329 25330 25331 25332[endsect] 25333 25334 25335 25336[section:message_end_of_record basic_seq_packet_socket::message_end_of_record] 25337 25338 25339['Inherited from socket_base.] 25340 25341[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.message_end_of_record..message_end_of_record..basic_seq_packet_socket] 25342Specifies that the data marks the end of a record. 25343 25344 25345 static const int message_end_of_record = implementation_defined; 25346 25347 25348 25349[endsect] 25350 25351 25352 25353[section:message_flags basic_seq_packet_socket::message_flags] 25354 25355 25356['Inherited from socket_base.] 25357 25358[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.message_flags..message_flags..basic_seq_packet_socket] 25359Bitmask type for flags that can be passed to send and receive operations. 25360 25361 25362 typedef int message_flags; 25363 25364 25365 25366[heading Requirements] 25367 25368['Header: ][^boost/asio/basic_seq_packet_socket.hpp] 25369 25370['Convenience header: ][^boost/asio.hpp] 25371 25372 25373[endsect] 25374 25375 25376 25377[section:message_out_of_band basic_seq_packet_socket::message_out_of_band] 25378 25379 25380['Inherited from socket_base.] 25381 25382[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.message_out_of_band..message_out_of_band..basic_seq_packet_socket] 25383Process out-of-band data. 25384 25385 25386 static const int message_out_of_band = implementation_defined; 25387 25388 25389 25390[endsect] 25391 25392 25393 25394[section:message_peek basic_seq_packet_socket::message_peek] 25395 25396 25397['Inherited from socket_base.] 25398 25399[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.message_peek..message_peek..basic_seq_packet_socket] 25400Peek at incoming data without removing it from the input queue. 25401 25402 25403 static const int message_peek = implementation_defined; 25404 25405 25406 25407[endsect] 25408 25409 25410 25411[section:native_handle basic_seq_packet_socket::native_handle] 25412 25413 25414['Inherited from basic_socket.] 25415 25416[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.native_handle..native_handle..basic_seq_packet_socket] 25417Get the native socket representation. 25418 25419 25420 native_handle_type native_handle(); 25421 25422 25423This 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. 25424 25425 25426[endsect] 25427 25428 25429 25430[section:native_handle_type basic_seq_packet_socket::native_handle_type] 25431 25432[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.native_handle_type..native_handle_type..basic_seq_packet_socket] 25433The native representation of a socket. 25434 25435 25436 typedef implementation_defined native_handle_type; 25437 25438 25439 25440[heading Requirements] 25441 25442['Header: ][^boost/asio/basic_seq_packet_socket.hpp] 25443 25444['Convenience header: ][^boost/asio.hpp] 25445 25446 25447[endsect] 25448 25449 25450[section:native_non_blocking basic_seq_packet_socket::native_non_blocking] 25451 25452[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.native_non_blocking..native_non_blocking..basic_seq_packet_socket] 25453Gets the non-blocking mode of the native socket implementation. 25454 25455 25456 bool ``[link boost_asio.reference.basic_seq_packet_socket.native_non_blocking.overload1 native_non_blocking]``() const; 25457 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.native_non_blocking.overload1 more...]]`` 25458 25459 25460Sets the non-blocking mode of the native socket implementation. 25461 25462 25463 void ``[link boost_asio.reference.basic_seq_packet_socket.native_non_blocking.overload2 native_non_blocking]``( 25464 bool mode); 25465 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.native_non_blocking.overload2 more...]]`` 25466 25467 void ``[link boost_asio.reference.basic_seq_packet_socket.native_non_blocking.overload3 native_non_blocking]``( 25468 bool mode, 25469 boost::system::error_code & ec); 25470 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.native_non_blocking.overload3 more...]]`` 25471 25472 25473[section:overload1 basic_seq_packet_socket::native_non_blocking (1 of 3 overloads)] 25474 25475 25476['Inherited from basic_socket.] 25477 25478 25479Gets the non-blocking mode of the native socket implementation. 25480 25481 25482 bool native_non_blocking() const; 25483 25484 25485This 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. 25486 25487 25488[heading Return Value] 25489 25490`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). 25491 25492 25493[heading Remarks] 25494 25495The 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. 25496 25497 25498[heading Example] 25499 25500This 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: 25501 25502 template <typename Handler> 25503 struct sendfile_op 25504 { 25505 tcp::socket& sock_; 25506 int fd_; 25507 Handler handler_; 25508 off_t offset_; 25509 std::size_t total_bytes_transferred_; 25510 25511 // Function call operator meeting WriteHandler requirements. 25512 // Used as the handler for the async_write_some operation. 25513 void operator()(boost::system::error_code ec, std::size_t) 25514 { 25515 // Put the underlying socket into non-blocking mode. 25516 if (!ec) 25517 if (!sock_.native_non_blocking()) 25518 sock_.native_non_blocking(true, ec); 25519 25520 if (!ec) 25521 { 25522 for (;;) 25523 { 25524 // Try the system call. 25525 errno = 0; 25526 int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536); 25527 ec = boost::system::error_code(n < 0 ? errno : 0, 25528 boost::asio::error::get_system_category()); 25529 total_bytes_transferred_ += ec ? 0 : n; 25530 25531 // Retry operation immediately if interrupted by signal. 25532 if (ec == boost::asio::error::interrupted) 25533 continue; 25534 25535 // Check if we need to run the operation again. 25536 if (ec == boost::asio::error::would_block 25537 || ec == boost::asio::error::try_again) 25538 { 25539 // We have to wait for the socket to become ready again. 25540 sock_.async_wait(tcp::socket::wait_write, *this); 25541 return; 25542 } 25543 25544 if (ec || n == 0) 25545 { 25546 // An error occurred, or we have reached the end of the file. 25547 // Either way we must exit the loop so we can call the handler. 25548 break; 25549 } 25550 25551 // Loop around to try calling sendfile again. 25552 } 25553 } 25554 25555 // Pass result back to user's handler. 25556 handler_(ec, total_bytes_transferred_); 25557 } 25558 }; 25559 25560 template <typename Handler> 25561 void async_sendfile(tcp::socket& sock, int fd, Handler h) 25562 { 25563 sendfile_op<Handler> op = { sock, fd, h, 0, 0 }; 25564 sock.async_wait(tcp::socket::wait_write, op); 25565 } 25566 25567 25568 25569 25570 25571 25572 25573[endsect] 25574 25575 25576 25577[section:overload2 basic_seq_packet_socket::native_non_blocking (2 of 3 overloads)] 25578 25579 25580['Inherited from basic_socket.] 25581 25582 25583Sets the non-blocking mode of the native socket implementation. 25584 25585 25586 void native_non_blocking( 25587 bool mode); 25588 25589 25590This 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. 25591 25592 25593[heading Parameters] 25594 25595 25596[variablelist 25597 25598[[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).]] 25599 25600] 25601 25602 25603[heading Exceptions] 25604 25605 25606[variablelist 25607 25608[[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.]] 25609 25610] 25611 25612 25613[heading Example] 25614 25615This 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: 25616 25617 template <typename Handler> 25618 struct sendfile_op 25619 { 25620 tcp::socket& sock_; 25621 int fd_; 25622 Handler handler_; 25623 off_t offset_; 25624 std::size_t total_bytes_transferred_; 25625 25626 // Function call operator meeting WriteHandler requirements. 25627 // Used as the handler for the async_write_some operation. 25628 void operator()(boost::system::error_code ec, std::size_t) 25629 { 25630 // Put the underlying socket into non-blocking mode. 25631 if (!ec) 25632 if (!sock_.native_non_blocking()) 25633 sock_.native_non_blocking(true, ec); 25634 25635 if (!ec) 25636 { 25637 for (;;) 25638 { 25639 // Try the system call. 25640 errno = 0; 25641 int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536); 25642 ec = boost::system::error_code(n < 0 ? errno : 0, 25643 boost::asio::error::get_system_category()); 25644 total_bytes_transferred_ += ec ? 0 : n; 25645 25646 // Retry operation immediately if interrupted by signal. 25647 if (ec == boost::asio::error::interrupted) 25648 continue; 25649 25650 // Check if we need to run the operation again. 25651 if (ec == boost::asio::error::would_block 25652 || ec == boost::asio::error::try_again) 25653 { 25654 // We have to wait for the socket to become ready again. 25655 sock_.async_wait(tcp::socket::wait_write, *this); 25656 return; 25657 } 25658 25659 if (ec || n == 0) 25660 { 25661 // An error occurred, or we have reached the end of the file. 25662 // Either way we must exit the loop so we can call the handler. 25663 break; 25664 } 25665 25666 // Loop around to try calling sendfile again. 25667 } 25668 } 25669 25670 // Pass result back to user's handler. 25671 handler_(ec, total_bytes_transferred_); 25672 } 25673 }; 25674 25675 template <typename Handler> 25676 void async_sendfile(tcp::socket& sock, int fd, Handler h) 25677 { 25678 sendfile_op<Handler> op = { sock, fd, h, 0, 0 }; 25679 sock.async_wait(tcp::socket::wait_write, op); 25680 } 25681 25682 25683 25684 25685 25686 25687 25688[endsect] 25689 25690 25691 25692[section:overload3 basic_seq_packet_socket::native_non_blocking (3 of 3 overloads)] 25693 25694 25695['Inherited from basic_socket.] 25696 25697 25698Sets the non-blocking mode of the native socket implementation. 25699 25700 25701 void native_non_blocking( 25702 bool mode, 25703 boost::system::error_code & ec); 25704 25705 25706This 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. 25707 25708 25709[heading Parameters] 25710 25711 25712[variablelist 25713 25714[[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).]] 25715 25716[[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.]] 25717 25718] 25719 25720 25721[heading Example] 25722 25723This 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: 25724 25725 template <typename Handler> 25726 struct sendfile_op 25727 { 25728 tcp::socket& sock_; 25729 int fd_; 25730 Handler handler_; 25731 off_t offset_; 25732 std::size_t total_bytes_transferred_; 25733 25734 // Function call operator meeting WriteHandler requirements. 25735 // Used as the handler for the async_write_some operation. 25736 void operator()(boost::system::error_code ec, std::size_t) 25737 { 25738 // Put the underlying socket into non-blocking mode. 25739 if (!ec) 25740 if (!sock_.native_non_blocking()) 25741 sock_.native_non_blocking(true, ec); 25742 25743 if (!ec) 25744 { 25745 for (;;) 25746 { 25747 // Try the system call. 25748 errno = 0; 25749 int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536); 25750 ec = boost::system::error_code(n < 0 ? errno : 0, 25751 boost::asio::error::get_system_category()); 25752 total_bytes_transferred_ += ec ? 0 : n; 25753 25754 // Retry operation immediately if interrupted by signal. 25755 if (ec == boost::asio::error::interrupted) 25756 continue; 25757 25758 // Check if we need to run the operation again. 25759 if (ec == boost::asio::error::would_block 25760 || ec == boost::asio::error::try_again) 25761 { 25762 // We have to wait for the socket to become ready again. 25763 sock_.async_wait(tcp::socket::wait_write, *this); 25764 return; 25765 } 25766 25767 if (ec || n == 0) 25768 { 25769 // An error occurred, or we have reached the end of the file. 25770 // Either way we must exit the loop so we can call the handler. 25771 break; 25772 } 25773 25774 // Loop around to try calling sendfile again. 25775 } 25776 } 25777 25778 // Pass result back to user's handler. 25779 handler_(ec, total_bytes_transferred_); 25780 } 25781 }; 25782 25783 template <typename Handler> 25784 void async_sendfile(tcp::socket& sock, int fd, Handler h) 25785 { 25786 sendfile_op<Handler> op = { sock, fd, h, 0, 0 }; 25787 sock.async_wait(tcp::socket::wait_write, op); 25788 } 25789 25790 25791 25792 25793 25794 25795 25796[endsect] 25797 25798 25799[endsect] 25800 25801[section:non_blocking basic_seq_packet_socket::non_blocking] 25802 25803[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.non_blocking..non_blocking..basic_seq_packet_socket] 25804Gets the non-blocking mode of the socket. 25805 25806 25807 bool ``[link boost_asio.reference.basic_seq_packet_socket.non_blocking.overload1 non_blocking]``() const; 25808 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.non_blocking.overload1 more...]]`` 25809 25810 25811Sets the non-blocking mode of the socket. 25812 25813 25814 void ``[link boost_asio.reference.basic_seq_packet_socket.non_blocking.overload2 non_blocking]``( 25815 bool mode); 25816 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.non_blocking.overload2 more...]]`` 25817 25818 void ``[link boost_asio.reference.basic_seq_packet_socket.non_blocking.overload3 non_blocking]``( 25819 bool mode, 25820 boost::system::error_code & ec); 25821 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.non_blocking.overload3 more...]]`` 25822 25823 25824[section:overload1 basic_seq_packet_socket::non_blocking (1 of 3 overloads)] 25825 25826 25827['Inherited from basic_socket.] 25828 25829 25830Gets the non-blocking mode of the socket. 25831 25832 25833 bool non_blocking() const; 25834 25835 25836 25837[heading Return Value] 25838 25839`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. 25840 25841 25842[heading Remarks] 25843 25844The 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`. 25845 25846 25847 25848 25849[endsect] 25850 25851 25852 25853[section:overload2 basic_seq_packet_socket::non_blocking (2 of 3 overloads)] 25854 25855 25856['Inherited from basic_socket.] 25857 25858 25859Sets the non-blocking mode of the socket. 25860 25861 25862 void non_blocking( 25863 bool mode); 25864 25865 25866 25867[heading Parameters] 25868 25869 25870[variablelist 25871 25872[[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.]] 25873 25874] 25875 25876 25877[heading Exceptions] 25878 25879 25880[variablelist 25881 25882[[boost::system::system_error][Thrown on failure.]] 25883 25884] 25885 25886 25887[heading Remarks] 25888 25889The 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`. 25890 25891 25892 25893 25894[endsect] 25895 25896 25897 25898[section:overload3 basic_seq_packet_socket::non_blocking (3 of 3 overloads)] 25899 25900 25901['Inherited from basic_socket.] 25902 25903 25904Sets the non-blocking mode of the socket. 25905 25906 25907 void non_blocking( 25908 bool mode, 25909 boost::system::error_code & ec); 25910 25911 25912 25913[heading Parameters] 25914 25915 25916[variablelist 25917 25918[[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.]] 25919 25920[[ec][Set to indicate what error occurred, if any.]] 25921 25922] 25923 25924 25925[heading Remarks] 25926 25927The 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`. 25928 25929 25930 25931 25932[endsect] 25933 25934 25935[endsect] 25936 25937[section:open basic_seq_packet_socket::open] 25938 25939[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.open..open..basic_seq_packet_socket] 25940Open the socket using the specified protocol. 25941 25942 25943 void ``[link boost_asio.reference.basic_seq_packet_socket.open.overload1 open]``( 25944 const protocol_type & protocol = protocol_type()); 25945 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.open.overload1 more...]]`` 25946 25947 void ``[link boost_asio.reference.basic_seq_packet_socket.open.overload2 open]``( 25948 const protocol_type & protocol, 25949 boost::system::error_code & ec); 25950 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.open.overload2 more...]]`` 25951 25952 25953[section:overload1 basic_seq_packet_socket::open (1 of 2 overloads)] 25954 25955 25956['Inherited from basic_socket.] 25957 25958 25959Open the socket using the specified protocol. 25960 25961 25962 void open( 25963 const protocol_type & protocol = protocol_type()); 25964 25965 25966This function opens the socket so that it will use the specified protocol. 25967 25968 25969[heading Parameters] 25970 25971 25972[variablelist 25973 25974[[protocol][An object specifying protocol parameters to be used.]] 25975 25976] 25977 25978 25979[heading Exceptions] 25980 25981 25982[variablelist 25983 25984[[boost::system::system_error][Thrown on failure.]] 25985 25986] 25987 25988 25989[heading Example] 25990 25991 25992 25993 boost::asio::ip::tcp::socket socket(my_context); 25994 socket.open(boost::asio::ip::tcp::v4()); 25995 25996 25997 25998 25999 26000 26001 26002[endsect] 26003 26004 26005 26006[section:overload2 basic_seq_packet_socket::open (2 of 2 overloads)] 26007 26008 26009['Inherited from basic_socket.] 26010 26011 26012Open the socket using the specified protocol. 26013 26014 26015 void open( 26016 const protocol_type & protocol, 26017 boost::system::error_code & ec); 26018 26019 26020This function opens the socket so that it will use the specified protocol. 26021 26022 26023[heading Parameters] 26024 26025 26026[variablelist 26027 26028[[protocol][An object specifying which protocol is to be used.]] 26029 26030[[ec][Set to indicate what error occurred, if any.]] 26031 26032] 26033 26034 26035[heading Example] 26036 26037 26038 26039 boost::asio::ip::tcp::socket socket(my_context); 26040 boost::system::error_code ec; 26041 socket.open(boost::asio::ip::tcp::v4(), ec); 26042 if (ec) 26043 { 26044 // An error occurred. 26045 } 26046 26047 26048 26049 26050 26051 26052 26053[endsect] 26054 26055 26056[endsect] 26057 26058[section:operator_eq_ basic_seq_packet_socket::operator=] 26059 26060[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.operator_eq_..operator=..basic_seq_packet_socket] 26061Move-assign a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] from another. 26062 26063 26064 basic_seq_packet_socket & ``[link boost_asio.reference.basic_seq_packet_socket.operator_eq_.overload1 operator=]``( 26065 basic_seq_packet_socket && other); 26066 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.operator_eq_.overload1 more...]]`` 26067 26068 26069Move-assign a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] from a socket of another protocol type. 26070 26071 26072 template< 26073 typename ``[link boost_asio.reference.Protocol Protocol1]``, 26074 typename ``[link boost_asio.reference.Executor1 Executor1]``> 26075 constraint< 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=]``( 26076 basic_seq_packet_socket< Protocol1, Executor1 > && other); 26077 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.operator_eq_.overload2 more...]]`` 26078 26079 26080[section:overload1 basic_seq_packet_socket::operator= (1 of 2 overloads)] 26081 26082 26083Move-assign a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] from another. 26084 26085 26086 basic_seq_packet_socket & operator=( 26087 basic_seq_packet_socket && other); 26088 26089 26090This assignment operator moves a sequenced packet socket from one object to another. 26091 26092 26093[heading Parameters] 26094 26095 26096[variablelist 26097 26098[[other][The other [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] object from which the move will occur.]] 26099 26100] 26101 26102 26103[heading Remarks] 26104 26105Following the move, the moved-from object is in the same state as if constructed using the `basic_seq_packet_socket(const executor_type&)` constructor. 26106 26107 26108 26109 26110[endsect] 26111 26112 26113 26114[section:overload2 basic_seq_packet_socket::operator= (2 of 2 overloads)] 26115 26116 26117Move-assign a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] from a socket of another protocol type. 26118 26119 26120 template< 26121 typename ``[link boost_asio.reference.Protocol Protocol1]``, 26122 typename ``[link boost_asio.reference.Executor1 Executor1]``> 26123 constraint< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value, basic_seq_packet_socket & >::type operator=( 26124 basic_seq_packet_socket< Protocol1, Executor1 > && other); 26125 26126 26127This assignment operator moves a sequenced packet socket from one object to another. 26128 26129 26130[heading Parameters] 26131 26132 26133[variablelist 26134 26135[[other][The other [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] object from which the move will occur.]] 26136 26137] 26138 26139 26140[heading Remarks] 26141 26142Following the move, the moved-from object is in the same state as if constructed using the `basic_seq_packet_socket(const executor_type&)` constructor. 26143 26144 26145 26146 26147[endsect] 26148 26149 26150[endsect] 26151 26152 26153[section:out_of_band_inline basic_seq_packet_socket::out_of_band_inline] 26154 26155 26156['Inherited from socket_base.] 26157 26158[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.out_of_band_inline..out_of_band_inline..basic_seq_packet_socket] 26159Socket option for putting received out-of-band data inline. 26160 26161 26162 typedef implementation_defined out_of_band_inline; 26163 26164 26165 26166Implements the SOL\_SOCKET/SO\_OOBINLINE socket option. 26167 26168 26169[heading Examples] 26170 26171Setting the option: 26172 26173 boost::asio::ip::tcp::socket socket(my_context); 26174 ... 26175 boost::asio::socket_base::out_of_band_inline option(true); 26176 socket.set_option(option); 26177 26178 26179 26180 26181 26182Getting the current option value: 26183 26184 boost::asio::ip::tcp::socket socket(my_context); 26185 ... 26186 boost::asio::socket_base::out_of_band_inline option; 26187 socket.get_option(option); 26188 bool value = option.value(); 26189 26190 26191 26192 26193 26194 26195 26196[heading Requirements] 26197 26198['Header: ][^boost/asio/basic_seq_packet_socket.hpp] 26199 26200['Convenience header: ][^boost/asio.hpp] 26201 26202 26203[endsect] 26204 26205 26206 26207[section:protocol_type basic_seq_packet_socket::protocol_type] 26208 26209[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.protocol_type..protocol_type..basic_seq_packet_socket] 26210The protocol type. 26211 26212 26213 typedef Protocol protocol_type; 26214 26215 26216 26217[heading Requirements] 26218 26219['Header: ][^boost/asio/basic_seq_packet_socket.hpp] 26220 26221['Convenience header: ][^boost/asio.hpp] 26222 26223 26224[endsect] 26225 26226 26227[section:receive basic_seq_packet_socket::receive] 26228 26229[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.receive..receive..basic_seq_packet_socket] 26230Receive some data on the socket. 26231 26232 26233 template< 26234 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 26235 std::size_t ``[link boost_asio.reference.basic_seq_packet_socket.receive.overload1 receive]``( 26236 const MutableBufferSequence & buffers, 26237 socket_base::message_flags & out_flags); 26238 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.receive.overload1 more...]]`` 26239 26240 template< 26241 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 26242 std::size_t ``[link boost_asio.reference.basic_seq_packet_socket.receive.overload2 receive]``( 26243 const MutableBufferSequence & buffers, 26244 socket_base::message_flags in_flags, 26245 socket_base::message_flags & out_flags); 26246 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.receive.overload2 more...]]`` 26247 26248 26249Receive some data on a connected socket. 26250 26251 26252 template< 26253 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 26254 std::size_t ``[link boost_asio.reference.basic_seq_packet_socket.receive.overload3 receive]``( 26255 const MutableBufferSequence & buffers, 26256 socket_base::message_flags in_flags, 26257 socket_base::message_flags & out_flags, 26258 boost::system::error_code & ec); 26259 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.receive.overload3 more...]]`` 26260 26261 26262[section:overload1 basic_seq_packet_socket::receive (1 of 3 overloads)] 26263 26264 26265Receive some data on the socket. 26266 26267 26268 template< 26269 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 26270 std::size_t receive( 26271 const MutableBufferSequence & buffers, 26272 socket_base::message_flags & out_flags); 26273 26274 26275This 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. 26276 26277 26278[heading Parameters] 26279 26280 26281[variablelist 26282 26283[[buffers][One or more buffers into which the data will be received.]] 26284 26285[[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.]] 26286 26287] 26288 26289 26290[heading Return Value] 26291 26292The number of bytes received. 26293 26294 26295[heading Exceptions] 26296 26297 26298[variablelist 26299 26300[[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]] 26301 26302] 26303 26304 26305[heading Example] 26306 26307To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 26308 26309 socket.receive(boost::asio::buffer(data, size), out_flags); 26310 26311 26312See 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. 26313 26314 26315 26316 26317[endsect] 26318 26319 26320 26321[section:overload2 basic_seq_packet_socket::receive (2 of 3 overloads)] 26322 26323 26324Receive some data on the socket. 26325 26326 26327 template< 26328 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 26329 std::size_t receive( 26330 const MutableBufferSequence & buffers, 26331 socket_base::message_flags in_flags, 26332 socket_base::message_flags & out_flags); 26333 26334 26335This 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. 26336 26337 26338[heading Parameters] 26339 26340 26341[variablelist 26342 26343[[buffers][One or more buffers into which the data will be received.]] 26344 26345[[in_flags][Flags specifying how the receive call is to be made.]] 26346 26347[[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.]] 26348 26349] 26350 26351 26352[heading Return Value] 26353 26354The number of bytes received. 26355 26356 26357[heading Exceptions] 26358 26359 26360[variablelist 26361 26362[[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]] 26363 26364] 26365 26366 26367[heading Remarks] 26368 26369The 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. 26370 26371 26372[heading Example] 26373 26374To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 26375 26376 socket.receive(boost::asio::buffer(data, size), 0, out_flags); 26377 26378 26379See 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. 26380 26381 26382 26383 26384[endsect] 26385 26386 26387 26388[section:overload3 basic_seq_packet_socket::receive (3 of 3 overloads)] 26389 26390 26391Receive some data on a connected socket. 26392 26393 26394 template< 26395 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 26396 std::size_t receive( 26397 const MutableBufferSequence & buffers, 26398 socket_base::message_flags in_flags, 26399 socket_base::message_flags & out_flags, 26400 boost::system::error_code & ec); 26401 26402 26403This 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. 26404 26405 26406[heading Parameters] 26407 26408 26409[variablelist 26410 26411[[buffers][One or more buffers into which the data will be received.]] 26412 26413[[in_flags][Flags specifying how the receive call is to be made.]] 26414 26415[[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.]] 26416 26417[[ec][Set to indicate what error occurred, if any.]] 26418 26419] 26420 26421 26422[heading Return Value] 26423 26424The number of bytes received. Returns 0 if an error occurred. 26425 26426 26427[heading Remarks] 26428 26429The 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. 26430 26431 26432 26433 26434[endsect] 26435 26436 26437[endsect] 26438 26439 26440[section:receive_buffer_size basic_seq_packet_socket::receive_buffer_size] 26441 26442 26443['Inherited from socket_base.] 26444 26445[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.receive_buffer_size..receive_buffer_size..basic_seq_packet_socket] 26446Socket option for the receive buffer size of a socket. 26447 26448 26449 typedef implementation_defined receive_buffer_size; 26450 26451 26452 26453Implements the SOL\_SOCKET/SO\_RCVBUF socket option. 26454 26455 26456[heading Examples] 26457 26458Setting the option: 26459 26460 boost::asio::ip::tcp::socket socket(my_context); 26461 ... 26462 boost::asio::socket_base::receive_buffer_size option(8192); 26463 socket.set_option(option); 26464 26465 26466 26467 26468 26469Getting the current option value: 26470 26471 boost::asio::ip::tcp::socket socket(my_context); 26472 ... 26473 boost::asio::socket_base::receive_buffer_size option; 26474 socket.get_option(option); 26475 int size = option.value(); 26476 26477 26478 26479 26480 26481 26482 26483[heading Requirements] 26484 26485['Header: ][^boost/asio/basic_seq_packet_socket.hpp] 26486 26487['Convenience header: ][^boost/asio.hpp] 26488 26489 26490[endsect] 26491 26492 26493 26494[section:receive_low_watermark basic_seq_packet_socket::receive_low_watermark] 26495 26496 26497['Inherited from socket_base.] 26498 26499[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.receive_low_watermark..receive_low_watermark..basic_seq_packet_socket] 26500Socket option for the receive low watermark. 26501 26502 26503 typedef implementation_defined receive_low_watermark; 26504 26505 26506 26507Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option. 26508 26509 26510[heading Examples] 26511 26512Setting the option: 26513 26514 boost::asio::ip::tcp::socket socket(my_context); 26515 ... 26516 boost::asio::socket_base::receive_low_watermark option(1024); 26517 socket.set_option(option); 26518 26519 26520 26521 26522 26523Getting the current option value: 26524 26525 boost::asio::ip::tcp::socket socket(my_context); 26526 ... 26527 boost::asio::socket_base::receive_low_watermark option; 26528 socket.get_option(option); 26529 int size = option.value(); 26530 26531 26532 26533 26534 26535 26536 26537[heading Requirements] 26538 26539['Header: ][^boost/asio/basic_seq_packet_socket.hpp] 26540 26541['Convenience header: ][^boost/asio.hpp] 26542 26543 26544[endsect] 26545 26546 26547[section:release basic_seq_packet_socket::release] 26548 26549[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.release..release..basic_seq_packet_socket] 26550Release ownership of the underlying native socket. 26551 26552 26553 native_handle_type ``[link boost_asio.reference.basic_seq_packet_socket.release.overload1 release]``(); 26554 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.release.overload1 more...]]`` 26555 26556 native_handle_type ``[link boost_asio.reference.basic_seq_packet_socket.release.overload2 release]``( 26557 boost::system::error_code & ec); 26558 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.release.overload2 more...]]`` 26559 26560 26561[section:overload1 basic_seq_packet_socket::release (1 of 2 overloads)] 26562 26563 26564['Inherited from basic_socket.] 26565 26566 26567Release ownership of the underlying native socket. 26568 26569 26570 native_handle_type release(); 26571 26572 26573This 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. 26574 26575 26576[heading Exceptions] 26577 26578 26579[variablelist 26580 26581[[boost::system::system_error][Thrown on failure.]] 26582 26583] 26584 26585 26586[heading Remarks] 26587 26588This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms. 26589 26590 26591 26592 26593[endsect] 26594 26595 26596 26597[section:overload2 basic_seq_packet_socket::release (2 of 2 overloads)] 26598 26599 26600['Inherited from basic_socket.] 26601 26602 26603Release ownership of the underlying native socket. 26604 26605 26606 native_handle_type release( 26607 boost::system::error_code & ec); 26608 26609 26610This 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. 26611 26612 26613[heading Parameters] 26614 26615 26616[variablelist 26617 26618[[ec][Set to indicate what error occurred, if any.]] 26619 26620] 26621 26622 26623[heading Remarks] 26624 26625This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms. 26626 26627 26628 26629 26630[endsect] 26631 26632 26633[endsect] 26634 26635[section:remote_endpoint basic_seq_packet_socket::remote_endpoint] 26636 26637[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.remote_endpoint..remote_endpoint..basic_seq_packet_socket] 26638Get the remote endpoint of the socket. 26639 26640 26641 endpoint_type ``[link boost_asio.reference.basic_seq_packet_socket.remote_endpoint.overload1 remote_endpoint]``() const; 26642 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.remote_endpoint.overload1 more...]]`` 26643 26644 endpoint_type ``[link boost_asio.reference.basic_seq_packet_socket.remote_endpoint.overload2 remote_endpoint]``( 26645 boost::system::error_code & ec) const; 26646 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.remote_endpoint.overload2 more...]]`` 26647 26648 26649[section:overload1 basic_seq_packet_socket::remote_endpoint (1 of 2 overloads)] 26650 26651 26652['Inherited from basic_socket.] 26653 26654 26655Get the remote endpoint of the socket. 26656 26657 26658 endpoint_type remote_endpoint() const; 26659 26660 26661This function is used to obtain the remote endpoint of the socket. 26662 26663 26664[heading Return Value] 26665 26666An object that represents the remote endpoint of the socket. 26667 26668 26669[heading Exceptions] 26670 26671 26672[variablelist 26673 26674[[boost::system::system_error][Thrown on failure.]] 26675 26676] 26677 26678 26679[heading Example] 26680 26681 26682 26683 boost::asio::ip::tcp::socket socket(my_context); 26684 ... 26685 boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(); 26686 26687 26688 26689 26690 26691 26692 26693[endsect] 26694 26695 26696 26697[section:overload2 basic_seq_packet_socket::remote_endpoint (2 of 2 overloads)] 26698 26699 26700['Inherited from basic_socket.] 26701 26702 26703Get the remote endpoint of the socket. 26704 26705 26706 endpoint_type remote_endpoint( 26707 boost::system::error_code & ec) const; 26708 26709 26710This function is used to obtain the remote endpoint of the socket. 26711 26712 26713[heading Parameters] 26714 26715 26716[variablelist 26717 26718[[ec][Set to indicate what error occurred, if any.]] 26719 26720] 26721 26722 26723[heading Return Value] 26724 26725An object that represents the remote endpoint of the socket. Returns a default-constructed endpoint object if an error occurred. 26726 26727 26728[heading Example] 26729 26730 26731 26732 boost::asio::ip::tcp::socket socket(my_context); 26733 ... 26734 boost::system::error_code ec; 26735 boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(ec); 26736 if (ec) 26737 { 26738 // An error occurred. 26739 } 26740 26741 26742 26743 26744 26745 26746 26747[endsect] 26748 26749 26750[endsect] 26751 26752 26753[section:reuse_address basic_seq_packet_socket::reuse_address] 26754 26755 26756['Inherited from socket_base.] 26757 26758[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.reuse_address..reuse_address..basic_seq_packet_socket] 26759Socket option to allow the socket to be bound to an address that is already in use. 26760 26761 26762 typedef implementation_defined reuse_address; 26763 26764 26765 26766Implements the SOL\_SOCKET/SO\_REUSEADDR socket option. 26767 26768 26769[heading Examples] 26770 26771Setting the option: 26772 26773 boost::asio::ip::tcp::acceptor acceptor(my_context); 26774 ... 26775 boost::asio::socket_base::reuse_address option(true); 26776 acceptor.set_option(option); 26777 26778 26779 26780 26781 26782Getting the current option value: 26783 26784 boost::asio::ip::tcp::acceptor acceptor(my_context); 26785 ... 26786 boost::asio::socket_base::reuse_address option; 26787 acceptor.get_option(option); 26788 bool is_set = option.value(); 26789 26790 26791 26792 26793 26794 26795 26796[heading Requirements] 26797 26798['Header: ][^boost/asio/basic_seq_packet_socket.hpp] 26799 26800['Convenience header: ][^boost/asio.hpp] 26801 26802 26803[endsect] 26804 26805 26806[section:send basic_seq_packet_socket::send] 26807 26808[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.send..send..basic_seq_packet_socket] 26809Send some data on the socket. 26810 26811 26812 template< 26813 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 26814 std::size_t ``[link boost_asio.reference.basic_seq_packet_socket.send.overload1 send]``( 26815 const ConstBufferSequence & buffers, 26816 socket_base::message_flags flags); 26817 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.send.overload1 more...]]`` 26818 26819 template< 26820 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 26821 std::size_t ``[link boost_asio.reference.basic_seq_packet_socket.send.overload2 send]``( 26822 const ConstBufferSequence & buffers, 26823 socket_base::message_flags flags, 26824 boost::system::error_code & ec); 26825 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.send.overload2 more...]]`` 26826 26827 26828[section:overload1 basic_seq_packet_socket::send (1 of 2 overloads)] 26829 26830 26831Send some data on the socket. 26832 26833 26834 template< 26835 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 26836 std::size_t send( 26837 const ConstBufferSequence & buffers, 26838 socket_base::message_flags flags); 26839 26840 26841This 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. 26842 26843 26844[heading Parameters] 26845 26846 26847[variablelist 26848 26849[[buffers][One or more data buffers to be sent on the socket.]] 26850 26851[[flags][Flags specifying how the send call is to be made.]] 26852 26853] 26854 26855 26856[heading Return Value] 26857 26858The number of bytes sent. 26859 26860 26861[heading Exceptions] 26862 26863 26864[variablelist 26865 26866[[boost::system::system_error][Thrown on failure.]] 26867 26868] 26869 26870 26871[heading Example] 26872 26873To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 26874 26875 socket.send(boost::asio::buffer(data, size), 0); 26876 26877 26878See 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. 26879 26880 26881 26882 26883[endsect] 26884 26885 26886 26887[section:overload2 basic_seq_packet_socket::send (2 of 2 overloads)] 26888 26889 26890Send some data on the socket. 26891 26892 26893 template< 26894 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 26895 std::size_t send( 26896 const ConstBufferSequence & buffers, 26897 socket_base::message_flags flags, 26898 boost::system::error_code & ec); 26899 26900 26901This 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. 26902 26903 26904[heading Parameters] 26905 26906 26907[variablelist 26908 26909[[buffers][One or more data buffers to be sent on the socket.]] 26910 26911[[flags][Flags specifying how the send call is to be made.]] 26912 26913[[ec][Set to indicate what error occurred, if any.]] 26914 26915] 26916 26917 26918[heading Return Value] 26919 26920The number of bytes sent. Returns 0 if an error occurred. 26921 26922 26923[heading Remarks] 26924 26925The 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. 26926 26927 26928 26929 26930[endsect] 26931 26932 26933[endsect] 26934 26935 26936[section:send_buffer_size basic_seq_packet_socket::send_buffer_size] 26937 26938 26939['Inherited from socket_base.] 26940 26941[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.send_buffer_size..send_buffer_size..basic_seq_packet_socket] 26942Socket option for the send buffer size of a socket. 26943 26944 26945 typedef implementation_defined send_buffer_size; 26946 26947 26948 26949Implements the SOL\_SOCKET/SO\_SNDBUF socket option. 26950 26951 26952[heading Examples] 26953 26954Setting the option: 26955 26956 boost::asio::ip::tcp::socket socket(my_context); 26957 ... 26958 boost::asio::socket_base::send_buffer_size option(8192); 26959 socket.set_option(option); 26960 26961 26962 26963 26964 26965Getting the current option value: 26966 26967 boost::asio::ip::tcp::socket socket(my_context); 26968 ... 26969 boost::asio::socket_base::send_buffer_size option; 26970 socket.get_option(option); 26971 int size = option.value(); 26972 26973 26974 26975 26976 26977 26978 26979[heading Requirements] 26980 26981['Header: ][^boost/asio/basic_seq_packet_socket.hpp] 26982 26983['Convenience header: ][^boost/asio.hpp] 26984 26985 26986[endsect] 26987 26988 26989 26990[section:send_low_watermark basic_seq_packet_socket::send_low_watermark] 26991 26992 26993['Inherited from socket_base.] 26994 26995[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.send_low_watermark..send_low_watermark..basic_seq_packet_socket] 26996Socket option for the send low watermark. 26997 26998 26999 typedef implementation_defined send_low_watermark; 27000 27001 27002 27003Implements the SOL\_SOCKET/SO\_SNDLOWAT socket option. 27004 27005 27006[heading Examples] 27007 27008Setting the option: 27009 27010 boost::asio::ip::tcp::socket socket(my_context); 27011 ... 27012 boost::asio::socket_base::send_low_watermark option(1024); 27013 socket.set_option(option); 27014 27015 27016 27017 27018 27019Getting the current option value: 27020 27021 boost::asio::ip::tcp::socket socket(my_context); 27022 ... 27023 boost::asio::socket_base::send_low_watermark option; 27024 socket.get_option(option); 27025 int size = option.value(); 27026 27027 27028 27029 27030 27031 27032 27033[heading Requirements] 27034 27035['Header: ][^boost/asio/basic_seq_packet_socket.hpp] 27036 27037['Convenience header: ][^boost/asio.hpp] 27038 27039 27040[endsect] 27041 27042 27043[section:set_option basic_seq_packet_socket::set_option] 27044 27045[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.set_option..set_option..basic_seq_packet_socket] 27046Set an option on the socket. 27047 27048 27049 template< 27050 typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``> 27051 void ``[link boost_asio.reference.basic_seq_packet_socket.set_option.overload1 set_option]``( 27052 const SettableSocketOption & option); 27053 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.set_option.overload1 more...]]`` 27054 27055 template< 27056 typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``> 27057 void ``[link boost_asio.reference.basic_seq_packet_socket.set_option.overload2 set_option]``( 27058 const SettableSocketOption & option, 27059 boost::system::error_code & ec); 27060 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.set_option.overload2 more...]]`` 27061 27062 27063[section:overload1 basic_seq_packet_socket::set_option (1 of 2 overloads)] 27064 27065 27066['Inherited from basic_socket.] 27067 27068 27069Set an option on the socket. 27070 27071 27072 template< 27073 typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``> 27074 void set_option( 27075 const SettableSocketOption & option); 27076 27077 27078This function is used to set an option on the socket. 27079 27080 27081[heading Parameters] 27082 27083 27084[variablelist 27085 27086[[option][The new option value to be set on the socket.]] 27087 27088] 27089 27090 27091[heading Exceptions] 27092 27093 27094[variablelist 27095 27096[[boost::system::system_error][Thrown on failure.]] 27097 27098] 27099 27100 27101 27102[heading Example] 27103 27104Setting the IPPROTO\_TCP/TCP\_NODELAY option: 27105 27106 boost::asio::ip::tcp::socket socket(my_context); 27107 ... 27108 boost::asio::ip::tcp::no_delay option(true); 27109 socket.set_option(option); 27110 27111 27112 27113 27114 27115 27116 27117[endsect] 27118 27119 27120 27121[section:overload2 basic_seq_packet_socket::set_option (2 of 2 overloads)] 27122 27123 27124['Inherited from basic_socket.] 27125 27126 27127Set an option on the socket. 27128 27129 27130 template< 27131 typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``> 27132 void set_option( 27133 const SettableSocketOption & option, 27134 boost::system::error_code & ec); 27135 27136 27137This function is used to set an option on the socket. 27138 27139 27140[heading Parameters] 27141 27142 27143[variablelist 27144 27145[[option][The new option value to be set on the socket.]] 27146 27147[[ec][Set to indicate what error occurred, if any.]] 27148 27149] 27150 27151 27152 27153[heading Example] 27154 27155Setting the IPPROTO\_TCP/TCP\_NODELAY option: 27156 27157 boost::asio::ip::tcp::socket socket(my_context); 27158 ... 27159 boost::asio::ip::tcp::no_delay option(true); 27160 boost::system::error_code ec; 27161 socket.set_option(option, ec); 27162 if (ec) 27163 { 27164 // An error occurred. 27165 } 27166 27167 27168 27169 27170 27171 27172 27173[endsect] 27174 27175 27176[endsect] 27177 27178[section:shutdown basic_seq_packet_socket::shutdown] 27179 27180[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.shutdown..shutdown..basic_seq_packet_socket] 27181Disable sends or receives on the socket. 27182 27183 27184 void ``[link boost_asio.reference.basic_seq_packet_socket.shutdown.overload1 shutdown]``( 27185 shutdown_type what); 27186 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.shutdown.overload1 more...]]`` 27187 27188 void ``[link boost_asio.reference.basic_seq_packet_socket.shutdown.overload2 shutdown]``( 27189 shutdown_type what, 27190 boost::system::error_code & ec); 27191 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.shutdown.overload2 more...]]`` 27192 27193 27194[section:overload1 basic_seq_packet_socket::shutdown (1 of 2 overloads)] 27195 27196 27197['Inherited from basic_socket.] 27198 27199 27200Disable sends or receives on the socket. 27201 27202 27203 void shutdown( 27204 shutdown_type what); 27205 27206 27207This function is used to disable send operations, receive operations, or both. 27208 27209 27210[heading Parameters] 27211 27212 27213[variablelist 27214 27215[[what][Determines what types of operation will no longer be allowed.]] 27216 27217] 27218 27219 27220[heading Exceptions] 27221 27222 27223[variablelist 27224 27225[[boost::system::system_error][Thrown on failure.]] 27226 27227] 27228 27229 27230[heading Example] 27231 27232Shutting down the send side of the socket: 27233 27234 boost::asio::ip::tcp::socket socket(my_context); 27235 ... 27236 socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send); 27237 27238 27239 27240 27241 27242 27243 27244[endsect] 27245 27246 27247 27248[section:overload2 basic_seq_packet_socket::shutdown (2 of 2 overloads)] 27249 27250 27251['Inherited from basic_socket.] 27252 27253 27254Disable sends or receives on the socket. 27255 27256 27257 void shutdown( 27258 shutdown_type what, 27259 boost::system::error_code & ec); 27260 27261 27262This function is used to disable send operations, receive operations, or both. 27263 27264 27265[heading Parameters] 27266 27267 27268[variablelist 27269 27270[[what][Determines what types of operation will no longer be allowed.]] 27271 27272[[ec][Set to indicate what error occurred, if any.]] 27273 27274] 27275 27276 27277[heading Example] 27278 27279Shutting down the send side of the socket: 27280 27281 boost::asio::ip::tcp::socket socket(my_context); 27282 ... 27283 boost::system::error_code ec; 27284 socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send, ec); 27285 if (ec) 27286 { 27287 // An error occurred. 27288 } 27289 27290 27291 27292 27293 27294 27295 27296[endsect] 27297 27298 27299[endsect] 27300 27301 27302[section:shutdown_type basic_seq_packet_socket::shutdown_type] 27303 27304 27305['Inherited from socket_base.] 27306 27307[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.shutdown_type..shutdown_type..basic_seq_packet_socket] 27308Different ways a socket may be shutdown. 27309 27310 27311 enum shutdown_type 27312 27313[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.shutdown_type.shutdown_receive..shutdown_receive..basic_seq_packet_socket] 27314[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.shutdown_type.shutdown_send..shutdown_send..basic_seq_packet_socket] 27315[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.shutdown_type.shutdown_both..shutdown_both..basic_seq_packet_socket] 27316 27317[heading Values] 27318[variablelist 27319 27320 [ 27321 [shutdown_receive] 27322 [Shutdown the receive side of the socket. ] 27323 ] 27324 27325 [ 27326 [shutdown_send] 27327 [Shutdown the send side of the socket. ] 27328 ] 27329 27330 [ 27331 [shutdown_both] 27332 [Shutdown both send and receive on the socket. ] 27333 ] 27334 27335] 27336 27337 27338 27339[endsect] 27340 27341 27342[section:wait basic_seq_packet_socket::wait] 27343 27344[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.wait..wait..basic_seq_packet_socket] 27345Wait for the socket to become ready to read, ready to write, or to have pending error conditions. 27346 27347 27348 void ``[link boost_asio.reference.basic_seq_packet_socket.wait.overload1 wait]``( 27349 wait_type w); 27350 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.wait.overload1 more...]]`` 27351 27352 void ``[link boost_asio.reference.basic_seq_packet_socket.wait.overload2 wait]``( 27353 wait_type w, 27354 boost::system::error_code & ec); 27355 `` [''''»''' [link boost_asio.reference.basic_seq_packet_socket.wait.overload2 more...]]`` 27356 27357 27358[section:overload1 basic_seq_packet_socket::wait (1 of 2 overloads)] 27359 27360 27361['Inherited from basic_socket.] 27362 27363 27364Wait for the socket to become ready to read, ready to write, or to have pending error conditions. 27365 27366 27367 void wait( 27368 wait_type w); 27369 27370 27371This function is used to perform a blocking wait for a socket to enter a ready to read, write or error condition state. 27372 27373 27374[heading Parameters] 27375 27376 27377[variablelist 27378 27379[[w][Specifies the desired socket state.]] 27380 27381] 27382 27383 27384[heading Example] 27385 27386Waiting for a socket to become readable. 27387 27388 boost::asio::ip::tcp::socket socket(my_context); 27389 ... 27390 socket.wait(boost::asio::ip::tcp::socket::wait_read); 27391 27392 27393 27394 27395 27396 27397 27398[endsect] 27399 27400 27401 27402[section:overload2 basic_seq_packet_socket::wait (2 of 2 overloads)] 27403 27404 27405['Inherited from basic_socket.] 27406 27407 27408Wait for the socket to become ready to read, ready to write, or to have pending error conditions. 27409 27410 27411 void wait( 27412 wait_type w, 27413 boost::system::error_code & ec); 27414 27415 27416This function is used to perform a blocking wait for a socket to enter a ready to read, write or error condition state. 27417 27418 27419[heading Parameters] 27420 27421 27422[variablelist 27423 27424[[w][Specifies the desired socket state.]] 27425 27426[[ec][Set to indicate what error occurred, if any.]] 27427 27428] 27429 27430 27431[heading Example] 27432 27433Waiting for a socket to become readable. 27434 27435 boost::asio::ip::tcp::socket socket(my_context); 27436 ... 27437 boost::system::error_code ec; 27438 socket.wait(boost::asio::ip::tcp::socket::wait_read, ec); 27439 27440 27441 27442 27443 27444 27445 27446[endsect] 27447 27448 27449[endsect] 27450 27451 27452[section:wait_type basic_seq_packet_socket::wait_type] 27453 27454 27455['Inherited from socket_base.] 27456 27457[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.wait_type..wait_type..basic_seq_packet_socket] 27458Wait types. 27459 27460 27461 enum wait_type 27462 27463[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.wait_type.wait_read..wait_read..basic_seq_packet_socket] 27464[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.wait_type.wait_write..wait_write..basic_seq_packet_socket] 27465[indexterm2 boost_asio.indexterm.basic_seq_packet_socket.wait_type.wait_error..wait_error..basic_seq_packet_socket] 27466 27467[heading Values] 27468[variablelist 27469 27470 [ 27471 [wait_read] 27472 [Wait for a socket to become ready to read. ] 27473 ] 27474 27475 [ 27476 [wait_write] 27477 [Wait for a socket to become ready to write. ] 27478 ] 27479 27480 [ 27481 [wait_error] 27482 [Wait for a socket to have error conditions pending. ] 27483 ] 27484 27485] 27486 27487 27488For use with `basic_socket::wait()` and `basic_socket::async_wait()`. 27489 27490 27491[endsect] 27492 27493 27494 27495[section:_basic_seq_packet_socket basic_seq_packet_socket::~basic_seq_packet_socket] 27496 27497[indexterm2 boost_asio.indexterm.basic_seq_packet_socket._basic_seq_packet_socket..~basic_seq_packet_socket..basic_seq_packet_socket] 27498Destroys the socket. 27499 27500 27501 ~basic_seq_packet_socket(); 27502 27503 27504This function destroys the socket, cancelling any outstanding asynchronous operations associated with the socket as if by calling `cancel`. 27505 27506 27507[endsect] 27508 27509 27510 27511[endsect] 27512 27513[section:basic_seq_packet_socket__rebind_executor basic_seq_packet_socket::rebind_executor] 27514 27515[indexterm1 boost_asio.indexterm.basic_seq_packet_socket__rebind_executor..basic_seq_packet_socket::rebind_executor] 27516 27517 27518Rebinds the socket type to another executor. 27519 27520 27521 template< 27522 typename ``[link boost_asio.reference.Executor1 Executor1]``> 27523 struct rebind_executor 27524 27525 27526[heading Types] 27527[table 27528 [[Name][Description]] 27529 27530 [ 27531 27532 [[link boost_asio.reference.basic_seq_packet_socket__rebind_executor.other [*other]]] 27533 [The socket type when rebound to the specified executor. ] 27534 27535 ] 27536 27537] 27538 27539[heading Requirements] 27540 27541['Header: ][^boost/asio/basic_seq_packet_socket.hpp] 27542 27543['Convenience header: ][^boost/asio.hpp] 27544 27545 27546[section:other basic_seq_packet_socket::rebind_executor::other] 27547 27548[indexterm2 boost_asio.indexterm.basic_seq_packet_socket__rebind_executor.other..other..basic_seq_packet_socket::rebind_executor] 27549The socket type when rebound to the specified executor. 27550 27551 27552 typedef basic_seq_packet_socket< Protocol, Executor1 > other; 27553 27554 27555[heading Types] 27556[table 27557 [[Name][Description]] 27558 27559 [ 27560 27561 [[link boost_asio.reference.basic_seq_packet_socket__rebind_executor [*rebind_executor]]] 27562 [Rebinds the socket type to another executor. ] 27563 27564 ] 27565 27566 [ 27567 27568 [[link boost_asio.reference.basic_seq_packet_socket.broadcast [*broadcast]]] 27569 [Socket option to permit sending of broadcast messages. ] 27570 27571 ] 27572 27573 [ 27574 27575 [[link boost_asio.reference.basic_seq_packet_socket.bytes_readable [*bytes_readable]]] 27576 [IO control command to get the amount of data that can be read without blocking. ] 27577 27578 ] 27579 27580 [ 27581 27582 [[link boost_asio.reference.basic_seq_packet_socket.debug [*debug]]] 27583 [Socket option to enable socket-level debugging. ] 27584 27585 ] 27586 27587 [ 27588 27589 [[link boost_asio.reference.basic_seq_packet_socket.do_not_route [*do_not_route]]] 27590 [Socket option to prevent routing, use local interfaces only. ] 27591 27592 ] 27593 27594 [ 27595 27596 [[link boost_asio.reference.basic_seq_packet_socket.enable_connection_aborted [*enable_connection_aborted]]] 27597 [Socket option to report aborted connections on accept. ] 27598 27599 ] 27600 27601 [ 27602 27603 [[link boost_asio.reference.basic_seq_packet_socket.endpoint_type [*endpoint_type]]] 27604 [The endpoint type. ] 27605 27606 ] 27607 27608 [ 27609 27610 [[link boost_asio.reference.basic_seq_packet_socket.executor_type [*executor_type]]] 27611 [The type of the executor associated with the object. ] 27612 27613 ] 27614 27615 [ 27616 27617 [[link boost_asio.reference.basic_seq_packet_socket.keep_alive [*keep_alive]]] 27618 [Socket option to send keep-alives. ] 27619 27620 ] 27621 27622 [ 27623 27624 [[link boost_asio.reference.basic_seq_packet_socket.linger [*linger]]] 27625 [Socket option to specify whether the socket lingers on close if unsent data is present. ] 27626 27627 ] 27628 27629 [ 27630 27631 [[link boost_asio.reference.basic_seq_packet_socket.lowest_layer_type [*lowest_layer_type]]] 27632 [A basic_socket is always the lowest layer. ] 27633 27634 ] 27635 27636 [ 27637 27638 [[link boost_asio.reference.basic_seq_packet_socket.message_flags [*message_flags]]] 27639 [Bitmask type for flags that can be passed to send and receive operations. ] 27640 27641 ] 27642 27643 [ 27644 27645 [[link boost_asio.reference.basic_seq_packet_socket.native_handle_type [*native_handle_type]]] 27646 [The native representation of a socket. ] 27647 27648 ] 27649 27650 [ 27651 27652 [[link boost_asio.reference.basic_seq_packet_socket.out_of_band_inline [*out_of_band_inline]]] 27653 [Socket option for putting received out-of-band data inline. ] 27654 27655 ] 27656 27657 [ 27658 27659 [[link boost_asio.reference.basic_seq_packet_socket.protocol_type [*protocol_type]]] 27660 [The protocol type. ] 27661 27662 ] 27663 27664 [ 27665 27666 [[link boost_asio.reference.basic_seq_packet_socket.receive_buffer_size [*receive_buffer_size]]] 27667 [Socket option for the receive buffer size of a socket. ] 27668 27669 ] 27670 27671 [ 27672 27673 [[link boost_asio.reference.basic_seq_packet_socket.receive_low_watermark [*receive_low_watermark]]] 27674 [Socket option for the receive low watermark. ] 27675 27676 ] 27677 27678 [ 27679 27680 [[link boost_asio.reference.basic_seq_packet_socket.reuse_address [*reuse_address]]] 27681 [Socket option to allow the socket to be bound to an address that is already in use. ] 27682 27683 ] 27684 27685 [ 27686 27687 [[link boost_asio.reference.basic_seq_packet_socket.send_buffer_size [*send_buffer_size]]] 27688 [Socket option for the send buffer size of a socket. ] 27689 27690 ] 27691 27692 [ 27693 27694 [[link boost_asio.reference.basic_seq_packet_socket.send_low_watermark [*send_low_watermark]]] 27695 [Socket option for the send low watermark. ] 27696 27697 ] 27698 27699 [ 27700 27701 [[link boost_asio.reference.basic_seq_packet_socket.shutdown_type [*shutdown_type]]] 27702 [Different ways a socket may be shutdown. ] 27703 27704 ] 27705 27706 [ 27707 27708 [[link boost_asio.reference.basic_seq_packet_socket.wait_type [*wait_type]]] 27709 [Wait types. ] 27710 27711 ] 27712 27713] 27714 27715[heading Member Functions] 27716[table 27717 [[Name][Description]] 27718 27719 [ 27720 [[link boost_asio.reference.basic_seq_packet_socket.assign [*assign]]] 27721 [Assign an existing native socket to the socket. ] 27722 ] 27723 27724 [ 27725 [[link boost_asio.reference.basic_seq_packet_socket.async_connect [*async_connect]]] 27726 [Start an asynchronous connect. ] 27727 ] 27728 27729 [ 27730 [[link boost_asio.reference.basic_seq_packet_socket.async_receive [*async_receive]]] 27731 [Start an asynchronous receive. ] 27732 ] 27733 27734 [ 27735 [[link boost_asio.reference.basic_seq_packet_socket.async_send [*async_send]]] 27736 [Start an asynchronous send. ] 27737 ] 27738 27739 [ 27740 [[link boost_asio.reference.basic_seq_packet_socket.async_wait [*async_wait]]] 27741 [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 27742 ] 27743 27744 [ 27745 [[link boost_asio.reference.basic_seq_packet_socket.at_mark [*at_mark]]] 27746 [Determine whether the socket is at the out-of-band data mark. ] 27747 ] 27748 27749 [ 27750 [[link boost_asio.reference.basic_seq_packet_socket.available [*available]]] 27751 [Determine the number of bytes available for reading. ] 27752 ] 27753 27754 [ 27755 [[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket [*basic_seq_packet_socket]] [constructor]] 27756 [Construct a basic_seq_packet_socket without opening it. 27757 [hr] 27758 Construct and open a basic_seq_packet_socket. 27759 [hr] 27760 Construct a basic_seq_packet_socket, opening it and binding it to the given local endpoint. 27761 [hr] 27762 Construct a basic_seq_packet_socket on an existing native socket. 27763 [hr] 27764 Move-construct a basic_seq_packet_socket from another. 27765 [hr] 27766 Move-construct a basic_seq_packet_socket from a socket of another protocol type. ] 27767 ] 27768 27769 [ 27770 [[link boost_asio.reference.basic_seq_packet_socket.bind [*bind]]] 27771 [Bind the socket to the given local endpoint. ] 27772 ] 27773 27774 [ 27775 [[link boost_asio.reference.basic_seq_packet_socket.cancel [*cancel]]] 27776 [Cancel all asynchronous operations associated with the socket. ] 27777 ] 27778 27779 [ 27780 [[link boost_asio.reference.basic_seq_packet_socket.close [*close]]] 27781 [Close the socket. ] 27782 ] 27783 27784 [ 27785 [[link boost_asio.reference.basic_seq_packet_socket.connect [*connect]]] 27786 [Connect the socket to the specified endpoint. ] 27787 ] 27788 27789 [ 27790 [[link boost_asio.reference.basic_seq_packet_socket.get_executor [*get_executor]]] 27791 [Get the executor associated with the object. ] 27792 ] 27793 27794 [ 27795 [[link boost_asio.reference.basic_seq_packet_socket.get_option [*get_option]]] 27796 [Get an option from the socket. ] 27797 ] 27798 27799 [ 27800 [[link boost_asio.reference.basic_seq_packet_socket.io_control [*io_control]]] 27801 [Perform an IO control command on the socket. ] 27802 ] 27803 27804 [ 27805 [[link boost_asio.reference.basic_seq_packet_socket.is_open [*is_open]]] 27806 [Determine whether the socket is open. ] 27807 ] 27808 27809 [ 27810 [[link boost_asio.reference.basic_seq_packet_socket.local_endpoint [*local_endpoint]]] 27811 [Get the local endpoint of the socket. ] 27812 ] 27813 27814 [ 27815 [[link boost_asio.reference.basic_seq_packet_socket.lowest_layer [*lowest_layer]]] 27816 [Get a reference to the lowest layer. 27817 [hr] 27818 Get a const reference to the lowest layer. ] 27819 ] 27820 27821 [ 27822 [[link boost_asio.reference.basic_seq_packet_socket.native_handle [*native_handle]]] 27823 [Get the native socket representation. ] 27824 ] 27825 27826 [ 27827 [[link boost_asio.reference.basic_seq_packet_socket.native_non_blocking [*native_non_blocking]]] 27828 [Gets the non-blocking mode of the native socket implementation. 27829 [hr] 27830 Sets the non-blocking mode of the native socket implementation. ] 27831 ] 27832 27833 [ 27834 [[link boost_asio.reference.basic_seq_packet_socket.non_blocking [*non_blocking]]] 27835 [Gets the non-blocking mode of the socket. 27836 [hr] 27837 Sets the non-blocking mode of the socket. ] 27838 ] 27839 27840 [ 27841 [[link boost_asio.reference.basic_seq_packet_socket.open [*open]]] 27842 [Open the socket using the specified protocol. ] 27843 ] 27844 27845 [ 27846 [[link boost_asio.reference.basic_seq_packet_socket.operator_eq_ [*operator=]]] 27847 [Move-assign a basic_seq_packet_socket from another. 27848 [hr] 27849 Move-assign a basic_seq_packet_socket from a socket of another protocol type. ] 27850 ] 27851 27852 [ 27853 [[link boost_asio.reference.basic_seq_packet_socket.receive [*receive]]] 27854 [Receive some data on the socket. 27855 [hr] 27856 Receive some data on a connected socket. ] 27857 ] 27858 27859 [ 27860 [[link boost_asio.reference.basic_seq_packet_socket.release [*release]]] 27861 [Release ownership of the underlying native socket. ] 27862 ] 27863 27864 [ 27865 [[link boost_asio.reference.basic_seq_packet_socket.remote_endpoint [*remote_endpoint]]] 27866 [Get the remote endpoint of the socket. ] 27867 ] 27868 27869 [ 27870 [[link boost_asio.reference.basic_seq_packet_socket.send [*send]]] 27871 [Send some data on the socket. ] 27872 ] 27873 27874 [ 27875 [[link boost_asio.reference.basic_seq_packet_socket.set_option [*set_option]]] 27876 [Set an option on the socket. ] 27877 ] 27878 27879 [ 27880 [[link boost_asio.reference.basic_seq_packet_socket.shutdown [*shutdown]]] 27881 [Disable sends or receives on the socket. ] 27882 ] 27883 27884 [ 27885 [[link boost_asio.reference.basic_seq_packet_socket.wait [*wait]]] 27886 [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 27887 ] 27888 27889 [ 27890 [[link boost_asio.reference.basic_seq_packet_socket._basic_seq_packet_socket [*~basic_seq_packet_socket]] [destructor]] 27891 [Destroys the socket. ] 27892 ] 27893 27894] 27895 27896[heading Data Members] 27897[table 27898 [[Name][Description]] 27899 27900 [ 27901 [[link boost_asio.reference.basic_seq_packet_socket.max_connections [*max_connections]] [static]] 27902 [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ] 27903 ] 27904 27905 [ 27906 [[link boost_asio.reference.basic_seq_packet_socket.max_listen_connections [*max_listen_connections]] [static]] 27907 [The maximum length of the queue of pending incoming connections. ] 27908 ] 27909 27910 [ 27911 [[link boost_asio.reference.basic_seq_packet_socket.message_do_not_route [*message_do_not_route]] [static]] 27912 [Specify that the data should not be subject to routing. ] 27913 ] 27914 27915 [ 27916 [[link boost_asio.reference.basic_seq_packet_socket.message_end_of_record [*message_end_of_record]] [static]] 27917 [Specifies that the data marks the end of a record. ] 27918 ] 27919 27920 [ 27921 [[link boost_asio.reference.basic_seq_packet_socket.message_out_of_band [*message_out_of_band]] [static]] 27922 [Process out-of-band data. ] 27923 ] 27924 27925 [ 27926 [[link boost_asio.reference.basic_seq_packet_socket.message_peek [*message_peek]] [static]] 27927 [Peek at incoming data without removing it from the input queue. ] 27928 ] 27929 27930] 27931 27932The [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] class template provides asynchronous and blocking sequenced packet socket functionality. 27933 27934 27935[heading Thread Safety] 27936 27937['Distinct] ['objects:] Safe. 27938 27939['Shared] ['objects:] Unsafe. 27940 27941Synchronous `send`, `receive`, and `connect` operations are thread safe with respect to each other, if the underlying operating system calls are also thread safe. This means that it is permitted to perform concurrent calls to these synchronous operations on a single socket object. Other synchronous operations, such as `open` or `close`, are not thread safe. 27942 27943 27944[heading Requirements] 27945 27946['Header: ][^boost/asio/basic_seq_packet_socket.hpp] 27947 27948['Convenience header: ][^boost/asio.hpp] 27949 27950 27951[endsect] 27952 27953 27954 27955[endsect] 27956 27957[section:basic_serial_port basic_serial_port] 27958 27959[indexterm1 boost_asio.indexterm.basic_serial_port..basic_serial_port] 27960 27961 27962Provides serial port functionality. 27963 27964 27965 template< 27966 typename ``[link boost_asio.reference.Executor1 Executor]`` = any_io_executor> 27967 class basic_serial_port : 27968 public serial_port_base 27969 27970 27971[heading Types] 27972[table 27973 [[Name][Description]] 27974 27975 [ 27976 27977 [[link boost_asio.reference.basic_serial_port__rebind_executor [*rebind_executor]]] 27978 [Rebinds the serial port type to another executor. ] 27979 27980 ] 27981 27982 [ 27983 27984 [[link boost_asio.reference.basic_serial_port.executor_type [*executor_type]]] 27985 [The type of the executor associated with the object. ] 27986 27987 ] 27988 27989 [ 27990 27991 [[link boost_asio.reference.basic_serial_port.lowest_layer_type [*lowest_layer_type]]] 27992 [A basic_basic_serial_port is always the lowest layer. ] 27993 27994 ] 27995 27996 [ 27997 27998 [[link boost_asio.reference.basic_serial_port.native_handle_type [*native_handle_type]]] 27999 [The native representation of a serial port. ] 28000 28001 ] 28002 28003] 28004 28005[heading Member Functions] 28006[table 28007 [[Name][Description]] 28008 28009 [ 28010 [[link boost_asio.reference.basic_serial_port.assign [*assign]]] 28011 [Assign an existing native serial port to the serial port. ] 28012 ] 28013 28014 [ 28015 [[link boost_asio.reference.basic_serial_port.async_read_some [*async_read_some]]] 28016 [Start an asynchronous read. ] 28017 ] 28018 28019 [ 28020 [[link boost_asio.reference.basic_serial_port.async_write_some [*async_write_some]]] 28021 [Start an asynchronous write. ] 28022 ] 28023 28024 [ 28025 [[link boost_asio.reference.basic_serial_port.basic_serial_port [*basic_serial_port]] [constructor]] 28026 [Construct a basic_serial_port without opening it. 28027 [hr] 28028 Construct and open a basic_serial_port. 28029 [hr] 28030 Construct a basic_serial_port on an existing native serial port. 28031 [hr] 28032 Move-construct a basic_serial_port from another. ] 28033 ] 28034 28035 [ 28036 [[link boost_asio.reference.basic_serial_port.cancel [*cancel]]] 28037 [Cancel all asynchronous operations associated with the serial port. ] 28038 ] 28039 28040 [ 28041 [[link boost_asio.reference.basic_serial_port.close [*close]]] 28042 [Close the serial port. ] 28043 ] 28044 28045 [ 28046 [[link boost_asio.reference.basic_serial_port.get_executor [*get_executor]]] 28047 [Get the executor associated with the object. ] 28048 ] 28049 28050 [ 28051 [[link boost_asio.reference.basic_serial_port.get_option [*get_option]]] 28052 [Get an option from the serial port. ] 28053 ] 28054 28055 [ 28056 [[link boost_asio.reference.basic_serial_port.is_open [*is_open]]] 28057 [Determine whether the serial port is open. ] 28058 ] 28059 28060 [ 28061 [[link boost_asio.reference.basic_serial_port.lowest_layer [*lowest_layer]]] 28062 [Get a reference to the lowest layer. 28063 [hr] 28064 Get a const reference to the lowest layer. ] 28065 ] 28066 28067 [ 28068 [[link boost_asio.reference.basic_serial_port.native_handle [*native_handle]]] 28069 [Get the native serial port representation. ] 28070 ] 28071 28072 [ 28073 [[link boost_asio.reference.basic_serial_port.open [*open]]] 28074 [Open the serial port using the specified device name. ] 28075 ] 28076 28077 [ 28078 [[link boost_asio.reference.basic_serial_port.operator_eq_ [*operator=]]] 28079 [Move-assign a basic_serial_port from another. ] 28080 ] 28081 28082 [ 28083 [[link boost_asio.reference.basic_serial_port.read_some [*read_some]]] 28084 [Read some data from the serial port. ] 28085 ] 28086 28087 [ 28088 [[link boost_asio.reference.basic_serial_port.send_break [*send_break]]] 28089 [Send a break sequence to the serial port. ] 28090 ] 28091 28092 [ 28093 [[link boost_asio.reference.basic_serial_port.set_option [*set_option]]] 28094 [Set an option on the serial port. ] 28095 ] 28096 28097 [ 28098 [[link boost_asio.reference.basic_serial_port.write_some [*write_some]]] 28099 [Write some data to the serial port. ] 28100 ] 28101 28102 [ 28103 [[link boost_asio.reference.basic_serial_port._basic_serial_port [*~basic_serial_port]] [destructor]] 28104 [Destroys the serial port. ] 28105 ] 28106 28107] 28108 28109The [link boost_asio.reference.basic_serial_port `basic_serial_port`] class provides a wrapper over serial port functionality. 28110 28111 28112[heading Thread Safety] 28113 28114['Distinct] ['objects:] Safe. 28115 28116['Shared] ['objects:] Unsafe. 28117 28118 28119 28120[heading Requirements] 28121 28122['Header: ][^boost/asio/basic_serial_port.hpp] 28123 28124['Convenience header: ][^boost/asio.hpp] 28125 28126[section:assign basic_serial_port::assign] 28127 28128[indexterm2 boost_asio.indexterm.basic_serial_port.assign..assign..basic_serial_port] 28129Assign an existing native serial port to the serial port. 28130 28131 28132 void ``[link boost_asio.reference.basic_serial_port.assign.overload1 assign]``( 28133 const native_handle_type & native_serial_port); 28134 `` [''''»''' [link boost_asio.reference.basic_serial_port.assign.overload1 more...]]`` 28135 28136 void ``[link boost_asio.reference.basic_serial_port.assign.overload2 assign]``( 28137 const native_handle_type & native_serial_port, 28138 boost::system::error_code & ec); 28139 `` [''''»''' [link boost_asio.reference.basic_serial_port.assign.overload2 more...]]`` 28140 28141 28142[section:overload1 basic_serial_port::assign (1 of 2 overloads)] 28143 28144 28145Assign an existing native serial port to the serial port. 28146 28147 28148 void assign( 28149 const native_handle_type & native_serial_port); 28150 28151 28152 28153[endsect] 28154 28155 28156 28157[section:overload2 basic_serial_port::assign (2 of 2 overloads)] 28158 28159 28160Assign an existing native serial port to the serial port. 28161 28162 28163 void assign( 28164 const native_handle_type & native_serial_port, 28165 boost::system::error_code & ec); 28166 28167 28168 28169[endsect] 28170 28171 28172[endsect] 28173 28174 28175[section:async_read_some basic_serial_port::async_read_some] 28176 28177[indexterm2 boost_asio.indexterm.basic_serial_port.async_read_some..async_read_some..basic_serial_port] 28178Start an asynchronous read. 28179 28180 28181 template< 28182 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 28183 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 28184 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_some( 28185 const MutableBufferSequence & buffers, 28186 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 28187 28188 28189This function is used to asynchronously read data from the serial port. The function call always returns immediately. 28190 28191 28192[heading Parameters] 28193 28194 28195[variablelist 28196 28197[[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.]] 28198 28199[[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: 28200`` 28201 void handler( 28202 const boost::system::error_code& error, // Result of operation. 28203 std::size_t bytes_transferred // Number of bytes read. 28204 ); 28205`` 28206Regardless 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`].]] 28207 28208] 28209 28210 28211[heading Remarks] 28212 28213The 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. 28214 28215 28216[heading Example] 28217 28218To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 28219 28220 basic_serial_port.async_read_some( 28221 boost::asio::buffer(data, size), handler); 28222 28223 28224See 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. 28225 28226 28227 28228 28229[endsect] 28230 28231 28232 28233[section:async_write_some basic_serial_port::async_write_some] 28234 28235[indexterm2 boost_asio.indexterm.basic_serial_port.async_write_some..async_write_some..basic_serial_port] 28236Start an asynchronous write. 28237 28238 28239 template< 28240 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 28241 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 28242 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_some( 28243 const ConstBufferSequence & buffers, 28244 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 28245 28246 28247This function is used to asynchronously write data to the serial port. The function call always returns immediately. 28248 28249 28250[heading Parameters] 28251 28252 28253[variablelist 28254 28255[[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.]] 28256 28257[[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: 28258`` 28259 void handler( 28260 const boost::system::error_code& error, // Result of operation. 28261 std::size_t bytes_transferred // Number of bytes written. 28262 ); 28263`` 28264Regardless 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`].]] 28265 28266] 28267 28268 28269[heading Remarks] 28270 28271The 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. 28272 28273 28274[heading Example] 28275 28276To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 28277 28278 basic_serial_port.async_write_some( 28279 boost::asio::buffer(data, size), handler); 28280 28281 28282See 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. 28283 28284 28285 28286 28287[endsect] 28288 28289 28290[section:basic_serial_port basic_serial_port::basic_serial_port] 28291 28292[indexterm2 boost_asio.indexterm.basic_serial_port.basic_serial_port..basic_serial_port..basic_serial_port] 28293Construct a [link boost_asio.reference.basic_serial_port `basic_serial_port`] without opening it. 28294 28295 28296 explicit ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload1 basic_serial_port]``( 28297 const executor_type & ex); 28298 `` [''''»''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload1 more...]]`` 28299 28300 template< 28301 typename ExecutionContext> 28302 explicit ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload2 basic_serial_port]``( 28303 ExecutionContext & context, 28304 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value, defaulted_constraint >::type = defaulted_constraint()); 28305 `` [''''»''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload2 more...]]`` 28306 28307 28308Construct and open a [link boost_asio.reference.basic_serial_port `basic_serial_port`]. 28309 28310 28311 ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload3 basic_serial_port]``( 28312 const executor_type & ex, 28313 const char * device); 28314 `` [''''»''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload3 more...]]`` 28315 28316 template< 28317 typename ExecutionContext> 28318 ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload4 basic_serial_port]``( 28319 ExecutionContext & context, 28320 const char * device, 28321 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 28322 `` [''''»''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload4 more...]]`` 28323 28324 ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload5 basic_serial_port]``( 28325 const executor_type & ex, 28326 const std::string & device); 28327 `` [''''»''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload5 more...]]`` 28328 28329 template< 28330 typename ExecutionContext> 28331 ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload6 basic_serial_port]``( 28332 ExecutionContext & context, 28333 const std::string & device, 28334 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 28335 `` [''''»''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload6 more...]]`` 28336 28337 28338Construct a [link boost_asio.reference.basic_serial_port `basic_serial_port`] on an existing native serial port. 28339 28340 28341 ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload7 basic_serial_port]``( 28342 const executor_type & ex, 28343 const native_handle_type & native_serial_port); 28344 `` [''''»''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload7 more...]]`` 28345 28346 template< 28347 typename ExecutionContext> 28348 ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload8 basic_serial_port]``( 28349 ExecutionContext & context, 28350 const native_handle_type & native_serial_port, 28351 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 28352 `` [''''»''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload8 more...]]`` 28353 28354 28355Move-construct a [link boost_asio.reference.basic_serial_port `basic_serial_port`] from another. 28356 28357 28358 ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload9 basic_serial_port]``( 28359 basic_serial_port && other); 28360 `` [''''»''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload9 more...]]`` 28361 28362 28363[section:overload1 basic_serial_port::basic_serial_port (1 of 9 overloads)] 28364 28365 28366Construct a [link boost_asio.reference.basic_serial_port `basic_serial_port`] without opening it. 28367 28368 28369 basic_serial_port( 28370 const executor_type & ex); 28371 28372 28373This constructor creates a serial port without opening it. 28374 28375 28376[heading Parameters] 28377 28378 28379[variablelist 28380 28381[[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. ]] 28382 28383] 28384 28385 28386 28387 28388[endsect] 28389 28390 28391 28392[section:overload2 basic_serial_port::basic_serial_port (2 of 9 overloads)] 28393 28394 28395Construct a [link boost_asio.reference.basic_serial_port `basic_serial_port`] without opening it. 28396 28397 28398 template< 28399 typename ExecutionContext> 28400 basic_serial_port( 28401 ExecutionContext & context, 28402 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value, defaulted_constraint >::type = defaulted_constraint()); 28403 28404 28405This constructor creates a serial port without opening it. 28406 28407 28408[heading Parameters] 28409 28410 28411[variablelist 28412 28413[[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. ]] 28414 28415] 28416 28417 28418 28419 28420[endsect] 28421 28422 28423 28424[section:overload3 basic_serial_port::basic_serial_port (3 of 9 overloads)] 28425 28426 28427Construct and open a [link boost_asio.reference.basic_serial_port `basic_serial_port`]. 28428 28429 28430 basic_serial_port( 28431 const executor_type & ex, 28432 const char * device); 28433 28434 28435This constructor creates and opens a serial port for the specified device name. 28436 28437 28438[heading Parameters] 28439 28440 28441[variablelist 28442 28443[[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.]] 28444 28445[[device][The platform-specific device name for this serial port. ]] 28446 28447] 28448 28449 28450 28451 28452[endsect] 28453 28454 28455 28456[section:overload4 basic_serial_port::basic_serial_port (4 of 9 overloads)] 28457 28458 28459Construct and open a [link boost_asio.reference.basic_serial_port `basic_serial_port`]. 28460 28461 28462 template< 28463 typename ExecutionContext> 28464 basic_serial_port( 28465 ExecutionContext & context, 28466 const char * device, 28467 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 28468 28469 28470This constructor creates and opens a serial port for the specified device name. 28471 28472 28473[heading Parameters] 28474 28475 28476[variablelist 28477 28478[[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.]] 28479 28480[[device][The platform-specific device name for this serial port. ]] 28481 28482] 28483 28484 28485 28486 28487[endsect] 28488 28489 28490 28491[section:overload5 basic_serial_port::basic_serial_port (5 of 9 overloads)] 28492 28493 28494Construct and open a [link boost_asio.reference.basic_serial_port `basic_serial_port`]. 28495 28496 28497 basic_serial_port( 28498 const executor_type & ex, 28499 const std::string & device); 28500 28501 28502This constructor creates and opens a serial port for the specified device name. 28503 28504 28505[heading Parameters] 28506 28507 28508[variablelist 28509 28510[[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.]] 28511 28512[[device][The platform-specific device name for this serial port. ]] 28513 28514] 28515 28516 28517 28518 28519[endsect] 28520 28521 28522 28523[section:overload6 basic_serial_port::basic_serial_port (6 of 9 overloads)] 28524 28525 28526Construct and open a [link boost_asio.reference.basic_serial_port `basic_serial_port`]. 28527 28528 28529 template< 28530 typename ExecutionContext> 28531 basic_serial_port( 28532 ExecutionContext & context, 28533 const std::string & device, 28534 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 28535 28536 28537This constructor creates and opens a serial port for the specified device name. 28538 28539 28540[heading Parameters] 28541 28542 28543[variablelist 28544 28545[[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.]] 28546 28547[[device][The platform-specific device name for this serial port. ]] 28548 28549] 28550 28551 28552 28553 28554[endsect] 28555 28556 28557 28558[section:overload7 basic_serial_port::basic_serial_port (7 of 9 overloads)] 28559 28560 28561Construct a [link boost_asio.reference.basic_serial_port `basic_serial_port`] on an existing native serial port. 28562 28563 28564 basic_serial_port( 28565 const executor_type & ex, 28566 const native_handle_type & native_serial_port); 28567 28568 28569This constructor creates a serial port object to hold an existing native serial port. 28570 28571 28572[heading Parameters] 28573 28574 28575[variablelist 28576 28577[[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.]] 28578 28579[[native_serial_port][A native serial port.]] 28580 28581] 28582 28583 28584[heading Exceptions] 28585 28586 28587[variablelist 28588 28589[[boost::system::system_error][Thrown on failure. ]] 28590 28591] 28592 28593 28594 28595 28596[endsect] 28597 28598 28599 28600[section:overload8 basic_serial_port::basic_serial_port (8 of 9 overloads)] 28601 28602 28603Construct a [link boost_asio.reference.basic_serial_port `basic_serial_port`] on an existing native serial port. 28604 28605 28606 template< 28607 typename ExecutionContext> 28608 basic_serial_port( 28609 ExecutionContext & context, 28610 const native_handle_type & native_serial_port, 28611 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 28612 28613 28614This constructor creates a serial port object to hold an existing native serial port. 28615 28616 28617[heading Parameters] 28618 28619 28620[variablelist 28621 28622[[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.]] 28623 28624[[native_serial_port][A native serial port.]] 28625 28626] 28627 28628 28629[heading Exceptions] 28630 28631 28632[variablelist 28633 28634[[boost::system::system_error][Thrown on failure. ]] 28635 28636] 28637 28638 28639 28640 28641[endsect] 28642 28643 28644 28645[section:overload9 basic_serial_port::basic_serial_port (9 of 9 overloads)] 28646 28647 28648Move-construct a [link boost_asio.reference.basic_serial_port `basic_serial_port`] from another. 28649 28650 28651 basic_serial_port( 28652 basic_serial_port && other); 28653 28654 28655This constructor moves a serial port from one object to another. 28656 28657 28658[heading Parameters] 28659 28660 28661[variablelist 28662 28663[[other][The other [link boost_asio.reference.basic_serial_port `basic_serial_port`] object from which the move will occur.]] 28664 28665] 28666 28667 28668[heading Remarks] 28669 28670Following the move, the moved-from object is in the same state as if constructed using the `basic_serial_port(const executor_type&)` constructor. 28671 28672 28673 28674 28675[endsect] 28676 28677 28678[endsect] 28679 28680[section:cancel basic_serial_port::cancel] 28681 28682[indexterm2 boost_asio.indexterm.basic_serial_port.cancel..cancel..basic_serial_port] 28683Cancel all asynchronous operations associated with the serial port. 28684 28685 28686 void ``[link boost_asio.reference.basic_serial_port.cancel.overload1 cancel]``(); 28687 `` [''''»''' [link boost_asio.reference.basic_serial_port.cancel.overload1 more...]]`` 28688 28689 void ``[link boost_asio.reference.basic_serial_port.cancel.overload2 cancel]``( 28690 boost::system::error_code & ec); 28691 `` [''''»''' [link boost_asio.reference.basic_serial_port.cancel.overload2 more...]]`` 28692 28693 28694[section:overload1 basic_serial_port::cancel (1 of 2 overloads)] 28695 28696 28697Cancel all asynchronous operations associated with the serial port. 28698 28699 28700 void cancel(); 28701 28702 28703This 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. 28704 28705 28706[heading Exceptions] 28707 28708 28709[variablelist 28710 28711[[boost::system::system_error][Thrown on failure. ]] 28712 28713] 28714 28715 28716 28717 28718[endsect] 28719 28720 28721 28722[section:overload2 basic_serial_port::cancel (2 of 2 overloads)] 28723 28724 28725Cancel all asynchronous operations associated with the serial port. 28726 28727 28728 void cancel( 28729 boost::system::error_code & ec); 28730 28731 28732This 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. 28733 28734 28735[heading Parameters] 28736 28737 28738[variablelist 28739 28740[[ec][Set to indicate what error occurred, if any. ]] 28741 28742] 28743 28744 28745 28746 28747[endsect] 28748 28749 28750[endsect] 28751 28752[section:close basic_serial_port::close] 28753 28754[indexterm2 boost_asio.indexterm.basic_serial_port.close..close..basic_serial_port] 28755Close the serial port. 28756 28757 28758 void ``[link boost_asio.reference.basic_serial_port.close.overload1 close]``(); 28759 `` [''''»''' [link boost_asio.reference.basic_serial_port.close.overload1 more...]]`` 28760 28761 void ``[link boost_asio.reference.basic_serial_port.close.overload2 close]``( 28762 boost::system::error_code & ec); 28763 `` [''''»''' [link boost_asio.reference.basic_serial_port.close.overload2 more...]]`` 28764 28765 28766[section:overload1 basic_serial_port::close (1 of 2 overloads)] 28767 28768 28769Close the serial port. 28770 28771 28772 void close(); 28773 28774 28775This 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. 28776 28777 28778[heading Exceptions] 28779 28780 28781[variablelist 28782 28783[[boost::system::system_error][Thrown on failure. ]] 28784 28785] 28786 28787 28788 28789 28790[endsect] 28791 28792 28793 28794[section:overload2 basic_serial_port::close (2 of 2 overloads)] 28795 28796 28797Close the serial port. 28798 28799 28800 void close( 28801 boost::system::error_code & ec); 28802 28803 28804This 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. 28805 28806 28807[heading Parameters] 28808 28809 28810[variablelist 28811 28812[[ec][Set to indicate what error occurred, if any. ]] 28813 28814] 28815 28816 28817 28818 28819[endsect] 28820 28821 28822[endsect] 28823 28824 28825[section:executor_type basic_serial_port::executor_type] 28826 28827[indexterm2 boost_asio.indexterm.basic_serial_port.executor_type..executor_type..basic_serial_port] 28828The type of the executor associated with the object. 28829 28830 28831 typedef Executor executor_type; 28832 28833 28834 28835[heading Requirements] 28836 28837['Header: ][^boost/asio/basic_serial_port.hpp] 28838 28839['Convenience header: ][^boost/asio.hpp] 28840 28841 28842[endsect] 28843 28844 28845 28846[section:get_executor basic_serial_port::get_executor] 28847 28848[indexterm2 boost_asio.indexterm.basic_serial_port.get_executor..get_executor..basic_serial_port] 28849Get the executor associated with the object. 28850 28851 28852 executor_type get_executor(); 28853 28854 28855 28856[endsect] 28857 28858 28859[section:get_option basic_serial_port::get_option] 28860 28861[indexterm2 boost_asio.indexterm.basic_serial_port.get_option..get_option..basic_serial_port] 28862Get an option from the serial port. 28863 28864 28865 template< 28866 typename ``[link boost_asio.reference.GettableSerialPortOption GettableSerialPortOption]``> 28867 void ``[link boost_asio.reference.basic_serial_port.get_option.overload1 get_option]``( 28868 GettableSerialPortOption & option) const; 28869 `` [''''»''' [link boost_asio.reference.basic_serial_port.get_option.overload1 more...]]`` 28870 28871 template< 28872 typename ``[link boost_asio.reference.GettableSerialPortOption GettableSerialPortOption]``> 28873 void ``[link boost_asio.reference.basic_serial_port.get_option.overload2 get_option]``( 28874 GettableSerialPortOption & option, 28875 boost::system::error_code & ec) const; 28876 `` [''''»''' [link boost_asio.reference.basic_serial_port.get_option.overload2 more...]]`` 28877 28878 28879[section:overload1 basic_serial_port::get_option (1 of 2 overloads)] 28880 28881 28882Get an option from the serial port. 28883 28884 28885 template< 28886 typename ``[link boost_asio.reference.GettableSerialPortOption GettableSerialPortOption]``> 28887 void get_option( 28888 GettableSerialPortOption & option) const; 28889 28890 28891This function is used to get the current value of an option on the serial port. 28892 28893 28894[heading Parameters] 28895 28896 28897[variablelist 28898 28899[[option][The option value to be obtained from the serial port.]] 28900 28901] 28902 28903 28904[heading Exceptions] 28905 28906 28907[variablelist 28908 28909[[boost::system::system_error][Thrown on failure.]] 28910 28911] 28912 28913 28914 28915 28916 28917[endsect] 28918 28919 28920 28921[section:overload2 basic_serial_port::get_option (2 of 2 overloads)] 28922 28923 28924Get an option from the serial port. 28925 28926 28927 template< 28928 typename ``[link boost_asio.reference.GettableSerialPortOption GettableSerialPortOption]``> 28929 void get_option( 28930 GettableSerialPortOption & option, 28931 boost::system::error_code & ec) const; 28932 28933 28934This function is used to get the current value of an option on the serial port. 28935 28936 28937[heading Parameters] 28938 28939 28940[variablelist 28941 28942[[option][The option value to be obtained from the serial port.]] 28943 28944[[ec][Set to indicate what error occurred, if any.]] 28945 28946] 28947 28948 28949 28950 28951 28952[endsect] 28953 28954 28955[endsect] 28956 28957 28958[section:is_open basic_serial_port::is_open] 28959 28960[indexterm2 boost_asio.indexterm.basic_serial_port.is_open..is_open..basic_serial_port] 28961Determine whether the serial port is open. 28962 28963 28964 bool is_open() const; 28965 28966 28967 28968[endsect] 28969 28970 28971[section:lowest_layer basic_serial_port::lowest_layer] 28972 28973[indexterm2 boost_asio.indexterm.basic_serial_port.lowest_layer..lowest_layer..basic_serial_port] 28974Get a reference to the lowest layer. 28975 28976 28977 lowest_layer_type & ``[link boost_asio.reference.basic_serial_port.lowest_layer.overload1 lowest_layer]``(); 28978 `` [''''»''' [link boost_asio.reference.basic_serial_port.lowest_layer.overload1 more...]]`` 28979 28980 28981Get a const reference to the lowest layer. 28982 28983 28984 const lowest_layer_type & ``[link boost_asio.reference.basic_serial_port.lowest_layer.overload2 lowest_layer]``() const; 28985 `` [''''»''' [link boost_asio.reference.basic_serial_port.lowest_layer.overload2 more...]]`` 28986 28987 28988[section:overload1 basic_serial_port::lowest_layer (1 of 2 overloads)] 28989 28990 28991Get a reference to the lowest layer. 28992 28993 28994 lowest_layer_type & lowest_layer(); 28995 28996 28997This 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. 28998 28999 29000[heading Return Value] 29001 29002A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 29003 29004 29005 29006 29007[endsect] 29008 29009 29010 29011[section:overload2 basic_serial_port::lowest_layer (2 of 2 overloads)] 29012 29013 29014Get a const reference to the lowest layer. 29015 29016 29017 const lowest_layer_type & lowest_layer() const; 29018 29019 29020This 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. 29021 29022 29023[heading Return Value] 29024 29025A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 29026 29027 29028 29029 29030[endsect] 29031 29032 29033[endsect] 29034 29035 29036[section:lowest_layer_type basic_serial_port::lowest_layer_type] 29037 29038[indexterm2 boost_asio.indexterm.basic_serial_port.lowest_layer_type..lowest_layer_type..basic_serial_port] 29039A basic\_basic\_serial\_port is always the lowest layer. 29040 29041 29042 typedef basic_serial_port lowest_layer_type; 29043 29044 29045[heading Types] 29046[table 29047 [[Name][Description]] 29048 29049 [ 29050 29051 [[link boost_asio.reference.basic_serial_port__rebind_executor [*rebind_executor]]] 29052 [Rebinds the serial port type to another executor. ] 29053 29054 ] 29055 29056 [ 29057 29058 [[link boost_asio.reference.basic_serial_port.executor_type [*executor_type]]] 29059 [The type of the executor associated with the object. ] 29060 29061 ] 29062 29063 [ 29064 29065 [[link boost_asio.reference.basic_serial_port.lowest_layer_type [*lowest_layer_type]]] 29066 [A basic_basic_serial_port is always the lowest layer. ] 29067 29068 ] 29069 29070 [ 29071 29072 [[link boost_asio.reference.basic_serial_port.native_handle_type [*native_handle_type]]] 29073 [The native representation of a serial port. ] 29074 29075 ] 29076 29077] 29078 29079[heading Member Functions] 29080[table 29081 [[Name][Description]] 29082 29083 [ 29084 [[link boost_asio.reference.basic_serial_port.assign [*assign]]] 29085 [Assign an existing native serial port to the serial port. ] 29086 ] 29087 29088 [ 29089 [[link boost_asio.reference.basic_serial_port.async_read_some [*async_read_some]]] 29090 [Start an asynchronous read. ] 29091 ] 29092 29093 [ 29094 [[link boost_asio.reference.basic_serial_port.async_write_some [*async_write_some]]] 29095 [Start an asynchronous write. ] 29096 ] 29097 29098 [ 29099 [[link boost_asio.reference.basic_serial_port.basic_serial_port [*basic_serial_port]] [constructor]] 29100 [Construct a basic_serial_port without opening it. 29101 [hr] 29102 Construct and open a basic_serial_port. 29103 [hr] 29104 Construct a basic_serial_port on an existing native serial port. 29105 [hr] 29106 Move-construct a basic_serial_port from another. ] 29107 ] 29108 29109 [ 29110 [[link boost_asio.reference.basic_serial_port.cancel [*cancel]]] 29111 [Cancel all asynchronous operations associated with the serial port. ] 29112 ] 29113 29114 [ 29115 [[link boost_asio.reference.basic_serial_port.close [*close]]] 29116 [Close the serial port. ] 29117 ] 29118 29119 [ 29120 [[link boost_asio.reference.basic_serial_port.get_executor [*get_executor]]] 29121 [Get the executor associated with the object. ] 29122 ] 29123 29124 [ 29125 [[link boost_asio.reference.basic_serial_port.get_option [*get_option]]] 29126 [Get an option from the serial port. ] 29127 ] 29128 29129 [ 29130 [[link boost_asio.reference.basic_serial_port.is_open [*is_open]]] 29131 [Determine whether the serial port is open. ] 29132 ] 29133 29134 [ 29135 [[link boost_asio.reference.basic_serial_port.lowest_layer [*lowest_layer]]] 29136 [Get a reference to the lowest layer. 29137 [hr] 29138 Get a const reference to the lowest layer. ] 29139 ] 29140 29141 [ 29142 [[link boost_asio.reference.basic_serial_port.native_handle [*native_handle]]] 29143 [Get the native serial port representation. ] 29144 ] 29145 29146 [ 29147 [[link boost_asio.reference.basic_serial_port.open [*open]]] 29148 [Open the serial port using the specified device name. ] 29149 ] 29150 29151 [ 29152 [[link boost_asio.reference.basic_serial_port.operator_eq_ [*operator=]]] 29153 [Move-assign a basic_serial_port from another. ] 29154 ] 29155 29156 [ 29157 [[link boost_asio.reference.basic_serial_port.read_some [*read_some]]] 29158 [Read some data from the serial port. ] 29159 ] 29160 29161 [ 29162 [[link boost_asio.reference.basic_serial_port.send_break [*send_break]]] 29163 [Send a break sequence to the serial port. ] 29164 ] 29165 29166 [ 29167 [[link boost_asio.reference.basic_serial_port.set_option [*set_option]]] 29168 [Set an option on the serial port. ] 29169 ] 29170 29171 [ 29172 [[link boost_asio.reference.basic_serial_port.write_some [*write_some]]] 29173 [Write some data to the serial port. ] 29174 ] 29175 29176 [ 29177 [[link boost_asio.reference.basic_serial_port._basic_serial_port [*~basic_serial_port]] [destructor]] 29178 [Destroys the serial port. ] 29179 ] 29180 29181] 29182 29183The [link boost_asio.reference.basic_serial_port `basic_serial_port`] class provides a wrapper over serial port functionality. 29184 29185 29186[heading Thread Safety] 29187 29188['Distinct] ['objects:] Safe. 29189 29190['Shared] ['objects:] Unsafe. 29191 29192 29193 29194 29195[heading Requirements] 29196 29197['Header: ][^boost/asio/basic_serial_port.hpp] 29198 29199['Convenience header: ][^boost/asio.hpp] 29200 29201 29202[endsect] 29203 29204 29205 29206[section:native_handle basic_serial_port::native_handle] 29207 29208[indexterm2 boost_asio.indexterm.basic_serial_port.native_handle..native_handle..basic_serial_port] 29209Get the native serial port representation. 29210 29211 29212 native_handle_type native_handle(); 29213 29214 29215This 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. 29216 29217 29218[endsect] 29219 29220 29221 29222[section:native_handle_type basic_serial_port::native_handle_type] 29223 29224[indexterm2 boost_asio.indexterm.basic_serial_port.native_handle_type..native_handle_type..basic_serial_port] 29225The native representation of a serial port. 29226 29227 29228 typedef implementation_defined native_handle_type; 29229 29230 29231 29232[heading Requirements] 29233 29234['Header: ][^boost/asio/basic_serial_port.hpp] 29235 29236['Convenience header: ][^boost/asio.hpp] 29237 29238 29239[endsect] 29240 29241 29242[section:open basic_serial_port::open] 29243 29244[indexterm2 boost_asio.indexterm.basic_serial_port.open..open..basic_serial_port] 29245Open the serial port using the specified device name. 29246 29247 29248 void ``[link boost_asio.reference.basic_serial_port.open.overload1 open]``( 29249 const std::string & device); 29250 `` [''''»''' [link boost_asio.reference.basic_serial_port.open.overload1 more...]]`` 29251 29252 void ``[link boost_asio.reference.basic_serial_port.open.overload2 open]``( 29253 const std::string & device, 29254 boost::system::error_code & ec); 29255 `` [''''»''' [link boost_asio.reference.basic_serial_port.open.overload2 more...]]`` 29256 29257 29258[section:overload1 basic_serial_port::open (1 of 2 overloads)] 29259 29260 29261Open the serial port using the specified device name. 29262 29263 29264 void open( 29265 const std::string & device); 29266 29267 29268This function opens the serial port for the specified device name. 29269 29270 29271[heading Parameters] 29272 29273 29274[variablelist 29275 29276[[device][The platform-specific device name.]] 29277 29278] 29279 29280 29281[heading Exceptions] 29282 29283 29284[variablelist 29285 29286[[boost::system::system_error][Thrown on failure. ]] 29287 29288] 29289 29290 29291 29292 29293[endsect] 29294 29295 29296 29297[section:overload2 basic_serial_port::open (2 of 2 overloads)] 29298 29299 29300Open the serial port using the specified device name. 29301 29302 29303 void open( 29304 const std::string & device, 29305 boost::system::error_code & ec); 29306 29307 29308This function opens the serial port using the given platform-specific device name. 29309 29310 29311[heading Parameters] 29312 29313 29314[variablelist 29315 29316[[device][The platform-specific device name.]] 29317 29318[[ec][Set the indicate what error occurred, if any. ]] 29319 29320] 29321 29322 29323 29324 29325[endsect] 29326 29327 29328[endsect] 29329 29330 29331[section:operator_eq_ basic_serial_port::operator=] 29332 29333[indexterm2 boost_asio.indexterm.basic_serial_port.operator_eq_..operator=..basic_serial_port] 29334Move-assign a [link boost_asio.reference.basic_serial_port `basic_serial_port`] from another. 29335 29336 29337 basic_serial_port & operator=( 29338 basic_serial_port && other); 29339 29340 29341This assignment operator moves a serial port from one object to another. 29342 29343 29344[heading Parameters] 29345 29346 29347[variablelist 29348 29349[[other][The other [link boost_asio.reference.basic_serial_port `basic_serial_port`] object from which the move will occur.]] 29350 29351] 29352 29353 29354[heading Remarks] 29355 29356Following the move, the moved-from object is in the same state as if constructed using the `basic_serial_port(const executor_type&)` constructor. 29357 29358 29359 29360 29361[endsect] 29362 29363 29364[section:read_some basic_serial_port::read_some] 29365 29366[indexterm2 boost_asio.indexterm.basic_serial_port.read_some..read_some..basic_serial_port] 29367Read some data from the serial port. 29368 29369 29370 template< 29371 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 29372 std::size_t ``[link boost_asio.reference.basic_serial_port.read_some.overload1 read_some]``( 29373 const MutableBufferSequence & buffers); 29374 `` [''''»''' [link boost_asio.reference.basic_serial_port.read_some.overload1 more...]]`` 29375 29376 template< 29377 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 29378 std::size_t ``[link boost_asio.reference.basic_serial_port.read_some.overload2 read_some]``( 29379 const MutableBufferSequence & buffers, 29380 boost::system::error_code & ec); 29381 `` [''''»''' [link boost_asio.reference.basic_serial_port.read_some.overload2 more...]]`` 29382 29383 29384[section:overload1 basic_serial_port::read_some (1 of 2 overloads)] 29385 29386 29387Read some data from the serial port. 29388 29389 29390 template< 29391 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 29392 std::size_t read_some( 29393 const MutableBufferSequence & buffers); 29394 29395 29396This 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. 29397 29398 29399[heading Parameters] 29400 29401 29402[variablelist 29403 29404[[buffers][One or more buffers into which the data will be read.]] 29405 29406] 29407 29408 29409[heading Return Value] 29410 29411The number of bytes read. 29412 29413 29414[heading Exceptions] 29415 29416 29417[variablelist 29418 29419[[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]] 29420 29421] 29422 29423 29424[heading Remarks] 29425 29426The 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. 29427 29428 29429[heading Example] 29430 29431To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 29432 29433 basic_serial_port.read_some(boost::asio::buffer(data, size)); 29434 29435 29436See 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. 29437 29438 29439 29440 29441[endsect] 29442 29443 29444 29445[section:overload2 basic_serial_port::read_some (2 of 2 overloads)] 29446 29447 29448Read some data from the serial port. 29449 29450 29451 template< 29452 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 29453 std::size_t read_some( 29454 const MutableBufferSequence & buffers, 29455 boost::system::error_code & ec); 29456 29457 29458This 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. 29459 29460 29461[heading Parameters] 29462 29463 29464[variablelist 29465 29466[[buffers][One or more buffers into which the data will be read.]] 29467 29468[[ec][Set to indicate what error occurred, if any.]] 29469 29470] 29471 29472 29473[heading Return Value] 29474 29475The number of bytes read. Returns 0 if an error occurred. 29476 29477 29478[heading Remarks] 29479 29480The 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. 29481 29482 29483 29484 29485[endsect] 29486 29487 29488[endsect] 29489 29490[section:send_break basic_serial_port::send_break] 29491 29492[indexterm2 boost_asio.indexterm.basic_serial_port.send_break..send_break..basic_serial_port] 29493Send a break sequence to the serial port. 29494 29495 29496 void ``[link boost_asio.reference.basic_serial_port.send_break.overload1 send_break]``(); 29497 `` [''''»''' [link boost_asio.reference.basic_serial_port.send_break.overload1 more...]]`` 29498 29499 void ``[link boost_asio.reference.basic_serial_port.send_break.overload2 send_break]``( 29500 boost::system::error_code & ec); 29501 `` [''''»''' [link boost_asio.reference.basic_serial_port.send_break.overload2 more...]]`` 29502 29503 29504[section:overload1 basic_serial_port::send_break (1 of 2 overloads)] 29505 29506 29507Send a break sequence to the serial port. 29508 29509 29510 void send_break(); 29511 29512 29513This function causes a break sequence of platform-specific duration to be sent out the serial port. 29514 29515 29516[heading Exceptions] 29517 29518 29519[variablelist 29520 29521[[boost::system::system_error][Thrown on failure. ]] 29522 29523] 29524 29525 29526 29527 29528[endsect] 29529 29530 29531 29532[section:overload2 basic_serial_port::send_break (2 of 2 overloads)] 29533 29534 29535Send a break sequence to the serial port. 29536 29537 29538 void send_break( 29539 boost::system::error_code & ec); 29540 29541 29542This function causes a break sequence of platform-specific duration to be sent out the serial port. 29543 29544 29545[heading Parameters] 29546 29547 29548[variablelist 29549 29550[[ec][Set to indicate what error occurred, if any. ]] 29551 29552] 29553 29554 29555 29556 29557[endsect] 29558 29559 29560[endsect] 29561 29562[section:set_option basic_serial_port::set_option] 29563 29564[indexterm2 boost_asio.indexterm.basic_serial_port.set_option..set_option..basic_serial_port] 29565Set an option on the serial port. 29566 29567 29568 template< 29569 typename ``[link boost_asio.reference.SettableSerialPortOption SettableSerialPortOption]``> 29570 void ``[link boost_asio.reference.basic_serial_port.set_option.overload1 set_option]``( 29571 const SettableSerialPortOption & option); 29572 `` [''''»''' [link boost_asio.reference.basic_serial_port.set_option.overload1 more...]]`` 29573 29574 template< 29575 typename ``[link boost_asio.reference.SettableSerialPortOption SettableSerialPortOption]``> 29576 void ``[link boost_asio.reference.basic_serial_port.set_option.overload2 set_option]``( 29577 const SettableSerialPortOption & option, 29578 boost::system::error_code & ec); 29579 `` [''''»''' [link boost_asio.reference.basic_serial_port.set_option.overload2 more...]]`` 29580 29581 29582[section:overload1 basic_serial_port::set_option (1 of 2 overloads)] 29583 29584 29585Set an option on the serial port. 29586 29587 29588 template< 29589 typename ``[link boost_asio.reference.SettableSerialPortOption SettableSerialPortOption]``> 29590 void set_option( 29591 const SettableSerialPortOption & option); 29592 29593 29594This function is used to set an option on the serial port. 29595 29596 29597[heading Parameters] 29598 29599 29600[variablelist 29601 29602[[option][The option value to be set on the serial port.]] 29603 29604] 29605 29606 29607[heading Exceptions] 29608 29609 29610[variablelist 29611 29612[[boost::system::system_error][Thrown on failure.]] 29613 29614] 29615 29616 29617 29618 29619 29620[endsect] 29621 29622 29623 29624[section:overload2 basic_serial_port::set_option (2 of 2 overloads)] 29625 29626 29627Set an option on the serial port. 29628 29629 29630 template< 29631 typename ``[link boost_asio.reference.SettableSerialPortOption SettableSerialPortOption]``> 29632 void set_option( 29633 const SettableSerialPortOption & option, 29634 boost::system::error_code & ec); 29635 29636 29637This function is used to set an option on the serial port. 29638 29639 29640[heading Parameters] 29641 29642 29643[variablelist 29644 29645[[option][The option value to be set on the serial port.]] 29646 29647[[ec][Set to indicate what error occurred, if any.]] 29648 29649] 29650 29651 29652 29653 29654 29655[endsect] 29656 29657 29658[endsect] 29659 29660[section:write_some basic_serial_port::write_some] 29661 29662[indexterm2 boost_asio.indexterm.basic_serial_port.write_some..write_some..basic_serial_port] 29663Write some data to the serial port. 29664 29665 29666 template< 29667 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 29668 std::size_t ``[link boost_asio.reference.basic_serial_port.write_some.overload1 write_some]``( 29669 const ConstBufferSequence & buffers); 29670 `` [''''»''' [link boost_asio.reference.basic_serial_port.write_some.overload1 more...]]`` 29671 29672 template< 29673 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 29674 std::size_t ``[link boost_asio.reference.basic_serial_port.write_some.overload2 write_some]``( 29675 const ConstBufferSequence & buffers, 29676 boost::system::error_code & ec); 29677 `` [''''»''' [link boost_asio.reference.basic_serial_port.write_some.overload2 more...]]`` 29678 29679 29680[section:overload1 basic_serial_port::write_some (1 of 2 overloads)] 29681 29682 29683Write some data to the serial port. 29684 29685 29686 template< 29687 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 29688 std::size_t write_some( 29689 const ConstBufferSequence & buffers); 29690 29691 29692This 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. 29693 29694 29695[heading Parameters] 29696 29697 29698[variablelist 29699 29700[[buffers][One or more data buffers to be written to the serial port.]] 29701 29702] 29703 29704 29705[heading Return Value] 29706 29707The number of bytes written. 29708 29709 29710[heading Exceptions] 29711 29712 29713[variablelist 29714 29715[[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]] 29716 29717] 29718 29719 29720[heading Remarks] 29721 29722The 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. 29723 29724 29725[heading Example] 29726 29727To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 29728 29729 basic_serial_port.write_some(boost::asio::buffer(data, size)); 29730 29731 29732See 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. 29733 29734 29735 29736 29737[endsect] 29738 29739 29740 29741[section:overload2 basic_serial_port::write_some (2 of 2 overloads)] 29742 29743 29744Write some data to the serial port. 29745 29746 29747 template< 29748 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 29749 std::size_t write_some( 29750 const ConstBufferSequence & buffers, 29751 boost::system::error_code & ec); 29752 29753 29754This 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. 29755 29756 29757[heading Parameters] 29758 29759 29760[variablelist 29761 29762[[buffers][One or more data buffers to be written to the serial port.]] 29763 29764[[ec][Set to indicate what error occurred, if any.]] 29765 29766] 29767 29768 29769[heading Return Value] 29770 29771The number of bytes written. Returns 0 if an error occurred. 29772 29773 29774[heading Remarks] 29775 29776The 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. 29777 29778 29779 29780 29781[endsect] 29782 29783 29784[endsect] 29785 29786 29787[section:_basic_serial_port basic_serial_port::~basic_serial_port] 29788 29789[indexterm2 boost_asio.indexterm.basic_serial_port._basic_serial_port..~basic_serial_port..basic_serial_port] 29790Destroys the serial port. 29791 29792 29793 ~basic_serial_port(); 29794 29795 29796This function destroys the serial port, cancelling any outstanding asynchronous wait operations associated with the serial port as if by calling `cancel`. 29797 29798 29799[endsect] 29800 29801 29802 29803[endsect] 29804 29805[section:basic_serial_port__rebind_executor basic_serial_port::rebind_executor] 29806 29807[indexterm1 boost_asio.indexterm.basic_serial_port__rebind_executor..basic_serial_port::rebind_executor] 29808 29809 29810Rebinds the serial port type to another executor. 29811 29812 29813 template< 29814 typename ``[link boost_asio.reference.Executor1 Executor1]``> 29815 struct rebind_executor 29816 29817 29818[heading Types] 29819[table 29820 [[Name][Description]] 29821 29822 [ 29823 29824 [[link boost_asio.reference.basic_serial_port__rebind_executor.other [*other]]] 29825 [The serial port type when rebound to the specified executor. ] 29826 29827 ] 29828 29829] 29830 29831[heading Requirements] 29832 29833['Header: ][^boost/asio/basic_serial_port.hpp] 29834 29835['Convenience header: ][^boost/asio.hpp] 29836 29837 29838[section:other basic_serial_port::rebind_executor::other] 29839 29840[indexterm2 boost_asio.indexterm.basic_serial_port__rebind_executor.other..other..basic_serial_port::rebind_executor] 29841The serial port type when rebound to the specified executor. 29842 29843 29844 typedef basic_serial_port< Executor1 > other; 29845 29846 29847[heading Types] 29848[table 29849 [[Name][Description]] 29850 29851 [ 29852 29853 [[link boost_asio.reference.basic_serial_port__rebind_executor [*rebind_executor]]] 29854 [Rebinds the serial port type to another executor. ] 29855 29856 ] 29857 29858 [ 29859 29860 [[link boost_asio.reference.basic_serial_port.executor_type [*executor_type]]] 29861 [The type of the executor associated with the object. ] 29862 29863 ] 29864 29865 [ 29866 29867 [[link boost_asio.reference.basic_serial_port.lowest_layer_type [*lowest_layer_type]]] 29868 [A basic_basic_serial_port is always the lowest layer. ] 29869 29870 ] 29871 29872 [ 29873 29874 [[link boost_asio.reference.basic_serial_port.native_handle_type [*native_handle_type]]] 29875 [The native representation of a serial port. ] 29876 29877 ] 29878 29879] 29880 29881[heading Member Functions] 29882[table 29883 [[Name][Description]] 29884 29885 [ 29886 [[link boost_asio.reference.basic_serial_port.assign [*assign]]] 29887 [Assign an existing native serial port to the serial port. ] 29888 ] 29889 29890 [ 29891 [[link boost_asio.reference.basic_serial_port.async_read_some [*async_read_some]]] 29892 [Start an asynchronous read. ] 29893 ] 29894 29895 [ 29896 [[link boost_asio.reference.basic_serial_port.async_write_some [*async_write_some]]] 29897 [Start an asynchronous write. ] 29898 ] 29899 29900 [ 29901 [[link boost_asio.reference.basic_serial_port.basic_serial_port [*basic_serial_port]] [constructor]] 29902 [Construct a basic_serial_port without opening it. 29903 [hr] 29904 Construct and open a basic_serial_port. 29905 [hr] 29906 Construct a basic_serial_port on an existing native serial port. 29907 [hr] 29908 Move-construct a basic_serial_port from another. ] 29909 ] 29910 29911 [ 29912 [[link boost_asio.reference.basic_serial_port.cancel [*cancel]]] 29913 [Cancel all asynchronous operations associated with the serial port. ] 29914 ] 29915 29916 [ 29917 [[link boost_asio.reference.basic_serial_port.close [*close]]] 29918 [Close the serial port. ] 29919 ] 29920 29921 [ 29922 [[link boost_asio.reference.basic_serial_port.get_executor [*get_executor]]] 29923 [Get the executor associated with the object. ] 29924 ] 29925 29926 [ 29927 [[link boost_asio.reference.basic_serial_port.get_option [*get_option]]] 29928 [Get an option from the serial port. ] 29929 ] 29930 29931 [ 29932 [[link boost_asio.reference.basic_serial_port.is_open [*is_open]]] 29933 [Determine whether the serial port is open. ] 29934 ] 29935 29936 [ 29937 [[link boost_asio.reference.basic_serial_port.lowest_layer [*lowest_layer]]] 29938 [Get a reference to the lowest layer. 29939 [hr] 29940 Get a const reference to the lowest layer. ] 29941 ] 29942 29943 [ 29944 [[link boost_asio.reference.basic_serial_port.native_handle [*native_handle]]] 29945 [Get the native serial port representation. ] 29946 ] 29947 29948 [ 29949 [[link boost_asio.reference.basic_serial_port.open [*open]]] 29950 [Open the serial port using the specified device name. ] 29951 ] 29952 29953 [ 29954 [[link boost_asio.reference.basic_serial_port.operator_eq_ [*operator=]]] 29955 [Move-assign a basic_serial_port from another. ] 29956 ] 29957 29958 [ 29959 [[link boost_asio.reference.basic_serial_port.read_some [*read_some]]] 29960 [Read some data from the serial port. ] 29961 ] 29962 29963 [ 29964 [[link boost_asio.reference.basic_serial_port.send_break [*send_break]]] 29965 [Send a break sequence to the serial port. ] 29966 ] 29967 29968 [ 29969 [[link boost_asio.reference.basic_serial_port.set_option [*set_option]]] 29970 [Set an option on the serial port. ] 29971 ] 29972 29973 [ 29974 [[link boost_asio.reference.basic_serial_port.write_some [*write_some]]] 29975 [Write some data to the serial port. ] 29976 ] 29977 29978 [ 29979 [[link boost_asio.reference.basic_serial_port._basic_serial_port [*~basic_serial_port]] [destructor]] 29980 [Destroys the serial port. ] 29981 ] 29982 29983] 29984 29985The [link boost_asio.reference.basic_serial_port `basic_serial_port`] class provides a wrapper over serial port functionality. 29986 29987 29988[heading Thread Safety] 29989 29990['Distinct] ['objects:] Safe. 29991 29992['Shared] ['objects:] Unsafe. 29993 29994 29995 29996 29997[heading Requirements] 29998 29999['Header: ][^boost/asio/basic_serial_port.hpp] 30000 30001['Convenience header: ][^boost/asio.hpp] 30002 30003 30004[endsect] 30005 30006 30007 30008[endsect] 30009 30010[section:basic_signal_set basic_signal_set] 30011 30012[indexterm1 boost_asio.indexterm.basic_signal_set..basic_signal_set] 30013 30014 30015Provides signal functionality. 30016 30017 30018 template< 30019 typename ``[link boost_asio.reference.Executor1 Executor]`` = any_io_executor> 30020 class basic_signal_set 30021 30022 30023[heading Types] 30024[table 30025 [[Name][Description]] 30026 30027 [ 30028 30029 [[link boost_asio.reference.basic_signal_set__rebind_executor [*rebind_executor]]] 30030 [Rebinds the signal set type to another executor. ] 30031 30032 ] 30033 30034 [ 30035 30036 [[link boost_asio.reference.basic_signal_set.executor_type [*executor_type]]] 30037 [The type of the executor associated with the object. ] 30038 30039 ] 30040 30041] 30042 30043[heading Member Functions] 30044[table 30045 [[Name][Description]] 30046 30047 [ 30048 [[link boost_asio.reference.basic_signal_set.add [*add]]] 30049 [Add a signal to a signal_set. ] 30050 ] 30051 30052 [ 30053 [[link boost_asio.reference.basic_signal_set.async_wait [*async_wait]]] 30054 [Start an asynchronous operation to wait for a signal to be delivered. ] 30055 ] 30056 30057 [ 30058 [[link boost_asio.reference.basic_signal_set.basic_signal_set [*basic_signal_set]] [constructor]] 30059 [Construct a signal set without adding any signals. 30060 [hr] 30061 Construct a signal set and add one signal. 30062 [hr] 30063 Construct a signal set and add two signals. 30064 [hr] 30065 Construct a signal set and add three signals. ] 30066 ] 30067 30068 [ 30069 [[link boost_asio.reference.basic_signal_set.cancel [*cancel]]] 30070 [Cancel all operations associated with the signal set. ] 30071 ] 30072 30073 [ 30074 [[link boost_asio.reference.basic_signal_set.clear [*clear]]] 30075 [Remove all signals from a signal_set. ] 30076 ] 30077 30078 [ 30079 [[link boost_asio.reference.basic_signal_set.get_executor [*get_executor]]] 30080 [Get the executor associated with the object. ] 30081 ] 30082 30083 [ 30084 [[link boost_asio.reference.basic_signal_set.remove [*remove]]] 30085 [Remove a signal from a signal_set. ] 30086 ] 30087 30088 [ 30089 [[link boost_asio.reference.basic_signal_set._basic_signal_set [*~basic_signal_set]] [destructor]] 30090 [Destroys the signal set. ] 30091 ] 30092 30093] 30094 30095The [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. 30096 30097 30098[heading Thread Safety] 30099 30100['Distinct] ['objects:] Safe. 30101 30102['Shared] ['objects:] Unsafe. 30103 30104 30105[heading Example] 30106 30107Performing an asynchronous wait: 30108 30109 void handler( 30110 const boost::system::error_code& error, 30111 int signal_number) 30112 { 30113 if (!error) 30114 { 30115 // A signal occurred. 30116 } 30117 } 30118 30119 ... 30120 30121 // Construct a signal set registered for process termination. 30122 boost::asio::signal_set signals(my_context, SIGINT, SIGTERM); 30123 30124 // Start an asynchronous wait for one of the signals to occur. 30125 signals.async_wait(handler); 30126 30127 30128 30129 30130 30131[heading Queueing of signal notifications] 30132 30133 30134 30135If 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. 30136 30137If 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. 30138 30139 30140[heading Multiple registration of signals] 30141 30142 30143 30144The same signal number may be registered with different signal\_set objects. When the signal occurs, one handler is called for each signal\_set object. 30145 30146Note 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()`. 30147 30148 30149[heading Signal masking on POSIX platforms] 30150 30151 30152 30153POSIX 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. 30154 30155[heading Requirements] 30156 30157['Header: ][^boost/asio/basic_signal_set.hpp] 30158 30159['Convenience header: ][^boost/asio.hpp] 30160 30161[section:add basic_signal_set::add] 30162 30163[indexterm2 boost_asio.indexterm.basic_signal_set.add..add..basic_signal_set] 30164Add a signal to a signal\_set. 30165 30166 30167 void ``[link boost_asio.reference.basic_signal_set.add.overload1 add]``( 30168 int signal_number); 30169 `` [''''»''' [link boost_asio.reference.basic_signal_set.add.overload1 more...]]`` 30170 30171 void ``[link boost_asio.reference.basic_signal_set.add.overload2 add]``( 30172 int signal_number, 30173 boost::system::error_code & ec); 30174 `` [''''»''' [link boost_asio.reference.basic_signal_set.add.overload2 more...]]`` 30175 30176 30177[section:overload1 basic_signal_set::add (1 of 2 overloads)] 30178 30179 30180Add a signal to a signal\_set. 30181 30182 30183 void add( 30184 int signal_number); 30185 30186 30187This function adds the specified signal to the set. It has no effect if the signal is already in the set. 30188 30189 30190[heading Parameters] 30191 30192 30193[variablelist 30194 30195[[signal_number][The signal to be added to the set.]] 30196 30197] 30198 30199 30200[heading Exceptions] 30201 30202 30203[variablelist 30204 30205[[boost::system::system_error][Thrown on failure. ]] 30206 30207] 30208 30209 30210 30211 30212[endsect] 30213 30214 30215 30216[section:overload2 basic_signal_set::add (2 of 2 overloads)] 30217 30218 30219Add a signal to a signal\_set. 30220 30221 30222 void add( 30223 int signal_number, 30224 boost::system::error_code & ec); 30225 30226 30227This function adds the specified signal to the set. It has no effect if the signal is already in the set. 30228 30229 30230[heading Parameters] 30231 30232 30233[variablelist 30234 30235[[signal_number][The signal to be added to the set.]] 30236 30237[[ec][Set to indicate what error occurred, if any. ]] 30238 30239] 30240 30241 30242 30243 30244[endsect] 30245 30246 30247[endsect] 30248 30249 30250[section:async_wait basic_signal_set::async_wait] 30251 30252[indexterm2 boost_asio.indexterm.basic_signal_set.async_wait..async_wait..basic_signal_set] 30253Start an asynchronous operation to wait for a signal to be delivered. 30254 30255 30256 template< 30257 typename ``[link boost_asio.reference.SignalHandler SignalHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 30258 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait( 30259 SignalHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 30260 30261 30262This function may be used to initiate an asynchronous wait against the signal set. It always returns immediately. 30263 30264For each call to `async_wait()`, the supplied handler will be called exactly once. The handler will be called when: 30265 30266 30267* One of the registered signals in the signal set occurs; or 30268 30269 30270* The signal set was cancelled, in which case the handler is passed the error code `boost::asio::error::operation_aborted`. 30271 30272 30273[heading Parameters] 30274 30275 30276[variablelist 30277 30278[[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: 30279`` 30280 void handler( 30281 const boost::system::error_code& error, // Result of operation. 30282 int signal_number // Indicates which signal occurred. 30283 ); 30284`` 30285Regardless 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`]. ]] 30286 30287] 30288 30289 30290 30291 30292[endsect] 30293 30294 30295[section:basic_signal_set basic_signal_set::basic_signal_set] 30296 30297[indexterm2 boost_asio.indexterm.basic_signal_set.basic_signal_set..basic_signal_set..basic_signal_set] 30298Construct a signal set without adding any signals. 30299 30300 30301 explicit ``[link boost_asio.reference.basic_signal_set.basic_signal_set.overload1 basic_signal_set]``( 30302 const executor_type & ex); 30303 `` [''''»''' [link boost_asio.reference.basic_signal_set.basic_signal_set.overload1 more...]]`` 30304 30305 template< 30306 typename ExecutionContext> 30307 explicit ``[link boost_asio.reference.basic_signal_set.basic_signal_set.overload2 basic_signal_set]``( 30308 ExecutionContext & context, 30309 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value, defaulted_constraint >::type = defaulted_constraint()); 30310 `` [''''»''' [link boost_asio.reference.basic_signal_set.basic_signal_set.overload2 more...]]`` 30311 30312 30313Construct a signal set and add one signal. 30314 30315 30316 ``[link boost_asio.reference.basic_signal_set.basic_signal_set.overload3 basic_signal_set]``( 30317 const executor_type & ex, 30318 int signal_number_1); 30319 `` [''''»''' [link boost_asio.reference.basic_signal_set.basic_signal_set.overload3 more...]]`` 30320 30321 template< 30322 typename ExecutionContext> 30323 ``[link boost_asio.reference.basic_signal_set.basic_signal_set.overload4 basic_signal_set]``( 30324 ExecutionContext & context, 30325 int signal_number_1, 30326 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value, defaulted_constraint >::type = defaulted_constraint()); 30327 `` [''''»''' [link boost_asio.reference.basic_signal_set.basic_signal_set.overload4 more...]]`` 30328 30329 30330Construct a signal set and add two signals. 30331 30332 30333 ``[link boost_asio.reference.basic_signal_set.basic_signal_set.overload5 basic_signal_set]``( 30334 const executor_type & ex, 30335 int signal_number_1, 30336 int signal_number_2); 30337 `` [''''»''' [link boost_asio.reference.basic_signal_set.basic_signal_set.overload5 more...]]`` 30338 30339 template< 30340 typename ExecutionContext> 30341 ``[link boost_asio.reference.basic_signal_set.basic_signal_set.overload6 basic_signal_set]``( 30342 ExecutionContext & context, 30343 int signal_number_1, 30344 int signal_number_2, 30345 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value, defaulted_constraint >::type = defaulted_constraint()); 30346 `` [''''»''' [link boost_asio.reference.basic_signal_set.basic_signal_set.overload6 more...]]`` 30347 30348 30349Construct a signal set and add three signals. 30350 30351 30352 ``[link boost_asio.reference.basic_signal_set.basic_signal_set.overload7 basic_signal_set]``( 30353 const executor_type & ex, 30354 int signal_number_1, 30355 int signal_number_2, 30356 int signal_number_3); 30357 `` [''''»''' [link boost_asio.reference.basic_signal_set.basic_signal_set.overload7 more...]]`` 30358 30359 template< 30360 typename ExecutionContext> 30361 ``[link boost_asio.reference.basic_signal_set.basic_signal_set.overload8 basic_signal_set]``( 30362 ExecutionContext & context, 30363 int signal_number_1, 30364 int signal_number_2, 30365 int signal_number_3, 30366 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value, defaulted_constraint >::type = defaulted_constraint()); 30367 `` [''''»''' [link boost_asio.reference.basic_signal_set.basic_signal_set.overload8 more...]]`` 30368 30369 30370[section:overload1 basic_signal_set::basic_signal_set (1 of 8 overloads)] 30371 30372 30373Construct a signal set without adding any signals. 30374 30375 30376 basic_signal_set( 30377 const executor_type & ex); 30378 30379 30380This constructor creates a signal set without registering for any signals. 30381 30382 30383[heading Parameters] 30384 30385 30386[variablelist 30387 30388[[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. ]] 30389 30390] 30391 30392 30393 30394 30395[endsect] 30396 30397 30398 30399[section:overload2 basic_signal_set::basic_signal_set (2 of 8 overloads)] 30400 30401 30402Construct a signal set without adding any signals. 30403 30404 30405 template< 30406 typename ExecutionContext> 30407 basic_signal_set( 30408 ExecutionContext & context, 30409 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value, defaulted_constraint >::type = defaulted_constraint()); 30410 30411 30412This constructor creates a signal set without registering for any signals. 30413 30414 30415[heading Parameters] 30416 30417 30418[variablelist 30419 30420[[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. ]] 30421 30422] 30423 30424 30425 30426 30427[endsect] 30428 30429 30430 30431[section:overload3 basic_signal_set::basic_signal_set (3 of 8 overloads)] 30432 30433 30434Construct a signal set and add one signal. 30435 30436 30437 basic_signal_set( 30438 const executor_type & ex, 30439 int signal_number_1); 30440 30441 30442This constructor creates a signal set and registers for one signal. 30443 30444 30445[heading Parameters] 30446 30447 30448[variablelist 30449 30450[[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.]] 30451 30452[[signal_number_1][The signal number to be added.]] 30453 30454] 30455 30456 30457[heading Remarks] 30458 30459This constructor is equivalent to performing: 30460 30461 boost::asio::signal_set signals(ex); 30462 signals.add(signal_number_1); 30463 30464 30465 30466 30467 30468 30469 30470[endsect] 30471 30472 30473 30474[section:overload4 basic_signal_set::basic_signal_set (4 of 8 overloads)] 30475 30476 30477Construct a signal set and add one signal. 30478 30479 30480 template< 30481 typename ExecutionContext> 30482 basic_signal_set( 30483 ExecutionContext & context, 30484 int signal_number_1, 30485 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value, defaulted_constraint >::type = defaulted_constraint()); 30486 30487 30488This constructor creates a signal set and registers for one signal. 30489 30490 30491[heading Parameters] 30492 30493 30494[variablelist 30495 30496[[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.]] 30497 30498[[signal_number_1][The signal number to be added.]] 30499 30500] 30501 30502 30503[heading Remarks] 30504 30505This constructor is equivalent to performing: 30506 30507 boost::asio::signal_set signals(context); 30508 signals.add(signal_number_1); 30509 30510 30511 30512 30513 30514 30515 30516[endsect] 30517 30518 30519 30520[section:overload5 basic_signal_set::basic_signal_set (5 of 8 overloads)] 30521 30522 30523Construct a signal set and add two signals. 30524 30525 30526 basic_signal_set( 30527 const executor_type & ex, 30528 int signal_number_1, 30529 int signal_number_2); 30530 30531 30532This constructor creates a signal set and registers for two signals. 30533 30534 30535[heading Parameters] 30536 30537 30538[variablelist 30539 30540[[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.]] 30541 30542[[signal_number_1][The first signal number to be added.]] 30543 30544[[signal_number_2][The second signal number to be added.]] 30545 30546] 30547 30548 30549[heading Remarks] 30550 30551This constructor is equivalent to performing: 30552 30553 boost::asio::signal_set signals(ex); 30554 signals.add(signal_number_1); 30555 signals.add(signal_number_2); 30556 30557 30558 30559 30560 30561 30562 30563[endsect] 30564 30565 30566 30567[section:overload6 basic_signal_set::basic_signal_set (6 of 8 overloads)] 30568 30569 30570Construct a signal set and add two signals. 30571 30572 30573 template< 30574 typename ExecutionContext> 30575 basic_signal_set( 30576 ExecutionContext & context, 30577 int signal_number_1, 30578 int signal_number_2, 30579 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value, defaulted_constraint >::type = defaulted_constraint()); 30580 30581 30582This constructor creates a signal set and registers for two signals. 30583 30584 30585[heading Parameters] 30586 30587 30588[variablelist 30589 30590[[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.]] 30591 30592[[signal_number_1][The first signal number to be added.]] 30593 30594[[signal_number_2][The second signal number to be added.]] 30595 30596] 30597 30598 30599[heading Remarks] 30600 30601This constructor is equivalent to performing: 30602 30603 boost::asio::signal_set signals(context); 30604 signals.add(signal_number_1); 30605 signals.add(signal_number_2); 30606 30607 30608 30609 30610 30611 30612 30613[endsect] 30614 30615 30616 30617[section:overload7 basic_signal_set::basic_signal_set (7 of 8 overloads)] 30618 30619 30620Construct a signal set and add three signals. 30621 30622 30623 basic_signal_set( 30624 const executor_type & ex, 30625 int signal_number_1, 30626 int signal_number_2, 30627 int signal_number_3); 30628 30629 30630This constructor creates a signal set and registers for three signals. 30631 30632 30633[heading Parameters] 30634 30635 30636[variablelist 30637 30638[[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.]] 30639 30640[[signal_number_1][The first signal number to be added.]] 30641 30642[[signal_number_2][The second signal number to be added.]] 30643 30644[[signal_number_3][The third signal number to be added.]] 30645 30646] 30647 30648 30649[heading Remarks] 30650 30651This constructor is equivalent to performing: 30652 30653 boost::asio::signal_set signals(ex); 30654 signals.add(signal_number_1); 30655 signals.add(signal_number_2); 30656 signals.add(signal_number_3); 30657 30658 30659 30660 30661 30662 30663 30664[endsect] 30665 30666 30667 30668[section:overload8 basic_signal_set::basic_signal_set (8 of 8 overloads)] 30669 30670 30671Construct a signal set and add three signals. 30672 30673 30674 template< 30675 typename ExecutionContext> 30676 basic_signal_set( 30677 ExecutionContext & context, 30678 int signal_number_1, 30679 int signal_number_2, 30680 int signal_number_3, 30681 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value, defaulted_constraint >::type = defaulted_constraint()); 30682 30683 30684This constructor creates a signal set and registers for three signals. 30685 30686 30687[heading Parameters] 30688 30689 30690[variablelist 30691 30692[[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.]] 30693 30694[[signal_number_1][The first signal number to be added.]] 30695 30696[[signal_number_2][The second signal number to be added.]] 30697 30698[[signal_number_3][The third signal number to be added.]] 30699 30700] 30701 30702 30703[heading Remarks] 30704 30705This constructor is equivalent to performing: 30706 30707 boost::asio::signal_set signals(context); 30708 signals.add(signal_number_1); 30709 signals.add(signal_number_2); 30710 signals.add(signal_number_3); 30711 30712 30713 30714 30715 30716 30717 30718[endsect] 30719 30720 30721[endsect] 30722 30723[section:cancel basic_signal_set::cancel] 30724 30725[indexterm2 boost_asio.indexterm.basic_signal_set.cancel..cancel..basic_signal_set] 30726Cancel all operations associated with the signal set. 30727 30728 30729 void ``[link boost_asio.reference.basic_signal_set.cancel.overload1 cancel]``(); 30730 `` [''''»''' [link boost_asio.reference.basic_signal_set.cancel.overload1 more...]]`` 30731 30732 void ``[link boost_asio.reference.basic_signal_set.cancel.overload2 cancel]``( 30733 boost::system::error_code & ec); 30734 `` [''''»''' [link boost_asio.reference.basic_signal_set.cancel.overload2 more...]]`` 30735 30736 30737[section:overload1 basic_signal_set::cancel (1 of 2 overloads)] 30738 30739 30740Cancel all operations associated with the signal set. 30741 30742 30743 void cancel(); 30744 30745 30746This 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. 30747 30748Cancellation does not alter the set of registered signals. 30749 30750 30751[heading Exceptions] 30752 30753 30754[variablelist 30755 30756[[boost::system::system_error][Thrown on failure.]] 30757 30758] 30759 30760 30761[heading Remarks] 30762 30763If a registered signal occurred before `cancel()` is called, then the handlers for asynchronous wait operations will: 30764 30765 30766* have already been invoked; or 30767 30768 30769* have been queued for invocation in the near future. 30770 30771These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 30772 30773 30774[endsect] 30775 30776 30777 30778[section:overload2 basic_signal_set::cancel (2 of 2 overloads)] 30779 30780 30781Cancel all operations associated with the signal set. 30782 30783 30784 void cancel( 30785 boost::system::error_code & ec); 30786 30787 30788This 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. 30789 30790Cancellation does not alter the set of registered signals. 30791 30792 30793[heading Parameters] 30794 30795 30796[variablelist 30797 30798[[ec][Set to indicate what error occurred, if any.]] 30799 30800] 30801 30802 30803[heading Remarks] 30804 30805If a registered signal occurred before `cancel()` is called, then the handlers for asynchronous wait operations will: 30806 30807 30808* have already been invoked; or 30809 30810 30811* have been queued for invocation in the near future. 30812 30813These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 30814 30815 30816[endsect] 30817 30818 30819[endsect] 30820 30821[section:clear basic_signal_set::clear] 30822 30823[indexterm2 boost_asio.indexterm.basic_signal_set.clear..clear..basic_signal_set] 30824Remove all signals from a signal\_set. 30825 30826 30827 void ``[link boost_asio.reference.basic_signal_set.clear.overload1 clear]``(); 30828 `` [''''»''' [link boost_asio.reference.basic_signal_set.clear.overload1 more...]]`` 30829 30830 void ``[link boost_asio.reference.basic_signal_set.clear.overload2 clear]``( 30831 boost::system::error_code & ec); 30832 `` [''''»''' [link boost_asio.reference.basic_signal_set.clear.overload2 more...]]`` 30833 30834 30835[section:overload1 basic_signal_set::clear (1 of 2 overloads)] 30836 30837 30838Remove all signals from a signal\_set. 30839 30840 30841 void clear(); 30842 30843 30844This function removes all signals from the set. It has no effect if the set is already empty. 30845 30846 30847[heading Exceptions] 30848 30849 30850[variablelist 30851 30852[[boost::system::system_error][Thrown on failure.]] 30853 30854] 30855 30856 30857[heading Remarks] 30858 30859Removes all queued notifications. 30860 30861 30862 30863 30864[endsect] 30865 30866 30867 30868[section:overload2 basic_signal_set::clear (2 of 2 overloads)] 30869 30870 30871Remove all signals from a signal\_set. 30872 30873 30874 void clear( 30875 boost::system::error_code & ec); 30876 30877 30878This function removes all signals from the set. It has no effect if the set is already empty. 30879 30880 30881[heading Parameters] 30882 30883 30884[variablelist 30885 30886[[ec][Set to indicate what error occurred, if any.]] 30887 30888] 30889 30890 30891[heading Remarks] 30892 30893Removes all queued notifications. 30894 30895 30896 30897 30898[endsect] 30899 30900 30901[endsect] 30902 30903 30904[section:executor_type basic_signal_set::executor_type] 30905 30906[indexterm2 boost_asio.indexterm.basic_signal_set.executor_type..executor_type..basic_signal_set] 30907The type of the executor associated with the object. 30908 30909 30910 typedef Executor executor_type; 30911 30912 30913 30914[heading Requirements] 30915 30916['Header: ][^boost/asio/basic_signal_set.hpp] 30917 30918['Convenience header: ][^boost/asio.hpp] 30919 30920 30921[endsect] 30922 30923 30924 30925[section:get_executor basic_signal_set::get_executor] 30926 30927[indexterm2 boost_asio.indexterm.basic_signal_set.get_executor..get_executor..basic_signal_set] 30928Get the executor associated with the object. 30929 30930 30931 executor_type get_executor(); 30932 30933 30934 30935[endsect] 30936 30937 30938[section:remove basic_signal_set::remove] 30939 30940[indexterm2 boost_asio.indexterm.basic_signal_set.remove..remove..basic_signal_set] 30941Remove a signal from a signal\_set. 30942 30943 30944 void ``[link boost_asio.reference.basic_signal_set.remove.overload1 remove]``( 30945 int signal_number); 30946 `` [''''»''' [link boost_asio.reference.basic_signal_set.remove.overload1 more...]]`` 30947 30948 void ``[link boost_asio.reference.basic_signal_set.remove.overload2 remove]``( 30949 int signal_number, 30950 boost::system::error_code & ec); 30951 `` [''''»''' [link boost_asio.reference.basic_signal_set.remove.overload2 more...]]`` 30952 30953 30954[section:overload1 basic_signal_set::remove (1 of 2 overloads)] 30955 30956 30957Remove a signal from a signal\_set. 30958 30959 30960 void remove( 30961 int signal_number); 30962 30963 30964This function removes the specified signal from the set. It has no effect if the signal is not in the set. 30965 30966 30967[heading Parameters] 30968 30969 30970[variablelist 30971 30972[[signal_number][The signal to be removed from the set.]] 30973 30974] 30975 30976 30977[heading Exceptions] 30978 30979 30980[variablelist 30981 30982[[boost::system::system_error][Thrown on failure.]] 30983 30984] 30985 30986 30987[heading Remarks] 30988 30989Removes any notifications that have been queued for the specified signal number. 30990 30991 30992 30993 30994[endsect] 30995 30996 30997 30998[section:overload2 basic_signal_set::remove (2 of 2 overloads)] 30999 31000 31001Remove a signal from a signal\_set. 31002 31003 31004 void remove( 31005 int signal_number, 31006 boost::system::error_code & ec); 31007 31008 31009This function removes the specified signal from the set. It has no effect if the signal is not in the set. 31010 31011 31012[heading Parameters] 31013 31014 31015[variablelist 31016 31017[[signal_number][The signal to be removed from the set.]] 31018 31019[[ec][Set to indicate what error occurred, if any.]] 31020 31021] 31022 31023 31024[heading Remarks] 31025 31026Removes any notifications that have been queued for the specified signal number. 31027 31028 31029 31030 31031[endsect] 31032 31033 31034[endsect] 31035 31036 31037[section:_basic_signal_set basic_signal_set::~basic_signal_set] 31038 31039[indexterm2 boost_asio.indexterm.basic_signal_set._basic_signal_set..~basic_signal_set..basic_signal_set] 31040Destroys the signal set. 31041 31042 31043 ~basic_signal_set(); 31044 31045 31046This function destroys the signal set, cancelling any outstanding asynchronous wait operations associated with the signal set as if by calling `cancel`. 31047 31048 31049[endsect] 31050 31051 31052 31053[endsect] 31054 31055[section:basic_signal_set__rebind_executor basic_signal_set::rebind_executor] 31056 31057[indexterm1 boost_asio.indexterm.basic_signal_set__rebind_executor..basic_signal_set::rebind_executor] 31058 31059 31060Rebinds the signal set type to another executor. 31061 31062 31063 template< 31064 typename ``[link boost_asio.reference.Executor1 Executor1]``> 31065 struct rebind_executor 31066 31067 31068[heading Types] 31069[table 31070 [[Name][Description]] 31071 31072 [ 31073 31074 [[link boost_asio.reference.basic_signal_set__rebind_executor.other [*other]]] 31075 [The signal set type when rebound to the specified executor. ] 31076 31077 ] 31078 31079] 31080 31081[heading Requirements] 31082 31083['Header: ][^boost/asio/basic_signal_set.hpp] 31084 31085['Convenience header: ][^boost/asio.hpp] 31086 31087 31088[section:other basic_signal_set::rebind_executor::other] 31089 31090[indexterm2 boost_asio.indexterm.basic_signal_set__rebind_executor.other..other..basic_signal_set::rebind_executor] 31091The signal set type when rebound to the specified executor. 31092 31093 31094 typedef basic_signal_set< Executor1 > other; 31095 31096 31097[heading Types] 31098[table 31099 [[Name][Description]] 31100 31101 [ 31102 31103 [[link boost_asio.reference.basic_signal_set__rebind_executor [*rebind_executor]]] 31104 [Rebinds the signal set type to another executor. ] 31105 31106 ] 31107 31108 [ 31109 31110 [[link boost_asio.reference.basic_signal_set.executor_type [*executor_type]]] 31111 [The type of the executor associated with the object. ] 31112 31113 ] 31114 31115] 31116 31117[heading Member Functions] 31118[table 31119 [[Name][Description]] 31120 31121 [ 31122 [[link boost_asio.reference.basic_signal_set.add [*add]]] 31123 [Add a signal to a signal_set. ] 31124 ] 31125 31126 [ 31127 [[link boost_asio.reference.basic_signal_set.async_wait [*async_wait]]] 31128 [Start an asynchronous operation to wait for a signal to be delivered. ] 31129 ] 31130 31131 [ 31132 [[link boost_asio.reference.basic_signal_set.basic_signal_set [*basic_signal_set]] [constructor]] 31133 [Construct a signal set without adding any signals. 31134 [hr] 31135 Construct a signal set and add one signal. 31136 [hr] 31137 Construct a signal set and add two signals. 31138 [hr] 31139 Construct a signal set and add three signals. ] 31140 ] 31141 31142 [ 31143 [[link boost_asio.reference.basic_signal_set.cancel [*cancel]]] 31144 [Cancel all operations associated with the signal set. ] 31145 ] 31146 31147 [ 31148 [[link boost_asio.reference.basic_signal_set.clear [*clear]]] 31149 [Remove all signals from a signal_set. ] 31150 ] 31151 31152 [ 31153 [[link boost_asio.reference.basic_signal_set.get_executor [*get_executor]]] 31154 [Get the executor associated with the object. ] 31155 ] 31156 31157 [ 31158 [[link boost_asio.reference.basic_signal_set.remove [*remove]]] 31159 [Remove a signal from a signal_set. ] 31160 ] 31161 31162 [ 31163 [[link boost_asio.reference.basic_signal_set._basic_signal_set [*~basic_signal_set]] [destructor]] 31164 [Destroys the signal set. ] 31165 ] 31166 31167] 31168 31169The [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. 31170 31171 31172[heading Thread Safety] 31173 31174['Distinct] ['objects:] Safe. 31175 31176['Shared] ['objects:] Unsafe. 31177 31178 31179[heading Example] 31180 31181Performing an asynchronous wait: 31182 31183 void handler( 31184 const boost::system::error_code& error, 31185 int signal_number) 31186 { 31187 if (!error) 31188 { 31189 // A signal occurred. 31190 } 31191 } 31192 31193 ... 31194 31195 // Construct a signal set registered for process termination. 31196 boost::asio::signal_set signals(my_context, SIGINT, SIGTERM); 31197 31198 // Start an asynchronous wait for one of the signals to occur. 31199 signals.async_wait(handler); 31200 31201 31202 31203 31204 31205[heading Queueing of signal notifications] 31206 31207 31208 31209If 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. 31210 31211If 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. 31212 31213 31214[heading Multiple registration of signals] 31215 31216 31217 31218The same signal number may be registered with different signal\_set objects. When the signal occurs, one handler is called for each signal\_set object. 31219 31220Note 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()`. 31221 31222 31223[heading Signal masking on POSIX platforms] 31224 31225 31226 31227POSIX 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. 31228 31229 31230[heading Requirements] 31231 31232['Header: ][^boost/asio/basic_signal_set.hpp] 31233 31234['Convenience header: ][^boost/asio.hpp] 31235 31236 31237[endsect] 31238 31239 31240 31241[endsect] 31242 31243[section:basic_socket basic_socket] 31244 31245[indexterm1 boost_asio.indexterm.basic_socket..basic_socket] 31246 31247 31248Provides socket functionality. 31249 31250 31251 template< 31252 typename ``[link boost_asio.reference.Protocol Protocol]``, 31253 typename ``[link boost_asio.reference.Executor1 Executor]``> 31254 class basic_socket : 31255 public socket_base 31256 31257 31258[heading Types] 31259[table 31260 [[Name][Description]] 31261 31262 [ 31263 31264 [[link boost_asio.reference.basic_socket__rebind_executor [*rebind_executor]]] 31265 [Rebinds the socket type to another executor. ] 31266 31267 ] 31268 31269 [ 31270 31271 [[link boost_asio.reference.basic_socket.broadcast [*broadcast]]] 31272 [Socket option to permit sending of broadcast messages. ] 31273 31274 ] 31275 31276 [ 31277 31278 [[link boost_asio.reference.basic_socket.bytes_readable [*bytes_readable]]] 31279 [IO control command to get the amount of data that can be read without blocking. ] 31280 31281 ] 31282 31283 [ 31284 31285 [[link boost_asio.reference.basic_socket.debug [*debug]]] 31286 [Socket option to enable socket-level debugging. ] 31287 31288 ] 31289 31290 [ 31291 31292 [[link boost_asio.reference.basic_socket.do_not_route [*do_not_route]]] 31293 [Socket option to prevent routing, use local interfaces only. ] 31294 31295 ] 31296 31297 [ 31298 31299 [[link boost_asio.reference.basic_socket.enable_connection_aborted [*enable_connection_aborted]]] 31300 [Socket option to report aborted connections on accept. ] 31301 31302 ] 31303 31304 [ 31305 31306 [[link boost_asio.reference.basic_socket.endpoint_type [*endpoint_type]]] 31307 [The endpoint type. ] 31308 31309 ] 31310 31311 [ 31312 31313 [[link boost_asio.reference.basic_socket.executor_type [*executor_type]]] 31314 [The type of the executor associated with the object. ] 31315 31316 ] 31317 31318 [ 31319 31320 [[link boost_asio.reference.basic_socket.keep_alive [*keep_alive]]] 31321 [Socket option to send keep-alives. ] 31322 31323 ] 31324 31325 [ 31326 31327 [[link boost_asio.reference.basic_socket.linger [*linger]]] 31328 [Socket option to specify whether the socket lingers on close if unsent data is present. ] 31329 31330 ] 31331 31332 [ 31333 31334 [[link boost_asio.reference.basic_socket.lowest_layer_type [*lowest_layer_type]]] 31335 [A basic_socket is always the lowest layer. ] 31336 31337 ] 31338 31339 [ 31340 31341 [[link boost_asio.reference.basic_socket.message_flags [*message_flags]]] 31342 [Bitmask type for flags that can be passed to send and receive operations. ] 31343 31344 ] 31345 31346 [ 31347 31348 [[link boost_asio.reference.basic_socket.native_handle_type [*native_handle_type]]] 31349 [The native representation of a socket. ] 31350 31351 ] 31352 31353 [ 31354 31355 [[link boost_asio.reference.basic_socket.out_of_band_inline [*out_of_band_inline]]] 31356 [Socket option for putting received out-of-band data inline. ] 31357 31358 ] 31359 31360 [ 31361 31362 [[link boost_asio.reference.basic_socket.protocol_type [*protocol_type]]] 31363 [The protocol type. ] 31364 31365 ] 31366 31367 [ 31368 31369 [[link boost_asio.reference.basic_socket.receive_buffer_size [*receive_buffer_size]]] 31370 [Socket option for the receive buffer size of a socket. ] 31371 31372 ] 31373 31374 [ 31375 31376 [[link boost_asio.reference.basic_socket.receive_low_watermark [*receive_low_watermark]]] 31377 [Socket option for the receive low watermark. ] 31378 31379 ] 31380 31381 [ 31382 31383 [[link boost_asio.reference.basic_socket.reuse_address [*reuse_address]]] 31384 [Socket option to allow the socket to be bound to an address that is already in use. ] 31385 31386 ] 31387 31388 [ 31389 31390 [[link boost_asio.reference.basic_socket.send_buffer_size [*send_buffer_size]]] 31391 [Socket option for the send buffer size of a socket. ] 31392 31393 ] 31394 31395 [ 31396 31397 [[link boost_asio.reference.basic_socket.send_low_watermark [*send_low_watermark]]] 31398 [Socket option for the send low watermark. ] 31399 31400 ] 31401 31402 [ 31403 31404 [[link boost_asio.reference.basic_socket.shutdown_type [*shutdown_type]]] 31405 [Different ways a socket may be shutdown. ] 31406 31407 ] 31408 31409 [ 31410 31411 [[link boost_asio.reference.basic_socket.wait_type [*wait_type]]] 31412 [Wait types. ] 31413 31414 ] 31415 31416] 31417 31418[heading Member Functions] 31419[table 31420 [[Name][Description]] 31421 31422 [ 31423 [[link boost_asio.reference.basic_socket.assign [*assign]]] 31424 [Assign an existing native socket to the socket. ] 31425 ] 31426 31427 [ 31428 [[link boost_asio.reference.basic_socket.async_connect [*async_connect]]] 31429 [Start an asynchronous connect. ] 31430 ] 31431 31432 [ 31433 [[link boost_asio.reference.basic_socket.async_wait [*async_wait]]] 31434 [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 31435 ] 31436 31437 [ 31438 [[link boost_asio.reference.basic_socket.at_mark [*at_mark]]] 31439 [Determine whether the socket is at the out-of-band data mark. ] 31440 ] 31441 31442 [ 31443 [[link boost_asio.reference.basic_socket.available [*available]]] 31444 [Determine the number of bytes available for reading. ] 31445 ] 31446 31447 [ 31448 [[link boost_asio.reference.basic_socket.basic_socket [*basic_socket]] [constructor]] 31449 [Construct a basic_socket without opening it. 31450 [hr] 31451 Construct and open a basic_socket. 31452 [hr] 31453 Construct a basic_socket, opening it and binding it to the given local endpoint. 31454 [hr] 31455 Construct a basic_socket on an existing native socket. 31456 [hr] 31457 Move-construct a basic_socket from another. 31458 [hr] 31459 Move-construct a basic_socket from a socket of another protocol type. ] 31460 ] 31461 31462 [ 31463 [[link boost_asio.reference.basic_socket.bind [*bind]]] 31464 [Bind the socket to the given local endpoint. ] 31465 ] 31466 31467 [ 31468 [[link boost_asio.reference.basic_socket.cancel [*cancel]]] 31469 [Cancel all asynchronous operations associated with the socket. ] 31470 ] 31471 31472 [ 31473 [[link boost_asio.reference.basic_socket.close [*close]]] 31474 [Close the socket. ] 31475 ] 31476 31477 [ 31478 [[link boost_asio.reference.basic_socket.connect [*connect]]] 31479 [Connect the socket to the specified endpoint. ] 31480 ] 31481 31482 [ 31483 [[link boost_asio.reference.basic_socket.get_executor [*get_executor]]] 31484 [Get the executor associated with the object. ] 31485 ] 31486 31487 [ 31488 [[link boost_asio.reference.basic_socket.get_option [*get_option]]] 31489 [Get an option from the socket. ] 31490 ] 31491 31492 [ 31493 [[link boost_asio.reference.basic_socket.io_control [*io_control]]] 31494 [Perform an IO control command on the socket. ] 31495 ] 31496 31497 [ 31498 [[link boost_asio.reference.basic_socket.is_open [*is_open]]] 31499 [Determine whether the socket is open. ] 31500 ] 31501 31502 [ 31503 [[link boost_asio.reference.basic_socket.local_endpoint [*local_endpoint]]] 31504 [Get the local endpoint of the socket. ] 31505 ] 31506 31507 [ 31508 [[link boost_asio.reference.basic_socket.lowest_layer [*lowest_layer]]] 31509 [Get a reference to the lowest layer. 31510 [hr] 31511 Get a const reference to the lowest layer. ] 31512 ] 31513 31514 [ 31515 [[link boost_asio.reference.basic_socket.native_handle [*native_handle]]] 31516 [Get the native socket representation. ] 31517 ] 31518 31519 [ 31520 [[link boost_asio.reference.basic_socket.native_non_blocking [*native_non_blocking]]] 31521 [Gets the non-blocking mode of the native socket implementation. 31522 [hr] 31523 Sets the non-blocking mode of the native socket implementation. ] 31524 ] 31525 31526 [ 31527 [[link boost_asio.reference.basic_socket.non_blocking [*non_blocking]]] 31528 [Gets the non-blocking mode of the socket. 31529 [hr] 31530 Sets the non-blocking mode of the socket. ] 31531 ] 31532 31533 [ 31534 [[link boost_asio.reference.basic_socket.open [*open]]] 31535 [Open the socket using the specified protocol. ] 31536 ] 31537 31538 [ 31539 [[link boost_asio.reference.basic_socket.operator_eq_ [*operator=]]] 31540 [Move-assign a basic_socket from another. 31541 [hr] 31542 Move-assign a basic_socket from a socket of another protocol type. ] 31543 ] 31544 31545 [ 31546 [[link boost_asio.reference.basic_socket.release [*release]]] 31547 [Release ownership of the underlying native socket. ] 31548 ] 31549 31550 [ 31551 [[link boost_asio.reference.basic_socket.remote_endpoint [*remote_endpoint]]] 31552 [Get the remote endpoint of the socket. ] 31553 ] 31554 31555 [ 31556 [[link boost_asio.reference.basic_socket.set_option [*set_option]]] 31557 [Set an option on the socket. ] 31558 ] 31559 31560 [ 31561 [[link boost_asio.reference.basic_socket.shutdown [*shutdown]]] 31562 [Disable sends or receives on the socket. ] 31563 ] 31564 31565 [ 31566 [[link boost_asio.reference.basic_socket.wait [*wait]]] 31567 [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 31568 ] 31569 31570] 31571 31572[heading Protected Member Functions] 31573[table 31574 [[Name][Description]] 31575 31576 [ 31577 [[link boost_asio.reference.basic_socket._basic_socket [*~basic_socket]] [destructor]] 31578 [Protected destructor to prevent deletion through this type. ] 31579 ] 31580 31581] 31582 31583[heading Data Members] 31584[table 31585 [[Name][Description]] 31586 31587 [ 31588 [[link boost_asio.reference.basic_socket.max_connections [*max_connections]] [static]] 31589 [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ] 31590 ] 31591 31592 [ 31593 [[link boost_asio.reference.basic_socket.max_listen_connections [*max_listen_connections]] [static]] 31594 [The maximum length of the queue of pending incoming connections. ] 31595 ] 31596 31597 [ 31598 [[link boost_asio.reference.basic_socket.message_do_not_route [*message_do_not_route]] [static]] 31599 [Specify that the data should not be subject to routing. ] 31600 ] 31601 31602 [ 31603 [[link boost_asio.reference.basic_socket.message_end_of_record [*message_end_of_record]] [static]] 31604 [Specifies that the data marks the end of a record. ] 31605 ] 31606 31607 [ 31608 [[link boost_asio.reference.basic_socket.message_out_of_band [*message_out_of_band]] [static]] 31609 [Process out-of-band data. ] 31610 ] 31611 31612 [ 31613 [[link boost_asio.reference.basic_socket.message_peek [*message_peek]] [static]] 31614 [Peek at incoming data without removing it from the input queue. ] 31615 ] 31616 31617] 31618 31619The [link boost_asio.reference.basic_socket `basic_socket`] class template provides functionality that is common to both stream-oriented and datagram-oriented sockets. 31620 31621 31622[heading Thread Safety] 31623 31624['Distinct] ['objects:] Safe. 31625 31626['Shared] ['objects:] Unsafe. 31627 31628 31629 31630[heading Requirements] 31631 31632['Header: ][^boost/asio/basic_socket.hpp] 31633 31634['Convenience header: ][^boost/asio.hpp] 31635 31636[section:assign basic_socket::assign] 31637 31638[indexterm2 boost_asio.indexterm.basic_socket.assign..assign..basic_socket] 31639Assign an existing native socket to the socket. 31640 31641 31642 void ``[link boost_asio.reference.basic_socket.assign.overload1 assign]``( 31643 const protocol_type & protocol, 31644 const native_handle_type & native_socket); 31645 `` [''''»''' [link boost_asio.reference.basic_socket.assign.overload1 more...]]`` 31646 31647 void ``[link boost_asio.reference.basic_socket.assign.overload2 assign]``( 31648 const protocol_type & protocol, 31649 const native_handle_type & native_socket, 31650 boost::system::error_code & ec); 31651 `` [''''»''' [link boost_asio.reference.basic_socket.assign.overload2 more...]]`` 31652 31653 31654[section:overload1 basic_socket::assign (1 of 2 overloads)] 31655 31656 31657Assign an existing native socket to the socket. 31658 31659 31660 void assign( 31661 const protocol_type & protocol, 31662 const native_handle_type & native_socket); 31663 31664 31665 31666[endsect] 31667 31668 31669 31670[section:overload2 basic_socket::assign (2 of 2 overloads)] 31671 31672 31673Assign an existing native socket to the socket. 31674 31675 31676 void assign( 31677 const protocol_type & protocol, 31678 const native_handle_type & native_socket, 31679 boost::system::error_code & ec); 31680 31681 31682 31683[endsect] 31684 31685 31686[endsect] 31687 31688 31689[section:async_connect basic_socket::async_connect] 31690 31691[indexterm2 boost_asio.indexterm.basic_socket.async_connect..async_connect..basic_socket] 31692Start an asynchronous connect. 31693 31694 31695 template< 31696 typename ``[link boost_asio.reference.ConnectHandler ConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 31697 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect( 31698 const endpoint_type & peer_endpoint, 31699 ConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 31700 31701 31702This function is used to asynchronously connect a socket to the specified remote endpoint. The function call always returns immediately. 31703 31704The 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. 31705 31706 31707[heading Parameters] 31708 31709 31710[variablelist 31711 31712[[peer_endpoint][The remote endpoint to which the socket will be connected. Copies will be made of the endpoint object as required.]] 31713 31714[[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: 31715`` 31716 void handler( 31717 const boost::system::error_code& error // Result of operation 31718 ); 31719`` 31720Regardless 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`].]] 31721 31722] 31723 31724 31725[heading Example] 31726 31727 31728 31729 void connect_handler(const boost::system::error_code& error) 31730 { 31731 if (!error) 31732 { 31733 // Connect succeeded. 31734 } 31735 } 31736 31737 ... 31738 31739 boost::asio::ip::tcp::socket socket(my_context); 31740 boost::asio::ip::tcp::endpoint endpoint( 31741 boost::asio::ip::address::from_string("1.2.3.4"), 12345); 31742 socket.async_connect(endpoint, connect_handler); 31743 31744 31745 31746 31747 31748 31749 31750[endsect] 31751 31752 31753 31754[section:async_wait basic_socket::async_wait] 31755 31756[indexterm2 boost_asio.indexterm.basic_socket.async_wait..async_wait..basic_socket] 31757Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. 31758 31759 31760 template< 31761 typename ``[link boost_asio.reference.WaitHandler WaitHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 31762 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait( 31763 wait_type w, 31764 WaitHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 31765 31766 31767This function is used to perform an asynchronous wait for a socket to enter a ready to read, write or error condition state. 31768 31769 31770[heading Parameters] 31771 31772 31773[variablelist 31774 31775[[w][Specifies the desired socket state.]] 31776 31777[[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: 31778`` 31779 void handler( 31780 const boost::system::error_code& error // Result of operation 31781 ); 31782`` 31783Regardless 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`].]] 31784 31785] 31786 31787 31788[heading Example] 31789 31790 31791 31792 void wait_handler(const boost::system::error_code& error) 31793 { 31794 if (!error) 31795 { 31796 // Wait succeeded. 31797 } 31798 } 31799 31800 ... 31801 31802 boost::asio::ip::tcp::socket socket(my_context); 31803 ... 31804 socket.async_wait(boost::asio::ip::tcp::socket::wait_read, wait_handler); 31805 31806 31807 31808 31809 31810 31811 31812[endsect] 31813 31814 31815[section:at_mark basic_socket::at_mark] 31816 31817[indexterm2 boost_asio.indexterm.basic_socket.at_mark..at_mark..basic_socket] 31818Determine whether the socket is at the out-of-band data mark. 31819 31820 31821 bool ``[link boost_asio.reference.basic_socket.at_mark.overload1 at_mark]``() const; 31822 `` [''''»''' [link boost_asio.reference.basic_socket.at_mark.overload1 more...]]`` 31823 31824 bool ``[link boost_asio.reference.basic_socket.at_mark.overload2 at_mark]``( 31825 boost::system::error_code & ec) const; 31826 `` [''''»''' [link boost_asio.reference.basic_socket.at_mark.overload2 more...]]`` 31827 31828 31829[section:overload1 basic_socket::at_mark (1 of 2 overloads)] 31830 31831 31832Determine whether the socket is at the out-of-band data mark. 31833 31834 31835 bool at_mark() const; 31836 31837 31838This function is used to check whether the socket input is currently positioned at the out-of-band data mark. 31839 31840 31841[heading Return Value] 31842 31843A bool indicating whether the socket is at the out-of-band data mark. 31844 31845 31846[heading Exceptions] 31847 31848 31849[variablelist 31850 31851[[boost::system::system_error][Thrown on failure. ]] 31852 31853] 31854 31855 31856 31857 31858[endsect] 31859 31860 31861 31862[section:overload2 basic_socket::at_mark (2 of 2 overloads)] 31863 31864 31865Determine whether the socket is at the out-of-band data mark. 31866 31867 31868 bool at_mark( 31869 boost::system::error_code & ec) const; 31870 31871 31872This function is used to check whether the socket input is currently positioned at the out-of-band data mark. 31873 31874 31875[heading Parameters] 31876 31877 31878[variablelist 31879 31880[[ec][Set to indicate what error occurred, if any.]] 31881 31882] 31883 31884 31885[heading Return Value] 31886 31887A bool indicating whether the socket is at the out-of-band data mark. 31888 31889 31890 31891 31892[endsect] 31893 31894 31895[endsect] 31896 31897[section:available basic_socket::available] 31898 31899[indexterm2 boost_asio.indexterm.basic_socket.available..available..basic_socket] 31900Determine the number of bytes available for reading. 31901 31902 31903 std::size_t ``[link boost_asio.reference.basic_socket.available.overload1 available]``() const; 31904 `` [''''»''' [link boost_asio.reference.basic_socket.available.overload1 more...]]`` 31905 31906 std::size_t ``[link boost_asio.reference.basic_socket.available.overload2 available]``( 31907 boost::system::error_code & ec) const; 31908 `` [''''»''' [link boost_asio.reference.basic_socket.available.overload2 more...]]`` 31909 31910 31911[section:overload1 basic_socket::available (1 of 2 overloads)] 31912 31913 31914Determine the number of bytes available for reading. 31915 31916 31917 std::size_t available() const; 31918 31919 31920This function is used to determine the number of bytes that may be read without blocking. 31921 31922 31923[heading Return Value] 31924 31925The number of bytes that may be read without blocking, or 0 if an error occurs. 31926 31927 31928[heading Exceptions] 31929 31930 31931[variablelist 31932 31933[[boost::system::system_error][Thrown on failure. ]] 31934 31935] 31936 31937 31938 31939 31940[endsect] 31941 31942 31943 31944[section:overload2 basic_socket::available (2 of 2 overloads)] 31945 31946 31947Determine the number of bytes available for reading. 31948 31949 31950 std::size_t available( 31951 boost::system::error_code & ec) const; 31952 31953 31954This function is used to determine the number of bytes that may be read without blocking. 31955 31956 31957[heading Parameters] 31958 31959 31960[variablelist 31961 31962[[ec][Set to indicate what error occurred, if any.]] 31963 31964] 31965 31966 31967[heading Return Value] 31968 31969The number of bytes that may be read without blocking, or 0 if an error occurs. 31970 31971 31972 31973 31974[endsect] 31975 31976 31977[endsect] 31978 31979[section:basic_socket basic_socket::basic_socket] 31980 31981[indexterm2 boost_asio.indexterm.basic_socket.basic_socket..basic_socket..basic_socket] 31982Construct a [link boost_asio.reference.basic_socket `basic_socket`] without opening it. 31983 31984 31985 explicit ``[link boost_asio.reference.basic_socket.basic_socket.overload1 basic_socket]``( 31986 const executor_type & ex); 31987 `` [''''»''' [link boost_asio.reference.basic_socket.basic_socket.overload1 more...]]`` 31988 31989 template< 31990 typename ExecutionContext> 31991 explicit ``[link boost_asio.reference.basic_socket.basic_socket.overload2 basic_socket]``( 31992 ExecutionContext & context, 31993 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 31994 `` [''''»''' [link boost_asio.reference.basic_socket.basic_socket.overload2 more...]]`` 31995 31996 31997Construct and open a [link boost_asio.reference.basic_socket `basic_socket`]. 31998 31999 32000 ``[link boost_asio.reference.basic_socket.basic_socket.overload3 basic_socket]``( 32001 const executor_type & ex, 32002 const protocol_type & protocol); 32003 `` [''''»''' [link boost_asio.reference.basic_socket.basic_socket.overload3 more...]]`` 32004 32005 template< 32006 typename ExecutionContext> 32007 ``[link boost_asio.reference.basic_socket.basic_socket.overload4 basic_socket]``( 32008 ExecutionContext & context, 32009 const protocol_type & protocol, 32010 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value, defaulted_constraint >::type = defaulted_constraint()); 32011 `` [''''»''' [link boost_asio.reference.basic_socket.basic_socket.overload4 more...]]`` 32012 32013 32014Construct a [link boost_asio.reference.basic_socket `basic_socket`], opening it and binding it to the given local endpoint. 32015 32016 32017 ``[link boost_asio.reference.basic_socket.basic_socket.overload5 basic_socket]``( 32018 const executor_type & ex, 32019 const endpoint_type & endpoint); 32020 `` [''''»''' [link boost_asio.reference.basic_socket.basic_socket.overload5 more...]]`` 32021 32022 template< 32023 typename ExecutionContext> 32024 ``[link boost_asio.reference.basic_socket.basic_socket.overload6 basic_socket]``( 32025 ExecutionContext & context, 32026 const endpoint_type & endpoint, 32027 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 32028 `` [''''»''' [link boost_asio.reference.basic_socket.basic_socket.overload6 more...]]`` 32029 32030 32031Construct a [link boost_asio.reference.basic_socket `basic_socket`] on an existing native socket. 32032 32033 32034 ``[link boost_asio.reference.basic_socket.basic_socket.overload7 basic_socket]``( 32035 const executor_type & ex, 32036 const protocol_type & protocol, 32037 const native_handle_type & native_socket); 32038 `` [''''»''' [link boost_asio.reference.basic_socket.basic_socket.overload7 more...]]`` 32039 32040 template< 32041 typename ExecutionContext> 32042 ``[link boost_asio.reference.basic_socket.basic_socket.overload8 basic_socket]``( 32043 ExecutionContext & context, 32044 const protocol_type & protocol, 32045 const native_handle_type & native_socket, 32046 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 32047 `` [''''»''' [link boost_asio.reference.basic_socket.basic_socket.overload8 more...]]`` 32048 32049 32050Move-construct a [link boost_asio.reference.basic_socket `basic_socket`] from another. 32051 32052 32053 ``[link boost_asio.reference.basic_socket.basic_socket.overload9 basic_socket]``( 32054 basic_socket && other); 32055 `` [''''»''' [link boost_asio.reference.basic_socket.basic_socket.overload9 more...]]`` 32056 32057 32058Move-construct a [link boost_asio.reference.basic_socket `basic_socket`] from a socket of another protocol type. 32059 32060 32061 template< 32062 typename ``[link boost_asio.reference.Protocol Protocol1]``, 32063 typename ``[link boost_asio.reference.Executor1 Executor1]``> 32064 ``[link boost_asio.reference.basic_socket.basic_socket.overload10 basic_socket]``( 32065 basic_socket< Protocol1, Executor1 > && other, 32066 typename constraint< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type = 0); 32067 `` [''''»''' [link boost_asio.reference.basic_socket.basic_socket.overload10 more...]]`` 32068 32069 32070[section:overload1 basic_socket::basic_socket (1 of 10 overloads)] 32071 32072 32073Construct a [link boost_asio.reference.basic_socket `basic_socket`] without opening it. 32074 32075 32076 basic_socket( 32077 const executor_type & ex); 32078 32079 32080This constructor creates a socket without opening it. 32081 32082 32083[heading Parameters] 32084 32085 32086[variablelist 32087 32088[[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket. ]] 32089 32090] 32091 32092 32093 32094 32095[endsect] 32096 32097 32098 32099[section:overload2 basic_socket::basic_socket (2 of 10 overloads)] 32100 32101 32102Construct a [link boost_asio.reference.basic_socket `basic_socket`] without opening it. 32103 32104 32105 template< 32106 typename ExecutionContext> 32107 basic_socket( 32108 ExecutionContext & context, 32109 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 32110 32111 32112This constructor creates a socket without opening it. 32113 32114 32115[heading Parameters] 32116 32117 32118[variablelist 32119 32120[[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. ]] 32121 32122] 32123 32124 32125 32126 32127[endsect] 32128 32129 32130 32131[section:overload3 basic_socket::basic_socket (3 of 10 overloads)] 32132 32133 32134Construct and open a [link boost_asio.reference.basic_socket `basic_socket`]. 32135 32136 32137 basic_socket( 32138 const executor_type & ex, 32139 const protocol_type & protocol); 32140 32141 32142This constructor creates and opens a socket. 32143 32144 32145[heading Parameters] 32146 32147 32148[variablelist 32149 32150[[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]] 32151 32152[[protocol][An object specifying protocol parameters to be used.]] 32153 32154] 32155 32156 32157[heading Exceptions] 32158 32159 32160[variablelist 32161 32162[[boost::system::system_error][Thrown on failure. ]] 32163 32164] 32165 32166 32167 32168 32169[endsect] 32170 32171 32172 32173[section:overload4 basic_socket::basic_socket (4 of 10 overloads)] 32174 32175 32176Construct and open a [link boost_asio.reference.basic_socket `basic_socket`]. 32177 32178 32179 template< 32180 typename ExecutionContext> 32181 basic_socket( 32182 ExecutionContext & context, 32183 const protocol_type & protocol, 32184 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value, defaulted_constraint >::type = defaulted_constraint()); 32185 32186 32187This constructor creates and opens a socket. 32188 32189 32190[heading Parameters] 32191 32192 32193[variablelist 32194 32195[[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.]] 32196 32197[[protocol][An object specifying protocol parameters to be used.]] 32198 32199] 32200 32201 32202[heading Exceptions] 32203 32204 32205[variablelist 32206 32207[[boost::system::system_error][Thrown on failure. ]] 32208 32209] 32210 32211 32212 32213 32214[endsect] 32215 32216 32217 32218[section:overload5 basic_socket::basic_socket (5 of 10 overloads)] 32219 32220 32221Construct a [link boost_asio.reference.basic_socket `basic_socket`], opening it and binding it to the given local endpoint. 32222 32223 32224 basic_socket( 32225 const executor_type & ex, 32226 const endpoint_type & endpoint); 32227 32228 32229This 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. 32230 32231 32232[heading Parameters] 32233 32234 32235[variablelist 32236 32237[[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]] 32238 32239[[endpoint][An endpoint on the local machine to which the socket will be bound.]] 32240 32241] 32242 32243 32244[heading Exceptions] 32245 32246 32247[variablelist 32248 32249[[boost::system::system_error][Thrown on failure. ]] 32250 32251] 32252 32253 32254 32255 32256[endsect] 32257 32258 32259 32260[section:overload6 basic_socket::basic_socket (6 of 10 overloads)] 32261 32262 32263Construct a [link boost_asio.reference.basic_socket `basic_socket`], opening it and binding it to the given local endpoint. 32264 32265 32266 template< 32267 typename ExecutionContext> 32268 basic_socket( 32269 ExecutionContext & context, 32270 const endpoint_type & endpoint, 32271 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 32272 32273 32274This 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. 32275 32276 32277[heading Parameters] 32278 32279 32280[variablelist 32281 32282[[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.]] 32283 32284[[endpoint][An endpoint on the local machine to which the socket will be bound.]] 32285 32286] 32287 32288 32289[heading Exceptions] 32290 32291 32292[variablelist 32293 32294[[boost::system::system_error][Thrown on failure. ]] 32295 32296] 32297 32298 32299 32300 32301[endsect] 32302 32303 32304 32305[section:overload7 basic_socket::basic_socket (7 of 10 overloads)] 32306 32307 32308Construct a [link boost_asio.reference.basic_socket `basic_socket`] on an existing native socket. 32309 32310 32311 basic_socket( 32312 const executor_type & ex, 32313 const protocol_type & protocol, 32314 const native_handle_type & native_socket); 32315 32316 32317This constructor creates a socket object to hold an existing native socket. 32318 32319 32320[heading Parameters] 32321 32322 32323[variablelist 32324 32325[[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]] 32326 32327[[protocol][An object specifying protocol parameters to be used.]] 32328 32329[[native_socket][A native socket.]] 32330 32331] 32332 32333 32334[heading Exceptions] 32335 32336 32337[variablelist 32338 32339[[boost::system::system_error][Thrown on failure. ]] 32340 32341] 32342 32343 32344 32345 32346[endsect] 32347 32348 32349 32350[section:overload8 basic_socket::basic_socket (8 of 10 overloads)] 32351 32352 32353Construct a [link boost_asio.reference.basic_socket `basic_socket`] on an existing native socket. 32354 32355 32356 template< 32357 typename ExecutionContext> 32358 basic_socket( 32359 ExecutionContext & context, 32360 const protocol_type & protocol, 32361 const native_handle_type & native_socket, 32362 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 32363 32364 32365This constructor creates a socket object to hold an existing native socket. 32366 32367 32368[heading Parameters] 32369 32370 32371[variablelist 32372 32373[[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.]] 32374 32375[[protocol][An object specifying protocol parameters to be used.]] 32376 32377[[native_socket][A native socket.]] 32378 32379] 32380 32381 32382[heading Exceptions] 32383 32384 32385[variablelist 32386 32387[[boost::system::system_error][Thrown on failure. ]] 32388 32389] 32390 32391 32392 32393 32394[endsect] 32395 32396 32397 32398[section:overload9 basic_socket::basic_socket (9 of 10 overloads)] 32399 32400 32401Move-construct a [link boost_asio.reference.basic_socket `basic_socket`] from another. 32402 32403 32404 basic_socket( 32405 basic_socket && other); 32406 32407 32408This constructor moves a socket from one object to another. 32409 32410 32411[heading Parameters] 32412 32413 32414[variablelist 32415 32416[[other][The other [link boost_asio.reference.basic_socket `basic_socket`] object from which the move will occur.]] 32417 32418] 32419 32420 32421[heading Remarks] 32422 32423Following the move, the moved-from object is in the same state as if constructed using the `basic_socket(const executor_type&) constructor`. 32424 32425 32426 32427 32428[endsect] 32429 32430 32431 32432[section:overload10 basic_socket::basic_socket (10 of 10 overloads)] 32433 32434 32435Move-construct a [link boost_asio.reference.basic_socket `basic_socket`] from a socket of another protocol type. 32436 32437 32438 template< 32439 typename ``[link boost_asio.reference.Protocol Protocol1]``, 32440 typename ``[link boost_asio.reference.Executor1 Executor1]``> 32441 basic_socket( 32442 basic_socket< Protocol1, Executor1 > && other, 32443 typename constraint< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type = 0); 32444 32445 32446This constructor moves a socket from one object to another. 32447 32448 32449[heading Parameters] 32450 32451 32452[variablelist 32453 32454[[other][The other [link boost_asio.reference.basic_socket `basic_socket`] object from which the move will occur.]] 32455 32456] 32457 32458 32459[heading Remarks] 32460 32461Following the move, the moved-from object is in the same state as if constructed using the `basic_socket(const executor_type&) constructor`. 32462 32463 32464 32465 32466[endsect] 32467 32468 32469[endsect] 32470 32471[section:bind basic_socket::bind] 32472 32473[indexterm2 boost_asio.indexterm.basic_socket.bind..bind..basic_socket] 32474Bind the socket to the given local endpoint. 32475 32476 32477 void ``[link boost_asio.reference.basic_socket.bind.overload1 bind]``( 32478 const endpoint_type & endpoint); 32479 `` [''''»''' [link boost_asio.reference.basic_socket.bind.overload1 more...]]`` 32480 32481 void ``[link boost_asio.reference.basic_socket.bind.overload2 bind]``( 32482 const endpoint_type & endpoint, 32483 boost::system::error_code & ec); 32484 `` [''''»''' [link boost_asio.reference.basic_socket.bind.overload2 more...]]`` 32485 32486 32487[section:overload1 basic_socket::bind (1 of 2 overloads)] 32488 32489 32490Bind the socket to the given local endpoint. 32491 32492 32493 void bind( 32494 const endpoint_type & endpoint); 32495 32496 32497This function binds the socket to the specified endpoint on the local machine. 32498 32499 32500[heading Parameters] 32501 32502 32503[variablelist 32504 32505[[endpoint][An endpoint on the local machine to which the socket will be bound.]] 32506 32507] 32508 32509 32510[heading Exceptions] 32511 32512 32513[variablelist 32514 32515[[boost::system::system_error][Thrown on failure.]] 32516 32517] 32518 32519 32520[heading Example] 32521 32522 32523 32524 boost::asio::ip::tcp::socket socket(my_context); 32525 socket.open(boost::asio::ip::tcp::v4()); 32526 socket.bind(boost::asio::ip::tcp::endpoint( 32527 boost::asio::ip::tcp::v4(), 12345)); 32528 32529 32530 32531 32532 32533 32534 32535[endsect] 32536 32537 32538 32539[section:overload2 basic_socket::bind (2 of 2 overloads)] 32540 32541 32542Bind the socket to the given local endpoint. 32543 32544 32545 void bind( 32546 const endpoint_type & endpoint, 32547 boost::system::error_code & ec); 32548 32549 32550This function binds the socket to the specified endpoint on the local machine. 32551 32552 32553[heading Parameters] 32554 32555 32556[variablelist 32557 32558[[endpoint][An endpoint on the local machine to which the socket will be bound.]] 32559 32560[[ec][Set to indicate what error occurred, if any.]] 32561 32562] 32563 32564 32565[heading Example] 32566 32567 32568 32569 boost::asio::ip::tcp::socket socket(my_context); 32570 socket.open(boost::asio::ip::tcp::v4()); 32571 boost::system::error_code ec; 32572 socket.bind(boost::asio::ip::tcp::endpoint( 32573 boost::asio::ip::tcp::v4(), 12345), ec); 32574 if (ec) 32575 { 32576 // An error occurred. 32577 } 32578 32579 32580 32581 32582 32583 32584 32585[endsect] 32586 32587 32588[endsect] 32589 32590 32591[section:broadcast basic_socket::broadcast] 32592 32593 32594['Inherited from socket_base.] 32595 32596[indexterm2 boost_asio.indexterm.basic_socket.broadcast..broadcast..basic_socket] 32597Socket option to permit sending of broadcast messages. 32598 32599 32600 typedef implementation_defined broadcast; 32601 32602 32603 32604Implements the SOL\_SOCKET/SO\_BROADCAST socket option. 32605 32606 32607[heading Examples] 32608 32609Setting the option: 32610 32611 boost::asio::ip::udp::socket socket(my_context); 32612 ... 32613 boost::asio::socket_base::broadcast option(true); 32614 socket.set_option(option); 32615 32616 32617 32618 32619 32620Getting the current option value: 32621 32622 boost::asio::ip::udp::socket socket(my_context); 32623 ... 32624 boost::asio::socket_base::broadcast option; 32625 socket.get_option(option); 32626 bool is_set = option.value(); 32627 32628 32629 32630 32631 32632 32633 32634[heading Requirements] 32635 32636['Header: ][^boost/asio/basic_socket.hpp] 32637 32638['Convenience header: ][^boost/asio.hpp] 32639 32640 32641[endsect] 32642 32643 32644 32645[section:bytes_readable basic_socket::bytes_readable] 32646 32647 32648['Inherited from socket_base.] 32649 32650[indexterm2 boost_asio.indexterm.basic_socket.bytes_readable..bytes_readable..basic_socket] 32651IO control command to get the amount of data that can be read without blocking. 32652 32653 32654 typedef implementation_defined bytes_readable; 32655 32656 32657 32658Implements the FIONREAD IO control command. 32659 32660 32661[heading Example] 32662 32663 32664 32665 boost::asio::ip::tcp::socket socket(my_context); 32666 ... 32667 boost::asio::socket_base::bytes_readable command(true); 32668 socket.io_control(command); 32669 std::size_t bytes_readable = command.get(); 32670 32671 32672 32673 32674 32675 32676 32677[heading Requirements] 32678 32679['Header: ][^boost/asio/basic_socket.hpp] 32680 32681['Convenience header: ][^boost/asio.hpp] 32682 32683 32684[endsect] 32685 32686 32687[section:cancel basic_socket::cancel] 32688 32689[indexterm2 boost_asio.indexterm.basic_socket.cancel..cancel..basic_socket] 32690Cancel all asynchronous operations associated with the socket. 32691 32692 32693 void ``[link boost_asio.reference.basic_socket.cancel.overload1 cancel]``(); 32694 `` [''''»''' [link boost_asio.reference.basic_socket.cancel.overload1 more...]]`` 32695 32696 void ``[link boost_asio.reference.basic_socket.cancel.overload2 cancel]``( 32697 boost::system::error_code & ec); 32698 `` [''''»''' [link boost_asio.reference.basic_socket.cancel.overload2 more...]]`` 32699 32700 32701[section:overload1 basic_socket::cancel (1 of 2 overloads)] 32702 32703 32704Cancel all asynchronous operations associated with the socket. 32705 32706 32707 void cancel(); 32708 32709 32710This 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. 32711 32712 32713[heading Exceptions] 32714 32715 32716[variablelist 32717 32718[[boost::system::system_error][Thrown on failure.]] 32719 32720] 32721 32722 32723[heading Remarks] 32724 32725Calls 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: 32726 32727 32728* It will only cancel asynchronous operations that were initiated in the current thread. 32729 32730 32731* 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. 32732 32733For portable cancellation, consider using one of the following alternatives: 32734 32735 32736* Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP. 32737 32738 32739* Use the `close()` function to simultaneously cancel the outstanding operations and close the socket. 32740 32741When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above. 32742 32743 32744[endsect] 32745 32746 32747 32748[section:overload2 basic_socket::cancel (2 of 2 overloads)] 32749 32750 32751Cancel all asynchronous operations associated with the socket. 32752 32753 32754 void cancel( 32755 boost::system::error_code & ec); 32756 32757 32758This 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. 32759 32760 32761[heading Parameters] 32762 32763 32764[variablelist 32765 32766[[ec][Set to indicate what error occurred, if any.]] 32767 32768] 32769 32770 32771[heading Remarks] 32772 32773Calls 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: 32774 32775 32776* It will only cancel asynchronous operations that were initiated in the current thread. 32777 32778 32779* 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. 32780 32781For portable cancellation, consider using one of the following alternatives: 32782 32783 32784* Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP. 32785 32786 32787* Use the `close()` function to simultaneously cancel the outstanding operations and close the socket. 32788 32789When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above. 32790 32791 32792[endsect] 32793 32794 32795[endsect] 32796 32797[section:close basic_socket::close] 32798 32799[indexterm2 boost_asio.indexterm.basic_socket.close..close..basic_socket] 32800Close the socket. 32801 32802 32803 void ``[link boost_asio.reference.basic_socket.close.overload1 close]``(); 32804 `` [''''»''' [link boost_asio.reference.basic_socket.close.overload1 more...]]`` 32805 32806 void ``[link boost_asio.reference.basic_socket.close.overload2 close]``( 32807 boost::system::error_code & ec); 32808 `` [''''»''' [link boost_asio.reference.basic_socket.close.overload2 more...]]`` 32809 32810 32811[section:overload1 basic_socket::close (1 of 2 overloads)] 32812 32813 32814Close the socket. 32815 32816 32817 void close(); 32818 32819 32820This 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. 32821 32822 32823[heading Exceptions] 32824 32825 32826[variablelist 32827 32828[[boost::system::system_error][Thrown on failure. Note that, even if the function indicates an error, the underlying descriptor is closed.]] 32829 32830] 32831 32832 32833[heading Remarks] 32834 32835For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket. 32836 32837 32838 32839 32840[endsect] 32841 32842 32843 32844[section:overload2 basic_socket::close (2 of 2 overloads)] 32845 32846 32847Close the socket. 32848 32849 32850 void close( 32851 boost::system::error_code & ec); 32852 32853 32854This 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. 32855 32856 32857[heading Parameters] 32858 32859 32860[variablelist 32861 32862[[ec][Set to indicate what error occurred, if any. Note that, even if the function indicates an error, the underlying descriptor is closed.]] 32863 32864] 32865 32866 32867[heading Example] 32868 32869 32870 32871 boost::asio::ip::tcp::socket socket(my_context); 32872 ... 32873 boost::system::error_code ec; 32874 socket.close(ec); 32875 if (ec) 32876 { 32877 // An error occurred. 32878 } 32879 32880 32881 32882 32883 32884[heading Remarks] 32885 32886For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket. 32887 32888 32889 32890 32891[endsect] 32892 32893 32894[endsect] 32895 32896[section:connect basic_socket::connect] 32897 32898[indexterm2 boost_asio.indexterm.basic_socket.connect..connect..basic_socket] 32899Connect the socket to the specified endpoint. 32900 32901 32902 void ``[link boost_asio.reference.basic_socket.connect.overload1 connect]``( 32903 const endpoint_type & peer_endpoint); 32904 `` [''''»''' [link boost_asio.reference.basic_socket.connect.overload1 more...]]`` 32905 32906 void ``[link boost_asio.reference.basic_socket.connect.overload2 connect]``( 32907 const endpoint_type & peer_endpoint, 32908 boost::system::error_code & ec); 32909 `` [''''»''' [link boost_asio.reference.basic_socket.connect.overload2 more...]]`` 32910 32911 32912[section:overload1 basic_socket::connect (1 of 2 overloads)] 32913 32914 32915Connect the socket to the specified endpoint. 32916 32917 32918 void connect( 32919 const endpoint_type & peer_endpoint); 32920 32921 32922This 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. 32923 32924The 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. 32925 32926 32927[heading Parameters] 32928 32929 32930[variablelist 32931 32932[[peer_endpoint][The remote endpoint to which the socket will be connected.]] 32933 32934] 32935 32936 32937[heading Exceptions] 32938 32939 32940[variablelist 32941 32942[[boost::system::system_error][Thrown on failure.]] 32943 32944] 32945 32946 32947[heading Example] 32948 32949 32950 32951 boost::asio::ip::tcp::socket socket(my_context); 32952 boost::asio::ip::tcp::endpoint endpoint( 32953 boost::asio::ip::address::from_string("1.2.3.4"), 12345); 32954 socket.connect(endpoint); 32955 32956 32957 32958 32959 32960 32961 32962[endsect] 32963 32964 32965 32966[section:overload2 basic_socket::connect (2 of 2 overloads)] 32967 32968 32969Connect the socket to the specified endpoint. 32970 32971 32972 void connect( 32973 const endpoint_type & peer_endpoint, 32974 boost::system::error_code & ec); 32975 32976 32977This 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. 32978 32979The 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. 32980 32981 32982[heading Parameters] 32983 32984 32985[variablelist 32986 32987[[peer_endpoint][The remote endpoint to which the socket will be connected.]] 32988 32989[[ec][Set to indicate what error occurred, if any.]] 32990 32991] 32992 32993 32994[heading Example] 32995 32996 32997 32998 boost::asio::ip::tcp::socket socket(my_context); 32999 boost::asio::ip::tcp::endpoint endpoint( 33000 boost::asio::ip::address::from_string("1.2.3.4"), 12345); 33001 boost::system::error_code ec; 33002 socket.connect(endpoint, ec); 33003 if (ec) 33004 { 33005 // An error occurred. 33006 } 33007 33008 33009 33010 33011 33012 33013 33014[endsect] 33015 33016 33017[endsect] 33018 33019 33020[section:debug basic_socket::debug] 33021 33022 33023['Inherited from socket_base.] 33024 33025[indexterm2 boost_asio.indexterm.basic_socket.debug..debug..basic_socket] 33026Socket option to enable socket-level debugging. 33027 33028 33029 typedef implementation_defined debug; 33030 33031 33032 33033Implements the SOL\_SOCKET/SO\_DEBUG socket option. 33034 33035 33036[heading Examples] 33037 33038Setting the option: 33039 33040 boost::asio::ip::tcp::socket socket(my_context); 33041 ... 33042 boost::asio::socket_base::debug option(true); 33043 socket.set_option(option); 33044 33045 33046 33047 33048 33049Getting the current option value: 33050 33051 boost::asio::ip::tcp::socket socket(my_context); 33052 ... 33053 boost::asio::socket_base::debug option; 33054 socket.get_option(option); 33055 bool is_set = option.value(); 33056 33057 33058 33059 33060 33061 33062 33063[heading Requirements] 33064 33065['Header: ][^boost/asio/basic_socket.hpp] 33066 33067['Convenience header: ][^boost/asio.hpp] 33068 33069 33070[endsect] 33071 33072 33073 33074[section:do_not_route basic_socket::do_not_route] 33075 33076 33077['Inherited from socket_base.] 33078 33079[indexterm2 boost_asio.indexterm.basic_socket.do_not_route..do_not_route..basic_socket] 33080Socket option to prevent routing, use local interfaces only. 33081 33082 33083 typedef implementation_defined do_not_route; 33084 33085 33086 33087Implements the SOL\_SOCKET/SO\_DONTROUTE socket option. 33088 33089 33090[heading Examples] 33091 33092Setting the option: 33093 33094 boost::asio::ip::udp::socket socket(my_context); 33095 ... 33096 boost::asio::socket_base::do_not_route option(true); 33097 socket.set_option(option); 33098 33099 33100 33101 33102 33103Getting the current option value: 33104 33105 boost::asio::ip::udp::socket socket(my_context); 33106 ... 33107 boost::asio::socket_base::do_not_route option; 33108 socket.get_option(option); 33109 bool is_set = option.value(); 33110 33111 33112 33113 33114 33115 33116 33117[heading Requirements] 33118 33119['Header: ][^boost/asio/basic_socket.hpp] 33120 33121['Convenience header: ][^boost/asio.hpp] 33122 33123 33124[endsect] 33125 33126 33127 33128[section:enable_connection_aborted basic_socket::enable_connection_aborted] 33129 33130 33131['Inherited from socket_base.] 33132 33133[indexterm2 boost_asio.indexterm.basic_socket.enable_connection_aborted..enable_connection_aborted..basic_socket] 33134Socket option to report aborted connections on accept. 33135 33136 33137 typedef implementation_defined enable_connection_aborted; 33138 33139 33140 33141Implements 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. 33142 33143 33144[heading Examples] 33145 33146Setting the option: 33147 33148 boost::asio::ip::tcp::acceptor acceptor(my_context); 33149 ... 33150 boost::asio::socket_base::enable_connection_aborted option(true); 33151 acceptor.set_option(option); 33152 33153 33154 33155 33156 33157Getting the current option value: 33158 33159 boost::asio::ip::tcp::acceptor acceptor(my_context); 33160 ... 33161 boost::asio::socket_base::enable_connection_aborted option; 33162 acceptor.get_option(option); 33163 bool is_set = option.value(); 33164 33165 33166 33167 33168 33169 33170 33171[heading Requirements] 33172 33173['Header: ][^boost/asio/basic_socket.hpp] 33174 33175['Convenience header: ][^boost/asio.hpp] 33176 33177 33178[endsect] 33179 33180 33181 33182[section:endpoint_type basic_socket::endpoint_type] 33183 33184[indexterm2 boost_asio.indexterm.basic_socket.endpoint_type..endpoint_type..basic_socket] 33185The endpoint type. 33186 33187 33188 typedef Protocol::endpoint endpoint_type; 33189 33190 33191 33192[heading Requirements] 33193 33194['Header: ][^boost/asio/basic_socket.hpp] 33195 33196['Convenience header: ][^boost/asio.hpp] 33197 33198 33199[endsect] 33200 33201 33202 33203[section:executor_type basic_socket::executor_type] 33204 33205[indexterm2 boost_asio.indexterm.basic_socket.executor_type..executor_type..basic_socket] 33206The type of the executor associated with the object. 33207 33208 33209 typedef Executor executor_type; 33210 33211 33212 33213[heading Requirements] 33214 33215['Header: ][^boost/asio/basic_socket.hpp] 33216 33217['Convenience header: ][^boost/asio.hpp] 33218 33219 33220[endsect] 33221 33222 33223 33224[section:get_executor basic_socket::get_executor] 33225 33226[indexterm2 boost_asio.indexterm.basic_socket.get_executor..get_executor..basic_socket] 33227Get the executor associated with the object. 33228 33229 33230 executor_type get_executor(); 33231 33232 33233 33234[endsect] 33235 33236 33237[section:get_option basic_socket::get_option] 33238 33239[indexterm2 boost_asio.indexterm.basic_socket.get_option..get_option..basic_socket] 33240Get an option from the socket. 33241 33242 33243 template< 33244 typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``> 33245 void ``[link boost_asio.reference.basic_socket.get_option.overload1 get_option]``( 33246 GettableSocketOption & option) const; 33247 `` [''''»''' [link boost_asio.reference.basic_socket.get_option.overload1 more...]]`` 33248 33249 template< 33250 typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``> 33251 void ``[link boost_asio.reference.basic_socket.get_option.overload2 get_option]``( 33252 GettableSocketOption & option, 33253 boost::system::error_code & ec) const; 33254 `` [''''»''' [link boost_asio.reference.basic_socket.get_option.overload2 more...]]`` 33255 33256 33257[section:overload1 basic_socket::get_option (1 of 2 overloads)] 33258 33259 33260Get an option from the socket. 33261 33262 33263 template< 33264 typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``> 33265 void get_option( 33266 GettableSocketOption & option) const; 33267 33268 33269This function is used to get the current value of an option on the socket. 33270 33271 33272[heading Parameters] 33273 33274 33275[variablelist 33276 33277[[option][The option value to be obtained from the socket.]] 33278 33279] 33280 33281 33282[heading Exceptions] 33283 33284 33285[variablelist 33286 33287[[boost::system::system_error][Thrown on failure.]] 33288 33289] 33290 33291 33292 33293[heading Example] 33294 33295Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option: 33296 33297 boost::asio::ip::tcp::socket socket(my_context); 33298 ... 33299 boost::asio::ip::tcp::socket::keep_alive option; 33300 socket.get_option(option); 33301 bool is_set = option.value(); 33302 33303 33304 33305 33306 33307 33308 33309[endsect] 33310 33311 33312 33313[section:overload2 basic_socket::get_option (2 of 2 overloads)] 33314 33315 33316Get an option from the socket. 33317 33318 33319 template< 33320 typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``> 33321 void get_option( 33322 GettableSocketOption & option, 33323 boost::system::error_code & ec) const; 33324 33325 33326This function is used to get the current value of an option on the socket. 33327 33328 33329[heading Parameters] 33330 33331 33332[variablelist 33333 33334[[option][The option value to be obtained from the socket.]] 33335 33336[[ec][Set to indicate what error occurred, if any.]] 33337 33338] 33339 33340 33341 33342[heading Example] 33343 33344Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option: 33345 33346 boost::asio::ip::tcp::socket socket(my_context); 33347 ... 33348 boost::asio::ip::tcp::socket::keep_alive option; 33349 boost::system::error_code ec; 33350 socket.get_option(option, ec); 33351 if (ec) 33352 { 33353 // An error occurred. 33354 } 33355 bool is_set = option.value(); 33356 33357 33358 33359 33360 33361 33362 33363[endsect] 33364 33365 33366[endsect] 33367 33368[section:io_control basic_socket::io_control] 33369 33370[indexterm2 boost_asio.indexterm.basic_socket.io_control..io_control..basic_socket] 33371Perform an IO control command on the socket. 33372 33373 33374 template< 33375 typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> 33376 void ``[link boost_asio.reference.basic_socket.io_control.overload1 io_control]``( 33377 IoControlCommand & command); 33378 `` [''''»''' [link boost_asio.reference.basic_socket.io_control.overload1 more...]]`` 33379 33380 template< 33381 typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> 33382 void ``[link boost_asio.reference.basic_socket.io_control.overload2 io_control]``( 33383 IoControlCommand & command, 33384 boost::system::error_code & ec); 33385 `` [''''»''' [link boost_asio.reference.basic_socket.io_control.overload2 more...]]`` 33386 33387 33388[section:overload1 basic_socket::io_control (1 of 2 overloads)] 33389 33390 33391Perform an IO control command on the socket. 33392 33393 33394 template< 33395 typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> 33396 void io_control( 33397 IoControlCommand & command); 33398 33399 33400This function is used to execute an IO control command on the socket. 33401 33402 33403[heading Parameters] 33404 33405 33406[variablelist 33407 33408[[command][The IO control command to be performed on the socket.]] 33409 33410] 33411 33412 33413[heading Exceptions] 33414 33415 33416[variablelist 33417 33418[[boost::system::system_error][Thrown on failure.]] 33419 33420] 33421 33422 33423 33424[heading Example] 33425 33426Getting the number of bytes ready to read: 33427 33428 boost::asio::ip::tcp::socket socket(my_context); 33429 ... 33430 boost::asio::ip::tcp::socket::bytes_readable command; 33431 socket.io_control(command); 33432 std::size_t bytes_readable = command.get(); 33433 33434 33435 33436 33437 33438 33439 33440[endsect] 33441 33442 33443 33444[section:overload2 basic_socket::io_control (2 of 2 overloads)] 33445 33446 33447Perform an IO control command on the socket. 33448 33449 33450 template< 33451 typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> 33452 void io_control( 33453 IoControlCommand & command, 33454 boost::system::error_code & ec); 33455 33456 33457This function is used to execute an IO control command on the socket. 33458 33459 33460[heading Parameters] 33461 33462 33463[variablelist 33464 33465[[command][The IO control command to be performed on the socket.]] 33466 33467[[ec][Set to indicate what error occurred, if any.]] 33468 33469] 33470 33471 33472 33473[heading Example] 33474 33475Getting the number of bytes ready to read: 33476 33477 boost::asio::ip::tcp::socket socket(my_context); 33478 ... 33479 boost::asio::ip::tcp::socket::bytes_readable command; 33480 boost::system::error_code ec; 33481 socket.io_control(command, ec); 33482 if (ec) 33483 { 33484 // An error occurred. 33485 } 33486 std::size_t bytes_readable = command.get(); 33487 33488 33489 33490 33491 33492 33493 33494[endsect] 33495 33496 33497[endsect] 33498 33499 33500[section:is_open basic_socket::is_open] 33501 33502[indexterm2 boost_asio.indexterm.basic_socket.is_open..is_open..basic_socket] 33503Determine whether the socket is open. 33504 33505 33506 bool is_open() const; 33507 33508 33509 33510[endsect] 33511 33512 33513 33514[section:keep_alive basic_socket::keep_alive] 33515 33516 33517['Inherited from socket_base.] 33518 33519[indexterm2 boost_asio.indexterm.basic_socket.keep_alive..keep_alive..basic_socket] 33520Socket option to send keep-alives. 33521 33522 33523 typedef implementation_defined keep_alive; 33524 33525 33526 33527Implements the SOL\_SOCKET/SO\_KEEPALIVE socket option. 33528 33529 33530[heading Examples] 33531 33532Setting the option: 33533 33534 boost::asio::ip::tcp::socket socket(my_context); 33535 ... 33536 boost::asio::socket_base::keep_alive option(true); 33537 socket.set_option(option); 33538 33539 33540 33541 33542 33543Getting the current option value: 33544 33545 boost::asio::ip::tcp::socket socket(my_context); 33546 ... 33547 boost::asio::socket_base::keep_alive option; 33548 socket.get_option(option); 33549 bool is_set = option.value(); 33550 33551 33552 33553 33554 33555 33556 33557[heading Requirements] 33558 33559['Header: ][^boost/asio/basic_socket.hpp] 33560 33561['Convenience header: ][^boost/asio.hpp] 33562 33563 33564[endsect] 33565 33566 33567 33568[section:linger basic_socket::linger] 33569 33570 33571['Inherited from socket_base.] 33572 33573[indexterm2 boost_asio.indexterm.basic_socket.linger..linger..basic_socket] 33574Socket option to specify whether the socket lingers on close if unsent data is present. 33575 33576 33577 typedef implementation_defined linger; 33578 33579 33580 33581Implements the SOL\_SOCKET/SO\_LINGER socket option. 33582 33583 33584[heading Examples] 33585 33586Setting the option: 33587 33588 boost::asio::ip::tcp::socket socket(my_context); 33589 ... 33590 boost::asio::socket_base::linger option(true, 30); 33591 socket.set_option(option); 33592 33593 33594 33595 33596 33597Getting the current option value: 33598 33599 boost::asio::ip::tcp::socket socket(my_context); 33600 ... 33601 boost::asio::socket_base::linger option; 33602 socket.get_option(option); 33603 bool is_set = option.enabled(); 33604 unsigned short timeout = option.timeout(); 33605 33606 33607 33608 33609 33610 33611 33612[heading Requirements] 33613 33614['Header: ][^boost/asio/basic_socket.hpp] 33615 33616['Convenience header: ][^boost/asio.hpp] 33617 33618 33619[endsect] 33620 33621 33622[section:local_endpoint basic_socket::local_endpoint] 33623 33624[indexterm2 boost_asio.indexterm.basic_socket.local_endpoint..local_endpoint..basic_socket] 33625Get the local endpoint of the socket. 33626 33627 33628 endpoint_type ``[link boost_asio.reference.basic_socket.local_endpoint.overload1 local_endpoint]``() const; 33629 `` [''''»''' [link boost_asio.reference.basic_socket.local_endpoint.overload1 more...]]`` 33630 33631 endpoint_type ``[link boost_asio.reference.basic_socket.local_endpoint.overload2 local_endpoint]``( 33632 boost::system::error_code & ec) const; 33633 `` [''''»''' [link boost_asio.reference.basic_socket.local_endpoint.overload2 more...]]`` 33634 33635 33636[section:overload1 basic_socket::local_endpoint (1 of 2 overloads)] 33637 33638 33639Get the local endpoint of the socket. 33640 33641 33642 endpoint_type local_endpoint() const; 33643 33644 33645This function is used to obtain the locally bound endpoint of the socket. 33646 33647 33648[heading Return Value] 33649 33650An object that represents the local endpoint of the socket. 33651 33652 33653[heading Exceptions] 33654 33655 33656[variablelist 33657 33658[[boost::system::system_error][Thrown on failure.]] 33659 33660] 33661 33662 33663[heading Example] 33664 33665 33666 33667 boost::asio::ip::tcp::socket socket(my_context); 33668 ... 33669 boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint(); 33670 33671 33672 33673 33674 33675 33676 33677[endsect] 33678 33679 33680 33681[section:overload2 basic_socket::local_endpoint (2 of 2 overloads)] 33682 33683 33684Get the local endpoint of the socket. 33685 33686 33687 endpoint_type local_endpoint( 33688 boost::system::error_code & ec) const; 33689 33690 33691This function is used to obtain the locally bound endpoint of the socket. 33692 33693 33694[heading Parameters] 33695 33696 33697[variablelist 33698 33699[[ec][Set to indicate what error occurred, if any.]] 33700 33701] 33702 33703 33704[heading Return Value] 33705 33706An object that represents the local endpoint of the socket. Returns a default-constructed endpoint object if an error occurred. 33707 33708 33709[heading Example] 33710 33711 33712 33713 boost::asio::ip::tcp::socket socket(my_context); 33714 ... 33715 boost::system::error_code ec; 33716 boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint(ec); 33717 if (ec) 33718 { 33719 // An error occurred. 33720 } 33721 33722 33723 33724 33725 33726 33727 33728[endsect] 33729 33730 33731[endsect] 33732 33733[section:lowest_layer basic_socket::lowest_layer] 33734 33735[indexterm2 boost_asio.indexterm.basic_socket.lowest_layer..lowest_layer..basic_socket] 33736Get a reference to the lowest layer. 33737 33738 33739 lowest_layer_type & ``[link boost_asio.reference.basic_socket.lowest_layer.overload1 lowest_layer]``(); 33740 `` [''''»''' [link boost_asio.reference.basic_socket.lowest_layer.overload1 more...]]`` 33741 33742 33743Get a const reference to the lowest layer. 33744 33745 33746 const lowest_layer_type & ``[link boost_asio.reference.basic_socket.lowest_layer.overload2 lowest_layer]``() const; 33747 `` [''''»''' [link boost_asio.reference.basic_socket.lowest_layer.overload2 more...]]`` 33748 33749 33750[section:overload1 basic_socket::lowest_layer (1 of 2 overloads)] 33751 33752 33753Get a reference to the lowest layer. 33754 33755 33756 lowest_layer_type & lowest_layer(); 33757 33758 33759This 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. 33760 33761 33762[heading Return Value] 33763 33764A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 33765 33766 33767 33768 33769[endsect] 33770 33771 33772 33773[section:overload2 basic_socket::lowest_layer (2 of 2 overloads)] 33774 33775 33776Get a const reference to the lowest layer. 33777 33778 33779 const lowest_layer_type & lowest_layer() const; 33780 33781 33782This 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. 33783 33784 33785[heading Return Value] 33786 33787A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 33788 33789 33790 33791 33792[endsect] 33793 33794 33795[endsect] 33796 33797 33798[section:lowest_layer_type basic_socket::lowest_layer_type] 33799 33800[indexterm2 boost_asio.indexterm.basic_socket.lowest_layer_type..lowest_layer_type..basic_socket] 33801A [link boost_asio.reference.basic_socket `basic_socket`] is always the lowest layer. 33802 33803 33804 typedef basic_socket< Protocol, Executor > lowest_layer_type; 33805 33806 33807[heading Types] 33808[table 33809 [[Name][Description]] 33810 33811 [ 33812 33813 [[link boost_asio.reference.basic_socket__rebind_executor [*rebind_executor]]] 33814 [Rebinds the socket type to another executor. ] 33815 33816 ] 33817 33818 [ 33819 33820 [[link boost_asio.reference.basic_socket.broadcast [*broadcast]]] 33821 [Socket option to permit sending of broadcast messages. ] 33822 33823 ] 33824 33825 [ 33826 33827 [[link boost_asio.reference.basic_socket.bytes_readable [*bytes_readable]]] 33828 [IO control command to get the amount of data that can be read without blocking. ] 33829 33830 ] 33831 33832 [ 33833 33834 [[link boost_asio.reference.basic_socket.debug [*debug]]] 33835 [Socket option to enable socket-level debugging. ] 33836 33837 ] 33838 33839 [ 33840 33841 [[link boost_asio.reference.basic_socket.do_not_route [*do_not_route]]] 33842 [Socket option to prevent routing, use local interfaces only. ] 33843 33844 ] 33845 33846 [ 33847 33848 [[link boost_asio.reference.basic_socket.enable_connection_aborted [*enable_connection_aborted]]] 33849 [Socket option to report aborted connections on accept. ] 33850 33851 ] 33852 33853 [ 33854 33855 [[link boost_asio.reference.basic_socket.endpoint_type [*endpoint_type]]] 33856 [The endpoint type. ] 33857 33858 ] 33859 33860 [ 33861 33862 [[link boost_asio.reference.basic_socket.executor_type [*executor_type]]] 33863 [The type of the executor associated with the object. ] 33864 33865 ] 33866 33867 [ 33868 33869 [[link boost_asio.reference.basic_socket.keep_alive [*keep_alive]]] 33870 [Socket option to send keep-alives. ] 33871 33872 ] 33873 33874 [ 33875 33876 [[link boost_asio.reference.basic_socket.linger [*linger]]] 33877 [Socket option to specify whether the socket lingers on close if unsent data is present. ] 33878 33879 ] 33880 33881 [ 33882 33883 [[link boost_asio.reference.basic_socket.lowest_layer_type [*lowest_layer_type]]] 33884 [A basic_socket is always the lowest layer. ] 33885 33886 ] 33887 33888 [ 33889 33890 [[link boost_asio.reference.basic_socket.message_flags [*message_flags]]] 33891 [Bitmask type for flags that can be passed to send and receive operations. ] 33892 33893 ] 33894 33895 [ 33896 33897 [[link boost_asio.reference.basic_socket.native_handle_type [*native_handle_type]]] 33898 [The native representation of a socket. ] 33899 33900 ] 33901 33902 [ 33903 33904 [[link boost_asio.reference.basic_socket.out_of_band_inline [*out_of_band_inline]]] 33905 [Socket option for putting received out-of-band data inline. ] 33906 33907 ] 33908 33909 [ 33910 33911 [[link boost_asio.reference.basic_socket.protocol_type [*protocol_type]]] 33912 [The protocol type. ] 33913 33914 ] 33915 33916 [ 33917 33918 [[link boost_asio.reference.basic_socket.receive_buffer_size [*receive_buffer_size]]] 33919 [Socket option for the receive buffer size of a socket. ] 33920 33921 ] 33922 33923 [ 33924 33925 [[link boost_asio.reference.basic_socket.receive_low_watermark [*receive_low_watermark]]] 33926 [Socket option for the receive low watermark. ] 33927 33928 ] 33929 33930 [ 33931 33932 [[link boost_asio.reference.basic_socket.reuse_address [*reuse_address]]] 33933 [Socket option to allow the socket to be bound to an address that is already in use. ] 33934 33935 ] 33936 33937 [ 33938 33939 [[link boost_asio.reference.basic_socket.send_buffer_size [*send_buffer_size]]] 33940 [Socket option for the send buffer size of a socket. ] 33941 33942 ] 33943 33944 [ 33945 33946 [[link boost_asio.reference.basic_socket.send_low_watermark [*send_low_watermark]]] 33947 [Socket option for the send low watermark. ] 33948 33949 ] 33950 33951 [ 33952 33953 [[link boost_asio.reference.basic_socket.shutdown_type [*shutdown_type]]] 33954 [Different ways a socket may be shutdown. ] 33955 33956 ] 33957 33958 [ 33959 33960 [[link boost_asio.reference.basic_socket.wait_type [*wait_type]]] 33961 [Wait types. ] 33962 33963 ] 33964 33965] 33966 33967[heading Member Functions] 33968[table 33969 [[Name][Description]] 33970 33971 [ 33972 [[link boost_asio.reference.basic_socket.assign [*assign]]] 33973 [Assign an existing native socket to the socket. ] 33974 ] 33975 33976 [ 33977 [[link boost_asio.reference.basic_socket.async_connect [*async_connect]]] 33978 [Start an asynchronous connect. ] 33979 ] 33980 33981 [ 33982 [[link boost_asio.reference.basic_socket.async_wait [*async_wait]]] 33983 [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 33984 ] 33985 33986 [ 33987 [[link boost_asio.reference.basic_socket.at_mark [*at_mark]]] 33988 [Determine whether the socket is at the out-of-band data mark. ] 33989 ] 33990 33991 [ 33992 [[link boost_asio.reference.basic_socket.available [*available]]] 33993 [Determine the number of bytes available for reading. ] 33994 ] 33995 33996 [ 33997 [[link boost_asio.reference.basic_socket.basic_socket [*basic_socket]] [constructor]] 33998 [Construct a basic_socket without opening it. 33999 [hr] 34000 Construct and open a basic_socket. 34001 [hr] 34002 Construct a basic_socket, opening it and binding it to the given local endpoint. 34003 [hr] 34004 Construct a basic_socket on an existing native socket. 34005 [hr] 34006 Move-construct a basic_socket from another. 34007 [hr] 34008 Move-construct a basic_socket from a socket of another protocol type. ] 34009 ] 34010 34011 [ 34012 [[link boost_asio.reference.basic_socket.bind [*bind]]] 34013 [Bind the socket to the given local endpoint. ] 34014 ] 34015 34016 [ 34017 [[link boost_asio.reference.basic_socket.cancel [*cancel]]] 34018 [Cancel all asynchronous operations associated with the socket. ] 34019 ] 34020 34021 [ 34022 [[link boost_asio.reference.basic_socket.close [*close]]] 34023 [Close the socket. ] 34024 ] 34025 34026 [ 34027 [[link boost_asio.reference.basic_socket.connect [*connect]]] 34028 [Connect the socket to the specified endpoint. ] 34029 ] 34030 34031 [ 34032 [[link boost_asio.reference.basic_socket.get_executor [*get_executor]]] 34033 [Get the executor associated with the object. ] 34034 ] 34035 34036 [ 34037 [[link boost_asio.reference.basic_socket.get_option [*get_option]]] 34038 [Get an option from the socket. ] 34039 ] 34040 34041 [ 34042 [[link boost_asio.reference.basic_socket.io_control [*io_control]]] 34043 [Perform an IO control command on the socket. ] 34044 ] 34045 34046 [ 34047 [[link boost_asio.reference.basic_socket.is_open [*is_open]]] 34048 [Determine whether the socket is open. ] 34049 ] 34050 34051 [ 34052 [[link boost_asio.reference.basic_socket.local_endpoint [*local_endpoint]]] 34053 [Get the local endpoint of the socket. ] 34054 ] 34055 34056 [ 34057 [[link boost_asio.reference.basic_socket.lowest_layer [*lowest_layer]]] 34058 [Get a reference to the lowest layer. 34059 [hr] 34060 Get a const reference to the lowest layer. ] 34061 ] 34062 34063 [ 34064 [[link boost_asio.reference.basic_socket.native_handle [*native_handle]]] 34065 [Get the native socket representation. ] 34066 ] 34067 34068 [ 34069 [[link boost_asio.reference.basic_socket.native_non_blocking [*native_non_blocking]]] 34070 [Gets the non-blocking mode of the native socket implementation. 34071 [hr] 34072 Sets the non-blocking mode of the native socket implementation. ] 34073 ] 34074 34075 [ 34076 [[link boost_asio.reference.basic_socket.non_blocking [*non_blocking]]] 34077 [Gets the non-blocking mode of the socket. 34078 [hr] 34079 Sets the non-blocking mode of the socket. ] 34080 ] 34081 34082 [ 34083 [[link boost_asio.reference.basic_socket.open [*open]]] 34084 [Open the socket using the specified protocol. ] 34085 ] 34086 34087 [ 34088 [[link boost_asio.reference.basic_socket.operator_eq_ [*operator=]]] 34089 [Move-assign a basic_socket from another. 34090 [hr] 34091 Move-assign a basic_socket from a socket of another protocol type. ] 34092 ] 34093 34094 [ 34095 [[link boost_asio.reference.basic_socket.release [*release]]] 34096 [Release ownership of the underlying native socket. ] 34097 ] 34098 34099 [ 34100 [[link boost_asio.reference.basic_socket.remote_endpoint [*remote_endpoint]]] 34101 [Get the remote endpoint of the socket. ] 34102 ] 34103 34104 [ 34105 [[link boost_asio.reference.basic_socket.set_option [*set_option]]] 34106 [Set an option on the socket. ] 34107 ] 34108 34109 [ 34110 [[link boost_asio.reference.basic_socket.shutdown [*shutdown]]] 34111 [Disable sends or receives on the socket. ] 34112 ] 34113 34114 [ 34115 [[link boost_asio.reference.basic_socket.wait [*wait]]] 34116 [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 34117 ] 34118 34119] 34120 34121[heading Protected Member Functions] 34122[table 34123 [[Name][Description]] 34124 34125 [ 34126 [[link boost_asio.reference.basic_socket._basic_socket [*~basic_socket]] [destructor]] 34127 [Protected destructor to prevent deletion through this type. ] 34128 ] 34129 34130] 34131 34132[heading Data Members] 34133[table 34134 [[Name][Description]] 34135 34136 [ 34137 [[link boost_asio.reference.basic_socket.max_connections [*max_connections]] [static]] 34138 [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ] 34139 ] 34140 34141 [ 34142 [[link boost_asio.reference.basic_socket.max_listen_connections [*max_listen_connections]] [static]] 34143 [The maximum length of the queue of pending incoming connections. ] 34144 ] 34145 34146 [ 34147 [[link boost_asio.reference.basic_socket.message_do_not_route [*message_do_not_route]] [static]] 34148 [Specify that the data should not be subject to routing. ] 34149 ] 34150 34151 [ 34152 [[link boost_asio.reference.basic_socket.message_end_of_record [*message_end_of_record]] [static]] 34153 [Specifies that the data marks the end of a record. ] 34154 ] 34155 34156 [ 34157 [[link boost_asio.reference.basic_socket.message_out_of_band [*message_out_of_band]] [static]] 34158 [Process out-of-band data. ] 34159 ] 34160 34161 [ 34162 [[link boost_asio.reference.basic_socket.message_peek [*message_peek]] [static]] 34163 [Peek at incoming data without removing it from the input queue. ] 34164 ] 34165 34166] 34167 34168The [link boost_asio.reference.basic_socket `basic_socket`] class template provides functionality that is common to both stream-oriented and datagram-oriented sockets. 34169 34170 34171[heading Thread Safety] 34172 34173['Distinct] ['objects:] Safe. 34174 34175['Shared] ['objects:] Unsafe. 34176 34177 34178 34179 34180[heading Requirements] 34181 34182['Header: ][^boost/asio/basic_socket.hpp] 34183 34184['Convenience header: ][^boost/asio.hpp] 34185 34186 34187[endsect] 34188 34189 34190 34191[section:max_connections basic_socket::max_connections] 34192 34193 34194['Inherited from socket_base.] 34195 34196[indexterm2 boost_asio.indexterm.basic_socket.max_connections..max_connections..basic_socket] 34197(Deprecated: Use max\_listen\_connections.) The maximum length of the queue of pending incoming connections. 34198 34199 34200 static const int max_connections = implementation_defined; 34201 34202 34203 34204[endsect] 34205 34206 34207 34208[section:max_listen_connections basic_socket::max_listen_connections] 34209 34210 34211['Inherited from socket_base.] 34212 34213[indexterm2 boost_asio.indexterm.basic_socket.max_listen_connections..max_listen_connections..basic_socket] 34214The maximum length of the queue of pending incoming connections. 34215 34216 34217 static const int max_listen_connections = implementation_defined; 34218 34219 34220 34221[endsect] 34222 34223 34224 34225[section:message_do_not_route basic_socket::message_do_not_route] 34226 34227 34228['Inherited from socket_base.] 34229 34230[indexterm2 boost_asio.indexterm.basic_socket.message_do_not_route..message_do_not_route..basic_socket] 34231Specify that the data should not be subject to routing. 34232 34233 34234 static const int message_do_not_route = implementation_defined; 34235 34236 34237 34238[endsect] 34239 34240 34241 34242[section:message_end_of_record basic_socket::message_end_of_record] 34243 34244 34245['Inherited from socket_base.] 34246 34247[indexterm2 boost_asio.indexterm.basic_socket.message_end_of_record..message_end_of_record..basic_socket] 34248Specifies that the data marks the end of a record. 34249 34250 34251 static const int message_end_of_record = implementation_defined; 34252 34253 34254 34255[endsect] 34256 34257 34258 34259[section:message_flags basic_socket::message_flags] 34260 34261 34262['Inherited from socket_base.] 34263 34264[indexterm2 boost_asio.indexterm.basic_socket.message_flags..message_flags..basic_socket] 34265Bitmask type for flags that can be passed to send and receive operations. 34266 34267 34268 typedef int message_flags; 34269 34270 34271 34272[heading Requirements] 34273 34274['Header: ][^boost/asio/basic_socket.hpp] 34275 34276['Convenience header: ][^boost/asio.hpp] 34277 34278 34279[endsect] 34280 34281 34282 34283[section:message_out_of_band basic_socket::message_out_of_band] 34284 34285 34286['Inherited from socket_base.] 34287 34288[indexterm2 boost_asio.indexterm.basic_socket.message_out_of_band..message_out_of_band..basic_socket] 34289Process out-of-band data. 34290 34291 34292 static const int message_out_of_band = implementation_defined; 34293 34294 34295 34296[endsect] 34297 34298 34299 34300[section:message_peek basic_socket::message_peek] 34301 34302 34303['Inherited from socket_base.] 34304 34305[indexterm2 boost_asio.indexterm.basic_socket.message_peek..message_peek..basic_socket] 34306Peek at incoming data without removing it from the input queue. 34307 34308 34309 static const int message_peek = implementation_defined; 34310 34311 34312 34313[endsect] 34314 34315 34316 34317[section:native_handle basic_socket::native_handle] 34318 34319[indexterm2 boost_asio.indexterm.basic_socket.native_handle..native_handle..basic_socket] 34320Get the native socket representation. 34321 34322 34323 native_handle_type native_handle(); 34324 34325 34326This 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. 34327 34328 34329[endsect] 34330 34331 34332 34333[section:native_handle_type basic_socket::native_handle_type] 34334 34335[indexterm2 boost_asio.indexterm.basic_socket.native_handle_type..native_handle_type..basic_socket] 34336The native representation of a socket. 34337 34338 34339 typedef implementation_defined native_handle_type; 34340 34341 34342 34343[heading Requirements] 34344 34345['Header: ][^boost/asio/basic_socket.hpp] 34346 34347['Convenience header: ][^boost/asio.hpp] 34348 34349 34350[endsect] 34351 34352 34353[section:native_non_blocking basic_socket::native_non_blocking] 34354 34355[indexterm2 boost_asio.indexterm.basic_socket.native_non_blocking..native_non_blocking..basic_socket] 34356Gets the non-blocking mode of the native socket implementation. 34357 34358 34359 bool ``[link boost_asio.reference.basic_socket.native_non_blocking.overload1 native_non_blocking]``() const; 34360 `` [''''»''' [link boost_asio.reference.basic_socket.native_non_blocking.overload1 more...]]`` 34361 34362 34363Sets the non-blocking mode of the native socket implementation. 34364 34365 34366 void ``[link boost_asio.reference.basic_socket.native_non_blocking.overload2 native_non_blocking]``( 34367 bool mode); 34368 `` [''''»''' [link boost_asio.reference.basic_socket.native_non_blocking.overload2 more...]]`` 34369 34370 void ``[link boost_asio.reference.basic_socket.native_non_blocking.overload3 native_non_blocking]``( 34371 bool mode, 34372 boost::system::error_code & ec); 34373 `` [''''»''' [link boost_asio.reference.basic_socket.native_non_blocking.overload3 more...]]`` 34374 34375 34376[section:overload1 basic_socket::native_non_blocking (1 of 3 overloads)] 34377 34378 34379Gets the non-blocking mode of the native socket implementation. 34380 34381 34382 bool native_non_blocking() const; 34383 34384 34385This 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. 34386 34387 34388[heading Return Value] 34389 34390`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). 34391 34392 34393[heading Remarks] 34394 34395The 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. 34396 34397 34398[heading Example] 34399 34400This 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: 34401 34402 template <typename Handler> 34403 struct sendfile_op 34404 { 34405 tcp::socket& sock_; 34406 int fd_; 34407 Handler handler_; 34408 off_t offset_; 34409 std::size_t total_bytes_transferred_; 34410 34411 // Function call operator meeting WriteHandler requirements. 34412 // Used as the handler for the async_write_some operation. 34413 void operator()(boost::system::error_code ec, std::size_t) 34414 { 34415 // Put the underlying socket into non-blocking mode. 34416 if (!ec) 34417 if (!sock_.native_non_blocking()) 34418 sock_.native_non_blocking(true, ec); 34419 34420 if (!ec) 34421 { 34422 for (;;) 34423 { 34424 // Try the system call. 34425 errno = 0; 34426 int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536); 34427 ec = boost::system::error_code(n < 0 ? errno : 0, 34428 boost::asio::error::get_system_category()); 34429 total_bytes_transferred_ += ec ? 0 : n; 34430 34431 // Retry operation immediately if interrupted by signal. 34432 if (ec == boost::asio::error::interrupted) 34433 continue; 34434 34435 // Check if we need to run the operation again. 34436 if (ec == boost::asio::error::would_block 34437 || ec == boost::asio::error::try_again) 34438 { 34439 // We have to wait for the socket to become ready again. 34440 sock_.async_wait(tcp::socket::wait_write, *this); 34441 return; 34442 } 34443 34444 if (ec || n == 0) 34445 { 34446 // An error occurred, or we have reached the end of the file. 34447 // Either way we must exit the loop so we can call the handler. 34448 break; 34449 } 34450 34451 // Loop around to try calling sendfile again. 34452 } 34453 } 34454 34455 // Pass result back to user's handler. 34456 handler_(ec, total_bytes_transferred_); 34457 } 34458 }; 34459 34460 template <typename Handler> 34461 void async_sendfile(tcp::socket& sock, int fd, Handler h) 34462 { 34463 sendfile_op<Handler> op = { sock, fd, h, 0, 0 }; 34464 sock.async_wait(tcp::socket::wait_write, op); 34465 } 34466 34467 34468 34469 34470 34471 34472 34473[endsect] 34474 34475 34476 34477[section:overload2 basic_socket::native_non_blocking (2 of 3 overloads)] 34478 34479 34480Sets the non-blocking mode of the native socket implementation. 34481 34482 34483 void native_non_blocking( 34484 bool mode); 34485 34486 34487This 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. 34488 34489 34490[heading Parameters] 34491 34492 34493[variablelist 34494 34495[[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).]] 34496 34497] 34498 34499 34500[heading Exceptions] 34501 34502 34503[variablelist 34504 34505[[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.]] 34506 34507] 34508 34509 34510[heading Example] 34511 34512This 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: 34513 34514 template <typename Handler> 34515 struct sendfile_op 34516 { 34517 tcp::socket& sock_; 34518 int fd_; 34519 Handler handler_; 34520 off_t offset_; 34521 std::size_t total_bytes_transferred_; 34522 34523 // Function call operator meeting WriteHandler requirements. 34524 // Used as the handler for the async_write_some operation. 34525 void operator()(boost::system::error_code ec, std::size_t) 34526 { 34527 // Put the underlying socket into non-blocking mode. 34528 if (!ec) 34529 if (!sock_.native_non_blocking()) 34530 sock_.native_non_blocking(true, ec); 34531 34532 if (!ec) 34533 { 34534 for (;;) 34535 { 34536 // Try the system call. 34537 errno = 0; 34538 int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536); 34539 ec = boost::system::error_code(n < 0 ? errno : 0, 34540 boost::asio::error::get_system_category()); 34541 total_bytes_transferred_ += ec ? 0 : n; 34542 34543 // Retry operation immediately if interrupted by signal. 34544 if (ec == boost::asio::error::interrupted) 34545 continue; 34546 34547 // Check if we need to run the operation again. 34548 if (ec == boost::asio::error::would_block 34549 || ec == boost::asio::error::try_again) 34550 { 34551 // We have to wait for the socket to become ready again. 34552 sock_.async_wait(tcp::socket::wait_write, *this); 34553 return; 34554 } 34555 34556 if (ec || n == 0) 34557 { 34558 // An error occurred, or we have reached the end of the file. 34559 // Either way we must exit the loop so we can call the handler. 34560 break; 34561 } 34562 34563 // Loop around to try calling sendfile again. 34564 } 34565 } 34566 34567 // Pass result back to user's handler. 34568 handler_(ec, total_bytes_transferred_); 34569 } 34570 }; 34571 34572 template <typename Handler> 34573 void async_sendfile(tcp::socket& sock, int fd, Handler h) 34574 { 34575 sendfile_op<Handler> op = { sock, fd, h, 0, 0 }; 34576 sock.async_wait(tcp::socket::wait_write, op); 34577 } 34578 34579 34580 34581 34582 34583 34584 34585[endsect] 34586 34587 34588 34589[section:overload3 basic_socket::native_non_blocking (3 of 3 overloads)] 34590 34591 34592Sets the non-blocking mode of the native socket implementation. 34593 34594 34595 void native_non_blocking( 34596 bool mode, 34597 boost::system::error_code & ec); 34598 34599 34600This 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. 34601 34602 34603[heading Parameters] 34604 34605 34606[variablelist 34607 34608[[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).]] 34609 34610[[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.]] 34611 34612] 34613 34614 34615[heading Example] 34616 34617This 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: 34618 34619 template <typename Handler> 34620 struct sendfile_op 34621 { 34622 tcp::socket& sock_; 34623 int fd_; 34624 Handler handler_; 34625 off_t offset_; 34626 std::size_t total_bytes_transferred_; 34627 34628 // Function call operator meeting WriteHandler requirements. 34629 // Used as the handler for the async_write_some operation. 34630 void operator()(boost::system::error_code ec, std::size_t) 34631 { 34632 // Put the underlying socket into non-blocking mode. 34633 if (!ec) 34634 if (!sock_.native_non_blocking()) 34635 sock_.native_non_blocking(true, ec); 34636 34637 if (!ec) 34638 { 34639 for (;;) 34640 { 34641 // Try the system call. 34642 errno = 0; 34643 int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536); 34644 ec = boost::system::error_code(n < 0 ? errno : 0, 34645 boost::asio::error::get_system_category()); 34646 total_bytes_transferred_ += ec ? 0 : n; 34647 34648 // Retry operation immediately if interrupted by signal. 34649 if (ec == boost::asio::error::interrupted) 34650 continue; 34651 34652 // Check if we need to run the operation again. 34653 if (ec == boost::asio::error::would_block 34654 || ec == boost::asio::error::try_again) 34655 { 34656 // We have to wait for the socket to become ready again. 34657 sock_.async_wait(tcp::socket::wait_write, *this); 34658 return; 34659 } 34660 34661 if (ec || n == 0) 34662 { 34663 // An error occurred, or we have reached the end of the file. 34664 // Either way we must exit the loop so we can call the handler. 34665 break; 34666 } 34667 34668 // Loop around to try calling sendfile again. 34669 } 34670 } 34671 34672 // Pass result back to user's handler. 34673 handler_(ec, total_bytes_transferred_); 34674 } 34675 }; 34676 34677 template <typename Handler> 34678 void async_sendfile(tcp::socket& sock, int fd, Handler h) 34679 { 34680 sendfile_op<Handler> op = { sock, fd, h, 0, 0 }; 34681 sock.async_wait(tcp::socket::wait_write, op); 34682 } 34683 34684 34685 34686 34687 34688 34689 34690[endsect] 34691 34692 34693[endsect] 34694 34695[section:non_blocking basic_socket::non_blocking] 34696 34697[indexterm2 boost_asio.indexterm.basic_socket.non_blocking..non_blocking..basic_socket] 34698Gets the non-blocking mode of the socket. 34699 34700 34701 bool ``[link boost_asio.reference.basic_socket.non_blocking.overload1 non_blocking]``() const; 34702 `` [''''»''' [link boost_asio.reference.basic_socket.non_blocking.overload1 more...]]`` 34703 34704 34705Sets the non-blocking mode of the socket. 34706 34707 34708 void ``[link boost_asio.reference.basic_socket.non_blocking.overload2 non_blocking]``( 34709 bool mode); 34710 `` [''''»''' [link boost_asio.reference.basic_socket.non_blocking.overload2 more...]]`` 34711 34712 void ``[link boost_asio.reference.basic_socket.non_blocking.overload3 non_blocking]``( 34713 bool mode, 34714 boost::system::error_code & ec); 34715 `` [''''»''' [link boost_asio.reference.basic_socket.non_blocking.overload3 more...]]`` 34716 34717 34718[section:overload1 basic_socket::non_blocking (1 of 3 overloads)] 34719 34720 34721Gets the non-blocking mode of the socket. 34722 34723 34724 bool non_blocking() const; 34725 34726 34727 34728[heading Return Value] 34729 34730`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. 34731 34732 34733[heading Remarks] 34734 34735The 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`. 34736 34737 34738 34739 34740[endsect] 34741 34742 34743 34744[section:overload2 basic_socket::non_blocking (2 of 3 overloads)] 34745 34746 34747Sets the non-blocking mode of the socket. 34748 34749 34750 void non_blocking( 34751 bool mode); 34752 34753 34754 34755[heading Parameters] 34756 34757 34758[variablelist 34759 34760[[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.]] 34761 34762] 34763 34764 34765[heading Exceptions] 34766 34767 34768[variablelist 34769 34770[[boost::system::system_error][Thrown on failure.]] 34771 34772] 34773 34774 34775[heading Remarks] 34776 34777The 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`. 34778 34779 34780 34781 34782[endsect] 34783 34784 34785 34786[section:overload3 basic_socket::non_blocking (3 of 3 overloads)] 34787 34788 34789Sets the non-blocking mode of the socket. 34790 34791 34792 void non_blocking( 34793 bool mode, 34794 boost::system::error_code & ec); 34795 34796 34797 34798[heading Parameters] 34799 34800 34801[variablelist 34802 34803[[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.]] 34804 34805[[ec][Set to indicate what error occurred, if any.]] 34806 34807] 34808 34809 34810[heading Remarks] 34811 34812The 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`. 34813 34814 34815 34816 34817[endsect] 34818 34819 34820[endsect] 34821 34822[section:open basic_socket::open] 34823 34824[indexterm2 boost_asio.indexterm.basic_socket.open..open..basic_socket] 34825Open the socket using the specified protocol. 34826 34827 34828 void ``[link boost_asio.reference.basic_socket.open.overload1 open]``( 34829 const protocol_type & protocol = protocol_type()); 34830 `` [''''»''' [link boost_asio.reference.basic_socket.open.overload1 more...]]`` 34831 34832 void ``[link boost_asio.reference.basic_socket.open.overload2 open]``( 34833 const protocol_type & protocol, 34834 boost::system::error_code & ec); 34835 `` [''''»''' [link boost_asio.reference.basic_socket.open.overload2 more...]]`` 34836 34837 34838[section:overload1 basic_socket::open (1 of 2 overloads)] 34839 34840 34841Open the socket using the specified protocol. 34842 34843 34844 void open( 34845 const protocol_type & protocol = protocol_type()); 34846 34847 34848This function opens the socket so that it will use the specified protocol. 34849 34850 34851[heading Parameters] 34852 34853 34854[variablelist 34855 34856[[protocol][An object specifying protocol parameters to be used.]] 34857 34858] 34859 34860 34861[heading Exceptions] 34862 34863 34864[variablelist 34865 34866[[boost::system::system_error][Thrown on failure.]] 34867 34868] 34869 34870 34871[heading Example] 34872 34873 34874 34875 boost::asio::ip::tcp::socket socket(my_context); 34876 socket.open(boost::asio::ip::tcp::v4()); 34877 34878 34879 34880 34881 34882 34883 34884[endsect] 34885 34886 34887 34888[section:overload2 basic_socket::open (2 of 2 overloads)] 34889 34890 34891Open the socket using the specified protocol. 34892 34893 34894 void open( 34895 const protocol_type & protocol, 34896 boost::system::error_code & ec); 34897 34898 34899This function opens the socket so that it will use the specified protocol. 34900 34901 34902[heading Parameters] 34903 34904 34905[variablelist 34906 34907[[protocol][An object specifying which protocol is to be used.]] 34908 34909[[ec][Set to indicate what error occurred, if any.]] 34910 34911] 34912 34913 34914[heading Example] 34915 34916 34917 34918 boost::asio::ip::tcp::socket socket(my_context); 34919 boost::system::error_code ec; 34920 socket.open(boost::asio::ip::tcp::v4(), ec); 34921 if (ec) 34922 { 34923 // An error occurred. 34924 } 34925 34926 34927 34928 34929 34930 34931 34932[endsect] 34933 34934 34935[endsect] 34936 34937[section:operator_eq_ basic_socket::operator=] 34938 34939[indexterm2 boost_asio.indexterm.basic_socket.operator_eq_..operator=..basic_socket] 34940Move-assign a [link boost_asio.reference.basic_socket `basic_socket`] from another. 34941 34942 34943 basic_socket & ``[link boost_asio.reference.basic_socket.operator_eq_.overload1 operator=]``( 34944 basic_socket && other); 34945 `` [''''»''' [link boost_asio.reference.basic_socket.operator_eq_.overload1 more...]]`` 34946 34947 34948Move-assign a [link boost_asio.reference.basic_socket `basic_socket`] from a socket of another protocol type. 34949 34950 34951 template< 34952 typename ``[link boost_asio.reference.Protocol Protocol1]``, 34953 typename ``[link boost_asio.reference.Executor1 Executor1]``> 34954 constraint< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value, basic_socket & >::type ``[link boost_asio.reference.basic_socket.operator_eq_.overload2 operator=]``( 34955 basic_socket< Protocol1, Executor1 > && other); 34956 `` [''''»''' [link boost_asio.reference.basic_socket.operator_eq_.overload2 more...]]`` 34957 34958 34959[section:overload1 basic_socket::operator= (1 of 2 overloads)] 34960 34961 34962Move-assign a [link boost_asio.reference.basic_socket `basic_socket`] from another. 34963 34964 34965 basic_socket & operator=( 34966 basic_socket && other); 34967 34968 34969This assignment operator moves a socket from one object to another. 34970 34971 34972[heading Parameters] 34973 34974 34975[variablelist 34976 34977[[other][The other [link boost_asio.reference.basic_socket `basic_socket`] object from which the move will occur.]] 34978 34979] 34980 34981 34982[heading Remarks] 34983 34984Following the move, the moved-from object is in the same state as if constructed using the `basic_socket(const executor_type&) constructor`. 34985 34986 34987 34988 34989[endsect] 34990 34991 34992 34993[section:overload2 basic_socket::operator= (2 of 2 overloads)] 34994 34995 34996Move-assign a [link boost_asio.reference.basic_socket `basic_socket`] from a socket of another protocol type. 34997 34998 34999 template< 35000 typename ``[link boost_asio.reference.Protocol Protocol1]``, 35001 typename ``[link boost_asio.reference.Executor1 Executor1]``> 35002 constraint< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value, basic_socket & >::type operator=( 35003 basic_socket< Protocol1, Executor1 > && other); 35004 35005 35006This assignment operator moves a socket from one object to another. 35007 35008 35009[heading Parameters] 35010 35011 35012[variablelist 35013 35014[[other][The other [link boost_asio.reference.basic_socket `basic_socket`] object from which the move will occur.]] 35015 35016] 35017 35018 35019[heading Remarks] 35020 35021Following the move, the moved-from object is in the same state as if constructed using the `basic_socket(const executor_type&) constructor`. 35022 35023 35024 35025 35026[endsect] 35027 35028 35029[endsect] 35030 35031 35032[section:out_of_band_inline basic_socket::out_of_band_inline] 35033 35034 35035['Inherited from socket_base.] 35036 35037[indexterm2 boost_asio.indexterm.basic_socket.out_of_band_inline..out_of_band_inline..basic_socket] 35038Socket option for putting received out-of-band data inline. 35039 35040 35041 typedef implementation_defined out_of_band_inline; 35042 35043 35044 35045Implements the SOL\_SOCKET/SO\_OOBINLINE socket option. 35046 35047 35048[heading Examples] 35049 35050Setting the option: 35051 35052 boost::asio::ip::tcp::socket socket(my_context); 35053 ... 35054 boost::asio::socket_base::out_of_band_inline option(true); 35055 socket.set_option(option); 35056 35057 35058 35059 35060 35061Getting the current option value: 35062 35063 boost::asio::ip::tcp::socket socket(my_context); 35064 ... 35065 boost::asio::socket_base::out_of_band_inline option; 35066 socket.get_option(option); 35067 bool value = option.value(); 35068 35069 35070 35071 35072 35073 35074 35075[heading Requirements] 35076 35077['Header: ][^boost/asio/basic_socket.hpp] 35078 35079['Convenience header: ][^boost/asio.hpp] 35080 35081 35082[endsect] 35083 35084 35085 35086[section:protocol_type basic_socket::protocol_type] 35087 35088[indexterm2 boost_asio.indexterm.basic_socket.protocol_type..protocol_type..basic_socket] 35089The protocol type. 35090 35091 35092 typedef Protocol protocol_type; 35093 35094 35095 35096[heading Requirements] 35097 35098['Header: ][^boost/asio/basic_socket.hpp] 35099 35100['Convenience header: ][^boost/asio.hpp] 35101 35102 35103[endsect] 35104 35105 35106 35107[section:receive_buffer_size basic_socket::receive_buffer_size] 35108 35109 35110['Inherited from socket_base.] 35111 35112[indexterm2 boost_asio.indexterm.basic_socket.receive_buffer_size..receive_buffer_size..basic_socket] 35113Socket option for the receive buffer size of a socket. 35114 35115 35116 typedef implementation_defined receive_buffer_size; 35117 35118 35119 35120Implements the SOL\_SOCKET/SO\_RCVBUF socket option. 35121 35122 35123[heading Examples] 35124 35125Setting the option: 35126 35127 boost::asio::ip::tcp::socket socket(my_context); 35128 ... 35129 boost::asio::socket_base::receive_buffer_size option(8192); 35130 socket.set_option(option); 35131 35132 35133 35134 35135 35136Getting the current option value: 35137 35138 boost::asio::ip::tcp::socket socket(my_context); 35139 ... 35140 boost::asio::socket_base::receive_buffer_size option; 35141 socket.get_option(option); 35142 int size = option.value(); 35143 35144 35145 35146 35147 35148 35149 35150[heading Requirements] 35151 35152['Header: ][^boost/asio/basic_socket.hpp] 35153 35154['Convenience header: ][^boost/asio.hpp] 35155 35156 35157[endsect] 35158 35159 35160 35161[section:receive_low_watermark basic_socket::receive_low_watermark] 35162 35163 35164['Inherited from socket_base.] 35165 35166[indexterm2 boost_asio.indexterm.basic_socket.receive_low_watermark..receive_low_watermark..basic_socket] 35167Socket option for the receive low watermark. 35168 35169 35170 typedef implementation_defined receive_low_watermark; 35171 35172 35173 35174Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option. 35175 35176 35177[heading Examples] 35178 35179Setting the option: 35180 35181 boost::asio::ip::tcp::socket socket(my_context); 35182 ... 35183 boost::asio::socket_base::receive_low_watermark option(1024); 35184 socket.set_option(option); 35185 35186 35187 35188 35189 35190Getting the current option value: 35191 35192 boost::asio::ip::tcp::socket socket(my_context); 35193 ... 35194 boost::asio::socket_base::receive_low_watermark option; 35195 socket.get_option(option); 35196 int size = option.value(); 35197 35198 35199 35200 35201 35202 35203 35204[heading Requirements] 35205 35206['Header: ][^boost/asio/basic_socket.hpp] 35207 35208['Convenience header: ][^boost/asio.hpp] 35209 35210 35211[endsect] 35212 35213 35214[section:release basic_socket::release] 35215 35216[indexterm2 boost_asio.indexterm.basic_socket.release..release..basic_socket] 35217Release ownership of the underlying native socket. 35218 35219 35220 native_handle_type ``[link boost_asio.reference.basic_socket.release.overload1 release]``(); 35221 `` [''''»''' [link boost_asio.reference.basic_socket.release.overload1 more...]]`` 35222 35223 native_handle_type ``[link boost_asio.reference.basic_socket.release.overload2 release]``( 35224 boost::system::error_code & ec); 35225 `` [''''»''' [link boost_asio.reference.basic_socket.release.overload2 more...]]`` 35226 35227 35228[section:overload1 basic_socket::release (1 of 2 overloads)] 35229 35230 35231Release ownership of the underlying native socket. 35232 35233 35234 native_handle_type release(); 35235 35236 35237This 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. 35238 35239 35240[heading Exceptions] 35241 35242 35243[variablelist 35244 35245[[boost::system::system_error][Thrown on failure.]] 35246 35247] 35248 35249 35250[heading Remarks] 35251 35252This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms. 35253 35254 35255 35256 35257[endsect] 35258 35259 35260 35261[section:overload2 basic_socket::release (2 of 2 overloads)] 35262 35263 35264Release ownership of the underlying native socket. 35265 35266 35267 native_handle_type release( 35268 boost::system::error_code & ec); 35269 35270 35271This 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. 35272 35273 35274[heading Parameters] 35275 35276 35277[variablelist 35278 35279[[ec][Set to indicate what error occurred, if any.]] 35280 35281] 35282 35283 35284[heading Remarks] 35285 35286This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms. 35287 35288 35289 35290 35291[endsect] 35292 35293 35294[endsect] 35295 35296[section:remote_endpoint basic_socket::remote_endpoint] 35297 35298[indexterm2 boost_asio.indexterm.basic_socket.remote_endpoint..remote_endpoint..basic_socket] 35299Get the remote endpoint of the socket. 35300 35301 35302 endpoint_type ``[link boost_asio.reference.basic_socket.remote_endpoint.overload1 remote_endpoint]``() const; 35303 `` [''''»''' [link boost_asio.reference.basic_socket.remote_endpoint.overload1 more...]]`` 35304 35305 endpoint_type ``[link boost_asio.reference.basic_socket.remote_endpoint.overload2 remote_endpoint]``( 35306 boost::system::error_code & ec) const; 35307 `` [''''»''' [link boost_asio.reference.basic_socket.remote_endpoint.overload2 more...]]`` 35308 35309 35310[section:overload1 basic_socket::remote_endpoint (1 of 2 overloads)] 35311 35312 35313Get the remote endpoint of the socket. 35314 35315 35316 endpoint_type remote_endpoint() const; 35317 35318 35319This function is used to obtain the remote endpoint of the socket. 35320 35321 35322[heading Return Value] 35323 35324An object that represents the remote endpoint of the socket. 35325 35326 35327[heading Exceptions] 35328 35329 35330[variablelist 35331 35332[[boost::system::system_error][Thrown on failure.]] 35333 35334] 35335 35336 35337[heading Example] 35338 35339 35340 35341 boost::asio::ip::tcp::socket socket(my_context); 35342 ... 35343 boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(); 35344 35345 35346 35347 35348 35349 35350 35351[endsect] 35352 35353 35354 35355[section:overload2 basic_socket::remote_endpoint (2 of 2 overloads)] 35356 35357 35358Get the remote endpoint of the socket. 35359 35360 35361 endpoint_type remote_endpoint( 35362 boost::system::error_code & ec) const; 35363 35364 35365This function is used to obtain the remote endpoint of the socket. 35366 35367 35368[heading Parameters] 35369 35370 35371[variablelist 35372 35373[[ec][Set to indicate what error occurred, if any.]] 35374 35375] 35376 35377 35378[heading Return Value] 35379 35380An object that represents the remote endpoint of the socket. Returns a default-constructed endpoint object if an error occurred. 35381 35382 35383[heading Example] 35384 35385 35386 35387 boost::asio::ip::tcp::socket socket(my_context); 35388 ... 35389 boost::system::error_code ec; 35390 boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(ec); 35391 if (ec) 35392 { 35393 // An error occurred. 35394 } 35395 35396 35397 35398 35399 35400 35401 35402[endsect] 35403 35404 35405[endsect] 35406 35407 35408[section:reuse_address basic_socket::reuse_address] 35409 35410 35411['Inherited from socket_base.] 35412 35413[indexterm2 boost_asio.indexterm.basic_socket.reuse_address..reuse_address..basic_socket] 35414Socket option to allow the socket to be bound to an address that is already in use. 35415 35416 35417 typedef implementation_defined reuse_address; 35418 35419 35420 35421Implements the SOL\_SOCKET/SO\_REUSEADDR socket option. 35422 35423 35424[heading Examples] 35425 35426Setting the option: 35427 35428 boost::asio::ip::tcp::acceptor acceptor(my_context); 35429 ... 35430 boost::asio::socket_base::reuse_address option(true); 35431 acceptor.set_option(option); 35432 35433 35434 35435 35436 35437Getting the current option value: 35438 35439 boost::asio::ip::tcp::acceptor acceptor(my_context); 35440 ... 35441 boost::asio::socket_base::reuse_address option; 35442 acceptor.get_option(option); 35443 bool is_set = option.value(); 35444 35445 35446 35447 35448 35449 35450 35451[heading Requirements] 35452 35453['Header: ][^boost/asio/basic_socket.hpp] 35454 35455['Convenience header: ][^boost/asio.hpp] 35456 35457 35458[endsect] 35459 35460 35461 35462[section:send_buffer_size basic_socket::send_buffer_size] 35463 35464 35465['Inherited from socket_base.] 35466 35467[indexterm2 boost_asio.indexterm.basic_socket.send_buffer_size..send_buffer_size..basic_socket] 35468Socket option for the send buffer size of a socket. 35469 35470 35471 typedef implementation_defined send_buffer_size; 35472 35473 35474 35475Implements the SOL\_SOCKET/SO\_SNDBUF socket option. 35476 35477 35478[heading Examples] 35479 35480Setting the option: 35481 35482 boost::asio::ip::tcp::socket socket(my_context); 35483 ... 35484 boost::asio::socket_base::send_buffer_size option(8192); 35485 socket.set_option(option); 35486 35487 35488 35489 35490 35491Getting the current option value: 35492 35493 boost::asio::ip::tcp::socket socket(my_context); 35494 ... 35495 boost::asio::socket_base::send_buffer_size option; 35496 socket.get_option(option); 35497 int size = option.value(); 35498 35499 35500 35501 35502 35503 35504 35505[heading Requirements] 35506 35507['Header: ][^boost/asio/basic_socket.hpp] 35508 35509['Convenience header: ][^boost/asio.hpp] 35510 35511 35512[endsect] 35513 35514 35515 35516[section:send_low_watermark basic_socket::send_low_watermark] 35517 35518 35519['Inherited from socket_base.] 35520 35521[indexterm2 boost_asio.indexterm.basic_socket.send_low_watermark..send_low_watermark..basic_socket] 35522Socket option for the send low watermark. 35523 35524 35525 typedef implementation_defined send_low_watermark; 35526 35527 35528 35529Implements the SOL\_SOCKET/SO\_SNDLOWAT socket option. 35530 35531 35532[heading Examples] 35533 35534Setting the option: 35535 35536 boost::asio::ip::tcp::socket socket(my_context); 35537 ... 35538 boost::asio::socket_base::send_low_watermark option(1024); 35539 socket.set_option(option); 35540 35541 35542 35543 35544 35545Getting the current option value: 35546 35547 boost::asio::ip::tcp::socket socket(my_context); 35548 ... 35549 boost::asio::socket_base::send_low_watermark option; 35550 socket.get_option(option); 35551 int size = option.value(); 35552 35553 35554 35555 35556 35557 35558 35559[heading Requirements] 35560 35561['Header: ][^boost/asio/basic_socket.hpp] 35562 35563['Convenience header: ][^boost/asio.hpp] 35564 35565 35566[endsect] 35567 35568 35569[section:set_option basic_socket::set_option] 35570 35571[indexterm2 boost_asio.indexterm.basic_socket.set_option..set_option..basic_socket] 35572Set an option on the socket. 35573 35574 35575 template< 35576 typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``> 35577 void ``[link boost_asio.reference.basic_socket.set_option.overload1 set_option]``( 35578 const SettableSocketOption & option); 35579 `` [''''»''' [link boost_asio.reference.basic_socket.set_option.overload1 more...]]`` 35580 35581 template< 35582 typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``> 35583 void ``[link boost_asio.reference.basic_socket.set_option.overload2 set_option]``( 35584 const SettableSocketOption & option, 35585 boost::system::error_code & ec); 35586 `` [''''»''' [link boost_asio.reference.basic_socket.set_option.overload2 more...]]`` 35587 35588 35589[section:overload1 basic_socket::set_option (1 of 2 overloads)] 35590 35591 35592Set an option on the socket. 35593 35594 35595 template< 35596 typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``> 35597 void set_option( 35598 const SettableSocketOption & option); 35599 35600 35601This function is used to set an option on the socket. 35602 35603 35604[heading Parameters] 35605 35606 35607[variablelist 35608 35609[[option][The new option value to be set on the socket.]] 35610 35611] 35612 35613 35614[heading Exceptions] 35615 35616 35617[variablelist 35618 35619[[boost::system::system_error][Thrown on failure.]] 35620 35621] 35622 35623 35624 35625[heading Example] 35626 35627Setting the IPPROTO\_TCP/TCP\_NODELAY option: 35628 35629 boost::asio::ip::tcp::socket socket(my_context); 35630 ... 35631 boost::asio::ip::tcp::no_delay option(true); 35632 socket.set_option(option); 35633 35634 35635 35636 35637 35638 35639 35640[endsect] 35641 35642 35643 35644[section:overload2 basic_socket::set_option (2 of 2 overloads)] 35645 35646 35647Set an option on the socket. 35648 35649 35650 template< 35651 typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``> 35652 void set_option( 35653 const SettableSocketOption & option, 35654 boost::system::error_code & ec); 35655 35656 35657This function is used to set an option on the socket. 35658 35659 35660[heading Parameters] 35661 35662 35663[variablelist 35664 35665[[option][The new option value to be set on the socket.]] 35666 35667[[ec][Set to indicate what error occurred, if any.]] 35668 35669] 35670 35671 35672 35673[heading Example] 35674 35675Setting the IPPROTO\_TCP/TCP\_NODELAY option: 35676 35677 boost::asio::ip::tcp::socket socket(my_context); 35678 ... 35679 boost::asio::ip::tcp::no_delay option(true); 35680 boost::system::error_code ec; 35681 socket.set_option(option, ec); 35682 if (ec) 35683 { 35684 // An error occurred. 35685 } 35686 35687 35688 35689 35690 35691 35692 35693[endsect] 35694 35695 35696[endsect] 35697 35698[section:shutdown basic_socket::shutdown] 35699 35700[indexterm2 boost_asio.indexterm.basic_socket.shutdown..shutdown..basic_socket] 35701Disable sends or receives on the socket. 35702 35703 35704 void ``[link boost_asio.reference.basic_socket.shutdown.overload1 shutdown]``( 35705 shutdown_type what); 35706 `` [''''»''' [link boost_asio.reference.basic_socket.shutdown.overload1 more...]]`` 35707 35708 void ``[link boost_asio.reference.basic_socket.shutdown.overload2 shutdown]``( 35709 shutdown_type what, 35710 boost::system::error_code & ec); 35711 `` [''''»''' [link boost_asio.reference.basic_socket.shutdown.overload2 more...]]`` 35712 35713 35714[section:overload1 basic_socket::shutdown (1 of 2 overloads)] 35715 35716 35717Disable sends or receives on the socket. 35718 35719 35720 void shutdown( 35721 shutdown_type what); 35722 35723 35724This function is used to disable send operations, receive operations, or both. 35725 35726 35727[heading Parameters] 35728 35729 35730[variablelist 35731 35732[[what][Determines what types of operation will no longer be allowed.]] 35733 35734] 35735 35736 35737[heading Exceptions] 35738 35739 35740[variablelist 35741 35742[[boost::system::system_error][Thrown on failure.]] 35743 35744] 35745 35746 35747[heading Example] 35748 35749Shutting down the send side of the socket: 35750 35751 boost::asio::ip::tcp::socket socket(my_context); 35752 ... 35753 socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send); 35754 35755 35756 35757 35758 35759 35760 35761[endsect] 35762 35763 35764 35765[section:overload2 basic_socket::shutdown (2 of 2 overloads)] 35766 35767 35768Disable sends or receives on the socket. 35769 35770 35771 void shutdown( 35772 shutdown_type what, 35773 boost::system::error_code & ec); 35774 35775 35776This function is used to disable send operations, receive operations, or both. 35777 35778 35779[heading Parameters] 35780 35781 35782[variablelist 35783 35784[[what][Determines what types of operation will no longer be allowed.]] 35785 35786[[ec][Set to indicate what error occurred, if any.]] 35787 35788] 35789 35790 35791[heading Example] 35792 35793Shutting down the send side of the socket: 35794 35795 boost::asio::ip::tcp::socket socket(my_context); 35796 ... 35797 boost::system::error_code ec; 35798 socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send, ec); 35799 if (ec) 35800 { 35801 // An error occurred. 35802 } 35803 35804 35805 35806 35807 35808 35809 35810[endsect] 35811 35812 35813[endsect] 35814 35815 35816[section:shutdown_type basic_socket::shutdown_type] 35817 35818 35819['Inherited from socket_base.] 35820 35821[indexterm2 boost_asio.indexterm.basic_socket.shutdown_type..shutdown_type..basic_socket] 35822Different ways a socket may be shutdown. 35823 35824 35825 enum shutdown_type 35826 35827[indexterm2 boost_asio.indexterm.basic_socket.shutdown_type.shutdown_receive..shutdown_receive..basic_socket] 35828[indexterm2 boost_asio.indexterm.basic_socket.shutdown_type.shutdown_send..shutdown_send..basic_socket] 35829[indexterm2 boost_asio.indexterm.basic_socket.shutdown_type.shutdown_both..shutdown_both..basic_socket] 35830 35831[heading Values] 35832[variablelist 35833 35834 [ 35835 [shutdown_receive] 35836 [Shutdown the receive side of the socket. ] 35837 ] 35838 35839 [ 35840 [shutdown_send] 35841 [Shutdown the send side of the socket. ] 35842 ] 35843 35844 [ 35845 [shutdown_both] 35846 [Shutdown both send and receive on the socket. ] 35847 ] 35848 35849] 35850 35851 35852 35853[endsect] 35854 35855 35856[section:wait basic_socket::wait] 35857 35858[indexterm2 boost_asio.indexterm.basic_socket.wait..wait..basic_socket] 35859Wait for the socket to become ready to read, ready to write, or to have pending error conditions. 35860 35861 35862 void ``[link boost_asio.reference.basic_socket.wait.overload1 wait]``( 35863 wait_type w); 35864 `` [''''»''' [link boost_asio.reference.basic_socket.wait.overload1 more...]]`` 35865 35866 void ``[link boost_asio.reference.basic_socket.wait.overload2 wait]``( 35867 wait_type w, 35868 boost::system::error_code & ec); 35869 `` [''''»''' [link boost_asio.reference.basic_socket.wait.overload2 more...]]`` 35870 35871 35872[section:overload1 basic_socket::wait (1 of 2 overloads)] 35873 35874 35875Wait for the socket to become ready to read, ready to write, or to have pending error conditions. 35876 35877 35878 void wait( 35879 wait_type w); 35880 35881 35882This function is used to perform a blocking wait for a socket to enter a ready to read, write or error condition state. 35883 35884 35885[heading Parameters] 35886 35887 35888[variablelist 35889 35890[[w][Specifies the desired socket state.]] 35891 35892] 35893 35894 35895[heading Example] 35896 35897Waiting for a socket to become readable. 35898 35899 boost::asio::ip::tcp::socket socket(my_context); 35900 ... 35901 socket.wait(boost::asio::ip::tcp::socket::wait_read); 35902 35903 35904 35905 35906 35907 35908 35909[endsect] 35910 35911 35912 35913[section:overload2 basic_socket::wait (2 of 2 overloads)] 35914 35915 35916Wait for the socket to become ready to read, ready to write, or to have pending error conditions. 35917 35918 35919 void wait( 35920 wait_type w, 35921 boost::system::error_code & ec); 35922 35923 35924This function is used to perform a blocking wait for a socket to enter a ready to read, write or error condition state. 35925 35926 35927[heading Parameters] 35928 35929 35930[variablelist 35931 35932[[w][Specifies the desired socket state.]] 35933 35934[[ec][Set to indicate what error occurred, if any.]] 35935 35936] 35937 35938 35939[heading Example] 35940 35941Waiting for a socket to become readable. 35942 35943 boost::asio::ip::tcp::socket socket(my_context); 35944 ... 35945 boost::system::error_code ec; 35946 socket.wait(boost::asio::ip::tcp::socket::wait_read, ec); 35947 35948 35949 35950 35951 35952 35953 35954[endsect] 35955 35956 35957[endsect] 35958 35959 35960[section:wait_type basic_socket::wait_type] 35961 35962 35963['Inherited from socket_base.] 35964 35965[indexterm2 boost_asio.indexterm.basic_socket.wait_type..wait_type..basic_socket] 35966Wait types. 35967 35968 35969 enum wait_type 35970 35971[indexterm2 boost_asio.indexterm.basic_socket.wait_type.wait_read..wait_read..basic_socket] 35972[indexterm2 boost_asio.indexterm.basic_socket.wait_type.wait_write..wait_write..basic_socket] 35973[indexterm2 boost_asio.indexterm.basic_socket.wait_type.wait_error..wait_error..basic_socket] 35974 35975[heading Values] 35976[variablelist 35977 35978 [ 35979 [wait_read] 35980 [Wait for a socket to become ready to read. ] 35981 ] 35982 35983 [ 35984 [wait_write] 35985 [Wait for a socket to become ready to write. ] 35986 ] 35987 35988 [ 35989 [wait_error] 35990 [Wait for a socket to have error conditions pending. ] 35991 ] 35992 35993] 35994 35995 35996For use with `basic_socket::wait()` and `basic_socket::async_wait()`. 35997 35998 35999[endsect] 36000 36001 36002 36003[section:_basic_socket basic_socket::~basic_socket] 36004 36005[indexterm2 boost_asio.indexterm.basic_socket._basic_socket..~basic_socket..basic_socket] 36006Protected destructor to prevent deletion through this type. 36007 36008 36009 ~basic_socket(); 36010 36011 36012This function destroys the socket, cancelling any outstanding asynchronous operations associated with the socket as if by calling `cancel`. 36013 36014 36015[endsect] 36016 36017 36018 36019[endsect] 36020 36021[section:basic_socket__rebind_executor basic_socket::rebind_executor] 36022 36023[indexterm1 boost_asio.indexterm.basic_socket__rebind_executor..basic_socket::rebind_executor] 36024 36025 36026Rebinds the socket type to another executor. 36027 36028 36029 template< 36030 typename ``[link boost_asio.reference.Executor1 Executor1]``> 36031 struct rebind_executor 36032 36033 36034[heading Types] 36035[table 36036 [[Name][Description]] 36037 36038 [ 36039 36040 [[link boost_asio.reference.basic_socket__rebind_executor.other [*other]]] 36041 [The socket type when rebound to the specified executor. ] 36042 36043 ] 36044 36045] 36046 36047[heading Requirements] 36048 36049['Header: ][^boost/asio/basic_socket.hpp] 36050 36051['Convenience header: ][^boost/asio.hpp] 36052 36053 36054[section:other basic_socket::rebind_executor::other] 36055 36056[indexterm2 boost_asio.indexterm.basic_socket__rebind_executor.other..other..basic_socket::rebind_executor] 36057The socket type when rebound to the specified executor. 36058 36059 36060 typedef basic_socket< Protocol, Executor1 > other; 36061 36062 36063[heading Types] 36064[table 36065 [[Name][Description]] 36066 36067 [ 36068 36069 [[link boost_asio.reference.basic_socket__rebind_executor [*rebind_executor]]] 36070 [Rebinds the socket type to another executor. ] 36071 36072 ] 36073 36074 [ 36075 36076 [[link boost_asio.reference.basic_socket.broadcast [*broadcast]]] 36077 [Socket option to permit sending of broadcast messages. ] 36078 36079 ] 36080 36081 [ 36082 36083 [[link boost_asio.reference.basic_socket.bytes_readable [*bytes_readable]]] 36084 [IO control command to get the amount of data that can be read without blocking. ] 36085 36086 ] 36087 36088 [ 36089 36090 [[link boost_asio.reference.basic_socket.debug [*debug]]] 36091 [Socket option to enable socket-level debugging. ] 36092 36093 ] 36094 36095 [ 36096 36097 [[link boost_asio.reference.basic_socket.do_not_route [*do_not_route]]] 36098 [Socket option to prevent routing, use local interfaces only. ] 36099 36100 ] 36101 36102 [ 36103 36104 [[link boost_asio.reference.basic_socket.enable_connection_aborted [*enable_connection_aborted]]] 36105 [Socket option to report aborted connections on accept. ] 36106 36107 ] 36108 36109 [ 36110 36111 [[link boost_asio.reference.basic_socket.endpoint_type [*endpoint_type]]] 36112 [The endpoint type. ] 36113 36114 ] 36115 36116 [ 36117 36118 [[link boost_asio.reference.basic_socket.executor_type [*executor_type]]] 36119 [The type of the executor associated with the object. ] 36120 36121 ] 36122 36123 [ 36124 36125 [[link boost_asio.reference.basic_socket.keep_alive [*keep_alive]]] 36126 [Socket option to send keep-alives. ] 36127 36128 ] 36129 36130 [ 36131 36132 [[link boost_asio.reference.basic_socket.linger [*linger]]] 36133 [Socket option to specify whether the socket lingers on close if unsent data is present. ] 36134 36135 ] 36136 36137 [ 36138 36139 [[link boost_asio.reference.basic_socket.lowest_layer_type [*lowest_layer_type]]] 36140 [A basic_socket is always the lowest layer. ] 36141 36142 ] 36143 36144 [ 36145 36146 [[link boost_asio.reference.basic_socket.message_flags [*message_flags]]] 36147 [Bitmask type for flags that can be passed to send and receive operations. ] 36148 36149 ] 36150 36151 [ 36152 36153 [[link boost_asio.reference.basic_socket.native_handle_type [*native_handle_type]]] 36154 [The native representation of a socket. ] 36155 36156 ] 36157 36158 [ 36159 36160 [[link boost_asio.reference.basic_socket.out_of_band_inline [*out_of_band_inline]]] 36161 [Socket option for putting received out-of-band data inline. ] 36162 36163 ] 36164 36165 [ 36166 36167 [[link boost_asio.reference.basic_socket.protocol_type [*protocol_type]]] 36168 [The protocol type. ] 36169 36170 ] 36171 36172 [ 36173 36174 [[link boost_asio.reference.basic_socket.receive_buffer_size [*receive_buffer_size]]] 36175 [Socket option for the receive buffer size of a socket. ] 36176 36177 ] 36178 36179 [ 36180 36181 [[link boost_asio.reference.basic_socket.receive_low_watermark [*receive_low_watermark]]] 36182 [Socket option for the receive low watermark. ] 36183 36184 ] 36185 36186 [ 36187 36188 [[link boost_asio.reference.basic_socket.reuse_address [*reuse_address]]] 36189 [Socket option to allow the socket to be bound to an address that is already in use. ] 36190 36191 ] 36192 36193 [ 36194 36195 [[link boost_asio.reference.basic_socket.send_buffer_size [*send_buffer_size]]] 36196 [Socket option for the send buffer size of a socket. ] 36197 36198 ] 36199 36200 [ 36201 36202 [[link boost_asio.reference.basic_socket.send_low_watermark [*send_low_watermark]]] 36203 [Socket option for the send low watermark. ] 36204 36205 ] 36206 36207 [ 36208 36209 [[link boost_asio.reference.basic_socket.shutdown_type [*shutdown_type]]] 36210 [Different ways a socket may be shutdown. ] 36211 36212 ] 36213 36214 [ 36215 36216 [[link boost_asio.reference.basic_socket.wait_type [*wait_type]]] 36217 [Wait types. ] 36218 36219 ] 36220 36221] 36222 36223[heading Member Functions] 36224[table 36225 [[Name][Description]] 36226 36227 [ 36228 [[link boost_asio.reference.basic_socket.assign [*assign]]] 36229 [Assign an existing native socket to the socket. ] 36230 ] 36231 36232 [ 36233 [[link boost_asio.reference.basic_socket.async_connect [*async_connect]]] 36234 [Start an asynchronous connect. ] 36235 ] 36236 36237 [ 36238 [[link boost_asio.reference.basic_socket.async_wait [*async_wait]]] 36239 [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 36240 ] 36241 36242 [ 36243 [[link boost_asio.reference.basic_socket.at_mark [*at_mark]]] 36244 [Determine whether the socket is at the out-of-band data mark. ] 36245 ] 36246 36247 [ 36248 [[link boost_asio.reference.basic_socket.available [*available]]] 36249 [Determine the number of bytes available for reading. ] 36250 ] 36251 36252 [ 36253 [[link boost_asio.reference.basic_socket.basic_socket [*basic_socket]] [constructor]] 36254 [Construct a basic_socket without opening it. 36255 [hr] 36256 Construct and open a basic_socket. 36257 [hr] 36258 Construct a basic_socket, opening it and binding it to the given local endpoint. 36259 [hr] 36260 Construct a basic_socket on an existing native socket. 36261 [hr] 36262 Move-construct a basic_socket from another. 36263 [hr] 36264 Move-construct a basic_socket from a socket of another protocol type. ] 36265 ] 36266 36267 [ 36268 [[link boost_asio.reference.basic_socket.bind [*bind]]] 36269 [Bind the socket to the given local endpoint. ] 36270 ] 36271 36272 [ 36273 [[link boost_asio.reference.basic_socket.cancel [*cancel]]] 36274 [Cancel all asynchronous operations associated with the socket. ] 36275 ] 36276 36277 [ 36278 [[link boost_asio.reference.basic_socket.close [*close]]] 36279 [Close the socket. ] 36280 ] 36281 36282 [ 36283 [[link boost_asio.reference.basic_socket.connect [*connect]]] 36284 [Connect the socket to the specified endpoint. ] 36285 ] 36286 36287 [ 36288 [[link boost_asio.reference.basic_socket.get_executor [*get_executor]]] 36289 [Get the executor associated with the object. ] 36290 ] 36291 36292 [ 36293 [[link boost_asio.reference.basic_socket.get_option [*get_option]]] 36294 [Get an option from the socket. ] 36295 ] 36296 36297 [ 36298 [[link boost_asio.reference.basic_socket.io_control [*io_control]]] 36299 [Perform an IO control command on the socket. ] 36300 ] 36301 36302 [ 36303 [[link boost_asio.reference.basic_socket.is_open [*is_open]]] 36304 [Determine whether the socket is open. ] 36305 ] 36306 36307 [ 36308 [[link boost_asio.reference.basic_socket.local_endpoint [*local_endpoint]]] 36309 [Get the local endpoint of the socket. ] 36310 ] 36311 36312 [ 36313 [[link boost_asio.reference.basic_socket.lowest_layer [*lowest_layer]]] 36314 [Get a reference to the lowest layer. 36315 [hr] 36316 Get a const reference to the lowest layer. ] 36317 ] 36318 36319 [ 36320 [[link boost_asio.reference.basic_socket.native_handle [*native_handle]]] 36321 [Get the native socket representation. ] 36322 ] 36323 36324 [ 36325 [[link boost_asio.reference.basic_socket.native_non_blocking [*native_non_blocking]]] 36326 [Gets the non-blocking mode of the native socket implementation. 36327 [hr] 36328 Sets the non-blocking mode of the native socket implementation. ] 36329 ] 36330 36331 [ 36332 [[link boost_asio.reference.basic_socket.non_blocking [*non_blocking]]] 36333 [Gets the non-blocking mode of the socket. 36334 [hr] 36335 Sets the non-blocking mode of the socket. ] 36336 ] 36337 36338 [ 36339 [[link boost_asio.reference.basic_socket.open [*open]]] 36340 [Open the socket using the specified protocol. ] 36341 ] 36342 36343 [ 36344 [[link boost_asio.reference.basic_socket.operator_eq_ [*operator=]]] 36345 [Move-assign a basic_socket from another. 36346 [hr] 36347 Move-assign a basic_socket from a socket of another protocol type. ] 36348 ] 36349 36350 [ 36351 [[link boost_asio.reference.basic_socket.release [*release]]] 36352 [Release ownership of the underlying native socket. ] 36353 ] 36354 36355 [ 36356 [[link boost_asio.reference.basic_socket.remote_endpoint [*remote_endpoint]]] 36357 [Get the remote endpoint of the socket. ] 36358 ] 36359 36360 [ 36361 [[link boost_asio.reference.basic_socket.set_option [*set_option]]] 36362 [Set an option on the socket. ] 36363 ] 36364 36365 [ 36366 [[link boost_asio.reference.basic_socket.shutdown [*shutdown]]] 36367 [Disable sends or receives on the socket. ] 36368 ] 36369 36370 [ 36371 [[link boost_asio.reference.basic_socket.wait [*wait]]] 36372 [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 36373 ] 36374 36375] 36376 36377[heading Protected Member Functions] 36378[table 36379 [[Name][Description]] 36380 36381 [ 36382 [[link boost_asio.reference.basic_socket._basic_socket [*~basic_socket]] [destructor]] 36383 [Protected destructor to prevent deletion through this type. ] 36384 ] 36385 36386] 36387 36388[heading Data Members] 36389[table 36390 [[Name][Description]] 36391 36392 [ 36393 [[link boost_asio.reference.basic_socket.max_connections [*max_connections]] [static]] 36394 [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ] 36395 ] 36396 36397 [ 36398 [[link boost_asio.reference.basic_socket.max_listen_connections [*max_listen_connections]] [static]] 36399 [The maximum length of the queue of pending incoming connections. ] 36400 ] 36401 36402 [ 36403 [[link boost_asio.reference.basic_socket.message_do_not_route [*message_do_not_route]] [static]] 36404 [Specify that the data should not be subject to routing. ] 36405 ] 36406 36407 [ 36408 [[link boost_asio.reference.basic_socket.message_end_of_record [*message_end_of_record]] [static]] 36409 [Specifies that the data marks the end of a record. ] 36410 ] 36411 36412 [ 36413 [[link boost_asio.reference.basic_socket.message_out_of_band [*message_out_of_band]] [static]] 36414 [Process out-of-band data. ] 36415 ] 36416 36417 [ 36418 [[link boost_asio.reference.basic_socket.message_peek [*message_peek]] [static]] 36419 [Peek at incoming data without removing it from the input queue. ] 36420 ] 36421 36422] 36423 36424The [link boost_asio.reference.basic_socket `basic_socket`] class template provides functionality that is common to both stream-oriented and datagram-oriented sockets. 36425 36426 36427[heading Thread Safety] 36428 36429['Distinct] ['objects:] Safe. 36430 36431['Shared] ['objects:] Unsafe. 36432 36433 36434 36435 36436[heading Requirements] 36437 36438['Header: ][^boost/asio/basic_socket.hpp] 36439 36440['Convenience header: ][^boost/asio.hpp] 36441 36442 36443[endsect] 36444 36445 36446 36447[endsect] 36448 36449[section:basic_socket_acceptor basic_socket_acceptor] 36450 36451[indexterm1 boost_asio.indexterm.basic_socket_acceptor..basic_socket_acceptor] 36452 36453 36454Provides the ability to accept new connections. 36455 36456 36457 template< 36458 typename ``[link boost_asio.reference.Protocol Protocol]``, 36459 typename ``[link boost_asio.reference.Executor1 Executor]``> 36460 class basic_socket_acceptor : 36461 public socket_base 36462 36463 36464[heading Types] 36465[table 36466 [[Name][Description]] 36467 36468 [ 36469 36470 [[link boost_asio.reference.basic_socket_acceptor__rebind_executor [*rebind_executor]]] 36471 [Rebinds the acceptor type to another executor. ] 36472 36473 ] 36474 36475 [ 36476 36477 [[link boost_asio.reference.basic_socket_acceptor.broadcast [*broadcast]]] 36478 [Socket option to permit sending of broadcast messages. ] 36479 36480 ] 36481 36482 [ 36483 36484 [[link boost_asio.reference.basic_socket_acceptor.bytes_readable [*bytes_readable]]] 36485 [IO control command to get the amount of data that can be read without blocking. ] 36486 36487 ] 36488 36489 [ 36490 36491 [[link boost_asio.reference.basic_socket_acceptor.debug [*debug]]] 36492 [Socket option to enable socket-level debugging. ] 36493 36494 ] 36495 36496 [ 36497 36498 [[link boost_asio.reference.basic_socket_acceptor.do_not_route [*do_not_route]]] 36499 [Socket option to prevent routing, use local interfaces only. ] 36500 36501 ] 36502 36503 [ 36504 36505 [[link boost_asio.reference.basic_socket_acceptor.enable_connection_aborted [*enable_connection_aborted]]] 36506 [Socket option to report aborted connections on accept. ] 36507 36508 ] 36509 36510 [ 36511 36512 [[link boost_asio.reference.basic_socket_acceptor.endpoint_type [*endpoint_type]]] 36513 [The endpoint type. ] 36514 36515 ] 36516 36517 [ 36518 36519 [[link boost_asio.reference.basic_socket_acceptor.executor_type [*executor_type]]] 36520 [The type of the executor associated with the object. ] 36521 36522 ] 36523 36524 [ 36525 36526 [[link boost_asio.reference.basic_socket_acceptor.keep_alive [*keep_alive]]] 36527 [Socket option to send keep-alives. ] 36528 36529 ] 36530 36531 [ 36532 36533 [[link boost_asio.reference.basic_socket_acceptor.linger [*linger]]] 36534 [Socket option to specify whether the socket lingers on close if unsent data is present. ] 36535 36536 ] 36537 36538 [ 36539 36540 [[link boost_asio.reference.basic_socket_acceptor.message_flags [*message_flags]]] 36541 [Bitmask type for flags that can be passed to send and receive operations. ] 36542 36543 ] 36544 36545 [ 36546 36547 [[link boost_asio.reference.basic_socket_acceptor.native_handle_type [*native_handle_type]]] 36548 [The native representation of an acceptor. ] 36549 36550 ] 36551 36552 [ 36553 36554 [[link boost_asio.reference.basic_socket_acceptor.out_of_band_inline [*out_of_band_inline]]] 36555 [Socket option for putting received out-of-band data inline. ] 36556 36557 ] 36558 36559 [ 36560 36561 [[link boost_asio.reference.basic_socket_acceptor.protocol_type [*protocol_type]]] 36562 [The protocol type. ] 36563 36564 ] 36565 36566 [ 36567 36568 [[link boost_asio.reference.basic_socket_acceptor.receive_buffer_size [*receive_buffer_size]]] 36569 [Socket option for the receive buffer size of a socket. ] 36570 36571 ] 36572 36573 [ 36574 36575 [[link boost_asio.reference.basic_socket_acceptor.receive_low_watermark [*receive_low_watermark]]] 36576 [Socket option for the receive low watermark. ] 36577 36578 ] 36579 36580 [ 36581 36582 [[link boost_asio.reference.basic_socket_acceptor.reuse_address [*reuse_address]]] 36583 [Socket option to allow the socket to be bound to an address that is already in use. ] 36584 36585 ] 36586 36587 [ 36588 36589 [[link boost_asio.reference.basic_socket_acceptor.send_buffer_size [*send_buffer_size]]] 36590 [Socket option for the send buffer size of a socket. ] 36591 36592 ] 36593 36594 [ 36595 36596 [[link boost_asio.reference.basic_socket_acceptor.send_low_watermark [*send_low_watermark]]] 36597 [Socket option for the send low watermark. ] 36598 36599 ] 36600 36601 [ 36602 36603 [[link boost_asio.reference.basic_socket_acceptor.shutdown_type [*shutdown_type]]] 36604 [Different ways a socket may be shutdown. ] 36605 36606 ] 36607 36608 [ 36609 36610 [[link boost_asio.reference.basic_socket_acceptor.wait_type [*wait_type]]] 36611 [Wait types. ] 36612 36613 ] 36614 36615] 36616 36617[heading Member Functions] 36618[table 36619 [[Name][Description]] 36620 36621 [ 36622 [[link boost_asio.reference.basic_socket_acceptor.accept [*accept]]] 36623 [Accept a new connection. 36624 [hr] 36625 Accept a new connection and obtain the endpoint of the peer. ] 36626 ] 36627 36628 [ 36629 [[link boost_asio.reference.basic_socket_acceptor.assign [*assign]]] 36630 [Assigns an existing native acceptor to the acceptor. ] 36631 ] 36632 36633 [ 36634 [[link boost_asio.reference.basic_socket_acceptor.async_accept [*async_accept]]] 36635 [Start an asynchronous accept. ] 36636 ] 36637 36638 [ 36639 [[link boost_asio.reference.basic_socket_acceptor.async_wait [*async_wait]]] 36640 [Asynchronously wait for the acceptor to become ready to read, ready to write, or to have pending error conditions. ] 36641 ] 36642 36643 [ 36644 [[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor [*basic_socket_acceptor]] [constructor]] 36645 [Construct an acceptor without opening it. 36646 [hr] 36647 Construct an open acceptor. 36648 [hr] 36649 Construct an acceptor opened on the given endpoint. 36650 [hr] 36651 Construct a basic_socket_acceptor on an existing native acceptor. 36652 [hr] 36653 Move-construct a basic_socket_acceptor from another. 36654 [hr] 36655 Move-construct a basic_socket_acceptor from an acceptor of another protocol type. ] 36656 ] 36657 36658 [ 36659 [[link boost_asio.reference.basic_socket_acceptor.bind [*bind]]] 36660 [Bind the acceptor to the given local endpoint. ] 36661 ] 36662 36663 [ 36664 [[link boost_asio.reference.basic_socket_acceptor.cancel [*cancel]]] 36665 [Cancel all asynchronous operations associated with the acceptor. ] 36666 ] 36667 36668 [ 36669 [[link boost_asio.reference.basic_socket_acceptor.close [*close]]] 36670 [Close the acceptor. ] 36671 ] 36672 36673 [ 36674 [[link boost_asio.reference.basic_socket_acceptor.get_executor [*get_executor]]] 36675 [Get the executor associated with the object. ] 36676 ] 36677 36678 [ 36679 [[link boost_asio.reference.basic_socket_acceptor.get_option [*get_option]]] 36680 [Get an option from the acceptor. ] 36681 ] 36682 36683 [ 36684 [[link boost_asio.reference.basic_socket_acceptor.io_control [*io_control]]] 36685 [Perform an IO control command on the acceptor. ] 36686 ] 36687 36688 [ 36689 [[link boost_asio.reference.basic_socket_acceptor.is_open [*is_open]]] 36690 [Determine whether the acceptor is open. ] 36691 ] 36692 36693 [ 36694 [[link boost_asio.reference.basic_socket_acceptor.listen [*listen]]] 36695 [Place the acceptor into the state where it will listen for new connections. ] 36696 ] 36697 36698 [ 36699 [[link boost_asio.reference.basic_socket_acceptor.local_endpoint [*local_endpoint]]] 36700 [Get the local endpoint of the acceptor. ] 36701 ] 36702 36703 [ 36704 [[link boost_asio.reference.basic_socket_acceptor.native_handle [*native_handle]]] 36705 [Get the native acceptor representation. ] 36706 ] 36707 36708 [ 36709 [[link boost_asio.reference.basic_socket_acceptor.native_non_blocking [*native_non_blocking]]] 36710 [Gets the non-blocking mode of the native acceptor implementation. 36711 [hr] 36712 Sets the non-blocking mode of the native acceptor implementation. ] 36713 ] 36714 36715 [ 36716 [[link boost_asio.reference.basic_socket_acceptor.non_blocking [*non_blocking]]] 36717 [Gets the non-blocking mode of the acceptor. 36718 [hr] 36719 Sets the non-blocking mode of the acceptor. ] 36720 ] 36721 36722 [ 36723 [[link boost_asio.reference.basic_socket_acceptor.open [*open]]] 36724 [Open the acceptor using the specified protocol. ] 36725 ] 36726 36727 [ 36728 [[link boost_asio.reference.basic_socket_acceptor.operator_eq_ [*operator=]]] 36729 [Move-assign a basic_socket_acceptor from another. 36730 [hr] 36731 Move-assign a basic_socket_acceptor from an acceptor of another protocol type. ] 36732 ] 36733 36734 [ 36735 [[link boost_asio.reference.basic_socket_acceptor.release [*release]]] 36736 [Release ownership of the underlying native acceptor. ] 36737 ] 36738 36739 [ 36740 [[link boost_asio.reference.basic_socket_acceptor.set_option [*set_option]]] 36741 [Set an option on the acceptor. ] 36742 ] 36743 36744 [ 36745 [[link boost_asio.reference.basic_socket_acceptor.wait [*wait]]] 36746 [Wait for the acceptor to become ready to read, ready to write, or to have pending error conditions. ] 36747 ] 36748 36749 [ 36750 [[link boost_asio.reference.basic_socket_acceptor._basic_socket_acceptor [*~basic_socket_acceptor]] [destructor]] 36751 [Destroys the acceptor. ] 36752 ] 36753 36754] 36755 36756[heading Data Members] 36757[table 36758 [[Name][Description]] 36759 36760 [ 36761 [[link boost_asio.reference.basic_socket_acceptor.max_connections [*max_connections]] [static]] 36762 [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ] 36763 ] 36764 36765 [ 36766 [[link boost_asio.reference.basic_socket_acceptor.max_listen_connections [*max_listen_connections]] [static]] 36767 [The maximum length of the queue of pending incoming connections. ] 36768 ] 36769 36770 [ 36771 [[link boost_asio.reference.basic_socket_acceptor.message_do_not_route [*message_do_not_route]] [static]] 36772 [Specify that the data should not be subject to routing. ] 36773 ] 36774 36775 [ 36776 [[link boost_asio.reference.basic_socket_acceptor.message_end_of_record [*message_end_of_record]] [static]] 36777 [Specifies that the data marks the end of a record. ] 36778 ] 36779 36780 [ 36781 [[link boost_asio.reference.basic_socket_acceptor.message_out_of_band [*message_out_of_band]] [static]] 36782 [Process out-of-band data. ] 36783 ] 36784 36785 [ 36786 [[link boost_asio.reference.basic_socket_acceptor.message_peek [*message_peek]] [static]] 36787 [Peek at incoming data without removing it from the input queue. ] 36788 ] 36789 36790] 36791 36792The [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] class template is used for accepting new socket connections. 36793 36794 36795[heading Thread Safety] 36796 36797['Distinct] ['objects:] Safe. 36798 36799['Shared] ['objects:] Unsafe. 36800 36801Synchronous `accept` operations are thread safe, if the underlying operating system calls are also thread safe. This means that it is permitted to perform concurrent calls to synchronous `accept` operations on a single socket object. Other synchronous operations, such as `open` or `close`, are not thread safe. 36802 36803 36804[heading Example] 36805 36806Opening a socket acceptor with the SO\_REUSEADDR option enabled: 36807 36808 boost::asio::ip::tcp::acceptor acceptor(my_context); 36809 boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), port); 36810 acceptor.open(endpoint.protocol()); 36811 acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true)); 36812 acceptor.bind(endpoint); 36813 acceptor.listen(); 36814 36815 36816 36817 36818 36819 36820[heading Requirements] 36821 36822['Header: ][^boost/asio/basic_socket_acceptor.hpp] 36823 36824['Convenience header: ][^boost/asio.hpp] 36825 36826[section:accept basic_socket_acceptor::accept] 36827 36828[indexterm2 boost_asio.indexterm.basic_socket_acceptor.accept..accept..basic_socket_acceptor] 36829Accept a new connection. 36830 36831 36832 template< 36833 typename ``[link boost_asio.reference.Protocol Protocol1]``, 36834 typename ``[link boost_asio.reference.Executor1 Executor1]``> 36835 void ``[link boost_asio.reference.basic_socket_acceptor.accept.overload1 accept]``( 36836 basic_socket< Protocol1, Executor1 > & peer, 36837 typename constraint< is_convertible< Protocol, Protocol1 >::value >::type = 0); 36838 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.accept.overload1 more...]]`` 36839 36840 template< 36841 typename ``[link boost_asio.reference.Protocol Protocol1]``, 36842 typename ``[link boost_asio.reference.Executor1 Executor1]``> 36843 void ``[link boost_asio.reference.basic_socket_acceptor.accept.overload2 accept]``( 36844 basic_socket< Protocol1, Executor1 > & peer, 36845 boost::system::error_code & ec, 36846 typename constraint< is_convertible< Protocol, Protocol1 >::value >::type = 0); 36847 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.accept.overload2 more...]]`` 36848 36849 36850Accept a new connection and obtain the endpoint of the peer. 36851 36852 36853 template< 36854 typename ``[link boost_asio.reference.Executor1 Executor1]``> 36855 void ``[link boost_asio.reference.basic_socket_acceptor.accept.overload3 accept]``( 36856 basic_socket< protocol_type, Executor1 > & peer, 36857 endpoint_type & peer_endpoint); 36858 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.accept.overload3 more...]]`` 36859 36860 template< 36861 typename ``[link boost_asio.reference.Executor1 Executor1]``> 36862 void ``[link boost_asio.reference.basic_socket_acceptor.accept.overload4 accept]``( 36863 basic_socket< protocol_type, Executor1 > & peer, 36864 endpoint_type & peer_endpoint, 36865 boost::system::error_code & ec); 36866 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.accept.overload4 more...]]`` 36867 36868 Protocol::socket::template rebind_executor< executor_type >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload5 accept]``(); 36869 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.accept.overload5 more...]]`` 36870 36871 Protocol::socket::template rebind_executor< executor_type >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload6 accept]``( 36872 boost::system::error_code & ec); 36873 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.accept.overload6 more...]]`` 36874 36875 template< 36876 typename ``[link boost_asio.reference.Executor1 Executor1]``> 36877 Protocol::socket::template rebind_executor< Executor1 >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload7 accept]``( 36878 const Executor1 & ex, 36879 typename constraint< is_executor< Executor1 >::value||execution::is_executor< Executor1 >::value >::type = 0); 36880 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.accept.overload7 more...]]`` 36881 36882 template< 36883 typename ExecutionContext> 36884 Protocol::socket::template rebind_executor< typename ExecutionContext::executor_type >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload8 accept]``( 36885 ExecutionContext & context, 36886 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 36887 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.accept.overload8 more...]]`` 36888 36889 template< 36890 typename ``[link boost_asio.reference.Executor1 Executor1]``> 36891 Protocol::socket::template rebind_executor< Executor1 >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload9 accept]``( 36892 const Executor1 & ex, 36893 boost::system::error_code & ec, 36894 typename constraint< is_executor< Executor1 >::value||execution::is_executor< Executor1 >::value >::type = 0); 36895 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.accept.overload9 more...]]`` 36896 36897 template< 36898 typename ExecutionContext> 36899 Protocol::socket::template rebind_executor< typename ExecutionContext::executor_type >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload10 accept]``( 36900 ExecutionContext & context, 36901 boost::system::error_code & ec, 36902 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 36903 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.accept.overload10 more...]]`` 36904 36905 Protocol::socket::template rebind_executor< executor_type >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload11 accept]``( 36906 endpoint_type & peer_endpoint); 36907 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.accept.overload11 more...]]`` 36908 36909 Protocol::socket::template rebind_executor< executor_type >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload12 accept]``( 36910 endpoint_type & peer_endpoint, 36911 boost::system::error_code & ec); 36912 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.accept.overload12 more...]]`` 36913 36914 template< 36915 typename ``[link boost_asio.reference.Executor1 Executor1]``> 36916 Protocol::socket::template rebind_executor< Executor1 >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload13 accept]``( 36917 const Executor1 & ex, 36918 endpoint_type & peer_endpoint, 36919 typename constraint< is_executor< Executor1 >::value||execution::is_executor< Executor1 >::value >::type = 0); 36920 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.accept.overload13 more...]]`` 36921 36922 template< 36923 typename ExecutionContext> 36924 Protocol::socket::template rebind_executor< typename ExecutionContext::executor_type >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload14 accept]``( 36925 ExecutionContext & context, 36926 endpoint_type & peer_endpoint, 36927 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 36928 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.accept.overload14 more...]]`` 36929 36930 template< 36931 typename ``[link boost_asio.reference.Executor1 Executor1]``> 36932 Protocol::socket::template rebind_executor< Executor1 >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload15 accept]``( 36933 const executor_type & ex, 36934 endpoint_type & peer_endpoint, 36935 boost::system::error_code & ec, 36936 typename constraint< is_executor< Executor1 >::value||execution::is_executor< Executor1 >::value >::type = 0); 36937 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.accept.overload15 more...]]`` 36938 36939 template< 36940 typename ExecutionContext> 36941 Protocol::socket::template rebind_executor< typename ExecutionContext::executor_type >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload16 accept]``( 36942 ExecutionContext & context, 36943 endpoint_type & peer_endpoint, 36944 boost::system::error_code & ec, 36945 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 36946 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.accept.overload16 more...]]`` 36947 36948 36949[section:overload1 basic_socket_acceptor::accept (1 of 16 overloads)] 36950 36951 36952Accept a new connection. 36953 36954 36955 template< 36956 typename ``[link boost_asio.reference.Protocol Protocol1]``, 36957 typename ``[link boost_asio.reference.Executor1 Executor1]``> 36958 void accept( 36959 basic_socket< Protocol1, Executor1 > & peer, 36960 typename constraint< is_convertible< Protocol, Protocol1 >::value >::type = 0); 36961 36962 36963This 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. 36964 36965 36966[heading Parameters] 36967 36968 36969[variablelist 36970 36971[[peer][The socket into which the new connection will be accepted.]] 36972 36973] 36974 36975 36976[heading Exceptions] 36977 36978 36979[variablelist 36980 36981[[boost::system::system_error][Thrown on failure.]] 36982 36983] 36984 36985 36986[heading Example] 36987 36988 36989 36990 boost::asio::ip::tcp::acceptor acceptor(my_context); 36991 ... 36992 boost::asio::ip::tcp::socket socket(my_context); 36993 acceptor.accept(socket); 36994 36995 36996 36997 36998 36999 37000 37001[endsect] 37002 37003 37004 37005[section:overload2 basic_socket_acceptor::accept (2 of 16 overloads)] 37006 37007 37008Accept a new connection. 37009 37010 37011 template< 37012 typename ``[link boost_asio.reference.Protocol Protocol1]``, 37013 typename ``[link boost_asio.reference.Executor1 Executor1]``> 37014 void accept( 37015 basic_socket< Protocol1, Executor1 > & peer, 37016 boost::system::error_code & ec, 37017 typename constraint< is_convertible< Protocol, Protocol1 >::value >::type = 0); 37018 37019 37020This 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. 37021 37022 37023[heading Parameters] 37024 37025 37026[variablelist 37027 37028[[peer][The socket into which the new connection will be accepted.]] 37029 37030[[ec][Set to indicate what error occurred, if any.]] 37031 37032] 37033 37034 37035[heading Example] 37036 37037 37038 37039 boost::asio::ip::tcp::acceptor acceptor(my_context); 37040 ... 37041 boost::asio::ip::tcp::socket socket(my_context); 37042 boost::system::error_code ec; 37043 acceptor.accept(socket, ec); 37044 if (ec) 37045 { 37046 // An error occurred. 37047 } 37048 37049 37050 37051 37052 37053 37054 37055[endsect] 37056 37057 37058 37059[section:overload3 basic_socket_acceptor::accept (3 of 16 overloads)] 37060 37061 37062Accept a new connection and obtain the endpoint of the peer. 37063 37064 37065 template< 37066 typename ``[link boost_asio.reference.Executor1 Executor1]``> 37067 void accept( 37068 basic_socket< protocol_type, Executor1 > & peer, 37069 endpoint_type & peer_endpoint); 37070 37071 37072This 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. 37073 37074 37075[heading Parameters] 37076 37077 37078[variablelist 37079 37080[[peer][The socket into which the new connection will be accepted.]] 37081 37082[[peer_endpoint][An endpoint object which will receive the endpoint of the remote peer.]] 37083 37084] 37085 37086 37087[heading Exceptions] 37088 37089 37090[variablelist 37091 37092[[boost::system::system_error][Thrown on failure.]] 37093 37094] 37095 37096 37097[heading Example] 37098 37099 37100 37101 boost::asio::ip::tcp::acceptor acceptor(my_context); 37102 ... 37103 boost::asio::ip::tcp::socket socket(my_context); 37104 boost::asio::ip::tcp::endpoint endpoint; 37105 acceptor.accept(socket, endpoint); 37106 37107 37108 37109 37110 37111 37112 37113[endsect] 37114 37115 37116 37117[section:overload4 basic_socket_acceptor::accept (4 of 16 overloads)] 37118 37119 37120Accept a new connection and obtain the endpoint of the peer. 37121 37122 37123 template< 37124 typename ``[link boost_asio.reference.Executor1 Executor1]``> 37125 void accept( 37126 basic_socket< protocol_type, Executor1 > & peer, 37127 endpoint_type & peer_endpoint, 37128 boost::system::error_code & ec); 37129 37130 37131This 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. 37132 37133 37134[heading Parameters] 37135 37136 37137[variablelist 37138 37139[[peer][The socket into which the new connection will be accepted.]] 37140 37141[[peer_endpoint][An endpoint object which will receive the endpoint of the remote peer.]] 37142 37143[[ec][Set to indicate what error occurred, if any.]] 37144 37145] 37146 37147 37148[heading Example] 37149 37150 37151 37152 boost::asio::ip::tcp::acceptor acceptor(my_context); 37153 ... 37154 boost::asio::ip::tcp::socket socket(my_context); 37155 boost::asio::ip::tcp::endpoint endpoint; 37156 boost::system::error_code ec; 37157 acceptor.accept(socket, endpoint, ec); 37158 if (ec) 37159 { 37160 // An error occurred. 37161 } 37162 37163 37164 37165 37166 37167 37168 37169[endsect] 37170 37171 37172 37173[section:overload5 basic_socket_acceptor::accept (5 of 16 overloads)] 37174 37175 37176Accept a new connection. 37177 37178 37179 Protocol::socket::template rebind_executor< executor_type >::other accept(); 37180 37181 37182This 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. 37183 37184This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements. 37185 37186 37187[heading Return Value] 37188 37189A socket object representing the newly accepted connection. 37190 37191 37192[heading Exceptions] 37193 37194 37195[variablelist 37196 37197[[boost::system::system_error][Thrown on failure.]] 37198 37199] 37200 37201 37202[heading Example] 37203 37204 37205 37206 boost::asio::ip::tcp::acceptor acceptor(my_context); 37207 ... 37208 boost::asio::ip::tcp::socket socket(acceptor.accept()); 37209 37210 37211 37212 37213 37214 37215 37216[endsect] 37217 37218 37219 37220[section:overload6 basic_socket_acceptor::accept (6 of 16 overloads)] 37221 37222 37223Accept a new connection. 37224 37225 37226 Protocol::socket::template rebind_executor< executor_type >::other accept( 37227 boost::system::error_code & ec); 37228 37229 37230This 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. 37231 37232This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements. 37233 37234 37235[heading Parameters] 37236 37237 37238[variablelist 37239 37240[[ec][Set to indicate what error occurred, if any.]] 37241 37242] 37243 37244 37245[heading Return Value] 37246 37247On success, a socket object representing the newly accepted connection. On error, a socket object where `is_open()` is false. 37248 37249 37250[heading Example] 37251 37252 37253 37254 boost::asio::ip::tcp::acceptor acceptor(my_context); 37255 ... 37256 boost::asio::ip::tcp::socket socket(acceptor.accept(ec)); 37257 if (ec) 37258 { 37259 // An error occurred. 37260 } 37261 37262 37263 37264 37265 37266 37267 37268[endsect] 37269 37270 37271 37272[section:overload7 basic_socket_acceptor::accept (7 of 16 overloads)] 37273 37274 37275Accept a new connection. 37276 37277 37278 template< 37279 typename ``[link boost_asio.reference.Executor1 Executor1]``> 37280 Protocol::socket::template rebind_executor< Executor1 >::other accept( 37281 const Executor1 & ex, 37282 typename constraint< is_executor< Executor1 >::value||execution::is_executor< Executor1 >::value >::type = 0); 37283 37284 37285This 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. 37286 37287This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements. 37288 37289 37290[heading Parameters] 37291 37292 37293[variablelist 37294 37295[[ex][The I/O executor object to be used for the newly accepted socket.]] 37296 37297] 37298 37299 37300[heading Return Value] 37301 37302A socket object representing the newly accepted connection. 37303 37304 37305[heading Exceptions] 37306 37307 37308[variablelist 37309 37310[[boost::system::system_error][Thrown on failure.]] 37311 37312] 37313 37314 37315[heading Example] 37316 37317 37318 37319 boost::asio::ip::tcp::acceptor acceptor(my_context); 37320 ... 37321 boost::asio::ip::tcp::socket socket(acceptor.accept()); 37322 37323 37324 37325 37326 37327 37328 37329[endsect] 37330 37331 37332 37333[section:overload8 basic_socket_acceptor::accept (8 of 16 overloads)] 37334 37335 37336Accept a new connection. 37337 37338 37339 template< 37340 typename ExecutionContext> 37341 Protocol::socket::template rebind_executor< typename ExecutionContext::executor_type >::other accept( 37342 ExecutionContext & context, 37343 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 37344 37345 37346This 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. 37347 37348This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements. 37349 37350 37351[heading Parameters] 37352 37353 37354[variablelist 37355 37356[[context][The I/O execution context object to be used for the newly accepted socket.]] 37357 37358] 37359 37360 37361[heading Return Value] 37362 37363A socket object representing the newly accepted connection. 37364 37365 37366[heading Exceptions] 37367 37368 37369[variablelist 37370 37371[[boost::system::system_error][Thrown on failure.]] 37372 37373] 37374 37375 37376[heading Example] 37377 37378 37379 37380 boost::asio::ip::tcp::acceptor acceptor(my_context); 37381 ... 37382 boost::asio::ip::tcp::socket socket(acceptor.accept()); 37383 37384 37385 37386 37387 37388 37389 37390[endsect] 37391 37392 37393 37394[section:overload9 basic_socket_acceptor::accept (9 of 16 overloads)] 37395 37396 37397Accept a new connection. 37398 37399 37400 template< 37401 typename ``[link boost_asio.reference.Executor1 Executor1]``> 37402 Protocol::socket::template rebind_executor< Executor1 >::other accept( 37403 const Executor1 & ex, 37404 boost::system::error_code & ec, 37405 typename constraint< is_executor< Executor1 >::value||execution::is_executor< Executor1 >::value >::type = 0); 37406 37407 37408This 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. 37409 37410This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements. 37411 37412 37413[heading Parameters] 37414 37415 37416[variablelist 37417 37418[[ex][The I/O executor object to be used for the newly accepted socket.]] 37419 37420[[ec][Set to indicate what error occurred, if any.]] 37421 37422] 37423 37424 37425[heading Return Value] 37426 37427On success, a socket object representing the newly accepted connection. On error, a socket object where `is_open()` is false. 37428 37429 37430[heading Example] 37431 37432 37433 37434 boost::asio::ip::tcp::acceptor acceptor(my_context); 37435 ... 37436 boost::asio::ip::tcp::socket socket(acceptor.accept(my_context2, ec)); 37437 if (ec) 37438 { 37439 // An error occurred. 37440 } 37441 37442 37443 37444 37445 37446 37447 37448[endsect] 37449 37450 37451 37452[section:overload10 basic_socket_acceptor::accept (10 of 16 overloads)] 37453 37454 37455Accept a new connection. 37456 37457 37458 template< 37459 typename ExecutionContext> 37460 Protocol::socket::template rebind_executor< typename ExecutionContext::executor_type >::other accept( 37461 ExecutionContext & context, 37462 boost::system::error_code & ec, 37463 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 37464 37465 37466This 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. 37467 37468This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements. 37469 37470 37471[heading Parameters] 37472 37473 37474[variablelist 37475 37476[[context][The I/O execution context object to be used for the newly accepted socket.]] 37477 37478[[ec][Set to indicate what error occurred, if any.]] 37479 37480] 37481 37482 37483[heading Return Value] 37484 37485On success, a socket object representing the newly accepted connection. On error, a socket object where `is_open()` is false. 37486 37487 37488[heading Example] 37489 37490 37491 37492 boost::asio::ip::tcp::acceptor acceptor(my_context); 37493 ... 37494 boost::asio::ip::tcp::socket socket(acceptor.accept(my_context2, ec)); 37495 if (ec) 37496 { 37497 // An error occurred. 37498 } 37499 37500 37501 37502 37503 37504 37505 37506[endsect] 37507 37508 37509 37510[section:overload11 basic_socket_acceptor::accept (11 of 16 overloads)] 37511 37512 37513Accept a new connection. 37514 37515 37516 Protocol::socket::template rebind_executor< executor_type >::other accept( 37517 endpoint_type & peer_endpoint); 37518 37519 37520This 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. 37521 37522This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements. 37523 37524 37525[heading Parameters] 37526 37527 37528[variablelist 37529 37530[[peer_endpoint][An endpoint object into which the endpoint of the remote peer will be written.]] 37531 37532] 37533 37534 37535[heading Return Value] 37536 37537A socket object representing the newly accepted connection. 37538 37539 37540[heading Exceptions] 37541 37542 37543[variablelist 37544 37545[[boost::system::system_error][Thrown on failure.]] 37546 37547] 37548 37549 37550[heading Example] 37551 37552 37553 37554 boost::asio::ip::tcp::acceptor acceptor(my_context); 37555 ... 37556 boost::asio::ip::tcp::endpoint endpoint; 37557 boost::asio::ip::tcp::socket socket(acceptor.accept(endpoint)); 37558 37559 37560 37561 37562 37563 37564 37565[endsect] 37566 37567 37568 37569[section:overload12 basic_socket_acceptor::accept (12 of 16 overloads)] 37570 37571 37572Accept a new connection. 37573 37574 37575 Protocol::socket::template rebind_executor< executor_type >::other accept( 37576 endpoint_type & peer_endpoint, 37577 boost::system::error_code & ec); 37578 37579 37580This 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. 37581 37582This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements. 37583 37584 37585[heading Parameters] 37586 37587 37588[variablelist 37589 37590[[peer_endpoint][An endpoint object into which the endpoint of the remote peer will be written.]] 37591 37592[[ec][Set to indicate what error occurred, if any.]] 37593 37594] 37595 37596 37597[heading Return Value] 37598 37599On success, a socket object representing the newly accepted connection. On error, a socket object where `is_open()` is false. 37600 37601 37602[heading Example] 37603 37604 37605 37606 boost::asio::ip::tcp::acceptor acceptor(my_context); 37607 ... 37608 boost::asio::ip::tcp::endpoint endpoint; 37609 boost::asio::ip::tcp::socket socket(acceptor.accept(endpoint, ec)); 37610 if (ec) 37611 { 37612 // An error occurred. 37613 } 37614 37615 37616 37617 37618 37619 37620 37621[endsect] 37622 37623 37624 37625[section:overload13 basic_socket_acceptor::accept (13 of 16 overloads)] 37626 37627 37628Accept a new connection. 37629 37630 37631 template< 37632 typename ``[link boost_asio.reference.Executor1 Executor1]``> 37633 Protocol::socket::template rebind_executor< Executor1 >::other accept( 37634 const Executor1 & ex, 37635 endpoint_type & peer_endpoint, 37636 typename constraint< is_executor< Executor1 >::value||execution::is_executor< Executor1 >::value >::type = 0); 37637 37638 37639This 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. 37640 37641This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements. 37642 37643 37644[heading Parameters] 37645 37646 37647[variablelist 37648 37649[[ex][The I/O executor object to be used for the newly accepted socket.]] 37650 37651[[peer_endpoint][An endpoint object into which the endpoint of the remote peer will be written.]] 37652 37653] 37654 37655 37656[heading Return Value] 37657 37658A socket object representing the newly accepted connection. 37659 37660 37661[heading Exceptions] 37662 37663 37664[variablelist 37665 37666[[boost::system::system_error][Thrown on failure.]] 37667 37668] 37669 37670 37671[heading Example] 37672 37673 37674 37675 boost::asio::ip::tcp::acceptor acceptor(my_context); 37676 ... 37677 boost::asio::ip::tcp::endpoint endpoint; 37678 boost::asio::ip::tcp::socket socket( 37679 acceptor.accept(my_context2, endpoint)); 37680 37681 37682 37683 37684 37685 37686 37687[endsect] 37688 37689 37690 37691[section:overload14 basic_socket_acceptor::accept (14 of 16 overloads)] 37692 37693 37694Accept a new connection. 37695 37696 37697 template< 37698 typename ExecutionContext> 37699 Protocol::socket::template rebind_executor< typename ExecutionContext::executor_type >::other accept( 37700 ExecutionContext & context, 37701 endpoint_type & peer_endpoint, 37702 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 37703 37704 37705This 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. 37706 37707This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements. 37708 37709 37710[heading Parameters] 37711 37712 37713[variablelist 37714 37715[[context][The I/O execution context object to be used for the newly accepted socket.]] 37716 37717[[peer_endpoint][An endpoint object into which the endpoint of the remote peer will be written.]] 37718 37719] 37720 37721 37722[heading Return Value] 37723 37724A socket object representing the newly accepted connection. 37725 37726 37727[heading Exceptions] 37728 37729 37730[variablelist 37731 37732[[boost::system::system_error][Thrown on failure.]] 37733 37734] 37735 37736 37737[heading Example] 37738 37739 37740 37741 boost::asio::ip::tcp::acceptor acceptor(my_context); 37742 ... 37743 boost::asio::ip::tcp::endpoint endpoint; 37744 boost::asio::ip::tcp::socket socket( 37745 acceptor.accept(my_context2, endpoint)); 37746 37747 37748 37749 37750 37751 37752 37753[endsect] 37754 37755 37756 37757[section:overload15 basic_socket_acceptor::accept (15 of 16 overloads)] 37758 37759 37760Accept a new connection. 37761 37762 37763 template< 37764 typename ``[link boost_asio.reference.Executor1 Executor1]``> 37765 Protocol::socket::template rebind_executor< Executor1 >::other accept( 37766 const executor_type & ex, 37767 endpoint_type & peer_endpoint, 37768 boost::system::error_code & ec, 37769 typename constraint< is_executor< Executor1 >::value||execution::is_executor< Executor1 >::value >::type = 0); 37770 37771 37772This 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. 37773 37774This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements. 37775 37776 37777[heading Parameters] 37778 37779 37780[variablelist 37781 37782[[ex][The I/O executor object to be used for the newly accepted socket.]] 37783 37784[[peer_endpoint][An endpoint object into which the endpoint of the remote peer will be written.]] 37785 37786[[ec][Set to indicate what error occurred, if any.]] 37787 37788] 37789 37790 37791[heading Return Value] 37792 37793On success, a socket object representing the newly accepted connection. On error, a socket object where `is_open()` is false. 37794 37795 37796[heading Example] 37797 37798 37799 37800 boost::asio::ip::tcp::acceptor acceptor(my_context); 37801 ... 37802 boost::asio::ip::tcp::endpoint endpoint; 37803 boost::asio::ip::tcp::socket socket( 37804 acceptor.accept(my_context2, endpoint, ec)); 37805 if (ec) 37806 { 37807 // An error occurred. 37808 } 37809 37810 37811 37812 37813 37814 37815 37816[endsect] 37817 37818 37819 37820[section:overload16 basic_socket_acceptor::accept (16 of 16 overloads)] 37821 37822 37823Accept a new connection. 37824 37825 37826 template< 37827 typename ExecutionContext> 37828 Protocol::socket::template rebind_executor< typename ExecutionContext::executor_type >::other accept( 37829 ExecutionContext & context, 37830 endpoint_type & peer_endpoint, 37831 boost::system::error_code & ec, 37832 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 37833 37834 37835This 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. 37836 37837This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements. 37838 37839 37840[heading Parameters] 37841 37842 37843[variablelist 37844 37845[[context][The I/O execution context object to be used for the newly accepted socket.]] 37846 37847[[peer_endpoint][An endpoint object into which the endpoint of the remote peer will be written.]] 37848 37849[[ec][Set to indicate what error occurred, if any.]] 37850 37851] 37852 37853 37854[heading Return Value] 37855 37856On success, a socket object representing the newly accepted connection. On error, a socket object where `is_open()` is false. 37857 37858 37859[heading Example] 37860 37861 37862 37863 boost::asio::ip::tcp::acceptor acceptor(my_context); 37864 ... 37865 boost::asio::ip::tcp::endpoint endpoint; 37866 boost::asio::ip::tcp::socket socket( 37867 acceptor.accept(my_context2, endpoint, ec)); 37868 if (ec) 37869 { 37870 // An error occurred. 37871 } 37872 37873 37874 37875 37876 37877 37878 37879[endsect] 37880 37881 37882[endsect] 37883 37884[section:assign basic_socket_acceptor::assign] 37885 37886[indexterm2 boost_asio.indexterm.basic_socket_acceptor.assign..assign..basic_socket_acceptor] 37887Assigns an existing native acceptor to the acceptor. 37888 37889 37890 void ``[link boost_asio.reference.basic_socket_acceptor.assign.overload1 assign]``( 37891 const protocol_type & protocol, 37892 const native_handle_type & native_acceptor); 37893 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.assign.overload1 more...]]`` 37894 37895 void ``[link boost_asio.reference.basic_socket_acceptor.assign.overload2 assign]``( 37896 const protocol_type & protocol, 37897 const native_handle_type & native_acceptor, 37898 boost::system::error_code & ec); 37899 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.assign.overload2 more...]]`` 37900 37901 37902[section:overload1 basic_socket_acceptor::assign (1 of 2 overloads)] 37903 37904 37905Assigns an existing native acceptor to the acceptor. 37906 37907 37908 void assign( 37909 const protocol_type & protocol, 37910 const native_handle_type & native_acceptor); 37911 37912 37913 37914[endsect] 37915 37916 37917 37918[section:overload2 basic_socket_acceptor::assign (2 of 2 overloads)] 37919 37920 37921Assigns an existing native acceptor to the acceptor. 37922 37923 37924 void assign( 37925 const protocol_type & protocol, 37926 const native_handle_type & native_acceptor, 37927 boost::system::error_code & ec); 37928 37929 37930 37931[endsect] 37932 37933 37934[endsect] 37935 37936[section:async_accept basic_socket_acceptor::async_accept] 37937 37938[indexterm2 boost_asio.indexterm.basic_socket_acceptor.async_accept..async_accept..basic_socket_acceptor] 37939Start an asynchronous accept. 37940 37941 37942 template< 37943 typename ``[link boost_asio.reference.Protocol Protocol1]``, 37944 typename ``[link boost_asio.reference.Executor1 Executor1]``, 37945 typename ``[link boost_asio.reference.AcceptHandler AcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 37946 ``[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]``( 37947 basic_socket< Protocol1, Executor1 > & peer, 37948 AcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 37949 typename constraint< is_convertible< Protocol, Protocol1 >::value >::type = 0); 37950 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.async_accept.overload1 more...]]`` 37951 37952 template< 37953 typename ``[link boost_asio.reference.Executor1 Executor1]``, 37954 typename ``[link boost_asio.reference.AcceptHandler AcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 37955 ``[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]``( 37956 basic_socket< protocol_type, Executor1 > & peer, 37957 endpoint_type & peer_endpoint, 37958 AcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 37959 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.async_accept.overload2 more...]]`` 37960 37961 template< 37962 typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 37963 ``[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]``( 37964 MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 37965 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.async_accept.overload3 more...]]`` 37966 37967 template< 37968 typename ``[link boost_asio.reference.Executor1 Executor1]``, 37969 typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 37970 ``[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]``( 37971 const Executor1 & ex, 37972 MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 37973 typename constraint< is_executor< Executor1 >::value||execution::is_executor< Executor1 >::value >::type = 0); 37974 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.async_accept.overload4 more...]]`` 37975 37976 template< 37977 typename ExecutionContext, 37978 typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 37979 ``[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]``( 37980 ExecutionContext & context, 37981 MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 37982 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 37983 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.async_accept.overload5 more...]]`` 37984 37985 template< 37986 typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 37987 ``[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]``( 37988 endpoint_type & peer_endpoint, 37989 MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 37990 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.async_accept.overload6 more...]]`` 37991 37992 template< 37993 typename ``[link boost_asio.reference.Executor1 Executor1]``, 37994 typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 37995 ``[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]``( 37996 const Executor1 & ex, 37997 endpoint_type & peer_endpoint, 37998 MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 37999 typename constraint< is_executor< Executor1 >::value||execution::is_executor< Executor1 >::value >::type = 0); 38000 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.async_accept.overload7 more...]]`` 38001 38002 template< 38003 typename ExecutionContext, 38004 typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 38005 ``[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]``( 38006 ExecutionContext & context, 38007 endpoint_type & peer_endpoint, 38008 MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 38009 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 38010 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.async_accept.overload8 more...]]`` 38011 38012 38013[section:overload1 basic_socket_acceptor::async_accept (1 of 8 overloads)] 38014 38015 38016Start an asynchronous accept. 38017 38018 38019 template< 38020 typename ``[link boost_asio.reference.Protocol Protocol1]``, 38021 typename ``[link boost_asio.reference.Executor1 Executor1]``, 38022 typename ``[link boost_asio.reference.AcceptHandler AcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 38023 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_accept( 38024 basic_socket< Protocol1, Executor1 > & peer, 38025 AcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 38026 typename constraint< is_convertible< Protocol, Protocol1 >::value >::type = 0); 38027 38028 38029This function is used to asynchronously accept a new connection into a socket. The function call always returns immediately. 38030 38031 38032[heading Parameters] 38033 38034 38035[variablelist 38036 38037[[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.]] 38038 38039[[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: 38040`` 38041 void handler( 38042 const boost::system::error_code& error // Result of operation. 38043 ); 38044`` 38045Regardless 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`].]] 38046 38047] 38048 38049 38050[heading Example] 38051 38052 38053 38054 void accept_handler(const boost::system::error_code& error) 38055 { 38056 if (!error) 38057 { 38058 // Accept succeeded. 38059 } 38060 } 38061 38062 ... 38063 38064 boost::asio::ip::tcp::acceptor acceptor(my_context); 38065 ... 38066 boost::asio::ip::tcp::socket socket(my_context); 38067 acceptor.async_accept(socket, accept_handler); 38068 38069 38070 38071 38072 38073 38074 38075[endsect] 38076 38077 38078 38079[section:overload2 basic_socket_acceptor::async_accept (2 of 8 overloads)] 38080 38081 38082Start an asynchronous accept. 38083 38084 38085 template< 38086 typename ``[link boost_asio.reference.Executor1 Executor1]``, 38087 typename ``[link boost_asio.reference.AcceptHandler AcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 38088 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_accept( 38089 basic_socket< protocol_type, Executor1 > & peer, 38090 endpoint_type & peer_endpoint, 38091 AcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 38092 38093 38094This 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. 38095 38096 38097[heading Parameters] 38098 38099 38100[variablelist 38101 38102[[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.]] 38103 38104[[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.]] 38105 38106[[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: 38107`` 38108 void handler( 38109 const boost::system::error_code& error // Result of operation. 38110 ); 38111`` 38112Regardless 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`]. ]] 38113 38114] 38115 38116 38117 38118 38119[endsect] 38120 38121 38122 38123[section:overload3 basic_socket_acceptor::async_accept (3 of 8 overloads)] 38124 38125 38126Start an asynchronous accept. 38127 38128 38129 template< 38130 typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 38131 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_accept( 38132 MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 38133 38134 38135This function is used to asynchronously accept a new connection. The function call always returns immediately. 38136 38137This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements. 38138 38139 38140[heading Parameters] 38141 38142 38143[variablelist 38144 38145[[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: 38146`` 38147 void handler( 38148 // Result of operation. 38149 const boost::system::error_code& error, 38150 // On success, the newly accepted socket. 38151 typename Protocol::socket::template 38152 rebind_executor<executor_type>::other peer 38153 ); 38154`` 38155Regardless 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`].]] 38156 38157] 38158 38159 38160[heading Example] 38161 38162 38163 38164 void accept_handler(const boost::system::error_code& error, 38165 boost::asio::ip::tcp::socket peer) 38166 { 38167 if (!error) 38168 { 38169 // Accept succeeded. 38170 } 38171 } 38172 38173 ... 38174 38175 boost::asio::ip::tcp::acceptor acceptor(my_context); 38176 ... 38177 acceptor.async_accept(accept_handler); 38178 38179 38180 38181 38182 38183 38184 38185[endsect] 38186 38187 38188 38189[section:overload4 basic_socket_acceptor::async_accept (4 of 8 overloads)] 38190 38191 38192Start an asynchronous accept. 38193 38194 38195 template< 38196 typename ``[link boost_asio.reference.Executor1 Executor1]``, 38197 typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 38198 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_accept( 38199 const Executor1 & ex, 38200 MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 38201 typename constraint< is_executor< Executor1 >::value||execution::is_executor< Executor1 >::value >::type = 0); 38202 38203 38204This function is used to asynchronously accept a new connection. The function call always returns immediately. 38205 38206This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements. 38207 38208 38209[heading Parameters] 38210 38211 38212[variablelist 38213 38214[[ex][The I/O executor object to be used for the newly accepted socket.]] 38215 38216[[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: 38217`` 38218 void handler( 38219 const boost::system::error_code& error, // Result of operation. 38220 typename Protocol::socket::template rebind_executor< 38221 Executor1>::other peer // On success, the newly accepted socket. 38222 ); 38223`` 38224Regardless 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`].]] 38225 38226] 38227 38228 38229[heading Example] 38230 38231 38232 38233 void accept_handler(const boost::system::error_code& error, 38234 boost::asio::ip::tcp::socket peer) 38235 { 38236 if (!error) 38237 { 38238 // Accept succeeded. 38239 } 38240 } 38241 38242 ... 38243 38244 boost::asio::ip::tcp::acceptor acceptor(my_context); 38245 ... 38246 acceptor.async_accept(my_context2, accept_handler); 38247 38248 38249 38250 38251 38252 38253 38254[endsect] 38255 38256 38257 38258[section:overload5 basic_socket_acceptor::async_accept (5 of 8 overloads)] 38259 38260 38261Start an asynchronous accept. 38262 38263 38264 template< 38265 typename ExecutionContext, 38266 typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 38267 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_accept( 38268 ExecutionContext & context, 38269 MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 38270 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 38271 38272 38273This function is used to asynchronously accept a new connection. The function call always returns immediately. 38274 38275This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements. 38276 38277 38278[heading Parameters] 38279 38280 38281[variablelist 38282 38283[[context][The I/O execution context object to be used for the newly accepted socket.]] 38284 38285[[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: 38286`` 38287 void handler( 38288 const boost::system::error_code& error, // Result of operation. 38289 typename Protocol::socket::template rebind_executor< 38290 typename ExecutionContext::executor_type>::other peer 38291 // On success, the newly accepted socket. 38292 ); 38293`` 38294Regardless 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`].]] 38295 38296] 38297 38298 38299[heading Example] 38300 38301 38302 38303 void accept_handler(const boost::system::error_code& error, 38304 boost::asio::ip::tcp::socket peer) 38305 { 38306 if (!error) 38307 { 38308 // Accept succeeded. 38309 } 38310 } 38311 38312 ... 38313 38314 boost::asio::ip::tcp::acceptor acceptor(my_context); 38315 ... 38316 acceptor.async_accept(my_context2, accept_handler); 38317 38318 38319 38320 38321 38322 38323 38324[endsect] 38325 38326 38327 38328[section:overload6 basic_socket_acceptor::async_accept (6 of 8 overloads)] 38329 38330 38331Start an asynchronous accept. 38332 38333 38334 template< 38335 typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 38336 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_accept( 38337 endpoint_type & peer_endpoint, 38338 MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 38339 38340 38341This function is used to asynchronously accept a new connection. The function call always returns immediately. 38342 38343This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements. 38344 38345 38346[heading Parameters] 38347 38348 38349[variablelist 38350 38351[[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.]] 38352 38353[[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: 38354`` 38355 void handler( 38356 // Result of operation. 38357 const boost::system::error_code& error, 38358 // On success, the newly accepted socket. 38359 typename Protocol::socket::template 38360 rebind_executor<executor_type>::other peer 38361 ); 38362`` 38363Regardless 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`].]] 38364 38365] 38366 38367 38368[heading Example] 38369 38370 38371 38372 void accept_handler(const boost::system::error_code& error, 38373 boost::asio::ip::tcp::socket peer) 38374 { 38375 if (!error) 38376 { 38377 // Accept succeeded. 38378 } 38379 } 38380 38381 ... 38382 38383 boost::asio::ip::tcp::acceptor acceptor(my_context); 38384 ... 38385 boost::asio::ip::tcp::endpoint endpoint; 38386 acceptor.async_accept(endpoint, accept_handler); 38387 38388 38389 38390 38391 38392 38393 38394[endsect] 38395 38396 38397 38398[section:overload7 basic_socket_acceptor::async_accept (7 of 8 overloads)] 38399 38400 38401Start an asynchronous accept. 38402 38403 38404 template< 38405 typename ``[link boost_asio.reference.Executor1 Executor1]``, 38406 typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 38407 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_accept( 38408 const Executor1 & ex, 38409 endpoint_type & peer_endpoint, 38410 MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 38411 typename constraint< is_executor< Executor1 >::value||execution::is_executor< Executor1 >::value >::type = 0); 38412 38413 38414This function is used to asynchronously accept a new connection. The function call always returns immediately. 38415 38416This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements. 38417 38418 38419[heading Parameters] 38420 38421 38422[variablelist 38423 38424[[ex][The I/O executor object to be used for the newly accepted socket.]] 38425 38426[[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.]] 38427 38428[[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: 38429`` 38430 void handler( 38431 const boost::system::error_code& error, // Result of operation. 38432 typename Protocol::socket::template rebind_executor< 38433 Executor1>::other peer // On success, the newly accepted socket. 38434 ); 38435`` 38436Regardless 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`].]] 38437 38438] 38439 38440 38441[heading Example] 38442 38443 38444 38445 void accept_handler(const boost::system::error_code& error, 38446 boost::asio::ip::tcp::socket peer) 38447 { 38448 if (!error) 38449 { 38450 // Accept succeeded. 38451 } 38452 } 38453 38454 ... 38455 38456 boost::asio::ip::tcp::acceptor acceptor(my_context); 38457 ... 38458 boost::asio::ip::tcp::endpoint endpoint; 38459 acceptor.async_accept(my_context2, endpoint, accept_handler); 38460 38461 38462 38463 38464 38465 38466 38467[endsect] 38468 38469 38470 38471[section:overload8 basic_socket_acceptor::async_accept (8 of 8 overloads)] 38472 38473 38474Start an asynchronous accept. 38475 38476 38477 template< 38478 typename ExecutionContext, 38479 typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 38480 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_accept( 38481 ExecutionContext & context, 38482 endpoint_type & peer_endpoint, 38483 MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 38484 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 38485 38486 38487This function is used to asynchronously accept a new connection. The function call always returns immediately. 38488 38489This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements. 38490 38491 38492[heading Parameters] 38493 38494 38495[variablelist 38496 38497[[context][The I/O execution context object to be used for the newly accepted socket.]] 38498 38499[[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.]] 38500 38501[[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: 38502`` 38503 void handler( 38504 const boost::system::error_code& error, // Result of operation. 38505 typename Protocol::socket::template rebind_executor< 38506 typename ExecutionContext::executor_type>::other peer 38507 // On success, the newly accepted socket. 38508 ); 38509`` 38510Regardless 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`].]] 38511 38512] 38513 38514 38515[heading Example] 38516 38517 38518 38519 void accept_handler(const boost::system::error_code& error, 38520 boost::asio::ip::tcp::socket peer) 38521 { 38522 if (!error) 38523 { 38524 // Accept succeeded. 38525 } 38526 } 38527 38528 ... 38529 38530 boost::asio::ip::tcp::acceptor acceptor(my_context); 38531 ... 38532 boost::asio::ip::tcp::endpoint endpoint; 38533 acceptor.async_accept(my_context2, endpoint, accept_handler); 38534 38535 38536 38537 38538 38539 38540 38541[endsect] 38542 38543 38544[endsect] 38545 38546 38547[section:async_wait basic_socket_acceptor::async_wait] 38548 38549[indexterm2 boost_asio.indexterm.basic_socket_acceptor.async_wait..async_wait..basic_socket_acceptor] 38550Asynchronously wait for the acceptor to become ready to read, ready to write, or to have pending error conditions. 38551 38552 38553 template< 38554 typename ``[link boost_asio.reference.WaitHandler WaitHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 38555 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait( 38556 wait_type w, 38557 WaitHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 38558 38559 38560This function is used to perform an asynchronous wait for an acceptor to enter a ready to read, write or error condition state. 38561 38562 38563[heading Parameters] 38564 38565 38566[variablelist 38567 38568[[w][Specifies the desired acceptor state.]] 38569 38570[[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: 38571`` 38572 void handler( 38573 const boost::system::error_code& error // Result of operation 38574 ); 38575`` 38576Regardless 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`].]] 38577 38578] 38579 38580 38581[heading Example] 38582 38583 38584 38585 void wait_handler(const boost::system::error_code& error) 38586 { 38587 if (!error) 38588 { 38589 // Wait succeeded. 38590 } 38591 } 38592 38593 ... 38594 38595 boost::asio::ip::tcp::acceptor acceptor(my_context); 38596 ... 38597 acceptor.async_wait( 38598 boost::asio::ip::tcp::acceptor::wait_read, 38599 wait_handler); 38600 38601 38602 38603 38604 38605 38606 38607[endsect] 38608 38609 38610[section:basic_socket_acceptor basic_socket_acceptor::basic_socket_acceptor] 38611 38612[indexterm2 boost_asio.indexterm.basic_socket_acceptor.basic_socket_acceptor..basic_socket_acceptor..basic_socket_acceptor] 38613Construct an acceptor without opening it. 38614 38615 38616 explicit ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload1 basic_socket_acceptor]``( 38617 const executor_type & ex); 38618 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload1 more...]]`` 38619 38620 template< 38621 typename ExecutionContext> 38622 explicit ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload2 basic_socket_acceptor]``( 38623 ExecutionContext & context, 38624 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 38625 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload2 more...]]`` 38626 38627 38628Construct an open acceptor. 38629 38630 38631 ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload3 basic_socket_acceptor]``( 38632 const executor_type & ex, 38633 const protocol_type & protocol); 38634 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload3 more...]]`` 38635 38636 template< 38637 typename ExecutionContext> 38638 ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload4 basic_socket_acceptor]``( 38639 ExecutionContext & context, 38640 const protocol_type & protocol, 38641 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value, defaulted_constraint >::type = defaulted_constraint()); 38642 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload4 more...]]`` 38643 38644 38645Construct an acceptor opened on the given endpoint. 38646 38647 38648 ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload5 basic_socket_acceptor]``( 38649 const executor_type & ex, 38650 const endpoint_type & endpoint, 38651 bool reuse_addr = true); 38652 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload5 more...]]`` 38653 38654 template< 38655 typename ExecutionContext> 38656 ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload6 basic_socket_acceptor]``( 38657 ExecutionContext & context, 38658 const endpoint_type & endpoint, 38659 bool reuse_addr = true, 38660 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 38661 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload6 more...]]`` 38662 38663 38664Construct a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] on an existing native acceptor. 38665 38666 38667 ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload7 basic_socket_acceptor]``( 38668 const executor_type & ex, 38669 const protocol_type & protocol, 38670 const native_handle_type & native_acceptor); 38671 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload7 more...]]`` 38672 38673 template< 38674 typename ExecutionContext> 38675 ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload8 basic_socket_acceptor]``( 38676 ExecutionContext & context, 38677 const protocol_type & protocol, 38678 const native_handle_type & native_acceptor, 38679 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 38680 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload8 more...]]`` 38681 38682 38683Move-construct a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] from another. 38684 38685 38686 ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload9 basic_socket_acceptor]``( 38687 basic_socket_acceptor && other); 38688 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload9 more...]]`` 38689 38690 38691Move-construct a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] from an acceptor of another protocol type. 38692 38693 38694 template< 38695 typename ``[link boost_asio.reference.Protocol Protocol1]``, 38696 typename ``[link boost_asio.reference.Executor1 Executor1]``> 38697 ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload10 basic_socket_acceptor]``( 38698 basic_socket_acceptor< Protocol1, Executor1 > && other, 38699 typename constraint< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type = 0); 38700 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload10 more...]]`` 38701 38702 38703[section:overload1 basic_socket_acceptor::basic_socket_acceptor (1 of 10 overloads)] 38704 38705 38706Construct an acceptor without opening it. 38707 38708 38709 basic_socket_acceptor( 38710 const executor_type & ex); 38711 38712 38713This 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. 38714 38715 38716[heading Parameters] 38717 38718 38719[variablelist 38720 38721[[ex][The I/O executor that the acceptor will use, by default, to dispatch handlers for any asynchronous operations performed on the acceptor. ]] 38722 38723] 38724 38725 38726 38727 38728[endsect] 38729 38730 38731 38732[section:overload2 basic_socket_acceptor::basic_socket_acceptor (2 of 10 overloads)] 38733 38734 38735Construct an acceptor without opening it. 38736 38737 38738 template< 38739 typename ExecutionContext> 38740 basic_socket_acceptor( 38741 ExecutionContext & context, 38742 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 38743 38744 38745This 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. 38746 38747 38748[heading Parameters] 38749 38750 38751[variablelist 38752 38753[[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. ]] 38754 38755] 38756 38757 38758 38759 38760[endsect] 38761 38762 38763 38764[section:overload3 basic_socket_acceptor::basic_socket_acceptor (3 of 10 overloads)] 38765 38766 38767Construct an open acceptor. 38768 38769 38770 basic_socket_acceptor( 38771 const executor_type & ex, 38772 const protocol_type & protocol); 38773 38774 38775This constructor creates an acceptor and automatically opens it. 38776 38777 38778[heading Parameters] 38779 38780 38781[variablelist 38782 38783[[ex][The I/O executor that the acceptor will use, by default, to dispatch handlers for any asynchronous operations performed on the acceptor.]] 38784 38785[[protocol][An object specifying protocol parameters to be used.]] 38786 38787] 38788 38789 38790[heading Exceptions] 38791 38792 38793[variablelist 38794 38795[[boost::system::system_error][Thrown on failure. ]] 38796 38797] 38798 38799 38800 38801 38802[endsect] 38803 38804 38805 38806[section:overload4 basic_socket_acceptor::basic_socket_acceptor (4 of 10 overloads)] 38807 38808 38809Construct an open acceptor. 38810 38811 38812 template< 38813 typename ExecutionContext> 38814 basic_socket_acceptor( 38815 ExecutionContext & context, 38816 const protocol_type & protocol, 38817 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value, defaulted_constraint >::type = defaulted_constraint()); 38818 38819 38820This constructor creates an acceptor and automatically opens it. 38821 38822 38823[heading Parameters] 38824 38825 38826[variablelist 38827 38828[[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.]] 38829 38830[[protocol][An object specifying protocol parameters to be used.]] 38831 38832] 38833 38834 38835[heading Exceptions] 38836 38837 38838[variablelist 38839 38840[[boost::system::system_error][Thrown on failure. ]] 38841 38842] 38843 38844 38845 38846 38847[endsect] 38848 38849 38850 38851[section:overload5 basic_socket_acceptor::basic_socket_acceptor (5 of 10 overloads)] 38852 38853 38854Construct an acceptor opened on the given endpoint. 38855 38856 38857 basic_socket_acceptor( 38858 const executor_type & ex, 38859 const endpoint_type & endpoint, 38860 bool reuse_addr = true); 38861 38862 38863This constructor creates an acceptor and automatically opens it to listen for new connections on the specified endpoint. 38864 38865 38866[heading Parameters] 38867 38868 38869[variablelist 38870 38871[[ex][The I/O executor that the acceptor will use, by default, to dispatch handlers for any asynchronous operations performed on the acceptor.]] 38872 38873[[endpoint][An endpoint on the local machine on which the acceptor will listen for new connections.]] 38874 38875[[reuse_addr][Whether the constructor should set the socket option `socket_base::reuse_address`.]] 38876 38877] 38878 38879 38880[heading Exceptions] 38881 38882 38883[variablelist 38884 38885[[boost::system::system_error][Thrown on failure.]] 38886 38887] 38888 38889 38890[heading Remarks] 38891 38892This constructor is equivalent to the following code: 38893 38894 basic_socket_acceptor<Protocol> acceptor(my_context); 38895 acceptor.open(endpoint.protocol()); 38896 if (reuse_addr) 38897 acceptor.set_option(socket_base::reuse_address(true)); 38898 acceptor.bind(endpoint); 38899 acceptor.listen(); 38900 38901 38902 38903 38904 38905 38906 38907[endsect] 38908 38909 38910 38911[section:overload6 basic_socket_acceptor::basic_socket_acceptor (6 of 10 overloads)] 38912 38913 38914Construct an acceptor opened on the given endpoint. 38915 38916 38917 template< 38918 typename ExecutionContext> 38919 basic_socket_acceptor( 38920 ExecutionContext & context, 38921 const endpoint_type & endpoint, 38922 bool reuse_addr = true, 38923 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 38924 38925 38926This constructor creates an acceptor and automatically opens it to listen for new connections on the specified endpoint. 38927 38928 38929[heading Parameters] 38930 38931 38932[variablelist 38933 38934[[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.]] 38935 38936[[endpoint][An endpoint on the local machine on which the acceptor will listen for new connections.]] 38937 38938[[reuse_addr][Whether the constructor should set the socket option `socket_base::reuse_address`.]] 38939 38940] 38941 38942 38943[heading Exceptions] 38944 38945 38946[variablelist 38947 38948[[boost::system::system_error][Thrown on failure.]] 38949 38950] 38951 38952 38953[heading Remarks] 38954 38955This constructor is equivalent to the following code: 38956 38957 basic_socket_acceptor<Protocol> acceptor(my_context); 38958 acceptor.open(endpoint.protocol()); 38959 if (reuse_addr) 38960 acceptor.set_option(socket_base::reuse_address(true)); 38961 acceptor.bind(endpoint); 38962 acceptor.listen(); 38963 38964 38965 38966 38967 38968 38969 38970[endsect] 38971 38972 38973 38974[section:overload7 basic_socket_acceptor::basic_socket_acceptor (7 of 10 overloads)] 38975 38976 38977Construct a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] on an existing native acceptor. 38978 38979 38980 basic_socket_acceptor( 38981 const executor_type & ex, 38982 const protocol_type & protocol, 38983 const native_handle_type & native_acceptor); 38984 38985 38986This constructor creates an acceptor object to hold an existing native acceptor. 38987 38988 38989[heading Parameters] 38990 38991 38992[variablelist 38993 38994[[ex][The I/O executor that the acceptor will use, by default, to dispatch handlers for any asynchronous operations performed on the acceptor.]] 38995 38996[[protocol][An object specifying protocol parameters to be used.]] 38997 38998[[native_acceptor][A native acceptor.]] 38999 39000] 39001 39002 39003[heading Exceptions] 39004 39005 39006[variablelist 39007 39008[[boost::system::system_error][Thrown on failure. ]] 39009 39010] 39011 39012 39013 39014 39015[endsect] 39016 39017 39018 39019[section:overload8 basic_socket_acceptor::basic_socket_acceptor (8 of 10 overloads)] 39020 39021 39022Construct a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] on an existing native acceptor. 39023 39024 39025 template< 39026 typename ExecutionContext> 39027 basic_socket_acceptor( 39028 ExecutionContext & context, 39029 const protocol_type & protocol, 39030 const native_handle_type & native_acceptor, 39031 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 39032 39033 39034This constructor creates an acceptor object to hold an existing native acceptor. 39035 39036 39037[heading Parameters] 39038 39039 39040[variablelist 39041 39042[[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.]] 39043 39044[[protocol][An object specifying protocol parameters to be used.]] 39045 39046[[native_acceptor][A native acceptor.]] 39047 39048] 39049 39050 39051[heading Exceptions] 39052 39053 39054[variablelist 39055 39056[[boost::system::system_error][Thrown on failure. ]] 39057 39058] 39059 39060 39061 39062 39063[endsect] 39064 39065 39066 39067[section:overload9 basic_socket_acceptor::basic_socket_acceptor (9 of 10 overloads)] 39068 39069 39070Move-construct a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] from another. 39071 39072 39073 basic_socket_acceptor( 39074 basic_socket_acceptor && other); 39075 39076 39077This constructor moves an acceptor from one object to another. 39078 39079 39080[heading Parameters] 39081 39082 39083[variablelist 39084 39085[[other][The other [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] object from which the move will occur.]] 39086 39087] 39088 39089 39090[heading Remarks] 39091 39092Following the move, the moved-from object is in the same state as if constructed using the `basic_socket_acceptor(const executor_type&)` constructor. 39093 39094 39095 39096 39097[endsect] 39098 39099 39100 39101[section:overload10 basic_socket_acceptor::basic_socket_acceptor (10 of 10 overloads)] 39102 39103 39104Move-construct a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] from an acceptor of another protocol type. 39105 39106 39107 template< 39108 typename ``[link boost_asio.reference.Protocol Protocol1]``, 39109 typename ``[link boost_asio.reference.Executor1 Executor1]``> 39110 basic_socket_acceptor( 39111 basic_socket_acceptor< Protocol1, Executor1 > && other, 39112 typename constraint< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type = 0); 39113 39114 39115This constructor moves an acceptor from one object to another. 39116 39117 39118[heading Parameters] 39119 39120 39121[variablelist 39122 39123[[other][The other [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] object from which the move will occur.]] 39124 39125] 39126 39127 39128[heading Remarks] 39129 39130Following the move, the moved-from object is in the same state as if constructed using the `basic_socket_acceptor(const executor_type&)` constructor. 39131 39132 39133 39134 39135[endsect] 39136 39137 39138[endsect] 39139 39140[section:bind basic_socket_acceptor::bind] 39141 39142[indexterm2 boost_asio.indexterm.basic_socket_acceptor.bind..bind..basic_socket_acceptor] 39143Bind the acceptor to the given local endpoint. 39144 39145 39146 void ``[link boost_asio.reference.basic_socket_acceptor.bind.overload1 bind]``( 39147 const endpoint_type & endpoint); 39148 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.bind.overload1 more...]]`` 39149 39150 void ``[link boost_asio.reference.basic_socket_acceptor.bind.overload2 bind]``( 39151 const endpoint_type & endpoint, 39152 boost::system::error_code & ec); 39153 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.bind.overload2 more...]]`` 39154 39155 39156[section:overload1 basic_socket_acceptor::bind (1 of 2 overloads)] 39157 39158 39159Bind the acceptor to the given local endpoint. 39160 39161 39162 void bind( 39163 const endpoint_type & endpoint); 39164 39165 39166This function binds the socket acceptor to the specified endpoint on the local machine. 39167 39168 39169[heading Parameters] 39170 39171 39172[variablelist 39173 39174[[endpoint][An endpoint on the local machine to which the socket acceptor will be bound.]] 39175 39176] 39177 39178 39179[heading Exceptions] 39180 39181 39182[variablelist 39183 39184[[boost::system::system_error][Thrown on failure.]] 39185 39186] 39187 39188 39189[heading Example] 39190 39191 39192 39193 boost::asio::ip::tcp::acceptor acceptor(my_context); 39194 boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), 12345); 39195 acceptor.open(endpoint.protocol()); 39196 acceptor.bind(endpoint); 39197 39198 39199 39200 39201 39202 39203 39204[endsect] 39205 39206 39207 39208[section:overload2 basic_socket_acceptor::bind (2 of 2 overloads)] 39209 39210 39211Bind the acceptor to the given local endpoint. 39212 39213 39214 void bind( 39215 const endpoint_type & endpoint, 39216 boost::system::error_code & ec); 39217 39218 39219This function binds the socket acceptor to the specified endpoint on the local machine. 39220 39221 39222[heading Parameters] 39223 39224 39225[variablelist 39226 39227[[endpoint][An endpoint on the local machine to which the socket acceptor will be bound.]] 39228 39229[[ec][Set to indicate what error occurred, if any.]] 39230 39231] 39232 39233 39234[heading Example] 39235 39236 39237 39238 boost::asio::ip::tcp::acceptor acceptor(my_context); 39239 boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), 12345); 39240 acceptor.open(endpoint.protocol()); 39241 boost::system::error_code ec; 39242 acceptor.bind(endpoint, ec); 39243 if (ec) 39244 { 39245 // An error occurred. 39246 } 39247 39248 39249 39250 39251 39252 39253 39254[endsect] 39255 39256 39257[endsect] 39258 39259 39260[section:broadcast basic_socket_acceptor::broadcast] 39261 39262 39263['Inherited from socket_base.] 39264 39265[indexterm2 boost_asio.indexterm.basic_socket_acceptor.broadcast..broadcast..basic_socket_acceptor] 39266Socket option to permit sending of broadcast messages. 39267 39268 39269 typedef implementation_defined broadcast; 39270 39271 39272 39273Implements the SOL\_SOCKET/SO\_BROADCAST socket option. 39274 39275 39276[heading Examples] 39277 39278Setting the option: 39279 39280 boost::asio::ip::udp::socket socket(my_context); 39281 ... 39282 boost::asio::socket_base::broadcast option(true); 39283 socket.set_option(option); 39284 39285 39286 39287 39288 39289Getting the current option value: 39290 39291 boost::asio::ip::udp::socket socket(my_context); 39292 ... 39293 boost::asio::socket_base::broadcast option; 39294 socket.get_option(option); 39295 bool is_set = option.value(); 39296 39297 39298 39299 39300 39301 39302 39303[heading Requirements] 39304 39305['Header: ][^boost/asio/basic_socket_acceptor.hpp] 39306 39307['Convenience header: ][^boost/asio.hpp] 39308 39309 39310[endsect] 39311 39312 39313 39314[section:bytes_readable basic_socket_acceptor::bytes_readable] 39315 39316 39317['Inherited from socket_base.] 39318 39319[indexterm2 boost_asio.indexterm.basic_socket_acceptor.bytes_readable..bytes_readable..basic_socket_acceptor] 39320IO control command to get the amount of data that can be read without blocking. 39321 39322 39323 typedef implementation_defined bytes_readable; 39324 39325 39326 39327Implements the FIONREAD IO control command. 39328 39329 39330[heading Example] 39331 39332 39333 39334 boost::asio::ip::tcp::socket socket(my_context); 39335 ... 39336 boost::asio::socket_base::bytes_readable command(true); 39337 socket.io_control(command); 39338 std::size_t bytes_readable = command.get(); 39339 39340 39341 39342 39343 39344 39345 39346[heading Requirements] 39347 39348['Header: ][^boost/asio/basic_socket_acceptor.hpp] 39349 39350['Convenience header: ][^boost/asio.hpp] 39351 39352 39353[endsect] 39354 39355 39356[section:cancel basic_socket_acceptor::cancel] 39357 39358[indexterm2 boost_asio.indexterm.basic_socket_acceptor.cancel..cancel..basic_socket_acceptor] 39359Cancel all asynchronous operations associated with the acceptor. 39360 39361 39362 void ``[link boost_asio.reference.basic_socket_acceptor.cancel.overload1 cancel]``(); 39363 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.cancel.overload1 more...]]`` 39364 39365 void ``[link boost_asio.reference.basic_socket_acceptor.cancel.overload2 cancel]``( 39366 boost::system::error_code & ec); 39367 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.cancel.overload2 more...]]`` 39368 39369 39370[section:overload1 basic_socket_acceptor::cancel (1 of 2 overloads)] 39371 39372 39373Cancel all asynchronous operations associated with the acceptor. 39374 39375 39376 void cancel(); 39377 39378 39379This 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. 39380 39381 39382[heading Exceptions] 39383 39384 39385[variablelist 39386 39387[[boost::system::system_error][Thrown on failure. ]] 39388 39389] 39390 39391 39392 39393 39394[endsect] 39395 39396 39397 39398[section:overload2 basic_socket_acceptor::cancel (2 of 2 overloads)] 39399 39400 39401Cancel all asynchronous operations associated with the acceptor. 39402 39403 39404 void cancel( 39405 boost::system::error_code & ec); 39406 39407 39408This 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. 39409 39410 39411[heading Parameters] 39412 39413 39414[variablelist 39415 39416[[ec][Set to indicate what error occurred, if any. ]] 39417 39418] 39419 39420 39421 39422 39423[endsect] 39424 39425 39426[endsect] 39427 39428[section:close basic_socket_acceptor::close] 39429 39430[indexterm2 boost_asio.indexterm.basic_socket_acceptor.close..close..basic_socket_acceptor] 39431Close the acceptor. 39432 39433 39434 void ``[link boost_asio.reference.basic_socket_acceptor.close.overload1 close]``(); 39435 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.close.overload1 more...]]`` 39436 39437 void ``[link boost_asio.reference.basic_socket_acceptor.close.overload2 close]``( 39438 boost::system::error_code & ec); 39439 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.close.overload2 more...]]`` 39440 39441 39442[section:overload1 basic_socket_acceptor::close (1 of 2 overloads)] 39443 39444 39445Close the acceptor. 39446 39447 39448 void close(); 39449 39450 39451This function is used to close the acceptor. Any asynchronous accept operations will be cancelled immediately. 39452 39453A subsequent call to `open()` is required before the acceptor can again be used to again perform socket accept operations. 39454 39455 39456[heading Exceptions] 39457 39458 39459[variablelist 39460 39461[[boost::system::system_error][Thrown on failure. ]] 39462 39463] 39464 39465 39466 39467 39468[endsect] 39469 39470 39471 39472[section:overload2 basic_socket_acceptor::close (2 of 2 overloads)] 39473 39474 39475Close the acceptor. 39476 39477 39478 void close( 39479 boost::system::error_code & ec); 39480 39481 39482This function is used to close the acceptor. Any asynchronous accept operations will be cancelled immediately. 39483 39484A subsequent call to `open()` is required before the acceptor can again be used to again perform socket accept operations. 39485 39486 39487[heading Parameters] 39488 39489 39490[variablelist 39491 39492[[ec][Set to indicate what error occurred, if any.]] 39493 39494] 39495 39496 39497[heading Example] 39498 39499 39500 39501 boost::asio::ip::tcp::acceptor acceptor(my_context); 39502 ... 39503 boost::system::error_code ec; 39504 acceptor.close(ec); 39505 if (ec) 39506 { 39507 // An error occurred. 39508 } 39509 39510 39511 39512 39513 39514 39515 39516[endsect] 39517 39518 39519[endsect] 39520 39521 39522[section:debug basic_socket_acceptor::debug] 39523 39524 39525['Inherited from socket_base.] 39526 39527[indexterm2 boost_asio.indexterm.basic_socket_acceptor.debug..debug..basic_socket_acceptor] 39528Socket option to enable socket-level debugging. 39529 39530 39531 typedef implementation_defined debug; 39532 39533 39534 39535Implements the SOL\_SOCKET/SO\_DEBUG socket option. 39536 39537 39538[heading Examples] 39539 39540Setting the option: 39541 39542 boost::asio::ip::tcp::socket socket(my_context); 39543 ... 39544 boost::asio::socket_base::debug option(true); 39545 socket.set_option(option); 39546 39547 39548 39549 39550 39551Getting the current option value: 39552 39553 boost::asio::ip::tcp::socket socket(my_context); 39554 ... 39555 boost::asio::socket_base::debug option; 39556 socket.get_option(option); 39557 bool is_set = option.value(); 39558 39559 39560 39561 39562 39563 39564 39565[heading Requirements] 39566 39567['Header: ][^boost/asio/basic_socket_acceptor.hpp] 39568 39569['Convenience header: ][^boost/asio.hpp] 39570 39571 39572[endsect] 39573 39574 39575 39576[section:do_not_route basic_socket_acceptor::do_not_route] 39577 39578 39579['Inherited from socket_base.] 39580 39581[indexterm2 boost_asio.indexterm.basic_socket_acceptor.do_not_route..do_not_route..basic_socket_acceptor] 39582Socket option to prevent routing, use local interfaces only. 39583 39584 39585 typedef implementation_defined do_not_route; 39586 39587 39588 39589Implements the SOL\_SOCKET/SO\_DONTROUTE socket option. 39590 39591 39592[heading Examples] 39593 39594Setting the option: 39595 39596 boost::asio::ip::udp::socket socket(my_context); 39597 ... 39598 boost::asio::socket_base::do_not_route option(true); 39599 socket.set_option(option); 39600 39601 39602 39603 39604 39605Getting the current option value: 39606 39607 boost::asio::ip::udp::socket socket(my_context); 39608 ... 39609 boost::asio::socket_base::do_not_route option; 39610 socket.get_option(option); 39611 bool is_set = option.value(); 39612 39613 39614 39615 39616 39617 39618 39619[heading Requirements] 39620 39621['Header: ][^boost/asio/basic_socket_acceptor.hpp] 39622 39623['Convenience header: ][^boost/asio.hpp] 39624 39625 39626[endsect] 39627 39628 39629 39630[section:enable_connection_aborted basic_socket_acceptor::enable_connection_aborted] 39631 39632 39633['Inherited from socket_base.] 39634 39635[indexterm2 boost_asio.indexterm.basic_socket_acceptor.enable_connection_aborted..enable_connection_aborted..basic_socket_acceptor] 39636Socket option to report aborted connections on accept. 39637 39638 39639 typedef implementation_defined enable_connection_aborted; 39640 39641 39642 39643Implements 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. 39644 39645 39646[heading Examples] 39647 39648Setting the option: 39649 39650 boost::asio::ip::tcp::acceptor acceptor(my_context); 39651 ... 39652 boost::asio::socket_base::enable_connection_aborted option(true); 39653 acceptor.set_option(option); 39654 39655 39656 39657 39658 39659Getting the current option value: 39660 39661 boost::asio::ip::tcp::acceptor acceptor(my_context); 39662 ... 39663 boost::asio::socket_base::enable_connection_aborted option; 39664 acceptor.get_option(option); 39665 bool is_set = option.value(); 39666 39667 39668 39669 39670 39671 39672 39673[heading Requirements] 39674 39675['Header: ][^boost/asio/basic_socket_acceptor.hpp] 39676 39677['Convenience header: ][^boost/asio.hpp] 39678 39679 39680[endsect] 39681 39682 39683 39684[section:endpoint_type basic_socket_acceptor::endpoint_type] 39685 39686[indexterm2 boost_asio.indexterm.basic_socket_acceptor.endpoint_type..endpoint_type..basic_socket_acceptor] 39687The endpoint type. 39688 39689 39690 typedef Protocol::endpoint endpoint_type; 39691 39692 39693 39694[heading Requirements] 39695 39696['Header: ][^boost/asio/basic_socket_acceptor.hpp] 39697 39698['Convenience header: ][^boost/asio.hpp] 39699 39700 39701[endsect] 39702 39703 39704 39705[section:executor_type basic_socket_acceptor::executor_type] 39706 39707[indexterm2 boost_asio.indexterm.basic_socket_acceptor.executor_type..executor_type..basic_socket_acceptor] 39708The type of the executor associated with the object. 39709 39710 39711 typedef Executor executor_type; 39712 39713 39714 39715[heading Requirements] 39716 39717['Header: ][^boost/asio/basic_socket_acceptor.hpp] 39718 39719['Convenience header: ][^boost/asio.hpp] 39720 39721 39722[endsect] 39723 39724 39725 39726[section:get_executor basic_socket_acceptor::get_executor] 39727 39728[indexterm2 boost_asio.indexterm.basic_socket_acceptor.get_executor..get_executor..basic_socket_acceptor] 39729Get the executor associated with the object. 39730 39731 39732 executor_type get_executor(); 39733 39734 39735 39736[endsect] 39737 39738 39739[section:get_option basic_socket_acceptor::get_option] 39740 39741[indexterm2 boost_asio.indexterm.basic_socket_acceptor.get_option..get_option..basic_socket_acceptor] 39742Get an option from the acceptor. 39743 39744 39745 template< 39746 typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``> 39747 void ``[link boost_asio.reference.basic_socket_acceptor.get_option.overload1 get_option]``( 39748 GettableSocketOption & option) const; 39749 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.get_option.overload1 more...]]`` 39750 39751 template< 39752 typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``> 39753 void ``[link boost_asio.reference.basic_socket_acceptor.get_option.overload2 get_option]``( 39754 GettableSocketOption & option, 39755 boost::system::error_code & ec) const; 39756 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.get_option.overload2 more...]]`` 39757 39758 39759[section:overload1 basic_socket_acceptor::get_option (1 of 2 overloads)] 39760 39761 39762Get an option from the acceptor. 39763 39764 39765 template< 39766 typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``> 39767 void get_option( 39768 GettableSocketOption & option) const; 39769 39770 39771This function is used to get the current value of an option on the acceptor. 39772 39773 39774[heading Parameters] 39775 39776 39777[variablelist 39778 39779[[option][The option value to be obtained from the acceptor.]] 39780 39781] 39782 39783 39784[heading Exceptions] 39785 39786 39787[variablelist 39788 39789[[boost::system::system_error][Thrown on failure.]] 39790 39791] 39792 39793 39794 39795[heading Example] 39796 39797Getting the value of the SOL\_SOCKET/SO\_REUSEADDR option: 39798 39799 boost::asio::ip::tcp::acceptor acceptor(my_context); 39800 ... 39801 boost::asio::ip::tcp::acceptor::reuse_address option; 39802 acceptor.get_option(option); 39803 bool is_set = option.get(); 39804 39805 39806 39807 39808 39809 39810 39811[endsect] 39812 39813 39814 39815[section:overload2 basic_socket_acceptor::get_option (2 of 2 overloads)] 39816 39817 39818Get an option from the acceptor. 39819 39820 39821 template< 39822 typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``> 39823 void get_option( 39824 GettableSocketOption & option, 39825 boost::system::error_code & ec) const; 39826 39827 39828This function is used to get the current value of an option on the acceptor. 39829 39830 39831[heading Parameters] 39832 39833 39834[variablelist 39835 39836[[option][The option value to be obtained from the acceptor.]] 39837 39838[[ec][Set to indicate what error occurred, if any.]] 39839 39840] 39841 39842 39843 39844[heading Example] 39845 39846Getting the value of the SOL\_SOCKET/SO\_REUSEADDR option: 39847 39848 boost::asio::ip::tcp::acceptor acceptor(my_context); 39849 ... 39850 boost::asio::ip::tcp::acceptor::reuse_address option; 39851 boost::system::error_code ec; 39852 acceptor.get_option(option, ec); 39853 if (ec) 39854 { 39855 // An error occurred. 39856 } 39857 bool is_set = option.get(); 39858 39859 39860 39861 39862 39863 39864 39865[endsect] 39866 39867 39868[endsect] 39869 39870[section:io_control basic_socket_acceptor::io_control] 39871 39872[indexterm2 boost_asio.indexterm.basic_socket_acceptor.io_control..io_control..basic_socket_acceptor] 39873Perform an IO control command on the acceptor. 39874 39875 39876 template< 39877 typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> 39878 void ``[link boost_asio.reference.basic_socket_acceptor.io_control.overload1 io_control]``( 39879 IoControlCommand & command); 39880 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.io_control.overload1 more...]]`` 39881 39882 template< 39883 typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> 39884 void ``[link boost_asio.reference.basic_socket_acceptor.io_control.overload2 io_control]``( 39885 IoControlCommand & command, 39886 boost::system::error_code & ec); 39887 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.io_control.overload2 more...]]`` 39888 39889 39890[section:overload1 basic_socket_acceptor::io_control (1 of 2 overloads)] 39891 39892 39893Perform an IO control command on the acceptor. 39894 39895 39896 template< 39897 typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> 39898 void io_control( 39899 IoControlCommand & command); 39900 39901 39902This function is used to execute an IO control command on the acceptor. 39903 39904 39905[heading Parameters] 39906 39907 39908[variablelist 39909 39910[[command][The IO control command to be performed on the acceptor.]] 39911 39912] 39913 39914 39915[heading Exceptions] 39916 39917 39918[variablelist 39919 39920[[boost::system::system_error][Thrown on failure.]] 39921 39922] 39923 39924 39925 39926[heading Example] 39927 39928Getting the number of bytes ready to read: 39929 39930 boost::asio::ip::tcp::acceptor acceptor(my_context); 39931 ... 39932 boost::asio::ip::tcp::acceptor::non_blocking_io command(true); 39933 socket.io_control(command); 39934 39935 39936 39937 39938 39939 39940 39941[endsect] 39942 39943 39944 39945[section:overload2 basic_socket_acceptor::io_control (2 of 2 overloads)] 39946 39947 39948Perform an IO control command on the acceptor. 39949 39950 39951 template< 39952 typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> 39953 void io_control( 39954 IoControlCommand & command, 39955 boost::system::error_code & ec); 39956 39957 39958This function is used to execute an IO control command on the acceptor. 39959 39960 39961[heading Parameters] 39962 39963 39964[variablelist 39965 39966[[command][The IO control command to be performed on the acceptor.]] 39967 39968[[ec][Set to indicate what error occurred, if any.]] 39969 39970] 39971 39972 39973 39974[heading Example] 39975 39976Getting the number of bytes ready to read: 39977 39978 boost::asio::ip::tcp::acceptor acceptor(my_context); 39979 ... 39980 boost::asio::ip::tcp::acceptor::non_blocking_io command(true); 39981 boost::system::error_code ec; 39982 socket.io_control(command, ec); 39983 if (ec) 39984 { 39985 // An error occurred. 39986 } 39987 39988 39989 39990 39991 39992 39993 39994[endsect] 39995 39996 39997[endsect] 39998 39999 40000[section:is_open basic_socket_acceptor::is_open] 40001 40002[indexterm2 boost_asio.indexterm.basic_socket_acceptor.is_open..is_open..basic_socket_acceptor] 40003Determine whether the acceptor is open. 40004 40005 40006 bool is_open() const; 40007 40008 40009 40010[endsect] 40011 40012 40013 40014[section:keep_alive basic_socket_acceptor::keep_alive] 40015 40016 40017['Inherited from socket_base.] 40018 40019[indexterm2 boost_asio.indexterm.basic_socket_acceptor.keep_alive..keep_alive..basic_socket_acceptor] 40020Socket option to send keep-alives. 40021 40022 40023 typedef implementation_defined keep_alive; 40024 40025 40026 40027Implements the SOL\_SOCKET/SO\_KEEPALIVE socket option. 40028 40029 40030[heading Examples] 40031 40032Setting the option: 40033 40034 boost::asio::ip::tcp::socket socket(my_context); 40035 ... 40036 boost::asio::socket_base::keep_alive option(true); 40037 socket.set_option(option); 40038 40039 40040 40041 40042 40043Getting the current option value: 40044 40045 boost::asio::ip::tcp::socket socket(my_context); 40046 ... 40047 boost::asio::socket_base::keep_alive option; 40048 socket.get_option(option); 40049 bool is_set = option.value(); 40050 40051 40052 40053 40054 40055 40056 40057[heading Requirements] 40058 40059['Header: ][^boost/asio/basic_socket_acceptor.hpp] 40060 40061['Convenience header: ][^boost/asio.hpp] 40062 40063 40064[endsect] 40065 40066 40067 40068[section:linger basic_socket_acceptor::linger] 40069 40070 40071['Inherited from socket_base.] 40072 40073[indexterm2 boost_asio.indexterm.basic_socket_acceptor.linger..linger..basic_socket_acceptor] 40074Socket option to specify whether the socket lingers on close if unsent data is present. 40075 40076 40077 typedef implementation_defined linger; 40078 40079 40080 40081Implements the SOL\_SOCKET/SO\_LINGER socket option. 40082 40083 40084[heading Examples] 40085 40086Setting the option: 40087 40088 boost::asio::ip::tcp::socket socket(my_context); 40089 ... 40090 boost::asio::socket_base::linger option(true, 30); 40091 socket.set_option(option); 40092 40093 40094 40095 40096 40097Getting the current option value: 40098 40099 boost::asio::ip::tcp::socket socket(my_context); 40100 ... 40101 boost::asio::socket_base::linger option; 40102 socket.get_option(option); 40103 bool is_set = option.enabled(); 40104 unsigned short timeout = option.timeout(); 40105 40106 40107 40108 40109 40110 40111 40112[heading Requirements] 40113 40114['Header: ][^boost/asio/basic_socket_acceptor.hpp] 40115 40116['Convenience header: ][^boost/asio.hpp] 40117 40118 40119[endsect] 40120 40121 40122[section:listen basic_socket_acceptor::listen] 40123 40124[indexterm2 boost_asio.indexterm.basic_socket_acceptor.listen..listen..basic_socket_acceptor] 40125Place the acceptor into the state where it will listen for new connections. 40126 40127 40128 void ``[link boost_asio.reference.basic_socket_acceptor.listen.overload1 listen]``( 40129 int backlog = socket_base::max_listen_connections); 40130 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.listen.overload1 more...]]`` 40131 40132 void ``[link boost_asio.reference.basic_socket_acceptor.listen.overload2 listen]``( 40133 int backlog, 40134 boost::system::error_code & ec); 40135 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.listen.overload2 more...]]`` 40136 40137 40138[section:overload1 basic_socket_acceptor::listen (1 of 2 overloads)] 40139 40140 40141Place the acceptor into the state where it will listen for new connections. 40142 40143 40144 void listen( 40145 int backlog = socket_base::max_listen_connections); 40146 40147 40148This function puts the socket acceptor into the state where it may accept new connections. 40149 40150 40151[heading Parameters] 40152 40153 40154[variablelist 40155 40156[[backlog][The maximum length of the queue of pending connections.]] 40157 40158] 40159 40160 40161[heading Exceptions] 40162 40163 40164[variablelist 40165 40166[[boost::system::system_error][Thrown on failure. ]] 40167 40168] 40169 40170 40171 40172 40173[endsect] 40174 40175 40176 40177[section:overload2 basic_socket_acceptor::listen (2 of 2 overloads)] 40178 40179 40180Place the acceptor into the state where it will listen for new connections. 40181 40182 40183 void listen( 40184 int backlog, 40185 boost::system::error_code & ec); 40186 40187 40188This function puts the socket acceptor into the state where it may accept new connections. 40189 40190 40191[heading Parameters] 40192 40193 40194[variablelist 40195 40196[[backlog][The maximum length of the queue of pending connections.]] 40197 40198[[ec][Set to indicate what error occurred, if any.]] 40199 40200] 40201 40202 40203[heading Example] 40204 40205 40206 40207 boost::asio::ip::tcp::acceptor acceptor(my_context); 40208 ... 40209 boost::system::error_code ec; 40210 acceptor.listen(boost::asio::socket_base::max_listen_connections, ec); 40211 if (ec) 40212 { 40213 // An error occurred. 40214 } 40215 40216 40217 40218 40219 40220 40221 40222[endsect] 40223 40224 40225[endsect] 40226 40227[section:local_endpoint basic_socket_acceptor::local_endpoint] 40228 40229[indexterm2 boost_asio.indexterm.basic_socket_acceptor.local_endpoint..local_endpoint..basic_socket_acceptor] 40230Get the local endpoint of the acceptor. 40231 40232 40233 endpoint_type ``[link boost_asio.reference.basic_socket_acceptor.local_endpoint.overload1 local_endpoint]``() const; 40234 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.local_endpoint.overload1 more...]]`` 40235 40236 endpoint_type ``[link boost_asio.reference.basic_socket_acceptor.local_endpoint.overload2 local_endpoint]``( 40237 boost::system::error_code & ec) const; 40238 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.local_endpoint.overload2 more...]]`` 40239 40240 40241[section:overload1 basic_socket_acceptor::local_endpoint (1 of 2 overloads)] 40242 40243 40244Get the local endpoint of the acceptor. 40245 40246 40247 endpoint_type local_endpoint() const; 40248 40249 40250This function is used to obtain the locally bound endpoint of the acceptor. 40251 40252 40253[heading Return Value] 40254 40255An object that represents the local endpoint of the acceptor. 40256 40257 40258[heading Exceptions] 40259 40260 40261[variablelist 40262 40263[[boost::system::system_error][Thrown on failure.]] 40264 40265] 40266 40267 40268[heading Example] 40269 40270 40271 40272 boost::asio::ip::tcp::acceptor acceptor(my_context); 40273 ... 40274 boost::asio::ip::tcp::endpoint endpoint = acceptor.local_endpoint(); 40275 40276 40277 40278 40279 40280 40281 40282[endsect] 40283 40284 40285 40286[section:overload2 basic_socket_acceptor::local_endpoint (2 of 2 overloads)] 40287 40288 40289Get the local endpoint of the acceptor. 40290 40291 40292 endpoint_type local_endpoint( 40293 boost::system::error_code & ec) const; 40294 40295 40296This function is used to obtain the locally bound endpoint of the acceptor. 40297 40298 40299[heading Parameters] 40300 40301 40302[variablelist 40303 40304[[ec][Set to indicate what error occurred, if any.]] 40305 40306] 40307 40308 40309[heading Return Value] 40310 40311An 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. 40312 40313 40314[heading Example] 40315 40316 40317 40318 boost::asio::ip::tcp::acceptor acceptor(my_context); 40319 ... 40320 boost::system::error_code ec; 40321 boost::asio::ip::tcp::endpoint endpoint = acceptor.local_endpoint(ec); 40322 if (ec) 40323 { 40324 // An error occurred. 40325 } 40326 40327 40328 40329 40330 40331 40332 40333[endsect] 40334 40335 40336[endsect] 40337 40338 40339[section:max_connections basic_socket_acceptor::max_connections] 40340 40341 40342['Inherited from socket_base.] 40343 40344[indexterm2 boost_asio.indexterm.basic_socket_acceptor.max_connections..max_connections..basic_socket_acceptor] 40345(Deprecated: Use max\_listen\_connections.) The maximum length of the queue of pending incoming connections. 40346 40347 40348 static const int max_connections = implementation_defined; 40349 40350 40351 40352[endsect] 40353 40354 40355 40356[section:max_listen_connections basic_socket_acceptor::max_listen_connections] 40357 40358 40359['Inherited from socket_base.] 40360 40361[indexterm2 boost_asio.indexterm.basic_socket_acceptor.max_listen_connections..max_listen_connections..basic_socket_acceptor] 40362The maximum length of the queue of pending incoming connections. 40363 40364 40365 static const int max_listen_connections = implementation_defined; 40366 40367 40368 40369[endsect] 40370 40371 40372 40373[section:message_do_not_route basic_socket_acceptor::message_do_not_route] 40374 40375 40376['Inherited from socket_base.] 40377 40378[indexterm2 boost_asio.indexterm.basic_socket_acceptor.message_do_not_route..message_do_not_route..basic_socket_acceptor] 40379Specify that the data should not be subject to routing. 40380 40381 40382 static const int message_do_not_route = implementation_defined; 40383 40384 40385 40386[endsect] 40387 40388 40389 40390[section:message_end_of_record basic_socket_acceptor::message_end_of_record] 40391 40392 40393['Inherited from socket_base.] 40394 40395[indexterm2 boost_asio.indexterm.basic_socket_acceptor.message_end_of_record..message_end_of_record..basic_socket_acceptor] 40396Specifies that the data marks the end of a record. 40397 40398 40399 static const int message_end_of_record = implementation_defined; 40400 40401 40402 40403[endsect] 40404 40405 40406 40407[section:message_flags basic_socket_acceptor::message_flags] 40408 40409 40410['Inherited from socket_base.] 40411 40412[indexterm2 boost_asio.indexterm.basic_socket_acceptor.message_flags..message_flags..basic_socket_acceptor] 40413Bitmask type for flags that can be passed to send and receive operations. 40414 40415 40416 typedef int message_flags; 40417 40418 40419 40420[heading Requirements] 40421 40422['Header: ][^boost/asio/basic_socket_acceptor.hpp] 40423 40424['Convenience header: ][^boost/asio.hpp] 40425 40426 40427[endsect] 40428 40429 40430 40431[section:message_out_of_band basic_socket_acceptor::message_out_of_band] 40432 40433 40434['Inherited from socket_base.] 40435 40436[indexterm2 boost_asio.indexterm.basic_socket_acceptor.message_out_of_band..message_out_of_band..basic_socket_acceptor] 40437Process out-of-band data. 40438 40439 40440 static const int message_out_of_band = implementation_defined; 40441 40442 40443 40444[endsect] 40445 40446 40447 40448[section:message_peek basic_socket_acceptor::message_peek] 40449 40450 40451['Inherited from socket_base.] 40452 40453[indexterm2 boost_asio.indexterm.basic_socket_acceptor.message_peek..message_peek..basic_socket_acceptor] 40454Peek at incoming data without removing it from the input queue. 40455 40456 40457 static const int message_peek = implementation_defined; 40458 40459 40460 40461[endsect] 40462 40463 40464 40465[section:native_handle basic_socket_acceptor::native_handle] 40466 40467[indexterm2 boost_asio.indexterm.basic_socket_acceptor.native_handle..native_handle..basic_socket_acceptor] 40468Get the native acceptor representation. 40469 40470 40471 native_handle_type native_handle(); 40472 40473 40474This 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. 40475 40476 40477[endsect] 40478 40479 40480 40481[section:native_handle_type basic_socket_acceptor::native_handle_type] 40482 40483[indexterm2 boost_asio.indexterm.basic_socket_acceptor.native_handle_type..native_handle_type..basic_socket_acceptor] 40484The native representation of an acceptor. 40485 40486 40487 typedef implementation_defined native_handle_type; 40488 40489 40490 40491[heading Requirements] 40492 40493['Header: ][^boost/asio/basic_socket_acceptor.hpp] 40494 40495['Convenience header: ][^boost/asio.hpp] 40496 40497 40498[endsect] 40499 40500 40501[section:native_non_blocking basic_socket_acceptor::native_non_blocking] 40502 40503[indexterm2 boost_asio.indexterm.basic_socket_acceptor.native_non_blocking..native_non_blocking..basic_socket_acceptor] 40504Gets the non-blocking mode of the native acceptor implementation. 40505 40506 40507 bool ``[link boost_asio.reference.basic_socket_acceptor.native_non_blocking.overload1 native_non_blocking]``() const; 40508 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.native_non_blocking.overload1 more...]]`` 40509 40510 40511Sets the non-blocking mode of the native acceptor implementation. 40512 40513 40514 void ``[link boost_asio.reference.basic_socket_acceptor.native_non_blocking.overload2 native_non_blocking]``( 40515 bool mode); 40516 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.native_non_blocking.overload2 more...]]`` 40517 40518 void ``[link boost_asio.reference.basic_socket_acceptor.native_non_blocking.overload3 native_non_blocking]``( 40519 bool mode, 40520 boost::system::error_code & ec); 40521 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.native_non_blocking.overload3 more...]]`` 40522 40523 40524[section:overload1 basic_socket_acceptor::native_non_blocking (1 of 3 overloads)] 40525 40526 40527Gets the non-blocking mode of the native acceptor implementation. 40528 40529 40530 bool native_non_blocking() const; 40531 40532 40533This 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. 40534 40535 40536[heading Return Value] 40537 40538`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). 40539 40540 40541[heading Remarks] 40542 40543The 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. 40544 40545 40546 40547 40548[endsect] 40549 40550 40551 40552[section:overload2 basic_socket_acceptor::native_non_blocking (2 of 3 overloads)] 40553 40554 40555Sets the non-blocking mode of the native acceptor implementation. 40556 40557 40558 void native_non_blocking( 40559 bool mode); 40560 40561 40562This 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. 40563 40564 40565[heading Parameters] 40566 40567 40568[variablelist 40569 40570[[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).]] 40571 40572] 40573 40574 40575[heading Exceptions] 40576 40577 40578[variablelist 40579 40580[[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. ]] 40581 40582] 40583 40584 40585 40586 40587[endsect] 40588 40589 40590 40591[section:overload3 basic_socket_acceptor::native_non_blocking (3 of 3 overloads)] 40592 40593 40594Sets the non-blocking mode of the native acceptor implementation. 40595 40596 40597 void native_non_blocking( 40598 bool mode, 40599 boost::system::error_code & ec); 40600 40601 40602This 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. 40603 40604 40605[heading Parameters] 40606 40607 40608[variablelist 40609 40610[[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).]] 40611 40612[[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. ]] 40613 40614] 40615 40616 40617 40618 40619[endsect] 40620 40621 40622[endsect] 40623 40624[section:non_blocking basic_socket_acceptor::non_blocking] 40625 40626[indexterm2 boost_asio.indexterm.basic_socket_acceptor.non_blocking..non_blocking..basic_socket_acceptor] 40627Gets the non-blocking mode of the acceptor. 40628 40629 40630 bool ``[link boost_asio.reference.basic_socket_acceptor.non_blocking.overload1 non_blocking]``() const; 40631 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.non_blocking.overload1 more...]]`` 40632 40633 40634Sets the non-blocking mode of the acceptor. 40635 40636 40637 void ``[link boost_asio.reference.basic_socket_acceptor.non_blocking.overload2 non_blocking]``( 40638 bool mode); 40639 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.non_blocking.overload2 more...]]`` 40640 40641 void ``[link boost_asio.reference.basic_socket_acceptor.non_blocking.overload3 non_blocking]``( 40642 bool mode, 40643 boost::system::error_code & ec); 40644 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.non_blocking.overload3 more...]]`` 40645 40646 40647[section:overload1 basic_socket_acceptor::non_blocking (1 of 3 overloads)] 40648 40649 40650Gets the non-blocking mode of the acceptor. 40651 40652 40653 bool non_blocking() const; 40654 40655 40656 40657[heading Return Value] 40658 40659`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. 40660 40661 40662[heading Remarks] 40663 40664The 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`. 40665 40666 40667 40668 40669[endsect] 40670 40671 40672 40673[section:overload2 basic_socket_acceptor::non_blocking (2 of 3 overloads)] 40674 40675 40676Sets the non-blocking mode of the acceptor. 40677 40678 40679 void non_blocking( 40680 bool mode); 40681 40682 40683 40684[heading Parameters] 40685 40686 40687[variablelist 40688 40689[[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.]] 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[heading Remarks] 40705 40706The 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`. 40707 40708 40709 40710 40711[endsect] 40712 40713 40714 40715[section:overload3 basic_socket_acceptor::non_blocking (3 of 3 overloads)] 40716 40717 40718Sets the non-blocking mode of the acceptor. 40719 40720 40721 void non_blocking( 40722 bool mode, 40723 boost::system::error_code & ec); 40724 40725 40726 40727[heading Parameters] 40728 40729 40730[variablelist 40731 40732[[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.]] 40733 40734[[ec][Set to indicate what error occurred, if any.]] 40735 40736] 40737 40738 40739[heading Remarks] 40740 40741The 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`. 40742 40743 40744 40745 40746[endsect] 40747 40748 40749[endsect] 40750 40751[section:open basic_socket_acceptor::open] 40752 40753[indexterm2 boost_asio.indexterm.basic_socket_acceptor.open..open..basic_socket_acceptor] 40754Open the acceptor using the specified protocol. 40755 40756 40757 void ``[link boost_asio.reference.basic_socket_acceptor.open.overload1 open]``( 40758 const protocol_type & protocol = protocol_type()); 40759 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.open.overload1 more...]]`` 40760 40761 void ``[link boost_asio.reference.basic_socket_acceptor.open.overload2 open]``( 40762 const protocol_type & protocol, 40763 boost::system::error_code & ec); 40764 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.open.overload2 more...]]`` 40765 40766 40767[section:overload1 basic_socket_acceptor::open (1 of 2 overloads)] 40768 40769 40770Open the acceptor using the specified protocol. 40771 40772 40773 void open( 40774 const protocol_type & protocol = protocol_type()); 40775 40776 40777This function opens the socket acceptor so that it will use the specified protocol. 40778 40779 40780[heading Parameters] 40781 40782 40783[variablelist 40784 40785[[protocol][An object specifying which protocol is to be used.]] 40786 40787] 40788 40789 40790[heading Exceptions] 40791 40792 40793[variablelist 40794 40795[[boost::system::system_error][Thrown on failure.]] 40796 40797] 40798 40799 40800[heading Example] 40801 40802 40803 40804 boost::asio::ip::tcp::acceptor acceptor(my_context); 40805 acceptor.open(boost::asio::ip::tcp::v4()); 40806 40807 40808 40809 40810 40811 40812 40813[endsect] 40814 40815 40816 40817[section:overload2 basic_socket_acceptor::open (2 of 2 overloads)] 40818 40819 40820Open the acceptor using the specified protocol. 40821 40822 40823 void open( 40824 const protocol_type & protocol, 40825 boost::system::error_code & ec); 40826 40827 40828This function opens the socket acceptor so that it will use the specified protocol. 40829 40830 40831[heading Parameters] 40832 40833 40834[variablelist 40835 40836[[protocol][An object specifying which protocol is to be used.]] 40837 40838[[ec][Set to indicate what error occurred, if any.]] 40839 40840] 40841 40842 40843[heading Example] 40844 40845 40846 40847 boost::asio::ip::tcp::acceptor acceptor(my_context); 40848 boost::system::error_code ec; 40849 acceptor.open(boost::asio::ip::tcp::v4(), ec); 40850 if (ec) 40851 { 40852 // An error occurred. 40853 } 40854 40855 40856 40857 40858 40859 40860 40861[endsect] 40862 40863 40864[endsect] 40865 40866[section:operator_eq_ basic_socket_acceptor::operator=] 40867 40868[indexterm2 boost_asio.indexterm.basic_socket_acceptor.operator_eq_..operator=..basic_socket_acceptor] 40869Move-assign a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] from another. 40870 40871 40872 basic_socket_acceptor & ``[link boost_asio.reference.basic_socket_acceptor.operator_eq_.overload1 operator=]``( 40873 basic_socket_acceptor && other); 40874 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.operator_eq_.overload1 more...]]`` 40875 40876 40877Move-assign a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] from an acceptor of another protocol type. 40878 40879 40880 template< 40881 typename ``[link boost_asio.reference.Protocol Protocol1]``, 40882 typename ``[link boost_asio.reference.Executor1 Executor1]``> 40883 constraint< 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=]``( 40884 basic_socket_acceptor< Protocol1, Executor1 > && other); 40885 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.operator_eq_.overload2 more...]]`` 40886 40887 40888[section:overload1 basic_socket_acceptor::operator= (1 of 2 overloads)] 40889 40890 40891Move-assign a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] from another. 40892 40893 40894 basic_socket_acceptor & operator=( 40895 basic_socket_acceptor && other); 40896 40897 40898This assignment operator moves an acceptor from one object to another. 40899 40900 40901[heading Parameters] 40902 40903 40904[variablelist 40905 40906[[other][The other [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] object from which the move will occur.]] 40907 40908] 40909 40910 40911[heading Remarks] 40912 40913Following the move, the moved-from object is in the same state as if constructed using the `basic_socket_acceptor(const executor_type&)` constructor. 40914 40915 40916 40917 40918[endsect] 40919 40920 40921 40922[section:overload2 basic_socket_acceptor::operator= (2 of 2 overloads)] 40923 40924 40925Move-assign a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] from an acceptor of another protocol type. 40926 40927 40928 template< 40929 typename ``[link boost_asio.reference.Protocol Protocol1]``, 40930 typename ``[link boost_asio.reference.Executor1 Executor1]``> 40931 constraint< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value, basic_socket_acceptor & >::type operator=( 40932 basic_socket_acceptor< Protocol1, Executor1 > && other); 40933 40934 40935This assignment operator moves an acceptor from one object to another. 40936 40937 40938[heading Parameters] 40939 40940 40941[variablelist 40942 40943[[other][The other [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] object from which the move will occur.]] 40944 40945] 40946 40947 40948[heading Remarks] 40949 40950Following the move, the moved-from object is in the same state as if constructed using the `basic_socket_acceptor(const executor_type&)` constructor. 40951 40952 40953 40954 40955[endsect] 40956 40957 40958[endsect] 40959 40960 40961[section:out_of_band_inline basic_socket_acceptor::out_of_band_inline] 40962 40963 40964['Inherited from socket_base.] 40965 40966[indexterm2 boost_asio.indexterm.basic_socket_acceptor.out_of_band_inline..out_of_band_inline..basic_socket_acceptor] 40967Socket option for putting received out-of-band data inline. 40968 40969 40970 typedef implementation_defined out_of_band_inline; 40971 40972 40973 40974Implements the SOL\_SOCKET/SO\_OOBINLINE socket option. 40975 40976 40977[heading Examples] 40978 40979Setting the option: 40980 40981 boost::asio::ip::tcp::socket socket(my_context); 40982 ... 40983 boost::asio::socket_base::out_of_band_inline option(true); 40984 socket.set_option(option); 40985 40986 40987 40988 40989 40990Getting the current option value: 40991 40992 boost::asio::ip::tcp::socket socket(my_context); 40993 ... 40994 boost::asio::socket_base::out_of_band_inline option; 40995 socket.get_option(option); 40996 bool value = option.value(); 40997 40998 40999 41000 41001 41002 41003 41004[heading Requirements] 41005 41006['Header: ][^boost/asio/basic_socket_acceptor.hpp] 41007 41008['Convenience header: ][^boost/asio.hpp] 41009 41010 41011[endsect] 41012 41013 41014 41015[section:protocol_type basic_socket_acceptor::protocol_type] 41016 41017[indexterm2 boost_asio.indexterm.basic_socket_acceptor.protocol_type..protocol_type..basic_socket_acceptor] 41018The protocol type. 41019 41020 41021 typedef Protocol protocol_type; 41022 41023 41024 41025[heading Requirements] 41026 41027['Header: ][^boost/asio/basic_socket_acceptor.hpp] 41028 41029['Convenience header: ][^boost/asio.hpp] 41030 41031 41032[endsect] 41033 41034 41035 41036[section:receive_buffer_size basic_socket_acceptor::receive_buffer_size] 41037 41038 41039['Inherited from socket_base.] 41040 41041[indexterm2 boost_asio.indexterm.basic_socket_acceptor.receive_buffer_size..receive_buffer_size..basic_socket_acceptor] 41042Socket option for the receive buffer size of a socket. 41043 41044 41045 typedef implementation_defined receive_buffer_size; 41046 41047 41048 41049Implements the SOL\_SOCKET/SO\_RCVBUF socket option. 41050 41051 41052[heading Examples] 41053 41054Setting the option: 41055 41056 boost::asio::ip::tcp::socket socket(my_context); 41057 ... 41058 boost::asio::socket_base::receive_buffer_size option(8192); 41059 socket.set_option(option); 41060 41061 41062 41063 41064 41065Getting the current option value: 41066 41067 boost::asio::ip::tcp::socket socket(my_context); 41068 ... 41069 boost::asio::socket_base::receive_buffer_size option; 41070 socket.get_option(option); 41071 int size = option.value(); 41072 41073 41074 41075 41076 41077 41078 41079[heading Requirements] 41080 41081['Header: ][^boost/asio/basic_socket_acceptor.hpp] 41082 41083['Convenience header: ][^boost/asio.hpp] 41084 41085 41086[endsect] 41087 41088 41089 41090[section:receive_low_watermark basic_socket_acceptor::receive_low_watermark] 41091 41092 41093['Inherited from socket_base.] 41094 41095[indexterm2 boost_asio.indexterm.basic_socket_acceptor.receive_low_watermark..receive_low_watermark..basic_socket_acceptor] 41096Socket option for the receive low watermark. 41097 41098 41099 typedef implementation_defined receive_low_watermark; 41100 41101 41102 41103Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option. 41104 41105 41106[heading Examples] 41107 41108Setting the option: 41109 41110 boost::asio::ip::tcp::socket socket(my_context); 41111 ... 41112 boost::asio::socket_base::receive_low_watermark option(1024); 41113 socket.set_option(option); 41114 41115 41116 41117 41118 41119Getting the current option value: 41120 41121 boost::asio::ip::tcp::socket socket(my_context); 41122 ... 41123 boost::asio::socket_base::receive_low_watermark option; 41124 socket.get_option(option); 41125 int size = option.value(); 41126 41127 41128 41129 41130 41131 41132 41133[heading Requirements] 41134 41135['Header: ][^boost/asio/basic_socket_acceptor.hpp] 41136 41137['Convenience header: ][^boost/asio.hpp] 41138 41139 41140[endsect] 41141 41142 41143[section:release basic_socket_acceptor::release] 41144 41145[indexterm2 boost_asio.indexterm.basic_socket_acceptor.release..release..basic_socket_acceptor] 41146Release ownership of the underlying native acceptor. 41147 41148 41149 native_handle_type ``[link boost_asio.reference.basic_socket_acceptor.release.overload1 release]``(); 41150 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.release.overload1 more...]]`` 41151 41152 native_handle_type ``[link boost_asio.reference.basic_socket_acceptor.release.overload2 release]``( 41153 boost::system::error_code & ec); 41154 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.release.overload2 more...]]`` 41155 41156 41157[section:overload1 basic_socket_acceptor::release (1 of 2 overloads)] 41158 41159 41160Release ownership of the underlying native acceptor. 41161 41162 41163 native_handle_type release(); 41164 41165 41166This 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. 41167 41168 41169[heading Exceptions] 41170 41171 41172[variablelist 41173 41174[[boost::system::system_error][Thrown on failure.]] 41175 41176] 41177 41178 41179[heading Remarks] 41180 41181This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms. 41182 41183 41184 41185 41186[endsect] 41187 41188 41189 41190[section:overload2 basic_socket_acceptor::release (2 of 2 overloads)] 41191 41192 41193Release ownership of the underlying native acceptor. 41194 41195 41196 native_handle_type release( 41197 boost::system::error_code & ec); 41198 41199 41200This 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. 41201 41202 41203[heading Parameters] 41204 41205 41206[variablelist 41207 41208[[ec][Set to indicate what error occurred, if any.]] 41209 41210] 41211 41212 41213[heading Remarks] 41214 41215This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms. 41216 41217 41218 41219 41220[endsect] 41221 41222 41223[endsect] 41224 41225 41226[section:reuse_address basic_socket_acceptor::reuse_address] 41227 41228 41229['Inherited from socket_base.] 41230 41231[indexterm2 boost_asio.indexterm.basic_socket_acceptor.reuse_address..reuse_address..basic_socket_acceptor] 41232Socket option to allow the socket to be bound to an address that is already in use. 41233 41234 41235 typedef implementation_defined reuse_address; 41236 41237 41238 41239Implements the SOL\_SOCKET/SO\_REUSEADDR socket option. 41240 41241 41242[heading Examples] 41243 41244Setting the option: 41245 41246 boost::asio::ip::tcp::acceptor acceptor(my_context); 41247 ... 41248 boost::asio::socket_base::reuse_address option(true); 41249 acceptor.set_option(option); 41250 41251 41252 41253 41254 41255Getting the current option value: 41256 41257 boost::asio::ip::tcp::acceptor acceptor(my_context); 41258 ... 41259 boost::asio::socket_base::reuse_address option; 41260 acceptor.get_option(option); 41261 bool is_set = option.value(); 41262 41263 41264 41265 41266 41267 41268 41269[heading Requirements] 41270 41271['Header: ][^boost/asio/basic_socket_acceptor.hpp] 41272 41273['Convenience header: ][^boost/asio.hpp] 41274 41275 41276[endsect] 41277 41278 41279 41280[section:send_buffer_size basic_socket_acceptor::send_buffer_size] 41281 41282 41283['Inherited from socket_base.] 41284 41285[indexterm2 boost_asio.indexterm.basic_socket_acceptor.send_buffer_size..send_buffer_size..basic_socket_acceptor] 41286Socket option for the send buffer size of a socket. 41287 41288 41289 typedef implementation_defined send_buffer_size; 41290 41291 41292 41293Implements the SOL\_SOCKET/SO\_SNDBUF socket option. 41294 41295 41296[heading Examples] 41297 41298Setting the option: 41299 41300 boost::asio::ip::tcp::socket socket(my_context); 41301 ... 41302 boost::asio::socket_base::send_buffer_size option(8192); 41303 socket.set_option(option); 41304 41305 41306 41307 41308 41309Getting the current option value: 41310 41311 boost::asio::ip::tcp::socket socket(my_context); 41312 ... 41313 boost::asio::socket_base::send_buffer_size option; 41314 socket.get_option(option); 41315 int size = option.value(); 41316 41317 41318 41319 41320 41321 41322 41323[heading Requirements] 41324 41325['Header: ][^boost/asio/basic_socket_acceptor.hpp] 41326 41327['Convenience header: ][^boost/asio.hpp] 41328 41329 41330[endsect] 41331 41332 41333 41334[section:send_low_watermark basic_socket_acceptor::send_low_watermark] 41335 41336 41337['Inherited from socket_base.] 41338 41339[indexterm2 boost_asio.indexterm.basic_socket_acceptor.send_low_watermark..send_low_watermark..basic_socket_acceptor] 41340Socket option for the send low watermark. 41341 41342 41343 typedef implementation_defined send_low_watermark; 41344 41345 41346 41347Implements the SOL\_SOCKET/SO\_SNDLOWAT socket option. 41348 41349 41350[heading Examples] 41351 41352Setting the option: 41353 41354 boost::asio::ip::tcp::socket socket(my_context); 41355 ... 41356 boost::asio::socket_base::send_low_watermark option(1024); 41357 socket.set_option(option); 41358 41359 41360 41361 41362 41363Getting the current option value: 41364 41365 boost::asio::ip::tcp::socket socket(my_context); 41366 ... 41367 boost::asio::socket_base::send_low_watermark option; 41368 socket.get_option(option); 41369 int size = option.value(); 41370 41371 41372 41373 41374 41375 41376 41377[heading Requirements] 41378 41379['Header: ][^boost/asio/basic_socket_acceptor.hpp] 41380 41381['Convenience header: ][^boost/asio.hpp] 41382 41383 41384[endsect] 41385 41386 41387[section:set_option basic_socket_acceptor::set_option] 41388 41389[indexterm2 boost_asio.indexterm.basic_socket_acceptor.set_option..set_option..basic_socket_acceptor] 41390Set an option on the acceptor. 41391 41392 41393 template< 41394 typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``> 41395 void ``[link boost_asio.reference.basic_socket_acceptor.set_option.overload1 set_option]``( 41396 const SettableSocketOption & option); 41397 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.set_option.overload1 more...]]`` 41398 41399 template< 41400 typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``> 41401 void ``[link boost_asio.reference.basic_socket_acceptor.set_option.overload2 set_option]``( 41402 const SettableSocketOption & option, 41403 boost::system::error_code & ec); 41404 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.set_option.overload2 more...]]`` 41405 41406 41407[section:overload1 basic_socket_acceptor::set_option (1 of 2 overloads)] 41408 41409 41410Set an option on the acceptor. 41411 41412 41413 template< 41414 typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``> 41415 void set_option( 41416 const SettableSocketOption & option); 41417 41418 41419This function is used to set an option on the acceptor. 41420 41421 41422[heading Parameters] 41423 41424 41425[variablelist 41426 41427[[option][The new option value to be set on the acceptor.]] 41428 41429] 41430 41431 41432[heading Exceptions] 41433 41434 41435[variablelist 41436 41437[[boost::system::system_error][Thrown on failure.]] 41438 41439] 41440 41441 41442 41443[heading Example] 41444 41445Setting the SOL\_SOCKET/SO\_REUSEADDR option: 41446 41447 boost::asio::ip::tcp::acceptor acceptor(my_context); 41448 ... 41449 boost::asio::ip::tcp::acceptor::reuse_address option(true); 41450 acceptor.set_option(option); 41451 41452 41453 41454 41455 41456 41457 41458[endsect] 41459 41460 41461 41462[section:overload2 basic_socket_acceptor::set_option (2 of 2 overloads)] 41463 41464 41465Set an option on the acceptor. 41466 41467 41468 template< 41469 typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``> 41470 void set_option( 41471 const SettableSocketOption & option, 41472 boost::system::error_code & ec); 41473 41474 41475This function is used to set an option on the acceptor. 41476 41477 41478[heading Parameters] 41479 41480 41481[variablelist 41482 41483[[option][The new option value to be set on the acceptor.]] 41484 41485[[ec][Set to indicate what error occurred, if any.]] 41486 41487] 41488 41489 41490 41491[heading Example] 41492 41493Setting the SOL\_SOCKET/SO\_REUSEADDR option: 41494 41495 boost::asio::ip::tcp::acceptor acceptor(my_context); 41496 ... 41497 boost::asio::ip::tcp::acceptor::reuse_address option(true); 41498 boost::system::error_code ec; 41499 acceptor.set_option(option, ec); 41500 if (ec) 41501 { 41502 // An error occurred. 41503 } 41504 41505 41506 41507 41508 41509 41510 41511[endsect] 41512 41513 41514[endsect] 41515 41516 41517[section:shutdown_type basic_socket_acceptor::shutdown_type] 41518 41519 41520['Inherited from socket_base.] 41521 41522[indexterm2 boost_asio.indexterm.basic_socket_acceptor.shutdown_type..shutdown_type..basic_socket_acceptor] 41523Different ways a socket may be shutdown. 41524 41525 41526 enum shutdown_type 41527 41528[indexterm2 boost_asio.indexterm.basic_socket_acceptor.shutdown_type.shutdown_receive..shutdown_receive..basic_socket_acceptor] 41529[indexterm2 boost_asio.indexterm.basic_socket_acceptor.shutdown_type.shutdown_send..shutdown_send..basic_socket_acceptor] 41530[indexterm2 boost_asio.indexterm.basic_socket_acceptor.shutdown_type.shutdown_both..shutdown_both..basic_socket_acceptor] 41531 41532[heading Values] 41533[variablelist 41534 41535 [ 41536 [shutdown_receive] 41537 [Shutdown the receive side of the socket. ] 41538 ] 41539 41540 [ 41541 [shutdown_send] 41542 [Shutdown the send side of the socket. ] 41543 ] 41544 41545 [ 41546 [shutdown_both] 41547 [Shutdown both send and receive on the socket. ] 41548 ] 41549 41550] 41551 41552 41553 41554[endsect] 41555 41556 41557[section:wait basic_socket_acceptor::wait] 41558 41559[indexterm2 boost_asio.indexterm.basic_socket_acceptor.wait..wait..basic_socket_acceptor] 41560Wait for the acceptor to become ready to read, ready to write, or to have pending error conditions. 41561 41562 41563 void ``[link boost_asio.reference.basic_socket_acceptor.wait.overload1 wait]``( 41564 wait_type w); 41565 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.wait.overload1 more...]]`` 41566 41567 void ``[link boost_asio.reference.basic_socket_acceptor.wait.overload2 wait]``( 41568 wait_type w, 41569 boost::system::error_code & ec); 41570 `` [''''»''' [link boost_asio.reference.basic_socket_acceptor.wait.overload2 more...]]`` 41571 41572 41573[section:overload1 basic_socket_acceptor::wait (1 of 2 overloads)] 41574 41575 41576Wait for the acceptor to become ready to read, ready to write, or to have pending error conditions. 41577 41578 41579 void wait( 41580 wait_type w); 41581 41582 41583This function is used to perform a blocking wait for an acceptor to enter a ready to read, write or error condition state. 41584 41585 41586[heading Parameters] 41587 41588 41589[variablelist 41590 41591[[w][Specifies the desired acceptor state.]] 41592 41593] 41594 41595 41596[heading Example] 41597 41598Waiting for an acceptor to become readable. 41599 41600 boost::asio::ip::tcp::acceptor acceptor(my_context); 41601 ... 41602 acceptor.wait(boost::asio::ip::tcp::acceptor::wait_read); 41603 41604 41605 41606 41607 41608 41609 41610[endsect] 41611 41612 41613 41614[section:overload2 basic_socket_acceptor::wait (2 of 2 overloads)] 41615 41616 41617Wait for the acceptor to become ready to read, ready to write, or to have pending error conditions. 41618 41619 41620 void wait( 41621 wait_type w, 41622 boost::system::error_code & ec); 41623 41624 41625This function is used to perform a blocking wait for an acceptor to enter a ready to read, write or error condition state. 41626 41627 41628[heading Parameters] 41629 41630 41631[variablelist 41632 41633[[w][Specifies the desired acceptor state.]] 41634 41635[[ec][Set to indicate what error occurred, if any.]] 41636 41637] 41638 41639 41640[heading Example] 41641 41642Waiting for an acceptor to become readable. 41643 41644 boost::asio::ip::tcp::acceptor acceptor(my_context); 41645 ... 41646 boost::system::error_code ec; 41647 acceptor.wait(boost::asio::ip::tcp::acceptor::wait_read, ec); 41648 41649 41650 41651 41652 41653 41654 41655[endsect] 41656 41657 41658[endsect] 41659 41660 41661[section:wait_type basic_socket_acceptor::wait_type] 41662 41663 41664['Inherited from socket_base.] 41665 41666[indexterm2 boost_asio.indexterm.basic_socket_acceptor.wait_type..wait_type..basic_socket_acceptor] 41667Wait types. 41668 41669 41670 enum wait_type 41671 41672[indexterm2 boost_asio.indexterm.basic_socket_acceptor.wait_type.wait_read..wait_read..basic_socket_acceptor] 41673[indexterm2 boost_asio.indexterm.basic_socket_acceptor.wait_type.wait_write..wait_write..basic_socket_acceptor] 41674[indexterm2 boost_asio.indexterm.basic_socket_acceptor.wait_type.wait_error..wait_error..basic_socket_acceptor] 41675 41676[heading Values] 41677[variablelist 41678 41679 [ 41680 [wait_read] 41681 [Wait for a socket to become ready to read. ] 41682 ] 41683 41684 [ 41685 [wait_write] 41686 [Wait for a socket to become ready to write. ] 41687 ] 41688 41689 [ 41690 [wait_error] 41691 [Wait for a socket to have error conditions pending. ] 41692 ] 41693 41694] 41695 41696 41697For use with `basic_socket::wait()` and `basic_socket::async_wait()`. 41698 41699 41700[endsect] 41701 41702 41703 41704[section:_basic_socket_acceptor basic_socket_acceptor::~basic_socket_acceptor] 41705 41706[indexterm2 boost_asio.indexterm.basic_socket_acceptor._basic_socket_acceptor..~basic_socket_acceptor..basic_socket_acceptor] 41707Destroys the acceptor. 41708 41709 41710 ~basic_socket_acceptor(); 41711 41712 41713This function destroys the acceptor, cancelling any outstanding asynchronous operations associated with the acceptor as if by calling `cancel`. 41714 41715 41716[endsect] 41717 41718 41719 41720[endsect] 41721 41722[section:basic_socket_acceptor__rebind_executor basic_socket_acceptor::rebind_executor] 41723 41724[indexterm1 boost_asio.indexterm.basic_socket_acceptor__rebind_executor..basic_socket_acceptor::rebind_executor] 41725 41726 41727Rebinds the acceptor type to another executor. 41728 41729 41730 template< 41731 typename ``[link boost_asio.reference.Executor1 Executor1]``> 41732 struct rebind_executor 41733 41734 41735[heading Types] 41736[table 41737 [[Name][Description]] 41738 41739 [ 41740 41741 [[link boost_asio.reference.basic_socket_acceptor__rebind_executor.other [*other]]] 41742 [The socket type when rebound to the specified executor. ] 41743 41744 ] 41745 41746] 41747 41748[heading Requirements] 41749 41750['Header: ][^boost/asio/basic_socket_acceptor.hpp] 41751 41752['Convenience header: ][^boost/asio.hpp] 41753 41754 41755[section:other basic_socket_acceptor::rebind_executor::other] 41756 41757[indexterm2 boost_asio.indexterm.basic_socket_acceptor__rebind_executor.other..other..basic_socket_acceptor::rebind_executor] 41758The socket type when rebound to the specified executor. 41759 41760 41761 typedef basic_socket_acceptor< Protocol, Executor1 > other; 41762 41763 41764[heading Types] 41765[table 41766 [[Name][Description]] 41767 41768 [ 41769 41770 [[link boost_asio.reference.basic_socket_acceptor__rebind_executor [*rebind_executor]]] 41771 [Rebinds the acceptor type to another executor. ] 41772 41773 ] 41774 41775 [ 41776 41777 [[link boost_asio.reference.basic_socket_acceptor.broadcast [*broadcast]]] 41778 [Socket option to permit sending of broadcast messages. ] 41779 41780 ] 41781 41782 [ 41783 41784 [[link boost_asio.reference.basic_socket_acceptor.bytes_readable [*bytes_readable]]] 41785 [IO control command to get the amount of data that can be read without blocking. ] 41786 41787 ] 41788 41789 [ 41790 41791 [[link boost_asio.reference.basic_socket_acceptor.debug [*debug]]] 41792 [Socket option to enable socket-level debugging. ] 41793 41794 ] 41795 41796 [ 41797 41798 [[link boost_asio.reference.basic_socket_acceptor.do_not_route [*do_not_route]]] 41799 [Socket option to prevent routing, use local interfaces only. ] 41800 41801 ] 41802 41803 [ 41804 41805 [[link boost_asio.reference.basic_socket_acceptor.enable_connection_aborted [*enable_connection_aborted]]] 41806 [Socket option to report aborted connections on accept. ] 41807 41808 ] 41809 41810 [ 41811 41812 [[link boost_asio.reference.basic_socket_acceptor.endpoint_type [*endpoint_type]]] 41813 [The endpoint type. ] 41814 41815 ] 41816 41817 [ 41818 41819 [[link boost_asio.reference.basic_socket_acceptor.executor_type [*executor_type]]] 41820 [The type of the executor associated with the object. ] 41821 41822 ] 41823 41824 [ 41825 41826 [[link boost_asio.reference.basic_socket_acceptor.keep_alive [*keep_alive]]] 41827 [Socket option to send keep-alives. ] 41828 41829 ] 41830 41831 [ 41832 41833 [[link boost_asio.reference.basic_socket_acceptor.linger [*linger]]] 41834 [Socket option to specify whether the socket lingers on close if unsent data is present. ] 41835 41836 ] 41837 41838 [ 41839 41840 [[link boost_asio.reference.basic_socket_acceptor.message_flags [*message_flags]]] 41841 [Bitmask type for flags that can be passed to send and receive operations. ] 41842 41843 ] 41844 41845 [ 41846 41847 [[link boost_asio.reference.basic_socket_acceptor.native_handle_type [*native_handle_type]]] 41848 [The native representation of an acceptor. ] 41849 41850 ] 41851 41852 [ 41853 41854 [[link boost_asio.reference.basic_socket_acceptor.out_of_band_inline [*out_of_band_inline]]] 41855 [Socket option for putting received out-of-band data inline. ] 41856 41857 ] 41858 41859 [ 41860 41861 [[link boost_asio.reference.basic_socket_acceptor.protocol_type [*protocol_type]]] 41862 [The protocol type. ] 41863 41864 ] 41865 41866 [ 41867 41868 [[link boost_asio.reference.basic_socket_acceptor.receive_buffer_size [*receive_buffer_size]]] 41869 [Socket option for the receive buffer size of a socket. ] 41870 41871 ] 41872 41873 [ 41874 41875 [[link boost_asio.reference.basic_socket_acceptor.receive_low_watermark [*receive_low_watermark]]] 41876 [Socket option for the receive low watermark. ] 41877 41878 ] 41879 41880 [ 41881 41882 [[link boost_asio.reference.basic_socket_acceptor.reuse_address [*reuse_address]]] 41883 [Socket option to allow the socket to be bound to an address that is already in use. ] 41884 41885 ] 41886 41887 [ 41888 41889 [[link boost_asio.reference.basic_socket_acceptor.send_buffer_size [*send_buffer_size]]] 41890 [Socket option for the send buffer size of a socket. ] 41891 41892 ] 41893 41894 [ 41895 41896 [[link boost_asio.reference.basic_socket_acceptor.send_low_watermark [*send_low_watermark]]] 41897 [Socket option for the send low watermark. ] 41898 41899 ] 41900 41901 [ 41902 41903 [[link boost_asio.reference.basic_socket_acceptor.shutdown_type [*shutdown_type]]] 41904 [Different ways a socket may be shutdown. ] 41905 41906 ] 41907 41908 [ 41909 41910 [[link boost_asio.reference.basic_socket_acceptor.wait_type [*wait_type]]] 41911 [Wait types. ] 41912 41913 ] 41914 41915] 41916 41917[heading Member Functions] 41918[table 41919 [[Name][Description]] 41920 41921 [ 41922 [[link boost_asio.reference.basic_socket_acceptor.accept [*accept]]] 41923 [Accept a new connection. 41924 [hr] 41925 Accept a new connection and obtain the endpoint of the peer. ] 41926 ] 41927 41928 [ 41929 [[link boost_asio.reference.basic_socket_acceptor.assign [*assign]]] 41930 [Assigns an existing native acceptor to the acceptor. ] 41931 ] 41932 41933 [ 41934 [[link boost_asio.reference.basic_socket_acceptor.async_accept [*async_accept]]] 41935 [Start an asynchronous accept. ] 41936 ] 41937 41938 [ 41939 [[link boost_asio.reference.basic_socket_acceptor.async_wait [*async_wait]]] 41940 [Asynchronously wait for the acceptor to become ready to read, ready to write, or to have pending error conditions. ] 41941 ] 41942 41943 [ 41944 [[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor [*basic_socket_acceptor]] [constructor]] 41945 [Construct an acceptor without opening it. 41946 [hr] 41947 Construct an open acceptor. 41948 [hr] 41949 Construct an acceptor opened on the given endpoint. 41950 [hr] 41951 Construct a basic_socket_acceptor on an existing native acceptor. 41952 [hr] 41953 Move-construct a basic_socket_acceptor from another. 41954 [hr] 41955 Move-construct a basic_socket_acceptor from an acceptor of another protocol type. ] 41956 ] 41957 41958 [ 41959 [[link boost_asio.reference.basic_socket_acceptor.bind [*bind]]] 41960 [Bind the acceptor to the given local endpoint. ] 41961 ] 41962 41963 [ 41964 [[link boost_asio.reference.basic_socket_acceptor.cancel [*cancel]]] 41965 [Cancel all asynchronous operations associated with the acceptor. ] 41966 ] 41967 41968 [ 41969 [[link boost_asio.reference.basic_socket_acceptor.close [*close]]] 41970 [Close the acceptor. ] 41971 ] 41972 41973 [ 41974 [[link boost_asio.reference.basic_socket_acceptor.get_executor [*get_executor]]] 41975 [Get the executor associated with the object. ] 41976 ] 41977 41978 [ 41979 [[link boost_asio.reference.basic_socket_acceptor.get_option [*get_option]]] 41980 [Get an option from the acceptor. ] 41981 ] 41982 41983 [ 41984 [[link boost_asio.reference.basic_socket_acceptor.io_control [*io_control]]] 41985 [Perform an IO control command on the acceptor. ] 41986 ] 41987 41988 [ 41989 [[link boost_asio.reference.basic_socket_acceptor.is_open [*is_open]]] 41990 [Determine whether the acceptor is open. ] 41991 ] 41992 41993 [ 41994 [[link boost_asio.reference.basic_socket_acceptor.listen [*listen]]] 41995 [Place the acceptor into the state where it will listen for new connections. ] 41996 ] 41997 41998 [ 41999 [[link boost_asio.reference.basic_socket_acceptor.local_endpoint [*local_endpoint]]] 42000 [Get the local endpoint of the acceptor. ] 42001 ] 42002 42003 [ 42004 [[link boost_asio.reference.basic_socket_acceptor.native_handle [*native_handle]]] 42005 [Get the native acceptor representation. ] 42006 ] 42007 42008 [ 42009 [[link boost_asio.reference.basic_socket_acceptor.native_non_blocking [*native_non_blocking]]] 42010 [Gets the non-blocking mode of the native acceptor implementation. 42011 [hr] 42012 Sets the non-blocking mode of the native acceptor implementation. ] 42013 ] 42014 42015 [ 42016 [[link boost_asio.reference.basic_socket_acceptor.non_blocking [*non_blocking]]] 42017 [Gets the non-blocking mode of the acceptor. 42018 [hr] 42019 Sets the non-blocking mode of the acceptor. ] 42020 ] 42021 42022 [ 42023 [[link boost_asio.reference.basic_socket_acceptor.open [*open]]] 42024 [Open the acceptor using the specified protocol. ] 42025 ] 42026 42027 [ 42028 [[link boost_asio.reference.basic_socket_acceptor.operator_eq_ [*operator=]]] 42029 [Move-assign a basic_socket_acceptor from another. 42030 [hr] 42031 Move-assign a basic_socket_acceptor from an acceptor of another protocol type. ] 42032 ] 42033 42034 [ 42035 [[link boost_asio.reference.basic_socket_acceptor.release [*release]]] 42036 [Release ownership of the underlying native acceptor. ] 42037 ] 42038 42039 [ 42040 [[link boost_asio.reference.basic_socket_acceptor.set_option [*set_option]]] 42041 [Set an option on the acceptor. ] 42042 ] 42043 42044 [ 42045 [[link boost_asio.reference.basic_socket_acceptor.wait [*wait]]] 42046 [Wait for the acceptor to become ready to read, ready to write, or to have pending error conditions. ] 42047 ] 42048 42049 [ 42050 [[link boost_asio.reference.basic_socket_acceptor._basic_socket_acceptor [*~basic_socket_acceptor]] [destructor]] 42051 [Destroys the acceptor. ] 42052 ] 42053 42054] 42055 42056[heading Data Members] 42057[table 42058 [[Name][Description]] 42059 42060 [ 42061 [[link boost_asio.reference.basic_socket_acceptor.max_connections [*max_connections]] [static]] 42062 [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ] 42063 ] 42064 42065 [ 42066 [[link boost_asio.reference.basic_socket_acceptor.max_listen_connections [*max_listen_connections]] [static]] 42067 [The maximum length of the queue of pending incoming connections. ] 42068 ] 42069 42070 [ 42071 [[link boost_asio.reference.basic_socket_acceptor.message_do_not_route [*message_do_not_route]] [static]] 42072 [Specify that the data should not be subject to routing. ] 42073 ] 42074 42075 [ 42076 [[link boost_asio.reference.basic_socket_acceptor.message_end_of_record [*message_end_of_record]] [static]] 42077 [Specifies that the data marks the end of a record. ] 42078 ] 42079 42080 [ 42081 [[link boost_asio.reference.basic_socket_acceptor.message_out_of_band [*message_out_of_band]] [static]] 42082 [Process out-of-band data. ] 42083 ] 42084 42085 [ 42086 [[link boost_asio.reference.basic_socket_acceptor.message_peek [*message_peek]] [static]] 42087 [Peek at incoming data without removing it from the input queue. ] 42088 ] 42089 42090] 42091 42092The [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] class template is used for accepting new socket connections. 42093 42094 42095[heading Thread Safety] 42096 42097['Distinct] ['objects:] Safe. 42098 42099['Shared] ['objects:] Unsafe. 42100 42101Synchronous `accept` operations are thread safe, if the underlying operating system calls are also thread safe. This means that it is permitted to perform concurrent calls to synchronous `accept` operations on a single socket object. Other synchronous operations, such as `open` or `close`, are not thread safe. 42102 42103 42104[heading Example] 42105 42106Opening a socket acceptor with the SO\_REUSEADDR option enabled: 42107 42108 boost::asio::ip::tcp::acceptor acceptor(my_context); 42109 boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), port); 42110 acceptor.open(endpoint.protocol()); 42111 acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true)); 42112 acceptor.bind(endpoint); 42113 acceptor.listen(); 42114 42115 42116 42117 42118 42119 42120 42121[heading Requirements] 42122 42123['Header: ][^boost/asio/basic_socket_acceptor.hpp] 42124 42125['Convenience header: ][^boost/asio.hpp] 42126 42127 42128[endsect] 42129 42130 42131 42132[endsect] 42133 42134[section:basic_socket_iostream basic_socket_iostream] 42135 42136[indexterm1 boost_asio.indexterm.basic_socket_iostream..basic_socket_iostream] 42137 42138 42139Iostream interface for a socket. 42140 42141 42142 template< 42143 typename ``[link boost_asio.reference.Protocol Protocol]``, 42144 typename Clock = chrono::steady_clock, 42145 typename ``[link boost_asio.reference.WaitTraits WaitTraits]`` = wait_traits<Clock>> 42146 class basic_socket_iostream 42147 42148 42149[heading Types] 42150[table 42151 [[Name][Description]] 42152 42153 [ 42154 42155 [[link boost_asio.reference.basic_socket_iostream.clock_type [*clock_type]]] 42156 [The clock type. ] 42157 42158 ] 42159 42160 [ 42161 42162 [[link boost_asio.reference.basic_socket_iostream.duration [*duration]]] 42163 [The duration type. ] 42164 42165 ] 42166 42167 [ 42168 42169 [[link boost_asio.reference.basic_socket_iostream.duration_type [*duration_type]]] 42170 [(Deprecated: Use duration.) The duration type. ] 42171 42172 ] 42173 42174 [ 42175 42176 [[link boost_asio.reference.basic_socket_iostream.endpoint_type [*endpoint_type]]] 42177 [The endpoint type. ] 42178 42179 ] 42180 42181 [ 42182 42183 [[link boost_asio.reference.basic_socket_iostream.protocol_type [*protocol_type]]] 42184 [The protocol type. ] 42185 42186 ] 42187 42188 [ 42189 42190 [[link boost_asio.reference.basic_socket_iostream.time_point [*time_point]]] 42191 [The time type. ] 42192 42193 ] 42194 42195 [ 42196 42197 [[link boost_asio.reference.basic_socket_iostream.time_type [*time_type]]] 42198 [(Deprecated: Use time_point.) The time type. ] 42199 42200 ] 42201 42202] 42203 42204[heading Member Functions] 42205[table 42206 [[Name][Description]] 42207 42208 [ 42209 [[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream [*basic_socket_iostream]] [constructor]] 42210 [Construct a basic_socket_iostream without establishing a connection. 42211 [hr] 42212 Construct a basic_socket_iostream from the supplied socket. 42213 [hr] 42214 Move-construct a basic_socket_iostream from another. 42215 [hr] 42216 Establish a connection to an endpoint corresponding to a resolver query. ] 42217 ] 42218 42219 [ 42220 [[link boost_asio.reference.basic_socket_iostream.close [*close]]] 42221 [Close the connection. ] 42222 ] 42223 42224 [ 42225 [[link boost_asio.reference.basic_socket_iostream.connect [*connect]]] 42226 [Establish a connection to an endpoint corresponding to a resolver query. ] 42227 ] 42228 42229 [ 42230 [[link boost_asio.reference.basic_socket_iostream.error [*error]]] 42231 [Get the last error associated with the stream. ] 42232 ] 42233 42234 [ 42235 [[link boost_asio.reference.basic_socket_iostream.expires_after [*expires_after]]] 42236 [Set the stream's expiry time relative to now. ] 42237 ] 42238 42239 [ 42240 [[link boost_asio.reference.basic_socket_iostream.expires_at [*expires_at]]] 42241 [(Deprecated: Use expiry().) Get the stream's expiry time as an absolute time. 42242 [hr] 42243 Set the stream's expiry time as an absolute time. ] 42244 ] 42245 42246 [ 42247 [[link boost_asio.reference.basic_socket_iostream.expires_from_now [*expires_from_now]]] 42248 [(Deprecated: Use expiry().) Get the stream's expiry time relative to now. 42249 [hr] 42250 (Deprecated: Use expires_after().) Set the stream's expiry time relative to now. ] 42251 ] 42252 42253 [ 42254 [[link boost_asio.reference.basic_socket_iostream.expiry [*expiry]]] 42255 [Get the stream's expiry time as an absolute time. ] 42256 ] 42257 42258 [ 42259 [[link boost_asio.reference.basic_socket_iostream.operator_eq_ [*operator=]]] 42260 [Move-assign a basic_socket_iostream from another. ] 42261 ] 42262 42263 [ 42264 [[link boost_asio.reference.basic_socket_iostream.rdbuf [*rdbuf]]] 42265 [Return a pointer to the underlying streambuf. ] 42266 ] 42267 42268 [ 42269 [[link boost_asio.reference.basic_socket_iostream.socket [*socket]]] 42270 [Get a reference to the underlying socket. ] 42271 ] 42272 42273] 42274 42275[heading Requirements] 42276 42277['Header: ][^boost/asio/basic_socket_iostream.hpp] 42278 42279['Convenience header: ][^boost/asio.hpp] 42280 42281[section:basic_socket_iostream basic_socket_iostream::basic_socket_iostream] 42282 42283[indexterm2 boost_asio.indexterm.basic_socket_iostream.basic_socket_iostream..basic_socket_iostream..basic_socket_iostream] 42284Construct a [link boost_asio.reference.basic_socket_iostream `basic_socket_iostream`] without establishing a connection. 42285 42286 42287 ``[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload1 basic_socket_iostream]``(); 42288 `` [''''»''' [link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload1 more...]]`` 42289 42290 42291Construct a [link boost_asio.reference.basic_socket_iostream `basic_socket_iostream`] from the supplied socket. 42292 42293 42294 explicit ``[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload2 basic_socket_iostream]``( 42295 basic_stream_socket< protocol_type > s); 42296 `` [''''»''' [link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload2 more...]]`` 42297 42298 42299Move-construct a [link boost_asio.reference.basic_socket_iostream `basic_socket_iostream`] from another. 42300 42301 42302 ``[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload3 basic_socket_iostream]``( 42303 basic_socket_iostream && other); 42304 `` [''''»''' [link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload3 more...]]`` 42305 42306 42307Establish a connection to an endpoint corresponding to a resolver query. 42308 42309 42310 template< 42311 typename T1, 42312 ... , 42313 typename TN> 42314 explicit ``[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload4 basic_socket_iostream]``( 42315 T1 t1, 42316 ... , 42317 TN tn); 42318 `` [''''»''' [link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload4 more...]]`` 42319 42320 42321[section:overload1 basic_socket_iostream::basic_socket_iostream (1 of 4 overloads)] 42322 42323 42324Construct a [link boost_asio.reference.basic_socket_iostream `basic_socket_iostream`] without establishing a connection. 42325 42326 42327 basic_socket_iostream(); 42328 42329 42330 42331[endsect] 42332 42333 42334 42335[section:overload2 basic_socket_iostream::basic_socket_iostream (2 of 4 overloads)] 42336 42337 42338Construct a [link boost_asio.reference.basic_socket_iostream `basic_socket_iostream`] from the supplied socket. 42339 42340 42341 basic_socket_iostream( 42342 basic_stream_socket< protocol_type > s); 42343 42344 42345 42346[endsect] 42347 42348 42349 42350[section:overload3 basic_socket_iostream::basic_socket_iostream (3 of 4 overloads)] 42351 42352 42353Move-construct a [link boost_asio.reference.basic_socket_iostream `basic_socket_iostream`] from another. 42354 42355 42356 basic_socket_iostream( 42357 basic_socket_iostream && other); 42358 42359 42360 42361[endsect] 42362 42363 42364 42365[section:overload4 basic_socket_iostream::basic_socket_iostream (4 of 4 overloads)] 42366 42367 42368Establish a connection to an endpoint corresponding to a resolver query. 42369 42370 42371 template< 42372 typename T1, 42373 ... , 42374 typename TN> 42375 basic_socket_iostream( 42376 T1 t1, 42377 ... , 42378 TN tn); 42379 42380 42381This constructor automatically establishes a connection based on the supplied resolver query parameters. The arguments are used to construct a resolver query object. 42382 42383 42384[endsect] 42385 42386 42387[endsect] 42388 42389 42390[section:clock_type basic_socket_iostream::clock_type] 42391 42392[indexterm2 boost_asio.indexterm.basic_socket_iostream.clock_type..clock_type..basic_socket_iostream] 42393The clock type. 42394 42395 42396 typedef Clock clock_type; 42397 42398 42399 42400[heading Requirements] 42401 42402['Header: ][^boost/asio/basic_socket_iostream.hpp] 42403 42404['Convenience header: ][^boost/asio.hpp] 42405 42406 42407[endsect] 42408 42409 42410 42411[section:close basic_socket_iostream::close] 42412 42413[indexterm2 boost_asio.indexterm.basic_socket_iostream.close..close..basic_socket_iostream] 42414Close the connection. 42415 42416 42417 void close(); 42418 42419 42420 42421[endsect] 42422 42423 42424 42425[section:connect basic_socket_iostream::connect] 42426 42427[indexterm2 boost_asio.indexterm.basic_socket_iostream.connect..connect..basic_socket_iostream] 42428Establish a connection to an endpoint corresponding to a resolver query. 42429 42430 42431 template< 42432 typename T1, 42433 ... , 42434 typename TN> 42435 void connect( 42436 T1 t1, 42437 ... , 42438 TN tn); 42439 42440 42441This function automatically establishes a connection based on the supplied resolver query parameters. The arguments are used to construct a resolver query object. 42442 42443 42444[endsect] 42445 42446 42447 42448[section:duration basic_socket_iostream::duration] 42449 42450[indexterm2 boost_asio.indexterm.basic_socket_iostream.duration..duration..basic_socket_iostream] 42451The duration type. 42452 42453 42454 typedef WaitTraits::duration duration; 42455 42456 42457 42458[heading Requirements] 42459 42460['Header: ][^boost/asio/basic_socket_iostream.hpp] 42461 42462['Convenience header: ][^boost/asio.hpp] 42463 42464 42465[endsect] 42466 42467 42468 42469[section:duration_type basic_socket_iostream::duration_type] 42470 42471[indexterm2 boost_asio.indexterm.basic_socket_iostream.duration_type..duration_type..basic_socket_iostream] 42472(Deprecated: Use duration.) The duration type. 42473 42474 42475 typedef WaitTraits::duration_type duration_type; 42476 42477 42478 42479[heading Requirements] 42480 42481['Header: ][^boost/asio/basic_socket_iostream.hpp] 42482 42483['Convenience header: ][^boost/asio.hpp] 42484 42485 42486[endsect] 42487 42488 42489 42490[section:endpoint_type basic_socket_iostream::endpoint_type] 42491 42492[indexterm2 boost_asio.indexterm.basic_socket_iostream.endpoint_type..endpoint_type..basic_socket_iostream] 42493The endpoint type. 42494 42495 42496 typedef Protocol::endpoint endpoint_type; 42497 42498 42499 42500[heading Requirements] 42501 42502['Header: ][^boost/asio/basic_socket_iostream.hpp] 42503 42504['Convenience header: ][^boost/asio.hpp] 42505 42506 42507[endsect] 42508 42509 42510 42511[section:error basic_socket_iostream::error] 42512 42513[indexterm2 boost_asio.indexterm.basic_socket_iostream.error..error..basic_socket_iostream] 42514Get the last error associated with the stream. 42515 42516 42517 const boost::system::error_code & error() const; 42518 42519 42520 42521[heading Return Value] 42522 42523An `error_code` corresponding to the last error from the stream. 42524 42525 42526[heading Example] 42527 42528To print the error associated with a failure to establish a connection: 42529 42530 tcp::iostream s("www.boost.org", "http"); 42531 if (!s) 42532 { 42533 std::cout << "Error: " << s.error().message() << std::endl; 42534 } 42535 42536 42537 42538 42539 42540 42541 42542[endsect] 42543 42544 42545 42546[section:expires_after basic_socket_iostream::expires_after] 42547 42548[indexterm2 boost_asio.indexterm.basic_socket_iostream.expires_after..expires_after..basic_socket_iostream] 42549Set the stream's expiry time relative to now. 42550 42551 42552 void expires_after( 42553 const duration & expiry_time); 42554 42555 42556This 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`. 42557 42558 42559[heading Parameters] 42560 42561 42562[variablelist 42563 42564[[expiry_time][The expiry time to be used for the timer. ]] 42565 42566] 42567 42568 42569 42570 42571[endsect] 42572 42573 42574[section:expires_at basic_socket_iostream::expires_at] 42575 42576[indexterm2 boost_asio.indexterm.basic_socket_iostream.expires_at..expires_at..basic_socket_iostream] 42577(Deprecated: Use `expiry()`.) Get the stream's expiry time as an absolute time. 42578 42579 42580 time_point ``[link boost_asio.reference.basic_socket_iostream.expires_at.overload1 expires_at]``() const; 42581 `` [''''»''' [link boost_asio.reference.basic_socket_iostream.expires_at.overload1 more...]]`` 42582 42583 42584Set the stream's expiry time as an absolute time. 42585 42586 42587 void ``[link boost_asio.reference.basic_socket_iostream.expires_at.overload2 expires_at]``( 42588 const time_point & expiry_time); 42589 `` [''''»''' [link boost_asio.reference.basic_socket_iostream.expires_at.overload2 more...]]`` 42590 42591 42592[section:overload1 basic_socket_iostream::expires_at (1 of 2 overloads)] 42593 42594 42595(Deprecated: Use `expiry()`.) Get the stream's expiry time as an absolute time. 42596 42597 42598 time_point expires_at() const; 42599 42600 42601 42602[heading Return Value] 42603 42604An absolute time value representing the stream's expiry time. 42605 42606 42607 42608 42609[endsect] 42610 42611 42612 42613[section:overload2 basic_socket_iostream::expires_at (2 of 2 overloads)] 42614 42615 42616Set the stream's expiry time as an absolute time. 42617 42618 42619 void expires_at( 42620 const time_point & expiry_time); 42621 42622 42623This 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`. 42624 42625 42626[heading Parameters] 42627 42628 42629[variablelist 42630 42631[[expiry_time][The expiry time to be used for the stream. ]] 42632 42633] 42634 42635 42636 42637 42638[endsect] 42639 42640 42641[endsect] 42642 42643[section:expires_from_now basic_socket_iostream::expires_from_now] 42644 42645[indexterm2 boost_asio.indexterm.basic_socket_iostream.expires_from_now..expires_from_now..basic_socket_iostream] 42646(Deprecated: Use `expiry()`.) Get the stream's expiry time relative to now. 42647 42648 42649 duration ``[link boost_asio.reference.basic_socket_iostream.expires_from_now.overload1 expires_from_now]``() const; 42650 `` [''''»''' [link boost_asio.reference.basic_socket_iostream.expires_from_now.overload1 more...]]`` 42651 42652 42653(Deprecated: Use `expires_after()`.) Set the stream's expiry time relative to now. 42654 42655 42656 void ``[link boost_asio.reference.basic_socket_iostream.expires_from_now.overload2 expires_from_now]``( 42657 const duration & expiry_time); 42658 `` [''''»''' [link boost_asio.reference.basic_socket_iostream.expires_from_now.overload2 more...]]`` 42659 42660 42661[section:overload1 basic_socket_iostream::expires_from_now (1 of 2 overloads)] 42662 42663 42664(Deprecated: Use `expiry()`.) Get the stream's expiry time relative to now. 42665 42666 42667 duration expires_from_now() const; 42668 42669 42670 42671[heading Return Value] 42672 42673A relative time value representing the stream's expiry time. 42674 42675 42676 42677 42678[endsect] 42679 42680 42681 42682[section:overload2 basic_socket_iostream::expires_from_now (2 of 2 overloads)] 42683 42684 42685(Deprecated: Use `expires_after()`.) Set the stream's expiry time relative to now. 42686 42687 42688 void expires_from_now( 42689 const duration & expiry_time); 42690 42691 42692This 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`. 42693 42694 42695[heading Parameters] 42696 42697 42698[variablelist 42699 42700[[expiry_time][The expiry time to be used for the timer. ]] 42701 42702] 42703 42704 42705 42706 42707[endsect] 42708 42709 42710[endsect] 42711 42712 42713[section:expiry basic_socket_iostream::expiry] 42714 42715[indexterm2 boost_asio.indexterm.basic_socket_iostream.expiry..expiry..basic_socket_iostream] 42716Get the stream's expiry time as an absolute time. 42717 42718 42719 time_point expiry() const; 42720 42721 42722 42723[heading Return Value] 42724 42725An absolute time value representing the stream's expiry time. 42726 42727 42728 42729 42730[endsect] 42731 42732 42733 42734[section:operator_eq_ basic_socket_iostream::operator=] 42735 42736[indexterm2 boost_asio.indexterm.basic_socket_iostream.operator_eq_..operator=..basic_socket_iostream] 42737Move-assign a [link boost_asio.reference.basic_socket_iostream `basic_socket_iostream`] from another. 42738 42739 42740 basic_socket_iostream & operator=( 42741 basic_socket_iostream && other); 42742 42743 42744 42745[endsect] 42746 42747 42748 42749[section:protocol_type basic_socket_iostream::protocol_type] 42750 42751[indexterm2 boost_asio.indexterm.basic_socket_iostream.protocol_type..protocol_type..basic_socket_iostream] 42752The protocol type. 42753 42754 42755 typedef Protocol protocol_type; 42756 42757 42758 42759[heading Requirements] 42760 42761['Header: ][^boost/asio/basic_socket_iostream.hpp] 42762 42763['Convenience header: ][^boost/asio.hpp] 42764 42765 42766[endsect] 42767 42768 42769 42770[section:rdbuf basic_socket_iostream::rdbuf] 42771 42772[indexterm2 boost_asio.indexterm.basic_socket_iostream.rdbuf..rdbuf..basic_socket_iostream] 42773Return a pointer to the underlying streambuf. 42774 42775 42776 basic_socket_streambuf< Protocol, Clock, WaitTraits > * rdbuf() const; 42777 42778 42779 42780[endsect] 42781 42782 42783 42784[section:socket basic_socket_iostream::socket] 42785 42786[indexterm2 boost_asio.indexterm.basic_socket_iostream.socket..socket..basic_socket_iostream] 42787Get a reference to the underlying socket. 42788 42789 42790 basic_socket< Protocol > & socket(); 42791 42792 42793 42794[endsect] 42795 42796 42797 42798[section:time_point basic_socket_iostream::time_point] 42799 42800[indexterm2 boost_asio.indexterm.basic_socket_iostream.time_point..time_point..basic_socket_iostream] 42801The time type. 42802 42803 42804 typedef WaitTraits::time_point time_point; 42805 42806 42807 42808[heading Requirements] 42809 42810['Header: ][^boost/asio/basic_socket_iostream.hpp] 42811 42812['Convenience header: ][^boost/asio.hpp] 42813 42814 42815[endsect] 42816 42817 42818 42819[section:time_type basic_socket_iostream::time_type] 42820 42821[indexterm2 boost_asio.indexterm.basic_socket_iostream.time_type..time_type..basic_socket_iostream] 42822(Deprecated: Use time\_point.) The time type. 42823 42824 42825 typedef WaitTraits::time_type time_type; 42826 42827 42828 42829[heading Requirements] 42830 42831['Header: ][^boost/asio/basic_socket_iostream.hpp] 42832 42833['Convenience header: ][^boost/asio.hpp] 42834 42835 42836[endsect] 42837 42838 42839 42840[endsect] 42841 42842[section:basic_socket_streambuf basic_socket_streambuf] 42843 42844[indexterm1 boost_asio.indexterm.basic_socket_streambuf..basic_socket_streambuf] 42845 42846 42847Iostream streambuf for a socket. 42848 42849 42850 template< 42851 typename ``[link boost_asio.reference.Protocol Protocol]``, 42852 typename Clock = chrono::steady_clock, 42853 typename ``[link boost_asio.reference.WaitTraits WaitTraits]`` = wait_traits<Clock>> 42854 class basic_socket_streambuf : 42855 basic_socket< Protocol > 42856 42857 42858[heading Types] 42859[table 42860 [[Name][Description]] 42861 42862 [ 42863 42864 [[link boost_asio.reference.basic_socket_streambuf.clock_type [*clock_type]]] 42865 [The clock type. ] 42866 42867 ] 42868 42869 [ 42870 42871 [[link boost_asio.reference.basic_socket_streambuf.duration [*duration]]] 42872 [The duration type. ] 42873 42874 ] 42875 42876 [ 42877 42878 [[link boost_asio.reference.basic_socket_streambuf.duration_type [*duration_type]]] 42879 [(Deprecated: Use duration.) The duration type. ] 42880 42881 ] 42882 42883 [ 42884 42885 [[link boost_asio.reference.basic_socket_streambuf.endpoint_type [*endpoint_type]]] 42886 [The endpoint type. ] 42887 42888 ] 42889 42890 [ 42891 42892 [[link boost_asio.reference.basic_socket_streambuf.protocol_type [*protocol_type]]] 42893 [The protocol type. ] 42894 42895 ] 42896 42897 [ 42898 42899 [[link boost_asio.reference.basic_socket_streambuf.time_point [*time_point]]] 42900 [The time type. ] 42901 42902 ] 42903 42904 [ 42905 42906 [[link boost_asio.reference.basic_socket_streambuf.time_type [*time_type]]] 42907 [(Deprecated: Use time_point.) The time type. ] 42908 42909 ] 42910 42911] 42912 42913[heading Member Functions] 42914[table 42915 [[Name][Description]] 42916 42917 [ 42918 [[link boost_asio.reference.basic_socket_streambuf.basic_socket_streambuf [*basic_socket_streambuf]] [constructor]] 42919 [Construct a basic_socket_streambuf without establishing a connection. 42920 [hr] 42921 Construct a basic_socket_streambuf from the supplied socket. 42922 [hr] 42923 Move-construct a basic_socket_streambuf from another. ] 42924 ] 42925 42926 [ 42927 [[link boost_asio.reference.basic_socket_streambuf.close [*close]]] 42928 [Close the connection. ] 42929 ] 42930 42931 [ 42932 [[link boost_asio.reference.basic_socket_streambuf.connect [*connect]]] 42933 [Establish a connection. ] 42934 ] 42935 42936 [ 42937 [[link boost_asio.reference.basic_socket_streambuf.error [*error]]] 42938 [Get the last error associated with the stream buffer. ] 42939 ] 42940 42941 [ 42942 [[link boost_asio.reference.basic_socket_streambuf.expires_after [*expires_after]]] 42943 [Set the stream buffer's expiry time relative to now. ] 42944 ] 42945 42946 [ 42947 [[link boost_asio.reference.basic_socket_streambuf.expires_at [*expires_at]]] 42948 [(Deprecated: Use expiry().) Get the stream buffer's expiry time as an absolute time. 42949 [hr] 42950 Set the stream buffer's expiry time as an absolute time. ] 42951 ] 42952 42953 [ 42954 [[link boost_asio.reference.basic_socket_streambuf.expires_from_now [*expires_from_now]]] 42955 [(Deprecated: Use expiry().) Get the stream buffer's expiry time relative to now. 42956 [hr] 42957 (Deprecated: Use expires_after().) Set the stream buffer's expiry time relative to now. ] 42958 ] 42959 42960 [ 42961 [[link boost_asio.reference.basic_socket_streambuf.expiry [*expiry]]] 42962 [Get the stream buffer's expiry time as an absolute time. ] 42963 ] 42964 42965 [ 42966 [[link boost_asio.reference.basic_socket_streambuf.operator_eq_ [*operator=]]] 42967 [Move-assign a basic_socket_streambuf from another. ] 42968 ] 42969 42970 [ 42971 [[link boost_asio.reference.basic_socket_streambuf.puberror [*puberror]]] 42972 [(Deprecated: Use error().) Get the last error associated with the stream buffer. ] 42973 ] 42974 42975 [ 42976 [[link boost_asio.reference.basic_socket_streambuf.socket [*socket]]] 42977 [Get a reference to the underlying socket. ] 42978 ] 42979 42980 [ 42981 [[link boost_asio.reference.basic_socket_streambuf._basic_socket_streambuf [*~basic_socket_streambuf]] [destructor]] 42982 [Destructor flushes buffered data. ] 42983 ] 42984 42985] 42986 42987[heading Protected Member Functions] 42988[table 42989 [[Name][Description]] 42990 42991 [ 42992 [[link boost_asio.reference.basic_socket_streambuf.overflow [*overflow]]] 42993 [] 42994 ] 42995 42996 [ 42997 [[link boost_asio.reference.basic_socket_streambuf.setbuf [*setbuf]]] 42998 [] 42999 ] 43000 43001 [ 43002 [[link boost_asio.reference.basic_socket_streambuf.sync [*sync]]] 43003 [] 43004 ] 43005 43006 [ 43007 [[link boost_asio.reference.basic_socket_streambuf.underflow [*underflow]]] 43008 [] 43009 ] 43010 43011] 43012 43013[heading Requirements] 43014 43015['Header: ][^boost/asio/basic_socket_streambuf.hpp] 43016 43017['Convenience header: ][^boost/asio.hpp] 43018 43019[section:basic_socket_streambuf basic_socket_streambuf::basic_socket_streambuf] 43020 43021[indexterm2 boost_asio.indexterm.basic_socket_streambuf.basic_socket_streambuf..basic_socket_streambuf..basic_socket_streambuf] 43022Construct a [link boost_asio.reference.basic_socket_streambuf `basic_socket_streambuf`] without establishing a connection. 43023 43024 43025 ``[link boost_asio.reference.basic_socket_streambuf.basic_socket_streambuf.overload1 basic_socket_streambuf]``(); 43026 `` [''''»''' [link boost_asio.reference.basic_socket_streambuf.basic_socket_streambuf.overload1 more...]]`` 43027 43028 43029Construct a [link boost_asio.reference.basic_socket_streambuf `basic_socket_streambuf`] from the supplied socket. 43030 43031 43032 explicit ``[link boost_asio.reference.basic_socket_streambuf.basic_socket_streambuf.overload2 basic_socket_streambuf]``( 43033 basic_stream_socket< protocol_type > s); 43034 `` [''''»''' [link boost_asio.reference.basic_socket_streambuf.basic_socket_streambuf.overload2 more...]]`` 43035 43036 43037Move-construct a [link boost_asio.reference.basic_socket_streambuf `basic_socket_streambuf`] from another. 43038 43039 43040 ``[link boost_asio.reference.basic_socket_streambuf.basic_socket_streambuf.overload3 basic_socket_streambuf]``( 43041 basic_socket_streambuf && other); 43042 `` [''''»''' [link boost_asio.reference.basic_socket_streambuf.basic_socket_streambuf.overload3 more...]]`` 43043 43044 43045[section:overload1 basic_socket_streambuf::basic_socket_streambuf (1 of 3 overloads)] 43046 43047 43048Construct a [link boost_asio.reference.basic_socket_streambuf `basic_socket_streambuf`] without establishing a connection. 43049 43050 43051 basic_socket_streambuf(); 43052 43053 43054 43055[endsect] 43056 43057 43058 43059[section:overload2 basic_socket_streambuf::basic_socket_streambuf (2 of 3 overloads)] 43060 43061 43062Construct a [link boost_asio.reference.basic_socket_streambuf `basic_socket_streambuf`] from the supplied socket. 43063 43064 43065 basic_socket_streambuf( 43066 basic_stream_socket< protocol_type > s); 43067 43068 43069 43070[endsect] 43071 43072 43073 43074[section:overload3 basic_socket_streambuf::basic_socket_streambuf (3 of 3 overloads)] 43075 43076 43077Move-construct a [link boost_asio.reference.basic_socket_streambuf `basic_socket_streambuf`] from another. 43078 43079 43080 basic_socket_streambuf( 43081 basic_socket_streambuf && other); 43082 43083 43084 43085[endsect] 43086 43087 43088[endsect] 43089 43090 43091[section:clock_type basic_socket_streambuf::clock_type] 43092 43093[indexterm2 boost_asio.indexterm.basic_socket_streambuf.clock_type..clock_type..basic_socket_streambuf] 43094The clock type. 43095 43096 43097 typedef Clock clock_type; 43098 43099 43100 43101[heading Requirements] 43102 43103['Header: ][^boost/asio/basic_socket_streambuf.hpp] 43104 43105['Convenience header: ][^boost/asio.hpp] 43106 43107 43108[endsect] 43109 43110 43111 43112[section:close basic_socket_streambuf::close] 43113 43114[indexterm2 boost_asio.indexterm.basic_socket_streambuf.close..close..basic_socket_streambuf] 43115Close the connection. 43116 43117 43118 basic_socket_streambuf * close(); 43119 43120 43121 43122[heading Return Value] 43123 43124`this` if a connection was successfully established, a null pointer otherwise. 43125 43126 43127 43128 43129[endsect] 43130 43131 43132[section:connect basic_socket_streambuf::connect] 43133 43134[indexterm2 boost_asio.indexterm.basic_socket_streambuf.connect..connect..basic_socket_streambuf] 43135Establish a connection. 43136 43137 43138 basic_socket_streambuf * ``[link boost_asio.reference.basic_socket_streambuf.connect.overload1 connect]``( 43139 const endpoint_type & endpoint); 43140 `` [''''»''' [link boost_asio.reference.basic_socket_streambuf.connect.overload1 more...]]`` 43141 43142 template< 43143 typename T1, 43144 ... , 43145 typename TN> 43146 basic_socket_streambuf * ``[link boost_asio.reference.basic_socket_streambuf.connect.overload2 connect]``( 43147 T1 t1, 43148 ... , 43149 TN tn); 43150 `` [''''»''' [link boost_asio.reference.basic_socket_streambuf.connect.overload2 more...]]`` 43151 43152 43153[section:overload1 basic_socket_streambuf::connect (1 of 2 overloads)] 43154 43155 43156Establish a connection. 43157 43158 43159 basic_socket_streambuf * connect( 43160 const endpoint_type & endpoint); 43161 43162 43163This function establishes a connection to the specified endpoint. 43164 43165 43166[heading Return Value] 43167 43168`this` if a connection was successfully established, a null pointer otherwise. 43169 43170 43171 43172 43173[endsect] 43174 43175 43176 43177[section:overload2 basic_socket_streambuf::connect (2 of 2 overloads)] 43178 43179 43180Establish a connection. 43181 43182 43183 template< 43184 typename T1, 43185 ... , 43186 typename TN> 43187 basic_socket_streambuf * connect( 43188 T1 t1, 43189 ... , 43190 TN tn); 43191 43192 43193This function automatically establishes a connection based on the supplied resolver query parameters. The arguments are used to construct a resolver query object. 43194 43195 43196[heading Return Value] 43197 43198`this` if a connection was successfully established, a null pointer otherwise. 43199 43200 43201 43202 43203[endsect] 43204 43205 43206[endsect] 43207 43208 43209[section:duration basic_socket_streambuf::duration] 43210 43211[indexterm2 boost_asio.indexterm.basic_socket_streambuf.duration..duration..basic_socket_streambuf] 43212The duration type. 43213 43214 43215 typedef WaitTraits::duration duration; 43216 43217 43218 43219[heading Requirements] 43220 43221['Header: ][^boost/asio/basic_socket_streambuf.hpp] 43222 43223['Convenience header: ][^boost/asio.hpp] 43224 43225 43226[endsect] 43227 43228 43229 43230[section:duration_type basic_socket_streambuf::duration_type] 43231 43232[indexterm2 boost_asio.indexterm.basic_socket_streambuf.duration_type..duration_type..basic_socket_streambuf] 43233(Deprecated: Use duration.) The duration type. 43234 43235 43236 typedef WaitTraits::duration_type duration_type; 43237 43238 43239 43240[heading Requirements] 43241 43242['Header: ][^boost/asio/basic_socket_streambuf.hpp] 43243 43244['Convenience header: ][^boost/asio.hpp] 43245 43246 43247[endsect] 43248 43249 43250 43251[section:endpoint_type basic_socket_streambuf::endpoint_type] 43252 43253[indexterm2 boost_asio.indexterm.basic_socket_streambuf.endpoint_type..endpoint_type..basic_socket_streambuf] 43254The endpoint type. 43255 43256 43257 typedef Protocol::endpoint endpoint_type; 43258 43259 43260 43261[heading Requirements] 43262 43263['Header: ][^boost/asio/basic_socket_streambuf.hpp] 43264 43265['Convenience header: ][^boost/asio.hpp] 43266 43267 43268[endsect] 43269 43270 43271 43272[section:error basic_socket_streambuf::error] 43273 43274[indexterm2 boost_asio.indexterm.basic_socket_streambuf.error..error..basic_socket_streambuf] 43275Get the last error associated with the stream buffer. 43276 43277 43278 const boost::system::error_code & error() const; 43279 43280 43281 43282[heading Return Value] 43283 43284An `error_code` corresponding to the last error from the stream buffer. 43285 43286 43287 43288 43289[endsect] 43290 43291 43292 43293[section:expires_after basic_socket_streambuf::expires_after] 43294 43295[indexterm2 boost_asio.indexterm.basic_socket_streambuf.expires_after..expires_after..basic_socket_streambuf] 43296Set the stream buffer's expiry time relative to now. 43297 43298 43299 void expires_after( 43300 const duration & expiry_time); 43301 43302 43303This 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`. 43304 43305 43306[heading Parameters] 43307 43308 43309[variablelist 43310 43311[[expiry_time][The expiry time to be used for the timer. ]] 43312 43313] 43314 43315 43316 43317 43318[endsect] 43319 43320 43321[section:expires_at basic_socket_streambuf::expires_at] 43322 43323[indexterm2 boost_asio.indexterm.basic_socket_streambuf.expires_at..expires_at..basic_socket_streambuf] 43324(Deprecated: Use `expiry()`.) Get the stream buffer's expiry time as an absolute time. 43325 43326 43327 time_point ``[link boost_asio.reference.basic_socket_streambuf.expires_at.overload1 expires_at]``() const; 43328 `` [''''»''' [link boost_asio.reference.basic_socket_streambuf.expires_at.overload1 more...]]`` 43329 43330 43331Set the stream buffer's expiry time as an absolute time. 43332 43333 43334 void ``[link boost_asio.reference.basic_socket_streambuf.expires_at.overload2 expires_at]``( 43335 const time_point & expiry_time); 43336 `` [''''»''' [link boost_asio.reference.basic_socket_streambuf.expires_at.overload2 more...]]`` 43337 43338 43339[section:overload1 basic_socket_streambuf::expires_at (1 of 2 overloads)] 43340 43341 43342(Deprecated: Use `expiry()`.) Get the stream buffer's expiry time as an absolute time. 43343 43344 43345 time_point expires_at() const; 43346 43347 43348 43349[heading Return Value] 43350 43351An absolute time value representing the stream buffer's expiry time. 43352 43353 43354 43355 43356[endsect] 43357 43358 43359 43360[section:overload2 basic_socket_streambuf::expires_at (2 of 2 overloads)] 43361 43362 43363Set the stream buffer's expiry time as an absolute time. 43364 43365 43366 void expires_at( 43367 const time_point & expiry_time); 43368 43369 43370This 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`. 43371 43372 43373[heading Parameters] 43374 43375 43376[variablelist 43377 43378[[expiry_time][The expiry time to be used for the stream. ]] 43379 43380] 43381 43382 43383 43384 43385[endsect] 43386 43387 43388[endsect] 43389 43390[section:expires_from_now basic_socket_streambuf::expires_from_now] 43391 43392[indexterm2 boost_asio.indexterm.basic_socket_streambuf.expires_from_now..expires_from_now..basic_socket_streambuf] 43393(Deprecated: Use `expiry()`.) Get the stream buffer's expiry time relative to now. 43394 43395 43396 duration ``[link boost_asio.reference.basic_socket_streambuf.expires_from_now.overload1 expires_from_now]``() const; 43397 `` [''''»''' [link boost_asio.reference.basic_socket_streambuf.expires_from_now.overload1 more...]]`` 43398 43399 43400(Deprecated: Use `expires_after()`.) Set the stream buffer's expiry time relative to now. 43401 43402 43403 void ``[link boost_asio.reference.basic_socket_streambuf.expires_from_now.overload2 expires_from_now]``( 43404 const duration & expiry_time); 43405 `` [''''»''' [link boost_asio.reference.basic_socket_streambuf.expires_from_now.overload2 more...]]`` 43406 43407 43408[section:overload1 basic_socket_streambuf::expires_from_now (1 of 2 overloads)] 43409 43410 43411(Deprecated: Use `expiry()`.) Get the stream buffer's expiry time relative to now. 43412 43413 43414 duration expires_from_now() const; 43415 43416 43417 43418[heading Return Value] 43419 43420A relative time value representing the stream buffer's expiry time. 43421 43422 43423 43424 43425[endsect] 43426 43427 43428 43429[section:overload2 basic_socket_streambuf::expires_from_now (2 of 2 overloads)] 43430 43431 43432(Deprecated: Use `expires_after()`.) Set the stream buffer's expiry time relative to now. 43433 43434 43435 void expires_from_now( 43436 const duration & expiry_time); 43437 43438 43439This 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`. 43440 43441 43442[heading Parameters] 43443 43444 43445[variablelist 43446 43447[[expiry_time][The expiry time to be used for the timer. ]] 43448 43449] 43450 43451 43452 43453 43454[endsect] 43455 43456 43457[endsect] 43458 43459 43460[section:expiry basic_socket_streambuf::expiry] 43461 43462[indexterm2 boost_asio.indexterm.basic_socket_streambuf.expiry..expiry..basic_socket_streambuf] 43463Get the stream buffer's expiry time as an absolute time. 43464 43465 43466 time_point expiry() const; 43467 43468 43469 43470[heading Return Value] 43471 43472An absolute time value representing the stream buffer's expiry time. 43473 43474 43475 43476 43477[endsect] 43478 43479 43480 43481[section:operator_eq_ basic_socket_streambuf::operator=] 43482 43483[indexterm2 boost_asio.indexterm.basic_socket_streambuf.operator_eq_..operator=..basic_socket_streambuf] 43484Move-assign a [link boost_asio.reference.basic_socket_streambuf `basic_socket_streambuf`] from another. 43485 43486 43487 basic_socket_streambuf & operator=( 43488 basic_socket_streambuf && other); 43489 43490 43491 43492[endsect] 43493 43494 43495 43496[section:overflow basic_socket_streambuf::overflow] 43497 43498[indexterm2 boost_asio.indexterm.basic_socket_streambuf.overflow..overflow..basic_socket_streambuf] 43499 43500 int_type overflow( 43501 int_type c); 43502 43503 43504 43505[endsect] 43506 43507 43508 43509[section:protocol_type basic_socket_streambuf::protocol_type] 43510 43511[indexterm2 boost_asio.indexterm.basic_socket_streambuf.protocol_type..protocol_type..basic_socket_streambuf] 43512The protocol type. 43513 43514 43515 typedef Protocol protocol_type; 43516 43517 43518 43519[heading Requirements] 43520 43521['Header: ][^boost/asio/basic_socket_streambuf.hpp] 43522 43523['Convenience header: ][^boost/asio.hpp] 43524 43525 43526[endsect] 43527 43528 43529 43530[section:puberror basic_socket_streambuf::puberror] 43531 43532[indexterm2 boost_asio.indexterm.basic_socket_streambuf.puberror..puberror..basic_socket_streambuf] 43533(Deprecated: Use `error()`.) Get the last error associated with the stream buffer. 43534 43535 43536 const boost::system::error_code & puberror() const; 43537 43538 43539 43540[heading Return Value] 43541 43542An `error_code` corresponding to the last error from the stream buffer. 43543 43544 43545 43546 43547[endsect] 43548 43549 43550 43551[section:setbuf basic_socket_streambuf::setbuf] 43552 43553[indexterm2 boost_asio.indexterm.basic_socket_streambuf.setbuf..setbuf..basic_socket_streambuf] 43554 43555 std::streambuf * setbuf( 43556 char_type * s, 43557 std::streamsize n); 43558 43559 43560 43561[endsect] 43562 43563 43564 43565[section:socket basic_socket_streambuf::socket] 43566 43567[indexterm2 boost_asio.indexterm.basic_socket_streambuf.socket..socket..basic_socket_streambuf] 43568Get a reference to the underlying socket. 43569 43570 43571 basic_socket< Protocol > & socket(); 43572 43573 43574 43575[endsect] 43576 43577 43578 43579[section:sync basic_socket_streambuf::sync] 43580 43581[indexterm2 boost_asio.indexterm.basic_socket_streambuf.sync..sync..basic_socket_streambuf] 43582 43583 int sync(); 43584 43585 43586 43587[endsect] 43588 43589 43590 43591[section:time_point basic_socket_streambuf::time_point] 43592 43593[indexterm2 boost_asio.indexterm.basic_socket_streambuf.time_point..time_point..basic_socket_streambuf] 43594The time type. 43595 43596 43597 typedef WaitTraits::time_point time_point; 43598 43599 43600 43601[heading Requirements] 43602 43603['Header: ][^boost/asio/basic_socket_streambuf.hpp] 43604 43605['Convenience header: ][^boost/asio.hpp] 43606 43607 43608[endsect] 43609 43610 43611 43612[section:time_type basic_socket_streambuf::time_type] 43613 43614[indexterm2 boost_asio.indexterm.basic_socket_streambuf.time_type..time_type..basic_socket_streambuf] 43615(Deprecated: Use time\_point.) The time type. 43616 43617 43618 typedef WaitTraits::time_type time_type; 43619 43620 43621 43622[heading Requirements] 43623 43624['Header: ][^boost/asio/basic_socket_streambuf.hpp] 43625 43626['Convenience header: ][^boost/asio.hpp] 43627 43628 43629[endsect] 43630 43631 43632 43633[section:underflow basic_socket_streambuf::underflow] 43634 43635[indexterm2 boost_asio.indexterm.basic_socket_streambuf.underflow..underflow..basic_socket_streambuf] 43636 43637 int_type underflow(); 43638 43639 43640 43641[endsect] 43642 43643 43644 43645[section:_basic_socket_streambuf basic_socket_streambuf::~basic_socket_streambuf] 43646 43647[indexterm2 boost_asio.indexterm.basic_socket_streambuf._basic_socket_streambuf..~basic_socket_streambuf..basic_socket_streambuf] 43648Destructor flushes buffered data. 43649 43650 43651 virtual ~basic_socket_streambuf(); 43652 43653 43654 43655[endsect] 43656 43657 43658 43659[endsect] 43660 43661[section:basic_stream_socket basic_stream_socket] 43662 43663[indexterm1 boost_asio.indexterm.basic_stream_socket..basic_stream_socket] 43664 43665 43666Provides stream-oriented socket functionality. 43667 43668 43669 template< 43670 typename ``[link boost_asio.reference.Protocol Protocol]``, 43671 typename ``[link boost_asio.reference.Executor1 Executor]``> 43672 class basic_stream_socket : 43673 public basic_socket< Protocol, Executor > 43674 43675 43676[heading Types] 43677[table 43678 [[Name][Description]] 43679 43680 [ 43681 43682 [[link boost_asio.reference.basic_stream_socket__rebind_executor [*rebind_executor]]] 43683 [Rebinds the socket type to another executor. ] 43684 43685 ] 43686 43687 [ 43688 43689 [[link boost_asio.reference.basic_stream_socket.broadcast [*broadcast]]] 43690 [Socket option to permit sending of broadcast messages. ] 43691 43692 ] 43693 43694 [ 43695 43696 [[link boost_asio.reference.basic_stream_socket.bytes_readable [*bytes_readable]]] 43697 [IO control command to get the amount of data that can be read without blocking. ] 43698 43699 ] 43700 43701 [ 43702 43703 [[link boost_asio.reference.basic_stream_socket.debug [*debug]]] 43704 [Socket option to enable socket-level debugging. ] 43705 43706 ] 43707 43708 [ 43709 43710 [[link boost_asio.reference.basic_stream_socket.do_not_route [*do_not_route]]] 43711 [Socket option to prevent routing, use local interfaces only. ] 43712 43713 ] 43714 43715 [ 43716 43717 [[link boost_asio.reference.basic_stream_socket.enable_connection_aborted [*enable_connection_aborted]]] 43718 [Socket option to report aborted connections on accept. ] 43719 43720 ] 43721 43722 [ 43723 43724 [[link boost_asio.reference.basic_stream_socket.endpoint_type [*endpoint_type]]] 43725 [The endpoint type. ] 43726 43727 ] 43728 43729 [ 43730 43731 [[link boost_asio.reference.basic_stream_socket.executor_type [*executor_type]]] 43732 [The type of the executor associated with the object. ] 43733 43734 ] 43735 43736 [ 43737 43738 [[link boost_asio.reference.basic_stream_socket.keep_alive [*keep_alive]]] 43739 [Socket option to send keep-alives. ] 43740 43741 ] 43742 43743 [ 43744 43745 [[link boost_asio.reference.basic_stream_socket.linger [*linger]]] 43746 [Socket option to specify whether the socket lingers on close if unsent data is present. ] 43747 43748 ] 43749 43750 [ 43751 43752 [[link boost_asio.reference.basic_stream_socket.lowest_layer_type [*lowest_layer_type]]] 43753 [A basic_socket is always the lowest layer. ] 43754 43755 ] 43756 43757 [ 43758 43759 [[link boost_asio.reference.basic_stream_socket.message_flags [*message_flags]]] 43760 [Bitmask type for flags that can be passed to send and receive operations. ] 43761 43762 ] 43763 43764 [ 43765 43766 [[link boost_asio.reference.basic_stream_socket.native_handle_type [*native_handle_type]]] 43767 [The native representation of a socket. ] 43768 43769 ] 43770 43771 [ 43772 43773 [[link boost_asio.reference.basic_stream_socket.out_of_band_inline [*out_of_band_inline]]] 43774 [Socket option for putting received out-of-band data inline. ] 43775 43776 ] 43777 43778 [ 43779 43780 [[link boost_asio.reference.basic_stream_socket.protocol_type [*protocol_type]]] 43781 [The protocol type. ] 43782 43783 ] 43784 43785 [ 43786 43787 [[link boost_asio.reference.basic_stream_socket.receive_buffer_size [*receive_buffer_size]]] 43788 [Socket option for the receive buffer size of a socket. ] 43789 43790 ] 43791 43792 [ 43793 43794 [[link boost_asio.reference.basic_stream_socket.receive_low_watermark [*receive_low_watermark]]] 43795 [Socket option for the receive low watermark. ] 43796 43797 ] 43798 43799 [ 43800 43801 [[link boost_asio.reference.basic_stream_socket.reuse_address [*reuse_address]]] 43802 [Socket option to allow the socket to be bound to an address that is already in use. ] 43803 43804 ] 43805 43806 [ 43807 43808 [[link boost_asio.reference.basic_stream_socket.send_buffer_size [*send_buffer_size]]] 43809 [Socket option for the send buffer size of a socket. ] 43810 43811 ] 43812 43813 [ 43814 43815 [[link boost_asio.reference.basic_stream_socket.send_low_watermark [*send_low_watermark]]] 43816 [Socket option for the send low watermark. ] 43817 43818 ] 43819 43820 [ 43821 43822 [[link boost_asio.reference.basic_stream_socket.shutdown_type [*shutdown_type]]] 43823 [Different ways a socket may be shutdown. ] 43824 43825 ] 43826 43827 [ 43828 43829 [[link boost_asio.reference.basic_stream_socket.wait_type [*wait_type]]] 43830 [Wait types. ] 43831 43832 ] 43833 43834] 43835 43836[heading Member Functions] 43837[table 43838 [[Name][Description]] 43839 43840 [ 43841 [[link boost_asio.reference.basic_stream_socket.assign [*assign]]] 43842 [Assign an existing native socket to the socket. ] 43843 ] 43844 43845 [ 43846 [[link boost_asio.reference.basic_stream_socket.async_connect [*async_connect]]] 43847 [Start an asynchronous connect. ] 43848 ] 43849 43850 [ 43851 [[link boost_asio.reference.basic_stream_socket.async_read_some [*async_read_some]]] 43852 [Start an asynchronous read. ] 43853 ] 43854 43855 [ 43856 [[link boost_asio.reference.basic_stream_socket.async_receive [*async_receive]]] 43857 [Start an asynchronous receive. ] 43858 ] 43859 43860 [ 43861 [[link boost_asio.reference.basic_stream_socket.async_send [*async_send]]] 43862 [Start an asynchronous send. ] 43863 ] 43864 43865 [ 43866 [[link boost_asio.reference.basic_stream_socket.async_wait [*async_wait]]] 43867 [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 43868 ] 43869 43870 [ 43871 [[link boost_asio.reference.basic_stream_socket.async_write_some [*async_write_some]]] 43872 [Start an asynchronous write. ] 43873 ] 43874 43875 [ 43876 [[link boost_asio.reference.basic_stream_socket.at_mark [*at_mark]]] 43877 [Determine whether the socket is at the out-of-band data mark. ] 43878 ] 43879 43880 [ 43881 [[link boost_asio.reference.basic_stream_socket.available [*available]]] 43882 [Determine the number of bytes available for reading. ] 43883 ] 43884 43885 [ 43886 [[link boost_asio.reference.basic_stream_socket.basic_stream_socket [*basic_stream_socket]] [constructor]] 43887 [Construct a basic_stream_socket without opening it. 43888 [hr] 43889 Construct and open a basic_stream_socket. 43890 [hr] 43891 Construct a basic_stream_socket, opening it and binding it to the given local endpoint. 43892 [hr] 43893 Construct a basic_stream_socket on an existing native socket. 43894 [hr] 43895 Move-construct a basic_stream_socket from another. 43896 [hr] 43897 Move-construct a basic_stream_socket from a socket of another protocol type. ] 43898 ] 43899 43900 [ 43901 [[link boost_asio.reference.basic_stream_socket.bind [*bind]]] 43902 [Bind the socket to the given local endpoint. ] 43903 ] 43904 43905 [ 43906 [[link boost_asio.reference.basic_stream_socket.cancel [*cancel]]] 43907 [Cancel all asynchronous operations associated with the socket. ] 43908 ] 43909 43910 [ 43911 [[link boost_asio.reference.basic_stream_socket.close [*close]]] 43912 [Close the socket. ] 43913 ] 43914 43915 [ 43916 [[link boost_asio.reference.basic_stream_socket.connect [*connect]]] 43917 [Connect the socket to the specified endpoint. ] 43918 ] 43919 43920 [ 43921 [[link boost_asio.reference.basic_stream_socket.get_executor [*get_executor]]] 43922 [Get the executor associated with the object. ] 43923 ] 43924 43925 [ 43926 [[link boost_asio.reference.basic_stream_socket.get_option [*get_option]]] 43927 [Get an option from the socket. ] 43928 ] 43929 43930 [ 43931 [[link boost_asio.reference.basic_stream_socket.io_control [*io_control]]] 43932 [Perform an IO control command on the socket. ] 43933 ] 43934 43935 [ 43936 [[link boost_asio.reference.basic_stream_socket.is_open [*is_open]]] 43937 [Determine whether the socket is open. ] 43938 ] 43939 43940 [ 43941 [[link boost_asio.reference.basic_stream_socket.local_endpoint [*local_endpoint]]] 43942 [Get the local endpoint of the socket. ] 43943 ] 43944 43945 [ 43946 [[link boost_asio.reference.basic_stream_socket.lowest_layer [*lowest_layer]]] 43947 [Get a reference to the lowest layer. 43948 [hr] 43949 Get a const reference to the lowest layer. ] 43950 ] 43951 43952 [ 43953 [[link boost_asio.reference.basic_stream_socket.native_handle [*native_handle]]] 43954 [Get the native socket representation. ] 43955 ] 43956 43957 [ 43958 [[link boost_asio.reference.basic_stream_socket.native_non_blocking [*native_non_blocking]]] 43959 [Gets the non-blocking mode of the native socket implementation. 43960 [hr] 43961 Sets the non-blocking mode of the native socket implementation. ] 43962 ] 43963 43964 [ 43965 [[link boost_asio.reference.basic_stream_socket.non_blocking [*non_blocking]]] 43966 [Gets the non-blocking mode of the socket. 43967 [hr] 43968 Sets the non-blocking mode of the socket. ] 43969 ] 43970 43971 [ 43972 [[link boost_asio.reference.basic_stream_socket.open [*open]]] 43973 [Open the socket using the specified protocol. ] 43974 ] 43975 43976 [ 43977 [[link boost_asio.reference.basic_stream_socket.operator_eq_ [*operator=]]] 43978 [Move-assign a basic_stream_socket from another. 43979 [hr] 43980 Move-assign a basic_stream_socket from a socket of another protocol type. ] 43981 ] 43982 43983 [ 43984 [[link boost_asio.reference.basic_stream_socket.read_some [*read_some]]] 43985 [Read some data from the socket. ] 43986 ] 43987 43988 [ 43989 [[link boost_asio.reference.basic_stream_socket.receive [*receive]]] 43990 [Receive some data on the socket. 43991 [hr] 43992 Receive some data on a connected socket. ] 43993 ] 43994 43995 [ 43996 [[link boost_asio.reference.basic_stream_socket.release [*release]]] 43997 [Release ownership of the underlying native socket. ] 43998 ] 43999 44000 [ 44001 [[link boost_asio.reference.basic_stream_socket.remote_endpoint [*remote_endpoint]]] 44002 [Get the remote endpoint of the socket. ] 44003 ] 44004 44005 [ 44006 [[link boost_asio.reference.basic_stream_socket.send [*send]]] 44007 [Send some data on the socket. ] 44008 ] 44009 44010 [ 44011 [[link boost_asio.reference.basic_stream_socket.set_option [*set_option]]] 44012 [Set an option on the socket. ] 44013 ] 44014 44015 [ 44016 [[link boost_asio.reference.basic_stream_socket.shutdown [*shutdown]]] 44017 [Disable sends or receives on the socket. ] 44018 ] 44019 44020 [ 44021 [[link boost_asio.reference.basic_stream_socket.wait [*wait]]] 44022 [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 44023 ] 44024 44025 [ 44026 [[link boost_asio.reference.basic_stream_socket.write_some [*write_some]]] 44027 [Write some data to the socket. ] 44028 ] 44029 44030 [ 44031 [[link boost_asio.reference.basic_stream_socket._basic_stream_socket [*~basic_stream_socket]] [destructor]] 44032 [Destroys the socket. ] 44033 ] 44034 44035] 44036 44037[heading Data Members] 44038[table 44039 [[Name][Description]] 44040 44041 [ 44042 [[link boost_asio.reference.basic_stream_socket.max_connections [*max_connections]] [static]] 44043 [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ] 44044 ] 44045 44046 [ 44047 [[link boost_asio.reference.basic_stream_socket.max_listen_connections [*max_listen_connections]] [static]] 44048 [The maximum length of the queue of pending incoming connections. ] 44049 ] 44050 44051 [ 44052 [[link boost_asio.reference.basic_stream_socket.message_do_not_route [*message_do_not_route]] [static]] 44053 [Specify that the data should not be subject to routing. ] 44054 ] 44055 44056 [ 44057 [[link boost_asio.reference.basic_stream_socket.message_end_of_record [*message_end_of_record]] [static]] 44058 [Specifies that the data marks the end of a record. ] 44059 ] 44060 44061 [ 44062 [[link boost_asio.reference.basic_stream_socket.message_out_of_band [*message_out_of_band]] [static]] 44063 [Process out-of-band data. ] 44064 ] 44065 44066 [ 44067 [[link boost_asio.reference.basic_stream_socket.message_peek [*message_peek]] [static]] 44068 [Peek at incoming data without removing it from the input queue. ] 44069 ] 44070 44071] 44072 44073The [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] class template provides asynchronous and blocking stream-oriented socket functionality. 44074 44075 44076[heading Thread Safety] 44077 44078['Distinct] ['objects:] Safe. 44079 44080['Shared] ['objects:] Unsafe. 44081 44082Synchronous `send`, `receive`, and `connect` operations are thread safe with respect to each other, if the underlying operating system calls are also thread safe. This means that it is permitted to perform concurrent calls to these synchronous operations on a single socket object. Other synchronous operations, such as `open` or `close`, are not thread safe. 44083 44084 44085 44086 44087[heading Requirements] 44088 44089['Header: ][^boost/asio/basic_stream_socket.hpp] 44090 44091['Convenience header: ][^boost/asio.hpp] 44092 44093[section:assign basic_stream_socket::assign] 44094 44095[indexterm2 boost_asio.indexterm.basic_stream_socket.assign..assign..basic_stream_socket] 44096Assign an existing native socket to the socket. 44097 44098 44099 void ``[link boost_asio.reference.basic_stream_socket.assign.overload1 assign]``( 44100 const protocol_type & protocol, 44101 const native_handle_type & native_socket); 44102 `` [''''»''' [link boost_asio.reference.basic_stream_socket.assign.overload1 more...]]`` 44103 44104 void ``[link boost_asio.reference.basic_stream_socket.assign.overload2 assign]``( 44105 const protocol_type & protocol, 44106 const native_handle_type & native_socket, 44107 boost::system::error_code & ec); 44108 `` [''''»''' [link boost_asio.reference.basic_stream_socket.assign.overload2 more...]]`` 44109 44110 44111[section:overload1 basic_stream_socket::assign (1 of 2 overloads)] 44112 44113 44114['Inherited from basic_socket.] 44115 44116 44117Assign an existing native socket to the socket. 44118 44119 44120 void assign( 44121 const protocol_type & protocol, 44122 const native_handle_type & native_socket); 44123 44124 44125 44126[endsect] 44127 44128 44129 44130[section:overload2 basic_stream_socket::assign (2 of 2 overloads)] 44131 44132 44133['Inherited from basic_socket.] 44134 44135 44136Assign an existing native socket to the socket. 44137 44138 44139 void assign( 44140 const protocol_type & protocol, 44141 const native_handle_type & native_socket, 44142 boost::system::error_code & ec); 44143 44144 44145 44146[endsect] 44147 44148 44149[endsect] 44150 44151 44152[section:async_connect basic_stream_socket::async_connect] 44153 44154 44155['Inherited from basic_socket.] 44156 44157[indexterm2 boost_asio.indexterm.basic_stream_socket.async_connect..async_connect..basic_stream_socket] 44158Start an asynchronous connect. 44159 44160 44161 template< 44162 typename ``[link boost_asio.reference.ConnectHandler ConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 44163 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect( 44164 const endpoint_type & peer_endpoint, 44165 ConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 44166 44167 44168This function is used to asynchronously connect a socket to the specified remote endpoint. The function call always returns immediately. 44169 44170The 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. 44171 44172 44173[heading Parameters] 44174 44175 44176[variablelist 44177 44178[[peer_endpoint][The remote endpoint to which the socket will be connected. Copies will be made of the endpoint object as required.]] 44179 44180[[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: 44181`` 44182 void handler( 44183 const boost::system::error_code& error // Result of operation 44184 ); 44185`` 44186Regardless 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`].]] 44187 44188] 44189 44190 44191[heading Example] 44192 44193 44194 44195 void connect_handler(const boost::system::error_code& error) 44196 { 44197 if (!error) 44198 { 44199 // Connect succeeded. 44200 } 44201 } 44202 44203 ... 44204 44205 boost::asio::ip::tcp::socket socket(my_context); 44206 boost::asio::ip::tcp::endpoint endpoint( 44207 boost::asio::ip::address::from_string("1.2.3.4"), 12345); 44208 socket.async_connect(endpoint, connect_handler); 44209 44210 44211 44212 44213 44214 44215 44216[endsect] 44217 44218 44219 44220[section:async_read_some basic_stream_socket::async_read_some] 44221 44222[indexterm2 boost_asio.indexterm.basic_stream_socket.async_read_some..async_read_some..basic_stream_socket] 44223Start an asynchronous read. 44224 44225 44226 template< 44227 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 44228 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 44229 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_some( 44230 const MutableBufferSequence & buffers, 44231 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 44232 44233 44234This function is used to asynchronously read data from the stream socket. The function call always returns immediately. 44235 44236 44237[heading Parameters] 44238 44239 44240[variablelist 44241 44242[[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.]] 44243 44244[[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: 44245`` 44246 void handler( 44247 const boost::system::error_code& error, // Result of operation. 44248 std::size_t bytes_transferred // Number of bytes read. 44249 ); 44250`` 44251Regardless 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`].]] 44252 44253] 44254 44255 44256[heading Remarks] 44257 44258The 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. 44259 44260 44261[heading Example] 44262 44263To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 44264 44265 socket.async_read_some(boost::asio::buffer(data, size), handler); 44266 44267 44268See 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. 44269 44270 44271 44272 44273[endsect] 44274 44275 44276[section:async_receive basic_stream_socket::async_receive] 44277 44278[indexterm2 boost_asio.indexterm.basic_stream_socket.async_receive..async_receive..basic_stream_socket] 44279Start an asynchronous receive. 44280 44281 44282 template< 44283 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 44284 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 44285 ``[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]``( 44286 const MutableBufferSequence & buffers, 44287 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 44288 `` [''''»''' [link boost_asio.reference.basic_stream_socket.async_receive.overload1 more...]]`` 44289 44290 template< 44291 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 44292 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 44293 ``[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]``( 44294 const MutableBufferSequence & buffers, 44295 socket_base::message_flags flags, 44296 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 44297 `` [''''»''' [link boost_asio.reference.basic_stream_socket.async_receive.overload2 more...]]`` 44298 44299 44300[section:overload1 basic_stream_socket::async_receive (1 of 2 overloads)] 44301 44302 44303Start an asynchronous receive. 44304 44305 44306 template< 44307 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 44308 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 44309 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive( 44310 const MutableBufferSequence & buffers, 44311 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 44312 44313 44314This function is used to asynchronously receive data from the stream socket. The function call always returns immediately. 44315 44316 44317[heading Parameters] 44318 44319 44320[variablelist 44321 44322[[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.]] 44323 44324[[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: 44325`` 44326 void handler( 44327 const boost::system::error_code& error, // Result of operation. 44328 std::size_t bytes_transferred // Number of bytes received. 44329 ); 44330`` 44331Regardless 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`].]] 44332 44333] 44334 44335 44336[heading Remarks] 44337 44338The 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. 44339 44340 44341[heading Example] 44342 44343To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 44344 44345 socket.async_receive(boost::asio::buffer(data, size), handler); 44346 44347 44348See 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. 44349 44350 44351 44352 44353[endsect] 44354 44355 44356 44357[section:overload2 basic_stream_socket::async_receive (2 of 2 overloads)] 44358 44359 44360Start an asynchronous receive. 44361 44362 44363 template< 44364 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 44365 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 44366 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive( 44367 const MutableBufferSequence & buffers, 44368 socket_base::message_flags flags, 44369 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 44370 44371 44372This function is used to asynchronously receive data from the stream socket. The function call always returns immediately. 44373 44374 44375[heading Parameters] 44376 44377 44378[variablelist 44379 44380[[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.]] 44381 44382[[flags][Flags specifying how the receive call is to be made.]] 44383 44384[[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: 44385`` 44386 void handler( 44387 const boost::system::error_code& error, // Result of operation. 44388 std::size_t bytes_transferred // Number of bytes received. 44389 ); 44390`` 44391Regardless 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`].]] 44392 44393] 44394 44395 44396[heading Remarks] 44397 44398The 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. 44399 44400 44401[heading Example] 44402 44403To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 44404 44405 socket.async_receive(boost::asio::buffer(data, size), 0, handler); 44406 44407 44408See 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. 44409 44410 44411 44412 44413[endsect] 44414 44415 44416[endsect] 44417 44418[section:async_send basic_stream_socket::async_send] 44419 44420[indexterm2 boost_asio.indexterm.basic_stream_socket.async_send..async_send..basic_stream_socket] 44421Start an asynchronous send. 44422 44423 44424 template< 44425 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 44426 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 44427 ``[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]``( 44428 const ConstBufferSequence & buffers, 44429 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 44430 `` [''''»''' [link boost_asio.reference.basic_stream_socket.async_send.overload1 more...]]`` 44431 44432 template< 44433 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 44434 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 44435 ``[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]``( 44436 const ConstBufferSequence & buffers, 44437 socket_base::message_flags flags, 44438 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 44439 `` [''''»''' [link boost_asio.reference.basic_stream_socket.async_send.overload2 more...]]`` 44440 44441 44442[section:overload1 basic_stream_socket::async_send (1 of 2 overloads)] 44443 44444 44445Start an asynchronous send. 44446 44447 44448 template< 44449 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 44450 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 44451 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send( 44452 const ConstBufferSequence & buffers, 44453 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 44454 44455 44456This function is used to asynchronously send data on the stream socket. The function call always returns immediately. 44457 44458 44459[heading Parameters] 44460 44461 44462[variablelist 44463 44464[[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.]] 44465 44466[[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: 44467`` 44468 void handler( 44469 const boost::system::error_code& error, // Result of operation. 44470 std::size_t bytes_transferred // Number of bytes sent. 44471 ); 44472`` 44473Regardless 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`].]] 44474 44475] 44476 44477 44478[heading Remarks] 44479 44480The 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. 44481 44482 44483[heading Example] 44484 44485To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 44486 44487 socket.async_send(boost::asio::buffer(data, size), handler); 44488 44489 44490See 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. 44491 44492 44493 44494 44495[endsect] 44496 44497 44498 44499[section:overload2 basic_stream_socket::async_send (2 of 2 overloads)] 44500 44501 44502Start an asynchronous send. 44503 44504 44505 template< 44506 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 44507 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 44508 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send( 44509 const ConstBufferSequence & buffers, 44510 socket_base::message_flags flags, 44511 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 44512 44513 44514This function is used to asynchronously send data on the stream socket. The function call always returns immediately. 44515 44516 44517[heading Parameters] 44518 44519 44520[variablelist 44521 44522[[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.]] 44523 44524[[flags][Flags specifying how the send call is to be made.]] 44525 44526[[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: 44527`` 44528 void handler( 44529 const boost::system::error_code& error, // Result of operation. 44530 std::size_t bytes_transferred // Number of bytes sent. 44531 ); 44532`` 44533Regardless 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`].]] 44534 44535] 44536 44537 44538[heading Remarks] 44539 44540The 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. 44541 44542 44543[heading Example] 44544 44545To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 44546 44547 socket.async_send(boost::asio::buffer(data, size), 0, handler); 44548 44549 44550See 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. 44551 44552 44553 44554 44555[endsect] 44556 44557 44558[endsect] 44559 44560 44561[section:async_wait basic_stream_socket::async_wait] 44562 44563 44564['Inherited from basic_socket.] 44565 44566[indexterm2 boost_asio.indexterm.basic_stream_socket.async_wait..async_wait..basic_stream_socket] 44567Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. 44568 44569 44570 template< 44571 typename ``[link boost_asio.reference.WaitHandler WaitHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 44572 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait( 44573 wait_type w, 44574 WaitHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 44575 44576 44577This function is used to perform an asynchronous wait for a socket to enter a ready to read, write or error condition state. 44578 44579 44580[heading Parameters] 44581 44582 44583[variablelist 44584 44585[[w][Specifies the desired socket state.]] 44586 44587[[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: 44588`` 44589 void handler( 44590 const boost::system::error_code& error // Result of operation 44591 ); 44592`` 44593Regardless 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`].]] 44594 44595] 44596 44597 44598[heading Example] 44599 44600 44601 44602 void wait_handler(const boost::system::error_code& error) 44603 { 44604 if (!error) 44605 { 44606 // Wait succeeded. 44607 } 44608 } 44609 44610 ... 44611 44612 boost::asio::ip::tcp::socket socket(my_context); 44613 ... 44614 socket.async_wait(boost::asio::ip::tcp::socket::wait_read, wait_handler); 44615 44616 44617 44618 44619 44620 44621 44622[endsect] 44623 44624 44625 44626[section:async_write_some basic_stream_socket::async_write_some] 44627 44628[indexterm2 boost_asio.indexterm.basic_stream_socket.async_write_some..async_write_some..basic_stream_socket] 44629Start an asynchronous write. 44630 44631 44632 template< 44633 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 44634 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 44635 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_some( 44636 const ConstBufferSequence & buffers, 44637 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 44638 44639 44640This function is used to asynchronously write data to the stream socket. The function call always returns immediately. 44641 44642 44643[heading Parameters] 44644 44645 44646[variablelist 44647 44648[[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.]] 44649 44650[[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: 44651`` 44652 void handler( 44653 const boost::system::error_code& error, // Result of operation. 44654 std::size_t bytes_transferred // Number of bytes written. 44655 ); 44656`` 44657Regardless 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`].]] 44658 44659] 44660 44661 44662[heading Remarks] 44663 44664The 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. 44665 44666 44667[heading Example] 44668 44669To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 44670 44671 socket.async_write_some(boost::asio::buffer(data, size), handler); 44672 44673 44674See 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. 44675 44676 44677 44678 44679[endsect] 44680 44681 44682[section:at_mark basic_stream_socket::at_mark] 44683 44684[indexterm2 boost_asio.indexterm.basic_stream_socket.at_mark..at_mark..basic_stream_socket] 44685Determine whether the socket is at the out-of-band data mark. 44686 44687 44688 bool ``[link boost_asio.reference.basic_stream_socket.at_mark.overload1 at_mark]``() const; 44689 `` [''''»''' [link boost_asio.reference.basic_stream_socket.at_mark.overload1 more...]]`` 44690 44691 bool ``[link boost_asio.reference.basic_stream_socket.at_mark.overload2 at_mark]``( 44692 boost::system::error_code & ec) const; 44693 `` [''''»''' [link boost_asio.reference.basic_stream_socket.at_mark.overload2 more...]]`` 44694 44695 44696[section:overload1 basic_stream_socket::at_mark (1 of 2 overloads)] 44697 44698 44699['Inherited from basic_socket.] 44700 44701 44702Determine whether the socket is at the out-of-band data mark. 44703 44704 44705 bool at_mark() const; 44706 44707 44708This function is used to check whether the socket input is currently positioned at the out-of-band data mark. 44709 44710 44711[heading Return Value] 44712 44713A bool indicating whether the socket is at the out-of-band data mark. 44714 44715 44716[heading Exceptions] 44717 44718 44719[variablelist 44720 44721[[boost::system::system_error][Thrown on failure. ]] 44722 44723] 44724 44725 44726 44727 44728[endsect] 44729 44730 44731 44732[section:overload2 basic_stream_socket::at_mark (2 of 2 overloads)] 44733 44734 44735['Inherited from basic_socket.] 44736 44737 44738Determine whether the socket is at the out-of-band data mark. 44739 44740 44741 bool at_mark( 44742 boost::system::error_code & ec) const; 44743 44744 44745This function is used to check whether the socket input is currently positioned at the out-of-band data mark. 44746 44747 44748[heading Parameters] 44749 44750 44751[variablelist 44752 44753[[ec][Set to indicate what error occurred, if any.]] 44754 44755] 44756 44757 44758[heading Return Value] 44759 44760A bool indicating whether the socket is at the out-of-band data mark. 44761 44762 44763 44764 44765[endsect] 44766 44767 44768[endsect] 44769 44770[section:available basic_stream_socket::available] 44771 44772[indexterm2 boost_asio.indexterm.basic_stream_socket.available..available..basic_stream_socket] 44773Determine the number of bytes available for reading. 44774 44775 44776 std::size_t ``[link boost_asio.reference.basic_stream_socket.available.overload1 available]``() const; 44777 `` [''''»''' [link boost_asio.reference.basic_stream_socket.available.overload1 more...]]`` 44778 44779 std::size_t ``[link boost_asio.reference.basic_stream_socket.available.overload2 available]``( 44780 boost::system::error_code & ec) const; 44781 `` [''''»''' [link boost_asio.reference.basic_stream_socket.available.overload2 more...]]`` 44782 44783 44784[section:overload1 basic_stream_socket::available (1 of 2 overloads)] 44785 44786 44787['Inherited from basic_socket.] 44788 44789 44790Determine the number of bytes available for reading. 44791 44792 44793 std::size_t available() const; 44794 44795 44796This function is used to determine the number of bytes that may be read without blocking. 44797 44798 44799[heading Return Value] 44800 44801The number of bytes that may be read without blocking, or 0 if an error occurs. 44802 44803 44804[heading Exceptions] 44805 44806 44807[variablelist 44808 44809[[boost::system::system_error][Thrown on failure. ]] 44810 44811] 44812 44813 44814 44815 44816[endsect] 44817 44818 44819 44820[section:overload2 basic_stream_socket::available (2 of 2 overloads)] 44821 44822 44823['Inherited from basic_socket.] 44824 44825 44826Determine the number of bytes available for reading. 44827 44828 44829 std::size_t available( 44830 boost::system::error_code & ec) const; 44831 44832 44833This function is used to determine the number of bytes that may be read without blocking. 44834 44835 44836[heading Parameters] 44837 44838 44839[variablelist 44840 44841[[ec][Set to indicate what error occurred, if any.]] 44842 44843] 44844 44845 44846[heading Return Value] 44847 44848The number of bytes that may be read without blocking, or 0 if an error occurs. 44849 44850 44851 44852 44853[endsect] 44854 44855 44856[endsect] 44857 44858[section:basic_stream_socket basic_stream_socket::basic_stream_socket] 44859 44860[indexterm2 boost_asio.indexterm.basic_stream_socket.basic_stream_socket..basic_stream_socket..basic_stream_socket] 44861Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] without opening it. 44862 44863 44864 explicit ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload1 basic_stream_socket]``( 44865 const executor_type & ex); 44866 `` [''''»''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload1 more...]]`` 44867 44868 template< 44869 typename ExecutionContext> 44870 explicit ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload2 basic_stream_socket]``( 44871 ExecutionContext & context, 44872 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 44873 `` [''''»''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload2 more...]]`` 44874 44875 44876Construct and open a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`]. 44877 44878 44879 ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload3 basic_stream_socket]``( 44880 const executor_type & ex, 44881 const protocol_type & protocol); 44882 `` [''''»''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload3 more...]]`` 44883 44884 template< 44885 typename ExecutionContext> 44886 ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload4 basic_stream_socket]``( 44887 ExecutionContext & context, 44888 const protocol_type & protocol, 44889 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value, defaulted_constraint >::type = defaulted_constraint()); 44890 `` [''''»''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload4 more...]]`` 44891 44892 44893Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`], opening it and binding it to the given local endpoint. 44894 44895 44896 ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload5 basic_stream_socket]``( 44897 const executor_type & ex, 44898 const endpoint_type & endpoint); 44899 `` [''''»''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload5 more...]]`` 44900 44901 template< 44902 typename ExecutionContext> 44903 ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload6 basic_stream_socket]``( 44904 ExecutionContext & context, 44905 const endpoint_type & endpoint, 44906 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 44907 `` [''''»''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload6 more...]]`` 44908 44909 44910Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] on an existing native socket. 44911 44912 44913 ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload7 basic_stream_socket]``( 44914 const executor_type & ex, 44915 const protocol_type & protocol, 44916 const native_handle_type & native_socket); 44917 `` [''''»''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload7 more...]]`` 44918 44919 template< 44920 typename ExecutionContext> 44921 ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload8 basic_stream_socket]``( 44922 ExecutionContext & context, 44923 const protocol_type & protocol, 44924 const native_handle_type & native_socket, 44925 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 44926 `` [''''»''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload8 more...]]`` 44927 44928 44929Move-construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] from another. 44930 44931 44932 ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload9 basic_stream_socket]``( 44933 basic_stream_socket && other); 44934 `` [''''»''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload9 more...]]`` 44935 44936 44937Move-construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] from a socket of another protocol type. 44938 44939 44940 template< 44941 typename ``[link boost_asio.reference.Protocol Protocol1]``, 44942 typename ``[link boost_asio.reference.Executor1 Executor1]``> 44943 ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload10 basic_stream_socket]``( 44944 basic_stream_socket< Protocol1, Executor1 > && other, 44945 typename constraint< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type = 0); 44946 `` [''''»''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload10 more...]]`` 44947 44948 44949[section:overload1 basic_stream_socket::basic_stream_socket (1 of 10 overloads)] 44950 44951 44952Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] without opening it. 44953 44954 44955 basic_stream_socket( 44956 const executor_type & ex); 44957 44958 44959This 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. 44960 44961 44962[heading Parameters] 44963 44964 44965[variablelist 44966 44967[[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket. ]] 44968 44969] 44970 44971 44972 44973 44974[endsect] 44975 44976 44977 44978[section:overload2 basic_stream_socket::basic_stream_socket (2 of 10 overloads)] 44979 44980 44981Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] without opening it. 44982 44983 44984 template< 44985 typename ExecutionContext> 44986 basic_stream_socket( 44987 ExecutionContext & context, 44988 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 44989 44990 44991This 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. 44992 44993 44994[heading Parameters] 44995 44996 44997[variablelist 44998 44999[[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. ]] 45000 45001] 45002 45003 45004 45005 45006[endsect] 45007 45008 45009 45010[section:overload3 basic_stream_socket::basic_stream_socket (3 of 10 overloads)] 45011 45012 45013Construct and open a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`]. 45014 45015 45016 basic_stream_socket( 45017 const executor_type & ex, 45018 const protocol_type & protocol); 45019 45020 45021This constructor creates and opens a stream socket. The socket needs to be connected or accepted before data can be sent or received on it. 45022 45023 45024[heading Parameters] 45025 45026 45027[variablelist 45028 45029[[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]] 45030 45031[[protocol][An object specifying protocol parameters to be used.]] 45032 45033] 45034 45035 45036[heading Exceptions] 45037 45038 45039[variablelist 45040 45041[[boost::system::system_error][Thrown on failure. ]] 45042 45043] 45044 45045 45046 45047 45048[endsect] 45049 45050 45051 45052[section:overload4 basic_stream_socket::basic_stream_socket (4 of 10 overloads)] 45053 45054 45055Construct and open a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`]. 45056 45057 45058 template< 45059 typename ExecutionContext> 45060 basic_stream_socket( 45061 ExecutionContext & context, 45062 const protocol_type & protocol, 45063 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value, defaulted_constraint >::type = defaulted_constraint()); 45064 45065 45066This constructor creates and opens a stream socket. The socket needs to be connected or accepted before data can be sent or received on it. 45067 45068 45069[heading Parameters] 45070 45071 45072[variablelist 45073 45074[[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.]] 45075 45076[[protocol][An object specifying protocol parameters to be used.]] 45077 45078] 45079 45080 45081[heading Exceptions] 45082 45083 45084[variablelist 45085 45086[[boost::system::system_error][Thrown on failure. ]] 45087 45088] 45089 45090 45091 45092 45093[endsect] 45094 45095 45096 45097[section:overload5 basic_stream_socket::basic_stream_socket (5 of 10 overloads)] 45098 45099 45100Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`], opening it and binding it to the given local endpoint. 45101 45102 45103 basic_stream_socket( 45104 const executor_type & ex, 45105 const endpoint_type & endpoint); 45106 45107 45108This 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. 45109 45110 45111[heading Parameters] 45112 45113 45114[variablelist 45115 45116[[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]] 45117 45118[[endpoint][An endpoint on the local machine to which the stream socket will be bound.]] 45119 45120] 45121 45122 45123[heading Exceptions] 45124 45125 45126[variablelist 45127 45128[[boost::system::system_error][Thrown on failure. ]] 45129 45130] 45131 45132 45133 45134 45135[endsect] 45136 45137 45138 45139[section:overload6 basic_stream_socket::basic_stream_socket (6 of 10 overloads)] 45140 45141 45142Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`], opening it and binding it to the given local endpoint. 45143 45144 45145 template< 45146 typename ExecutionContext> 45147 basic_stream_socket( 45148 ExecutionContext & context, 45149 const endpoint_type & endpoint, 45150 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 45151 45152 45153This 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. 45154 45155 45156[heading Parameters] 45157 45158 45159[variablelist 45160 45161[[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.]] 45162 45163[[endpoint][An endpoint on the local machine to which the stream socket will be bound.]] 45164 45165] 45166 45167 45168[heading Exceptions] 45169 45170 45171[variablelist 45172 45173[[boost::system::system_error][Thrown on failure. ]] 45174 45175] 45176 45177 45178 45179 45180[endsect] 45181 45182 45183 45184[section:overload7 basic_stream_socket::basic_stream_socket (7 of 10 overloads)] 45185 45186 45187Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] on an existing native socket. 45188 45189 45190 basic_stream_socket( 45191 const executor_type & ex, 45192 const protocol_type & protocol, 45193 const native_handle_type & native_socket); 45194 45195 45196This constructor creates a stream socket object to hold an existing native socket. 45197 45198 45199[heading Parameters] 45200 45201 45202[variablelist 45203 45204[[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]] 45205 45206[[protocol][An object specifying protocol parameters to be used.]] 45207 45208[[native_socket][The new underlying socket implementation.]] 45209 45210] 45211 45212 45213[heading Exceptions] 45214 45215 45216[variablelist 45217 45218[[boost::system::system_error][Thrown on failure. ]] 45219 45220] 45221 45222 45223 45224 45225[endsect] 45226 45227 45228 45229[section:overload8 basic_stream_socket::basic_stream_socket (8 of 10 overloads)] 45230 45231 45232Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] on an existing native socket. 45233 45234 45235 template< 45236 typename ExecutionContext> 45237 basic_stream_socket( 45238 ExecutionContext & context, 45239 const protocol_type & protocol, 45240 const native_handle_type & native_socket, 45241 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 45242 45243 45244This constructor creates a stream socket object to hold an existing native socket. 45245 45246 45247[heading Parameters] 45248 45249 45250[variablelist 45251 45252[[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.]] 45253 45254[[protocol][An object specifying protocol parameters to be used.]] 45255 45256[[native_socket][The new underlying socket implementation.]] 45257 45258] 45259 45260 45261[heading Exceptions] 45262 45263 45264[variablelist 45265 45266[[boost::system::system_error][Thrown on failure. ]] 45267 45268] 45269 45270 45271 45272 45273[endsect] 45274 45275 45276 45277[section:overload9 basic_stream_socket::basic_stream_socket (9 of 10 overloads)] 45278 45279 45280Move-construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] from another. 45281 45282 45283 basic_stream_socket( 45284 basic_stream_socket && other); 45285 45286 45287This constructor moves a stream socket from one object to another. 45288 45289 45290[heading Parameters] 45291 45292 45293[variablelist 45294 45295[[other][The other [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] object from which the move will occur.]] 45296 45297] 45298 45299 45300[heading Remarks] 45301 45302Following the move, the moved-from object is in the same state as if constructed using the `basic_stream_socket(const executor_type&)` constructor. 45303 45304 45305 45306 45307[endsect] 45308 45309 45310 45311[section:overload10 basic_stream_socket::basic_stream_socket (10 of 10 overloads)] 45312 45313 45314Move-construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] from a socket of another protocol type. 45315 45316 45317 template< 45318 typename ``[link boost_asio.reference.Protocol Protocol1]``, 45319 typename ``[link boost_asio.reference.Executor1 Executor1]``> 45320 basic_stream_socket( 45321 basic_stream_socket< Protocol1, Executor1 > && other, 45322 typename constraint< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type = 0); 45323 45324 45325This constructor moves a stream socket from one object to another. 45326 45327 45328[heading Parameters] 45329 45330 45331[variablelist 45332 45333[[other][The other [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] object from which the move will occur.]] 45334 45335] 45336 45337 45338[heading Remarks] 45339 45340Following the move, the moved-from object is in the same state as if constructed using the `basic_stream_socket(const executor_type&)` constructor. 45341 45342 45343 45344 45345[endsect] 45346 45347 45348[endsect] 45349 45350[section:bind basic_stream_socket::bind] 45351 45352[indexterm2 boost_asio.indexterm.basic_stream_socket.bind..bind..basic_stream_socket] 45353Bind the socket to the given local endpoint. 45354 45355 45356 void ``[link boost_asio.reference.basic_stream_socket.bind.overload1 bind]``( 45357 const endpoint_type & endpoint); 45358 `` [''''»''' [link boost_asio.reference.basic_stream_socket.bind.overload1 more...]]`` 45359 45360 void ``[link boost_asio.reference.basic_stream_socket.bind.overload2 bind]``( 45361 const endpoint_type & endpoint, 45362 boost::system::error_code & ec); 45363 `` [''''»''' [link boost_asio.reference.basic_stream_socket.bind.overload2 more...]]`` 45364 45365 45366[section:overload1 basic_stream_socket::bind (1 of 2 overloads)] 45367 45368 45369['Inherited from basic_socket.] 45370 45371 45372Bind the socket to the given local endpoint. 45373 45374 45375 void bind( 45376 const endpoint_type & endpoint); 45377 45378 45379This function binds the socket to the specified endpoint on the local machine. 45380 45381 45382[heading Parameters] 45383 45384 45385[variablelist 45386 45387[[endpoint][An endpoint on the local machine to which the socket will be bound.]] 45388 45389] 45390 45391 45392[heading Exceptions] 45393 45394 45395[variablelist 45396 45397[[boost::system::system_error][Thrown on failure.]] 45398 45399] 45400 45401 45402[heading Example] 45403 45404 45405 45406 boost::asio::ip::tcp::socket socket(my_context); 45407 socket.open(boost::asio::ip::tcp::v4()); 45408 socket.bind(boost::asio::ip::tcp::endpoint( 45409 boost::asio::ip::tcp::v4(), 12345)); 45410 45411 45412 45413 45414 45415 45416 45417[endsect] 45418 45419 45420 45421[section:overload2 basic_stream_socket::bind (2 of 2 overloads)] 45422 45423 45424['Inherited from basic_socket.] 45425 45426 45427Bind the socket to the given local endpoint. 45428 45429 45430 void bind( 45431 const endpoint_type & endpoint, 45432 boost::system::error_code & ec); 45433 45434 45435This function binds the socket to the specified endpoint on the local machine. 45436 45437 45438[heading Parameters] 45439 45440 45441[variablelist 45442 45443[[endpoint][An endpoint on the local machine to which the socket will be bound.]] 45444 45445[[ec][Set to indicate what error occurred, if any.]] 45446 45447] 45448 45449 45450[heading Example] 45451 45452 45453 45454 boost::asio::ip::tcp::socket socket(my_context); 45455 socket.open(boost::asio::ip::tcp::v4()); 45456 boost::system::error_code ec; 45457 socket.bind(boost::asio::ip::tcp::endpoint( 45458 boost::asio::ip::tcp::v4(), 12345), ec); 45459 if (ec) 45460 { 45461 // An error occurred. 45462 } 45463 45464 45465 45466 45467 45468 45469 45470[endsect] 45471 45472 45473[endsect] 45474 45475 45476[section:broadcast basic_stream_socket::broadcast] 45477 45478 45479['Inherited from socket_base.] 45480 45481[indexterm2 boost_asio.indexterm.basic_stream_socket.broadcast..broadcast..basic_stream_socket] 45482Socket option to permit sending of broadcast messages. 45483 45484 45485 typedef implementation_defined broadcast; 45486 45487 45488 45489Implements the SOL\_SOCKET/SO\_BROADCAST socket option. 45490 45491 45492[heading Examples] 45493 45494Setting the option: 45495 45496 boost::asio::ip::udp::socket socket(my_context); 45497 ... 45498 boost::asio::socket_base::broadcast option(true); 45499 socket.set_option(option); 45500 45501 45502 45503 45504 45505Getting the current option value: 45506 45507 boost::asio::ip::udp::socket socket(my_context); 45508 ... 45509 boost::asio::socket_base::broadcast option; 45510 socket.get_option(option); 45511 bool is_set = option.value(); 45512 45513 45514 45515 45516 45517 45518 45519[heading Requirements] 45520 45521['Header: ][^boost/asio/basic_stream_socket.hpp] 45522 45523['Convenience header: ][^boost/asio.hpp] 45524 45525 45526[endsect] 45527 45528 45529 45530[section:bytes_readable basic_stream_socket::bytes_readable] 45531 45532 45533['Inherited from socket_base.] 45534 45535[indexterm2 boost_asio.indexterm.basic_stream_socket.bytes_readable..bytes_readable..basic_stream_socket] 45536IO control command to get the amount of data that can be read without blocking. 45537 45538 45539 typedef implementation_defined bytes_readable; 45540 45541 45542 45543Implements the FIONREAD IO control command. 45544 45545 45546[heading Example] 45547 45548 45549 45550 boost::asio::ip::tcp::socket socket(my_context); 45551 ... 45552 boost::asio::socket_base::bytes_readable command(true); 45553 socket.io_control(command); 45554 std::size_t bytes_readable = command.get(); 45555 45556 45557 45558 45559 45560 45561 45562[heading Requirements] 45563 45564['Header: ][^boost/asio/basic_stream_socket.hpp] 45565 45566['Convenience header: ][^boost/asio.hpp] 45567 45568 45569[endsect] 45570 45571 45572[section:cancel basic_stream_socket::cancel] 45573 45574[indexterm2 boost_asio.indexterm.basic_stream_socket.cancel..cancel..basic_stream_socket] 45575Cancel all asynchronous operations associated with the socket. 45576 45577 45578 void ``[link boost_asio.reference.basic_stream_socket.cancel.overload1 cancel]``(); 45579 `` [''''»''' [link boost_asio.reference.basic_stream_socket.cancel.overload1 more...]]`` 45580 45581 void ``[link boost_asio.reference.basic_stream_socket.cancel.overload2 cancel]``( 45582 boost::system::error_code & ec); 45583 `` [''''»''' [link boost_asio.reference.basic_stream_socket.cancel.overload2 more...]]`` 45584 45585 45586[section:overload1 basic_stream_socket::cancel (1 of 2 overloads)] 45587 45588 45589['Inherited from basic_socket.] 45590 45591 45592Cancel all asynchronous operations associated with the socket. 45593 45594 45595 void cancel(); 45596 45597 45598This 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. 45599 45600 45601[heading Exceptions] 45602 45603 45604[variablelist 45605 45606[[boost::system::system_error][Thrown on failure.]] 45607 45608] 45609 45610 45611[heading Remarks] 45612 45613Calls 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: 45614 45615 45616* It will only cancel asynchronous operations that were initiated in the current thread. 45617 45618 45619* 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. 45620 45621For portable cancellation, consider using one of the following alternatives: 45622 45623 45624* Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP. 45625 45626 45627* Use the `close()` function to simultaneously cancel the outstanding operations and close the socket. 45628 45629When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above. 45630 45631 45632[endsect] 45633 45634 45635 45636[section:overload2 basic_stream_socket::cancel (2 of 2 overloads)] 45637 45638 45639['Inherited from basic_socket.] 45640 45641 45642Cancel all asynchronous operations associated with the socket. 45643 45644 45645 void cancel( 45646 boost::system::error_code & ec); 45647 45648 45649This 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. 45650 45651 45652[heading Parameters] 45653 45654 45655[variablelist 45656 45657[[ec][Set to indicate what error occurred, if any.]] 45658 45659] 45660 45661 45662[heading Remarks] 45663 45664Calls 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: 45665 45666 45667* It will only cancel asynchronous operations that were initiated in the current thread. 45668 45669 45670* 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. 45671 45672For portable cancellation, consider using one of the following alternatives: 45673 45674 45675* Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP. 45676 45677 45678* Use the `close()` function to simultaneously cancel the outstanding operations and close the socket. 45679 45680When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above. 45681 45682 45683[endsect] 45684 45685 45686[endsect] 45687 45688[section:close basic_stream_socket::close] 45689 45690[indexterm2 boost_asio.indexterm.basic_stream_socket.close..close..basic_stream_socket] 45691Close the socket. 45692 45693 45694 void ``[link boost_asio.reference.basic_stream_socket.close.overload1 close]``(); 45695 `` [''''»''' [link boost_asio.reference.basic_stream_socket.close.overload1 more...]]`` 45696 45697 void ``[link boost_asio.reference.basic_stream_socket.close.overload2 close]``( 45698 boost::system::error_code & ec); 45699 `` [''''»''' [link boost_asio.reference.basic_stream_socket.close.overload2 more...]]`` 45700 45701 45702[section:overload1 basic_stream_socket::close (1 of 2 overloads)] 45703 45704 45705['Inherited from basic_socket.] 45706 45707 45708Close the socket. 45709 45710 45711 void close(); 45712 45713 45714This 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. 45715 45716 45717[heading Exceptions] 45718 45719 45720[variablelist 45721 45722[[boost::system::system_error][Thrown on failure. Note that, even if the function indicates an error, the underlying descriptor is closed.]] 45723 45724] 45725 45726 45727[heading Remarks] 45728 45729For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket. 45730 45731 45732 45733 45734[endsect] 45735 45736 45737 45738[section:overload2 basic_stream_socket::close (2 of 2 overloads)] 45739 45740 45741['Inherited from basic_socket.] 45742 45743 45744Close the socket. 45745 45746 45747 void close( 45748 boost::system::error_code & ec); 45749 45750 45751This 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. 45752 45753 45754[heading Parameters] 45755 45756 45757[variablelist 45758 45759[[ec][Set to indicate what error occurred, if any. Note that, even if the function indicates an error, the underlying descriptor is closed.]] 45760 45761] 45762 45763 45764[heading Example] 45765 45766 45767 45768 boost::asio::ip::tcp::socket socket(my_context); 45769 ... 45770 boost::system::error_code ec; 45771 socket.close(ec); 45772 if (ec) 45773 { 45774 // An error occurred. 45775 } 45776 45777 45778 45779 45780 45781[heading Remarks] 45782 45783For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket. 45784 45785 45786 45787 45788[endsect] 45789 45790 45791[endsect] 45792 45793[section:connect basic_stream_socket::connect] 45794 45795[indexterm2 boost_asio.indexterm.basic_stream_socket.connect..connect..basic_stream_socket] 45796Connect the socket to the specified endpoint. 45797 45798 45799 void ``[link boost_asio.reference.basic_stream_socket.connect.overload1 connect]``( 45800 const endpoint_type & peer_endpoint); 45801 `` [''''»''' [link boost_asio.reference.basic_stream_socket.connect.overload1 more...]]`` 45802 45803 void ``[link boost_asio.reference.basic_stream_socket.connect.overload2 connect]``( 45804 const endpoint_type & peer_endpoint, 45805 boost::system::error_code & ec); 45806 `` [''''»''' [link boost_asio.reference.basic_stream_socket.connect.overload2 more...]]`` 45807 45808 45809[section:overload1 basic_stream_socket::connect (1 of 2 overloads)] 45810 45811 45812['Inherited from basic_socket.] 45813 45814 45815Connect the socket to the specified endpoint. 45816 45817 45818 void connect( 45819 const endpoint_type & peer_endpoint); 45820 45821 45822This 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. 45823 45824The 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. 45825 45826 45827[heading Parameters] 45828 45829 45830[variablelist 45831 45832[[peer_endpoint][The remote endpoint to which the socket will be connected.]] 45833 45834] 45835 45836 45837[heading Exceptions] 45838 45839 45840[variablelist 45841 45842[[boost::system::system_error][Thrown on failure.]] 45843 45844] 45845 45846 45847[heading Example] 45848 45849 45850 45851 boost::asio::ip::tcp::socket socket(my_context); 45852 boost::asio::ip::tcp::endpoint endpoint( 45853 boost::asio::ip::address::from_string("1.2.3.4"), 12345); 45854 socket.connect(endpoint); 45855 45856 45857 45858 45859 45860 45861 45862[endsect] 45863 45864 45865 45866[section:overload2 basic_stream_socket::connect (2 of 2 overloads)] 45867 45868 45869['Inherited from basic_socket.] 45870 45871 45872Connect the socket to the specified endpoint. 45873 45874 45875 void connect( 45876 const endpoint_type & peer_endpoint, 45877 boost::system::error_code & ec); 45878 45879 45880This 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. 45881 45882The 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. 45883 45884 45885[heading Parameters] 45886 45887 45888[variablelist 45889 45890[[peer_endpoint][The remote endpoint to which the socket will be connected.]] 45891 45892[[ec][Set to indicate what error occurred, if any.]] 45893 45894] 45895 45896 45897[heading Example] 45898 45899 45900 45901 boost::asio::ip::tcp::socket socket(my_context); 45902 boost::asio::ip::tcp::endpoint endpoint( 45903 boost::asio::ip::address::from_string("1.2.3.4"), 12345); 45904 boost::system::error_code ec; 45905 socket.connect(endpoint, ec); 45906 if (ec) 45907 { 45908 // An error occurred. 45909 } 45910 45911 45912 45913 45914 45915 45916 45917[endsect] 45918 45919 45920[endsect] 45921 45922 45923[section:debug basic_stream_socket::debug] 45924 45925 45926['Inherited from socket_base.] 45927 45928[indexterm2 boost_asio.indexterm.basic_stream_socket.debug..debug..basic_stream_socket] 45929Socket option to enable socket-level debugging. 45930 45931 45932 typedef implementation_defined debug; 45933 45934 45935 45936Implements the SOL\_SOCKET/SO\_DEBUG socket option. 45937 45938 45939[heading Examples] 45940 45941Setting the option: 45942 45943 boost::asio::ip::tcp::socket socket(my_context); 45944 ... 45945 boost::asio::socket_base::debug option(true); 45946 socket.set_option(option); 45947 45948 45949 45950 45951 45952Getting the current option value: 45953 45954 boost::asio::ip::tcp::socket socket(my_context); 45955 ... 45956 boost::asio::socket_base::debug option; 45957 socket.get_option(option); 45958 bool is_set = option.value(); 45959 45960 45961 45962 45963 45964 45965 45966[heading Requirements] 45967 45968['Header: ][^boost/asio/basic_stream_socket.hpp] 45969 45970['Convenience header: ][^boost/asio.hpp] 45971 45972 45973[endsect] 45974 45975 45976 45977[section:do_not_route basic_stream_socket::do_not_route] 45978 45979 45980['Inherited from socket_base.] 45981 45982[indexterm2 boost_asio.indexterm.basic_stream_socket.do_not_route..do_not_route..basic_stream_socket] 45983Socket option to prevent routing, use local interfaces only. 45984 45985 45986 typedef implementation_defined do_not_route; 45987 45988 45989 45990Implements the SOL\_SOCKET/SO\_DONTROUTE socket option. 45991 45992 45993[heading Examples] 45994 45995Setting the option: 45996 45997 boost::asio::ip::udp::socket socket(my_context); 45998 ... 45999 boost::asio::socket_base::do_not_route option(true); 46000 socket.set_option(option); 46001 46002 46003 46004 46005 46006Getting the current option value: 46007 46008 boost::asio::ip::udp::socket socket(my_context); 46009 ... 46010 boost::asio::socket_base::do_not_route option; 46011 socket.get_option(option); 46012 bool is_set = option.value(); 46013 46014 46015 46016 46017 46018 46019 46020[heading Requirements] 46021 46022['Header: ][^boost/asio/basic_stream_socket.hpp] 46023 46024['Convenience header: ][^boost/asio.hpp] 46025 46026 46027[endsect] 46028 46029 46030 46031[section:enable_connection_aborted basic_stream_socket::enable_connection_aborted] 46032 46033 46034['Inherited from socket_base.] 46035 46036[indexterm2 boost_asio.indexterm.basic_stream_socket.enable_connection_aborted..enable_connection_aborted..basic_stream_socket] 46037Socket option to report aborted connections on accept. 46038 46039 46040 typedef implementation_defined enable_connection_aborted; 46041 46042 46043 46044Implements 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. 46045 46046 46047[heading Examples] 46048 46049Setting the option: 46050 46051 boost::asio::ip::tcp::acceptor acceptor(my_context); 46052 ... 46053 boost::asio::socket_base::enable_connection_aborted option(true); 46054 acceptor.set_option(option); 46055 46056 46057 46058 46059 46060Getting the current option value: 46061 46062 boost::asio::ip::tcp::acceptor acceptor(my_context); 46063 ... 46064 boost::asio::socket_base::enable_connection_aborted option; 46065 acceptor.get_option(option); 46066 bool is_set = option.value(); 46067 46068 46069 46070 46071 46072 46073 46074[heading Requirements] 46075 46076['Header: ][^boost/asio/basic_stream_socket.hpp] 46077 46078['Convenience header: ][^boost/asio.hpp] 46079 46080 46081[endsect] 46082 46083 46084 46085[section:endpoint_type basic_stream_socket::endpoint_type] 46086 46087[indexterm2 boost_asio.indexterm.basic_stream_socket.endpoint_type..endpoint_type..basic_stream_socket] 46088The endpoint type. 46089 46090 46091 typedef Protocol::endpoint endpoint_type; 46092 46093 46094 46095[heading Requirements] 46096 46097['Header: ][^boost/asio/basic_stream_socket.hpp] 46098 46099['Convenience header: ][^boost/asio.hpp] 46100 46101 46102[endsect] 46103 46104 46105 46106[section:executor_type basic_stream_socket::executor_type] 46107 46108[indexterm2 boost_asio.indexterm.basic_stream_socket.executor_type..executor_type..basic_stream_socket] 46109The type of the executor associated with the object. 46110 46111 46112 typedef Executor executor_type; 46113 46114 46115 46116[heading Requirements] 46117 46118['Header: ][^boost/asio/basic_stream_socket.hpp] 46119 46120['Convenience header: ][^boost/asio.hpp] 46121 46122 46123[endsect] 46124 46125 46126 46127[section:get_executor basic_stream_socket::get_executor] 46128 46129 46130['Inherited from basic_socket.] 46131 46132[indexterm2 boost_asio.indexterm.basic_stream_socket.get_executor..get_executor..basic_stream_socket] 46133Get the executor associated with the object. 46134 46135 46136 executor_type get_executor(); 46137 46138 46139 46140[endsect] 46141 46142 46143[section:get_option basic_stream_socket::get_option] 46144 46145[indexterm2 boost_asio.indexterm.basic_stream_socket.get_option..get_option..basic_stream_socket] 46146Get an option from the socket. 46147 46148 46149 template< 46150 typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``> 46151 void ``[link boost_asio.reference.basic_stream_socket.get_option.overload1 get_option]``( 46152 GettableSocketOption & option) const; 46153 `` [''''»''' [link boost_asio.reference.basic_stream_socket.get_option.overload1 more...]]`` 46154 46155 template< 46156 typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``> 46157 void ``[link boost_asio.reference.basic_stream_socket.get_option.overload2 get_option]``( 46158 GettableSocketOption & option, 46159 boost::system::error_code & ec) const; 46160 `` [''''»''' [link boost_asio.reference.basic_stream_socket.get_option.overload2 more...]]`` 46161 46162 46163[section:overload1 basic_stream_socket::get_option (1 of 2 overloads)] 46164 46165 46166['Inherited from basic_socket.] 46167 46168 46169Get an option from the socket. 46170 46171 46172 template< 46173 typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``> 46174 void get_option( 46175 GettableSocketOption & option) const; 46176 46177 46178This function is used to get the current value of an option on the socket. 46179 46180 46181[heading Parameters] 46182 46183 46184[variablelist 46185 46186[[option][The option value to be obtained from the socket.]] 46187 46188] 46189 46190 46191[heading Exceptions] 46192 46193 46194[variablelist 46195 46196[[boost::system::system_error][Thrown on failure.]] 46197 46198] 46199 46200 46201 46202[heading Example] 46203 46204Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option: 46205 46206 boost::asio::ip::tcp::socket socket(my_context); 46207 ... 46208 boost::asio::ip::tcp::socket::keep_alive option; 46209 socket.get_option(option); 46210 bool is_set = option.value(); 46211 46212 46213 46214 46215 46216 46217 46218[endsect] 46219 46220 46221 46222[section:overload2 basic_stream_socket::get_option (2 of 2 overloads)] 46223 46224 46225['Inherited from basic_socket.] 46226 46227 46228Get an option from the socket. 46229 46230 46231 template< 46232 typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``> 46233 void get_option( 46234 GettableSocketOption & option, 46235 boost::system::error_code & ec) const; 46236 46237 46238This function is used to get the current value of an option on the socket. 46239 46240 46241[heading Parameters] 46242 46243 46244[variablelist 46245 46246[[option][The option value to be obtained from the socket.]] 46247 46248[[ec][Set to indicate what error occurred, if any.]] 46249 46250] 46251 46252 46253 46254[heading Example] 46255 46256Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option: 46257 46258 boost::asio::ip::tcp::socket socket(my_context); 46259 ... 46260 boost::asio::ip::tcp::socket::keep_alive option; 46261 boost::system::error_code ec; 46262 socket.get_option(option, ec); 46263 if (ec) 46264 { 46265 // An error occurred. 46266 } 46267 bool is_set = option.value(); 46268 46269 46270 46271 46272 46273 46274 46275[endsect] 46276 46277 46278[endsect] 46279 46280[section:io_control basic_stream_socket::io_control] 46281 46282[indexterm2 boost_asio.indexterm.basic_stream_socket.io_control..io_control..basic_stream_socket] 46283Perform an IO control command on the socket. 46284 46285 46286 template< 46287 typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> 46288 void ``[link boost_asio.reference.basic_stream_socket.io_control.overload1 io_control]``( 46289 IoControlCommand & command); 46290 `` [''''»''' [link boost_asio.reference.basic_stream_socket.io_control.overload1 more...]]`` 46291 46292 template< 46293 typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> 46294 void ``[link boost_asio.reference.basic_stream_socket.io_control.overload2 io_control]``( 46295 IoControlCommand & command, 46296 boost::system::error_code & ec); 46297 `` [''''»''' [link boost_asio.reference.basic_stream_socket.io_control.overload2 more...]]`` 46298 46299 46300[section:overload1 basic_stream_socket::io_control (1 of 2 overloads)] 46301 46302 46303['Inherited from basic_socket.] 46304 46305 46306Perform an IO control command on the socket. 46307 46308 46309 template< 46310 typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> 46311 void io_control( 46312 IoControlCommand & command); 46313 46314 46315This function is used to execute an IO control command on the socket. 46316 46317 46318[heading Parameters] 46319 46320 46321[variablelist 46322 46323[[command][The IO control command to be performed on the socket.]] 46324 46325] 46326 46327 46328[heading Exceptions] 46329 46330 46331[variablelist 46332 46333[[boost::system::system_error][Thrown on failure.]] 46334 46335] 46336 46337 46338 46339[heading Example] 46340 46341Getting the number of bytes ready to read: 46342 46343 boost::asio::ip::tcp::socket socket(my_context); 46344 ... 46345 boost::asio::ip::tcp::socket::bytes_readable command; 46346 socket.io_control(command); 46347 std::size_t bytes_readable = command.get(); 46348 46349 46350 46351 46352 46353 46354 46355[endsect] 46356 46357 46358 46359[section:overload2 basic_stream_socket::io_control (2 of 2 overloads)] 46360 46361 46362['Inherited from basic_socket.] 46363 46364 46365Perform an IO control command on the socket. 46366 46367 46368 template< 46369 typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> 46370 void io_control( 46371 IoControlCommand & command, 46372 boost::system::error_code & ec); 46373 46374 46375This function is used to execute an IO control command on the socket. 46376 46377 46378[heading Parameters] 46379 46380 46381[variablelist 46382 46383[[command][The IO control command to be performed on the socket.]] 46384 46385[[ec][Set to indicate what error occurred, if any.]] 46386 46387] 46388 46389 46390 46391[heading Example] 46392 46393Getting the number of bytes ready to read: 46394 46395 boost::asio::ip::tcp::socket socket(my_context); 46396 ... 46397 boost::asio::ip::tcp::socket::bytes_readable command; 46398 boost::system::error_code ec; 46399 socket.io_control(command, ec); 46400 if (ec) 46401 { 46402 // An error occurred. 46403 } 46404 std::size_t bytes_readable = command.get(); 46405 46406 46407 46408 46409 46410 46411 46412[endsect] 46413 46414 46415[endsect] 46416 46417 46418[section:is_open basic_stream_socket::is_open] 46419 46420 46421['Inherited from basic_socket.] 46422 46423[indexterm2 boost_asio.indexterm.basic_stream_socket.is_open..is_open..basic_stream_socket] 46424Determine whether the socket is open. 46425 46426 46427 bool is_open() const; 46428 46429 46430 46431[endsect] 46432 46433 46434 46435[section:keep_alive basic_stream_socket::keep_alive] 46436 46437 46438['Inherited from socket_base.] 46439 46440[indexterm2 boost_asio.indexterm.basic_stream_socket.keep_alive..keep_alive..basic_stream_socket] 46441Socket option to send keep-alives. 46442 46443 46444 typedef implementation_defined keep_alive; 46445 46446 46447 46448Implements the SOL\_SOCKET/SO\_KEEPALIVE socket option. 46449 46450 46451[heading Examples] 46452 46453Setting the option: 46454 46455 boost::asio::ip::tcp::socket socket(my_context); 46456 ... 46457 boost::asio::socket_base::keep_alive option(true); 46458 socket.set_option(option); 46459 46460 46461 46462 46463 46464Getting the current option value: 46465 46466 boost::asio::ip::tcp::socket socket(my_context); 46467 ... 46468 boost::asio::socket_base::keep_alive option; 46469 socket.get_option(option); 46470 bool is_set = option.value(); 46471 46472 46473 46474 46475 46476 46477 46478[heading Requirements] 46479 46480['Header: ][^boost/asio/basic_stream_socket.hpp] 46481 46482['Convenience header: ][^boost/asio.hpp] 46483 46484 46485[endsect] 46486 46487 46488 46489[section:linger basic_stream_socket::linger] 46490 46491 46492['Inherited from socket_base.] 46493 46494[indexterm2 boost_asio.indexterm.basic_stream_socket.linger..linger..basic_stream_socket] 46495Socket option to specify whether the socket lingers on close if unsent data is present. 46496 46497 46498 typedef implementation_defined linger; 46499 46500 46501 46502Implements the SOL\_SOCKET/SO\_LINGER socket option. 46503 46504 46505[heading Examples] 46506 46507Setting the option: 46508 46509 boost::asio::ip::tcp::socket socket(my_context); 46510 ... 46511 boost::asio::socket_base::linger option(true, 30); 46512 socket.set_option(option); 46513 46514 46515 46516 46517 46518Getting the current option value: 46519 46520 boost::asio::ip::tcp::socket socket(my_context); 46521 ... 46522 boost::asio::socket_base::linger option; 46523 socket.get_option(option); 46524 bool is_set = option.enabled(); 46525 unsigned short timeout = option.timeout(); 46526 46527 46528 46529 46530 46531 46532 46533[heading Requirements] 46534 46535['Header: ][^boost/asio/basic_stream_socket.hpp] 46536 46537['Convenience header: ][^boost/asio.hpp] 46538 46539 46540[endsect] 46541 46542 46543[section:local_endpoint basic_stream_socket::local_endpoint] 46544 46545[indexterm2 boost_asio.indexterm.basic_stream_socket.local_endpoint..local_endpoint..basic_stream_socket] 46546Get the local endpoint of the socket. 46547 46548 46549 endpoint_type ``[link boost_asio.reference.basic_stream_socket.local_endpoint.overload1 local_endpoint]``() const; 46550 `` [''''»''' [link boost_asio.reference.basic_stream_socket.local_endpoint.overload1 more...]]`` 46551 46552 endpoint_type ``[link boost_asio.reference.basic_stream_socket.local_endpoint.overload2 local_endpoint]``( 46553 boost::system::error_code & ec) const; 46554 `` [''''»''' [link boost_asio.reference.basic_stream_socket.local_endpoint.overload2 more...]]`` 46555 46556 46557[section:overload1 basic_stream_socket::local_endpoint (1 of 2 overloads)] 46558 46559 46560['Inherited from basic_socket.] 46561 46562 46563Get the local endpoint of the socket. 46564 46565 46566 endpoint_type local_endpoint() const; 46567 46568 46569This function is used to obtain the locally bound endpoint of the socket. 46570 46571 46572[heading Return Value] 46573 46574An object that represents the local endpoint of the socket. 46575 46576 46577[heading Exceptions] 46578 46579 46580[variablelist 46581 46582[[boost::system::system_error][Thrown on failure.]] 46583 46584] 46585 46586 46587[heading Example] 46588 46589 46590 46591 boost::asio::ip::tcp::socket socket(my_context); 46592 ... 46593 boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint(); 46594 46595 46596 46597 46598 46599 46600 46601[endsect] 46602 46603 46604 46605[section:overload2 basic_stream_socket::local_endpoint (2 of 2 overloads)] 46606 46607 46608['Inherited from basic_socket.] 46609 46610 46611Get the local endpoint of the socket. 46612 46613 46614 endpoint_type local_endpoint( 46615 boost::system::error_code & ec) const; 46616 46617 46618This function is used to obtain the locally bound endpoint of the socket. 46619 46620 46621[heading Parameters] 46622 46623 46624[variablelist 46625 46626[[ec][Set to indicate what error occurred, if any.]] 46627 46628] 46629 46630 46631[heading Return Value] 46632 46633An object that represents the local endpoint of the socket. Returns a default-constructed endpoint object if an error occurred. 46634 46635 46636[heading Example] 46637 46638 46639 46640 boost::asio::ip::tcp::socket socket(my_context); 46641 ... 46642 boost::system::error_code ec; 46643 boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint(ec); 46644 if (ec) 46645 { 46646 // An error occurred. 46647 } 46648 46649 46650 46651 46652 46653 46654 46655[endsect] 46656 46657 46658[endsect] 46659 46660[section:lowest_layer basic_stream_socket::lowest_layer] 46661 46662[indexterm2 boost_asio.indexterm.basic_stream_socket.lowest_layer..lowest_layer..basic_stream_socket] 46663Get a reference to the lowest layer. 46664 46665 46666 lowest_layer_type & ``[link boost_asio.reference.basic_stream_socket.lowest_layer.overload1 lowest_layer]``(); 46667 `` [''''»''' [link boost_asio.reference.basic_stream_socket.lowest_layer.overload1 more...]]`` 46668 46669 46670Get a const reference to the lowest layer. 46671 46672 46673 const lowest_layer_type & ``[link boost_asio.reference.basic_stream_socket.lowest_layer.overload2 lowest_layer]``() const; 46674 `` [''''»''' [link boost_asio.reference.basic_stream_socket.lowest_layer.overload2 more...]]`` 46675 46676 46677[section:overload1 basic_stream_socket::lowest_layer (1 of 2 overloads)] 46678 46679 46680['Inherited from basic_socket.] 46681 46682 46683Get a reference to the lowest layer. 46684 46685 46686 lowest_layer_type & lowest_layer(); 46687 46688 46689This 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. 46690 46691 46692[heading Return Value] 46693 46694A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 46695 46696 46697 46698 46699[endsect] 46700 46701 46702 46703[section:overload2 basic_stream_socket::lowest_layer (2 of 2 overloads)] 46704 46705 46706['Inherited from basic_socket.] 46707 46708 46709Get a const reference to the lowest layer. 46710 46711 46712 const lowest_layer_type & lowest_layer() const; 46713 46714 46715This 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. 46716 46717 46718[heading Return Value] 46719 46720A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 46721 46722 46723 46724 46725[endsect] 46726 46727 46728[endsect] 46729 46730 46731[section:lowest_layer_type basic_stream_socket::lowest_layer_type] 46732 46733 46734['Inherited from basic_socket.] 46735 46736[indexterm2 boost_asio.indexterm.basic_stream_socket.lowest_layer_type..lowest_layer_type..basic_stream_socket] 46737A [link boost_asio.reference.basic_socket `basic_socket`] is always the lowest layer. 46738 46739 46740 typedef basic_socket< Protocol, Executor > lowest_layer_type; 46741 46742 46743[heading Types] 46744[table 46745 [[Name][Description]] 46746 46747 [ 46748 46749 [[link boost_asio.reference.basic_socket__rebind_executor [*rebind_executor]]] 46750 [Rebinds the socket type to another executor. ] 46751 46752 ] 46753 46754 [ 46755 46756 [[link boost_asio.reference.basic_socket.broadcast [*broadcast]]] 46757 [Socket option to permit sending of broadcast messages. ] 46758 46759 ] 46760 46761 [ 46762 46763 [[link boost_asio.reference.basic_socket.bytes_readable [*bytes_readable]]] 46764 [IO control command to get the amount of data that can be read without blocking. ] 46765 46766 ] 46767 46768 [ 46769 46770 [[link boost_asio.reference.basic_socket.debug [*debug]]] 46771 [Socket option to enable socket-level debugging. ] 46772 46773 ] 46774 46775 [ 46776 46777 [[link boost_asio.reference.basic_socket.do_not_route [*do_not_route]]] 46778 [Socket option to prevent routing, use local interfaces only. ] 46779 46780 ] 46781 46782 [ 46783 46784 [[link boost_asio.reference.basic_socket.enable_connection_aborted [*enable_connection_aborted]]] 46785 [Socket option to report aborted connections on accept. ] 46786 46787 ] 46788 46789 [ 46790 46791 [[link boost_asio.reference.basic_socket.endpoint_type [*endpoint_type]]] 46792 [The endpoint type. ] 46793 46794 ] 46795 46796 [ 46797 46798 [[link boost_asio.reference.basic_socket.executor_type [*executor_type]]] 46799 [The type of the executor associated with the object. ] 46800 46801 ] 46802 46803 [ 46804 46805 [[link boost_asio.reference.basic_socket.keep_alive [*keep_alive]]] 46806 [Socket option to send keep-alives. ] 46807 46808 ] 46809 46810 [ 46811 46812 [[link boost_asio.reference.basic_socket.linger [*linger]]] 46813 [Socket option to specify whether the socket lingers on close if unsent data is present. ] 46814 46815 ] 46816 46817 [ 46818 46819 [[link boost_asio.reference.basic_socket.lowest_layer_type [*lowest_layer_type]]] 46820 [A basic_socket is always the lowest layer. ] 46821 46822 ] 46823 46824 [ 46825 46826 [[link boost_asio.reference.basic_socket.message_flags [*message_flags]]] 46827 [Bitmask type for flags that can be passed to send and receive operations. ] 46828 46829 ] 46830 46831 [ 46832 46833 [[link boost_asio.reference.basic_socket.native_handle_type [*native_handle_type]]] 46834 [The native representation of a socket. ] 46835 46836 ] 46837 46838 [ 46839 46840 [[link boost_asio.reference.basic_socket.out_of_band_inline [*out_of_band_inline]]] 46841 [Socket option for putting received out-of-band data inline. ] 46842 46843 ] 46844 46845 [ 46846 46847 [[link boost_asio.reference.basic_socket.protocol_type [*protocol_type]]] 46848 [The protocol type. ] 46849 46850 ] 46851 46852 [ 46853 46854 [[link boost_asio.reference.basic_socket.receive_buffer_size [*receive_buffer_size]]] 46855 [Socket option for the receive buffer size of a socket. ] 46856 46857 ] 46858 46859 [ 46860 46861 [[link boost_asio.reference.basic_socket.receive_low_watermark [*receive_low_watermark]]] 46862 [Socket option for the receive low watermark. ] 46863 46864 ] 46865 46866 [ 46867 46868 [[link boost_asio.reference.basic_socket.reuse_address [*reuse_address]]] 46869 [Socket option to allow the socket to be bound to an address that is already in use. ] 46870 46871 ] 46872 46873 [ 46874 46875 [[link boost_asio.reference.basic_socket.send_buffer_size [*send_buffer_size]]] 46876 [Socket option for the send buffer size of a socket. ] 46877 46878 ] 46879 46880 [ 46881 46882 [[link boost_asio.reference.basic_socket.send_low_watermark [*send_low_watermark]]] 46883 [Socket option for the send low watermark. ] 46884 46885 ] 46886 46887 [ 46888 46889 [[link boost_asio.reference.basic_socket.shutdown_type [*shutdown_type]]] 46890 [Different ways a socket may be shutdown. ] 46891 46892 ] 46893 46894 [ 46895 46896 [[link boost_asio.reference.basic_socket.wait_type [*wait_type]]] 46897 [Wait types. ] 46898 46899 ] 46900 46901] 46902 46903[heading Member Functions] 46904[table 46905 [[Name][Description]] 46906 46907 [ 46908 [[link boost_asio.reference.basic_socket.assign [*assign]]] 46909 [Assign an existing native socket to the socket. ] 46910 ] 46911 46912 [ 46913 [[link boost_asio.reference.basic_socket.async_connect [*async_connect]]] 46914 [Start an asynchronous connect. ] 46915 ] 46916 46917 [ 46918 [[link boost_asio.reference.basic_socket.async_wait [*async_wait]]] 46919 [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 46920 ] 46921 46922 [ 46923 [[link boost_asio.reference.basic_socket.at_mark [*at_mark]]] 46924 [Determine whether the socket is at the out-of-band data mark. ] 46925 ] 46926 46927 [ 46928 [[link boost_asio.reference.basic_socket.available [*available]]] 46929 [Determine the number of bytes available for reading. ] 46930 ] 46931 46932 [ 46933 [[link boost_asio.reference.basic_socket.basic_socket [*basic_socket]] [constructor]] 46934 [Construct a basic_socket without opening it. 46935 [hr] 46936 Construct and open a basic_socket. 46937 [hr] 46938 Construct a basic_socket, opening it and binding it to the given local endpoint. 46939 [hr] 46940 Construct a basic_socket on an existing native socket. 46941 [hr] 46942 Move-construct a basic_socket from another. 46943 [hr] 46944 Move-construct a basic_socket from a socket of another protocol type. ] 46945 ] 46946 46947 [ 46948 [[link boost_asio.reference.basic_socket.bind [*bind]]] 46949 [Bind the socket to the given local endpoint. ] 46950 ] 46951 46952 [ 46953 [[link boost_asio.reference.basic_socket.cancel [*cancel]]] 46954 [Cancel all asynchronous operations associated with the socket. ] 46955 ] 46956 46957 [ 46958 [[link boost_asio.reference.basic_socket.close [*close]]] 46959 [Close the socket. ] 46960 ] 46961 46962 [ 46963 [[link boost_asio.reference.basic_socket.connect [*connect]]] 46964 [Connect the socket to the specified endpoint. ] 46965 ] 46966 46967 [ 46968 [[link boost_asio.reference.basic_socket.get_executor [*get_executor]]] 46969 [Get the executor associated with the object. ] 46970 ] 46971 46972 [ 46973 [[link boost_asio.reference.basic_socket.get_option [*get_option]]] 46974 [Get an option from the socket. ] 46975 ] 46976 46977 [ 46978 [[link boost_asio.reference.basic_socket.io_control [*io_control]]] 46979 [Perform an IO control command on the socket. ] 46980 ] 46981 46982 [ 46983 [[link boost_asio.reference.basic_socket.is_open [*is_open]]] 46984 [Determine whether the socket is open. ] 46985 ] 46986 46987 [ 46988 [[link boost_asio.reference.basic_socket.local_endpoint [*local_endpoint]]] 46989 [Get the local endpoint of the socket. ] 46990 ] 46991 46992 [ 46993 [[link boost_asio.reference.basic_socket.lowest_layer [*lowest_layer]]] 46994 [Get a reference to the lowest layer. 46995 [hr] 46996 Get a const reference to the lowest layer. ] 46997 ] 46998 46999 [ 47000 [[link boost_asio.reference.basic_socket.native_handle [*native_handle]]] 47001 [Get the native socket representation. ] 47002 ] 47003 47004 [ 47005 [[link boost_asio.reference.basic_socket.native_non_blocking [*native_non_blocking]]] 47006 [Gets the non-blocking mode of the native socket implementation. 47007 [hr] 47008 Sets the non-blocking mode of the native socket implementation. ] 47009 ] 47010 47011 [ 47012 [[link boost_asio.reference.basic_socket.non_blocking [*non_blocking]]] 47013 [Gets the non-blocking mode of the socket. 47014 [hr] 47015 Sets the non-blocking mode of the socket. ] 47016 ] 47017 47018 [ 47019 [[link boost_asio.reference.basic_socket.open [*open]]] 47020 [Open the socket using the specified protocol. ] 47021 ] 47022 47023 [ 47024 [[link boost_asio.reference.basic_socket.operator_eq_ [*operator=]]] 47025 [Move-assign a basic_socket from another. 47026 [hr] 47027 Move-assign a basic_socket from a socket of another protocol type. ] 47028 ] 47029 47030 [ 47031 [[link boost_asio.reference.basic_socket.release [*release]]] 47032 [Release ownership of the underlying native socket. ] 47033 ] 47034 47035 [ 47036 [[link boost_asio.reference.basic_socket.remote_endpoint [*remote_endpoint]]] 47037 [Get the remote endpoint of the socket. ] 47038 ] 47039 47040 [ 47041 [[link boost_asio.reference.basic_socket.set_option [*set_option]]] 47042 [Set an option on the socket. ] 47043 ] 47044 47045 [ 47046 [[link boost_asio.reference.basic_socket.shutdown [*shutdown]]] 47047 [Disable sends or receives on the socket. ] 47048 ] 47049 47050 [ 47051 [[link boost_asio.reference.basic_socket.wait [*wait]]] 47052 [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 47053 ] 47054 47055] 47056 47057[heading Protected Member Functions] 47058[table 47059 [[Name][Description]] 47060 47061 [ 47062 [[link boost_asio.reference.basic_socket._basic_socket [*~basic_socket]] [destructor]] 47063 [Protected destructor to prevent deletion through this type. ] 47064 ] 47065 47066] 47067 47068[heading Data Members] 47069[table 47070 [[Name][Description]] 47071 47072 [ 47073 [[link boost_asio.reference.basic_socket.max_connections [*max_connections]] [static]] 47074 [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ] 47075 ] 47076 47077 [ 47078 [[link boost_asio.reference.basic_socket.max_listen_connections [*max_listen_connections]] [static]] 47079 [The maximum length of the queue of pending incoming connections. ] 47080 ] 47081 47082 [ 47083 [[link boost_asio.reference.basic_socket.message_do_not_route [*message_do_not_route]] [static]] 47084 [Specify that the data should not be subject to routing. ] 47085 ] 47086 47087 [ 47088 [[link boost_asio.reference.basic_socket.message_end_of_record [*message_end_of_record]] [static]] 47089 [Specifies that the data marks the end of a record. ] 47090 ] 47091 47092 [ 47093 [[link boost_asio.reference.basic_socket.message_out_of_band [*message_out_of_band]] [static]] 47094 [Process out-of-band data. ] 47095 ] 47096 47097 [ 47098 [[link boost_asio.reference.basic_socket.message_peek [*message_peek]] [static]] 47099 [Peek at incoming data without removing it from the input queue. ] 47100 ] 47101 47102] 47103 47104The [link boost_asio.reference.basic_socket `basic_socket`] class template provides functionality that is common to both stream-oriented and datagram-oriented sockets. 47105 47106 47107[heading Thread Safety] 47108 47109['Distinct] ['objects:] Safe. 47110 47111['Shared] ['objects:] Unsafe. 47112 47113 47114 47115 47116[heading Requirements] 47117 47118['Header: ][^boost/asio/basic_stream_socket.hpp] 47119 47120['Convenience header: ][^boost/asio.hpp] 47121 47122 47123[endsect] 47124 47125 47126 47127[section:max_connections basic_stream_socket::max_connections] 47128 47129 47130['Inherited from socket_base.] 47131 47132[indexterm2 boost_asio.indexterm.basic_stream_socket.max_connections..max_connections..basic_stream_socket] 47133(Deprecated: Use max\_listen\_connections.) The maximum length of the queue of pending incoming connections. 47134 47135 47136 static const int max_connections = implementation_defined; 47137 47138 47139 47140[endsect] 47141 47142 47143 47144[section:max_listen_connections basic_stream_socket::max_listen_connections] 47145 47146 47147['Inherited from socket_base.] 47148 47149[indexterm2 boost_asio.indexterm.basic_stream_socket.max_listen_connections..max_listen_connections..basic_stream_socket] 47150The maximum length of the queue of pending incoming connections. 47151 47152 47153 static const int max_listen_connections = implementation_defined; 47154 47155 47156 47157[endsect] 47158 47159 47160 47161[section:message_do_not_route basic_stream_socket::message_do_not_route] 47162 47163 47164['Inherited from socket_base.] 47165 47166[indexterm2 boost_asio.indexterm.basic_stream_socket.message_do_not_route..message_do_not_route..basic_stream_socket] 47167Specify that the data should not be subject to routing. 47168 47169 47170 static const int message_do_not_route = implementation_defined; 47171 47172 47173 47174[endsect] 47175 47176 47177 47178[section:message_end_of_record basic_stream_socket::message_end_of_record] 47179 47180 47181['Inherited from socket_base.] 47182 47183[indexterm2 boost_asio.indexterm.basic_stream_socket.message_end_of_record..message_end_of_record..basic_stream_socket] 47184Specifies that the data marks the end of a record. 47185 47186 47187 static const int message_end_of_record = implementation_defined; 47188 47189 47190 47191[endsect] 47192 47193 47194 47195[section:message_flags basic_stream_socket::message_flags] 47196 47197 47198['Inherited from socket_base.] 47199 47200[indexterm2 boost_asio.indexterm.basic_stream_socket.message_flags..message_flags..basic_stream_socket] 47201Bitmask type for flags that can be passed to send and receive operations. 47202 47203 47204 typedef int message_flags; 47205 47206 47207 47208[heading Requirements] 47209 47210['Header: ][^boost/asio/basic_stream_socket.hpp] 47211 47212['Convenience header: ][^boost/asio.hpp] 47213 47214 47215[endsect] 47216 47217 47218 47219[section:message_out_of_band basic_stream_socket::message_out_of_band] 47220 47221 47222['Inherited from socket_base.] 47223 47224[indexterm2 boost_asio.indexterm.basic_stream_socket.message_out_of_band..message_out_of_band..basic_stream_socket] 47225Process out-of-band data. 47226 47227 47228 static const int message_out_of_band = implementation_defined; 47229 47230 47231 47232[endsect] 47233 47234 47235 47236[section:message_peek basic_stream_socket::message_peek] 47237 47238 47239['Inherited from socket_base.] 47240 47241[indexterm2 boost_asio.indexterm.basic_stream_socket.message_peek..message_peek..basic_stream_socket] 47242Peek at incoming data without removing it from the input queue. 47243 47244 47245 static const int message_peek = implementation_defined; 47246 47247 47248 47249[endsect] 47250 47251 47252 47253[section:native_handle basic_stream_socket::native_handle] 47254 47255 47256['Inherited from basic_socket.] 47257 47258[indexterm2 boost_asio.indexterm.basic_stream_socket.native_handle..native_handle..basic_stream_socket] 47259Get the native socket representation. 47260 47261 47262 native_handle_type native_handle(); 47263 47264 47265This 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. 47266 47267 47268[endsect] 47269 47270 47271 47272[section:native_handle_type basic_stream_socket::native_handle_type] 47273 47274[indexterm2 boost_asio.indexterm.basic_stream_socket.native_handle_type..native_handle_type..basic_stream_socket] 47275The native representation of a socket. 47276 47277 47278 typedef implementation_defined native_handle_type; 47279 47280 47281 47282[heading Requirements] 47283 47284['Header: ][^boost/asio/basic_stream_socket.hpp] 47285 47286['Convenience header: ][^boost/asio.hpp] 47287 47288 47289[endsect] 47290 47291 47292[section:native_non_blocking basic_stream_socket::native_non_blocking] 47293 47294[indexterm2 boost_asio.indexterm.basic_stream_socket.native_non_blocking..native_non_blocking..basic_stream_socket] 47295Gets the non-blocking mode of the native socket implementation. 47296 47297 47298 bool ``[link boost_asio.reference.basic_stream_socket.native_non_blocking.overload1 native_non_blocking]``() const; 47299 `` [''''»''' [link boost_asio.reference.basic_stream_socket.native_non_blocking.overload1 more...]]`` 47300 47301 47302Sets the non-blocking mode of the native socket implementation. 47303 47304 47305 void ``[link boost_asio.reference.basic_stream_socket.native_non_blocking.overload2 native_non_blocking]``( 47306 bool mode); 47307 `` [''''»''' [link boost_asio.reference.basic_stream_socket.native_non_blocking.overload2 more...]]`` 47308 47309 void ``[link boost_asio.reference.basic_stream_socket.native_non_blocking.overload3 native_non_blocking]``( 47310 bool mode, 47311 boost::system::error_code & ec); 47312 `` [''''»''' [link boost_asio.reference.basic_stream_socket.native_non_blocking.overload3 more...]]`` 47313 47314 47315[section:overload1 basic_stream_socket::native_non_blocking (1 of 3 overloads)] 47316 47317 47318['Inherited from basic_socket.] 47319 47320 47321Gets the non-blocking mode of the native socket implementation. 47322 47323 47324 bool native_non_blocking() const; 47325 47326 47327This 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. 47328 47329 47330[heading Return Value] 47331 47332`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). 47333 47334 47335[heading Remarks] 47336 47337The 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. 47338 47339 47340[heading Example] 47341 47342This 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: 47343 47344 template <typename Handler> 47345 struct sendfile_op 47346 { 47347 tcp::socket& sock_; 47348 int fd_; 47349 Handler handler_; 47350 off_t offset_; 47351 std::size_t total_bytes_transferred_; 47352 47353 // Function call operator meeting WriteHandler requirements. 47354 // Used as the handler for the async_write_some operation. 47355 void operator()(boost::system::error_code ec, std::size_t) 47356 { 47357 // Put the underlying socket into non-blocking mode. 47358 if (!ec) 47359 if (!sock_.native_non_blocking()) 47360 sock_.native_non_blocking(true, ec); 47361 47362 if (!ec) 47363 { 47364 for (;;) 47365 { 47366 // Try the system call. 47367 errno = 0; 47368 int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536); 47369 ec = boost::system::error_code(n < 0 ? errno : 0, 47370 boost::asio::error::get_system_category()); 47371 total_bytes_transferred_ += ec ? 0 : n; 47372 47373 // Retry operation immediately if interrupted by signal. 47374 if (ec == boost::asio::error::interrupted) 47375 continue; 47376 47377 // Check if we need to run the operation again. 47378 if (ec == boost::asio::error::would_block 47379 || ec == boost::asio::error::try_again) 47380 { 47381 // We have to wait for the socket to become ready again. 47382 sock_.async_wait(tcp::socket::wait_write, *this); 47383 return; 47384 } 47385 47386 if (ec || n == 0) 47387 { 47388 // An error occurred, or we have reached the end of the file. 47389 // Either way we must exit the loop so we can call the handler. 47390 break; 47391 } 47392 47393 // Loop around to try calling sendfile again. 47394 } 47395 } 47396 47397 // Pass result back to user's handler. 47398 handler_(ec, total_bytes_transferred_); 47399 } 47400 }; 47401 47402 template <typename Handler> 47403 void async_sendfile(tcp::socket& sock, int fd, Handler h) 47404 { 47405 sendfile_op<Handler> op = { sock, fd, h, 0, 0 }; 47406 sock.async_wait(tcp::socket::wait_write, op); 47407 } 47408 47409 47410 47411 47412 47413 47414 47415[endsect] 47416 47417 47418 47419[section:overload2 basic_stream_socket::native_non_blocking (2 of 3 overloads)] 47420 47421 47422['Inherited from basic_socket.] 47423 47424 47425Sets the non-blocking mode of the native socket implementation. 47426 47427 47428 void native_non_blocking( 47429 bool mode); 47430 47431 47432This 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. 47433 47434 47435[heading Parameters] 47436 47437 47438[variablelist 47439 47440[[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).]] 47441 47442] 47443 47444 47445[heading Exceptions] 47446 47447 47448[variablelist 47449 47450[[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.]] 47451 47452] 47453 47454 47455[heading Example] 47456 47457This 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: 47458 47459 template <typename Handler> 47460 struct sendfile_op 47461 { 47462 tcp::socket& sock_; 47463 int fd_; 47464 Handler handler_; 47465 off_t offset_; 47466 std::size_t total_bytes_transferred_; 47467 47468 // Function call operator meeting WriteHandler requirements. 47469 // Used as the handler for the async_write_some operation. 47470 void operator()(boost::system::error_code ec, std::size_t) 47471 { 47472 // Put the underlying socket into non-blocking mode. 47473 if (!ec) 47474 if (!sock_.native_non_blocking()) 47475 sock_.native_non_blocking(true, ec); 47476 47477 if (!ec) 47478 { 47479 for (;;) 47480 { 47481 // Try the system call. 47482 errno = 0; 47483 int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536); 47484 ec = boost::system::error_code(n < 0 ? errno : 0, 47485 boost::asio::error::get_system_category()); 47486 total_bytes_transferred_ += ec ? 0 : n; 47487 47488 // Retry operation immediately if interrupted by signal. 47489 if (ec == boost::asio::error::interrupted) 47490 continue; 47491 47492 // Check if we need to run the operation again. 47493 if (ec == boost::asio::error::would_block 47494 || ec == boost::asio::error::try_again) 47495 { 47496 // We have to wait for the socket to become ready again. 47497 sock_.async_wait(tcp::socket::wait_write, *this); 47498 return; 47499 } 47500 47501 if (ec || n == 0) 47502 { 47503 // An error occurred, or we have reached the end of the file. 47504 // Either way we must exit the loop so we can call the handler. 47505 break; 47506 } 47507 47508 // Loop around to try calling sendfile again. 47509 } 47510 } 47511 47512 // Pass result back to user's handler. 47513 handler_(ec, total_bytes_transferred_); 47514 } 47515 }; 47516 47517 template <typename Handler> 47518 void async_sendfile(tcp::socket& sock, int fd, Handler h) 47519 { 47520 sendfile_op<Handler> op = { sock, fd, h, 0, 0 }; 47521 sock.async_wait(tcp::socket::wait_write, op); 47522 } 47523 47524 47525 47526 47527 47528 47529 47530[endsect] 47531 47532 47533 47534[section:overload3 basic_stream_socket::native_non_blocking (3 of 3 overloads)] 47535 47536 47537['Inherited from basic_socket.] 47538 47539 47540Sets the non-blocking mode of the native socket implementation. 47541 47542 47543 void native_non_blocking( 47544 bool mode, 47545 boost::system::error_code & ec); 47546 47547 47548This 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. 47549 47550 47551[heading Parameters] 47552 47553 47554[variablelist 47555 47556[[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).]] 47557 47558[[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.]] 47559 47560] 47561 47562 47563[heading Example] 47564 47565This 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: 47566 47567 template <typename Handler> 47568 struct sendfile_op 47569 { 47570 tcp::socket& sock_; 47571 int fd_; 47572 Handler handler_; 47573 off_t offset_; 47574 std::size_t total_bytes_transferred_; 47575 47576 // Function call operator meeting WriteHandler requirements. 47577 // Used as the handler for the async_write_some operation. 47578 void operator()(boost::system::error_code ec, std::size_t) 47579 { 47580 // Put the underlying socket into non-blocking mode. 47581 if (!ec) 47582 if (!sock_.native_non_blocking()) 47583 sock_.native_non_blocking(true, ec); 47584 47585 if (!ec) 47586 { 47587 for (;;) 47588 { 47589 // Try the system call. 47590 errno = 0; 47591 int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536); 47592 ec = boost::system::error_code(n < 0 ? errno : 0, 47593 boost::asio::error::get_system_category()); 47594 total_bytes_transferred_ += ec ? 0 : n; 47595 47596 // Retry operation immediately if interrupted by signal. 47597 if (ec == boost::asio::error::interrupted) 47598 continue; 47599 47600 // Check if we need to run the operation again. 47601 if (ec == boost::asio::error::would_block 47602 || ec == boost::asio::error::try_again) 47603 { 47604 // We have to wait for the socket to become ready again. 47605 sock_.async_wait(tcp::socket::wait_write, *this); 47606 return; 47607 } 47608 47609 if (ec || n == 0) 47610 { 47611 // An error occurred, or we have reached the end of the file. 47612 // Either way we must exit the loop so we can call the handler. 47613 break; 47614 } 47615 47616 // Loop around to try calling sendfile again. 47617 } 47618 } 47619 47620 // Pass result back to user's handler. 47621 handler_(ec, total_bytes_transferred_); 47622 } 47623 }; 47624 47625 template <typename Handler> 47626 void async_sendfile(tcp::socket& sock, int fd, Handler h) 47627 { 47628 sendfile_op<Handler> op = { sock, fd, h, 0, 0 }; 47629 sock.async_wait(tcp::socket::wait_write, op); 47630 } 47631 47632 47633 47634 47635 47636 47637 47638[endsect] 47639 47640 47641[endsect] 47642 47643[section:non_blocking basic_stream_socket::non_blocking] 47644 47645[indexterm2 boost_asio.indexterm.basic_stream_socket.non_blocking..non_blocking..basic_stream_socket] 47646Gets the non-blocking mode of the socket. 47647 47648 47649 bool ``[link boost_asio.reference.basic_stream_socket.non_blocking.overload1 non_blocking]``() const; 47650 `` [''''»''' [link boost_asio.reference.basic_stream_socket.non_blocking.overload1 more...]]`` 47651 47652 47653Sets the non-blocking mode of the socket. 47654 47655 47656 void ``[link boost_asio.reference.basic_stream_socket.non_blocking.overload2 non_blocking]``( 47657 bool mode); 47658 `` [''''»''' [link boost_asio.reference.basic_stream_socket.non_blocking.overload2 more...]]`` 47659 47660 void ``[link boost_asio.reference.basic_stream_socket.non_blocking.overload3 non_blocking]``( 47661 bool mode, 47662 boost::system::error_code & ec); 47663 `` [''''»''' [link boost_asio.reference.basic_stream_socket.non_blocking.overload3 more...]]`` 47664 47665 47666[section:overload1 basic_stream_socket::non_blocking (1 of 3 overloads)] 47667 47668 47669['Inherited from basic_socket.] 47670 47671 47672Gets the non-blocking mode of the socket. 47673 47674 47675 bool non_blocking() const; 47676 47677 47678 47679[heading Return Value] 47680 47681`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. 47682 47683 47684[heading Remarks] 47685 47686The 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`. 47687 47688 47689 47690 47691[endsect] 47692 47693 47694 47695[section:overload2 basic_stream_socket::non_blocking (2 of 3 overloads)] 47696 47697 47698['Inherited from basic_socket.] 47699 47700 47701Sets the non-blocking mode of the socket. 47702 47703 47704 void non_blocking( 47705 bool mode); 47706 47707 47708 47709[heading Parameters] 47710 47711 47712[variablelist 47713 47714[[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.]] 47715 47716] 47717 47718 47719[heading Exceptions] 47720 47721 47722[variablelist 47723 47724[[boost::system::system_error][Thrown on failure.]] 47725 47726] 47727 47728 47729[heading Remarks] 47730 47731The 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`. 47732 47733 47734 47735 47736[endsect] 47737 47738 47739 47740[section:overload3 basic_stream_socket::non_blocking (3 of 3 overloads)] 47741 47742 47743['Inherited from basic_socket.] 47744 47745 47746Sets the non-blocking mode of the socket. 47747 47748 47749 void non_blocking( 47750 bool mode, 47751 boost::system::error_code & ec); 47752 47753 47754 47755[heading Parameters] 47756 47757 47758[variablelist 47759 47760[[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.]] 47761 47762[[ec][Set to indicate what error occurred, if any.]] 47763 47764] 47765 47766 47767[heading Remarks] 47768 47769The 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`. 47770 47771 47772 47773 47774[endsect] 47775 47776 47777[endsect] 47778 47779[section:open basic_stream_socket::open] 47780 47781[indexterm2 boost_asio.indexterm.basic_stream_socket.open..open..basic_stream_socket] 47782Open the socket using the specified protocol. 47783 47784 47785 void ``[link boost_asio.reference.basic_stream_socket.open.overload1 open]``( 47786 const protocol_type & protocol = protocol_type()); 47787 `` [''''»''' [link boost_asio.reference.basic_stream_socket.open.overload1 more...]]`` 47788 47789 void ``[link boost_asio.reference.basic_stream_socket.open.overload2 open]``( 47790 const protocol_type & protocol, 47791 boost::system::error_code & ec); 47792 `` [''''»''' [link boost_asio.reference.basic_stream_socket.open.overload2 more...]]`` 47793 47794 47795[section:overload1 basic_stream_socket::open (1 of 2 overloads)] 47796 47797 47798['Inherited from basic_socket.] 47799 47800 47801Open the socket using the specified protocol. 47802 47803 47804 void open( 47805 const protocol_type & protocol = protocol_type()); 47806 47807 47808This function opens the socket so that it will use the specified protocol. 47809 47810 47811[heading Parameters] 47812 47813 47814[variablelist 47815 47816[[protocol][An object specifying protocol parameters to be used.]] 47817 47818] 47819 47820 47821[heading Exceptions] 47822 47823 47824[variablelist 47825 47826[[boost::system::system_error][Thrown on failure.]] 47827 47828] 47829 47830 47831[heading Example] 47832 47833 47834 47835 boost::asio::ip::tcp::socket socket(my_context); 47836 socket.open(boost::asio::ip::tcp::v4()); 47837 47838 47839 47840 47841 47842 47843 47844[endsect] 47845 47846 47847 47848[section:overload2 basic_stream_socket::open (2 of 2 overloads)] 47849 47850 47851['Inherited from basic_socket.] 47852 47853 47854Open the socket using the specified protocol. 47855 47856 47857 void open( 47858 const protocol_type & protocol, 47859 boost::system::error_code & ec); 47860 47861 47862This function opens the socket so that it will use the specified protocol. 47863 47864 47865[heading Parameters] 47866 47867 47868[variablelist 47869 47870[[protocol][An object specifying which protocol is to be used.]] 47871 47872[[ec][Set to indicate what error occurred, if any.]] 47873 47874] 47875 47876 47877[heading Example] 47878 47879 47880 47881 boost::asio::ip::tcp::socket socket(my_context); 47882 boost::system::error_code ec; 47883 socket.open(boost::asio::ip::tcp::v4(), ec); 47884 if (ec) 47885 { 47886 // An error occurred. 47887 } 47888 47889 47890 47891 47892 47893 47894 47895[endsect] 47896 47897 47898[endsect] 47899 47900[section:operator_eq_ basic_stream_socket::operator=] 47901 47902[indexterm2 boost_asio.indexterm.basic_stream_socket.operator_eq_..operator=..basic_stream_socket] 47903Move-assign a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] from another. 47904 47905 47906 basic_stream_socket & ``[link boost_asio.reference.basic_stream_socket.operator_eq_.overload1 operator=]``( 47907 basic_stream_socket && other); 47908 `` [''''»''' [link boost_asio.reference.basic_stream_socket.operator_eq_.overload1 more...]]`` 47909 47910 47911Move-assign a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] from a socket of another protocol type. 47912 47913 47914 template< 47915 typename ``[link boost_asio.reference.Protocol Protocol1]``, 47916 typename ``[link boost_asio.reference.Executor1 Executor1]``> 47917 constraint< 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=]``( 47918 basic_stream_socket< Protocol1, Executor1 > && other); 47919 `` [''''»''' [link boost_asio.reference.basic_stream_socket.operator_eq_.overload2 more...]]`` 47920 47921 47922[section:overload1 basic_stream_socket::operator= (1 of 2 overloads)] 47923 47924 47925Move-assign a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] from another. 47926 47927 47928 basic_stream_socket & operator=( 47929 basic_stream_socket && other); 47930 47931 47932This assignment operator moves a stream socket from one object to another. 47933 47934 47935[heading Parameters] 47936 47937 47938[variablelist 47939 47940[[other][The other [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] object from which the move will occur.]] 47941 47942] 47943 47944 47945[heading Remarks] 47946 47947Following the move, the moved-from object is in the same state as if constructed using the `basic_stream_socket(const executor_type&)` constructor. 47948 47949 47950 47951 47952[endsect] 47953 47954 47955 47956[section:overload2 basic_stream_socket::operator= (2 of 2 overloads)] 47957 47958 47959Move-assign a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] from a socket of another protocol type. 47960 47961 47962 template< 47963 typename ``[link boost_asio.reference.Protocol Protocol1]``, 47964 typename ``[link boost_asio.reference.Executor1 Executor1]``> 47965 constraint< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value, basic_stream_socket & >::type operator=( 47966 basic_stream_socket< Protocol1, Executor1 > && other); 47967 47968 47969This assignment operator moves a stream socket from one object to another. 47970 47971 47972[heading Parameters] 47973 47974 47975[variablelist 47976 47977[[other][The other [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] object from which the move will occur.]] 47978 47979] 47980 47981 47982[heading Remarks] 47983 47984Following the move, the moved-from object is in the same state as if constructed using the `basic_stream_socket(const executor_type&)` constructor. 47985 47986 47987 47988 47989[endsect] 47990 47991 47992[endsect] 47993 47994 47995[section:out_of_band_inline basic_stream_socket::out_of_band_inline] 47996 47997 47998['Inherited from socket_base.] 47999 48000[indexterm2 boost_asio.indexterm.basic_stream_socket.out_of_band_inline..out_of_band_inline..basic_stream_socket] 48001Socket option for putting received out-of-band data inline. 48002 48003 48004 typedef implementation_defined out_of_band_inline; 48005 48006 48007 48008Implements the SOL\_SOCKET/SO\_OOBINLINE socket option. 48009 48010 48011[heading Examples] 48012 48013Setting the option: 48014 48015 boost::asio::ip::tcp::socket socket(my_context); 48016 ... 48017 boost::asio::socket_base::out_of_band_inline option(true); 48018 socket.set_option(option); 48019 48020 48021 48022 48023 48024Getting the current option value: 48025 48026 boost::asio::ip::tcp::socket socket(my_context); 48027 ... 48028 boost::asio::socket_base::out_of_band_inline option; 48029 socket.get_option(option); 48030 bool value = option.value(); 48031 48032 48033 48034 48035 48036 48037 48038[heading Requirements] 48039 48040['Header: ][^boost/asio/basic_stream_socket.hpp] 48041 48042['Convenience header: ][^boost/asio.hpp] 48043 48044 48045[endsect] 48046 48047 48048 48049[section:protocol_type basic_stream_socket::protocol_type] 48050 48051[indexterm2 boost_asio.indexterm.basic_stream_socket.protocol_type..protocol_type..basic_stream_socket] 48052The protocol type. 48053 48054 48055 typedef Protocol protocol_type; 48056 48057 48058 48059[heading Requirements] 48060 48061['Header: ][^boost/asio/basic_stream_socket.hpp] 48062 48063['Convenience header: ][^boost/asio.hpp] 48064 48065 48066[endsect] 48067 48068 48069[section:read_some basic_stream_socket::read_some] 48070 48071[indexterm2 boost_asio.indexterm.basic_stream_socket.read_some..read_some..basic_stream_socket] 48072Read some data from the socket. 48073 48074 48075 template< 48076 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 48077 std::size_t ``[link boost_asio.reference.basic_stream_socket.read_some.overload1 read_some]``( 48078 const MutableBufferSequence & buffers); 48079 `` [''''»''' [link boost_asio.reference.basic_stream_socket.read_some.overload1 more...]]`` 48080 48081 template< 48082 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 48083 std::size_t ``[link boost_asio.reference.basic_stream_socket.read_some.overload2 read_some]``( 48084 const MutableBufferSequence & buffers, 48085 boost::system::error_code & ec); 48086 `` [''''»''' [link boost_asio.reference.basic_stream_socket.read_some.overload2 more...]]`` 48087 48088 48089[section:overload1 basic_stream_socket::read_some (1 of 2 overloads)] 48090 48091 48092Read some data from the socket. 48093 48094 48095 template< 48096 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 48097 std::size_t read_some( 48098 const MutableBufferSequence & buffers); 48099 48100 48101This 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. 48102 48103 48104[heading Parameters] 48105 48106 48107[variablelist 48108 48109[[buffers][One or more buffers into which the data will be read.]] 48110 48111] 48112 48113 48114[heading Return Value] 48115 48116The number of bytes read. 48117 48118 48119[heading Exceptions] 48120 48121 48122[variablelist 48123 48124[[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]] 48125 48126] 48127 48128 48129[heading Remarks] 48130 48131The 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. 48132 48133 48134[heading Example] 48135 48136To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 48137 48138 socket.read_some(boost::asio::buffer(data, size)); 48139 48140 48141See 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. 48142 48143 48144 48145 48146[endsect] 48147 48148 48149 48150[section:overload2 basic_stream_socket::read_some (2 of 2 overloads)] 48151 48152 48153Read some data from the socket. 48154 48155 48156 template< 48157 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 48158 std::size_t read_some( 48159 const MutableBufferSequence & buffers, 48160 boost::system::error_code & ec); 48161 48162 48163This 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. 48164 48165 48166[heading Parameters] 48167 48168 48169[variablelist 48170 48171[[buffers][One or more buffers into which the data will be read.]] 48172 48173[[ec][Set to indicate what error occurred, if any.]] 48174 48175] 48176 48177 48178[heading Return Value] 48179 48180The number of bytes read. Returns 0 if an error occurred. 48181 48182 48183[heading Remarks] 48184 48185The 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. 48186 48187 48188 48189 48190[endsect] 48191 48192 48193[endsect] 48194 48195[section:receive basic_stream_socket::receive] 48196 48197[indexterm2 boost_asio.indexterm.basic_stream_socket.receive..receive..basic_stream_socket] 48198Receive some data on the socket. 48199 48200 48201 template< 48202 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 48203 std::size_t ``[link boost_asio.reference.basic_stream_socket.receive.overload1 receive]``( 48204 const MutableBufferSequence & buffers); 48205 `` [''''»''' [link boost_asio.reference.basic_stream_socket.receive.overload1 more...]]`` 48206 48207 template< 48208 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 48209 std::size_t ``[link boost_asio.reference.basic_stream_socket.receive.overload2 receive]``( 48210 const MutableBufferSequence & buffers, 48211 socket_base::message_flags flags); 48212 `` [''''»''' [link boost_asio.reference.basic_stream_socket.receive.overload2 more...]]`` 48213 48214 48215Receive some data on a connected socket. 48216 48217 48218 template< 48219 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 48220 std::size_t ``[link boost_asio.reference.basic_stream_socket.receive.overload3 receive]``( 48221 const MutableBufferSequence & buffers, 48222 socket_base::message_flags flags, 48223 boost::system::error_code & ec); 48224 `` [''''»''' [link boost_asio.reference.basic_stream_socket.receive.overload3 more...]]`` 48225 48226 48227[section:overload1 basic_stream_socket::receive (1 of 3 overloads)] 48228 48229 48230Receive some data on the socket. 48231 48232 48233 template< 48234 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 48235 std::size_t receive( 48236 const MutableBufferSequence & buffers); 48237 48238 48239This 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. 48240 48241 48242[heading Parameters] 48243 48244 48245[variablelist 48246 48247[[buffers][One or more buffers into which the data will be received.]] 48248 48249] 48250 48251 48252[heading Return Value] 48253 48254The number of bytes received. 48255 48256 48257[heading Exceptions] 48258 48259 48260[variablelist 48261 48262[[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]] 48263 48264] 48265 48266 48267[heading Remarks] 48268 48269The 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. 48270 48271 48272[heading Example] 48273 48274To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 48275 48276 socket.receive(boost::asio::buffer(data, size)); 48277 48278 48279See 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. 48280 48281 48282 48283 48284[endsect] 48285 48286 48287 48288[section:overload2 basic_stream_socket::receive (2 of 3 overloads)] 48289 48290 48291Receive some data on the socket. 48292 48293 48294 template< 48295 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 48296 std::size_t receive( 48297 const MutableBufferSequence & buffers, 48298 socket_base::message_flags flags); 48299 48300 48301This 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. 48302 48303 48304[heading Parameters] 48305 48306 48307[variablelist 48308 48309[[buffers][One or more buffers into which the data will be received.]] 48310 48311[[flags][Flags specifying how the receive call is to be made.]] 48312 48313] 48314 48315 48316[heading Return Value] 48317 48318The number of bytes received. 48319 48320 48321[heading Exceptions] 48322 48323 48324[variablelist 48325 48326[[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]] 48327 48328] 48329 48330 48331[heading Remarks] 48332 48333The 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. 48334 48335 48336[heading Example] 48337 48338To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 48339 48340 socket.receive(boost::asio::buffer(data, size), 0); 48341 48342 48343See 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. 48344 48345 48346 48347 48348[endsect] 48349 48350 48351 48352[section:overload3 basic_stream_socket::receive (3 of 3 overloads)] 48353 48354 48355Receive some data on a connected socket. 48356 48357 48358 template< 48359 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 48360 std::size_t receive( 48361 const MutableBufferSequence & buffers, 48362 socket_base::message_flags flags, 48363 boost::system::error_code & ec); 48364 48365 48366This 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. 48367 48368 48369[heading Parameters] 48370 48371 48372[variablelist 48373 48374[[buffers][One or more buffers into which the data will be received.]] 48375 48376[[flags][Flags specifying how the receive call is to be made.]] 48377 48378[[ec][Set to indicate what error occurred, if any.]] 48379 48380] 48381 48382 48383[heading Return Value] 48384 48385The number of bytes received. Returns 0 if an error occurred. 48386 48387 48388[heading Remarks] 48389 48390The 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. 48391 48392 48393 48394 48395[endsect] 48396 48397 48398[endsect] 48399 48400 48401[section:receive_buffer_size basic_stream_socket::receive_buffer_size] 48402 48403 48404['Inherited from socket_base.] 48405 48406[indexterm2 boost_asio.indexterm.basic_stream_socket.receive_buffer_size..receive_buffer_size..basic_stream_socket] 48407Socket option for the receive buffer size of a socket. 48408 48409 48410 typedef implementation_defined receive_buffer_size; 48411 48412 48413 48414Implements the SOL\_SOCKET/SO\_RCVBUF socket option. 48415 48416 48417[heading Examples] 48418 48419Setting the option: 48420 48421 boost::asio::ip::tcp::socket socket(my_context); 48422 ... 48423 boost::asio::socket_base::receive_buffer_size option(8192); 48424 socket.set_option(option); 48425 48426 48427 48428 48429 48430Getting the current option value: 48431 48432 boost::asio::ip::tcp::socket socket(my_context); 48433 ... 48434 boost::asio::socket_base::receive_buffer_size option; 48435 socket.get_option(option); 48436 int size = option.value(); 48437 48438 48439 48440 48441 48442 48443 48444[heading Requirements] 48445 48446['Header: ][^boost/asio/basic_stream_socket.hpp] 48447 48448['Convenience header: ][^boost/asio.hpp] 48449 48450 48451[endsect] 48452 48453 48454 48455[section:receive_low_watermark basic_stream_socket::receive_low_watermark] 48456 48457 48458['Inherited from socket_base.] 48459 48460[indexterm2 boost_asio.indexterm.basic_stream_socket.receive_low_watermark..receive_low_watermark..basic_stream_socket] 48461Socket option for the receive low watermark. 48462 48463 48464 typedef implementation_defined receive_low_watermark; 48465 48466 48467 48468Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option. 48469 48470 48471[heading Examples] 48472 48473Setting the option: 48474 48475 boost::asio::ip::tcp::socket socket(my_context); 48476 ... 48477 boost::asio::socket_base::receive_low_watermark option(1024); 48478 socket.set_option(option); 48479 48480 48481 48482 48483 48484Getting the current option value: 48485 48486 boost::asio::ip::tcp::socket socket(my_context); 48487 ... 48488 boost::asio::socket_base::receive_low_watermark option; 48489 socket.get_option(option); 48490 int size = option.value(); 48491 48492 48493 48494 48495 48496 48497 48498[heading Requirements] 48499 48500['Header: ][^boost/asio/basic_stream_socket.hpp] 48501 48502['Convenience header: ][^boost/asio.hpp] 48503 48504 48505[endsect] 48506 48507 48508[section:release basic_stream_socket::release] 48509 48510[indexterm2 boost_asio.indexterm.basic_stream_socket.release..release..basic_stream_socket] 48511Release ownership of the underlying native socket. 48512 48513 48514 native_handle_type ``[link boost_asio.reference.basic_stream_socket.release.overload1 release]``(); 48515 `` [''''»''' [link boost_asio.reference.basic_stream_socket.release.overload1 more...]]`` 48516 48517 native_handle_type ``[link boost_asio.reference.basic_stream_socket.release.overload2 release]``( 48518 boost::system::error_code & ec); 48519 `` [''''»''' [link boost_asio.reference.basic_stream_socket.release.overload2 more...]]`` 48520 48521 48522[section:overload1 basic_stream_socket::release (1 of 2 overloads)] 48523 48524 48525['Inherited from basic_socket.] 48526 48527 48528Release ownership of the underlying native socket. 48529 48530 48531 native_handle_type release(); 48532 48533 48534This 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. 48535 48536 48537[heading Exceptions] 48538 48539 48540[variablelist 48541 48542[[boost::system::system_error][Thrown on failure.]] 48543 48544] 48545 48546 48547[heading Remarks] 48548 48549This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms. 48550 48551 48552 48553 48554[endsect] 48555 48556 48557 48558[section:overload2 basic_stream_socket::release (2 of 2 overloads)] 48559 48560 48561['Inherited from basic_socket.] 48562 48563 48564Release ownership of the underlying native socket. 48565 48566 48567 native_handle_type release( 48568 boost::system::error_code & ec); 48569 48570 48571This 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. 48572 48573 48574[heading Parameters] 48575 48576 48577[variablelist 48578 48579[[ec][Set to indicate what error occurred, if any.]] 48580 48581] 48582 48583 48584[heading Remarks] 48585 48586This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms. 48587 48588 48589 48590 48591[endsect] 48592 48593 48594[endsect] 48595 48596[section:remote_endpoint basic_stream_socket::remote_endpoint] 48597 48598[indexterm2 boost_asio.indexterm.basic_stream_socket.remote_endpoint..remote_endpoint..basic_stream_socket] 48599Get the remote endpoint of the socket. 48600 48601 48602 endpoint_type ``[link boost_asio.reference.basic_stream_socket.remote_endpoint.overload1 remote_endpoint]``() const; 48603 `` [''''»''' [link boost_asio.reference.basic_stream_socket.remote_endpoint.overload1 more...]]`` 48604 48605 endpoint_type ``[link boost_asio.reference.basic_stream_socket.remote_endpoint.overload2 remote_endpoint]``( 48606 boost::system::error_code & ec) const; 48607 `` [''''»''' [link boost_asio.reference.basic_stream_socket.remote_endpoint.overload2 more...]]`` 48608 48609 48610[section:overload1 basic_stream_socket::remote_endpoint (1 of 2 overloads)] 48611 48612 48613['Inherited from basic_socket.] 48614 48615 48616Get the remote endpoint of the socket. 48617 48618 48619 endpoint_type remote_endpoint() const; 48620 48621 48622This function is used to obtain the remote endpoint of the socket. 48623 48624 48625[heading Return Value] 48626 48627An object that represents the remote endpoint of the socket. 48628 48629 48630[heading Exceptions] 48631 48632 48633[variablelist 48634 48635[[boost::system::system_error][Thrown on failure.]] 48636 48637] 48638 48639 48640[heading Example] 48641 48642 48643 48644 boost::asio::ip::tcp::socket socket(my_context); 48645 ... 48646 boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(); 48647 48648 48649 48650 48651 48652 48653 48654[endsect] 48655 48656 48657 48658[section:overload2 basic_stream_socket::remote_endpoint (2 of 2 overloads)] 48659 48660 48661['Inherited from basic_socket.] 48662 48663 48664Get the remote endpoint of the socket. 48665 48666 48667 endpoint_type remote_endpoint( 48668 boost::system::error_code & ec) const; 48669 48670 48671This function is used to obtain the remote endpoint of the socket. 48672 48673 48674[heading Parameters] 48675 48676 48677[variablelist 48678 48679[[ec][Set to indicate what error occurred, if any.]] 48680 48681] 48682 48683 48684[heading Return Value] 48685 48686An object that represents the remote endpoint of the socket. Returns a default-constructed endpoint object if an error occurred. 48687 48688 48689[heading Example] 48690 48691 48692 48693 boost::asio::ip::tcp::socket socket(my_context); 48694 ... 48695 boost::system::error_code ec; 48696 boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(ec); 48697 if (ec) 48698 { 48699 // An error occurred. 48700 } 48701 48702 48703 48704 48705 48706 48707 48708[endsect] 48709 48710 48711[endsect] 48712 48713 48714[section:reuse_address basic_stream_socket::reuse_address] 48715 48716 48717['Inherited from socket_base.] 48718 48719[indexterm2 boost_asio.indexterm.basic_stream_socket.reuse_address..reuse_address..basic_stream_socket] 48720Socket option to allow the socket to be bound to an address that is already in use. 48721 48722 48723 typedef implementation_defined reuse_address; 48724 48725 48726 48727Implements the SOL\_SOCKET/SO\_REUSEADDR socket option. 48728 48729 48730[heading Examples] 48731 48732Setting the option: 48733 48734 boost::asio::ip::tcp::acceptor acceptor(my_context); 48735 ... 48736 boost::asio::socket_base::reuse_address option(true); 48737 acceptor.set_option(option); 48738 48739 48740 48741 48742 48743Getting the current option value: 48744 48745 boost::asio::ip::tcp::acceptor acceptor(my_context); 48746 ... 48747 boost::asio::socket_base::reuse_address option; 48748 acceptor.get_option(option); 48749 bool is_set = option.value(); 48750 48751 48752 48753 48754 48755 48756 48757[heading Requirements] 48758 48759['Header: ][^boost/asio/basic_stream_socket.hpp] 48760 48761['Convenience header: ][^boost/asio.hpp] 48762 48763 48764[endsect] 48765 48766 48767[section:send basic_stream_socket::send] 48768 48769[indexterm2 boost_asio.indexterm.basic_stream_socket.send..send..basic_stream_socket] 48770Send some data on the socket. 48771 48772 48773 template< 48774 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 48775 std::size_t ``[link boost_asio.reference.basic_stream_socket.send.overload1 send]``( 48776 const ConstBufferSequence & buffers); 48777 `` [''''»''' [link boost_asio.reference.basic_stream_socket.send.overload1 more...]]`` 48778 48779 template< 48780 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 48781 std::size_t ``[link boost_asio.reference.basic_stream_socket.send.overload2 send]``( 48782 const ConstBufferSequence & buffers, 48783 socket_base::message_flags flags); 48784 `` [''''»''' [link boost_asio.reference.basic_stream_socket.send.overload2 more...]]`` 48785 48786 template< 48787 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 48788 std::size_t ``[link boost_asio.reference.basic_stream_socket.send.overload3 send]``( 48789 const ConstBufferSequence & buffers, 48790 socket_base::message_flags flags, 48791 boost::system::error_code & ec); 48792 `` [''''»''' [link boost_asio.reference.basic_stream_socket.send.overload3 more...]]`` 48793 48794 48795[section:overload1 basic_stream_socket::send (1 of 3 overloads)] 48796 48797 48798Send some data on the socket. 48799 48800 48801 template< 48802 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 48803 std::size_t send( 48804 const ConstBufferSequence & buffers); 48805 48806 48807This 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. 48808 48809 48810[heading Parameters] 48811 48812 48813[variablelist 48814 48815[[buffers][One or more data buffers to be sent on the socket.]] 48816 48817] 48818 48819 48820[heading Return Value] 48821 48822The number of bytes sent. 48823 48824 48825[heading Exceptions] 48826 48827 48828[variablelist 48829 48830[[boost::system::system_error][Thrown on failure.]] 48831 48832] 48833 48834 48835[heading Remarks] 48836 48837The 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. 48838 48839 48840[heading Example] 48841 48842To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 48843 48844 socket.send(boost::asio::buffer(data, size)); 48845 48846 48847See 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. 48848 48849 48850 48851 48852[endsect] 48853 48854 48855 48856[section:overload2 basic_stream_socket::send (2 of 3 overloads)] 48857 48858 48859Send some data on the socket. 48860 48861 48862 template< 48863 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 48864 std::size_t send( 48865 const ConstBufferSequence & buffers, 48866 socket_base::message_flags flags); 48867 48868 48869This 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. 48870 48871 48872[heading Parameters] 48873 48874 48875[variablelist 48876 48877[[buffers][One or more data buffers to be sent on the socket.]] 48878 48879[[flags][Flags specifying how the send call is to be made.]] 48880 48881] 48882 48883 48884[heading Return Value] 48885 48886The number of bytes sent. 48887 48888 48889[heading Exceptions] 48890 48891 48892[variablelist 48893 48894[[boost::system::system_error][Thrown on failure.]] 48895 48896] 48897 48898 48899[heading Remarks] 48900 48901The 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. 48902 48903 48904[heading Example] 48905 48906To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 48907 48908 socket.send(boost::asio::buffer(data, size), 0); 48909 48910 48911See 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. 48912 48913 48914 48915 48916[endsect] 48917 48918 48919 48920[section:overload3 basic_stream_socket::send (3 of 3 overloads)] 48921 48922 48923Send some data on the socket. 48924 48925 48926 template< 48927 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 48928 std::size_t send( 48929 const ConstBufferSequence & buffers, 48930 socket_base::message_flags flags, 48931 boost::system::error_code & ec); 48932 48933 48934This 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. 48935 48936 48937[heading Parameters] 48938 48939 48940[variablelist 48941 48942[[buffers][One or more data buffers to be sent on the socket.]] 48943 48944[[flags][Flags specifying how the send call is to be made.]] 48945 48946[[ec][Set to indicate what error occurred, if any.]] 48947 48948] 48949 48950 48951[heading Return Value] 48952 48953The number of bytes sent. Returns 0 if an error occurred. 48954 48955 48956[heading Remarks] 48957 48958The 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. 48959 48960 48961 48962 48963[endsect] 48964 48965 48966[endsect] 48967 48968 48969[section:send_buffer_size basic_stream_socket::send_buffer_size] 48970 48971 48972['Inherited from socket_base.] 48973 48974[indexterm2 boost_asio.indexterm.basic_stream_socket.send_buffer_size..send_buffer_size..basic_stream_socket] 48975Socket option for the send buffer size of a socket. 48976 48977 48978 typedef implementation_defined send_buffer_size; 48979 48980 48981 48982Implements the SOL\_SOCKET/SO\_SNDBUF socket option. 48983 48984 48985[heading Examples] 48986 48987Setting the option: 48988 48989 boost::asio::ip::tcp::socket socket(my_context); 48990 ... 48991 boost::asio::socket_base::send_buffer_size option(8192); 48992 socket.set_option(option); 48993 48994 48995 48996 48997 48998Getting the current option value: 48999 49000 boost::asio::ip::tcp::socket socket(my_context); 49001 ... 49002 boost::asio::socket_base::send_buffer_size option; 49003 socket.get_option(option); 49004 int size = option.value(); 49005 49006 49007 49008 49009 49010 49011 49012[heading Requirements] 49013 49014['Header: ][^boost/asio/basic_stream_socket.hpp] 49015 49016['Convenience header: ][^boost/asio.hpp] 49017 49018 49019[endsect] 49020 49021 49022 49023[section:send_low_watermark basic_stream_socket::send_low_watermark] 49024 49025 49026['Inherited from socket_base.] 49027 49028[indexterm2 boost_asio.indexterm.basic_stream_socket.send_low_watermark..send_low_watermark..basic_stream_socket] 49029Socket option for the send low watermark. 49030 49031 49032 typedef implementation_defined send_low_watermark; 49033 49034 49035 49036Implements the SOL\_SOCKET/SO\_SNDLOWAT socket option. 49037 49038 49039[heading Examples] 49040 49041Setting the option: 49042 49043 boost::asio::ip::tcp::socket socket(my_context); 49044 ... 49045 boost::asio::socket_base::send_low_watermark option(1024); 49046 socket.set_option(option); 49047 49048 49049 49050 49051 49052Getting the current option value: 49053 49054 boost::asio::ip::tcp::socket socket(my_context); 49055 ... 49056 boost::asio::socket_base::send_low_watermark option; 49057 socket.get_option(option); 49058 int size = option.value(); 49059 49060 49061 49062 49063 49064 49065 49066[heading Requirements] 49067 49068['Header: ][^boost/asio/basic_stream_socket.hpp] 49069 49070['Convenience header: ][^boost/asio.hpp] 49071 49072 49073[endsect] 49074 49075 49076[section:set_option basic_stream_socket::set_option] 49077 49078[indexterm2 boost_asio.indexterm.basic_stream_socket.set_option..set_option..basic_stream_socket] 49079Set an option on the socket. 49080 49081 49082 template< 49083 typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``> 49084 void ``[link boost_asio.reference.basic_stream_socket.set_option.overload1 set_option]``( 49085 const SettableSocketOption & option); 49086 `` [''''»''' [link boost_asio.reference.basic_stream_socket.set_option.overload1 more...]]`` 49087 49088 template< 49089 typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``> 49090 void ``[link boost_asio.reference.basic_stream_socket.set_option.overload2 set_option]``( 49091 const SettableSocketOption & option, 49092 boost::system::error_code & ec); 49093 `` [''''»''' [link boost_asio.reference.basic_stream_socket.set_option.overload2 more...]]`` 49094 49095 49096[section:overload1 basic_stream_socket::set_option (1 of 2 overloads)] 49097 49098 49099['Inherited from basic_socket.] 49100 49101 49102Set an option on the socket. 49103 49104 49105 template< 49106 typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``> 49107 void set_option( 49108 const SettableSocketOption & option); 49109 49110 49111This function is used to set an option on the socket. 49112 49113 49114[heading Parameters] 49115 49116 49117[variablelist 49118 49119[[option][The new option value to be set on the socket.]] 49120 49121] 49122 49123 49124[heading Exceptions] 49125 49126 49127[variablelist 49128 49129[[boost::system::system_error][Thrown on failure.]] 49130 49131] 49132 49133 49134 49135[heading Example] 49136 49137Setting the IPPROTO\_TCP/TCP\_NODELAY option: 49138 49139 boost::asio::ip::tcp::socket socket(my_context); 49140 ... 49141 boost::asio::ip::tcp::no_delay option(true); 49142 socket.set_option(option); 49143 49144 49145 49146 49147 49148 49149 49150[endsect] 49151 49152 49153 49154[section:overload2 basic_stream_socket::set_option (2 of 2 overloads)] 49155 49156 49157['Inherited from basic_socket.] 49158 49159 49160Set an option on the socket. 49161 49162 49163 template< 49164 typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``> 49165 void set_option( 49166 const SettableSocketOption & option, 49167 boost::system::error_code & ec); 49168 49169 49170This function is used to set an option on the socket. 49171 49172 49173[heading Parameters] 49174 49175 49176[variablelist 49177 49178[[option][The new option value to be set on the socket.]] 49179 49180[[ec][Set to indicate what error occurred, if any.]] 49181 49182] 49183 49184 49185 49186[heading Example] 49187 49188Setting the IPPROTO\_TCP/TCP\_NODELAY option: 49189 49190 boost::asio::ip::tcp::socket socket(my_context); 49191 ... 49192 boost::asio::ip::tcp::no_delay option(true); 49193 boost::system::error_code ec; 49194 socket.set_option(option, ec); 49195 if (ec) 49196 { 49197 // An error occurred. 49198 } 49199 49200 49201 49202 49203 49204 49205 49206[endsect] 49207 49208 49209[endsect] 49210 49211[section:shutdown basic_stream_socket::shutdown] 49212 49213[indexterm2 boost_asio.indexterm.basic_stream_socket.shutdown..shutdown..basic_stream_socket] 49214Disable sends or receives on the socket. 49215 49216 49217 void ``[link boost_asio.reference.basic_stream_socket.shutdown.overload1 shutdown]``( 49218 shutdown_type what); 49219 `` [''''»''' [link boost_asio.reference.basic_stream_socket.shutdown.overload1 more...]]`` 49220 49221 void ``[link boost_asio.reference.basic_stream_socket.shutdown.overload2 shutdown]``( 49222 shutdown_type what, 49223 boost::system::error_code & ec); 49224 `` [''''»''' [link boost_asio.reference.basic_stream_socket.shutdown.overload2 more...]]`` 49225 49226 49227[section:overload1 basic_stream_socket::shutdown (1 of 2 overloads)] 49228 49229 49230['Inherited from basic_socket.] 49231 49232 49233Disable sends or receives on the socket. 49234 49235 49236 void shutdown( 49237 shutdown_type what); 49238 49239 49240This function is used to disable send operations, receive operations, or both. 49241 49242 49243[heading Parameters] 49244 49245 49246[variablelist 49247 49248[[what][Determines what types of operation will no longer be allowed.]] 49249 49250] 49251 49252 49253[heading Exceptions] 49254 49255 49256[variablelist 49257 49258[[boost::system::system_error][Thrown on failure.]] 49259 49260] 49261 49262 49263[heading Example] 49264 49265Shutting down the send side of the socket: 49266 49267 boost::asio::ip::tcp::socket socket(my_context); 49268 ... 49269 socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send); 49270 49271 49272 49273 49274 49275 49276 49277[endsect] 49278 49279 49280 49281[section:overload2 basic_stream_socket::shutdown (2 of 2 overloads)] 49282 49283 49284['Inherited from basic_socket.] 49285 49286 49287Disable sends or receives on the socket. 49288 49289 49290 void shutdown( 49291 shutdown_type what, 49292 boost::system::error_code & ec); 49293 49294 49295This function is used to disable send operations, receive operations, or both. 49296 49297 49298[heading Parameters] 49299 49300 49301[variablelist 49302 49303[[what][Determines what types of operation will no longer be allowed.]] 49304 49305[[ec][Set to indicate what error occurred, if any.]] 49306 49307] 49308 49309 49310[heading Example] 49311 49312Shutting down the send side of the socket: 49313 49314 boost::asio::ip::tcp::socket socket(my_context); 49315 ... 49316 boost::system::error_code ec; 49317 socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send, ec); 49318 if (ec) 49319 { 49320 // An error occurred. 49321 } 49322 49323 49324 49325 49326 49327 49328 49329[endsect] 49330 49331 49332[endsect] 49333 49334 49335[section:shutdown_type basic_stream_socket::shutdown_type] 49336 49337 49338['Inherited from socket_base.] 49339 49340[indexterm2 boost_asio.indexterm.basic_stream_socket.shutdown_type..shutdown_type..basic_stream_socket] 49341Different ways a socket may be shutdown. 49342 49343 49344 enum shutdown_type 49345 49346[indexterm2 boost_asio.indexterm.basic_stream_socket.shutdown_type.shutdown_receive..shutdown_receive..basic_stream_socket] 49347[indexterm2 boost_asio.indexterm.basic_stream_socket.shutdown_type.shutdown_send..shutdown_send..basic_stream_socket] 49348[indexterm2 boost_asio.indexterm.basic_stream_socket.shutdown_type.shutdown_both..shutdown_both..basic_stream_socket] 49349 49350[heading Values] 49351[variablelist 49352 49353 [ 49354 [shutdown_receive] 49355 [Shutdown the receive side of the socket. ] 49356 ] 49357 49358 [ 49359 [shutdown_send] 49360 [Shutdown the send side of the socket. ] 49361 ] 49362 49363 [ 49364 [shutdown_both] 49365 [Shutdown both send and receive on the socket. ] 49366 ] 49367 49368] 49369 49370 49371 49372[endsect] 49373 49374 49375[section:wait basic_stream_socket::wait] 49376 49377[indexterm2 boost_asio.indexterm.basic_stream_socket.wait..wait..basic_stream_socket] 49378Wait for the socket to become ready to read, ready to write, or to have pending error conditions. 49379 49380 49381 void ``[link boost_asio.reference.basic_stream_socket.wait.overload1 wait]``( 49382 wait_type w); 49383 `` [''''»''' [link boost_asio.reference.basic_stream_socket.wait.overload1 more...]]`` 49384 49385 void ``[link boost_asio.reference.basic_stream_socket.wait.overload2 wait]``( 49386 wait_type w, 49387 boost::system::error_code & ec); 49388 `` [''''»''' [link boost_asio.reference.basic_stream_socket.wait.overload2 more...]]`` 49389 49390 49391[section:overload1 basic_stream_socket::wait (1 of 2 overloads)] 49392 49393 49394['Inherited from basic_socket.] 49395 49396 49397Wait for the socket to become ready to read, ready to write, or to have pending error conditions. 49398 49399 49400 void wait( 49401 wait_type w); 49402 49403 49404This function is used to perform a blocking wait for a socket to enter a ready to read, write or error condition state. 49405 49406 49407[heading Parameters] 49408 49409 49410[variablelist 49411 49412[[w][Specifies the desired socket state.]] 49413 49414] 49415 49416 49417[heading Example] 49418 49419Waiting for a socket to become readable. 49420 49421 boost::asio::ip::tcp::socket socket(my_context); 49422 ... 49423 socket.wait(boost::asio::ip::tcp::socket::wait_read); 49424 49425 49426 49427 49428 49429 49430 49431[endsect] 49432 49433 49434 49435[section:overload2 basic_stream_socket::wait (2 of 2 overloads)] 49436 49437 49438['Inherited from basic_socket.] 49439 49440 49441Wait for the socket to become ready to read, ready to write, or to have pending error conditions. 49442 49443 49444 void wait( 49445 wait_type w, 49446 boost::system::error_code & ec); 49447 49448 49449This function is used to perform a blocking wait for a socket to enter a ready to read, write or error condition state. 49450 49451 49452[heading Parameters] 49453 49454 49455[variablelist 49456 49457[[w][Specifies the desired socket state.]] 49458 49459[[ec][Set to indicate what error occurred, if any.]] 49460 49461] 49462 49463 49464[heading Example] 49465 49466Waiting for a socket to become readable. 49467 49468 boost::asio::ip::tcp::socket socket(my_context); 49469 ... 49470 boost::system::error_code ec; 49471 socket.wait(boost::asio::ip::tcp::socket::wait_read, ec); 49472 49473 49474 49475 49476 49477 49478 49479[endsect] 49480 49481 49482[endsect] 49483 49484 49485[section:wait_type basic_stream_socket::wait_type] 49486 49487 49488['Inherited from socket_base.] 49489 49490[indexterm2 boost_asio.indexterm.basic_stream_socket.wait_type..wait_type..basic_stream_socket] 49491Wait types. 49492 49493 49494 enum wait_type 49495 49496[indexterm2 boost_asio.indexterm.basic_stream_socket.wait_type.wait_read..wait_read..basic_stream_socket] 49497[indexterm2 boost_asio.indexterm.basic_stream_socket.wait_type.wait_write..wait_write..basic_stream_socket] 49498[indexterm2 boost_asio.indexterm.basic_stream_socket.wait_type.wait_error..wait_error..basic_stream_socket] 49499 49500[heading Values] 49501[variablelist 49502 49503 [ 49504 [wait_read] 49505 [Wait for a socket to become ready to read. ] 49506 ] 49507 49508 [ 49509 [wait_write] 49510 [Wait for a socket to become ready to write. ] 49511 ] 49512 49513 [ 49514 [wait_error] 49515 [Wait for a socket to have error conditions pending. ] 49516 ] 49517 49518] 49519 49520 49521For use with `basic_socket::wait()` and `basic_socket::async_wait()`. 49522 49523 49524[endsect] 49525 49526 49527[section:write_some basic_stream_socket::write_some] 49528 49529[indexterm2 boost_asio.indexterm.basic_stream_socket.write_some..write_some..basic_stream_socket] 49530Write some data to the socket. 49531 49532 49533 template< 49534 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 49535 std::size_t ``[link boost_asio.reference.basic_stream_socket.write_some.overload1 write_some]``( 49536 const ConstBufferSequence & buffers); 49537 `` [''''»''' [link boost_asio.reference.basic_stream_socket.write_some.overload1 more...]]`` 49538 49539 template< 49540 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 49541 std::size_t ``[link boost_asio.reference.basic_stream_socket.write_some.overload2 write_some]``( 49542 const ConstBufferSequence & buffers, 49543 boost::system::error_code & ec); 49544 `` [''''»''' [link boost_asio.reference.basic_stream_socket.write_some.overload2 more...]]`` 49545 49546 49547[section:overload1 basic_stream_socket::write_some (1 of 2 overloads)] 49548 49549 49550Write some data to the socket. 49551 49552 49553 template< 49554 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 49555 std::size_t write_some( 49556 const ConstBufferSequence & buffers); 49557 49558 49559This 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. 49560 49561 49562[heading Parameters] 49563 49564 49565[variablelist 49566 49567[[buffers][One or more data buffers to be written to the socket.]] 49568 49569] 49570 49571 49572[heading Return Value] 49573 49574The number of bytes written. 49575 49576 49577[heading Exceptions] 49578 49579 49580[variablelist 49581 49582[[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]] 49583 49584] 49585 49586 49587[heading Remarks] 49588 49589The 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. 49590 49591 49592[heading Example] 49593 49594To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 49595 49596 socket.write_some(boost::asio::buffer(data, size)); 49597 49598 49599See 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. 49600 49601 49602 49603 49604[endsect] 49605 49606 49607 49608[section:overload2 basic_stream_socket::write_some (2 of 2 overloads)] 49609 49610 49611Write some data to the socket. 49612 49613 49614 template< 49615 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 49616 std::size_t write_some( 49617 const ConstBufferSequence & buffers, 49618 boost::system::error_code & ec); 49619 49620 49621This 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. 49622 49623 49624[heading Parameters] 49625 49626 49627[variablelist 49628 49629[[buffers][One or more data buffers to be written to the socket.]] 49630 49631[[ec][Set to indicate what error occurred, if any.]] 49632 49633] 49634 49635 49636[heading Return Value] 49637 49638The number of bytes written. Returns 0 if an error occurred. 49639 49640 49641[heading Remarks] 49642 49643The 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. 49644 49645 49646 49647 49648[endsect] 49649 49650 49651[endsect] 49652 49653 49654[section:_basic_stream_socket basic_stream_socket::~basic_stream_socket] 49655 49656[indexterm2 boost_asio.indexterm.basic_stream_socket._basic_stream_socket..~basic_stream_socket..basic_stream_socket] 49657Destroys the socket. 49658 49659 49660 ~basic_stream_socket(); 49661 49662 49663This function destroys the socket, cancelling any outstanding asynchronous operations associated with the socket as if by calling `cancel`. 49664 49665 49666[endsect] 49667 49668 49669 49670[endsect] 49671 49672[section:basic_stream_socket__rebind_executor basic_stream_socket::rebind_executor] 49673 49674[indexterm1 boost_asio.indexterm.basic_stream_socket__rebind_executor..basic_stream_socket::rebind_executor] 49675 49676 49677Rebinds the socket type to another executor. 49678 49679 49680 template< 49681 typename ``[link boost_asio.reference.Executor1 Executor1]``> 49682 struct rebind_executor 49683 49684 49685[heading Types] 49686[table 49687 [[Name][Description]] 49688 49689 [ 49690 49691 [[link boost_asio.reference.basic_stream_socket__rebind_executor.other [*other]]] 49692 [The socket type when rebound to the specified executor. ] 49693 49694 ] 49695 49696] 49697 49698[heading Requirements] 49699 49700['Header: ][^boost/asio/basic_stream_socket.hpp] 49701 49702['Convenience header: ][^boost/asio.hpp] 49703 49704 49705[section:other basic_stream_socket::rebind_executor::other] 49706 49707[indexterm2 boost_asio.indexterm.basic_stream_socket__rebind_executor.other..other..basic_stream_socket::rebind_executor] 49708The socket type when rebound to the specified executor. 49709 49710 49711 typedef basic_stream_socket< Protocol, Executor1 > other; 49712 49713 49714[heading Types] 49715[table 49716 [[Name][Description]] 49717 49718 [ 49719 49720 [[link boost_asio.reference.basic_stream_socket__rebind_executor [*rebind_executor]]] 49721 [Rebinds the socket type to another executor. ] 49722 49723 ] 49724 49725 [ 49726 49727 [[link boost_asio.reference.basic_stream_socket.broadcast [*broadcast]]] 49728 [Socket option to permit sending of broadcast messages. ] 49729 49730 ] 49731 49732 [ 49733 49734 [[link boost_asio.reference.basic_stream_socket.bytes_readable [*bytes_readable]]] 49735 [IO control command to get the amount of data that can be read without blocking. ] 49736 49737 ] 49738 49739 [ 49740 49741 [[link boost_asio.reference.basic_stream_socket.debug [*debug]]] 49742 [Socket option to enable socket-level debugging. ] 49743 49744 ] 49745 49746 [ 49747 49748 [[link boost_asio.reference.basic_stream_socket.do_not_route [*do_not_route]]] 49749 [Socket option to prevent routing, use local interfaces only. ] 49750 49751 ] 49752 49753 [ 49754 49755 [[link boost_asio.reference.basic_stream_socket.enable_connection_aborted [*enable_connection_aborted]]] 49756 [Socket option to report aborted connections on accept. ] 49757 49758 ] 49759 49760 [ 49761 49762 [[link boost_asio.reference.basic_stream_socket.endpoint_type [*endpoint_type]]] 49763 [The endpoint type. ] 49764 49765 ] 49766 49767 [ 49768 49769 [[link boost_asio.reference.basic_stream_socket.executor_type [*executor_type]]] 49770 [The type of the executor associated with the object. ] 49771 49772 ] 49773 49774 [ 49775 49776 [[link boost_asio.reference.basic_stream_socket.keep_alive [*keep_alive]]] 49777 [Socket option to send keep-alives. ] 49778 49779 ] 49780 49781 [ 49782 49783 [[link boost_asio.reference.basic_stream_socket.linger [*linger]]] 49784 [Socket option to specify whether the socket lingers on close if unsent data is present. ] 49785 49786 ] 49787 49788 [ 49789 49790 [[link boost_asio.reference.basic_stream_socket.lowest_layer_type [*lowest_layer_type]]] 49791 [A basic_socket is always the lowest layer. ] 49792 49793 ] 49794 49795 [ 49796 49797 [[link boost_asio.reference.basic_stream_socket.message_flags [*message_flags]]] 49798 [Bitmask type for flags that can be passed to send and receive operations. ] 49799 49800 ] 49801 49802 [ 49803 49804 [[link boost_asio.reference.basic_stream_socket.native_handle_type [*native_handle_type]]] 49805 [The native representation of a socket. ] 49806 49807 ] 49808 49809 [ 49810 49811 [[link boost_asio.reference.basic_stream_socket.out_of_band_inline [*out_of_band_inline]]] 49812 [Socket option for putting received out-of-band data inline. ] 49813 49814 ] 49815 49816 [ 49817 49818 [[link boost_asio.reference.basic_stream_socket.protocol_type [*protocol_type]]] 49819 [The protocol type. ] 49820 49821 ] 49822 49823 [ 49824 49825 [[link boost_asio.reference.basic_stream_socket.receive_buffer_size [*receive_buffer_size]]] 49826 [Socket option for the receive buffer size of a socket. ] 49827 49828 ] 49829 49830 [ 49831 49832 [[link boost_asio.reference.basic_stream_socket.receive_low_watermark [*receive_low_watermark]]] 49833 [Socket option for the receive low watermark. ] 49834 49835 ] 49836 49837 [ 49838 49839 [[link boost_asio.reference.basic_stream_socket.reuse_address [*reuse_address]]] 49840 [Socket option to allow the socket to be bound to an address that is already in use. ] 49841 49842 ] 49843 49844 [ 49845 49846 [[link boost_asio.reference.basic_stream_socket.send_buffer_size [*send_buffer_size]]] 49847 [Socket option for the send buffer size of a socket. ] 49848 49849 ] 49850 49851 [ 49852 49853 [[link boost_asio.reference.basic_stream_socket.send_low_watermark [*send_low_watermark]]] 49854 [Socket option for the send low watermark. ] 49855 49856 ] 49857 49858 [ 49859 49860 [[link boost_asio.reference.basic_stream_socket.shutdown_type [*shutdown_type]]] 49861 [Different ways a socket may be shutdown. ] 49862 49863 ] 49864 49865 [ 49866 49867 [[link boost_asio.reference.basic_stream_socket.wait_type [*wait_type]]] 49868 [Wait types. ] 49869 49870 ] 49871 49872] 49873 49874[heading Member Functions] 49875[table 49876 [[Name][Description]] 49877 49878 [ 49879 [[link boost_asio.reference.basic_stream_socket.assign [*assign]]] 49880 [Assign an existing native socket to the socket. ] 49881 ] 49882 49883 [ 49884 [[link boost_asio.reference.basic_stream_socket.async_connect [*async_connect]]] 49885 [Start an asynchronous connect. ] 49886 ] 49887 49888 [ 49889 [[link boost_asio.reference.basic_stream_socket.async_read_some [*async_read_some]]] 49890 [Start an asynchronous read. ] 49891 ] 49892 49893 [ 49894 [[link boost_asio.reference.basic_stream_socket.async_receive [*async_receive]]] 49895 [Start an asynchronous receive. ] 49896 ] 49897 49898 [ 49899 [[link boost_asio.reference.basic_stream_socket.async_send [*async_send]]] 49900 [Start an asynchronous send. ] 49901 ] 49902 49903 [ 49904 [[link boost_asio.reference.basic_stream_socket.async_wait [*async_wait]]] 49905 [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 49906 ] 49907 49908 [ 49909 [[link boost_asio.reference.basic_stream_socket.async_write_some [*async_write_some]]] 49910 [Start an asynchronous write. ] 49911 ] 49912 49913 [ 49914 [[link boost_asio.reference.basic_stream_socket.at_mark [*at_mark]]] 49915 [Determine whether the socket is at the out-of-band data mark. ] 49916 ] 49917 49918 [ 49919 [[link boost_asio.reference.basic_stream_socket.available [*available]]] 49920 [Determine the number of bytes available for reading. ] 49921 ] 49922 49923 [ 49924 [[link boost_asio.reference.basic_stream_socket.basic_stream_socket [*basic_stream_socket]] [constructor]] 49925 [Construct a basic_stream_socket without opening it. 49926 [hr] 49927 Construct and open a basic_stream_socket. 49928 [hr] 49929 Construct a basic_stream_socket, opening it and binding it to the given local endpoint. 49930 [hr] 49931 Construct a basic_stream_socket on an existing native socket. 49932 [hr] 49933 Move-construct a basic_stream_socket from another. 49934 [hr] 49935 Move-construct a basic_stream_socket from a socket of another protocol type. ] 49936 ] 49937 49938 [ 49939 [[link boost_asio.reference.basic_stream_socket.bind [*bind]]] 49940 [Bind the socket to the given local endpoint. ] 49941 ] 49942 49943 [ 49944 [[link boost_asio.reference.basic_stream_socket.cancel [*cancel]]] 49945 [Cancel all asynchronous operations associated with the socket. ] 49946 ] 49947 49948 [ 49949 [[link boost_asio.reference.basic_stream_socket.close [*close]]] 49950 [Close the socket. ] 49951 ] 49952 49953 [ 49954 [[link boost_asio.reference.basic_stream_socket.connect [*connect]]] 49955 [Connect the socket to the specified endpoint. ] 49956 ] 49957 49958 [ 49959 [[link boost_asio.reference.basic_stream_socket.get_executor [*get_executor]]] 49960 [Get the executor associated with the object. ] 49961 ] 49962 49963 [ 49964 [[link boost_asio.reference.basic_stream_socket.get_option [*get_option]]] 49965 [Get an option from the socket. ] 49966 ] 49967 49968 [ 49969 [[link boost_asio.reference.basic_stream_socket.io_control [*io_control]]] 49970 [Perform an IO control command on the socket. ] 49971 ] 49972 49973 [ 49974 [[link boost_asio.reference.basic_stream_socket.is_open [*is_open]]] 49975 [Determine whether the socket is open. ] 49976 ] 49977 49978 [ 49979 [[link boost_asio.reference.basic_stream_socket.local_endpoint [*local_endpoint]]] 49980 [Get the local endpoint of the socket. ] 49981 ] 49982 49983 [ 49984 [[link boost_asio.reference.basic_stream_socket.lowest_layer [*lowest_layer]]] 49985 [Get a reference to the lowest layer. 49986 [hr] 49987 Get a const reference to the lowest layer. ] 49988 ] 49989 49990 [ 49991 [[link boost_asio.reference.basic_stream_socket.native_handle [*native_handle]]] 49992 [Get the native socket representation. ] 49993 ] 49994 49995 [ 49996 [[link boost_asio.reference.basic_stream_socket.native_non_blocking [*native_non_blocking]]] 49997 [Gets the non-blocking mode of the native socket implementation. 49998 [hr] 49999 Sets the non-blocking mode of the native socket implementation. ] 50000 ] 50001 50002 [ 50003 [[link boost_asio.reference.basic_stream_socket.non_blocking [*non_blocking]]] 50004 [Gets the non-blocking mode of the socket. 50005 [hr] 50006 Sets the non-blocking mode of the socket. ] 50007 ] 50008 50009 [ 50010 [[link boost_asio.reference.basic_stream_socket.open [*open]]] 50011 [Open the socket using the specified protocol. ] 50012 ] 50013 50014 [ 50015 [[link boost_asio.reference.basic_stream_socket.operator_eq_ [*operator=]]] 50016 [Move-assign a basic_stream_socket from another. 50017 [hr] 50018 Move-assign a basic_stream_socket from a socket of another protocol type. ] 50019 ] 50020 50021 [ 50022 [[link boost_asio.reference.basic_stream_socket.read_some [*read_some]]] 50023 [Read some data from the socket. ] 50024 ] 50025 50026 [ 50027 [[link boost_asio.reference.basic_stream_socket.receive [*receive]]] 50028 [Receive some data on the socket. 50029 [hr] 50030 Receive some data on a connected socket. ] 50031 ] 50032 50033 [ 50034 [[link boost_asio.reference.basic_stream_socket.release [*release]]] 50035 [Release ownership of the underlying native socket. ] 50036 ] 50037 50038 [ 50039 [[link boost_asio.reference.basic_stream_socket.remote_endpoint [*remote_endpoint]]] 50040 [Get the remote endpoint of the socket. ] 50041 ] 50042 50043 [ 50044 [[link boost_asio.reference.basic_stream_socket.send [*send]]] 50045 [Send some data on the socket. ] 50046 ] 50047 50048 [ 50049 [[link boost_asio.reference.basic_stream_socket.set_option [*set_option]]] 50050 [Set an option on the socket. ] 50051 ] 50052 50053 [ 50054 [[link boost_asio.reference.basic_stream_socket.shutdown [*shutdown]]] 50055 [Disable sends or receives on the socket. ] 50056 ] 50057 50058 [ 50059 [[link boost_asio.reference.basic_stream_socket.wait [*wait]]] 50060 [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 50061 ] 50062 50063 [ 50064 [[link boost_asio.reference.basic_stream_socket.write_some [*write_some]]] 50065 [Write some data to the socket. ] 50066 ] 50067 50068 [ 50069 [[link boost_asio.reference.basic_stream_socket._basic_stream_socket [*~basic_stream_socket]] [destructor]] 50070 [Destroys the socket. ] 50071 ] 50072 50073] 50074 50075[heading Data Members] 50076[table 50077 [[Name][Description]] 50078 50079 [ 50080 [[link boost_asio.reference.basic_stream_socket.max_connections [*max_connections]] [static]] 50081 [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ] 50082 ] 50083 50084 [ 50085 [[link boost_asio.reference.basic_stream_socket.max_listen_connections [*max_listen_connections]] [static]] 50086 [The maximum length of the queue of pending incoming connections. ] 50087 ] 50088 50089 [ 50090 [[link boost_asio.reference.basic_stream_socket.message_do_not_route [*message_do_not_route]] [static]] 50091 [Specify that the data should not be subject to routing. ] 50092 ] 50093 50094 [ 50095 [[link boost_asio.reference.basic_stream_socket.message_end_of_record [*message_end_of_record]] [static]] 50096 [Specifies that the data marks the end of a record. ] 50097 ] 50098 50099 [ 50100 [[link boost_asio.reference.basic_stream_socket.message_out_of_band [*message_out_of_band]] [static]] 50101 [Process out-of-band data. ] 50102 ] 50103 50104 [ 50105 [[link boost_asio.reference.basic_stream_socket.message_peek [*message_peek]] [static]] 50106 [Peek at incoming data without removing it from the input queue. ] 50107 ] 50108 50109] 50110 50111The [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] class template provides asynchronous and blocking stream-oriented socket functionality. 50112 50113 50114[heading Thread Safety] 50115 50116['Distinct] ['objects:] Safe. 50117 50118['Shared] ['objects:] Unsafe. 50119 50120Synchronous `send`, `receive`, and `connect` operations are thread safe with respect to each other, if the underlying operating system calls are also thread safe. This means that it is permitted to perform concurrent calls to these synchronous operations on a single socket object. Other synchronous operations, such as `open` or `close`, are not thread safe. 50121 50122 50123 50124 50125 50126[heading Requirements] 50127 50128['Header: ][^boost/asio/basic_stream_socket.hpp] 50129 50130['Convenience header: ][^boost/asio.hpp] 50131 50132 50133[endsect] 50134 50135 50136 50137[endsect] 50138 50139[section:basic_streambuf basic_streambuf] 50140 50141[indexterm1 boost_asio.indexterm.basic_streambuf..basic_streambuf] 50142 50143 50144Automatically resizable buffer class based on std::streambuf. 50145 50146 50147 template< 50148 typename Allocator = std::allocator<char>> 50149 class basic_streambuf : 50150 noncopyable 50151 50152 50153[heading Types] 50154[table 50155 [[Name][Description]] 50156 50157 [ 50158 50159 [[link boost_asio.reference.basic_streambuf.const_buffers_type [*const_buffers_type]]] 50160 [The type used to represent the input sequence as a list of buffers. ] 50161 50162 ] 50163 50164 [ 50165 50166 [[link boost_asio.reference.basic_streambuf.mutable_buffers_type [*mutable_buffers_type]]] 50167 [The type used to represent the output sequence as a list of buffers. ] 50168 50169 ] 50170 50171] 50172 50173[heading Member Functions] 50174[table 50175 [[Name][Description]] 50176 50177 [ 50178 [[link boost_asio.reference.basic_streambuf.basic_streambuf [*basic_streambuf]] [constructor]] 50179 [Construct a basic_streambuf object. ] 50180 ] 50181 50182 [ 50183 [[link boost_asio.reference.basic_streambuf.capacity [*capacity]]] 50184 [Get the current capacity of the basic_streambuf. ] 50185 ] 50186 50187 [ 50188 [[link boost_asio.reference.basic_streambuf.commit [*commit]]] 50189 [Move characters from the output sequence to the input sequence. ] 50190 ] 50191 50192 [ 50193 [[link boost_asio.reference.basic_streambuf.consume [*consume]]] 50194 [Remove characters from the input sequence. ] 50195 ] 50196 50197 [ 50198 [[link boost_asio.reference.basic_streambuf.data [*data]]] 50199 [Get a list of buffers that represents the input sequence. ] 50200 ] 50201 50202 [ 50203 [[link boost_asio.reference.basic_streambuf.max_size [*max_size]]] 50204 [Get the maximum size of the basic_streambuf. ] 50205 ] 50206 50207 [ 50208 [[link boost_asio.reference.basic_streambuf.prepare [*prepare]]] 50209 [Get a list of buffers that represents the output sequence, with the given size. ] 50210 ] 50211 50212 [ 50213 [[link boost_asio.reference.basic_streambuf.size [*size]]] 50214 [Get the size of the input sequence. ] 50215 ] 50216 50217] 50218 50219[heading Protected Member Functions] 50220[table 50221 [[Name][Description]] 50222 50223 [ 50224 [[link boost_asio.reference.basic_streambuf.overflow [*overflow]]] 50225 [Override std::streambuf behaviour. ] 50226 ] 50227 50228 [ 50229 [[link boost_asio.reference.basic_streambuf.reserve [*reserve]]] 50230 [] 50231 ] 50232 50233 [ 50234 [[link boost_asio.reference.basic_streambuf.underflow [*underflow]]] 50235 [Override std::streambuf behaviour. ] 50236 ] 50237 50238] 50239 50240The `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. 50241 50242The `basic_streambuf` class's public interface is intended to permit the following implementation strategies: 50243 50244 50245* 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. 50246 50247 50248* 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. 50249 50250 50251* 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. 50252 50253The 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: 50254 50255 size() <= max_size() 50256 50257 50258Any member function that would, if successful, cause the invariant to be violated shall throw an exception of class `std::length_error`. 50259 50260The 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. 50261 50262 50263[heading Examples] 50264 50265Writing directly from an streambuf to a socket: 50266 50267 boost::asio::streambuf b; 50268 std::ostream os(&b); 50269 os << "Hello, World!\n"; 50270 50271 // try sending some data in input sequence 50272 size_t n = sock.send(b.data()); 50273 50274 b.consume(n); // sent data is removed from input sequence 50275 50276 50277 50278 50279Reading from a socket directly into a streambuf: 50280 50281 boost::asio::streambuf b; 50282 50283 // reserve 512 bytes in output sequence 50284 boost::asio::streambuf::mutable_buffers_type bufs = b.prepare(512); 50285 50286 size_t n = sock.receive(bufs); 50287 50288 // received data is "committed" from output sequence to input sequence 50289 b.commit(n); 50290 50291 std::istream is(&b); 50292 std::string s; 50293 is >> s; 50294 50295 50296 50297 50298[heading Requirements] 50299 50300['Header: ][^boost/asio/basic_streambuf.hpp] 50301 50302['Convenience header: ][^boost/asio.hpp] 50303 50304 50305[section:basic_streambuf basic_streambuf::basic_streambuf] 50306 50307[indexterm2 boost_asio.indexterm.basic_streambuf.basic_streambuf..basic_streambuf..basic_streambuf] 50308Construct a [link boost_asio.reference.basic_streambuf `basic_streambuf`] object. 50309 50310 50311 basic_streambuf( 50312 std::size_t maximum_size = (std::numeric_limits< std::size_t >::max)(), 50313 const Allocator & allocator = Allocator()); 50314 50315 50316Constructs a streambuf with the specified maximum size. The initial size of the streambuf's input sequence is 0. 50317 50318 50319[endsect] 50320 50321 50322 50323[section:capacity basic_streambuf::capacity] 50324 50325[indexterm2 boost_asio.indexterm.basic_streambuf.capacity..capacity..basic_streambuf] 50326Get the current capacity of the [link boost_asio.reference.basic_streambuf `basic_streambuf`]. 50327 50328 50329 std::size_t capacity() const; 50330 50331 50332 50333[heading Return Value] 50334 50335The current total capacity of the streambuf, i.e. for both the input sequence and output sequence. 50336 50337 50338 50339 50340[endsect] 50341 50342 50343 50344[section:commit basic_streambuf::commit] 50345 50346[indexterm2 boost_asio.indexterm.basic_streambuf.commit..commit..basic_streambuf] 50347Move characters from the output sequence to the input sequence. 50348 50349 50350 void commit( 50351 std::size_t n); 50352 50353 50354Appends `n` characters from the start of the output sequence to the input sequence. The beginning of the output sequence is advanced by `n` characters. 50355 50356Requires a preceding call `prepare(x)` where `x >= n`, and no intervening operations that modify the input or output sequence. 50357 50358 50359[heading Remarks] 50360 50361If `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. 50362 50363 50364 50365 50366[endsect] 50367 50368 50369 50370[section:const_buffers_type basic_streambuf::const_buffers_type] 50371 50372[indexterm2 boost_asio.indexterm.basic_streambuf.const_buffers_type..const_buffers_type..basic_streambuf] 50373The type used to represent the input sequence as a list of buffers. 50374 50375 50376 typedef implementation_defined const_buffers_type; 50377 50378 50379 50380[heading Requirements] 50381 50382['Header: ][^boost/asio/basic_streambuf.hpp] 50383 50384['Convenience header: ][^boost/asio.hpp] 50385 50386 50387[endsect] 50388 50389 50390 50391[section:consume basic_streambuf::consume] 50392 50393[indexterm2 boost_asio.indexterm.basic_streambuf.consume..consume..basic_streambuf] 50394Remove characters from the input sequence. 50395 50396 50397 void consume( 50398 std::size_t n); 50399 50400 50401Removes `n` characters from the beginning of the input sequence. 50402 50403 50404[heading Remarks] 50405 50406If `n` is greater than the size of the input sequence, the entire input sequence is consumed and no error is issued. 50407 50408 50409 50410 50411[endsect] 50412 50413 50414 50415[section:data basic_streambuf::data] 50416 50417[indexterm2 boost_asio.indexterm.basic_streambuf.data..data..basic_streambuf] 50418Get a list of buffers that represents the input sequence. 50419 50420 50421 const_buffers_type data() const; 50422 50423 50424 50425[heading Return Value] 50426 50427An object of type `const_buffers_type` that satisfies ConstBufferSequence requirements, representing all character arrays in the input sequence. 50428 50429 50430[heading Remarks] 50431 50432The returned object is invalidated by any `basic_streambuf` member function that modifies the input sequence or output sequence. 50433 50434 50435 50436 50437[endsect] 50438 50439 50440 50441[section:max_size basic_streambuf::max_size] 50442 50443[indexterm2 boost_asio.indexterm.basic_streambuf.max_size..max_size..basic_streambuf] 50444Get the maximum size of the [link boost_asio.reference.basic_streambuf `basic_streambuf`]. 50445 50446 50447 std::size_t max_size() const; 50448 50449 50450 50451[heading Return Value] 50452 50453The allowed maximum of the sum of the sizes of the input sequence and output sequence. 50454 50455 50456 50457 50458[endsect] 50459 50460 50461 50462[section:mutable_buffers_type basic_streambuf::mutable_buffers_type] 50463 50464[indexterm2 boost_asio.indexterm.basic_streambuf.mutable_buffers_type..mutable_buffers_type..basic_streambuf] 50465The type used to represent the output sequence as a list of buffers. 50466 50467 50468 typedef implementation_defined mutable_buffers_type; 50469 50470 50471 50472[heading Requirements] 50473 50474['Header: ][^boost/asio/basic_streambuf.hpp] 50475 50476['Convenience header: ][^boost/asio.hpp] 50477 50478 50479[endsect] 50480 50481 50482 50483[section:overflow basic_streambuf::overflow] 50484 50485[indexterm2 boost_asio.indexterm.basic_streambuf.overflow..overflow..basic_streambuf] 50486Override std::streambuf behaviour. 50487 50488 50489 int_type overflow( 50490 int_type c); 50491 50492 50493Behaves 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. 50494 50495 50496[endsect] 50497 50498 50499 50500[section:prepare basic_streambuf::prepare] 50501 50502[indexterm2 boost_asio.indexterm.basic_streambuf.prepare..prepare..basic_streambuf] 50503Get a list of buffers that represents the output sequence, with the given size. 50504 50505 50506 mutable_buffers_type prepare( 50507 std::size_t n); 50508 50509 50510Ensures that the output sequence can accommodate `n` characters, reallocating character array objects as necessary. 50511 50512 50513[heading Return Value] 50514 50515An 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`. 50516 50517 50518[heading Exceptions] 50519 50520 50521[variablelist 50522 50523[[std::length_error][If `size() + n > max_size()`.]] 50524 50525] 50526 50527 50528[heading Remarks] 50529 50530The returned object is invalidated by any `basic_streambuf` member function that modifies the input sequence or output sequence. 50531 50532 50533 50534 50535[endsect] 50536 50537 50538 50539[section:reserve basic_streambuf::reserve] 50540 50541[indexterm2 boost_asio.indexterm.basic_streambuf.reserve..reserve..basic_streambuf] 50542 50543 void reserve( 50544 std::size_t n); 50545 50546 50547 50548[endsect] 50549 50550 50551 50552[section:size basic_streambuf::size] 50553 50554[indexterm2 boost_asio.indexterm.basic_streambuf.size..size..basic_streambuf] 50555Get the size of the input sequence. 50556 50557 50558 std::size_t size() const; 50559 50560 50561 50562[heading Return Value] 50563 50564The size of the input sequence. The value is equal to that calculated for `s` in the following code: 50565 50566 size_t s = 0; 50567 const_buffers_type bufs = data(); 50568 const_buffers_type::const_iterator i = bufs.begin(); 50569 while (i != bufs.end()) 50570 { 50571 const_buffer buf(*i++); 50572 s += buf.size(); 50573 } 50574 50575 50576 50577 50578 50579 50580 50581[endsect] 50582 50583 50584 50585[section:underflow basic_streambuf::underflow] 50586 50587[indexterm2 boost_asio.indexterm.basic_streambuf.underflow..underflow..basic_streambuf] 50588Override std::streambuf behaviour. 50589 50590 50591 int_type underflow(); 50592 50593 50594Behaves according to the specification of `std::streambuf::underflow()`. 50595 50596 50597[endsect] 50598 50599 50600 50601[endsect] 50602 50603[section:basic_streambuf_ref basic_streambuf_ref] 50604 50605[indexterm1 boost_asio.indexterm.basic_streambuf_ref..basic_streambuf_ref] 50606 50607 50608Adapts [link boost_asio.reference.basic_streambuf `basic_streambuf`] to the dynamic buffer sequence type requirements. 50609 50610 50611 template< 50612 typename Allocator = std::allocator<char>> 50613 class basic_streambuf_ref 50614 50615 50616[heading Types] 50617[table 50618 [[Name][Description]] 50619 50620 [ 50621 50622 [[link boost_asio.reference.basic_streambuf_ref.const_buffers_type [*const_buffers_type]]] 50623 [The type used to represent the input sequence as a list of buffers. ] 50624 50625 ] 50626 50627 [ 50628 50629 [[link boost_asio.reference.basic_streambuf_ref.mutable_buffers_type [*mutable_buffers_type]]] 50630 [The type used to represent the output sequence as a list of buffers. ] 50631 50632 ] 50633 50634] 50635 50636[heading Member Functions] 50637[table 50638 [[Name][Description]] 50639 50640 [ 50641 [[link boost_asio.reference.basic_streambuf_ref.basic_streambuf_ref [*basic_streambuf_ref]] [constructor]] 50642 [Construct a basic_streambuf_ref for the given basic_streambuf object. 50643 [hr] 50644 Copy construct a basic_streambuf_ref. 50645 [hr] 50646 Move construct a basic_streambuf_ref. ] 50647 ] 50648 50649 [ 50650 [[link boost_asio.reference.basic_streambuf_ref.capacity [*capacity]]] 50651 [Get the current capacity of the dynamic buffer. ] 50652 ] 50653 50654 [ 50655 [[link boost_asio.reference.basic_streambuf_ref.commit [*commit]]] 50656 [Move bytes from the output sequence to the input sequence. ] 50657 ] 50658 50659 [ 50660 [[link boost_asio.reference.basic_streambuf_ref.consume [*consume]]] 50661 [Remove characters from the input sequence. ] 50662 ] 50663 50664 [ 50665 [[link boost_asio.reference.basic_streambuf_ref.data [*data]]] 50666 [Get a list of buffers that represents the input sequence. ] 50667 ] 50668 50669 [ 50670 [[link boost_asio.reference.basic_streambuf_ref.max_size [*max_size]]] 50671 [Get the maximum size of the dynamic buffer. ] 50672 ] 50673 50674 [ 50675 [[link boost_asio.reference.basic_streambuf_ref.prepare [*prepare]]] 50676 [Get a list of buffers that represents the output sequence, with the given size. ] 50677 ] 50678 50679 [ 50680 [[link boost_asio.reference.basic_streambuf_ref.size [*size]]] 50681 [Get the size of the input sequence. ] 50682 ] 50683 50684] 50685 50686[heading Requirements] 50687 50688['Header: ][^boost/asio/basic_streambuf.hpp] 50689 50690['Convenience header: ][^boost/asio.hpp] 50691 50692[section:basic_streambuf_ref basic_streambuf_ref::basic_streambuf_ref] 50693 50694[indexterm2 boost_asio.indexterm.basic_streambuf_ref.basic_streambuf_ref..basic_streambuf_ref..basic_streambuf_ref] 50695Construct a [link boost_asio.reference.basic_streambuf_ref `basic_streambuf_ref`] for the given [link boost_asio.reference.basic_streambuf `basic_streambuf`] object. 50696 50697 50698 explicit ``[link boost_asio.reference.basic_streambuf_ref.basic_streambuf_ref.overload1 basic_streambuf_ref]``( 50699 basic_streambuf< Allocator > & sb); 50700 `` [''''»''' [link boost_asio.reference.basic_streambuf_ref.basic_streambuf_ref.overload1 more...]]`` 50701 50702 50703Copy construct a [link boost_asio.reference.basic_streambuf_ref `basic_streambuf_ref`]. 50704 50705 50706 ``[link boost_asio.reference.basic_streambuf_ref.basic_streambuf_ref.overload2 basic_streambuf_ref]``( 50707 const basic_streambuf_ref & other); 50708 `` [''''»''' [link boost_asio.reference.basic_streambuf_ref.basic_streambuf_ref.overload2 more...]]`` 50709 50710 50711Move construct a [link boost_asio.reference.basic_streambuf_ref `basic_streambuf_ref`]. 50712 50713 50714 ``[link boost_asio.reference.basic_streambuf_ref.basic_streambuf_ref.overload3 basic_streambuf_ref]``( 50715 basic_streambuf_ref && other); 50716 `` [''''»''' [link boost_asio.reference.basic_streambuf_ref.basic_streambuf_ref.overload3 more...]]`` 50717 50718 50719[section:overload1 basic_streambuf_ref::basic_streambuf_ref (1 of 3 overloads)] 50720 50721 50722Construct a [link boost_asio.reference.basic_streambuf_ref `basic_streambuf_ref`] for the given [link boost_asio.reference.basic_streambuf `basic_streambuf`] object. 50723 50724 50725 basic_streambuf_ref( 50726 basic_streambuf< Allocator > & sb); 50727 50728 50729 50730[endsect] 50731 50732 50733 50734[section:overload2 basic_streambuf_ref::basic_streambuf_ref (2 of 3 overloads)] 50735 50736 50737Copy construct a [link boost_asio.reference.basic_streambuf_ref `basic_streambuf_ref`]. 50738 50739 50740 basic_streambuf_ref( 50741 const basic_streambuf_ref & other); 50742 50743 50744 50745[endsect] 50746 50747 50748 50749[section:overload3 basic_streambuf_ref::basic_streambuf_ref (3 of 3 overloads)] 50750 50751 50752Move construct a [link boost_asio.reference.basic_streambuf_ref `basic_streambuf_ref`]. 50753 50754 50755 basic_streambuf_ref( 50756 basic_streambuf_ref && other); 50757 50758 50759 50760[endsect] 50761 50762 50763[endsect] 50764 50765 50766[section:capacity basic_streambuf_ref::capacity] 50767 50768[indexterm2 boost_asio.indexterm.basic_streambuf_ref.capacity..capacity..basic_streambuf_ref] 50769Get the current capacity of the dynamic buffer. 50770 50771 50772 std::size_t capacity() const; 50773 50774 50775 50776[endsect] 50777 50778 50779 50780[section:commit basic_streambuf_ref::commit] 50781 50782[indexterm2 boost_asio.indexterm.basic_streambuf_ref.commit..commit..basic_streambuf_ref] 50783Move bytes from the output sequence to the input sequence. 50784 50785 50786 void commit( 50787 std::size_t n); 50788 50789 50790 50791[endsect] 50792 50793 50794 50795[section:const_buffers_type basic_streambuf_ref::const_buffers_type] 50796 50797[indexterm2 boost_asio.indexterm.basic_streambuf_ref.const_buffers_type..const_buffers_type..basic_streambuf_ref] 50798The type used to represent the input sequence as a list of buffers. 50799 50800 50801 typedef basic_streambuf< Allocator >::const_buffers_type const_buffers_type; 50802 50803 50804[heading Types] 50805[table 50806 [[Name][Description]] 50807 50808 [ 50809 50810 [[link boost_asio.reference.basic_streambuf.const_buffers_type [*const_buffers_type]]] 50811 [The type used to represent the input sequence as a list of buffers. ] 50812 50813 ] 50814 50815 [ 50816 50817 [[link boost_asio.reference.basic_streambuf.mutable_buffers_type [*mutable_buffers_type]]] 50818 [The type used to represent the output sequence as a list of buffers. ] 50819 50820 ] 50821 50822] 50823 50824[heading Member Functions] 50825[table 50826 [[Name][Description]] 50827 50828 [ 50829 [[link boost_asio.reference.basic_streambuf.basic_streambuf [*basic_streambuf]] [constructor]] 50830 [Construct a basic_streambuf object. ] 50831 ] 50832 50833 [ 50834 [[link boost_asio.reference.basic_streambuf.capacity [*capacity]]] 50835 [Get the current capacity of the basic_streambuf. ] 50836 ] 50837 50838 [ 50839 [[link boost_asio.reference.basic_streambuf.commit [*commit]]] 50840 [Move characters from the output sequence to the input sequence. ] 50841 ] 50842 50843 [ 50844 [[link boost_asio.reference.basic_streambuf.consume [*consume]]] 50845 [Remove characters from the input sequence. ] 50846 ] 50847 50848 [ 50849 [[link boost_asio.reference.basic_streambuf.data [*data]]] 50850 [Get a list of buffers that represents the input sequence. ] 50851 ] 50852 50853 [ 50854 [[link boost_asio.reference.basic_streambuf.max_size [*max_size]]] 50855 [Get the maximum size of the basic_streambuf. ] 50856 ] 50857 50858 [ 50859 [[link boost_asio.reference.basic_streambuf.prepare [*prepare]]] 50860 [Get a list of buffers that represents the output sequence, with the given size. ] 50861 ] 50862 50863 [ 50864 [[link boost_asio.reference.basic_streambuf.size [*size]]] 50865 [Get the size of the input sequence. ] 50866 ] 50867 50868] 50869 50870[heading Protected Member Functions] 50871[table 50872 [[Name][Description]] 50873 50874 [ 50875 [[link boost_asio.reference.basic_streambuf.overflow [*overflow]]] 50876 [Override std::streambuf behaviour. ] 50877 ] 50878 50879 [ 50880 [[link boost_asio.reference.basic_streambuf.reserve [*reserve]]] 50881 [] 50882 ] 50883 50884 [ 50885 [[link boost_asio.reference.basic_streambuf.underflow [*underflow]]] 50886 [Override std::streambuf behaviour. ] 50887 ] 50888 50889] 50890 50891The `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. 50892 50893The `basic_streambuf` class's public interface is intended to permit the following implementation strategies: 50894 50895 50896* 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. 50897 50898 50899* 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. 50900 50901 50902* 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. 50903 50904The 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: 50905 50906 size() <= max_size() 50907 50908 50909Any member function that would, if successful, cause the invariant to be violated shall throw an exception of class `std::length_error`. 50910 50911The 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. 50912 50913 50914[heading Examples] 50915 50916Writing directly from an streambuf to a socket: 50917 50918 boost::asio::streambuf b; 50919 std::ostream os(&b); 50920 os << "Hello, World!\n"; 50921 50922 // try sending some data in input sequence 50923 size_t n = sock.send(b.data()); 50924 50925 b.consume(n); // sent data is removed from input sequence 50926 50927 50928 50929 50930Reading from a socket directly into a streambuf: 50931 50932 boost::asio::streambuf b; 50933 50934 // reserve 512 bytes in output sequence 50935 boost::asio::streambuf::mutable_buffers_type bufs = b.prepare(512); 50936 50937 size_t n = sock.receive(bufs); 50938 50939 // received data is "committed" from output sequence to input sequence 50940 b.commit(n); 50941 50942 std::istream is(&b); 50943 std::string s; 50944 is >> s; 50945 50946 50947 50948 50949 50950[heading Requirements] 50951 50952['Header: ][^boost/asio/basic_streambuf.hpp] 50953 50954['Convenience header: ][^boost/asio.hpp] 50955 50956 50957[endsect] 50958 50959 50960 50961[section:consume basic_streambuf_ref::consume] 50962 50963[indexterm2 boost_asio.indexterm.basic_streambuf_ref.consume..consume..basic_streambuf_ref] 50964Remove characters from the input sequence. 50965 50966 50967 void consume( 50968 std::size_t n); 50969 50970 50971 50972[endsect] 50973 50974 50975 50976[section:data basic_streambuf_ref::data] 50977 50978[indexterm2 boost_asio.indexterm.basic_streambuf_ref.data..data..basic_streambuf_ref] 50979Get a list of buffers that represents the input sequence. 50980 50981 50982 const_buffers_type data() const; 50983 50984 50985 50986[endsect] 50987 50988 50989 50990[section:max_size basic_streambuf_ref::max_size] 50991 50992[indexterm2 boost_asio.indexterm.basic_streambuf_ref.max_size..max_size..basic_streambuf_ref] 50993Get the maximum size of the dynamic buffer. 50994 50995 50996 std::size_t max_size() const; 50997 50998 50999 51000[endsect] 51001 51002 51003 51004[section:mutable_buffers_type basic_streambuf_ref::mutable_buffers_type] 51005 51006[indexterm2 boost_asio.indexterm.basic_streambuf_ref.mutable_buffers_type..mutable_buffers_type..basic_streambuf_ref] 51007The type used to represent the output sequence as a list of buffers. 51008 51009 51010 typedef basic_streambuf< Allocator >::mutable_buffers_type mutable_buffers_type; 51011 51012 51013[heading Types] 51014[table 51015 [[Name][Description]] 51016 51017 [ 51018 51019 [[link boost_asio.reference.basic_streambuf.const_buffers_type [*const_buffers_type]]] 51020 [The type used to represent the input sequence as a list of buffers. ] 51021 51022 ] 51023 51024 [ 51025 51026 [[link boost_asio.reference.basic_streambuf.mutable_buffers_type [*mutable_buffers_type]]] 51027 [The type used to represent the output sequence as a list of buffers. ] 51028 51029 ] 51030 51031] 51032 51033[heading Member Functions] 51034[table 51035 [[Name][Description]] 51036 51037 [ 51038 [[link boost_asio.reference.basic_streambuf.basic_streambuf [*basic_streambuf]] [constructor]] 51039 [Construct a basic_streambuf object. ] 51040 ] 51041 51042 [ 51043 [[link boost_asio.reference.basic_streambuf.capacity [*capacity]]] 51044 [Get the current capacity of the basic_streambuf. ] 51045 ] 51046 51047 [ 51048 [[link boost_asio.reference.basic_streambuf.commit [*commit]]] 51049 [Move characters from the output sequence to the input sequence. ] 51050 ] 51051 51052 [ 51053 [[link boost_asio.reference.basic_streambuf.consume [*consume]]] 51054 [Remove characters from the input sequence. ] 51055 ] 51056 51057 [ 51058 [[link boost_asio.reference.basic_streambuf.data [*data]]] 51059 [Get a list of buffers that represents the input sequence. ] 51060 ] 51061 51062 [ 51063 [[link boost_asio.reference.basic_streambuf.max_size [*max_size]]] 51064 [Get the maximum size of the basic_streambuf. ] 51065 ] 51066 51067 [ 51068 [[link boost_asio.reference.basic_streambuf.prepare [*prepare]]] 51069 [Get a list of buffers that represents the output sequence, with the given size. ] 51070 ] 51071 51072 [ 51073 [[link boost_asio.reference.basic_streambuf.size [*size]]] 51074 [Get the size of the input sequence. ] 51075 ] 51076 51077] 51078 51079[heading Protected Member Functions] 51080[table 51081 [[Name][Description]] 51082 51083 [ 51084 [[link boost_asio.reference.basic_streambuf.overflow [*overflow]]] 51085 [Override std::streambuf behaviour. ] 51086 ] 51087 51088 [ 51089 [[link boost_asio.reference.basic_streambuf.reserve [*reserve]]] 51090 [] 51091 ] 51092 51093 [ 51094 [[link boost_asio.reference.basic_streambuf.underflow [*underflow]]] 51095 [Override std::streambuf behaviour. ] 51096 ] 51097 51098] 51099 51100The `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. 51101 51102The `basic_streambuf` class's public interface is intended to permit the following implementation strategies: 51103 51104 51105* 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. 51106 51107 51108* 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. 51109 51110 51111* 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. 51112 51113The 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: 51114 51115 size() <= max_size() 51116 51117 51118Any member function that would, if successful, cause the invariant to be violated shall throw an exception of class `std::length_error`. 51119 51120The 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. 51121 51122 51123[heading Examples] 51124 51125Writing directly from an streambuf to a socket: 51126 51127 boost::asio::streambuf b; 51128 std::ostream os(&b); 51129 os << "Hello, World!\n"; 51130 51131 // try sending some data in input sequence 51132 size_t n = sock.send(b.data()); 51133 51134 b.consume(n); // sent data is removed from input sequence 51135 51136 51137 51138 51139Reading from a socket directly into a streambuf: 51140 51141 boost::asio::streambuf b; 51142 51143 // reserve 512 bytes in output sequence 51144 boost::asio::streambuf::mutable_buffers_type bufs = b.prepare(512); 51145 51146 size_t n = sock.receive(bufs); 51147 51148 // received data is "committed" from output sequence to input sequence 51149 b.commit(n); 51150 51151 std::istream is(&b); 51152 std::string s; 51153 is >> s; 51154 51155 51156 51157 51158 51159[heading Requirements] 51160 51161['Header: ][^boost/asio/basic_streambuf.hpp] 51162 51163['Convenience header: ][^boost/asio.hpp] 51164 51165 51166[endsect] 51167 51168 51169 51170[section:prepare basic_streambuf_ref::prepare] 51171 51172[indexterm2 boost_asio.indexterm.basic_streambuf_ref.prepare..prepare..basic_streambuf_ref] 51173Get a list of buffers that represents the output sequence, with the given size. 51174 51175 51176 mutable_buffers_type prepare( 51177 std::size_t n); 51178 51179 51180 51181[endsect] 51182 51183 51184 51185[section:size basic_streambuf_ref::size] 51186 51187[indexterm2 boost_asio.indexterm.basic_streambuf_ref.size..size..basic_streambuf_ref] 51188Get the size of the input sequence. 51189 51190 51191 std::size_t size() const; 51192 51193 51194 51195[endsect] 51196 51197 51198 51199[endsect] 51200 51201[section:basic_system_executor basic_system_executor] 51202 51203[indexterm1 boost_asio.indexterm.basic_system_executor..basic_system_executor] 51204 51205 51206An executor that uses arbitrary threads. 51207 51208 51209 template< 51210 typename Blocking, 51211 typename Relationship, 51212 typename Allocator> 51213 class basic_system_executor 51214 51215 51216[heading Member Functions] 51217[table 51218 [[Name][Description]] 51219 51220 [ 51221 [[link boost_asio.reference.basic_system_executor.basic_system_executor [*basic_system_executor]] [constructor]] 51222 [Default constructor. ] 51223 ] 51224 51225 [ 51226 [[link boost_asio.reference.basic_system_executor.context [*context]]] 51227 [Obtain the underlying execution context. ] 51228 ] 51229 51230 [ 51231 [[link boost_asio.reference.basic_system_executor.defer [*defer]]] 51232 [Request the system executor to invoke the given function object. ] 51233 ] 51234 51235 [ 51236 [[link boost_asio.reference.basic_system_executor.dispatch [*dispatch]]] 51237 [Request the system executor to invoke the given function object. ] 51238 ] 51239 51240 [ 51241 [[link boost_asio.reference.basic_system_executor.execute [*execute]]] 51242 [Execution function. ] 51243 ] 51244 51245 [ 51246 [[link boost_asio.reference.basic_system_executor.on_work_finished [*on_work_finished]]] 51247 [Inform the executor that some work is no longer outstanding. ] 51248 ] 51249 51250 [ 51251 [[link boost_asio.reference.basic_system_executor.on_work_started [*on_work_started]]] 51252 [Inform the executor that it has some outstanding work to do. ] 51253 ] 51254 51255 [ 51256 [[link boost_asio.reference.basic_system_executor.post [*post]]] 51257 [Request the system executor to invoke the given function object. ] 51258 ] 51259 51260 [ 51261 [[link boost_asio.reference.basic_system_executor.query [*query]]] 51262 [Query the current value of the allocator property. 51263 [hr] 51264 Query the occupancy (recommended number of work items) for the system context. ] 51265 ] 51266 51267 [ 51268 [[link boost_asio.reference.basic_system_executor.query__static [*query]] [static]] 51269 [Query the current value of the mapping property. 51270 [hr] 51271 Query the current value of the context property. 51272 [hr] 51273 Query the current value of the blocking property. 51274 [hr] 51275 Query the current value of the relationship property. ] 51276 ] 51277 51278 [ 51279 [[link boost_asio.reference.basic_system_executor.require [*require]]] 51280 [Obtain an executor with the blocking.possibly property. 51281 [hr] 51282 Obtain an executor with the blocking.always property. 51283 [hr] 51284 Obtain an executor with the blocking.never property. 51285 [hr] 51286 Obtain an executor with the relationship.continuation property. 51287 [hr] 51288 Obtain an executor with the relationship.fork property. 51289 [hr] 51290 Obtain an executor with the specified allocator property. 51291 [hr] 51292 Obtain an executor with the default allocator property. ] 51293 ] 51294 51295] 51296 51297[heading Friends] 51298[table 51299 [[Name][Description]] 51300 51301 [ 51302 [[link boost_asio.reference.basic_system_executor.operator_not__eq_ [*operator!=]]] 51303 [Compare two executors for inequality. ] 51304 ] 51305 51306 [ 51307 [[link boost_asio.reference.basic_system_executor.operator_eq__eq_ [*operator==]]] 51308 [Compare two executors for equality. ] 51309 ] 51310 51311] 51312 51313The system executor represents an execution context where functions are permitted to run on arbitrary threads. When the blocking.never property is established, the system executor will schedule the function to run on an unspecified system thread pool. When either blocking.possibly or blocking.always is established, the executor invokes the function immediately. 51314 51315[heading Requirements] 51316 51317['Header: ][^boost/asio/system_executor.hpp] 51318 51319['Convenience header: ][^boost/asio.hpp] 51320 51321 51322[section:basic_system_executor basic_system_executor::basic_system_executor] 51323 51324[indexterm2 boost_asio.indexterm.basic_system_executor.basic_system_executor..basic_system_executor..basic_system_executor] 51325Default constructor. 51326 51327 51328 basic_system_executor(); 51329 51330 51331 51332[endsect] 51333 51334 51335 51336[section:context basic_system_executor::context] 51337 51338[indexterm2 boost_asio.indexterm.basic_system_executor.context..context..basic_system_executor] 51339Obtain the underlying execution context. 51340 51341 51342 system_context & context() const; 51343 51344 51345 51346[endsect] 51347 51348 51349 51350[section:defer basic_system_executor::defer] 51351 51352[indexterm2 boost_asio.indexterm.basic_system_executor.defer..defer..basic_system_executor] 51353Request the system executor to invoke the given function object. 51354 51355 51356 template< 51357 typename Function, 51358 typename OtherAllocator> 51359 void defer( 51360 Function && f, 51361 const OtherAllocator & a) const; 51362 51363 51364This 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. 51365 51366 51367[heading Parameters] 51368 51369 51370[variablelist 51371 51372[[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: 51373`` 51374 void function(); 51375`` 51376]] 51377 51378[[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]] 51379 51380] 51381 51382 51383 51384 51385[endsect] 51386 51387 51388 51389[section:dispatch basic_system_executor::dispatch] 51390 51391[indexterm2 boost_asio.indexterm.basic_system_executor.dispatch..dispatch..basic_system_executor] 51392Request the system executor to invoke the given function object. 51393 51394 51395 template< 51396 typename Function, 51397 typename OtherAllocator> 51398 void dispatch( 51399 Function && f, 51400 const OtherAllocator & a) const; 51401 51402 51403This function is used to ask the executor to execute the given function object. The function object will always be executed inside this function. 51404 51405 51406[heading Parameters] 51407 51408 51409[variablelist 51410 51411[[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: 51412`` 51413 void function(); 51414`` 51415]] 51416 51417[[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]] 51418 51419] 51420 51421 51422 51423 51424[endsect] 51425 51426 51427 51428[section:execute basic_system_executor::execute] 51429 51430[indexterm2 boost_asio.indexterm.basic_system_executor.execute..execute..basic_system_executor] 51431Execution function. 51432 51433 51434 template< 51435 typename Function> 51436 void execute( 51437 Function && f) const; 51438 51439 51440Do not call this function directly. It is intended for use with the [link boost_asio.reference.execution__execute `execution::execute`] customisation point. 51441 51442For example: 51443 51444 boost::asio::system_executor ex; 51445 execution::execute(ex, my_function_object); 51446 51447 51448 51449 51450 51451[endsect] 51452 51453 51454 51455[section:on_work_finished basic_system_executor::on_work_finished] 51456 51457[indexterm2 boost_asio.indexterm.basic_system_executor.on_work_finished..on_work_finished..basic_system_executor] 51458Inform the executor that some work is no longer outstanding. 51459 51460 51461 void on_work_finished() const; 51462 51463 51464For the system executor, this is a no-op. 51465 51466 51467[endsect] 51468 51469 51470 51471[section:on_work_started basic_system_executor::on_work_started] 51472 51473[indexterm2 boost_asio.indexterm.basic_system_executor.on_work_started..on_work_started..basic_system_executor] 51474Inform the executor that it has some outstanding work to do. 51475 51476 51477 void on_work_started() const; 51478 51479 51480For the system executor, this is a no-op. 51481 51482 51483[endsect] 51484 51485 51486 51487[section:operator_not__eq_ basic_system_executor::operator!=] 51488 51489[indexterm2 boost_asio.indexterm.basic_system_executor.operator_not__eq_..operator!=..basic_system_executor] 51490Compare two executors for inequality. 51491 51492 51493 friend bool operator!=( 51494 const basic_system_executor & , 51495 const basic_system_executor & ); 51496 51497 51498Two executors are equal if they refer to the same underlying [link boost_asio.reference.io_context `io_context`]. 51499 51500[heading Requirements] 51501 51502['Header: ][^boost/asio/system_executor.hpp] 51503 51504['Convenience header: ][^boost/asio.hpp] 51505 51506 51507[endsect] 51508 51509 51510 51511[section:operator_eq__eq_ basic_system_executor::operator==] 51512 51513[indexterm2 boost_asio.indexterm.basic_system_executor.operator_eq__eq_..operator==..basic_system_executor] 51514Compare two executors for equality. 51515 51516 51517 friend bool operator==( 51518 const basic_system_executor & , 51519 const basic_system_executor & ); 51520 51521 51522Two executors are equal if they refer to the same underlying [link boost_asio.reference.io_context `io_context`]. 51523 51524[heading Requirements] 51525 51526['Header: ][^boost/asio/system_executor.hpp] 51527 51528['Convenience header: ][^boost/asio.hpp] 51529 51530 51531[endsect] 51532 51533 51534 51535[section:post basic_system_executor::post] 51536 51537[indexterm2 boost_asio.indexterm.basic_system_executor.post..post..basic_system_executor] 51538Request the system executor to invoke the given function object. 51539 51540 51541 template< 51542 typename Function, 51543 typename OtherAllocator> 51544 void post( 51545 Function && f, 51546 const OtherAllocator & a) const; 51547 51548 51549This 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. 51550 51551 51552[heading Parameters] 51553 51554 51555[variablelist 51556 51557[[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: 51558`` 51559 void function(); 51560`` 51561]] 51562 51563[[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]] 51564 51565] 51566 51567 51568 51569 51570[endsect] 51571 51572 51573[section:query basic_system_executor::query] 51574 51575[indexterm2 boost_asio.indexterm.basic_system_executor.query..query..basic_system_executor] 51576Query the current value of the `allocator` property. 51577 51578 51579 template< 51580 typename OtherAllocator> 51581 constexpr Allocator ``[link boost_asio.reference.basic_system_executor.query.overload1 query]``( 51582 execution::allocator_t< OtherAllocator > ) const; 51583 `` [''''»''' [link boost_asio.reference.basic_system_executor.query.overload1 more...]]`` 51584 51585 constexpr Allocator ``[link boost_asio.reference.basic_system_executor.query.overload2 query]``( 51586 execution::allocator_t< void > ) const; 51587 `` [''''»''' [link boost_asio.reference.basic_system_executor.query.overload2 more...]]`` 51588 51589 51590Query the occupancy (recommended number of work items) for the system context. 51591 51592 51593 std::size_t ``[link boost_asio.reference.basic_system_executor.query.overload3 query]``( 51594 execution::occupancy_t ) const; 51595 `` [''''»''' [link boost_asio.reference.basic_system_executor.query.overload3 more...]]`` 51596 51597 51598[section:overload1 basic_system_executor::query (1 of 3 overloads)] 51599 51600 51601Query the current value of the `allocator` property. 51602 51603 51604 template< 51605 typename OtherAllocator> 51606 constexpr Allocator query( 51607 execution::allocator_t< OtherAllocator > ) const; 51608 51609 51610Do not call this function directly. It is intended for use with the [link boost_asio.reference.query `query`] customisation point. 51611 51612For example: 51613 51614 boost::asio::system_executor ex; 51615 auto alloc = boost::asio::query(ex, 51616 boost::asio::execution::allocator); 51617 51618 51619 51620 51621 51622[endsect] 51623 51624 51625 51626[section:overload2 basic_system_executor::query (2 of 3 overloads)] 51627 51628 51629Query the current value of the `allocator` property. 51630 51631 51632 constexpr Allocator query( 51633 execution::allocator_t< void > ) const; 51634 51635 51636Do not call this function directly. It is intended for use with the [link boost_asio.reference.query `query`] customisation point. 51637 51638For example: 51639 51640 boost::asio::system_executor ex; 51641 auto alloc = boost::asio::query(ex, 51642 boost::asio::execution::allocator); 51643 51644 51645 51646 51647 51648[endsect] 51649 51650 51651 51652[section:overload3 basic_system_executor::query (3 of 3 overloads)] 51653 51654 51655Query the occupancy (recommended number of work items) for the system context. 51656 51657 51658 std::size_t query( 51659 execution::occupancy_t ) const; 51660 51661 51662Do not call this function directly. It is intended for use with the [link boost_asio.reference.query `query`] customisation point. 51663 51664For example: 51665 51666 boost::asio::system_executor ex; 51667 std::size_t occupancy = boost::asio::query( 51668 ex, boost::asio::execution::occupancy); 51669 51670 51671 51672 51673 51674[endsect] 51675 51676 51677[endsect] 51678 51679[section:query__static basic_system_executor::query] 51680 51681[indexterm2 boost_asio.indexterm.basic_system_executor.query__static..query..basic_system_executor] 51682Query the current value of the `mapping` property. 51683 51684 51685 static constexpr execution::mapping_t ``[link boost_asio.reference.basic_system_executor.query__static.overload1 query]``( 51686 execution::mapping_t ); 51687 `` [''''»''' [link boost_asio.reference.basic_system_executor.query__static.overload1 more...]]`` 51688 51689 51690Query the current value of the `context` property. 51691 51692 51693 static system_context & ``[link boost_asio.reference.basic_system_executor.query__static.overload2 query]``( 51694 execution::context_t ); 51695 `` [''''»''' [link boost_asio.reference.basic_system_executor.query__static.overload2 more...]]`` 51696 51697 51698Query the current value of the `blocking` property. 51699 51700 51701 static constexpr execution::blocking_t ``[link boost_asio.reference.basic_system_executor.query__static.overload3 query]``( 51702 execution::blocking_t ); 51703 `` [''''»''' [link boost_asio.reference.basic_system_executor.query__static.overload3 more...]]`` 51704 51705 51706Query the current value of the `relationship` property. 51707 51708 51709 static constexpr execution::relationship_t ``[link boost_asio.reference.basic_system_executor.query__static.overload4 query]``( 51710 execution::relationship_t ); 51711 `` [''''»''' [link boost_asio.reference.basic_system_executor.query__static.overload4 more...]]`` 51712 51713 51714[section:overload1 basic_system_executor::query (1 of 4 overloads)] 51715 51716 51717Query the current value of the `mapping` property. 51718 51719 51720 static constexpr execution::mapping_t query( 51721 execution::mapping_t ); 51722 51723 51724Do not call this function directly. It is intended for use with the [link boost_asio.reference.query `query`] customisation point. 51725 51726For example: 51727 51728 boost::asio::system_executor ex; 51729 if (boost::asio::query(ex, boost::asio::execution::mapping) 51730 == boost::asio::execution::mapping.thread) 51731 ... 51732 51733 51734 51735 51736 51737[endsect] 51738 51739 51740 51741[section:overload2 basic_system_executor::query (2 of 4 overloads)] 51742 51743 51744Query the current value of the `context` property. 51745 51746 51747 static system_context & query( 51748 execution::context_t ); 51749 51750 51751Do not call this function directly. It is intended for use with the [link boost_asio.reference.query `query`] customisation point. 51752 51753For example: 51754 51755 boost::asio::system_executor ex; 51756 boost::asio::system_context& pool = boost::asio::query( 51757 ex, boost::asio::execution::context); 51758 51759 51760 51761 51762 51763[endsect] 51764 51765 51766 51767[section:overload3 basic_system_executor::query (3 of 4 overloads)] 51768 51769 51770Query the current value of the `blocking` property. 51771 51772 51773 static constexpr execution::blocking_t query( 51774 execution::blocking_t ); 51775 51776 51777Do not call this function directly. It is intended for use with the [link boost_asio.reference.query `query`] customisation point. 51778 51779For example: 51780 51781 boost::asio::system_executor ex; 51782 if (boost::asio::query(ex, boost::asio::execution::blocking) 51783 == boost::asio::execution::blocking.always) 51784 ... 51785 51786 51787 51788 51789 51790[endsect] 51791 51792 51793 51794[section:overload4 basic_system_executor::query (4 of 4 overloads)] 51795 51796 51797Query the current value of the `relationship` property. 51798 51799 51800 static constexpr execution::relationship_t query( 51801 execution::relationship_t ); 51802 51803 51804Do not call this function directly. It is intended for use with the [link boost_asio.reference.query `query`] customisation point. 51805 51806For example: 51807 51808 boost::asio::system_executor ex; 51809 if (boost::asio::query(ex, boost::asio::execution::relationship) 51810 == boost::asio::execution::relationship.continuation) 51811 ... 51812 51813 51814 51815 51816 51817[endsect] 51818 51819 51820[endsect] 51821 51822[section:require basic_system_executor::require] 51823 51824[indexterm2 boost_asio.indexterm.basic_system_executor.require..require..basic_system_executor] 51825Obtain an executor with the `blocking.possibly` property. 51826 51827 51828 basic_system_executor< execution::blocking_t::possibly_t, Relationship, Allocator > ``[link boost_asio.reference.basic_system_executor.require.overload1 require]``( 51829 execution::blocking_t::possibly_t ) const; 51830 `` [''''»''' [link boost_asio.reference.basic_system_executor.require.overload1 more...]]`` 51831 51832 51833Obtain an executor with the `blocking.always` property. 51834 51835 51836 basic_system_executor< execution::blocking_t::always_t, Relationship, Allocator > ``[link boost_asio.reference.basic_system_executor.require.overload2 require]``( 51837 execution::blocking_t::always_t ) const; 51838 `` [''''»''' [link boost_asio.reference.basic_system_executor.require.overload2 more...]]`` 51839 51840 51841Obtain an executor with the `blocking.never` property. 51842 51843 51844 basic_system_executor< execution::blocking_t::never_t, Relationship, Allocator > ``[link boost_asio.reference.basic_system_executor.require.overload3 require]``( 51845 execution::blocking_t::never_t ) const; 51846 `` [''''»''' [link boost_asio.reference.basic_system_executor.require.overload3 more...]]`` 51847 51848 51849Obtain an executor with the `relationship.continuation` property. 51850 51851 51852 basic_system_executor< Blocking, execution::relationship_t::continuation_t, Allocator > ``[link boost_asio.reference.basic_system_executor.require.overload4 require]``( 51853 execution::relationship_t::continuation_t ) const; 51854 `` [''''»''' [link boost_asio.reference.basic_system_executor.require.overload4 more...]]`` 51855 51856 51857Obtain an executor with the `relationship.fork` property. 51858 51859 51860 basic_system_executor< Blocking, execution::relationship_t::fork_t, Allocator > ``[link boost_asio.reference.basic_system_executor.require.overload5 require]``( 51861 execution::relationship_t::fork_t ) const; 51862 `` [''''»''' [link boost_asio.reference.basic_system_executor.require.overload5 more...]]`` 51863 51864 51865Obtain an executor with the specified `allocator` property. 51866 51867 51868 template< 51869 typename OtherAllocator> 51870 basic_system_executor< Blocking, Relationship, OtherAllocator > ``[link boost_asio.reference.basic_system_executor.require.overload6 require]``( 51871 execution::allocator_t< OtherAllocator > a) const; 51872 `` [''''»''' [link boost_asio.reference.basic_system_executor.require.overload6 more...]]`` 51873 51874 51875Obtain an executor with the default `allocator` property. 51876 51877 51878 basic_system_executor< Blocking, Relationship, std::allocator< void > > ``[link boost_asio.reference.basic_system_executor.require.overload7 require]``( 51879 execution::allocator_t< void > ) const; 51880 `` [''''»''' [link boost_asio.reference.basic_system_executor.require.overload7 more...]]`` 51881 51882 51883[section:overload1 basic_system_executor::require (1 of 7 overloads)] 51884 51885 51886Obtain an executor with the `blocking.possibly` property. 51887 51888 51889 basic_system_executor< execution::blocking_t::possibly_t, Relationship, Allocator > require( 51890 execution::blocking_t::possibly_t ) const; 51891 51892 51893Do not call this function directly. It is intended for use with the [link boost_asio.reference.require `require`] customisation point. 51894 51895For example: 51896 51897 boost::asio::system_executor ex1; 51898 auto ex2 = boost::asio::require(ex1, 51899 boost::asio::execution::blocking.possibly); 51900 51901 51902 51903 51904 51905[endsect] 51906 51907 51908 51909[section:overload2 basic_system_executor::require (2 of 7 overloads)] 51910 51911 51912Obtain an executor with the `blocking.always` property. 51913 51914 51915 basic_system_executor< execution::blocking_t::always_t, Relationship, Allocator > require( 51916 execution::blocking_t::always_t ) const; 51917 51918 51919Do not call this function directly. It is intended for use with the [link boost_asio.reference.require `require`] customisation point. 51920 51921For example: 51922 51923 boost::asio::system_executor ex1; 51924 auto ex2 = boost::asio::require(ex1, 51925 boost::asio::execution::blocking.always); 51926 51927 51928 51929 51930 51931[endsect] 51932 51933 51934 51935[section:overload3 basic_system_executor::require (3 of 7 overloads)] 51936 51937 51938Obtain an executor with the `blocking.never` property. 51939 51940 51941 basic_system_executor< execution::blocking_t::never_t, Relationship, Allocator > require( 51942 execution::blocking_t::never_t ) const; 51943 51944 51945Do not call this function directly. It is intended for use with the [link boost_asio.reference.require `require`] customisation point. 51946 51947For example: 51948 51949 boost::asio::system_executor ex1; 51950 auto ex2 = boost::asio::require(ex1, 51951 boost::asio::execution::blocking.never); 51952 51953 51954 51955 51956 51957[endsect] 51958 51959 51960 51961[section:overload4 basic_system_executor::require (4 of 7 overloads)] 51962 51963 51964Obtain an executor with the `relationship.continuation` property. 51965 51966 51967 basic_system_executor< Blocking, execution::relationship_t::continuation_t, Allocator > require( 51968 execution::relationship_t::continuation_t ) const; 51969 51970 51971Do not call this function directly. It is intended for use with the [link boost_asio.reference.require `require`] customisation point. 51972 51973For example: 51974 51975 boost::asio::system_executor ex1; 51976 auto ex2 = boost::asio::require(ex1, 51977 boost::asio::execution::relationship.continuation); 51978 51979 51980 51981 51982 51983[endsect] 51984 51985 51986 51987[section:overload5 basic_system_executor::require (5 of 7 overloads)] 51988 51989 51990Obtain an executor with the `relationship.fork` property. 51991 51992 51993 basic_system_executor< Blocking, execution::relationship_t::fork_t, Allocator > require( 51994 execution::relationship_t::fork_t ) const; 51995 51996 51997Do not call this function directly. It is intended for use with the [link boost_asio.reference.require `require`] customisation point. 51998 51999For example: 52000 52001 boost::asio::system_executor ex1; 52002 auto ex2 = boost::asio::require(ex1, 52003 boost::asio::execution::relationship.fork); 52004 52005 52006 52007 52008 52009[endsect] 52010 52011 52012 52013[section:overload6 basic_system_executor::require (6 of 7 overloads)] 52014 52015 52016Obtain an executor with the specified `allocator` property. 52017 52018 52019 template< 52020 typename OtherAllocator> 52021 basic_system_executor< Blocking, Relationship, OtherAllocator > require( 52022 execution::allocator_t< OtherAllocator > a) const; 52023 52024 52025Do not call this function directly. It is intended for use with the [link boost_asio.reference.require `require`] customisation point. 52026 52027For example: 52028 52029 boost::asio::system_executor ex1; 52030 auto ex2 = boost::asio::require(ex1, 52031 boost::asio::execution::allocator(my_allocator)); 52032 52033 52034 52035 52036 52037[endsect] 52038 52039 52040 52041[section:overload7 basic_system_executor::require (7 of 7 overloads)] 52042 52043 52044Obtain an executor with the default `allocator` property. 52045 52046 52047 basic_system_executor< Blocking, Relationship, std::allocator< void > > require( 52048 execution::allocator_t< void > ) const; 52049 52050 52051Do not call this function directly. It is intended for use with the [link boost_asio.reference.require `require`] customisation point. 52052 52053For example: 52054 52055 boost::asio::system_executor ex1; 52056 auto ex2 = boost::asio::require(ex1, 52057 boost::asio::execution::allocator); 52058 52059 52060 52061 52062 52063[endsect] 52064 52065 52066[endsect] 52067 52068 52069[endsect] 52070 52071[section:basic_waitable_timer basic_waitable_timer] 52072 52073[indexterm1 boost_asio.indexterm.basic_waitable_timer..basic_waitable_timer] 52074 52075 52076Provides waitable timer functionality. 52077 52078 52079 template< 52080 typename Clock, 52081 typename ``[link boost_asio.reference.WaitTraits WaitTraits]``, 52082 typename ``[link boost_asio.reference.Executor1 Executor]``> 52083 class basic_waitable_timer 52084 52085 52086[heading Types] 52087[table 52088 [[Name][Description]] 52089 52090 [ 52091 52092 [[link boost_asio.reference.basic_waitable_timer__rebind_executor [*rebind_executor]]] 52093 [Rebinds the timer type to another executor. ] 52094 52095 ] 52096 52097 [ 52098 52099 [[link boost_asio.reference.basic_waitable_timer.clock_type [*clock_type]]] 52100 [The clock type. ] 52101 52102 ] 52103 52104 [ 52105 52106 [[link boost_asio.reference.basic_waitable_timer.duration [*duration]]] 52107 [The duration type of the clock. ] 52108 52109 ] 52110 52111 [ 52112 52113 [[link boost_asio.reference.basic_waitable_timer.executor_type [*executor_type]]] 52114 [The type of the executor associated with the object. ] 52115 52116 ] 52117 52118 [ 52119 52120 [[link boost_asio.reference.basic_waitable_timer.time_point [*time_point]]] 52121 [The time point type of the clock. ] 52122 52123 ] 52124 52125 [ 52126 52127 [[link boost_asio.reference.basic_waitable_timer.traits_type [*traits_type]]] 52128 [The wait traits type. ] 52129 52130 ] 52131 52132] 52133 52134[heading Member Functions] 52135[table 52136 [[Name][Description]] 52137 52138 [ 52139 [[link boost_asio.reference.basic_waitable_timer.async_wait [*async_wait]]] 52140 [Start an asynchronous wait on the timer. ] 52141 ] 52142 52143 [ 52144 [[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer [*basic_waitable_timer]] [constructor]] 52145 [Constructor. 52146 [hr] 52147 Constructor to set a particular expiry time as an absolute time. 52148 [hr] 52149 Constructor to set a particular expiry time relative to now. 52150 [hr] 52151 Move-construct a basic_waitable_timer from another. ] 52152 ] 52153 52154 [ 52155 [[link boost_asio.reference.basic_waitable_timer.cancel [*cancel]]] 52156 [Cancel any asynchronous operations that are waiting on the timer. 52157 [hr] 52158 (Deprecated: Use non-error_code overload.) Cancel any asynchronous operations that are waiting on the timer. ] 52159 ] 52160 52161 [ 52162 [[link boost_asio.reference.basic_waitable_timer.cancel_one [*cancel_one]]] 52163 [Cancels one asynchronous operation that is waiting on the timer. 52164 [hr] 52165 (Deprecated: Use non-error_code overload.) Cancels one asynchronous operation that is waiting on the timer. ] 52166 ] 52167 52168 [ 52169 [[link boost_asio.reference.basic_waitable_timer.expires_after [*expires_after]]] 52170 [Set the timer's expiry time relative to now. ] 52171 ] 52172 52173 [ 52174 [[link boost_asio.reference.basic_waitable_timer.expires_at [*expires_at]]] 52175 [(Deprecated: Use expiry().) Get the timer's expiry time as an absolute time. 52176 [hr] 52177 Set the timer's expiry time as an absolute time. 52178 [hr] 52179 (Deprecated: Use non-error_code overload.) Set the timer's expiry time as an absolute time. ] 52180 ] 52181 52182 [ 52183 [[link boost_asio.reference.basic_waitable_timer.expires_from_now [*expires_from_now]]] 52184 [(Deprecated: Use expiry().) Get the timer's expiry time relative to now. 52185 [hr] 52186 (Deprecated: Use expires_after().) Set the timer's expiry time relative to now. ] 52187 ] 52188 52189 [ 52190 [[link boost_asio.reference.basic_waitable_timer.expiry [*expiry]]] 52191 [Get the timer's expiry time as an absolute time. ] 52192 ] 52193 52194 [ 52195 [[link boost_asio.reference.basic_waitable_timer.get_executor [*get_executor]]] 52196 [Get the executor associated with the object. ] 52197 ] 52198 52199 [ 52200 [[link boost_asio.reference.basic_waitable_timer.operator_eq_ [*operator=]]] 52201 [Move-assign a basic_waitable_timer from another. ] 52202 ] 52203 52204 [ 52205 [[link boost_asio.reference.basic_waitable_timer.wait [*wait]]] 52206 [Perform a blocking wait on the timer. ] 52207 ] 52208 52209 [ 52210 [[link boost_asio.reference.basic_waitable_timer._basic_waitable_timer [*~basic_waitable_timer]] [destructor]] 52211 [Destroys the timer. ] 52212 ] 52213 52214] 52215 52216The [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. 52217 52218A 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. 52219 52220Most 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. 52221 52222 52223[heading Remarks] 52224 52225This waitable timer functionality is for use with the C++11 standard library's `<chrono>` facility, or with the Boost.Chrono library. 52226 52227 52228[heading Thread Safety] 52229 52230['Distinct] ['objects:] Safe. 52231 52232['Shared] ['objects:] Unsafe. 52233 52234 52235[heading Examples] 52236 52237Performing a blocking wait (C++11): 52238 52239 // Construct a timer without setting an expiry time. 52240 boost::asio::steady_timer timer(my_context); 52241 52242 // Set an expiry time relative to now. 52243 timer.expires_after(std::chrono::seconds(5)); 52244 52245 // Wait for the timer to expire. 52246 timer.wait(); 52247 52248 52249 52250 52251 52252Performing an asynchronous wait (C++11): 52253 52254 void handler(const boost::system::error_code& error) 52255 { 52256 if (!error) 52257 { 52258 // Timer expired. 52259 } 52260 } 52261 52262 ... 52263 52264 // Construct a timer with an absolute expiry time. 52265 boost::asio::steady_timer timer(my_context, 52266 std::chrono::steady_clock::now() + std::chrono::seconds(60)); 52267 52268 // Start an asynchronous wait. 52269 timer.async_wait(handler); 52270 52271 52272 52273 52274 52275[heading Changing an active waitable timer's expiry time] 52276 52277 52278 52279Changing 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: 52280 52281 52282 52283 void on_some_event() 52284 { 52285 if (my_timer.expires_after(seconds(5)) > 0) 52286 { 52287 // We managed to cancel the timer. Start new asynchronous wait. 52288 my_timer.async_wait(on_timeout); 52289 } 52290 else 52291 { 52292 // Too late, timer has already expired! 52293 } 52294 } 52295 52296 void on_timeout(const boost::system::error_code& e) 52297 { 52298 if (e != boost::asio::error::operation_aborted) 52299 { 52300 // Timer was not cancelled, take necessary action. 52301 } 52302 } 52303 52304 52305 52306 52307 52308* 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. 52309 52310 52311* If a wait handler is cancelled, the boost::system::error\_code passed to it contains the value `boost::asio::error::operation_aborted`. 52312 52313 52314 52315[heading Requirements] 52316 52317['Header: ][^boost/asio/basic_waitable_timer.hpp] 52318 52319['Convenience header: ][^boost/asio.hpp] 52320 52321 52322[section:async_wait basic_waitable_timer::async_wait] 52323 52324[indexterm2 boost_asio.indexterm.basic_waitable_timer.async_wait..async_wait..basic_waitable_timer] 52325Start an asynchronous wait on the timer. 52326 52327 52328 template< 52329 typename ``[link boost_asio.reference.WaitHandler WaitHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 52330 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait( 52331 WaitHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 52332 52333 52334This function may be used to initiate an asynchronous wait against the timer. It always returns immediately. 52335 52336For each call to `async_wait()`, the supplied handler will be called exactly once. The handler will be called when: 52337 52338 52339* The timer has expired. 52340 52341 52342* The timer was cancelled, in which case the handler is passed the error code `boost::asio::error::operation_aborted`. 52343 52344 52345[heading Parameters] 52346 52347 52348[variablelist 52349 52350[[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: 52351`` 52352 void handler( 52353 const boost::system::error_code& error // Result of operation. 52354 ); 52355`` 52356Regardless 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`]. ]] 52357 52358] 52359 52360 52361 52362 52363[endsect] 52364 52365 52366[section:basic_waitable_timer basic_waitable_timer::basic_waitable_timer] 52367 52368[indexterm2 boost_asio.indexterm.basic_waitable_timer.basic_waitable_timer..basic_waitable_timer..basic_waitable_timer] 52369Constructor. 52370 52371 52372 explicit ``[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload1 basic_waitable_timer]``( 52373 const executor_type & ex); 52374 `` [''''»''' [link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload1 more...]]`` 52375 52376 template< 52377 typename ExecutionContext> 52378 explicit ``[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload2 basic_waitable_timer]``( 52379 ExecutionContext & context, 52380 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 52381 `` [''''»''' [link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload2 more...]]`` 52382 52383 52384Constructor to set a particular expiry time as an absolute time. 52385 52386 52387 ``[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload3 basic_waitable_timer]``( 52388 const executor_type & ex, 52389 const time_point & expiry_time); 52390 `` [''''»''' [link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload3 more...]]`` 52391 52392 template< 52393 typename ExecutionContext> 52394 explicit ``[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload4 basic_waitable_timer]``( 52395 ExecutionContext & context, 52396 const time_point & expiry_time, 52397 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 52398 `` [''''»''' [link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload4 more...]]`` 52399 52400 52401Constructor to set a particular expiry time relative to now. 52402 52403 52404 ``[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload5 basic_waitable_timer]``( 52405 const executor_type & ex, 52406 const duration & expiry_time); 52407 `` [''''»''' [link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload5 more...]]`` 52408 52409 template< 52410 typename ExecutionContext> 52411 explicit ``[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload6 basic_waitable_timer]``( 52412 ExecutionContext & context, 52413 const duration & expiry_time, 52414 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 52415 `` [''''»''' [link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload6 more...]]`` 52416 52417 52418Move-construct a [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] from another. 52419 52420 52421 ``[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload7 basic_waitable_timer]``( 52422 basic_waitable_timer && other); 52423 `` [''''»''' [link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload7 more...]]`` 52424 52425 template< 52426 typename ``[link boost_asio.reference.Executor1 Executor1]``> 52427 ``[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload8 basic_waitable_timer]``( 52428 basic_waitable_timer< Clock, WaitTraits, Executor1 > && other, 52429 typename constraint< is_convertible< Executor1, Executor >::value >::type = 0); 52430 `` [''''»''' [link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload8 more...]]`` 52431 52432 52433[section:overload1 basic_waitable_timer::basic_waitable_timer (1 of 8 overloads)] 52434 52435 52436Constructor. 52437 52438 52439 basic_waitable_timer( 52440 const executor_type & ex); 52441 52442 52443This 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. 52444 52445 52446[heading Parameters] 52447 52448 52449[variablelist 52450 52451[[ex][The I/O executor that the timer will use, by default, to dispatch handlers for any asynchronous operations performed on the timer. ]] 52452 52453] 52454 52455 52456 52457 52458[endsect] 52459 52460 52461 52462[section:overload2 basic_waitable_timer::basic_waitable_timer (2 of 8 overloads)] 52463 52464 52465Constructor. 52466 52467 52468 template< 52469 typename ExecutionContext> 52470 basic_waitable_timer( 52471 ExecutionContext & context, 52472 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 52473 52474 52475This 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. 52476 52477 52478[heading Parameters] 52479 52480 52481[variablelist 52482 52483[[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. ]] 52484 52485] 52486 52487 52488 52489 52490[endsect] 52491 52492 52493 52494[section:overload3 basic_waitable_timer::basic_waitable_timer (3 of 8 overloads)] 52495 52496 52497Constructor to set a particular expiry time as an absolute time. 52498 52499 52500 basic_waitable_timer( 52501 const executor_type & ex, 52502 const time_point & expiry_time); 52503 52504 52505This constructor creates a timer and sets the expiry time. 52506 52507 52508[heading Parameters] 52509 52510 52511[variablelist 52512 52513[[ex][The I/O executor object that the timer will use, by default, to dispatch handlers for any asynchronous operations performed on the timer.]] 52514 52515[[expiry_time][The expiry time to be used for the timer, expressed as an absolute time. ]] 52516 52517] 52518 52519 52520 52521 52522[endsect] 52523 52524 52525 52526[section:overload4 basic_waitable_timer::basic_waitable_timer (4 of 8 overloads)] 52527 52528 52529Constructor to set a particular expiry time as an absolute time. 52530 52531 52532 template< 52533 typename ExecutionContext> 52534 basic_waitable_timer( 52535 ExecutionContext & context, 52536 const time_point & expiry_time, 52537 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 52538 52539 52540This constructor creates a timer and sets the expiry time. 52541 52542 52543[heading Parameters] 52544 52545 52546[variablelist 52547 52548[[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.]] 52549 52550[[expiry_time][The expiry time to be used for the timer, expressed as an absolute time. ]] 52551 52552] 52553 52554 52555 52556 52557[endsect] 52558 52559 52560 52561[section:overload5 basic_waitable_timer::basic_waitable_timer (5 of 8 overloads)] 52562 52563 52564Constructor to set a particular expiry time relative to now. 52565 52566 52567 basic_waitable_timer( 52568 const executor_type & ex, 52569 const duration & expiry_time); 52570 52571 52572This constructor creates a timer and sets the expiry time. 52573 52574 52575[heading Parameters] 52576 52577 52578[variablelist 52579 52580[[ex][The I/O executor that the timer will use, by default, to dispatch handlers for any asynchronous operations performed on the timer.]] 52581 52582[[expiry_time][The expiry time to be used for the timer, relative to now. ]] 52583 52584] 52585 52586 52587 52588 52589[endsect] 52590 52591 52592 52593[section:overload6 basic_waitable_timer::basic_waitable_timer (6 of 8 overloads)] 52594 52595 52596Constructor to set a particular expiry time relative to now. 52597 52598 52599 template< 52600 typename ExecutionContext> 52601 basic_waitable_timer( 52602 ExecutionContext & context, 52603 const duration & expiry_time, 52604 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 52605 52606 52607This constructor creates a timer and sets the expiry time. 52608 52609 52610[heading Parameters] 52611 52612 52613[variablelist 52614 52615[[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.]] 52616 52617[[expiry_time][The expiry time to be used for the timer, relative to now. ]] 52618 52619] 52620 52621 52622 52623 52624[endsect] 52625 52626 52627 52628[section:overload7 basic_waitable_timer::basic_waitable_timer (7 of 8 overloads)] 52629 52630 52631Move-construct a [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] from another. 52632 52633 52634 basic_waitable_timer( 52635 basic_waitable_timer && other); 52636 52637 52638This constructor moves a timer from one object to another. 52639 52640 52641[heading Parameters] 52642 52643 52644[variablelist 52645 52646[[other][The other [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] object from which the move will occur.]] 52647 52648] 52649 52650 52651[heading Remarks] 52652 52653Following the move, the moved-from object is in the same state as if constructed using the `basic_waitable_timer(const executor_type&)` constructor. 52654 52655 52656 52657 52658[endsect] 52659 52660 52661 52662[section:overload8 basic_waitable_timer::basic_waitable_timer (8 of 8 overloads)] 52663 52664 52665Move-construct a [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] from another. 52666 52667 52668 template< 52669 typename ``[link boost_asio.reference.Executor1 Executor1]``> 52670 basic_waitable_timer( 52671 basic_waitable_timer< Clock, WaitTraits, Executor1 > && other, 52672 typename constraint< is_convertible< Executor1, Executor >::value >::type = 0); 52673 52674 52675This constructor moves a timer from one object to another. 52676 52677 52678[heading Parameters] 52679 52680 52681[variablelist 52682 52683[[other][The other [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] object from which the move will occur.]] 52684 52685] 52686 52687 52688[heading Remarks] 52689 52690Following the move, the moved-from object is in the same state as if constructed using the `basic_waitable_timer(const executor_type&)` constructor. 52691 52692 52693 52694 52695[endsect] 52696 52697 52698[endsect] 52699 52700[section:cancel basic_waitable_timer::cancel] 52701 52702[indexterm2 boost_asio.indexterm.basic_waitable_timer.cancel..cancel..basic_waitable_timer] 52703Cancel any asynchronous operations that are waiting on the timer. 52704 52705 52706 std::size_t ``[link boost_asio.reference.basic_waitable_timer.cancel.overload1 cancel]``(); 52707 `` [''''»''' [link boost_asio.reference.basic_waitable_timer.cancel.overload1 more...]]`` 52708 52709 52710(Deprecated: Use non-error\_code overload.) Cancel any asynchronous operations that are waiting on the timer. 52711 52712 52713 std::size_t ``[link boost_asio.reference.basic_waitable_timer.cancel.overload2 cancel]``( 52714 boost::system::error_code & ec); 52715 `` [''''»''' [link boost_asio.reference.basic_waitable_timer.cancel.overload2 more...]]`` 52716 52717 52718[section:overload1 basic_waitable_timer::cancel (1 of 2 overloads)] 52719 52720 52721Cancel any asynchronous operations that are waiting on the timer. 52722 52723 52724 std::size_t cancel(); 52725 52726 52727This 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. 52728 52729Cancelling the timer does not change the expiry time. 52730 52731 52732[heading Return Value] 52733 52734The number of asynchronous operations that were cancelled. 52735 52736 52737[heading Exceptions] 52738 52739 52740[variablelist 52741 52742[[boost::system::system_error][Thrown on failure.]] 52743 52744] 52745 52746 52747[heading Remarks] 52748 52749If the timer has already expired when `cancel()` is called, then the handlers for asynchronous wait operations will: 52750 52751 52752* have already been invoked; or 52753 52754 52755* have been queued for invocation in the near future. 52756 52757These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 52758 52759 52760[endsect] 52761 52762 52763 52764[section:overload2 basic_waitable_timer::cancel (2 of 2 overloads)] 52765 52766 52767(Deprecated: Use non-error\_code overload.) Cancel any asynchronous operations that are waiting on the timer. 52768 52769 52770 std::size_t cancel( 52771 boost::system::error_code & ec); 52772 52773 52774This 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. 52775 52776Cancelling the timer does not change the expiry time. 52777 52778 52779[heading Parameters] 52780 52781 52782[variablelist 52783 52784[[ec][Set to indicate what error occurred, if any.]] 52785 52786] 52787 52788 52789[heading Return Value] 52790 52791The number of asynchronous operations that were cancelled. 52792 52793 52794[heading Remarks] 52795 52796If the timer has already expired when `cancel()` is called, then the handlers for asynchronous wait operations will: 52797 52798 52799* have already been invoked; or 52800 52801 52802* have been queued for invocation in the near future. 52803 52804These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 52805 52806 52807[endsect] 52808 52809 52810[endsect] 52811 52812[section:cancel_one basic_waitable_timer::cancel_one] 52813 52814[indexterm2 boost_asio.indexterm.basic_waitable_timer.cancel_one..cancel_one..basic_waitable_timer] 52815Cancels one asynchronous operation that is waiting on the timer. 52816 52817 52818 std::size_t ``[link boost_asio.reference.basic_waitable_timer.cancel_one.overload1 cancel_one]``(); 52819 `` [''''»''' [link boost_asio.reference.basic_waitable_timer.cancel_one.overload1 more...]]`` 52820 52821 52822(Deprecated: Use non-error\_code overload.) Cancels one asynchronous operation that is waiting on the timer. 52823 52824 52825 std::size_t ``[link boost_asio.reference.basic_waitable_timer.cancel_one.overload2 cancel_one]``( 52826 boost::system::error_code & ec); 52827 `` [''''»''' [link boost_asio.reference.basic_waitable_timer.cancel_one.overload2 more...]]`` 52828 52829 52830[section:overload1 basic_waitable_timer::cancel_one (1 of 2 overloads)] 52831 52832 52833Cancels one asynchronous operation that is waiting on the timer. 52834 52835 52836 std::size_t cancel_one(); 52837 52838 52839This 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. 52840 52841Cancelling the timer does not change the expiry time. 52842 52843 52844[heading Return Value] 52845 52846The number of asynchronous operations that were cancelled. That is, either 0 or 1. 52847 52848 52849[heading Exceptions] 52850 52851 52852[variablelist 52853 52854[[boost::system::system_error][Thrown on failure.]] 52855 52856] 52857 52858 52859[heading Remarks] 52860 52861If the timer has already expired when `cancel_one()` is called, then the handlers for asynchronous wait operations will: 52862 52863 52864* have already been invoked; or 52865 52866 52867* have been queued for invocation in the near future. 52868 52869These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 52870 52871 52872[endsect] 52873 52874 52875 52876[section:overload2 basic_waitable_timer::cancel_one (2 of 2 overloads)] 52877 52878 52879(Deprecated: Use non-error\_code overload.) Cancels one asynchronous operation that is waiting on the timer. 52880 52881 52882 std::size_t cancel_one( 52883 boost::system::error_code & ec); 52884 52885 52886This 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. 52887 52888Cancelling the timer does not change the expiry time. 52889 52890 52891[heading Parameters] 52892 52893 52894[variablelist 52895 52896[[ec][Set to indicate what error occurred, if any.]] 52897 52898] 52899 52900 52901[heading Return Value] 52902 52903The number of asynchronous operations that were cancelled. That is, either 0 or 1. 52904 52905 52906[heading Remarks] 52907 52908If the timer has already expired when `cancel_one()` is called, then the handlers for asynchronous wait operations will: 52909 52910 52911* have already been invoked; or 52912 52913 52914* have been queued for invocation in the near future. 52915 52916These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 52917 52918 52919[endsect] 52920 52921 52922[endsect] 52923 52924 52925[section:clock_type basic_waitable_timer::clock_type] 52926 52927[indexterm2 boost_asio.indexterm.basic_waitable_timer.clock_type..clock_type..basic_waitable_timer] 52928The clock type. 52929 52930 52931 typedef Clock clock_type; 52932 52933 52934 52935[heading Requirements] 52936 52937['Header: ][^boost/asio/basic_waitable_timer.hpp] 52938 52939['Convenience header: ][^boost/asio.hpp] 52940 52941 52942[endsect] 52943 52944 52945 52946[section:duration basic_waitable_timer::duration] 52947 52948[indexterm2 boost_asio.indexterm.basic_waitable_timer.duration..duration..basic_waitable_timer] 52949The duration type of the clock. 52950 52951 52952 typedef clock_type::duration duration; 52953 52954 52955 52956[heading Requirements] 52957 52958['Header: ][^boost/asio/basic_waitable_timer.hpp] 52959 52960['Convenience header: ][^boost/asio.hpp] 52961 52962 52963[endsect] 52964 52965 52966 52967[section:executor_type basic_waitable_timer::executor_type] 52968 52969[indexterm2 boost_asio.indexterm.basic_waitable_timer.executor_type..executor_type..basic_waitable_timer] 52970The type of the executor associated with the object. 52971 52972 52973 typedef Executor executor_type; 52974 52975 52976 52977[heading Requirements] 52978 52979['Header: ][^boost/asio/basic_waitable_timer.hpp] 52980 52981['Convenience header: ][^boost/asio.hpp] 52982 52983 52984[endsect] 52985 52986 52987 52988[section:expires_after basic_waitable_timer::expires_after] 52989 52990[indexterm2 boost_asio.indexterm.basic_waitable_timer.expires_after..expires_after..basic_waitable_timer] 52991Set the timer's expiry time relative to now. 52992 52993 52994 std::size_t expires_after( 52995 const duration & expiry_time); 52996 52997 52998This 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. 52999 53000 53001[heading Parameters] 53002 53003 53004[variablelist 53005 53006[[expiry_time][The expiry time to be used for the timer.]] 53007 53008] 53009 53010 53011[heading Return Value] 53012 53013The number of asynchronous operations that were cancelled. 53014 53015 53016[heading Exceptions] 53017 53018 53019[variablelist 53020 53021[[boost::system::system_error][Thrown on failure.]] 53022 53023] 53024 53025 53026[heading Remarks] 53027 53028If the timer has already expired when `expires_after()` is called, then the handlers for asynchronous wait operations will: 53029 53030 53031* have already been invoked; or 53032 53033 53034* have been queued for invocation in the near future. 53035 53036These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 53037 53038 53039[endsect] 53040 53041 53042[section:expires_at basic_waitable_timer::expires_at] 53043 53044[indexterm2 boost_asio.indexterm.basic_waitable_timer.expires_at..expires_at..basic_waitable_timer] 53045(Deprecated: Use `expiry()`.) Get the timer's expiry time as an absolute time. 53046 53047 53048 time_point ``[link boost_asio.reference.basic_waitable_timer.expires_at.overload1 expires_at]``() const; 53049 `` [''''»''' [link boost_asio.reference.basic_waitable_timer.expires_at.overload1 more...]]`` 53050 53051 53052Set the timer's expiry time as an absolute time. 53053 53054 53055 std::size_t ``[link boost_asio.reference.basic_waitable_timer.expires_at.overload2 expires_at]``( 53056 const time_point & expiry_time); 53057 `` [''''»''' [link boost_asio.reference.basic_waitable_timer.expires_at.overload2 more...]]`` 53058 53059 53060(Deprecated: Use non-error\_code overload.) Set the timer's expiry time as an absolute time. 53061 53062 53063 std::size_t ``[link boost_asio.reference.basic_waitable_timer.expires_at.overload3 expires_at]``( 53064 const time_point & expiry_time, 53065 boost::system::error_code & ec); 53066 `` [''''»''' [link boost_asio.reference.basic_waitable_timer.expires_at.overload3 more...]]`` 53067 53068 53069[section:overload1 basic_waitable_timer::expires_at (1 of 3 overloads)] 53070 53071 53072(Deprecated: Use `expiry()`.) Get the timer's expiry time as an absolute time. 53073 53074 53075 time_point expires_at() const; 53076 53077 53078This function may be used to obtain the timer's current expiry time. Whether the timer has expired or not does not affect this value. 53079 53080 53081[endsect] 53082 53083 53084 53085[section:overload2 basic_waitable_timer::expires_at (2 of 3 overloads)] 53086 53087 53088Set the timer's expiry time as an absolute time. 53089 53090 53091 std::size_t expires_at( 53092 const time_point & expiry_time); 53093 53094 53095This 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. 53096 53097 53098[heading Parameters] 53099 53100 53101[variablelist 53102 53103[[expiry_time][The expiry time to be used for the timer.]] 53104 53105] 53106 53107 53108[heading Return Value] 53109 53110The number of asynchronous operations that were cancelled. 53111 53112 53113[heading Exceptions] 53114 53115 53116[variablelist 53117 53118[[boost::system::system_error][Thrown on failure.]] 53119 53120] 53121 53122 53123[heading Remarks] 53124 53125If the timer has already expired when `expires_at()` is called, then the handlers for asynchronous wait operations will: 53126 53127 53128* have already been invoked; or 53129 53130 53131* have been queued for invocation in the near future. 53132 53133These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 53134 53135 53136[endsect] 53137 53138 53139 53140[section:overload3 basic_waitable_timer::expires_at (3 of 3 overloads)] 53141 53142 53143(Deprecated: Use non-error\_code overload.) Set the timer's expiry time as an absolute time. 53144 53145 53146 std::size_t expires_at( 53147 const time_point & expiry_time, 53148 boost::system::error_code & ec); 53149 53150 53151This 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. 53152 53153 53154[heading Parameters] 53155 53156 53157[variablelist 53158 53159[[expiry_time][The expiry time to be used for the timer.]] 53160 53161[[ec][Set to indicate what error occurred, if any.]] 53162 53163] 53164 53165 53166[heading Return Value] 53167 53168The number of asynchronous operations that were cancelled. 53169 53170 53171[heading Remarks] 53172 53173If the timer has already expired when `expires_at()` is called, then the handlers for asynchronous wait operations will: 53174 53175 53176* have already been invoked; or 53177 53178 53179* have been queued for invocation in the near future. 53180 53181These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 53182 53183 53184[endsect] 53185 53186 53187[endsect] 53188 53189[section:expires_from_now basic_waitable_timer::expires_from_now] 53190 53191[indexterm2 boost_asio.indexterm.basic_waitable_timer.expires_from_now..expires_from_now..basic_waitable_timer] 53192(Deprecated: Use `expiry()`.) Get the timer's expiry time relative to now. 53193 53194 53195 duration ``[link boost_asio.reference.basic_waitable_timer.expires_from_now.overload1 expires_from_now]``() const; 53196 `` [''''»''' [link boost_asio.reference.basic_waitable_timer.expires_from_now.overload1 more...]]`` 53197 53198 53199(Deprecated: Use `expires_after()`.) Set the timer's expiry time relative to now. 53200 53201 53202 std::size_t ``[link boost_asio.reference.basic_waitable_timer.expires_from_now.overload2 expires_from_now]``( 53203 const duration & expiry_time); 53204 `` [''''»''' [link boost_asio.reference.basic_waitable_timer.expires_from_now.overload2 more...]]`` 53205 53206 std::size_t ``[link boost_asio.reference.basic_waitable_timer.expires_from_now.overload3 expires_from_now]``( 53207 const duration & expiry_time, 53208 boost::system::error_code & ec); 53209 `` [''''»''' [link boost_asio.reference.basic_waitable_timer.expires_from_now.overload3 more...]]`` 53210 53211 53212[section:overload1 basic_waitable_timer::expires_from_now (1 of 3 overloads)] 53213 53214 53215(Deprecated: Use `expiry()`.) Get the timer's expiry time relative to now. 53216 53217 53218 duration expires_from_now() const; 53219 53220 53221This function may be used to obtain the timer's current expiry time. Whether the timer has expired or not does not affect this value. 53222 53223 53224[endsect] 53225 53226 53227 53228[section:overload2 basic_waitable_timer::expires_from_now (2 of 3 overloads)] 53229 53230 53231(Deprecated: Use `expires_after()`.) Set the timer's expiry time relative to now. 53232 53233 53234 std::size_t expires_from_now( 53235 const duration & expiry_time); 53236 53237 53238This 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. 53239 53240 53241[heading Parameters] 53242 53243 53244[variablelist 53245 53246[[expiry_time][The expiry time to be used for the timer.]] 53247 53248] 53249 53250 53251[heading Return Value] 53252 53253The number of asynchronous operations that were cancelled. 53254 53255 53256[heading Exceptions] 53257 53258 53259[variablelist 53260 53261[[boost::system::system_error][Thrown on failure.]] 53262 53263] 53264 53265 53266[heading Remarks] 53267 53268If the timer has already expired when `expires_from_now()` is called, then the handlers for asynchronous wait operations will: 53269 53270 53271* have already been invoked; or 53272 53273 53274* have been queued for invocation in the near future. 53275 53276These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 53277 53278 53279[endsect] 53280 53281 53282 53283[section:overload3 basic_waitable_timer::expires_from_now (3 of 3 overloads)] 53284 53285 53286(Deprecated: Use `expires_after()`.) Set the timer's expiry time relative to now. 53287 53288 53289 std::size_t expires_from_now( 53290 const duration & expiry_time, 53291 boost::system::error_code & ec); 53292 53293 53294This 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. 53295 53296 53297[heading Parameters] 53298 53299 53300[variablelist 53301 53302[[expiry_time][The expiry time to be used for the timer.]] 53303 53304[[ec][Set to indicate what error occurred, if any.]] 53305 53306] 53307 53308 53309[heading Return Value] 53310 53311The number of asynchronous operations that were cancelled. 53312 53313 53314[heading Remarks] 53315 53316If the timer has already expired when `expires_from_now()` is called, then the handlers for asynchronous wait operations will: 53317 53318 53319* have already been invoked; or 53320 53321 53322* have been queued for invocation in the near future. 53323 53324These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation. 53325 53326 53327[endsect] 53328 53329 53330[endsect] 53331 53332 53333[section:expiry basic_waitable_timer::expiry] 53334 53335[indexterm2 boost_asio.indexterm.basic_waitable_timer.expiry..expiry..basic_waitable_timer] 53336Get the timer's expiry time as an absolute time. 53337 53338 53339 time_point expiry() const; 53340 53341 53342This function may be used to obtain the timer's current expiry time. Whether the timer has expired or not does not affect this value. 53343 53344 53345[endsect] 53346 53347 53348 53349[section:get_executor basic_waitable_timer::get_executor] 53350 53351[indexterm2 boost_asio.indexterm.basic_waitable_timer.get_executor..get_executor..basic_waitable_timer] 53352Get the executor associated with the object. 53353 53354 53355 executor_type get_executor(); 53356 53357 53358 53359[endsect] 53360 53361 53362[section:operator_eq_ basic_waitable_timer::operator=] 53363 53364[indexterm2 boost_asio.indexterm.basic_waitable_timer.operator_eq_..operator=..basic_waitable_timer] 53365Move-assign a [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] from another. 53366 53367 53368 basic_waitable_timer & ``[link boost_asio.reference.basic_waitable_timer.operator_eq_.overload1 operator=]``( 53369 basic_waitable_timer && other); 53370 `` [''''»''' [link boost_asio.reference.basic_waitable_timer.operator_eq_.overload1 more...]]`` 53371 53372 template< 53373 typename ``[link boost_asio.reference.Executor1 Executor1]``> 53374 constraint< is_convertible< Executor1, Executor >::value, basic_waitable_timer & >::type ``[link boost_asio.reference.basic_waitable_timer.operator_eq_.overload2 operator=]``( 53375 basic_waitable_timer< Clock, WaitTraits, Executor1 > && other); 53376 `` [''''»''' [link boost_asio.reference.basic_waitable_timer.operator_eq_.overload2 more...]]`` 53377 53378 53379[section:overload1 basic_waitable_timer::operator= (1 of 2 overloads)] 53380 53381 53382Move-assign a [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] from another. 53383 53384 53385 basic_waitable_timer & operator=( 53386 basic_waitable_timer && other); 53387 53388 53389This assignment operator moves a timer from one object to another. Cancels any outstanding asynchronous operations associated with the target object. 53390 53391 53392[heading Parameters] 53393 53394 53395[variablelist 53396 53397[[other][The other [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] object from which the move will occur.]] 53398 53399] 53400 53401 53402[heading Remarks] 53403 53404Following the move, the moved-from object is in the same state as if constructed using the `basic_waitable_timer(const executor_type&)` constructor. 53405 53406 53407 53408 53409[endsect] 53410 53411 53412 53413[section:overload2 basic_waitable_timer::operator= (2 of 2 overloads)] 53414 53415 53416Move-assign a [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] from another. 53417 53418 53419 template< 53420 typename ``[link boost_asio.reference.Executor1 Executor1]``> 53421 constraint< is_convertible< Executor1, Executor >::value, basic_waitable_timer & >::type operator=( 53422 basic_waitable_timer< Clock, WaitTraits, Executor1 > && other); 53423 53424 53425This assignment operator moves a timer from one object to another. Cancels any outstanding asynchronous operations associated with the target object. 53426 53427 53428[heading Parameters] 53429 53430 53431[variablelist 53432 53433[[other][The other [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] object from which the move will occur.]] 53434 53435] 53436 53437 53438[heading Remarks] 53439 53440Following the move, the moved-from object is in the same state as if constructed using the `basic_waitable_timer(const executor_type&)` constructor. 53441 53442 53443 53444 53445[endsect] 53446 53447 53448[endsect] 53449 53450 53451[section:time_point basic_waitable_timer::time_point] 53452 53453[indexterm2 boost_asio.indexterm.basic_waitable_timer.time_point..time_point..basic_waitable_timer] 53454The time point type of the clock. 53455 53456 53457 typedef clock_type::time_point time_point; 53458 53459 53460 53461[heading Requirements] 53462 53463['Header: ][^boost/asio/basic_waitable_timer.hpp] 53464 53465['Convenience header: ][^boost/asio.hpp] 53466 53467 53468[endsect] 53469 53470 53471 53472[section:traits_type basic_waitable_timer::traits_type] 53473 53474[indexterm2 boost_asio.indexterm.basic_waitable_timer.traits_type..traits_type..basic_waitable_timer] 53475The wait traits type. 53476 53477 53478 typedef WaitTraits traits_type; 53479 53480 53481 53482[heading Requirements] 53483 53484['Header: ][^boost/asio/basic_waitable_timer.hpp] 53485 53486['Convenience header: ][^boost/asio.hpp] 53487 53488 53489[endsect] 53490 53491 53492[section:wait basic_waitable_timer::wait] 53493 53494[indexterm2 boost_asio.indexterm.basic_waitable_timer.wait..wait..basic_waitable_timer] 53495Perform a blocking wait on the timer. 53496 53497 53498 void ``[link boost_asio.reference.basic_waitable_timer.wait.overload1 wait]``(); 53499 `` [''''»''' [link boost_asio.reference.basic_waitable_timer.wait.overload1 more...]]`` 53500 53501 void ``[link boost_asio.reference.basic_waitable_timer.wait.overload2 wait]``( 53502 boost::system::error_code & ec); 53503 `` [''''»''' [link boost_asio.reference.basic_waitable_timer.wait.overload2 more...]]`` 53504 53505 53506[section:overload1 basic_waitable_timer::wait (1 of 2 overloads)] 53507 53508 53509Perform a blocking wait on the timer. 53510 53511 53512 void wait(); 53513 53514 53515This function is used to wait for the timer to expire. This function blocks and does not return until the timer has expired. 53516 53517 53518[heading Exceptions] 53519 53520 53521[variablelist 53522 53523[[boost::system::system_error][Thrown on failure. ]] 53524 53525] 53526 53527 53528 53529 53530[endsect] 53531 53532 53533 53534[section:overload2 basic_waitable_timer::wait (2 of 2 overloads)] 53535 53536 53537Perform a blocking wait on the timer. 53538 53539 53540 void wait( 53541 boost::system::error_code & ec); 53542 53543 53544This function is used to wait for the timer to expire. This function blocks and does not return until the timer has expired. 53545 53546 53547[heading Parameters] 53548 53549 53550[variablelist 53551 53552[[ec][Set to indicate what error occurred, if any. ]] 53553 53554] 53555 53556 53557 53558 53559[endsect] 53560 53561 53562[endsect] 53563 53564 53565[section:_basic_waitable_timer basic_waitable_timer::~basic_waitable_timer] 53566 53567[indexterm2 boost_asio.indexterm.basic_waitable_timer._basic_waitable_timer..~basic_waitable_timer..basic_waitable_timer] 53568Destroys the timer. 53569 53570 53571 ~basic_waitable_timer(); 53572 53573 53574This function destroys the timer, cancelling any outstanding asynchronous wait operations associated with the timer as if by calling `cancel`. 53575 53576 53577[endsect] 53578 53579 53580 53581[endsect] 53582 53583[section:basic_waitable_timer__rebind_executor basic_waitable_timer::rebind_executor] 53584 53585[indexterm1 boost_asio.indexterm.basic_waitable_timer__rebind_executor..basic_waitable_timer::rebind_executor] 53586 53587 53588Rebinds the timer type to another executor. 53589 53590 53591 template< 53592 typename ``[link boost_asio.reference.Executor1 Executor1]``> 53593 struct rebind_executor 53594 53595 53596[heading Types] 53597[table 53598 [[Name][Description]] 53599 53600 [ 53601 53602 [[link boost_asio.reference.basic_waitable_timer__rebind_executor.other [*other]]] 53603 [The timer type when rebound to the specified executor. ] 53604 53605 ] 53606 53607] 53608 53609[heading Requirements] 53610 53611['Header: ][^boost/asio/basic_waitable_timer.hpp] 53612 53613['Convenience header: ][^boost/asio.hpp] 53614 53615 53616[section:other basic_waitable_timer::rebind_executor::other] 53617 53618[indexterm2 boost_asio.indexterm.basic_waitable_timer__rebind_executor.other..other..basic_waitable_timer::rebind_executor] 53619The timer type when rebound to the specified executor. 53620 53621 53622 typedef basic_waitable_timer< Clock, WaitTraits, Executor1 > other; 53623 53624 53625[heading Types] 53626[table 53627 [[Name][Description]] 53628 53629 [ 53630 53631 [[link boost_asio.reference.basic_waitable_timer__rebind_executor [*rebind_executor]]] 53632 [Rebinds the timer type to another executor. ] 53633 53634 ] 53635 53636 [ 53637 53638 [[link boost_asio.reference.basic_waitable_timer.clock_type [*clock_type]]] 53639 [The clock type. ] 53640 53641 ] 53642 53643 [ 53644 53645 [[link boost_asio.reference.basic_waitable_timer.duration [*duration]]] 53646 [The duration type of the clock. ] 53647 53648 ] 53649 53650 [ 53651 53652 [[link boost_asio.reference.basic_waitable_timer.executor_type [*executor_type]]] 53653 [The type of the executor associated with the object. ] 53654 53655 ] 53656 53657 [ 53658 53659 [[link boost_asio.reference.basic_waitable_timer.time_point [*time_point]]] 53660 [The time point type of the clock. ] 53661 53662 ] 53663 53664 [ 53665 53666 [[link boost_asio.reference.basic_waitable_timer.traits_type [*traits_type]]] 53667 [The wait traits type. ] 53668 53669 ] 53670 53671] 53672 53673[heading Member Functions] 53674[table 53675 [[Name][Description]] 53676 53677 [ 53678 [[link boost_asio.reference.basic_waitable_timer.async_wait [*async_wait]]] 53679 [Start an asynchronous wait on the timer. ] 53680 ] 53681 53682 [ 53683 [[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer [*basic_waitable_timer]] [constructor]] 53684 [Constructor. 53685 [hr] 53686 Constructor to set a particular expiry time as an absolute time. 53687 [hr] 53688 Constructor to set a particular expiry time relative to now. 53689 [hr] 53690 Move-construct a basic_waitable_timer from another. ] 53691 ] 53692 53693 [ 53694 [[link boost_asio.reference.basic_waitable_timer.cancel [*cancel]]] 53695 [Cancel any asynchronous operations that are waiting on the timer. 53696 [hr] 53697 (Deprecated: Use non-error_code overload.) Cancel any asynchronous operations that are waiting on the timer. ] 53698 ] 53699 53700 [ 53701 [[link boost_asio.reference.basic_waitable_timer.cancel_one [*cancel_one]]] 53702 [Cancels one asynchronous operation that is waiting on the timer. 53703 [hr] 53704 (Deprecated: Use non-error_code overload.) Cancels one asynchronous operation that is waiting on the timer. ] 53705 ] 53706 53707 [ 53708 [[link boost_asio.reference.basic_waitable_timer.expires_after [*expires_after]]] 53709 [Set the timer's expiry time relative to now. ] 53710 ] 53711 53712 [ 53713 [[link boost_asio.reference.basic_waitable_timer.expires_at [*expires_at]]] 53714 [(Deprecated: Use expiry().) Get the timer's expiry time as an absolute time. 53715 [hr] 53716 Set the timer's expiry time as an absolute time. 53717 [hr] 53718 (Deprecated: Use non-error_code overload.) Set the timer's expiry time as an absolute time. ] 53719 ] 53720 53721 [ 53722 [[link boost_asio.reference.basic_waitable_timer.expires_from_now [*expires_from_now]]] 53723 [(Deprecated: Use expiry().) Get the timer's expiry time relative to now. 53724 [hr] 53725 (Deprecated: Use expires_after().) Set the timer's expiry time relative to now. ] 53726 ] 53727 53728 [ 53729 [[link boost_asio.reference.basic_waitable_timer.expiry [*expiry]]] 53730 [Get the timer's expiry time as an absolute time. ] 53731 ] 53732 53733 [ 53734 [[link boost_asio.reference.basic_waitable_timer.get_executor [*get_executor]]] 53735 [Get the executor associated with the object. ] 53736 ] 53737 53738 [ 53739 [[link boost_asio.reference.basic_waitable_timer.operator_eq_ [*operator=]]] 53740 [Move-assign a basic_waitable_timer from another. ] 53741 ] 53742 53743 [ 53744 [[link boost_asio.reference.basic_waitable_timer.wait [*wait]]] 53745 [Perform a blocking wait on the timer. ] 53746 ] 53747 53748 [ 53749 [[link boost_asio.reference.basic_waitable_timer._basic_waitable_timer [*~basic_waitable_timer]] [destructor]] 53750 [Destroys the timer. ] 53751 ] 53752 53753] 53754 53755The [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. 53756 53757A 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. 53758 53759Most 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. 53760 53761 53762[heading Remarks] 53763 53764This waitable timer functionality is for use with the C++11 standard library's `<chrono>` facility, or with the Boost.Chrono library. 53765 53766 53767[heading Thread Safety] 53768 53769['Distinct] ['objects:] Safe. 53770 53771['Shared] ['objects:] Unsafe. 53772 53773 53774[heading Examples] 53775 53776Performing a blocking wait (C++11): 53777 53778 // Construct a timer without setting an expiry time. 53779 boost::asio::steady_timer timer(my_context); 53780 53781 // Set an expiry time relative to now. 53782 timer.expires_after(std::chrono::seconds(5)); 53783 53784 // Wait for the timer to expire. 53785 timer.wait(); 53786 53787 53788 53789 53790 53791Performing an asynchronous wait (C++11): 53792 53793 void handler(const boost::system::error_code& error) 53794 { 53795 if (!error) 53796 { 53797 // Timer expired. 53798 } 53799 } 53800 53801 ... 53802 53803 // Construct a timer with an absolute expiry time. 53804 boost::asio::steady_timer timer(my_context, 53805 std::chrono::steady_clock::now() + std::chrono::seconds(60)); 53806 53807 // Start an asynchronous wait. 53808 timer.async_wait(handler); 53809 53810 53811 53812 53813 53814[heading Changing an active waitable timer's expiry time] 53815 53816 53817 53818Changing 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: 53819 53820 53821 53822 void on_some_event() 53823 { 53824 if (my_timer.expires_after(seconds(5)) > 0) 53825 { 53826 // We managed to cancel the timer. Start new asynchronous wait. 53827 my_timer.async_wait(on_timeout); 53828 } 53829 else 53830 { 53831 // Too late, timer has already expired! 53832 } 53833 } 53834 53835 void on_timeout(const boost::system::error_code& e) 53836 { 53837 if (e != boost::asio::error::operation_aborted) 53838 { 53839 // Timer was not cancelled, take necessary action. 53840 } 53841 } 53842 53843 53844 53845 53846 53847* 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. 53848 53849 53850* If a wait handler is cancelled, the boost::system::error\_code passed to it contains the value `boost::asio::error::operation_aborted`. 53851 53852 53853 53854 53855[heading Requirements] 53856 53857['Header: ][^boost/asio/basic_waitable_timer.hpp] 53858 53859['Convenience header: ][^boost/asio.hpp] 53860 53861 53862[endsect] 53863 53864 53865 53866[endsect] 53867 53868[section:basic_yield_context basic_yield_context] 53869 53870[indexterm1 boost_asio.indexterm.basic_yield_context..basic_yield_context] 53871 53872 53873Context object the represents the currently executing coroutine. 53874 53875 53876 template< 53877 typename ``[link boost_asio.reference.Handler Handler]``> 53878 class basic_yield_context 53879 53880 53881[heading Types] 53882[table 53883 [[Name][Description]] 53884 53885 [ 53886 53887 [[link boost_asio.reference.basic_yield_context.callee_type [*callee_type]]] 53888 [The coroutine callee type, used by the implementation. ] 53889 53890 ] 53891 53892 [ 53893 53894 [[link boost_asio.reference.basic_yield_context.caller_type [*caller_type]]] 53895 [The coroutine caller type, used by the implementation. ] 53896 53897 ] 53898 53899] 53900 53901[heading Member Functions] 53902[table 53903 [[Name][Description]] 53904 53905 [ 53906 [[link boost_asio.reference.basic_yield_context.basic_yield_context [*basic_yield_context]] [constructor]] 53907 [Construct a yield context to represent the specified coroutine. 53908 [hr] 53909 Construct a yield context from another yield context type. ] 53910 ] 53911 53912 [ 53913 [[link boost_asio.reference.basic_yield_context.operator_lb__rb_ [*operator\[\]]]] 53914 [Return a yield context that sets the specified error_code. ] 53915 ] 53916 53917] 53918 53919The [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: 53920 53921 53922 53923 template <typename Handler> 53924 void my_coroutine(basic_yield_context<Handler> yield) 53925 { 53926 ... 53927 std::size_t n = my_socket.async_read_some(buffer, yield); 53928 ... 53929 } 53930 53931 53932 53933 53934The 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. 53935 53936[heading Requirements] 53937 53938['Header: ][^boost/asio/spawn.hpp] 53939 53940['Convenience header: ]None 53941 53942[section:basic_yield_context basic_yield_context::basic_yield_context] 53943 53944[indexterm2 boost_asio.indexterm.basic_yield_context.basic_yield_context..basic_yield_context..basic_yield_context] 53945Construct a yield context to represent the specified coroutine. 53946 53947 53948 ``[link boost_asio.reference.basic_yield_context.basic_yield_context.overload1 basic_yield_context]``( 53949 const detail::weak_ptr< callee_type > & coro, 53950 caller_type & ca, 53951 Handler & handler); 53952 `` [''''»''' [link boost_asio.reference.basic_yield_context.basic_yield_context.overload1 more...]]`` 53953 53954 53955Construct a yield context from another yield context type. 53956 53957 53958 template< 53959 typename OtherHandler> 53960 ``[link boost_asio.reference.basic_yield_context.basic_yield_context.overload2 basic_yield_context]``( 53961 const basic_yield_context< OtherHandler > & other); 53962 `` [''''»''' [link boost_asio.reference.basic_yield_context.basic_yield_context.overload2 more...]]`` 53963 53964 53965[section:overload1 basic_yield_context::basic_yield_context (1 of 2 overloads)] 53966 53967 53968Construct a yield context to represent the specified coroutine. 53969 53970 53971 basic_yield_context( 53972 const detail::weak_ptr< callee_type > & coro, 53973 caller_type & ca, 53974 Handler & handler); 53975 53976 53977Most applications do not need to use this constructor. Instead, the `spawn()` function passes a yield context as an argument to the coroutine function. 53978 53979 53980[endsect] 53981 53982 53983 53984[section:overload2 basic_yield_context::basic_yield_context (2 of 2 overloads)] 53985 53986 53987Construct a yield context from another yield context type. 53988 53989 53990 template< 53991 typename OtherHandler> 53992 basic_yield_context( 53993 const basic_yield_context< OtherHandler > & other); 53994 53995 53996Requires that OtherHandler be convertible to Handler. 53997 53998 53999[endsect] 54000 54001 54002[endsect] 54003 54004 54005[section:callee_type basic_yield_context::callee_type] 54006 54007[indexterm2 boost_asio.indexterm.basic_yield_context.callee_type..callee_type..basic_yield_context] 54008The coroutine callee type, used by the implementation. 54009 54010 54011 typedef implementation_defined callee_type; 54012 54013 54014 54015When using Boost.Coroutine v1, this type is: 54016 54017 typename coroutine<void()> 54018 54019 54020When using Boost.Coroutine v2 (unidirectional coroutines), this type is: 54021 54022 push_coroutine<void> 54023 54024 54025 54026 54027[heading Requirements] 54028 54029['Header: ][^boost/asio/spawn.hpp] 54030 54031['Convenience header: ]None 54032 54033 54034[endsect] 54035 54036 54037 54038[section:caller_type basic_yield_context::caller_type] 54039 54040[indexterm2 boost_asio.indexterm.basic_yield_context.caller_type..caller_type..basic_yield_context] 54041The coroutine caller type, used by the implementation. 54042 54043 54044 typedef implementation_defined caller_type; 54045 54046 54047 54048When using Boost.Coroutine v1, this type is: 54049 54050 typename coroutine<void()>::caller_type 54051 54052 54053When using Boost.Coroutine v2 (unidirectional coroutines), this type is: 54054 54055 pull_coroutine<void> 54056 54057 54058 54059 54060[heading Requirements] 54061 54062['Header: ][^boost/asio/spawn.hpp] 54063 54064['Convenience header: ]None 54065 54066 54067[endsect] 54068 54069 54070 54071[section:operator_lb__rb_ basic_yield_context::operator\[\]] 54072 54073[indexterm2 boost_asio.indexterm.basic_yield_context.operator_lb__rb_..operator\[\]..basic_yield_context] 54074Return a yield context that sets the specified error\_code. 54075 54076 54077 basic_yield_context operator[]( 54078 boost::system::error_code & ec) const; 54079 54080 54081By 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: 54082 54083 54084 54085 template <typename Handler> 54086 void my_coroutine(basic_yield_context<Handler> yield) 54087 { 54088 ... 54089 std::size_t n = my_socket.async_read_some(buffer, yield[ec]); 54090 if (ec) 54091 { 54092 // An error occurred. 54093 } 54094 ... 54095 } 54096 54097 54098 54099 54100 54101[endsect] 54102 54103 54104 54105[endsect] 54106 54107[section:bind_executor bind_executor] 54108 54109[indexterm1 boost_asio.indexterm.bind_executor..bind_executor] 54110Associate an object of type `T` with an executor of type `Executor`. 54111 54112 template< 54113 typename ``[link boost_asio.reference.Executor1 Executor]``, 54114 typename T> 54115 executor_binder< typename decay< T >::type, Executor > ``[link boost_asio.reference.bind_executor.overload1 bind_executor]``( 54116 const Executor & ex, 54117 T && t, 54118 typename constraint< is_executor< Executor >::value||execution::is_executor< Executor >::value >::type = 0); 54119 `` [''''»''' [link boost_asio.reference.bind_executor.overload1 more...]]`` 54120 54121Associate an object of type `T` with an execution context's executor. 54122 54123 template< 54124 typename ExecutionContext, 54125 typename T> 54126 executor_binder< typename decay< T >::type, typename ExecutionContext::executor_type > ``[link boost_asio.reference.bind_executor.overload2 bind_executor]``( 54127 ExecutionContext & ctx, 54128 T && t, 54129 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 54130 `` [''''»''' [link boost_asio.reference.bind_executor.overload2 more...]]`` 54131 54132[heading Requirements] 54133 54134['Header: ][^boost/asio/bind_executor.hpp] 54135 54136['Convenience header: ][^boost/asio.hpp] 54137 54138 54139[section:overload1 bind_executor (1 of 2 overloads)] 54140 54141 54142Associate an object of type `T` with an executor of type `Executor`. 54143 54144 54145 template< 54146 typename ``[link boost_asio.reference.Executor1 Executor]``, 54147 typename T> 54148 executor_binder< typename decay< T >::type, Executor > bind_executor( 54149 const Executor & ex, 54150 T && t, 54151 typename constraint< is_executor< Executor >::value||execution::is_executor< Executor >::value >::type = 0); 54152 54153 54154 54155[endsect] 54156 54157 54158 54159[section:overload2 bind_executor (2 of 2 overloads)] 54160 54161 54162Associate an object of type `T` with an execution context's executor. 54163 54164 54165 template< 54166 typename ExecutionContext, 54167 typename T> 54168 executor_binder< typename decay< T >::type, typename ExecutionContext::executor_type > bind_executor( 54169 ExecutionContext & ctx, 54170 T && t, 54171 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 54172 54173 54174 54175[endsect] 54176 54177 54178[endsect] 54179 54180[section:buffer buffer] 54181 54182[indexterm1 boost_asio.indexterm.buffer..buffer] 54183The `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. 54184 54185 54186Create a new modifiable buffer from an existing buffer. 54187 54188 mutable_buffer ``[link boost_asio.reference.buffer.overload1 buffer]``( 54189 const mutable_buffer & b); 54190 `` [''''»''' [link boost_asio.reference.buffer.overload1 more...]]`` 54191 54192 mutable_buffer ``[link boost_asio.reference.buffer.overload2 buffer]``( 54193 const mutable_buffer & b, 54194 std::size_t max_size_in_bytes); 54195 `` [''''»''' [link boost_asio.reference.buffer.overload2 more...]]`` 54196 54197Create a new non-modifiable buffer from an existing buffer. 54198 54199 const_buffer ``[link boost_asio.reference.buffer.overload3 buffer]``( 54200 const const_buffer & b); 54201 `` [''''»''' [link boost_asio.reference.buffer.overload3 more...]]`` 54202 54203 const_buffer ``[link boost_asio.reference.buffer.overload4 buffer]``( 54204 const const_buffer & b, 54205 std::size_t max_size_in_bytes); 54206 `` [''''»''' [link boost_asio.reference.buffer.overload4 more...]]`` 54207 54208Create a new modifiable buffer that represents the given memory range. 54209 54210 mutable_buffer ``[link boost_asio.reference.buffer.overload5 buffer]``( 54211 void * data, 54212 std::size_t size_in_bytes); 54213 `` [''''»''' [link boost_asio.reference.buffer.overload5 more...]]`` 54214 54215Create a new non-modifiable buffer that represents the given memory range. 54216 54217 const_buffer ``[link boost_asio.reference.buffer.overload6 buffer]``( 54218 const void * data, 54219 std::size_t size_in_bytes); 54220 `` [''''»''' [link boost_asio.reference.buffer.overload6 more...]]`` 54221 54222Create a new modifiable buffer that represents the given POD array. 54223 54224 template< 54225 typename PodType, 54226 std::size_t N> 54227 mutable_buffer ``[link boost_asio.reference.buffer.overload7 buffer]``( 54228 PodType (&data)[N]); 54229 `` [''''»''' [link boost_asio.reference.buffer.overload7 more...]]`` 54230 54231 template< 54232 typename PodType, 54233 std::size_t N> 54234 mutable_buffer ``[link boost_asio.reference.buffer.overload8 buffer]``( 54235 PodType (&data)[N], 54236 std::size_t max_size_in_bytes); 54237 `` [''''»''' [link boost_asio.reference.buffer.overload8 more...]]`` 54238 54239Create a new non-modifiable buffer that represents the given POD array. 54240 54241 template< 54242 typename PodType, 54243 std::size_t N> 54244 const_buffer ``[link boost_asio.reference.buffer.overload9 buffer]``( 54245 const PodType (&data)[N]); 54246 `` [''''»''' [link boost_asio.reference.buffer.overload9 more...]]`` 54247 54248 template< 54249 typename PodType, 54250 std::size_t N> 54251 const_buffer ``[link boost_asio.reference.buffer.overload10 buffer]``( 54252 const PodType (&data)[N], 54253 std::size_t max_size_in_bytes); 54254 `` [''''»''' [link boost_asio.reference.buffer.overload10 more...]]`` 54255 54256Create a new modifiable buffer that represents the given POD array. 54257 54258 template< 54259 typename PodType, 54260 std::size_t N> 54261 mutable_buffer ``[link boost_asio.reference.buffer.overload11 buffer]``( 54262 boost::array< PodType, N > & data); 54263 `` [''''»''' [link boost_asio.reference.buffer.overload11 more...]]`` 54264 54265 template< 54266 typename PodType, 54267 std::size_t N> 54268 mutable_buffer ``[link boost_asio.reference.buffer.overload12 buffer]``( 54269 boost::array< PodType, N > & data, 54270 std::size_t max_size_in_bytes); 54271 `` [''''»''' [link boost_asio.reference.buffer.overload12 more...]]`` 54272 54273Create a new non-modifiable buffer that represents the given POD array. 54274 54275 template< 54276 typename PodType, 54277 std::size_t N> 54278 const_buffer ``[link boost_asio.reference.buffer.overload13 buffer]``( 54279 boost::array< const PodType, N > & data); 54280 `` [''''»''' [link boost_asio.reference.buffer.overload13 more...]]`` 54281 54282 template< 54283 typename PodType, 54284 std::size_t N> 54285 const_buffer ``[link boost_asio.reference.buffer.overload14 buffer]``( 54286 boost::array< const PodType, N > & data, 54287 std::size_t max_size_in_bytes); 54288 `` [''''»''' [link boost_asio.reference.buffer.overload14 more...]]`` 54289 54290 template< 54291 typename PodType, 54292 std::size_t N> 54293 const_buffer ``[link boost_asio.reference.buffer.overload15 buffer]``( 54294 const boost::array< PodType, N > & data); 54295 `` [''''»''' [link boost_asio.reference.buffer.overload15 more...]]`` 54296 54297 template< 54298 typename PodType, 54299 std::size_t N> 54300 const_buffer ``[link boost_asio.reference.buffer.overload16 buffer]``( 54301 const boost::array< PodType, N > & data, 54302 std::size_t max_size_in_bytes); 54303 `` [''''»''' [link boost_asio.reference.buffer.overload16 more...]]`` 54304 54305Create a new modifiable buffer that represents the given POD array. 54306 54307 template< 54308 typename PodType, 54309 std::size_t N> 54310 mutable_buffer ``[link boost_asio.reference.buffer.overload17 buffer]``( 54311 std::array< PodType, N > & data); 54312 `` [''''»''' [link boost_asio.reference.buffer.overload17 more...]]`` 54313 54314 template< 54315 typename PodType, 54316 std::size_t N> 54317 mutable_buffer ``[link boost_asio.reference.buffer.overload18 buffer]``( 54318 std::array< PodType, N > & data, 54319 std::size_t max_size_in_bytes); 54320 `` [''''»''' [link boost_asio.reference.buffer.overload18 more...]]`` 54321 54322Create a new non-modifiable buffer that represents the given POD array. 54323 54324 template< 54325 typename PodType, 54326 std::size_t N> 54327 const_buffer ``[link boost_asio.reference.buffer.overload19 buffer]``( 54328 std::array< const PodType, N > & data); 54329 `` [''''»''' [link boost_asio.reference.buffer.overload19 more...]]`` 54330 54331 template< 54332 typename PodType, 54333 std::size_t N> 54334 const_buffer ``[link boost_asio.reference.buffer.overload20 buffer]``( 54335 std::array< const PodType, N > & data, 54336 std::size_t max_size_in_bytes); 54337 `` [''''»''' [link boost_asio.reference.buffer.overload20 more...]]`` 54338 54339 template< 54340 typename PodType, 54341 std::size_t N> 54342 const_buffer ``[link boost_asio.reference.buffer.overload21 buffer]``( 54343 const std::array< PodType, N > & data); 54344 `` [''''»''' [link boost_asio.reference.buffer.overload21 more...]]`` 54345 54346 template< 54347 typename PodType, 54348 std::size_t N> 54349 const_buffer ``[link boost_asio.reference.buffer.overload22 buffer]``( 54350 const std::array< PodType, N > & data, 54351 std::size_t max_size_in_bytes); 54352 `` [''''»''' [link boost_asio.reference.buffer.overload22 more...]]`` 54353 54354Create a new modifiable buffer that represents the given POD vector. 54355 54356 template< 54357 typename PodType, 54358 typename Allocator> 54359 mutable_buffer ``[link boost_asio.reference.buffer.overload23 buffer]``( 54360 std::vector< PodType, Allocator > & data); 54361 `` [''''»''' [link boost_asio.reference.buffer.overload23 more...]]`` 54362 54363 template< 54364 typename PodType, 54365 typename Allocator> 54366 mutable_buffer ``[link boost_asio.reference.buffer.overload24 buffer]``( 54367 std::vector< PodType, Allocator > & data, 54368 std::size_t max_size_in_bytes); 54369 `` [''''»''' [link boost_asio.reference.buffer.overload24 more...]]`` 54370 54371Create a new non-modifiable buffer that represents the given POD vector. 54372 54373 template< 54374 typename PodType, 54375 typename Allocator> 54376 const_buffer ``[link boost_asio.reference.buffer.overload25 buffer]``( 54377 const std::vector< PodType, Allocator > & data); 54378 `` [''''»''' [link boost_asio.reference.buffer.overload25 more...]]`` 54379 54380 template< 54381 typename PodType, 54382 typename Allocator> 54383 const_buffer ``[link boost_asio.reference.buffer.overload26 buffer]``( 54384 const std::vector< PodType, Allocator > & data, 54385 std::size_t max_size_in_bytes); 54386 `` [''''»''' [link boost_asio.reference.buffer.overload26 more...]]`` 54387 54388Create a new modifiable buffer that represents the given string. 54389 54390 template< 54391 typename Elem, 54392 typename Traits, 54393 typename Allocator> 54394 mutable_buffer ``[link boost_asio.reference.buffer.overload27 buffer]``( 54395 std::basic_string< Elem, Traits, Allocator > & data); 54396 `` [''''»''' [link boost_asio.reference.buffer.overload27 more...]]`` 54397 54398 template< 54399 typename Elem, 54400 typename Traits, 54401 typename Allocator> 54402 mutable_buffer ``[link boost_asio.reference.buffer.overload28 buffer]``( 54403 std::basic_string< Elem, Traits, Allocator > & data, 54404 std::size_t max_size_in_bytes); 54405 `` [''''»''' [link boost_asio.reference.buffer.overload28 more...]]`` 54406 54407Create a new non-modifiable buffer that represents the given string. 54408 54409 template< 54410 typename Elem, 54411 typename Traits, 54412 typename Allocator> 54413 const_buffer ``[link boost_asio.reference.buffer.overload29 buffer]``( 54414 const std::basic_string< Elem, Traits, Allocator > & data); 54415 `` [''''»''' [link boost_asio.reference.buffer.overload29 more...]]`` 54416 54417 template< 54418 typename Elem, 54419 typename Traits, 54420 typename Allocator> 54421 const_buffer ``[link boost_asio.reference.buffer.overload30 buffer]``( 54422 const std::basic_string< Elem, Traits, Allocator > & data, 54423 std::size_t max_size_in_bytes); 54424 `` [''''»''' [link boost_asio.reference.buffer.overload30 more...]]`` 54425 54426Create a new modifiable buffer that represents the given string\_view. 54427 54428 template< 54429 typename Elem, 54430 typename Traits> 54431 const_buffer ``[link boost_asio.reference.buffer.overload31 buffer]``( 54432 basic_string_view< Elem, Traits > data); 54433 `` [''''»''' [link boost_asio.reference.buffer.overload31 more...]]`` 54434 54435Create a new non-modifiable buffer that represents the given string. 54436 54437 template< 54438 typename Elem, 54439 typename Traits> 54440 const_buffer ``[link boost_asio.reference.buffer.overload32 buffer]``( 54441 basic_string_view< Elem, Traits > data, 54442 std::size_t max_size_in_bytes); 54443 `` [''''»''' [link boost_asio.reference.buffer.overload32 more...]]`` 54444 54445A 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. 54446 54447The simplest use case involves reading or writing a single buffer of a specified size: 54448 54449 54450 54451 sock.send(boost::asio::buffer(data, size)); 54452 54453 54454 54455 54456In 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. 54457 54458An 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: 54459 54460 54461 54462 char d1[128]; 54463 size_t bytes_transferred = sock.receive(boost::asio::buffer(d1)); 54464 54465 std::vector<char> d2(128); 54466 bytes_transferred = sock.receive(boost::asio::buffer(d2)); 54467 54468 std::array<char, 128> d3; 54469 bytes_transferred = sock.receive(boost::asio::buffer(d3)); 54470 54471 boost::array<char, 128> d4; 54472 bytes_transferred = sock.receive(boost::asio::buffer(d4)); 54473 54474 54475 54476 54477In 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. 54478 54479 54480[heading Accessing Buffer Contents] 54481 54482 54483 54484The contents of a buffer may be accessed using the `data()` and `size()` member functions: 54485 54486 54487 54488 boost::asio::mutable_buffer b1 = ...; 54489 std::size_t s1 = b1.size(); 54490 unsigned char* p1 = static_cast<unsigned char*>(b1.data()); 54491 54492 boost::asio::const_buffer b2 = ...; 54493 std::size_t s2 = b2.size(); 54494 const void* p2 = b2.data(); 54495 54496 54497 54498 54499The `data()` member function permits violations of type safety, so uses of it in application code should be carefully considered. 54500 54501For 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. 54502 54503 54504[heading Buffer Copying] 54505 54506 54507 54508The [link boost_asio.reference.buffer_copy `buffer_copy`] function may be used to copy raw bytes between individual buffers and buffer sequences. 54509 54510In 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: 54511 54512 54513 54514 vector<const_buffer> buffers = ...; 54515 54516 vector<unsigned char> data(boost::asio::buffer_size(buffers)); 54517 boost::asio::buffer_copy(boost::asio::buffer(data), buffers); 54518 54519 54520 54521 54522Note 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. 54523 54524 54525[heading Buffer Invalidation] 54526 54527 54528 54529A 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. 54530 54531For 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) 54532 54533For 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). 54534 54535 54536[heading Buffer Arithmetic] 54537 54538 54539 54540Buffer objects may be manipulated using simple arithmetic in a safe way which helps prevent buffer overruns. Consider an array initialised as follows: 54541 54542 54543 54544 boost::array<char, 6> a = { 'a', 'b', 'c', 'd', 'e' }; 54545 54546 54547 54548 54549A buffer object `b1` created using: 54550 54551 54552 54553 b1 = boost::asio::buffer(a); 54554 54555 54556 54557 54558represents 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: 54559 54560 54561 54562 b2 = boost::asio::buffer(a, 3); 54563 54564 54565 54566 54567such 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. 54568 54569An offset may be applied to an existing buffer to create a new one: 54570 54571 54572 54573 b3 = b1 + 2; 54574 54575 54576 54577 54578where `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. 54579 54580Both an offset and size may be specified to create a buffer that corresponds to a specific range of bytes within an existing buffer: 54581 54582 54583 54584 b4 = boost::asio::buffer(b1 + 1, 3); 54585 54586 54587 54588 54589so that `b4` will refer to the bytes `{ 'b', 'c', 'd' }`. 54590 54591 54592[heading Buffers and Scatter-Gather I/O] 54593 54594 54595 54596To 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: 54597 54598 54599 54600 char d1[128]; 54601 std::vector<char> d2(128); 54602 boost::array<char, 128> d3; 54603 54604 boost::array<mutable_buffer, 3> bufs1 = { 54605 boost::asio::buffer(d1), 54606 boost::asio::buffer(d2), 54607 boost::asio::buffer(d3) }; 54608 bytes_transferred = sock.receive(bufs1); 54609 54610 std::vector<const_buffer> bufs2; 54611 bufs2.push_back(boost::asio::buffer(d1)); 54612 bufs2.push_back(boost::asio::buffer(d2)); 54613 bufs2.push_back(boost::asio::buffer(d3)); 54614 bytes_transferred = sock.send(bufs2); 54615 54616 54617 54618 54619[heading Requirements] 54620 54621['Header: ][^boost/asio/buffer.hpp] 54622 54623['Convenience header: ][^boost/asio.hpp] 54624 54625 54626[section:overload1 buffer (1 of 32 overloads)] 54627 54628 54629Create a new modifiable buffer from an existing buffer. 54630 54631 54632 mutable_buffer buffer( 54633 const mutable_buffer & b); 54634 54635 54636 54637[heading Return Value] 54638 54639`mutable_buffer(b)`. 54640 54641 54642 54643 54644[endsect] 54645 54646 54647 54648[section:overload2 buffer (2 of 32 overloads)] 54649 54650 54651Create a new modifiable buffer from an existing buffer. 54652 54653 54654 mutable_buffer buffer( 54655 const mutable_buffer & b, 54656 std::size_t max_size_in_bytes); 54657 54658 54659 54660[heading Return Value] 54661 54662A [link boost_asio.reference.mutable_buffer `mutable_buffer`] value equivalent to: 54663 54664 mutable_buffer( 54665 b.data(), 54666 min(b.size(), max_size_in_bytes)); 54667 54668 54669 54670 54671 54672 54673 54674[endsect] 54675 54676 54677 54678[section:overload3 buffer (3 of 32 overloads)] 54679 54680 54681Create a new non-modifiable buffer from an existing buffer. 54682 54683 54684 const_buffer buffer( 54685 const const_buffer & b); 54686 54687 54688 54689[heading Return Value] 54690 54691`const_buffer(b)`. 54692 54693 54694 54695 54696[endsect] 54697 54698 54699 54700[section:overload4 buffer (4 of 32 overloads)] 54701 54702 54703Create a new non-modifiable buffer from an existing buffer. 54704 54705 54706 const_buffer buffer( 54707 const const_buffer & b, 54708 std::size_t max_size_in_bytes); 54709 54710 54711 54712[heading Return Value] 54713 54714A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to: 54715 54716 const_buffer( 54717 b.data(), 54718 min(b.size(), max_size_in_bytes)); 54719 54720 54721 54722 54723 54724 54725 54726[endsect] 54727 54728 54729 54730[section:overload5 buffer (5 of 32 overloads)] 54731 54732 54733Create a new modifiable buffer that represents the given memory range. 54734 54735 54736 mutable_buffer buffer( 54737 void * data, 54738 std::size_t size_in_bytes); 54739 54740 54741 54742[heading Return Value] 54743 54744`mutable_buffer(data, size_in_bytes)`. 54745 54746 54747 54748 54749[endsect] 54750 54751 54752 54753[section:overload6 buffer (6 of 32 overloads)] 54754 54755 54756Create a new non-modifiable buffer that represents the given memory range. 54757 54758 54759 const_buffer buffer( 54760 const void * data, 54761 std::size_t size_in_bytes); 54762 54763 54764 54765[heading Return Value] 54766 54767`const_buffer(data, size_in_bytes)`. 54768 54769 54770 54771 54772[endsect] 54773 54774 54775 54776[section:overload7 buffer (7 of 32 overloads)] 54777 54778 54779Create a new modifiable buffer that represents the given POD array. 54780 54781 54782 template< 54783 typename PodType, 54784 std::size_t N> 54785 mutable_buffer buffer( 54786 PodType (&data)[N]); 54787 54788 54789 54790[heading Return Value] 54791 54792A [link boost_asio.reference.mutable_buffer `mutable_buffer`] value equivalent to: 54793 54794 mutable_buffer( 54795 static_cast<void*>(data), 54796 N * sizeof(PodType)); 54797 54798 54799 54800 54801 54802 54803 54804[endsect] 54805 54806 54807 54808[section:overload8 buffer (8 of 32 overloads)] 54809 54810 54811Create a new modifiable buffer that represents the given POD array. 54812 54813 54814 template< 54815 typename PodType, 54816 std::size_t N> 54817 mutable_buffer buffer( 54818 PodType (&data)[N], 54819 std::size_t max_size_in_bytes); 54820 54821 54822 54823[heading Return Value] 54824 54825A [link boost_asio.reference.mutable_buffer `mutable_buffer`] value equivalent to: 54826 54827 mutable_buffer( 54828 static_cast<void*>(data), 54829 min(N * sizeof(PodType), max_size_in_bytes)); 54830 54831 54832 54833 54834 54835 54836 54837[endsect] 54838 54839 54840 54841[section:overload9 buffer (9 of 32 overloads)] 54842 54843 54844Create a new non-modifiable buffer that represents the given POD array. 54845 54846 54847 template< 54848 typename PodType, 54849 std::size_t N> 54850 const_buffer buffer( 54851 const PodType (&data)[N]); 54852 54853 54854 54855[heading Return Value] 54856 54857A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to: 54858 54859 const_buffer( 54860 static_cast<const void*>(data), 54861 N * sizeof(PodType)); 54862 54863 54864 54865 54866 54867 54868 54869[endsect] 54870 54871 54872 54873[section:overload10 buffer (10 of 32 overloads)] 54874 54875 54876Create a new non-modifiable buffer that represents the given POD array. 54877 54878 54879 template< 54880 typename PodType, 54881 std::size_t N> 54882 const_buffer buffer( 54883 const PodType (&data)[N], 54884 std::size_t max_size_in_bytes); 54885 54886 54887 54888[heading Return Value] 54889 54890A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to: 54891 54892 const_buffer( 54893 static_cast<const void*>(data), 54894 min(N * sizeof(PodType), max_size_in_bytes)); 54895 54896 54897 54898 54899 54900 54901 54902[endsect] 54903 54904 54905 54906[section:overload11 buffer (11 of 32 overloads)] 54907 54908 54909Create a new modifiable buffer that represents the given POD array. 54910 54911 54912 template< 54913 typename PodType, 54914 std::size_t N> 54915 mutable_buffer buffer( 54916 boost::array< PodType, N > & data); 54917 54918 54919 54920[heading Return Value] 54921 54922A [link boost_asio.reference.mutable_buffer `mutable_buffer`] value equivalent to: 54923 54924 mutable_buffer( 54925 data.data(), 54926 data.size() * sizeof(PodType)); 54927 54928 54929 54930 54931 54932 54933 54934[endsect] 54935 54936 54937 54938[section:overload12 buffer (12 of 32 overloads)] 54939 54940 54941Create a new modifiable buffer that represents the given POD array. 54942 54943 54944 template< 54945 typename PodType, 54946 std::size_t N> 54947 mutable_buffer buffer( 54948 boost::array< PodType, N > & data, 54949 std::size_t max_size_in_bytes); 54950 54951 54952 54953[heading Return Value] 54954 54955A [link boost_asio.reference.mutable_buffer `mutable_buffer`] value equivalent to: 54956 54957 mutable_buffer( 54958 data.data(), 54959 min(data.size() * sizeof(PodType), max_size_in_bytes)); 54960 54961 54962 54963 54964 54965 54966 54967[endsect] 54968 54969 54970 54971[section:overload13 buffer (13 of 32 overloads)] 54972 54973 54974Create a new non-modifiable buffer that represents the given POD array. 54975 54976 54977 template< 54978 typename PodType, 54979 std::size_t N> 54980 const_buffer buffer( 54981 boost::array< const PodType, N > & data); 54982 54983 54984 54985[heading Return Value] 54986 54987A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to: 54988 54989 const_buffer( 54990 data.data(), 54991 data.size() * sizeof(PodType)); 54992 54993 54994 54995 54996 54997 54998 54999[endsect] 55000 55001 55002 55003[section:overload14 buffer (14 of 32 overloads)] 55004 55005 55006Create a new non-modifiable buffer that represents the given POD array. 55007 55008 55009 template< 55010 typename PodType, 55011 std::size_t N> 55012 const_buffer buffer( 55013 boost::array< const PodType, N > & data, 55014 std::size_t max_size_in_bytes); 55015 55016 55017 55018[heading Return Value] 55019 55020A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to: 55021 55022 const_buffer( 55023 data.data(), 55024 min(data.size() * sizeof(PodType), max_size_in_bytes)); 55025 55026 55027 55028 55029 55030 55031 55032[endsect] 55033 55034 55035 55036[section:overload15 buffer (15 of 32 overloads)] 55037 55038 55039Create a new non-modifiable buffer that represents the given POD array. 55040 55041 55042 template< 55043 typename PodType, 55044 std::size_t N> 55045 const_buffer buffer( 55046 const boost::array< PodType, N > & data); 55047 55048 55049 55050[heading Return Value] 55051 55052A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to: 55053 55054 const_buffer( 55055 data.data(), 55056 data.size() * sizeof(PodType)); 55057 55058 55059 55060 55061 55062 55063 55064[endsect] 55065 55066 55067 55068[section:overload16 buffer (16 of 32 overloads)] 55069 55070 55071Create a new non-modifiable buffer that represents the given POD array. 55072 55073 55074 template< 55075 typename PodType, 55076 std::size_t N> 55077 const_buffer buffer( 55078 const boost::array< PodType, N > & data, 55079 std::size_t max_size_in_bytes); 55080 55081 55082 55083[heading Return Value] 55084 55085A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to: 55086 55087 const_buffer( 55088 data.data(), 55089 min(data.size() * sizeof(PodType), max_size_in_bytes)); 55090 55091 55092 55093 55094 55095 55096 55097[endsect] 55098 55099 55100 55101[section:overload17 buffer (17 of 32 overloads)] 55102 55103 55104Create a new modifiable buffer that represents the given POD array. 55105 55106 55107 template< 55108 typename PodType, 55109 std::size_t N> 55110 mutable_buffer buffer( 55111 std::array< PodType, N > & data); 55112 55113 55114 55115[heading Return Value] 55116 55117A [link boost_asio.reference.mutable_buffer `mutable_buffer`] value equivalent to: 55118 55119 mutable_buffer( 55120 data.data(), 55121 data.size() * sizeof(PodType)); 55122 55123 55124 55125 55126 55127 55128 55129[endsect] 55130 55131 55132 55133[section:overload18 buffer (18 of 32 overloads)] 55134 55135 55136Create a new modifiable buffer that represents the given POD array. 55137 55138 55139 template< 55140 typename PodType, 55141 std::size_t N> 55142 mutable_buffer buffer( 55143 std::array< PodType, N > & data, 55144 std::size_t max_size_in_bytes); 55145 55146 55147 55148[heading Return Value] 55149 55150A [link boost_asio.reference.mutable_buffer `mutable_buffer`] value equivalent to: 55151 55152 mutable_buffer( 55153 data.data(), 55154 min(data.size() * sizeof(PodType), max_size_in_bytes)); 55155 55156 55157 55158 55159 55160 55161 55162[endsect] 55163 55164 55165 55166[section:overload19 buffer (19 of 32 overloads)] 55167 55168 55169Create a new non-modifiable buffer that represents the given POD array. 55170 55171 55172 template< 55173 typename PodType, 55174 std::size_t N> 55175 const_buffer buffer( 55176 std::array< const PodType, N > & data); 55177 55178 55179 55180[heading Return Value] 55181 55182A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to: 55183 55184 const_buffer( 55185 data.data(), 55186 data.size() * sizeof(PodType)); 55187 55188 55189 55190 55191 55192 55193 55194[endsect] 55195 55196 55197 55198[section:overload20 buffer (20 of 32 overloads)] 55199 55200 55201Create a new non-modifiable buffer that represents the given POD array. 55202 55203 55204 template< 55205 typename PodType, 55206 std::size_t N> 55207 const_buffer buffer( 55208 std::array< const PodType, N > & data, 55209 std::size_t max_size_in_bytes); 55210 55211 55212 55213[heading Return Value] 55214 55215A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to: 55216 55217 const_buffer( 55218 data.data(), 55219 min(data.size() * sizeof(PodType), max_size_in_bytes)); 55220 55221 55222 55223 55224 55225 55226 55227[endsect] 55228 55229 55230 55231[section:overload21 buffer (21 of 32 overloads)] 55232 55233 55234Create a new non-modifiable buffer that represents the given POD array. 55235 55236 55237 template< 55238 typename PodType, 55239 std::size_t N> 55240 const_buffer buffer( 55241 const std::array< PodType, N > & data); 55242 55243 55244 55245[heading Return Value] 55246 55247A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to: 55248 55249 const_buffer( 55250 data.data(), 55251 data.size() * sizeof(PodType)); 55252 55253 55254 55255 55256 55257 55258 55259[endsect] 55260 55261 55262 55263[section:overload22 buffer (22 of 32 overloads)] 55264 55265 55266Create a new non-modifiable buffer that represents the given POD array. 55267 55268 55269 template< 55270 typename PodType, 55271 std::size_t N> 55272 const_buffer buffer( 55273 const std::array< PodType, N > & data, 55274 std::size_t max_size_in_bytes); 55275 55276 55277 55278[heading Return Value] 55279 55280A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to: 55281 55282 const_buffer( 55283 data.data(), 55284 min(data.size() * sizeof(PodType), max_size_in_bytes)); 55285 55286 55287 55288 55289 55290 55291 55292[endsect] 55293 55294 55295 55296[section:overload23 buffer (23 of 32 overloads)] 55297 55298 55299Create a new modifiable buffer that represents the given POD vector. 55300 55301 55302 template< 55303 typename PodType, 55304 typename Allocator> 55305 mutable_buffer buffer( 55306 std::vector< PodType, Allocator > & data); 55307 55308 55309 55310[heading Return Value] 55311 55312A [link boost_asio.reference.mutable_buffer `mutable_buffer`] value equivalent to: 55313 55314 mutable_buffer( 55315 data.size() ? &data[0] : 0, 55316 data.size() * sizeof(PodType)); 55317 55318 55319 55320 55321 55322[heading Remarks] 55323 55324The buffer is invalidated by any vector operation that would also invalidate iterators. 55325 55326 55327 55328 55329[endsect] 55330 55331 55332 55333[section:overload24 buffer (24 of 32 overloads)] 55334 55335 55336Create a new modifiable buffer that represents the given POD vector. 55337 55338 55339 template< 55340 typename PodType, 55341 typename Allocator> 55342 mutable_buffer buffer( 55343 std::vector< PodType, Allocator > & data, 55344 std::size_t max_size_in_bytes); 55345 55346 55347 55348[heading Return Value] 55349 55350A [link boost_asio.reference.mutable_buffer `mutable_buffer`] value equivalent to: 55351 55352 mutable_buffer( 55353 data.size() ? &data[0] : 0, 55354 min(data.size() * sizeof(PodType), max_size_in_bytes)); 55355 55356 55357 55358 55359 55360[heading Remarks] 55361 55362The buffer is invalidated by any vector operation that would also invalidate iterators. 55363 55364 55365 55366 55367[endsect] 55368 55369 55370 55371[section:overload25 buffer (25 of 32 overloads)] 55372 55373 55374Create a new non-modifiable buffer that represents the given POD vector. 55375 55376 55377 template< 55378 typename PodType, 55379 typename Allocator> 55380 const_buffer buffer( 55381 const std::vector< PodType, Allocator > & data); 55382 55383 55384 55385[heading Return Value] 55386 55387A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to: 55388 55389 const_buffer( 55390 data.size() ? &data[0] : 0, 55391 data.size() * sizeof(PodType)); 55392 55393 55394 55395 55396 55397[heading Remarks] 55398 55399The buffer is invalidated by any vector operation that would also invalidate iterators. 55400 55401 55402 55403 55404[endsect] 55405 55406 55407 55408[section:overload26 buffer (26 of 32 overloads)] 55409 55410 55411Create a new non-modifiable buffer that represents the given POD vector. 55412 55413 55414 template< 55415 typename PodType, 55416 typename Allocator> 55417 const_buffer buffer( 55418 const std::vector< PodType, Allocator > & data, 55419 std::size_t max_size_in_bytes); 55420 55421 55422 55423[heading Return Value] 55424 55425A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to: 55426 55427 const_buffer( 55428 data.size() ? &data[0] : 0, 55429 min(data.size() * sizeof(PodType), max_size_in_bytes)); 55430 55431 55432 55433 55434 55435[heading Remarks] 55436 55437The buffer is invalidated by any vector operation that would also invalidate iterators. 55438 55439 55440 55441 55442[endsect] 55443 55444 55445 55446[section:overload27 buffer (27 of 32 overloads)] 55447 55448 55449Create a new modifiable buffer that represents the given string. 55450 55451 55452 template< 55453 typename Elem, 55454 typename Traits, 55455 typename Allocator> 55456 mutable_buffer buffer( 55457 std::basic_string< Elem, Traits, Allocator > & data); 55458 55459 55460 55461[heading Return Value] 55462 55463`mutable_buffer(data.size() ? &data[0] : 0, data.size() * sizeof(Elem))`. 55464 55465 55466[heading Remarks] 55467 55468The buffer is invalidated by any non-const operation called on the given string object. 55469 55470 55471 55472 55473[endsect] 55474 55475 55476 55477[section:overload28 buffer (28 of 32 overloads)] 55478 55479 55480Create a new modifiable buffer that represents the given string. 55481 55482 55483 template< 55484 typename Elem, 55485 typename Traits, 55486 typename Allocator> 55487 mutable_buffer buffer( 55488 std::basic_string< Elem, Traits, Allocator > & data, 55489 std::size_t max_size_in_bytes); 55490 55491 55492 55493[heading Return Value] 55494 55495A [link boost_asio.reference.mutable_buffer `mutable_buffer`] value equivalent to: 55496 55497 mutable_buffer( 55498 data.size() ? &data[0] : 0, 55499 min(data.size() * sizeof(Elem), max_size_in_bytes)); 55500 55501 55502 55503 55504 55505[heading Remarks] 55506 55507The buffer is invalidated by any non-const operation called on the given string object. 55508 55509 55510 55511 55512[endsect] 55513 55514 55515 55516[section:overload29 buffer (29 of 32 overloads)] 55517 55518 55519Create a new non-modifiable buffer that represents the given string. 55520 55521 55522 template< 55523 typename Elem, 55524 typename Traits, 55525 typename Allocator> 55526 const_buffer buffer( 55527 const std::basic_string< Elem, Traits, Allocator > & data); 55528 55529 55530 55531[heading Return Value] 55532 55533`const_buffer(data.data(), data.size() * sizeof(Elem))`. 55534 55535 55536[heading Remarks] 55537 55538The buffer is invalidated by any non-const operation called on the given string object. 55539 55540 55541 55542 55543[endsect] 55544 55545 55546 55547[section:overload30 buffer (30 of 32 overloads)] 55548 55549 55550Create a new non-modifiable buffer that represents the given string. 55551 55552 55553 template< 55554 typename Elem, 55555 typename Traits, 55556 typename Allocator> 55557 const_buffer buffer( 55558 const std::basic_string< Elem, Traits, Allocator > & data, 55559 std::size_t max_size_in_bytes); 55560 55561 55562 55563[heading Return Value] 55564 55565A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to: 55566 55567 const_buffer( 55568 data.data(), 55569 min(data.size() * sizeof(Elem), max_size_in_bytes)); 55570 55571 55572 55573 55574 55575[heading Remarks] 55576 55577The buffer is invalidated by any non-const operation called on the given string object. 55578 55579 55580 55581 55582[endsect] 55583 55584 55585 55586[section:overload31 buffer (31 of 32 overloads)] 55587 55588 55589Create a new modifiable buffer that represents the given string\_view. 55590 55591 55592 template< 55593 typename Elem, 55594 typename Traits> 55595 const_buffer buffer( 55596 basic_string_view< Elem, Traits > data); 55597 55598 55599 55600[heading Return Value] 55601 55602`mutable_buffer(data.size() ? &data[0] : 0, data.size() * sizeof(Elem))`. 55603 55604 55605 55606 55607[endsect] 55608 55609 55610 55611[section:overload32 buffer (32 of 32 overloads)] 55612 55613 55614Create a new non-modifiable buffer that represents the given string. 55615 55616 55617 template< 55618 typename Elem, 55619 typename Traits> 55620 const_buffer buffer( 55621 basic_string_view< Elem, Traits > data, 55622 std::size_t max_size_in_bytes); 55623 55624 55625 55626[heading Return Value] 55627 55628A [link boost_asio.reference.mutable_buffer `mutable_buffer`] value equivalent to: 55629 55630 mutable_buffer( 55631 data.size() ? &data[0] : 0, 55632 min(data.size() * sizeof(Elem), max_size_in_bytes)); 55633 55634 55635 55636 55637 55638 55639 55640[endsect] 55641 55642 55643[endsect] 55644 55645[section:buffer_cast buffer_cast] 55646 55647[indexterm1 boost_asio.indexterm.buffer_cast..buffer_cast] 55648(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. 55649 55650 55651Cast a non-modifiable buffer to a specified pointer to POD type. 55652 55653 template< 55654 typename PointerToPodType> 55655 PointerToPodType ``[link boost_asio.reference.buffer_cast.overload1 buffer_cast]``( 55656 const mutable_buffer & b); 55657 `` [''''»''' [link boost_asio.reference.buffer_cast.overload1 more...]]`` 55658 55659 template< 55660 typename PointerToPodType> 55661 PointerToPodType ``[link boost_asio.reference.buffer_cast.overload2 buffer_cast]``( 55662 const const_buffer & b); 55663 `` [''''»''' [link boost_asio.reference.buffer_cast.overload2 more...]]`` 55664 55665 55666[heading Examples:] 55667 55668 55669 55670To access the memory of a non-modifiable buffer, use: 55671 55672 boost::asio::const_buffer b1 = ...; 55673 const unsigned char* p1 = boost::asio::buffer_cast<const unsigned char*>(b1); 55674 55675 55676 55677 55678To access the memory of a modifiable buffer, use: 55679 55680 boost::asio::mutable_buffer b2 = ...; 55681 unsigned char* p2 = boost::asio::buffer_cast<unsigned char*>(b2); 55682 55683 55684 55685 55686The `boost::asio::buffer_cast` function permits violations of type safety, so uses of it in application code should be carefully considered. 55687 55688[heading Requirements] 55689 55690['Header: ][^boost/asio/buffer.hpp] 55691 55692['Convenience header: ][^boost/asio.hpp] 55693 55694 55695[section:overload1 buffer_cast (1 of 2 overloads)] 55696 55697 55698Cast a non-modifiable buffer to a specified pointer to POD type. 55699 55700 55701 template< 55702 typename PointerToPodType> 55703 PointerToPodType buffer_cast( 55704 const mutable_buffer & b); 55705 55706 55707 55708[endsect] 55709 55710 55711 55712[section:overload2 buffer_cast (2 of 2 overloads)] 55713 55714 55715Cast a non-modifiable buffer to a specified pointer to POD type. 55716 55717 55718 template< 55719 typename PointerToPodType> 55720 PointerToPodType buffer_cast( 55721 const const_buffer & b); 55722 55723 55724 55725[endsect] 55726 55727 55728[endsect] 55729 55730[section:buffer_copy buffer_copy] 55731 55732[indexterm1 boost_asio.indexterm.buffer_copy..buffer_copy] 55733The `boost::asio::buffer_copy` function is used to copy bytes from a source buffer (or buffer sequence) to a target buffer (or buffer sequence). 55734 55735 55736Copies bytes from a source buffer sequence to a target buffer sequence. 55737 55738 template< 55739 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 55740 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 55741 std::size_t ``[link boost_asio.reference.buffer_copy.overload1 buffer_copy]``( 55742 const MutableBufferSequence & target, 55743 const ConstBufferSequence & source); 55744 `` [''''»''' [link boost_asio.reference.buffer_copy.overload1 more...]]`` 55745 55746Copies a limited number of bytes from a source buffer sequence to a target buffer sequence. 55747 55748 template< 55749 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 55750 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 55751 std::size_t ``[link boost_asio.reference.buffer_copy.overload2 buffer_copy]``( 55752 const MutableBufferSequence & target, 55753 const ConstBufferSequence & source, 55754 std::size_t max_bytes_to_copy); 55755 `` [''''»''' [link boost_asio.reference.buffer_copy.overload2 more...]]`` 55756 55757The `buffer_copy` function is available in two forms: 55758 55759 55760* A 2-argument form: `buffer_copy(target, source)` 55761 55762 55763* A 3-argument form: `buffer_copy(target, source, max_bytes_to_copy)` 55764 55765Both forms return the number of bytes actually copied. The number of bytes copied is the lesser of: 55766 55767 55768* `buffer_size(target)` 55769 55770 55771* `buffer_size(source)` 55772 55773 55774* `If` specified, `max_bytes_to_copy`. 55775 55776This prevents buffer overflow, regardless of the buffer sizes used in the copy operation. 55777 55778Note 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. 55779 55780[heading Requirements] 55781 55782['Header: ][^boost/asio/buffer.hpp] 55783 55784['Convenience header: ][^boost/asio.hpp] 55785 55786 55787[section:overload1 buffer_copy (1 of 2 overloads)] 55788 55789 55790Copies bytes from a source buffer sequence to a target buffer sequence. 55791 55792 55793 template< 55794 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 55795 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 55796 std::size_t buffer_copy( 55797 const MutableBufferSequence & target, 55798 const ConstBufferSequence & source); 55799 55800 55801 55802[heading Parameters] 55803 55804 55805[variablelist 55806 55807[[target][A modifiable buffer sequence representing the memory regions to which the bytes will be copied.]] 55808 55809[[source][A non-modifiable buffer sequence representing the memory regions from which the bytes will be copied.]] 55810 55811] 55812 55813 55814[heading Return Value] 55815 55816The number of bytes copied. 55817 55818 55819[heading Remarks] 55820 55821The number of bytes copied is the lesser of: 55822 55823 55824* `buffer_size(target)` 55825 55826 55827* `buffer_size(source)` 55828 55829This function is implemented in terms of `memcpy`, and consequently it cannot be used to copy between overlapping memory regions. 55830 55831 55832[endsect] 55833 55834 55835 55836[section:overload2 buffer_copy (2 of 2 overloads)] 55837 55838 55839Copies a limited number of bytes from a source buffer sequence to a target buffer sequence. 55840 55841 55842 template< 55843 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 55844 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 55845 std::size_t buffer_copy( 55846 const MutableBufferSequence & target, 55847 const ConstBufferSequence & source, 55848 std::size_t max_bytes_to_copy); 55849 55850 55851 55852[heading Parameters] 55853 55854 55855[variablelist 55856 55857[[target][A modifiable buffer sequence representing the memory regions to which the bytes will be copied.]] 55858 55859[[source][A non-modifiable buffer sequence representing the memory regions from which the bytes will be copied.]] 55860 55861[[max_bytes_to_copy][The maximum number of bytes to be copied.]] 55862 55863] 55864 55865 55866[heading Return Value] 55867 55868The number of bytes copied. 55869 55870 55871[heading Remarks] 55872 55873The number of bytes copied is the lesser of: 55874 55875 55876* `buffer_size(target)` 55877 55878 55879* `buffer_size(source)` 55880 55881 55882* `max_bytes_to_copy` 55883 55884This function is implemented in terms of `memcpy`, and consequently it cannot be used to copy between overlapping memory regions. 55885 55886 55887[endsect] 55888 55889 55890[endsect] 55891 55892[section:buffer_sequence_begin buffer_sequence_begin] 55893 55894[indexterm1 boost_asio.indexterm.buffer_sequence_begin..buffer_sequence_begin] 55895The `boost::asio::buffer_sequence_begin` function returns an iterator pointing to the first element in a buffer sequence. 55896 55897 55898Get an iterator to the first element in a buffer sequence. 55899 55900 template< 55901 typename MutableBuffer> 55902 const mutable_buffer * ``[link boost_asio.reference.buffer_sequence_begin.overload1 buffer_sequence_begin]``( 55903 const MutableBuffer & b, 55904 typename constraint< is_convertible< const MutableBuffer *, const mutable_buffer * >::value >::type = 0); 55905 `` [''''»''' [link boost_asio.reference.buffer_sequence_begin.overload1 more...]]`` 55906 55907 template< 55908 typename ConstBuffer> 55909 const const_buffer * ``[link boost_asio.reference.buffer_sequence_begin.overload2 buffer_sequence_begin]``( 55910 const ConstBuffer & b, 55911 typename constraint< is_convertible< const ConstBuffer *, const const_buffer * >::value >::type = 0); 55912 `` [''''»''' [link boost_asio.reference.buffer_sequence_begin.overload2 more...]]`` 55913 55914 template< 55915 typename C> 55916 auto ``[link boost_asio.reference.buffer_sequence_begin.overload3 buffer_sequence_begin]``( 55917 C & c, 55918 typename constraint< !is_convertible< const C *, const mutable_buffer * >::value &&!is_convertible< const C *, const const_buffer * >::value >::type = 0); 55919 `` [''''»''' [link boost_asio.reference.buffer_sequence_begin.overload3 more...]]`` 55920 55921 template< 55922 typename C> 55923 auto ``[link boost_asio.reference.buffer_sequence_begin.overload4 buffer_sequence_begin]``( 55924 const C & c, 55925 typename constraint< !is_convertible< const C *, const mutable_buffer * >::value &&!is_convertible< const C *, const const_buffer * >::value >::type = 0); 55926 `` [''''»''' [link boost_asio.reference.buffer_sequence_begin.overload4 more...]]`` 55927 55928[heading Requirements] 55929 55930['Header: ][^boost/asio/buffer.hpp] 55931 55932['Convenience header: ][^boost/asio.hpp] 55933 55934 55935[section:overload1 buffer_sequence_begin (1 of 4 overloads)] 55936 55937 55938Get an iterator to the first element in a buffer sequence. 55939 55940 55941 template< 55942 typename MutableBuffer> 55943 const mutable_buffer * buffer_sequence_begin( 55944 const MutableBuffer & b, 55945 typename constraint< is_convertible< const MutableBuffer *, const mutable_buffer * >::value >::type = 0); 55946 55947 55948 55949[endsect] 55950 55951 55952 55953[section:overload2 buffer_sequence_begin (2 of 4 overloads)] 55954 55955 55956Get an iterator to the first element in a buffer sequence. 55957 55958 55959 template< 55960 typename ConstBuffer> 55961 const const_buffer * buffer_sequence_begin( 55962 const ConstBuffer & b, 55963 typename constraint< is_convertible< const ConstBuffer *, const const_buffer * >::value >::type = 0); 55964 55965 55966 55967[endsect] 55968 55969 55970 55971[section:overload3 buffer_sequence_begin (3 of 4 overloads)] 55972 55973 55974Get an iterator to the first element in a buffer sequence. 55975 55976 55977 template< 55978 typename C> 55979 auto buffer_sequence_begin( 55980 C & c, 55981 typename constraint< !is_convertible< const C *, const mutable_buffer * >::value &&!is_convertible< const C *, const const_buffer * >::value >::type = 0); 55982 55983 55984 55985[endsect] 55986 55987 55988 55989[section:overload4 buffer_sequence_begin (4 of 4 overloads)] 55990 55991 55992Get an iterator to the first element in a buffer sequence. 55993 55994 55995 template< 55996 typename C> 55997 auto buffer_sequence_begin( 55998 const C & c, 55999 typename constraint< !is_convertible< const C *, const mutable_buffer * >::value &&!is_convertible< const C *, const const_buffer * >::value >::type = 0); 56000 56001 56002 56003[endsect] 56004 56005 56006[endsect] 56007 56008[section:buffer_sequence_end buffer_sequence_end] 56009 56010[indexterm1 boost_asio.indexterm.buffer_sequence_end..buffer_sequence_end] 56011The `boost::asio::buffer_sequence_end` function returns an iterator pointing to one past the end element in a buffer sequence. 56012 56013 56014Get an iterator to one past the end element in a buffer sequence. 56015 56016 template< 56017 typename MutableBuffer> 56018 const mutable_buffer * ``[link boost_asio.reference.buffer_sequence_end.overload1 buffer_sequence_end]``( 56019 const MutableBuffer & b, 56020 typename constraint< is_convertible< const MutableBuffer *, const mutable_buffer * >::value >::type = 0); 56021 `` [''''»''' [link boost_asio.reference.buffer_sequence_end.overload1 more...]]`` 56022 56023 template< 56024 typename ConstBuffer> 56025 const const_buffer * ``[link boost_asio.reference.buffer_sequence_end.overload2 buffer_sequence_end]``( 56026 const ConstBuffer & b, 56027 typename constraint< is_convertible< const ConstBuffer *, const const_buffer * >::value >::type = 0); 56028 `` [''''»''' [link boost_asio.reference.buffer_sequence_end.overload2 more...]]`` 56029 56030 template< 56031 typename C> 56032 auto ``[link boost_asio.reference.buffer_sequence_end.overload3 buffer_sequence_end]``( 56033 C & c, 56034 typename constraint< !is_convertible< const C *, const mutable_buffer * >::value &&!is_convertible< const C *, const const_buffer * >::value >::type = 0); 56035 `` [''''»''' [link boost_asio.reference.buffer_sequence_end.overload3 more...]]`` 56036 56037 template< 56038 typename C> 56039 auto ``[link boost_asio.reference.buffer_sequence_end.overload4 buffer_sequence_end]``( 56040 const C & c, 56041 typename constraint< !is_convertible< const C *, const mutable_buffer * >::value &&!is_convertible< const C *, const const_buffer * >::value >::type = 0); 56042 `` [''''»''' [link boost_asio.reference.buffer_sequence_end.overload4 more...]]`` 56043 56044[heading Requirements] 56045 56046['Header: ][^boost/asio/buffer.hpp] 56047 56048['Convenience header: ][^boost/asio.hpp] 56049 56050 56051[section:overload1 buffer_sequence_end (1 of 4 overloads)] 56052 56053 56054Get an iterator to one past the end element in a buffer sequence. 56055 56056 56057 template< 56058 typename MutableBuffer> 56059 const mutable_buffer * buffer_sequence_end( 56060 const MutableBuffer & b, 56061 typename constraint< is_convertible< const MutableBuffer *, const mutable_buffer * >::value >::type = 0); 56062 56063 56064 56065[endsect] 56066 56067 56068 56069[section:overload2 buffer_sequence_end (2 of 4 overloads)] 56070 56071 56072Get an iterator to one past the end element in a buffer sequence. 56073 56074 56075 template< 56076 typename ConstBuffer> 56077 const const_buffer * buffer_sequence_end( 56078 const ConstBuffer & b, 56079 typename constraint< is_convertible< const ConstBuffer *, const const_buffer * >::value >::type = 0); 56080 56081 56082 56083[endsect] 56084 56085 56086 56087[section:overload3 buffer_sequence_end (3 of 4 overloads)] 56088 56089 56090Get an iterator to one past the end element in a buffer sequence. 56091 56092 56093 template< 56094 typename C> 56095 auto buffer_sequence_end( 56096 C & c, 56097 typename constraint< !is_convertible< const C *, const mutable_buffer * >::value &&!is_convertible< const C *, const const_buffer * >::value >::type = 0); 56098 56099 56100 56101[endsect] 56102 56103 56104 56105[section:overload4 buffer_sequence_end (4 of 4 overloads)] 56106 56107 56108Get an iterator to one past the end element in a buffer sequence. 56109 56110 56111 template< 56112 typename C> 56113 auto buffer_sequence_end( 56114 const C & c, 56115 typename constraint< !is_convertible< const C *, const mutable_buffer * >::value &&!is_convertible< const C *, const const_buffer * >::value >::type = 0); 56116 56117 56118 56119[endsect] 56120 56121 56122[endsect] 56123 56124 56125[section:buffer_size buffer_size] 56126 56127[indexterm1 boost_asio.indexterm.buffer_size..buffer_size] 56128Get the total number of bytes in a buffer sequence. 56129 56130 56131 template< 56132 typename BufferSequence> 56133 std::size_t buffer_size( 56134 const BufferSequence & b); 56135 56136 56137The `buffer_size` function determines the total size of all buffers in the buffer sequence, as if computed as follows: 56138 56139 56140 56141 size_t total_size = 0; 56142 auto i = boost::asio::buffer_sequence_begin(buffers); 56143 auto end = boost::asio::buffer_sequence_end(buffers); 56144 for (; i != end; ++i) 56145 { 56146 const_buffer b(*i); 56147 total_size += b.size(); 56148 } 56149 return total_size; 56150 56151 56152 56153 56154The `BufferSequence` template parameter may meet either of the `ConstBufferSequence` or `MutableBufferSequence` type requirements. 56155 56156[heading Requirements] 56157 56158['Header: ][^boost/asio/buffer.hpp] 56159 56160['Convenience header: ][^boost/asio.hpp] 56161 56162 56163[endsect] 56164 56165 56166[section:buffered_read_stream buffered_read_stream] 56167 56168[indexterm1 boost_asio.indexterm.buffered_read_stream..buffered_read_stream] 56169 56170 56171Adds buffering to the read-related operations of a stream. 56172 56173 56174 template< 56175 typename Stream> 56176 class buffered_read_stream : 56177 noncopyable 56178 56179 56180[heading Types] 56181[table 56182 [[Name][Description]] 56183 56184 [ 56185 56186 [[link boost_asio.reference.buffered_read_stream.executor_type [*executor_type]]] 56187 [The type of the executor associated with the object. ] 56188 56189 ] 56190 56191 [ 56192 56193 [[link boost_asio.reference.buffered_read_stream.lowest_layer_type [*lowest_layer_type]]] 56194 [The type of the lowest layer. ] 56195 56196 ] 56197 56198 [ 56199 56200 [[link boost_asio.reference.buffered_read_stream.next_layer_type [*next_layer_type]]] 56201 [The type of the next layer. ] 56202 56203 ] 56204 56205] 56206 56207[heading Member Functions] 56208[table 56209 [[Name][Description]] 56210 56211 [ 56212 [[link boost_asio.reference.buffered_read_stream.async_fill [*async_fill]]] 56213 [Start an asynchronous fill. ] 56214 ] 56215 56216 [ 56217 [[link boost_asio.reference.buffered_read_stream.async_read_some [*async_read_some]]] 56218 [Start an asynchronous read. The buffer into which the data will be read must be valid for the lifetime of the asynchronous operation. ] 56219 ] 56220 56221 [ 56222 [[link boost_asio.reference.buffered_read_stream.async_write_some [*async_write_some]]] 56223 [Start an asynchronous write. The data being written must be valid for the lifetime of the asynchronous operation. ] 56224 ] 56225 56226 [ 56227 [[link boost_asio.reference.buffered_read_stream.buffered_read_stream [*buffered_read_stream]] [constructor]] 56228 [Construct, passing the specified argument to initialise the next layer. ] 56229 ] 56230 56231 [ 56232 [[link boost_asio.reference.buffered_read_stream.close [*close]]] 56233 [Close the stream. ] 56234 ] 56235 56236 [ 56237 [[link boost_asio.reference.buffered_read_stream.fill [*fill]]] 56238 [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. 56239 [hr] 56240 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. ] 56241 ] 56242 56243 [ 56244 [[link boost_asio.reference.buffered_read_stream.get_executor [*get_executor]]] 56245 [Get the executor associated with the object. ] 56246 ] 56247 56248 [ 56249 [[link boost_asio.reference.buffered_read_stream.in_avail [*in_avail]]] 56250 [Determine the amount of data that may be read without blocking. ] 56251 ] 56252 56253 [ 56254 [[link boost_asio.reference.buffered_read_stream.lowest_layer [*lowest_layer]]] 56255 [Get a reference to the lowest layer. 56256 [hr] 56257 Get a const reference to the lowest layer. ] 56258 ] 56259 56260 [ 56261 [[link boost_asio.reference.buffered_read_stream.next_layer [*next_layer]]] 56262 [Get a reference to the next layer. ] 56263 ] 56264 56265 [ 56266 [[link boost_asio.reference.buffered_read_stream.peek [*peek]]] 56267 [Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure. 56268 [hr] 56269 Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred. ] 56270 ] 56271 56272 [ 56273 [[link boost_asio.reference.buffered_read_stream.read_some [*read_some]]] 56274 [Read some data from the stream. Returns the number of bytes read. Throws an exception on failure. 56275 [hr] 56276 Read some data from the stream. Returns the number of bytes read or 0 if an error occurred. ] 56277 ] 56278 56279 [ 56280 [[link boost_asio.reference.buffered_read_stream.write_some [*write_some]]] 56281 [Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure. 56282 [hr] 56283 Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred. ] 56284 ] 56285 56286] 56287 56288[heading Data Members] 56289[table 56290 [[Name][Description]] 56291 56292 [ 56293 [[link boost_asio.reference.buffered_read_stream.default_buffer_size [*default_buffer_size]] [static]] 56294 [The default buffer size. ] 56295 ] 56296 56297] 56298 56299The [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. 56300 56301 56302[heading Thread Safety] 56303 56304['Distinct] ['objects:] Safe. 56305 56306['Shared] ['objects:] Unsafe. 56307 56308 56309 56310 56311[heading Requirements] 56312 56313['Header: ][^boost/asio/buffered_read_stream.hpp] 56314 56315['Convenience header: ][^boost/asio.hpp] 56316 56317 56318[section:async_fill buffered_read_stream::async_fill] 56319 56320[indexterm2 boost_asio.indexterm.buffered_read_stream.async_fill..async_fill..buffered_read_stream] 56321Start an asynchronous fill. 56322 56323 56324 template< 56325 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 56326 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_fill( 56327 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 56328 56329 56330 56331[endsect] 56332 56333 56334 56335[section:async_read_some buffered_read_stream::async_read_some] 56336 56337[indexterm2 boost_asio.indexterm.buffered_read_stream.async_read_some..async_read_some..buffered_read_stream] 56338Start an asynchronous read. The buffer into which the data will be read must be valid for the lifetime of the asynchronous operation. 56339 56340 56341 template< 56342 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 56343 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 56344 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_some( 56345 const MutableBufferSequence & buffers, 56346 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 56347 56348 56349 56350[endsect] 56351 56352 56353 56354[section:async_write_some buffered_read_stream::async_write_some] 56355 56356[indexterm2 boost_asio.indexterm.buffered_read_stream.async_write_some..async_write_some..buffered_read_stream] 56357Start an asynchronous write. The data being written must be valid for the lifetime of the asynchronous operation. 56358 56359 56360 template< 56361 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 56362 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 56363 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_some( 56364 const ConstBufferSequence & buffers, 56365 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 56366 56367 56368 56369[endsect] 56370 56371 56372[section:buffered_read_stream buffered_read_stream::buffered_read_stream] 56373 56374[indexterm2 boost_asio.indexterm.buffered_read_stream.buffered_read_stream..buffered_read_stream..buffered_read_stream] 56375Construct, passing the specified argument to initialise the next layer. 56376 56377 56378 template< 56379 typename Arg> 56380 explicit ``[link boost_asio.reference.buffered_read_stream.buffered_read_stream.overload1 buffered_read_stream]``( 56381 Arg & a); 56382 `` [''''»''' [link boost_asio.reference.buffered_read_stream.buffered_read_stream.overload1 more...]]`` 56383 56384 template< 56385 typename Arg> 56386 ``[link boost_asio.reference.buffered_read_stream.buffered_read_stream.overload2 buffered_read_stream]``( 56387 Arg & a, 56388 std::size_t buffer_size); 56389 `` [''''»''' [link boost_asio.reference.buffered_read_stream.buffered_read_stream.overload2 more...]]`` 56390 56391 56392[section:overload1 buffered_read_stream::buffered_read_stream (1 of 2 overloads)] 56393 56394 56395Construct, passing the specified argument to initialise the next layer. 56396 56397 56398 template< 56399 typename Arg> 56400 buffered_read_stream( 56401 Arg & a); 56402 56403 56404 56405[endsect] 56406 56407 56408 56409[section:overload2 buffered_read_stream::buffered_read_stream (2 of 2 overloads)] 56410 56411 56412Construct, passing the specified argument to initialise the next layer. 56413 56414 56415 template< 56416 typename Arg> 56417 buffered_read_stream( 56418 Arg & a, 56419 std::size_t buffer_size); 56420 56421 56422 56423[endsect] 56424 56425 56426[endsect] 56427 56428[section:close buffered_read_stream::close] 56429 56430[indexterm2 boost_asio.indexterm.buffered_read_stream.close..close..buffered_read_stream] 56431Close the stream. 56432 56433 56434 void ``[link boost_asio.reference.buffered_read_stream.close.overload1 close]``(); 56435 `` [''''»''' [link boost_asio.reference.buffered_read_stream.close.overload1 more...]]`` 56436 56437 void ``[link boost_asio.reference.buffered_read_stream.close.overload2 close]``( 56438 boost::system::error_code & ec); 56439 `` [''''»''' [link boost_asio.reference.buffered_read_stream.close.overload2 more...]]`` 56440 56441 56442[section:overload1 buffered_read_stream::close (1 of 2 overloads)] 56443 56444 56445Close the stream. 56446 56447 56448 void close(); 56449 56450 56451 56452[endsect] 56453 56454 56455 56456[section:overload2 buffered_read_stream::close (2 of 2 overloads)] 56457 56458 56459Close the stream. 56460 56461 56462 void close( 56463 boost::system::error_code & ec); 56464 56465 56466 56467[endsect] 56468 56469 56470[endsect] 56471 56472 56473[section:default_buffer_size buffered_read_stream::default_buffer_size] 56474 56475[indexterm2 boost_asio.indexterm.buffered_read_stream.default_buffer_size..default_buffer_size..buffered_read_stream] 56476The default buffer size. 56477 56478 56479 static const std::size_t default_buffer_size = implementation_defined; 56480 56481 56482 56483[endsect] 56484 56485 56486 56487[section:executor_type buffered_read_stream::executor_type] 56488 56489[indexterm2 boost_asio.indexterm.buffered_read_stream.executor_type..executor_type..buffered_read_stream] 56490The type of the executor associated with the object. 56491 56492 56493 typedef lowest_layer_type::executor_type executor_type; 56494 56495 56496 56497[heading Requirements] 56498 56499['Header: ][^boost/asio/buffered_read_stream.hpp] 56500 56501['Convenience header: ][^boost/asio.hpp] 56502 56503 56504[endsect] 56505 56506 56507[section:fill buffered_read_stream::fill] 56508 56509[indexterm2 boost_asio.indexterm.buffered_read_stream.fill..fill..buffered_read_stream] 56510Fill 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. 56511 56512 56513 std::size_t ``[link boost_asio.reference.buffered_read_stream.fill.overload1 fill]``(); 56514 `` [''''»''' [link boost_asio.reference.buffered_read_stream.fill.overload1 more...]]`` 56515 56516 56517Fill 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. 56518 56519 56520 std::size_t ``[link boost_asio.reference.buffered_read_stream.fill.overload2 fill]``( 56521 boost::system::error_code & ec); 56522 `` [''''»''' [link boost_asio.reference.buffered_read_stream.fill.overload2 more...]]`` 56523 56524 56525[section:overload1 buffered_read_stream::fill (1 of 2 overloads)] 56526 56527 56528Fill 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. 56529 56530 56531 std::size_t fill(); 56532 56533 56534 56535[endsect] 56536 56537 56538 56539[section:overload2 buffered_read_stream::fill (2 of 2 overloads)] 56540 56541 56542Fill 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. 56543 56544 56545 std::size_t fill( 56546 boost::system::error_code & ec); 56547 56548 56549 56550[endsect] 56551 56552 56553[endsect] 56554 56555 56556[section:get_executor buffered_read_stream::get_executor] 56557 56558[indexterm2 boost_asio.indexterm.buffered_read_stream.get_executor..get_executor..buffered_read_stream] 56559Get the executor associated with the object. 56560 56561 56562 executor_type get_executor(); 56563 56564 56565 56566[endsect] 56567 56568 56569[section:in_avail buffered_read_stream::in_avail] 56570 56571[indexterm2 boost_asio.indexterm.buffered_read_stream.in_avail..in_avail..buffered_read_stream] 56572Determine the amount of data that may be read without blocking. 56573 56574 56575 std::size_t ``[link boost_asio.reference.buffered_read_stream.in_avail.overload1 in_avail]``(); 56576 `` [''''»''' [link boost_asio.reference.buffered_read_stream.in_avail.overload1 more...]]`` 56577 56578 std::size_t ``[link boost_asio.reference.buffered_read_stream.in_avail.overload2 in_avail]``( 56579 boost::system::error_code & ec); 56580 `` [''''»''' [link boost_asio.reference.buffered_read_stream.in_avail.overload2 more...]]`` 56581 56582 56583[section:overload1 buffered_read_stream::in_avail (1 of 2 overloads)] 56584 56585 56586Determine the amount of data that may be read without blocking. 56587 56588 56589 std::size_t in_avail(); 56590 56591 56592 56593[endsect] 56594 56595 56596 56597[section:overload2 buffered_read_stream::in_avail (2 of 2 overloads)] 56598 56599 56600Determine the amount of data that may be read without blocking. 56601 56602 56603 std::size_t in_avail( 56604 boost::system::error_code & ec); 56605 56606 56607 56608[endsect] 56609 56610 56611[endsect] 56612 56613[section:lowest_layer buffered_read_stream::lowest_layer] 56614 56615[indexterm2 boost_asio.indexterm.buffered_read_stream.lowest_layer..lowest_layer..buffered_read_stream] 56616Get a reference to the lowest layer. 56617 56618 56619 lowest_layer_type & ``[link boost_asio.reference.buffered_read_stream.lowest_layer.overload1 lowest_layer]``(); 56620 `` [''''»''' [link boost_asio.reference.buffered_read_stream.lowest_layer.overload1 more...]]`` 56621 56622 56623Get a const reference to the lowest layer. 56624 56625 56626 const lowest_layer_type & ``[link boost_asio.reference.buffered_read_stream.lowest_layer.overload2 lowest_layer]``() const; 56627 `` [''''»''' [link boost_asio.reference.buffered_read_stream.lowest_layer.overload2 more...]]`` 56628 56629 56630[section:overload1 buffered_read_stream::lowest_layer (1 of 2 overloads)] 56631 56632 56633Get a reference to the lowest layer. 56634 56635 56636 lowest_layer_type & lowest_layer(); 56637 56638 56639 56640[endsect] 56641 56642 56643 56644[section:overload2 buffered_read_stream::lowest_layer (2 of 2 overloads)] 56645 56646 56647Get a const reference to the lowest layer. 56648 56649 56650 const lowest_layer_type & lowest_layer() const; 56651 56652 56653 56654[endsect] 56655 56656 56657[endsect] 56658 56659 56660[section:lowest_layer_type buffered_read_stream::lowest_layer_type] 56661 56662[indexterm2 boost_asio.indexterm.buffered_read_stream.lowest_layer_type..lowest_layer_type..buffered_read_stream] 56663The type of the lowest layer. 56664 56665 56666 typedef next_layer_type::lowest_layer_type lowest_layer_type; 56667 56668 56669 56670[heading Requirements] 56671 56672['Header: ][^boost/asio/buffered_read_stream.hpp] 56673 56674['Convenience header: ][^boost/asio.hpp] 56675 56676 56677[endsect] 56678 56679 56680 56681[section:next_layer buffered_read_stream::next_layer] 56682 56683[indexterm2 boost_asio.indexterm.buffered_read_stream.next_layer..next_layer..buffered_read_stream] 56684Get a reference to the next layer. 56685 56686 56687 next_layer_type & next_layer(); 56688 56689 56690 56691[endsect] 56692 56693 56694 56695[section:next_layer_type buffered_read_stream::next_layer_type] 56696 56697[indexterm2 boost_asio.indexterm.buffered_read_stream.next_layer_type..next_layer_type..buffered_read_stream] 56698The type of the next layer. 56699 56700 56701 typedef remove_reference< Stream >::type next_layer_type; 56702 56703 56704 56705[heading Requirements] 56706 56707['Header: ][^boost/asio/buffered_read_stream.hpp] 56708 56709['Convenience header: ][^boost/asio.hpp] 56710 56711 56712[endsect] 56713 56714 56715[section:peek buffered_read_stream::peek] 56716 56717[indexterm2 boost_asio.indexterm.buffered_read_stream.peek..peek..buffered_read_stream] 56718Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure. 56719 56720 56721 template< 56722 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 56723 std::size_t ``[link boost_asio.reference.buffered_read_stream.peek.overload1 peek]``( 56724 const MutableBufferSequence & buffers); 56725 `` [''''»''' [link boost_asio.reference.buffered_read_stream.peek.overload1 more...]]`` 56726 56727 56728Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred. 56729 56730 56731 template< 56732 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 56733 std::size_t ``[link boost_asio.reference.buffered_read_stream.peek.overload2 peek]``( 56734 const MutableBufferSequence & buffers, 56735 boost::system::error_code & ec); 56736 `` [''''»''' [link boost_asio.reference.buffered_read_stream.peek.overload2 more...]]`` 56737 56738 56739[section:overload1 buffered_read_stream::peek (1 of 2 overloads)] 56740 56741 56742Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure. 56743 56744 56745 template< 56746 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 56747 std::size_t peek( 56748 const MutableBufferSequence & buffers); 56749 56750 56751 56752[endsect] 56753 56754 56755 56756[section:overload2 buffered_read_stream::peek (2 of 2 overloads)] 56757 56758 56759Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred. 56760 56761 56762 template< 56763 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 56764 std::size_t peek( 56765 const MutableBufferSequence & buffers, 56766 boost::system::error_code & ec); 56767 56768 56769 56770[endsect] 56771 56772 56773[endsect] 56774 56775[section:read_some buffered_read_stream::read_some] 56776 56777[indexterm2 boost_asio.indexterm.buffered_read_stream.read_some..read_some..buffered_read_stream] 56778Read some data from the stream. Returns the number of bytes read. Throws an exception on failure. 56779 56780 56781 template< 56782 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 56783 std::size_t ``[link boost_asio.reference.buffered_read_stream.read_some.overload1 read_some]``( 56784 const MutableBufferSequence & buffers); 56785 `` [''''»''' [link boost_asio.reference.buffered_read_stream.read_some.overload1 more...]]`` 56786 56787 56788Read some data from the stream. Returns the number of bytes read or 0 if an error occurred. 56789 56790 56791 template< 56792 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 56793 std::size_t ``[link boost_asio.reference.buffered_read_stream.read_some.overload2 read_some]``( 56794 const MutableBufferSequence & buffers, 56795 boost::system::error_code & ec); 56796 `` [''''»''' [link boost_asio.reference.buffered_read_stream.read_some.overload2 more...]]`` 56797 56798 56799[section:overload1 buffered_read_stream::read_some (1 of 2 overloads)] 56800 56801 56802Read some data from the stream. Returns the number of bytes read. Throws an exception on failure. 56803 56804 56805 template< 56806 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 56807 std::size_t read_some( 56808 const MutableBufferSequence & buffers); 56809 56810 56811 56812[endsect] 56813 56814 56815 56816[section:overload2 buffered_read_stream::read_some (2 of 2 overloads)] 56817 56818 56819Read some data from the stream. Returns the number of bytes read or 0 if an error occurred. 56820 56821 56822 template< 56823 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 56824 std::size_t read_some( 56825 const MutableBufferSequence & buffers, 56826 boost::system::error_code & ec); 56827 56828 56829 56830[endsect] 56831 56832 56833[endsect] 56834 56835[section:write_some buffered_read_stream::write_some] 56836 56837[indexterm2 boost_asio.indexterm.buffered_read_stream.write_some..write_some..buffered_read_stream] 56838Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure. 56839 56840 56841 template< 56842 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 56843 std::size_t ``[link boost_asio.reference.buffered_read_stream.write_some.overload1 write_some]``( 56844 const ConstBufferSequence & buffers); 56845 `` [''''»''' [link boost_asio.reference.buffered_read_stream.write_some.overload1 more...]]`` 56846 56847 56848Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred. 56849 56850 56851 template< 56852 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 56853 std::size_t ``[link boost_asio.reference.buffered_read_stream.write_some.overload2 write_some]``( 56854 const ConstBufferSequence & buffers, 56855 boost::system::error_code & ec); 56856 `` [''''»''' [link boost_asio.reference.buffered_read_stream.write_some.overload2 more...]]`` 56857 56858 56859[section:overload1 buffered_read_stream::write_some (1 of 2 overloads)] 56860 56861 56862Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure. 56863 56864 56865 template< 56866 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 56867 std::size_t write_some( 56868 const ConstBufferSequence & buffers); 56869 56870 56871 56872[endsect] 56873 56874 56875 56876[section:overload2 buffered_read_stream::write_some (2 of 2 overloads)] 56877 56878 56879Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred. 56880 56881 56882 template< 56883 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 56884 std::size_t write_some( 56885 const ConstBufferSequence & buffers, 56886 boost::system::error_code & ec); 56887 56888 56889 56890[endsect] 56891 56892 56893[endsect] 56894 56895 56896[endsect] 56897 56898[section:buffered_stream buffered_stream] 56899 56900[indexterm1 boost_asio.indexterm.buffered_stream..buffered_stream] 56901 56902 56903Adds buffering to the read- and write-related operations of a stream. 56904 56905 56906 template< 56907 typename Stream> 56908 class buffered_stream : 56909 noncopyable 56910 56911 56912[heading Types] 56913[table 56914 [[Name][Description]] 56915 56916 [ 56917 56918 [[link boost_asio.reference.buffered_stream.executor_type [*executor_type]]] 56919 [The type of the executor associated with the object. ] 56920 56921 ] 56922 56923 [ 56924 56925 [[link boost_asio.reference.buffered_stream.lowest_layer_type [*lowest_layer_type]]] 56926 [The type of the lowest layer. ] 56927 56928 ] 56929 56930 [ 56931 56932 [[link boost_asio.reference.buffered_stream.next_layer_type [*next_layer_type]]] 56933 [The type of the next layer. ] 56934 56935 ] 56936 56937] 56938 56939[heading Member Functions] 56940[table 56941 [[Name][Description]] 56942 56943 [ 56944 [[link boost_asio.reference.buffered_stream.async_fill [*async_fill]]] 56945 [Start an asynchronous fill. ] 56946 ] 56947 56948 [ 56949 [[link boost_asio.reference.buffered_stream.async_flush [*async_flush]]] 56950 [Start an asynchronous flush. ] 56951 ] 56952 56953 [ 56954 [[link boost_asio.reference.buffered_stream.async_read_some [*async_read_some]]] 56955 [Start an asynchronous read. The buffer into which the data will be read must be valid for the lifetime of the asynchronous operation. ] 56956 ] 56957 56958 [ 56959 [[link boost_asio.reference.buffered_stream.async_write_some [*async_write_some]]] 56960 [Start an asynchronous write. The data being written must be valid for the lifetime of the asynchronous operation. ] 56961 ] 56962 56963 [ 56964 [[link boost_asio.reference.buffered_stream.buffered_stream [*buffered_stream]] [constructor]] 56965 [Construct, passing the specified argument to initialise the next layer. ] 56966 ] 56967 56968 [ 56969 [[link boost_asio.reference.buffered_stream.close [*close]]] 56970 [Close the stream. ] 56971 ] 56972 56973 [ 56974 [[link boost_asio.reference.buffered_stream.fill [*fill]]] 56975 [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. 56976 [hr] 56977 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. ] 56978 ] 56979 56980 [ 56981 [[link boost_asio.reference.buffered_stream.flush [*flush]]] 56982 [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. 56983 [hr] 56984 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. ] 56985 ] 56986 56987 [ 56988 [[link boost_asio.reference.buffered_stream.get_executor [*get_executor]]] 56989 [Get the executor associated with the object. ] 56990 ] 56991 56992 [ 56993 [[link boost_asio.reference.buffered_stream.in_avail [*in_avail]]] 56994 [Determine the amount of data that may be read without blocking. ] 56995 ] 56996 56997 [ 56998 [[link boost_asio.reference.buffered_stream.lowest_layer [*lowest_layer]]] 56999 [Get a reference to the lowest layer. 57000 [hr] 57001 Get a const reference to the lowest layer. ] 57002 ] 57003 57004 [ 57005 [[link boost_asio.reference.buffered_stream.next_layer [*next_layer]]] 57006 [Get a reference to the next layer. ] 57007 ] 57008 57009 [ 57010 [[link boost_asio.reference.buffered_stream.peek [*peek]]] 57011 [Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure. 57012 [hr] 57013 Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred. ] 57014 ] 57015 57016 [ 57017 [[link boost_asio.reference.buffered_stream.read_some [*read_some]]] 57018 [Read some data from the stream. Returns the number of bytes read. Throws an exception on failure. 57019 [hr] 57020 Read some data from the stream. Returns the number of bytes read or 0 if an error occurred. ] 57021 ] 57022 57023 [ 57024 [[link boost_asio.reference.buffered_stream.write_some [*write_some]]] 57025 [Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure. 57026 [hr] 57027 Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred. ] 57028 ] 57029 57030] 57031 57032The [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. 57033 57034 57035[heading Thread Safety] 57036 57037['Distinct] ['objects:] Safe. 57038 57039['Shared] ['objects:] Unsafe. 57040 57041 57042 57043 57044[heading Requirements] 57045 57046['Header: ][^boost/asio/buffered_stream.hpp] 57047 57048['Convenience header: ][^boost/asio.hpp] 57049 57050 57051[section:async_fill buffered_stream::async_fill] 57052 57053[indexterm2 boost_asio.indexterm.buffered_stream.async_fill..async_fill..buffered_stream] 57054Start an asynchronous fill. 57055 57056 57057 template< 57058 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 57059 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_fill( 57060 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 57061 57062 57063 57064[endsect] 57065 57066 57067 57068[section:async_flush buffered_stream::async_flush] 57069 57070[indexterm2 boost_asio.indexterm.buffered_stream.async_flush..async_flush..buffered_stream] 57071Start an asynchronous flush. 57072 57073 57074 template< 57075 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 57076 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_flush( 57077 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 57078 57079 57080 57081[endsect] 57082 57083 57084 57085[section:async_read_some buffered_stream::async_read_some] 57086 57087[indexterm2 boost_asio.indexterm.buffered_stream.async_read_some..async_read_some..buffered_stream] 57088Start an asynchronous read. The buffer into which the data will be read must be valid for the lifetime of the asynchronous operation. 57089 57090 57091 template< 57092 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 57093 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 57094 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_some( 57095 const MutableBufferSequence & buffers, 57096 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 57097 57098 57099 57100[endsect] 57101 57102 57103 57104[section:async_write_some buffered_stream::async_write_some] 57105 57106[indexterm2 boost_asio.indexterm.buffered_stream.async_write_some..async_write_some..buffered_stream] 57107Start an asynchronous write. The data being written must be valid for the lifetime of the asynchronous operation. 57108 57109 57110 template< 57111 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 57112 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 57113 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_some( 57114 const ConstBufferSequence & buffers, 57115 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 57116 57117 57118 57119[endsect] 57120 57121 57122[section:buffered_stream buffered_stream::buffered_stream] 57123 57124[indexterm2 boost_asio.indexterm.buffered_stream.buffered_stream..buffered_stream..buffered_stream] 57125Construct, passing the specified argument to initialise the next layer. 57126 57127 57128 template< 57129 typename Arg> 57130 explicit ``[link boost_asio.reference.buffered_stream.buffered_stream.overload1 buffered_stream]``( 57131 Arg & a); 57132 `` [''''»''' [link boost_asio.reference.buffered_stream.buffered_stream.overload1 more...]]`` 57133 57134 template< 57135 typename Arg> 57136 explicit ``[link boost_asio.reference.buffered_stream.buffered_stream.overload2 buffered_stream]``( 57137 Arg & a, 57138 std::size_t read_buffer_size, 57139 std::size_t write_buffer_size); 57140 `` [''''»''' [link boost_asio.reference.buffered_stream.buffered_stream.overload2 more...]]`` 57141 57142 57143[section:overload1 buffered_stream::buffered_stream (1 of 2 overloads)] 57144 57145 57146Construct, passing the specified argument to initialise the next layer. 57147 57148 57149 template< 57150 typename Arg> 57151 buffered_stream( 57152 Arg & a); 57153 57154 57155 57156[endsect] 57157 57158 57159 57160[section:overload2 buffered_stream::buffered_stream (2 of 2 overloads)] 57161 57162 57163Construct, passing the specified argument to initialise the next layer. 57164 57165 57166 template< 57167 typename Arg> 57168 buffered_stream( 57169 Arg & a, 57170 std::size_t read_buffer_size, 57171 std::size_t write_buffer_size); 57172 57173 57174 57175[endsect] 57176 57177 57178[endsect] 57179 57180[section:close buffered_stream::close] 57181 57182[indexterm2 boost_asio.indexterm.buffered_stream.close..close..buffered_stream] 57183Close the stream. 57184 57185 57186 void ``[link boost_asio.reference.buffered_stream.close.overload1 close]``(); 57187 `` [''''»''' [link boost_asio.reference.buffered_stream.close.overload1 more...]]`` 57188 57189 void ``[link boost_asio.reference.buffered_stream.close.overload2 close]``( 57190 boost::system::error_code & ec); 57191 `` [''''»''' [link boost_asio.reference.buffered_stream.close.overload2 more...]]`` 57192 57193 57194[section:overload1 buffered_stream::close (1 of 2 overloads)] 57195 57196 57197Close the stream. 57198 57199 57200 void close(); 57201 57202 57203 57204[endsect] 57205 57206 57207 57208[section:overload2 buffered_stream::close (2 of 2 overloads)] 57209 57210 57211Close the stream. 57212 57213 57214 void close( 57215 boost::system::error_code & ec); 57216 57217 57218 57219[endsect] 57220 57221 57222[endsect] 57223 57224 57225[section:executor_type buffered_stream::executor_type] 57226 57227[indexterm2 boost_asio.indexterm.buffered_stream.executor_type..executor_type..buffered_stream] 57228The type of the executor associated with the object. 57229 57230 57231 typedef lowest_layer_type::executor_type executor_type; 57232 57233 57234 57235[heading Requirements] 57236 57237['Header: ][^boost/asio/buffered_stream.hpp] 57238 57239['Convenience header: ][^boost/asio.hpp] 57240 57241 57242[endsect] 57243 57244 57245[section:fill buffered_stream::fill] 57246 57247[indexterm2 boost_asio.indexterm.buffered_stream.fill..fill..buffered_stream] 57248Fill 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. 57249 57250 57251 std::size_t ``[link boost_asio.reference.buffered_stream.fill.overload1 fill]``(); 57252 `` [''''»''' [link boost_asio.reference.buffered_stream.fill.overload1 more...]]`` 57253 57254 57255Fill 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. 57256 57257 57258 std::size_t ``[link boost_asio.reference.buffered_stream.fill.overload2 fill]``( 57259 boost::system::error_code & ec); 57260 `` [''''»''' [link boost_asio.reference.buffered_stream.fill.overload2 more...]]`` 57261 57262 57263[section:overload1 buffered_stream::fill (1 of 2 overloads)] 57264 57265 57266Fill 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. 57267 57268 57269 std::size_t fill(); 57270 57271 57272 57273[endsect] 57274 57275 57276 57277[section:overload2 buffered_stream::fill (2 of 2 overloads)] 57278 57279 57280Fill 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. 57281 57282 57283 std::size_t fill( 57284 boost::system::error_code & ec); 57285 57286 57287 57288[endsect] 57289 57290 57291[endsect] 57292 57293[section:flush buffered_stream::flush] 57294 57295[indexterm2 boost_asio.indexterm.buffered_stream.flush..flush..buffered_stream] 57296Flush 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. 57297 57298 57299 std::size_t ``[link boost_asio.reference.buffered_stream.flush.overload1 flush]``(); 57300 `` [''''»''' [link boost_asio.reference.buffered_stream.flush.overload1 more...]]`` 57301 57302 57303Flush 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. 57304 57305 57306 std::size_t ``[link boost_asio.reference.buffered_stream.flush.overload2 flush]``( 57307 boost::system::error_code & ec); 57308 `` [''''»''' [link boost_asio.reference.buffered_stream.flush.overload2 more...]]`` 57309 57310 57311[section:overload1 buffered_stream::flush (1 of 2 overloads)] 57312 57313 57314Flush 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. 57315 57316 57317 std::size_t flush(); 57318 57319 57320 57321[endsect] 57322 57323 57324 57325[section:overload2 buffered_stream::flush (2 of 2 overloads)] 57326 57327 57328Flush 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. 57329 57330 57331 std::size_t flush( 57332 boost::system::error_code & ec); 57333 57334 57335 57336[endsect] 57337 57338 57339[endsect] 57340 57341 57342[section:get_executor buffered_stream::get_executor] 57343 57344[indexterm2 boost_asio.indexterm.buffered_stream.get_executor..get_executor..buffered_stream] 57345Get the executor associated with the object. 57346 57347 57348 executor_type get_executor(); 57349 57350 57351 57352[endsect] 57353 57354 57355[section:in_avail buffered_stream::in_avail] 57356 57357[indexterm2 boost_asio.indexterm.buffered_stream.in_avail..in_avail..buffered_stream] 57358Determine the amount of data that may be read without blocking. 57359 57360 57361 std::size_t ``[link boost_asio.reference.buffered_stream.in_avail.overload1 in_avail]``(); 57362 `` [''''»''' [link boost_asio.reference.buffered_stream.in_avail.overload1 more...]]`` 57363 57364 std::size_t ``[link boost_asio.reference.buffered_stream.in_avail.overload2 in_avail]``( 57365 boost::system::error_code & ec); 57366 `` [''''»''' [link boost_asio.reference.buffered_stream.in_avail.overload2 more...]]`` 57367 57368 57369[section:overload1 buffered_stream::in_avail (1 of 2 overloads)] 57370 57371 57372Determine the amount of data that may be read without blocking. 57373 57374 57375 std::size_t in_avail(); 57376 57377 57378 57379[endsect] 57380 57381 57382 57383[section:overload2 buffered_stream::in_avail (2 of 2 overloads)] 57384 57385 57386Determine the amount of data that may be read without blocking. 57387 57388 57389 std::size_t in_avail( 57390 boost::system::error_code & ec); 57391 57392 57393 57394[endsect] 57395 57396 57397[endsect] 57398 57399[section:lowest_layer buffered_stream::lowest_layer] 57400 57401[indexterm2 boost_asio.indexterm.buffered_stream.lowest_layer..lowest_layer..buffered_stream] 57402Get a reference to the lowest layer. 57403 57404 57405 lowest_layer_type & ``[link boost_asio.reference.buffered_stream.lowest_layer.overload1 lowest_layer]``(); 57406 `` [''''»''' [link boost_asio.reference.buffered_stream.lowest_layer.overload1 more...]]`` 57407 57408 57409Get a const reference to the lowest layer. 57410 57411 57412 const lowest_layer_type & ``[link boost_asio.reference.buffered_stream.lowest_layer.overload2 lowest_layer]``() const; 57413 `` [''''»''' [link boost_asio.reference.buffered_stream.lowest_layer.overload2 more...]]`` 57414 57415 57416[section:overload1 buffered_stream::lowest_layer (1 of 2 overloads)] 57417 57418 57419Get a reference to the lowest layer. 57420 57421 57422 lowest_layer_type & lowest_layer(); 57423 57424 57425 57426[endsect] 57427 57428 57429 57430[section:overload2 buffered_stream::lowest_layer (2 of 2 overloads)] 57431 57432 57433Get a const reference to the lowest layer. 57434 57435 57436 const lowest_layer_type & lowest_layer() const; 57437 57438 57439 57440[endsect] 57441 57442 57443[endsect] 57444 57445 57446[section:lowest_layer_type buffered_stream::lowest_layer_type] 57447 57448[indexterm2 boost_asio.indexterm.buffered_stream.lowest_layer_type..lowest_layer_type..buffered_stream] 57449The type of the lowest layer. 57450 57451 57452 typedef next_layer_type::lowest_layer_type lowest_layer_type; 57453 57454 57455 57456[heading Requirements] 57457 57458['Header: ][^boost/asio/buffered_stream.hpp] 57459 57460['Convenience header: ][^boost/asio.hpp] 57461 57462 57463[endsect] 57464 57465 57466 57467[section:next_layer buffered_stream::next_layer] 57468 57469[indexterm2 boost_asio.indexterm.buffered_stream.next_layer..next_layer..buffered_stream] 57470Get a reference to the next layer. 57471 57472 57473 next_layer_type & next_layer(); 57474 57475 57476 57477[endsect] 57478 57479 57480 57481[section:next_layer_type buffered_stream::next_layer_type] 57482 57483[indexterm2 boost_asio.indexterm.buffered_stream.next_layer_type..next_layer_type..buffered_stream] 57484The type of the next layer. 57485 57486 57487 typedef remove_reference< Stream >::type next_layer_type; 57488 57489 57490 57491[heading Requirements] 57492 57493['Header: ][^boost/asio/buffered_stream.hpp] 57494 57495['Convenience header: ][^boost/asio.hpp] 57496 57497 57498[endsect] 57499 57500 57501[section:peek buffered_stream::peek] 57502 57503[indexterm2 boost_asio.indexterm.buffered_stream.peek..peek..buffered_stream] 57504Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure. 57505 57506 57507 template< 57508 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 57509 std::size_t ``[link boost_asio.reference.buffered_stream.peek.overload1 peek]``( 57510 const MutableBufferSequence & buffers); 57511 `` [''''»''' [link boost_asio.reference.buffered_stream.peek.overload1 more...]]`` 57512 57513 57514Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred. 57515 57516 57517 template< 57518 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 57519 std::size_t ``[link boost_asio.reference.buffered_stream.peek.overload2 peek]``( 57520 const MutableBufferSequence & buffers, 57521 boost::system::error_code & ec); 57522 `` [''''»''' [link boost_asio.reference.buffered_stream.peek.overload2 more...]]`` 57523 57524 57525[section:overload1 buffered_stream::peek (1 of 2 overloads)] 57526 57527 57528Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure. 57529 57530 57531 template< 57532 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 57533 std::size_t peek( 57534 const MutableBufferSequence & buffers); 57535 57536 57537 57538[endsect] 57539 57540 57541 57542[section:overload2 buffered_stream::peek (2 of 2 overloads)] 57543 57544 57545Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred. 57546 57547 57548 template< 57549 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 57550 std::size_t peek( 57551 const MutableBufferSequence & buffers, 57552 boost::system::error_code & ec); 57553 57554 57555 57556[endsect] 57557 57558 57559[endsect] 57560 57561[section:read_some buffered_stream::read_some] 57562 57563[indexterm2 boost_asio.indexterm.buffered_stream.read_some..read_some..buffered_stream] 57564Read some data from the stream. Returns the number of bytes read. Throws an exception on failure. 57565 57566 57567 template< 57568 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 57569 std::size_t ``[link boost_asio.reference.buffered_stream.read_some.overload1 read_some]``( 57570 const MutableBufferSequence & buffers); 57571 `` [''''»''' [link boost_asio.reference.buffered_stream.read_some.overload1 more...]]`` 57572 57573 57574Read some data from the stream. Returns the number of bytes read or 0 if an error occurred. 57575 57576 57577 template< 57578 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 57579 std::size_t ``[link boost_asio.reference.buffered_stream.read_some.overload2 read_some]``( 57580 const MutableBufferSequence & buffers, 57581 boost::system::error_code & ec); 57582 `` [''''»''' [link boost_asio.reference.buffered_stream.read_some.overload2 more...]]`` 57583 57584 57585[section:overload1 buffered_stream::read_some (1 of 2 overloads)] 57586 57587 57588Read some data from the stream. Returns the number of bytes read. Throws an exception on failure. 57589 57590 57591 template< 57592 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 57593 std::size_t read_some( 57594 const MutableBufferSequence & buffers); 57595 57596 57597 57598[endsect] 57599 57600 57601 57602[section:overload2 buffered_stream::read_some (2 of 2 overloads)] 57603 57604 57605Read some data from the stream. Returns the number of bytes read or 0 if an error occurred. 57606 57607 57608 template< 57609 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 57610 std::size_t read_some( 57611 const MutableBufferSequence & buffers, 57612 boost::system::error_code & ec); 57613 57614 57615 57616[endsect] 57617 57618 57619[endsect] 57620 57621[section:write_some buffered_stream::write_some] 57622 57623[indexterm2 boost_asio.indexterm.buffered_stream.write_some..write_some..buffered_stream] 57624Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure. 57625 57626 57627 template< 57628 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 57629 std::size_t ``[link boost_asio.reference.buffered_stream.write_some.overload1 write_some]``( 57630 const ConstBufferSequence & buffers); 57631 `` [''''»''' [link boost_asio.reference.buffered_stream.write_some.overload1 more...]]`` 57632 57633 57634Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred. 57635 57636 57637 template< 57638 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 57639 std::size_t ``[link boost_asio.reference.buffered_stream.write_some.overload2 write_some]``( 57640 const ConstBufferSequence & buffers, 57641 boost::system::error_code & ec); 57642 `` [''''»''' [link boost_asio.reference.buffered_stream.write_some.overload2 more...]]`` 57643 57644 57645[section:overload1 buffered_stream::write_some (1 of 2 overloads)] 57646 57647 57648Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure. 57649 57650 57651 template< 57652 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 57653 std::size_t write_some( 57654 const ConstBufferSequence & buffers); 57655 57656 57657 57658[endsect] 57659 57660 57661 57662[section:overload2 buffered_stream::write_some (2 of 2 overloads)] 57663 57664 57665Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred. 57666 57667 57668 template< 57669 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 57670 std::size_t write_some( 57671 const ConstBufferSequence & buffers, 57672 boost::system::error_code & ec); 57673 57674 57675 57676[endsect] 57677 57678 57679[endsect] 57680 57681 57682[endsect] 57683 57684[section:buffered_write_stream buffered_write_stream] 57685 57686[indexterm1 boost_asio.indexterm.buffered_write_stream..buffered_write_stream] 57687 57688 57689Adds buffering to the write-related operations of a stream. 57690 57691 57692 template< 57693 typename Stream> 57694 class buffered_write_stream : 57695 noncopyable 57696 57697 57698[heading Types] 57699[table 57700 [[Name][Description]] 57701 57702 [ 57703 57704 [[link boost_asio.reference.buffered_write_stream.executor_type [*executor_type]]] 57705 [The type of the executor associated with the object. ] 57706 57707 ] 57708 57709 [ 57710 57711 [[link boost_asio.reference.buffered_write_stream.lowest_layer_type [*lowest_layer_type]]] 57712 [The type of the lowest layer. ] 57713 57714 ] 57715 57716 [ 57717 57718 [[link boost_asio.reference.buffered_write_stream.next_layer_type [*next_layer_type]]] 57719 [The type of the next layer. ] 57720 57721 ] 57722 57723] 57724 57725[heading Member Functions] 57726[table 57727 [[Name][Description]] 57728 57729 [ 57730 [[link boost_asio.reference.buffered_write_stream.async_flush [*async_flush]]] 57731 [Start an asynchronous flush. ] 57732 ] 57733 57734 [ 57735 [[link boost_asio.reference.buffered_write_stream.async_read_some [*async_read_some]]] 57736 [Start an asynchronous read. The buffer into which the data will be read must be valid for the lifetime of the asynchronous operation. ] 57737 ] 57738 57739 [ 57740 [[link boost_asio.reference.buffered_write_stream.async_write_some [*async_write_some]]] 57741 [Start an asynchronous write. The data being written must be valid for the lifetime of the asynchronous operation. ] 57742 ] 57743 57744 [ 57745 [[link boost_asio.reference.buffered_write_stream.buffered_write_stream [*buffered_write_stream]] [constructor]] 57746 [Construct, passing the specified argument to initialise the next layer. ] 57747 ] 57748 57749 [ 57750 [[link boost_asio.reference.buffered_write_stream.close [*close]]] 57751 [Close the stream. ] 57752 ] 57753 57754 [ 57755 [[link boost_asio.reference.buffered_write_stream.flush [*flush]]] 57756 [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. 57757 [hr] 57758 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. ] 57759 ] 57760 57761 [ 57762 [[link boost_asio.reference.buffered_write_stream.get_executor [*get_executor]]] 57763 [Get the executor associated with the object. ] 57764 ] 57765 57766 [ 57767 [[link boost_asio.reference.buffered_write_stream.in_avail [*in_avail]]] 57768 [Determine the amount of data that may be read without blocking. ] 57769 ] 57770 57771 [ 57772 [[link boost_asio.reference.buffered_write_stream.lowest_layer [*lowest_layer]]] 57773 [Get a reference to the lowest layer. 57774 [hr] 57775 Get a const reference to the lowest layer. ] 57776 ] 57777 57778 [ 57779 [[link boost_asio.reference.buffered_write_stream.next_layer [*next_layer]]] 57780 [Get a reference to the next layer. ] 57781 ] 57782 57783 [ 57784 [[link boost_asio.reference.buffered_write_stream.peek [*peek]]] 57785 [Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure. 57786 [hr] 57787 Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred. ] 57788 ] 57789 57790 [ 57791 [[link boost_asio.reference.buffered_write_stream.read_some [*read_some]]] 57792 [Read some data from the stream. Returns the number of bytes read. Throws an exception on failure. 57793 [hr] 57794 Read some data from the stream. Returns the number of bytes read or 0 if an error occurred. ] 57795 ] 57796 57797 [ 57798 [[link boost_asio.reference.buffered_write_stream.write_some [*write_some]]] 57799 [Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure. 57800 [hr] 57801 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. ] 57802 ] 57803 57804] 57805 57806[heading Data Members] 57807[table 57808 [[Name][Description]] 57809 57810 [ 57811 [[link boost_asio.reference.buffered_write_stream.default_buffer_size [*default_buffer_size]] [static]] 57812 [The default buffer size. ] 57813 ] 57814 57815] 57816 57817The [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. 57818 57819 57820[heading Thread Safety] 57821 57822['Distinct] ['objects:] Safe. 57823 57824['Shared] ['objects:] Unsafe. 57825 57826 57827 57828 57829[heading Requirements] 57830 57831['Header: ][^boost/asio/buffered_write_stream.hpp] 57832 57833['Convenience header: ][^boost/asio.hpp] 57834 57835 57836[section:async_flush buffered_write_stream::async_flush] 57837 57838[indexterm2 boost_asio.indexterm.buffered_write_stream.async_flush..async_flush..buffered_write_stream] 57839Start an asynchronous flush. 57840 57841 57842 template< 57843 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 57844 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_flush( 57845 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 57846 57847 57848 57849[endsect] 57850 57851 57852 57853[section:async_read_some buffered_write_stream::async_read_some] 57854 57855[indexterm2 boost_asio.indexterm.buffered_write_stream.async_read_some..async_read_some..buffered_write_stream] 57856Start an asynchronous read. The buffer into which the data will be read must be valid for the lifetime of the asynchronous operation. 57857 57858 57859 template< 57860 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 57861 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 57862 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_some( 57863 const MutableBufferSequence & buffers, 57864 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 57865 57866 57867 57868[endsect] 57869 57870 57871 57872[section:async_write_some buffered_write_stream::async_write_some] 57873 57874[indexterm2 boost_asio.indexterm.buffered_write_stream.async_write_some..async_write_some..buffered_write_stream] 57875Start an asynchronous write. The data being written must be valid for the lifetime of the asynchronous operation. 57876 57877 57878 template< 57879 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 57880 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 57881 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_some( 57882 const ConstBufferSequence & buffers, 57883 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 57884 57885 57886 57887[endsect] 57888 57889 57890[section:buffered_write_stream buffered_write_stream::buffered_write_stream] 57891 57892[indexterm2 boost_asio.indexterm.buffered_write_stream.buffered_write_stream..buffered_write_stream..buffered_write_stream] 57893Construct, passing the specified argument to initialise the next layer. 57894 57895 57896 template< 57897 typename Arg> 57898 explicit ``[link boost_asio.reference.buffered_write_stream.buffered_write_stream.overload1 buffered_write_stream]``( 57899 Arg & a); 57900 `` [''''»''' [link boost_asio.reference.buffered_write_stream.buffered_write_stream.overload1 more...]]`` 57901 57902 template< 57903 typename Arg> 57904 ``[link boost_asio.reference.buffered_write_stream.buffered_write_stream.overload2 buffered_write_stream]``( 57905 Arg & a, 57906 std::size_t buffer_size); 57907 `` [''''»''' [link boost_asio.reference.buffered_write_stream.buffered_write_stream.overload2 more...]]`` 57908 57909 57910[section:overload1 buffered_write_stream::buffered_write_stream (1 of 2 overloads)] 57911 57912 57913Construct, passing the specified argument to initialise the next layer. 57914 57915 57916 template< 57917 typename Arg> 57918 buffered_write_stream( 57919 Arg & a); 57920 57921 57922 57923[endsect] 57924 57925 57926 57927[section:overload2 buffered_write_stream::buffered_write_stream (2 of 2 overloads)] 57928 57929 57930Construct, passing the specified argument to initialise the next layer. 57931 57932 57933 template< 57934 typename Arg> 57935 buffered_write_stream( 57936 Arg & a, 57937 std::size_t buffer_size); 57938 57939 57940 57941[endsect] 57942 57943 57944[endsect] 57945 57946[section:close buffered_write_stream::close] 57947 57948[indexterm2 boost_asio.indexterm.buffered_write_stream.close..close..buffered_write_stream] 57949Close the stream. 57950 57951 57952 void ``[link boost_asio.reference.buffered_write_stream.close.overload1 close]``(); 57953 `` [''''»''' [link boost_asio.reference.buffered_write_stream.close.overload1 more...]]`` 57954 57955 void ``[link boost_asio.reference.buffered_write_stream.close.overload2 close]``( 57956 boost::system::error_code & ec); 57957 `` [''''»''' [link boost_asio.reference.buffered_write_stream.close.overload2 more...]]`` 57958 57959 57960[section:overload1 buffered_write_stream::close (1 of 2 overloads)] 57961 57962 57963Close the stream. 57964 57965 57966 void close(); 57967 57968 57969 57970[endsect] 57971 57972 57973 57974[section:overload2 buffered_write_stream::close (2 of 2 overloads)] 57975 57976 57977Close the stream. 57978 57979 57980 void close( 57981 boost::system::error_code & ec); 57982 57983 57984 57985[endsect] 57986 57987 57988[endsect] 57989 57990 57991[section:default_buffer_size buffered_write_stream::default_buffer_size] 57992 57993[indexterm2 boost_asio.indexterm.buffered_write_stream.default_buffer_size..default_buffer_size..buffered_write_stream] 57994The default buffer size. 57995 57996 57997 static const std::size_t default_buffer_size = implementation_defined; 57998 57999 58000 58001[endsect] 58002 58003 58004 58005[section:executor_type buffered_write_stream::executor_type] 58006 58007[indexterm2 boost_asio.indexterm.buffered_write_stream.executor_type..executor_type..buffered_write_stream] 58008The type of the executor associated with the object. 58009 58010 58011 typedef lowest_layer_type::executor_type executor_type; 58012 58013 58014 58015[heading Requirements] 58016 58017['Header: ][^boost/asio/buffered_write_stream.hpp] 58018 58019['Convenience header: ][^boost/asio.hpp] 58020 58021 58022[endsect] 58023 58024 58025[section:flush buffered_write_stream::flush] 58026 58027[indexterm2 boost_asio.indexterm.buffered_write_stream.flush..flush..buffered_write_stream] 58028Flush 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. 58029 58030 58031 std::size_t ``[link boost_asio.reference.buffered_write_stream.flush.overload1 flush]``(); 58032 `` [''''»''' [link boost_asio.reference.buffered_write_stream.flush.overload1 more...]]`` 58033 58034 58035Flush 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. 58036 58037 58038 std::size_t ``[link boost_asio.reference.buffered_write_stream.flush.overload2 flush]``( 58039 boost::system::error_code & ec); 58040 `` [''''»''' [link boost_asio.reference.buffered_write_stream.flush.overload2 more...]]`` 58041 58042 58043[section:overload1 buffered_write_stream::flush (1 of 2 overloads)] 58044 58045 58046Flush 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. 58047 58048 58049 std::size_t flush(); 58050 58051 58052 58053[endsect] 58054 58055 58056 58057[section:overload2 buffered_write_stream::flush (2 of 2 overloads)] 58058 58059 58060Flush 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. 58061 58062 58063 std::size_t flush( 58064 boost::system::error_code & ec); 58065 58066 58067 58068[endsect] 58069 58070 58071[endsect] 58072 58073 58074[section:get_executor buffered_write_stream::get_executor] 58075 58076[indexterm2 boost_asio.indexterm.buffered_write_stream.get_executor..get_executor..buffered_write_stream] 58077Get the executor associated with the object. 58078 58079 58080 executor_type get_executor(); 58081 58082 58083 58084[endsect] 58085 58086 58087[section:in_avail buffered_write_stream::in_avail] 58088 58089[indexterm2 boost_asio.indexterm.buffered_write_stream.in_avail..in_avail..buffered_write_stream] 58090Determine the amount of data that may be read without blocking. 58091 58092 58093 std::size_t ``[link boost_asio.reference.buffered_write_stream.in_avail.overload1 in_avail]``(); 58094 `` [''''»''' [link boost_asio.reference.buffered_write_stream.in_avail.overload1 more...]]`` 58095 58096 std::size_t ``[link boost_asio.reference.buffered_write_stream.in_avail.overload2 in_avail]``( 58097 boost::system::error_code & ec); 58098 `` [''''»''' [link boost_asio.reference.buffered_write_stream.in_avail.overload2 more...]]`` 58099 58100 58101[section:overload1 buffered_write_stream::in_avail (1 of 2 overloads)] 58102 58103 58104Determine the amount of data that may be read without blocking. 58105 58106 58107 std::size_t in_avail(); 58108 58109 58110 58111[endsect] 58112 58113 58114 58115[section:overload2 buffered_write_stream::in_avail (2 of 2 overloads)] 58116 58117 58118Determine the amount of data that may be read without blocking. 58119 58120 58121 std::size_t in_avail( 58122 boost::system::error_code & ec); 58123 58124 58125 58126[endsect] 58127 58128 58129[endsect] 58130 58131[section:lowest_layer buffered_write_stream::lowest_layer] 58132 58133[indexterm2 boost_asio.indexterm.buffered_write_stream.lowest_layer..lowest_layer..buffered_write_stream] 58134Get a reference to the lowest layer. 58135 58136 58137 lowest_layer_type & ``[link boost_asio.reference.buffered_write_stream.lowest_layer.overload1 lowest_layer]``(); 58138 `` [''''»''' [link boost_asio.reference.buffered_write_stream.lowest_layer.overload1 more...]]`` 58139 58140 58141Get a const reference to the lowest layer. 58142 58143 58144 const lowest_layer_type & ``[link boost_asio.reference.buffered_write_stream.lowest_layer.overload2 lowest_layer]``() const; 58145 `` [''''»''' [link boost_asio.reference.buffered_write_stream.lowest_layer.overload2 more...]]`` 58146 58147 58148[section:overload1 buffered_write_stream::lowest_layer (1 of 2 overloads)] 58149 58150 58151Get a reference to the lowest layer. 58152 58153 58154 lowest_layer_type & lowest_layer(); 58155 58156 58157 58158[endsect] 58159 58160 58161 58162[section:overload2 buffered_write_stream::lowest_layer (2 of 2 overloads)] 58163 58164 58165Get a const reference to the lowest layer. 58166 58167 58168 const lowest_layer_type & lowest_layer() const; 58169 58170 58171 58172[endsect] 58173 58174 58175[endsect] 58176 58177 58178[section:lowest_layer_type buffered_write_stream::lowest_layer_type] 58179 58180[indexterm2 boost_asio.indexterm.buffered_write_stream.lowest_layer_type..lowest_layer_type..buffered_write_stream] 58181The type of the lowest layer. 58182 58183 58184 typedef next_layer_type::lowest_layer_type lowest_layer_type; 58185 58186 58187 58188[heading Requirements] 58189 58190['Header: ][^boost/asio/buffered_write_stream.hpp] 58191 58192['Convenience header: ][^boost/asio.hpp] 58193 58194 58195[endsect] 58196 58197 58198 58199[section:next_layer buffered_write_stream::next_layer] 58200 58201[indexterm2 boost_asio.indexterm.buffered_write_stream.next_layer..next_layer..buffered_write_stream] 58202Get a reference to the next layer. 58203 58204 58205 next_layer_type & next_layer(); 58206 58207 58208 58209[endsect] 58210 58211 58212 58213[section:next_layer_type buffered_write_stream::next_layer_type] 58214 58215[indexterm2 boost_asio.indexterm.buffered_write_stream.next_layer_type..next_layer_type..buffered_write_stream] 58216The type of the next layer. 58217 58218 58219 typedef remove_reference< Stream >::type next_layer_type; 58220 58221 58222 58223[heading Requirements] 58224 58225['Header: ][^boost/asio/buffered_write_stream.hpp] 58226 58227['Convenience header: ][^boost/asio.hpp] 58228 58229 58230[endsect] 58231 58232 58233[section:peek buffered_write_stream::peek] 58234 58235[indexterm2 boost_asio.indexterm.buffered_write_stream.peek..peek..buffered_write_stream] 58236Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure. 58237 58238 58239 template< 58240 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 58241 std::size_t ``[link boost_asio.reference.buffered_write_stream.peek.overload1 peek]``( 58242 const MutableBufferSequence & buffers); 58243 `` [''''»''' [link boost_asio.reference.buffered_write_stream.peek.overload1 more...]]`` 58244 58245 58246Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred. 58247 58248 58249 template< 58250 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 58251 std::size_t ``[link boost_asio.reference.buffered_write_stream.peek.overload2 peek]``( 58252 const MutableBufferSequence & buffers, 58253 boost::system::error_code & ec); 58254 `` [''''»''' [link boost_asio.reference.buffered_write_stream.peek.overload2 more...]]`` 58255 58256 58257[section:overload1 buffered_write_stream::peek (1 of 2 overloads)] 58258 58259 58260Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure. 58261 58262 58263 template< 58264 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 58265 std::size_t peek( 58266 const MutableBufferSequence & buffers); 58267 58268 58269 58270[endsect] 58271 58272 58273 58274[section:overload2 buffered_write_stream::peek (2 of 2 overloads)] 58275 58276 58277Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred. 58278 58279 58280 template< 58281 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 58282 std::size_t peek( 58283 const MutableBufferSequence & buffers, 58284 boost::system::error_code & ec); 58285 58286 58287 58288[endsect] 58289 58290 58291[endsect] 58292 58293[section:read_some buffered_write_stream::read_some] 58294 58295[indexterm2 boost_asio.indexterm.buffered_write_stream.read_some..read_some..buffered_write_stream] 58296Read some data from the stream. Returns the number of bytes read. Throws an exception on failure. 58297 58298 58299 template< 58300 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 58301 std::size_t ``[link boost_asio.reference.buffered_write_stream.read_some.overload1 read_some]``( 58302 const MutableBufferSequence & buffers); 58303 `` [''''»''' [link boost_asio.reference.buffered_write_stream.read_some.overload1 more...]]`` 58304 58305 58306Read some data from the stream. Returns the number of bytes read or 0 if an error occurred. 58307 58308 58309 template< 58310 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 58311 std::size_t ``[link boost_asio.reference.buffered_write_stream.read_some.overload2 read_some]``( 58312 const MutableBufferSequence & buffers, 58313 boost::system::error_code & ec); 58314 `` [''''»''' [link boost_asio.reference.buffered_write_stream.read_some.overload2 more...]]`` 58315 58316 58317[section:overload1 buffered_write_stream::read_some (1 of 2 overloads)] 58318 58319 58320Read some data from the stream. Returns the number of bytes read. Throws an exception on failure. 58321 58322 58323 template< 58324 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 58325 std::size_t read_some( 58326 const MutableBufferSequence & buffers); 58327 58328 58329 58330[endsect] 58331 58332 58333 58334[section:overload2 buffered_write_stream::read_some (2 of 2 overloads)] 58335 58336 58337Read some data from the stream. Returns the number of bytes read or 0 if an error occurred. 58338 58339 58340 template< 58341 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 58342 std::size_t read_some( 58343 const MutableBufferSequence & buffers, 58344 boost::system::error_code & ec); 58345 58346 58347 58348[endsect] 58349 58350 58351[endsect] 58352 58353[section:write_some buffered_write_stream::write_some] 58354 58355[indexterm2 boost_asio.indexterm.buffered_write_stream.write_some..write_some..buffered_write_stream] 58356Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure. 58357 58358 58359 template< 58360 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 58361 std::size_t ``[link boost_asio.reference.buffered_write_stream.write_some.overload1 write_some]``( 58362 const ConstBufferSequence & buffers); 58363 `` [''''»''' [link boost_asio.reference.buffered_write_stream.write_some.overload1 more...]]`` 58364 58365 58366Write 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. 58367 58368 58369 template< 58370 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 58371 std::size_t ``[link boost_asio.reference.buffered_write_stream.write_some.overload2 write_some]``( 58372 const ConstBufferSequence & buffers, 58373 boost::system::error_code & ec); 58374 `` [''''»''' [link boost_asio.reference.buffered_write_stream.write_some.overload2 more...]]`` 58375 58376 58377[section:overload1 buffered_write_stream::write_some (1 of 2 overloads)] 58378 58379 58380Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure. 58381 58382 58383 template< 58384 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 58385 std::size_t write_some( 58386 const ConstBufferSequence & buffers); 58387 58388 58389 58390[endsect] 58391 58392 58393 58394[section:overload2 buffered_write_stream::write_some (2 of 2 overloads)] 58395 58396 58397Write 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. 58398 58399 58400 template< 58401 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 58402 std::size_t write_some( 58403 const ConstBufferSequence & buffers, 58404 boost::system::error_code & ec); 58405 58406 58407 58408[endsect] 58409 58410 58411[endsect] 58412 58413 58414[endsect] 58415 58416 58417[section:buffers_begin buffers_begin] 58418 58419[indexterm1 boost_asio.indexterm.buffers_begin..buffers_begin] 58420Construct an iterator representing the beginning of the buffers' data. 58421 58422 58423 template< 58424 typename BufferSequence> 58425 buffers_iterator< BufferSequence > buffers_begin( 58426 const BufferSequence & buffers); 58427 58428 58429[heading Requirements] 58430 58431['Header: ][^boost/asio/buffers_iterator.hpp] 58432 58433['Convenience header: ][^boost/asio.hpp] 58434 58435 58436[endsect] 58437 58438 58439 58440[section:buffers_end buffers_end] 58441 58442[indexterm1 boost_asio.indexterm.buffers_end..buffers_end] 58443Construct an iterator representing the end of the buffers' data. 58444 58445 58446 template< 58447 typename BufferSequence> 58448 buffers_iterator< BufferSequence > buffers_end( 58449 const BufferSequence & buffers); 58450 58451 58452[heading Requirements] 58453 58454['Header: ][^boost/asio/buffers_iterator.hpp] 58455 58456['Convenience header: ][^boost/asio.hpp] 58457 58458 58459[endsect] 58460 58461 58462[section:buffers_iterator buffers_iterator] 58463 58464[indexterm1 boost_asio.indexterm.buffers_iterator..buffers_iterator] 58465 58466 58467A random access iterator over the bytes in a buffer sequence. 58468 58469 58470 template< 58471 typename BufferSequence, 58472 typename ByteType = char> 58473 class buffers_iterator 58474 58475 58476[heading Types] 58477[table 58478 [[Name][Description]] 58479 58480 [ 58481 58482 [[link boost_asio.reference.buffers_iterator.difference_type [*difference_type]]] 58483 [The type used for the distance between two iterators. ] 58484 58485 ] 58486 58487 [ 58488 58489 [[link boost_asio.reference.buffers_iterator.iterator_category [*iterator_category]]] 58490 [The iterator category. ] 58491 58492 ] 58493 58494 [ 58495 58496 [[link boost_asio.reference.buffers_iterator.pointer [*pointer]]] 58497 [The type of the result of applying operator->() to the iterator. ] 58498 58499 ] 58500 58501 [ 58502 58503 [[link boost_asio.reference.buffers_iterator.reference [*reference]]] 58504 [The type of the result of applying operator*() to the iterator. ] 58505 58506 ] 58507 58508 [ 58509 58510 [[link boost_asio.reference.buffers_iterator.value_type [*value_type]]] 58511 [The type of the value pointed to by the iterator. ] 58512 58513 ] 58514 58515] 58516 58517[heading Member Functions] 58518[table 58519 [[Name][Description]] 58520 58521 [ 58522 [[link boost_asio.reference.buffers_iterator.begin [*begin]] [static]] 58523 [Construct an iterator representing the beginning of the buffers' data. ] 58524 ] 58525 58526 [ 58527 [[link boost_asio.reference.buffers_iterator.buffers_iterator [*buffers_iterator]] [constructor]] 58528 [Default constructor. Creates an iterator in an undefined state. ] 58529 ] 58530 58531 [ 58532 [[link boost_asio.reference.buffers_iterator.end [*end]] [static]] 58533 [Construct an iterator representing the end of the buffers' data. ] 58534 ] 58535 58536 [ 58537 [[link boost_asio.reference.buffers_iterator.operator__star_ [*operator *]]] 58538 [Dereference an iterator. ] 58539 ] 58540 58541 [ 58542 [[link boost_asio.reference.buffers_iterator.operator_plus__plus_ [*operator++]]] 58543 [Increment operator (prefix). 58544 [hr] 58545 Increment operator (postfix). ] 58546 ] 58547 58548 [ 58549 [[link boost_asio.reference.buffers_iterator.operator_plus__eq_ [*operator+=]]] 58550 [Addition operator. ] 58551 ] 58552 58553 [ 58554 [[link boost_asio.reference.buffers_iterator.operator_minus__minus_ [*operator--]]] 58555 [Decrement operator (prefix). 58556 [hr] 58557 Decrement operator (postfix). ] 58558 ] 58559 58560 [ 58561 [[link boost_asio.reference.buffers_iterator.operator_minus__eq_ [*operator-=]]] 58562 [Subtraction operator. ] 58563 ] 58564 58565 [ 58566 [[link boost_asio.reference.buffers_iterator.operator_arrow_ [*operator->]]] 58567 [Dereference an iterator. ] 58568 ] 58569 58570 [ 58571 [[link boost_asio.reference.buffers_iterator.operator_lb__rb_ [*operator\[\]]]] 58572 [Access an individual element. ] 58573 ] 58574 58575] 58576 58577[heading Friends] 58578[table 58579 [[Name][Description]] 58580 58581 [ 58582 [[link boost_asio.reference.buffers_iterator.operator_not__eq_ [*operator!=]]] 58583 [Test two iterators for inequality. ] 58584 ] 58585 58586 [ 58587 [[link boost_asio.reference.buffers_iterator.operator_plus_ [*operator+]]] 58588 [Addition operator. ] 58589 ] 58590 58591 [ 58592 [[link boost_asio.reference.buffers_iterator.operator_minus_ [*operator-]]] 58593 [Subtraction operator. ] 58594 ] 58595 58596 [ 58597 [[link boost_asio.reference.buffers_iterator.operator_lt_ [*operator<]]] 58598 [Compare two iterators. ] 58599 ] 58600 58601 [ 58602 [[link boost_asio.reference.buffers_iterator.operator_lt__eq_ [*operator<=]]] 58603 [Compare two iterators. ] 58604 ] 58605 58606 [ 58607 [[link boost_asio.reference.buffers_iterator.operator_eq__eq_ [*operator==]]] 58608 [Test two iterators for equality. ] 58609 ] 58610 58611 [ 58612 [[link boost_asio.reference.buffers_iterator.operator_gt_ [*operator>]]] 58613 [Compare two iterators. ] 58614 ] 58615 58616 [ 58617 [[link boost_asio.reference.buffers_iterator.operator_gt__eq_ [*operator>=]]] 58618 [Compare two iterators. ] 58619 ] 58620 58621] 58622 58623[heading Requirements] 58624 58625['Header: ][^boost/asio/buffers_iterator.hpp] 58626 58627['Convenience header: ][^boost/asio.hpp] 58628 58629 58630[section:begin buffers_iterator::begin] 58631 58632[indexterm2 boost_asio.indexterm.buffers_iterator.begin..begin..buffers_iterator] 58633Construct an iterator representing the beginning of the buffers' data. 58634 58635 58636 static buffers_iterator begin( 58637 const BufferSequence & buffers); 58638 58639 58640 58641[endsect] 58642 58643 58644 58645[section:buffers_iterator buffers_iterator::buffers_iterator] 58646 58647[indexterm2 boost_asio.indexterm.buffers_iterator.buffers_iterator..buffers_iterator..buffers_iterator] 58648Default constructor. Creates an iterator in an undefined state. 58649 58650 58651 buffers_iterator(); 58652 58653 58654 58655[endsect] 58656 58657 58658 58659[section:difference_type buffers_iterator::difference_type] 58660 58661[indexterm2 boost_asio.indexterm.buffers_iterator.difference_type..difference_type..buffers_iterator] 58662The type used for the distance between two iterators. 58663 58664 58665 typedef std::ptrdiff_t difference_type; 58666 58667 58668 58669[heading Requirements] 58670 58671['Header: ][^boost/asio/buffers_iterator.hpp] 58672 58673['Convenience header: ][^boost/asio.hpp] 58674 58675 58676[endsect] 58677 58678 58679 58680[section:end buffers_iterator::end] 58681 58682[indexterm2 boost_asio.indexterm.buffers_iterator.end..end..buffers_iterator] 58683Construct an iterator representing the end of the buffers' data. 58684 58685 58686 static buffers_iterator end( 58687 const BufferSequence & buffers); 58688 58689 58690 58691[endsect] 58692 58693 58694 58695[section:iterator_category buffers_iterator::iterator_category] 58696 58697[indexterm2 boost_asio.indexterm.buffers_iterator.iterator_category..iterator_category..buffers_iterator] 58698The iterator category. 58699 58700 58701 typedef std::random_access_iterator_tag iterator_category; 58702 58703 58704 58705[heading Requirements] 58706 58707['Header: ][^boost/asio/buffers_iterator.hpp] 58708 58709['Convenience header: ][^boost/asio.hpp] 58710 58711 58712[endsect] 58713 58714 58715 58716[section:operator__star_ buffers_iterator::operator *] 58717 58718[indexterm2 boost_asio.indexterm.buffers_iterator.operator__star_..operator *..buffers_iterator] 58719Dereference an iterator. 58720 58721 58722 reference operator *() const; 58723 58724 58725 58726[endsect] 58727 58728 58729 58730[section:operator_not__eq_ buffers_iterator::operator!=] 58731 58732[indexterm2 boost_asio.indexterm.buffers_iterator.operator_not__eq_..operator!=..buffers_iterator] 58733Test two iterators for inequality. 58734 58735 58736 friend bool operator!=( 58737 const buffers_iterator & a, 58738 const buffers_iterator & b); 58739 58740 58741[heading Requirements] 58742 58743['Header: ][^boost/asio/buffers_iterator.hpp] 58744 58745['Convenience header: ][^boost/asio.hpp] 58746 58747 58748[endsect] 58749 58750 58751[section:operator_plus_ buffers_iterator::operator+] 58752 58753[indexterm2 boost_asio.indexterm.buffers_iterator.operator_plus_..operator+..buffers_iterator] 58754Addition operator. 58755 58756 58757 friend buffers_iterator ``[link boost_asio.reference.buffers_iterator.operator_plus_.overload1 operator+]``( 58758 const buffers_iterator & iter, 58759 std::ptrdiff_t difference); 58760 `` [''''»''' [link boost_asio.reference.buffers_iterator.operator_plus_.overload1 more...]]`` 58761 58762 friend buffers_iterator ``[link boost_asio.reference.buffers_iterator.operator_plus_.overload2 operator+]``( 58763 std::ptrdiff_t difference, 58764 const buffers_iterator & iter); 58765 `` [''''»''' [link boost_asio.reference.buffers_iterator.operator_plus_.overload2 more...]]`` 58766 58767 58768[section:overload1 buffers_iterator::operator+ (1 of 2 overloads)] 58769 58770 58771Addition operator. 58772 58773 58774 friend buffers_iterator operator+( 58775 const buffers_iterator & iter, 58776 std::ptrdiff_t difference); 58777 58778 58779[heading Requirements] 58780 58781['Header: ][^boost/asio/buffers_iterator.hpp] 58782 58783['Convenience header: ][^boost/asio.hpp] 58784 58785 58786[endsect] 58787 58788 58789 58790[section:overload2 buffers_iterator::operator+ (2 of 2 overloads)] 58791 58792 58793Addition operator. 58794 58795 58796 friend buffers_iterator operator+( 58797 std::ptrdiff_t difference, 58798 const buffers_iterator & iter); 58799 58800 58801[heading Requirements] 58802 58803['Header: ][^boost/asio/buffers_iterator.hpp] 58804 58805['Convenience header: ][^boost/asio.hpp] 58806 58807 58808[endsect] 58809 58810 58811[endsect] 58812 58813[section:operator_plus__plus_ buffers_iterator::operator++] 58814 58815[indexterm2 boost_asio.indexterm.buffers_iterator.operator_plus__plus_..operator++..buffers_iterator] 58816Increment operator (prefix). 58817 58818 58819 buffers_iterator & ``[link boost_asio.reference.buffers_iterator.operator_plus__plus_.overload1 operator++]``(); 58820 `` [''''»''' [link boost_asio.reference.buffers_iterator.operator_plus__plus_.overload1 more...]]`` 58821 58822 58823Increment operator (postfix). 58824 58825 58826 buffers_iterator ``[link boost_asio.reference.buffers_iterator.operator_plus__plus_.overload2 operator++]``( 58827 int ); 58828 `` [''''»''' [link boost_asio.reference.buffers_iterator.operator_plus__plus_.overload2 more...]]`` 58829 58830 58831[section:overload1 buffers_iterator::operator++ (1 of 2 overloads)] 58832 58833 58834Increment operator (prefix). 58835 58836 58837 buffers_iterator & operator++(); 58838 58839 58840 58841[endsect] 58842 58843 58844 58845[section:overload2 buffers_iterator::operator++ (2 of 2 overloads)] 58846 58847 58848Increment operator (postfix). 58849 58850 58851 buffers_iterator operator++( 58852 int ); 58853 58854 58855 58856[endsect] 58857 58858 58859[endsect] 58860 58861 58862[section:operator_plus__eq_ buffers_iterator::operator+=] 58863 58864[indexterm2 boost_asio.indexterm.buffers_iterator.operator_plus__eq_..operator+=..buffers_iterator] 58865Addition operator. 58866 58867 58868 buffers_iterator & operator+=( 58869 std::ptrdiff_t difference); 58870 58871 58872 58873[endsect] 58874 58875 58876[section:operator_minus_ buffers_iterator::operator-] 58877 58878[indexterm2 boost_asio.indexterm.buffers_iterator.operator_minus_..operator-..buffers_iterator] 58879Subtraction operator. 58880 58881 58882 friend buffers_iterator ``[link boost_asio.reference.buffers_iterator.operator_minus_.overload1 operator-]``( 58883 const buffers_iterator & iter, 58884 std::ptrdiff_t difference); 58885 `` [''''»''' [link boost_asio.reference.buffers_iterator.operator_minus_.overload1 more...]]`` 58886 58887 friend std::ptrdiff_t ``[link boost_asio.reference.buffers_iterator.operator_minus_.overload2 operator-]``( 58888 const buffers_iterator & a, 58889 const buffers_iterator & b); 58890 `` [''''»''' [link boost_asio.reference.buffers_iterator.operator_minus_.overload2 more...]]`` 58891 58892 58893[section:overload1 buffers_iterator::operator- (1 of 2 overloads)] 58894 58895 58896Subtraction operator. 58897 58898 58899 friend buffers_iterator operator-( 58900 const buffers_iterator & iter, 58901 std::ptrdiff_t difference); 58902 58903 58904[heading Requirements] 58905 58906['Header: ][^boost/asio/buffers_iterator.hpp] 58907 58908['Convenience header: ][^boost/asio.hpp] 58909 58910 58911[endsect] 58912 58913 58914 58915[section:overload2 buffers_iterator::operator- (2 of 2 overloads)] 58916 58917 58918Subtraction operator. 58919 58920 58921 friend std::ptrdiff_t operator-( 58922 const buffers_iterator & a, 58923 const buffers_iterator & b); 58924 58925 58926[heading Requirements] 58927 58928['Header: ][^boost/asio/buffers_iterator.hpp] 58929 58930['Convenience header: ][^boost/asio.hpp] 58931 58932 58933[endsect] 58934 58935 58936[endsect] 58937 58938[section:operator_minus__minus_ buffers_iterator::operator--] 58939 58940[indexterm2 boost_asio.indexterm.buffers_iterator.operator_minus__minus_..operator--..buffers_iterator] 58941Decrement operator (prefix). 58942 58943 58944 buffers_iterator & ``[link boost_asio.reference.buffers_iterator.operator_minus__minus_.overload1 operator--]``(); 58945 `` [''''»''' [link boost_asio.reference.buffers_iterator.operator_minus__minus_.overload1 more...]]`` 58946 58947 58948Decrement operator (postfix). 58949 58950 58951 buffers_iterator ``[link boost_asio.reference.buffers_iterator.operator_minus__minus_.overload2 operator--]``( 58952 int ); 58953 `` [''''»''' [link boost_asio.reference.buffers_iterator.operator_minus__minus_.overload2 more...]]`` 58954 58955 58956[section:overload1 buffers_iterator::operator-- (1 of 2 overloads)] 58957 58958 58959Decrement operator (prefix). 58960 58961 58962 buffers_iterator & operator--(); 58963 58964 58965 58966[endsect] 58967 58968 58969 58970[section:overload2 buffers_iterator::operator-- (2 of 2 overloads)] 58971 58972 58973Decrement operator (postfix). 58974 58975 58976 buffers_iterator operator--( 58977 int ); 58978 58979 58980 58981[endsect] 58982 58983 58984[endsect] 58985 58986 58987[section:operator_minus__eq_ buffers_iterator::operator-=] 58988 58989[indexterm2 boost_asio.indexterm.buffers_iterator.operator_minus__eq_..operator-=..buffers_iterator] 58990Subtraction operator. 58991 58992 58993 buffers_iterator & operator-=( 58994 std::ptrdiff_t difference); 58995 58996 58997 58998[endsect] 58999 59000 59001 59002[section:operator_arrow_ buffers_iterator::operator->] 59003 59004[indexterm2 boost_asio.indexterm.buffers_iterator.operator_arrow_..operator->..buffers_iterator] 59005Dereference an iterator. 59006 59007 59008 pointer operator->() const; 59009 59010 59011 59012[endsect] 59013 59014 59015 59016[section:operator_lt_ buffers_iterator::operator<] 59017 59018[indexterm2 boost_asio.indexterm.buffers_iterator.operator_lt_..operator<..buffers_iterator] 59019Compare two iterators. 59020 59021 59022 friend bool operator<( 59023 const buffers_iterator & a, 59024 const buffers_iterator & b); 59025 59026 59027[heading Requirements] 59028 59029['Header: ][^boost/asio/buffers_iterator.hpp] 59030 59031['Convenience header: ][^boost/asio.hpp] 59032 59033 59034[endsect] 59035 59036 59037 59038[section:operator_lt__eq_ buffers_iterator::operator<=] 59039 59040[indexterm2 boost_asio.indexterm.buffers_iterator.operator_lt__eq_..operator<=..buffers_iterator] 59041Compare two iterators. 59042 59043 59044 friend bool operator<=( 59045 const buffers_iterator & a, 59046 const buffers_iterator & b); 59047 59048 59049[heading Requirements] 59050 59051['Header: ][^boost/asio/buffers_iterator.hpp] 59052 59053['Convenience header: ][^boost/asio.hpp] 59054 59055 59056[endsect] 59057 59058 59059 59060[section:operator_eq__eq_ buffers_iterator::operator==] 59061 59062[indexterm2 boost_asio.indexterm.buffers_iterator.operator_eq__eq_..operator==..buffers_iterator] 59063Test two iterators for equality. 59064 59065 59066 friend bool operator==( 59067 const buffers_iterator & a, 59068 const buffers_iterator & b); 59069 59070 59071[heading Requirements] 59072 59073['Header: ][^boost/asio/buffers_iterator.hpp] 59074 59075['Convenience header: ][^boost/asio.hpp] 59076 59077 59078[endsect] 59079 59080 59081 59082[section:operator_gt_ buffers_iterator::operator>] 59083 59084[indexterm2 boost_asio.indexterm.buffers_iterator.operator_gt_..operator>..buffers_iterator] 59085Compare two iterators. 59086 59087 59088 friend bool operator>( 59089 const buffers_iterator & a, 59090 const buffers_iterator & b); 59091 59092 59093[heading Requirements] 59094 59095['Header: ][^boost/asio/buffers_iterator.hpp] 59096 59097['Convenience header: ][^boost/asio.hpp] 59098 59099 59100[endsect] 59101 59102 59103 59104[section:operator_gt__eq_ buffers_iterator::operator>=] 59105 59106[indexterm2 boost_asio.indexterm.buffers_iterator.operator_gt__eq_..operator>=..buffers_iterator] 59107Compare two iterators. 59108 59109 59110 friend bool operator>=( 59111 const buffers_iterator & a, 59112 const buffers_iterator & b); 59113 59114 59115[heading Requirements] 59116 59117['Header: ][^boost/asio/buffers_iterator.hpp] 59118 59119['Convenience header: ][^boost/asio.hpp] 59120 59121 59122[endsect] 59123 59124 59125 59126[section:operator_lb__rb_ buffers_iterator::operator\[\]] 59127 59128[indexterm2 boost_asio.indexterm.buffers_iterator.operator_lb__rb_..operator\[\]..buffers_iterator] 59129Access an individual element. 59130 59131 59132 reference operator[]( 59133 std::ptrdiff_t difference) const; 59134 59135 59136 59137[endsect] 59138 59139 59140 59141[section:pointer buffers_iterator::pointer] 59142 59143[indexterm2 boost_asio.indexterm.buffers_iterator.pointer..pointer..buffers_iterator] 59144The type of the result of applying `operator->()` to the iterator. 59145 59146 59147 typedef const_or_non_const_ByteType * pointer; 59148 59149 59150 59151If 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. 59152 59153[heading Requirements] 59154 59155['Header: ][^boost/asio/buffers_iterator.hpp] 59156 59157['Convenience header: ][^boost/asio.hpp] 59158 59159 59160[endsect] 59161 59162 59163 59164[section:reference buffers_iterator::reference] 59165 59166[indexterm2 boost_asio.indexterm.buffers_iterator.reference..reference..buffers_iterator] 59167The type of the result of applying `operator*()` to the iterator. 59168 59169 59170 typedef const_or_non_const_ByteType & reference; 59171 59172 59173 59174If 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. 59175 59176[heading Requirements] 59177 59178['Header: ][^boost/asio/buffers_iterator.hpp] 59179 59180['Convenience header: ][^boost/asio.hpp] 59181 59182 59183[endsect] 59184 59185 59186 59187[section:value_type buffers_iterator::value_type] 59188 59189[indexterm2 boost_asio.indexterm.buffers_iterator.value_type..value_type..buffers_iterator] 59190The type of the value pointed to by the iterator. 59191 59192 59193 typedef ByteType value_type; 59194 59195 59196 59197[heading Requirements] 59198 59199['Header: ][^boost/asio/buffers_iterator.hpp] 59200 59201['Convenience header: ][^boost/asio.hpp] 59202 59203 59204[endsect] 59205 59206 59207 59208[endsect] 59209 59210[section:can_prefer can_prefer] 59211 59212[indexterm1 boost_asio.indexterm.can_prefer..can_prefer] 59213 59214 59215A type trait that determines whether a `prefer` expression is well-formed. 59216 59217 59218 template< 59219 typename T, 59220 typename... Properties> 59221 struct can_prefer 59222 59223 59224Class template `can_prefer` is a trait that is derived from `true_type` if the expression `boost::asio::prefer(std::declval<T>(), std::declval<Properties>()...)` is well formed; otherwise `false_type`. 59225 59226[heading Requirements] 59227 59228['Header: ][^boost/asio/prefer.hpp] 59229 59230['Convenience header: ][^boost/asio.hpp] 59231 59232 59233[endsect] 59234 59235[section:can_query can_query] 59236 59237[indexterm1 boost_asio.indexterm.can_query..can_query] 59238 59239 59240A type trait that determines whether a `query` expression is well-formed. 59241 59242 59243 template< 59244 typename T, 59245 typename Property> 59246 struct can_query 59247 59248 59249Class template `can_query` is a trait that is derived from `true_type` if the expression `boost::asio::query(std::declval<T>(), std::declval<Property>())` is well formed; otherwise `false_type`. 59250 59251[heading Requirements] 59252 59253['Header: ][^boost/asio/query.hpp] 59254 59255['Convenience header: ][^boost/asio.hpp] 59256 59257 59258[endsect] 59259 59260[section:can_require can_require] 59261 59262[indexterm1 boost_asio.indexterm.can_require..can_require] 59263 59264 59265A type trait that determines whether a `require` expression is well-formed. 59266 59267 59268 template< 59269 typename T, 59270 typename... Properties> 59271 struct can_require 59272 59273 59274Class template `can_require` is a trait that is derived from `true_type` if the expression `boost::asio::require(std::declval<T>(), std::declval<Properties>()...)` is well formed; otherwise `false_type`. 59275 59276[heading Requirements] 59277 59278['Header: ][^boost/asio/require.hpp] 59279 59280['Convenience header: ][^boost/asio.hpp] 59281 59282 59283[endsect] 59284 59285[section:can_require_concept can_require_concept] 59286 59287[indexterm1 boost_asio.indexterm.can_require_concept..can_require_concept] 59288 59289 59290A type trait that determines whether a `require_concept` expression is well-formed. 59291 59292 59293 template< 59294 typename T, 59295 typename Property> 59296 struct can_require_concept 59297 59298 59299Class template `can_require_concept` is a trait that is derived from `true_type` if the expression `boost::asio::require_concept(std::declval<T>(), std::declval<Property>())` is well formed; otherwise `false_type`. 59300 59301[heading Requirements] 59302 59303['Header: ][^boost/asio/require_concept.hpp] 59304 59305['Convenience header: ][^boost/asio.hpp] 59306 59307 59308[endsect] 59309 59310[section:co_spawn co_spawn] 59311 59312[indexterm1 boost_asio.indexterm.co_spawn..co_spawn] 59313Spawn a new coroutined-based thread of execution. 59314 59315 template< 59316 typename ``[link boost_asio.reference.Executor1 Executor]``, 59317 typename T, 59318 typename ``[link boost_asio.reference.Executor1 AwaitableExecutor]``, 59319 typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 59320 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.co_spawn.overload1 co_spawn]``( 59321 const Executor & ex, 59322 awaitable< T, AwaitableExecutor > a, 59323 CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 59324 typename constraint< (is_executor< Executor >::value||execution::is_executor< Executor >::value)&&is_convertible< Executor, AwaitableExecutor >::value >::type = 0); 59325 `` [''''»''' [link boost_asio.reference.co_spawn.overload1 more...]]`` 59326 59327 template< 59328 typename ``[link boost_asio.reference.Executor1 Executor]``, 59329 typename ``[link boost_asio.reference.Executor1 AwaitableExecutor]``, 59330 typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 59331 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.co_spawn.overload2 co_spawn]``( 59332 const Executor & ex, 59333 awaitable< void, AwaitableExecutor > a, 59334 CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 59335 typename constraint< (is_executor< Executor >::value||execution::is_executor< Executor >::value)&&is_convertible< Executor, AwaitableExecutor >::value >::type = 0); 59336 `` [''''»''' [link boost_asio.reference.co_spawn.overload2 more...]]`` 59337 59338 template< 59339 typename ExecutionContext, 59340 typename T, 59341 typename ``[link boost_asio.reference.Executor1 AwaitableExecutor]``, 59342 typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 59343 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.co_spawn.overload3 co_spawn]``( 59344 ExecutionContext & ctx, 59345 awaitable< T, AwaitableExecutor > a, 59346 CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 59347 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value &&is_convertible< typename ExecutionContext::executor_type, AwaitableExecutor >::value >::type = 0); 59348 `` [''''»''' [link boost_asio.reference.co_spawn.overload3 more...]]`` 59349 59350 template< 59351 typename ExecutionContext, 59352 typename ``[link boost_asio.reference.Executor1 AwaitableExecutor]``, 59353 typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 59354 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.co_spawn.overload4 co_spawn]``( 59355 ExecutionContext & ctx, 59356 awaitable< void, AwaitableExecutor > a, 59357 CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 59358 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value &&is_convertible< typename ExecutionContext::executor_type, AwaitableExecutor >::value >::type = 0); 59359 `` [''''»''' [link boost_asio.reference.co_spawn.overload4 more...]]`` 59360 59361 template< 59362 typename ``[link boost_asio.reference.Executor1 Executor]``, 59363 typename F, 59364 typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 59365 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.co_spawn.overload5 co_spawn]``( 59366 const Executor & ex, 59367 F && f, 59368 CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 59369 typename constraint< is_executor< Executor >::value||execution::is_executor< Executor >::value >::type = 0); 59370 `` [''''»''' [link boost_asio.reference.co_spawn.overload5 more...]]`` 59371 59372 template< 59373 typename ExecutionContext, 59374 typename F, 59375 typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 59376 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.co_spawn.overload6 co_spawn]``( 59377 ExecutionContext & ctx, 59378 F && f, 59379 CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 59380 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 59381 `` [''''»''' [link boost_asio.reference.co_spawn.overload6 more...]]`` 59382 59383[heading Requirements] 59384 59385['Header: ][^boost/asio/co_spawn.hpp] 59386 59387['Convenience header: ][^boost/asio.hpp] 59388 59389 59390[section:overload1 co_spawn (1 of 6 overloads)] 59391 59392 59393Spawn a new coroutined-based thread of execution. 59394 59395 59396 template< 59397 typename ``[link boost_asio.reference.Executor1 Executor]``, 59398 typename T, 59399 typename ``[link boost_asio.reference.Executor1 AwaitableExecutor]``, 59400 typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 59401 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` co_spawn( 59402 const Executor & ex, 59403 awaitable< T, AwaitableExecutor > a, 59404 CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 59405 typename constraint< (is_executor< Executor >::value||execution::is_executor< Executor >::value)&&is_convertible< Executor, AwaitableExecutor >::value >::type = 0); 59406 59407 59408 59409[heading Parameters] 59410 59411 59412[variablelist 59413 59414[[ex][The executor that will be used to schedule the new thread of execution.]] 59415 59416[[a][The [link boost_asio.reference.awaitable `awaitable`] object that is the result of calling the coroutine's entry point function.]] 59417 59418[[token][The completion token that will handle the notification that the thread of execution has completed. The function signature of the completion handler must be: 59419`` 59420 void handler(std::exception_ptr, T); 59421`` 59422]] 59423 59424] 59425 59426 59427[heading Example] 59428 59429 59430 59431 boost::asio::awaitable<std::size_t> echo(tcp::socket socket) 59432 { 59433 std::size_t bytes_transferred = 0; 59434 59435 try 59436 { 59437 char data[1024]; 59438 for (;;) 59439 { 59440 std::size_t n = co_await socket.async_read_some( 59441 boost::asio::buffer(data), boost::asio::use_awaitable); 59442 59443 co_await boost::asio::async_write(socket, 59444 boost::asio::buffer(data, n), boost::asio::use_awaitable); 59445 59446 bytes_transferred += n; 59447 } 59448 } 59449 catch (const std::exception&) 59450 { 59451 } 59452 59453 co_return bytes_transferred; 59454 } 59455 59456 // ... 59457 59458 boost::asio::co_spawn(my_executor, 59459 echo(std::move(my_tcp_socket)), 59460 [](std::exception_ptr e, std::size_t n) 59461 { 59462 std::cout << "transferred " << n << "\n"; 59463 }); 59464 59465 59466 59467 59468 59469 59470 59471[endsect] 59472 59473 59474 59475[section:overload2 co_spawn (2 of 6 overloads)] 59476 59477 59478Spawn a new coroutined-based thread of execution. 59479 59480 59481 template< 59482 typename ``[link boost_asio.reference.Executor1 Executor]``, 59483 typename ``[link boost_asio.reference.Executor1 AwaitableExecutor]``, 59484 typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 59485 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` co_spawn( 59486 const Executor & ex, 59487 awaitable< void, AwaitableExecutor > a, 59488 CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 59489 typename constraint< (is_executor< Executor >::value||execution::is_executor< Executor >::value)&&is_convertible< Executor, AwaitableExecutor >::value >::type = 0); 59490 59491 59492 59493[heading Parameters] 59494 59495 59496[variablelist 59497 59498[[ex][The executor that will be used to schedule the new thread of execution.]] 59499 59500[[a][The [link boost_asio.reference.awaitable `awaitable`] object that is the result of calling the coroutine's entry point function.]] 59501 59502[[token][The completion token that will handle the notification that the thread of execution has completed. The function signature of the completion handler must be: 59503`` 59504 void handler(std::exception_ptr); 59505`` 59506]] 59507 59508] 59509 59510 59511[heading Example] 59512 59513 59514 59515 boost::asio::awaitable<void> echo(tcp::socket socket) 59516 { 59517 try 59518 { 59519 char data[1024]; 59520 for (;;) 59521 { 59522 std::size_t n = co_await socket.async_read_some( 59523 boost::asio::buffer(data), boost::asio::use_awaitable); 59524 59525 co_await boost::asio::async_write(socket, 59526 boost::asio::buffer(data, n), boost::asio::use_awaitable); 59527 } 59528 } 59529 catch (const std::exception& e) 59530 { 59531 std::cerr << "Exception: " << e.what() << "\n"; 59532 } 59533 } 59534 59535 // ... 59536 59537 boost::asio::co_spawn(my_executor, 59538 echo(std::move(my_tcp_socket)), 59539 boost::asio::detached); 59540 59541 59542 59543 59544 59545 59546 59547[endsect] 59548 59549 59550 59551[section:overload3 co_spawn (3 of 6 overloads)] 59552 59553 59554Spawn a new coroutined-based thread of execution. 59555 59556 59557 template< 59558 typename ExecutionContext, 59559 typename T, 59560 typename ``[link boost_asio.reference.Executor1 AwaitableExecutor]``, 59561 typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 59562 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` co_spawn( 59563 ExecutionContext & ctx, 59564 awaitable< T, AwaitableExecutor > a, 59565 CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 59566 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value &&is_convertible< typename ExecutionContext::executor_type, AwaitableExecutor >::value >::type = 0); 59567 59568 59569 59570[heading Parameters] 59571 59572 59573[variablelist 59574 59575[[ctx][An execution context that will provide the executor to be used to schedule the new thread of execution.]] 59576 59577[[a][The [link boost_asio.reference.awaitable `awaitable`] object that is the result of calling the coroutine's entry point function.]] 59578 59579[[token][The completion token that will handle the notification that the thread of execution has completed. The function signature of the completion handler must be: 59580`` 59581 void handler(std::exception_ptr); 59582`` 59583]] 59584 59585] 59586 59587 59588[heading Example] 59589 59590 59591 59592 boost::asio::awaitable<std::size_t> echo(tcp::socket socket) 59593 { 59594 std::size_t bytes_transferred = 0; 59595 59596 try 59597 { 59598 char data[1024]; 59599 for (;;) 59600 { 59601 std::size_t n = co_await socket.async_read_some( 59602 boost::asio::buffer(data), boost::asio::use_awaitable); 59603 59604 co_await boost::asio::async_write(socket, 59605 boost::asio::buffer(data, n), boost::asio::use_awaitable); 59606 59607 bytes_transferred += n; 59608 } 59609 } 59610 catch (const std::exception&) 59611 { 59612 } 59613 59614 co_return bytes_transferred; 59615 } 59616 59617 // ... 59618 59619 boost::asio::co_spawn(my_io_context, 59620 echo(std::move(my_tcp_socket)), 59621 [](std::exception_ptr e, std::size_t n) 59622 { 59623 std::cout << "transferred " << n << "\n"; 59624 }); 59625 59626 59627 59628 59629 59630 59631 59632[endsect] 59633 59634 59635 59636[section:overload4 co_spawn (4 of 6 overloads)] 59637 59638 59639Spawn a new coroutined-based thread of execution. 59640 59641 59642 template< 59643 typename ExecutionContext, 59644 typename ``[link boost_asio.reference.Executor1 AwaitableExecutor]``, 59645 typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 59646 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` co_spawn( 59647 ExecutionContext & ctx, 59648 awaitable< void, AwaitableExecutor > a, 59649 CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 59650 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value &&is_convertible< typename ExecutionContext::executor_type, AwaitableExecutor >::value >::type = 0); 59651 59652 59653 59654[heading Parameters] 59655 59656 59657[variablelist 59658 59659[[ctx][An execution context that will provide the executor to be used to schedule the new thread of execution.]] 59660 59661[[a][The [link boost_asio.reference.awaitable `awaitable`] object that is the result of calling the coroutine's entry point function.]] 59662 59663[[token][The completion token that will handle the notification that the thread of execution has completed. The function signature of the completion handler must be: 59664`` 59665 void handler(std::exception_ptr); 59666`` 59667]] 59668 59669] 59670 59671 59672[heading Example] 59673 59674 59675 59676 boost::asio::awaitable<void> echo(tcp::socket socket) 59677 { 59678 try 59679 { 59680 char data[1024]; 59681 for (;;) 59682 { 59683 std::size_t n = co_await socket.async_read_some( 59684 boost::asio::buffer(data), boost::asio::use_awaitable); 59685 59686 co_await boost::asio::async_write(socket, 59687 boost::asio::buffer(data, n), boost::asio::use_awaitable); 59688 } 59689 } 59690 catch (const std::exception& e) 59691 { 59692 std::cerr << "Exception: " << e.what() << "\n"; 59693 } 59694 } 59695 59696 // ... 59697 59698 boost::asio::co_spawn(my_io_context, 59699 echo(std::move(my_tcp_socket)), 59700 boost::asio::detached); 59701 59702 59703 59704 59705 59706 59707 59708[endsect] 59709 59710 59711 59712[section:overload5 co_spawn (5 of 6 overloads)] 59713 59714 59715Spawn a new coroutined-based thread of execution. 59716 59717 59718 template< 59719 typename ``[link boost_asio.reference.Executor1 Executor]``, 59720 typename F, 59721 typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 59722 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` co_spawn( 59723 const Executor & ex, 59724 F && f, 59725 CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 59726 typename constraint< is_executor< Executor >::value||execution::is_executor< Executor >::value >::type = 0); 59727 59728 59729 59730[heading Parameters] 59731 59732 59733[variablelist 59734 59735[[ex][The executor that will be used to schedule the new thread of execution.]] 59736 59737[[f][A nullary function object with a return type of the form `boost::asio::awaitable<R,E>` that will be used as the coroutine's entry point.]] 59738 59739[[token][The completion token that will handle the notification that the thread of execution has completed. If `R` is `void`, the function signature of the completion handler must be:]] 59740 59741] 59742 59743 59744 59745 void handler(std::exception_ptr); 59746 59747 59748Otherwise, the function signature of the completion handler must be: 59749 59750 void handler(std::exception_ptr, R); 59751 59752 59753 59754 59755 59756[heading Example] 59757 59758 59759 59760 boost::asio::awaitable<std::size_t> echo(tcp::socket socket) 59761 { 59762 std::size_t bytes_transferred = 0; 59763 59764 try 59765 { 59766 char data[1024]; 59767 for (;;) 59768 { 59769 std::size_t n = co_await socket.async_read_some( 59770 boost::asio::buffer(data), boost::asio::use_awaitable); 59771 59772 co_await boost::asio::async_write(socket, 59773 boost::asio::buffer(data, n), boost::asio::use_awaitable); 59774 59775 bytes_transferred += n; 59776 } 59777 } 59778 catch (const std::exception&) 59779 { 59780 } 59781 59782 co_return bytes_transferred; 59783 } 59784 59785 // ... 59786 59787 boost::asio::co_spawn(my_executor, 59788 [socket = std::move(my_tcp_socket)]() mutable 59789 -> boost::asio::awaitable<void> 59790 { 59791 try 59792 { 59793 char data[1024]; 59794 for (;;) 59795 { 59796 std::size_t n = co_await socket.async_read_some( 59797 boost::asio::buffer(data), boost::asio::use_awaitable); 59798 59799 co_await boost::asio::async_write(socket, 59800 boost::asio::buffer(data, n), boost::asio::use_awaitable); 59801 } 59802 } 59803 catch (const std::exception& e) 59804 { 59805 std::cerr << "Exception: " << e.what() << "\n"; 59806 } 59807 }, boost::asio::detached); 59808 59809 59810 59811 59812 59813 59814 59815[endsect] 59816 59817 59818 59819[section:overload6 co_spawn (6 of 6 overloads)] 59820 59821 59822Spawn a new coroutined-based thread of execution. 59823 59824 59825 template< 59826 typename ExecutionContext, 59827 typename F, 59828 typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 59829 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` co_spawn( 59830 ExecutionContext & ctx, 59831 F && f, 59832 CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 59833 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 59834 59835 59836 59837[heading Parameters] 59838 59839 59840[variablelist 59841 59842[[ctx][An execution context that will provide the executor to be used to schedule the new thread of execution.]] 59843 59844[[f][A nullary function object with a return type of the form `boost::asio::awaitable<R,E>` that will be used as the coroutine's entry point.]] 59845 59846[[token][The completion token that will handle the notification that the thread of execution has completed. If `R` is `void`, the function signature of the completion handler must be:]] 59847 59848] 59849 59850 59851 59852 void handler(std::exception_ptr); 59853 59854 59855Otherwise, the function signature of the completion handler must be: 59856 59857 void handler(std::exception_ptr, R); 59858 59859 59860 59861 59862 59863[heading Example] 59864 59865 59866 59867 boost::asio::awaitable<std::size_t> echo(tcp::socket socket) 59868 { 59869 std::size_t bytes_transferred = 0; 59870 59871 try 59872 { 59873 char data[1024]; 59874 for (;;) 59875 { 59876 std::size_t n = co_await socket.async_read_some( 59877 boost::asio::buffer(data), boost::asio::use_awaitable); 59878 59879 co_await boost::asio::async_write(socket, 59880 boost::asio::buffer(data, n), boost::asio::use_awaitable); 59881 59882 bytes_transferred += n; 59883 } 59884 } 59885 catch (const std::exception&) 59886 { 59887 } 59888 59889 co_return bytes_transferred; 59890 } 59891 59892 // ... 59893 59894 boost::asio::co_spawn(my_io_context, 59895 [socket = std::move(my_tcp_socket)]() mutable 59896 -> boost::asio::awaitable<void> 59897 { 59898 try 59899 { 59900 char data[1024]; 59901 for (;;) 59902 { 59903 std::size_t n = co_await socket.async_read_some( 59904 boost::asio::buffer(data), boost::asio::use_awaitable); 59905 59906 co_await boost::asio::async_write(socket, 59907 boost::asio::buffer(data, n), boost::asio::use_awaitable); 59908 } 59909 } 59910 catch (const std::exception& e) 59911 { 59912 std::cerr << "Exception: " << e.what() << "\n"; 59913 } 59914 }, boost::asio::detached); 59915 59916 59917 59918 59919 59920 59921 59922[endsect] 59923 59924 59925[endsect] 59926 59927[section:connect connect] 59928 59929[indexterm1 boost_asio.indexterm.connect..connect] 59930The `connect` function is a composed operation that establishes a socket connection by trying each endpoint in a sequence. 59931 59932 59933Establishes a socket connection by trying each endpoint in a sequence. 59934 59935 template< 59936 typename ``[link boost_asio.reference.Protocol Protocol]``, 59937 typename ``[link boost_asio.reference.Executor1 Executor]``, 59938 typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``> 59939 Protocol::endpoint ``[link boost_asio.reference.connect.overload1 connect]``( 59940 basic_socket< Protocol, Executor > & s, 59941 const EndpointSequence & endpoints, 59942 typename constraint< is_endpoint_sequence< EndpointSequence >::value >::type = 0); 59943 `` [''''»''' [link boost_asio.reference.connect.overload1 more...]]`` 59944 59945 template< 59946 typename ``[link boost_asio.reference.Protocol Protocol]``, 59947 typename ``[link boost_asio.reference.Executor1 Executor]``, 59948 typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``> 59949 Protocol::endpoint ``[link boost_asio.reference.connect.overload2 connect]``( 59950 basic_socket< Protocol, Executor > & s, 59951 const EndpointSequence & endpoints, 59952 boost::system::error_code & ec, 59953 typename constraint< is_endpoint_sequence< EndpointSequence >::value >::type = 0); 59954 `` [''''»''' [link boost_asio.reference.connect.overload2 more...]]`` 59955 59956(Deprecated: Use range overload.) Establishes a socket connection by trying each endpoint in a sequence. 59957 59958 template< 59959 typename ``[link boost_asio.reference.Protocol Protocol]``, 59960 typename ``[link boost_asio.reference.Executor1 Executor]``, 59961 typename Iterator> 59962 Iterator ``[link boost_asio.reference.connect.overload3 connect]``( 59963 basic_socket< Protocol, Executor > & s, 59964 Iterator begin, 59965 typename constraint<!is_endpoint_sequence< Iterator >::value >::type = 0); 59966 `` [''''»''' [link boost_asio.reference.connect.overload3 more...]]`` 59967 59968 template< 59969 typename ``[link boost_asio.reference.Protocol Protocol]``, 59970 typename ``[link boost_asio.reference.Executor1 Executor]``, 59971 typename Iterator> 59972 Iterator ``[link boost_asio.reference.connect.overload4 connect]``( 59973 basic_socket< Protocol, Executor > & s, 59974 Iterator begin, 59975 boost::system::error_code & ec, 59976 typename constraint<!is_endpoint_sequence< Iterator >::value >::type = 0); 59977 `` [''''»''' [link boost_asio.reference.connect.overload4 more...]]`` 59978 59979Establishes a socket connection by trying each endpoint in a sequence. 59980 59981 template< 59982 typename ``[link boost_asio.reference.Protocol Protocol]``, 59983 typename ``[link boost_asio.reference.Executor1 Executor]``, 59984 typename Iterator> 59985 Iterator ``[link boost_asio.reference.connect.overload5 connect]``( 59986 basic_socket< Protocol, Executor > & s, 59987 Iterator begin, 59988 Iterator end); 59989 `` [''''»''' [link boost_asio.reference.connect.overload5 more...]]`` 59990 59991 template< 59992 typename ``[link boost_asio.reference.Protocol Protocol]``, 59993 typename ``[link boost_asio.reference.Executor1 Executor]``, 59994 typename Iterator> 59995 Iterator ``[link boost_asio.reference.connect.overload6 connect]``( 59996 basic_socket< Protocol, Executor > & s, 59997 Iterator begin, 59998 Iterator end, 59999 boost::system::error_code & ec); 60000 `` [''''»''' [link boost_asio.reference.connect.overload6 more...]]`` 60001 60002 template< 60003 typename ``[link boost_asio.reference.Protocol Protocol]``, 60004 typename ``[link boost_asio.reference.Executor1 Executor]``, 60005 typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``, 60006 typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``> 60007 Protocol::endpoint ``[link boost_asio.reference.connect.overload7 connect]``( 60008 basic_socket< Protocol, Executor > & s, 60009 const EndpointSequence & endpoints, 60010 ConnectCondition connect_condition, 60011 typename constraint< is_endpoint_sequence< EndpointSequence >::value >::type = 0); 60012 `` [''''»''' [link boost_asio.reference.connect.overload7 more...]]`` 60013 60014 template< 60015 typename ``[link boost_asio.reference.Protocol Protocol]``, 60016 typename ``[link boost_asio.reference.Executor1 Executor]``, 60017 typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``, 60018 typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``> 60019 Protocol::endpoint ``[link boost_asio.reference.connect.overload8 connect]``( 60020 basic_socket< Protocol, Executor > & s, 60021 const EndpointSequence & endpoints, 60022 ConnectCondition connect_condition, 60023 boost::system::error_code & ec, 60024 typename constraint< is_endpoint_sequence< EndpointSequence >::value >::type = 0); 60025 `` [''''»''' [link boost_asio.reference.connect.overload8 more...]]`` 60026 60027(Deprecated: Use range overload.) Establishes a socket connection by trying each endpoint in a sequence. 60028 60029 template< 60030 typename ``[link boost_asio.reference.Protocol Protocol]``, 60031 typename ``[link boost_asio.reference.Executor1 Executor]``, 60032 typename Iterator, 60033 typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``> 60034 Iterator ``[link boost_asio.reference.connect.overload9 connect]``( 60035 basic_socket< Protocol, Executor > & s, 60036 Iterator begin, 60037 ConnectCondition connect_condition, 60038 typename constraint<!is_endpoint_sequence< Iterator >::value >::type = 0); 60039 `` [''''»''' [link boost_asio.reference.connect.overload9 more...]]`` 60040 60041 template< 60042 typename ``[link boost_asio.reference.Protocol Protocol]``, 60043 typename ``[link boost_asio.reference.Executor1 Executor]``, 60044 typename Iterator, 60045 typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``> 60046 Iterator ``[link boost_asio.reference.connect.overload10 connect]``( 60047 basic_socket< Protocol, Executor > & s, 60048 Iterator begin, 60049 ConnectCondition connect_condition, 60050 boost::system::error_code & ec, 60051 typename constraint<!is_endpoint_sequence< Iterator >::value >::type = 0); 60052 `` [''''»''' [link boost_asio.reference.connect.overload10 more...]]`` 60053 60054Establishes a socket connection by trying each endpoint in a sequence. 60055 60056 template< 60057 typename ``[link boost_asio.reference.Protocol Protocol]``, 60058 typename ``[link boost_asio.reference.Executor1 Executor]``, 60059 typename Iterator, 60060 typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``> 60061 Iterator ``[link boost_asio.reference.connect.overload11 connect]``( 60062 basic_socket< Protocol, Executor > & s, 60063 Iterator begin, 60064 Iterator end, 60065 ConnectCondition connect_condition); 60066 `` [''''»''' [link boost_asio.reference.connect.overload11 more...]]`` 60067 60068 template< 60069 typename ``[link boost_asio.reference.Protocol Protocol]``, 60070 typename ``[link boost_asio.reference.Executor1 Executor]``, 60071 typename Iterator, 60072 typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``> 60073 Iterator ``[link boost_asio.reference.connect.overload12 connect]``( 60074 basic_socket< Protocol, Executor > & s, 60075 Iterator begin, 60076 Iterator end, 60077 ConnectCondition connect_condition, 60078 boost::system::error_code & ec); 60079 `` [''''»''' [link boost_asio.reference.connect.overload12 more...]]`` 60080 60081[heading Requirements] 60082 60083['Header: ][^boost/asio/connect.hpp] 60084 60085['Convenience header: ][^boost/asio.hpp] 60086 60087 60088[section:overload1 connect (1 of 12 overloads)] 60089 60090 60091Establishes a socket connection by trying each endpoint in a sequence. 60092 60093 60094 template< 60095 typename ``[link boost_asio.reference.Protocol Protocol]``, 60096 typename ``[link boost_asio.reference.Executor1 Executor]``, 60097 typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``> 60098 Protocol::endpoint connect( 60099 basic_socket< Protocol, Executor > & s, 60100 const EndpointSequence & endpoints, 60101 typename constraint< is_endpoint_sequence< EndpointSequence >::value >::type = 0); 60102 60103 60104This 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. 60105 60106 60107[heading Parameters] 60108 60109 60110[variablelist 60111 60112[[s][The socket to be connected. If the socket is already open, it will be closed.]] 60113 60114[[endpoints][A sequence of endpoints.]] 60115 60116] 60117 60118 60119[heading Return Value] 60120 60121The successfully connected endpoint. 60122 60123 60124[heading Exceptions] 60125 60126 60127[variablelist 60128 60129[[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.]] 60130 60131] 60132 60133 60134[heading Example] 60135 60136 60137 60138 tcp::resolver r(my_context); 60139 tcp::resolver::query q("host", "service"); 60140 tcp::socket s(my_context); 60141 boost::asio::connect(s, r.resolve(q)); 60142 60143 60144 60145 60146 60147 60148 60149[endsect] 60150 60151 60152 60153[section:overload2 connect (2 of 12 overloads)] 60154 60155 60156Establishes a socket connection by trying each endpoint in a sequence. 60157 60158 60159 template< 60160 typename ``[link boost_asio.reference.Protocol Protocol]``, 60161 typename ``[link boost_asio.reference.Executor1 Executor]``, 60162 typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``> 60163 Protocol::endpoint connect( 60164 basic_socket< Protocol, Executor > & s, 60165 const EndpointSequence & endpoints, 60166 boost::system::error_code & ec, 60167 typename constraint< is_endpoint_sequence< EndpointSequence >::value >::type = 0); 60168 60169 60170This 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. 60171 60172 60173[heading Parameters] 60174 60175 60176[variablelist 60177 60178[[s][The socket to be connected. If the socket is already open, it will be closed.]] 60179 60180[[endpoints][A sequence of endpoints.]] 60181 60182[[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.]] 60183 60184] 60185 60186 60187[heading Return Value] 60188 60189On success, the successfully connected endpoint. Otherwise, a default-constructed endpoint. 60190 60191 60192[heading Example] 60193 60194 60195 60196 tcp::resolver r(my_context); 60197 tcp::resolver::query q("host", "service"); 60198 tcp::socket s(my_context); 60199 boost::system::error_code ec; 60200 boost::asio::connect(s, r.resolve(q), ec); 60201 if (ec) 60202 { 60203 // An error occurred. 60204 } 60205 60206 60207 60208 60209 60210 60211 60212[endsect] 60213 60214 60215 60216[section:overload3 connect (3 of 12 overloads)] 60217 60218 60219(Deprecated: Use range overload.) Establishes a socket connection by trying each endpoint in a sequence. 60220 60221 60222 template< 60223 typename ``[link boost_asio.reference.Protocol Protocol]``, 60224 typename ``[link boost_asio.reference.Executor1 Executor]``, 60225 typename Iterator> 60226 Iterator connect( 60227 basic_socket< Protocol, Executor > & s, 60228 Iterator begin, 60229 typename constraint<!is_endpoint_sequence< Iterator >::value >::type = 0); 60230 60231 60232This 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. 60233 60234 60235[heading Parameters] 60236 60237 60238[variablelist 60239 60240[[s][The socket to be connected. If the socket is already open, it will be closed.]] 60241 60242[[begin][An iterator pointing to the start of a sequence of endpoints.]] 60243 60244] 60245 60246 60247[heading Return Value] 60248 60249On success, an iterator denoting the successfully connected endpoint. Otherwise, the end iterator. 60250 60251 60252[heading Exceptions] 60253 60254 60255[variablelist 60256 60257[[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.]] 60258 60259] 60260 60261 60262[heading Remarks] 60263 60264This 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`. 60265 60266 60267 60268 60269[endsect] 60270 60271 60272 60273[section:overload4 connect (4 of 12 overloads)] 60274 60275 60276(Deprecated: Use range overload.) Establishes a socket connection by trying each endpoint in a sequence. 60277 60278 60279 template< 60280 typename ``[link boost_asio.reference.Protocol Protocol]``, 60281 typename ``[link boost_asio.reference.Executor1 Executor]``, 60282 typename Iterator> 60283 Iterator connect( 60284 basic_socket< Protocol, Executor > & s, 60285 Iterator begin, 60286 boost::system::error_code & ec, 60287 typename constraint<!is_endpoint_sequence< Iterator >::value >::type = 0); 60288 60289 60290This 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. 60291 60292 60293[heading Parameters] 60294 60295 60296[variablelist 60297 60298[[s][The socket to be connected. If the socket is already open, it will be closed.]] 60299 60300[[begin][An iterator pointing to the start of a sequence of endpoints.]] 60301 60302[[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.]] 60303 60304] 60305 60306 60307[heading Return Value] 60308 60309On success, an iterator denoting the successfully connected endpoint. Otherwise, the end iterator. 60310 60311 60312[heading Remarks] 60313 60314This 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`. 60315 60316 60317 60318 60319[endsect] 60320 60321 60322 60323[section:overload5 connect (5 of 12 overloads)] 60324 60325 60326Establishes a socket connection by trying each endpoint in a sequence. 60327 60328 60329 template< 60330 typename ``[link boost_asio.reference.Protocol Protocol]``, 60331 typename ``[link boost_asio.reference.Executor1 Executor]``, 60332 typename Iterator> 60333 Iterator connect( 60334 basic_socket< Protocol, Executor > & s, 60335 Iterator begin, 60336 Iterator end); 60337 60338 60339This 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. 60340 60341 60342[heading Parameters] 60343 60344 60345[variablelist 60346 60347[[s][The socket to be connected. If the socket is already open, it will be closed.]] 60348 60349[[begin][An iterator pointing to the start of a sequence of endpoints.]] 60350 60351[[end][An iterator pointing to the end of a sequence of endpoints.]] 60352 60353] 60354 60355 60356[heading Return Value] 60357 60358An iterator denoting the successfully connected endpoint. 60359 60360 60361[heading Exceptions] 60362 60363 60364[variablelist 60365 60366[[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.]] 60367 60368] 60369 60370 60371[heading Example] 60372 60373 60374 60375 tcp::resolver r(my_context); 60376 tcp::resolver::query q("host", "service"); 60377 tcp::resolver::results_type e = r.resolve(q); 60378 tcp::socket s(my_context); 60379 boost::asio::connect(s, e.begin(), e.end()); 60380 60381 60382 60383 60384 60385 60386 60387[endsect] 60388 60389 60390 60391[section:overload6 connect (6 of 12 overloads)] 60392 60393 60394Establishes a socket connection by trying each endpoint in a sequence. 60395 60396 60397 template< 60398 typename ``[link boost_asio.reference.Protocol Protocol]``, 60399 typename ``[link boost_asio.reference.Executor1 Executor]``, 60400 typename Iterator> 60401 Iterator connect( 60402 basic_socket< Protocol, Executor > & s, 60403 Iterator begin, 60404 Iterator end, 60405 boost::system::error_code & ec); 60406 60407 60408This 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. 60409 60410 60411[heading Parameters] 60412 60413 60414[variablelist 60415 60416[[s][The socket to be connected. If the socket is already open, it will be closed.]] 60417 60418[[begin][An iterator pointing to the start of a sequence of endpoints.]] 60419 60420[[end][An iterator pointing to the end of a sequence of endpoints.]] 60421 60422[[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.]] 60423 60424] 60425 60426 60427[heading Return Value] 60428 60429On success, an iterator denoting the successfully connected endpoint. Otherwise, the end iterator. 60430 60431 60432[heading Example] 60433 60434 60435 60436 tcp::resolver r(my_context); 60437 tcp::resolver::query q("host", "service"); 60438 tcp::resolver::results_type e = r.resolve(q); 60439 tcp::socket s(my_context); 60440 boost::system::error_code ec; 60441 boost::asio::connect(s, e.begin(), e.end(), ec); 60442 if (ec) 60443 { 60444 // An error occurred. 60445 } 60446 60447 60448 60449 60450 60451 60452 60453[endsect] 60454 60455 60456 60457[section:overload7 connect (7 of 12 overloads)] 60458 60459 60460Establishes a socket connection by trying each endpoint in a sequence. 60461 60462 60463 template< 60464 typename ``[link boost_asio.reference.Protocol Protocol]``, 60465 typename ``[link boost_asio.reference.Executor1 Executor]``, 60466 typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``, 60467 typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``> 60468 Protocol::endpoint connect( 60469 basic_socket< Protocol, Executor > & s, 60470 const EndpointSequence & endpoints, 60471 ConnectCondition connect_condition, 60472 typename constraint< is_endpoint_sequence< EndpointSequence >::value >::type = 0); 60473 60474 60475This 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. 60476 60477 60478[heading Parameters] 60479 60480 60481[variablelist 60482 60483[[s][The socket to be connected. If the socket is already open, it will be closed.]] 60484 60485[[endpoints][A sequence of endpoints.]] 60486 60487[[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be: 60488`` 60489 bool connect_condition( 60490 const boost::system::error_code& ec, 60491 const typename Protocol::endpoint& next); 60492`` 60493The `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.]] 60494 60495] 60496 60497 60498[heading Return Value] 60499 60500The successfully connected endpoint. 60501 60502 60503[heading Exceptions] 60504 60505 60506[variablelist 60507 60508[[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.]] 60509 60510] 60511 60512 60513[heading Example] 60514 60515The following connect condition function object can be used to output information about the individual connection attempts: 60516 60517 struct my_connect_condition 60518 { 60519 bool operator()( 60520 const boost::system::error_code& ec, 60521 const::tcp::endpoint& next) 60522 { 60523 if (ec) std::cout << "Error: " << ec.message() << std::endl; 60524 std::cout << "Trying: " << next << std::endl; 60525 return true; 60526 } 60527 }; 60528 60529 60530It would be used with the `boost::asio::connect` function as follows: 60531 60532 tcp::resolver r(my_context); 60533 tcp::resolver::query q("host", "service"); 60534 tcp::socket s(my_context); 60535 tcp::endpoint e = boost::asio::connect(s, 60536 r.resolve(q), my_connect_condition()); 60537 std::cout << "Connected to: " << e << std::endl; 60538 60539 60540 60541 60542 60543 60544 60545[endsect] 60546 60547 60548 60549[section:overload8 connect (8 of 12 overloads)] 60550 60551 60552Establishes a socket connection by trying each endpoint in a sequence. 60553 60554 60555 template< 60556 typename ``[link boost_asio.reference.Protocol Protocol]``, 60557 typename ``[link boost_asio.reference.Executor1 Executor]``, 60558 typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``, 60559 typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``> 60560 Protocol::endpoint connect( 60561 basic_socket< Protocol, Executor > & s, 60562 const EndpointSequence & endpoints, 60563 ConnectCondition connect_condition, 60564 boost::system::error_code & ec, 60565 typename constraint< is_endpoint_sequence< EndpointSequence >::value >::type = 0); 60566 60567 60568This 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. 60569 60570 60571[heading Parameters] 60572 60573 60574[variablelist 60575 60576[[s][The socket to be connected. If the socket is already open, it will be closed.]] 60577 60578[[endpoints][A sequence of endpoints.]] 60579 60580[[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be: 60581`` 60582 bool connect_condition( 60583 const boost::system::error_code& ec, 60584 const typename Protocol::endpoint& next); 60585`` 60586The `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.]] 60587 60588[[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.]] 60589 60590] 60591 60592 60593[heading Return Value] 60594 60595On success, the successfully connected endpoint. Otherwise, a default-constructed endpoint. 60596 60597 60598[heading Example] 60599 60600The following connect condition function object can be used to output information about the individual connection attempts: 60601 60602 struct my_connect_condition 60603 { 60604 bool operator()( 60605 const boost::system::error_code& ec, 60606 const::tcp::endpoint& next) 60607 { 60608 if (ec) std::cout << "Error: " << ec.message() << std::endl; 60609 std::cout << "Trying: " << next << std::endl; 60610 return true; 60611 } 60612 }; 60613 60614 60615It would be used with the `boost::asio::connect` function as follows: 60616 60617 tcp::resolver r(my_context); 60618 tcp::resolver::query q("host", "service"); 60619 tcp::socket s(my_context); 60620 boost::system::error_code ec; 60621 tcp::endpoint e = boost::asio::connect(s, 60622 r.resolve(q), my_connect_condition(), ec); 60623 if (ec) 60624 { 60625 // An error occurred. 60626 } 60627 else 60628 { 60629 std::cout << "Connected to: " << e << std::endl; 60630 } 60631 60632 60633 60634 60635 60636 60637 60638[endsect] 60639 60640 60641 60642[section:overload9 connect (9 of 12 overloads)] 60643 60644 60645(Deprecated: Use range overload.) Establishes a socket connection by trying each endpoint in a sequence. 60646 60647 60648 template< 60649 typename ``[link boost_asio.reference.Protocol Protocol]``, 60650 typename ``[link boost_asio.reference.Executor1 Executor]``, 60651 typename Iterator, 60652 typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``> 60653 Iterator connect( 60654 basic_socket< Protocol, Executor > & s, 60655 Iterator begin, 60656 ConnectCondition connect_condition, 60657 typename constraint<!is_endpoint_sequence< Iterator >::value >::type = 0); 60658 60659 60660This 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. 60661 60662 60663[heading Parameters] 60664 60665 60666[variablelist 60667 60668[[s][The socket to be connected. If the socket is already open, it will be closed.]] 60669 60670[[begin][An iterator pointing to the start of a sequence of endpoints.]] 60671 60672[[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be: 60673`` 60674 bool connect_condition( 60675 const boost::system::error_code& ec, 60676 const typename Protocol::endpoint& next); 60677`` 60678The `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.]] 60679 60680] 60681 60682 60683[heading Return Value] 60684 60685On success, an iterator denoting the successfully connected endpoint. Otherwise, the end iterator. 60686 60687 60688[heading Exceptions] 60689 60690 60691[variablelist 60692 60693[[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.]] 60694 60695] 60696 60697 60698[heading Remarks] 60699 60700This 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`. 60701 60702 60703 60704 60705[endsect] 60706 60707 60708 60709[section:overload10 connect (10 of 12 overloads)] 60710 60711 60712(Deprecated: Use range overload.) Establishes a socket connection by trying each endpoint in a sequence. 60713 60714 60715 template< 60716 typename ``[link boost_asio.reference.Protocol Protocol]``, 60717 typename ``[link boost_asio.reference.Executor1 Executor]``, 60718 typename Iterator, 60719 typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``> 60720 Iterator connect( 60721 basic_socket< Protocol, Executor > & s, 60722 Iterator begin, 60723 ConnectCondition connect_condition, 60724 boost::system::error_code & ec, 60725 typename constraint<!is_endpoint_sequence< Iterator >::value >::type = 0); 60726 60727 60728This 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. 60729 60730 60731[heading Parameters] 60732 60733 60734[variablelist 60735 60736[[s][The socket to be connected. If the socket is already open, it will be closed.]] 60737 60738[[begin][An iterator pointing to the start of a sequence of endpoints.]] 60739 60740[[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be: 60741`` 60742 bool connect_condition( 60743 const boost::system::error_code& ec, 60744 const typename Protocol::endpoint& next); 60745`` 60746The `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.]] 60747 60748[[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.]] 60749 60750] 60751 60752 60753[heading Return Value] 60754 60755On success, an iterator denoting the successfully connected endpoint. Otherwise, the end iterator. 60756 60757 60758[heading Remarks] 60759 60760This 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`. 60761 60762 60763 60764 60765[endsect] 60766 60767 60768 60769[section:overload11 connect (11 of 12 overloads)] 60770 60771 60772Establishes a socket connection by trying each endpoint in a sequence. 60773 60774 60775 template< 60776 typename ``[link boost_asio.reference.Protocol Protocol]``, 60777 typename ``[link boost_asio.reference.Executor1 Executor]``, 60778 typename Iterator, 60779 typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``> 60780 Iterator connect( 60781 basic_socket< Protocol, Executor > & s, 60782 Iterator begin, 60783 Iterator end, 60784 ConnectCondition connect_condition); 60785 60786 60787This 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. 60788 60789 60790[heading Parameters] 60791 60792 60793[variablelist 60794 60795[[s][The socket to be connected. If the socket is already open, it will be closed.]] 60796 60797[[begin][An iterator pointing to the start of a sequence of endpoints.]] 60798 60799[[end][An iterator pointing to the end of a sequence of endpoints.]] 60800 60801[[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be: 60802`` 60803 bool connect_condition( 60804 const boost::system::error_code& ec, 60805 const typename Protocol::endpoint& next); 60806`` 60807The `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.]] 60808 60809] 60810 60811 60812[heading Return Value] 60813 60814An iterator denoting the successfully connected endpoint. 60815 60816 60817[heading Exceptions] 60818 60819 60820[variablelist 60821 60822[[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.]] 60823 60824] 60825 60826 60827[heading Example] 60828 60829The following connect condition function object can be used to output information about the individual connection attempts: 60830 60831 struct my_connect_condition 60832 { 60833 bool operator()( 60834 const boost::system::error_code& ec, 60835 const::tcp::endpoint& next) 60836 { 60837 if (ec) std::cout << "Error: " << ec.message() << std::endl; 60838 std::cout << "Trying: " << next << std::endl; 60839 return true; 60840 } 60841 }; 60842 60843 60844It would be used with the `boost::asio::connect` function as follows: 60845 60846 tcp::resolver r(my_context); 60847 tcp::resolver::query q("host", "service"); 60848 tcp::resolver::results_type e = r.resolve(q); 60849 tcp::socket s(my_context); 60850 tcp::resolver::results_type::iterator i = boost::asio::connect( 60851 s, e.begin(), e.end(), my_connect_condition()); 60852 std::cout << "Connected to: " << i->endpoint() << std::endl; 60853 60854 60855 60856 60857 60858 60859 60860[endsect] 60861 60862 60863 60864[section:overload12 connect (12 of 12 overloads)] 60865 60866 60867Establishes a socket connection by trying each endpoint in a sequence. 60868 60869 60870 template< 60871 typename ``[link boost_asio.reference.Protocol Protocol]``, 60872 typename ``[link boost_asio.reference.Executor1 Executor]``, 60873 typename Iterator, 60874 typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``> 60875 Iterator connect( 60876 basic_socket< Protocol, Executor > & s, 60877 Iterator begin, 60878 Iterator end, 60879 ConnectCondition connect_condition, 60880 boost::system::error_code & ec); 60881 60882 60883This 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. 60884 60885 60886[heading Parameters] 60887 60888 60889[variablelist 60890 60891[[s][The socket to be connected. If the socket is already open, it will be closed.]] 60892 60893[[begin][An iterator pointing to the start of a sequence of endpoints.]] 60894 60895[[end][An iterator pointing to the end of a sequence of endpoints.]] 60896 60897[[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be: 60898`` 60899 bool connect_condition( 60900 const boost::system::error_code& ec, 60901 const typename Protocol::endpoint& next); 60902`` 60903The `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.]] 60904 60905[[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.]] 60906 60907] 60908 60909 60910[heading Return Value] 60911 60912On success, an iterator denoting the successfully connected endpoint. Otherwise, the end iterator. 60913 60914 60915[heading Example] 60916 60917The following connect condition function object can be used to output information about the individual connection attempts: 60918 60919 struct my_connect_condition 60920 { 60921 bool operator()( 60922 const boost::system::error_code& ec, 60923 const::tcp::endpoint& next) 60924 { 60925 if (ec) std::cout << "Error: " << ec.message() << std::endl; 60926 std::cout << "Trying: " << next << std::endl; 60927 return true; 60928 } 60929 }; 60930 60931 60932It would be used with the `boost::asio::connect` function as follows: 60933 60934 tcp::resolver r(my_context); 60935 tcp::resolver::query q("host", "service"); 60936 tcp::resolver::results_type e = r.resolve(q); 60937 tcp::socket s(my_context); 60938 boost::system::error_code ec; 60939 tcp::resolver::results_type::iterator i = boost::asio::connect( 60940 s, e.begin(), e.end(), my_connect_condition()); 60941 if (ec) 60942 { 60943 // An error occurred. 60944 } 60945 else 60946 { 60947 std::cout << "Connected to: " << i->endpoint() << std::endl; 60948 } 60949 60950 60951 60952 60953 60954 60955 60956[endsect] 60957 60958 60959[endsect] 60960 60961[section:const_buffer const_buffer] 60962 60963[indexterm1 boost_asio.indexterm.const_buffer..const_buffer] 60964 60965 60966Holds a buffer that cannot be modified. 60967 60968 60969 class const_buffer 60970 60971 60972[heading Member Functions] 60973[table 60974 [[Name][Description]] 60975 60976 [ 60977 [[link boost_asio.reference.const_buffer.const_buffer [*const_buffer]] [constructor]] 60978 [Construct an empty buffer. 60979 [hr] 60980 Construct a buffer to represent a given memory range. 60981 [hr] 60982 Construct a non-modifiable buffer from a modifiable one. ] 60983 ] 60984 60985 [ 60986 [[link boost_asio.reference.const_buffer.data [*data]]] 60987 [Get a pointer to the beginning of the memory range. ] 60988 ] 60989 60990 [ 60991 [[link boost_asio.reference.const_buffer.operator_plus__eq_ [*operator+=]]] 60992 [Move the start of the buffer by the specified number of bytes. ] 60993 ] 60994 60995 [ 60996 [[link boost_asio.reference.const_buffer.size [*size]]] 60997 [Get the size of the memory range. ] 60998 ] 60999 61000] 61001 61002[heading Related Functions] 61003[table 61004 [[Name][Description]] 61005 61006 [ 61007 [[link boost_asio.reference.const_buffer.operator_plus_ [*operator+]]] 61008 [Create a new non-modifiable buffer that is offset from the start of another. ] 61009 ] 61010 61011] 61012 61013The [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. 61014 61015 61016[heading Accessing Buffer Contents] 61017 61018 61019 61020The contents of a buffer may be accessed using the `data()` and `size()` member functions: 61021 61022 61023 61024 boost::asio::const_buffer b1 = ...; 61025 std::size_t s1 = b1.size(); 61026 const unsigned char* p1 = static_cast<const unsigned char*>(b1.data()); 61027 61028 61029 61030 61031The `data()` member function permits violations of type safety, so uses of it in application code should be carefully considered. 61032 61033[heading Requirements] 61034 61035['Header: ][^boost/asio/buffer.hpp] 61036 61037['Convenience header: ][^boost/asio.hpp] 61038 61039[section:const_buffer const_buffer::const_buffer] 61040 61041[indexterm2 boost_asio.indexterm.const_buffer.const_buffer..const_buffer..const_buffer] 61042Construct an empty buffer. 61043 61044 61045 ``[link boost_asio.reference.const_buffer.const_buffer.overload1 const_buffer]``(); 61046 `` [''''»''' [link boost_asio.reference.const_buffer.const_buffer.overload1 more...]]`` 61047 61048 61049Construct a buffer to represent a given memory range. 61050 61051 61052 ``[link boost_asio.reference.const_buffer.const_buffer.overload2 const_buffer]``( 61053 const void * data, 61054 std::size_t size); 61055 `` [''''»''' [link boost_asio.reference.const_buffer.const_buffer.overload2 more...]]`` 61056 61057 61058Construct a non-modifiable buffer from a modifiable one. 61059 61060 61061 ``[link boost_asio.reference.const_buffer.const_buffer.overload3 const_buffer]``( 61062 const mutable_buffer & b); 61063 `` [''''»''' [link boost_asio.reference.const_buffer.const_buffer.overload3 more...]]`` 61064 61065 61066[section:overload1 const_buffer::const_buffer (1 of 3 overloads)] 61067 61068 61069Construct an empty buffer. 61070 61071 61072 const_buffer(); 61073 61074 61075 61076[endsect] 61077 61078 61079 61080[section:overload2 const_buffer::const_buffer (2 of 3 overloads)] 61081 61082 61083Construct a buffer to represent a given memory range. 61084 61085 61086 const_buffer( 61087 const void * data, 61088 std::size_t size); 61089 61090 61091 61092[endsect] 61093 61094 61095 61096[section:overload3 const_buffer::const_buffer (3 of 3 overloads)] 61097 61098 61099Construct a non-modifiable buffer from a modifiable one. 61100 61101 61102 const_buffer( 61103 const mutable_buffer & b); 61104 61105 61106 61107[endsect] 61108 61109 61110[endsect] 61111 61112 61113[section:data const_buffer::data] 61114 61115[indexterm2 boost_asio.indexterm.const_buffer.data..data..const_buffer] 61116Get a pointer to the beginning of the memory range. 61117 61118 61119 const void * data() const; 61120 61121 61122 61123[endsect] 61124 61125 61126[section:operator_plus_ const_buffer::operator+] 61127 61128[indexterm2 boost_asio.indexterm.const_buffer.operator_plus_..operator+..const_buffer] 61129Create a new non-modifiable buffer that is offset from the start of another. 61130 61131 61132 const_buffer ``[link boost_asio.reference.const_buffer.operator_plus_.overload1 operator+]``( 61133 const const_buffer & b, 61134 std::size_t n); 61135 `` [''''»''' [link boost_asio.reference.const_buffer.operator_plus_.overload1 more...]]`` 61136 61137 const_buffer ``[link boost_asio.reference.const_buffer.operator_plus_.overload2 operator+]``( 61138 std::size_t n, 61139 const const_buffer & b); 61140 `` [''''»''' [link boost_asio.reference.const_buffer.operator_plus_.overload2 more...]]`` 61141 61142 61143[section:overload1 const_buffer::operator+ (1 of 2 overloads)] 61144 61145 61146Create a new non-modifiable buffer that is offset from the start of another. 61147 61148 61149 const_buffer operator+( 61150 const const_buffer & b, 61151 std::size_t n); 61152 61153 61154 61155[endsect] 61156 61157 61158 61159[section:overload2 const_buffer::operator+ (2 of 2 overloads)] 61160 61161 61162Create a new non-modifiable buffer that is offset from the start of another. 61163 61164 61165 const_buffer operator+( 61166 std::size_t n, 61167 const const_buffer & b); 61168 61169 61170 61171[endsect] 61172 61173 61174[endsect] 61175 61176 61177[section:operator_plus__eq_ const_buffer::operator+=] 61178 61179[indexterm2 boost_asio.indexterm.const_buffer.operator_plus__eq_..operator+=..const_buffer] 61180Move the start of the buffer by the specified number of bytes. 61181 61182 61183 const_buffer & operator+=( 61184 std::size_t n); 61185 61186 61187 61188[endsect] 61189 61190 61191 61192[section:size const_buffer::size] 61193 61194[indexterm2 boost_asio.indexterm.const_buffer.size..size..const_buffer] 61195Get the size of the memory range. 61196 61197 61198 std::size_t size() const; 61199 61200 61201 61202[endsect] 61203 61204 61205 61206[endsect] 61207 61208[section:const_buffers_1 const_buffers_1] 61209 61210[indexterm1 boost_asio.indexterm.const_buffers_1..const_buffers_1] 61211 61212 61213(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. 61214 61215 61216 class const_buffers_1 : 61217 public const_buffer 61218 61219 61220[heading Types] 61221[table 61222 [[Name][Description]] 61223 61224 [ 61225 61226 [[link boost_asio.reference.const_buffers_1.const_iterator [*const_iterator]]] 61227 [A random-access iterator type that may be used to read elements. ] 61228 61229 ] 61230 61231 [ 61232 61233 [[link boost_asio.reference.const_buffers_1.value_type [*value_type]]] 61234 [The type for each element in the list of buffers. ] 61235 61236 ] 61237 61238] 61239 61240[heading Member Functions] 61241[table 61242 [[Name][Description]] 61243 61244 [ 61245 [[link boost_asio.reference.const_buffers_1.begin [*begin]]] 61246 [Get a random-access iterator to the first element. ] 61247 ] 61248 61249 [ 61250 [[link boost_asio.reference.const_buffers_1.const_buffers_1 [*const_buffers_1]] [constructor]] 61251 [Construct to represent a given memory range. 61252 [hr] 61253 Construct to represent a single non-modifiable buffer. ] 61254 ] 61255 61256 [ 61257 [[link boost_asio.reference.const_buffers_1.data [*data]]] 61258 [Get a pointer to the beginning of the memory range. ] 61259 ] 61260 61261 [ 61262 [[link boost_asio.reference.const_buffers_1.end [*end]]] 61263 [Get a random-access iterator for one past the last element. ] 61264 ] 61265 61266 [ 61267 [[link boost_asio.reference.const_buffers_1.operator_plus__eq_ [*operator+=]]] 61268 [Move the start of the buffer by the specified number of bytes. ] 61269 ] 61270 61271 [ 61272 [[link boost_asio.reference.const_buffers_1.size [*size]]] 61273 [Get the size of the memory range. ] 61274 ] 61275 61276] 61277 61278[heading Related Functions] 61279[table 61280 [[Name][Description]] 61281 61282 [ 61283 [[link boost_asio.reference.const_buffers_1.operator_plus_ [*operator+]]] 61284 [Create a new non-modifiable buffer that is offset from the start of another. ] 61285 ] 61286 61287] 61288 61289[heading Requirements] 61290 61291['Header: ][^boost/asio/buffer.hpp] 61292 61293['Convenience header: ][^boost/asio.hpp] 61294 61295 61296[section:begin const_buffers_1::begin] 61297 61298[indexterm2 boost_asio.indexterm.const_buffers_1.begin..begin..const_buffers_1] 61299Get a random-access iterator to the first element. 61300 61301 61302 const_iterator begin() const; 61303 61304 61305 61306[endsect] 61307 61308 61309[section:const_buffers_1 const_buffers_1::const_buffers_1] 61310 61311[indexterm2 boost_asio.indexterm.const_buffers_1.const_buffers_1..const_buffers_1..const_buffers_1] 61312Construct to represent a given memory range. 61313 61314 61315 ``[link boost_asio.reference.const_buffers_1.const_buffers_1.overload1 const_buffers_1]``( 61316 const void * data, 61317 std::size_t size); 61318 `` [''''»''' [link boost_asio.reference.const_buffers_1.const_buffers_1.overload1 more...]]`` 61319 61320 61321Construct to represent a single non-modifiable buffer. 61322 61323 61324 explicit ``[link boost_asio.reference.const_buffers_1.const_buffers_1.overload2 const_buffers_1]``( 61325 const const_buffer & b); 61326 `` [''''»''' [link boost_asio.reference.const_buffers_1.const_buffers_1.overload2 more...]]`` 61327 61328 61329[section:overload1 const_buffers_1::const_buffers_1 (1 of 2 overloads)] 61330 61331 61332Construct to represent a given memory range. 61333 61334 61335 const_buffers_1( 61336 const void * data, 61337 std::size_t size); 61338 61339 61340 61341[endsect] 61342 61343 61344 61345[section:overload2 const_buffers_1::const_buffers_1 (2 of 2 overloads)] 61346 61347 61348Construct to represent a single non-modifiable buffer. 61349 61350 61351 const_buffers_1( 61352 const const_buffer & b); 61353 61354 61355 61356[endsect] 61357 61358 61359[endsect] 61360 61361 61362[section:const_iterator const_buffers_1::const_iterator] 61363 61364[indexterm2 boost_asio.indexterm.const_buffers_1.const_iterator..const_iterator..const_buffers_1] 61365A random-access iterator type that may be used to read elements. 61366 61367 61368 typedef const const_buffer * const_iterator; 61369 61370 61371 61372[heading Requirements] 61373 61374['Header: ][^boost/asio/buffer.hpp] 61375 61376['Convenience header: ][^boost/asio.hpp] 61377 61378 61379[endsect] 61380 61381 61382 61383[section:data const_buffers_1::data] 61384 61385 61386['Inherited from const_buffer.] 61387 61388[indexterm2 boost_asio.indexterm.const_buffers_1.data..data..const_buffers_1] 61389Get a pointer to the beginning of the memory range. 61390 61391 61392 const void * data() const; 61393 61394 61395 61396[endsect] 61397 61398 61399 61400[section:end const_buffers_1::end] 61401 61402[indexterm2 boost_asio.indexterm.const_buffers_1.end..end..const_buffers_1] 61403Get a random-access iterator for one past the last element. 61404 61405 61406 const_iterator end() const; 61407 61408 61409 61410[endsect] 61411 61412 61413[section:operator_plus_ const_buffers_1::operator+] 61414 61415[indexterm2 boost_asio.indexterm.const_buffers_1.operator_plus_..operator+..const_buffers_1] 61416Create a new non-modifiable buffer that is offset from the start of another. 61417 61418 61419 const_buffer ``[link boost_asio.reference.const_buffers_1.operator_plus_.overload1 operator+]``( 61420 const const_buffer & b, 61421 std::size_t n); 61422 `` [''''»''' [link boost_asio.reference.const_buffers_1.operator_plus_.overload1 more...]]`` 61423 61424 const_buffer ``[link boost_asio.reference.const_buffers_1.operator_plus_.overload2 operator+]``( 61425 std::size_t n, 61426 const const_buffer & b); 61427 `` [''''»''' [link boost_asio.reference.const_buffers_1.operator_plus_.overload2 more...]]`` 61428 61429 61430[section:overload1 const_buffers_1::operator+ (1 of 2 overloads)] 61431 61432 61433['Inherited from const_buffer.] 61434 61435 61436Create a new non-modifiable buffer that is offset from the start of another. 61437 61438 61439 const_buffer operator+( 61440 const const_buffer & b, 61441 std::size_t n); 61442 61443 61444 61445[endsect] 61446 61447 61448 61449[section:overload2 const_buffers_1::operator+ (2 of 2 overloads)] 61450 61451 61452['Inherited from const_buffer.] 61453 61454 61455Create a new non-modifiable buffer that is offset from the start of another. 61456 61457 61458 const_buffer operator+( 61459 std::size_t n, 61460 const const_buffer & b); 61461 61462 61463 61464[endsect] 61465 61466 61467[endsect] 61468 61469 61470[section:operator_plus__eq_ const_buffers_1::operator+=] 61471 61472 61473['Inherited from const_buffer.] 61474 61475[indexterm2 boost_asio.indexterm.const_buffers_1.operator_plus__eq_..operator+=..const_buffers_1] 61476Move the start of the buffer by the specified number of bytes. 61477 61478 61479 const_buffer & operator+=( 61480 std::size_t n); 61481 61482 61483 61484[endsect] 61485 61486 61487 61488[section:size const_buffers_1::size] 61489 61490 61491['Inherited from const_buffer.] 61492 61493[indexterm2 boost_asio.indexterm.const_buffers_1.size..size..const_buffers_1] 61494Get the size of the memory range. 61495 61496 61497 std::size_t size() const; 61498 61499 61500 61501[endsect] 61502 61503 61504 61505[section:value_type const_buffers_1::value_type] 61506 61507[indexterm2 boost_asio.indexterm.const_buffers_1.value_type..value_type..const_buffers_1] 61508The type for each element in the list of buffers. 61509 61510 61511 typedef const_buffer value_type; 61512 61513 61514[heading Member Functions] 61515[table 61516 [[Name][Description]] 61517 61518 [ 61519 [[link boost_asio.reference.const_buffer.const_buffer [*const_buffer]] [constructor]] 61520 [Construct an empty buffer. 61521 [hr] 61522 Construct a buffer to represent a given memory range. 61523 [hr] 61524 Construct a non-modifiable buffer from a modifiable one. ] 61525 ] 61526 61527 [ 61528 [[link boost_asio.reference.const_buffer.data [*data]]] 61529 [Get a pointer to the beginning of the memory range. ] 61530 ] 61531 61532 [ 61533 [[link boost_asio.reference.const_buffer.operator_plus__eq_ [*operator+=]]] 61534 [Move the start of the buffer by the specified number of bytes. ] 61535 ] 61536 61537 [ 61538 [[link boost_asio.reference.const_buffer.size [*size]]] 61539 [Get the size of the memory range. ] 61540 ] 61541 61542] 61543 61544[heading Related Functions] 61545[table 61546 [[Name][Description]] 61547 61548 [ 61549 [[link boost_asio.reference.const_buffer.operator_plus_ [*operator+]]] 61550 [Create a new non-modifiable buffer that is offset from the start of another. ] 61551 ] 61552 61553] 61554 61555The [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. 61556 61557 61558[heading Accessing Buffer Contents] 61559 61560 61561 61562The contents of a buffer may be accessed using the `data()` and `size()` member functions: 61563 61564 61565 61566 boost::asio::const_buffer b1 = ...; 61567 std::size_t s1 = b1.size(); 61568 const unsigned char* p1 = static_cast<const unsigned char*>(b1.data()); 61569 61570 61571 61572 61573The `data()` member function permits violations of type safety, so uses of it in application code should be carefully considered. 61574 61575 61576[heading Requirements] 61577 61578['Header: ][^boost/asio/buffer.hpp] 61579 61580['Convenience header: ][^boost/asio.hpp] 61581 61582 61583[endsect] 61584 61585 61586 61587[endsect] 61588 61589[section:coroutine coroutine] 61590 61591[indexterm1 boost_asio.indexterm.coroutine..coroutine] 61592 61593 61594Provides support for implementing stackless coroutines. 61595 61596 61597 class coroutine 61598 61599 61600[heading Member Functions] 61601[table 61602 [[Name][Description]] 61603 61604 [ 61605 [[link boost_asio.reference.coroutine.coroutine [*coroutine]] [constructor]] 61606 [Constructs a coroutine in its initial state. ] 61607 ] 61608 61609 [ 61610 [[link boost_asio.reference.coroutine.is_child [*is_child]]] 61611 [Returns true if the coroutine is the child of a fork. ] 61612 ] 61613 61614 [ 61615 [[link boost_asio.reference.coroutine.is_complete [*is_complete]]] 61616 [Returns true if the coroutine has reached its terminal state. ] 61617 ] 61618 61619 [ 61620 [[link boost_asio.reference.coroutine.is_parent [*is_parent]]] 61621 [Returns true if the coroutine is the parent of a fork. ] 61622 ] 61623 61624] 61625 61626The `coroutine` class may be used to implement stackless coroutines. The class itself is used to store the current state of the coroutine. 61627 61628Coroutines are copy-constructible and assignable, and the space overhead is a single int. They can be used as a base class: 61629 61630 61631 61632 class session : coroutine 61633 { 61634 ... 61635 }; 61636 61637 61638 61639 61640or as a data member: 61641 61642 61643 61644 class session 61645 { 61646 ... 61647 coroutine coro_; 61648 }; 61649 61650 61651 61652 61653or 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. 61654 61655 61656[heading Pseudo-keywords] 61657 61658 61659 61660A coroutine is used in conjunction with certain "pseudo-keywords", which are implemented as macros. These macros are defined by a header file: 61661 61662 61663 61664 #include <boost/asio/yield.hpp> 61665 61666 61667 61668 61669and may conversely be undefined as follows: 61670 61671 61672 61673 #include <boost/asio/unyield.hpp> 61674 61675 61676 61677 61678[*reenter] 61679 61680The `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: 61681 61682 61683 61684 reenter (this) 61685 { 61686 ... coroutine body ... 61687 } 61688 61689 61690 61691 61692and if a data member or other variable you can write: 61693 61694 61695 61696 reenter (coro_) 61697 { 61698 ... coroutine body ... 61699 } 61700 61701 61702 61703 61704When `reenter` is executed at runtime, control jumps to the location of the last `yield` or `fork`. 61705 61706The coroutine body may also be a single statement, such as: 61707 61708 61709 61710 reenter (this) for (;;) 61711 { 61712 ... 61713 } 61714 61715 61716 61717 61718[*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. 61719 61720[*yield ['statement]] 61721 61722This form of the `yield` keyword is often used with asynchronous operations: 61723 61724 61725 61726 yield socket_->async_read_some(buffer(*buffer_), *this); 61727 61728 61729 61730 61731This divides into four logical steps: 61732 61733 61734* `yield` saves the current state of the coroutine. 61735 61736* The statement initiates the asynchronous operation. 61737 61738* The resume point is defined immediately following the statement. 61739 61740* Control is transferred to the end of the coroutine body. 61741 61742When 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. 61743 61744The statement may also be a compound statement, and this permits us to define local variables with limited scope: 61745 61746 61747 61748 yield 61749 { 61750 mutable_buffers_1 b = buffer(*buffer_); 61751 socket_->async_read_some(b, *this); 61752 } 61753 61754 61755 61756 61757[*yield return ['expression] ;] 61758 61759This form of `yield` is often used in generators or coroutine-based parsers. For example, the function object: 61760 61761 61762 61763 struct interleave : coroutine 61764 { 61765 istream& is1; 61766 istream& is2; 61767 char operator()(char c) 61768 { 61769 reenter (this) for (;;) 61770 { 61771 yield return is1.get(); 61772 yield return is2.get(); 61773 } 61774 } 61775 }; 61776 61777 61778 61779 61780defines a trivial coroutine that interleaves the characters from two input streams. 61781 61782This type of `yield` divides into three logical steps: 61783 61784 61785* `yield` saves the current state of the coroutine. 61786 61787* The resume point is defined immediately following the semicolon. 61788 61789* The value of the expression is returned from the function. 61790 61791[*yield ;] 61792 61793This form of `yield` is equivalent to the following steps: 61794 61795 61796* `yield` saves the current state of the coroutine. 61797 61798* The resume point is defined immediately following the semicolon. 61799 61800* Control is transferred to the end of the coroutine body. 61801 61802This form might be applied when coroutines are used for cooperative threading and scheduling is explicitly managed. For example: 61803 61804 61805 61806 struct task : coroutine 61807 { 61808 ... 61809 void operator()() 61810 { 61811 reenter (this) 61812 { 61813 while (... not finished ...) 61814 { 61815 ... do something ... 61816 yield; 61817 ... do some more ... 61818 yield; 61819 } 61820 } 61821 } 61822 ... 61823 }; 61824 ... 61825 task t1, t2; 61826 for (;;) 61827 { 61828 t1(); 61829 t2(); 61830 } 61831 61832 61833 61834 61835[*yield break ;] 61836 61837The final form of `yield` is used to explicitly terminate the coroutine. This form is comprised of two steps: 61838 61839 61840* `yield` sets the coroutine state to indicate termination. 61841 61842* Control is transferred to the end of the coroutine body. 61843 61844Once terminated, calls to `is_complete()` return true and the coroutine cannot be reentered. 61845 61846Note 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. 61847 61848[*fork ['statement]] 61849 61850The `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: 61851 61852 61853 61854 reenter (this) 61855 { 61856 do 61857 { 61858 socket_.reset(new tcp::socket(my_context_)); 61859 yield acceptor->async_accept(*socket_, *this); 61860 fork server(*this)(); 61861 } while (is_parent()); 61862 ... client-specific handling follows ... 61863 } 61864 61865 61866 61867 61868The logical steps involved in a `fork` are: 61869 61870 61871* `fork` saves the current state of the coroutine. 61872 61873* The statement creates a copy of the coroutine and either executes it immediately or schedules it for later execution. 61874 61875* The resume point is defined immediately following the semicolon. 61876 61877* For the "parent", control immediately continues from the next line. 61878 61879The 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. 61880 61881Note 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`]. 61882 61883 61884[heading Alternate macro names] 61885 61886 61887 61888If preferred, an application can use macro names that follow a more typical naming convention, rather than the pseudo-keywords. These are: 61889 61890 61891* `BOOST_ASIO_CORO_REENTER` instead of `reenter` 61892 61893* `BOOST_ASIO_CORO_YIELD` instead of `yield` 61894 61895* `BOOST_ASIO_CORO_FORK` instead of `fork` 61896 61897 61898 61899[heading Requirements] 61900 61901['Header: ][^boost/asio/coroutine.hpp] 61902 61903['Convenience header: ][^boost/asio.hpp] 61904 61905 61906[section:coroutine coroutine::coroutine] 61907 61908[indexterm2 boost_asio.indexterm.coroutine.coroutine..coroutine..coroutine] 61909Constructs a coroutine in its initial state. 61910 61911 61912 coroutine(); 61913 61914 61915 61916[endsect] 61917 61918 61919 61920[section:is_child coroutine::is_child] 61921 61922[indexterm2 boost_asio.indexterm.coroutine.is_child..is_child..coroutine] 61923Returns true if the coroutine is the child of a fork. 61924 61925 61926 bool is_child() const; 61927 61928 61929 61930[endsect] 61931 61932 61933 61934[section:is_complete coroutine::is_complete] 61935 61936[indexterm2 boost_asio.indexterm.coroutine.is_complete..is_complete..coroutine] 61937Returns true if the coroutine has reached its terminal state. 61938 61939 61940 bool is_complete() const; 61941 61942 61943 61944[endsect] 61945 61946 61947 61948[section:is_parent coroutine::is_parent] 61949 61950[indexterm2 boost_asio.indexterm.coroutine.is_parent..is_parent..coroutine] 61951Returns true if the coroutine is the parent of a fork. 61952 61953 61954 bool is_parent() const; 61955 61956 61957 61958[endsect] 61959 61960 61961 61962[endsect] 61963 61964 61965[section:deadline_timer deadline_timer] 61966 61967[indexterm1 boost_asio.indexterm.deadline_timer..deadline_timer] 61968Typedef for the typical usage of timer. Uses a UTC clock. 61969 61970 61971 typedef basic_deadline_timer< boost::posix_time::ptime > deadline_timer; 61972 61973 61974[heading Types] 61975[table 61976 [[Name][Description]] 61977 61978 [ 61979 61980 [[link boost_asio.reference.basic_deadline_timer__rebind_executor [*rebind_executor]]] 61981 [Rebinds the timer type to another executor. ] 61982 61983 ] 61984 61985 [ 61986 61987 [[link boost_asio.reference.basic_deadline_timer.duration_type [*duration_type]]] 61988 [The duration type. ] 61989 61990 ] 61991 61992 [ 61993 61994 [[link boost_asio.reference.basic_deadline_timer.executor_type [*executor_type]]] 61995 [The type of the executor associated with the object. ] 61996 61997 ] 61998 61999 [ 62000 62001 [[link boost_asio.reference.basic_deadline_timer.time_type [*time_type]]] 62002 [The time type. ] 62003 62004 ] 62005 62006 [ 62007 62008 [[link boost_asio.reference.basic_deadline_timer.traits_type [*traits_type]]] 62009 [The time traits type. ] 62010 62011 ] 62012 62013] 62014 62015[heading Member Functions] 62016[table 62017 [[Name][Description]] 62018 62019 [ 62020 [[link boost_asio.reference.basic_deadline_timer.async_wait [*async_wait]]] 62021 [Start an asynchronous wait on the timer. ] 62022 ] 62023 62024 [ 62025 [[link boost_asio.reference.basic_deadline_timer.basic_deadline_timer [*basic_deadline_timer]] [constructor]] 62026 [Constructor. 62027 [hr] 62028 Constructor to set a particular expiry time as an absolute time. 62029 [hr] 62030 Constructor to set a particular expiry time relative to now. 62031 [hr] 62032 Move-construct a basic_deadline_timer from another. ] 62033 ] 62034 62035 [ 62036 [[link boost_asio.reference.basic_deadline_timer.cancel [*cancel]]] 62037 [Cancel any asynchronous operations that are waiting on the timer. ] 62038 ] 62039 62040 [ 62041 [[link boost_asio.reference.basic_deadline_timer.cancel_one [*cancel_one]]] 62042 [Cancels one asynchronous operation that is waiting on the timer. ] 62043 ] 62044 62045 [ 62046 [[link boost_asio.reference.basic_deadline_timer.expires_at [*expires_at]]] 62047 [Get the timer's expiry time as an absolute time. 62048 [hr] 62049 Set the timer's expiry time as an absolute time. ] 62050 ] 62051 62052 [ 62053 [[link boost_asio.reference.basic_deadline_timer.expires_from_now [*expires_from_now]]] 62054 [Get the timer's expiry time relative to now. 62055 [hr] 62056 Set the timer's expiry time relative to now. ] 62057 ] 62058 62059 [ 62060 [[link boost_asio.reference.basic_deadline_timer.get_executor [*get_executor]]] 62061 [Get the executor associated with the object. ] 62062 ] 62063 62064 [ 62065 [[link boost_asio.reference.basic_deadline_timer.operator_eq_ [*operator=]]] 62066 [Move-assign a basic_deadline_timer from another. ] 62067 ] 62068 62069 [ 62070 [[link boost_asio.reference.basic_deadline_timer.wait [*wait]]] 62071 [Perform a blocking wait on the timer. ] 62072 ] 62073 62074 [ 62075 [[link boost_asio.reference.basic_deadline_timer._basic_deadline_timer [*~basic_deadline_timer]] [destructor]] 62076 [Destroys the timer. ] 62077 ] 62078 62079] 62080 62081The [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. 62082 62083A 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. 62084 62085Most applications will use the [link boost_asio.reference.deadline_timer `deadline_timer`] typedef. 62086 62087 62088[heading Thread Safety] 62089 62090['Distinct] ['objects:] Safe. 62091 62092['Shared] ['objects:] Unsafe. 62093 62094 62095[heading Examples] 62096 62097Performing a blocking wait: 62098 62099 // Construct a timer without setting an expiry time. 62100 boost::asio::deadline_timer timer(my_context); 62101 62102 // Set an expiry time relative to now. 62103 timer.expires_from_now(boost::posix_time::seconds(5)); 62104 62105 // Wait for the timer to expire. 62106 timer.wait(); 62107 62108 62109 62110 62111 62112Performing an asynchronous wait: 62113 62114 void handler(const boost::system::error_code& error) 62115 { 62116 if (!error) 62117 { 62118 // Timer expired. 62119 } 62120 } 62121 62122 ... 62123 62124 // Construct a timer with an absolute expiry time. 62125 boost::asio::deadline_timer timer(my_context, 62126 boost::posix_time::time_from_string("2005-12-07 23:59:59.000")); 62127 62128 // Start an asynchronous wait. 62129 timer.async_wait(handler); 62130 62131 62132 62133 62134 62135[heading Changing an active deadline_timer's expiry time] 62136 62137 62138 62139Changing 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: 62140 62141 62142 62143 void on_some_event() 62144 { 62145 if (my_timer.expires_from_now(seconds(5)) > 0) 62146 { 62147 // We managed to cancel the timer. Start new asynchronous wait. 62148 my_timer.async_wait(on_timeout); 62149 } 62150 else 62151 { 62152 // Too late, timer has already expired! 62153 } 62154 } 62155 62156 void on_timeout(const boost::system::error_code& e) 62157 { 62158 if (e != boost::asio::error::operation_aborted) 62159 { 62160 // Timer was not cancelled, take necessary action. 62161 } 62162 } 62163 62164 62165 62166 62167 62168* 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. 62169 62170 62171* If a wait handler is cancelled, the boost::system::error\_code passed to it contains the value `boost::asio::error::operation_aborted`. 62172 62173 62174 62175 62176[heading Requirements] 62177 62178['Header: ][^boost/asio/deadline_timer.hpp] 62179 62180['Convenience header: ][^boost/asio.hpp] 62181 62182 62183[endsect] 62184 62185 62186[section:default_completion_token default_completion_token] 62187 62188[indexterm1 boost_asio.indexterm.default_completion_token..default_completion_token] 62189 62190 62191Traits type used to determine the default completion token type associated with a type (such as an executor). 62192 62193 62194 template< 62195 typename T> 62196 struct default_completion_token 62197 62198 62199[heading Types] 62200[table 62201 [[Name][Description]] 62202 62203 [ 62204 62205 [[link boost_asio.reference.default_completion_token.type [*type]]] 62206 [If T has a nested type default_completion_token_type, T::default_completion_token_type. Otherwise the typedef type is not defined. ] 62207 62208 ] 62209 62210] 62211 62212A program may specialise this traits type if the `T` template parameter in the specialisation is a user-defined type. 62213 62214Specialisations of this trait may provide a nested typedef `type`, which is a default-constructible completion token type. 62215 62216[heading Requirements] 62217 62218['Header: ][^boost/asio/async_result.hpp] 62219 62220['Convenience header: ][^boost/asio.hpp] 62221 62222 62223[section:type default_completion_token::type] 62224 62225[indexterm2 boost_asio.indexterm.default_completion_token.type..type..default_completion_token] 62226If `T` has a nested type `default_completion_token_type`, `T::default_completion_token_type`. Otherwise the typedef `type` is not defined. 62227 62228 62229 typedef see_below type; 62230 62231 62232 62233[heading Requirements] 62234 62235['Header: ][^boost/asio/async_result.hpp] 62236 62237['Convenience header: ][^boost/asio.hpp] 62238 62239 62240[endsect] 62241 62242 62243 62244[endsect] 62245 62246[section:defer defer] 62247 62248[indexterm1 boost_asio.indexterm.defer..defer] 62249Submits a completion token or function object for execution. 62250 62251 template< 62252 typename CompletionToken> 62253 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.defer.overload1 defer]``( 62254 CompletionToken && token); 62255 `` [''''»''' [link boost_asio.reference.defer.overload1 more...]]`` 62256 62257 template< 62258 typename ``[link boost_asio.reference.Executor1 Executor]``, 62259 typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 62260 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.defer.overload2 defer]``( 62261 const Executor & ex, 62262 CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 62263 typename constraint< execution::is_executor< Executor >::value||is_executor< Executor >::value >::type = 0); 62264 `` [''''»''' [link boost_asio.reference.defer.overload2 more...]]`` 62265 62266 template< 62267 typename ExecutionContext, 62268 typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 62269 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.defer.overload3 defer]``( 62270 ExecutionContext & ctx, 62271 CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 62272 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 62273 `` [''''»''' [link boost_asio.reference.defer.overload3 more...]]`` 62274 62275[heading Requirements] 62276 62277['Header: ][^boost/asio/defer.hpp] 62278 62279['Convenience header: ][^boost/asio.hpp] 62280 62281 62282[section:overload1 defer (1 of 3 overloads)] 62283 62284 62285Submits a completion token or function object for execution. 62286 62287 62288 template< 62289 typename CompletionToken> 62290 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` defer( 62291 CompletionToken && token); 62292 62293 62294This 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()`. 62295 62296The 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. 62297 62298This function has the following effects: 62299 62300 62301* Constructs a function object handler of type `Handler`, initialized with `handler(forward<CompletionToken>(token))`. 62302 62303 62304* Constructs an object `result` of type `async_result<Handler>`, initializing the object as `result(handler)`. 62305 62306 62307* Obtains the handler's associated executor object `ex` by performing `get_associated_executor(handler)`. 62308 62309 62310* Obtains the handler's associated allocator object `alloc` by performing `get_associated_allocator(handler)`. 62311 62312 62313* Performs `ex.defer(std::move(handler), alloc)`. 62314 62315 62316* Returns `result.get()`. 62317 62318 62319 62320 62321[endsect] 62322 62323 62324 62325[section:overload2 defer (2 of 3 overloads)] 62326 62327 62328Submits a completion token or function object for execution. 62329 62330 62331 template< 62332 typename ``[link boost_asio.reference.Executor1 Executor]``, 62333 typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 62334 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` defer( 62335 const Executor & ex, 62336 CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 62337 typename constraint< execution::is_executor< Executor >::value||is_executor< Executor >::value >::type = 0); 62338 62339 62340This 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()`. 62341 62342The 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. 62343 62344This function has the following effects: 62345 62346 62347* Constructs a function object handler of type `Handler`, initialized with `handler(forward<CompletionToken>(token))`. 62348 62349 62350* Constructs an object `result` of type `async_result<Handler>`, initializing the object as `result(handler)`. 62351 62352 62353* Obtains the handler's associated executor object `ex1` by performing `get_associated_executor(handler)`. 62354 62355 62356* Creates a work object `w` by performing `make_work(ex1)`. 62357 62358 62359* Obtains the handler's associated allocator object `alloc` by performing `get_associated_allocator(handler)`. 62360 62361 62362* Constructs a function object `f` with a function call operator that performs `ex1.dispatch(std::move(handler), alloc)` followed by `w.reset()`. 62363 62364 62365* Performs `Executor(ex).defer(std::move(f), alloc)`. 62366 62367 62368* Returns `result.get()`. 62369 62370 62371 62372 62373[endsect] 62374 62375 62376 62377[section:overload3 defer (3 of 3 overloads)] 62378 62379 62380Submits a completion token or function object for execution. 62381 62382 62383 template< 62384 typename ExecutionContext, 62385 typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 62386 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` defer( 62387 ExecutionContext & ctx, 62388 CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 62389 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 62390 62391 62392 62393[heading Return Value] 62394 62395`defer(ctx.get_executor(), forward<CompletionToken>(token))`. 62396 62397 62398 62399 62400[endsect] 62401 62402 62403[endsect] 62404 62405 62406[section:detached detached] 62407 62408[indexterm1 boost_asio.indexterm.detached..detached] 62409A special value, similar to std::nothrow. 62410 62411 62412 constexpr detached_t detached; 62413 62414 62415See the documentation for [link boost_asio.reference.detached_t `detached_t`] for a usage example. 62416 62417[heading Requirements] 62418 62419['Header: ][^boost/asio/detached.hpp] 62420 62421['Convenience header: ][^boost/asio.hpp] 62422 62423 62424[endsect] 62425 62426 62427[section:detached_t detached_t] 62428 62429[indexterm1 boost_asio.indexterm.detached_t..detached_t] 62430 62431 62432Class used to specify that an asynchronous operation is detached. 62433 62434 62435 class detached_t 62436 62437 62438[heading Types] 62439[table 62440 [[Name][Description]] 62441 62442 [ 62443 62444 [[link boost_asio.reference.detached_t__executor_with_default [*executor_with_default]]] 62445 [Adapts an executor to add the detached_t completion token as the default. ] 62446 62447 ] 62448 62449] 62450 62451[heading Member Functions] 62452[table 62453 [[Name][Description]] 62454 62455 [ 62456 [[link boost_asio.reference.detached_t.as_default_on [*as_default_on]] [static]] 62457 [Function helper to adapt an I/O object to use detached_t as its default completion token type. ] 62458 ] 62459 62460 [ 62461 [[link boost_asio.reference.detached_t.detached_t [*detached_t]] [constructor]] 62462 [Constructor. ] 62463 ] 62464 62465] 62466 62467The [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: 62468 62469 62470 62471 my_socket.async_send(my_buffer, boost::asio::detached); 62472 62473 62474 62475 62476[heading Requirements] 62477 62478['Header: ][^boost/asio/detached.hpp] 62479 62480['Convenience header: ][^boost/asio.hpp] 62481 62482 62483[section:as_default_on detached_t::as_default_on] 62484 62485[indexterm2 boost_asio.indexterm.detached_t.as_default_on..as_default_on..detached_t] 62486Function helper to adapt an I/O object to use `detached_t` as its default completion token type. 62487 62488 62489 template< 62490 typename T> 62491 static decay< T >::type::template rebind_executor< executor_with_default< typename decay< T >::type::executor_type > >::other as_default_on( 62492 T && object); 62493 62494 62495 62496[endsect] 62497 62498 62499 62500[section:detached_t detached_t::detached_t] 62501 62502[indexterm2 boost_asio.indexterm.detached_t.detached_t..detached_t..detached_t] 62503Constructor. 62504 62505 62506 constexpr detached_t(); 62507 62508 62509 62510[endsect] 62511 62512 62513 62514[endsect] 62515 62516[section:detached_t__executor_with_default detached_t::executor_with_default] 62517 62518[indexterm1 boost_asio.indexterm.detached_t__executor_with_default..detached_t::executor_with_default] 62519 62520 62521Adapts an executor to add the `detached_t` completion token as the default. 62522 62523 62524 template< 62525 typename ``[link boost_asio.reference.Executor1 InnerExecutor]``> 62526 struct executor_with_default 62527 62528 62529[heading Types] 62530[table 62531 [[Name][Description]] 62532 62533 [ 62534 62535 [[link boost_asio.reference.detached_t__executor_with_default.default_completion_token_type [*default_completion_token_type]]] 62536 [Specify detached_t as the default completion token type. ] 62537 62538 ] 62539 62540] 62541 62542[heading Member Functions] 62543[table 62544 [[Name][Description]] 62545 62546 [ 62547 [[link boost_asio.reference.detached_t__executor_with_default.executor_with_default [*executor_with_default]] [constructor]] 62548 [Construct the adapted executor from the inner executor type. 62549 [hr] 62550 Convert the specified executor to the inner executor type, then use that to construct the adapted executor. ] 62551 ] 62552 62553] 62554 62555[heading Requirements] 62556 62557['Header: ][^boost/asio/detached.hpp] 62558 62559['Convenience header: ][^boost/asio.hpp] 62560 62561 62562[section:default_completion_token_type detached_t::executor_with_default::default_completion_token_type] 62563 62564[indexterm2 boost_asio.indexterm.detached_t__executor_with_default.default_completion_token_type..default_completion_token_type..detached_t::executor_with_default] 62565Specify `detached_t` as the default completion token type. 62566 62567 62568 typedef detached_t default_completion_token_type; 62569 62570 62571[heading Types] 62572[table 62573 [[Name][Description]] 62574 62575 [ 62576 62577 [[link boost_asio.reference.detached_t__executor_with_default [*executor_with_default]]] 62578 [Adapts an executor to add the detached_t completion token as the default. ] 62579 62580 ] 62581 62582] 62583 62584[heading Member Functions] 62585[table 62586 [[Name][Description]] 62587 62588 [ 62589 [[link boost_asio.reference.detached_t.as_default_on [*as_default_on]] [static]] 62590 [Function helper to adapt an I/O object to use detached_t as its default completion token type. ] 62591 ] 62592 62593 [ 62594 [[link boost_asio.reference.detached_t.detached_t [*detached_t]] [constructor]] 62595 [Constructor. ] 62596 ] 62597 62598] 62599 62600The [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: 62601 62602 62603 62604 my_socket.async_send(my_buffer, boost::asio::detached); 62605 62606 62607 62608 62609 62610[heading Requirements] 62611 62612['Header: ][^boost/asio/detached.hpp] 62613 62614['Convenience header: ][^boost/asio.hpp] 62615 62616 62617[endsect] 62618 62619 62620[section:executor_with_default detached_t::executor_with_default::executor_with_default] 62621 62622[indexterm2 boost_asio.indexterm.detached_t__executor_with_default.executor_with_default..executor_with_default..detached_t::executor_with_default] 62623Construct the adapted executor from the inner executor type. 62624 62625 62626 ``[link boost_asio.reference.detached_t__executor_with_default.executor_with_default.overload1 executor_with_default]``( 62627 const InnerExecutor & ex); 62628 `` [''''»''' [link boost_asio.reference.detached_t__executor_with_default.executor_with_default.overload1 more...]]`` 62629 62630 62631Convert the specified executor to the inner executor type, then use that to construct the adapted executor. 62632 62633 62634 template< 62635 typename ``[link boost_asio.reference.Executor1 OtherExecutor]``> 62636 ``[link boost_asio.reference.detached_t__executor_with_default.executor_with_default.overload2 executor_with_default]``( 62637 const OtherExecutor & ex, 62638 typename constraint< is_convertible< OtherExecutor, InnerExecutor >::value >::type = 0); 62639 `` [''''»''' [link boost_asio.reference.detached_t__executor_with_default.executor_with_default.overload2 more...]]`` 62640 62641 62642[section:overload1 detached_t::executor_with_default::executor_with_default (1 of 2 overloads)] 62643 62644 62645Construct the adapted executor from the inner executor type. 62646 62647 62648 executor_with_default( 62649 const InnerExecutor & ex); 62650 62651 62652 62653[endsect] 62654 62655 62656 62657[section:overload2 detached_t::executor_with_default::executor_with_default (2 of 2 overloads)] 62658 62659 62660Convert the specified executor to the inner executor type, then use that to construct the adapted executor. 62661 62662 62663 template< 62664 typename ``[link boost_asio.reference.Executor1 OtherExecutor]``> 62665 executor_with_default( 62666 const OtherExecutor & ex, 62667 typename constraint< is_convertible< OtherExecutor, InnerExecutor >::value >::type = 0); 62668 62669 62670 62671[endsect] 62672 62673 62674[endsect] 62675 62676 62677[endsect] 62678 62679[section:dispatch dispatch] 62680 62681[indexterm1 boost_asio.indexterm.dispatch..dispatch] 62682Submits a completion token or function object for execution. 62683 62684 template< 62685 typename CompletionToken> 62686 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.dispatch.overload1 dispatch]``( 62687 CompletionToken && token); 62688 `` [''''»''' [link boost_asio.reference.dispatch.overload1 more...]]`` 62689 62690 template< 62691 typename ``[link boost_asio.reference.Executor1 Executor]``, 62692 typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 62693 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.dispatch.overload2 dispatch]``( 62694 const Executor & ex, 62695 CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 62696 typename constraint< execution::is_executor< Executor >::value||is_executor< Executor >::value >::type = 0); 62697 `` [''''»''' [link boost_asio.reference.dispatch.overload2 more...]]`` 62698 62699 template< 62700 typename ExecutionContext, 62701 typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 62702 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.dispatch.overload3 dispatch]``( 62703 ExecutionContext & ctx, 62704 CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 62705 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 62706 `` [''''»''' [link boost_asio.reference.dispatch.overload3 more...]]`` 62707 62708[heading Requirements] 62709 62710['Header: ][^boost/asio/dispatch.hpp] 62711 62712['Convenience header: ][^boost/asio.hpp] 62713 62714 62715[section:overload1 dispatch (1 of 3 overloads)] 62716 62717 62718Submits a completion token or function object for execution. 62719 62720 62721 template< 62722 typename CompletionToken> 62723 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` dispatch( 62724 CompletionToken && token); 62725 62726 62727This 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. 62728 62729This function has the following effects: 62730 62731 62732* Constructs a function object handler of type `Handler`, initialized with `handler(forward<CompletionToken>(token))`. 62733 62734 62735* Constructs an object `result` of type `async_result<Handler>`, initializing the object as `result(handler)`. 62736 62737 62738* Obtains the handler's associated executor object `ex` by performing `get_associated_executor(handler)`. 62739 62740 62741* Obtains the handler's associated allocator object `alloc` by performing `get_associated_allocator(handler)`. 62742 62743 62744* Performs `ex.dispatch(std::move(handler), alloc)`. 62745 62746 62747* Returns `result.get()`. 62748 62749 62750 62751 62752[endsect] 62753 62754 62755 62756[section:overload2 dispatch (2 of 3 overloads)] 62757 62758 62759Submits a completion token or function object for execution. 62760 62761 62762 template< 62763 typename ``[link boost_asio.reference.Executor1 Executor]``, 62764 typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 62765 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` dispatch( 62766 const Executor & ex, 62767 CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 62768 typename constraint< execution::is_executor< Executor >::value||is_executor< Executor >::value >::type = 0); 62769 62770 62771This 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. 62772 62773This function has the following effects: 62774 62775 62776* Constructs a function object handler of type `Handler`, initialized with `handler(forward<CompletionToken>(token))`. 62777 62778 62779* Constructs an object `result` of type `async_result<Handler>`, initializing the object as `result(handler)`. 62780 62781 62782* Obtains the handler's associated executor object `ex1` by performing `get_associated_executor(handler)`. 62783 62784 62785* Creates a work object `w` by performing `make_work(ex1)`. 62786 62787 62788* Obtains the handler's associated allocator object `alloc` by performing `get_associated_allocator(handler)`. 62789 62790 62791* Constructs a function object `f` with a function call operator that performs `ex1.dispatch(std::move(handler), alloc)` followed by `w.reset()`. 62792 62793 62794* Performs `Executor(ex).dispatch(std::move(f), alloc)`. 62795 62796 62797* Returns `result.get()`. 62798 62799 62800 62801 62802[endsect] 62803 62804 62805 62806[section:overload3 dispatch (3 of 3 overloads)] 62807 62808 62809Submits a completion token or function object for execution. 62810 62811 62812 template< 62813 typename ExecutionContext, 62814 typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 62815 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` dispatch( 62816 ExecutionContext & ctx, 62817 CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 62818 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 62819 62820 62821 62822[heading Return Value] 62823 62824`dispatch(ctx.get_executor(), forward<CompletionToken>(token))`. 62825 62826 62827 62828 62829[endsect] 62830 62831 62832[endsect] 62833 62834[section:dynamic_buffer dynamic_buffer] 62835 62836[indexterm1 boost_asio.indexterm.dynamic_buffer..dynamic_buffer] 62837The `boost::asio::dynamic_buffer` function is used to create a dynamically resized buffer from a `std::basic_string` or `std::vector`. 62838 62839 62840Create a new dynamic buffer that represents the given string. 62841 62842 template< 62843 typename Elem, 62844 typename Traits, 62845 typename Allocator> 62846 dynamic_string_buffer< Elem, Traits, Allocator > ``[link boost_asio.reference.dynamic_buffer.overload1 dynamic_buffer]``( 62847 std::basic_string< Elem, Traits, Allocator > & data); 62848 `` [''''»''' [link boost_asio.reference.dynamic_buffer.overload1 more...]]`` 62849 62850 template< 62851 typename Elem, 62852 typename Traits, 62853 typename Allocator> 62854 dynamic_string_buffer< Elem, Traits, Allocator > ``[link boost_asio.reference.dynamic_buffer.overload2 dynamic_buffer]``( 62855 std::basic_string< Elem, Traits, Allocator > & data, 62856 std::size_t max_size); 62857 `` [''''»''' [link boost_asio.reference.dynamic_buffer.overload2 more...]]`` 62858 62859Create a new dynamic buffer that represents the given vector. 62860 62861 template< 62862 typename Elem, 62863 typename Allocator> 62864 dynamic_vector_buffer< Elem, Allocator > ``[link boost_asio.reference.dynamic_buffer.overload3 dynamic_buffer]``( 62865 std::vector< Elem, Allocator > & data); 62866 `` [''''»''' [link boost_asio.reference.dynamic_buffer.overload3 more...]]`` 62867 62868 template< 62869 typename Elem, 62870 typename Allocator> 62871 dynamic_vector_buffer< Elem, Allocator > ``[link boost_asio.reference.dynamic_buffer.overload4 dynamic_buffer]``( 62872 std::vector< Elem, Allocator > & data, 62873 std::size_t max_size); 62874 `` [''''»''' [link boost_asio.reference.dynamic_buffer.overload4 more...]]`` 62875 62876[heading Requirements] 62877 62878['Header: ][^boost/asio/buffer.hpp] 62879 62880['Convenience header: ][^boost/asio.hpp] 62881 62882 62883[section:overload1 dynamic_buffer (1 of 4 overloads)] 62884 62885 62886Create a new dynamic buffer that represents the given string. 62887 62888 62889 template< 62890 typename Elem, 62891 typename Traits, 62892 typename Allocator> 62893 dynamic_string_buffer< Elem, Traits, Allocator > dynamic_buffer( 62894 std::basic_string< Elem, Traits, Allocator > & data); 62895 62896 62897 62898[heading Return Value] 62899 62900`dynamic_string_buffer<Elem, Traits, Allocator>(data)`. 62901 62902 62903 62904 62905[endsect] 62906 62907 62908 62909[section:overload2 dynamic_buffer (2 of 4 overloads)] 62910 62911 62912Create a new dynamic buffer that represents the given string. 62913 62914 62915 template< 62916 typename Elem, 62917 typename Traits, 62918 typename Allocator> 62919 dynamic_string_buffer< Elem, Traits, Allocator > dynamic_buffer( 62920 std::basic_string< Elem, Traits, Allocator > & data, 62921 std::size_t max_size); 62922 62923 62924 62925[heading Return Value] 62926 62927`dynamic_string_buffer<Elem, Traits, Allocator>(data, max_size)`. 62928 62929 62930 62931 62932[endsect] 62933 62934 62935 62936[section:overload3 dynamic_buffer (3 of 4 overloads)] 62937 62938 62939Create a new dynamic buffer that represents the given vector. 62940 62941 62942 template< 62943 typename Elem, 62944 typename Allocator> 62945 dynamic_vector_buffer< Elem, Allocator > dynamic_buffer( 62946 std::vector< Elem, Allocator > & data); 62947 62948 62949 62950[heading Return Value] 62951 62952`dynamic_vector_buffer<Elem, Allocator>(data)`. 62953 62954 62955 62956 62957[endsect] 62958 62959 62960 62961[section:overload4 dynamic_buffer (4 of 4 overloads)] 62962 62963 62964Create a new dynamic buffer that represents the given vector. 62965 62966 62967 template< 62968 typename Elem, 62969 typename Allocator> 62970 dynamic_vector_buffer< Elem, Allocator > dynamic_buffer( 62971 std::vector< Elem, Allocator > & data, 62972 std::size_t max_size); 62973 62974 62975 62976[heading Return Value] 62977 62978`dynamic_vector_buffer<Elem, Allocator>(data, max_size)`. 62979 62980 62981 62982 62983[endsect] 62984 62985 62986[endsect] 62987 62988[section:dynamic_string_buffer dynamic_string_buffer] 62989 62990[indexterm1 boost_asio.indexterm.dynamic_string_buffer..dynamic_string_buffer] 62991 62992 62993Adapt a basic\_string to the DynamicBuffer requirements. 62994 62995 62996 template< 62997 typename Elem, 62998 typename Traits, 62999 typename Allocator> 63000 class dynamic_string_buffer 63001 63002 63003[heading Types] 63004[table 63005 [[Name][Description]] 63006 63007 [ 63008 63009 [[link boost_asio.reference.dynamic_string_buffer.const_buffers_type [*const_buffers_type]]] 63010 [The type used to represent a sequence of constant buffers that refers to the underlying memory. ] 63011 63012 ] 63013 63014 [ 63015 63016 [[link boost_asio.reference.dynamic_string_buffer.mutable_buffers_type [*mutable_buffers_type]]] 63017 [The type used to represent a sequence of mutable buffers that refers to the underlying memory. ] 63018 63019 ] 63020 63021] 63022 63023[heading Member Functions] 63024[table 63025 [[Name][Description]] 63026 63027 [ 63028 [[link boost_asio.reference.dynamic_string_buffer.capacity [*capacity]]] 63029 [Get the maximum size that the buffer may grow to without triggering reallocation. ] 63030 ] 63031 63032 [ 63033 [[link boost_asio.reference.dynamic_string_buffer.commit [*commit]]] 63034 [DynamicBuffer_v1: Move bytes from the output sequence to the input sequence. ] 63035 ] 63036 63037 [ 63038 [[link boost_asio.reference.dynamic_string_buffer.consume [*consume]]] 63039 [DynamicBuffer_v1: Remove characters from the input sequence. DynamicBuffer_v2: Consume the specified number of bytes from the beginning of the underlying memory. ] 63040 ] 63041 63042 [ 63043 [[link boost_asio.reference.dynamic_string_buffer.data [*data]]] 63044 [DynamicBuffer_v1: Get a list of buffers that represents the input sequence. 63045 [hr] 63046 DynamicBuffer_v2: Get a sequence of buffers that represents the underlying memory. ] 63047 ] 63048 63049 [ 63050 [[link boost_asio.reference.dynamic_string_buffer.dynamic_string_buffer [*dynamic_string_buffer]] [constructor]] 63051 [Construct a dynamic buffer from a string. 63052 [hr] 63053 DynamicBuffer_v2: Copy construct a dynamic buffer. 63054 [hr] 63055 Move construct a dynamic buffer. ] 63056 ] 63057 63058 [ 63059 [[link boost_asio.reference.dynamic_string_buffer.grow [*grow]]] 63060 [DynamicBuffer_v2: Grow the underlying memory by the specified number of bytes. ] 63061 ] 63062 63063 [ 63064 [[link boost_asio.reference.dynamic_string_buffer.max_size [*max_size]]] 63065 [Get the maximum size of the dynamic buffer. ] 63066 ] 63067 63068 [ 63069 [[link boost_asio.reference.dynamic_string_buffer.prepare [*prepare]]] 63070 [DynamicBuffer_v1: Get a list of buffers that represents the output sequence, with the given size. ] 63071 ] 63072 63073 [ 63074 [[link boost_asio.reference.dynamic_string_buffer.shrink [*shrink]]] 63075 [DynamicBuffer_v2: Shrink the underlying memory by the specified number of bytes. ] 63076 ] 63077 63078 [ 63079 [[link boost_asio.reference.dynamic_string_buffer.size [*size]]] 63080 [DynamicBuffer_v1: Get the size of the input sequence. DynamicBuffer_v2: Get the current size of the underlying memory. ] 63081 ] 63082 63083] 63084 63085Requires that `sizeof(Elem) == 1`. 63086 63087[heading Requirements] 63088 63089['Header: ][^boost/asio/buffer.hpp] 63090 63091['Convenience header: ][^boost/asio.hpp] 63092 63093 63094[section:capacity dynamic_string_buffer::capacity] 63095 63096[indexterm2 boost_asio.indexterm.dynamic_string_buffer.capacity..capacity..dynamic_string_buffer] 63097Get the maximum size that the buffer may grow to without triggering reallocation. 63098 63099 63100 std::size_t capacity() const; 63101 63102 63103 63104[heading Return Value] 63105 63106The current capacity of the underlying string if less than `max_size()`. Otherwise returns `max_size()`. 63107 63108 63109 63110 63111[endsect] 63112 63113 63114 63115[section:commit dynamic_string_buffer::commit] 63116 63117[indexterm2 boost_asio.indexterm.dynamic_string_buffer.commit..commit..dynamic_string_buffer] 63118[*DynamicBuffer\_v1:] Move bytes from the output sequence to the input sequence. 63119 63120 63121 void commit( 63122 std::size_t n); 63123 63124 63125 63126[heading Parameters] 63127 63128 63129[variablelist 63130 63131[[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.]] 63132 63133] 63134 63135Requires a preceding call `prepare(x)` where `x >= n`, and no intervening operations that modify the input or output sequence. 63136 63137 63138[heading Remarks] 63139 63140If `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. 63141 63142 63143 63144 63145[endsect] 63146 63147 63148 63149[section:const_buffers_type dynamic_string_buffer::const_buffers_type] 63150 63151[indexterm2 boost_asio.indexterm.dynamic_string_buffer.const_buffers_type..const_buffers_type..dynamic_string_buffer] 63152The type used to represent a sequence of constant buffers that refers to the underlying memory. 63153 63154 63155 typedef const_buffer const_buffers_type; 63156 63157 63158[heading Member Functions] 63159[table 63160 [[Name][Description]] 63161 63162 [ 63163 [[link boost_asio.reference.const_buffer.const_buffer [*const_buffer]] [constructor]] 63164 [Construct an empty buffer. 63165 [hr] 63166 Construct a buffer to represent a given memory range. 63167 [hr] 63168 Construct a non-modifiable buffer from a modifiable one. ] 63169 ] 63170 63171 [ 63172 [[link boost_asio.reference.const_buffer.data [*data]]] 63173 [Get a pointer to the beginning of the memory range. ] 63174 ] 63175 63176 [ 63177 [[link boost_asio.reference.const_buffer.operator_plus__eq_ [*operator+=]]] 63178 [Move the start of the buffer by the specified number of bytes. ] 63179 ] 63180 63181 [ 63182 [[link boost_asio.reference.const_buffer.size [*size]]] 63183 [Get the size of the memory range. ] 63184 ] 63185 63186] 63187 63188[heading Related Functions] 63189[table 63190 [[Name][Description]] 63191 63192 [ 63193 [[link boost_asio.reference.const_buffer.operator_plus_ [*operator+]]] 63194 [Create a new non-modifiable buffer that is offset from the start of another. ] 63195 ] 63196 63197] 63198 63199The [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. 63200 63201 63202[heading Accessing Buffer Contents] 63203 63204 63205 63206The contents of a buffer may be accessed using the `data()` and `size()` member functions: 63207 63208 63209 63210 boost::asio::const_buffer b1 = ...; 63211 std::size_t s1 = b1.size(); 63212 const unsigned char* p1 = static_cast<const unsigned char*>(b1.data()); 63213 63214 63215 63216 63217The `data()` member function permits violations of type safety, so uses of it in application code should be carefully considered. 63218 63219 63220[heading Requirements] 63221 63222['Header: ][^boost/asio/buffer.hpp] 63223 63224['Convenience header: ][^boost/asio.hpp] 63225 63226 63227[endsect] 63228 63229 63230 63231[section:consume dynamic_string_buffer::consume] 63232 63233[indexterm2 boost_asio.indexterm.dynamic_string_buffer.consume..consume..dynamic_string_buffer] 63234[*DynamicBuffer\_v1:] Remove characters from the input sequence. [*DynamicBuffer\_v2:] Consume the specified number of bytes from the beginning of the underlying memory. 63235 63236 63237 void consume( 63238 std::size_t n); 63239 63240 63241[*DynamicBuffer\_v1:] Removes `n` characters from the beginning of the input sequence. 63242[heading Remarks] 63243 63244If `n` is greater than the size of the input sequence, the entire input sequence is consumed and no error is issued. 63245 63246[*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. 63247 63248 63249[endsect] 63250 63251 63252[section:data dynamic_string_buffer::data] 63253 63254[indexterm2 boost_asio.indexterm.dynamic_string_buffer.data..data..dynamic_string_buffer] 63255[*DynamicBuffer\_v1:] Get a list of buffers that represents the input sequence. 63256 63257 63258 const_buffers_type ``[link boost_asio.reference.dynamic_string_buffer.data.overload1 data]``() const; 63259 `` [''''»''' [link boost_asio.reference.dynamic_string_buffer.data.overload1 more...]]`` 63260 63261 63262[*DynamicBuffer\_v2:] Get a sequence of buffers that represents the underlying memory. 63263 63264 63265 mutable_buffers_type ``[link boost_asio.reference.dynamic_string_buffer.data.overload2 data]``( 63266 std::size_t pos, 63267 std::size_t n); 63268 `` [''''»''' [link boost_asio.reference.dynamic_string_buffer.data.overload2 more...]]`` 63269 63270 const_buffers_type ``[link boost_asio.reference.dynamic_string_buffer.data.overload3 data]``( 63271 std::size_t pos, 63272 std::size_t n) const; 63273 `` [''''»''' [link boost_asio.reference.dynamic_string_buffer.data.overload3 more...]]`` 63274 63275 63276[section:overload1 dynamic_string_buffer::data (1 of 3 overloads)] 63277 63278 63279[*DynamicBuffer\_v1:] Get a list of buffers that represents the input sequence. 63280 63281 63282 const_buffers_type data() const; 63283 63284 63285 63286[heading Return Value] 63287 63288An object of type `const_buffers_type` that satisfies ConstBufferSequence requirements, representing the basic\_string memory in the input sequence. 63289 63290 63291[heading Remarks] 63292 63293The returned object is invalidated by any `dynamic_string_buffer` or `basic_string` member function that resizes or erases the string. 63294 63295 63296 63297 63298[endsect] 63299 63300 63301 63302[section:overload2 dynamic_string_buffer::data (2 of 3 overloads)] 63303 63304 63305[*DynamicBuffer\_v2:] Get a sequence of buffers that represents the underlying memory. 63306 63307 63308 mutable_buffers_type data( 63309 std::size_t pos, 63310 std::size_t n); 63311 63312 63313 63314[heading Parameters] 63315 63316 63317[variablelist 63318 63319[[pos][Position of the first byte to represent in the buffer sequence]] 63320 63321[[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.]] 63322 63323] 63324 63325 63326[heading Return Value] 63327 63328An object of type `mutable_buffers_type` that satisfies MutableBufferSequence requirements, representing the basic\_string memory. 63329 63330 63331[heading Remarks] 63332 63333The returned object is invalidated by any `dynamic_string_buffer` or `basic_string` member function that resizes or erases the string. 63334 63335 63336 63337 63338[endsect] 63339 63340 63341 63342[section:overload3 dynamic_string_buffer::data (3 of 3 overloads)] 63343 63344 63345[*DynamicBuffer\_v2:] Get a sequence of buffers that represents the underlying memory. 63346 63347 63348 const_buffers_type data( 63349 std::size_t pos, 63350 std::size_t n) const; 63351 63352 63353 63354[heading Parameters] 63355 63356 63357[variablelist 63358 63359[[pos][Position of the first byte to represent in the buffer sequence]] 63360 63361[[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.]] 63362 63363] 63364 63365 63366[heading Remarks] 63367 63368The returned object is invalidated by any `dynamic_string_buffer` or `basic_string` member function that resizes or erases the string. 63369 63370 63371 63372 63373[endsect] 63374 63375 63376[endsect] 63377 63378[section:dynamic_string_buffer dynamic_string_buffer::dynamic_string_buffer] 63379 63380[indexterm2 boost_asio.indexterm.dynamic_string_buffer.dynamic_string_buffer..dynamic_string_buffer..dynamic_string_buffer] 63381Construct a dynamic buffer from a string. 63382 63383 63384 explicit ``[link boost_asio.reference.dynamic_string_buffer.dynamic_string_buffer.overload1 dynamic_string_buffer]``( 63385 std::basic_string< Elem, Traits, Allocator > & s, 63386 std::size_t maximum_size = (std::numeric_limits< std::size_t >::max)()); 63387 `` [''''»''' [link boost_asio.reference.dynamic_string_buffer.dynamic_string_buffer.overload1 more...]]`` 63388 63389 63390[*DynamicBuffer\_v2:] Copy construct a dynamic buffer. 63391 63392 63393 ``[link boost_asio.reference.dynamic_string_buffer.dynamic_string_buffer.overload2 dynamic_string_buffer]``( 63394 const dynamic_string_buffer & other); 63395 `` [''''»''' [link boost_asio.reference.dynamic_string_buffer.dynamic_string_buffer.overload2 more...]]`` 63396 63397 63398Move construct a dynamic buffer. 63399 63400 63401 ``[link boost_asio.reference.dynamic_string_buffer.dynamic_string_buffer.overload3 dynamic_string_buffer]``( 63402 dynamic_string_buffer && other); 63403 `` [''''»''' [link boost_asio.reference.dynamic_string_buffer.dynamic_string_buffer.overload3 more...]]`` 63404 63405 63406[section:overload1 dynamic_string_buffer::dynamic_string_buffer (1 of 3 overloads)] 63407 63408 63409Construct a dynamic buffer from a string. 63410 63411 63412 dynamic_string_buffer( 63413 std::basic_string< Elem, Traits, Allocator > & s, 63414 std::size_t maximum_size = (std::numeric_limits< std::size_t >::max)()); 63415 63416 63417 63418[heading Parameters] 63419 63420 63421[variablelist 63422 63423[[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.]] 63424 63425] 63426 63427[*DynamicBuffer\_v1:] Any existing data in the string is treated as the dynamic buffer's input sequence. 63428 63429 63430[heading Parameters] 63431 63432 63433[variablelist 63434 63435[[maximum_size][Specifies a maximum size for the buffer, in bytes. ]] 63436 63437] 63438 63439 63440 63441 63442[endsect] 63443 63444 63445 63446[section:overload2 dynamic_string_buffer::dynamic_string_buffer (2 of 3 overloads)] 63447 63448 63449[*DynamicBuffer\_v2:] Copy construct a dynamic buffer. 63450 63451 63452 dynamic_string_buffer( 63453 const dynamic_string_buffer & other); 63454 63455 63456 63457[endsect] 63458 63459 63460 63461[section:overload3 dynamic_string_buffer::dynamic_string_buffer (3 of 3 overloads)] 63462 63463 63464Move construct a dynamic buffer. 63465 63466 63467 dynamic_string_buffer( 63468 dynamic_string_buffer && other); 63469 63470 63471 63472[endsect] 63473 63474 63475[endsect] 63476 63477 63478[section:grow dynamic_string_buffer::grow] 63479 63480[indexterm2 boost_asio.indexterm.dynamic_string_buffer.grow..grow..dynamic_string_buffer] 63481[*DynamicBuffer\_v2:] Grow the underlying memory by the specified number of bytes. 63482 63483 63484 void grow( 63485 std::size_t n); 63486 63487 63488Resizes the string to accommodate an additional `n` bytes at the end. 63489 63490 63491[heading Exceptions] 63492 63493 63494[variablelist 63495 63496[[std::length_error][If `size() + n > max_size()`. ]] 63497 63498] 63499 63500 63501 63502 63503[endsect] 63504 63505 63506 63507[section:max_size dynamic_string_buffer::max_size] 63508 63509[indexterm2 boost_asio.indexterm.dynamic_string_buffer.max_size..max_size..dynamic_string_buffer] 63510Get the maximum size of the dynamic buffer. 63511 63512 63513 std::size_t max_size() const; 63514 63515 63516 63517[heading Return Value] 63518 63519The allowed maximum size of the underlying memory. 63520 63521 63522 63523 63524[endsect] 63525 63526 63527 63528[section:mutable_buffers_type dynamic_string_buffer::mutable_buffers_type] 63529 63530[indexterm2 boost_asio.indexterm.dynamic_string_buffer.mutable_buffers_type..mutable_buffers_type..dynamic_string_buffer] 63531The type used to represent a sequence of mutable buffers that refers to the underlying memory. 63532 63533 63534 typedef mutable_buffer mutable_buffers_type; 63535 63536 63537[heading Member Functions] 63538[table 63539 [[Name][Description]] 63540 63541 [ 63542 [[link boost_asio.reference.mutable_buffer.data [*data]]] 63543 [Get a pointer to the beginning of the memory range. ] 63544 ] 63545 63546 [ 63547 [[link boost_asio.reference.mutable_buffer.mutable_buffer [*mutable_buffer]] [constructor]] 63548 [Construct an empty buffer. 63549 [hr] 63550 Construct a buffer to represent a given memory range. ] 63551 ] 63552 63553 [ 63554 [[link boost_asio.reference.mutable_buffer.operator_plus__eq_ [*operator+=]]] 63555 [Move the start of the buffer by the specified number of bytes. ] 63556 ] 63557 63558 [ 63559 [[link boost_asio.reference.mutable_buffer.size [*size]]] 63560 [Get the size of the memory range. ] 63561 ] 63562 63563] 63564 63565[heading Related Functions] 63566[table 63567 [[Name][Description]] 63568 63569 [ 63570 [[link boost_asio.reference.mutable_buffer.operator_plus_ [*operator+]]] 63571 [Create a new modifiable buffer that is offset from the start of another. ] 63572 ] 63573 63574] 63575 63576The [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. 63577 63578 63579[heading Accessing Buffer Contents] 63580 63581 63582 63583The contents of a buffer may be accessed using the `data()` and `size()` member functions: 63584 63585 63586 63587 boost::asio::mutable_buffer b1 = ...; 63588 std::size_t s1 = b1.size(); 63589 unsigned char* p1 = static_cast<unsigned char*>(b1.data()); 63590 63591 63592 63593 63594The `data()` member function permits violations of type safety, so uses of it in application code should be carefully considered. 63595 63596 63597[heading Requirements] 63598 63599['Header: ][^boost/asio/buffer.hpp] 63600 63601['Convenience header: ][^boost/asio.hpp] 63602 63603 63604[endsect] 63605 63606 63607 63608[section:prepare dynamic_string_buffer::prepare] 63609 63610[indexterm2 boost_asio.indexterm.dynamic_string_buffer.prepare..prepare..dynamic_string_buffer] 63611[*DynamicBuffer\_v1:] Get a list of buffers that represents the output sequence, with the given size. 63612 63613 63614 mutable_buffers_type prepare( 63615 std::size_t n); 63616 63617 63618Ensures that the output sequence can accommodate `n` bytes, resizing the basic\_string object as necessary. 63619 63620 63621[heading Return Value] 63622 63623An object of type `mutable_buffers_type` that satisfies MutableBufferSequence requirements, representing basic\_string memory at the start of the output sequence of size `n`. 63624 63625 63626[heading Exceptions] 63627 63628 63629[variablelist 63630 63631[[std::length_error][If `size() + n > max_size()`.]] 63632 63633] 63634 63635 63636[heading Remarks] 63637 63638The returned object is invalidated by any `dynamic_string_buffer` or `basic_string` member function that modifies the input sequence or output sequence. 63639 63640 63641 63642 63643[endsect] 63644 63645 63646 63647[section:shrink dynamic_string_buffer::shrink] 63648 63649[indexterm2 boost_asio.indexterm.dynamic_string_buffer.shrink..shrink..dynamic_string_buffer] 63650[*DynamicBuffer\_v2:] Shrink the underlying memory by the specified number of bytes. 63651 63652 63653 void shrink( 63654 std::size_t n); 63655 63656 63657Erases `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. 63658 63659 63660[endsect] 63661 63662 63663 63664[section:size dynamic_string_buffer::size] 63665 63666[indexterm2 boost_asio.indexterm.dynamic_string_buffer.size..size..dynamic_string_buffer] 63667[*DynamicBuffer\_v1:] Get the size of the input sequence. [*DynamicBuffer\_v2:] Get the current size of the underlying memory. 63668 63669 63670 std::size_t size() const; 63671 63672 63673 63674[heading Return Value] 63675 63676[*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()`. 63677 63678 63679 63680 63681[endsect] 63682 63683 63684 63685[endsect] 63686 63687[section:dynamic_vector_buffer dynamic_vector_buffer] 63688 63689[indexterm1 boost_asio.indexterm.dynamic_vector_buffer..dynamic_vector_buffer] 63690 63691 63692Adapt a vector to the DynamicBuffer requirements. 63693 63694 63695 template< 63696 typename Elem, 63697 typename Allocator> 63698 class dynamic_vector_buffer 63699 63700 63701[heading Types] 63702[table 63703 [[Name][Description]] 63704 63705 [ 63706 63707 [[link boost_asio.reference.dynamic_vector_buffer.const_buffers_type [*const_buffers_type]]] 63708 [The type used to represent a sequence of constant buffers that refers to the underlying memory. ] 63709 63710 ] 63711 63712 [ 63713 63714 [[link boost_asio.reference.dynamic_vector_buffer.mutable_buffers_type [*mutable_buffers_type]]] 63715 [The type used to represent a sequence of mutable buffers that refers to the underlying memory. ] 63716 63717 ] 63718 63719] 63720 63721[heading Member Functions] 63722[table 63723 [[Name][Description]] 63724 63725 [ 63726 [[link boost_asio.reference.dynamic_vector_buffer.capacity [*capacity]]] 63727 [Get the maximum size that the buffer may grow to without triggering reallocation. ] 63728 ] 63729 63730 [ 63731 [[link boost_asio.reference.dynamic_vector_buffer.commit [*commit]]] 63732 [DynamicBuffer_v1: Move bytes from the output sequence to the input sequence. ] 63733 ] 63734 63735 [ 63736 [[link boost_asio.reference.dynamic_vector_buffer.consume [*consume]]] 63737 [DynamicBuffer_v1: Remove characters from the input sequence. DynamicBuffer_v2: Consume the specified number of bytes from the beginning of the underlying memory. ] 63738 ] 63739 63740 [ 63741 [[link boost_asio.reference.dynamic_vector_buffer.data [*data]]] 63742 [DynamicBuffer_v1: Get a list of buffers that represents the input sequence. 63743 [hr] 63744 DynamicBuffer_v2: Get a sequence of buffers that represents the underlying memory. ] 63745 ] 63746 63747 [ 63748 [[link boost_asio.reference.dynamic_vector_buffer.dynamic_vector_buffer [*dynamic_vector_buffer]] [constructor]] 63749 [Construct a dynamic buffer from a vector. 63750 [hr] 63751 DynamicBuffer_v2: Copy construct a dynamic buffer. 63752 [hr] 63753 Move construct a dynamic buffer. ] 63754 ] 63755 63756 [ 63757 [[link boost_asio.reference.dynamic_vector_buffer.grow [*grow]]] 63758 [DynamicBuffer_v2: Grow the underlying memory by the specified number of bytes. ] 63759 ] 63760 63761 [ 63762 [[link boost_asio.reference.dynamic_vector_buffer.max_size [*max_size]]] 63763 [Get the maximum size of the dynamic buffer. ] 63764 ] 63765 63766 [ 63767 [[link boost_asio.reference.dynamic_vector_buffer.prepare [*prepare]]] 63768 [DynamicBuffer_v1: Get a list of buffers that represents the output sequence, with the given size. ] 63769 ] 63770 63771 [ 63772 [[link boost_asio.reference.dynamic_vector_buffer.shrink [*shrink]]] 63773 [DynamicBuffer_v2: Shrink the underlying memory by the specified number of bytes. ] 63774 ] 63775 63776 [ 63777 [[link boost_asio.reference.dynamic_vector_buffer.size [*size]]] 63778 [DynamicBuffer_v1: Get the size of the input sequence. DynamicBuffer_v2: Get the current size of the underlying memory. ] 63779 ] 63780 63781] 63782 63783Requires that `sizeof(Elem) == 1`. 63784 63785[heading Requirements] 63786 63787['Header: ][^boost/asio/buffer.hpp] 63788 63789['Convenience header: ][^boost/asio.hpp] 63790 63791 63792[section:capacity dynamic_vector_buffer::capacity] 63793 63794[indexterm2 boost_asio.indexterm.dynamic_vector_buffer.capacity..capacity..dynamic_vector_buffer] 63795Get the maximum size that the buffer may grow to without triggering reallocation. 63796 63797 63798 std::size_t capacity() const; 63799 63800 63801 63802[heading Return Value] 63803 63804[*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()`. 63805 63806 63807 63808 63809[endsect] 63810 63811 63812 63813[section:commit dynamic_vector_buffer::commit] 63814 63815[indexterm2 boost_asio.indexterm.dynamic_vector_buffer.commit..commit..dynamic_vector_buffer] 63816[*DynamicBuffer\_v1:] Move bytes from the output sequence to the input sequence. 63817 63818 63819 void commit( 63820 std::size_t n); 63821 63822 63823 63824[heading Parameters] 63825 63826 63827[variablelist 63828 63829[[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.]] 63830 63831] 63832 63833Requires a preceding call `prepare(x)` where `x >= n`, and no intervening operations that modify the input or output sequence. 63834 63835 63836[heading Remarks] 63837 63838If `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. 63839 63840 63841 63842 63843[endsect] 63844 63845 63846 63847[section:const_buffers_type dynamic_vector_buffer::const_buffers_type] 63848 63849[indexterm2 boost_asio.indexterm.dynamic_vector_buffer.const_buffers_type..const_buffers_type..dynamic_vector_buffer] 63850The type used to represent a sequence of constant buffers that refers to the underlying memory. 63851 63852 63853 typedef const_buffer const_buffers_type; 63854 63855 63856[heading Member Functions] 63857[table 63858 [[Name][Description]] 63859 63860 [ 63861 [[link boost_asio.reference.const_buffer.const_buffer [*const_buffer]] [constructor]] 63862 [Construct an empty buffer. 63863 [hr] 63864 Construct a buffer to represent a given memory range. 63865 [hr] 63866 Construct a non-modifiable buffer from a modifiable one. ] 63867 ] 63868 63869 [ 63870 [[link boost_asio.reference.const_buffer.data [*data]]] 63871 [Get a pointer to the beginning of the memory range. ] 63872 ] 63873 63874 [ 63875 [[link boost_asio.reference.const_buffer.operator_plus__eq_ [*operator+=]]] 63876 [Move the start of the buffer by the specified number of bytes. ] 63877 ] 63878 63879 [ 63880 [[link boost_asio.reference.const_buffer.size [*size]]] 63881 [Get the size of the memory range. ] 63882 ] 63883 63884] 63885 63886[heading Related Functions] 63887[table 63888 [[Name][Description]] 63889 63890 [ 63891 [[link boost_asio.reference.const_buffer.operator_plus_ [*operator+]]] 63892 [Create a new non-modifiable buffer that is offset from the start of another. ] 63893 ] 63894 63895] 63896 63897The [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. 63898 63899 63900[heading Accessing Buffer Contents] 63901 63902 63903 63904The contents of a buffer may be accessed using the `data()` and `size()` member functions: 63905 63906 63907 63908 boost::asio::const_buffer b1 = ...; 63909 std::size_t s1 = b1.size(); 63910 const unsigned char* p1 = static_cast<const unsigned char*>(b1.data()); 63911 63912 63913 63914 63915The `data()` member function permits violations of type safety, so uses of it in application code should be carefully considered. 63916 63917 63918[heading Requirements] 63919 63920['Header: ][^boost/asio/buffer.hpp] 63921 63922['Convenience header: ][^boost/asio.hpp] 63923 63924 63925[endsect] 63926 63927 63928 63929[section:consume dynamic_vector_buffer::consume] 63930 63931[indexterm2 boost_asio.indexterm.dynamic_vector_buffer.consume..consume..dynamic_vector_buffer] 63932[*DynamicBuffer\_v1:] Remove characters from the input sequence. [*DynamicBuffer\_v2:] Consume the specified number of bytes from the beginning of the underlying memory. 63933 63934 63935 void consume( 63936 std::size_t n); 63937 63938 63939[*DynamicBuffer\_v1:] Removes `n` characters from the beginning of the input sequence. 63940[heading Remarks] 63941 63942If `n` is greater than the size of the input sequence, the entire input sequence is consumed and no error is issued. 63943 63944[*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. 63945 63946 63947[endsect] 63948 63949 63950[section:data dynamic_vector_buffer::data] 63951 63952[indexterm2 boost_asio.indexterm.dynamic_vector_buffer.data..data..dynamic_vector_buffer] 63953[*DynamicBuffer\_v1:] Get a list of buffers that represents the input sequence. 63954 63955 63956 const_buffers_type ``[link boost_asio.reference.dynamic_vector_buffer.data.overload1 data]``() const; 63957 `` [''''»''' [link boost_asio.reference.dynamic_vector_buffer.data.overload1 more...]]`` 63958 63959 63960[*DynamicBuffer\_v2:] Get a sequence of buffers that represents the underlying memory. 63961 63962 63963 mutable_buffers_type ``[link boost_asio.reference.dynamic_vector_buffer.data.overload2 data]``( 63964 std::size_t pos, 63965 std::size_t n); 63966 `` [''''»''' [link boost_asio.reference.dynamic_vector_buffer.data.overload2 more...]]`` 63967 63968 const_buffers_type ``[link boost_asio.reference.dynamic_vector_buffer.data.overload3 data]``( 63969 std::size_t pos, 63970 std::size_t n) const; 63971 `` [''''»''' [link boost_asio.reference.dynamic_vector_buffer.data.overload3 more...]]`` 63972 63973 63974[section:overload1 dynamic_vector_buffer::data (1 of 3 overloads)] 63975 63976 63977[*DynamicBuffer\_v1:] Get a list of buffers that represents the input sequence. 63978 63979 63980 const_buffers_type data() const; 63981 63982 63983 63984[heading Return Value] 63985 63986An object of type `const_buffers_type` that satisfies ConstBufferSequence requirements, representing the vector memory in the input sequence. 63987 63988 63989[heading Remarks] 63990 63991The returned object is invalidated by any `dynamic_vector_buffer` or `vector` member function that modifies the input sequence or output sequence. 63992 63993 63994 63995 63996[endsect] 63997 63998 63999 64000[section:overload2 dynamic_vector_buffer::data (2 of 3 overloads)] 64001 64002 64003[*DynamicBuffer\_v2:] Get a sequence of buffers that represents the underlying memory. 64004 64005 64006 mutable_buffers_type data( 64007 std::size_t pos, 64008 std::size_t n); 64009 64010 64011 64012[heading Parameters] 64013 64014 64015[variablelist 64016 64017[[pos][Position of the first byte to represent in the buffer sequence]] 64018 64019[[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.]] 64020 64021] 64022 64023 64024[heading Return Value] 64025 64026An object of type `mutable_buffers_type` that satisfies MutableBufferSequence requirements, representing the vector memory. 64027 64028 64029[heading Remarks] 64030 64031The returned object is invalidated by any `dynamic_vector_buffer` or `vector` member function that resizes or erases the vector. 64032 64033 64034 64035 64036[endsect] 64037 64038 64039 64040[section:overload3 dynamic_vector_buffer::data (3 of 3 overloads)] 64041 64042 64043[*DynamicBuffer\_v2:] Get a sequence of buffers that represents the underlying memory. 64044 64045 64046 const_buffers_type data( 64047 std::size_t pos, 64048 std::size_t n) const; 64049 64050 64051 64052[heading Parameters] 64053 64054 64055[variablelist 64056 64057[[pos][Position of the first byte to represent in the buffer sequence]] 64058 64059[[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.]] 64060 64061] 64062 64063 64064[heading Remarks] 64065 64066The returned object is invalidated by any `dynamic_vector_buffer` or `vector` member function that resizes or erases the vector. 64067 64068 64069 64070 64071[endsect] 64072 64073 64074[endsect] 64075 64076[section:dynamic_vector_buffer dynamic_vector_buffer::dynamic_vector_buffer] 64077 64078[indexterm2 boost_asio.indexterm.dynamic_vector_buffer.dynamic_vector_buffer..dynamic_vector_buffer..dynamic_vector_buffer] 64079Construct a dynamic buffer from a vector. 64080 64081 64082 explicit ``[link boost_asio.reference.dynamic_vector_buffer.dynamic_vector_buffer.overload1 dynamic_vector_buffer]``( 64083 std::vector< Elem, Allocator > & v, 64084 std::size_t maximum_size = (std::numeric_limits< std::size_t >::max)()); 64085 `` [''''»''' [link boost_asio.reference.dynamic_vector_buffer.dynamic_vector_buffer.overload1 more...]]`` 64086 64087 64088[*DynamicBuffer\_v2:] Copy construct a dynamic buffer. 64089 64090 64091 ``[link boost_asio.reference.dynamic_vector_buffer.dynamic_vector_buffer.overload2 dynamic_vector_buffer]``( 64092 const dynamic_vector_buffer & other); 64093 `` [''''»''' [link boost_asio.reference.dynamic_vector_buffer.dynamic_vector_buffer.overload2 more...]]`` 64094 64095 64096Move construct a dynamic buffer. 64097 64098 64099 ``[link boost_asio.reference.dynamic_vector_buffer.dynamic_vector_buffer.overload3 dynamic_vector_buffer]``( 64100 dynamic_vector_buffer && other); 64101 `` [''''»''' [link boost_asio.reference.dynamic_vector_buffer.dynamic_vector_buffer.overload3 more...]]`` 64102 64103 64104[section:overload1 dynamic_vector_buffer::dynamic_vector_buffer (1 of 3 overloads)] 64105 64106 64107Construct a dynamic buffer from a vector. 64108 64109 64110 dynamic_vector_buffer( 64111 std::vector< Elem, Allocator > & v, 64112 std::size_t maximum_size = (std::numeric_limits< std::size_t >::max)()); 64113 64114 64115 64116[heading Parameters] 64117 64118 64119[variablelist 64120 64121[[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.]] 64122 64123[[maximum_size][Specifies a maximum size for the buffer, in bytes. ]] 64124 64125] 64126 64127 64128 64129 64130[endsect] 64131 64132 64133 64134[section:overload2 dynamic_vector_buffer::dynamic_vector_buffer (2 of 3 overloads)] 64135 64136 64137[*DynamicBuffer\_v2:] Copy construct a dynamic buffer. 64138 64139 64140 dynamic_vector_buffer( 64141 const dynamic_vector_buffer & other); 64142 64143 64144 64145[endsect] 64146 64147 64148 64149[section:overload3 dynamic_vector_buffer::dynamic_vector_buffer (3 of 3 overloads)] 64150 64151 64152Move construct a dynamic buffer. 64153 64154 64155 dynamic_vector_buffer( 64156 dynamic_vector_buffer && other); 64157 64158 64159 64160[endsect] 64161 64162 64163[endsect] 64164 64165 64166[section:grow dynamic_vector_buffer::grow] 64167 64168[indexterm2 boost_asio.indexterm.dynamic_vector_buffer.grow..grow..dynamic_vector_buffer] 64169[*DynamicBuffer\_v2:] Grow the underlying memory by the specified number of bytes. 64170 64171 64172 void grow( 64173 std::size_t n); 64174 64175 64176Resizes the vector to accommodate an additional `n` bytes at the end. 64177 64178 64179[heading Exceptions] 64180 64181 64182[variablelist 64183 64184[[std::length_error][If `size() + n > max_size()`. ]] 64185 64186] 64187 64188 64189 64190 64191[endsect] 64192 64193 64194 64195[section:max_size dynamic_vector_buffer::max_size] 64196 64197[indexterm2 boost_asio.indexterm.dynamic_vector_buffer.max_size..max_size..dynamic_vector_buffer] 64198Get the maximum size of the dynamic buffer. 64199 64200 64201 std::size_t max_size() const; 64202 64203 64204 64205[heading Return Value] 64206 64207[*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. 64208 64209 64210 64211 64212[endsect] 64213 64214 64215 64216[section:mutable_buffers_type dynamic_vector_buffer::mutable_buffers_type] 64217 64218[indexterm2 boost_asio.indexterm.dynamic_vector_buffer.mutable_buffers_type..mutable_buffers_type..dynamic_vector_buffer] 64219The type used to represent a sequence of mutable buffers that refers to the underlying memory. 64220 64221 64222 typedef mutable_buffer mutable_buffers_type; 64223 64224 64225[heading Member Functions] 64226[table 64227 [[Name][Description]] 64228 64229 [ 64230 [[link boost_asio.reference.mutable_buffer.data [*data]]] 64231 [Get a pointer to the beginning of the memory range. ] 64232 ] 64233 64234 [ 64235 [[link boost_asio.reference.mutable_buffer.mutable_buffer [*mutable_buffer]] [constructor]] 64236 [Construct an empty buffer. 64237 [hr] 64238 Construct a buffer to represent a given memory range. ] 64239 ] 64240 64241 [ 64242 [[link boost_asio.reference.mutable_buffer.operator_plus__eq_ [*operator+=]]] 64243 [Move the start of the buffer by the specified number of bytes. ] 64244 ] 64245 64246 [ 64247 [[link boost_asio.reference.mutable_buffer.size [*size]]] 64248 [Get the size of the memory range. ] 64249 ] 64250 64251] 64252 64253[heading Related Functions] 64254[table 64255 [[Name][Description]] 64256 64257 [ 64258 [[link boost_asio.reference.mutable_buffer.operator_plus_ [*operator+]]] 64259 [Create a new modifiable buffer that is offset from the start of another. ] 64260 ] 64261 64262] 64263 64264The [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. 64265 64266 64267[heading Accessing Buffer Contents] 64268 64269 64270 64271The contents of a buffer may be accessed using the `data()` and `size()` member functions: 64272 64273 64274 64275 boost::asio::mutable_buffer b1 = ...; 64276 std::size_t s1 = b1.size(); 64277 unsigned char* p1 = static_cast<unsigned char*>(b1.data()); 64278 64279 64280 64281 64282The `data()` member function permits violations of type safety, so uses of it in application code should be carefully considered. 64283 64284 64285[heading Requirements] 64286 64287['Header: ][^boost/asio/buffer.hpp] 64288 64289['Convenience header: ][^boost/asio.hpp] 64290 64291 64292[endsect] 64293 64294 64295 64296[section:prepare dynamic_vector_buffer::prepare] 64297 64298[indexterm2 boost_asio.indexterm.dynamic_vector_buffer.prepare..prepare..dynamic_vector_buffer] 64299[*DynamicBuffer\_v1:] Get a list of buffers that represents the output sequence, with the given size. 64300 64301 64302 mutable_buffers_type prepare( 64303 std::size_t n); 64304 64305 64306Ensures that the output sequence can accommodate `n` bytes, resizing the vector object as necessary. 64307 64308 64309[heading Return Value] 64310 64311An object of type `mutable_buffers_type` that satisfies MutableBufferSequence requirements, representing vector memory at the start of the output sequence of size `n`. 64312 64313 64314[heading Exceptions] 64315 64316 64317[variablelist 64318 64319[[std::length_error][If `size() + n > max_size()`.]] 64320 64321] 64322 64323 64324[heading Remarks] 64325 64326The returned object is invalidated by any `dynamic_vector_buffer` or `vector` member function that modifies the input sequence or output sequence. 64327 64328 64329 64330 64331[endsect] 64332 64333 64334 64335[section:shrink dynamic_vector_buffer::shrink] 64336 64337[indexterm2 boost_asio.indexterm.dynamic_vector_buffer.shrink..shrink..dynamic_vector_buffer] 64338[*DynamicBuffer\_v2:] Shrink the underlying memory by the specified number of bytes. 64339 64340 64341 void shrink( 64342 std::size_t n); 64343 64344 64345Erases `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. 64346 64347 64348[endsect] 64349 64350 64351 64352[section:size dynamic_vector_buffer::size] 64353 64354[indexterm2 boost_asio.indexterm.dynamic_vector_buffer.size..size..dynamic_vector_buffer] 64355[*DynamicBuffer\_v1:] Get the size of the input sequence. [*DynamicBuffer\_v2:] Get the current size of the underlying memory. 64356 64357 64358 std::size_t size() const; 64359 64360 64361 64362[heading Return Value] 64363 64364[*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()`. 64365 64366 64367 64368 64369[endsect] 64370 64371 64372 64373[endsect] 64374 64375 64376[section:error__addrinfo_category error::addrinfo_category] 64377 64378[indexterm1 boost_asio.indexterm.error__addrinfo_category..error::addrinfo_category] 64379 64380 static const boost::system::error_category & addrinfo_category = boost::asio::error::get_addrinfo_category(); 64381 64382 64383[heading Requirements] 64384 64385['Header: ][^boost/asio/error.hpp] 64386 64387['Convenience header: ][^boost/asio.hpp] 64388 64389 64390[endsect] 64391 64392 64393 64394[section:error__addrinfo_errors error::addrinfo_errors] 64395 64396[indexterm1 boost_asio.indexterm.error__addrinfo_errors..error::addrinfo_errors] 64397 64398 enum addrinfo_errors 64399 64400[indexterm2 boost_asio.indexterm.error__addrinfo_errors.service_not_found..service_not_found..error::addrinfo_errors] 64401[indexterm2 boost_asio.indexterm.error__addrinfo_errors.socket_type_not_supported..socket_type_not_supported..error::addrinfo_errors] 64402 64403[heading Values] 64404[variablelist 64405 64406 [ 64407 [service_not_found] 64408 [The service is not supported for the given socket type. ] 64409 ] 64410 64411 [ 64412 [socket_type_not_supported] 64413 [The socket type is not supported. ] 64414 ] 64415 64416] 64417 64418 64419[heading Requirements] 64420 64421['Header: ][^boost/asio/error.hpp] 64422 64423['Convenience header: ][^boost/asio.hpp] 64424 64425 64426[endsect] 64427 64428 64429 64430[section:error__basic_errors error::basic_errors] 64431 64432[indexterm1 boost_asio.indexterm.error__basic_errors..error::basic_errors] 64433 64434 enum basic_errors 64435 64436[indexterm2 boost_asio.indexterm.error__basic_errors.access_denied..access_denied..error::basic_errors] 64437[indexterm2 boost_asio.indexterm.error__basic_errors.address_family_not_supported..address_family_not_supported..error::basic_errors] 64438[indexterm2 boost_asio.indexterm.error__basic_errors.address_in_use..address_in_use..error::basic_errors] 64439[indexterm2 boost_asio.indexterm.error__basic_errors.already_connected..already_connected..error::basic_errors] 64440[indexterm2 boost_asio.indexterm.error__basic_errors.already_started..already_started..error::basic_errors] 64441[indexterm2 boost_asio.indexterm.error__basic_errors.broken_pipe..broken_pipe..error::basic_errors] 64442[indexterm2 boost_asio.indexterm.error__basic_errors.connection_aborted..connection_aborted..error::basic_errors] 64443[indexterm2 boost_asio.indexterm.error__basic_errors.connection_refused..connection_refused..error::basic_errors] 64444[indexterm2 boost_asio.indexterm.error__basic_errors.connection_reset..connection_reset..error::basic_errors] 64445[indexterm2 boost_asio.indexterm.error__basic_errors.bad_descriptor..bad_descriptor..error::basic_errors] 64446[indexterm2 boost_asio.indexterm.error__basic_errors.fault..fault..error::basic_errors] 64447[indexterm2 boost_asio.indexterm.error__basic_errors.host_unreachable..host_unreachable..error::basic_errors] 64448[indexterm2 boost_asio.indexterm.error__basic_errors.in_progress..in_progress..error::basic_errors] 64449[indexterm2 boost_asio.indexterm.error__basic_errors.interrupted..interrupted..error::basic_errors] 64450[indexterm2 boost_asio.indexterm.error__basic_errors.invalid_argument..invalid_argument..error::basic_errors] 64451[indexterm2 boost_asio.indexterm.error__basic_errors.message_size..message_size..error::basic_errors] 64452[indexterm2 boost_asio.indexterm.error__basic_errors.name_too_long..name_too_long..error::basic_errors] 64453[indexterm2 boost_asio.indexterm.error__basic_errors.network_down..network_down..error::basic_errors] 64454[indexterm2 boost_asio.indexterm.error__basic_errors.network_reset..network_reset..error::basic_errors] 64455[indexterm2 boost_asio.indexterm.error__basic_errors.network_unreachable..network_unreachable..error::basic_errors] 64456[indexterm2 boost_asio.indexterm.error__basic_errors.no_descriptors..no_descriptors..error::basic_errors] 64457[indexterm2 boost_asio.indexterm.error__basic_errors.no_buffer_space..no_buffer_space..error::basic_errors] 64458[indexterm2 boost_asio.indexterm.error__basic_errors.no_memory..no_memory..error::basic_errors] 64459[indexterm2 boost_asio.indexterm.error__basic_errors.no_permission..no_permission..error::basic_errors] 64460[indexterm2 boost_asio.indexterm.error__basic_errors.no_protocol_option..no_protocol_option..error::basic_errors] 64461[indexterm2 boost_asio.indexterm.error__basic_errors.no_such_device..no_such_device..error::basic_errors] 64462[indexterm2 boost_asio.indexterm.error__basic_errors.not_connected..not_connected..error::basic_errors] 64463[indexterm2 boost_asio.indexterm.error__basic_errors.not_socket..not_socket..error::basic_errors] 64464[indexterm2 boost_asio.indexterm.error__basic_errors.operation_aborted..operation_aborted..error::basic_errors] 64465[indexterm2 boost_asio.indexterm.error__basic_errors.operation_not_supported..operation_not_supported..error::basic_errors] 64466[indexterm2 boost_asio.indexterm.error__basic_errors.shut_down..shut_down..error::basic_errors] 64467[indexterm2 boost_asio.indexterm.error__basic_errors.timed_out..timed_out..error::basic_errors] 64468[indexterm2 boost_asio.indexterm.error__basic_errors.try_again..try_again..error::basic_errors] 64469[indexterm2 boost_asio.indexterm.error__basic_errors.would_block..would_block..error::basic_errors] 64470 64471[heading Values] 64472[variablelist 64473 64474 [ 64475 [access_denied] 64476 [Permission denied. ] 64477 ] 64478 64479 [ 64480 [address_family_not_supported] 64481 [Address family not supported by protocol. ] 64482 ] 64483 64484 [ 64485 [address_in_use] 64486 [Address already in use. ] 64487 ] 64488 64489 [ 64490 [already_connected] 64491 [Transport endpoint is already connected. ] 64492 ] 64493 64494 [ 64495 [already_started] 64496 [Operation already in progress. ] 64497 ] 64498 64499 [ 64500 [broken_pipe] 64501 [Broken pipe. ] 64502 ] 64503 64504 [ 64505 [connection_aborted] 64506 [A connection has been aborted. ] 64507 ] 64508 64509 [ 64510 [connection_refused] 64511 [Connection refused. ] 64512 ] 64513 64514 [ 64515 [connection_reset] 64516 [Connection reset by peer. ] 64517 ] 64518 64519 [ 64520 [bad_descriptor] 64521 [Bad file descriptor. ] 64522 ] 64523 64524 [ 64525 [fault] 64526 [Bad address. ] 64527 ] 64528 64529 [ 64530 [host_unreachable] 64531 [No route to host. ] 64532 ] 64533 64534 [ 64535 [in_progress] 64536 [Operation now in progress. ] 64537 ] 64538 64539 [ 64540 [interrupted] 64541 [Interrupted system call. ] 64542 ] 64543 64544 [ 64545 [invalid_argument] 64546 [Invalid argument. ] 64547 ] 64548 64549 [ 64550 [message_size] 64551 [Message too long. ] 64552 ] 64553 64554 [ 64555 [name_too_long] 64556 [The name was too long. ] 64557 ] 64558 64559 [ 64560 [network_down] 64561 [Network is down. ] 64562 ] 64563 64564 [ 64565 [network_reset] 64566 [Network dropped connection on reset. ] 64567 ] 64568 64569 [ 64570 [network_unreachable] 64571 [Network is unreachable. ] 64572 ] 64573 64574 [ 64575 [no_descriptors] 64576 [Too many open files. ] 64577 ] 64578 64579 [ 64580 [no_buffer_space] 64581 [No buffer space available. ] 64582 ] 64583 64584 [ 64585 [no_memory] 64586 [Cannot allocate memory. ] 64587 ] 64588 64589 [ 64590 [no_permission] 64591 [Operation not permitted. ] 64592 ] 64593 64594 [ 64595 [no_protocol_option] 64596 [Protocol not available. ] 64597 ] 64598 64599 [ 64600 [no_such_device] 64601 [No such device. ] 64602 ] 64603 64604 [ 64605 [not_connected] 64606 [Transport endpoint is not connected. ] 64607 ] 64608 64609 [ 64610 [not_socket] 64611 [Socket operation on non-socket. ] 64612 ] 64613 64614 [ 64615 [operation_aborted] 64616 [Operation cancelled. ] 64617 ] 64618 64619 [ 64620 [operation_not_supported] 64621 [Operation not supported. ] 64622 ] 64623 64624 [ 64625 [shut_down] 64626 [Cannot send after transport endpoint shutdown. ] 64627 ] 64628 64629 [ 64630 [timed_out] 64631 [Connection timed out. ] 64632 ] 64633 64634 [ 64635 [try_again] 64636 [Resource temporarily unavailable. ] 64637 ] 64638 64639 [ 64640 [would_block] 64641 [The socket is marked non-blocking and the requested operation would block. ] 64642 ] 64643 64644] 64645 64646 64647[heading Requirements] 64648 64649['Header: ][^boost/asio/error.hpp] 64650 64651['Convenience header: ][^boost/asio.hpp] 64652 64653 64654[endsect] 64655 64656 64657 64658[section:error__get_addrinfo_category error::get_addrinfo_category] 64659 64660[indexterm1 boost_asio.indexterm.error__get_addrinfo_category..error::get_addrinfo_category] 64661 64662 const boost::system::error_category & get_addrinfo_category(); 64663 64664 64665[heading Requirements] 64666 64667['Header: ][^boost/asio/error.hpp] 64668 64669['Convenience header: ][^boost/asio.hpp] 64670 64671 64672[endsect] 64673 64674 64675 64676[section:error__get_misc_category error::get_misc_category] 64677 64678[indexterm1 boost_asio.indexterm.error__get_misc_category..error::get_misc_category] 64679 64680 const boost::system::error_category & get_misc_category(); 64681 64682 64683[heading Requirements] 64684 64685['Header: ][^boost/asio/error.hpp] 64686 64687['Convenience header: ][^boost/asio.hpp] 64688 64689 64690[endsect] 64691 64692 64693 64694[section:error__get_netdb_category error::get_netdb_category] 64695 64696[indexterm1 boost_asio.indexterm.error__get_netdb_category..error::get_netdb_category] 64697 64698 const boost::system::error_category & get_netdb_category(); 64699 64700 64701[heading Requirements] 64702 64703['Header: ][^boost/asio/error.hpp] 64704 64705['Convenience header: ][^boost/asio.hpp] 64706 64707 64708[endsect] 64709 64710 64711 64712[section:error__get_ssl_category error::get_ssl_category] 64713 64714[indexterm1 boost_asio.indexterm.error__get_ssl_category..error::get_ssl_category] 64715 64716 const boost::system::error_category & get_ssl_category(); 64717 64718 64719[heading Requirements] 64720 64721['Header: ][^boost/asio/ssl/error.hpp] 64722 64723['Convenience header: ][^boost/asio/ssl.hpp] 64724 64725 64726[endsect] 64727 64728 64729 64730[section:error__get_system_category error::get_system_category] 64731 64732[indexterm1 boost_asio.indexterm.error__get_system_category..error::get_system_category] 64733 64734 const boost::system::error_category & get_system_category(); 64735 64736 64737[heading Requirements] 64738 64739['Header: ][^boost/asio/error.hpp] 64740 64741['Convenience header: ][^boost/asio.hpp] 64742 64743 64744[endsect] 64745 64746 64747[section:error__make_error_code error::make_error_code] 64748 64749[indexterm1 boost_asio.indexterm.error__make_error_code..error::make_error_code] 64750 boost::system::error_code ``[link boost_asio.reference.error__make_error_code.overload1 make_error_code]``( 64751 basic_errors e); 64752 `` [''''»''' [link boost_asio.reference.error__make_error_code.overload1 more...]]`` 64753 64754 boost::system::error_code ``[link boost_asio.reference.error__make_error_code.overload2 make_error_code]``( 64755 netdb_errors e); 64756 `` [''''»''' [link boost_asio.reference.error__make_error_code.overload2 more...]]`` 64757 64758 boost::system::error_code ``[link boost_asio.reference.error__make_error_code.overload3 make_error_code]``( 64759 addrinfo_errors e); 64760 `` [''''»''' [link boost_asio.reference.error__make_error_code.overload3 more...]]`` 64761 64762 boost::system::error_code ``[link boost_asio.reference.error__make_error_code.overload4 make_error_code]``( 64763 misc_errors e); 64764 `` [''''»''' [link boost_asio.reference.error__make_error_code.overload4 more...]]`` 64765 64766 boost::system::error_code ``[link boost_asio.reference.error__make_error_code.overload5 make_error_code]``( 64767 ssl_errors e); 64768 `` [''''»''' [link boost_asio.reference.error__make_error_code.overload5 more...]]`` 64769 64770[heading Requirements] 64771 64772['Header: ][^boost/asio/error.hpp] 64773 64774['Convenience header: ][^boost/asio.hpp] 64775 64776 64777[section:overload1 error::make_error_code (1 of 5 overloads)] 64778 64779 64780 64781 boost::system::error_code make_error_code( 64782 basic_errors e); 64783 64784 64785 64786[endsect] 64787 64788 64789 64790[section:overload2 error::make_error_code (2 of 5 overloads)] 64791 64792 64793 64794 boost::system::error_code make_error_code( 64795 netdb_errors e); 64796 64797 64798 64799[endsect] 64800 64801 64802 64803[section:overload3 error::make_error_code (3 of 5 overloads)] 64804 64805 64806 64807 boost::system::error_code make_error_code( 64808 addrinfo_errors e); 64809 64810 64811 64812[endsect] 64813 64814 64815 64816[section:overload4 error::make_error_code (4 of 5 overloads)] 64817 64818 64819 64820 boost::system::error_code make_error_code( 64821 misc_errors e); 64822 64823 64824 64825[endsect] 64826 64827 64828 64829[section:overload5 error::make_error_code (5 of 5 overloads)] 64830 64831 64832 64833 boost::system::error_code make_error_code( 64834 ssl_errors e); 64835 64836 64837 64838[endsect] 64839 64840 64841[endsect] 64842 64843 64844[section:error__misc_category error::misc_category] 64845 64846[indexterm1 boost_asio.indexterm.error__misc_category..error::misc_category] 64847 64848 static const boost::system::error_category & misc_category = boost::asio::error::get_misc_category(); 64849 64850 64851[heading Requirements] 64852 64853['Header: ][^boost/asio/error.hpp] 64854 64855['Convenience header: ][^boost/asio.hpp] 64856 64857 64858[endsect] 64859 64860 64861 64862[section:error__misc_errors error::misc_errors] 64863 64864[indexterm1 boost_asio.indexterm.error__misc_errors..error::misc_errors] 64865 64866 enum misc_errors 64867 64868[indexterm2 boost_asio.indexterm.error__misc_errors.already_open..already_open..error::misc_errors] 64869[indexterm2 boost_asio.indexterm.error__misc_errors.eof..eof..error::misc_errors] 64870[indexterm2 boost_asio.indexterm.error__misc_errors.not_found..not_found..error::misc_errors] 64871[indexterm2 boost_asio.indexterm.error__misc_errors.fd_set_failure..fd_set_failure..error::misc_errors] 64872 64873[heading Values] 64874[variablelist 64875 64876 [ 64877 [already_open] 64878 [Already open. ] 64879 ] 64880 64881 [ 64882 [eof] 64883 [End of file or stream. ] 64884 ] 64885 64886 [ 64887 [not_found] 64888 [Element not found. ] 64889 ] 64890 64891 [ 64892 [fd_set_failure] 64893 [The descriptor cannot fit into the select system call's fd_set. ] 64894 ] 64895 64896] 64897 64898 64899[heading Requirements] 64900 64901['Header: ][^boost/asio/error.hpp] 64902 64903['Convenience header: ][^boost/asio.hpp] 64904 64905 64906[endsect] 64907 64908 64909 64910[section:error__netdb_category error::netdb_category] 64911 64912[indexterm1 boost_asio.indexterm.error__netdb_category..error::netdb_category] 64913 64914 static const boost::system::error_category & netdb_category = boost::asio::error::get_netdb_category(); 64915 64916 64917[heading Requirements] 64918 64919['Header: ][^boost/asio/error.hpp] 64920 64921['Convenience header: ][^boost/asio.hpp] 64922 64923 64924[endsect] 64925 64926 64927 64928[section:error__netdb_errors error::netdb_errors] 64929 64930[indexterm1 boost_asio.indexterm.error__netdb_errors..error::netdb_errors] 64931 64932 enum netdb_errors 64933 64934[indexterm2 boost_asio.indexterm.error__netdb_errors.host_not_found..host_not_found..error::netdb_errors] 64935[indexterm2 boost_asio.indexterm.error__netdb_errors.host_not_found_try_again..host_not_found_try_again..error::netdb_errors] 64936[indexterm2 boost_asio.indexterm.error__netdb_errors.no_data..no_data..error::netdb_errors] 64937[indexterm2 boost_asio.indexterm.error__netdb_errors.no_recovery..no_recovery..error::netdb_errors] 64938 64939[heading Values] 64940[variablelist 64941 64942 [ 64943 [host_not_found] 64944 [Host not found (authoritative). ] 64945 ] 64946 64947 [ 64948 [host_not_found_try_again] 64949 [Host not found (non-authoritative). ] 64950 ] 64951 64952 [ 64953 [no_data] 64954 [The query is valid but does not have associated address data. ] 64955 ] 64956 64957 [ 64958 [no_recovery] 64959 [A non-recoverable error occurred. ] 64960 ] 64961 64962] 64963 64964 64965[heading Requirements] 64966 64967['Header: ][^boost/asio/error.hpp] 64968 64969['Convenience header: ][^boost/asio.hpp] 64970 64971 64972[endsect] 64973 64974 64975 64976[section:error__ssl_category error::ssl_category] 64977 64978[indexterm1 boost_asio.indexterm.error__ssl_category..error::ssl_category] 64979 64980 static const boost::system::error_category & ssl_category = boost::asio::error::get_ssl_category(); 64981 64982 64983[heading Requirements] 64984 64985['Header: ][^boost/asio/ssl/error.hpp] 64986 64987['Convenience header: ][^boost/asio/ssl.hpp] 64988 64989 64990[endsect] 64991 64992 64993 64994[section:error__ssl_errors error::ssl_errors] 64995 64996[indexterm1 boost_asio.indexterm.error__ssl_errors..error::ssl_errors] 64997 64998 enum ssl_errors 64999 65000 65001[heading Requirements] 65002 65003['Header: ][^boost/asio/ssl/error.hpp] 65004 65005['Convenience header: ][^boost/asio/ssl.hpp] 65006 65007 65008[endsect] 65009 65010 65011 65012[section:error__system_category error::system_category] 65013 65014[indexterm1 boost_asio.indexterm.error__system_category..error::system_category] 65015 65016 static const boost::system::error_category & system_category = boost::asio::error::get_system_category(); 65017 65018 65019[heading Requirements] 65020 65021['Header: ][^boost/asio/error.hpp] 65022 65023['Convenience header: ][^boost/asio.hpp] 65024 65025 65026[endsect] 65027 65028 65029 65030[section:execution__allocator execution::allocator] 65031 65032[indexterm1 boost_asio.indexterm.execution__allocator..execution::allocator] 65033A special value used for accessing the [link boost_asio.reference.execution__allocator_t `execution::allocator_t`] property. 65034 65035 65036 constexpr allocator_t< void > allocator; 65037 65038 65039[heading Requirements] 65040 65041['Header: ][^boost/asio/execution/allocator.hpp] 65042 65043['Convenience header: ][^boost/asio/execution.hpp] 65044 65045 65046[endsect] 65047 65048 65049[section:execution__allocator_t execution::allocator_t] 65050 65051[indexterm1 boost_asio.indexterm.execution__allocator_t..execution::allocator_t] 65052 65053 65054A property to describe which allocator an executor will use to allocate the memory required to store a submitted function object. 65055 65056 65057 template< 65058 typename ``[link boost_asio.reference.ProtoAllocator ProtoAllocator]``> 65059 struct allocator_t 65060 65061 65062[heading Member Functions] 65063[table 65064 [[Name][Description]] 65065 65066 [ 65067 [[link boost_asio.reference.execution__allocator_t.allocator_t [*allocator_t]] [constructor]] 65068 [Default constructor. ] 65069 ] 65070 65071 [ 65072 [[link boost_asio.reference.execution__allocator_t.value [*value]]] 65073 [Obtain the allocator stored in the allocator_t property object. ] 65074 ] 65075 65076] 65077 65078[heading Data Members] 65079[table 65080 [[Name][Description]] 65081 65082 [ 65083 [[link boost_asio.reference.execution__allocator_t.is_applicable_property_v [*is_applicable_property_v]] [static]] 65084 [The allocator_t property applies to executors, senders, and schedulers. ] 65085 ] 65086 65087 [ 65088 [[link boost_asio.reference.execution__allocator_t.is_preferable [*is_preferable]] [static]] 65089 [The allocator_t property can be preferred. ] 65090 ] 65091 65092 [ 65093 [[link boost_asio.reference.execution__allocator_t.is_requirable [*is_requirable]] [static]] 65094 [The allocator_t property can be required. ] 65095 ] 65096 65097] 65098 65099[heading Requirements] 65100 65101['Header: ][^boost/asio/execution/allocator.hpp] 65102 65103['Convenience header: ][^boost/asio/execution.hpp] 65104 65105 65106[section:allocator_t execution::allocator_t::allocator_t] 65107 65108[indexterm2 boost_asio.indexterm.execution__allocator_t.allocator_t..allocator_t..execution::allocator_t] 65109Default constructor. 65110 65111 65112 constexpr allocator_t(); 65113 65114 65115 65116[endsect] 65117 65118 65119 65120[section:is_applicable_property_v execution::allocator_t::is_applicable_property_v] 65121 65122[indexterm2 boost_asio.indexterm.execution__allocator_t.is_applicable_property_v..is_applicable_property_v..execution::allocator_t] 65123The [link boost_asio.reference.execution__allocator_t `execution::allocator_t`] property applies to executors, senders, and schedulers. 65124 65125 65126 template <typename T> 65127 static constexpr bool is_applicable_property_v = 65128 is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>; 65129 65130 65131 65132[endsect] 65133 65134 65135 65136[section:is_preferable execution::allocator_t::is_preferable] 65137 65138[indexterm2 boost_asio.indexterm.execution__allocator_t.is_preferable..is_preferable..execution::allocator_t] 65139The [link boost_asio.reference.execution__allocator_t `execution::allocator_t`] property can be preferred. 65140 65141 65142 static constexpr bool is_preferable = true; 65143 65144 65145 65146[endsect] 65147 65148 65149 65150[section:is_requirable execution::allocator_t::is_requirable] 65151 65152[indexterm2 boost_asio.indexterm.execution__allocator_t.is_requirable..is_requirable..execution::allocator_t] 65153The [link boost_asio.reference.execution__allocator_t `execution::allocator_t`] property can be required. 65154 65155 65156 static constexpr bool is_requirable = true; 65157 65158 65159 65160[endsect] 65161 65162 65163 65164[section:value execution::allocator_t::value] 65165 65166[indexterm2 boost_asio.indexterm.execution__allocator_t.value..value..execution::allocator_t] 65167Obtain the allocator stored in the [link boost_asio.reference.execution__allocator_t `execution::allocator_t`] property object. 65168 65169 65170 constexpr ProtoAllocator value() const; 65171 65172 65173Present only if `ProtoAllocator` is non-void. 65174 65175 65176[endsect] 65177 65178 65179 65180[endsect] 65181 65182[section:execution__any_executor execution::any_executor] 65183 65184[indexterm1 boost_asio.indexterm.execution__any_executor..execution::any_executor] 65185 65186 65187Polymorphic executor wrapper. 65188 65189 65190 template< 65191 typename... SupportableProperties> 65192 class any_executor 65193 65194 65195[heading Member Functions] 65196[table 65197 [[Name][Description]] 65198 65199 [ 65200 [[link boost_asio.reference.execution__any_executor.any_executor [*any_executor]] [constructor]] 65201 [Default constructor. 65202 [hr] 65203 Construct in an empty state. Equivalent effects to default constructor. 65204 [hr] 65205 Copy constructor. 65206 [hr] 65207 Move constructor. 65208 [hr] 65209 Construct to point to the same target as another any_executor. 65210 [hr] 65211 Construct a polymorphic wrapper for the specified executor. ] 65212 ] 65213 65214 [ 65215 [[link boost_asio.reference.execution__any_executor.context [*context]]] 65216 [Obtain the underlying execution context. ] 65217 ] 65218 65219 [ 65220 [[link boost_asio.reference.execution__any_executor.execute [*execute]]] 65221 [Execute the function on the target executor. ] 65222 ] 65223 65224 [ 65225 [[link boost_asio.reference.execution__any_executor.operator_bool [*operator bool]]] 65226 [Determine whether the wrapper has a target executor. ] 65227 ] 65228 65229 [ 65230 [[link boost_asio.reference.execution__any_executor.operator_eq_ [*operator=]]] 65231 [Assignment operator. 65232 [hr] 65233 Move assignment operator. 65234 [hr] 65235 Assignment operator that sets the polymorphic wrapper to the empty state. 65236 [hr] 65237 Assignment operator to create a polymorphic wrapper for the specified executor. ] 65238 ] 65239 65240 [ 65241 [[link boost_asio.reference.execution__any_executor.prefer [*prefer]]] 65242 [Obtain a polymorphic wrapper with the specified property. ] 65243 ] 65244 65245 [ 65246 [[link boost_asio.reference.execution__any_executor.query [*query]]] 65247 [Obtain the value associated with the specified property. ] 65248 ] 65249 65250 [ 65251 [[link boost_asio.reference.execution__any_executor.require [*require]]] 65252 [Obtain a polymorphic wrapper with the specified property. ] 65253 ] 65254 65255 [ 65256 [[link boost_asio.reference.execution__any_executor.swap [*swap]]] 65257 [Swap targets with another polymorphic wrapper. ] 65258 ] 65259 65260 [ 65261 [[link boost_asio.reference.execution__any_executor.target [*target]]] 65262 [Get a pointer to the target executor. ] 65263 ] 65264 65265 [ 65266 [[link boost_asio.reference.execution__any_executor.target_type [*target_type]]] 65267 [Get the type of the target executor. ] 65268 ] 65269 65270 [ 65271 [[link boost_asio.reference.execution__any_executor._any_executor [*~any_executor]] [destructor]] 65272 [Destructor. ] 65273 ] 65274 65275] 65276 65277[heading Related Functions] 65278[table 65279 [[Name][Description]] 65280 65281 [ 65282 [[link boost_asio.reference.execution__any_executor.operator_not__eq_ [*operator!=]]] 65283 [Inequality operator. ] 65284 ] 65285 65286 [ 65287 [[link boost_asio.reference.execution__any_executor.operator_eq__eq_ [*operator==]]] 65288 [Equality operator. ] 65289 ] 65290 65291] 65292 65293[heading Requirements] 65294 65295['Header: ][^boost/asio/execution/any_executor.hpp] 65296 65297['Convenience header: ][^boost/asio/execution.hpp] 65298 65299[section:any_executor execution::any_executor::any_executor] 65300 65301[indexterm2 boost_asio.indexterm.execution__any_executor.any_executor..any_executor..execution::any_executor] 65302Default constructor. 65303 65304 65305 ``[link boost_asio.reference.execution__any_executor.any_executor.overload1 any_executor]``(); 65306 `` [''''»''' [link boost_asio.reference.execution__any_executor.any_executor.overload1 more...]]`` 65307 65308 65309Construct in an empty state. Equivalent effects to default constructor. 65310 65311 65312 ``[link boost_asio.reference.execution__any_executor.any_executor.overload2 any_executor]``( 65313 nullptr_t ); 65314 `` [''''»''' [link boost_asio.reference.execution__any_executor.any_executor.overload2 more...]]`` 65315 65316 65317Copy constructor. 65318 65319 65320 ``[link boost_asio.reference.execution__any_executor.any_executor.overload3 any_executor]``( 65321 const any_executor & e); 65322 `` [''''»''' [link boost_asio.reference.execution__any_executor.any_executor.overload3 more...]]`` 65323 65324 65325Move constructor. 65326 65327 65328 ``[link boost_asio.reference.execution__any_executor.any_executor.overload4 any_executor]``( 65329 any_executor && e); 65330 `` [''''»''' [link boost_asio.reference.execution__any_executor.any_executor.overload4 more...]]`` 65331 65332 65333Construct to point to the same target as another [link boost_asio.reference.execution__any_executor `execution::any_executor`]. 65334 65335 65336 template< 65337 class... OtherSupportableProperties> 65338 ``[link boost_asio.reference.execution__any_executor.any_executor.overload5 any_executor]``( 65339 any_executor< OtherSupportableProperties...> e); 65340 `` [''''»''' [link boost_asio.reference.execution__any_executor.any_executor.overload5 more...]]`` 65341 65342 65343Construct a polymorphic wrapper for the specified executor. 65344 65345 65346 template< 65347 typename ``[link boost_asio.reference.Executor1 Executor]``> 65348 ``[link boost_asio.reference.execution__any_executor.any_executor.overload6 any_executor]``( 65349 Executor e); 65350 `` [''''»''' [link boost_asio.reference.execution__any_executor.any_executor.overload6 more...]]`` 65351 65352 65353[section:overload1 execution::any_executor::any_executor (1 of 6 overloads)] 65354 65355 65356Default constructor. 65357 65358 65359 any_executor(); 65360 65361 65362 65363[endsect] 65364 65365 65366 65367[section:overload2 execution::any_executor::any_executor (2 of 6 overloads)] 65368 65369 65370Construct in an empty state. Equivalent effects to default constructor. 65371 65372 65373 any_executor( 65374 nullptr_t ); 65375 65376 65377 65378[endsect] 65379 65380 65381 65382[section:overload3 execution::any_executor::any_executor (3 of 6 overloads)] 65383 65384 65385Copy constructor. 65386 65387 65388 any_executor( 65389 const any_executor & e); 65390 65391 65392 65393[endsect] 65394 65395 65396 65397[section:overload4 execution::any_executor::any_executor (4 of 6 overloads)] 65398 65399 65400Move constructor. 65401 65402 65403 any_executor( 65404 any_executor && e); 65405 65406 65407 65408[endsect] 65409 65410 65411 65412[section:overload5 execution::any_executor::any_executor (5 of 6 overloads)] 65413 65414 65415Construct to point to the same target as another [link boost_asio.reference.execution__any_executor `execution::any_executor`]. 65416 65417 65418 template< 65419 class... OtherSupportableProperties> 65420 any_executor( 65421 any_executor< OtherSupportableProperties...> e); 65422 65423 65424 65425[endsect] 65426 65427 65428 65429[section:overload6 execution::any_executor::any_executor (6 of 6 overloads)] 65430 65431 65432Construct a polymorphic wrapper for the specified executor. 65433 65434 65435 template< 65436 typename ``[link boost_asio.reference.Executor1 Executor]``> 65437 any_executor( 65438 Executor e); 65439 65440 65441 65442[endsect] 65443 65444 65445[endsect] 65446 65447 65448[section:context execution::any_executor::context] 65449 65450[indexterm2 boost_asio.indexterm.execution__any_executor.context..context..execution::any_executor] 65451Obtain the underlying execution context. 65452 65453 65454 automatically_determined context() const; 65455 65456 65457This function is provided for backward compatibility. It is automatically defined when the `SupportableProperties`... list includes a property of type `execution::context_as<U>`, for some type `U`. 65458 65459 65460[endsect] 65461 65462 65463 65464[section:execute execution::any_executor::execute] 65465 65466[indexterm2 boost_asio.indexterm.execution__any_executor.execute..execute..execution::any_executor] 65467Execute the function on the target executor. 65468 65469 65470 template< 65471 typename Function> 65472 void execute( 65473 Function && f) const; 65474 65475 65476Do not call this function directly. It is intended for use with the [link boost_asio.reference.execution__execute `execution::execute`] customisation point. 65477 65478For example: 65479 65480 execution::any_executor<> ex = ...; 65481 execution::execute(ex, my_function_object); 65482 65483 65484 65485 65486Throws [link boost_asio.reference.bad_executor `bad_executor`] if the polymorphic wrapper has no target. 65487 65488 65489[endsect] 65490 65491 65492 65493[section:operator_bool execution::any_executor::operator bool] 65494 65495[indexterm2 boost_asio.indexterm.execution__any_executor.operator_bool..operator bool..execution::any_executor] 65496Determine whether the wrapper has a target executor. 65497 65498 65499 operator bool() const; 65500 65501 65502 65503[heading Return Value] 65504 65505`true` if the polymorphic wrapper has a target executor, otherwise false. 65506 65507 65508 65509 65510[endsect] 65511 65512 65513[section:operator_not__eq_ execution::any_executor::operator!=] 65514 65515[indexterm2 boost_asio.indexterm.execution__any_executor.operator_not__eq_..operator!=..execution::any_executor] 65516Inequality operator. 65517 65518 65519 bool ``[link boost_asio.reference.execution__any_executor.operator_not__eq_.overload1 operator!=]``( 65520 const any_executor< SupportableProperties...> & a, 65521 const any_executor< SupportableProperties...> & b); 65522 `` [''''»''' [link boost_asio.reference.execution__any_executor.operator_not__eq_.overload1 more...]]`` 65523 65524 bool ``[link boost_asio.reference.execution__any_executor.operator_not__eq_.overload2 operator!=]``( 65525 const any_executor< SupportableProperties...> & a, 65526 nullptr_t ); 65527 `` [''''»''' [link boost_asio.reference.execution__any_executor.operator_not__eq_.overload2 more...]]`` 65528 65529 bool ``[link boost_asio.reference.execution__any_executor.operator_not__eq_.overload3 operator!=]``( 65530 nullptr_t , 65531 const any_executor< SupportableProperties...> & b); 65532 `` [''''»''' [link boost_asio.reference.execution__any_executor.operator_not__eq_.overload3 more...]]`` 65533 65534 65535[section:overload1 execution::any_executor::operator!= (1 of 3 overloads)] 65536 65537 65538Inequality operator. 65539 65540 65541 bool operator!=( 65542 const any_executor< SupportableProperties...> & a, 65543 const any_executor< SupportableProperties...> & b); 65544 65545 65546 65547[endsect] 65548 65549 65550 65551[section:overload2 execution::any_executor::operator!= (2 of 3 overloads)] 65552 65553 65554Inequality operator. 65555 65556 65557 bool operator!=( 65558 const any_executor< SupportableProperties...> & a, 65559 nullptr_t ); 65560 65561 65562 65563[endsect] 65564 65565 65566 65567[section:overload3 execution::any_executor::operator!= (3 of 3 overloads)] 65568 65569 65570Inequality operator. 65571 65572 65573 bool operator!=( 65574 nullptr_t , 65575 const any_executor< SupportableProperties...> & b); 65576 65577 65578 65579[endsect] 65580 65581 65582[endsect] 65583 65584[section:operator_eq_ execution::any_executor::operator=] 65585 65586[indexterm2 boost_asio.indexterm.execution__any_executor.operator_eq_..operator=..execution::any_executor] 65587Assignment operator. 65588 65589 65590 any_executor & ``[link boost_asio.reference.execution__any_executor.operator_eq_.overload1 operator=]``( 65591 const any_executor & e); 65592 `` [''''»''' [link boost_asio.reference.execution__any_executor.operator_eq_.overload1 more...]]`` 65593 65594 65595Move assignment operator. 65596 65597 65598 any_executor & ``[link boost_asio.reference.execution__any_executor.operator_eq_.overload2 operator=]``( 65599 any_executor && e); 65600 `` [''''»''' [link boost_asio.reference.execution__any_executor.operator_eq_.overload2 more...]]`` 65601 65602 65603Assignment operator that sets the polymorphic wrapper to the empty state. 65604 65605 65606 any_executor & ``[link boost_asio.reference.execution__any_executor.operator_eq_.overload3 operator=]``( 65607 nullptr_t ); 65608 `` [''''»''' [link boost_asio.reference.execution__any_executor.operator_eq_.overload3 more...]]`` 65609 65610 65611Assignment operator to create a polymorphic wrapper for the specified executor. 65612 65613 65614 template< 65615 typename ``[link boost_asio.reference.Executor1 Executor]``> 65616 any_executor & ``[link boost_asio.reference.execution__any_executor.operator_eq_.overload4 operator=]``( 65617 Executor e); 65618 `` [''''»''' [link boost_asio.reference.execution__any_executor.operator_eq_.overload4 more...]]`` 65619 65620 65621[section:overload1 execution::any_executor::operator= (1 of 4 overloads)] 65622 65623 65624Assignment operator. 65625 65626 65627 any_executor & operator=( 65628 const any_executor & e); 65629 65630 65631 65632[endsect] 65633 65634 65635 65636[section:overload2 execution::any_executor::operator= (2 of 4 overloads)] 65637 65638 65639Move assignment operator. 65640 65641 65642 any_executor & operator=( 65643 any_executor && e); 65644 65645 65646 65647[endsect] 65648 65649 65650 65651[section:overload3 execution::any_executor::operator= (3 of 4 overloads)] 65652 65653 65654Assignment operator that sets the polymorphic wrapper to the empty state. 65655 65656 65657 any_executor & operator=( 65658 nullptr_t ); 65659 65660 65661 65662[endsect] 65663 65664 65665 65666[section:overload4 execution::any_executor::operator= (4 of 4 overloads)] 65667 65668 65669Assignment operator to create a polymorphic wrapper for the specified executor. 65670 65671 65672 template< 65673 typename ``[link boost_asio.reference.Executor1 Executor]``> 65674 any_executor & operator=( 65675 Executor e); 65676 65677 65678 65679[endsect] 65680 65681 65682[endsect] 65683 65684[section:operator_eq__eq_ execution::any_executor::operator==] 65685 65686[indexterm2 boost_asio.indexterm.execution__any_executor.operator_eq__eq_..operator==..execution::any_executor] 65687Equality operator. 65688 65689 65690 bool ``[link boost_asio.reference.execution__any_executor.operator_eq__eq_.overload1 operator==]``( 65691 const any_executor< SupportableProperties...> & a, 65692 const any_executor< SupportableProperties...> & b); 65693 `` [''''»''' [link boost_asio.reference.execution__any_executor.operator_eq__eq_.overload1 more...]]`` 65694 65695 bool ``[link boost_asio.reference.execution__any_executor.operator_eq__eq_.overload2 operator==]``( 65696 const any_executor< SupportableProperties...> & a, 65697 nullptr_t ); 65698 `` [''''»''' [link boost_asio.reference.execution__any_executor.operator_eq__eq_.overload2 more...]]`` 65699 65700 bool ``[link boost_asio.reference.execution__any_executor.operator_eq__eq_.overload3 operator==]``( 65701 nullptr_t , 65702 const any_executor< SupportableProperties...> & b); 65703 `` [''''»''' [link boost_asio.reference.execution__any_executor.operator_eq__eq_.overload3 more...]]`` 65704 65705 65706[section:overload1 execution::any_executor::operator== (1 of 3 overloads)] 65707 65708 65709Equality operator. 65710 65711 65712 bool operator==( 65713 const any_executor< SupportableProperties...> & a, 65714 const any_executor< SupportableProperties...> & b); 65715 65716 65717 65718[endsect] 65719 65720 65721 65722[section:overload2 execution::any_executor::operator== (2 of 3 overloads)] 65723 65724 65725Equality operator. 65726 65727 65728 bool operator==( 65729 const any_executor< SupportableProperties...> & a, 65730 nullptr_t ); 65731 65732 65733 65734[endsect] 65735 65736 65737 65738[section:overload3 execution::any_executor::operator== (3 of 3 overloads)] 65739 65740 65741Equality operator. 65742 65743 65744 bool operator==( 65745 nullptr_t , 65746 const any_executor< SupportableProperties...> & b); 65747 65748 65749 65750[endsect] 65751 65752 65753[endsect] 65754 65755 65756[section:prefer execution::any_executor::prefer] 65757 65758[indexterm2 boost_asio.indexterm.execution__any_executor.prefer..prefer..execution::any_executor] 65759Obtain a polymorphic wrapper with the specified property. 65760 65761 65762 template< 65763 typename Property> 65764 any_executor prefer( 65765 Property ) const; 65766 65767 65768Do not call this function directly. It is intended for use with the [link boost_asio.reference.prefer `prefer`] customisation point. 65769 65770For example: 65771 65772 execution::any_executor<execution::blocking_t::possibly_t> ex = ...; 65773 auto ex2 = boost::asio::prefer(ex, execution::blocking.possibly); 65774 65775 65776 65777 65778 65779[endsect] 65780 65781 65782 65783[section:query execution::any_executor::query] 65784 65785[indexterm2 boost_asio.indexterm.execution__any_executor.query..query..execution::any_executor] 65786Obtain the value associated with the specified property. 65787 65788 65789 template< 65790 typename Property> 65791 Property::polymorphic_query_result_type query( 65792 Property ) const; 65793 65794 65795Do not call this function directly. It is intended for use with the [link boost_asio.reference.query `query`] customisation point. 65796 65797For example: 65798 65799 execution::any_executor<execution::occupancy_t> ex = ...; 65800 size_t n = boost::asio::query(ex, execution::occupancy); 65801 65802 65803 65804 65805 65806[endsect] 65807 65808 65809 65810[section:require execution::any_executor::require] 65811 65812[indexterm2 boost_asio.indexterm.execution__any_executor.require..require..execution::any_executor] 65813Obtain a polymorphic wrapper with the specified property. 65814 65815 65816 template< 65817 typename Property> 65818 any_executor require( 65819 Property ) const; 65820 65821 65822Do not call this function directly. It is intended for use with the [link boost_asio.reference.require `require`] and [link boost_asio.reference.prefer `prefer`] customisation points. 65823 65824For example: 65825 65826 execution::any_executor<execution::blocking_t::possibly_t> ex = ...; 65827 auto ex2 = boost::asio::requre(ex, execution::blocking.possibly); 65828 65829 65830 65831 65832 65833[endsect] 65834 65835 65836 65837[section:swap execution::any_executor::swap] 65838 65839[indexterm2 boost_asio.indexterm.execution__any_executor.swap..swap..execution::any_executor] 65840Swap targets with another polymorphic wrapper. 65841 65842 65843 void swap( 65844 any_executor & other); 65845 65846 65847 65848[endsect] 65849 65850 65851[section:target execution::any_executor::target] 65852 65853[indexterm2 boost_asio.indexterm.execution__any_executor.target..target..execution::any_executor] 65854Get a pointer to the target executor. 65855 65856 65857 template< 65858 typename ``[link boost_asio.reference.Executor1 Executor]``> 65859 Executor * ``[link boost_asio.reference.execution__any_executor.target.overload1 target]``(); 65860 `` [''''»''' [link boost_asio.reference.execution__any_executor.target.overload1 more...]]`` 65861 65862 template< 65863 typename ``[link boost_asio.reference.Executor1 Executor]``> 65864 const Executor * ``[link boost_asio.reference.execution__any_executor.target.overload2 target]``() const; 65865 `` [''''»''' [link boost_asio.reference.execution__any_executor.target.overload2 more...]]`` 65866 65867 65868[section:overload1 execution::any_executor::target (1 of 2 overloads)] 65869 65870 65871Get a pointer to the target executor. 65872 65873 65874 template< 65875 typename ``[link boost_asio.reference.Executor1 Executor]``> 65876 Executor * target(); 65877 65878 65879 65880[endsect] 65881 65882 65883 65884[section:overload2 execution::any_executor::target (2 of 2 overloads)] 65885 65886 65887Get a pointer to the target executor. 65888 65889 65890 template< 65891 typename ``[link boost_asio.reference.Executor1 Executor]``> 65892 const Executor * target() const; 65893 65894 65895 65896[endsect] 65897 65898 65899[endsect] 65900 65901 65902[section:target_type execution::any_executor::target_type] 65903 65904[indexterm2 boost_asio.indexterm.execution__any_executor.target_type..target_type..execution::any_executor] 65905Get the type of the target executor. 65906 65907 65908 const type_info & target_type() const; 65909 65910 65911 65912[endsect] 65913 65914 65915 65916[section:_any_executor execution::any_executor::~any_executor] 65917 65918[indexterm2 boost_asio.indexterm.execution__any_executor._any_executor..~any_executor..execution::any_executor] 65919Destructor. 65920 65921 65922 ~any_executor(); 65923 65924 65925 65926[endsect] 65927 65928 65929 65930[endsect] 65931 65932[section:execution__bad_executor execution::bad_executor] 65933 65934[indexterm1 boost_asio.indexterm.execution__bad_executor..execution::bad_executor] 65935 65936 65937Exception thrown when trying to access an empty polymorphic executor. 65938 65939 65940 class bad_executor : 65941 public std::exception 65942 65943 65944[heading Member Functions] 65945[table 65946 [[Name][Description]] 65947 65948 [ 65949 [[link boost_asio.reference.execution__bad_executor.bad_executor [*bad_executor]] [constructor]] 65950 [Constructor. ] 65951 ] 65952 65953 [ 65954 [[link boost_asio.reference.execution__bad_executor.what [*what]]] 65955 [Obtain message associated with exception. ] 65956 ] 65957 65958] 65959 65960[heading Requirements] 65961 65962['Header: ][^boost/asio/execution/bad_executor.hpp] 65963 65964['Convenience header: ][^boost/asio/execution.hpp] 65965 65966 65967[section:bad_executor execution::bad_executor::bad_executor] 65968 65969[indexterm2 boost_asio.indexterm.execution__bad_executor.bad_executor..bad_executor..execution::bad_executor] 65970Constructor. 65971 65972 65973 bad_executor(); 65974 65975 65976 65977[endsect] 65978 65979 65980 65981[section:what execution::bad_executor::what] 65982 65983[indexterm2 boost_asio.indexterm.execution__bad_executor.what..what..execution::bad_executor] 65984Obtain message associated with exception. 65985 65986 65987 virtual const char * what() const; 65988 65989 65990 65991[endsect] 65992 65993 65994 65995[endsect] 65996 65997 65998[section:execution__blocking execution::blocking] 65999 66000[indexterm1 boost_asio.indexterm.execution__blocking..execution::blocking] 66001A special value used for accessing the [link boost_asio.reference.execution__blocking_t `execution::blocking_t`] property. 66002 66003 66004 constexpr blocking_t blocking; 66005 66006 66007[heading Requirements] 66008 66009['Header: ][^boost/asio/execution/blocking.hpp] 66010 66011['Convenience header: ][^boost/asio/execution.hpp] 66012 66013 66014[endsect] 66015 66016 66017 66018[section:execution__blocking_adaptation execution::blocking_adaptation] 66019 66020[indexterm1 boost_asio.indexterm.execution__blocking_adaptation..execution::blocking_adaptation] 66021A special value used for accessing the [link boost_asio.reference.execution__blocking_adaptation_t `execution::blocking_adaptation_t`] property. 66022 66023 66024 constexpr blocking_adaptation_t blocking_adaptation; 66025 66026 66027[heading Requirements] 66028 66029['Header: ][^boost/asio/execution/blocking_adaptation.hpp] 66030 66031['Convenience header: ][^boost/asio/execution.hpp] 66032 66033 66034[endsect] 66035 66036 66037[section:execution__blocking_adaptation_t execution::blocking_adaptation_t] 66038 66039[indexterm1 boost_asio.indexterm.execution__blocking_adaptation_t..execution::blocking_adaptation_t] 66040 66041 66042A property to describe whether automatic adaptation of an executor is allowed in order to apply the [link boost_asio.reference.execution__blocking_adaptation_t__allowed_t `execution::blocking_adaptation_t::allowed_t`] property. 66043 66044 66045 struct blocking_adaptation_t 66046 66047 66048[heading Types] 66049[table 66050 [[Name][Description]] 66051 66052 [ 66053 66054 [[link boost_asio.reference.execution__blocking_adaptation_t__allowed_t [*allowed_t]]] 66055 [A sub-property that indicates that automatic adaptation is allowed. ] 66056 66057 ] 66058 66059 [ 66060 66061 [[link boost_asio.reference.execution__blocking_adaptation_t__disallowed_t [*disallowed_t]]] 66062 [A sub-property that indicates that automatic adaptation is not allowed. ] 66063 66064 ] 66065 66066 [ 66067 66068 [[link boost_asio.reference.execution__blocking_adaptation_t.polymorphic_query_result_type [*polymorphic_query_result_type]]] 66069 [The type returned by queries against an any_executor. ] 66070 66071 ] 66072 66073] 66074 66075[heading Member Functions] 66076[table 66077 [[Name][Description]] 66078 66079 [ 66080 [[link boost_asio.reference.execution__blocking_adaptation_t.blocking_adaptation_t [*blocking_adaptation_t]] [constructor]] 66081 [Default constructor. 66082 [hr] 66083 Construct from a sub-property value. ] 66084 ] 66085 66086] 66087 66088[heading Data Members] 66089[table 66090 [[Name][Description]] 66091 66092 [ 66093 [[link boost_asio.reference.execution__blocking_adaptation_t.allowed [*allowed]] [static]] 66094 [A special value used for accessing the blocking_adaptation_t::allowed_t property. ] 66095 ] 66096 66097 [ 66098 [[link boost_asio.reference.execution__blocking_adaptation_t.disallowed [*disallowed]] [static]] 66099 [A special value used for accessing the blocking_adaptation_t::disallowed_t property. ] 66100 ] 66101 66102 [ 66103 [[link boost_asio.reference.execution__blocking_adaptation_t.is_applicable_property_v [*is_applicable_property_v]] [static]] 66104 [The blocking_adaptation_t property applies to executors, senders, and schedulers. ] 66105 ] 66106 66107 [ 66108 [[link boost_asio.reference.execution__blocking_adaptation_t.is_preferable [*is_preferable]] [static]] 66109 [The top-level blocking_adaptation_t property cannot be preferred. ] 66110 ] 66111 66112 [ 66113 [[link boost_asio.reference.execution__blocking_adaptation_t.is_requirable [*is_requirable]] [static]] 66114 [The top-level blocking_adaptation_t property cannot be required. ] 66115 ] 66116 66117] 66118 66119[heading Friends] 66120[table 66121 [[Name][Description]] 66122 66123 [ 66124 [[link boost_asio.reference.execution__blocking_adaptation_t.operator_not__eq_ [*operator!=]]] 66125 [Compare property values for inequality. ] 66126 ] 66127 66128 [ 66129 [[link boost_asio.reference.execution__blocking_adaptation_t.operator_eq__eq_ [*operator==]]] 66130 [Compare property values for equality. ] 66131 ] 66132 66133] 66134 66135[heading Requirements] 66136 66137['Header: ][^boost/asio/execution/blocking_adaptation.hpp] 66138 66139['Convenience header: ][^boost/asio/execution.hpp] 66140 66141 66142[section:allowed execution::blocking_adaptation_t::allowed] 66143 66144[indexterm2 boost_asio.indexterm.execution__blocking_adaptation_t.allowed..allowed..execution::blocking_adaptation_t] 66145A special value used for accessing the [link boost_asio.reference.execution__blocking_adaptation_t__allowed_t `execution::blocking_adaptation_t::allowed_t`] property. 66146 66147 66148 static constexpr allowed_t allowed; 66149 66150 66151 66152[endsect] 66153 66154 66155[section:blocking_adaptation_t execution::blocking_adaptation_t::blocking_adaptation_t] 66156 66157[indexterm2 boost_asio.indexterm.execution__blocking_adaptation_t.blocking_adaptation_t..blocking_adaptation_t..execution::blocking_adaptation_t] 66158Default constructor. 66159 66160 66161 constexpr ``[link boost_asio.reference.execution__blocking_adaptation_t.blocking_adaptation_t.overload1 blocking_adaptation_t]``(); 66162 `` [''''»''' [link boost_asio.reference.execution__blocking_adaptation_t.blocking_adaptation_t.overload1 more...]]`` 66163 66164 66165Construct from a sub-property value. 66166 66167 66168 constexpr ``[link boost_asio.reference.execution__blocking_adaptation_t.blocking_adaptation_t.overload2 blocking_adaptation_t]``( 66169 disallowed_t ); 66170 `` [''''»''' [link boost_asio.reference.execution__blocking_adaptation_t.blocking_adaptation_t.overload2 more...]]`` 66171 66172 constexpr ``[link boost_asio.reference.execution__blocking_adaptation_t.blocking_adaptation_t.overload3 blocking_adaptation_t]``( 66173 allowed_t ); 66174 `` [''''»''' [link boost_asio.reference.execution__blocking_adaptation_t.blocking_adaptation_t.overload3 more...]]`` 66175 66176 66177[section:overload1 execution::blocking_adaptation_t::blocking_adaptation_t (1 of 3 overloads)] 66178 66179 66180Default constructor. 66181 66182 66183 constexpr blocking_adaptation_t(); 66184 66185 66186 66187[endsect] 66188 66189 66190 66191[section:overload2 execution::blocking_adaptation_t::blocking_adaptation_t (2 of 3 overloads)] 66192 66193 66194Construct from a sub-property value. 66195 66196 66197 constexpr blocking_adaptation_t( 66198 disallowed_t ); 66199 66200 66201 66202[endsect] 66203 66204 66205 66206[section:overload3 execution::blocking_adaptation_t::blocking_adaptation_t (3 of 3 overloads)] 66207 66208 66209Construct from a sub-property value. 66210 66211 66212 constexpr blocking_adaptation_t( 66213 allowed_t ); 66214 66215 66216 66217[endsect] 66218 66219 66220[endsect] 66221 66222 66223[section:disallowed execution::blocking_adaptation_t::disallowed] 66224 66225[indexterm2 boost_asio.indexterm.execution__blocking_adaptation_t.disallowed..disallowed..execution::blocking_adaptation_t] 66226A special value used for accessing the [link boost_asio.reference.execution__blocking_adaptation_t__disallowed_t `execution::blocking_adaptation_t::disallowed_t`] property. 66227 66228 66229 static constexpr disallowed_t disallowed; 66230 66231 66232 66233[endsect] 66234 66235 66236 66237[section:is_applicable_property_v execution::blocking_adaptation_t::is_applicable_property_v] 66238 66239[indexterm2 boost_asio.indexterm.execution__blocking_adaptation_t.is_applicable_property_v..is_applicable_property_v..execution::blocking_adaptation_t] 66240The [link boost_asio.reference.execution__blocking_adaptation_t `execution::blocking_adaptation_t`] property applies to executors, senders, and schedulers. 66241 66242 66243 template <typename T> 66244 static constexpr bool is_applicable_property_v = 66245 is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>; 66246 66247 66248 66249[endsect] 66250 66251 66252 66253[section:is_preferable execution::blocking_adaptation_t::is_preferable] 66254 66255[indexterm2 boost_asio.indexterm.execution__blocking_adaptation_t.is_preferable..is_preferable..execution::blocking_adaptation_t] 66256The top-level [link boost_asio.reference.execution__blocking_adaptation_t `execution::blocking_adaptation_t`] property cannot be preferred. 66257 66258 66259 static constexpr bool is_preferable = false; 66260 66261 66262 66263[endsect] 66264 66265 66266 66267[section:is_requirable execution::blocking_adaptation_t::is_requirable] 66268 66269[indexterm2 boost_asio.indexterm.execution__blocking_adaptation_t.is_requirable..is_requirable..execution::blocking_adaptation_t] 66270The top-level [link boost_asio.reference.execution__blocking_adaptation_t `execution::blocking_adaptation_t`] property cannot be required. 66271 66272 66273 static constexpr bool is_requirable = false; 66274 66275 66276 66277[endsect] 66278 66279 66280 66281[section:operator_not__eq_ execution::blocking_adaptation_t::operator!=] 66282 66283[indexterm2 boost_asio.indexterm.execution__blocking_adaptation_t.operator_not__eq_..operator!=..execution::blocking_adaptation_t] 66284Compare property values for inequality. 66285 66286 66287 friend constexpr bool operator!=( 66288 const blocking_adaptation_t & a, 66289 const blocking_adaptation_t & b); 66290 66291 66292[heading Requirements] 66293 66294['Header: ][^boost/asio/execution/blocking_adaptation.hpp] 66295 66296['Convenience header: ][^boost/asio/execution.hpp] 66297 66298 66299[endsect] 66300 66301 66302 66303[section:operator_eq__eq_ execution::blocking_adaptation_t::operator==] 66304 66305[indexterm2 boost_asio.indexterm.execution__blocking_adaptation_t.operator_eq__eq_..operator==..execution::blocking_adaptation_t] 66306Compare property values for equality. 66307 66308 66309 friend constexpr bool operator==( 66310 const blocking_adaptation_t & a, 66311 const blocking_adaptation_t & b); 66312 66313 66314[heading Requirements] 66315 66316['Header: ][^boost/asio/execution/blocking_adaptation.hpp] 66317 66318['Convenience header: ][^boost/asio/execution.hpp] 66319 66320 66321[endsect] 66322 66323 66324 66325[section:polymorphic_query_result_type execution::blocking_adaptation_t::polymorphic_query_result_type] 66326 66327[indexterm2 boost_asio.indexterm.execution__blocking_adaptation_t.polymorphic_query_result_type..polymorphic_query_result_type..execution::blocking_adaptation_t] 66328The type returned by queries against an `any_executor`. 66329 66330 66331 typedef blocking_adaptation_t polymorphic_query_result_type; 66332 66333 66334 66335[heading Requirements] 66336 66337['Header: ][^boost/asio/execution/blocking_adaptation.hpp] 66338 66339['Convenience header: ][^boost/asio/execution.hpp] 66340 66341 66342[endsect] 66343 66344 66345 66346[endsect] 66347 66348[section:execution__blocking_adaptation_t__allowed_t execution::blocking_adaptation_t::allowed_t] 66349 66350[indexterm1 boost_asio.indexterm.execution__blocking_adaptation_t__allowed_t..execution::blocking_adaptation_t::allowed_t] 66351 66352 66353A sub-property that indicates that automatic adaptation is allowed. 66354 66355 66356 struct allowed_t 66357 66358 66359[heading Types] 66360[table 66361 [[Name][Description]] 66362 66363 [ 66364 66365 [[link boost_asio.reference.execution__blocking_adaptation_t__allowed_t.polymorphic_query_result_type [*polymorphic_query_result_type]]] 66366 [The type returned by queries against an any_executor. ] 66367 66368 ] 66369 66370] 66371 66372[heading Member Functions] 66373[table 66374 [[Name][Description]] 66375 66376 [ 66377 [[link boost_asio.reference.execution__blocking_adaptation_t__allowed_t.allowed_t [*allowed_t]] [constructor]] 66378 [Default constructor. ] 66379 ] 66380 66381 [ 66382 [[link boost_asio.reference.execution__blocking_adaptation_t__allowed_t.value [*value]] [static]] 66383 [Get the value associated with a property object. ] 66384 ] 66385 66386] 66387 66388[heading Data Members] 66389[table 66390 [[Name][Description]] 66391 66392 [ 66393 [[link boost_asio.reference.execution__blocking_adaptation_t__allowed_t.is_applicable_property_v [*is_applicable_property_v]] [static]] 66394 [The blocking_adaptation_t::allowed_t property applies to executors, senders, and schedulers. ] 66395 ] 66396 66397 [ 66398 [[link boost_asio.reference.execution__blocking_adaptation_t__allowed_t.is_preferable [*is_preferable]] [static]] 66399 [The blocking_adaptation_t::allowed_t property can be preferred. ] 66400 ] 66401 66402 [ 66403 [[link boost_asio.reference.execution__blocking_adaptation_t__allowed_t.is_requirable [*is_requirable]] [static]] 66404 [The blocking_adaptation_t::allowed_t property can be required. ] 66405 ] 66406 66407] 66408 66409[heading Requirements] 66410 66411['Header: ][^boost/asio/execution/blocking_adaptation.hpp] 66412 66413['Convenience header: ][^boost/asio/execution.hpp] 66414 66415 66416[section:allowed_t execution::blocking_adaptation_t::allowed_t::allowed_t] 66417 66418[indexterm2 boost_asio.indexterm.execution__blocking_adaptation_t__allowed_t.allowed_t..allowed_t..execution::blocking_adaptation_t::allowed_t] 66419Default constructor. 66420 66421 66422 constexpr allowed_t(); 66423 66424 66425 66426[endsect] 66427 66428 66429 66430[section:is_applicable_property_v execution::blocking_adaptation_t::allowed_t::is_applicable_property_v] 66431 66432[indexterm2 boost_asio.indexterm.execution__blocking_adaptation_t__allowed_t.is_applicable_property_v..is_applicable_property_v..execution::blocking_adaptation_t::allowed_t] 66433The [link boost_asio.reference.execution__blocking_adaptation_t__allowed_t `execution::blocking_adaptation_t::allowed_t`] property applies to executors, senders, and schedulers. 66434 66435 66436 template <typename T> 66437 static constexpr bool is_applicable_property_v = 66438 is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>; 66439 66440 66441 66442[endsect] 66443 66444 66445 66446[section:is_preferable execution::blocking_adaptation_t::allowed_t::is_preferable] 66447 66448[indexterm2 boost_asio.indexterm.execution__blocking_adaptation_t__allowed_t.is_preferable..is_preferable..execution::blocking_adaptation_t::allowed_t] 66449The [link boost_asio.reference.execution__blocking_adaptation_t__allowed_t `execution::blocking_adaptation_t::allowed_t`] property can be preferred. 66450 66451 66452 static constexpr bool is_preferable = false; 66453 66454 66455 66456[endsect] 66457 66458 66459 66460[section:is_requirable execution::blocking_adaptation_t::allowed_t::is_requirable] 66461 66462[indexterm2 boost_asio.indexterm.execution__blocking_adaptation_t__allowed_t.is_requirable..is_requirable..execution::blocking_adaptation_t::allowed_t] 66463The [link boost_asio.reference.execution__blocking_adaptation_t__allowed_t `execution::blocking_adaptation_t::allowed_t`] property can be required. 66464 66465 66466 static constexpr bool is_requirable = true; 66467 66468 66469 66470[endsect] 66471 66472 66473 66474[section:polymorphic_query_result_type execution::blocking_adaptation_t::allowed_t::polymorphic_query_result_type] 66475 66476[indexterm2 boost_asio.indexterm.execution__blocking_adaptation_t__allowed_t.polymorphic_query_result_type..polymorphic_query_result_type..execution::blocking_adaptation_t::allowed_t] 66477The type returned by queries against an `any_executor`. 66478 66479 66480 typedef blocking_adaptation_t polymorphic_query_result_type; 66481 66482 66483 66484[heading Requirements] 66485 66486['Header: ][^boost/asio/execution/blocking_adaptation.hpp] 66487 66488['Convenience header: ][^boost/asio/execution.hpp] 66489 66490 66491[endsect] 66492 66493 66494 66495[section:value execution::blocking_adaptation_t::allowed_t::value] 66496 66497[indexterm2 boost_asio.indexterm.execution__blocking_adaptation_t__allowed_t.value..value..execution::blocking_adaptation_t::allowed_t] 66498Get the value associated with a property object. 66499 66500 66501 static constexpr blocking_adaptation_t value(); 66502 66503 66504 66505[heading Return Value] 66506 66507`allowed_t()`; 66508 66509 66510 66511 66512[endsect] 66513 66514 66515 66516[endsect] 66517 66518[section:execution__blocking_adaptation_t__disallowed_t execution::blocking_adaptation_t::disallowed_t] 66519 66520[indexterm1 boost_asio.indexterm.execution__blocking_adaptation_t__disallowed_t..execution::blocking_adaptation_t::disallowed_t] 66521 66522 66523A sub-property that indicates that automatic adaptation is not allowed. 66524 66525 66526 struct disallowed_t 66527 66528 66529[heading Types] 66530[table 66531 [[Name][Description]] 66532 66533 [ 66534 66535 [[link boost_asio.reference.execution__blocking_adaptation_t__disallowed_t.polymorphic_query_result_type [*polymorphic_query_result_type]]] 66536 [The type returned by queries against an any_executor. ] 66537 66538 ] 66539 66540] 66541 66542[heading Member Functions] 66543[table 66544 [[Name][Description]] 66545 66546 [ 66547 [[link boost_asio.reference.execution__blocking_adaptation_t__disallowed_t.disallowed_t [*disallowed_t]] [constructor]] 66548 [Default constructor. ] 66549 ] 66550 66551 [ 66552 [[link boost_asio.reference.execution__blocking_adaptation_t__disallowed_t.value [*value]] [static]] 66553 [Get the value associated with a property object. ] 66554 ] 66555 66556] 66557 66558[heading Data Members] 66559[table 66560 [[Name][Description]] 66561 66562 [ 66563 [[link boost_asio.reference.execution__blocking_adaptation_t__disallowed_t.is_applicable_property_v [*is_applicable_property_v]] [static]] 66564 [The blocking_adaptation_t::disallowed_t property applies to executors, senders, and schedulers. ] 66565 ] 66566 66567 [ 66568 [[link boost_asio.reference.execution__blocking_adaptation_t__disallowed_t.is_preferable [*is_preferable]] [static]] 66569 [The blocking_adaptation_t::disallowed_t property can be preferred. ] 66570 ] 66571 66572 [ 66573 [[link boost_asio.reference.execution__blocking_adaptation_t__disallowed_t.is_requirable [*is_requirable]] [static]] 66574 [The blocking_adaptation_t::disallowed_t property can be required. ] 66575 ] 66576 66577] 66578 66579[heading Requirements] 66580 66581['Header: ][^boost/asio/execution/blocking_adaptation.hpp] 66582 66583['Convenience header: ][^boost/asio/execution.hpp] 66584 66585 66586[section:disallowed_t execution::blocking_adaptation_t::disallowed_t::disallowed_t] 66587 66588[indexterm2 boost_asio.indexterm.execution__blocking_adaptation_t__disallowed_t.disallowed_t..disallowed_t..execution::blocking_adaptation_t::disallowed_t] 66589Default constructor. 66590 66591 66592 constexpr disallowed_t(); 66593 66594 66595 66596[endsect] 66597 66598 66599 66600[section:is_applicable_property_v execution::blocking_adaptation_t::disallowed_t::is_applicable_property_v] 66601 66602[indexterm2 boost_asio.indexterm.execution__blocking_adaptation_t__disallowed_t.is_applicable_property_v..is_applicable_property_v..execution::blocking_adaptation_t::disallowed_t] 66603The [link boost_asio.reference.execution__blocking_adaptation_t__disallowed_t `execution::blocking_adaptation_t::disallowed_t`] property applies to executors, senders, and schedulers. 66604 66605 66606 template <typename T> 66607 static constexpr bool is_applicable_property_v = 66608 is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>; 66609 66610 66611 66612[endsect] 66613 66614 66615 66616[section:is_preferable execution::blocking_adaptation_t::disallowed_t::is_preferable] 66617 66618[indexterm2 boost_asio.indexterm.execution__blocking_adaptation_t__disallowed_t.is_preferable..is_preferable..execution::blocking_adaptation_t::disallowed_t] 66619The [link boost_asio.reference.execution__blocking_adaptation_t__disallowed_t `execution::blocking_adaptation_t::disallowed_t`] property can be preferred. 66620 66621 66622 static constexpr bool is_preferable = true; 66623 66624 66625 66626[endsect] 66627 66628 66629 66630[section:is_requirable execution::blocking_adaptation_t::disallowed_t::is_requirable] 66631 66632[indexterm2 boost_asio.indexterm.execution__blocking_adaptation_t__disallowed_t.is_requirable..is_requirable..execution::blocking_adaptation_t::disallowed_t] 66633The [link boost_asio.reference.execution__blocking_adaptation_t__disallowed_t `execution::blocking_adaptation_t::disallowed_t`] property can be required. 66634 66635 66636 static constexpr bool is_requirable = true; 66637 66638 66639 66640[endsect] 66641 66642 66643 66644[section:polymorphic_query_result_type execution::blocking_adaptation_t::disallowed_t::polymorphic_query_result_type] 66645 66646[indexterm2 boost_asio.indexterm.execution__blocking_adaptation_t__disallowed_t.polymorphic_query_result_type..polymorphic_query_result_type..execution::blocking_adaptation_t::disallowed_t] 66647The type returned by queries against an `any_executor`. 66648 66649 66650 typedef blocking_adaptation_t polymorphic_query_result_type; 66651 66652 66653 66654[heading Requirements] 66655 66656['Header: ][^boost/asio/execution/blocking_adaptation.hpp] 66657 66658['Convenience header: ][^boost/asio/execution.hpp] 66659 66660 66661[endsect] 66662 66663 66664 66665[section:value execution::blocking_adaptation_t::disallowed_t::value] 66666 66667[indexterm2 boost_asio.indexterm.execution__blocking_adaptation_t__disallowed_t.value..value..execution::blocking_adaptation_t::disallowed_t] 66668Get the value associated with a property object. 66669 66670 66671 static constexpr blocking_adaptation_t value(); 66672 66673 66674 66675[heading Return Value] 66676 66677`disallowed_t()`; 66678 66679 66680 66681 66682[endsect] 66683 66684 66685 66686[endsect] 66687 66688[section:execution__blocking_t execution::blocking_t] 66689 66690[indexterm1 boost_asio.indexterm.execution__blocking_t..execution::blocking_t] 66691 66692 66693A property to describe what guarantees an executor makes about the blocking behaviour of their execution functions. 66694 66695 66696 struct blocking_t 66697 66698 66699[heading Types] 66700[table 66701 [[Name][Description]] 66702 66703 [ 66704 66705 [[link boost_asio.reference.execution__blocking_t__always_t [*always_t]]] 66706 [A sub-property that indicates that invocation of an executor's execution function shall block until completion of all invocations of the submitted function object. ] 66707 66708 ] 66709 66710 [ 66711 66712 [[link boost_asio.reference.execution__blocking_t__never_t [*never_t]]] 66713 [A sub-property that indicates that invocation of an executor's execution function shall not block pending completion of the invocations of the submitted function object. ] 66714 66715 ] 66716 66717 [ 66718 66719 [[link boost_asio.reference.execution__blocking_t__possibly_t [*possibly_t]]] 66720 [A sub-property that indicates that invocation of an executor's execution function may block pending completion of one or more invocations of the submitted function object. ] 66721 66722 ] 66723 66724 [ 66725 66726 [[link boost_asio.reference.execution__blocking_t.polymorphic_query_result_type [*polymorphic_query_result_type]]] 66727 [The type returned by queries against an any_executor. ] 66728 66729 ] 66730 66731] 66732 66733[heading Member Functions] 66734[table 66735 [[Name][Description]] 66736 66737 [ 66738 [[link boost_asio.reference.execution__blocking_t.blocking_t [*blocking_t]] [constructor]] 66739 [Default constructor. 66740 [hr] 66741 Construct from a sub-property value. ] 66742 ] 66743 66744] 66745 66746[heading Data Members] 66747[table 66748 [[Name][Description]] 66749 66750 [ 66751 [[link boost_asio.reference.execution__blocking_t.always [*always]] [static]] 66752 [A special value used for accessing the blocking_t::always_t property. ] 66753 ] 66754 66755 [ 66756 [[link boost_asio.reference.execution__blocking_t.is_applicable_property_v [*is_applicable_property_v]] [static]] 66757 [The blocking_t property applies to executors, senders, and schedulers. ] 66758 ] 66759 66760 [ 66761 [[link boost_asio.reference.execution__blocking_t.is_preferable [*is_preferable]] [static]] 66762 [The top-level blocking_t property cannot be preferred. ] 66763 ] 66764 66765 [ 66766 [[link boost_asio.reference.execution__blocking_t.is_requirable [*is_requirable]] [static]] 66767 [The top-level blocking_t property cannot be required. ] 66768 ] 66769 66770 [ 66771 [[link boost_asio.reference.execution__blocking_t.never [*never]] [static]] 66772 [A special value used for accessing the blocking_t::never_t property. ] 66773 ] 66774 66775 [ 66776 [[link boost_asio.reference.execution__blocking_t.possibly [*possibly]] [static]] 66777 [A special value used for accessing the blocking_t::possibly_t property. ] 66778 ] 66779 66780] 66781 66782[heading Friends] 66783[table 66784 [[Name][Description]] 66785 66786 [ 66787 [[link boost_asio.reference.execution__blocking_t.operator_not__eq_ [*operator!=]]] 66788 [Compare property values for inequality. ] 66789 ] 66790 66791 [ 66792 [[link boost_asio.reference.execution__blocking_t.operator_eq__eq_ [*operator==]]] 66793 [Compare property values for equality. ] 66794 ] 66795 66796] 66797 66798[heading Requirements] 66799 66800['Header: ][^boost/asio/execution/blocking.hpp] 66801 66802['Convenience header: ][^boost/asio/execution.hpp] 66803 66804 66805[section:always execution::blocking_t::always] 66806 66807[indexterm2 boost_asio.indexterm.execution__blocking_t.always..always..execution::blocking_t] 66808A special value used for accessing the [link boost_asio.reference.execution__blocking_t__always_t `execution::blocking_t::always_t`] property. 66809 66810 66811 static constexpr always_t always; 66812 66813 66814 66815[endsect] 66816 66817 66818[section:blocking_t execution::blocking_t::blocking_t] 66819 66820[indexterm2 boost_asio.indexterm.execution__blocking_t.blocking_t..blocking_t..execution::blocking_t] 66821Default constructor. 66822 66823 66824 constexpr ``[link boost_asio.reference.execution__blocking_t.blocking_t.overload1 blocking_t]``(); 66825 `` [''''»''' [link boost_asio.reference.execution__blocking_t.blocking_t.overload1 more...]]`` 66826 66827 66828Construct from a sub-property value. 66829 66830 66831 constexpr ``[link boost_asio.reference.execution__blocking_t.blocking_t.overload2 blocking_t]``( 66832 possibly_t ); 66833 `` [''''»''' [link boost_asio.reference.execution__blocking_t.blocking_t.overload2 more...]]`` 66834 66835 constexpr ``[link boost_asio.reference.execution__blocking_t.blocking_t.overload3 blocking_t]``( 66836 always_t ); 66837 `` [''''»''' [link boost_asio.reference.execution__blocking_t.blocking_t.overload3 more...]]`` 66838 66839 constexpr ``[link boost_asio.reference.execution__blocking_t.blocking_t.overload4 blocking_t]``( 66840 never_t ); 66841 `` [''''»''' [link boost_asio.reference.execution__blocking_t.blocking_t.overload4 more...]]`` 66842 66843 66844[section:overload1 execution::blocking_t::blocking_t (1 of 4 overloads)] 66845 66846 66847Default constructor. 66848 66849 66850 constexpr blocking_t(); 66851 66852 66853 66854[endsect] 66855 66856 66857 66858[section:overload2 execution::blocking_t::blocking_t (2 of 4 overloads)] 66859 66860 66861Construct from a sub-property value. 66862 66863 66864 constexpr blocking_t( 66865 possibly_t ); 66866 66867 66868 66869[endsect] 66870 66871 66872 66873[section:overload3 execution::blocking_t::blocking_t (3 of 4 overloads)] 66874 66875 66876Construct from a sub-property value. 66877 66878 66879 constexpr blocking_t( 66880 always_t ); 66881 66882 66883 66884[endsect] 66885 66886 66887 66888[section:overload4 execution::blocking_t::blocking_t (4 of 4 overloads)] 66889 66890 66891Construct from a sub-property value. 66892 66893 66894 constexpr blocking_t( 66895 never_t ); 66896 66897 66898 66899[endsect] 66900 66901 66902[endsect] 66903 66904 66905[section:is_applicable_property_v execution::blocking_t::is_applicable_property_v] 66906 66907[indexterm2 boost_asio.indexterm.execution__blocking_t.is_applicable_property_v..is_applicable_property_v..execution::blocking_t] 66908The [link boost_asio.reference.execution__blocking_t `execution::blocking_t`] property applies to executors, senders, and schedulers. 66909 66910 66911 template <typename T> 66912 static constexpr bool is_applicable_property_v = 66913 is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>; 66914 66915 66916 66917[endsect] 66918 66919 66920 66921[section:is_preferable execution::blocking_t::is_preferable] 66922 66923[indexterm2 boost_asio.indexterm.execution__blocking_t.is_preferable..is_preferable..execution::blocking_t] 66924The top-level [link boost_asio.reference.execution__blocking_t `execution::blocking_t`] property cannot be preferred. 66925 66926 66927 static constexpr bool is_preferable = false; 66928 66929 66930 66931[endsect] 66932 66933 66934 66935[section:is_requirable execution::blocking_t::is_requirable] 66936 66937[indexterm2 boost_asio.indexterm.execution__blocking_t.is_requirable..is_requirable..execution::blocking_t] 66938The top-level [link boost_asio.reference.execution__blocking_t `execution::blocking_t`] property cannot be required. 66939 66940 66941 static constexpr bool is_requirable = false; 66942 66943 66944 66945[endsect] 66946 66947 66948 66949[section:never execution::blocking_t::never] 66950 66951[indexterm2 boost_asio.indexterm.execution__blocking_t.never..never..execution::blocking_t] 66952A special value used for accessing the [link boost_asio.reference.execution__blocking_t__never_t `execution::blocking_t::never_t`] property. 66953 66954 66955 static constexpr never_t never; 66956 66957 66958 66959[endsect] 66960 66961 66962 66963[section:operator_not__eq_ execution::blocking_t::operator!=] 66964 66965[indexterm2 boost_asio.indexterm.execution__blocking_t.operator_not__eq_..operator!=..execution::blocking_t] 66966Compare property values for inequality. 66967 66968 66969 friend constexpr bool operator!=( 66970 const blocking_t & a, 66971 const blocking_t & b); 66972 66973 66974[heading Requirements] 66975 66976['Header: ][^boost/asio/execution/blocking.hpp] 66977 66978['Convenience header: ][^boost/asio/execution.hpp] 66979 66980 66981[endsect] 66982 66983 66984 66985[section:operator_eq__eq_ execution::blocking_t::operator==] 66986 66987[indexterm2 boost_asio.indexterm.execution__blocking_t.operator_eq__eq_..operator==..execution::blocking_t] 66988Compare property values for equality. 66989 66990 66991 friend constexpr bool operator==( 66992 const blocking_t & a, 66993 const blocking_t & b); 66994 66995 66996[heading Requirements] 66997 66998['Header: ][^boost/asio/execution/blocking.hpp] 66999 67000['Convenience header: ][^boost/asio/execution.hpp] 67001 67002 67003[endsect] 67004 67005 67006 67007[section:polymorphic_query_result_type execution::blocking_t::polymorphic_query_result_type] 67008 67009[indexterm2 boost_asio.indexterm.execution__blocking_t.polymorphic_query_result_type..polymorphic_query_result_type..execution::blocking_t] 67010The type returned by queries against an `any_executor`. 67011 67012 67013 typedef blocking_t polymorphic_query_result_type; 67014 67015 67016 67017[heading Requirements] 67018 67019['Header: ][^boost/asio/execution/blocking.hpp] 67020 67021['Convenience header: ][^boost/asio/execution.hpp] 67022 67023 67024[endsect] 67025 67026 67027 67028[section:possibly execution::blocking_t::possibly] 67029 67030[indexterm2 boost_asio.indexterm.execution__blocking_t.possibly..possibly..execution::blocking_t] 67031A special value used for accessing the [link boost_asio.reference.execution__blocking_t__possibly_t `execution::blocking_t::possibly_t`] property. 67032 67033 67034 static constexpr possibly_t possibly; 67035 67036 67037 67038[endsect] 67039 67040 67041 67042[endsect] 67043 67044[section:execution__blocking_t__always_t execution::blocking_t::always_t] 67045 67046[indexterm1 boost_asio.indexterm.execution__blocking_t__always_t..execution::blocking_t::always_t] 67047 67048 67049A sub-property that indicates that invocation of an executor's execution function shall block until completion of all invocations of the submitted function object. 67050 67051 67052 struct always_t 67053 67054 67055[heading Types] 67056[table 67057 [[Name][Description]] 67058 67059 [ 67060 67061 [[link boost_asio.reference.execution__blocking_t__always_t.polymorphic_query_result_type [*polymorphic_query_result_type]]] 67062 [The type returned by queries against an any_executor. ] 67063 67064 ] 67065 67066] 67067 67068[heading Member Functions] 67069[table 67070 [[Name][Description]] 67071 67072 [ 67073 [[link boost_asio.reference.execution__blocking_t__always_t.always_t [*always_t]] [constructor]] 67074 [Default constructor. ] 67075 ] 67076 67077 [ 67078 [[link boost_asio.reference.execution__blocking_t__always_t.value [*value]] [static]] 67079 [Get the value associated with a property object. ] 67080 ] 67081 67082] 67083 67084[heading Data Members] 67085[table 67086 [[Name][Description]] 67087 67088 [ 67089 [[link boost_asio.reference.execution__blocking_t__always_t.is_applicable_property_v [*is_applicable_property_v]] [static]] 67090 [The blocking_t::always_t property applies to executors, senders, and schedulers. ] 67091 ] 67092 67093 [ 67094 [[link boost_asio.reference.execution__blocking_t__always_t.is_preferable [*is_preferable]] [static]] 67095 [The blocking_t::always_t property can be preferred. ] 67096 ] 67097 67098 [ 67099 [[link boost_asio.reference.execution__blocking_t__always_t.is_requirable [*is_requirable]] [static]] 67100 [The blocking_t::always_t property can be required. ] 67101 ] 67102 67103] 67104 67105[heading Requirements] 67106 67107['Header: ][^boost/asio/execution/blocking.hpp] 67108 67109['Convenience header: ][^boost/asio/execution.hpp] 67110 67111 67112[section:always_t execution::blocking_t::always_t::always_t] 67113 67114[indexterm2 boost_asio.indexterm.execution__blocking_t__always_t.always_t..always_t..execution::blocking_t::always_t] 67115Default constructor. 67116 67117 67118 constexpr always_t(); 67119 67120 67121 67122[endsect] 67123 67124 67125 67126[section:is_applicable_property_v execution::blocking_t::always_t::is_applicable_property_v] 67127 67128[indexterm2 boost_asio.indexterm.execution__blocking_t__always_t.is_applicable_property_v..is_applicable_property_v..execution::blocking_t::always_t] 67129The [link boost_asio.reference.execution__blocking_t__always_t `execution::blocking_t::always_t`] property applies to executors, senders, and schedulers. 67130 67131 67132 template <typename T> 67133 static constexpr bool is_applicable_property_v = 67134 is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>; 67135 67136 67137 67138[endsect] 67139 67140 67141 67142[section:is_preferable execution::blocking_t::always_t::is_preferable] 67143 67144[indexterm2 boost_asio.indexterm.execution__blocking_t__always_t.is_preferable..is_preferable..execution::blocking_t::always_t] 67145The [link boost_asio.reference.execution__blocking_t__always_t `execution::blocking_t::always_t`] property can be preferred. 67146 67147 67148 static constexpr bool is_preferable = false; 67149 67150 67151 67152[endsect] 67153 67154 67155 67156[section:is_requirable execution::blocking_t::always_t::is_requirable] 67157 67158[indexterm2 boost_asio.indexterm.execution__blocking_t__always_t.is_requirable..is_requirable..execution::blocking_t::always_t] 67159The [link boost_asio.reference.execution__blocking_t__always_t `execution::blocking_t::always_t`] property can be required. 67160 67161 67162 static constexpr bool is_requirable = true; 67163 67164 67165 67166[endsect] 67167 67168 67169 67170[section:polymorphic_query_result_type execution::blocking_t::always_t::polymorphic_query_result_type] 67171 67172[indexterm2 boost_asio.indexterm.execution__blocking_t__always_t.polymorphic_query_result_type..polymorphic_query_result_type..execution::blocking_t::always_t] 67173The type returned by queries against an `any_executor`. 67174 67175 67176 typedef blocking_t polymorphic_query_result_type; 67177 67178 67179 67180[heading Requirements] 67181 67182['Header: ][^boost/asio/execution/blocking.hpp] 67183 67184['Convenience header: ][^boost/asio/execution.hpp] 67185 67186 67187[endsect] 67188 67189 67190 67191[section:value execution::blocking_t::always_t::value] 67192 67193[indexterm2 boost_asio.indexterm.execution__blocking_t__always_t.value..value..execution::blocking_t::always_t] 67194Get the value associated with a property object. 67195 67196 67197 static constexpr blocking_t value(); 67198 67199 67200 67201[heading Return Value] 67202 67203`always_t()`; 67204 67205 67206 67207 67208[endsect] 67209 67210 67211 67212[endsect] 67213 67214[section:execution__blocking_t__never_t execution::blocking_t::never_t] 67215 67216[indexterm1 boost_asio.indexterm.execution__blocking_t__never_t..execution::blocking_t::never_t] 67217 67218 67219A sub-property that indicates that invocation of an executor's execution function shall not block pending completion of the invocations of the submitted function object. 67220 67221 67222 struct never_t 67223 67224 67225[heading Types] 67226[table 67227 [[Name][Description]] 67228 67229 [ 67230 67231 [[link boost_asio.reference.execution__blocking_t__never_t.polymorphic_query_result_type [*polymorphic_query_result_type]]] 67232 [The type returned by queries against an any_executor. ] 67233 67234 ] 67235 67236] 67237 67238[heading Member Functions] 67239[table 67240 [[Name][Description]] 67241 67242 [ 67243 [[link boost_asio.reference.execution__blocking_t__never_t.never_t [*never_t]] [constructor]] 67244 [Default constructor. ] 67245 ] 67246 67247 [ 67248 [[link boost_asio.reference.execution__blocking_t__never_t.value [*value]] [static]] 67249 [Get the value associated with a property object. ] 67250 ] 67251 67252] 67253 67254[heading Data Members] 67255[table 67256 [[Name][Description]] 67257 67258 [ 67259 [[link boost_asio.reference.execution__blocking_t__never_t.is_applicable_property_v [*is_applicable_property_v]] [static]] 67260 [The blocking_t::never_t property applies to executors, senders, and schedulers. ] 67261 ] 67262 67263 [ 67264 [[link boost_asio.reference.execution__blocking_t__never_t.is_preferable [*is_preferable]] [static]] 67265 [The blocking_t::never_t property can be preferred. ] 67266 ] 67267 67268 [ 67269 [[link boost_asio.reference.execution__blocking_t__never_t.is_requirable [*is_requirable]] [static]] 67270 [The blocking_t::never_t property can be required. ] 67271 ] 67272 67273] 67274 67275[heading Requirements] 67276 67277['Header: ][^boost/asio/execution/blocking.hpp] 67278 67279['Convenience header: ][^boost/asio/execution.hpp] 67280 67281 67282[section:is_applicable_property_v execution::blocking_t::never_t::is_applicable_property_v] 67283 67284[indexterm2 boost_asio.indexterm.execution__blocking_t__never_t.is_applicable_property_v..is_applicable_property_v..execution::blocking_t::never_t] 67285The [link boost_asio.reference.execution__blocking_t__never_t `execution::blocking_t::never_t`] property applies to executors, senders, and schedulers. 67286 67287 67288 template <typename T> 67289 static constexpr bool is_applicable_property_v = 67290 is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>; 67291 67292 67293 67294[endsect] 67295 67296 67297 67298[section:is_preferable execution::blocking_t::never_t::is_preferable] 67299 67300[indexterm2 boost_asio.indexterm.execution__blocking_t__never_t.is_preferable..is_preferable..execution::blocking_t::never_t] 67301The [link boost_asio.reference.execution__blocking_t__never_t `execution::blocking_t::never_t`] property can be preferred. 67302 67303 67304 static constexpr bool is_preferable = true; 67305 67306 67307 67308[endsect] 67309 67310 67311 67312[section:is_requirable execution::blocking_t::never_t::is_requirable] 67313 67314[indexterm2 boost_asio.indexterm.execution__blocking_t__never_t.is_requirable..is_requirable..execution::blocking_t::never_t] 67315The [link boost_asio.reference.execution__blocking_t__never_t `execution::blocking_t::never_t`] property can be required. 67316 67317 67318 static constexpr bool is_requirable = true; 67319 67320 67321 67322[endsect] 67323 67324 67325 67326[section:never_t execution::blocking_t::never_t::never_t] 67327 67328[indexterm2 boost_asio.indexterm.execution__blocking_t__never_t.never_t..never_t..execution::blocking_t::never_t] 67329Default constructor. 67330 67331 67332 constexpr never_t(); 67333 67334 67335 67336[endsect] 67337 67338 67339 67340[section:polymorphic_query_result_type execution::blocking_t::never_t::polymorphic_query_result_type] 67341 67342[indexterm2 boost_asio.indexterm.execution__blocking_t__never_t.polymorphic_query_result_type..polymorphic_query_result_type..execution::blocking_t::never_t] 67343The type returned by queries against an `any_executor`. 67344 67345 67346 typedef blocking_t polymorphic_query_result_type; 67347 67348 67349 67350[heading Requirements] 67351 67352['Header: ][^boost/asio/execution/blocking.hpp] 67353 67354['Convenience header: ][^boost/asio/execution.hpp] 67355 67356 67357[endsect] 67358 67359 67360 67361[section:value execution::blocking_t::never_t::value] 67362 67363[indexterm2 boost_asio.indexterm.execution__blocking_t__never_t.value..value..execution::blocking_t::never_t] 67364Get the value associated with a property object. 67365 67366 67367 static constexpr blocking_t value(); 67368 67369 67370 67371[heading Return Value] 67372 67373`never_t()`; 67374 67375 67376 67377 67378[endsect] 67379 67380 67381 67382[endsect] 67383 67384[section:execution__blocking_t__possibly_t execution::blocking_t::possibly_t] 67385 67386[indexterm1 boost_asio.indexterm.execution__blocking_t__possibly_t..execution::blocking_t::possibly_t] 67387 67388 67389A sub-property that indicates that invocation of an executor's execution function may block pending completion of one or more invocations of the submitted function object. 67390 67391 67392 struct possibly_t 67393 67394 67395[heading Types] 67396[table 67397 [[Name][Description]] 67398 67399 [ 67400 67401 [[link boost_asio.reference.execution__blocking_t__possibly_t.polymorphic_query_result_type [*polymorphic_query_result_type]]] 67402 [The type returned by queries against an any_executor. ] 67403 67404 ] 67405 67406] 67407 67408[heading Member Functions] 67409[table 67410 [[Name][Description]] 67411 67412 [ 67413 [[link boost_asio.reference.execution__blocking_t__possibly_t.possibly_t [*possibly_t]] [constructor]] 67414 [Default constructor. ] 67415 ] 67416 67417 [ 67418 [[link boost_asio.reference.execution__blocking_t__possibly_t.value [*value]] [static]] 67419 [Get the value associated with a property object. ] 67420 ] 67421 67422] 67423 67424[heading Data Members] 67425[table 67426 [[Name][Description]] 67427 67428 [ 67429 [[link boost_asio.reference.execution__blocking_t__possibly_t.is_applicable_property_v [*is_applicable_property_v]] [static]] 67430 [The blocking_t::possibly_t property applies to executors, senders, and schedulers. ] 67431 ] 67432 67433 [ 67434 [[link boost_asio.reference.execution__blocking_t__possibly_t.is_preferable [*is_preferable]] [static]] 67435 [The blocking_t::possibly_t property can be preferred. ] 67436 ] 67437 67438 [ 67439 [[link boost_asio.reference.execution__blocking_t__possibly_t.is_requirable [*is_requirable]] [static]] 67440 [The blocking_t::possibly_t property can be required. ] 67441 ] 67442 67443] 67444 67445[heading Requirements] 67446 67447['Header: ][^boost/asio/execution/blocking.hpp] 67448 67449['Convenience header: ][^boost/asio/execution.hpp] 67450 67451 67452[section:is_applicable_property_v execution::blocking_t::possibly_t::is_applicable_property_v] 67453 67454[indexterm2 boost_asio.indexterm.execution__blocking_t__possibly_t.is_applicable_property_v..is_applicable_property_v..execution::blocking_t::possibly_t] 67455The [link boost_asio.reference.execution__blocking_t__possibly_t `execution::blocking_t::possibly_t`] property applies to executors, senders, and schedulers. 67456 67457 67458 template <typename T> 67459 static constexpr bool is_applicable_property_v = 67460 is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>; 67461 67462 67463 67464[endsect] 67465 67466 67467 67468[section:is_preferable execution::blocking_t::possibly_t::is_preferable] 67469 67470[indexterm2 boost_asio.indexterm.execution__blocking_t__possibly_t.is_preferable..is_preferable..execution::blocking_t::possibly_t] 67471The [link boost_asio.reference.execution__blocking_t__possibly_t `execution::blocking_t::possibly_t`] property can be preferred. 67472 67473 67474 static constexpr bool is_preferable = true; 67475 67476 67477 67478[endsect] 67479 67480 67481 67482[section:is_requirable execution::blocking_t::possibly_t::is_requirable] 67483 67484[indexterm2 boost_asio.indexterm.execution__blocking_t__possibly_t.is_requirable..is_requirable..execution::blocking_t::possibly_t] 67485The [link boost_asio.reference.execution__blocking_t__possibly_t `execution::blocking_t::possibly_t`] property can be required. 67486 67487 67488 static constexpr bool is_requirable = true; 67489 67490 67491 67492[endsect] 67493 67494 67495 67496[section:polymorphic_query_result_type execution::blocking_t::possibly_t::polymorphic_query_result_type] 67497 67498[indexterm2 boost_asio.indexterm.execution__blocking_t__possibly_t.polymorphic_query_result_type..polymorphic_query_result_type..execution::blocking_t::possibly_t] 67499The type returned by queries against an `any_executor`. 67500 67501 67502 typedef blocking_t polymorphic_query_result_type; 67503 67504 67505 67506[heading Requirements] 67507 67508['Header: ][^boost/asio/execution/blocking.hpp] 67509 67510['Convenience header: ][^boost/asio/execution.hpp] 67511 67512 67513[endsect] 67514 67515 67516 67517[section:possibly_t execution::blocking_t::possibly_t::possibly_t] 67518 67519[indexterm2 boost_asio.indexterm.execution__blocking_t__possibly_t.possibly_t..possibly_t..execution::blocking_t::possibly_t] 67520Default constructor. 67521 67522 67523 constexpr possibly_t(); 67524 67525 67526 67527[endsect] 67528 67529 67530 67531[section:value execution::blocking_t::possibly_t::value] 67532 67533[indexterm2 boost_asio.indexterm.execution__blocking_t__possibly_t.value..value..execution::blocking_t::possibly_t] 67534Get the value associated with a property object. 67535 67536 67537 static constexpr blocking_t value(); 67538 67539 67540 67541[heading Return Value] 67542 67543`possibly_t()`; 67544 67545 67546 67547 67548[endsect] 67549 67550 67551 67552[endsect] 67553 67554 67555[section:execution__bulk_execute execution::bulk_execute] 67556 67557[indexterm1 boost_asio.indexterm.execution__bulk_execute..execution::bulk_execute] 67558A customisation point that creates a bulk sender. 67559 67560 67561 constexpr unspecified bulk_execute = unspecified; 67562 67563 67564The name `execution::bulk_execute` denotes a customisation point object. If `is_convertible_v<N, size_t>` is true, then the expression `execution::bulk_execute(S, F, N)` for some subexpressions `S`, `F`, and `N` is expression-equivalent to: 67565 67566 67567* `S.bulk_execute(F, N)`, if that expression is valid. If the function selected does not execute `N` invocations of the function object `F` on the executor `S` in bulk with forward progress guarantee `boost::asio::query(S, execution::bulk_guarantee)`, and the result of that function does not model `sender<void>`, the program is ill-formed with no diagnostic required. 67568 67569 67570* Otherwise, `bulk_execute(S, F, N)`, if that expression is valid, with overload resolution performed in a context that includes the declaration `void bulk_execute();` and that does not include a declaration of `execution::bulk_execute`. If the function selected by overload resolution does not execute `N` invocations of the function object `F` on the executor `S` in bulk with forward progress guarantee `boost::asio::query(E, execution::bulk_guarantee)`, and the result of that function does not model `sender<void>`, the program is ill-formed with no diagnostic required. 67571 67572 67573* Otherwise, if the types `F` and `executor_index_t<remove_cvref_t<S>>` model `invocable` and if `boost::asio::query(S, execution::bulk_guarantee)` equals `execution::bulk_guarantee.unsequenced`, then 67574 67575 67576* Evaluates `DECAY_COPY(std::forward<decltype(F)>(F))` on the calling thread to create a function object `cf`. [Note: Additional copies of `cf` may subsequently be created. --end note.] 67577 67578 67579 67580 67581* For each value of `i` in `N`, `cf(i)` (or copy of `cf`)) will be invoked at most once by an execution agent that is unique for each value of `i`. 67582 67583 67584 67585 67586* May block pending completion of one or more invocations of `cf`. 67587 67588 67589 67590 67591* Synchronizes with (C++Std [intro.multithread]) the invocations of `cf`. 67592 67593 67594 67595 67596* Otherwise, `execution::bulk_execute(S, F, N)` is ill-formed. 67597 67598 67599 67600[heading Requirements] 67601 67602['Header: ][^boost/asio/execution/bulk_execute.hpp] 67603 67604['Convenience header: ][^boost/asio/execution.hpp] 67605 67606 67607[endsect] 67608 67609 67610 67611[section:execution__bulk_guarantee execution::bulk_guarantee] 67612 67613[indexterm1 boost_asio.indexterm.execution__bulk_guarantee..execution::bulk_guarantee] 67614A special value used for accessing the [link boost_asio.reference.execution__bulk_guarantee_t `execution::bulk_guarantee_t`] property. 67615 67616 67617 constexpr bulk_guarantee_t bulk_guarantee; 67618 67619 67620[heading Requirements] 67621 67622['Header: ][^boost/asio/execution/bulk_guarantee.hpp] 67623 67624['Convenience header: ][^boost/asio/execution.hpp] 67625 67626 67627[endsect] 67628 67629 67630[section:execution__bulk_guarantee_t execution::bulk_guarantee_t] 67631 67632[indexterm1 boost_asio.indexterm.execution__bulk_guarantee_t..execution::bulk_guarantee_t] 67633 67634 67635A property to communicate the forward progress and ordering guarantees of execution agents associated with the bulk execution. 67636 67637 67638 struct bulk_guarantee_t 67639 67640 67641[heading Types] 67642[table 67643 [[Name][Description]] 67644 67645 [ 67646 67647 [[link boost_asio.reference.execution__bulk_guarantee_t__parallel_t [*parallel_t]]] 67648 [A sub-property that indicates that execution agents within the same bulk execution may be parallelised. ] 67649 67650 ] 67651 67652 [ 67653 67654 [[link boost_asio.reference.execution__bulk_guarantee_t__sequenced_t [*sequenced_t]]] 67655 [A sub-property that indicates that execution agents within the same bulk execution may not be parallelised and vectorised. ] 67656 67657 ] 67658 67659 [ 67660 67661 [[link boost_asio.reference.execution__bulk_guarantee_t__unsequenced_t [*unsequenced_t]]] 67662 [A sub-property that indicates that execution agents within the same bulk execution may be parallelised and vectorised. ] 67663 67664 ] 67665 67666 [ 67667 67668 [[link boost_asio.reference.execution__bulk_guarantee_t.polymorphic_query_result_type [*polymorphic_query_result_type]]] 67669 [The type returned by queries against an any_executor. ] 67670 67671 ] 67672 67673] 67674 67675[heading Member Functions] 67676[table 67677 [[Name][Description]] 67678 67679 [ 67680 [[link boost_asio.reference.execution__bulk_guarantee_t.bulk_guarantee_t [*bulk_guarantee_t]] [constructor]] 67681 [Default constructor. 67682 [hr] 67683 Construct from a sub-property value. ] 67684 ] 67685 67686] 67687 67688[heading Data Members] 67689[table 67690 [[Name][Description]] 67691 67692 [ 67693 [[link boost_asio.reference.execution__bulk_guarantee_t.is_applicable_property_v [*is_applicable_property_v]] [static]] 67694 [The bulk_guarantee_t property applies to executors, senders, and schedulers. ] 67695 ] 67696 67697 [ 67698 [[link boost_asio.reference.execution__bulk_guarantee_t.is_preferable [*is_preferable]] [static]] 67699 [The top-level bulk_guarantee_t property cannot be preferred. ] 67700 ] 67701 67702 [ 67703 [[link boost_asio.reference.execution__bulk_guarantee_t.is_requirable [*is_requirable]] [static]] 67704 [The top-level bulk_guarantee_t property cannot be required. ] 67705 ] 67706 67707 [ 67708 [[link boost_asio.reference.execution__bulk_guarantee_t.parallel [*parallel]] [static]] 67709 [A special value used for accessing the bulk_guarantee_t::parallel_t property. ] 67710 ] 67711 67712 [ 67713 [[link boost_asio.reference.execution__bulk_guarantee_t.sequenced [*sequenced]] [static]] 67714 [A special value used for accessing the bulk_guarantee_t::sequenced_t property. ] 67715 ] 67716 67717 [ 67718 [[link boost_asio.reference.execution__bulk_guarantee_t.unsequenced [*unsequenced]] [static]] 67719 [A special value used for accessing the bulk_guarantee_t::unsequenced_t property. ] 67720 ] 67721 67722] 67723 67724[heading Friends] 67725[table 67726 [[Name][Description]] 67727 67728 [ 67729 [[link boost_asio.reference.execution__bulk_guarantee_t.operator_not__eq_ [*operator!=]]] 67730 [Compare property values for inequality. ] 67731 ] 67732 67733 [ 67734 [[link boost_asio.reference.execution__bulk_guarantee_t.operator_eq__eq_ [*operator==]]] 67735 [Compare property values for equality. ] 67736 ] 67737 67738] 67739 67740[heading Requirements] 67741 67742['Header: ][^boost/asio/execution/bulk_guarantee.hpp] 67743 67744['Convenience header: ][^boost/asio/execution.hpp] 67745 67746[section:bulk_guarantee_t execution::bulk_guarantee_t::bulk_guarantee_t] 67747 67748[indexterm2 boost_asio.indexterm.execution__bulk_guarantee_t.bulk_guarantee_t..bulk_guarantee_t..execution::bulk_guarantee_t] 67749Default constructor. 67750 67751 67752 constexpr ``[link boost_asio.reference.execution__bulk_guarantee_t.bulk_guarantee_t.overload1 bulk_guarantee_t]``(); 67753 `` [''''»''' [link boost_asio.reference.execution__bulk_guarantee_t.bulk_guarantee_t.overload1 more...]]`` 67754 67755 67756Construct from a sub-property value. 67757 67758 67759 constexpr ``[link boost_asio.reference.execution__bulk_guarantee_t.bulk_guarantee_t.overload2 bulk_guarantee_t]``( 67760 unsequenced_t ); 67761 `` [''''»''' [link boost_asio.reference.execution__bulk_guarantee_t.bulk_guarantee_t.overload2 more...]]`` 67762 67763 constexpr ``[link boost_asio.reference.execution__bulk_guarantee_t.bulk_guarantee_t.overload3 bulk_guarantee_t]``( 67764 sequenced_t ); 67765 `` [''''»''' [link boost_asio.reference.execution__bulk_guarantee_t.bulk_guarantee_t.overload3 more...]]`` 67766 67767 constexpr ``[link boost_asio.reference.execution__bulk_guarantee_t.bulk_guarantee_t.overload4 bulk_guarantee_t]``( 67768 parallel_t ); 67769 `` [''''»''' [link boost_asio.reference.execution__bulk_guarantee_t.bulk_guarantee_t.overload4 more...]]`` 67770 67771 67772[section:overload1 execution::bulk_guarantee_t::bulk_guarantee_t (1 of 4 overloads)] 67773 67774 67775Default constructor. 67776 67777 67778 constexpr bulk_guarantee_t(); 67779 67780 67781 67782[endsect] 67783 67784 67785 67786[section:overload2 execution::bulk_guarantee_t::bulk_guarantee_t (2 of 4 overloads)] 67787 67788 67789Construct from a sub-property value. 67790 67791 67792 constexpr bulk_guarantee_t( 67793 unsequenced_t ); 67794 67795 67796 67797[endsect] 67798 67799 67800 67801[section:overload3 execution::bulk_guarantee_t::bulk_guarantee_t (3 of 4 overloads)] 67802 67803 67804Construct from a sub-property value. 67805 67806 67807 constexpr bulk_guarantee_t( 67808 sequenced_t ); 67809 67810 67811 67812[endsect] 67813 67814 67815 67816[section:overload4 execution::bulk_guarantee_t::bulk_guarantee_t (4 of 4 overloads)] 67817 67818 67819Construct from a sub-property value. 67820 67821 67822 constexpr bulk_guarantee_t( 67823 parallel_t ); 67824 67825 67826 67827[endsect] 67828 67829 67830[endsect] 67831 67832 67833[section:is_applicable_property_v execution::bulk_guarantee_t::is_applicable_property_v] 67834 67835[indexterm2 boost_asio.indexterm.execution__bulk_guarantee_t.is_applicable_property_v..is_applicable_property_v..execution::bulk_guarantee_t] 67836The [link boost_asio.reference.execution__bulk_guarantee_t `execution::bulk_guarantee_t`] property applies to executors, senders, and schedulers. 67837 67838 67839 template <typename T> 67840 static constexpr bool is_applicable_property_v = 67841 is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>; 67842 67843 67844 67845[endsect] 67846 67847 67848 67849[section:is_preferable execution::bulk_guarantee_t::is_preferable] 67850 67851[indexterm2 boost_asio.indexterm.execution__bulk_guarantee_t.is_preferable..is_preferable..execution::bulk_guarantee_t] 67852The top-level [link boost_asio.reference.execution__bulk_guarantee_t `execution::bulk_guarantee_t`] property cannot be preferred. 67853 67854 67855 static constexpr bool is_preferable = false; 67856 67857 67858 67859[endsect] 67860 67861 67862 67863[section:is_requirable execution::bulk_guarantee_t::is_requirable] 67864 67865[indexterm2 boost_asio.indexterm.execution__bulk_guarantee_t.is_requirable..is_requirable..execution::bulk_guarantee_t] 67866The top-level [link boost_asio.reference.execution__bulk_guarantee_t `execution::bulk_guarantee_t`] property cannot be required. 67867 67868 67869 static constexpr bool is_requirable = false; 67870 67871 67872 67873[endsect] 67874 67875 67876 67877[section:operator_not__eq_ execution::bulk_guarantee_t::operator!=] 67878 67879[indexterm2 boost_asio.indexterm.execution__bulk_guarantee_t.operator_not__eq_..operator!=..execution::bulk_guarantee_t] 67880Compare property values for inequality. 67881 67882 67883 friend constexpr bool operator!=( 67884 const bulk_guarantee_t & a, 67885 const bulk_guarantee_t & b); 67886 67887 67888[heading Requirements] 67889 67890['Header: ][^boost/asio/execution/bulk_guarantee.hpp] 67891 67892['Convenience header: ][^boost/asio/execution.hpp] 67893 67894 67895[endsect] 67896 67897 67898 67899[section:operator_eq__eq_ execution::bulk_guarantee_t::operator==] 67900 67901[indexterm2 boost_asio.indexterm.execution__bulk_guarantee_t.operator_eq__eq_..operator==..execution::bulk_guarantee_t] 67902Compare property values for equality. 67903 67904 67905 friend constexpr bool operator==( 67906 const bulk_guarantee_t & a, 67907 const bulk_guarantee_t & b); 67908 67909 67910[heading Requirements] 67911 67912['Header: ][^boost/asio/execution/bulk_guarantee.hpp] 67913 67914['Convenience header: ][^boost/asio/execution.hpp] 67915 67916 67917[endsect] 67918 67919 67920 67921[section:parallel execution::bulk_guarantee_t::parallel] 67922 67923[indexterm2 boost_asio.indexterm.execution__bulk_guarantee_t.parallel..parallel..execution::bulk_guarantee_t] 67924A special value used for accessing the [link boost_asio.reference.execution__bulk_guarantee_t__parallel_t `execution::bulk_guarantee_t::parallel_t`] property. 67925 67926 67927 static constexpr parallel_t parallel; 67928 67929 67930 67931[endsect] 67932 67933 67934 67935[section:polymorphic_query_result_type execution::bulk_guarantee_t::polymorphic_query_result_type] 67936 67937[indexterm2 boost_asio.indexterm.execution__bulk_guarantee_t.polymorphic_query_result_type..polymorphic_query_result_type..execution::bulk_guarantee_t] 67938The type returned by queries against an `any_executor`. 67939 67940 67941 typedef bulk_guarantee_t polymorphic_query_result_type; 67942 67943 67944 67945[heading Requirements] 67946 67947['Header: ][^boost/asio/execution/bulk_guarantee.hpp] 67948 67949['Convenience header: ][^boost/asio/execution.hpp] 67950 67951 67952[endsect] 67953 67954 67955 67956[section:sequenced execution::bulk_guarantee_t::sequenced] 67957 67958[indexterm2 boost_asio.indexterm.execution__bulk_guarantee_t.sequenced..sequenced..execution::bulk_guarantee_t] 67959A special value used for accessing the [link boost_asio.reference.execution__bulk_guarantee_t__sequenced_t `execution::bulk_guarantee_t::sequenced_t`] property. 67960 67961 67962 static constexpr sequenced_t sequenced; 67963 67964 67965 67966[endsect] 67967 67968 67969 67970[section:unsequenced execution::bulk_guarantee_t::unsequenced] 67971 67972[indexterm2 boost_asio.indexterm.execution__bulk_guarantee_t.unsequenced..unsequenced..execution::bulk_guarantee_t] 67973A special value used for accessing the [link boost_asio.reference.execution__bulk_guarantee_t__unsequenced_t `execution::bulk_guarantee_t::unsequenced_t`] property. 67974 67975 67976 static constexpr unsequenced_t unsequenced; 67977 67978 67979 67980[endsect] 67981 67982 67983 67984[endsect] 67985 67986[section:execution__bulk_guarantee_t__parallel_t execution::bulk_guarantee_t::parallel_t] 67987 67988[indexterm1 boost_asio.indexterm.execution__bulk_guarantee_t__parallel_t..execution::bulk_guarantee_t::parallel_t] 67989 67990 67991A sub-property that indicates that execution agents within the same bulk execution may be parallelised. 67992 67993 67994 struct parallel_t 67995 67996 67997[heading Types] 67998[table 67999 [[Name][Description]] 68000 68001 [ 68002 68003 [[link boost_asio.reference.execution__bulk_guarantee_t__parallel_t.polymorphic_query_result_type [*polymorphic_query_result_type]]] 68004 [The type returned by queries against an any_executor. ] 68005 68006 ] 68007 68008] 68009 68010[heading Member Functions] 68011[table 68012 [[Name][Description]] 68013 68014 [ 68015 [[link boost_asio.reference.execution__bulk_guarantee_t__parallel_t.parallel_t [*parallel_t]] [constructor]] 68016 [Default constructor. ] 68017 ] 68018 68019 [ 68020 [[link boost_asio.reference.execution__bulk_guarantee_t__parallel_t.value [*value]] [static]] 68021 [Get the value associated with a property object. ] 68022 ] 68023 68024] 68025 68026[heading Data Members] 68027[table 68028 [[Name][Description]] 68029 68030 [ 68031 [[link boost_asio.reference.execution__bulk_guarantee_t__parallel_t.is_applicable_property_v [*is_applicable_property_v]] [static]] 68032 [The bulk_guarantee_t::parallel_t property applies to executors, senders, and schedulers. ] 68033 ] 68034 68035 [ 68036 [[link boost_asio.reference.execution__bulk_guarantee_t__parallel_t.is_preferable [*is_preferable]] [static]] 68037 [The bulk_guarantee_t::parallel_t property can be preferred. ] 68038 ] 68039 68040 [ 68041 [[link boost_asio.reference.execution__bulk_guarantee_t__parallel_t.is_requirable [*is_requirable]] [static]] 68042 [The bulk_guarantee_t::parallel_t property can be required. ] 68043 ] 68044 68045] 68046 68047[heading Requirements] 68048 68049['Header: ][^boost/asio/execution/bulk_guarantee.hpp] 68050 68051['Convenience header: ][^boost/asio/execution.hpp] 68052 68053 68054[section:is_applicable_property_v execution::bulk_guarantee_t::parallel_t::is_applicable_property_v] 68055 68056[indexterm2 boost_asio.indexterm.execution__bulk_guarantee_t__parallel_t.is_applicable_property_v..is_applicable_property_v..execution::bulk_guarantee_t::parallel_t] 68057The [link boost_asio.reference.execution__bulk_guarantee_t__parallel_t `execution::bulk_guarantee_t::parallel_t`] property applies to executors, senders, and schedulers. 68058 68059 68060 template <typename T> 68061 static constexpr bool is_applicable_property_v = 68062 is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>; 68063 68064 68065 68066[endsect] 68067 68068 68069 68070[section:is_preferable execution::bulk_guarantee_t::parallel_t::is_preferable] 68071 68072[indexterm2 boost_asio.indexterm.execution__bulk_guarantee_t__parallel_t.is_preferable..is_preferable..execution::bulk_guarantee_t::parallel_t] 68073The [link boost_asio.reference.execution__bulk_guarantee_t__parallel_t `execution::bulk_guarantee_t::parallel_t`] property can be preferred. 68074 68075 68076 static constexpr bool is_preferable = true; 68077 68078 68079 68080[endsect] 68081 68082 68083 68084[section:is_requirable execution::bulk_guarantee_t::parallel_t::is_requirable] 68085 68086[indexterm2 boost_asio.indexterm.execution__bulk_guarantee_t__parallel_t.is_requirable..is_requirable..execution::bulk_guarantee_t::parallel_t] 68087The [link boost_asio.reference.execution__bulk_guarantee_t__parallel_t `execution::bulk_guarantee_t::parallel_t`] property can be required. 68088 68089 68090 static constexpr bool is_requirable = true; 68091 68092 68093 68094[endsect] 68095 68096 68097 68098[section:parallel_t execution::bulk_guarantee_t::parallel_t::parallel_t] 68099 68100[indexterm2 boost_asio.indexterm.execution__bulk_guarantee_t__parallel_t.parallel_t..parallel_t..execution::bulk_guarantee_t::parallel_t] 68101Default constructor. 68102 68103 68104 constexpr parallel_t(); 68105 68106 68107 68108[endsect] 68109 68110 68111 68112[section:polymorphic_query_result_type execution::bulk_guarantee_t::parallel_t::polymorphic_query_result_type] 68113 68114[indexterm2 boost_asio.indexterm.execution__bulk_guarantee_t__parallel_t.polymorphic_query_result_type..polymorphic_query_result_type..execution::bulk_guarantee_t::parallel_t] 68115The type returned by queries against an `any_executor`. 68116 68117 68118 typedef bulk_guarantee_t polymorphic_query_result_type; 68119 68120 68121 68122[heading Requirements] 68123 68124['Header: ][^boost/asio/execution/bulk_guarantee.hpp] 68125 68126['Convenience header: ][^boost/asio/execution.hpp] 68127 68128 68129[endsect] 68130 68131 68132 68133[section:value execution::bulk_guarantee_t::parallel_t::value] 68134 68135[indexterm2 boost_asio.indexterm.execution__bulk_guarantee_t__parallel_t.value..value..execution::bulk_guarantee_t::parallel_t] 68136Get the value associated with a property object. 68137 68138 68139 static constexpr bulk_guarantee_t value(); 68140 68141 68142 68143[heading Return Value] 68144 68145`parallel_t()`; 68146 68147 68148 68149 68150[endsect] 68151 68152 68153 68154[endsect] 68155 68156[section:execution__bulk_guarantee_t__sequenced_t execution::bulk_guarantee_t::sequenced_t] 68157 68158[indexterm1 boost_asio.indexterm.execution__bulk_guarantee_t__sequenced_t..execution::bulk_guarantee_t::sequenced_t] 68159 68160 68161A sub-property that indicates that execution agents within the same bulk execution may not be parallelised and vectorised. 68162 68163 68164 struct sequenced_t 68165 68166 68167[heading Types] 68168[table 68169 [[Name][Description]] 68170 68171 [ 68172 68173 [[link boost_asio.reference.execution__bulk_guarantee_t__sequenced_t.polymorphic_query_result_type [*polymorphic_query_result_type]]] 68174 [The type returned by queries against an any_executor. ] 68175 68176 ] 68177 68178] 68179 68180[heading Member Functions] 68181[table 68182 [[Name][Description]] 68183 68184 [ 68185 [[link boost_asio.reference.execution__bulk_guarantee_t__sequenced_t.sequenced_t [*sequenced_t]] [constructor]] 68186 [Default constructor. ] 68187 ] 68188 68189 [ 68190 [[link boost_asio.reference.execution__bulk_guarantee_t__sequenced_t.value [*value]] [static]] 68191 [Get the value associated with a property object. ] 68192 ] 68193 68194] 68195 68196[heading Data Members] 68197[table 68198 [[Name][Description]] 68199 68200 [ 68201 [[link boost_asio.reference.execution__bulk_guarantee_t__sequenced_t.is_applicable_property_v [*is_applicable_property_v]] [static]] 68202 [The bulk_guarantee_t::sequenced_t property applies to executors, senders, and schedulers. ] 68203 ] 68204 68205 [ 68206 [[link boost_asio.reference.execution__bulk_guarantee_t__sequenced_t.is_preferable [*is_preferable]] [static]] 68207 [The bulk_guarantee_t::sequenced_t property can be preferred. ] 68208 ] 68209 68210 [ 68211 [[link boost_asio.reference.execution__bulk_guarantee_t__sequenced_t.is_requirable [*is_requirable]] [static]] 68212 [The bulk_guarantee_t::sequenced_t property can be required. ] 68213 ] 68214 68215] 68216 68217[heading Requirements] 68218 68219['Header: ][^boost/asio/execution/bulk_guarantee.hpp] 68220 68221['Convenience header: ][^boost/asio/execution.hpp] 68222 68223 68224[section:is_applicable_property_v execution::bulk_guarantee_t::sequenced_t::is_applicable_property_v] 68225 68226[indexterm2 boost_asio.indexterm.execution__bulk_guarantee_t__sequenced_t.is_applicable_property_v..is_applicable_property_v..execution::bulk_guarantee_t::sequenced_t] 68227The [link boost_asio.reference.execution__bulk_guarantee_t__sequenced_t `execution::bulk_guarantee_t::sequenced_t`] property applies to executors, senders, and schedulers. 68228 68229 68230 template <typename T> 68231 static constexpr bool is_applicable_property_v = 68232 is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>; 68233 68234 68235 68236[endsect] 68237 68238 68239 68240[section:is_preferable execution::bulk_guarantee_t::sequenced_t::is_preferable] 68241 68242[indexterm2 boost_asio.indexterm.execution__bulk_guarantee_t__sequenced_t.is_preferable..is_preferable..execution::bulk_guarantee_t::sequenced_t] 68243The [link boost_asio.reference.execution__bulk_guarantee_t__sequenced_t `execution::bulk_guarantee_t::sequenced_t`] property can be preferred. 68244 68245 68246 static constexpr bool is_preferable = true; 68247 68248 68249 68250[endsect] 68251 68252 68253 68254[section:is_requirable execution::bulk_guarantee_t::sequenced_t::is_requirable] 68255 68256[indexterm2 boost_asio.indexterm.execution__bulk_guarantee_t__sequenced_t.is_requirable..is_requirable..execution::bulk_guarantee_t::sequenced_t] 68257The [link boost_asio.reference.execution__bulk_guarantee_t__sequenced_t `execution::bulk_guarantee_t::sequenced_t`] property can be required. 68258 68259 68260 static constexpr bool is_requirable = true; 68261 68262 68263 68264[endsect] 68265 68266 68267 68268[section:polymorphic_query_result_type execution::bulk_guarantee_t::sequenced_t::polymorphic_query_result_type] 68269 68270[indexterm2 boost_asio.indexterm.execution__bulk_guarantee_t__sequenced_t.polymorphic_query_result_type..polymorphic_query_result_type..execution::bulk_guarantee_t::sequenced_t] 68271The type returned by queries against an `any_executor`. 68272 68273 68274 typedef bulk_guarantee_t polymorphic_query_result_type; 68275 68276 68277 68278[heading Requirements] 68279 68280['Header: ][^boost/asio/execution/bulk_guarantee.hpp] 68281 68282['Convenience header: ][^boost/asio/execution.hpp] 68283 68284 68285[endsect] 68286 68287 68288 68289[section:sequenced_t execution::bulk_guarantee_t::sequenced_t::sequenced_t] 68290 68291[indexterm2 boost_asio.indexterm.execution__bulk_guarantee_t__sequenced_t.sequenced_t..sequenced_t..execution::bulk_guarantee_t::sequenced_t] 68292Default constructor. 68293 68294 68295 constexpr sequenced_t(); 68296 68297 68298 68299[endsect] 68300 68301 68302 68303[section:value execution::bulk_guarantee_t::sequenced_t::value] 68304 68305[indexterm2 boost_asio.indexterm.execution__bulk_guarantee_t__sequenced_t.value..value..execution::bulk_guarantee_t::sequenced_t] 68306Get the value associated with a property object. 68307 68308 68309 static constexpr bulk_guarantee_t value(); 68310 68311 68312 68313[heading Return Value] 68314 68315`sequenced_t()`; 68316 68317 68318 68319 68320[endsect] 68321 68322 68323 68324[endsect] 68325 68326[section:execution__bulk_guarantee_t__unsequenced_t execution::bulk_guarantee_t::unsequenced_t] 68327 68328[indexterm1 boost_asio.indexterm.execution__bulk_guarantee_t__unsequenced_t..execution::bulk_guarantee_t::unsequenced_t] 68329 68330 68331A sub-property that indicates that execution agents within the same bulk execution may be parallelised and vectorised. 68332 68333 68334 struct unsequenced_t 68335 68336 68337[heading Types] 68338[table 68339 [[Name][Description]] 68340 68341 [ 68342 68343 [[link boost_asio.reference.execution__bulk_guarantee_t__unsequenced_t.polymorphic_query_result_type [*polymorphic_query_result_type]]] 68344 [The type returned by queries against an any_executor. ] 68345 68346 ] 68347 68348] 68349 68350[heading Member Functions] 68351[table 68352 [[Name][Description]] 68353 68354 [ 68355 [[link boost_asio.reference.execution__bulk_guarantee_t__unsequenced_t.unsequenced_t [*unsequenced_t]] [constructor]] 68356 [Default constructor. ] 68357 ] 68358 68359 [ 68360 [[link boost_asio.reference.execution__bulk_guarantee_t__unsequenced_t.value [*value]] [static]] 68361 [Get the value associated with a property object. ] 68362 ] 68363 68364] 68365 68366[heading Data Members] 68367[table 68368 [[Name][Description]] 68369 68370 [ 68371 [[link boost_asio.reference.execution__bulk_guarantee_t__unsequenced_t.is_applicable_property_v [*is_applicable_property_v]] [static]] 68372 [The bulk_guarantee_t::unsequenced_t property applies to executors, senders, and schedulers. ] 68373 ] 68374 68375 [ 68376 [[link boost_asio.reference.execution__bulk_guarantee_t__unsequenced_t.is_preferable [*is_preferable]] [static]] 68377 [The bulk_guarantee_t::unsequenced_t property can be preferred. ] 68378 ] 68379 68380 [ 68381 [[link boost_asio.reference.execution__bulk_guarantee_t__unsequenced_t.is_requirable [*is_requirable]] [static]] 68382 [The bulk_guarantee_t::unsequenced_t property can be required. ] 68383 ] 68384 68385] 68386 68387[heading Requirements] 68388 68389['Header: ][^boost/asio/execution/bulk_guarantee.hpp] 68390 68391['Convenience header: ][^boost/asio/execution.hpp] 68392 68393 68394[section:is_applicable_property_v execution::bulk_guarantee_t::unsequenced_t::is_applicable_property_v] 68395 68396[indexterm2 boost_asio.indexterm.execution__bulk_guarantee_t__unsequenced_t.is_applicable_property_v..is_applicable_property_v..execution::bulk_guarantee_t::unsequenced_t] 68397The [link boost_asio.reference.execution__bulk_guarantee_t__unsequenced_t `execution::bulk_guarantee_t::unsequenced_t`] property applies to executors, senders, and schedulers. 68398 68399 68400 template <typename T> 68401 static constexpr bool is_applicable_property_v = 68402 is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>; 68403 68404 68405 68406[endsect] 68407 68408 68409 68410[section:is_preferable execution::bulk_guarantee_t::unsequenced_t::is_preferable] 68411 68412[indexterm2 boost_asio.indexterm.execution__bulk_guarantee_t__unsequenced_t.is_preferable..is_preferable..execution::bulk_guarantee_t::unsequenced_t] 68413The [link boost_asio.reference.execution__bulk_guarantee_t__unsequenced_t `execution::bulk_guarantee_t::unsequenced_t`] property can be preferred. 68414 68415 68416 static constexpr bool is_preferable = true; 68417 68418 68419 68420[endsect] 68421 68422 68423 68424[section:is_requirable execution::bulk_guarantee_t::unsequenced_t::is_requirable] 68425 68426[indexterm2 boost_asio.indexterm.execution__bulk_guarantee_t__unsequenced_t.is_requirable..is_requirable..execution::bulk_guarantee_t::unsequenced_t] 68427The [link boost_asio.reference.execution__bulk_guarantee_t__unsequenced_t `execution::bulk_guarantee_t::unsequenced_t`] property can be required. 68428 68429 68430 static constexpr bool is_requirable = true; 68431 68432 68433 68434[endsect] 68435 68436 68437 68438[section:polymorphic_query_result_type execution::bulk_guarantee_t::unsequenced_t::polymorphic_query_result_type] 68439 68440[indexterm2 boost_asio.indexterm.execution__bulk_guarantee_t__unsequenced_t.polymorphic_query_result_type..polymorphic_query_result_type..execution::bulk_guarantee_t::unsequenced_t] 68441The type returned by queries against an `any_executor`. 68442 68443 68444 typedef bulk_guarantee_t polymorphic_query_result_type; 68445 68446 68447 68448[heading Requirements] 68449 68450['Header: ][^boost/asio/execution/bulk_guarantee.hpp] 68451 68452['Convenience header: ][^boost/asio/execution.hpp] 68453 68454 68455[endsect] 68456 68457 68458 68459[section:unsequenced_t execution::bulk_guarantee_t::unsequenced_t::unsequenced_t] 68460 68461[indexterm2 boost_asio.indexterm.execution__bulk_guarantee_t__unsequenced_t.unsequenced_t..unsequenced_t..execution::bulk_guarantee_t::unsequenced_t] 68462Default constructor. 68463 68464 68465 constexpr unsequenced_t(); 68466 68467 68468 68469[endsect] 68470 68471 68472 68473[section:value execution::bulk_guarantee_t::unsequenced_t::value] 68474 68475[indexterm2 boost_asio.indexterm.execution__bulk_guarantee_t__unsequenced_t.value..value..execution::bulk_guarantee_t::unsequenced_t] 68476Get the value associated with a property object. 68477 68478 68479 static constexpr bulk_guarantee_t value(); 68480 68481 68482 68483[heading Return Value] 68484 68485`unsequenced_t()`; 68486 68487 68488 68489 68490[endsect] 68491 68492 68493 68494[endsect] 68495 68496[section:execution__can_bulk_execute execution::can_bulk_execute] 68497 68498[indexterm1 boost_asio.indexterm.execution__can_bulk_execute..execution::can_bulk_execute] 68499 68500 68501A type trait that determines whether a `bulk_execute` expression is well-formed. 68502 68503 68504 template< 68505 typename S, 68506 typename F, 68507 typename N> 68508 struct can_bulk_execute 68509 68510 68511Class template `can_bulk_execute` is a trait that is derived from `true_type` if the expression `execution::bulk_execute(std::declval<S>(), std::declval<F>(), std::declval<N>)` is well formed; otherwise `false_type`. 68512 68513[heading Requirements] 68514 68515['Header: ][^boost/asio/execution/bulk_execute.hpp] 68516 68517['Convenience header: ][^boost/asio/execution.hpp] 68518 68519 68520[endsect] 68521 68522[section:execution__can_connect execution::can_connect] 68523 68524[indexterm1 boost_asio.indexterm.execution__can_connect..execution::can_connect] 68525 68526 68527A type trait that determines whether a `connect` expression is well-formed. 68528 68529 68530 template< 68531 typename S, 68532 typename R> 68533 struct can_connect 68534 68535 68536Class template `can_connect` is a trait that is derived from `true_type` if the expression `execution::connect(std::declval<S>(), std::declval<R>())` is well formed; otherwise `false_type`. 68537 68538[heading Requirements] 68539 68540['Header: ][^boost/asio/execution/connect.hpp] 68541 68542['Convenience header: ][^boost/asio/execution.hpp] 68543 68544 68545[endsect] 68546 68547[section:execution__can_execute execution::can_execute] 68548 68549[indexterm1 boost_asio.indexterm.execution__can_execute..execution::can_execute] 68550 68551 68552A type trait that determines whether a `execute` expression is well-formed. 68553 68554 68555 template< 68556 typename T, 68557 typename F> 68558 struct can_execute 68559 68560 68561Class template `can_execute` is a trait that is derived from `true_type` if the expression `execution::execute(std::declval<T>(), std::declval<F>())` is well formed; otherwise `false_type`. 68562 68563[heading Requirements] 68564 68565['Header: ][^boost/asio/execution/execute.hpp] 68566 68567['Convenience header: ][^boost/asio/execution.hpp] 68568 68569 68570[endsect] 68571 68572[section:execution__can_schedule execution::can_schedule] 68573 68574[indexterm1 boost_asio.indexterm.execution__can_schedule..execution::can_schedule] 68575 68576 68577A type trait that determines whether a `schedule` expression is well-formed. 68578 68579 68580 template< 68581 typename S> 68582 struct can_schedule 68583 68584 68585Class template `can_schedule` is a trait that is derived from `true_type` if the expression `execution::schedule(std::declval<S>())` is well formed; otherwise `false_type`. 68586 68587[heading Requirements] 68588 68589['Header: ][^boost/asio/execution/schedule.hpp] 68590 68591['Convenience header: ][^boost/asio/execution.hpp] 68592 68593 68594[endsect] 68595 68596[section:execution__can_set_done execution::can_set_done] 68597 68598[indexterm1 boost_asio.indexterm.execution__can_set_done..execution::can_set_done] 68599 68600 68601A type trait that determines whether a `set_done` expression is well-formed. 68602 68603 68604 template< 68605 typename R> 68606 struct can_set_done 68607 68608 68609Class template `can_set_done` is a trait that is derived from `true_type` if the expression `execution::set_done(std::declval<R>(), std::declval<E>())` is well formed; otherwise `false_type`. 68610 68611[heading Requirements] 68612 68613['Header: ][^boost/asio/execution/set_done.hpp] 68614 68615['Convenience header: ][^boost/asio/execution.hpp] 68616 68617 68618[endsect] 68619 68620[section:execution__can_set_error execution::can_set_error] 68621 68622[indexterm1 boost_asio.indexterm.execution__can_set_error..execution::can_set_error] 68623 68624 68625A type trait that determines whether a `set_error` expression is well-formed. 68626 68627 68628 template< 68629 typename R, 68630 typename E> 68631 struct can_set_error 68632 68633 68634Class template `can_set_error` is a trait that is derived from `true_type` if the expression `execution::set_error(std::declval<R>(), std::declval<E>())` is well formed; otherwise `false_type`. 68635 68636[heading Requirements] 68637 68638['Header: ][^boost/asio/execution/set_error.hpp] 68639 68640['Convenience header: ][^boost/asio/execution.hpp] 68641 68642 68643[endsect] 68644 68645[section:execution__can_set_value execution::can_set_value] 68646 68647[indexterm1 boost_asio.indexterm.execution__can_set_value..execution::can_set_value] 68648 68649 68650A type trait that determines whether a `set_value` expression is well-formed. 68651 68652 68653 template< 68654 typename R, 68655 typename... Vs> 68656 struct can_set_value 68657 68658 68659Class template `can_set_value` is a trait that is derived from `true_type` if the expression `execution::set_value(std::declval<R>(), std::declval<Vs>()...)` is well formed; otherwise `false_type`. 68660 68661[heading Requirements] 68662 68663['Header: ][^boost/asio/execution/set_value.hpp] 68664 68665['Convenience header: ][^boost/asio/execution.hpp] 68666 68667 68668[endsect] 68669 68670[section:execution__can_start execution::can_start] 68671 68672[indexterm1 boost_asio.indexterm.execution__can_start..execution::can_start] 68673 68674 68675A type trait that determines whether a `start` expression is well-formed. 68676 68677 68678 template< 68679 typename R> 68680 struct can_start 68681 68682 68683Class template `can_start` is a trait that is derived from `true_type` if the expression `execution::start(std::declval<R>(), std::declval<E>())` is well formed; otherwise `false_type`. 68684 68685[heading Requirements] 68686 68687['Header: ][^boost/asio/execution/start.hpp] 68688 68689['Convenience header: ][^boost/asio/execution.hpp] 68690 68691 68692[endsect] 68693 68694[section:execution__can_submit execution::can_submit] 68695 68696[indexterm1 boost_asio.indexterm.execution__can_submit..execution::can_submit] 68697 68698 68699A type trait that determines whether a `submit` expression is well-formed. 68700 68701 68702 template< 68703 typename S, 68704 typename R> 68705 struct can_submit 68706 68707 68708Class template `can_submit` is a trait that is derived from `true_type` if the expression `execution::submit(std::declval<R>(), std::declval<E>())` is well formed; otherwise `false_type`. 68709 68710[heading Requirements] 68711 68712['Header: ][^boost/asio/execution/submit.hpp] 68713 68714['Convenience header: ][^boost/asio/execution.hpp] 68715 68716 68717[endsect] 68718 68719 68720[section:execution__connect execution::connect] 68721 68722[indexterm1 boost_asio.indexterm.execution__connect..execution::connect] 68723A customisation point that connects a sender to a receiver. 68724 68725 68726 constexpr unspecified connect = unspecified; 68727 68728 68729The name `execution::connect` denotes a customisation point object. For some subexpressions `s` and `r`, let `S` be a type such that `decltype((s))` is `S` and let `R` be a type such that `decltype((r))` is `R`. The expression `execution::connect(s, r)` is expression-equivalent to: 68730 68731 68732* `s.connect(r)`, if that expression is valid, if its type satisfies `operation_state`, and if `S` satisfies `sender`. 68733 68734 68735* Otherwise, `connect(s, r)`, if that expression is valid, if its type satisfies `operation_state`, and if `S` satisfies `sender`, with overload resolution performed in a context that includes the declaration `void connect();` and that does not include a declaration of `execution::connect`. 68736 68737 68738* Otherwise, `as_operation{s, r}`, if `r` is not an instance of `as_receiver<F, S>` for some type `F`, and if `receiver_of<R> && executor_of<remove_cvref_t<S>, as_invocable<remove_cvref_t<R>, S>>` is `true`, where `as_operation` is an implementation-defined class equivalent to 68739 68740 template <class S, class R> 68741 struct as_operation 68742 { 68743 remove_cvref_t<S> e_; 68744 remove_cvref_t<R> r_; 68745 void start() noexcept try { 68746 execution::execute(std::move(e_), 68747 as_invocable<remove_cvref_t<R>, S>{r_}); 68748 } catch(...) { 68749 execution::set_error(std::move(r_), current_exception()); 68750 } 68751 }; 68752 68753 68754and `as_invocable` is a class template equivalent to the following: 68755 68756 template<class R> 68757 struct as_invocable 68758 { 68759 R* r_; 68760 explicit as_invocable(R& r) noexcept 68761 : r_(std::addressof(r)) {} 68762 as_invocable(as_invocable && other) noexcept 68763 : r_(std::exchange(other.r_, nullptr)) {} 68764 ~as_invocable() { 68765 if(r_) 68766 execution::set_done(std::move(*r_)); 68767 } 68768 void operator()() & noexcept try { 68769 execution::set_value(std::move(*r_)); 68770 r_ = nullptr; 68771 } catch(...) { 68772 execution::set_error(std::move(*r_), current_exception()); 68773 r_ = nullptr; 68774 } 68775 }; 68776 68777 68778 68779 68780 68781* Otherwise, `execution::connect(s, r)` is ill-formed. 68782 68783 68784 68785[heading Requirements] 68786 68787['Header: ][^boost/asio/execution/connect.hpp] 68788 68789['Convenience header: ][^boost/asio/execution.hpp] 68790 68791 68792[endsect] 68793 68794 68795[section:execution__connect_result execution::connect_result] 68796 68797[indexterm1 boost_asio.indexterm.execution__connect_result..execution::connect_result] 68798 68799 68800A type trait to determine the result of a `connect` expression. 68801 68802 68803 template< 68804 typename S, 68805 typename R> 68806 struct connect_result 68807 68808 68809[heading Types] 68810[table 68811 [[Name][Description]] 68812 68813 [ 68814 68815 [[link boost_asio.reference.execution__connect_result.type [*type]]] 68816 [The type of the connect expression. ] 68817 68818 ] 68819 68820] 68821 68822[heading Requirements] 68823 68824['Header: ][^boost/asio/execution/connect.hpp] 68825 68826['Convenience header: ][^boost/asio/execution.hpp] 68827 68828 68829[section:type execution::connect_result::type] 68830 68831[indexterm2 boost_asio.indexterm.execution__connect_result.type..type..execution::connect_result] 68832The type of the connect expression. 68833 68834 68835 typedef automatically_determined type; 68836 68837 68838 68839The type of the expression `execution::connect(std::declval<S>(), std::declval<R>())`. 68840 68841[heading Requirements] 68842 68843['Header: ][^boost/asio/execution/connect.hpp] 68844 68845['Convenience header: ][^boost/asio/execution.hpp] 68846 68847 68848[endsect] 68849 68850 68851 68852[endsect] 68853 68854 68855[section:execution__context execution::context] 68856 68857[indexterm1 boost_asio.indexterm.execution__context..execution::context] 68858A special value used for accessing the [link boost_asio.reference.execution__context_t `execution::context_t`] property. 68859 68860 68861 constexpr context_t context; 68862 68863 68864[heading Requirements] 68865 68866['Header: ][^boost/asio/execution/context.hpp] 68867 68868['Convenience header: ][^boost/asio/execution.hpp] 68869 68870 68871[endsect] 68872 68873 68874 68875[section:execution__context_as execution::context_as] 68876 68877[indexterm1 boost_asio.indexterm.execution__context_as..execution::context_as] 68878A special value used for accessing the [link boost_asio.reference.execution__context_as_t `execution::context_as_t`] property. 68879 68880 68881 template <typename U> 68882 constexpr context_as_t context_as; 68883 68884 68885[heading Requirements] 68886 68887['Header: ][^boost/asio/execution/context_as.hpp] 68888 68889['Convenience header: ][^boost/asio/execution.hpp] 68890 68891 68892[endsect] 68893 68894 68895[section:execution__context_as_t execution::context_as_t] 68896 68897[indexterm1 boost_asio.indexterm.execution__context_as_t..execution::context_as_t] 68898 68899 68900A property that is used to obtain the execution context that is associated with an executor. 68901 68902 68903 template< 68904 typename U> 68905 struct context_as_t 68906 68907 68908[heading Types] 68909[table 68910 [[Name][Description]] 68911 68912 [ 68913 68914 [[link boost_asio.reference.execution__context_as_t.polymorphic_query_result_type [*polymorphic_query_result_type]]] 68915 [The type returned by queries against an any_executor. ] 68916 68917 ] 68918 68919] 68920 68921[heading Data Members] 68922[table 68923 [[Name][Description]] 68924 68925 [ 68926 [[link boost_asio.reference.execution__context_as_t.is_applicable_property_v [*is_applicable_property_v]] [static]] 68927 [The context_as_t property applies to executors, senders, and schedulers. ] 68928 ] 68929 68930 [ 68931 [[link boost_asio.reference.execution__context_as_t.is_preferable [*is_preferable]] [static]] 68932 [The context_t property cannot be preferred. ] 68933 ] 68934 68935 [ 68936 [[link boost_asio.reference.execution__context_as_t.is_requirable [*is_requirable]] [static]] 68937 [The context_t property cannot be required. ] 68938 ] 68939 68940] 68941 68942[heading Requirements] 68943 68944['Header: ][^boost/asio/execution/context_as.hpp] 68945 68946['Convenience header: ][^boost/asio/execution.hpp] 68947 68948 68949[section:is_applicable_property_v execution::context_as_t::is_applicable_property_v] 68950 68951[indexterm2 boost_asio.indexterm.execution__context_as_t.is_applicable_property_v..is_applicable_property_v..execution::context_as_t] 68952The [link boost_asio.reference.execution__context_as_t `execution::context_as_t`] property applies to executors, senders, and schedulers. 68953 68954 68955 template <typename T> 68956 static constexpr bool is_applicable_property_v = 68957 is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>; 68958 68959 68960 68961[endsect] 68962 68963 68964 68965[section:is_preferable execution::context_as_t::is_preferable] 68966 68967[indexterm2 boost_asio.indexterm.execution__context_as_t.is_preferable..is_preferable..execution::context_as_t] 68968The [link boost_asio.reference.execution__context_t `execution::context_t`] property cannot be preferred. 68969 68970 68971 static constexpr bool is_preferable = false; 68972 68973 68974 68975[endsect] 68976 68977 68978 68979[section:is_requirable execution::context_as_t::is_requirable] 68980 68981[indexterm2 boost_asio.indexterm.execution__context_as_t.is_requirable..is_requirable..execution::context_as_t] 68982The [link boost_asio.reference.execution__context_t `execution::context_t`] property cannot be required. 68983 68984 68985 static constexpr bool is_requirable = false; 68986 68987 68988 68989[endsect] 68990 68991 68992 68993[section:polymorphic_query_result_type execution::context_as_t::polymorphic_query_result_type] 68994 68995[indexterm2 boost_asio.indexterm.execution__context_as_t.polymorphic_query_result_type..polymorphic_query_result_type..execution::context_as_t] 68996The type returned by queries against an `any_executor`. 68997 68998 68999 typedef T polymorphic_query_result_type; 69000 69001 69002 69003[heading Requirements] 69004 69005['Header: ][^boost/asio/execution/context_as.hpp] 69006 69007['Convenience header: ][^boost/asio/execution.hpp] 69008 69009 69010[endsect] 69011 69012 69013 69014[endsect] 69015 69016[section:execution__context_t execution::context_t] 69017 69018[indexterm1 boost_asio.indexterm.execution__context_t..execution::context_t] 69019 69020 69021A property that is used to obtain the execution context that is associated with an executor. 69022 69023 69024 struct context_t 69025 69026 69027[heading Types] 69028[table 69029 [[Name][Description]] 69030 69031 [ 69032 69033 [[link boost_asio.reference.execution__context_t.polymorphic_query_result_type [*polymorphic_query_result_type]]] 69034 [The type returned by queries against an any_executor. ] 69035 69036 ] 69037 69038] 69039 69040[heading Data Members] 69041[table 69042 [[Name][Description]] 69043 69044 [ 69045 [[link boost_asio.reference.execution__context_t.is_applicable_property_v [*is_applicable_property_v]] [static]] 69046 [The context_t property applies to executors, senders, and schedulers. ] 69047 ] 69048 69049 [ 69050 [[link boost_asio.reference.execution__context_t.is_preferable [*is_preferable]] [static]] 69051 [The context_t property cannot be preferred. ] 69052 ] 69053 69054 [ 69055 [[link boost_asio.reference.execution__context_t.is_requirable [*is_requirable]] [static]] 69056 [The context_t property cannot be required. ] 69057 ] 69058 69059] 69060 69061[heading Requirements] 69062 69063['Header: ][^boost/asio/execution/context.hpp] 69064 69065['Convenience header: ][^boost/asio/execution.hpp] 69066 69067 69068[section:is_applicable_property_v execution::context_t::is_applicable_property_v] 69069 69070[indexterm2 boost_asio.indexterm.execution__context_t.is_applicable_property_v..is_applicable_property_v..execution::context_t] 69071The [link boost_asio.reference.execution__context_t `execution::context_t`] property applies to executors, senders, and schedulers. 69072 69073 69074 template <typename T> 69075 static constexpr bool is_applicable_property_v = 69076 is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>; 69077 69078 69079 69080[endsect] 69081 69082 69083 69084[section:is_preferable execution::context_t::is_preferable] 69085 69086[indexterm2 boost_asio.indexterm.execution__context_t.is_preferable..is_preferable..execution::context_t] 69087The [link boost_asio.reference.execution__context_t `execution::context_t`] property cannot be preferred. 69088 69089 69090 static constexpr bool is_preferable = false; 69091 69092 69093 69094[endsect] 69095 69096 69097 69098[section:is_requirable execution::context_t::is_requirable] 69099 69100[indexterm2 boost_asio.indexterm.execution__context_t.is_requirable..is_requirable..execution::context_t] 69101The [link boost_asio.reference.execution__context_t `execution::context_t`] property cannot be required. 69102 69103 69104 static constexpr bool is_requirable = false; 69105 69106 69107 69108[endsect] 69109 69110 69111 69112[section:polymorphic_query_result_type execution::context_t::polymorphic_query_result_type] 69113 69114[indexterm2 boost_asio.indexterm.execution__context_t.polymorphic_query_result_type..polymorphic_query_result_type..execution::context_t] 69115The type returned by queries against an `any_executor`. 69116 69117 69118 typedef std::any polymorphic_query_result_type; 69119 69120 69121 69122[heading Requirements] 69123 69124['Header: ][^boost/asio/execution/context.hpp] 69125 69126['Convenience header: ][^boost/asio/execution.hpp] 69127 69128 69129[endsect] 69130 69131 69132 69133[endsect] 69134 69135 69136[section:execution__execute execution::execute] 69137 69138[indexterm1 boost_asio.indexterm.execution__execute..execution::execute] 69139A customisation point that executes a function on an executor. 69140 69141 69142 constexpr unspecified execute = unspecified; 69143 69144 69145The name `execution::execute` denotes a customisation point object. 69146 69147For some subexpressions `e` and `f`, let `E` be a type such that `decltype((e))` is `E` and let `F` be a type such that `decltype((f))` is `F`. The expression `execution::execute(e, f)` is ill-formed if `F` does not model `invocable`, or if `E` does not model either `executor` or `sender`. Otherwise, it is expression-equivalent to: 69148 69149 69150* `e.execute(f)`, if that expression is valid. If the function selected does not execute the function object `f` on the executor `e`, the program is ill-formed with no diagnostic required. 69151 69152 69153* Otherwise, `execute(e, f)`, if that expression is valid, with overload resolution performed in a context that includes the declaration `void execute();` and that does not include a declaration of `execution::execute`. If the function selected by overload resolution does not execute the function object `f` on the executor `e`, the program is ill-formed with no diagnostic required. 69154 69155 69156 69157[heading Requirements] 69158 69159['Header: ][^boost/asio/execution/execute.hpp] 69160 69161['Convenience header: ][^boost/asio/execution.hpp] 69162 69163 69164[endsect] 69165 69166 69167[section:execution__executor_index execution::executor_index] 69168 69169[indexterm1 boost_asio.indexterm.execution__executor_index..execution::executor_index] 69170 69171 69172The [link boost_asio.reference.execution__executor_index `execution::executor_index`] trait detects the type used by an executor to represent an index within a bulk operation. 69173 69174 69175 template< 69176 typename T> 69177 struct executor_index 69178 69179 69180[heading Types] 69181[table 69182 [[Name][Description]] 69183 69184 [ 69185 69186 [[link boost_asio.reference.execution__executor_index.type [*type]]] 69187 [T::index_type if T::index_type is valid, otherwise executor_shape_t<T>. ] 69188 69189 ] 69190 69191] 69192 69193Class template `executor_index` is a type trait with a nested type alias `type` whose type is `T::index_type` if `T::index_type` is valid, otherwise `executor_shape_t<T>`. 69194 69195[heading Requirements] 69196 69197['Header: ][^boost/asio/execution/executor.hpp] 69198 69199['Convenience header: ][^boost/asio/execution.hpp] 69200 69201 69202[section:type execution::executor_index::type] 69203 69204[indexterm2 boost_asio.indexterm.execution__executor_index.type..type..execution::executor_index] 69205`T::index_type` if `T::index_type` is valid, otherwise `executor_shape_t<T>`. 69206 69207 69208 typedef automatically_determined type; 69209 69210 69211 69212[heading Requirements] 69213 69214['Header: ][^boost/asio/execution/executor.hpp] 69215 69216['Convenience header: ][^boost/asio/execution.hpp] 69217 69218 69219[endsect] 69220 69221 69222 69223[endsect] 69224 69225[section:execution__executor_shape execution::executor_shape] 69226 69227[indexterm1 boost_asio.indexterm.execution__executor_shape..execution::executor_shape] 69228 69229 69230The [link boost_asio.reference.execution__executor_shape `execution::executor_shape`] trait detects the type used by an executor to represent the shape of a bulk operation. 69231 69232 69233 template< 69234 typename T> 69235 struct executor_shape 69236 69237 69238[heading Types] 69239[table 69240 [[Name][Description]] 69241 69242 [ 69243 69244 [[link boost_asio.reference.execution__executor_shape.type [*type]]] 69245 [T::shape_type if T::shape_type is valid, otherwise std::size_t. ] 69246 69247 ] 69248 69249] 69250 69251Class template `executor_shape` is a type trait with a nested type alias `type` whose type is `T::shape_type` if `T::shape_type` is valid, otherwise `std::size_t`. 69252 69253[heading Requirements] 69254 69255['Header: ][^boost/asio/execution/executor.hpp] 69256 69257['Convenience header: ][^boost/asio/execution.hpp] 69258 69259 69260[section:type execution::executor_shape::type] 69261 69262[indexterm2 boost_asio.indexterm.execution__executor_shape.type..type..execution::executor_shape] 69263`T::shape_type` if `T::shape_type` is valid, otherwise `std::size_t`. 69264 69265 69266 typedef automatically_determined type; 69267 69268 69269 69270[heading Requirements] 69271 69272['Header: ][^boost/asio/execution/executor.hpp] 69273 69274['Convenience header: ][^boost/asio/execution.hpp] 69275 69276 69277[endsect] 69278 69279 69280 69281[endsect] 69282 69283[section:execution__invocable_archetype execution::invocable_archetype] 69284 69285[indexterm1 boost_asio.indexterm.execution__invocable_archetype..execution::invocable_archetype] 69286 69287 69288An archetypal function object used for determining adherence to the execution::executor concept. 69289 69290 69291 struct invocable_archetype 69292 69293 69294[heading Member Functions] 69295[table 69296 [[Name][Description]] 69297 69298 [ 69299 [[link boost_asio.reference.execution__invocable_archetype.operator_lp__rp_ [*operator()]]] 69300 [Function call operator. ] 69301 ] 69302 69303] 69304 69305[heading Requirements] 69306 69307['Header: ][^boost/asio/execution/invocable_archetype.hpp] 69308 69309['Convenience header: ][^boost/asio/execution.hpp] 69310 69311 69312[section:operator_lp__rp_ execution::invocable_archetype::operator()] 69313 69314[indexterm2 boost_asio.indexterm.execution__invocable_archetype.operator_lp__rp_..operator()..execution::invocable_archetype] 69315Function call operator. 69316 69317 69318 template< 69319 typename... Args> 69320 void operator()( 69321 Args && ...); 69322 69323 69324 69325[endsect] 69326 69327 69328 69329[endsect] 69330 69331[section:execution__is_executor execution::is_executor] 69332 69333[indexterm1 boost_asio.indexterm.execution__is_executor..execution::is_executor] 69334 69335 69336The [link boost_asio.reference.execution__is_executor `execution::is_executor`] trait detects whether a type T satisfies the execution::executor concept. 69337 69338 69339 template< 69340 typename T> 69341 struct is_executor 69342 69343 69344Class template `is_executor` is a UnaryTypeTrait that is derived from `true_type` if the type `T` meets the concept definition for an executor, otherwise `false_type`. 69345 69346[heading Requirements] 69347 69348['Header: ][^boost/asio/execution/executor.hpp] 69349 69350['Convenience header: ][^boost/asio/execution.hpp] 69351 69352 69353[endsect] 69354 69355[section:execution__is_executor_of execution::is_executor_of] 69356 69357[indexterm1 boost_asio.indexterm.execution__is_executor_of..execution::is_executor_of] 69358 69359 69360The [link boost_asio.reference.execution__is_executor_of `execution::is_executor_of`] trait detects whether a type T satisfies the execution::executor\_of concept for some set of value arguments. 69361 69362 69363 template< 69364 typename T, 69365 typename F> 69366 struct is_executor_of 69367 69368 69369Class template `is_executor_of` is a type trait that is derived from `true_type` if the type `T` meets the concept definition for an executor that is invocable with a function object of type `F`, otherwise `false_type`. 69370 69371[heading Requirements] 69372 69373['Header: ][^boost/asio/execution/executor.hpp] 69374 69375['Convenience header: ][^boost/asio/execution.hpp] 69376 69377 69378[endsect] 69379 69380[section:execution__is_nothrow_receiver_of execution::is_nothrow_receiver_of] 69381 69382[indexterm1 boost_asio.indexterm.execution__is_nothrow_receiver_of..execution::is_nothrow_receiver_of] 69383 69384 69385The [link boost_asio.reference.execution__is_nothrow_receiver_of `execution::is_nothrow_receiver_of`] trait detects whether a type T satisfies the execution::receiver\_of concept for some set of value arguments, with a noexcept `set_value` operation. 69386 69387 69388 template< 69389 typename T, 69390 typename... Vs> 69391 struct is_nothrow_receiver_of 69392 69393 69394Class template `is_nothrow_receiver_of` is a type trait that is derived from `true_type` if the type `T` meets the concept definition for a receiver for value arguments `Vs`, and the expression `execution::set_value(declval<T>(), declval<Ts>()...)` is noexcept, otherwise `false_type`. 69395 69396[heading Requirements] 69397 69398['Header: ][^boost/asio/execution/receiver.hpp] 69399 69400['Convenience header: ][^boost/asio/execution.hpp] 69401 69402 69403[endsect] 69404 69405[section:execution__is_operation_state execution::is_operation_state] 69406 69407[indexterm1 boost_asio.indexterm.execution__is_operation_state..execution::is_operation_state] 69408 69409 69410The [link boost_asio.reference.execution__is_operation_state `execution::is_operation_state`] trait detects whether a type T satisfies the execution::operation\_state concept. 69411 69412 69413 template< 69414 typename T> 69415 struct is_operation_state 69416 69417 69418Class template `is_operation_state` is a type trait that is derived from `true_type` if the type `T` meets the concept definition for an `operation_state`, otherwise `false_type`. 69419 69420[heading Requirements] 69421 69422['Header: ][^boost/asio/execution/operation_state.hpp] 69423 69424['Convenience header: ][^boost/asio/execution.hpp] 69425 69426 69427[endsect] 69428 69429[section:execution__is_receiver execution::is_receiver] 69430 69431[indexterm1 boost_asio.indexterm.execution__is_receiver..execution::is_receiver] 69432 69433 69434The [link boost_asio.reference.execution__is_receiver `execution::is_receiver`] trait detects whether a type T satisfies the execution::receiver concept. 69435 69436 69437 template< 69438 typename T, 69439 typename E = std::exception_ptr> 69440 struct is_receiver 69441 69442 69443Class template `is_receiver` is a type trait that is derived from `true_type` if the type `T` meets the concept definition for a receiver for error type `E`, otherwise `false_type`. 69444 69445[heading Requirements] 69446 69447['Header: ][^boost/asio/execution/receiver.hpp] 69448 69449['Convenience header: ][^boost/asio/execution.hpp] 69450 69451 69452[endsect] 69453 69454[section:execution__is_receiver_of execution::is_receiver_of] 69455 69456[indexterm1 boost_asio.indexterm.execution__is_receiver_of..execution::is_receiver_of] 69457 69458 69459The [link boost_asio.reference.execution__is_receiver_of `execution::is_receiver_of`] trait detects whether a type T satisfies the execution::receiver\_of concept for some set of value arguments. 69460 69461 69462 template< 69463 typename T, 69464 typename... Vs> 69465 struct is_receiver_of 69466 69467 69468Class template `is_receiver_of` is a type trait that is derived from `true_type` if the type `T` meets the concept definition for a receiver for value arguments `Vs`, otherwise `false_type`. 69469 69470[heading Requirements] 69471 69472['Header: ][^boost/asio/execution/receiver.hpp] 69473 69474['Convenience header: ][^boost/asio/execution.hpp] 69475 69476 69477[endsect] 69478 69479[section:execution__is_scheduler execution::is_scheduler] 69480 69481[indexterm1 boost_asio.indexterm.execution__is_scheduler..execution::is_scheduler] 69482 69483 69484The [link boost_asio.reference.execution__is_scheduler `execution::is_scheduler`] trait detects whether a type T satisfies the execution::scheduler concept. 69485 69486 69487 template< 69488 typename T> 69489 struct is_scheduler 69490 69491 69492Class template `is_scheduler` is a type trait that is derived from `true_type` if the type `T` meets the concept definition for a scheduler for error type `E`, otherwise `false_type`. 69493 69494[heading Requirements] 69495 69496['Header: ][^boost/asio/execution/scheduler.hpp] 69497 69498['Convenience header: ][^boost/asio/execution.hpp] 69499 69500 69501[endsect] 69502 69503[section:execution__is_sender execution::is_sender] 69504 69505[indexterm1 boost_asio.indexterm.execution__is_sender..execution::is_sender] 69506 69507 69508The [link boost_asio.reference.execution__is_sender `execution::is_sender`] trait detects whether a type T satisfies the execution::sender concept. 69509 69510 69511 template< 69512 typename T> 69513 struct is_sender 69514 69515 69516Class template `is_sender` is a type trait that is derived from `true_type` if the type `T` meets the concept definition for a sender, otherwise `false_type`. 69517 69518[heading Requirements] 69519 69520['Header: ][^boost/asio/execution/sender.hpp] 69521 69522['Convenience header: ][^boost/asio/execution.hpp] 69523 69524 69525[endsect] 69526 69527[section:execution__is_sender_to execution::is_sender_to] 69528 69529[indexterm1 boost_asio.indexterm.execution__is_sender_to..execution::is_sender_to] 69530 69531 69532The [link boost_asio.reference.execution__is_sender_to `execution::is_sender_to`] trait detects whether a type T satisfies the execution::sender\_to concept for some receiver. 69533 69534 69535 template< 69536 typename T, 69537 typename R> 69538 struct is_sender_to 69539 69540 69541Class template `is_sender_to` is a type trait that is derived from `true_type` if the type `T` meets the concept definition for a sender for some receiver type R, otherwise `false`. 69542 69543[heading Requirements] 69544 69545['Header: ][^boost/asio/execution/sender.hpp] 69546 69547['Convenience header: ][^boost/asio/execution.hpp] 69548 69549 69550[endsect] 69551 69552[section:execution__is_typed_sender execution::is_typed_sender] 69553 69554[indexterm1 boost_asio.indexterm.execution__is_typed_sender..execution::is_typed_sender] 69555 69556 69557The [link boost_asio.reference.execution__is_typed_sender `execution::is_typed_sender`] trait detects whether a type T satisfies the execution::typed\_sender concept. 69558 69559 69560 template< 69561 typename T> 69562 struct is_typed_sender 69563 69564 69565Class template `is_typed_sender` is a type trait that is derived from `true_type` if the type `T` meets the concept definition for a typed sender, otherwise `false`. 69566 69567[heading Requirements] 69568 69569['Header: ][^boost/asio/execution/sender.hpp] 69570 69571['Convenience header: ][^boost/asio/execution.hpp] 69572 69573 69574[endsect] 69575 69576 69577[section:execution__mapping execution::mapping] 69578 69579[indexterm1 boost_asio.indexterm.execution__mapping..execution::mapping] 69580A special value used for accessing the [link boost_asio.reference.execution__mapping_t `execution::mapping_t`] property. 69581 69582 69583 constexpr mapping_t mapping; 69584 69585 69586[heading Requirements] 69587 69588['Header: ][^boost/asio/execution/mapping.hpp] 69589 69590['Convenience header: ][^boost/asio/execution.hpp] 69591 69592 69593[endsect] 69594 69595 69596[section:execution__mapping_t execution::mapping_t] 69597 69598[indexterm1 boost_asio.indexterm.execution__mapping_t..execution::mapping_t] 69599 69600 69601A property to describe what guarantees an executor makes about the mapping of execution agents on to threads of execution. 69602 69603 69604 struct mapping_t 69605 69606 69607[heading Types] 69608[table 69609 [[Name][Description]] 69610 69611 [ 69612 69613 [[link boost_asio.reference.execution__mapping_t__new_thread_t [*new_thread_t]]] 69614 [A sub-property that indicates that execution agents are mapped on to new threads of execution. ] 69615 69616 ] 69617 69618 [ 69619 69620 [[link boost_asio.reference.execution__mapping_t__other_t [*other_t]]] 69621 [A sub-property that indicates that the mapping of execution agents is implementation-defined. ] 69622 69623 ] 69624 69625 [ 69626 69627 [[link boost_asio.reference.execution__mapping_t__thread_t [*thread_t]]] 69628 [A sub-property that indicates that execution agents are mapped on to threads of execution. ] 69629 69630 ] 69631 69632 [ 69633 69634 [[link boost_asio.reference.execution__mapping_t.polymorphic_query_result_type [*polymorphic_query_result_type]]] 69635 [The type returned by queries against an any_executor. ] 69636 69637 ] 69638 69639] 69640 69641[heading Member Functions] 69642[table 69643 [[Name][Description]] 69644 69645 [ 69646 [[link boost_asio.reference.execution__mapping_t.mapping_t [*mapping_t]] [constructor]] 69647 [Default constructor. 69648 [hr] 69649 Construct from a sub-property value. ] 69650 ] 69651 69652] 69653 69654[heading Data Members] 69655[table 69656 [[Name][Description]] 69657 69658 [ 69659 [[link boost_asio.reference.execution__mapping_t.is_applicable_property_v [*is_applicable_property_v]] [static]] 69660 [The mapping_t property applies to executors, senders, and schedulers. ] 69661 ] 69662 69663 [ 69664 [[link boost_asio.reference.execution__mapping_t.is_preferable [*is_preferable]] [static]] 69665 [The top-level mapping_t property cannot be preferred. ] 69666 ] 69667 69668 [ 69669 [[link boost_asio.reference.execution__mapping_t.is_requirable [*is_requirable]] [static]] 69670 [The top-level mapping_t property cannot be required. ] 69671 ] 69672 69673 [ 69674 [[link boost_asio.reference.execution__mapping_t.new_thread [*new_thread]] [static]] 69675 [A special value used for accessing the mapping_t::new_thread_t property. ] 69676 ] 69677 69678 [ 69679 [[link boost_asio.reference.execution__mapping_t.other [*other]] [static]] 69680 [A special value used for accessing the mapping_t::other_t property. ] 69681 ] 69682 69683 [ 69684 [[link boost_asio.reference.execution__mapping_t.thread [*thread]] [static]] 69685 [A special value used for accessing the mapping_t::thread_t property. ] 69686 ] 69687 69688] 69689 69690[heading Friends] 69691[table 69692 [[Name][Description]] 69693 69694 [ 69695 [[link boost_asio.reference.execution__mapping_t.operator_not__eq_ [*operator!=]]] 69696 [Compare property values for inequality. ] 69697 ] 69698 69699 [ 69700 [[link boost_asio.reference.execution__mapping_t.operator_eq__eq_ [*operator==]]] 69701 [Compare property values for equality. ] 69702 ] 69703 69704] 69705 69706[heading Requirements] 69707 69708['Header: ][^boost/asio/execution/mapping.hpp] 69709 69710['Convenience header: ][^boost/asio/execution.hpp] 69711 69712 69713[section:is_applicable_property_v execution::mapping_t::is_applicable_property_v] 69714 69715[indexterm2 boost_asio.indexterm.execution__mapping_t.is_applicable_property_v..is_applicable_property_v..execution::mapping_t] 69716The [link boost_asio.reference.execution__mapping_t `execution::mapping_t`] property applies to executors, senders, and schedulers. 69717 69718 69719 template <typename T> 69720 static constexpr bool is_applicable_property_v = 69721 is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>; 69722 69723 69724 69725[endsect] 69726 69727 69728 69729[section:is_preferable execution::mapping_t::is_preferable] 69730 69731[indexterm2 boost_asio.indexterm.execution__mapping_t.is_preferable..is_preferable..execution::mapping_t] 69732The top-level [link boost_asio.reference.execution__mapping_t `execution::mapping_t`] property cannot be preferred. 69733 69734 69735 static constexpr bool is_preferable = false; 69736 69737 69738 69739[endsect] 69740 69741 69742 69743[section:is_requirable execution::mapping_t::is_requirable] 69744 69745[indexterm2 boost_asio.indexterm.execution__mapping_t.is_requirable..is_requirable..execution::mapping_t] 69746The top-level [link boost_asio.reference.execution__mapping_t `execution::mapping_t`] property cannot be required. 69747 69748 69749 static constexpr bool is_requirable = false; 69750 69751 69752 69753[endsect] 69754 69755 69756[section:mapping_t execution::mapping_t::mapping_t] 69757 69758[indexterm2 boost_asio.indexterm.execution__mapping_t.mapping_t..mapping_t..execution::mapping_t] 69759Default constructor. 69760 69761 69762 constexpr ``[link boost_asio.reference.execution__mapping_t.mapping_t.overload1 mapping_t]``(); 69763 `` [''''»''' [link boost_asio.reference.execution__mapping_t.mapping_t.overload1 more...]]`` 69764 69765 69766Construct from a sub-property value. 69767 69768 69769 constexpr ``[link boost_asio.reference.execution__mapping_t.mapping_t.overload2 mapping_t]``( 69770 thread_t ); 69771 `` [''''»''' [link boost_asio.reference.execution__mapping_t.mapping_t.overload2 more...]]`` 69772 69773 constexpr ``[link boost_asio.reference.execution__mapping_t.mapping_t.overload3 mapping_t]``( 69774 new_thread_t ); 69775 `` [''''»''' [link boost_asio.reference.execution__mapping_t.mapping_t.overload3 more...]]`` 69776 69777 constexpr ``[link boost_asio.reference.execution__mapping_t.mapping_t.overload4 mapping_t]``( 69778 other_t ); 69779 `` [''''»''' [link boost_asio.reference.execution__mapping_t.mapping_t.overload4 more...]]`` 69780 69781 69782[section:overload1 execution::mapping_t::mapping_t (1 of 4 overloads)] 69783 69784 69785Default constructor. 69786 69787 69788 constexpr mapping_t(); 69789 69790 69791 69792[endsect] 69793 69794 69795 69796[section:overload2 execution::mapping_t::mapping_t (2 of 4 overloads)] 69797 69798 69799Construct from a sub-property value. 69800 69801 69802 constexpr mapping_t( 69803 thread_t ); 69804 69805 69806 69807[endsect] 69808 69809 69810 69811[section:overload3 execution::mapping_t::mapping_t (3 of 4 overloads)] 69812 69813 69814Construct from a sub-property value. 69815 69816 69817 constexpr mapping_t( 69818 new_thread_t ); 69819 69820 69821 69822[endsect] 69823 69824 69825 69826[section:overload4 execution::mapping_t::mapping_t (4 of 4 overloads)] 69827 69828 69829Construct from a sub-property value. 69830 69831 69832 constexpr mapping_t( 69833 other_t ); 69834 69835 69836 69837[endsect] 69838 69839 69840[endsect] 69841 69842 69843[section:new_thread execution::mapping_t::new_thread] 69844 69845[indexterm2 boost_asio.indexterm.execution__mapping_t.new_thread..new_thread..execution::mapping_t] 69846A special value used for accessing the [link boost_asio.reference.execution__mapping_t__new_thread_t `execution::mapping_t::new_thread_t`] property. 69847 69848 69849 static constexpr new_thread_t new_thread; 69850 69851 69852 69853[endsect] 69854 69855 69856 69857[section:operator_not__eq_ execution::mapping_t::operator!=] 69858 69859[indexterm2 boost_asio.indexterm.execution__mapping_t.operator_not__eq_..operator!=..execution::mapping_t] 69860Compare property values for inequality. 69861 69862 69863 friend constexpr bool operator!=( 69864 const mapping_t & a, 69865 const mapping_t & b); 69866 69867 69868[heading Requirements] 69869 69870['Header: ][^boost/asio/execution/mapping.hpp] 69871 69872['Convenience header: ][^boost/asio/execution.hpp] 69873 69874 69875[endsect] 69876 69877 69878 69879[section:operator_eq__eq_ execution::mapping_t::operator==] 69880 69881[indexterm2 boost_asio.indexterm.execution__mapping_t.operator_eq__eq_..operator==..execution::mapping_t] 69882Compare property values for equality. 69883 69884 69885 friend constexpr bool operator==( 69886 const mapping_t & a, 69887 const mapping_t & b); 69888 69889 69890[heading Requirements] 69891 69892['Header: ][^boost/asio/execution/mapping.hpp] 69893 69894['Convenience header: ][^boost/asio/execution.hpp] 69895 69896 69897[endsect] 69898 69899 69900 69901[section:other execution::mapping_t::other] 69902 69903[indexterm2 boost_asio.indexterm.execution__mapping_t.other..other..execution::mapping_t] 69904A special value used for accessing the [link boost_asio.reference.execution__mapping_t__other_t `execution::mapping_t::other_t`] property. 69905 69906 69907 static constexpr other_t other; 69908 69909 69910 69911[endsect] 69912 69913 69914 69915[section:polymorphic_query_result_type execution::mapping_t::polymorphic_query_result_type] 69916 69917[indexterm2 boost_asio.indexterm.execution__mapping_t.polymorphic_query_result_type..polymorphic_query_result_type..execution::mapping_t] 69918The type returned by queries against an `any_executor`. 69919 69920 69921 typedef mapping_t polymorphic_query_result_type; 69922 69923 69924 69925[heading Requirements] 69926 69927['Header: ][^boost/asio/execution/mapping.hpp] 69928 69929['Convenience header: ][^boost/asio/execution.hpp] 69930 69931 69932[endsect] 69933 69934 69935 69936[section:thread execution::mapping_t::thread] 69937 69938[indexterm2 boost_asio.indexterm.execution__mapping_t.thread..thread..execution::mapping_t] 69939A special value used for accessing the [link boost_asio.reference.execution__mapping_t__thread_t `execution::mapping_t::thread_t`] property. 69940 69941 69942 static constexpr thread_t thread; 69943 69944 69945 69946[endsect] 69947 69948 69949 69950[endsect] 69951 69952[section:execution__mapping_t__new_thread_t execution::mapping_t::new_thread_t] 69953 69954[indexterm1 boost_asio.indexterm.execution__mapping_t__new_thread_t..execution::mapping_t::new_thread_t] 69955 69956 69957A sub-property that indicates that execution agents are mapped on to new threads of execution. 69958 69959 69960 struct new_thread_t 69961 69962 69963[heading Types] 69964[table 69965 [[Name][Description]] 69966 69967 [ 69968 69969 [[link boost_asio.reference.execution__mapping_t__new_thread_t.polymorphic_query_result_type [*polymorphic_query_result_type]]] 69970 [The type returned by queries against an any_executor. ] 69971 69972 ] 69973 69974] 69975 69976[heading Member Functions] 69977[table 69978 [[Name][Description]] 69979 69980 [ 69981 [[link boost_asio.reference.execution__mapping_t__new_thread_t.new_thread_t [*new_thread_t]] [constructor]] 69982 [Default constructor. ] 69983 ] 69984 69985 [ 69986 [[link boost_asio.reference.execution__mapping_t__new_thread_t.value [*value]] [static]] 69987 [Get the value associated with a property object. ] 69988 ] 69989 69990] 69991 69992[heading Data Members] 69993[table 69994 [[Name][Description]] 69995 69996 [ 69997 [[link boost_asio.reference.execution__mapping_t__new_thread_t.is_applicable_property_v [*is_applicable_property_v]] [static]] 69998 [The mapping_t::new_thread_t property applies to executors, senders, and schedulers. ] 69999 ] 70000 70001 [ 70002 [[link boost_asio.reference.execution__mapping_t__new_thread_t.is_preferable [*is_preferable]] [static]] 70003 [The mapping_t::new_thread_t property can be preferred. ] 70004 ] 70005 70006 [ 70007 [[link boost_asio.reference.execution__mapping_t__new_thread_t.is_requirable [*is_requirable]] [static]] 70008 [The mapping_t::new_thread_t property can be required. ] 70009 ] 70010 70011] 70012 70013[heading Requirements] 70014 70015['Header: ][^boost/asio/execution/mapping.hpp] 70016 70017['Convenience header: ][^boost/asio/execution.hpp] 70018 70019 70020[section:is_applicable_property_v execution::mapping_t::new_thread_t::is_applicable_property_v] 70021 70022[indexterm2 boost_asio.indexterm.execution__mapping_t__new_thread_t.is_applicable_property_v..is_applicable_property_v..execution::mapping_t::new_thread_t] 70023The [link boost_asio.reference.execution__mapping_t__new_thread_t `execution::mapping_t::new_thread_t`] property applies to executors, senders, and schedulers. 70024 70025 70026 template <typename T> 70027 static constexpr bool is_applicable_property_v = 70028 is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>; 70029 70030 70031 70032[endsect] 70033 70034 70035 70036[section:is_preferable execution::mapping_t::new_thread_t::is_preferable] 70037 70038[indexterm2 boost_asio.indexterm.execution__mapping_t__new_thread_t.is_preferable..is_preferable..execution::mapping_t::new_thread_t] 70039The [link boost_asio.reference.execution__mapping_t__new_thread_t `execution::mapping_t::new_thread_t`] property can be preferred. 70040 70041 70042 static constexpr bool is_preferable = true; 70043 70044 70045 70046[endsect] 70047 70048 70049 70050[section:is_requirable execution::mapping_t::new_thread_t::is_requirable] 70051 70052[indexterm2 boost_asio.indexterm.execution__mapping_t__new_thread_t.is_requirable..is_requirable..execution::mapping_t::new_thread_t] 70053The [link boost_asio.reference.execution__mapping_t__new_thread_t `execution::mapping_t::new_thread_t`] property can be required. 70054 70055 70056 static constexpr bool is_requirable = true; 70057 70058 70059 70060[endsect] 70061 70062 70063 70064[section:new_thread_t execution::mapping_t::new_thread_t::new_thread_t] 70065 70066[indexterm2 boost_asio.indexterm.execution__mapping_t__new_thread_t.new_thread_t..new_thread_t..execution::mapping_t::new_thread_t] 70067Default constructor. 70068 70069 70070 constexpr new_thread_t(); 70071 70072 70073 70074[endsect] 70075 70076 70077 70078[section:polymorphic_query_result_type execution::mapping_t::new_thread_t::polymorphic_query_result_type] 70079 70080[indexterm2 boost_asio.indexterm.execution__mapping_t__new_thread_t.polymorphic_query_result_type..polymorphic_query_result_type..execution::mapping_t::new_thread_t] 70081The type returned by queries against an `any_executor`. 70082 70083 70084 typedef mapping_t polymorphic_query_result_type; 70085 70086 70087 70088[heading Requirements] 70089 70090['Header: ][^boost/asio/execution/mapping.hpp] 70091 70092['Convenience header: ][^boost/asio/execution.hpp] 70093 70094 70095[endsect] 70096 70097 70098 70099[section:value execution::mapping_t::new_thread_t::value] 70100 70101[indexterm2 boost_asio.indexterm.execution__mapping_t__new_thread_t.value..value..execution::mapping_t::new_thread_t] 70102Get the value associated with a property object. 70103 70104 70105 static constexpr mapping_t value(); 70106 70107 70108 70109[heading Return Value] 70110 70111`new_thread_t()`; 70112 70113 70114 70115 70116[endsect] 70117 70118 70119 70120[endsect] 70121 70122[section:execution__mapping_t__other_t execution::mapping_t::other_t] 70123 70124[indexterm1 boost_asio.indexterm.execution__mapping_t__other_t..execution::mapping_t::other_t] 70125 70126 70127A sub-property that indicates that the mapping of execution agents is implementation-defined. 70128 70129 70130 struct other_t 70131 70132 70133[heading Types] 70134[table 70135 [[Name][Description]] 70136 70137 [ 70138 70139 [[link boost_asio.reference.execution__mapping_t__other_t.polymorphic_query_result_type [*polymorphic_query_result_type]]] 70140 [The type returned by queries against an any_executor. ] 70141 70142 ] 70143 70144] 70145 70146[heading Member Functions] 70147[table 70148 [[Name][Description]] 70149 70150 [ 70151 [[link boost_asio.reference.execution__mapping_t__other_t.other_t [*other_t]] [constructor]] 70152 [Default constructor. ] 70153 ] 70154 70155 [ 70156 [[link boost_asio.reference.execution__mapping_t__other_t.value [*value]] [static]] 70157 [Get the value associated with a property object. ] 70158 ] 70159 70160] 70161 70162[heading Data Members] 70163[table 70164 [[Name][Description]] 70165 70166 [ 70167 [[link boost_asio.reference.execution__mapping_t__other_t.is_applicable_property_v [*is_applicable_property_v]] [static]] 70168 [The mapping_t::other_t property applies to executors, senders, and schedulers. ] 70169 ] 70170 70171 [ 70172 [[link boost_asio.reference.execution__mapping_t__other_t.is_preferable [*is_preferable]] [static]] 70173 [The mapping_t::other_t property can be preferred. ] 70174 ] 70175 70176 [ 70177 [[link boost_asio.reference.execution__mapping_t__other_t.is_requirable [*is_requirable]] [static]] 70178 [The mapping_t::other_t property can be required. ] 70179 ] 70180 70181] 70182 70183[heading Requirements] 70184 70185['Header: ][^boost/asio/execution/mapping.hpp] 70186 70187['Convenience header: ][^boost/asio/execution.hpp] 70188 70189 70190[section:is_applicable_property_v execution::mapping_t::other_t::is_applicable_property_v] 70191 70192[indexterm2 boost_asio.indexterm.execution__mapping_t__other_t.is_applicable_property_v..is_applicable_property_v..execution::mapping_t::other_t] 70193The [link boost_asio.reference.execution__mapping_t__other_t `execution::mapping_t::other_t`] property applies to executors, senders, and schedulers. 70194 70195 70196 template <typename T> 70197 static constexpr bool is_applicable_property_v = 70198 is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>; 70199 70200 70201 70202[endsect] 70203 70204 70205 70206[section:is_preferable execution::mapping_t::other_t::is_preferable] 70207 70208[indexterm2 boost_asio.indexterm.execution__mapping_t__other_t.is_preferable..is_preferable..execution::mapping_t::other_t] 70209The [link boost_asio.reference.execution__mapping_t__other_t `execution::mapping_t::other_t`] property can be preferred. 70210 70211 70212 static constexpr bool is_preferable = true; 70213 70214 70215 70216[endsect] 70217 70218 70219 70220[section:is_requirable execution::mapping_t::other_t::is_requirable] 70221 70222[indexterm2 boost_asio.indexterm.execution__mapping_t__other_t.is_requirable..is_requirable..execution::mapping_t::other_t] 70223The [link boost_asio.reference.execution__mapping_t__other_t `execution::mapping_t::other_t`] property can be required. 70224 70225 70226 static constexpr bool is_requirable = true; 70227 70228 70229 70230[endsect] 70231 70232 70233 70234[section:other_t execution::mapping_t::other_t::other_t] 70235 70236[indexterm2 boost_asio.indexterm.execution__mapping_t__other_t.other_t..other_t..execution::mapping_t::other_t] 70237Default constructor. 70238 70239 70240 constexpr other_t(); 70241 70242 70243 70244[endsect] 70245 70246 70247 70248[section:polymorphic_query_result_type execution::mapping_t::other_t::polymorphic_query_result_type] 70249 70250[indexterm2 boost_asio.indexterm.execution__mapping_t__other_t.polymorphic_query_result_type..polymorphic_query_result_type..execution::mapping_t::other_t] 70251The type returned by queries against an `any_executor`. 70252 70253 70254 typedef mapping_t polymorphic_query_result_type; 70255 70256 70257 70258[heading Requirements] 70259 70260['Header: ][^boost/asio/execution/mapping.hpp] 70261 70262['Convenience header: ][^boost/asio/execution.hpp] 70263 70264 70265[endsect] 70266 70267 70268 70269[section:value execution::mapping_t::other_t::value] 70270 70271[indexterm2 boost_asio.indexterm.execution__mapping_t__other_t.value..value..execution::mapping_t::other_t] 70272Get the value associated with a property object. 70273 70274 70275 static constexpr mapping_t value(); 70276 70277 70278 70279[heading Return Value] 70280 70281`other_t()`; 70282 70283 70284 70285 70286[endsect] 70287 70288 70289 70290[endsect] 70291 70292[section:execution__mapping_t__thread_t execution::mapping_t::thread_t] 70293 70294[indexterm1 boost_asio.indexterm.execution__mapping_t__thread_t..execution::mapping_t::thread_t] 70295 70296 70297A sub-property that indicates that execution agents are mapped on to threads of execution. 70298 70299 70300 struct thread_t 70301 70302 70303[heading Types] 70304[table 70305 [[Name][Description]] 70306 70307 [ 70308 70309 [[link boost_asio.reference.execution__mapping_t__thread_t.polymorphic_query_result_type [*polymorphic_query_result_type]]] 70310 [The type returned by queries against an any_executor. ] 70311 70312 ] 70313 70314] 70315 70316[heading Member Functions] 70317[table 70318 [[Name][Description]] 70319 70320 [ 70321 [[link boost_asio.reference.execution__mapping_t__thread_t.thread_t [*thread_t]] [constructor]] 70322 [Default constructor. ] 70323 ] 70324 70325 [ 70326 [[link boost_asio.reference.execution__mapping_t__thread_t.value [*value]] [static]] 70327 [Get the value associated with a property object. ] 70328 ] 70329 70330] 70331 70332[heading Data Members] 70333[table 70334 [[Name][Description]] 70335 70336 [ 70337 [[link boost_asio.reference.execution__mapping_t__thread_t.is_applicable_property_v [*is_applicable_property_v]] [static]] 70338 [The mapping_t::thread_t property applies to executors, senders, and schedulers. ] 70339 ] 70340 70341 [ 70342 [[link boost_asio.reference.execution__mapping_t__thread_t.is_preferable [*is_preferable]] [static]] 70343 [The mapping_t::thread_t property can be preferred. ] 70344 ] 70345 70346 [ 70347 [[link boost_asio.reference.execution__mapping_t__thread_t.is_requirable [*is_requirable]] [static]] 70348 [The mapping_t::thread_t property can be required. ] 70349 ] 70350 70351] 70352 70353[heading Requirements] 70354 70355['Header: ][^boost/asio/execution/mapping.hpp] 70356 70357['Convenience header: ][^boost/asio/execution.hpp] 70358 70359 70360[section:is_applicable_property_v execution::mapping_t::thread_t::is_applicable_property_v] 70361 70362[indexterm2 boost_asio.indexterm.execution__mapping_t__thread_t.is_applicable_property_v..is_applicable_property_v..execution::mapping_t::thread_t] 70363The [link boost_asio.reference.execution__mapping_t__thread_t `execution::mapping_t::thread_t`] property applies to executors, senders, and schedulers. 70364 70365 70366 template <typename T> 70367 static constexpr bool is_applicable_property_v = 70368 is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>; 70369 70370 70371 70372[endsect] 70373 70374 70375 70376[section:is_preferable execution::mapping_t::thread_t::is_preferable] 70377 70378[indexterm2 boost_asio.indexterm.execution__mapping_t__thread_t.is_preferable..is_preferable..execution::mapping_t::thread_t] 70379The [link boost_asio.reference.execution__mapping_t__thread_t `execution::mapping_t::thread_t`] property can be preferred. 70380 70381 70382 static constexpr bool is_preferable = true; 70383 70384 70385 70386[endsect] 70387 70388 70389 70390[section:is_requirable execution::mapping_t::thread_t::is_requirable] 70391 70392[indexterm2 boost_asio.indexterm.execution__mapping_t__thread_t.is_requirable..is_requirable..execution::mapping_t::thread_t] 70393The [link boost_asio.reference.execution__mapping_t__thread_t `execution::mapping_t::thread_t`] property can be required. 70394 70395 70396 static constexpr bool is_requirable = true; 70397 70398 70399 70400[endsect] 70401 70402 70403 70404[section:polymorphic_query_result_type execution::mapping_t::thread_t::polymorphic_query_result_type] 70405 70406[indexterm2 boost_asio.indexterm.execution__mapping_t__thread_t.polymorphic_query_result_type..polymorphic_query_result_type..execution::mapping_t::thread_t] 70407The type returned by queries against an `any_executor`. 70408 70409 70410 typedef mapping_t polymorphic_query_result_type; 70411 70412 70413 70414[heading Requirements] 70415 70416['Header: ][^boost/asio/execution/mapping.hpp] 70417 70418['Convenience header: ][^boost/asio/execution.hpp] 70419 70420 70421[endsect] 70422 70423 70424 70425[section:thread_t execution::mapping_t::thread_t::thread_t] 70426 70427[indexterm2 boost_asio.indexterm.execution__mapping_t__thread_t.thread_t..thread_t..execution::mapping_t::thread_t] 70428Default constructor. 70429 70430 70431 constexpr thread_t(); 70432 70433 70434 70435[endsect] 70436 70437 70438 70439[section:value execution::mapping_t::thread_t::value] 70440 70441[indexterm2 boost_asio.indexterm.execution__mapping_t__thread_t.value..value..execution::mapping_t::thread_t] 70442Get the value associated with a property object. 70443 70444 70445 static constexpr mapping_t value(); 70446 70447 70448 70449[heading Return Value] 70450 70451`thread_t()`; 70452 70453 70454 70455 70456[endsect] 70457 70458 70459 70460[endsect] 70461 70462 70463[section:execution__occupancy execution::occupancy] 70464 70465[indexterm1 boost_asio.indexterm.execution__occupancy..execution::occupancy] 70466A special value used for accessing the [link boost_asio.reference.execution__occupancy_t `execution::occupancy_t`] property. 70467 70468 70469 constexpr occupancy_t occupancy; 70470 70471 70472[heading Requirements] 70473 70474['Header: ][^boost/asio/execution/occupancy.hpp] 70475 70476['Convenience header: ][^boost/asio/execution.hpp] 70477 70478 70479[endsect] 70480 70481 70482[section:execution__occupancy_t execution::occupancy_t] 70483 70484[indexterm1 boost_asio.indexterm.execution__occupancy_t..execution::occupancy_t] 70485 70486 70487A property that gives an estimate of the number of execution agents that should occupy the associated execution context. 70488 70489 70490 struct occupancy_t 70491 70492 70493[heading Types] 70494[table 70495 [[Name][Description]] 70496 70497 [ 70498 70499 [[link boost_asio.reference.execution__occupancy_t.polymorphic_query_result_type [*polymorphic_query_result_type]]] 70500 [The type returned by queries against an any_executor. ] 70501 70502 ] 70503 70504] 70505 70506[heading Data Members] 70507[table 70508 [[Name][Description]] 70509 70510 [ 70511 [[link boost_asio.reference.execution__occupancy_t.is_applicable_property_v [*is_applicable_property_v]] [static]] 70512 [The occupancy_t property applies to executors, senders, and schedulers. ] 70513 ] 70514 70515 [ 70516 [[link boost_asio.reference.execution__occupancy_t.is_preferable [*is_preferable]] [static]] 70517 [The occupancy_t property cannot be preferred. ] 70518 ] 70519 70520 [ 70521 [[link boost_asio.reference.execution__occupancy_t.is_requirable [*is_requirable]] [static]] 70522 [The occupancy_t property cannot be required. ] 70523 ] 70524 70525] 70526 70527[heading Requirements] 70528 70529['Header: ][^boost/asio/execution/occupancy.hpp] 70530 70531['Convenience header: ][^boost/asio/execution.hpp] 70532 70533 70534[section:is_applicable_property_v execution::occupancy_t::is_applicable_property_v] 70535 70536[indexterm2 boost_asio.indexterm.execution__occupancy_t.is_applicable_property_v..is_applicable_property_v..execution::occupancy_t] 70537The [link boost_asio.reference.execution__occupancy_t `execution::occupancy_t`] property applies to executors, senders, and schedulers. 70538 70539 70540 template <typename T> 70541 static constexpr bool is_applicable_property_v = 70542 is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>; 70543 70544 70545 70546[endsect] 70547 70548 70549 70550[section:is_preferable execution::occupancy_t::is_preferable] 70551 70552[indexterm2 boost_asio.indexterm.execution__occupancy_t.is_preferable..is_preferable..execution::occupancy_t] 70553The [link boost_asio.reference.execution__occupancy_t `execution::occupancy_t`] property cannot be preferred. 70554 70555 70556 static constexpr bool is_preferable = false; 70557 70558 70559 70560[endsect] 70561 70562 70563 70564[section:is_requirable execution::occupancy_t::is_requirable] 70565 70566[indexterm2 boost_asio.indexterm.execution__occupancy_t.is_requirable..is_requirable..execution::occupancy_t] 70567The [link boost_asio.reference.execution__occupancy_t `execution::occupancy_t`] property cannot be required. 70568 70569 70570 static constexpr bool is_requirable = false; 70571 70572 70573 70574[endsect] 70575 70576 70577 70578[section:polymorphic_query_result_type execution::occupancy_t::polymorphic_query_result_type] 70579 70580[indexterm2 boost_asio.indexterm.execution__occupancy_t.polymorphic_query_result_type..polymorphic_query_result_type..execution::occupancy_t] 70581The type returned by queries against an `any_executor`. 70582 70583 70584 typedef std::size_t polymorphic_query_result_type; 70585 70586 70587 70588[heading Requirements] 70589 70590['Header: ][^boost/asio/execution/occupancy.hpp] 70591 70592['Convenience header: ][^boost/asio/execution.hpp] 70593 70594 70595[endsect] 70596 70597 70598 70599[endsect] 70600 70601 70602[section:execution__outstanding_work execution::outstanding_work] 70603 70604[indexterm1 boost_asio.indexterm.execution__outstanding_work..execution::outstanding_work] 70605A special value used for accessing the [link boost_asio.reference.execution__outstanding_work_t `execution::outstanding_work_t`] property. 70606 70607 70608 constexpr outstanding_work_t outstanding_work; 70609 70610 70611[heading Requirements] 70612 70613['Header: ][^boost/asio/execution/outstanding_work.hpp] 70614 70615['Convenience header: ][^boost/asio/execution.hpp] 70616 70617 70618[endsect] 70619 70620 70621[section:execution__outstanding_work_t execution::outstanding_work_t] 70622 70623[indexterm1 boost_asio.indexterm.execution__outstanding_work_t..execution::outstanding_work_t] 70624 70625 70626A property to describe whether task submission is likely in the future. 70627 70628 70629 struct outstanding_work_t 70630 70631 70632[heading Types] 70633[table 70634 [[Name][Description]] 70635 70636 [ 70637 70638 [[link boost_asio.reference.execution__outstanding_work_t__tracked_t [*tracked_t]]] 70639 [A sub-property that indicates that the executor represents likely future submission of a function object. ] 70640 70641 ] 70642 70643 [ 70644 70645 [[link boost_asio.reference.execution__outstanding_work_t__untracked_t [*untracked_t]]] 70646 [A sub-property that indicates that the executor does not represent likely future submission of a function object. ] 70647 70648 ] 70649 70650 [ 70651 70652 [[link boost_asio.reference.execution__outstanding_work_t.polymorphic_query_result_type [*polymorphic_query_result_type]]] 70653 [The type returned by queries against an any_executor. ] 70654 70655 ] 70656 70657] 70658 70659[heading Member Functions] 70660[table 70661 [[Name][Description]] 70662 70663 [ 70664 [[link boost_asio.reference.execution__outstanding_work_t.outstanding_work_t [*outstanding_work_t]] [constructor]] 70665 [Default constructor. 70666 [hr] 70667 Construct from a sub-property value. ] 70668 ] 70669 70670] 70671 70672[heading Data Members] 70673[table 70674 [[Name][Description]] 70675 70676 [ 70677 [[link boost_asio.reference.execution__outstanding_work_t.is_applicable_property_v [*is_applicable_property_v]] [static]] 70678 [The outstanding_work_t property applies to executors, senders, and schedulers. ] 70679 ] 70680 70681 [ 70682 [[link boost_asio.reference.execution__outstanding_work_t.is_preferable [*is_preferable]] [static]] 70683 [The top-level outstanding_work_t property cannot be preferred. ] 70684 ] 70685 70686 [ 70687 [[link boost_asio.reference.execution__outstanding_work_t.is_requirable [*is_requirable]] [static]] 70688 [The top-level outstanding_work_t property cannot be required. ] 70689 ] 70690 70691 [ 70692 [[link boost_asio.reference.execution__outstanding_work_t.tracked [*tracked]] [static]] 70693 [A special value used for accessing the outstanding_work_t::tracked_t property. ] 70694 ] 70695 70696 [ 70697 [[link boost_asio.reference.execution__outstanding_work_t.untracked [*untracked]] [static]] 70698 [A special value used for accessing the outstanding_work_t::untracked_t property. ] 70699 ] 70700 70701] 70702 70703[heading Friends] 70704[table 70705 [[Name][Description]] 70706 70707 [ 70708 [[link boost_asio.reference.execution__outstanding_work_t.operator_not__eq_ [*operator!=]]] 70709 [Compare property values for inequality. ] 70710 ] 70711 70712 [ 70713 [[link boost_asio.reference.execution__outstanding_work_t.operator_eq__eq_ [*operator==]]] 70714 [Compare property values for equality. ] 70715 ] 70716 70717] 70718 70719[heading Requirements] 70720 70721['Header: ][^boost/asio/execution/outstanding_work.hpp] 70722 70723['Convenience header: ][^boost/asio/execution.hpp] 70724 70725 70726[section:is_applicable_property_v execution::outstanding_work_t::is_applicable_property_v] 70727 70728[indexterm2 boost_asio.indexterm.execution__outstanding_work_t.is_applicable_property_v..is_applicable_property_v..execution::outstanding_work_t] 70729The [link boost_asio.reference.execution__outstanding_work_t `execution::outstanding_work_t`] property applies to executors, senders, and schedulers. 70730 70731 70732 template <typename T> 70733 static constexpr bool is_applicable_property_v = 70734 is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>; 70735 70736 70737 70738[endsect] 70739 70740 70741 70742[section:is_preferable execution::outstanding_work_t::is_preferable] 70743 70744[indexterm2 boost_asio.indexterm.execution__outstanding_work_t.is_preferable..is_preferable..execution::outstanding_work_t] 70745The top-level [link boost_asio.reference.execution__outstanding_work_t `execution::outstanding_work_t`] property cannot be preferred. 70746 70747 70748 static constexpr bool is_preferable = false; 70749 70750 70751 70752[endsect] 70753 70754 70755 70756[section:is_requirable execution::outstanding_work_t::is_requirable] 70757 70758[indexterm2 boost_asio.indexterm.execution__outstanding_work_t.is_requirable..is_requirable..execution::outstanding_work_t] 70759The top-level [link boost_asio.reference.execution__outstanding_work_t `execution::outstanding_work_t`] property cannot be required. 70760 70761 70762 static constexpr bool is_requirable = false; 70763 70764 70765 70766[endsect] 70767 70768 70769 70770[section:operator_not__eq_ execution::outstanding_work_t::operator!=] 70771 70772[indexterm2 boost_asio.indexterm.execution__outstanding_work_t.operator_not__eq_..operator!=..execution::outstanding_work_t] 70773Compare property values for inequality. 70774 70775 70776 friend constexpr bool operator!=( 70777 const outstanding_work_t & a, 70778 const outstanding_work_t & b); 70779 70780 70781[heading Requirements] 70782 70783['Header: ][^boost/asio/execution/outstanding_work.hpp] 70784 70785['Convenience header: ][^boost/asio/execution.hpp] 70786 70787 70788[endsect] 70789 70790 70791 70792[section:operator_eq__eq_ execution::outstanding_work_t::operator==] 70793 70794[indexterm2 boost_asio.indexterm.execution__outstanding_work_t.operator_eq__eq_..operator==..execution::outstanding_work_t] 70795Compare property values for equality. 70796 70797 70798 friend constexpr bool operator==( 70799 const outstanding_work_t & a, 70800 const outstanding_work_t & b); 70801 70802 70803[heading Requirements] 70804 70805['Header: ][^boost/asio/execution/outstanding_work.hpp] 70806 70807['Convenience header: ][^boost/asio/execution.hpp] 70808 70809 70810[endsect] 70811 70812 70813[section:outstanding_work_t execution::outstanding_work_t::outstanding_work_t] 70814 70815[indexterm2 boost_asio.indexterm.execution__outstanding_work_t.outstanding_work_t..outstanding_work_t..execution::outstanding_work_t] 70816Default constructor. 70817 70818 70819 constexpr ``[link boost_asio.reference.execution__outstanding_work_t.outstanding_work_t.overload1 outstanding_work_t]``(); 70820 `` [''''»''' [link boost_asio.reference.execution__outstanding_work_t.outstanding_work_t.overload1 more...]]`` 70821 70822 70823Construct from a sub-property value. 70824 70825 70826 constexpr ``[link boost_asio.reference.execution__outstanding_work_t.outstanding_work_t.overload2 outstanding_work_t]``( 70827 untracked_t ); 70828 `` [''''»''' [link boost_asio.reference.execution__outstanding_work_t.outstanding_work_t.overload2 more...]]`` 70829 70830 constexpr ``[link boost_asio.reference.execution__outstanding_work_t.outstanding_work_t.overload3 outstanding_work_t]``( 70831 tracked_t ); 70832 `` [''''»''' [link boost_asio.reference.execution__outstanding_work_t.outstanding_work_t.overload3 more...]]`` 70833 70834 70835[section:overload1 execution::outstanding_work_t::outstanding_work_t (1 of 3 overloads)] 70836 70837 70838Default constructor. 70839 70840 70841 constexpr outstanding_work_t(); 70842 70843 70844 70845[endsect] 70846 70847 70848 70849[section:overload2 execution::outstanding_work_t::outstanding_work_t (2 of 3 overloads)] 70850 70851 70852Construct from a sub-property value. 70853 70854 70855 constexpr outstanding_work_t( 70856 untracked_t ); 70857 70858 70859 70860[endsect] 70861 70862 70863 70864[section:overload3 execution::outstanding_work_t::outstanding_work_t (3 of 3 overloads)] 70865 70866 70867Construct from a sub-property value. 70868 70869 70870 constexpr outstanding_work_t( 70871 tracked_t ); 70872 70873 70874 70875[endsect] 70876 70877 70878[endsect] 70879 70880 70881[section:polymorphic_query_result_type execution::outstanding_work_t::polymorphic_query_result_type] 70882 70883[indexterm2 boost_asio.indexterm.execution__outstanding_work_t.polymorphic_query_result_type..polymorphic_query_result_type..execution::outstanding_work_t] 70884The type returned by queries against an `any_executor`. 70885 70886 70887 typedef outstanding_work_t polymorphic_query_result_type; 70888 70889 70890 70891[heading Requirements] 70892 70893['Header: ][^boost/asio/execution/outstanding_work.hpp] 70894 70895['Convenience header: ][^boost/asio/execution.hpp] 70896 70897 70898[endsect] 70899 70900 70901 70902[section:tracked execution::outstanding_work_t::tracked] 70903 70904[indexterm2 boost_asio.indexterm.execution__outstanding_work_t.tracked..tracked..execution::outstanding_work_t] 70905A special value used for accessing the [link boost_asio.reference.execution__outstanding_work_t__tracked_t `execution::outstanding_work_t::tracked_t`] property. 70906 70907 70908 static constexpr tracked_t tracked; 70909 70910 70911 70912[endsect] 70913 70914 70915 70916[section:untracked execution::outstanding_work_t::untracked] 70917 70918[indexterm2 boost_asio.indexterm.execution__outstanding_work_t.untracked..untracked..execution::outstanding_work_t] 70919A special value used for accessing the [link boost_asio.reference.execution__outstanding_work_t__untracked_t `execution::outstanding_work_t::untracked_t`] property. 70920 70921 70922 static constexpr untracked_t untracked; 70923 70924 70925 70926[endsect] 70927 70928 70929 70930[endsect] 70931 70932[section:execution__outstanding_work_t__tracked_t execution::outstanding_work_t::tracked_t] 70933 70934[indexterm1 boost_asio.indexterm.execution__outstanding_work_t__tracked_t..execution::outstanding_work_t::tracked_t] 70935 70936 70937A sub-property that indicates that the executor represents likely future submission of a function object. 70938 70939 70940 struct tracked_t 70941 70942 70943[heading Types] 70944[table 70945 [[Name][Description]] 70946 70947 [ 70948 70949 [[link boost_asio.reference.execution__outstanding_work_t__tracked_t.polymorphic_query_result_type [*polymorphic_query_result_type]]] 70950 [The type returned by queries against an any_executor. ] 70951 70952 ] 70953 70954] 70955 70956[heading Member Functions] 70957[table 70958 [[Name][Description]] 70959 70960 [ 70961 [[link boost_asio.reference.execution__outstanding_work_t__tracked_t.tracked_t [*tracked_t]] [constructor]] 70962 [Default constructor. ] 70963 ] 70964 70965 [ 70966 [[link boost_asio.reference.execution__outstanding_work_t__tracked_t.value [*value]] [static]] 70967 [Get the value associated with a property object. ] 70968 ] 70969 70970] 70971 70972[heading Data Members] 70973[table 70974 [[Name][Description]] 70975 70976 [ 70977 [[link boost_asio.reference.execution__outstanding_work_t__tracked_t.is_applicable_property_v [*is_applicable_property_v]] [static]] 70978 [The outstanding_work_t::untracked_t property applies to executors, senders, and schedulers. ] 70979 ] 70980 70981 [ 70982 [[link boost_asio.reference.execution__outstanding_work_t__tracked_t.is_preferable [*is_preferable]] [static]] 70983 [The outstanding_work_t::tracked_t property can be preferred. ] 70984 ] 70985 70986 [ 70987 [[link boost_asio.reference.execution__outstanding_work_t__tracked_t.is_requirable [*is_requirable]] [static]] 70988 [The outstanding_work_t::tracked_t property can be required. ] 70989 ] 70990 70991] 70992 70993[heading Requirements] 70994 70995['Header: ][^boost/asio/execution/outstanding_work.hpp] 70996 70997['Convenience header: ][^boost/asio/execution.hpp] 70998 70999 71000[section:is_applicable_property_v execution::outstanding_work_t::tracked_t::is_applicable_property_v] 71001 71002[indexterm2 boost_asio.indexterm.execution__outstanding_work_t__tracked_t.is_applicable_property_v..is_applicable_property_v..execution::outstanding_work_t::tracked_t] 71003The [link boost_asio.reference.execution__outstanding_work_t__untracked_t `execution::outstanding_work_t::untracked_t`] property applies to executors, senders, and schedulers. 71004 71005 71006 template <typename T> 71007 static constexpr bool is_applicable_property_v = 71008 is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>; 71009 71010 71011 71012[endsect] 71013 71014 71015 71016[section:is_preferable execution::outstanding_work_t::tracked_t::is_preferable] 71017 71018[indexterm2 boost_asio.indexterm.execution__outstanding_work_t__tracked_t.is_preferable..is_preferable..execution::outstanding_work_t::tracked_t] 71019The [link boost_asio.reference.execution__outstanding_work_t__tracked_t `execution::outstanding_work_t::tracked_t`] property can be preferred. 71020 71021 71022 static constexpr bool is_preferable = true; 71023 71024 71025 71026[endsect] 71027 71028 71029 71030[section:is_requirable execution::outstanding_work_t::tracked_t::is_requirable] 71031 71032[indexterm2 boost_asio.indexterm.execution__outstanding_work_t__tracked_t.is_requirable..is_requirable..execution::outstanding_work_t::tracked_t] 71033The [link boost_asio.reference.execution__outstanding_work_t__tracked_t `execution::outstanding_work_t::tracked_t`] property can be required. 71034 71035 71036 static constexpr bool is_requirable = true; 71037 71038 71039 71040[endsect] 71041 71042 71043 71044[section:polymorphic_query_result_type execution::outstanding_work_t::tracked_t::polymorphic_query_result_type] 71045 71046[indexterm2 boost_asio.indexterm.execution__outstanding_work_t__tracked_t.polymorphic_query_result_type..polymorphic_query_result_type..execution::outstanding_work_t::tracked_t] 71047The type returned by queries against an `any_executor`. 71048 71049 71050 typedef outstanding_work_t polymorphic_query_result_type; 71051 71052 71053 71054[heading Requirements] 71055 71056['Header: ][^boost/asio/execution/outstanding_work.hpp] 71057 71058['Convenience header: ][^boost/asio/execution.hpp] 71059 71060 71061[endsect] 71062 71063 71064 71065[section:tracked_t execution::outstanding_work_t::tracked_t::tracked_t] 71066 71067[indexterm2 boost_asio.indexterm.execution__outstanding_work_t__tracked_t.tracked_t..tracked_t..execution::outstanding_work_t::tracked_t] 71068Default constructor. 71069 71070 71071 constexpr tracked_t(); 71072 71073 71074 71075[endsect] 71076 71077 71078 71079[section:value execution::outstanding_work_t::tracked_t::value] 71080 71081[indexterm2 boost_asio.indexterm.execution__outstanding_work_t__tracked_t.value..value..execution::outstanding_work_t::tracked_t] 71082Get the value associated with a property object. 71083 71084 71085 static constexpr outstanding_work_t value(); 71086 71087 71088 71089[heading Return Value] 71090 71091`tracked_t()`; 71092 71093 71094 71095 71096[endsect] 71097 71098 71099 71100[endsect] 71101 71102[section:execution__outstanding_work_t__untracked_t execution::outstanding_work_t::untracked_t] 71103 71104[indexterm1 boost_asio.indexterm.execution__outstanding_work_t__untracked_t..execution::outstanding_work_t::untracked_t] 71105 71106 71107A sub-property that indicates that the executor does not represent likely future submission of a function object. 71108 71109 71110 struct untracked_t 71111 71112 71113[heading Types] 71114[table 71115 [[Name][Description]] 71116 71117 [ 71118 71119 [[link boost_asio.reference.execution__outstanding_work_t__untracked_t.polymorphic_query_result_type [*polymorphic_query_result_type]]] 71120 [The type returned by queries against an any_executor. ] 71121 71122 ] 71123 71124] 71125 71126[heading Member Functions] 71127[table 71128 [[Name][Description]] 71129 71130 [ 71131 [[link boost_asio.reference.execution__outstanding_work_t__untracked_t.untracked_t [*untracked_t]] [constructor]] 71132 [Default constructor. ] 71133 ] 71134 71135 [ 71136 [[link boost_asio.reference.execution__outstanding_work_t__untracked_t.value [*value]] [static]] 71137 [Get the value associated with a property object. ] 71138 ] 71139 71140] 71141 71142[heading Data Members] 71143[table 71144 [[Name][Description]] 71145 71146 [ 71147 [[link boost_asio.reference.execution__outstanding_work_t__untracked_t.is_applicable_property_v [*is_applicable_property_v]] [static]] 71148 [The outstanding_work_t::untracked_t property applies to executors, senders, and schedulers. ] 71149 ] 71150 71151 [ 71152 [[link boost_asio.reference.execution__outstanding_work_t__untracked_t.is_preferable [*is_preferable]] [static]] 71153 [The outstanding_work_t::untracked_t property can be preferred. ] 71154 ] 71155 71156 [ 71157 [[link boost_asio.reference.execution__outstanding_work_t__untracked_t.is_requirable [*is_requirable]] [static]] 71158 [The outstanding_work_t::untracked_t property can be required. ] 71159 ] 71160 71161] 71162 71163[heading Requirements] 71164 71165['Header: ][^boost/asio/execution/outstanding_work.hpp] 71166 71167['Convenience header: ][^boost/asio/execution.hpp] 71168 71169 71170[section:is_applicable_property_v execution::outstanding_work_t::untracked_t::is_applicable_property_v] 71171 71172[indexterm2 boost_asio.indexterm.execution__outstanding_work_t__untracked_t.is_applicable_property_v..is_applicable_property_v..execution::outstanding_work_t::untracked_t] 71173The [link boost_asio.reference.execution__outstanding_work_t__untracked_t `execution::outstanding_work_t::untracked_t`] property applies to executors, senders, and schedulers. 71174 71175 71176 template <typename T> 71177 static constexpr bool is_applicable_property_v = 71178 is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>; 71179 71180 71181 71182[endsect] 71183 71184 71185 71186[section:is_preferable execution::outstanding_work_t::untracked_t::is_preferable] 71187 71188[indexterm2 boost_asio.indexterm.execution__outstanding_work_t__untracked_t.is_preferable..is_preferable..execution::outstanding_work_t::untracked_t] 71189The [link boost_asio.reference.execution__outstanding_work_t__untracked_t `execution::outstanding_work_t::untracked_t`] property can be preferred. 71190 71191 71192 static constexpr bool is_preferable = true; 71193 71194 71195 71196[endsect] 71197 71198 71199 71200[section:is_requirable execution::outstanding_work_t::untracked_t::is_requirable] 71201 71202[indexterm2 boost_asio.indexterm.execution__outstanding_work_t__untracked_t.is_requirable..is_requirable..execution::outstanding_work_t::untracked_t] 71203The [link boost_asio.reference.execution__outstanding_work_t__untracked_t `execution::outstanding_work_t::untracked_t`] property can be required. 71204 71205 71206 static constexpr bool is_requirable = true; 71207 71208 71209 71210[endsect] 71211 71212 71213 71214[section:polymorphic_query_result_type execution::outstanding_work_t::untracked_t::polymorphic_query_result_type] 71215 71216[indexterm2 boost_asio.indexterm.execution__outstanding_work_t__untracked_t.polymorphic_query_result_type..polymorphic_query_result_type..execution::outstanding_work_t::untracked_t] 71217The type returned by queries against an `any_executor`. 71218 71219 71220 typedef outstanding_work_t polymorphic_query_result_type; 71221 71222 71223 71224[heading Requirements] 71225 71226['Header: ][^boost/asio/execution/outstanding_work.hpp] 71227 71228['Convenience header: ][^boost/asio/execution.hpp] 71229 71230 71231[endsect] 71232 71233 71234 71235[section:untracked_t execution::outstanding_work_t::untracked_t::untracked_t] 71236 71237[indexterm2 boost_asio.indexterm.execution__outstanding_work_t__untracked_t.untracked_t..untracked_t..execution::outstanding_work_t::untracked_t] 71238Default constructor. 71239 71240 71241 constexpr untracked_t(); 71242 71243 71244 71245[endsect] 71246 71247 71248 71249[section:value execution::outstanding_work_t::untracked_t::value] 71250 71251[indexterm2 boost_asio.indexterm.execution__outstanding_work_t__untracked_t.value..value..execution::outstanding_work_t::untracked_t] 71252Get the value associated with a property object. 71253 71254 71255 static constexpr outstanding_work_t value(); 71256 71257 71258 71259[heading Return Value] 71260 71261`untracked_t()`; 71262 71263 71264 71265 71266[endsect] 71267 71268 71269 71270[endsect] 71271 71272[section:execution__prefer_only execution::prefer_only] 71273 71274[indexterm1 boost_asio.indexterm.execution__prefer_only..execution::prefer_only] 71275 71276 71277A property adapter that is used with the polymorphic executor wrapper to mark properties as preferable, but not requirable. 71278 71279 71280 template< 71281 typename Property> 71282 struct prefer_only 71283 71284 71285[heading Types] 71286[table 71287 [[Name][Description]] 71288 71289 [ 71290 71291 [[link boost_asio.reference.execution__prefer_only.polymorphic_query_result_type [*polymorphic_query_result_type]]] 71292 [The type returned by queries against an any_executor. ] 71293 71294 ] 71295 71296] 71297 71298[heading Data Members] 71299[table 71300 [[Name][Description]] 71301 71302 [ 71303 [[link boost_asio.reference.execution__prefer_only.is_applicable_property_v [*is_applicable_property_v]] [static]] 71304 [The prefer_only adapter applies to the same types as the nested property. ] 71305 ] 71306 71307 [ 71308 [[link boost_asio.reference.execution__prefer_only.is_preferable [*is_preferable]] [static]] 71309 [The context_t property can be preferred, it the underlying property can be preferred. ] 71310 ] 71311 71312 [ 71313 [[link boost_asio.reference.execution__prefer_only.is_requirable [*is_requirable]] [static]] 71314 [The context_t property cannot be required. ] 71315 ] 71316 71317] 71318 71319[heading Requirements] 71320 71321['Header: ][^boost/asio/execution/prefer_only.hpp] 71322 71323['Convenience header: ][^boost/asio/execution.hpp] 71324 71325 71326[section:is_applicable_property_v execution::prefer_only::is_applicable_property_v] 71327 71328[indexterm2 boost_asio.indexterm.execution__prefer_only.is_applicable_property_v..is_applicable_property_v..execution::prefer_only] 71329The [link boost_asio.reference.execution__prefer_only `execution::prefer_only`] adapter applies to the same types as the nested property. 71330 71331 71332 template <typename T> 71333 static constexpr bool is_applicable_property_v =is_applicable_property<T, Property>::value; 71334 71335 71336 71337[endsect] 71338 71339 71340 71341[section:is_preferable execution::prefer_only::is_preferable] 71342 71343[indexterm2 boost_asio.indexterm.execution__prefer_only.is_preferable..is_preferable..execution::prefer_only] 71344The [link boost_asio.reference.execution__context_t `execution::context_t`] property can be preferred, it the underlying property can be preferred. 71345 71346 71347 static constexpr bool is_preferable = automatically_determined; 71348 71349 71350`true` if `Property::is_preferable` is `true`, otherwise `false`. 71351 71352 71353[endsect] 71354 71355 71356 71357[section:is_requirable execution::prefer_only::is_requirable] 71358 71359[indexterm2 boost_asio.indexterm.execution__prefer_only.is_requirable..is_requirable..execution::prefer_only] 71360The [link boost_asio.reference.execution__context_t `execution::context_t`] property cannot be required. 71361 71362 71363 static constexpr bool is_requirable = false; 71364 71365 71366 71367[endsect] 71368 71369 71370 71371[section:polymorphic_query_result_type execution::prefer_only::polymorphic_query_result_type] 71372 71373[indexterm2 boost_asio.indexterm.execution__prefer_only.polymorphic_query_result_type..polymorphic_query_result_type..execution::prefer_only] 71374The type returned by queries against an `any_executor`. 71375 71376 71377 typedef Property::polymorphic_query_result_type polymorphic_query_result_type; 71378 71379 71380 71381[heading Requirements] 71382 71383['Header: ][^boost/asio/execution/prefer_only.hpp] 71384 71385['Convenience header: ][^boost/asio/execution.hpp] 71386 71387 71388[endsect] 71389 71390 71391 71392[endsect] 71393 71394[section:execution__receiver_invocation_error execution::receiver_invocation_error] 71395 71396[indexterm1 boost_asio.indexterm.execution__receiver_invocation_error..execution::receiver_invocation_error] 71397 71398 71399Exception reported via `set_error` when an exception escapes from `set_value`. 71400 71401 71402 class receiver_invocation_error 71403 71404 71405[heading Member Functions] 71406[table 71407 [[Name][Description]] 71408 71409 [ 71410 [[link boost_asio.reference.execution__receiver_invocation_error.receiver_invocation_error [*receiver_invocation_error]] [constructor]] 71411 [Constructor. ] 71412 ] 71413 71414] 71415 71416[heading Requirements] 71417 71418['Header: ][^boost/asio/execution/receiver_invocation_error.hpp] 71419 71420['Convenience header: ][^boost/asio/execution.hpp] 71421 71422 71423[section:receiver_invocation_error execution::receiver_invocation_error::receiver_invocation_error] 71424 71425[indexterm2 boost_asio.indexterm.execution__receiver_invocation_error.receiver_invocation_error..receiver_invocation_error..execution::receiver_invocation_error] 71426Constructor. 71427 71428 71429 receiver_invocation_error(); 71430 71431 71432 71433[endsect] 71434 71435 71436 71437[endsect] 71438 71439 71440[section:execution__relationship execution::relationship] 71441 71442[indexterm1 boost_asio.indexterm.execution__relationship..execution::relationship] 71443A special value used for accessing the [link boost_asio.reference.execution__relationship_t `execution::relationship_t`] property. 71444 71445 71446 constexpr relationship_t relationship; 71447 71448 71449[heading Requirements] 71450 71451['Header: ][^boost/asio/execution/relationship.hpp] 71452 71453['Convenience header: ][^boost/asio/execution.hpp] 71454 71455 71456[endsect] 71457 71458 71459[section:execution__relationship_t execution::relationship_t] 71460 71461[indexterm1 boost_asio.indexterm.execution__relationship_t..execution::relationship_t] 71462 71463 71464A property to describe whether submitted tasks represent continuations of the calling context. 71465 71466 71467 struct relationship_t 71468 71469 71470[heading Types] 71471[table 71472 [[Name][Description]] 71473 71474 [ 71475 71476 [[link boost_asio.reference.execution__relationship_t__continuation_t [*continuation_t]]] 71477 [A sub-property that indicates that the executor represents a continuation of the calling context. ] 71478 71479 ] 71480 71481 [ 71482 71483 [[link boost_asio.reference.execution__relationship_t__fork_t [*fork_t]]] 71484 [A sub-property that indicates that the executor does not represent a continuation of the calling context. ] 71485 71486 ] 71487 71488 [ 71489 71490 [[link boost_asio.reference.execution__relationship_t.polymorphic_query_result_type [*polymorphic_query_result_type]]] 71491 [The type returned by queries against an any_executor. ] 71492 71493 ] 71494 71495] 71496 71497[heading Member Functions] 71498[table 71499 [[Name][Description]] 71500 71501 [ 71502 [[link boost_asio.reference.execution__relationship_t.relationship_t [*relationship_t]] [constructor]] 71503 [Default constructor. 71504 [hr] 71505 Construct from a sub-property value. ] 71506 ] 71507 71508] 71509 71510[heading Data Members] 71511[table 71512 [[Name][Description]] 71513 71514 [ 71515 [[link boost_asio.reference.execution__relationship_t.continuation [*continuation]] [static]] 71516 [A special value used for accessing the relationship_t::continuation_t property. ] 71517 ] 71518 71519 [ 71520 [[link boost_asio.reference.execution__relationship_t.fork [*fork]] [static]] 71521 [A special value used for accessing the relationship_t::fork_t property. ] 71522 ] 71523 71524 [ 71525 [[link boost_asio.reference.execution__relationship_t.is_applicable_property_v [*is_applicable_property_v]] [static]] 71526 [The relationship_t property applies to executors, senders, and schedulers. ] 71527 ] 71528 71529 [ 71530 [[link boost_asio.reference.execution__relationship_t.is_preferable [*is_preferable]] [static]] 71531 [The top-level relationship_t property cannot be preferred. ] 71532 ] 71533 71534 [ 71535 [[link boost_asio.reference.execution__relationship_t.is_requirable [*is_requirable]] [static]] 71536 [The top-level relationship_t property cannot be required. ] 71537 ] 71538 71539] 71540 71541[heading Friends] 71542[table 71543 [[Name][Description]] 71544 71545 [ 71546 [[link boost_asio.reference.execution__relationship_t.operator_not__eq_ [*operator!=]]] 71547 [Compare property values for inequality. ] 71548 ] 71549 71550 [ 71551 [[link boost_asio.reference.execution__relationship_t.operator_eq__eq_ [*operator==]]] 71552 [Compare property values for equality. ] 71553 ] 71554 71555] 71556 71557[heading Requirements] 71558 71559['Header: ][^boost/asio/execution/relationship.hpp] 71560 71561['Convenience header: ][^boost/asio/execution.hpp] 71562 71563 71564[section:continuation execution::relationship_t::continuation] 71565 71566[indexterm2 boost_asio.indexterm.execution__relationship_t.continuation..continuation..execution::relationship_t] 71567A special value used for accessing the [link boost_asio.reference.execution__relationship_t__continuation_t `execution::relationship_t::continuation_t`] property. 71568 71569 71570 static constexpr continuation_t continuation; 71571 71572 71573 71574[endsect] 71575 71576 71577 71578[section:fork execution::relationship_t::fork] 71579 71580[indexterm2 boost_asio.indexterm.execution__relationship_t.fork..fork..execution::relationship_t] 71581A special value used for accessing the [link boost_asio.reference.execution__relationship_t__fork_t `execution::relationship_t::fork_t`] property. 71582 71583 71584 static constexpr fork_t fork; 71585 71586 71587 71588[endsect] 71589 71590 71591 71592[section:is_applicable_property_v execution::relationship_t::is_applicable_property_v] 71593 71594[indexterm2 boost_asio.indexterm.execution__relationship_t.is_applicable_property_v..is_applicable_property_v..execution::relationship_t] 71595The [link boost_asio.reference.execution__relationship_t `execution::relationship_t`] property applies to executors, senders, and schedulers. 71596 71597 71598 template <typename T> 71599 static constexpr bool is_applicable_property_v = 71600 is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>; 71601 71602 71603 71604[endsect] 71605 71606 71607 71608[section:is_preferable execution::relationship_t::is_preferable] 71609 71610[indexterm2 boost_asio.indexterm.execution__relationship_t.is_preferable..is_preferable..execution::relationship_t] 71611The top-level [link boost_asio.reference.execution__relationship_t `execution::relationship_t`] property cannot be preferred. 71612 71613 71614 static constexpr bool is_preferable = false; 71615 71616 71617 71618[endsect] 71619 71620 71621 71622[section:is_requirable execution::relationship_t::is_requirable] 71623 71624[indexterm2 boost_asio.indexterm.execution__relationship_t.is_requirable..is_requirable..execution::relationship_t] 71625The top-level [link boost_asio.reference.execution__relationship_t `execution::relationship_t`] property cannot be required. 71626 71627 71628 static constexpr bool is_requirable = false; 71629 71630 71631 71632[endsect] 71633 71634 71635 71636[section:operator_not__eq_ execution::relationship_t::operator!=] 71637 71638[indexterm2 boost_asio.indexterm.execution__relationship_t.operator_not__eq_..operator!=..execution::relationship_t] 71639Compare property values for inequality. 71640 71641 71642 friend constexpr bool operator!=( 71643 const relationship_t & a, 71644 const relationship_t & b); 71645 71646 71647[heading Requirements] 71648 71649['Header: ][^boost/asio/execution/relationship.hpp] 71650 71651['Convenience header: ][^boost/asio/execution.hpp] 71652 71653 71654[endsect] 71655 71656 71657 71658[section:operator_eq__eq_ execution::relationship_t::operator==] 71659 71660[indexterm2 boost_asio.indexterm.execution__relationship_t.operator_eq__eq_..operator==..execution::relationship_t] 71661Compare property values for equality. 71662 71663 71664 friend constexpr bool operator==( 71665 const relationship_t & a, 71666 const relationship_t & b); 71667 71668 71669[heading Requirements] 71670 71671['Header: ][^boost/asio/execution/relationship.hpp] 71672 71673['Convenience header: ][^boost/asio/execution.hpp] 71674 71675 71676[endsect] 71677 71678 71679 71680[section:polymorphic_query_result_type execution::relationship_t::polymorphic_query_result_type] 71681 71682[indexterm2 boost_asio.indexterm.execution__relationship_t.polymorphic_query_result_type..polymorphic_query_result_type..execution::relationship_t] 71683The type returned by queries against an `any_executor`. 71684 71685 71686 typedef relationship_t polymorphic_query_result_type; 71687 71688 71689 71690[heading Requirements] 71691 71692['Header: ][^boost/asio/execution/relationship.hpp] 71693 71694['Convenience header: ][^boost/asio/execution.hpp] 71695 71696 71697[endsect] 71698 71699 71700[section:relationship_t execution::relationship_t::relationship_t] 71701 71702[indexterm2 boost_asio.indexterm.execution__relationship_t.relationship_t..relationship_t..execution::relationship_t] 71703Default constructor. 71704 71705 71706 constexpr ``[link boost_asio.reference.execution__relationship_t.relationship_t.overload1 relationship_t]``(); 71707 `` [''''»''' [link boost_asio.reference.execution__relationship_t.relationship_t.overload1 more...]]`` 71708 71709 71710Construct from a sub-property value. 71711 71712 71713 constexpr ``[link boost_asio.reference.execution__relationship_t.relationship_t.overload2 relationship_t]``( 71714 fork_t ); 71715 `` [''''»''' [link boost_asio.reference.execution__relationship_t.relationship_t.overload2 more...]]`` 71716 71717 constexpr ``[link boost_asio.reference.execution__relationship_t.relationship_t.overload3 relationship_t]``( 71718 continuation_t ); 71719 `` [''''»''' [link boost_asio.reference.execution__relationship_t.relationship_t.overload3 more...]]`` 71720 71721 71722[section:overload1 execution::relationship_t::relationship_t (1 of 3 overloads)] 71723 71724 71725Default constructor. 71726 71727 71728 constexpr relationship_t(); 71729 71730 71731 71732[endsect] 71733 71734 71735 71736[section:overload2 execution::relationship_t::relationship_t (2 of 3 overloads)] 71737 71738 71739Construct from a sub-property value. 71740 71741 71742 constexpr relationship_t( 71743 fork_t ); 71744 71745 71746 71747[endsect] 71748 71749 71750 71751[section:overload3 execution::relationship_t::relationship_t (3 of 3 overloads)] 71752 71753 71754Construct from a sub-property value. 71755 71756 71757 constexpr relationship_t( 71758 continuation_t ); 71759 71760 71761 71762[endsect] 71763 71764 71765[endsect] 71766 71767 71768[endsect] 71769 71770[section:execution__relationship_t__continuation_t execution::relationship_t::continuation_t] 71771 71772[indexterm1 boost_asio.indexterm.execution__relationship_t__continuation_t..execution::relationship_t::continuation_t] 71773 71774 71775A sub-property that indicates that the executor represents a continuation of the calling context. 71776 71777 71778 struct continuation_t 71779 71780 71781[heading Types] 71782[table 71783 [[Name][Description]] 71784 71785 [ 71786 71787 [[link boost_asio.reference.execution__relationship_t__continuation_t.polymorphic_query_result_type [*polymorphic_query_result_type]]] 71788 [The type returned by queries against an any_executor. ] 71789 71790 ] 71791 71792] 71793 71794[heading Member Functions] 71795[table 71796 [[Name][Description]] 71797 71798 [ 71799 [[link boost_asio.reference.execution__relationship_t__continuation_t.continuation_t [*continuation_t]] [constructor]] 71800 [Default constructor. ] 71801 ] 71802 71803 [ 71804 [[link boost_asio.reference.execution__relationship_t__continuation_t.value [*value]] [static]] 71805 [Get the value associated with a property object. ] 71806 ] 71807 71808] 71809 71810[heading Data Members] 71811[table 71812 [[Name][Description]] 71813 71814 [ 71815 [[link boost_asio.reference.execution__relationship_t__continuation_t.is_applicable_property_v [*is_applicable_property_v]] [static]] 71816 [The relationship_t::continuation_t property applies to executors, senders, and schedulers. ] 71817 ] 71818 71819 [ 71820 [[link boost_asio.reference.execution__relationship_t__continuation_t.is_preferable [*is_preferable]] [static]] 71821 [The relationship_t::continuation_t property can be preferred. ] 71822 ] 71823 71824 [ 71825 [[link boost_asio.reference.execution__relationship_t__continuation_t.is_requirable [*is_requirable]] [static]] 71826 [The relationship_t::continuation_t property can be required. ] 71827 ] 71828 71829] 71830 71831[heading Requirements] 71832 71833['Header: ][^boost/asio/execution/relationship.hpp] 71834 71835['Convenience header: ][^boost/asio/execution.hpp] 71836 71837 71838[section:continuation_t execution::relationship_t::continuation_t::continuation_t] 71839 71840[indexterm2 boost_asio.indexterm.execution__relationship_t__continuation_t.continuation_t..continuation_t..execution::relationship_t::continuation_t] 71841Default constructor. 71842 71843 71844 constexpr continuation_t(); 71845 71846 71847 71848[endsect] 71849 71850 71851 71852[section:is_applicable_property_v execution::relationship_t::continuation_t::is_applicable_property_v] 71853 71854[indexterm2 boost_asio.indexterm.execution__relationship_t__continuation_t.is_applicable_property_v..is_applicable_property_v..execution::relationship_t::continuation_t] 71855The [link boost_asio.reference.execution__relationship_t__continuation_t `execution::relationship_t::continuation_t`] property applies to executors, senders, and schedulers. 71856 71857 71858 template <typename T> 71859 static constexpr bool is_applicable_property_v = 71860 is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>; 71861 71862 71863 71864[endsect] 71865 71866 71867 71868[section:is_preferable execution::relationship_t::continuation_t::is_preferable] 71869 71870[indexterm2 boost_asio.indexterm.execution__relationship_t__continuation_t.is_preferable..is_preferable..execution::relationship_t::continuation_t] 71871The [link boost_asio.reference.execution__relationship_t__continuation_t `execution::relationship_t::continuation_t`] property can be preferred. 71872 71873 71874 static constexpr bool is_preferable = true; 71875 71876 71877 71878[endsect] 71879 71880 71881 71882[section:is_requirable execution::relationship_t::continuation_t::is_requirable] 71883 71884[indexterm2 boost_asio.indexterm.execution__relationship_t__continuation_t.is_requirable..is_requirable..execution::relationship_t::continuation_t] 71885The [link boost_asio.reference.execution__relationship_t__continuation_t `execution::relationship_t::continuation_t`] property can be required. 71886 71887 71888 static constexpr bool is_requirable = true; 71889 71890 71891 71892[endsect] 71893 71894 71895 71896[section:polymorphic_query_result_type execution::relationship_t::continuation_t::polymorphic_query_result_type] 71897 71898[indexterm2 boost_asio.indexterm.execution__relationship_t__continuation_t.polymorphic_query_result_type..polymorphic_query_result_type..execution::relationship_t::continuation_t] 71899The type returned by queries against an `any_executor`. 71900 71901 71902 typedef relationship_t polymorphic_query_result_type; 71903 71904 71905 71906[heading Requirements] 71907 71908['Header: ][^boost/asio/execution/relationship.hpp] 71909 71910['Convenience header: ][^boost/asio/execution.hpp] 71911 71912 71913[endsect] 71914 71915 71916 71917[section:value execution::relationship_t::continuation_t::value] 71918 71919[indexterm2 boost_asio.indexterm.execution__relationship_t__continuation_t.value..value..execution::relationship_t::continuation_t] 71920Get the value associated with a property object. 71921 71922 71923 static constexpr relationship_t value(); 71924 71925 71926 71927[heading Return Value] 71928 71929`continuation_t()`; 71930 71931 71932 71933 71934[endsect] 71935 71936 71937 71938[endsect] 71939 71940[section:execution__relationship_t__fork_t execution::relationship_t::fork_t] 71941 71942[indexterm1 boost_asio.indexterm.execution__relationship_t__fork_t..execution::relationship_t::fork_t] 71943 71944 71945A sub-property that indicates that the executor does not represent a continuation of the calling context. 71946 71947 71948 struct fork_t 71949 71950 71951[heading Types] 71952[table 71953 [[Name][Description]] 71954 71955 [ 71956 71957 [[link boost_asio.reference.execution__relationship_t__fork_t.polymorphic_query_result_type [*polymorphic_query_result_type]]] 71958 [The type returned by queries against an any_executor. ] 71959 71960 ] 71961 71962] 71963 71964[heading Member Functions] 71965[table 71966 [[Name][Description]] 71967 71968 [ 71969 [[link boost_asio.reference.execution__relationship_t__fork_t.fork_t [*fork_t]] [constructor]] 71970 [Default constructor. ] 71971 ] 71972 71973 [ 71974 [[link boost_asio.reference.execution__relationship_t__fork_t.value [*value]] [static]] 71975 [Get the value associated with a property object. ] 71976 ] 71977 71978] 71979 71980[heading Data Members] 71981[table 71982 [[Name][Description]] 71983 71984 [ 71985 [[link boost_asio.reference.execution__relationship_t__fork_t.is_applicable_property_v [*is_applicable_property_v]] [static]] 71986 [The relationship_t::fork_t property applies to executors, senders, and schedulers. ] 71987 ] 71988 71989 [ 71990 [[link boost_asio.reference.execution__relationship_t__fork_t.is_preferable [*is_preferable]] [static]] 71991 [The relationship_t::fork_t property can be preferred. ] 71992 ] 71993 71994 [ 71995 [[link boost_asio.reference.execution__relationship_t__fork_t.is_requirable [*is_requirable]] [static]] 71996 [The relationship_t::fork_t property can be required. ] 71997 ] 71998 71999] 72000 72001[heading Requirements] 72002 72003['Header: ][^boost/asio/execution/relationship.hpp] 72004 72005['Convenience header: ][^boost/asio/execution.hpp] 72006 72007 72008[section:fork_t execution::relationship_t::fork_t::fork_t] 72009 72010[indexterm2 boost_asio.indexterm.execution__relationship_t__fork_t.fork_t..fork_t..execution::relationship_t::fork_t] 72011Default constructor. 72012 72013 72014 constexpr fork_t(); 72015 72016 72017 72018[endsect] 72019 72020 72021 72022[section:is_applicable_property_v execution::relationship_t::fork_t::is_applicable_property_v] 72023 72024[indexterm2 boost_asio.indexterm.execution__relationship_t__fork_t.is_applicable_property_v..is_applicable_property_v..execution::relationship_t::fork_t] 72025The [link boost_asio.reference.execution__relationship_t__fork_t `execution::relationship_t::fork_t`] property applies to executors, senders, and schedulers. 72026 72027 72028 template <typename T> 72029 static constexpr bool is_applicable_property_v = 72030 is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>; 72031 72032 72033 72034[endsect] 72035 72036 72037 72038[section:is_preferable execution::relationship_t::fork_t::is_preferable] 72039 72040[indexterm2 boost_asio.indexterm.execution__relationship_t__fork_t.is_preferable..is_preferable..execution::relationship_t::fork_t] 72041The [link boost_asio.reference.execution__relationship_t__fork_t `execution::relationship_t::fork_t`] property can be preferred. 72042 72043 72044 static constexpr bool is_preferable = true; 72045 72046 72047 72048[endsect] 72049 72050 72051 72052[section:is_requirable execution::relationship_t::fork_t::is_requirable] 72053 72054[indexterm2 boost_asio.indexterm.execution__relationship_t__fork_t.is_requirable..is_requirable..execution::relationship_t::fork_t] 72055The [link boost_asio.reference.execution__relationship_t__fork_t `execution::relationship_t::fork_t`] property can be required. 72056 72057 72058 static constexpr bool is_requirable = true; 72059 72060 72061 72062[endsect] 72063 72064 72065 72066[section:polymorphic_query_result_type execution::relationship_t::fork_t::polymorphic_query_result_type] 72067 72068[indexterm2 boost_asio.indexterm.execution__relationship_t__fork_t.polymorphic_query_result_type..polymorphic_query_result_type..execution::relationship_t::fork_t] 72069The type returned by queries against an `any_executor`. 72070 72071 72072 typedef relationship_t polymorphic_query_result_type; 72073 72074 72075 72076[heading Requirements] 72077 72078['Header: ][^boost/asio/execution/relationship.hpp] 72079 72080['Convenience header: ][^boost/asio/execution.hpp] 72081 72082 72083[endsect] 72084 72085 72086 72087[section:value execution::relationship_t::fork_t::value] 72088 72089[indexterm2 boost_asio.indexterm.execution__relationship_t__fork_t.value..value..execution::relationship_t::fork_t] 72090Get the value associated with a property object. 72091 72092 72093 static constexpr relationship_t value(); 72094 72095 72096 72097[heading Return Value] 72098 72099`fork_t()`; 72100 72101 72102 72103 72104[endsect] 72105 72106 72107 72108[endsect] 72109 72110 72111[section:execution__schedule execution::schedule] 72112 72113[indexterm1 boost_asio.indexterm.execution__schedule..execution::schedule] 72114A customisation point that is used to obtain a sender from a scheduler. 72115 72116 72117 constexpr unspecified schedule = unspecified; 72118 72119 72120The name `execution::schedule` denotes a customisation point object. For some subexpression `s`, let `S` be a type such that `decltype((s))` is `S`. The expression `execution::schedule(s)` is expression-equivalent to: 72121 72122 72123* `s.schedule()`, if that expression is valid and its type models `sender`. 72124 72125 72126* Otherwise, `schedule(s)`, if that expression is valid and its type models `sender` with overload resolution performed in a context that includes the declaration `void schedule();` and that does not include a declaration of `execution::schedule`. 72127 72128 72129* Otherwise, `S` if `S` satisfies `executor`. 72130 72131 72132* Otherwise, `execution::schedule(s)` is ill-formed. 72133 72134 72135 72136[heading Requirements] 72137 72138['Header: ][^boost/asio/execution/schedule.hpp] 72139 72140['Convenience header: ][^boost/asio/execution.hpp] 72141 72142 72143[endsect] 72144 72145 72146 72147[section:execution__sender_base execution::sender_base] 72148 72149[indexterm1 boost_asio.indexterm.execution__sender_base..execution::sender_base] 72150Base class used for tagging senders. 72151 72152 72153 typedef unspecified sender_base; 72154 72155 72156 72157[heading Requirements] 72158 72159['Header: ][^boost/asio/execution/sender.hpp] 72160 72161['Convenience header: ][^boost/asio/execution.hpp] 72162 72163 72164[endsect] 72165 72166 72167[section:execution__sender_traits execution::sender_traits] 72168 72169[indexterm1 boost_asio.indexterm.execution__sender_traits..execution::sender_traits] 72170 72171 72172Traits for senders. 72173 72174 72175 template< 72176 typename S> 72177 struct sender_traits 72178 72179 72180[heading Requirements] 72181 72182['Header: ][^boost/asio/execution/sender.hpp] 72183 72184['Convenience header: ][^boost/asio/execution.hpp] 72185 72186 72187[endsect] 72188 72189 72190[section:execution__set_done execution::set_done] 72191 72192[indexterm1 boost_asio.indexterm.execution__set_done..execution::set_done] 72193A customisation point that delivers a done notification to a receiver. 72194 72195 72196 constexpr unspecified set_done = unspecified; 72197 72198 72199The name `execution::set_done` denotes a customisation point object. The expression `execution::set_done(R)` for some subexpression `R` is expression-equivalent to: 72200 72201 72202* `R.set_done()`, if that expression is valid. If the function selected does not signal the receiver `R`'s done channel, the program is ill-formed with no diagnostic required. 72203 72204 72205* Otherwise, `set_done(R)`, if that expression is valid, with overload resolution performed in a context that includes the declaration `void set_done();` and that does not include a declaration of `execution::set_done`. If the function selected by overload resolution does not signal the receiver `R`'s done channel, the program is ill-formed with no diagnostic required. 72206 72207 72208* Otherwise, `execution::set_done(R)` is ill-formed. 72209 72210 72211 72212[heading Requirements] 72213 72214['Header: ][^boost/asio/execution/set_done.hpp] 72215 72216['Convenience header: ][^boost/asio/execution.hpp] 72217 72218 72219[endsect] 72220 72221 72222 72223[section:execution__set_error execution::set_error] 72224 72225[indexterm1 boost_asio.indexterm.execution__set_error..execution::set_error] 72226A customisation point that delivers an error notification to a receiver. 72227 72228 72229 constexpr unspecified set_error = unspecified; 72230 72231 72232The name `execution::set_error` denotes a customisation point object. The expression `execution::set_error(R, E)` for some subexpressions `R` and `E` are expression-equivalent to: 72233 72234 72235* `R.set_error(E)`, if that expression is valid. If the function selected does not send the error `E` to the receiver `R`'s error channel, the program is ill-formed with no diagnostic required. 72236 72237 72238* Otherwise, `set_error(R, E)`, if that expression is valid, with overload resolution performed in a context that includes the declaration `void set_error();` and that does not include a declaration of `execution::set_error`. If the function selected by overload resolution does not send the error `E` to the receiver `R`'s error channel, the program is ill-formed with no diagnostic required. 72239 72240 72241* Otherwise, `execution::set_error(R, E)` is ill-formed. 72242 72243 72244 72245[heading Requirements] 72246 72247['Header: ][^boost/asio/execution/set_error.hpp] 72248 72249['Convenience header: ][^boost/asio/execution.hpp] 72250 72251 72252[endsect] 72253 72254 72255 72256[section:execution__set_value execution::set_value] 72257 72258[indexterm1 boost_asio.indexterm.execution__set_value..execution::set_value] 72259A customisation point that delivers a value to a receiver. 72260 72261 72262 constexpr unspecified set_value = unspecified; 72263 72264 72265The name `execution::set_value` denotes a customisation point object. The expression `execution::set_value(R, Vs...)` for some subexpressions `R` and `Vs...` is expression-equivalent to: 72266 72267 72268* `R.set_value(Vs...)`, if that expression is valid. If the function selected does not send the value(s) `Vs...` to the receiver `R`'s value channel, the program is ill-formed with no diagnostic required. 72269 72270 72271* Otherwise, `set_value(R, Vs...)`, if that expression is valid, with overload resolution performed in a context that includes the declaration `void set_value();` and that does not include a declaration of `execution::set_value`. If the function selected by overload resolution does not send the value(s) `Vs...` to the receiver `R`'s value channel, the program is ill-formed with no diagnostic required. 72272 72273 72274* Otherwise, `execution::set_value(R, Vs...)` is ill-formed. 72275 72276 72277 72278[heading Requirements] 72279 72280['Header: ][^boost/asio/execution/set_value.hpp] 72281 72282['Convenience header: ][^boost/asio/execution.hpp] 72283 72284 72285[endsect] 72286 72287 72288 72289[section:execution__start execution::start] 72290 72291[indexterm1 boost_asio.indexterm.execution__start..execution::start] 72292A customisation point that notifies an operation state object to start its associated operation. 72293 72294 72295 constexpr unspecified start = unspecified; 72296 72297 72298The name `execution::start` denotes a customisation point object. The expression `execution::start(R)` for some subexpression `R` is expression-equivalent to: 72299 72300 72301* `R.start()`, if that expression is valid. 72302 72303 72304* Otherwise, `start(R)`, if that expression is valid, with overload resolution performed in a context that includes the declaration `void start();` and that does not include a declaration of `execution::start`. 72305 72306 72307* Otherwise, `execution::start(R)` is ill-formed. 72308 72309 72310 72311[heading Requirements] 72312 72313['Header: ][^boost/asio/execution/start.hpp] 72314 72315['Convenience header: ][^boost/asio/execution.hpp] 72316 72317 72318[endsect] 72319 72320 72321 72322[section:execution__submit execution::submit] 72323 72324[indexterm1 boost_asio.indexterm.execution__submit..execution::submit] 72325A customisation point that submits a sender to a receiver. 72326 72327 72328 constexpr unspecified submit = unspecified; 72329 72330 72331The name `execution::submit` denotes a customisation point object. For some subexpressions `s` and `r`, let `S` be a type such that `decltype((s))` is `S` and let `R` be a type such that `decltype((r))` is `R`. The expression `execution::submit(s, r)` is ill-formed if `sender_to<S, R>` is not `true`. Otherwise, it is expression-equivalent to: 72332 72333 72334* `s.submit(r)`, if that expression is valid and `S` models `sender`. If the function selected does not submit the receiver object `r` via the sender `s`, the program is ill-formed with no diagnostic required. 72335 72336 72337* Otherwise, `submit(s, r)`, if that expression is valid and `S` models `sender`, with overload resolution performed in a context that includes the declaration `void submit();` and that does not include a declaration of `execution::submit`. If the function selected by overload resolution does not submit the receiver object `r` via the sender `s`, the program is ill-formed with no diagnostic required. 72338 72339 72340* Otherwise, `execution::start((new submit_receiver<S, R>{s,r})->state_)`, where `submit_receiver` is an implementation-defined class template equivalent to: 72341 72342 template<class S, class R> 72343 struct submit_receiver { 72344 struct wrap { 72345 submit_receiver * p_; 72346 template<class...As> 72347 requires receiver_of<R, As...> 72348 void set_value(As&&... as) && 72349 noexcept(is_nothrow_receiver_of_v<R, As...>) { 72350 execution::set_value(std::move(p_->r_), (As&&) as...); 72351 delete p_; 72352 } 72353 template<class E> 72354 requires receiver<R, E> 72355 void set_error(E&& e) && noexcept { 72356 execution::set_error(std::move(p_->r_), (E&&) e); 72357 delete p_; 72358 } 72359 void set_done() && noexcept { 72360 execution::set_done(std::move(p_->r_)); 72361 delete p_; 72362 } 72363 }; 72364 remove_cvref_t<R> r_; 72365 connect_result_t<S, wrap> state_; 72366 submit_receiver(S&& s, R&& r) 72367 : r_((R&&) r) 72368 , state_(execution::connect((S&&) s, wrap{this})) {} 72369 }; 72370 72371 72372 72373 72374 72375 72376[heading Requirements] 72377 72378['Header: ][^boost/asio/execution/submit.hpp] 72379 72380['Convenience header: ][^boost/asio/execution.hpp] 72381 72382 72383[endsect] 72384 72385 72386[section:execution_context execution_context] 72387 72388[indexterm1 boost_asio.indexterm.execution_context..execution_context] 72389 72390 72391A context for function object execution. 72392 72393 72394 class execution_context : 72395 noncopyable 72396 72397 72398[heading Types] 72399[table 72400 [[Name][Description]] 72401 72402 [ 72403 72404 [[link boost_asio.reference.execution_context__id [*id]]] 72405 [Class used to uniquely identify a service. ] 72406 72407 ] 72408 72409 [ 72410 72411 [[link boost_asio.reference.execution_context__service [*service]]] 72412 [Base class for all io_context services. ] 72413 72414 ] 72415 72416 [ 72417 72418 [[link boost_asio.reference.execution_context.fork_event [*fork_event]]] 72419 [Fork-related event notifications. ] 72420 72421 ] 72422 72423] 72424 72425[heading Member Functions] 72426[table 72427 [[Name][Description]] 72428 72429 [ 72430 [[link boost_asio.reference.execution_context.execution_context [*execution_context]] [constructor]] 72431 [Constructor. ] 72432 ] 72433 72434 [ 72435 [[link boost_asio.reference.execution_context.notify_fork [*notify_fork]]] 72436 [Notify the execution_context of a fork-related event. ] 72437 ] 72438 72439 [ 72440 [[link boost_asio.reference.execution_context._execution_context [*~execution_context]] [destructor]] 72441 [Destructor. ] 72442 ] 72443 72444] 72445 72446[heading Protected Member Functions] 72447[table 72448 [[Name][Description]] 72449 72450 [ 72451 [[link boost_asio.reference.execution_context.destroy [*destroy]]] 72452 [Destroys all services in the context. ] 72453 ] 72454 72455 [ 72456 [[link boost_asio.reference.execution_context.shutdown [*shutdown]]] 72457 [Shuts down all services in the context. ] 72458 ] 72459 72460] 72461 72462[heading Friends] 72463[table 72464 [[Name][Description]] 72465 72466 [ 72467 [[link boost_asio.reference.execution_context.add_service [*add_service]]] 72468 [(Deprecated: Use make_service().) Add a service object to the execution_context. ] 72469 ] 72470 72471 [ 72472 [[link boost_asio.reference.execution_context.has_service [*has_service]]] 72473 [Determine if an execution_context contains a specified service type. ] 72474 ] 72475 72476 [ 72477 [[link boost_asio.reference.execution_context.make_service [*make_service]]] 72478 [Creates a service object and adds it to the execution_context. ] 72479 ] 72480 72481 [ 72482 [[link boost_asio.reference.execution_context.use_service [*use_service]]] 72483 [Obtain the service object corresponding to the given type. ] 72484 ] 72485 72486] 72487 72488An execution context represents a place where function objects will be executed. An `io_context` is an example of an execution context. 72489 72490 72491[heading The execution_context class and services] 72492 72493 72494 72495Class [link boost_asio.reference.execution_context `execution_context`] implements an extensible, type-safe, polymorphic set of services, indexed by service type. 72496 72497Services 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. 72498 72499Access 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()`. 72500 72501In 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>()`. 72502 72503Service 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. 72504 72505Once 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. 72506 72507All 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. 72508 72509 72510[heading The execution_context as a base class] 72511 72512 72513 72514Class [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. 72515 72516On 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()`. 72517 72518This 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: 72519 72520 72521* 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. 72522 72523 72524* 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. 72525 72526 72527 72528[heading Requirements] 72529 72530['Header: ][^boost/asio/execution_context.hpp] 72531 72532['Convenience header: ][^boost/asio/execution.hpp] 72533 72534 72535[section:add_service execution_context::add_service] 72536 72537[indexterm2 boost_asio.indexterm.execution_context.add_service..add_service..execution_context] 72538(Deprecated: Use `make_service()`.) Add a service object to the [link boost_asio.reference.execution_context `execution_context`]. 72539 72540 72541 template< 72542 typename ``[link boost_asio.reference.Service Service]``> 72543 friend void add_service( 72544 execution_context & e, 72545 Service * svc); 72546 72547 72548This function is used to add a service to the [link boost_asio.reference.execution_context `execution_context`]. 72549 72550 72551[heading Parameters] 72552 72553 72554[variablelist 72555 72556[[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]] 72557 72558[[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: 72559`` 72560 delete static_cast<execution_context::service*>(svc) 72561`` 72562]] 72563 72564] 72565 72566 72567[heading Exceptions] 72568 72569 72570[variablelist 72571 72572[[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`].]] 72573 72574[[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. ]] 72575 72576] 72577 72578 72579 72580[heading Requirements] 72581 72582['Header: ][^boost/asio/execution_context.hpp] 72583 72584['Convenience header: ][^boost/asio/execution.hpp] 72585 72586 72587[endsect] 72588 72589 72590 72591[section:destroy execution_context::destroy] 72592 72593[indexterm2 boost_asio.indexterm.execution_context.destroy..destroy..execution_context] 72594Destroys all services in the context. 72595 72596 72597 void destroy(); 72598 72599 72600This function is implemented as follows: 72601 72602 72603* 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)`. 72604 72605 72606 72607 72608[endsect] 72609 72610 72611 72612[section:execution_context execution_context::execution_context] 72613 72614[indexterm2 boost_asio.indexterm.execution_context.execution_context..execution_context..execution_context] 72615Constructor. 72616 72617 72618 execution_context(); 72619 72620 72621 72622[endsect] 72623 72624 72625 72626[section:fork_event execution_context::fork_event] 72627 72628[indexterm2 boost_asio.indexterm.execution_context.fork_event..fork_event..execution_context] 72629Fork-related event notifications. 72630 72631 72632 enum fork_event 72633 72634[indexterm2 boost_asio.indexterm.execution_context.fork_event.fork_prepare..fork_prepare..execution_context] 72635[indexterm2 boost_asio.indexterm.execution_context.fork_event.fork_parent..fork_parent..execution_context] 72636[indexterm2 boost_asio.indexterm.execution_context.fork_event.fork_child..fork_child..execution_context] 72637 72638[heading Values] 72639[variablelist 72640 72641 [ 72642 [fork_prepare] 72643 [Notify the context that the process is about to fork. ] 72644 ] 72645 72646 [ 72647 [fork_parent] 72648 [Notify the context that the process has forked and is the parent. ] 72649 ] 72650 72651 [ 72652 [fork_child] 72653 [Notify the context that the process has forked and is the child. ] 72654 ] 72655 72656] 72657 72658 72659 72660[endsect] 72661 72662 72663 72664[section:has_service execution_context::has_service] 72665 72666[indexterm2 boost_asio.indexterm.execution_context.has_service..has_service..execution_context] 72667Determine if an [link boost_asio.reference.execution_context `execution_context`] contains a specified service type. 72668 72669 72670 template< 72671 typename ``[link boost_asio.reference.Service Service]``> 72672 friend bool has_service( 72673 execution_context & e); 72674 72675 72676This 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. 72677 72678 72679[heading Parameters] 72680 72681 72682[variablelist 72683 72684[[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]] 72685 72686] 72687 72688 72689[heading Return Value] 72690 72691A boolean indicating whether the [link boost_asio.reference.execution_context `execution_context`] contains the service. 72692 72693 72694 72695[heading Requirements] 72696 72697['Header: ][^boost/asio/execution_context.hpp] 72698 72699['Convenience header: ][^boost/asio/execution.hpp] 72700 72701 72702[endsect] 72703 72704 72705 72706[section:make_service execution_context::make_service] 72707 72708[indexterm2 boost_asio.indexterm.execution_context.make_service..make_service..execution_context] 72709Creates a service object and adds it to the [link boost_asio.reference.execution_context `execution_context`]. 72710 72711 72712 template< 72713 typename ``[link boost_asio.reference.Service Service]``, 72714 typename... Args> 72715 friend Service & make_service( 72716 execution_context & e, 72717 Args &&... args); 72718 72719 72720This function is used to add a service to the [link boost_asio.reference.execution_context `execution_context`]. 72721 72722 72723[heading Parameters] 72724 72725 72726[variablelist 72727 72728[[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]] 72729 72730[[args][Zero or more arguments to be passed to the service constructor.]] 72731 72732] 72733 72734 72735[heading Exceptions] 72736 72737 72738[variablelist 72739 72740[[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`]. ]] 72741 72742] 72743 72744 72745 72746[heading Requirements] 72747 72748['Header: ][^boost/asio/execution_context.hpp] 72749 72750['Convenience header: ][^boost/asio/execution.hpp] 72751 72752 72753[endsect] 72754 72755 72756 72757[section:notify_fork execution_context::notify_fork] 72758 72759[indexterm2 boost_asio.indexterm.execution_context.notify_fork..notify_fork..execution_context] 72760Notify the [link boost_asio.reference.execution_context `execution_context`] of a fork-related event. 72761 72762 72763 void notify_fork( 72764 fork_event event); 72765 72766 72767This 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. 72768 72769This 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. 72770 72771 72772[heading Parameters] 72773 72774 72775[variablelist 72776 72777[[event][A fork-related event.]] 72778 72779] 72780 72781 72782[heading Exceptions] 72783 72784 72785[variablelist 72786 72787[[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.]] 72788 72789] 72790 72791 72792[heading Example] 72793 72794The following code illustrates how to incorporate the `notify_fork()` function: 72795 72796 my_execution_context.notify_fork(execution_context::fork_prepare); 72797 if (fork() == 0) 72798 { 72799 // This is the child process. 72800 my_execution_context.notify_fork(execution_context::fork_child); 72801 } 72802 else 72803 { 72804 // This is the parent process. 72805 my_execution_context.notify_fork(execution_context::fork_parent); 72806 } 72807 72808 72809 72810 72811 72812[heading Remarks] 72813 72814For 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. 72815 72816 72817 72818 72819[endsect] 72820 72821 72822 72823[section:shutdown execution_context::shutdown] 72824 72825[indexterm2 boost_asio.indexterm.execution_context.shutdown..shutdown..execution_context] 72826Shuts down all services in the context. 72827 72828 72829 void shutdown(); 72830 72831 72832This function is implemented as follows: 72833 72834 72835* 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()`. 72836 72837 72838 72839 72840[endsect] 72841 72842 72843[section:use_service execution_context::use_service] 72844 72845[indexterm2 boost_asio.indexterm.execution_context.use_service..use_service..execution_context] 72846Obtain the service object corresponding to the given type. 72847 72848 72849 template< 72850 typename ``[link boost_asio.reference.Service Service]``> 72851 friend Service & ``[link boost_asio.reference.execution_context.use_service.overload1 use_service]``( 72852 execution_context & e); 72853 `` [''''»''' [link boost_asio.reference.execution_context.use_service.overload1 more...]]`` 72854 72855 template< 72856 typename ``[link boost_asio.reference.Service Service]``> 72857 friend Service & ``[link boost_asio.reference.execution_context.use_service.overload2 use_service]``( 72858 io_context & ioc); 72859 `` [''''»''' [link boost_asio.reference.execution_context.use_service.overload2 more...]]`` 72860 72861 72862[section:overload1 execution_context::use_service (1 of 2 overloads)] 72863 72864 72865Obtain the service object corresponding to the given type. 72866 72867 72868 template< 72869 typename ``[link boost_asio.reference.Service Service]``> 72870 friend Service & use_service( 72871 execution_context & e); 72872 72873 72874This 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. 72875 72876 72877[heading Parameters] 72878 72879 72880[variablelist 72881 72882[[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]] 72883 72884] 72885 72886 72887[heading Return Value] 72888 72889The service interface implementing the specified service type. Ownership of the service interface is not transferred to the caller. 72890 72891 72892 72893[heading Requirements] 72894 72895['Header: ][^boost/asio/execution_context.hpp] 72896 72897['Convenience header: ][^boost/asio/execution.hpp] 72898 72899 72900[endsect] 72901 72902 72903 72904[section:overload2 execution_context::use_service (2 of 2 overloads)] 72905 72906 72907Obtain the service object corresponding to the given type. 72908 72909 72910 template< 72911 typename ``[link boost_asio.reference.Service Service]``> 72912 friend Service & use_service( 72913 io_context & ioc); 72914 72915 72916This 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. 72917 72918 72919[heading Parameters] 72920 72921 72922[variablelist 72923 72924[[ioc][The [link boost_asio.reference.io_context `io_context`] object that owns the service.]] 72925 72926] 72927 72928 72929[heading Return Value] 72930 72931The service interface implementing the specified service type. Ownership of the service interface is not transferred to the caller. 72932 72933 72934[heading Remarks] 72935 72936This overload is preserved for backwards compatibility with services that inherit from [link boost_asio.reference.io_context__service `io_context::service`]. 72937 72938 72939 72940[heading Requirements] 72941 72942['Header: ][^boost/asio/execution_context.hpp] 72943 72944['Convenience header: ][^boost/asio/execution.hpp] 72945 72946 72947[endsect] 72948 72949 72950[endsect] 72951 72952 72953[section:_execution_context execution_context::~execution_context] 72954 72955[indexterm2 boost_asio.indexterm.execution_context._execution_context..~execution_context..execution_context] 72956Destructor. 72957 72958 72959 ~execution_context(); 72960 72961 72962 72963[endsect] 72964 72965 72966 72967[endsect] 72968 72969[section:execution_context__id execution_context::id] 72970 72971[indexterm1 boost_asio.indexterm.execution_context__id..execution_context::id] 72972 72973 72974Class used to uniquely identify a service. 72975 72976 72977 class id : 72978 noncopyable 72979 72980 72981[heading Member Functions] 72982[table 72983 [[Name][Description]] 72984 72985 [ 72986 [[link boost_asio.reference.execution_context__id.id [*id]] [constructor]] 72987 [Constructor. ] 72988 ] 72989 72990] 72991 72992[heading Requirements] 72993 72994['Header: ][^boost/asio/execution_context.hpp] 72995 72996['Convenience header: ][^boost/asio/execution.hpp] 72997 72998 72999[section:id execution_context::id::id] 73000 73001[indexterm2 boost_asio.indexterm.execution_context__id.id..id..execution_context::id] 73002Constructor. 73003 73004 73005 id(); 73006 73007 73008 73009[endsect] 73010 73011 73012 73013[endsect] 73014 73015[section:execution_context__service execution_context::service] 73016 73017[indexterm1 boost_asio.indexterm.execution_context__service..execution_context::service] 73018 73019 73020Base class for all [link boost_asio.reference.io_context `io_context`] services. 73021 73022 73023 class service : 73024 noncopyable 73025 73026 73027[heading Member Functions] 73028[table 73029 [[Name][Description]] 73030 73031 [ 73032 [[link boost_asio.reference.execution_context__service.context [*context]]] 73033 [Get the context object that owns the service. ] 73034 ] 73035 73036] 73037 73038[heading Protected Member Functions] 73039[table 73040 [[Name][Description]] 73041 73042 [ 73043 [[link boost_asio.reference.execution_context__service.service [*service]] [constructor]] 73044 [Constructor. ] 73045 ] 73046 73047 [ 73048 [[link boost_asio.reference.execution_context__service._service [*~service]] [destructor]] 73049 [Destructor. ] 73050 ] 73051 73052] 73053 73054[heading Private Member Functions] 73055[table 73056 [[Name][Description]] 73057 73058 [ 73059 [[link boost_asio.reference.execution_context__service.notify_fork [*notify_fork]]] 73060 [Handle notification of a fork-related event to perform any necessary housekeeping. ] 73061 ] 73062 73063 [ 73064 [[link boost_asio.reference.execution_context__service.shutdown [*shutdown]]] 73065 [Destroy all user-defined handler objects owned by the service. ] 73066 ] 73067 73068] 73069 73070[heading Requirements] 73071 73072['Header: ][^boost/asio/execution_context.hpp] 73073 73074['Convenience header: ][^boost/asio/execution.hpp] 73075 73076 73077[section:context execution_context::service::context] 73078 73079[indexterm2 boost_asio.indexterm.execution_context__service.context..context..execution_context::service] 73080Get the context object that owns the service. 73081 73082 73083 execution_context & context(); 73084 73085 73086 73087[endsect] 73088 73089 73090 73091[section:service execution_context::service::service] 73092 73093[indexterm2 boost_asio.indexterm.execution_context__service.service..service..execution_context::service] 73094Constructor. 73095 73096 73097 service( 73098 execution_context & owner); 73099 73100 73101 73102[heading Parameters] 73103 73104 73105[variablelist 73106 73107[[owner][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service. ]] 73108 73109] 73110 73111 73112 73113 73114[endsect] 73115 73116 73117 73118[section:_service execution_context::service::~service] 73119 73120[indexterm2 boost_asio.indexterm.execution_context__service._service..~service..execution_context::service] 73121Destructor. 73122 73123 73124 virtual ~service(); 73125 73126 73127 73128[endsect] 73129 73130 73131 73132[section:notify_fork execution_context::service::notify_fork] 73133 73134[indexterm2 boost_asio.indexterm.execution_context__service.notify_fork..notify_fork..execution_context::service] 73135Handle notification of a fork-related event to perform any necessary housekeeping. 73136 73137 73138 virtual void notify_fork( 73139 execution_context::fork_event event); 73140 73141 73142This function is not a pure virtual so that services only have to implement it if necessary. The default implementation does nothing. 73143 73144 73145[endsect] 73146 73147 73148 73149[section:shutdown execution_context::service::shutdown] 73150 73151[indexterm2 boost_asio.indexterm.execution_context__service.shutdown..shutdown..execution_context::service] 73152Destroy all user-defined handler objects owned by the service. 73153 73154 73155 void shutdown(); 73156 73157 73158 73159[endsect] 73160 73161 73162 73163[endsect] 73164 73165[section:executor executor] 73166 73167[indexterm1 boost_asio.indexterm.executor..executor] 73168 73169 73170Polymorphic wrapper for executors. 73171 73172 73173 class executor 73174 73175 73176[heading Types] 73177[table 73178 [[Name][Description]] 73179 73180 [ 73181 73182 [[link boost_asio.reference.executor__unspecified_bool_type_t [*unspecified_bool_type_t]]] 73183 [] 73184 73185 ] 73186 73187 [ 73188 73189 [[link boost_asio.reference.executor.unspecified_bool_type [*unspecified_bool_type]]] 73190 [] 73191 73192 ] 73193 73194] 73195 73196[heading Member Functions] 73197[table 73198 [[Name][Description]] 73199 73200 [ 73201 [[link boost_asio.reference.executor.context [*context]]] 73202 [Obtain the underlying execution context. ] 73203 ] 73204 73205 [ 73206 [[link boost_asio.reference.executor.defer [*defer]]] 73207 [Request the executor to invoke the given function object. ] 73208 ] 73209 73210 [ 73211 [[link boost_asio.reference.executor.dispatch [*dispatch]]] 73212 [Request the executor to invoke the given function object. ] 73213 ] 73214 73215 [ 73216 [[link boost_asio.reference.executor.executor [*executor]] [constructor]] 73217 [Default constructor. 73218 [hr] 73219 Construct from nullptr. 73220 [hr] 73221 Copy constructor. 73222 [hr] 73223 Move constructor. 73224 [hr] 73225 Construct a polymorphic wrapper for the specified executor. 73226 [hr] 73227 Allocator-aware constructor to create a polymorphic wrapper for the specified executor. ] 73228 ] 73229 73230 [ 73231 [[link boost_asio.reference.executor.on_work_finished [*on_work_finished]]] 73232 [Inform the executor that some work is no longer outstanding. ] 73233 ] 73234 73235 [ 73236 [[link boost_asio.reference.executor.on_work_started [*on_work_started]]] 73237 [Inform the executor that it has some outstanding work to do. ] 73238 ] 73239 73240 [ 73241 [[link boost_asio.reference.executor.operator_unspecified_bool_type [*operator unspecified_bool_type]]] 73242 [Operator to test if the executor contains a valid target. ] 73243 ] 73244 73245 [ 73246 [[link boost_asio.reference.executor.operator_eq_ [*operator=]]] 73247 [Assignment operator. 73248 [hr] 73249 73250 [hr] 73251 Assignment operator for nullptr_t. 73252 [hr] 73253 Assignment operator to create a polymorphic wrapper for the specified executor. ] 73254 ] 73255 73256 [ 73257 [[link boost_asio.reference.executor.post [*post]]] 73258 [Request the executor to invoke the given function object. ] 73259 ] 73260 73261 [ 73262 [[link boost_asio.reference.executor.target [*target]]] 73263 [Obtain a pointer to the target executor object. ] 73264 ] 73265 73266 [ 73267 [[link boost_asio.reference.executor.target_type [*target_type]]] 73268 [Obtain type information for the target executor object. ] 73269 ] 73270 73271 [ 73272 [[link boost_asio.reference.executor.unspecified_bool_true [*unspecified_bool_true]] [static]] 73273 [] 73274 ] 73275 73276 [ 73277 [[link boost_asio.reference.executor._executor [*~executor]] [destructor]] 73278 [Destructor. ] 73279 ] 73280 73281] 73282 73283[heading Friends] 73284[table 73285 [[Name][Description]] 73286 73287 [ 73288 [[link boost_asio.reference.executor.operator_not__eq_ [*operator!=]]] 73289 [Compare two executors for inequality. ] 73290 ] 73291 73292 [ 73293 [[link boost_asio.reference.executor.operator_eq__eq_ [*operator==]]] 73294 [Compare two executors for equality. ] 73295 ] 73296 73297] 73298 73299[heading Requirements] 73300 73301['Header: ][^boost/asio/executor.hpp] 73302 73303['Convenience header: ][^boost/asio.hpp] 73304 73305 73306[section:context executor::context] 73307 73308[indexterm2 boost_asio.indexterm.executor.context..context..executor] 73309Obtain the underlying execution context. 73310 73311 73312 execution_context & context() const; 73313 73314 73315 73316[endsect] 73317 73318 73319 73320[section:defer executor::defer] 73321 73322[indexterm2 boost_asio.indexterm.executor.defer..defer..executor] 73323Request the executor to invoke the given function object. 73324 73325 73326 template< 73327 typename Function, 73328 typename Allocator> 73329 void defer( 73330 Function && f, 73331 const Allocator & a) const; 73332 73333 73334This 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. 73335 73336 73337[heading Parameters] 73338 73339 73340[variablelist 73341 73342[[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: 73343`` 73344 void function(); 73345`` 73346]] 73347 73348[[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]] 73349 73350] 73351 73352 73353 73354 73355[endsect] 73356 73357 73358 73359[section:dispatch executor::dispatch] 73360 73361[indexterm2 boost_asio.indexterm.executor.dispatch..dispatch..executor] 73362Request the executor to invoke the given function object. 73363 73364 73365 template< 73366 typename Function, 73367 typename Allocator> 73368 void dispatch( 73369 Function && f, 73370 const Allocator & a) const; 73371 73372 73373This 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. 73374 73375 73376[heading Parameters] 73377 73378 73379[variablelist 73380 73381[[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: 73382`` 73383 void function(); 73384`` 73385]] 73386 73387[[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]] 73388 73389] 73390 73391 73392 73393 73394[endsect] 73395 73396 73397[section:executor executor::executor] 73398 73399[indexterm2 boost_asio.indexterm.executor.executor..executor..executor] 73400Default constructor. 73401 73402 73403 ``[link boost_asio.reference.executor.executor.overload1 executor]``(); 73404 `` [''''»''' [link boost_asio.reference.executor.executor.overload1 more...]]`` 73405 73406 73407Construct from nullptr. 73408 73409 73410 ``[link boost_asio.reference.executor.executor.overload2 executor]``( 73411 nullptr_t ); 73412 `` [''''»''' [link boost_asio.reference.executor.executor.overload2 more...]]`` 73413 73414 73415Copy constructor. 73416 73417 73418 ``[link boost_asio.reference.executor.executor.overload3 executor]``( 73419 const executor & other); 73420 `` [''''»''' [link boost_asio.reference.executor.executor.overload3 more...]]`` 73421 73422 73423Move constructor. 73424 73425 73426 ``[link boost_asio.reference.executor.executor.overload4 executor]``( 73427 executor && other); 73428 `` [''''»''' [link boost_asio.reference.executor.executor.overload4 more...]]`` 73429 73430 73431Construct a polymorphic wrapper for the specified executor. 73432 73433 73434 template< 73435 typename ``[link boost_asio.reference.Executor1 Executor]``> 73436 ``[link boost_asio.reference.executor.executor.overload5 executor]``( 73437 Executor e); 73438 `` [''''»''' [link boost_asio.reference.executor.executor.overload5 more...]]`` 73439 73440 73441Allocator-aware constructor to create a polymorphic wrapper for the specified executor. 73442 73443 73444 template< 73445 typename ``[link boost_asio.reference.Executor1 Executor]``, 73446 typename Allocator> 73447 ``[link boost_asio.reference.executor.executor.overload6 executor]``( 73448 allocator_arg_t , 73449 const Allocator & a, 73450 Executor e); 73451 `` [''''»''' [link boost_asio.reference.executor.executor.overload6 more...]]`` 73452 73453 73454[section:overload1 executor::executor (1 of 6 overloads)] 73455 73456 73457Default constructor. 73458 73459 73460 executor(); 73461 73462 73463 73464[endsect] 73465 73466 73467 73468[section:overload2 executor::executor (2 of 6 overloads)] 73469 73470 73471Construct from nullptr. 73472 73473 73474 executor( 73475 nullptr_t ); 73476 73477 73478 73479[endsect] 73480 73481 73482 73483[section:overload3 executor::executor (3 of 6 overloads)] 73484 73485 73486Copy constructor. 73487 73488 73489 executor( 73490 const executor & other); 73491 73492 73493 73494[endsect] 73495 73496 73497 73498[section:overload4 executor::executor (4 of 6 overloads)] 73499 73500 73501Move constructor. 73502 73503 73504 executor( 73505 executor && other); 73506 73507 73508 73509[endsect] 73510 73511 73512 73513[section:overload5 executor::executor (5 of 6 overloads)] 73514 73515 73516Construct a polymorphic wrapper for the specified executor. 73517 73518 73519 template< 73520 typename ``[link boost_asio.reference.Executor1 Executor]``> 73521 executor( 73522 Executor e); 73523 73524 73525 73526[endsect] 73527 73528 73529 73530[section:overload6 executor::executor (6 of 6 overloads)] 73531 73532 73533Allocator-aware constructor to create a polymorphic wrapper for the specified executor. 73534 73535 73536 template< 73537 typename ``[link boost_asio.reference.Executor1 Executor]``, 73538 typename Allocator> 73539 executor( 73540 allocator_arg_t , 73541 const Allocator & a, 73542 Executor e); 73543 73544 73545 73546[endsect] 73547 73548 73549[endsect] 73550 73551 73552[section:on_work_finished executor::on_work_finished] 73553 73554[indexterm2 boost_asio.indexterm.executor.on_work_finished..on_work_finished..executor] 73555Inform the executor that some work is no longer outstanding. 73556 73557 73558 void on_work_finished() const; 73559 73560 73561 73562[endsect] 73563 73564 73565 73566[section:on_work_started executor::on_work_started] 73567 73568[indexterm2 boost_asio.indexterm.executor.on_work_started..on_work_started..executor] 73569Inform the executor that it has some outstanding work to do. 73570 73571 73572 void on_work_started() const; 73573 73574 73575 73576[endsect] 73577 73578 73579 73580[section:operator_unspecified_bool_type executor::operator unspecified_bool_type] 73581 73582[indexterm2 boost_asio.indexterm.executor.operator_unspecified_bool_type..operator unspecified_bool_type..executor] 73583Operator to test if the executor contains a valid target. 73584 73585 73586 operator unspecified_bool_type() const; 73587 73588 73589 73590[endsect] 73591 73592 73593 73594[section:operator_not__eq_ executor::operator!=] 73595 73596[indexterm2 boost_asio.indexterm.executor.operator_not__eq_..operator!=..executor] 73597Compare two executors for inequality. 73598 73599 73600 friend bool operator!=( 73601 const executor & a, 73602 const executor & b); 73603 73604 73605[heading Requirements] 73606 73607['Header: ][^boost/asio/executor.hpp] 73608 73609['Convenience header: ][^boost/asio.hpp] 73610 73611 73612[endsect] 73613 73614 73615[section:operator_eq_ executor::operator=] 73616 73617[indexterm2 boost_asio.indexterm.executor.operator_eq_..operator=..executor] 73618Assignment operator. 73619 73620 73621 executor & ``[link boost_asio.reference.executor.operator_eq_.overload1 operator=]``( 73622 const executor & other); 73623 `` [''''»''' [link boost_asio.reference.executor.operator_eq_.overload1 more...]]`` 73624 73625 73626 73627 executor & ``[link boost_asio.reference.executor.operator_eq_.overload2 operator=]``( 73628 executor && other); 73629 `` [''''»''' [link boost_asio.reference.executor.operator_eq_.overload2 more...]]`` 73630 73631 73632Assignment operator for nullptr\_t. 73633 73634 73635 executor & ``[link boost_asio.reference.executor.operator_eq_.overload3 operator=]``( 73636 nullptr_t ); 73637 `` [''''»''' [link boost_asio.reference.executor.operator_eq_.overload3 more...]]`` 73638 73639 73640Assignment operator to create a polymorphic wrapper for the specified executor. 73641 73642 73643 template< 73644 typename ``[link boost_asio.reference.Executor1 Executor]``> 73645 executor & ``[link boost_asio.reference.executor.operator_eq_.overload4 operator=]``( 73646 Executor && e); 73647 `` [''''»''' [link boost_asio.reference.executor.operator_eq_.overload4 more...]]`` 73648 73649 73650[section:overload1 executor::operator= (1 of 4 overloads)] 73651 73652 73653Assignment operator. 73654 73655 73656 executor & operator=( 73657 const executor & other); 73658 73659 73660 73661[endsect] 73662 73663 73664 73665[section:overload2 executor::operator= (2 of 4 overloads)] 73666 73667 73668 73669 executor & operator=( 73670 executor && other); 73671 73672 73673 73674[endsect] 73675 73676 73677 73678[section:overload3 executor::operator= (3 of 4 overloads)] 73679 73680 73681Assignment operator for nullptr\_t. 73682 73683 73684 executor & operator=( 73685 nullptr_t ); 73686 73687 73688 73689[endsect] 73690 73691 73692 73693[section:overload4 executor::operator= (4 of 4 overloads)] 73694 73695 73696Assignment operator to create a polymorphic wrapper for the specified executor. 73697 73698 73699 template< 73700 typename ``[link boost_asio.reference.Executor1 Executor]``> 73701 executor & operator=( 73702 Executor && e); 73703 73704 73705 73706[endsect] 73707 73708 73709[endsect] 73710 73711 73712[section:operator_eq__eq_ executor::operator==] 73713 73714[indexterm2 boost_asio.indexterm.executor.operator_eq__eq_..operator==..executor] 73715Compare two executors for equality. 73716 73717 73718 friend bool operator==( 73719 const executor & a, 73720 const executor & b); 73721 73722 73723[heading Requirements] 73724 73725['Header: ][^boost/asio/executor.hpp] 73726 73727['Convenience header: ][^boost/asio.hpp] 73728 73729 73730[endsect] 73731 73732 73733 73734[section:post executor::post] 73735 73736[indexterm2 boost_asio.indexterm.executor.post..post..executor] 73737Request the executor to invoke the given function object. 73738 73739 73740 template< 73741 typename Function, 73742 typename Allocator> 73743 void post( 73744 Function && f, 73745 const Allocator & a) const; 73746 73747 73748This 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. 73749 73750 73751[heading Parameters] 73752 73753 73754[variablelist 73755 73756[[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: 73757`` 73758 void function(); 73759`` 73760]] 73761 73762[[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]] 73763 73764] 73765 73766 73767 73768 73769[endsect] 73770 73771 73772[section:target executor::target] 73773 73774[indexterm2 boost_asio.indexterm.executor.target..target..executor] 73775Obtain a pointer to the target executor object. 73776 73777 73778 template< 73779 typename ``[link boost_asio.reference.Executor1 Executor]``> 73780 Executor * ``[link boost_asio.reference.executor.target.overload1 target]``(); 73781 `` [''''»''' [link boost_asio.reference.executor.target.overload1 more...]]`` 73782 73783 template< 73784 typename ``[link boost_asio.reference.Executor1 Executor]``> 73785 const Executor * ``[link boost_asio.reference.executor.target.overload2 target]``() const; 73786 `` [''''»''' [link boost_asio.reference.executor.target.overload2 more...]]`` 73787 73788 73789[section:overload1 executor::target (1 of 2 overloads)] 73790 73791 73792Obtain a pointer to the target executor object. 73793 73794 73795 template< 73796 typename ``[link boost_asio.reference.Executor1 Executor]``> 73797 Executor * target(); 73798 73799 73800 73801[heading Return Value] 73802 73803If `target_type() == typeid(T)`, a pointer to the stored executor target; otherwise, a null pointer. 73804 73805 73806 73807 73808[endsect] 73809 73810 73811 73812[section:overload2 executor::target (2 of 2 overloads)] 73813 73814 73815Obtain a pointer to the target executor object. 73816 73817 73818 template< 73819 typename ``[link boost_asio.reference.Executor1 Executor]``> 73820 const Executor * target() const; 73821 73822 73823 73824[heading Return Value] 73825 73826If `target_type() == typeid(T)`, a pointer to the stored executor target; otherwise, a null pointer. 73827 73828 73829 73830 73831[endsect] 73832 73833 73834[endsect] 73835 73836 73837[section:target_type executor::target_type] 73838 73839[indexterm2 boost_asio.indexterm.executor.target_type..target_type..executor] 73840Obtain type information for the target executor object. 73841 73842 73843 const std::type_info & target_type() const; 73844 73845 73846 73847[heading Return Value] 73848 73849If `*this` has a target type of type `T`, `typeid(T)`; otherwise, `typeid(void)`. 73850 73851 73852 73853 73854[endsect] 73855 73856 73857 73858[section:unspecified_bool_true executor::unspecified_bool_true] 73859 73860[indexterm2 boost_asio.indexterm.executor.unspecified_bool_true..unspecified_bool_true..executor] 73861 73862 static void unspecified_bool_true( 73863 unspecified_bool_type_t ); 73864 73865 73866 73867[endsect] 73868 73869 73870 73871[section:unspecified_bool_type executor::unspecified_bool_type] 73872 73873[indexterm2 boost_asio.indexterm.executor.unspecified_bool_type..unspecified_bool_type..executor] 73874 73875 typedef void(*) unspecified_bool_type; 73876 73877 73878 73879[heading Requirements] 73880 73881['Header: ][^boost/asio/executor.hpp] 73882 73883['Convenience header: ][^boost/asio.hpp] 73884 73885 73886[endsect] 73887 73888 73889 73890[section:_executor executor::~executor] 73891 73892[indexterm2 boost_asio.indexterm.executor._executor..~executor..executor] 73893Destructor. 73894 73895 73896 ~executor(); 73897 73898 73899 73900[endsect] 73901 73902 73903 73904[endsect] 73905 73906[section:executor__unspecified_bool_type_t executor::unspecified_bool_type_t] 73907 73908[indexterm1 boost_asio.indexterm.executor__unspecified_bool_type_t..executor::unspecified_bool_type_t] 73909 73910 73911 73912 struct unspecified_bool_type_t 73913 73914 73915[heading Requirements] 73916 73917['Header: ][^boost/asio/executor.hpp] 73918 73919['Convenience header: ][^boost/asio.hpp] 73920 73921 73922[endsect] 73923 73924 73925[section:executor_arg executor_arg] 73926 73927[indexterm1 boost_asio.indexterm.executor_arg..executor_arg] 73928A special value, similar to std::nothrow, used to disambiguate constructors that accept executor arguments. 73929 73930 73931 constexpr executor_arg_t executor_arg; 73932 73933 73934See [link boost_asio.reference.executor_arg_t `executor_arg_t`] and [link boost_asio.reference.uses_executor `uses_executor`] for more information. 73935 73936[heading Requirements] 73937 73938['Header: ][^boost/asio/uses_executor.hpp] 73939 73940['Convenience header: ][^boost/asio.hpp] 73941 73942 73943[endsect] 73944 73945 73946[section:executor_arg_t executor_arg_t] 73947 73948[indexterm1 boost_asio.indexterm.executor_arg_t..executor_arg_t] 73949 73950 73951A special type, similar to std::nothrow\_t, used to disambiguate constructors that accept executor arguments. 73952 73953 73954 struct executor_arg_t 73955 73956 73957[heading Member Functions] 73958[table 73959 [[Name][Description]] 73960 73961 [ 73962 [[link boost_asio.reference.executor_arg_t.executor_arg_t [*executor_arg_t]] [constructor]] 73963 [Constructor. ] 73964 ] 73965 73966] 73967 73968The [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. 73969 73970[heading Requirements] 73971 73972['Header: ][^boost/asio/uses_executor.hpp] 73973 73974['Convenience header: ][^boost/asio.hpp] 73975 73976 73977[section:executor_arg_t executor_arg_t::executor_arg_t] 73978 73979[indexterm2 boost_asio.indexterm.executor_arg_t.executor_arg_t..executor_arg_t..executor_arg_t] 73980Constructor. 73981 73982 73983 constexpr executor_arg_t(); 73984 73985 73986 73987[endsect] 73988 73989 73990 73991[endsect] 73992 73993[section:executor_binder executor_binder] 73994 73995[indexterm1 boost_asio.indexterm.executor_binder..executor_binder] 73996 73997 73998A call wrapper type to bind an executor of type `Executor` to an object of type `T`. 73999 74000 74001 template< 74002 typename T, 74003 typename ``[link boost_asio.reference.Executor1 Executor]``> 74004 class executor_binder 74005 74006 74007[heading Types] 74008[table 74009 [[Name][Description]] 74010 74011 [ 74012 74013 [[link boost_asio.reference.executor_binder.argument_type [*argument_type]]] 74014 [The type of the function's argument. ] 74015 74016 ] 74017 74018 [ 74019 74020 [[link boost_asio.reference.executor_binder.executor_type [*executor_type]]] 74021 [The type of the associated executor. ] 74022 74023 ] 74024 74025 [ 74026 74027 [[link boost_asio.reference.executor_binder.first_argument_type [*first_argument_type]]] 74028 [The type of the function's first argument. ] 74029 74030 ] 74031 74032 [ 74033 74034 [[link boost_asio.reference.executor_binder.result_type [*result_type]]] 74035 [The return type if a function. ] 74036 74037 ] 74038 74039 [ 74040 74041 [[link boost_asio.reference.executor_binder.second_argument_type [*second_argument_type]]] 74042 [The type of the function's second argument. ] 74043 74044 ] 74045 74046 [ 74047 74048 [[link boost_asio.reference.executor_binder.target_type [*target_type]]] 74049 [The type of the target object. ] 74050 74051 ] 74052 74053] 74054 74055[heading Member Functions] 74056[table 74057 [[Name][Description]] 74058 74059 [ 74060 [[link boost_asio.reference.executor_binder.executor_binder [*executor_binder]] [constructor]] 74061 [Construct an executor wrapper for the specified object. 74062 [hr] 74063 Copy constructor. 74064 [hr] 74065 Construct a copy, but specify a different executor. 74066 [hr] 74067 Construct a copy of a different executor wrapper type. 74068 [hr] 74069 Construct a copy of a different executor wrapper type, but specify a different executor. 74070 [hr] 74071 Move constructor. 74072 [hr] 74073 Move construct the target object, but specify a different executor. 74074 [hr] 74075 Move construct from a different executor wrapper type. 74076 [hr] 74077 Move construct from a different executor wrapper type, but specify a different executor. ] 74078 ] 74079 74080 [ 74081 [[link boost_asio.reference.executor_binder.get [*get]]] 74082 [Obtain a reference to the target object. ] 74083 ] 74084 74085 [ 74086 [[link boost_asio.reference.executor_binder.get_executor [*get_executor]]] 74087 [Obtain the associated executor. ] 74088 ] 74089 74090 [ 74091 [[link boost_asio.reference.executor_binder.operator_lp__rp_ [*operator()]]] 74092 [] 74093 ] 74094 74095 [ 74096 [[link boost_asio.reference.executor_binder._executor_binder [*~executor_binder]] [destructor]] 74097 [Destructor. ] 74098 ] 74099 74100] 74101 74102[heading Requirements] 74103 74104['Header: ][^boost/asio/bind_executor.hpp] 74105 74106['Convenience header: ][^boost/asio.hpp] 74107 74108 74109[section:argument_type executor_binder::argument_type] 74110 74111[indexterm2 boost_asio.indexterm.executor_binder.argument_type..argument_type..executor_binder] 74112The type of the function's argument. 74113 74114 74115 typedef see_below argument_type; 74116 74117 74118 74119The type of `argument_type` is based on the type `T` of the wrapper's target object: 74120 74121 74122* if `T` is a pointer to a function type accepting a single argument, `argument_type` is a synonym for the return type of `T`; 74123 74124 74125* if `T` is a class type with a member type `argument_type`, then `argument_type` is a synonym for `T::argument_type`; 74126 74127 74128* otherwise `argument_type` is not defined. 74129 74130 74131 74132[heading Requirements] 74133 74134['Header: ][^boost/asio/bind_executor.hpp] 74135 74136['Convenience header: ][^boost/asio.hpp] 74137 74138 74139[endsect] 74140 74141 74142[section:executor_binder executor_binder::executor_binder] 74143 74144[indexterm2 boost_asio.indexterm.executor_binder.executor_binder..executor_binder..executor_binder] 74145Construct an executor wrapper for the specified object. 74146 74147 74148 template< 74149 typename U> 74150 ``[link boost_asio.reference.executor_binder.executor_binder.overload1 executor_binder]``( 74151 executor_arg_t , 74152 const executor_type & e, 74153 U && u); 74154 `` [''''»''' [link boost_asio.reference.executor_binder.executor_binder.overload1 more...]]`` 74155 74156 74157Copy constructor. 74158 74159 74160 ``[link boost_asio.reference.executor_binder.executor_binder.overload2 executor_binder]``( 74161 const executor_binder & other); 74162 `` [''''»''' [link boost_asio.reference.executor_binder.executor_binder.overload2 more...]]`` 74163 74164 74165Construct a copy, but specify a different executor. 74166 74167 74168 ``[link boost_asio.reference.executor_binder.executor_binder.overload3 executor_binder]``( 74169 executor_arg_t , 74170 const executor_type & e, 74171 const executor_binder & other); 74172 `` [''''»''' [link boost_asio.reference.executor_binder.executor_binder.overload3 more...]]`` 74173 74174 74175Construct a copy of a different executor wrapper type. 74176 74177 74178 template< 74179 typename U, 74180 typename ``[link boost_asio.reference.Executor1 OtherExecutor]``> 74181 ``[link boost_asio.reference.executor_binder.executor_binder.overload4 executor_binder]``( 74182 const executor_binder< U, OtherExecutor > & other); 74183 `` [''''»''' [link boost_asio.reference.executor_binder.executor_binder.overload4 more...]]`` 74184 74185 74186Construct a copy of a different executor wrapper type, but specify a different executor. 74187 74188 74189 template< 74190 typename U, 74191 typename ``[link boost_asio.reference.Executor1 OtherExecutor]``> 74192 ``[link boost_asio.reference.executor_binder.executor_binder.overload5 executor_binder]``( 74193 executor_arg_t , 74194 const executor_type & e, 74195 const executor_binder< U, OtherExecutor > & other); 74196 `` [''''»''' [link boost_asio.reference.executor_binder.executor_binder.overload5 more...]]`` 74197 74198 74199Move constructor. 74200 74201 74202 ``[link boost_asio.reference.executor_binder.executor_binder.overload6 executor_binder]``( 74203 executor_binder && other); 74204 `` [''''»''' [link boost_asio.reference.executor_binder.executor_binder.overload6 more...]]`` 74205 74206 74207Move construct the target object, but specify a different executor. 74208 74209 74210 ``[link boost_asio.reference.executor_binder.executor_binder.overload7 executor_binder]``( 74211 executor_arg_t , 74212 const executor_type & e, 74213 executor_binder && other); 74214 `` [''''»''' [link boost_asio.reference.executor_binder.executor_binder.overload7 more...]]`` 74215 74216 74217Move construct from a different executor wrapper type. 74218 74219 74220 template< 74221 typename U, 74222 typename ``[link boost_asio.reference.Executor1 OtherExecutor]``> 74223 ``[link boost_asio.reference.executor_binder.executor_binder.overload8 executor_binder]``( 74224 executor_binder< U, OtherExecutor > && other); 74225 `` [''''»''' [link boost_asio.reference.executor_binder.executor_binder.overload8 more...]]`` 74226 74227 74228Move construct from a different executor wrapper type, but specify a different executor. 74229 74230 74231 template< 74232 typename U, 74233 typename ``[link boost_asio.reference.Executor1 OtherExecutor]``> 74234 ``[link boost_asio.reference.executor_binder.executor_binder.overload9 executor_binder]``( 74235 executor_arg_t , 74236 const executor_type & e, 74237 executor_binder< U, OtherExecutor > && other); 74238 `` [''''»''' [link boost_asio.reference.executor_binder.executor_binder.overload9 more...]]`` 74239 74240 74241[section:overload1 executor_binder::executor_binder (1 of 9 overloads)] 74242 74243 74244Construct an executor wrapper for the specified object. 74245 74246 74247 template< 74248 typename U> 74249 executor_binder( 74250 executor_arg_t , 74251 const executor_type & e, 74252 U && u); 74253 74254 74255This constructor is only valid if the type `T` is constructible from type `U`. 74256 74257 74258[endsect] 74259 74260 74261 74262[section:overload2 executor_binder::executor_binder (2 of 9 overloads)] 74263 74264 74265Copy constructor. 74266 74267 74268 executor_binder( 74269 const executor_binder & other); 74270 74271 74272 74273[endsect] 74274 74275 74276 74277[section:overload3 executor_binder::executor_binder (3 of 9 overloads)] 74278 74279 74280Construct a copy, but specify a different executor. 74281 74282 74283 executor_binder( 74284 executor_arg_t , 74285 const executor_type & e, 74286 const executor_binder & other); 74287 74288 74289 74290[endsect] 74291 74292 74293 74294[section:overload4 executor_binder::executor_binder (4 of 9 overloads)] 74295 74296 74297Construct a copy of a different executor wrapper type. 74298 74299 74300 template< 74301 typename U, 74302 typename ``[link boost_asio.reference.Executor1 OtherExecutor]``> 74303 executor_binder( 74304 const executor_binder< U, OtherExecutor > & other); 74305 74306 74307This constructor is only valid if the `Executor` type is constructible from type `OtherExecutor`, and the type `T` is constructible from type `U`. 74308 74309 74310[endsect] 74311 74312 74313 74314[section:overload5 executor_binder::executor_binder (5 of 9 overloads)] 74315 74316 74317Construct a copy of a different executor wrapper type, but specify a different executor. 74318 74319 74320 template< 74321 typename U, 74322 typename ``[link boost_asio.reference.Executor1 OtherExecutor]``> 74323 executor_binder( 74324 executor_arg_t , 74325 const executor_type & e, 74326 const executor_binder< U, OtherExecutor > & other); 74327 74328 74329This constructor is only valid if the type `T` is constructible from type `U`. 74330 74331 74332[endsect] 74333 74334 74335 74336[section:overload6 executor_binder::executor_binder (6 of 9 overloads)] 74337 74338 74339Move constructor. 74340 74341 74342 executor_binder( 74343 executor_binder && other); 74344 74345 74346 74347[endsect] 74348 74349 74350 74351[section:overload7 executor_binder::executor_binder (7 of 9 overloads)] 74352 74353 74354Move construct the target object, but specify a different executor. 74355 74356 74357 executor_binder( 74358 executor_arg_t , 74359 const executor_type & e, 74360 executor_binder && other); 74361 74362 74363 74364[endsect] 74365 74366 74367 74368[section:overload8 executor_binder::executor_binder (8 of 9 overloads)] 74369 74370 74371Move construct from a different executor wrapper type. 74372 74373 74374 template< 74375 typename U, 74376 typename ``[link boost_asio.reference.Executor1 OtherExecutor]``> 74377 executor_binder( 74378 executor_binder< U, OtherExecutor > && other); 74379 74380 74381 74382[endsect] 74383 74384 74385 74386[section:overload9 executor_binder::executor_binder (9 of 9 overloads)] 74387 74388 74389Move construct from a different executor wrapper type, but specify a different executor. 74390 74391 74392 template< 74393 typename U, 74394 typename ``[link boost_asio.reference.Executor1 OtherExecutor]``> 74395 executor_binder( 74396 executor_arg_t , 74397 const executor_type & e, 74398 executor_binder< U, OtherExecutor > && other); 74399 74400 74401 74402[endsect] 74403 74404 74405[endsect] 74406 74407 74408[section:executor_type executor_binder::executor_type] 74409 74410[indexterm2 boost_asio.indexterm.executor_binder.executor_type..executor_type..executor_binder] 74411The type of the associated executor. 74412 74413 74414 typedef Executor executor_type; 74415 74416 74417 74418[heading Requirements] 74419 74420['Header: ][^boost/asio/bind_executor.hpp] 74421 74422['Convenience header: ][^boost/asio.hpp] 74423 74424 74425[endsect] 74426 74427 74428 74429[section:first_argument_type executor_binder::first_argument_type] 74430 74431[indexterm2 boost_asio.indexterm.executor_binder.first_argument_type..first_argument_type..executor_binder] 74432The type of the function's first argument. 74433 74434 74435 typedef see_below first_argument_type; 74436 74437 74438 74439The type of `first_argument_type` is based on the type `T` of the wrapper's target object: 74440 74441 74442* if `T` is a pointer to a function type accepting two arguments, `first_argument_type` is a synonym for the return type of `T`; 74443 74444 74445* 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`; 74446 74447 74448* otherwise `first_argument_type` is not defined. 74449 74450 74451 74452[heading Requirements] 74453 74454['Header: ][^boost/asio/bind_executor.hpp] 74455 74456['Convenience header: ][^boost/asio.hpp] 74457 74458 74459[endsect] 74460 74461 74462[section:get executor_binder::get] 74463 74464[indexterm2 boost_asio.indexterm.executor_binder.get..get..executor_binder] 74465Obtain a reference to the target object. 74466 74467 74468 target_type & ``[link boost_asio.reference.executor_binder.get.overload1 get]``(); 74469 `` [''''»''' [link boost_asio.reference.executor_binder.get.overload1 more...]]`` 74470 74471 const target_type & ``[link boost_asio.reference.executor_binder.get.overload2 get]``() const; 74472 `` [''''»''' [link boost_asio.reference.executor_binder.get.overload2 more...]]`` 74473 74474 74475[section:overload1 executor_binder::get (1 of 2 overloads)] 74476 74477 74478Obtain a reference to the target object. 74479 74480 74481 target_type & get(); 74482 74483 74484 74485[endsect] 74486 74487 74488 74489[section:overload2 executor_binder::get (2 of 2 overloads)] 74490 74491 74492Obtain a reference to the target object. 74493 74494 74495 const target_type & get() const; 74496 74497 74498 74499[endsect] 74500 74501 74502[endsect] 74503 74504 74505[section:get_executor executor_binder::get_executor] 74506 74507[indexterm2 boost_asio.indexterm.executor_binder.get_executor..get_executor..executor_binder] 74508Obtain the associated executor. 74509 74510 74511 executor_type get_executor() const; 74512 74513 74514 74515[endsect] 74516 74517 74518[section:operator_lp__rp_ executor_binder::operator()] 74519 74520[indexterm2 boost_asio.indexterm.executor_binder.operator_lp__rp_..operator()..executor_binder] 74521 74522 template< 74523 typename... Args> 74524 auto ``[link boost_asio.reference.executor_binder.operator_lp__rp_.overload1 operator()]``( 74525 Args && ...); 74526 `` [''''»''' [link boost_asio.reference.executor_binder.operator_lp__rp_.overload1 more...]]`` 74527 74528 template< 74529 typename... Args> 74530 auto ``[link boost_asio.reference.executor_binder.operator_lp__rp_.overload2 operator()]``( 74531 Args && ...) const; 74532 `` [''''»''' [link boost_asio.reference.executor_binder.operator_lp__rp_.overload2 more...]]`` 74533 74534 74535[section:overload1 executor_binder::operator() (1 of 2 overloads)] 74536 74537 74538 74539 template< 74540 typename... Args> 74541 auto operator()( 74542 Args && ...); 74543 74544 74545 74546[endsect] 74547 74548 74549 74550[section:overload2 executor_binder::operator() (2 of 2 overloads)] 74551 74552 74553 74554 template< 74555 typename... Args> 74556 auto operator()( 74557 Args && ...) const; 74558 74559 74560 74561[endsect] 74562 74563 74564[endsect] 74565 74566 74567[section:result_type executor_binder::result_type] 74568 74569[indexterm2 boost_asio.indexterm.executor_binder.result_type..result_type..executor_binder] 74570The return type if a function. 74571 74572 74573 typedef see_below result_type; 74574 74575 74576 74577The type of `result_type` is based on the type `T` of the wrapper's target object: 74578 74579 74580* if `T` is a pointer to function type, `result_type` is a synonym for the return type of `T`; 74581 74582 74583* if `T` is a class type with a member type `result_type`, then `result_type` is a synonym for `T::result_type`; 74584 74585 74586* otherwise `result_type` is not defined. 74587 74588 74589 74590[heading Requirements] 74591 74592['Header: ][^boost/asio/bind_executor.hpp] 74593 74594['Convenience header: ][^boost/asio.hpp] 74595 74596 74597[endsect] 74598 74599 74600 74601[section:second_argument_type executor_binder::second_argument_type] 74602 74603[indexterm2 boost_asio.indexterm.executor_binder.second_argument_type..second_argument_type..executor_binder] 74604The type of the function's second argument. 74605 74606 74607 typedef see_below second_argument_type; 74608 74609 74610 74611The type of `second_argument_type` is based on the type `T` of the wrapper's target object: 74612 74613 74614* if `T` is a pointer to a function type accepting two arguments, `second_argument_type` is a synonym for the return type of `T`; 74615 74616 74617* 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`; 74618 74619 74620* otherwise `second_argument_type` is not defined. 74621 74622 74623 74624[heading Requirements] 74625 74626['Header: ][^boost/asio/bind_executor.hpp] 74627 74628['Convenience header: ][^boost/asio.hpp] 74629 74630 74631[endsect] 74632 74633 74634 74635[section:target_type executor_binder::target_type] 74636 74637[indexterm2 boost_asio.indexterm.executor_binder.target_type..target_type..executor_binder] 74638The type of the target object. 74639 74640 74641 typedef T target_type; 74642 74643 74644 74645[heading Requirements] 74646 74647['Header: ][^boost/asio/bind_executor.hpp] 74648 74649['Convenience header: ][^boost/asio.hpp] 74650 74651 74652[endsect] 74653 74654 74655 74656[section:_executor_binder executor_binder::~executor_binder] 74657 74658[indexterm2 boost_asio.indexterm.executor_binder._executor_binder..~executor_binder..executor_binder] 74659Destructor. 74660 74661 74662 ~executor_binder(); 74663 74664 74665 74666[endsect] 74667 74668 74669 74670[endsect] 74671 74672[section:executor_work_guard executor_work_guard] 74673 74674[indexterm1 boost_asio.indexterm.executor_work_guard..executor_work_guard] 74675 74676 74677An object of type `executor_work_guard` controls ownership of executor work within a scope. 74678 74679 74680 template< 74681 typename ``[link boost_asio.reference.Executor1 Executor]``> 74682 class executor_work_guard 74683 74684 74685[heading Types] 74686[table 74687 [[Name][Description]] 74688 74689 [ 74690 74691 [[link boost_asio.reference.executor_work_guard.executor_type [*executor_type]]] 74692 [The underlying executor type. ] 74693 74694 ] 74695 74696] 74697 74698[heading Member Functions] 74699[table 74700 [[Name][Description]] 74701 74702 [ 74703 [[link boost_asio.reference.executor_work_guard.executor_work_guard [*executor_work_guard]] [constructor]] 74704 [Constructs a executor_work_guard object for the specified executor. 74705 [hr] 74706 Copy constructor. 74707 [hr] 74708 Move constructor. ] 74709 ] 74710 74711 [ 74712 [[link boost_asio.reference.executor_work_guard.get_executor [*get_executor]]] 74713 [Obtain the associated executor. ] 74714 ] 74715 74716 [ 74717 [[link boost_asio.reference.executor_work_guard.owns_work [*owns_work]]] 74718 [Whether the executor_work_guard object owns some outstanding work. ] 74719 ] 74720 74721 [ 74722 [[link boost_asio.reference.executor_work_guard.reset [*reset]]] 74723 [Indicate that the work is no longer outstanding. ] 74724 ] 74725 74726 [ 74727 [[link boost_asio.reference.executor_work_guard._executor_work_guard [*~executor_work_guard]] [destructor]] 74728 [Destructor. ] 74729 ] 74730 74731] 74732 74733[heading Requirements] 74734 74735['Header: ][^boost/asio/executor_work_guard.hpp] 74736 74737['Convenience header: ][^boost/asio.hpp] 74738 74739 74740[section:executor_type executor_work_guard::executor_type] 74741 74742[indexterm2 boost_asio.indexterm.executor_work_guard.executor_type..executor_type..executor_work_guard] 74743The underlying executor type. 74744 74745 74746 typedef Executor executor_type; 74747 74748 74749 74750[heading Requirements] 74751 74752['Header: ][^boost/asio/executor_work_guard.hpp] 74753 74754['Convenience header: ][^boost/asio.hpp] 74755 74756 74757[endsect] 74758 74759 74760[section:executor_work_guard executor_work_guard::executor_work_guard] 74761 74762[indexterm2 boost_asio.indexterm.executor_work_guard.executor_work_guard..executor_work_guard..executor_work_guard] 74763Constructs a `executor_work_guard` object for the specified executor. 74764 74765 74766 explicit ``[link boost_asio.reference.executor_work_guard.executor_work_guard.overload1 executor_work_guard]``( 74767 const executor_type & e); 74768 `` [''''»''' [link boost_asio.reference.executor_work_guard.executor_work_guard.overload1 more...]]`` 74769 74770 74771Copy constructor. 74772 74773 74774 ``[link boost_asio.reference.executor_work_guard.executor_work_guard.overload2 executor_work_guard]``( 74775 const executor_work_guard & other); 74776 `` [''''»''' [link boost_asio.reference.executor_work_guard.executor_work_guard.overload2 more...]]`` 74777 74778 74779Move constructor. 74780 74781 74782 ``[link boost_asio.reference.executor_work_guard.executor_work_guard.overload3 executor_work_guard]``( 74783 executor_work_guard && other); 74784 `` [''''»''' [link boost_asio.reference.executor_work_guard.executor_work_guard.overload3 more...]]`` 74785 74786 74787[section:overload1 executor_work_guard::executor_work_guard (1 of 3 overloads)] 74788 74789 74790Constructs a `executor_work_guard` object for the specified executor. 74791 74792 74793 executor_work_guard( 74794 const executor_type & e); 74795 74796 74797Stores a copy of `e` and calls `on_work_started()` on it. 74798 74799 74800[endsect] 74801 74802 74803 74804[section:overload2 executor_work_guard::executor_work_guard (2 of 3 overloads)] 74805 74806 74807Copy constructor. 74808 74809 74810 executor_work_guard( 74811 const executor_work_guard & other); 74812 74813 74814 74815[endsect] 74816 74817 74818 74819[section:overload3 executor_work_guard::executor_work_guard (3 of 3 overloads)] 74820 74821 74822Move constructor. 74823 74824 74825 executor_work_guard( 74826 executor_work_guard && other); 74827 74828 74829 74830[endsect] 74831 74832 74833[endsect] 74834 74835 74836[section:get_executor executor_work_guard::get_executor] 74837 74838[indexterm2 boost_asio.indexterm.executor_work_guard.get_executor..get_executor..executor_work_guard] 74839Obtain the associated executor. 74840 74841 74842 executor_type get_executor() const; 74843 74844 74845 74846[endsect] 74847 74848 74849 74850[section:owns_work executor_work_guard::owns_work] 74851 74852[indexterm2 boost_asio.indexterm.executor_work_guard.owns_work..owns_work..executor_work_guard] 74853Whether the [link boost_asio.reference.executor_work_guard `executor_work_guard`] object owns some outstanding work. 74854 74855 74856 bool owns_work() const; 74857 74858 74859 74860[endsect] 74861 74862 74863 74864[section:reset executor_work_guard::reset] 74865 74866[indexterm2 boost_asio.indexterm.executor_work_guard.reset..reset..executor_work_guard] 74867Indicate that the work is no longer outstanding. 74868 74869 74870 void reset(); 74871 74872 74873Unless the object has already been reset, or is in a moved-from state, calls `on_work_finished()` on the stored executor. 74874 74875 74876[endsect] 74877 74878 74879 74880[section:_executor_work_guard executor_work_guard::~executor_work_guard] 74881 74882[indexterm2 boost_asio.indexterm.executor_work_guard._executor_work_guard..~executor_work_guard..executor_work_guard] 74883Destructor. 74884 74885 74886 ~executor_work_guard(); 74887 74888 74889Unless the object has already been reset, or is in a moved-from state, calls `on_work_finished()` on the stored executor. 74890 74891 74892[endsect] 74893 74894 74895 74896[endsect] 74897 74898 74899[section:experimental__as_single experimental::as_single] 74900 74901[indexterm1 boost_asio.indexterm.experimental__as_single..experimental::as_single] 74902Create a completion token to specify that the completion handler arguments should be combined into a single argument. 74903 74904 74905 template< 74906 typename CompletionToken> 74907 constexpr as_single_t< typename decay< CompletionToken >::type > as_single( 74908 CompletionToken && completion_token); 74909 74910 74911[heading Requirements] 74912 74913['Header: ][^boost/asio/experimental/as_single.hpp] 74914 74915['Convenience header: ][^boost/asio.hpp] 74916 74917 74918[endsect] 74919 74920 74921[section:experimental__as_single_t experimental::as_single_t] 74922 74923[indexterm1 boost_asio.indexterm.experimental__as_single_t..experimental::as_single_t] 74924 74925 74926Completion token type used to specify that the completion handler arguments should be combined into a single argument. 74927 74928 74929 template< 74930 typename CompletionToken> 74931 class as_single_t 74932 74933 74934[heading Types] 74935[table 74936 [[Name][Description]] 74937 74938 [ 74939 74940 [[link boost_asio.reference.experimental__as_single_t__default_constructor_tag [*default_constructor_tag]]] 74941 [Tag type used to prevent the "default" constructor from being used for conversions. ] 74942 74943 ] 74944 74945 [ 74946 74947 [[link boost_asio.reference.experimental__as_single_t__executor_with_default [*executor_with_default]]] 74948 [Adapts an executor to add the as_single_t completion token as the default. ] 74949 74950 ] 74951 74952] 74953 74954[heading Member Functions] 74955[table 74956 [[Name][Description]] 74957 74958 [ 74959 [[link boost_asio.reference.experimental__as_single_t.as_default_on [*as_default_on]] [static]] 74960 [Function helper to adapt an I/O object to use as_single_t as its default completion token type. ] 74961 ] 74962 74963 [ 74964 [[link boost_asio.reference.experimental__as_single_t.as_single_t [*as_single_t]] [constructor]] 74965 [Default constructor. 74966 [hr] 74967 Constructor. ] 74968 ] 74969 74970] 74971 74972[heading Data Members] 74973[table 74974 [[Name][Description]] 74975 74976 [ 74977 [[link boost_asio.reference.experimental__as_single_t.token_ [*token_]]] 74978 [] 74979 ] 74980 74981] 74982 74983The [link boost_asio.reference.experimental__as_single_t `experimental::as_single_t`] class is used to indicate that any arguments to the completion handler should be combined and passed as a single argument. If there is already one argument, that argument is passed as-is. If there is more than argument, the arguments are first moved into a `std::tuple` and that tuple is then passed to the completion handler. 74984 74985[heading Requirements] 74986 74987['Header: ][^boost/asio/experimental/as_single.hpp] 74988 74989['Convenience header: ][^boost/asio.hpp] 74990 74991 74992[section:as_default_on experimental::as_single_t::as_default_on] 74993 74994[indexterm2 boost_asio.indexterm.experimental__as_single_t.as_default_on..as_default_on..experimental::as_single_t] 74995Function helper to adapt an I/O object to use `as_single_t` as its default completion token type. 74996 74997 74998 template< 74999 typename T> 75000 static decay< T >::type::template rebind_executor< executor_with_default< typename decay< T >::type::executor_type > >::other as_default_on( 75001 T && object); 75002 75003 75004 75005[endsect] 75006 75007 75008[section:as_single_t experimental::as_single_t::as_single_t] 75009 75010[indexterm2 boost_asio.indexterm.experimental__as_single_t.as_single_t..as_single_t..experimental::as_single_t] 75011Default constructor. 75012 75013 75014 constexpr ``[link boost_asio.reference.experimental__as_single_t.as_single_t.overload1 as_single_t]``( 75015 default_constructor_tag = default_constructor_tag(), 75016 CompletionToken token = CompletionToken()); 75017 `` [''''»''' [link boost_asio.reference.experimental__as_single_t.as_single_t.overload1 more...]]`` 75018 75019 75020Constructor. 75021 75022 75023 template< 75024 typename T> 75025 explicit constexpr ``[link boost_asio.reference.experimental__as_single_t.as_single_t.overload2 as_single_t]``( 75026 T && completion_token); 75027 `` [''''»''' [link boost_asio.reference.experimental__as_single_t.as_single_t.overload2 more...]]`` 75028 75029 75030[section:overload1 experimental::as_single_t::as_single_t (1 of 2 overloads)] 75031 75032 75033Default constructor. 75034 75035 75036 constexpr as_single_t( 75037 default_constructor_tag = default_constructor_tag(), 75038 CompletionToken token = CompletionToken()); 75039 75040 75041This constructor is only valid if the underlying completion token is default constructible and move constructible. The underlying completion token is itself defaulted as an argument to allow it to capture a source location. 75042 75043 75044[endsect] 75045 75046 75047 75048[section:overload2 experimental::as_single_t::as_single_t (2 of 2 overloads)] 75049 75050 75051Constructor. 75052 75053 75054 template< 75055 typename T> 75056 constexpr as_single_t( 75057 T && completion_token); 75058 75059 75060 75061[endsect] 75062 75063 75064[endsect] 75065 75066 75067[section:token_ experimental::as_single_t::token_] 75068 75069[indexterm2 boost_asio.indexterm.experimental__as_single_t.token_..token_..experimental::as_single_t] 75070 75071 CompletionToken token_; 75072 75073 75074 75075[endsect] 75076 75077 75078 75079[endsect] 75080 75081[section:experimental__as_single_t__default_constructor_tag experimental::as_single_t::default_constructor_tag] 75082 75083[indexterm1 boost_asio.indexterm.experimental__as_single_t__default_constructor_tag..experimental::as_single_t::default_constructor_tag] 75084 75085 75086Tag type used to prevent the "default" constructor from being used for conversions. 75087 75088 75089 struct default_constructor_tag 75090 75091 75092[heading Requirements] 75093 75094['Header: ][^boost/asio/experimental/as_single.hpp] 75095 75096['Convenience header: ][^boost/asio.hpp] 75097 75098 75099[endsect] 75100 75101[section:experimental__as_single_t__executor_with_default experimental::as_single_t::executor_with_default] 75102 75103[indexterm1 boost_asio.indexterm.experimental__as_single_t__executor_with_default..experimental::as_single_t::executor_with_default] 75104 75105 75106Adapts an executor to add the `as_single_t` completion token as the default. 75107 75108 75109 template< 75110 typename ``[link boost_asio.reference.Executor1 InnerExecutor]``> 75111 struct executor_with_default 75112 75113 75114[heading Types] 75115[table 75116 [[Name][Description]] 75117 75118 [ 75119 75120 [[link boost_asio.reference.experimental__as_single_t__executor_with_default.default_completion_token_type [*default_completion_token_type]]] 75121 [Specify as_single_t as the default completion token type. ] 75122 75123 ] 75124 75125] 75126 75127[heading Member Functions] 75128[table 75129 [[Name][Description]] 75130 75131 [ 75132 [[link boost_asio.reference.experimental__as_single_t__executor_with_default.executor_with_default [*executor_with_default]] [constructor]] 75133 [Construct the adapted executor from the inner executor type. 75134 [hr] 75135 Convert the specified executor to the inner executor type, then use that to construct the adapted executor. ] 75136 ] 75137 75138] 75139 75140[heading Requirements] 75141 75142['Header: ][^boost/asio/experimental/as_single.hpp] 75143 75144['Convenience header: ][^boost/asio.hpp] 75145 75146 75147[section:default_completion_token_type experimental::as_single_t::executor_with_default::default_completion_token_type] 75148 75149[indexterm2 boost_asio.indexterm.experimental__as_single_t__executor_with_default.default_completion_token_type..default_completion_token_type..experimental::as_single_t::executor_with_default] 75150Specify `as_single_t` as the default completion token type. 75151 75152 75153 typedef as_single_t default_completion_token_type; 75154 75155 75156[heading Types] 75157[table 75158 [[Name][Description]] 75159 75160 [ 75161 75162 [[link boost_asio.reference.experimental__as_single_t__default_constructor_tag [*default_constructor_tag]]] 75163 [Tag type used to prevent the "default" constructor from being used for conversions. ] 75164 75165 ] 75166 75167 [ 75168 75169 [[link boost_asio.reference.experimental__as_single_t__executor_with_default [*executor_with_default]]] 75170 [Adapts an executor to add the as_single_t completion token as the default. ] 75171 75172 ] 75173 75174] 75175 75176[heading Member Functions] 75177[table 75178 [[Name][Description]] 75179 75180 [ 75181 [[link boost_asio.reference.experimental__as_single_t.as_default_on [*as_default_on]] [static]] 75182 [Function helper to adapt an I/O object to use as_single_t as its default completion token type. ] 75183 ] 75184 75185 [ 75186 [[link boost_asio.reference.experimental__as_single_t.as_single_t [*as_single_t]] [constructor]] 75187 [Default constructor. 75188 [hr] 75189 Constructor. ] 75190 ] 75191 75192] 75193 75194[heading Data Members] 75195[table 75196 [[Name][Description]] 75197 75198 [ 75199 [[link boost_asio.reference.experimental__as_single_t.token_ [*token_]]] 75200 [] 75201 ] 75202 75203] 75204 75205The [link boost_asio.reference.experimental__as_single_t `experimental::as_single_t`] class is used to indicate that any arguments to the completion handler should be combined and passed as a single argument. If there is already one argument, that argument is passed as-is. If there is more than argument, the arguments are first moved into a `std::tuple` and that tuple is then passed to the completion handler. 75206 75207 75208[heading Requirements] 75209 75210['Header: ][^boost/asio/experimental/as_single.hpp] 75211 75212['Convenience header: ][^boost/asio.hpp] 75213 75214 75215[endsect] 75216 75217 75218[section:executor_with_default experimental::as_single_t::executor_with_default::executor_with_default] 75219 75220[indexterm2 boost_asio.indexterm.experimental__as_single_t__executor_with_default.executor_with_default..executor_with_default..experimental::as_single_t::executor_with_default] 75221Construct the adapted executor from the inner executor type. 75222 75223 75224 ``[link boost_asio.reference.experimental__as_single_t__executor_with_default.executor_with_default.overload1 executor_with_default]``( 75225 const InnerExecutor & ex); 75226 `` [''''»''' [link boost_asio.reference.experimental__as_single_t__executor_with_default.executor_with_default.overload1 more...]]`` 75227 75228 75229Convert the specified executor to the inner executor type, then use that to construct the adapted executor. 75230 75231 75232 template< 75233 typename ``[link boost_asio.reference.Executor1 OtherExecutor]``> 75234 ``[link boost_asio.reference.experimental__as_single_t__executor_with_default.executor_with_default.overload2 executor_with_default]``( 75235 const OtherExecutor & ex, 75236 typename constraint< is_convertible< OtherExecutor, InnerExecutor >::value >::type = 0); 75237 `` [''''»''' [link boost_asio.reference.experimental__as_single_t__executor_with_default.executor_with_default.overload2 more...]]`` 75238 75239 75240[section:overload1 experimental::as_single_t::executor_with_default::executor_with_default (1 of 2 overloads)] 75241 75242 75243Construct the adapted executor from the inner executor type. 75244 75245 75246 executor_with_default( 75247 const InnerExecutor & ex); 75248 75249 75250 75251[endsect] 75252 75253 75254 75255[section:overload2 experimental::as_single_t::executor_with_default::executor_with_default (2 of 2 overloads)] 75256 75257 75258Convert the specified executor to the inner executor type, then use that to construct the adapted executor. 75259 75260 75261 template< 75262 typename ``[link boost_asio.reference.Executor1 OtherExecutor]``> 75263 executor_with_default( 75264 const OtherExecutor & ex, 75265 typename constraint< is_convertible< OtherExecutor, InnerExecutor >::value >::type = 0); 75266 75267 75268 75269[endsect] 75270 75271 75272[endsect] 75273 75274 75275[endsect] 75276 75277[section:generic__basic_endpoint generic::basic_endpoint] 75278 75279[indexterm1 boost_asio.indexterm.generic__basic_endpoint..generic::basic_endpoint] 75280 75281 75282Describes an endpoint for any socket type. 75283 75284 75285 template< 75286 typename ``[link boost_asio.reference.Protocol Protocol]``> 75287 class basic_endpoint 75288 75289 75290[heading Types] 75291[table 75292 [[Name][Description]] 75293 75294 [ 75295 75296 [[link boost_asio.reference.generic__basic_endpoint.data_type [*data_type]]] 75297 [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ] 75298 75299 ] 75300 75301 [ 75302 75303 [[link boost_asio.reference.generic__basic_endpoint.protocol_type [*protocol_type]]] 75304 [The protocol type associated with the endpoint. ] 75305 75306 ] 75307 75308] 75309 75310[heading Member Functions] 75311[table 75312 [[Name][Description]] 75313 75314 [ 75315 [[link boost_asio.reference.generic__basic_endpoint.basic_endpoint [*basic_endpoint]] [constructor]] 75316 [Default constructor. 75317 [hr] 75318 Construct an endpoint from the specified socket address. 75319 [hr] 75320 Construct an endpoint from the specific endpoint type. 75321 [hr] 75322 Copy constructor. ] 75323 ] 75324 75325 [ 75326 [[link boost_asio.reference.generic__basic_endpoint.capacity [*capacity]]] 75327 [Get the capacity of the endpoint in the native type. ] 75328 ] 75329 75330 [ 75331 [[link boost_asio.reference.generic__basic_endpoint.data [*data]]] 75332 [Get the underlying endpoint in the native type. ] 75333 ] 75334 75335 [ 75336 [[link boost_asio.reference.generic__basic_endpoint.operator_eq_ [*operator=]]] 75337 [Assign from another endpoint. ] 75338 ] 75339 75340 [ 75341 [[link boost_asio.reference.generic__basic_endpoint.protocol [*protocol]]] 75342 [The protocol associated with the endpoint. ] 75343 ] 75344 75345 [ 75346 [[link boost_asio.reference.generic__basic_endpoint.resize [*resize]]] 75347 [Set the underlying size of the endpoint in the native type. ] 75348 ] 75349 75350 [ 75351 [[link boost_asio.reference.generic__basic_endpoint.size [*size]]] 75352 [Get the underlying size of the endpoint in the native type. ] 75353 ] 75354 75355] 75356 75357[heading Friends] 75358[table 75359 [[Name][Description]] 75360 75361 [ 75362 [[link boost_asio.reference.generic__basic_endpoint.operator_not__eq_ [*operator!=]]] 75363 [Compare two endpoints for inequality. ] 75364 ] 75365 75366 [ 75367 [[link boost_asio.reference.generic__basic_endpoint.operator_lt_ [*operator<]]] 75368 [Compare endpoints for ordering. ] 75369 ] 75370 75371 [ 75372 [[link boost_asio.reference.generic__basic_endpoint.operator_lt__eq_ [*operator<=]]] 75373 [Compare endpoints for ordering. ] 75374 ] 75375 75376 [ 75377 [[link boost_asio.reference.generic__basic_endpoint.operator_eq__eq_ [*operator==]]] 75378 [Compare two endpoints for equality. ] 75379 ] 75380 75381 [ 75382 [[link boost_asio.reference.generic__basic_endpoint.operator_gt_ [*operator>]]] 75383 [Compare endpoints for ordering. ] 75384 ] 75385 75386 [ 75387 [[link boost_asio.reference.generic__basic_endpoint.operator_gt__eq_ [*operator>=]]] 75388 [Compare endpoints for ordering. ] 75389 ] 75390 75391] 75392 75393The [link boost_asio.reference.generic__basic_endpoint `generic::basic_endpoint`] class template describes an endpoint that may be associated with any socket type. 75394 75395 75396[heading Remarks] 75397 75398The socket types sockaddr type must be able to fit into a `sockaddr_storage` structure. 75399 75400 75401[heading Thread Safety] 75402 75403['Distinct] ['objects:] Safe. 75404 75405['Shared] ['objects:] Unsafe. 75406 75407 75408 75409 75410[heading Requirements] 75411 75412['Header: ][^boost/asio/generic/basic_endpoint.hpp] 75413 75414['Convenience header: ][^boost/asio.hpp] 75415 75416[section:basic_endpoint generic::basic_endpoint::basic_endpoint] 75417 75418[indexterm2 boost_asio.indexterm.generic__basic_endpoint.basic_endpoint..basic_endpoint..generic::basic_endpoint] 75419Default constructor. 75420 75421 75422 ``[link boost_asio.reference.generic__basic_endpoint.basic_endpoint.overload1 basic_endpoint]``(); 75423 `` [''''»''' [link boost_asio.reference.generic__basic_endpoint.basic_endpoint.overload1 more...]]`` 75424 75425 75426Construct an endpoint from the specified socket address. 75427 75428 75429 ``[link boost_asio.reference.generic__basic_endpoint.basic_endpoint.overload2 basic_endpoint]``( 75430 const void * socket_address, 75431 std::size_t socket_address_size, 75432 int socket_protocol = 0); 75433 `` [''''»''' [link boost_asio.reference.generic__basic_endpoint.basic_endpoint.overload2 more...]]`` 75434 75435 75436Construct an endpoint from the specific endpoint type. 75437 75438 75439 template< 75440 typename ``[link boost_asio.reference.Endpoint Endpoint]``> 75441 ``[link boost_asio.reference.generic__basic_endpoint.basic_endpoint.overload3 basic_endpoint]``( 75442 const Endpoint & endpoint); 75443 `` [''''»''' [link boost_asio.reference.generic__basic_endpoint.basic_endpoint.overload3 more...]]`` 75444 75445 75446Copy constructor. 75447 75448 75449 ``[link boost_asio.reference.generic__basic_endpoint.basic_endpoint.overload4 basic_endpoint]``( 75450 const basic_endpoint & other); 75451 `` [''''»''' [link boost_asio.reference.generic__basic_endpoint.basic_endpoint.overload4 more...]]`` 75452 75453 75454[section:overload1 generic::basic_endpoint::basic_endpoint (1 of 4 overloads)] 75455 75456 75457Default constructor. 75458 75459 75460 basic_endpoint(); 75461 75462 75463 75464[endsect] 75465 75466 75467 75468[section:overload2 generic::basic_endpoint::basic_endpoint (2 of 4 overloads)] 75469 75470 75471Construct an endpoint from the specified socket address. 75472 75473 75474 basic_endpoint( 75475 const void * socket_address, 75476 std::size_t socket_address_size, 75477 int socket_protocol = 0); 75478 75479 75480 75481[endsect] 75482 75483 75484 75485[section:overload3 generic::basic_endpoint::basic_endpoint (3 of 4 overloads)] 75486 75487 75488Construct an endpoint from the specific endpoint type. 75489 75490 75491 template< 75492 typename ``[link boost_asio.reference.Endpoint Endpoint]``> 75493 basic_endpoint( 75494 const Endpoint & endpoint); 75495 75496 75497 75498[endsect] 75499 75500 75501 75502[section:overload4 generic::basic_endpoint::basic_endpoint (4 of 4 overloads)] 75503 75504 75505Copy constructor. 75506 75507 75508 basic_endpoint( 75509 const basic_endpoint & other); 75510 75511 75512 75513[endsect] 75514 75515 75516[endsect] 75517 75518 75519[section:capacity generic::basic_endpoint::capacity] 75520 75521[indexterm2 boost_asio.indexterm.generic__basic_endpoint.capacity..capacity..generic::basic_endpoint] 75522Get the capacity of the endpoint in the native type. 75523 75524 75525 std::size_t capacity() const; 75526 75527 75528 75529[endsect] 75530 75531 75532[section:data generic::basic_endpoint::data] 75533 75534[indexterm2 boost_asio.indexterm.generic__basic_endpoint.data..data..generic::basic_endpoint] 75535Get the underlying endpoint in the native type. 75536 75537 75538 data_type * ``[link boost_asio.reference.generic__basic_endpoint.data.overload1 data]``(); 75539 `` [''''»''' [link boost_asio.reference.generic__basic_endpoint.data.overload1 more...]]`` 75540 75541 const data_type * ``[link boost_asio.reference.generic__basic_endpoint.data.overload2 data]``() const; 75542 `` [''''»''' [link boost_asio.reference.generic__basic_endpoint.data.overload2 more...]]`` 75543 75544 75545[section:overload1 generic::basic_endpoint::data (1 of 2 overloads)] 75546 75547 75548Get the underlying endpoint in the native type. 75549 75550 75551 data_type * data(); 75552 75553 75554 75555[endsect] 75556 75557 75558 75559[section:overload2 generic::basic_endpoint::data (2 of 2 overloads)] 75560 75561 75562Get the underlying endpoint in the native type. 75563 75564 75565 const data_type * data() const; 75566 75567 75568 75569[endsect] 75570 75571 75572[endsect] 75573 75574 75575[section:data_type generic::basic_endpoint::data_type] 75576 75577[indexterm2 boost_asio.indexterm.generic__basic_endpoint.data_type..data_type..generic::basic_endpoint] 75578The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. 75579 75580 75581 typedef implementation_defined data_type; 75582 75583 75584 75585[heading Requirements] 75586 75587['Header: ][^boost/asio/generic/basic_endpoint.hpp] 75588 75589['Convenience header: ][^boost/asio.hpp] 75590 75591 75592[endsect] 75593 75594 75595 75596[section:operator_not__eq_ generic::basic_endpoint::operator!=] 75597 75598[indexterm2 boost_asio.indexterm.generic__basic_endpoint.operator_not__eq_..operator!=..generic::basic_endpoint] 75599Compare two endpoints for inequality. 75600 75601 75602 friend bool operator!=( 75603 const basic_endpoint< Protocol > & e1, 75604 const basic_endpoint< Protocol > & e2); 75605 75606 75607[heading Requirements] 75608 75609['Header: ][^boost/asio/generic/basic_endpoint.hpp] 75610 75611['Convenience header: ][^boost/asio.hpp] 75612 75613 75614[endsect] 75615 75616 75617 75618[section:operator_lt_ generic::basic_endpoint::operator<] 75619 75620[indexterm2 boost_asio.indexterm.generic__basic_endpoint.operator_lt_..operator<..generic::basic_endpoint] 75621Compare endpoints for ordering. 75622 75623 75624 friend bool operator<( 75625 const basic_endpoint< Protocol > & e1, 75626 const basic_endpoint< Protocol > & e2); 75627 75628 75629[heading Requirements] 75630 75631['Header: ][^boost/asio/generic/basic_endpoint.hpp] 75632 75633['Convenience header: ][^boost/asio.hpp] 75634 75635 75636[endsect] 75637 75638 75639 75640[section:operator_lt__eq_ generic::basic_endpoint::operator<=] 75641 75642[indexterm2 boost_asio.indexterm.generic__basic_endpoint.operator_lt__eq_..operator<=..generic::basic_endpoint] 75643Compare endpoints for ordering. 75644 75645 75646 friend bool operator<=( 75647 const basic_endpoint< Protocol > & e1, 75648 const basic_endpoint< Protocol > & e2); 75649 75650 75651[heading Requirements] 75652 75653['Header: ][^boost/asio/generic/basic_endpoint.hpp] 75654 75655['Convenience header: ][^boost/asio.hpp] 75656 75657 75658[endsect] 75659 75660 75661 75662[section:operator_eq_ generic::basic_endpoint::operator=] 75663 75664[indexterm2 boost_asio.indexterm.generic__basic_endpoint.operator_eq_..operator=..generic::basic_endpoint] 75665Assign from another endpoint. 75666 75667 75668 basic_endpoint & operator=( 75669 const basic_endpoint & other); 75670 75671 75672 75673[endsect] 75674 75675 75676 75677[section:operator_eq__eq_ generic::basic_endpoint::operator==] 75678 75679[indexterm2 boost_asio.indexterm.generic__basic_endpoint.operator_eq__eq_..operator==..generic::basic_endpoint] 75680Compare two endpoints for equality. 75681 75682 75683 friend bool operator==( 75684 const basic_endpoint< Protocol > & e1, 75685 const basic_endpoint< Protocol > & e2); 75686 75687 75688[heading Requirements] 75689 75690['Header: ][^boost/asio/generic/basic_endpoint.hpp] 75691 75692['Convenience header: ][^boost/asio.hpp] 75693 75694 75695[endsect] 75696 75697 75698 75699[section:operator_gt_ generic::basic_endpoint::operator>] 75700 75701[indexterm2 boost_asio.indexterm.generic__basic_endpoint.operator_gt_..operator>..generic::basic_endpoint] 75702Compare endpoints for ordering. 75703 75704 75705 friend bool operator>( 75706 const basic_endpoint< Protocol > & e1, 75707 const basic_endpoint< Protocol > & e2); 75708 75709 75710[heading Requirements] 75711 75712['Header: ][^boost/asio/generic/basic_endpoint.hpp] 75713 75714['Convenience header: ][^boost/asio.hpp] 75715 75716 75717[endsect] 75718 75719 75720 75721[section:operator_gt__eq_ generic::basic_endpoint::operator>=] 75722 75723[indexterm2 boost_asio.indexterm.generic__basic_endpoint.operator_gt__eq_..operator>=..generic::basic_endpoint] 75724Compare endpoints for ordering. 75725 75726 75727 friend bool operator>=( 75728 const basic_endpoint< Protocol > & e1, 75729 const basic_endpoint< Protocol > & e2); 75730 75731 75732[heading Requirements] 75733 75734['Header: ][^boost/asio/generic/basic_endpoint.hpp] 75735 75736['Convenience header: ][^boost/asio.hpp] 75737 75738 75739[endsect] 75740 75741 75742 75743[section:protocol generic::basic_endpoint::protocol] 75744 75745[indexterm2 boost_asio.indexterm.generic__basic_endpoint.protocol..protocol..generic::basic_endpoint] 75746The protocol associated with the endpoint. 75747 75748 75749 protocol_type protocol() const; 75750 75751 75752 75753[endsect] 75754 75755 75756 75757[section:protocol_type generic::basic_endpoint::protocol_type] 75758 75759[indexterm2 boost_asio.indexterm.generic__basic_endpoint.protocol_type..protocol_type..generic::basic_endpoint] 75760The protocol type associated with the endpoint. 75761 75762 75763 typedef Protocol protocol_type; 75764 75765 75766 75767[heading Requirements] 75768 75769['Header: ][^boost/asio/generic/basic_endpoint.hpp] 75770 75771['Convenience header: ][^boost/asio.hpp] 75772 75773 75774[endsect] 75775 75776 75777 75778[section:resize generic::basic_endpoint::resize] 75779 75780[indexterm2 boost_asio.indexterm.generic__basic_endpoint.resize..resize..generic::basic_endpoint] 75781Set the underlying size of the endpoint in the native type. 75782 75783 75784 void resize( 75785 std::size_t new_size); 75786 75787 75788 75789[endsect] 75790 75791 75792 75793[section:size generic::basic_endpoint::size] 75794 75795[indexterm2 boost_asio.indexterm.generic__basic_endpoint.size..size..generic::basic_endpoint] 75796Get the underlying size of the endpoint in the native type. 75797 75798 75799 std::size_t size() const; 75800 75801 75802 75803[endsect] 75804 75805 75806 75807[endsect] 75808 75809[section:generic__datagram_protocol generic::datagram_protocol] 75810 75811[indexterm1 boost_asio.indexterm.generic__datagram_protocol..generic::datagram_protocol] 75812 75813 75814Encapsulates the flags needed for a generic datagram-oriented socket. 75815 75816 75817 class datagram_protocol 75818 75819 75820[heading Types] 75821[table 75822 [[Name][Description]] 75823 75824 [ 75825 75826 [[link boost_asio.reference.generic__datagram_protocol.endpoint [*endpoint]]] 75827 [The type of an endpoint. ] 75828 75829 ] 75830 75831 [ 75832 75833 [[link boost_asio.reference.generic__datagram_protocol.socket [*socket]]] 75834 [The generic socket type. ] 75835 75836 ] 75837 75838] 75839 75840[heading Member Functions] 75841[table 75842 [[Name][Description]] 75843 75844 [ 75845 [[link boost_asio.reference.generic__datagram_protocol.datagram_protocol [*datagram_protocol]] [constructor]] 75846 [Construct a protocol object for a specific address family and protocol. 75847 [hr] 75848 Construct a generic protocol object from a specific protocol. ] 75849 ] 75850 75851 [ 75852 [[link boost_asio.reference.generic__datagram_protocol.family [*family]]] 75853 [Obtain an identifier for the protocol family. ] 75854 ] 75855 75856 [ 75857 [[link boost_asio.reference.generic__datagram_protocol.protocol [*protocol]]] 75858 [Obtain an identifier for the protocol. ] 75859 ] 75860 75861 [ 75862 [[link boost_asio.reference.generic__datagram_protocol.type [*type]]] 75863 [Obtain an identifier for the type of the protocol. ] 75864 ] 75865 75866] 75867 75868[heading Friends] 75869[table 75870 [[Name][Description]] 75871 75872 [ 75873 [[link boost_asio.reference.generic__datagram_protocol.operator_not__eq_ [*operator!=]]] 75874 [Compare two protocols for inequality. ] 75875 ] 75876 75877 [ 75878 [[link boost_asio.reference.generic__datagram_protocol.operator_eq__eq_ [*operator==]]] 75879 [Compare two protocols for equality. ] 75880 ] 75881 75882] 75883 75884The [link boost_asio.reference.generic__datagram_protocol `generic::datagram_protocol`] class contains flags necessary for datagram-oriented sockets of any address family and protocol. 75885 75886 75887[heading Examples] 75888 75889Constructing using a native address family and socket protocol: 75890 75891 datagram_protocol p(AF_INET, IPPROTO_UDP); 75892 75893 75894Constructing from a specific protocol type: 75895 75896 datagram_protocol p(boost::asio::ip::udp::v4()); 75897 75898 75899 75900 75901 75902[heading Thread Safety] 75903 75904['Distinct] ['objects:] Safe. 75905 75906['Shared] ['objects:] Safe. 75907 75908 75909 75910 75911[heading Requirements] 75912 75913['Header: ][^boost/asio/generic/datagram_protocol.hpp] 75914 75915['Convenience header: ][^boost/asio.hpp] 75916 75917[section:datagram_protocol generic::datagram_protocol::datagram_protocol] 75918 75919[indexterm2 boost_asio.indexterm.generic__datagram_protocol.datagram_protocol..datagram_protocol..generic::datagram_protocol] 75920Construct a protocol object for a specific address family and protocol. 75921 75922 75923 ``[link boost_asio.reference.generic__datagram_protocol.datagram_protocol.overload1 datagram_protocol]``( 75924 int address_family, 75925 int socket_protocol); 75926 `` [''''»''' [link boost_asio.reference.generic__datagram_protocol.datagram_protocol.overload1 more...]]`` 75927 75928 75929Construct a generic protocol object from a specific protocol. 75930 75931 75932 template< 75933 typename ``[link boost_asio.reference.Protocol Protocol]``> 75934 ``[link boost_asio.reference.generic__datagram_protocol.datagram_protocol.overload2 datagram_protocol]``( 75935 const Protocol & source_protocol); 75936 `` [''''»''' [link boost_asio.reference.generic__datagram_protocol.datagram_protocol.overload2 more...]]`` 75937 75938 75939[section:overload1 generic::datagram_protocol::datagram_protocol (1 of 2 overloads)] 75940 75941 75942Construct a protocol object for a specific address family and protocol. 75943 75944 75945 datagram_protocol( 75946 int address_family, 75947 int socket_protocol); 75948 75949 75950 75951[endsect] 75952 75953 75954 75955[section:overload2 generic::datagram_protocol::datagram_protocol (2 of 2 overloads)] 75956 75957 75958Construct a generic protocol object from a specific protocol. 75959 75960 75961 template< 75962 typename ``[link boost_asio.reference.Protocol Protocol]``> 75963 datagram_protocol( 75964 const Protocol & source_protocol); 75965 75966 75967 75968[heading Exceptions] 75969 75970 75971[variablelist 75972 75973[[@c][bad\_cast Thrown if the source protocol is not datagram-oriented. ]] 75974 75975] 75976 75977 75978 75979 75980[endsect] 75981 75982 75983[endsect] 75984 75985 75986[section:endpoint generic::datagram_protocol::endpoint] 75987 75988[indexterm2 boost_asio.indexterm.generic__datagram_protocol.endpoint..endpoint..generic::datagram_protocol] 75989The type of an endpoint. 75990 75991 75992 typedef basic_endpoint< datagram_protocol > endpoint; 75993 75994 75995[heading Types] 75996[table 75997 [[Name][Description]] 75998 75999 [ 76000 76001 [[link boost_asio.reference.generic__basic_endpoint.data_type [*data_type]]] 76002 [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ] 76003 76004 ] 76005 76006 [ 76007 76008 [[link boost_asio.reference.generic__basic_endpoint.protocol_type [*protocol_type]]] 76009 [The protocol type associated with the endpoint. ] 76010 76011 ] 76012 76013] 76014 76015[heading Member Functions] 76016[table 76017 [[Name][Description]] 76018 76019 [ 76020 [[link boost_asio.reference.generic__basic_endpoint.basic_endpoint [*basic_endpoint]] [constructor]] 76021 [Default constructor. 76022 [hr] 76023 Construct an endpoint from the specified socket address. 76024 [hr] 76025 Construct an endpoint from the specific endpoint type. 76026 [hr] 76027 Copy constructor. ] 76028 ] 76029 76030 [ 76031 [[link boost_asio.reference.generic__basic_endpoint.capacity [*capacity]]] 76032 [Get the capacity of the endpoint in the native type. ] 76033 ] 76034 76035 [ 76036 [[link boost_asio.reference.generic__basic_endpoint.data [*data]]] 76037 [Get the underlying endpoint in the native type. ] 76038 ] 76039 76040 [ 76041 [[link boost_asio.reference.generic__basic_endpoint.operator_eq_ [*operator=]]] 76042 [Assign from another endpoint. ] 76043 ] 76044 76045 [ 76046 [[link boost_asio.reference.generic__basic_endpoint.protocol [*protocol]]] 76047 [The protocol associated with the endpoint. ] 76048 ] 76049 76050 [ 76051 [[link boost_asio.reference.generic__basic_endpoint.resize [*resize]]] 76052 [Set the underlying size of the endpoint in the native type. ] 76053 ] 76054 76055 [ 76056 [[link boost_asio.reference.generic__basic_endpoint.size [*size]]] 76057 [Get the underlying size of the endpoint in the native type. ] 76058 ] 76059 76060] 76061 76062[heading Friends] 76063[table 76064 [[Name][Description]] 76065 76066 [ 76067 [[link boost_asio.reference.generic__basic_endpoint.operator_not__eq_ [*operator!=]]] 76068 [Compare two endpoints for inequality. ] 76069 ] 76070 76071 [ 76072 [[link boost_asio.reference.generic__basic_endpoint.operator_lt_ [*operator<]]] 76073 [Compare endpoints for ordering. ] 76074 ] 76075 76076 [ 76077 [[link boost_asio.reference.generic__basic_endpoint.operator_lt__eq_ [*operator<=]]] 76078 [Compare endpoints for ordering. ] 76079 ] 76080 76081 [ 76082 [[link boost_asio.reference.generic__basic_endpoint.operator_eq__eq_ [*operator==]]] 76083 [Compare two endpoints for equality. ] 76084 ] 76085 76086 [ 76087 [[link boost_asio.reference.generic__basic_endpoint.operator_gt_ [*operator>]]] 76088 [Compare endpoints for ordering. ] 76089 ] 76090 76091 [ 76092 [[link boost_asio.reference.generic__basic_endpoint.operator_gt__eq_ [*operator>=]]] 76093 [Compare endpoints for ordering. ] 76094 ] 76095 76096] 76097 76098The [link boost_asio.reference.generic__basic_endpoint `generic::basic_endpoint`] class template describes an endpoint that may be associated with any socket type. 76099 76100 76101[heading Remarks] 76102 76103The socket types sockaddr type must be able to fit into a `sockaddr_storage` structure. 76104 76105 76106[heading Thread Safety] 76107 76108['Distinct] ['objects:] Safe. 76109 76110['Shared] ['objects:] Unsafe. 76111 76112 76113 76114 76115 76116[heading Requirements] 76117 76118['Header: ][^boost/asio/generic/datagram_protocol.hpp] 76119 76120['Convenience header: ][^boost/asio.hpp] 76121 76122 76123[endsect] 76124 76125 76126 76127[section:family generic::datagram_protocol::family] 76128 76129[indexterm2 boost_asio.indexterm.generic__datagram_protocol.family..family..generic::datagram_protocol] 76130Obtain an identifier for the protocol family. 76131 76132 76133 int family() const; 76134 76135 76136 76137[endsect] 76138 76139 76140 76141[section:operator_not__eq_ generic::datagram_protocol::operator!=] 76142 76143[indexterm2 boost_asio.indexterm.generic__datagram_protocol.operator_not__eq_..operator!=..generic::datagram_protocol] 76144Compare two protocols for inequality. 76145 76146 76147 friend bool operator!=( 76148 const datagram_protocol & p1, 76149 const datagram_protocol & p2); 76150 76151 76152[heading Requirements] 76153 76154['Header: ][^boost/asio/generic/datagram_protocol.hpp] 76155 76156['Convenience header: ][^boost/asio.hpp] 76157 76158 76159[endsect] 76160 76161 76162 76163[section:operator_eq__eq_ generic::datagram_protocol::operator==] 76164 76165[indexterm2 boost_asio.indexterm.generic__datagram_protocol.operator_eq__eq_..operator==..generic::datagram_protocol] 76166Compare two protocols for equality. 76167 76168 76169 friend bool operator==( 76170 const datagram_protocol & p1, 76171 const datagram_protocol & p2); 76172 76173 76174[heading Requirements] 76175 76176['Header: ][^boost/asio/generic/datagram_protocol.hpp] 76177 76178['Convenience header: ][^boost/asio.hpp] 76179 76180 76181[endsect] 76182 76183 76184 76185[section:protocol generic::datagram_protocol::protocol] 76186 76187[indexterm2 boost_asio.indexterm.generic__datagram_protocol.protocol..protocol..generic::datagram_protocol] 76188Obtain an identifier for the protocol. 76189 76190 76191 int protocol() const; 76192 76193 76194 76195[endsect] 76196 76197 76198 76199[section:socket generic::datagram_protocol::socket] 76200 76201[indexterm2 boost_asio.indexterm.generic__datagram_protocol.socket..socket..generic::datagram_protocol] 76202The generic socket type. 76203 76204 76205 typedef basic_datagram_socket< datagram_protocol > socket; 76206 76207 76208[heading Types] 76209[table 76210 [[Name][Description]] 76211 76212 [ 76213 76214 [[link boost_asio.reference.basic_datagram_socket__rebind_executor [*rebind_executor]]] 76215 [Rebinds the socket type to another executor. ] 76216 76217 ] 76218 76219 [ 76220 76221 [[link boost_asio.reference.basic_datagram_socket.broadcast [*broadcast]]] 76222 [Socket option to permit sending of broadcast messages. ] 76223 76224 ] 76225 76226 [ 76227 76228 [[link boost_asio.reference.basic_datagram_socket.bytes_readable [*bytes_readable]]] 76229 [IO control command to get the amount of data that can be read without blocking. ] 76230 76231 ] 76232 76233 [ 76234 76235 [[link boost_asio.reference.basic_datagram_socket.debug [*debug]]] 76236 [Socket option to enable socket-level debugging. ] 76237 76238 ] 76239 76240 [ 76241 76242 [[link boost_asio.reference.basic_datagram_socket.do_not_route [*do_not_route]]] 76243 [Socket option to prevent routing, use local interfaces only. ] 76244 76245 ] 76246 76247 [ 76248 76249 [[link boost_asio.reference.basic_datagram_socket.enable_connection_aborted [*enable_connection_aborted]]] 76250 [Socket option to report aborted connections on accept. ] 76251 76252 ] 76253 76254 [ 76255 76256 [[link boost_asio.reference.basic_datagram_socket.endpoint_type [*endpoint_type]]] 76257 [The endpoint type. ] 76258 76259 ] 76260 76261 [ 76262 76263 [[link boost_asio.reference.basic_datagram_socket.executor_type [*executor_type]]] 76264 [The type of the executor associated with the object. ] 76265 76266 ] 76267 76268 [ 76269 76270 [[link boost_asio.reference.basic_datagram_socket.keep_alive [*keep_alive]]] 76271 [Socket option to send keep-alives. ] 76272 76273 ] 76274 76275 [ 76276 76277 [[link boost_asio.reference.basic_datagram_socket.linger [*linger]]] 76278 [Socket option to specify whether the socket lingers on close if unsent data is present. ] 76279 76280 ] 76281 76282 [ 76283 76284 [[link boost_asio.reference.basic_datagram_socket.lowest_layer_type [*lowest_layer_type]]] 76285 [A basic_socket is always the lowest layer. ] 76286 76287 ] 76288 76289 [ 76290 76291 [[link boost_asio.reference.basic_datagram_socket.message_flags [*message_flags]]] 76292 [Bitmask type for flags that can be passed to send and receive operations. ] 76293 76294 ] 76295 76296 [ 76297 76298 [[link boost_asio.reference.basic_datagram_socket.native_handle_type [*native_handle_type]]] 76299 [The native representation of a socket. ] 76300 76301 ] 76302 76303 [ 76304 76305 [[link boost_asio.reference.basic_datagram_socket.out_of_band_inline [*out_of_band_inline]]] 76306 [Socket option for putting received out-of-band data inline. ] 76307 76308 ] 76309 76310 [ 76311 76312 [[link boost_asio.reference.basic_datagram_socket.protocol_type [*protocol_type]]] 76313 [The protocol type. ] 76314 76315 ] 76316 76317 [ 76318 76319 [[link boost_asio.reference.basic_datagram_socket.receive_buffer_size [*receive_buffer_size]]] 76320 [Socket option for the receive buffer size of a socket. ] 76321 76322 ] 76323 76324 [ 76325 76326 [[link boost_asio.reference.basic_datagram_socket.receive_low_watermark [*receive_low_watermark]]] 76327 [Socket option for the receive low watermark. ] 76328 76329 ] 76330 76331 [ 76332 76333 [[link boost_asio.reference.basic_datagram_socket.reuse_address [*reuse_address]]] 76334 [Socket option to allow the socket to be bound to an address that is already in use. ] 76335 76336 ] 76337 76338 [ 76339 76340 [[link boost_asio.reference.basic_datagram_socket.send_buffer_size [*send_buffer_size]]] 76341 [Socket option for the send buffer size of a socket. ] 76342 76343 ] 76344 76345 [ 76346 76347 [[link boost_asio.reference.basic_datagram_socket.send_low_watermark [*send_low_watermark]]] 76348 [Socket option for the send low watermark. ] 76349 76350 ] 76351 76352 [ 76353 76354 [[link boost_asio.reference.basic_datagram_socket.shutdown_type [*shutdown_type]]] 76355 [Different ways a socket may be shutdown. ] 76356 76357 ] 76358 76359 [ 76360 76361 [[link boost_asio.reference.basic_datagram_socket.wait_type [*wait_type]]] 76362 [Wait types. ] 76363 76364 ] 76365 76366] 76367 76368[heading Member Functions] 76369[table 76370 [[Name][Description]] 76371 76372 [ 76373 [[link boost_asio.reference.basic_datagram_socket.assign [*assign]]] 76374 [Assign an existing native socket to the socket. ] 76375 ] 76376 76377 [ 76378 [[link boost_asio.reference.basic_datagram_socket.async_connect [*async_connect]]] 76379 [Start an asynchronous connect. ] 76380 ] 76381 76382 [ 76383 [[link boost_asio.reference.basic_datagram_socket.async_receive [*async_receive]]] 76384 [Start an asynchronous receive on a connected socket. ] 76385 ] 76386 76387 [ 76388 [[link boost_asio.reference.basic_datagram_socket.async_receive_from [*async_receive_from]]] 76389 [Start an asynchronous receive. ] 76390 ] 76391 76392 [ 76393 [[link boost_asio.reference.basic_datagram_socket.async_send [*async_send]]] 76394 [Start an asynchronous send on a connected socket. ] 76395 ] 76396 76397 [ 76398 [[link boost_asio.reference.basic_datagram_socket.async_send_to [*async_send_to]]] 76399 [Start an asynchronous send. ] 76400 ] 76401 76402 [ 76403 [[link boost_asio.reference.basic_datagram_socket.async_wait [*async_wait]]] 76404 [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 76405 ] 76406 76407 [ 76408 [[link boost_asio.reference.basic_datagram_socket.at_mark [*at_mark]]] 76409 [Determine whether the socket is at the out-of-band data mark. ] 76410 ] 76411 76412 [ 76413 [[link boost_asio.reference.basic_datagram_socket.available [*available]]] 76414 [Determine the number of bytes available for reading. ] 76415 ] 76416 76417 [ 76418 [[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket [*basic_datagram_socket]] [constructor]] 76419 [Construct a basic_datagram_socket without opening it. 76420 [hr] 76421 Construct and open a basic_datagram_socket. 76422 [hr] 76423 Construct a basic_datagram_socket, opening it and binding it to the given local endpoint. 76424 [hr] 76425 Construct a basic_datagram_socket on an existing native socket. 76426 [hr] 76427 Move-construct a basic_datagram_socket from another. 76428 [hr] 76429 Move-construct a basic_datagram_socket from a socket of another protocol type. ] 76430 ] 76431 76432 [ 76433 [[link boost_asio.reference.basic_datagram_socket.bind [*bind]]] 76434 [Bind the socket to the given local endpoint. ] 76435 ] 76436 76437 [ 76438 [[link boost_asio.reference.basic_datagram_socket.cancel [*cancel]]] 76439 [Cancel all asynchronous operations associated with the socket. ] 76440 ] 76441 76442 [ 76443 [[link boost_asio.reference.basic_datagram_socket.close [*close]]] 76444 [Close the socket. ] 76445 ] 76446 76447 [ 76448 [[link boost_asio.reference.basic_datagram_socket.connect [*connect]]] 76449 [Connect the socket to the specified endpoint. ] 76450 ] 76451 76452 [ 76453 [[link boost_asio.reference.basic_datagram_socket.get_executor [*get_executor]]] 76454 [Get the executor associated with the object. ] 76455 ] 76456 76457 [ 76458 [[link boost_asio.reference.basic_datagram_socket.get_option [*get_option]]] 76459 [Get an option from the socket. ] 76460 ] 76461 76462 [ 76463 [[link boost_asio.reference.basic_datagram_socket.io_control [*io_control]]] 76464 [Perform an IO control command on the socket. ] 76465 ] 76466 76467 [ 76468 [[link boost_asio.reference.basic_datagram_socket.is_open [*is_open]]] 76469 [Determine whether the socket is open. ] 76470 ] 76471 76472 [ 76473 [[link boost_asio.reference.basic_datagram_socket.local_endpoint [*local_endpoint]]] 76474 [Get the local endpoint of the socket. ] 76475 ] 76476 76477 [ 76478 [[link boost_asio.reference.basic_datagram_socket.lowest_layer [*lowest_layer]]] 76479 [Get a reference to the lowest layer. 76480 [hr] 76481 Get a const reference to the lowest layer. ] 76482 ] 76483 76484 [ 76485 [[link boost_asio.reference.basic_datagram_socket.native_handle [*native_handle]]] 76486 [Get the native socket representation. ] 76487 ] 76488 76489 [ 76490 [[link boost_asio.reference.basic_datagram_socket.native_non_blocking [*native_non_blocking]]] 76491 [Gets the non-blocking mode of the native socket implementation. 76492 [hr] 76493 Sets the non-blocking mode of the native socket implementation. ] 76494 ] 76495 76496 [ 76497 [[link boost_asio.reference.basic_datagram_socket.non_blocking [*non_blocking]]] 76498 [Gets the non-blocking mode of the socket. 76499 [hr] 76500 Sets the non-blocking mode of the socket. ] 76501 ] 76502 76503 [ 76504 [[link boost_asio.reference.basic_datagram_socket.open [*open]]] 76505 [Open the socket using the specified protocol. ] 76506 ] 76507 76508 [ 76509 [[link boost_asio.reference.basic_datagram_socket.operator_eq_ [*operator=]]] 76510 [Move-assign a basic_datagram_socket from another. 76511 [hr] 76512 Move-assign a basic_datagram_socket from a socket of another protocol type. ] 76513 ] 76514 76515 [ 76516 [[link boost_asio.reference.basic_datagram_socket.receive [*receive]]] 76517 [Receive some data on a connected socket. ] 76518 ] 76519 76520 [ 76521 [[link boost_asio.reference.basic_datagram_socket.receive_from [*receive_from]]] 76522 [Receive a datagram with the endpoint of the sender. ] 76523 ] 76524 76525 [ 76526 [[link boost_asio.reference.basic_datagram_socket.release [*release]]] 76527 [Release ownership of the underlying native socket. ] 76528 ] 76529 76530 [ 76531 [[link boost_asio.reference.basic_datagram_socket.remote_endpoint [*remote_endpoint]]] 76532 [Get the remote endpoint of the socket. ] 76533 ] 76534 76535 [ 76536 [[link boost_asio.reference.basic_datagram_socket.send [*send]]] 76537 [Send some data on a connected socket. ] 76538 ] 76539 76540 [ 76541 [[link boost_asio.reference.basic_datagram_socket.send_to [*send_to]]] 76542 [Send a datagram to the specified endpoint. ] 76543 ] 76544 76545 [ 76546 [[link boost_asio.reference.basic_datagram_socket.set_option [*set_option]]] 76547 [Set an option on the socket. ] 76548 ] 76549 76550 [ 76551 [[link boost_asio.reference.basic_datagram_socket.shutdown [*shutdown]]] 76552 [Disable sends or receives on the socket. ] 76553 ] 76554 76555 [ 76556 [[link boost_asio.reference.basic_datagram_socket.wait [*wait]]] 76557 [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 76558 ] 76559 76560 [ 76561 [[link boost_asio.reference.basic_datagram_socket._basic_datagram_socket [*~basic_datagram_socket]] [destructor]] 76562 [Destroys the socket. ] 76563 ] 76564 76565] 76566 76567[heading Data Members] 76568[table 76569 [[Name][Description]] 76570 76571 [ 76572 [[link boost_asio.reference.basic_datagram_socket.max_connections [*max_connections]] [static]] 76573 [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ] 76574 ] 76575 76576 [ 76577 [[link boost_asio.reference.basic_datagram_socket.max_listen_connections [*max_listen_connections]] [static]] 76578 [The maximum length of the queue of pending incoming connections. ] 76579 ] 76580 76581 [ 76582 [[link boost_asio.reference.basic_datagram_socket.message_do_not_route [*message_do_not_route]] [static]] 76583 [Specify that the data should not be subject to routing. ] 76584 ] 76585 76586 [ 76587 [[link boost_asio.reference.basic_datagram_socket.message_end_of_record [*message_end_of_record]] [static]] 76588 [Specifies that the data marks the end of a record. ] 76589 ] 76590 76591 [ 76592 [[link boost_asio.reference.basic_datagram_socket.message_out_of_band [*message_out_of_band]] [static]] 76593 [Process out-of-band data. ] 76594 ] 76595 76596 [ 76597 [[link boost_asio.reference.basic_datagram_socket.message_peek [*message_peek]] [static]] 76598 [Peek at incoming data without removing it from the input queue. ] 76599 ] 76600 76601] 76602 76603The [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] class template provides asynchronous and blocking datagram-oriented socket functionality. 76604 76605 76606[heading Thread Safety] 76607 76608['Distinct] ['objects:] Safe. 76609 76610['Shared] ['objects:] Unsafe. 76611 76612Synchronous `send`, `send_to`, `receive`, `receive_from`, and `connect` operations are thread safe with respect to each other, if the underlying operating system calls are also thread safe. This means that it is permitted to perform concurrent calls to these synchronous operations on a single socket object. Other synchronous operations, such as `open` or `close`, are not thread safe. 76613 76614 76615[heading Requirements] 76616 76617['Header: ][^boost/asio/generic/datagram_protocol.hpp] 76618 76619['Convenience header: ][^boost/asio.hpp] 76620 76621 76622[endsect] 76623 76624 76625 76626[section:type generic::datagram_protocol::type] 76627 76628[indexterm2 boost_asio.indexterm.generic__datagram_protocol.type..type..generic::datagram_protocol] 76629Obtain an identifier for the type of the protocol. 76630 76631 76632 int type() const; 76633 76634 76635 76636[endsect] 76637 76638 76639 76640[endsect] 76641 76642[section:generic__raw_protocol generic::raw_protocol] 76643 76644[indexterm1 boost_asio.indexterm.generic__raw_protocol..generic::raw_protocol] 76645 76646 76647Encapsulates the flags needed for a generic raw socket. 76648 76649 76650 class raw_protocol 76651 76652 76653[heading Types] 76654[table 76655 [[Name][Description]] 76656 76657 [ 76658 76659 [[link boost_asio.reference.generic__raw_protocol.endpoint [*endpoint]]] 76660 [The type of an endpoint. ] 76661 76662 ] 76663 76664 [ 76665 76666 [[link boost_asio.reference.generic__raw_protocol.socket [*socket]]] 76667 [The generic socket type. ] 76668 76669 ] 76670 76671] 76672 76673[heading Member Functions] 76674[table 76675 [[Name][Description]] 76676 76677 [ 76678 [[link boost_asio.reference.generic__raw_protocol.family [*family]]] 76679 [Obtain an identifier for the protocol family. ] 76680 ] 76681 76682 [ 76683 [[link boost_asio.reference.generic__raw_protocol.protocol [*protocol]]] 76684 [Obtain an identifier for the protocol. ] 76685 ] 76686 76687 [ 76688 [[link boost_asio.reference.generic__raw_protocol.raw_protocol [*raw_protocol]] [constructor]] 76689 [Construct a protocol object for a specific address family and protocol. 76690 [hr] 76691 Construct a generic protocol object from a specific protocol. ] 76692 ] 76693 76694 [ 76695 [[link boost_asio.reference.generic__raw_protocol.type [*type]]] 76696 [Obtain an identifier for the type of the protocol. ] 76697 ] 76698 76699] 76700 76701[heading Friends] 76702[table 76703 [[Name][Description]] 76704 76705 [ 76706 [[link boost_asio.reference.generic__raw_protocol.operator_not__eq_ [*operator!=]]] 76707 [Compare two protocols for inequality. ] 76708 ] 76709 76710 [ 76711 [[link boost_asio.reference.generic__raw_protocol.operator_eq__eq_ [*operator==]]] 76712 [Compare two protocols for equality. ] 76713 ] 76714 76715] 76716 76717The [link boost_asio.reference.generic__raw_protocol `generic::raw_protocol`] class contains flags necessary for raw sockets of any address family and protocol. 76718 76719 76720[heading Examples] 76721 76722Constructing using a native address family and socket protocol: 76723 76724 raw_protocol p(AF_INET, IPPROTO_ICMP); 76725 76726 76727Constructing from a specific protocol type: 76728 76729 raw_protocol p(boost::asio::ip::icmp::v4()); 76730 76731 76732 76733 76734 76735[heading Thread Safety] 76736 76737['Distinct] ['objects:] Safe. 76738 76739['Shared] ['objects:] Safe. 76740 76741 76742 76743 76744[heading Requirements] 76745 76746['Header: ][^boost/asio/generic/raw_protocol.hpp] 76747 76748['Convenience header: ][^boost/asio.hpp] 76749 76750 76751[section:endpoint generic::raw_protocol::endpoint] 76752 76753[indexterm2 boost_asio.indexterm.generic__raw_protocol.endpoint..endpoint..generic::raw_protocol] 76754The type of an endpoint. 76755 76756 76757 typedef basic_endpoint< raw_protocol > endpoint; 76758 76759 76760[heading Types] 76761[table 76762 [[Name][Description]] 76763 76764 [ 76765 76766 [[link boost_asio.reference.generic__basic_endpoint.data_type [*data_type]]] 76767 [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ] 76768 76769 ] 76770 76771 [ 76772 76773 [[link boost_asio.reference.generic__basic_endpoint.protocol_type [*protocol_type]]] 76774 [The protocol type associated with the endpoint. ] 76775 76776 ] 76777 76778] 76779 76780[heading Member Functions] 76781[table 76782 [[Name][Description]] 76783 76784 [ 76785 [[link boost_asio.reference.generic__basic_endpoint.basic_endpoint [*basic_endpoint]] [constructor]] 76786 [Default constructor. 76787 [hr] 76788 Construct an endpoint from the specified socket address. 76789 [hr] 76790 Construct an endpoint from the specific endpoint type. 76791 [hr] 76792 Copy constructor. ] 76793 ] 76794 76795 [ 76796 [[link boost_asio.reference.generic__basic_endpoint.capacity [*capacity]]] 76797 [Get the capacity of the endpoint in the native type. ] 76798 ] 76799 76800 [ 76801 [[link boost_asio.reference.generic__basic_endpoint.data [*data]]] 76802 [Get the underlying endpoint in the native type. ] 76803 ] 76804 76805 [ 76806 [[link boost_asio.reference.generic__basic_endpoint.operator_eq_ [*operator=]]] 76807 [Assign from another endpoint. ] 76808 ] 76809 76810 [ 76811 [[link boost_asio.reference.generic__basic_endpoint.protocol [*protocol]]] 76812 [The protocol associated with the endpoint. ] 76813 ] 76814 76815 [ 76816 [[link boost_asio.reference.generic__basic_endpoint.resize [*resize]]] 76817 [Set the underlying size of the endpoint in the native type. ] 76818 ] 76819 76820 [ 76821 [[link boost_asio.reference.generic__basic_endpoint.size [*size]]] 76822 [Get the underlying size of the endpoint in the native type. ] 76823 ] 76824 76825] 76826 76827[heading Friends] 76828[table 76829 [[Name][Description]] 76830 76831 [ 76832 [[link boost_asio.reference.generic__basic_endpoint.operator_not__eq_ [*operator!=]]] 76833 [Compare two endpoints for inequality. ] 76834 ] 76835 76836 [ 76837 [[link boost_asio.reference.generic__basic_endpoint.operator_lt_ [*operator<]]] 76838 [Compare endpoints for ordering. ] 76839 ] 76840 76841 [ 76842 [[link boost_asio.reference.generic__basic_endpoint.operator_lt__eq_ [*operator<=]]] 76843 [Compare endpoints for ordering. ] 76844 ] 76845 76846 [ 76847 [[link boost_asio.reference.generic__basic_endpoint.operator_eq__eq_ [*operator==]]] 76848 [Compare two endpoints for equality. ] 76849 ] 76850 76851 [ 76852 [[link boost_asio.reference.generic__basic_endpoint.operator_gt_ [*operator>]]] 76853 [Compare endpoints for ordering. ] 76854 ] 76855 76856 [ 76857 [[link boost_asio.reference.generic__basic_endpoint.operator_gt__eq_ [*operator>=]]] 76858 [Compare endpoints for ordering. ] 76859 ] 76860 76861] 76862 76863The [link boost_asio.reference.generic__basic_endpoint `generic::basic_endpoint`] class template describes an endpoint that may be associated with any socket type. 76864 76865 76866[heading Remarks] 76867 76868The socket types sockaddr type must be able to fit into a `sockaddr_storage` structure. 76869 76870 76871[heading Thread Safety] 76872 76873['Distinct] ['objects:] Safe. 76874 76875['Shared] ['objects:] Unsafe. 76876 76877 76878 76879 76880 76881[heading Requirements] 76882 76883['Header: ][^boost/asio/generic/raw_protocol.hpp] 76884 76885['Convenience header: ][^boost/asio.hpp] 76886 76887 76888[endsect] 76889 76890 76891 76892[section:family generic::raw_protocol::family] 76893 76894[indexterm2 boost_asio.indexterm.generic__raw_protocol.family..family..generic::raw_protocol] 76895Obtain an identifier for the protocol family. 76896 76897 76898 int family() const; 76899 76900 76901 76902[endsect] 76903 76904 76905 76906[section:operator_not__eq_ generic::raw_protocol::operator!=] 76907 76908[indexterm2 boost_asio.indexterm.generic__raw_protocol.operator_not__eq_..operator!=..generic::raw_protocol] 76909Compare two protocols for inequality. 76910 76911 76912 friend bool operator!=( 76913 const raw_protocol & p1, 76914 const raw_protocol & p2); 76915 76916 76917[heading Requirements] 76918 76919['Header: ][^boost/asio/generic/raw_protocol.hpp] 76920 76921['Convenience header: ][^boost/asio.hpp] 76922 76923 76924[endsect] 76925 76926 76927 76928[section:operator_eq__eq_ generic::raw_protocol::operator==] 76929 76930[indexterm2 boost_asio.indexterm.generic__raw_protocol.operator_eq__eq_..operator==..generic::raw_protocol] 76931Compare two protocols for equality. 76932 76933 76934 friend bool operator==( 76935 const raw_protocol & p1, 76936 const raw_protocol & p2); 76937 76938 76939[heading Requirements] 76940 76941['Header: ][^boost/asio/generic/raw_protocol.hpp] 76942 76943['Convenience header: ][^boost/asio.hpp] 76944 76945 76946[endsect] 76947 76948 76949 76950[section:protocol generic::raw_protocol::protocol] 76951 76952[indexterm2 boost_asio.indexterm.generic__raw_protocol.protocol..protocol..generic::raw_protocol] 76953Obtain an identifier for the protocol. 76954 76955 76956 int protocol() const; 76957 76958 76959 76960[endsect] 76961 76962 76963[section:raw_protocol generic::raw_protocol::raw_protocol] 76964 76965[indexterm2 boost_asio.indexterm.generic__raw_protocol.raw_protocol..raw_protocol..generic::raw_protocol] 76966Construct a protocol object for a specific address family and protocol. 76967 76968 76969 ``[link boost_asio.reference.generic__raw_protocol.raw_protocol.overload1 raw_protocol]``( 76970 int address_family, 76971 int socket_protocol); 76972 `` [''''»''' [link boost_asio.reference.generic__raw_protocol.raw_protocol.overload1 more...]]`` 76973 76974 76975Construct a generic protocol object from a specific protocol. 76976 76977 76978 template< 76979 typename ``[link boost_asio.reference.Protocol Protocol]``> 76980 ``[link boost_asio.reference.generic__raw_protocol.raw_protocol.overload2 raw_protocol]``( 76981 const Protocol & source_protocol); 76982 `` [''''»''' [link boost_asio.reference.generic__raw_protocol.raw_protocol.overload2 more...]]`` 76983 76984 76985[section:overload1 generic::raw_protocol::raw_protocol (1 of 2 overloads)] 76986 76987 76988Construct a protocol object for a specific address family and protocol. 76989 76990 76991 raw_protocol( 76992 int address_family, 76993 int socket_protocol); 76994 76995 76996 76997[endsect] 76998 76999 77000 77001[section:overload2 generic::raw_protocol::raw_protocol (2 of 2 overloads)] 77002 77003 77004Construct a generic protocol object from a specific protocol. 77005 77006 77007 template< 77008 typename ``[link boost_asio.reference.Protocol Protocol]``> 77009 raw_protocol( 77010 const Protocol & source_protocol); 77011 77012 77013 77014[heading Exceptions] 77015 77016 77017[variablelist 77018 77019[[@c][bad\_cast Thrown if the source protocol is not raw-oriented. ]] 77020 77021] 77022 77023 77024 77025 77026[endsect] 77027 77028 77029[endsect] 77030 77031 77032[section:socket generic::raw_protocol::socket] 77033 77034[indexterm2 boost_asio.indexterm.generic__raw_protocol.socket..socket..generic::raw_protocol] 77035The generic socket type. 77036 77037 77038 typedef basic_raw_socket< raw_protocol > socket; 77039 77040 77041[heading Types] 77042[table 77043 [[Name][Description]] 77044 77045 [ 77046 77047 [[link boost_asio.reference.basic_raw_socket__rebind_executor [*rebind_executor]]] 77048 [Rebinds the socket type to another executor. ] 77049 77050 ] 77051 77052 [ 77053 77054 [[link boost_asio.reference.basic_raw_socket.broadcast [*broadcast]]] 77055 [Socket option to permit sending of broadcast messages. ] 77056 77057 ] 77058 77059 [ 77060 77061 [[link boost_asio.reference.basic_raw_socket.bytes_readable [*bytes_readable]]] 77062 [IO control command to get the amount of data that can be read without blocking. ] 77063 77064 ] 77065 77066 [ 77067 77068 [[link boost_asio.reference.basic_raw_socket.debug [*debug]]] 77069 [Socket option to enable socket-level debugging. ] 77070 77071 ] 77072 77073 [ 77074 77075 [[link boost_asio.reference.basic_raw_socket.do_not_route [*do_not_route]]] 77076 [Socket option to prevent routing, use local interfaces only. ] 77077 77078 ] 77079 77080 [ 77081 77082 [[link boost_asio.reference.basic_raw_socket.enable_connection_aborted [*enable_connection_aborted]]] 77083 [Socket option to report aborted connections on accept. ] 77084 77085 ] 77086 77087 [ 77088 77089 [[link boost_asio.reference.basic_raw_socket.endpoint_type [*endpoint_type]]] 77090 [The endpoint type. ] 77091 77092 ] 77093 77094 [ 77095 77096 [[link boost_asio.reference.basic_raw_socket.executor_type [*executor_type]]] 77097 [The type of the executor associated with the object. ] 77098 77099 ] 77100 77101 [ 77102 77103 [[link boost_asio.reference.basic_raw_socket.keep_alive [*keep_alive]]] 77104 [Socket option to send keep-alives. ] 77105 77106 ] 77107 77108 [ 77109 77110 [[link boost_asio.reference.basic_raw_socket.linger [*linger]]] 77111 [Socket option to specify whether the socket lingers on close if unsent data is present. ] 77112 77113 ] 77114 77115 [ 77116 77117 [[link boost_asio.reference.basic_raw_socket.lowest_layer_type [*lowest_layer_type]]] 77118 [A basic_socket is always the lowest layer. ] 77119 77120 ] 77121 77122 [ 77123 77124 [[link boost_asio.reference.basic_raw_socket.message_flags [*message_flags]]] 77125 [Bitmask type for flags that can be passed to send and receive operations. ] 77126 77127 ] 77128 77129 [ 77130 77131 [[link boost_asio.reference.basic_raw_socket.native_handle_type [*native_handle_type]]] 77132 [The native representation of a socket. ] 77133 77134 ] 77135 77136 [ 77137 77138 [[link boost_asio.reference.basic_raw_socket.out_of_band_inline [*out_of_band_inline]]] 77139 [Socket option for putting received out-of-band data inline. ] 77140 77141 ] 77142 77143 [ 77144 77145 [[link boost_asio.reference.basic_raw_socket.protocol_type [*protocol_type]]] 77146 [The protocol type. ] 77147 77148 ] 77149 77150 [ 77151 77152 [[link boost_asio.reference.basic_raw_socket.receive_buffer_size [*receive_buffer_size]]] 77153 [Socket option for the receive buffer size of a socket. ] 77154 77155 ] 77156 77157 [ 77158 77159 [[link boost_asio.reference.basic_raw_socket.receive_low_watermark [*receive_low_watermark]]] 77160 [Socket option for the receive low watermark. ] 77161 77162 ] 77163 77164 [ 77165 77166 [[link boost_asio.reference.basic_raw_socket.reuse_address [*reuse_address]]] 77167 [Socket option to allow the socket to be bound to an address that is already in use. ] 77168 77169 ] 77170 77171 [ 77172 77173 [[link boost_asio.reference.basic_raw_socket.send_buffer_size [*send_buffer_size]]] 77174 [Socket option for the send buffer size of a socket. ] 77175 77176 ] 77177 77178 [ 77179 77180 [[link boost_asio.reference.basic_raw_socket.send_low_watermark [*send_low_watermark]]] 77181 [Socket option for the send low watermark. ] 77182 77183 ] 77184 77185 [ 77186 77187 [[link boost_asio.reference.basic_raw_socket.shutdown_type [*shutdown_type]]] 77188 [Different ways a socket may be shutdown. ] 77189 77190 ] 77191 77192 [ 77193 77194 [[link boost_asio.reference.basic_raw_socket.wait_type [*wait_type]]] 77195 [Wait types. ] 77196 77197 ] 77198 77199] 77200 77201[heading Member Functions] 77202[table 77203 [[Name][Description]] 77204 77205 [ 77206 [[link boost_asio.reference.basic_raw_socket.assign [*assign]]] 77207 [Assign an existing native socket to the socket. ] 77208 ] 77209 77210 [ 77211 [[link boost_asio.reference.basic_raw_socket.async_connect [*async_connect]]] 77212 [Start an asynchronous connect. ] 77213 ] 77214 77215 [ 77216 [[link boost_asio.reference.basic_raw_socket.async_receive [*async_receive]]] 77217 [Start an asynchronous receive on a connected socket. ] 77218 ] 77219 77220 [ 77221 [[link boost_asio.reference.basic_raw_socket.async_receive_from [*async_receive_from]]] 77222 [Start an asynchronous receive. ] 77223 ] 77224 77225 [ 77226 [[link boost_asio.reference.basic_raw_socket.async_send [*async_send]]] 77227 [Start an asynchronous send on a connected socket. ] 77228 ] 77229 77230 [ 77231 [[link boost_asio.reference.basic_raw_socket.async_send_to [*async_send_to]]] 77232 [Start an asynchronous send. ] 77233 ] 77234 77235 [ 77236 [[link boost_asio.reference.basic_raw_socket.async_wait [*async_wait]]] 77237 [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 77238 ] 77239 77240 [ 77241 [[link boost_asio.reference.basic_raw_socket.at_mark [*at_mark]]] 77242 [Determine whether the socket is at the out-of-band data mark. ] 77243 ] 77244 77245 [ 77246 [[link boost_asio.reference.basic_raw_socket.available [*available]]] 77247 [Determine the number of bytes available for reading. ] 77248 ] 77249 77250 [ 77251 [[link boost_asio.reference.basic_raw_socket.basic_raw_socket [*basic_raw_socket]] [constructor]] 77252 [Construct a basic_raw_socket without opening it. 77253 [hr] 77254 Construct and open a basic_raw_socket. 77255 [hr] 77256 Construct a basic_raw_socket, opening it and binding it to the given local endpoint. 77257 [hr] 77258 Construct a basic_raw_socket on an existing native socket. 77259 [hr] 77260 Move-construct a basic_raw_socket from another. 77261 [hr] 77262 Move-construct a basic_raw_socket from a socket of another protocol type. ] 77263 ] 77264 77265 [ 77266 [[link boost_asio.reference.basic_raw_socket.bind [*bind]]] 77267 [Bind the socket to the given local endpoint. ] 77268 ] 77269 77270 [ 77271 [[link boost_asio.reference.basic_raw_socket.cancel [*cancel]]] 77272 [Cancel all asynchronous operations associated with the socket. ] 77273 ] 77274 77275 [ 77276 [[link boost_asio.reference.basic_raw_socket.close [*close]]] 77277 [Close the socket. ] 77278 ] 77279 77280 [ 77281 [[link boost_asio.reference.basic_raw_socket.connect [*connect]]] 77282 [Connect the socket to the specified endpoint. ] 77283 ] 77284 77285 [ 77286 [[link boost_asio.reference.basic_raw_socket.get_executor [*get_executor]]] 77287 [Get the executor associated with the object. ] 77288 ] 77289 77290 [ 77291 [[link boost_asio.reference.basic_raw_socket.get_option [*get_option]]] 77292 [Get an option from the socket. ] 77293 ] 77294 77295 [ 77296 [[link boost_asio.reference.basic_raw_socket.io_control [*io_control]]] 77297 [Perform an IO control command on the socket. ] 77298 ] 77299 77300 [ 77301 [[link boost_asio.reference.basic_raw_socket.is_open [*is_open]]] 77302 [Determine whether the socket is open. ] 77303 ] 77304 77305 [ 77306 [[link boost_asio.reference.basic_raw_socket.local_endpoint [*local_endpoint]]] 77307 [Get the local endpoint of the socket. ] 77308 ] 77309 77310 [ 77311 [[link boost_asio.reference.basic_raw_socket.lowest_layer [*lowest_layer]]] 77312 [Get a reference to the lowest layer. 77313 [hr] 77314 Get a const reference to the lowest layer. ] 77315 ] 77316 77317 [ 77318 [[link boost_asio.reference.basic_raw_socket.native_handle [*native_handle]]] 77319 [Get the native socket representation. ] 77320 ] 77321 77322 [ 77323 [[link boost_asio.reference.basic_raw_socket.native_non_blocking [*native_non_blocking]]] 77324 [Gets the non-blocking mode of the native socket implementation. 77325 [hr] 77326 Sets the non-blocking mode of the native socket implementation. ] 77327 ] 77328 77329 [ 77330 [[link boost_asio.reference.basic_raw_socket.non_blocking [*non_blocking]]] 77331 [Gets the non-blocking mode of the socket. 77332 [hr] 77333 Sets the non-blocking mode of the socket. ] 77334 ] 77335 77336 [ 77337 [[link boost_asio.reference.basic_raw_socket.open [*open]]] 77338 [Open the socket using the specified protocol. ] 77339 ] 77340 77341 [ 77342 [[link boost_asio.reference.basic_raw_socket.operator_eq_ [*operator=]]] 77343 [Move-assign a basic_raw_socket from another. 77344 [hr] 77345 Move-assign a basic_raw_socket from a socket of another protocol type. ] 77346 ] 77347 77348 [ 77349 [[link boost_asio.reference.basic_raw_socket.receive [*receive]]] 77350 [Receive some data on a connected socket. ] 77351 ] 77352 77353 [ 77354 [[link boost_asio.reference.basic_raw_socket.receive_from [*receive_from]]] 77355 [Receive raw data with the endpoint of the sender. ] 77356 ] 77357 77358 [ 77359 [[link boost_asio.reference.basic_raw_socket.release [*release]]] 77360 [Release ownership of the underlying native socket. ] 77361 ] 77362 77363 [ 77364 [[link boost_asio.reference.basic_raw_socket.remote_endpoint [*remote_endpoint]]] 77365 [Get the remote endpoint of the socket. ] 77366 ] 77367 77368 [ 77369 [[link boost_asio.reference.basic_raw_socket.send [*send]]] 77370 [Send some data on a connected socket. ] 77371 ] 77372 77373 [ 77374 [[link boost_asio.reference.basic_raw_socket.send_to [*send_to]]] 77375 [Send raw data to the specified endpoint. ] 77376 ] 77377 77378 [ 77379 [[link boost_asio.reference.basic_raw_socket.set_option [*set_option]]] 77380 [Set an option on the socket. ] 77381 ] 77382 77383 [ 77384 [[link boost_asio.reference.basic_raw_socket.shutdown [*shutdown]]] 77385 [Disable sends or receives on the socket. ] 77386 ] 77387 77388 [ 77389 [[link boost_asio.reference.basic_raw_socket.wait [*wait]]] 77390 [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 77391 ] 77392 77393 [ 77394 [[link boost_asio.reference.basic_raw_socket._basic_raw_socket [*~basic_raw_socket]] [destructor]] 77395 [Destroys the socket. ] 77396 ] 77397 77398] 77399 77400[heading Data Members] 77401[table 77402 [[Name][Description]] 77403 77404 [ 77405 [[link boost_asio.reference.basic_raw_socket.max_connections [*max_connections]] [static]] 77406 [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ] 77407 ] 77408 77409 [ 77410 [[link boost_asio.reference.basic_raw_socket.max_listen_connections [*max_listen_connections]] [static]] 77411 [The maximum length of the queue of pending incoming connections. ] 77412 ] 77413 77414 [ 77415 [[link boost_asio.reference.basic_raw_socket.message_do_not_route [*message_do_not_route]] [static]] 77416 [Specify that the data should not be subject to routing. ] 77417 ] 77418 77419 [ 77420 [[link boost_asio.reference.basic_raw_socket.message_end_of_record [*message_end_of_record]] [static]] 77421 [Specifies that the data marks the end of a record. ] 77422 ] 77423 77424 [ 77425 [[link boost_asio.reference.basic_raw_socket.message_out_of_band [*message_out_of_band]] [static]] 77426 [Process out-of-band data. ] 77427 ] 77428 77429 [ 77430 [[link boost_asio.reference.basic_raw_socket.message_peek [*message_peek]] [static]] 77431 [Peek at incoming data without removing it from the input queue. ] 77432 ] 77433 77434] 77435 77436The [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] class template provides asynchronous and blocking raw-oriented socket functionality. 77437 77438 77439[heading Thread Safety] 77440 77441['Distinct] ['objects:] Safe. 77442 77443['Shared] ['objects:] Unsafe. 77444 77445Synchronous `send`, `send_to`, `receive`, `receive_from`, and `connect` operations are thread safe with respect to each other, if the underlying operating system calls are also thread safe. This means that it is permitted to perform concurrent calls to these synchronous operations on a single socket object. Other synchronous operations, such as `open` or `close`, are not thread safe. 77446 77447 77448[heading Requirements] 77449 77450['Header: ][^boost/asio/generic/raw_protocol.hpp] 77451 77452['Convenience header: ][^boost/asio.hpp] 77453 77454 77455[endsect] 77456 77457 77458 77459[section:type generic::raw_protocol::type] 77460 77461[indexterm2 boost_asio.indexterm.generic__raw_protocol.type..type..generic::raw_protocol] 77462Obtain an identifier for the type of the protocol. 77463 77464 77465 int type() const; 77466 77467 77468 77469[endsect] 77470 77471 77472 77473[endsect] 77474 77475[section:generic__seq_packet_protocol generic::seq_packet_protocol] 77476 77477[indexterm1 boost_asio.indexterm.generic__seq_packet_protocol..generic::seq_packet_protocol] 77478 77479 77480Encapsulates the flags needed for a generic sequenced packet socket. 77481 77482 77483 class seq_packet_protocol 77484 77485 77486[heading Types] 77487[table 77488 [[Name][Description]] 77489 77490 [ 77491 77492 [[link boost_asio.reference.generic__seq_packet_protocol.endpoint [*endpoint]]] 77493 [The type of an endpoint. ] 77494 77495 ] 77496 77497 [ 77498 77499 [[link boost_asio.reference.generic__seq_packet_protocol.socket [*socket]]] 77500 [The generic socket type. ] 77501 77502 ] 77503 77504] 77505 77506[heading Member Functions] 77507[table 77508 [[Name][Description]] 77509 77510 [ 77511 [[link boost_asio.reference.generic__seq_packet_protocol.family [*family]]] 77512 [Obtain an identifier for the protocol family. ] 77513 ] 77514 77515 [ 77516 [[link boost_asio.reference.generic__seq_packet_protocol.protocol [*protocol]]] 77517 [Obtain an identifier for the protocol. ] 77518 ] 77519 77520 [ 77521 [[link boost_asio.reference.generic__seq_packet_protocol.seq_packet_protocol [*seq_packet_protocol]] [constructor]] 77522 [Construct a protocol object for a specific address family and protocol. 77523 [hr] 77524 Construct a generic protocol object from a specific protocol. ] 77525 ] 77526 77527 [ 77528 [[link boost_asio.reference.generic__seq_packet_protocol.type [*type]]] 77529 [Obtain an identifier for the type of the protocol. ] 77530 ] 77531 77532] 77533 77534[heading Friends] 77535[table 77536 [[Name][Description]] 77537 77538 [ 77539 [[link boost_asio.reference.generic__seq_packet_protocol.operator_not__eq_ [*operator!=]]] 77540 [Compare two protocols for inequality. ] 77541 ] 77542 77543 [ 77544 [[link boost_asio.reference.generic__seq_packet_protocol.operator_eq__eq_ [*operator==]]] 77545 [Compare two protocols for equality. ] 77546 ] 77547 77548] 77549 77550The [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. 77551 77552 77553[heading Examples] 77554 77555Constructing using a native address family and socket protocol: 77556 77557 seq_packet_protocol p(AF_INET, IPPROTO_SCTP); 77558 77559 77560 77561 77562 77563[heading Thread Safety] 77564 77565['Distinct] ['objects:] Safe. 77566 77567['Shared] ['objects:] Safe. 77568 77569 77570 77571 77572[heading Requirements] 77573 77574['Header: ][^boost/asio/generic/seq_packet_protocol.hpp] 77575 77576['Convenience header: ][^boost/asio.hpp] 77577 77578 77579[section:endpoint generic::seq_packet_protocol::endpoint] 77580 77581[indexterm2 boost_asio.indexterm.generic__seq_packet_protocol.endpoint..endpoint..generic::seq_packet_protocol] 77582The type of an endpoint. 77583 77584 77585 typedef basic_endpoint< seq_packet_protocol > endpoint; 77586 77587 77588[heading Types] 77589[table 77590 [[Name][Description]] 77591 77592 [ 77593 77594 [[link boost_asio.reference.generic__basic_endpoint.data_type [*data_type]]] 77595 [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ] 77596 77597 ] 77598 77599 [ 77600 77601 [[link boost_asio.reference.generic__basic_endpoint.protocol_type [*protocol_type]]] 77602 [The protocol type associated with the endpoint. ] 77603 77604 ] 77605 77606] 77607 77608[heading Member Functions] 77609[table 77610 [[Name][Description]] 77611 77612 [ 77613 [[link boost_asio.reference.generic__basic_endpoint.basic_endpoint [*basic_endpoint]] [constructor]] 77614 [Default constructor. 77615 [hr] 77616 Construct an endpoint from the specified socket address. 77617 [hr] 77618 Construct an endpoint from the specific endpoint type. 77619 [hr] 77620 Copy constructor. ] 77621 ] 77622 77623 [ 77624 [[link boost_asio.reference.generic__basic_endpoint.capacity [*capacity]]] 77625 [Get the capacity of the endpoint in the native type. ] 77626 ] 77627 77628 [ 77629 [[link boost_asio.reference.generic__basic_endpoint.data [*data]]] 77630 [Get the underlying endpoint in the native type. ] 77631 ] 77632 77633 [ 77634 [[link boost_asio.reference.generic__basic_endpoint.operator_eq_ [*operator=]]] 77635 [Assign from another endpoint. ] 77636 ] 77637 77638 [ 77639 [[link boost_asio.reference.generic__basic_endpoint.protocol [*protocol]]] 77640 [The protocol associated with the endpoint. ] 77641 ] 77642 77643 [ 77644 [[link boost_asio.reference.generic__basic_endpoint.resize [*resize]]] 77645 [Set the underlying size of the endpoint in the native type. ] 77646 ] 77647 77648 [ 77649 [[link boost_asio.reference.generic__basic_endpoint.size [*size]]] 77650 [Get the underlying size of the endpoint in the native type. ] 77651 ] 77652 77653] 77654 77655[heading Friends] 77656[table 77657 [[Name][Description]] 77658 77659 [ 77660 [[link boost_asio.reference.generic__basic_endpoint.operator_not__eq_ [*operator!=]]] 77661 [Compare two endpoints for inequality. ] 77662 ] 77663 77664 [ 77665 [[link boost_asio.reference.generic__basic_endpoint.operator_lt_ [*operator<]]] 77666 [Compare endpoints for ordering. ] 77667 ] 77668 77669 [ 77670 [[link boost_asio.reference.generic__basic_endpoint.operator_lt__eq_ [*operator<=]]] 77671 [Compare endpoints for ordering. ] 77672 ] 77673 77674 [ 77675 [[link boost_asio.reference.generic__basic_endpoint.operator_eq__eq_ [*operator==]]] 77676 [Compare two endpoints for equality. ] 77677 ] 77678 77679 [ 77680 [[link boost_asio.reference.generic__basic_endpoint.operator_gt_ [*operator>]]] 77681 [Compare endpoints for ordering. ] 77682 ] 77683 77684 [ 77685 [[link boost_asio.reference.generic__basic_endpoint.operator_gt__eq_ [*operator>=]]] 77686 [Compare endpoints for ordering. ] 77687 ] 77688 77689] 77690 77691The [link boost_asio.reference.generic__basic_endpoint `generic::basic_endpoint`] class template describes an endpoint that may be associated with any socket type. 77692 77693 77694[heading Remarks] 77695 77696The socket types sockaddr type must be able to fit into a `sockaddr_storage` structure. 77697 77698 77699[heading Thread Safety] 77700 77701['Distinct] ['objects:] Safe. 77702 77703['Shared] ['objects:] Unsafe. 77704 77705 77706 77707 77708 77709[heading Requirements] 77710 77711['Header: ][^boost/asio/generic/seq_packet_protocol.hpp] 77712 77713['Convenience header: ][^boost/asio.hpp] 77714 77715 77716[endsect] 77717 77718 77719 77720[section:family generic::seq_packet_protocol::family] 77721 77722[indexterm2 boost_asio.indexterm.generic__seq_packet_protocol.family..family..generic::seq_packet_protocol] 77723Obtain an identifier for the protocol family. 77724 77725 77726 int family() const; 77727 77728 77729 77730[endsect] 77731 77732 77733 77734[section:operator_not__eq_ generic::seq_packet_protocol::operator!=] 77735 77736[indexterm2 boost_asio.indexterm.generic__seq_packet_protocol.operator_not__eq_..operator!=..generic::seq_packet_protocol] 77737Compare two protocols for inequality. 77738 77739 77740 friend bool operator!=( 77741 const seq_packet_protocol & p1, 77742 const seq_packet_protocol & p2); 77743 77744 77745[heading Requirements] 77746 77747['Header: ][^boost/asio/generic/seq_packet_protocol.hpp] 77748 77749['Convenience header: ][^boost/asio.hpp] 77750 77751 77752[endsect] 77753 77754 77755 77756[section:operator_eq__eq_ generic::seq_packet_protocol::operator==] 77757 77758[indexterm2 boost_asio.indexterm.generic__seq_packet_protocol.operator_eq__eq_..operator==..generic::seq_packet_protocol] 77759Compare two protocols for equality. 77760 77761 77762 friend bool operator==( 77763 const seq_packet_protocol & p1, 77764 const seq_packet_protocol & p2); 77765 77766 77767[heading Requirements] 77768 77769['Header: ][^boost/asio/generic/seq_packet_protocol.hpp] 77770 77771['Convenience header: ][^boost/asio.hpp] 77772 77773 77774[endsect] 77775 77776 77777 77778[section:protocol generic::seq_packet_protocol::protocol] 77779 77780[indexterm2 boost_asio.indexterm.generic__seq_packet_protocol.protocol..protocol..generic::seq_packet_protocol] 77781Obtain an identifier for the protocol. 77782 77783 77784 int protocol() const; 77785 77786 77787 77788[endsect] 77789 77790 77791[section:seq_packet_protocol generic::seq_packet_protocol::seq_packet_protocol] 77792 77793[indexterm2 boost_asio.indexterm.generic__seq_packet_protocol.seq_packet_protocol..seq_packet_protocol..generic::seq_packet_protocol] 77794Construct a protocol object for a specific address family and protocol. 77795 77796 77797 ``[link boost_asio.reference.generic__seq_packet_protocol.seq_packet_protocol.overload1 seq_packet_protocol]``( 77798 int address_family, 77799 int socket_protocol); 77800 `` [''''»''' [link boost_asio.reference.generic__seq_packet_protocol.seq_packet_protocol.overload1 more...]]`` 77801 77802 77803Construct a generic protocol object from a specific protocol. 77804 77805 77806 template< 77807 typename ``[link boost_asio.reference.Protocol Protocol]``> 77808 ``[link boost_asio.reference.generic__seq_packet_protocol.seq_packet_protocol.overload2 seq_packet_protocol]``( 77809 const Protocol & source_protocol); 77810 `` [''''»''' [link boost_asio.reference.generic__seq_packet_protocol.seq_packet_protocol.overload2 more...]]`` 77811 77812 77813[section:overload1 generic::seq_packet_protocol::seq_packet_protocol (1 of 2 overloads)] 77814 77815 77816Construct a protocol object for a specific address family and protocol. 77817 77818 77819 seq_packet_protocol( 77820 int address_family, 77821 int socket_protocol); 77822 77823 77824 77825[endsect] 77826 77827 77828 77829[section:overload2 generic::seq_packet_protocol::seq_packet_protocol (2 of 2 overloads)] 77830 77831 77832Construct a generic protocol object from a specific protocol. 77833 77834 77835 template< 77836 typename ``[link boost_asio.reference.Protocol Protocol]``> 77837 seq_packet_protocol( 77838 const Protocol & source_protocol); 77839 77840 77841 77842[heading Exceptions] 77843 77844 77845[variablelist 77846 77847[[@c][bad\_cast Thrown if the source protocol is not based around sequenced packets. ]] 77848 77849] 77850 77851 77852 77853 77854[endsect] 77855 77856 77857[endsect] 77858 77859 77860[section:socket generic::seq_packet_protocol::socket] 77861 77862[indexterm2 boost_asio.indexterm.generic__seq_packet_protocol.socket..socket..generic::seq_packet_protocol] 77863The generic socket type. 77864 77865 77866 typedef basic_seq_packet_socket< seq_packet_protocol > socket; 77867 77868 77869[heading Types] 77870[table 77871 [[Name][Description]] 77872 77873 [ 77874 77875 [[link boost_asio.reference.basic_seq_packet_socket__rebind_executor [*rebind_executor]]] 77876 [Rebinds the socket type to another executor. ] 77877 77878 ] 77879 77880 [ 77881 77882 [[link boost_asio.reference.basic_seq_packet_socket.broadcast [*broadcast]]] 77883 [Socket option to permit sending of broadcast messages. ] 77884 77885 ] 77886 77887 [ 77888 77889 [[link boost_asio.reference.basic_seq_packet_socket.bytes_readable [*bytes_readable]]] 77890 [IO control command to get the amount of data that can be read without blocking. ] 77891 77892 ] 77893 77894 [ 77895 77896 [[link boost_asio.reference.basic_seq_packet_socket.debug [*debug]]] 77897 [Socket option to enable socket-level debugging. ] 77898 77899 ] 77900 77901 [ 77902 77903 [[link boost_asio.reference.basic_seq_packet_socket.do_not_route [*do_not_route]]] 77904 [Socket option to prevent routing, use local interfaces only. ] 77905 77906 ] 77907 77908 [ 77909 77910 [[link boost_asio.reference.basic_seq_packet_socket.enable_connection_aborted [*enable_connection_aborted]]] 77911 [Socket option to report aborted connections on accept. ] 77912 77913 ] 77914 77915 [ 77916 77917 [[link boost_asio.reference.basic_seq_packet_socket.endpoint_type [*endpoint_type]]] 77918 [The endpoint type. ] 77919 77920 ] 77921 77922 [ 77923 77924 [[link boost_asio.reference.basic_seq_packet_socket.executor_type [*executor_type]]] 77925 [The type of the executor associated with the object. ] 77926 77927 ] 77928 77929 [ 77930 77931 [[link boost_asio.reference.basic_seq_packet_socket.keep_alive [*keep_alive]]] 77932 [Socket option to send keep-alives. ] 77933 77934 ] 77935 77936 [ 77937 77938 [[link boost_asio.reference.basic_seq_packet_socket.linger [*linger]]] 77939 [Socket option to specify whether the socket lingers on close if unsent data is present. ] 77940 77941 ] 77942 77943 [ 77944 77945 [[link boost_asio.reference.basic_seq_packet_socket.lowest_layer_type [*lowest_layer_type]]] 77946 [A basic_socket is always the lowest layer. ] 77947 77948 ] 77949 77950 [ 77951 77952 [[link boost_asio.reference.basic_seq_packet_socket.message_flags [*message_flags]]] 77953 [Bitmask type for flags that can be passed to send and receive operations. ] 77954 77955 ] 77956 77957 [ 77958 77959 [[link boost_asio.reference.basic_seq_packet_socket.native_handle_type [*native_handle_type]]] 77960 [The native representation of a socket. ] 77961 77962 ] 77963 77964 [ 77965 77966 [[link boost_asio.reference.basic_seq_packet_socket.out_of_band_inline [*out_of_band_inline]]] 77967 [Socket option for putting received out-of-band data inline. ] 77968 77969 ] 77970 77971 [ 77972 77973 [[link boost_asio.reference.basic_seq_packet_socket.protocol_type [*protocol_type]]] 77974 [The protocol type. ] 77975 77976 ] 77977 77978 [ 77979 77980 [[link boost_asio.reference.basic_seq_packet_socket.receive_buffer_size [*receive_buffer_size]]] 77981 [Socket option for the receive buffer size of a socket. ] 77982 77983 ] 77984 77985 [ 77986 77987 [[link boost_asio.reference.basic_seq_packet_socket.receive_low_watermark [*receive_low_watermark]]] 77988 [Socket option for the receive low watermark. ] 77989 77990 ] 77991 77992 [ 77993 77994 [[link boost_asio.reference.basic_seq_packet_socket.reuse_address [*reuse_address]]] 77995 [Socket option to allow the socket to be bound to an address that is already in use. ] 77996 77997 ] 77998 77999 [ 78000 78001 [[link boost_asio.reference.basic_seq_packet_socket.send_buffer_size [*send_buffer_size]]] 78002 [Socket option for the send buffer size of a socket. ] 78003 78004 ] 78005 78006 [ 78007 78008 [[link boost_asio.reference.basic_seq_packet_socket.send_low_watermark [*send_low_watermark]]] 78009 [Socket option for the send low watermark. ] 78010 78011 ] 78012 78013 [ 78014 78015 [[link boost_asio.reference.basic_seq_packet_socket.shutdown_type [*shutdown_type]]] 78016 [Different ways a socket may be shutdown. ] 78017 78018 ] 78019 78020 [ 78021 78022 [[link boost_asio.reference.basic_seq_packet_socket.wait_type [*wait_type]]] 78023 [Wait types. ] 78024 78025 ] 78026 78027] 78028 78029[heading Member Functions] 78030[table 78031 [[Name][Description]] 78032 78033 [ 78034 [[link boost_asio.reference.basic_seq_packet_socket.assign [*assign]]] 78035 [Assign an existing native socket to the socket. ] 78036 ] 78037 78038 [ 78039 [[link boost_asio.reference.basic_seq_packet_socket.async_connect [*async_connect]]] 78040 [Start an asynchronous connect. ] 78041 ] 78042 78043 [ 78044 [[link boost_asio.reference.basic_seq_packet_socket.async_receive [*async_receive]]] 78045 [Start an asynchronous receive. ] 78046 ] 78047 78048 [ 78049 [[link boost_asio.reference.basic_seq_packet_socket.async_send [*async_send]]] 78050 [Start an asynchronous send. ] 78051 ] 78052 78053 [ 78054 [[link boost_asio.reference.basic_seq_packet_socket.async_wait [*async_wait]]] 78055 [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 78056 ] 78057 78058 [ 78059 [[link boost_asio.reference.basic_seq_packet_socket.at_mark [*at_mark]]] 78060 [Determine whether the socket is at the out-of-band data mark. ] 78061 ] 78062 78063 [ 78064 [[link boost_asio.reference.basic_seq_packet_socket.available [*available]]] 78065 [Determine the number of bytes available for reading. ] 78066 ] 78067 78068 [ 78069 [[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket [*basic_seq_packet_socket]] [constructor]] 78070 [Construct a basic_seq_packet_socket without opening it. 78071 [hr] 78072 Construct and open a basic_seq_packet_socket. 78073 [hr] 78074 Construct a basic_seq_packet_socket, opening it and binding it to the given local endpoint. 78075 [hr] 78076 Construct a basic_seq_packet_socket on an existing native socket. 78077 [hr] 78078 Move-construct a basic_seq_packet_socket from another. 78079 [hr] 78080 Move-construct a basic_seq_packet_socket from a socket of another protocol type. ] 78081 ] 78082 78083 [ 78084 [[link boost_asio.reference.basic_seq_packet_socket.bind [*bind]]] 78085 [Bind the socket to the given local endpoint. ] 78086 ] 78087 78088 [ 78089 [[link boost_asio.reference.basic_seq_packet_socket.cancel [*cancel]]] 78090 [Cancel all asynchronous operations associated with the socket. ] 78091 ] 78092 78093 [ 78094 [[link boost_asio.reference.basic_seq_packet_socket.close [*close]]] 78095 [Close the socket. ] 78096 ] 78097 78098 [ 78099 [[link boost_asio.reference.basic_seq_packet_socket.connect [*connect]]] 78100 [Connect the socket to the specified endpoint. ] 78101 ] 78102 78103 [ 78104 [[link boost_asio.reference.basic_seq_packet_socket.get_executor [*get_executor]]] 78105 [Get the executor associated with the object. ] 78106 ] 78107 78108 [ 78109 [[link boost_asio.reference.basic_seq_packet_socket.get_option [*get_option]]] 78110 [Get an option from the socket. ] 78111 ] 78112 78113 [ 78114 [[link boost_asio.reference.basic_seq_packet_socket.io_control [*io_control]]] 78115 [Perform an IO control command on the socket. ] 78116 ] 78117 78118 [ 78119 [[link boost_asio.reference.basic_seq_packet_socket.is_open [*is_open]]] 78120 [Determine whether the socket is open. ] 78121 ] 78122 78123 [ 78124 [[link boost_asio.reference.basic_seq_packet_socket.local_endpoint [*local_endpoint]]] 78125 [Get the local endpoint of the socket. ] 78126 ] 78127 78128 [ 78129 [[link boost_asio.reference.basic_seq_packet_socket.lowest_layer [*lowest_layer]]] 78130 [Get a reference to the lowest layer. 78131 [hr] 78132 Get a const reference to the lowest layer. ] 78133 ] 78134 78135 [ 78136 [[link boost_asio.reference.basic_seq_packet_socket.native_handle [*native_handle]]] 78137 [Get the native socket representation. ] 78138 ] 78139 78140 [ 78141 [[link boost_asio.reference.basic_seq_packet_socket.native_non_blocking [*native_non_blocking]]] 78142 [Gets the non-blocking mode of the native socket implementation. 78143 [hr] 78144 Sets the non-blocking mode of the native socket implementation. ] 78145 ] 78146 78147 [ 78148 [[link boost_asio.reference.basic_seq_packet_socket.non_blocking [*non_blocking]]] 78149 [Gets the non-blocking mode of the socket. 78150 [hr] 78151 Sets the non-blocking mode of the socket. ] 78152 ] 78153 78154 [ 78155 [[link boost_asio.reference.basic_seq_packet_socket.open [*open]]] 78156 [Open the socket using the specified protocol. ] 78157 ] 78158 78159 [ 78160 [[link boost_asio.reference.basic_seq_packet_socket.operator_eq_ [*operator=]]] 78161 [Move-assign a basic_seq_packet_socket from another. 78162 [hr] 78163 Move-assign a basic_seq_packet_socket from a socket of another protocol type. ] 78164 ] 78165 78166 [ 78167 [[link boost_asio.reference.basic_seq_packet_socket.receive [*receive]]] 78168 [Receive some data on the socket. 78169 [hr] 78170 Receive some data on a connected socket. ] 78171 ] 78172 78173 [ 78174 [[link boost_asio.reference.basic_seq_packet_socket.release [*release]]] 78175 [Release ownership of the underlying native socket. ] 78176 ] 78177 78178 [ 78179 [[link boost_asio.reference.basic_seq_packet_socket.remote_endpoint [*remote_endpoint]]] 78180 [Get the remote endpoint of the socket. ] 78181 ] 78182 78183 [ 78184 [[link boost_asio.reference.basic_seq_packet_socket.send [*send]]] 78185 [Send some data on the socket. ] 78186 ] 78187 78188 [ 78189 [[link boost_asio.reference.basic_seq_packet_socket.set_option [*set_option]]] 78190 [Set an option on the socket. ] 78191 ] 78192 78193 [ 78194 [[link boost_asio.reference.basic_seq_packet_socket.shutdown [*shutdown]]] 78195 [Disable sends or receives on the socket. ] 78196 ] 78197 78198 [ 78199 [[link boost_asio.reference.basic_seq_packet_socket.wait [*wait]]] 78200 [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 78201 ] 78202 78203 [ 78204 [[link boost_asio.reference.basic_seq_packet_socket._basic_seq_packet_socket [*~basic_seq_packet_socket]] [destructor]] 78205 [Destroys the socket. ] 78206 ] 78207 78208] 78209 78210[heading Data Members] 78211[table 78212 [[Name][Description]] 78213 78214 [ 78215 [[link boost_asio.reference.basic_seq_packet_socket.max_connections [*max_connections]] [static]] 78216 [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ] 78217 ] 78218 78219 [ 78220 [[link boost_asio.reference.basic_seq_packet_socket.max_listen_connections [*max_listen_connections]] [static]] 78221 [The maximum length of the queue of pending incoming connections. ] 78222 ] 78223 78224 [ 78225 [[link boost_asio.reference.basic_seq_packet_socket.message_do_not_route [*message_do_not_route]] [static]] 78226 [Specify that the data should not be subject to routing. ] 78227 ] 78228 78229 [ 78230 [[link boost_asio.reference.basic_seq_packet_socket.message_end_of_record [*message_end_of_record]] [static]] 78231 [Specifies that the data marks the end of a record. ] 78232 ] 78233 78234 [ 78235 [[link boost_asio.reference.basic_seq_packet_socket.message_out_of_band [*message_out_of_band]] [static]] 78236 [Process out-of-band data. ] 78237 ] 78238 78239 [ 78240 [[link boost_asio.reference.basic_seq_packet_socket.message_peek [*message_peek]] [static]] 78241 [Peek at incoming data without removing it from the input queue. ] 78242 ] 78243 78244] 78245 78246The [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] class template provides asynchronous and blocking sequenced packet socket functionality. 78247 78248 78249[heading Thread Safety] 78250 78251['Distinct] ['objects:] Safe. 78252 78253['Shared] ['objects:] Unsafe. 78254 78255Synchronous `send`, `receive`, and `connect` operations are thread safe with respect to each other, if the underlying operating system calls are also thread safe. This means that it is permitted to perform concurrent calls to these synchronous operations on a single socket object. Other synchronous operations, such as `open` or `close`, are not thread safe. 78256 78257 78258[heading Requirements] 78259 78260['Header: ][^boost/asio/generic/seq_packet_protocol.hpp] 78261 78262['Convenience header: ][^boost/asio.hpp] 78263 78264 78265[endsect] 78266 78267 78268 78269[section:type generic::seq_packet_protocol::type] 78270 78271[indexterm2 boost_asio.indexterm.generic__seq_packet_protocol.type..type..generic::seq_packet_protocol] 78272Obtain an identifier for the type of the protocol. 78273 78274 78275 int type() const; 78276 78277 78278 78279[endsect] 78280 78281 78282 78283[endsect] 78284 78285[section:generic__stream_protocol generic::stream_protocol] 78286 78287[indexterm1 boost_asio.indexterm.generic__stream_protocol..generic::stream_protocol] 78288 78289 78290Encapsulates the flags needed for a generic stream-oriented socket. 78291 78292 78293 class stream_protocol 78294 78295 78296[heading Types] 78297[table 78298 [[Name][Description]] 78299 78300 [ 78301 78302 [[link boost_asio.reference.generic__stream_protocol.endpoint [*endpoint]]] 78303 [The type of an endpoint. ] 78304 78305 ] 78306 78307 [ 78308 78309 [[link boost_asio.reference.generic__stream_protocol.iostream [*iostream]]] 78310 [The generic socket iostream type. ] 78311 78312 ] 78313 78314 [ 78315 78316 [[link boost_asio.reference.generic__stream_protocol.socket [*socket]]] 78317 [The generic socket type. ] 78318 78319 ] 78320 78321] 78322 78323[heading Member Functions] 78324[table 78325 [[Name][Description]] 78326 78327 [ 78328 [[link boost_asio.reference.generic__stream_protocol.family [*family]]] 78329 [Obtain an identifier for the protocol family. ] 78330 ] 78331 78332 [ 78333 [[link boost_asio.reference.generic__stream_protocol.protocol [*protocol]]] 78334 [Obtain an identifier for the protocol. ] 78335 ] 78336 78337 [ 78338 [[link boost_asio.reference.generic__stream_protocol.stream_protocol [*stream_protocol]] [constructor]] 78339 [Construct a protocol object for a specific address family and protocol. 78340 [hr] 78341 Construct a generic protocol object from a specific protocol. ] 78342 ] 78343 78344 [ 78345 [[link boost_asio.reference.generic__stream_protocol.type [*type]]] 78346 [Obtain an identifier for the type of the protocol. ] 78347 ] 78348 78349] 78350 78351[heading Friends] 78352[table 78353 [[Name][Description]] 78354 78355 [ 78356 [[link boost_asio.reference.generic__stream_protocol.operator_not__eq_ [*operator!=]]] 78357 [Compare two protocols for inequality. ] 78358 ] 78359 78360 [ 78361 [[link boost_asio.reference.generic__stream_protocol.operator_eq__eq_ [*operator==]]] 78362 [Compare two protocols for equality. ] 78363 ] 78364 78365] 78366 78367The [link boost_asio.reference.generic__stream_protocol `generic::stream_protocol`] class contains flags necessary for stream-oriented sockets of any address family and protocol. 78368 78369 78370[heading Examples] 78371 78372Constructing using a native address family and socket protocol: 78373 78374 stream_protocol p(AF_INET, IPPROTO_TCP); 78375 78376 78377Constructing from a specific protocol type: 78378 78379 stream_protocol p(boost::asio::ip::tcp::v4()); 78380 78381 78382 78383 78384 78385[heading Thread Safety] 78386 78387['Distinct] ['objects:] Safe. 78388 78389['Shared] ['objects:] Safe. 78390 78391 78392 78393 78394[heading Requirements] 78395 78396['Header: ][^boost/asio/generic/stream_protocol.hpp] 78397 78398['Convenience header: ][^boost/asio.hpp] 78399 78400 78401[section:endpoint generic::stream_protocol::endpoint] 78402 78403[indexterm2 boost_asio.indexterm.generic__stream_protocol.endpoint..endpoint..generic::stream_protocol] 78404The type of an endpoint. 78405 78406 78407 typedef basic_endpoint< stream_protocol > endpoint; 78408 78409 78410[heading Types] 78411[table 78412 [[Name][Description]] 78413 78414 [ 78415 78416 [[link boost_asio.reference.generic__basic_endpoint.data_type [*data_type]]] 78417 [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ] 78418 78419 ] 78420 78421 [ 78422 78423 [[link boost_asio.reference.generic__basic_endpoint.protocol_type [*protocol_type]]] 78424 [The protocol type associated with the endpoint. ] 78425 78426 ] 78427 78428] 78429 78430[heading Member Functions] 78431[table 78432 [[Name][Description]] 78433 78434 [ 78435 [[link boost_asio.reference.generic__basic_endpoint.basic_endpoint [*basic_endpoint]] [constructor]] 78436 [Default constructor. 78437 [hr] 78438 Construct an endpoint from the specified socket address. 78439 [hr] 78440 Construct an endpoint from the specific endpoint type. 78441 [hr] 78442 Copy constructor. ] 78443 ] 78444 78445 [ 78446 [[link boost_asio.reference.generic__basic_endpoint.capacity [*capacity]]] 78447 [Get the capacity of the endpoint in the native type. ] 78448 ] 78449 78450 [ 78451 [[link boost_asio.reference.generic__basic_endpoint.data [*data]]] 78452 [Get the underlying endpoint in the native type. ] 78453 ] 78454 78455 [ 78456 [[link boost_asio.reference.generic__basic_endpoint.operator_eq_ [*operator=]]] 78457 [Assign from another endpoint. ] 78458 ] 78459 78460 [ 78461 [[link boost_asio.reference.generic__basic_endpoint.protocol [*protocol]]] 78462 [The protocol associated with the endpoint. ] 78463 ] 78464 78465 [ 78466 [[link boost_asio.reference.generic__basic_endpoint.resize [*resize]]] 78467 [Set the underlying size of the endpoint in the native type. ] 78468 ] 78469 78470 [ 78471 [[link boost_asio.reference.generic__basic_endpoint.size [*size]]] 78472 [Get the underlying size of the endpoint in the native type. ] 78473 ] 78474 78475] 78476 78477[heading Friends] 78478[table 78479 [[Name][Description]] 78480 78481 [ 78482 [[link boost_asio.reference.generic__basic_endpoint.operator_not__eq_ [*operator!=]]] 78483 [Compare two endpoints for inequality. ] 78484 ] 78485 78486 [ 78487 [[link boost_asio.reference.generic__basic_endpoint.operator_lt_ [*operator<]]] 78488 [Compare endpoints for ordering. ] 78489 ] 78490 78491 [ 78492 [[link boost_asio.reference.generic__basic_endpoint.operator_lt__eq_ [*operator<=]]] 78493 [Compare endpoints for ordering. ] 78494 ] 78495 78496 [ 78497 [[link boost_asio.reference.generic__basic_endpoint.operator_eq__eq_ [*operator==]]] 78498 [Compare two endpoints for equality. ] 78499 ] 78500 78501 [ 78502 [[link boost_asio.reference.generic__basic_endpoint.operator_gt_ [*operator>]]] 78503 [Compare endpoints for ordering. ] 78504 ] 78505 78506 [ 78507 [[link boost_asio.reference.generic__basic_endpoint.operator_gt__eq_ [*operator>=]]] 78508 [Compare endpoints for ordering. ] 78509 ] 78510 78511] 78512 78513The [link boost_asio.reference.generic__basic_endpoint `generic::basic_endpoint`] class template describes an endpoint that may be associated with any socket type. 78514 78515 78516[heading Remarks] 78517 78518The socket types sockaddr type must be able to fit into a `sockaddr_storage` structure. 78519 78520 78521[heading Thread Safety] 78522 78523['Distinct] ['objects:] Safe. 78524 78525['Shared] ['objects:] Unsafe. 78526 78527 78528 78529 78530 78531[heading Requirements] 78532 78533['Header: ][^boost/asio/generic/stream_protocol.hpp] 78534 78535['Convenience header: ][^boost/asio.hpp] 78536 78537 78538[endsect] 78539 78540 78541 78542[section:family generic::stream_protocol::family] 78543 78544[indexterm2 boost_asio.indexterm.generic__stream_protocol.family..family..generic::stream_protocol] 78545Obtain an identifier for the protocol family. 78546 78547 78548 int family() const; 78549 78550 78551 78552[endsect] 78553 78554 78555 78556[section:iostream generic::stream_protocol::iostream] 78557 78558[indexterm2 boost_asio.indexterm.generic__stream_protocol.iostream..iostream..generic::stream_protocol] 78559The generic socket iostream type. 78560 78561 78562 typedef basic_socket_iostream< stream_protocol > iostream; 78563 78564 78565[heading Types] 78566[table 78567 [[Name][Description]] 78568 78569 [ 78570 78571 [[link boost_asio.reference.basic_socket_iostream.clock_type [*clock_type]]] 78572 [The clock type. ] 78573 78574 ] 78575 78576 [ 78577 78578 [[link boost_asio.reference.basic_socket_iostream.duration [*duration]]] 78579 [The duration type. ] 78580 78581 ] 78582 78583 [ 78584 78585 [[link boost_asio.reference.basic_socket_iostream.duration_type [*duration_type]]] 78586 [(Deprecated: Use duration.) The duration type. ] 78587 78588 ] 78589 78590 [ 78591 78592 [[link boost_asio.reference.basic_socket_iostream.endpoint_type [*endpoint_type]]] 78593 [The endpoint type. ] 78594 78595 ] 78596 78597 [ 78598 78599 [[link boost_asio.reference.basic_socket_iostream.protocol_type [*protocol_type]]] 78600 [The protocol type. ] 78601 78602 ] 78603 78604 [ 78605 78606 [[link boost_asio.reference.basic_socket_iostream.time_point [*time_point]]] 78607 [The time type. ] 78608 78609 ] 78610 78611 [ 78612 78613 [[link boost_asio.reference.basic_socket_iostream.time_type [*time_type]]] 78614 [(Deprecated: Use time_point.) The time type. ] 78615 78616 ] 78617 78618] 78619 78620[heading Member Functions] 78621[table 78622 [[Name][Description]] 78623 78624 [ 78625 [[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream [*basic_socket_iostream]] [constructor]] 78626 [Construct a basic_socket_iostream without establishing a connection. 78627 [hr] 78628 Construct a basic_socket_iostream from the supplied socket. 78629 [hr] 78630 Move-construct a basic_socket_iostream from another. 78631 [hr] 78632 Establish a connection to an endpoint corresponding to a resolver query. ] 78633 ] 78634 78635 [ 78636 [[link boost_asio.reference.basic_socket_iostream.close [*close]]] 78637 [Close the connection. ] 78638 ] 78639 78640 [ 78641 [[link boost_asio.reference.basic_socket_iostream.connect [*connect]]] 78642 [Establish a connection to an endpoint corresponding to a resolver query. ] 78643 ] 78644 78645 [ 78646 [[link boost_asio.reference.basic_socket_iostream.error [*error]]] 78647 [Get the last error associated with the stream. ] 78648 ] 78649 78650 [ 78651 [[link boost_asio.reference.basic_socket_iostream.expires_after [*expires_after]]] 78652 [Set the stream's expiry time relative to now. ] 78653 ] 78654 78655 [ 78656 [[link boost_asio.reference.basic_socket_iostream.expires_at [*expires_at]]] 78657 [(Deprecated: Use expiry().) Get the stream's expiry time as an absolute time. 78658 [hr] 78659 Set the stream's expiry time as an absolute time. ] 78660 ] 78661 78662 [ 78663 [[link boost_asio.reference.basic_socket_iostream.expires_from_now [*expires_from_now]]] 78664 [(Deprecated: Use expiry().) Get the stream's expiry time relative to now. 78665 [hr] 78666 (Deprecated: Use expires_after().) Set the stream's expiry time relative to now. ] 78667 ] 78668 78669 [ 78670 [[link boost_asio.reference.basic_socket_iostream.expiry [*expiry]]] 78671 [Get the stream's expiry time as an absolute time. ] 78672 ] 78673 78674 [ 78675 [[link boost_asio.reference.basic_socket_iostream.operator_eq_ [*operator=]]] 78676 [Move-assign a basic_socket_iostream from another. ] 78677 ] 78678 78679 [ 78680 [[link boost_asio.reference.basic_socket_iostream.rdbuf [*rdbuf]]] 78681 [Return a pointer to the underlying streambuf. ] 78682 ] 78683 78684 [ 78685 [[link boost_asio.reference.basic_socket_iostream.socket [*socket]]] 78686 [Get a reference to the underlying socket. ] 78687 ] 78688 78689] 78690 78691 78692[heading Requirements] 78693 78694['Header: ][^boost/asio/generic/stream_protocol.hpp] 78695 78696['Convenience header: ][^boost/asio.hpp] 78697 78698 78699[endsect] 78700 78701 78702 78703[section:operator_not__eq_ generic::stream_protocol::operator!=] 78704 78705[indexterm2 boost_asio.indexterm.generic__stream_protocol.operator_not__eq_..operator!=..generic::stream_protocol] 78706Compare two protocols for inequality. 78707 78708 78709 friend bool operator!=( 78710 const stream_protocol & p1, 78711 const stream_protocol & p2); 78712 78713 78714[heading Requirements] 78715 78716['Header: ][^boost/asio/generic/stream_protocol.hpp] 78717 78718['Convenience header: ][^boost/asio.hpp] 78719 78720 78721[endsect] 78722 78723 78724 78725[section:operator_eq__eq_ generic::stream_protocol::operator==] 78726 78727[indexterm2 boost_asio.indexterm.generic__stream_protocol.operator_eq__eq_..operator==..generic::stream_protocol] 78728Compare two protocols for equality. 78729 78730 78731 friend bool operator==( 78732 const stream_protocol & p1, 78733 const stream_protocol & p2); 78734 78735 78736[heading Requirements] 78737 78738['Header: ][^boost/asio/generic/stream_protocol.hpp] 78739 78740['Convenience header: ][^boost/asio.hpp] 78741 78742 78743[endsect] 78744 78745 78746 78747[section:protocol generic::stream_protocol::protocol] 78748 78749[indexterm2 boost_asio.indexterm.generic__stream_protocol.protocol..protocol..generic::stream_protocol] 78750Obtain an identifier for the protocol. 78751 78752 78753 int protocol() const; 78754 78755 78756 78757[endsect] 78758 78759 78760 78761[section:socket generic::stream_protocol::socket] 78762 78763[indexterm2 boost_asio.indexterm.generic__stream_protocol.socket..socket..generic::stream_protocol] 78764The generic socket type. 78765 78766 78767 typedef basic_stream_socket< stream_protocol > socket; 78768 78769 78770[heading Types] 78771[table 78772 [[Name][Description]] 78773 78774 [ 78775 78776 [[link boost_asio.reference.basic_stream_socket__rebind_executor [*rebind_executor]]] 78777 [Rebinds the socket type to another executor. ] 78778 78779 ] 78780 78781 [ 78782 78783 [[link boost_asio.reference.basic_stream_socket.broadcast [*broadcast]]] 78784 [Socket option to permit sending of broadcast messages. ] 78785 78786 ] 78787 78788 [ 78789 78790 [[link boost_asio.reference.basic_stream_socket.bytes_readable [*bytes_readable]]] 78791 [IO control command to get the amount of data that can be read without blocking. ] 78792 78793 ] 78794 78795 [ 78796 78797 [[link boost_asio.reference.basic_stream_socket.debug [*debug]]] 78798 [Socket option to enable socket-level debugging. ] 78799 78800 ] 78801 78802 [ 78803 78804 [[link boost_asio.reference.basic_stream_socket.do_not_route [*do_not_route]]] 78805 [Socket option to prevent routing, use local interfaces only. ] 78806 78807 ] 78808 78809 [ 78810 78811 [[link boost_asio.reference.basic_stream_socket.enable_connection_aborted [*enable_connection_aborted]]] 78812 [Socket option to report aborted connections on accept. ] 78813 78814 ] 78815 78816 [ 78817 78818 [[link boost_asio.reference.basic_stream_socket.endpoint_type [*endpoint_type]]] 78819 [The endpoint type. ] 78820 78821 ] 78822 78823 [ 78824 78825 [[link boost_asio.reference.basic_stream_socket.executor_type [*executor_type]]] 78826 [The type of the executor associated with the object. ] 78827 78828 ] 78829 78830 [ 78831 78832 [[link boost_asio.reference.basic_stream_socket.keep_alive [*keep_alive]]] 78833 [Socket option to send keep-alives. ] 78834 78835 ] 78836 78837 [ 78838 78839 [[link boost_asio.reference.basic_stream_socket.linger [*linger]]] 78840 [Socket option to specify whether the socket lingers on close if unsent data is present. ] 78841 78842 ] 78843 78844 [ 78845 78846 [[link boost_asio.reference.basic_stream_socket.lowest_layer_type [*lowest_layer_type]]] 78847 [A basic_socket is always the lowest layer. ] 78848 78849 ] 78850 78851 [ 78852 78853 [[link boost_asio.reference.basic_stream_socket.message_flags [*message_flags]]] 78854 [Bitmask type for flags that can be passed to send and receive operations. ] 78855 78856 ] 78857 78858 [ 78859 78860 [[link boost_asio.reference.basic_stream_socket.native_handle_type [*native_handle_type]]] 78861 [The native representation of a socket. ] 78862 78863 ] 78864 78865 [ 78866 78867 [[link boost_asio.reference.basic_stream_socket.out_of_band_inline [*out_of_band_inline]]] 78868 [Socket option for putting received out-of-band data inline. ] 78869 78870 ] 78871 78872 [ 78873 78874 [[link boost_asio.reference.basic_stream_socket.protocol_type [*protocol_type]]] 78875 [The protocol type. ] 78876 78877 ] 78878 78879 [ 78880 78881 [[link boost_asio.reference.basic_stream_socket.receive_buffer_size [*receive_buffer_size]]] 78882 [Socket option for the receive buffer size of a socket. ] 78883 78884 ] 78885 78886 [ 78887 78888 [[link boost_asio.reference.basic_stream_socket.receive_low_watermark [*receive_low_watermark]]] 78889 [Socket option for the receive low watermark. ] 78890 78891 ] 78892 78893 [ 78894 78895 [[link boost_asio.reference.basic_stream_socket.reuse_address [*reuse_address]]] 78896 [Socket option to allow the socket to be bound to an address that is already in use. ] 78897 78898 ] 78899 78900 [ 78901 78902 [[link boost_asio.reference.basic_stream_socket.send_buffer_size [*send_buffer_size]]] 78903 [Socket option for the send buffer size of a socket. ] 78904 78905 ] 78906 78907 [ 78908 78909 [[link boost_asio.reference.basic_stream_socket.send_low_watermark [*send_low_watermark]]] 78910 [Socket option for the send low watermark. ] 78911 78912 ] 78913 78914 [ 78915 78916 [[link boost_asio.reference.basic_stream_socket.shutdown_type [*shutdown_type]]] 78917 [Different ways a socket may be shutdown. ] 78918 78919 ] 78920 78921 [ 78922 78923 [[link boost_asio.reference.basic_stream_socket.wait_type [*wait_type]]] 78924 [Wait types. ] 78925 78926 ] 78927 78928] 78929 78930[heading Member Functions] 78931[table 78932 [[Name][Description]] 78933 78934 [ 78935 [[link boost_asio.reference.basic_stream_socket.assign [*assign]]] 78936 [Assign an existing native socket to the socket. ] 78937 ] 78938 78939 [ 78940 [[link boost_asio.reference.basic_stream_socket.async_connect [*async_connect]]] 78941 [Start an asynchronous connect. ] 78942 ] 78943 78944 [ 78945 [[link boost_asio.reference.basic_stream_socket.async_read_some [*async_read_some]]] 78946 [Start an asynchronous read. ] 78947 ] 78948 78949 [ 78950 [[link boost_asio.reference.basic_stream_socket.async_receive [*async_receive]]] 78951 [Start an asynchronous receive. ] 78952 ] 78953 78954 [ 78955 [[link boost_asio.reference.basic_stream_socket.async_send [*async_send]]] 78956 [Start an asynchronous send. ] 78957 ] 78958 78959 [ 78960 [[link boost_asio.reference.basic_stream_socket.async_wait [*async_wait]]] 78961 [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 78962 ] 78963 78964 [ 78965 [[link boost_asio.reference.basic_stream_socket.async_write_some [*async_write_some]]] 78966 [Start an asynchronous write. ] 78967 ] 78968 78969 [ 78970 [[link boost_asio.reference.basic_stream_socket.at_mark [*at_mark]]] 78971 [Determine whether the socket is at the out-of-band data mark. ] 78972 ] 78973 78974 [ 78975 [[link boost_asio.reference.basic_stream_socket.available [*available]]] 78976 [Determine the number of bytes available for reading. ] 78977 ] 78978 78979 [ 78980 [[link boost_asio.reference.basic_stream_socket.basic_stream_socket [*basic_stream_socket]] [constructor]] 78981 [Construct a basic_stream_socket without opening it. 78982 [hr] 78983 Construct and open a basic_stream_socket. 78984 [hr] 78985 Construct a basic_stream_socket, opening it and binding it to the given local endpoint. 78986 [hr] 78987 Construct a basic_stream_socket on an existing native socket. 78988 [hr] 78989 Move-construct a basic_stream_socket from another. 78990 [hr] 78991 Move-construct a basic_stream_socket from a socket of another protocol type. ] 78992 ] 78993 78994 [ 78995 [[link boost_asio.reference.basic_stream_socket.bind [*bind]]] 78996 [Bind the socket to the given local endpoint. ] 78997 ] 78998 78999 [ 79000 [[link boost_asio.reference.basic_stream_socket.cancel [*cancel]]] 79001 [Cancel all asynchronous operations associated with the socket. ] 79002 ] 79003 79004 [ 79005 [[link boost_asio.reference.basic_stream_socket.close [*close]]] 79006 [Close the socket. ] 79007 ] 79008 79009 [ 79010 [[link boost_asio.reference.basic_stream_socket.connect [*connect]]] 79011 [Connect the socket to the specified endpoint. ] 79012 ] 79013 79014 [ 79015 [[link boost_asio.reference.basic_stream_socket.get_executor [*get_executor]]] 79016 [Get the executor associated with the object. ] 79017 ] 79018 79019 [ 79020 [[link boost_asio.reference.basic_stream_socket.get_option [*get_option]]] 79021 [Get an option from the socket. ] 79022 ] 79023 79024 [ 79025 [[link boost_asio.reference.basic_stream_socket.io_control [*io_control]]] 79026 [Perform an IO control command on the socket. ] 79027 ] 79028 79029 [ 79030 [[link boost_asio.reference.basic_stream_socket.is_open [*is_open]]] 79031 [Determine whether the socket is open. ] 79032 ] 79033 79034 [ 79035 [[link boost_asio.reference.basic_stream_socket.local_endpoint [*local_endpoint]]] 79036 [Get the local endpoint of the socket. ] 79037 ] 79038 79039 [ 79040 [[link boost_asio.reference.basic_stream_socket.lowest_layer [*lowest_layer]]] 79041 [Get a reference to the lowest layer. 79042 [hr] 79043 Get a const reference to the lowest layer. ] 79044 ] 79045 79046 [ 79047 [[link boost_asio.reference.basic_stream_socket.native_handle [*native_handle]]] 79048 [Get the native socket representation. ] 79049 ] 79050 79051 [ 79052 [[link boost_asio.reference.basic_stream_socket.native_non_blocking [*native_non_blocking]]] 79053 [Gets the non-blocking mode of the native socket implementation. 79054 [hr] 79055 Sets the non-blocking mode of the native socket implementation. ] 79056 ] 79057 79058 [ 79059 [[link boost_asio.reference.basic_stream_socket.non_blocking [*non_blocking]]] 79060 [Gets the non-blocking mode of the socket. 79061 [hr] 79062 Sets the non-blocking mode of the socket. ] 79063 ] 79064 79065 [ 79066 [[link boost_asio.reference.basic_stream_socket.open [*open]]] 79067 [Open the socket using the specified protocol. ] 79068 ] 79069 79070 [ 79071 [[link boost_asio.reference.basic_stream_socket.operator_eq_ [*operator=]]] 79072 [Move-assign a basic_stream_socket from another. 79073 [hr] 79074 Move-assign a basic_stream_socket from a socket of another protocol type. ] 79075 ] 79076 79077 [ 79078 [[link boost_asio.reference.basic_stream_socket.read_some [*read_some]]] 79079 [Read some data from the socket. ] 79080 ] 79081 79082 [ 79083 [[link boost_asio.reference.basic_stream_socket.receive [*receive]]] 79084 [Receive some data on the socket. 79085 [hr] 79086 Receive some data on a connected socket. ] 79087 ] 79088 79089 [ 79090 [[link boost_asio.reference.basic_stream_socket.release [*release]]] 79091 [Release ownership of the underlying native socket. ] 79092 ] 79093 79094 [ 79095 [[link boost_asio.reference.basic_stream_socket.remote_endpoint [*remote_endpoint]]] 79096 [Get the remote endpoint of the socket. ] 79097 ] 79098 79099 [ 79100 [[link boost_asio.reference.basic_stream_socket.send [*send]]] 79101 [Send some data on the socket. ] 79102 ] 79103 79104 [ 79105 [[link boost_asio.reference.basic_stream_socket.set_option [*set_option]]] 79106 [Set an option on the socket. ] 79107 ] 79108 79109 [ 79110 [[link boost_asio.reference.basic_stream_socket.shutdown [*shutdown]]] 79111 [Disable sends or receives on the socket. ] 79112 ] 79113 79114 [ 79115 [[link boost_asio.reference.basic_stream_socket.wait [*wait]]] 79116 [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 79117 ] 79118 79119 [ 79120 [[link boost_asio.reference.basic_stream_socket.write_some [*write_some]]] 79121 [Write some data to the socket. ] 79122 ] 79123 79124 [ 79125 [[link boost_asio.reference.basic_stream_socket._basic_stream_socket [*~basic_stream_socket]] [destructor]] 79126 [Destroys the socket. ] 79127 ] 79128 79129] 79130 79131[heading Data Members] 79132[table 79133 [[Name][Description]] 79134 79135 [ 79136 [[link boost_asio.reference.basic_stream_socket.max_connections [*max_connections]] [static]] 79137 [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ] 79138 ] 79139 79140 [ 79141 [[link boost_asio.reference.basic_stream_socket.max_listen_connections [*max_listen_connections]] [static]] 79142 [The maximum length of the queue of pending incoming connections. ] 79143 ] 79144 79145 [ 79146 [[link boost_asio.reference.basic_stream_socket.message_do_not_route [*message_do_not_route]] [static]] 79147 [Specify that the data should not be subject to routing. ] 79148 ] 79149 79150 [ 79151 [[link boost_asio.reference.basic_stream_socket.message_end_of_record [*message_end_of_record]] [static]] 79152 [Specifies that the data marks the end of a record. ] 79153 ] 79154 79155 [ 79156 [[link boost_asio.reference.basic_stream_socket.message_out_of_band [*message_out_of_band]] [static]] 79157 [Process out-of-band data. ] 79158 ] 79159 79160 [ 79161 [[link boost_asio.reference.basic_stream_socket.message_peek [*message_peek]] [static]] 79162 [Peek at incoming data without removing it from the input queue. ] 79163 ] 79164 79165] 79166 79167The [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] class template provides asynchronous and blocking stream-oriented socket functionality. 79168 79169 79170[heading Thread Safety] 79171 79172['Distinct] ['objects:] Safe. 79173 79174['Shared] ['objects:] Unsafe. 79175 79176Synchronous `send`, `receive`, and `connect` operations are thread safe with respect to each other, if the underlying operating system calls are also thread safe. This means that it is permitted to perform concurrent calls to these synchronous operations on a single socket object. Other synchronous operations, such as `open` or `close`, are not thread safe. 79177 79178 79179 79180 79181 79182[heading Requirements] 79183 79184['Header: ][^boost/asio/generic/stream_protocol.hpp] 79185 79186['Convenience header: ][^boost/asio.hpp] 79187 79188 79189[endsect] 79190 79191 79192[section:stream_protocol generic::stream_protocol::stream_protocol] 79193 79194[indexterm2 boost_asio.indexterm.generic__stream_protocol.stream_protocol..stream_protocol..generic::stream_protocol] 79195Construct a protocol object for a specific address family and protocol. 79196 79197 79198 ``[link boost_asio.reference.generic__stream_protocol.stream_protocol.overload1 stream_protocol]``( 79199 int address_family, 79200 int socket_protocol); 79201 `` [''''»''' [link boost_asio.reference.generic__stream_protocol.stream_protocol.overload1 more...]]`` 79202 79203 79204Construct a generic protocol object from a specific protocol. 79205 79206 79207 template< 79208 typename ``[link boost_asio.reference.Protocol Protocol]``> 79209 ``[link boost_asio.reference.generic__stream_protocol.stream_protocol.overload2 stream_protocol]``( 79210 const Protocol & source_protocol); 79211 `` [''''»''' [link boost_asio.reference.generic__stream_protocol.stream_protocol.overload2 more...]]`` 79212 79213 79214[section:overload1 generic::stream_protocol::stream_protocol (1 of 2 overloads)] 79215 79216 79217Construct a protocol object for a specific address family and protocol. 79218 79219 79220 stream_protocol( 79221 int address_family, 79222 int socket_protocol); 79223 79224 79225 79226[endsect] 79227 79228 79229 79230[section:overload2 generic::stream_protocol::stream_protocol (2 of 2 overloads)] 79231 79232 79233Construct a generic protocol object from a specific protocol. 79234 79235 79236 template< 79237 typename ``[link boost_asio.reference.Protocol Protocol]``> 79238 stream_protocol( 79239 const Protocol & source_protocol); 79240 79241 79242 79243[heading Exceptions] 79244 79245 79246[variablelist 79247 79248[[@c][bad\_cast Thrown if the source protocol is not stream-oriented. ]] 79249 79250] 79251 79252 79253 79254 79255[endsect] 79256 79257 79258[endsect] 79259 79260 79261[section:type generic::stream_protocol::type] 79262 79263[indexterm2 boost_asio.indexterm.generic__stream_protocol.type..type..generic::stream_protocol] 79264Obtain an identifier for the type of the protocol. 79265 79266 79267 int type() const; 79268 79269 79270 79271[endsect] 79272 79273 79274 79275[endsect] 79276 79277[section:get_associated_allocator get_associated_allocator] 79278 79279[indexterm1 boost_asio.indexterm.get_associated_allocator..get_associated_allocator] 79280Helper function to obtain an object's associated allocator. 79281 79282 template< 79283 typename T> 79284 associated_allocator< T >::type ``[link boost_asio.reference.get_associated_allocator.overload1 get_associated_allocator]``( 79285 const T & t); 79286 `` [''''»''' [link boost_asio.reference.get_associated_allocator.overload1 more...]]`` 79287 79288 template< 79289 typename T, 79290 typename Allocator> 79291 associated_allocator< T, Allocator >::type ``[link boost_asio.reference.get_associated_allocator.overload2 get_associated_allocator]``( 79292 const T & t, 79293 const Allocator & a); 79294 `` [''''»''' [link boost_asio.reference.get_associated_allocator.overload2 more...]]`` 79295 79296[heading Requirements] 79297 79298['Header: ][^boost/asio/associated_allocator.hpp] 79299 79300['Convenience header: ][^boost/asio.hpp] 79301 79302 79303[section:overload1 get_associated_allocator (1 of 2 overloads)] 79304 79305 79306Helper function to obtain an object's associated allocator. 79307 79308 79309 template< 79310 typename T> 79311 associated_allocator< T >::type get_associated_allocator( 79312 const T & t); 79313 79314 79315 79316[heading Return Value] 79317 79318`associated_allocator<T>::get(t)` 79319 79320 79321 79322 79323[endsect] 79324 79325 79326 79327[section:overload2 get_associated_allocator (2 of 2 overloads)] 79328 79329 79330Helper function to obtain an object's associated allocator. 79331 79332 79333 template< 79334 typename T, 79335 typename Allocator> 79336 associated_allocator< T, Allocator >::type get_associated_allocator( 79337 const T & t, 79338 const Allocator & a); 79339 79340 79341 79342[heading Return Value] 79343 79344`associated_allocator<T, Allocator>::get(t, a)` 79345 79346 79347 79348 79349[endsect] 79350 79351 79352[endsect] 79353 79354[section:get_associated_executor get_associated_executor] 79355 79356[indexterm1 boost_asio.indexterm.get_associated_executor..get_associated_executor] 79357Helper function to obtain an object's associated executor. 79358 79359 template< 79360 typename T> 79361 associated_executor< T >::type ``[link boost_asio.reference.get_associated_executor.overload1 get_associated_executor]``( 79362 const T & t); 79363 `` [''''»''' [link boost_asio.reference.get_associated_executor.overload1 more...]]`` 79364 79365 template< 79366 typename T, 79367 typename ``[link boost_asio.reference.Executor1 Executor]``> 79368 associated_executor< T, Executor >::type ``[link boost_asio.reference.get_associated_executor.overload2 get_associated_executor]``( 79369 const T & t, 79370 const Executor & ex, 79371 typename constraint< is_executor< Executor >::value||execution::is_executor< Executor >::value >::type = 0); 79372 `` [''''»''' [link boost_asio.reference.get_associated_executor.overload2 more...]]`` 79373 79374 template< 79375 typename T, 79376 typename ExecutionContext> 79377 associated_executor< T, typename ExecutionContext::executor_type >::type ``[link boost_asio.reference.get_associated_executor.overload3 get_associated_executor]``( 79378 const T & t, 79379 ExecutionContext & ctx, 79380 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 79381 `` [''''»''' [link boost_asio.reference.get_associated_executor.overload3 more...]]`` 79382 79383[heading Requirements] 79384 79385['Header: ][^boost/asio/associated_executor.hpp] 79386 79387['Convenience header: ][^boost/asio.hpp] 79388 79389 79390[section:overload1 get_associated_executor (1 of 3 overloads)] 79391 79392 79393Helper function to obtain an object's associated executor. 79394 79395 79396 template< 79397 typename T> 79398 associated_executor< T >::type get_associated_executor( 79399 const T & t); 79400 79401 79402 79403[heading Return Value] 79404 79405`associated_executor<T>::get(t)` 79406 79407 79408 79409 79410[endsect] 79411 79412 79413 79414[section:overload2 get_associated_executor (2 of 3 overloads)] 79415 79416 79417Helper function to obtain an object's associated executor. 79418 79419 79420 template< 79421 typename T, 79422 typename ``[link boost_asio.reference.Executor1 Executor]``> 79423 associated_executor< T, Executor >::type get_associated_executor( 79424 const T & t, 79425 const Executor & ex, 79426 typename constraint< is_executor< Executor >::value||execution::is_executor< Executor >::value >::type = 0); 79427 79428 79429 79430[heading Return Value] 79431 79432`associated_executor<T, Executor>::get(t, ex)` 79433 79434 79435 79436 79437[endsect] 79438 79439 79440 79441[section:overload3 get_associated_executor (3 of 3 overloads)] 79442 79443 79444Helper function to obtain an object's associated executor. 79445 79446 79447 template< 79448 typename T, 79449 typename ExecutionContext> 79450 associated_executor< T, typename ExecutionContext::executor_type >::type get_associated_executor( 79451 const T & t, 79452 ExecutionContext & ctx, 79453 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 79454 79455 79456 79457[heading Return Value] 79458 79459`associated_executor<T, typename ExecutionContext::executor_type>get(t, ctx.get_executor())` 79460 79461 79462 79463 79464[endsect] 79465 79466 79467[endsect] 79468 79469 79470[section:high_resolution_timer high_resolution_timer] 79471 79472[indexterm1 boost_asio.indexterm.high_resolution_timer..high_resolution_timer] 79473Typedef for a timer based on the high resolution clock. 79474 79475 79476 typedef basic_waitable_timer< chrono::high_resolution_clock > high_resolution_timer; 79477 79478 79479[heading Types] 79480[table 79481 [[Name][Description]] 79482 79483 [ 79484 79485 [[link boost_asio.reference.basic_waitable_timer__rebind_executor [*rebind_executor]]] 79486 [Rebinds the timer type to another executor. ] 79487 79488 ] 79489 79490 [ 79491 79492 [[link boost_asio.reference.basic_waitable_timer.clock_type [*clock_type]]] 79493 [The clock type. ] 79494 79495 ] 79496 79497 [ 79498 79499 [[link boost_asio.reference.basic_waitable_timer.duration [*duration]]] 79500 [The duration type of the clock. ] 79501 79502 ] 79503 79504 [ 79505 79506 [[link boost_asio.reference.basic_waitable_timer.executor_type [*executor_type]]] 79507 [The type of the executor associated with the object. ] 79508 79509 ] 79510 79511 [ 79512 79513 [[link boost_asio.reference.basic_waitable_timer.time_point [*time_point]]] 79514 [The time point type of the clock. ] 79515 79516 ] 79517 79518 [ 79519 79520 [[link boost_asio.reference.basic_waitable_timer.traits_type [*traits_type]]] 79521 [The wait traits type. ] 79522 79523 ] 79524 79525] 79526 79527[heading Member Functions] 79528[table 79529 [[Name][Description]] 79530 79531 [ 79532 [[link boost_asio.reference.basic_waitable_timer.async_wait [*async_wait]]] 79533 [Start an asynchronous wait on the timer. ] 79534 ] 79535 79536 [ 79537 [[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer [*basic_waitable_timer]] [constructor]] 79538 [Constructor. 79539 [hr] 79540 Constructor to set a particular expiry time as an absolute time. 79541 [hr] 79542 Constructor to set a particular expiry time relative to now. 79543 [hr] 79544 Move-construct a basic_waitable_timer from another. ] 79545 ] 79546 79547 [ 79548 [[link boost_asio.reference.basic_waitable_timer.cancel [*cancel]]] 79549 [Cancel any asynchronous operations that are waiting on the timer. 79550 [hr] 79551 (Deprecated: Use non-error_code overload.) Cancel any asynchronous operations that are waiting on the timer. ] 79552 ] 79553 79554 [ 79555 [[link boost_asio.reference.basic_waitable_timer.cancel_one [*cancel_one]]] 79556 [Cancels one asynchronous operation that is waiting on the timer. 79557 [hr] 79558 (Deprecated: Use non-error_code overload.) Cancels one asynchronous operation that is waiting on the timer. ] 79559 ] 79560 79561 [ 79562 [[link boost_asio.reference.basic_waitable_timer.expires_after [*expires_after]]] 79563 [Set the timer's expiry time relative to now. ] 79564 ] 79565 79566 [ 79567 [[link boost_asio.reference.basic_waitable_timer.expires_at [*expires_at]]] 79568 [(Deprecated: Use expiry().) Get the timer's expiry time as an absolute time. 79569 [hr] 79570 Set the timer's expiry time as an absolute time. 79571 [hr] 79572 (Deprecated: Use non-error_code overload.) Set the timer's expiry time as an absolute time. ] 79573 ] 79574 79575 [ 79576 [[link boost_asio.reference.basic_waitable_timer.expires_from_now [*expires_from_now]]] 79577 [(Deprecated: Use expiry().) Get the timer's expiry time relative to now. 79578 [hr] 79579 (Deprecated: Use expires_after().) Set the timer's expiry time relative to now. ] 79580 ] 79581 79582 [ 79583 [[link boost_asio.reference.basic_waitable_timer.expiry [*expiry]]] 79584 [Get the timer's expiry time as an absolute time. ] 79585 ] 79586 79587 [ 79588 [[link boost_asio.reference.basic_waitable_timer.get_executor [*get_executor]]] 79589 [Get the executor associated with the object. ] 79590 ] 79591 79592 [ 79593 [[link boost_asio.reference.basic_waitable_timer.operator_eq_ [*operator=]]] 79594 [Move-assign a basic_waitable_timer from another. ] 79595 ] 79596 79597 [ 79598 [[link boost_asio.reference.basic_waitable_timer.wait [*wait]]] 79599 [Perform a blocking wait on the timer. ] 79600 ] 79601 79602 [ 79603 [[link boost_asio.reference.basic_waitable_timer._basic_waitable_timer [*~basic_waitable_timer]] [destructor]] 79604 [Destroys the timer. ] 79605 ] 79606 79607] 79608 79609The [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. 79610 79611A 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. 79612 79613Most 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. 79614 79615 79616[heading Remarks] 79617 79618This waitable timer functionality is for use with the C++11 standard library's `<chrono>` facility, or with the Boost.Chrono library. 79619 79620 79621[heading Thread Safety] 79622 79623['Distinct] ['objects:] Safe. 79624 79625['Shared] ['objects:] Unsafe. 79626 79627 79628[heading Examples] 79629 79630Performing a blocking wait (C++11): 79631 79632 // Construct a timer without setting an expiry time. 79633 boost::asio::steady_timer timer(my_context); 79634 79635 // Set an expiry time relative to now. 79636 timer.expires_after(std::chrono::seconds(5)); 79637 79638 // Wait for the timer to expire. 79639 timer.wait(); 79640 79641 79642 79643 79644 79645Performing an asynchronous wait (C++11): 79646 79647 void handler(const boost::system::error_code& error) 79648 { 79649 if (!error) 79650 { 79651 // Timer expired. 79652 } 79653 } 79654 79655 ... 79656 79657 // Construct a timer with an absolute expiry time. 79658 boost::asio::steady_timer timer(my_context, 79659 std::chrono::steady_clock::now() + std::chrono::seconds(60)); 79660 79661 // Start an asynchronous wait. 79662 timer.async_wait(handler); 79663 79664 79665 79666 79667 79668[heading Changing an active waitable timer's expiry time] 79669 79670 79671 79672Changing 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: 79673 79674 79675 79676 void on_some_event() 79677 { 79678 if (my_timer.expires_after(seconds(5)) > 0) 79679 { 79680 // We managed to cancel the timer. Start new asynchronous wait. 79681 my_timer.async_wait(on_timeout); 79682 } 79683 else 79684 { 79685 // Too late, timer has already expired! 79686 } 79687 } 79688 79689 void on_timeout(const boost::system::error_code& e) 79690 { 79691 if (e != boost::asio::error::operation_aborted) 79692 { 79693 // Timer was not cancelled, take necessary action. 79694 } 79695 } 79696 79697 79698 79699 79700 79701* 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. 79702 79703 79704* If a wait handler is cancelled, the boost::system::error\_code passed to it contains the value `boost::asio::error::operation_aborted`. 79705 79706 79707 79708 79709This 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: 79710 79711 typedef basic_waitable_timer<boost::chrono::high_resolution_clock> timer; 79712 79713 79714 79715 79716[heading Requirements] 79717 79718['Header: ][^boost/asio/high_resolution_timer.hpp] 79719 79720['Convenience header: ][^boost/asio.hpp] 79721 79722 79723[endsect] 79724 79725 79726[section:invalid_service_owner invalid_service_owner] 79727 79728[indexterm1 boost_asio.indexterm.invalid_service_owner..invalid_service_owner] 79729 79730 79731Exception 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. 79732 79733 79734 class invalid_service_owner 79735 79736 79737[heading Member Functions] 79738[table 79739 [[Name][Description]] 79740 79741 [ 79742 [[link boost_asio.reference.invalid_service_owner.invalid_service_owner [*invalid_service_owner]] [constructor]] 79743 [] 79744 ] 79745 79746] 79747 79748[heading Requirements] 79749 79750['Header: ][^boost/asio/execution_context.hpp] 79751 79752['Convenience header: ][^boost/asio/execution.hpp] 79753 79754 79755[section:invalid_service_owner invalid_service_owner::invalid_service_owner] 79756 79757[indexterm2 boost_asio.indexterm.invalid_service_owner.invalid_service_owner..invalid_service_owner..invalid_service_owner] 79758 79759 invalid_service_owner(); 79760 79761 79762 79763[endsect] 79764 79765 79766 79767[endsect] 79768 79769[section:io_context io_context] 79770 79771[indexterm1 boost_asio.indexterm.io_context..io_context] 79772 79773 79774Provides core I/O functionality. 79775 79776 79777 class io_context : 79778 public execution_context 79779 79780 79781[heading Types] 79782[table 79783 [[Name][Description]] 79784 79785 [ 79786 79787 [[link boost_asio.reference.io_context__basic_executor_type [*basic_executor_type]]] 79788 [Executor implementation type used to submit functions to an io_context. ] 79789 79790 ] 79791 79792 [ 79793 79794 [[link boost_asio.reference.io_context__service [*service]]] 79795 [Base class for all io_context services. ] 79796 79797 ] 79798 79799 [ 79800 79801 [[link boost_asio.reference.io_context__strand [*strand]]] 79802 [Provides serialised handler execution. ] 79803 79804 ] 79805 79806 [ 79807 79808 [[link boost_asio.reference.io_context__work [*work]]] 79809 [(Deprecated: Use executor_work_guard.) Class to inform the io_context when it has work to do. ] 79810 79811 ] 79812 79813 [ 79814 79815 [[link boost_asio.reference.io_context.count_type [*count_type]]] 79816 [The type used to count the number of handlers executed by the context. ] 79817 79818 ] 79819 79820 [ 79821 79822 [[link boost_asio.reference.io_context.executor_type [*executor_type]]] 79823 [Executor used to submit functions to an io_context. ] 79824 79825 ] 79826 79827 [ 79828 79829 [[link boost_asio.reference.io_context.fork_event [*fork_event]]] 79830 [Fork-related event notifications. ] 79831 79832 ] 79833 79834] 79835 79836[heading Member Functions] 79837[table 79838 [[Name][Description]] 79839 79840 [ 79841 [[link boost_asio.reference.io_context.dispatch [*dispatch]]] 79842 [(Deprecated: Use boost::asio::dispatch().) Request the io_context to invoke the given handler. ] 79843 ] 79844 79845 [ 79846 [[link boost_asio.reference.io_context.get_executor [*get_executor]]] 79847 [Obtains the executor associated with the io_context. ] 79848 ] 79849 79850 [ 79851 [[link boost_asio.reference.io_context.io_context [*io_context]] [constructor]] 79852 [Constructor. ] 79853 ] 79854 79855 [ 79856 [[link boost_asio.reference.io_context.notify_fork [*notify_fork]]] 79857 [Notify the execution_context of a fork-related event. ] 79858 ] 79859 79860 [ 79861 [[link boost_asio.reference.io_context.poll [*poll]]] 79862 [Run the io_context object's event processing loop to execute ready handlers. 79863 [hr] 79864 (Deprecated: Use non-error_code overload.) Run the io_context object's event processing loop to execute ready handlers. ] 79865 ] 79866 79867 [ 79868 [[link boost_asio.reference.io_context.poll_one [*poll_one]]] 79869 [Run the io_context object's event processing loop to execute one ready handler. 79870 [hr] 79871 (Deprecated: Use non-error_code overload.) Run the io_context object's event processing loop to execute one ready handler. ] 79872 ] 79873 79874 [ 79875 [[link boost_asio.reference.io_context.post [*post]]] 79876 [(Deprecated: Use boost::asio::post().) Request the io_context to invoke the given handler and return immediately. ] 79877 ] 79878 79879 [ 79880 [[link boost_asio.reference.io_context.reset [*reset]]] 79881 [(Deprecated: Use restart().) Reset the io_context in preparation for a subsequent run() invocation. ] 79882 ] 79883 79884 [ 79885 [[link boost_asio.reference.io_context.restart [*restart]]] 79886 [Restart the io_context in preparation for a subsequent run() invocation. ] 79887 ] 79888 79889 [ 79890 [[link boost_asio.reference.io_context.run [*run]]] 79891 [Run the io_context object's event processing loop. 79892 [hr] 79893 (Deprecated: Use non-error_code overload.) Run the io_context object's event processing loop. ] 79894 ] 79895 79896 [ 79897 [[link boost_asio.reference.io_context.run_for [*run_for]]] 79898 [Run the io_context object's event processing loop for a specified duration. ] 79899 ] 79900 79901 [ 79902 [[link boost_asio.reference.io_context.run_one [*run_one]]] 79903 [Run the io_context object's event processing loop to execute at most one handler. 79904 [hr] 79905 (Deprecated: Use non-error_code overlaod.) Run the io_context object's event processing loop to execute at most one handler. ] 79906 ] 79907 79908 [ 79909 [[link boost_asio.reference.io_context.run_one_for [*run_one_for]]] 79910 [Run the io_context object's event processing loop for a specified duration to execute at most one handler. ] 79911 ] 79912 79913 [ 79914 [[link boost_asio.reference.io_context.run_one_until [*run_one_until]]] 79915 [Run the io_context object's event processing loop until a specified time to execute at most one handler. ] 79916 ] 79917 79918 [ 79919 [[link boost_asio.reference.io_context.run_until [*run_until]]] 79920 [Run the io_context object's event processing loop until a specified time. ] 79921 ] 79922 79923 [ 79924 [[link boost_asio.reference.io_context.stop [*stop]]] 79925 [Stop the io_context object's event processing loop. ] 79926 ] 79927 79928 [ 79929 [[link boost_asio.reference.io_context.stopped [*stopped]]] 79930 [Determine whether the io_context object has been stopped. ] 79931 ] 79932 79933 [ 79934 [[link boost_asio.reference.io_context.wrap [*wrap]]] 79935 [(Deprecated: Use boost::asio::bind_executor().) Create a new handler that automatically dispatches the wrapped handler on the io_context. ] 79936 ] 79937 79938 [ 79939 [[link boost_asio.reference.io_context._io_context [*~io_context]] [destructor]] 79940 [Destructor. ] 79941 ] 79942 79943] 79944 79945[heading Protected Member Functions] 79946[table 79947 [[Name][Description]] 79948 79949 [ 79950 [[link boost_asio.reference.io_context.destroy [*destroy]]] 79951 [Destroys all services in the context. ] 79952 ] 79953 79954 [ 79955 [[link boost_asio.reference.io_context.shutdown [*shutdown]]] 79956 [Shuts down all services in the context. ] 79957 ] 79958 79959] 79960 79961[heading Friends] 79962[table 79963 [[Name][Description]] 79964 79965 [ 79966 [[link boost_asio.reference.io_context.add_service [*add_service]]] 79967 [(Deprecated: Use make_service().) Add a service object to the execution_context. ] 79968 ] 79969 79970 [ 79971 [[link boost_asio.reference.io_context.has_service [*has_service]]] 79972 [Determine if an execution_context contains a specified service type. ] 79973 ] 79974 79975 [ 79976 [[link boost_asio.reference.io_context.make_service [*make_service]]] 79977 [Creates a service object and adds it to the execution_context. ] 79978 ] 79979 79980 [ 79981 [[link boost_asio.reference.io_context.use_service [*use_service]]] 79982 [ 79983 [hr] 79984 Obtain the service object corresponding to the given type. ] 79985 ] 79986 79987] 79988 79989The [link boost_asio.reference.io_context `io_context`] class provides the core I/O functionality for users of the asynchronous I/O objects, including: 79990 79991 79992* `boost::asio::ip::tcp::socket` 79993 79994* `boost::asio::ip::tcp::acceptor` 79995 79996* `boost::asio::ip::udp::socket` 79997 79998* [link boost_asio.reference.deadline_timer `deadline_timer`]. 79999 80000The [link boost_asio.reference.io_context `io_context`] class also includes facilities intended for developers of custom asynchronous services. 80001 80002 80003[heading Thread Safety] 80004 80005['Distinct] ['objects:] Safe. 80006 80007['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. 80008 80009 80010 80011[heading Synchronous and asynchronous operations] 80012 80013 80014 80015Synchronous 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`]. 80016 80017 80018[heading Effect of exceptions thrown from handlers] 80019 80020 80021 80022If 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. 80023 80024After 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. 80025 80026For example: 80027 80028 80029 80030 boost::asio::io_context io_context; 80031 ... 80032 for (;;) 80033 { 80034 try 80035 { 80036 io_context.run(); 80037 break; // run() exited normally 80038 } 80039 catch (my_exception& e) 80040 { 80041 // Deal with exception as appropriate. 80042 } 80043 } 80044 80045 80046 80047 80048 80049[heading Submitting arbitrary tasks to the io_context] 80050 80051 80052 80053To 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. 80054 80055For example: 80056 80057 80058 80059 void my_task() 80060 { 80061 ... 80062 } 80063 80064 ... 80065 80066 boost::asio::io_context io_context; 80067 80068 // Submit a function to the io_context. 80069 boost::asio::post(io_context, my_task); 80070 80071 // Submit a lambda object to the io_context. 80072 boost::asio::post(io_context, 80073 []() 80074 { 80075 ... 80076 }); 80077 80078 // Run the io_context until it runs out of work. 80079 io_context.run(); 80080 80081 80082 80083 80084 80085[heading Stopping the io_context from running out of work] 80086 80087 80088 80089Some 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 executor that tracks work against the [link boost_asio.reference.io_context `io_context`]: 80090 80091 80092 80093 boost::asio::io_context io_context; 80094 auto work = boost::asio::require(io_context.get_executor(), 80095 boost::asio::execution::outstanding_work.tracked); 80096 ... 80097 80098 80099 80100 80101If using C++03, which lacks automatic variable type deduction, you may compute the return type of the require call: 80102 80103 80104 80105 boost::asio::io_context io_context; 80106 typename boost::asio::require_result< 80107 boost::asio::io_context::executor_type, 80108 boost::asio::exeution::outstanding_work_t::tracked_t> 80109 work = boost::asio::require(io_context.get_executor(), 80110 boost::asio::execution::outstanding_work.tracked); 80111 ... 80112 80113 80114 80115 80116or store the result in the type-erasing executor wrapper, [link boost_asio.reference.any_io_executor `any_io_executor`]: 80117 80118 80119 80120 boost::asio::io_context io_context; 80121 boost::asio::any_io_executor work 80122 = boost::asio::require(io_context.get_executor(), 80123 boost::asio::execution::outstanding_work.tracked); 80124 ... 80125 80126 80127 80128 80129To 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. 80130 80131Alternatively, if the application requires that all operations and handlers be allowed to finish normally, store the work-tracking executor in an [link boost_asio.reference.any_io_executor `any_io_executor`] object, so that it may be explicitly reset. 80132 80133 80134 80135 boost::asio::io_context io_context; 80136 boost::asio::any_io_executor work 80137 = boost::asio::require(io_context.get_executor(), 80138 boost::asio::execution::outstanding_work.tracked); 80139 ... 80140 work = boost::asio::any_io_executor(); // Allow run() to exit. 80141 80142 80143 80144 80145[heading Requirements] 80146 80147['Header: ][^boost/asio/io_context.hpp] 80148 80149['Convenience header: ][^boost/asio.hpp] 80150 80151 80152[section:add_service io_context::add_service] 80153 80154 80155['Inherited from execution_context.] 80156 80157[indexterm2 boost_asio.indexterm.io_context.add_service..add_service..io_context] 80158(Deprecated: Use `make_service()`.) Add a service object to the [link boost_asio.reference.execution_context `execution_context`]. 80159 80160 80161 template< 80162 typename ``[link boost_asio.reference.Service Service]``> 80163 friend void add_service( 80164 execution_context & e, 80165 Service * svc); 80166 80167 80168This function is used to add a service to the [link boost_asio.reference.execution_context `execution_context`]. 80169 80170 80171[heading Parameters] 80172 80173 80174[variablelist 80175 80176[[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]] 80177 80178[[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: 80179`` 80180 delete static_cast<execution_context::service*>(svc) 80181`` 80182]] 80183 80184] 80185 80186 80187[heading Exceptions] 80188 80189 80190[variablelist 80191 80192[[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`].]] 80193 80194[[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. ]] 80195 80196] 80197 80198 80199 80200[heading Requirements] 80201 80202['Header: ][^boost/asio/io_context.hpp] 80203 80204['Convenience header: ][^boost/asio.hpp] 80205 80206 80207[endsect] 80208 80209 80210 80211[section:count_type io_context::count_type] 80212 80213[indexterm2 boost_asio.indexterm.io_context.count_type..count_type..io_context] 80214The type used to count the number of handlers executed by the context. 80215 80216 80217 typedef std::size_t count_type; 80218 80219 80220 80221[heading Requirements] 80222 80223['Header: ][^boost/asio/io_context.hpp] 80224 80225['Convenience header: ][^boost/asio.hpp] 80226 80227 80228[endsect] 80229 80230 80231 80232[section:destroy io_context::destroy] 80233 80234 80235['Inherited from execution_context.] 80236 80237[indexterm2 boost_asio.indexterm.io_context.destroy..destroy..io_context] 80238Destroys all services in the context. 80239 80240 80241 void destroy(); 80242 80243 80244This function is implemented as follows: 80245 80246 80247* 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)`. 80248 80249 80250 80251 80252[endsect] 80253 80254 80255 80256[section:dispatch io_context::dispatch] 80257 80258[indexterm2 boost_asio.indexterm.io_context.dispatch..dispatch..io_context] 80259(Deprecated: Use [link boost_asio.reference.dispatch `dispatch`].) Request the [link boost_asio.reference.io_context `io_context`] to invoke the given handler. 80260 80261 80262 template< 80263 typename ``[link boost_asio.reference.LegacyCompletionHandler LegacyCompletionHandler]``> 80264 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` dispatch( 80265 LegacyCompletionHandler && handler); 80266 80267 80268This function is used to ask the [link boost_asio.reference.io_context `io_context`] to execute the given handler. 80269 80270The [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. 80271 80272 80273[heading Parameters] 80274 80275 80276[variablelist 80277 80278[[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: 80279`` 80280 void handler(); 80281`` 80282]] 80283 80284] 80285 80286 80287[heading Remarks] 80288 80289This function throws an exception only if: 80290 80291 80292* the handler's `asio_handler_allocate` function; or 80293 80294 80295* the handler's copy constructor 80296 80297throws an exception. 80298 80299 80300[endsect] 80301 80302 80303 80304[section:executor_type io_context::executor_type] 80305 80306[indexterm2 boost_asio.indexterm.io_context.executor_type..executor_type..io_context] 80307Executor used to submit functions to an [link boost_asio.reference.io_context `io_context`]. 80308 80309 80310 typedef basic_executor_type< std::allocator< void >, 0 > executor_type; 80311 80312 80313[heading Member Functions] 80314[table 80315 [[Name][Description]] 80316 80317 [ 80318 [[link boost_asio.reference.io_context__basic_executor_type.basic_executor_type [*basic_executor_type]] [constructor]] 80319 [Copy constructor. 80320 [hr] 80321 Move constructor. ] 80322 ] 80323 80324 [ 80325 [[link boost_asio.reference.io_context__basic_executor_type.context [*context]]] 80326 [Obtain the underlying execution context. ] 80327 ] 80328 80329 [ 80330 [[link boost_asio.reference.io_context__basic_executor_type.defer [*defer]]] 80331 [Request the io_context to invoke the given function object. ] 80332 ] 80333 80334 [ 80335 [[link boost_asio.reference.io_context__basic_executor_type.dispatch [*dispatch]]] 80336 [Request the io_context to invoke the given function object. ] 80337 ] 80338 80339 [ 80340 [[link boost_asio.reference.io_context__basic_executor_type.execute [*execute]]] 80341 [Execution function. ] 80342 ] 80343 80344 [ 80345 [[link boost_asio.reference.io_context__basic_executor_type.on_work_finished [*on_work_finished]]] 80346 [Inform the io_context that some work is no longer outstanding. ] 80347 ] 80348 80349 [ 80350 [[link boost_asio.reference.io_context__basic_executor_type.on_work_started [*on_work_started]]] 80351 [Inform the io_context that it has some outstanding work to do. ] 80352 ] 80353 80354 [ 80355 [[link boost_asio.reference.io_context__basic_executor_type.operator_eq_ [*operator=]]] 80356 [Assignment operator. 80357 [hr] 80358 Move assignment operator. ] 80359 ] 80360 80361 [ 80362 [[link boost_asio.reference.io_context__basic_executor_type.post [*post]]] 80363 [Request the io_context to invoke the given function object. ] 80364 ] 80365 80366 [ 80367 [[link boost_asio.reference.io_context__basic_executor_type.query [*query]]] 80368 [Query the current value of the context property. 80369 [hr] 80370 Query the current value of the blocking property. 80371 [hr] 80372 Query the current value of the relationship property. 80373 [hr] 80374 Query the current value of the allocator property. ] 80375 ] 80376 80377 [ 80378 [[link boost_asio.reference.io_context__basic_executor_type.query__static [*query]] [static]] 80379 [Query the current value of the mapping property. 80380 [hr] 80381 Query the current value of the outstanding_work property. ] 80382 ] 80383 80384 [ 80385 [[link boost_asio.reference.io_context__basic_executor_type.require [*require]]] 80386 [Obtain an executor with the blocking.possibly property. 80387 [hr] 80388 Obtain an executor with the blocking.never property. 80389 [hr] 80390 Obtain an executor with the relationship.fork property. 80391 [hr] 80392 Obtain an executor with the relationship.continuation property. 80393 [hr] 80394 Obtain an executor with the outstanding_work.tracked property. 80395 [hr] 80396 Obtain an executor with the outstanding_work.untracked property. 80397 [hr] 80398 Obtain an executor with the specified allocator property. 80399 [hr] 80400 Obtain an executor with the default allocator property. ] 80401 ] 80402 80403 [ 80404 [[link boost_asio.reference.io_context__basic_executor_type.running_in_this_thread [*running_in_this_thread]]] 80405 [Determine whether the io_context is running in the current thread. ] 80406 ] 80407 80408 [ 80409 [[link boost_asio.reference.io_context__basic_executor_type._basic_executor_type [*~basic_executor_type]] [destructor]] 80410 [Destructor. ] 80411 ] 80412 80413] 80414 80415[heading Friends] 80416[table 80417 [[Name][Description]] 80418 80419 [ 80420 [[link boost_asio.reference.io_context__basic_executor_type.operator_not__eq_ [*operator!=]]] 80421 [Compare two executors for inequality. ] 80422 ] 80423 80424 [ 80425 [[link boost_asio.reference.io_context__basic_executor_type.operator_eq__eq_ [*operator==]]] 80426 [Compare two executors for equality. ] 80427 ] 80428 80429] 80430 80431 80432[heading Requirements] 80433 80434['Header: ][^boost/asio/io_context.hpp] 80435 80436['Convenience header: ][^boost/asio.hpp] 80437 80438 80439[endsect] 80440 80441 80442 80443[section:fork_event io_context::fork_event] 80444 80445 80446['Inherited from execution_context.] 80447 80448[indexterm2 boost_asio.indexterm.io_context.fork_event..fork_event..io_context] 80449Fork-related event notifications. 80450 80451 80452 enum fork_event 80453 80454[indexterm2 boost_asio.indexterm.io_context.fork_event.fork_prepare..fork_prepare..io_context] 80455[indexterm2 boost_asio.indexterm.io_context.fork_event.fork_parent..fork_parent..io_context] 80456[indexterm2 boost_asio.indexterm.io_context.fork_event.fork_child..fork_child..io_context] 80457 80458[heading Values] 80459[variablelist 80460 80461 [ 80462 [fork_prepare] 80463 [Notify the context that the process is about to fork. ] 80464 ] 80465 80466 [ 80467 [fork_parent] 80468 [Notify the context that the process has forked and is the parent. ] 80469 ] 80470 80471 [ 80472 [fork_child] 80473 [Notify the context that the process has forked and is the child. ] 80474 ] 80475 80476] 80477 80478 80479 80480[endsect] 80481 80482 80483 80484[section:get_executor io_context::get_executor] 80485 80486[indexterm2 boost_asio.indexterm.io_context.get_executor..get_executor..io_context] 80487Obtains the executor associated with the [link boost_asio.reference.io_context `io_context`]. 80488 80489 80490 executor_type get_executor(); 80491 80492 80493 80494[endsect] 80495 80496 80497 80498[section:has_service io_context::has_service] 80499 80500 80501['Inherited from execution_context.] 80502 80503[indexterm2 boost_asio.indexterm.io_context.has_service..has_service..io_context] 80504Determine if an [link boost_asio.reference.execution_context `execution_context`] contains a specified service type. 80505 80506 80507 template< 80508 typename ``[link boost_asio.reference.Service Service]``> 80509 friend bool has_service( 80510 execution_context & e); 80511 80512 80513This 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. 80514 80515 80516[heading Parameters] 80517 80518 80519[variablelist 80520 80521[[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]] 80522 80523] 80524 80525 80526[heading Return Value] 80527 80528A boolean indicating whether the [link boost_asio.reference.execution_context `execution_context`] contains the service. 80529 80530 80531 80532[heading Requirements] 80533 80534['Header: ][^boost/asio/io_context.hpp] 80535 80536['Convenience header: ][^boost/asio.hpp] 80537 80538 80539[endsect] 80540 80541 80542[section:io_context io_context::io_context] 80543 80544[indexterm2 boost_asio.indexterm.io_context.io_context..io_context..io_context] 80545Constructor. 80546 80547 80548 ``[link boost_asio.reference.io_context.io_context.overload1 io_context]``(); 80549 `` [''''»''' [link boost_asio.reference.io_context.io_context.overload1 more...]]`` 80550 80551 explicit ``[link boost_asio.reference.io_context.io_context.overload2 io_context]``( 80552 int concurrency_hint); 80553 `` [''''»''' [link boost_asio.reference.io_context.io_context.overload2 more...]]`` 80554 80555 80556[section:overload1 io_context::io_context (1 of 2 overloads)] 80557 80558 80559Constructor. 80560 80561 80562 io_context(); 80563 80564 80565 80566[endsect] 80567 80568 80569 80570[section:overload2 io_context::io_context (2 of 2 overloads)] 80571 80572 80573Constructor. 80574 80575 80576 io_context( 80577 int concurrency_hint); 80578 80579 80580Construct with a hint about the required level of concurrency. 80581 80582 80583[heading Parameters] 80584 80585 80586[variablelist 80587 80588[[concurrency_hint][A suggestion to the implementation on how many threads it should allow to run simultaneously. ]] 80589 80590] 80591 80592 80593 80594 80595[endsect] 80596 80597 80598[endsect] 80599 80600 80601[section:make_service io_context::make_service] 80602 80603 80604['Inherited from execution_context.] 80605 80606[indexterm2 boost_asio.indexterm.io_context.make_service..make_service..io_context] 80607Creates a service object and adds it to the [link boost_asio.reference.execution_context `execution_context`]. 80608 80609 80610 template< 80611 typename ``[link boost_asio.reference.Service Service]``, 80612 typename... Args> 80613 friend Service & make_service( 80614 execution_context & e, 80615 Args &&... args); 80616 80617 80618This function is used to add a service to the [link boost_asio.reference.execution_context `execution_context`]. 80619 80620 80621[heading Parameters] 80622 80623 80624[variablelist 80625 80626[[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]] 80627 80628[[args][Zero or more arguments to be passed to the service constructor.]] 80629 80630] 80631 80632 80633[heading Exceptions] 80634 80635 80636[variablelist 80637 80638[[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`]. ]] 80639 80640] 80641 80642 80643 80644[heading Requirements] 80645 80646['Header: ][^boost/asio/io_context.hpp] 80647 80648['Convenience header: ][^boost/asio.hpp] 80649 80650 80651[endsect] 80652 80653 80654 80655[section:notify_fork io_context::notify_fork] 80656 80657 80658['Inherited from execution_context.] 80659 80660[indexterm2 boost_asio.indexterm.io_context.notify_fork..notify_fork..io_context] 80661Notify the [link boost_asio.reference.execution_context `execution_context`] of a fork-related event. 80662 80663 80664 void notify_fork( 80665 fork_event event); 80666 80667 80668This 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. 80669 80670This 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. 80671 80672 80673[heading Parameters] 80674 80675 80676[variablelist 80677 80678[[event][A fork-related event.]] 80679 80680] 80681 80682 80683[heading Exceptions] 80684 80685 80686[variablelist 80687 80688[[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.]] 80689 80690] 80691 80692 80693[heading Example] 80694 80695The following code illustrates how to incorporate the `notify_fork()` function: 80696 80697 my_execution_context.notify_fork(execution_context::fork_prepare); 80698 if (fork() == 0) 80699 { 80700 // This is the child process. 80701 my_execution_context.notify_fork(execution_context::fork_child); 80702 } 80703 else 80704 { 80705 // This is the parent process. 80706 my_execution_context.notify_fork(execution_context::fork_parent); 80707 } 80708 80709 80710 80711 80712 80713[heading Remarks] 80714 80715For 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. 80716 80717 80718 80719 80720[endsect] 80721 80722 80723[section:poll io_context::poll] 80724 80725[indexterm2 boost_asio.indexterm.io_context.poll..poll..io_context] 80726Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop to execute ready handlers. 80727 80728 80729 count_type ``[link boost_asio.reference.io_context.poll.overload1 poll]``(); 80730 `` [''''»''' [link boost_asio.reference.io_context.poll.overload1 more...]]`` 80731 80732 80733(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. 80734 80735 80736 count_type ``[link boost_asio.reference.io_context.poll.overload2 poll]``( 80737 boost::system::error_code & ec); 80738 `` [''''»''' [link boost_asio.reference.io_context.poll.overload2 more...]]`` 80739 80740 80741[section:overload1 io_context::poll (1 of 2 overloads)] 80742 80743 80744Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop to execute ready handlers. 80745 80746 80747 count_type poll(); 80748 80749 80750The `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. 80751 80752 80753[heading Return Value] 80754 80755The number of handlers that were executed. 80756 80757 80758 80759 80760[endsect] 80761 80762 80763 80764[section:overload2 io_context::poll (2 of 2 overloads)] 80765 80766 80767(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. 80768 80769 80770 count_type poll( 80771 boost::system::error_code & ec); 80772 80773 80774The `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. 80775 80776 80777[heading Parameters] 80778 80779 80780[variablelist 80781 80782[[ec][Set to indicate what error occurred, if any.]] 80783 80784] 80785 80786 80787[heading Return Value] 80788 80789The number of handlers that were executed. 80790 80791 80792 80793 80794[endsect] 80795 80796 80797[endsect] 80798 80799[section:poll_one io_context::poll_one] 80800 80801[indexterm2 boost_asio.indexterm.io_context.poll_one..poll_one..io_context] 80802Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop to execute one ready handler. 80803 80804 80805 count_type ``[link boost_asio.reference.io_context.poll_one.overload1 poll_one]``(); 80806 `` [''''»''' [link boost_asio.reference.io_context.poll_one.overload1 more...]]`` 80807 80808 80809(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. 80810 80811 80812 count_type ``[link boost_asio.reference.io_context.poll_one.overload2 poll_one]``( 80813 boost::system::error_code & ec); 80814 `` [''''»''' [link boost_asio.reference.io_context.poll_one.overload2 more...]]`` 80815 80816 80817[section:overload1 io_context::poll_one (1 of 2 overloads)] 80818 80819 80820Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop to execute one ready handler. 80821 80822 80823 count_type poll_one(); 80824 80825 80826The `poll_one()` function runs at most one handler that is ready to run, without blocking. 80827 80828 80829[heading Return Value] 80830 80831The number of handlers that were executed. 80832 80833 80834 80835 80836[endsect] 80837 80838 80839 80840[section:overload2 io_context::poll_one (2 of 2 overloads)] 80841 80842 80843(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. 80844 80845 80846 count_type poll_one( 80847 boost::system::error_code & ec); 80848 80849 80850The `poll_one()` function runs at most one handler that is ready to run, without blocking. 80851 80852 80853[heading Parameters] 80854 80855 80856[variablelist 80857 80858[[ec][Set to indicate what error occurred, if any.]] 80859 80860] 80861 80862 80863[heading Return Value] 80864 80865The number of handlers that were executed. 80866 80867 80868 80869 80870[endsect] 80871 80872 80873[endsect] 80874 80875 80876[section:post io_context::post] 80877 80878[indexterm2 boost_asio.indexterm.io_context.post..post..io_context] 80879(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. 80880 80881 80882 template< 80883 typename ``[link boost_asio.reference.LegacyCompletionHandler LegacyCompletionHandler]``> 80884 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` post( 80885 LegacyCompletionHandler && handler); 80886 80887 80888This 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. 80889 80890The [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. 80891 80892 80893[heading Parameters] 80894 80895 80896[variablelist 80897 80898[[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: 80899`` 80900 void handler(); 80901`` 80902]] 80903 80904] 80905 80906 80907[heading Remarks] 80908 80909This function throws an exception only if: 80910 80911 80912* the handler's `asio_handler_allocate` function; or 80913 80914 80915* the handler's copy constructor 80916 80917throws an exception. 80918 80919 80920[endsect] 80921 80922 80923 80924[section:reset io_context::reset] 80925 80926[indexterm2 boost_asio.indexterm.io_context.reset..reset..io_context] 80927(Deprecated: Use `restart()`.) Reset the [link boost_asio.reference.io_context `io_context`] in preparation for a subsequent `run()` invocation. 80928 80929 80930 void reset(); 80931 80932 80933This 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`. 80934 80935This function must not be called while there are any unfinished calls to the `run()`, `run_one()`, `poll()` or `poll_one()` functions. 80936 80937 80938[endsect] 80939 80940 80941 80942[section:restart io_context::restart] 80943 80944[indexterm2 boost_asio.indexterm.io_context.restart..restart..io_context] 80945Restart the [link boost_asio.reference.io_context `io_context`] in preparation for a subsequent `run()` invocation. 80946 80947 80948 void restart(); 80949 80950 80951This 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`. 80952 80953This function must not be called while there are any unfinished calls to the `run()`, `run_one()`, `poll()` or `poll_one()` functions. 80954 80955 80956[endsect] 80957 80958 80959[section:run io_context::run] 80960 80961[indexterm2 boost_asio.indexterm.io_context.run..run..io_context] 80962Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop. 80963 80964 80965 count_type ``[link boost_asio.reference.io_context.run.overload1 run]``(); 80966 `` [''''»''' [link boost_asio.reference.io_context.run.overload1 more...]]`` 80967 80968 80969(Deprecated: Use non-error\_code overload.) Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop. 80970 80971 80972 count_type ``[link boost_asio.reference.io_context.run.overload2 run]``( 80973 boost::system::error_code & ec); 80974 `` [''''»''' [link boost_asio.reference.io_context.run.overload2 more...]]`` 80975 80976 80977[section:overload1 io_context::run (1 of 2 overloads)] 80978 80979 80980Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop. 80981 80982 80983 count_type run(); 80984 80985 80986The `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. 80987 80988Multiple 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. 80989 80990A 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()`. 80991 80992 80993[heading Return Value] 80994 80995The number of handlers that were executed. 80996 80997 80998[heading Remarks] 80999 81000Calling 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. 81001 81002The `poll()` function may also be used to dispatch ready handlers, but without blocking. 81003 81004 81005[endsect] 81006 81007 81008 81009[section:overload2 io_context::run (2 of 2 overloads)] 81010 81011 81012(Deprecated: Use non-error\_code overload.) Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop. 81013 81014 81015 count_type run( 81016 boost::system::error_code & ec); 81017 81018 81019The `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. 81020 81021Multiple 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. 81022 81023A 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()`. 81024 81025 81026[heading Parameters] 81027 81028 81029[variablelist 81030 81031[[ec][Set to indicate what error occurred, if any.]] 81032 81033] 81034 81035 81036[heading Return Value] 81037 81038The number of handlers that were executed. 81039 81040 81041[heading Remarks] 81042 81043Calling 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. 81044 81045The `poll()` function may also be used to dispatch ready handlers, but without blocking. 81046 81047 81048[endsect] 81049 81050 81051[endsect] 81052 81053 81054[section:run_for io_context::run_for] 81055 81056[indexterm2 boost_asio.indexterm.io_context.run_for..run_for..io_context] 81057Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop for a specified duration. 81058 81059 81060 template< 81061 typename Rep, 81062 typename Period> 81063 std::size_t run_for( 81064 const chrono::duration< Rep, Period > & rel_time); 81065 81066 81067The `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. 81068 81069 81070[heading Parameters] 81071 81072 81073[variablelist 81074 81075[[rel_time][The duration for which the call may block.]] 81076 81077] 81078 81079 81080[heading Return Value] 81081 81082The number of handlers that were executed. 81083 81084 81085 81086 81087[endsect] 81088 81089 81090[section:run_one io_context::run_one] 81091 81092[indexterm2 boost_asio.indexterm.io_context.run_one..run_one..io_context] 81093Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop to execute at most one handler. 81094 81095 81096 count_type ``[link boost_asio.reference.io_context.run_one.overload1 run_one]``(); 81097 `` [''''»''' [link boost_asio.reference.io_context.run_one.overload1 more...]]`` 81098 81099 81100(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. 81101 81102 81103 count_type ``[link boost_asio.reference.io_context.run_one.overload2 run_one]``( 81104 boost::system::error_code & ec); 81105 `` [''''»''' [link boost_asio.reference.io_context.run_one.overload2 more...]]`` 81106 81107 81108[section:overload1 io_context::run_one (1 of 2 overloads)] 81109 81110 81111Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop to execute at most one handler. 81112 81113 81114 count_type run_one(); 81115 81116 81117The `run_one()` function blocks until one handler has been dispatched, or until the [link boost_asio.reference.io_context `io_context`] has been stopped. 81118 81119 81120[heading Return Value] 81121 81122The 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()`. 81123 81124 81125[heading Remarks] 81126 81127Calling 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. 81128 81129 81130 81131 81132[endsect] 81133 81134 81135 81136[section:overload2 io_context::run_one (2 of 2 overloads)] 81137 81138 81139(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. 81140 81141 81142 count_type run_one( 81143 boost::system::error_code & ec); 81144 81145 81146The `run_one()` function blocks until one handler has been dispatched, or until the [link boost_asio.reference.io_context `io_context`] has been stopped. 81147 81148 81149[heading Return Value] 81150 81151The 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()`. 81152 81153The number of handlers that were executed. 81154 81155 81156[heading Remarks] 81157 81158Calling 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. 81159 81160 81161 81162 81163[endsect] 81164 81165 81166[endsect] 81167 81168 81169[section:run_one_for io_context::run_one_for] 81170 81171[indexterm2 boost_asio.indexterm.io_context.run_one_for..run_one_for..io_context] 81172Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop for a specified duration to execute at most one handler. 81173 81174 81175 template< 81176 typename Rep, 81177 typename Period> 81178 std::size_t run_one_for( 81179 const chrono::duration< Rep, Period > & rel_time); 81180 81181 81182The `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. 81183 81184 81185[heading Parameters] 81186 81187 81188[variablelist 81189 81190[[rel_time][The duration for which the call may block.]] 81191 81192] 81193 81194 81195[heading Return Value] 81196 81197The number of handlers that were executed. 81198 81199 81200 81201 81202[endsect] 81203 81204 81205 81206[section:run_one_until io_context::run_one_until] 81207 81208[indexterm2 boost_asio.indexterm.io_context.run_one_until..run_one_until..io_context] 81209Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop until a specified time to execute at most one handler. 81210 81211 81212 template< 81213 typename Clock, 81214 typename Duration> 81215 std::size_t run_one_until( 81216 const chrono::time_point< Clock, Duration > & abs_time); 81217 81218 81219The `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. 81220 81221 81222[heading Parameters] 81223 81224 81225[variablelist 81226 81227[[abs_time][The time point until which the call may block.]] 81228 81229] 81230 81231 81232[heading Return Value] 81233 81234The number of handlers that were executed. 81235 81236 81237 81238 81239[endsect] 81240 81241 81242 81243[section:run_until io_context::run_until] 81244 81245[indexterm2 boost_asio.indexterm.io_context.run_until..run_until..io_context] 81246Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop until a specified time. 81247 81248 81249 template< 81250 typename Clock, 81251 typename Duration> 81252 std::size_t run_until( 81253 const chrono::time_point< Clock, Duration > & abs_time); 81254 81255 81256The `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. 81257 81258 81259[heading Parameters] 81260 81261 81262[variablelist 81263 81264[[abs_time][The time point until which the call may block.]] 81265 81266] 81267 81268 81269[heading Return Value] 81270 81271The number of handlers that were executed. 81272 81273 81274 81275 81276[endsect] 81277 81278 81279 81280[section:shutdown io_context::shutdown] 81281 81282 81283['Inherited from execution_context.] 81284 81285[indexterm2 boost_asio.indexterm.io_context.shutdown..shutdown..io_context] 81286Shuts down all services in the context. 81287 81288 81289 void shutdown(); 81290 81291 81292This function is implemented as follows: 81293 81294 81295* 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()`. 81296 81297 81298 81299 81300[endsect] 81301 81302 81303 81304[section:stop io_context::stop] 81305 81306[indexterm2 boost_asio.indexterm.io_context.stop..stop..io_context] 81307Stop the [link boost_asio.reference.io_context `io_context`] object's event processing loop. 81308 81309 81310 void stop(); 81311 81312 81313This 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. 81314 81315 81316[endsect] 81317 81318 81319 81320[section:stopped io_context::stopped] 81321 81322[indexterm2 boost_asio.indexterm.io_context.stopped..stopped..io_context] 81323Determine whether the [link boost_asio.reference.io_context `io_context`] object has been stopped. 81324 81325 81326 bool stopped() const; 81327 81328 81329This 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. 81330 81331 81332[heading Return Value] 81333 81334`true` if the [link boost_asio.reference.io_context `io_context`] object is stopped, otherwise `false`. 81335 81336 81337 81338 81339[endsect] 81340 81341 81342[section:use_service io_context::use_service] 81343 81344[indexterm2 boost_asio.indexterm.io_context.use_service..use_service..io_context] 81345 81346 template< 81347 typename ``[link boost_asio.reference.Service Service]``> 81348 friend Service & ``[link boost_asio.reference.io_context.use_service.overload1 use_service]``( 81349 io_context & ioc); 81350 `` [''''»''' [link boost_asio.reference.io_context.use_service.overload1 more...]]`` 81351 81352 81353Obtain the service object corresponding to the given type. 81354 81355 81356 template< 81357 typename ``[link boost_asio.reference.Service Service]``> 81358 friend Service & ``[link boost_asio.reference.io_context.use_service.overload2 use_service]``( 81359 execution_context & e); 81360 `` [''''»''' [link boost_asio.reference.io_context.use_service.overload2 more...]]`` 81361 81362 81363[section:overload1 io_context::use_service (1 of 2 overloads)] 81364 81365 81366 81367 template< 81368 typename ``[link boost_asio.reference.Service Service]``> 81369 friend Service & use_service( 81370 io_context & ioc); 81371 81372 81373[heading Requirements] 81374 81375['Header: ][^boost/asio/io_context.hpp] 81376 81377['Convenience header: ][^boost/asio.hpp] 81378 81379 81380[endsect] 81381 81382 81383 81384[section:overload2 io_context::use_service (2 of 2 overloads)] 81385 81386 81387['Inherited from execution_context.] 81388 81389 81390Obtain the service object corresponding to the given type. 81391 81392 81393 template< 81394 typename ``[link boost_asio.reference.Service Service]``> 81395 friend Service & use_service( 81396 execution_context & e); 81397 81398 81399This 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. 81400 81401 81402[heading Parameters] 81403 81404 81405[variablelist 81406 81407[[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]] 81408 81409] 81410 81411 81412[heading Return Value] 81413 81414The service interface implementing the specified service type. Ownership of the service interface is not transferred to the caller. 81415 81416 81417 81418[heading Requirements] 81419 81420['Header: ][^boost/asio/io_context.hpp] 81421 81422['Convenience header: ][^boost/asio.hpp] 81423 81424 81425[endsect] 81426 81427 81428[endsect] 81429 81430 81431[section:wrap io_context::wrap] 81432 81433[indexterm2 boost_asio.indexterm.io_context.wrap..wrap..io_context] 81434(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`]. 81435 81436 81437 template< 81438 typename ``[link boost_asio.reference.Handler Handler]``> 81439 unspecified wrap( 81440 Handler handler); 81441 81442 81443This 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. 81444 81445 81446[heading Parameters] 81447 81448 81449[variablelist 81450 81451[[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: 81452`` 81453 void handler(A1 a1, ... An an); 81454`` 81455]] 81456 81457] 81458 81459 81460[heading Return Value] 81461 81462A 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: 81463 81464 R f(A1 a1, ... An an); 81465 81466 81467If this function object is passed to the wrap function like so: 81468 81469 io_context.wrap(f); 81470 81471 81472then the return value is a function object with the signature 81473 81474 void g(A1 a1, ... An an); 81475 81476 81477that, when invoked, executes code equivalent to: 81478 81479 io_context.dispatch(boost::bind(f, a1, ... an)); 81480 81481 81482 81483 81484 81485 81486 81487[endsect] 81488 81489 81490 81491[section:_io_context io_context::~io_context] 81492 81493[indexterm2 boost_asio.indexterm.io_context._io_context..~io_context..io_context] 81494Destructor. 81495 81496 81497 ~io_context(); 81498 81499 81500On destruction, the [link boost_asio.reference.io_context `io_context`] performs the following sequence of operations: 81501 81502 81503* 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()`. 81504 81505 81506* 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. 81507 81508 81509* 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)`. 81510 81511 81512[heading Remarks] 81513 81514The 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: 81515 81516 81517* 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. 81518 81519 81520* 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. 81521 81522 81523 81524 81525[endsect] 81526 81527 81528 81529[endsect] 81530 81531[section:io_context__basic_executor_type io_context::basic_executor_type] 81532 81533[indexterm1 boost_asio.indexterm.io_context__basic_executor_type..io_context::basic_executor_type] 81534 81535 81536Executor implementation type used to submit functions to an [link boost_asio.reference.io_context `io_context`]. 81537 81538 81539 template< 81540 typename Allocator, 81541 unsigned int Bits> 81542 class basic_executor_type 81543 81544 81545[heading Member Functions] 81546[table 81547 [[Name][Description]] 81548 81549 [ 81550 [[link boost_asio.reference.io_context__basic_executor_type.basic_executor_type [*basic_executor_type]] [constructor]] 81551 [Copy constructor. 81552 [hr] 81553 Move constructor. ] 81554 ] 81555 81556 [ 81557 [[link boost_asio.reference.io_context__basic_executor_type.context [*context]]] 81558 [Obtain the underlying execution context. ] 81559 ] 81560 81561 [ 81562 [[link boost_asio.reference.io_context__basic_executor_type.defer [*defer]]] 81563 [Request the io_context to invoke the given function object. ] 81564 ] 81565 81566 [ 81567 [[link boost_asio.reference.io_context__basic_executor_type.dispatch [*dispatch]]] 81568 [Request the io_context to invoke the given function object. ] 81569 ] 81570 81571 [ 81572 [[link boost_asio.reference.io_context__basic_executor_type.execute [*execute]]] 81573 [Execution function. ] 81574 ] 81575 81576 [ 81577 [[link boost_asio.reference.io_context__basic_executor_type.on_work_finished [*on_work_finished]]] 81578 [Inform the io_context that some work is no longer outstanding. ] 81579 ] 81580 81581 [ 81582 [[link boost_asio.reference.io_context__basic_executor_type.on_work_started [*on_work_started]]] 81583 [Inform the io_context that it has some outstanding work to do. ] 81584 ] 81585 81586 [ 81587 [[link boost_asio.reference.io_context__basic_executor_type.operator_eq_ [*operator=]]] 81588 [Assignment operator. 81589 [hr] 81590 Move assignment operator. ] 81591 ] 81592 81593 [ 81594 [[link boost_asio.reference.io_context__basic_executor_type.post [*post]]] 81595 [Request the io_context to invoke the given function object. ] 81596 ] 81597 81598 [ 81599 [[link boost_asio.reference.io_context__basic_executor_type.query [*query]]] 81600 [Query the current value of the context property. 81601 [hr] 81602 Query the current value of the blocking property. 81603 [hr] 81604 Query the current value of the relationship property. 81605 [hr] 81606 Query the current value of the allocator property. ] 81607 ] 81608 81609 [ 81610 [[link boost_asio.reference.io_context__basic_executor_type.query__static [*query]] [static]] 81611 [Query the current value of the mapping property. 81612 [hr] 81613 Query the current value of the outstanding_work property. ] 81614 ] 81615 81616 [ 81617 [[link boost_asio.reference.io_context__basic_executor_type.require [*require]]] 81618 [Obtain an executor with the blocking.possibly property. 81619 [hr] 81620 Obtain an executor with the blocking.never property. 81621 [hr] 81622 Obtain an executor with the relationship.fork property. 81623 [hr] 81624 Obtain an executor with the relationship.continuation property. 81625 [hr] 81626 Obtain an executor with the outstanding_work.tracked property. 81627 [hr] 81628 Obtain an executor with the outstanding_work.untracked property. 81629 [hr] 81630 Obtain an executor with the specified allocator property. 81631 [hr] 81632 Obtain an executor with the default allocator property. ] 81633 ] 81634 81635 [ 81636 [[link boost_asio.reference.io_context__basic_executor_type.running_in_this_thread [*running_in_this_thread]]] 81637 [Determine whether the io_context is running in the current thread. ] 81638 ] 81639 81640 [ 81641 [[link boost_asio.reference.io_context__basic_executor_type._basic_executor_type [*~basic_executor_type]] [destructor]] 81642 [Destructor. ] 81643 ] 81644 81645] 81646 81647[heading Friends] 81648[table 81649 [[Name][Description]] 81650 81651 [ 81652 [[link boost_asio.reference.io_context__basic_executor_type.operator_not__eq_ [*operator!=]]] 81653 [Compare two executors for inequality. ] 81654 ] 81655 81656 [ 81657 [[link boost_asio.reference.io_context__basic_executor_type.operator_eq__eq_ [*operator==]]] 81658 [Compare two executors for equality. ] 81659 ] 81660 81661] 81662 81663[heading Requirements] 81664 81665['Header: ][^boost/asio/io_context.hpp] 81666 81667['Convenience header: ][^boost/asio.hpp] 81668 81669[section:basic_executor_type io_context::basic_executor_type::basic_executor_type] 81670 81671[indexterm2 boost_asio.indexterm.io_context__basic_executor_type.basic_executor_type..basic_executor_type..io_context::basic_executor_type] 81672Copy constructor. 81673 81674 81675 ``[link boost_asio.reference.io_context__basic_executor_type.basic_executor_type.overload1 basic_executor_type]``( 81676 const basic_executor_type & other); 81677 `` [''''»''' [link boost_asio.reference.io_context__basic_executor_type.basic_executor_type.overload1 more...]]`` 81678 81679 81680Move constructor. 81681 81682 81683 ``[link boost_asio.reference.io_context__basic_executor_type.basic_executor_type.overload2 basic_executor_type]``( 81684 basic_executor_type && other); 81685 `` [''''»''' [link boost_asio.reference.io_context__basic_executor_type.basic_executor_type.overload2 more...]]`` 81686 81687 81688[section:overload1 io_context::basic_executor_type::basic_executor_type (1 of 2 overloads)] 81689 81690 81691Copy constructor. 81692 81693 81694 basic_executor_type( 81695 const basic_executor_type & other); 81696 81697 81698 81699[endsect] 81700 81701 81702 81703[section:overload2 io_context::basic_executor_type::basic_executor_type (2 of 2 overloads)] 81704 81705 81706Move constructor. 81707 81708 81709 basic_executor_type( 81710 basic_executor_type && other); 81711 81712 81713 81714[endsect] 81715 81716 81717[endsect] 81718 81719 81720[section:context io_context::basic_executor_type::context] 81721 81722[indexterm2 boost_asio.indexterm.io_context__basic_executor_type.context..context..io_context::basic_executor_type] 81723Obtain the underlying execution context. 81724 81725 81726 io_context & context() const; 81727 81728 81729 81730[endsect] 81731 81732 81733 81734[section:defer io_context::basic_executor_type::defer] 81735 81736[indexterm2 boost_asio.indexterm.io_context__basic_executor_type.defer..defer..io_context::basic_executor_type] 81737Request the [link boost_asio.reference.io_context `io_context`] to invoke the given function object. 81738 81739 81740 template< 81741 typename Function, 81742 typename OtherAllocator> 81743 void defer( 81744 Function && f, 81745 const OtherAllocator & a) const; 81746 81747 81748This 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`]. 81749 81750If 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. 81751 81752 81753[heading Parameters] 81754 81755 81756[variablelist 81757 81758[[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: 81759`` 81760 void function(); 81761`` 81762]] 81763 81764[[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]] 81765 81766] 81767 81768 81769 81770 81771[endsect] 81772 81773 81774 81775[section:dispatch io_context::basic_executor_type::dispatch] 81776 81777[indexterm2 boost_asio.indexterm.io_context__basic_executor_type.dispatch..dispatch..io_context::basic_executor_type] 81778Request the [link boost_asio.reference.io_context `io_context`] to invoke the given function object. 81779 81780 81781 template< 81782 typename Function, 81783 typename OtherAllocator> 81784 void dispatch( 81785 Function && f, 81786 const OtherAllocator & a) const; 81787 81788 81789This 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`]. 81790 81791 81792[heading Parameters] 81793 81794 81795[variablelist 81796 81797[[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: 81798`` 81799 void function(); 81800`` 81801]] 81802 81803[[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]] 81804 81805] 81806 81807 81808 81809 81810[endsect] 81811 81812 81813 81814[section:execute io_context::basic_executor_type::execute] 81815 81816[indexterm2 boost_asio.indexterm.io_context__basic_executor_type.execute..execute..io_context::basic_executor_type] 81817Execution function. 81818 81819 81820 template< 81821 typename Function> 81822 void execute( 81823 Function && f) const; 81824 81825 81826Do not call this function directly. It is intended for use with the [link boost_asio.reference.execution__execute `execution::execute`] customisation point. 81827 81828For example: 81829 81830 auto ex = my_io_context.get_executor(); 81831 execution::execute(ex, my_function_object); 81832 81833 81834 81835 81836 81837[endsect] 81838 81839 81840 81841[section:on_work_finished io_context::basic_executor_type::on_work_finished] 81842 81843[indexterm2 boost_asio.indexterm.io_context__basic_executor_type.on_work_finished..on_work_finished..io_context::basic_executor_type] 81844Inform the [link boost_asio.reference.io_context `io_context`] that some work is no longer outstanding. 81845 81846 81847 void on_work_finished() const; 81848 81849 81850This 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. 81851 81852 81853[endsect] 81854 81855 81856 81857[section:on_work_started io_context::basic_executor_type::on_work_started] 81858 81859[indexterm2 boost_asio.indexterm.io_context__basic_executor_type.on_work_started..on_work_started..io_context::basic_executor_type] 81860Inform the [link boost_asio.reference.io_context `io_context`] that it has some outstanding work to do. 81861 81862 81863 void on_work_started() const; 81864 81865 81866This 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. 81867 81868 81869[endsect] 81870 81871 81872 81873[section:operator_not__eq_ io_context::basic_executor_type::operator!=] 81874 81875[indexterm2 boost_asio.indexterm.io_context__basic_executor_type.operator_not__eq_..operator!=..io_context::basic_executor_type] 81876Compare two executors for inequality. 81877 81878 81879 friend bool operator!=( 81880 const basic_executor_type & a, 81881 const basic_executor_type & b); 81882 81883 81884Two executors are equal if they refer to the same underlying [link boost_asio.reference.io_context `io_context`]. 81885 81886[heading Requirements] 81887 81888['Header: ][^boost/asio/io_context.hpp] 81889 81890['Convenience header: ][^boost/asio.hpp] 81891 81892 81893[endsect] 81894 81895 81896[section:operator_eq_ io_context::basic_executor_type::operator=] 81897 81898[indexterm2 boost_asio.indexterm.io_context__basic_executor_type.operator_eq_..operator=..io_context::basic_executor_type] 81899Assignment operator. 81900 81901 81902 basic_executor_type & ``[link boost_asio.reference.io_context__basic_executor_type.operator_eq_.overload1 operator=]``( 81903 const basic_executor_type & other); 81904 `` [''''»''' [link boost_asio.reference.io_context__basic_executor_type.operator_eq_.overload1 more...]]`` 81905 81906 81907Move assignment operator. 81908 81909 81910 basic_executor_type & ``[link boost_asio.reference.io_context__basic_executor_type.operator_eq_.overload2 operator=]``( 81911 basic_executor_type && other); 81912 `` [''''»''' [link boost_asio.reference.io_context__basic_executor_type.operator_eq_.overload2 more...]]`` 81913 81914 81915[section:overload1 io_context::basic_executor_type::operator= (1 of 2 overloads)] 81916 81917 81918Assignment operator. 81919 81920 81921 basic_executor_type & operator=( 81922 const basic_executor_type & other); 81923 81924 81925 81926[endsect] 81927 81928 81929 81930[section:overload2 io_context::basic_executor_type::operator= (2 of 2 overloads)] 81931 81932 81933Move assignment operator. 81934 81935 81936 basic_executor_type & operator=( 81937 basic_executor_type && other); 81938 81939 81940 81941[endsect] 81942 81943 81944[endsect] 81945 81946 81947[section:operator_eq__eq_ io_context::basic_executor_type::operator==] 81948 81949[indexterm2 boost_asio.indexterm.io_context__basic_executor_type.operator_eq__eq_..operator==..io_context::basic_executor_type] 81950Compare two executors for equality. 81951 81952 81953 friend bool operator==( 81954 const basic_executor_type & a, 81955 const basic_executor_type & b); 81956 81957 81958Two executors are equal if they refer to the same underlying [link boost_asio.reference.io_context `io_context`]. 81959 81960[heading Requirements] 81961 81962['Header: ][^boost/asio/io_context.hpp] 81963 81964['Convenience header: ][^boost/asio.hpp] 81965 81966 81967[endsect] 81968 81969 81970 81971[section:post io_context::basic_executor_type::post] 81972 81973[indexterm2 boost_asio.indexterm.io_context__basic_executor_type.post..post..io_context::basic_executor_type] 81974Request the [link boost_asio.reference.io_context `io_context`] to invoke the given function object. 81975 81976 81977 template< 81978 typename Function, 81979 typename OtherAllocator> 81980 void post( 81981 Function && f, 81982 const OtherAllocator & a) const; 81983 81984 81985This 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`]. 81986 81987 81988[heading Parameters] 81989 81990 81991[variablelist 81992 81993[[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: 81994`` 81995 void function(); 81996`` 81997]] 81998 81999[[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]] 82000 82001] 82002 82003 82004 82005 82006[endsect] 82007 82008 82009[section:query io_context::basic_executor_type::query] 82010 82011[indexterm2 boost_asio.indexterm.io_context__basic_executor_type.query..query..io_context::basic_executor_type] 82012Query the current value of the `context` property. 82013 82014 82015 io_context & ``[link boost_asio.reference.io_context__basic_executor_type.query.overload1 query]``( 82016 execution::context_t ) const; 82017 `` [''''»''' [link boost_asio.reference.io_context__basic_executor_type.query.overload1 more...]]`` 82018 82019 82020Query the current value of the `blocking` property. 82021 82022 82023 constexpr execution::blocking_t ``[link boost_asio.reference.io_context__basic_executor_type.query.overload2 query]``( 82024 execution::blocking_t ) const; 82025 `` [''''»''' [link boost_asio.reference.io_context__basic_executor_type.query.overload2 more...]]`` 82026 82027 82028Query the current value of the `relationship` property. 82029 82030 82031 constexpr execution::relationship_t ``[link boost_asio.reference.io_context__basic_executor_type.query.overload3 query]``( 82032 execution::relationship_t ) const; 82033 `` [''''»''' [link boost_asio.reference.io_context__basic_executor_type.query.overload3 more...]]`` 82034 82035 82036Query the current value of the `allocator` property. 82037 82038 82039 template< 82040 typename OtherAllocator> 82041 constexpr Allocator ``[link boost_asio.reference.io_context__basic_executor_type.query.overload4 query]``( 82042 execution::allocator_t< OtherAllocator > ) const; 82043 `` [''''»''' [link boost_asio.reference.io_context__basic_executor_type.query.overload4 more...]]`` 82044 82045 constexpr Allocator ``[link boost_asio.reference.io_context__basic_executor_type.query.overload5 query]``( 82046 execution::allocator_t< void > ) const; 82047 `` [''''»''' [link boost_asio.reference.io_context__basic_executor_type.query.overload5 more...]]`` 82048 82049 82050[section:overload1 io_context::basic_executor_type::query (1 of 5 overloads)] 82051 82052 82053Query the current value of the `context` property. 82054 82055 82056 io_context & query( 82057 execution::context_t ) const; 82058 82059 82060Do not call this function directly. It is intended for use with the [link boost_asio.reference.query `query`] customisation point. 82061 82062For example: 82063 82064 auto ex = my_io_context.get_executor(); 82065 boost::asio::io_context& ctx = boost::asio::query( 82066 ex, boost::asio::execution::context); 82067 82068 82069 82070 82071 82072[endsect] 82073 82074 82075 82076[section:overload2 io_context::basic_executor_type::query (2 of 5 overloads)] 82077 82078 82079Query the current value of the `blocking` property. 82080 82081 82082 constexpr execution::blocking_t query( 82083 execution::blocking_t ) const; 82084 82085 82086Do not call this function directly. It is intended for use with the [link boost_asio.reference.query `query`] customisation point. 82087 82088For example: 82089 82090 auto ex = my_io_context.get_executor(); 82091 if (boost::asio::query(ex, boost::asio::execution::blocking) 82092 == boost::asio::execution::blocking.always) 82093 ... 82094 82095 82096 82097 82098 82099[endsect] 82100 82101 82102 82103[section:overload3 io_context::basic_executor_type::query (3 of 5 overloads)] 82104 82105 82106Query the current value of the `relationship` property. 82107 82108 82109 constexpr execution::relationship_t query( 82110 execution::relationship_t ) const; 82111 82112 82113Do not call this function directly. It is intended for use with the [link boost_asio.reference.query `query`] customisation point. 82114 82115For example: 82116 82117 auto ex = my_io_context.get_executor(); 82118 if (boost::asio::query(ex, boost::asio::execution::relationship) 82119 == boost::asio::execution::relationship.continuation) 82120 ... 82121 82122 82123 82124 82125 82126[endsect] 82127 82128 82129 82130[section:overload4 io_context::basic_executor_type::query (4 of 5 overloads)] 82131 82132 82133Query the current value of the `allocator` property. 82134 82135 82136 template< 82137 typename OtherAllocator> 82138 constexpr Allocator query( 82139 execution::allocator_t< OtherAllocator > ) const; 82140 82141 82142Do not call this function directly. It is intended for use with the [link boost_asio.reference.query `query`] customisation point. 82143 82144For example: 82145 82146 auto ex = my_io_context.get_executor(); 82147 auto alloc = boost::asio::query(ex, 82148 boost::asio::execution::allocator); 82149 82150 82151 82152 82153 82154[endsect] 82155 82156 82157 82158[section:overload5 io_context::basic_executor_type::query (5 of 5 overloads)] 82159 82160 82161Query the current value of the `allocator` property. 82162 82163 82164 constexpr Allocator query( 82165 execution::allocator_t< void > ) const; 82166 82167 82168Do not call this function directly. It is intended for use with the [link boost_asio.reference.query `query`] customisation point. 82169 82170For example: 82171 82172 auto ex = my_io_context.get_executor(); 82173 auto alloc = boost::asio::query(ex, 82174 boost::asio::execution::allocator); 82175 82176 82177 82178 82179 82180[endsect] 82181 82182 82183[endsect] 82184 82185[section:query__static io_context::basic_executor_type::query] 82186 82187[indexterm2 boost_asio.indexterm.io_context__basic_executor_type.query__static..query..io_context::basic_executor_type] 82188Query the current value of the `mapping` property. 82189 82190 82191 static constexpr execution::mapping_t ``[link boost_asio.reference.io_context__basic_executor_type.query__static.overload1 query]``( 82192 execution::mapping_t ); 82193 `` [''''»''' [link boost_asio.reference.io_context__basic_executor_type.query__static.overload1 more...]]`` 82194 82195 82196Query the current value of the `outstanding_work` property. 82197 82198 82199 static constexpr execution::outstanding_work_t ``[link boost_asio.reference.io_context__basic_executor_type.query__static.overload2 query]``( 82200 execution::outstanding_work_t ); 82201 `` [''''»''' [link boost_asio.reference.io_context__basic_executor_type.query__static.overload2 more...]]`` 82202 82203 82204[section:overload1 io_context::basic_executor_type::query (1 of 2 overloads)] 82205 82206 82207Query the current value of the `mapping` property. 82208 82209 82210 static constexpr execution::mapping_t query( 82211 execution::mapping_t ); 82212 82213 82214Do not call this function directly. It is intended for use with the [link boost_asio.reference.query `query`] customisation point. 82215 82216For example: 82217 82218 auto ex = my_io_context.get_executor(); 82219 if (boost::asio::query(ex, boost::asio::execution::mapping) 82220 == boost::asio::execution::mapping.thread) 82221 ... 82222 82223 82224 82225 82226 82227[endsect] 82228 82229 82230 82231[section:overload2 io_context::basic_executor_type::query (2 of 2 overloads)] 82232 82233 82234Query the current value of the `outstanding_work` property. 82235 82236 82237 static constexpr execution::outstanding_work_t query( 82238 execution::outstanding_work_t ); 82239 82240 82241Do not call this function directly. It is intended for use with the [link boost_asio.reference.query `query`] customisation point. 82242 82243For example: 82244 82245 auto ex = my_io_context.get_executor(); 82246 if (boost::asio::query(ex, boost::asio::execution::outstanding_work) 82247 == boost::asio::execution::outstanding_work.tracked) 82248 ... 82249 82250 82251 82252 82253 82254[endsect] 82255 82256 82257[endsect] 82258 82259[section:require io_context::basic_executor_type::require] 82260 82261[indexterm2 boost_asio.indexterm.io_context__basic_executor_type.require..require..io_context::basic_executor_type] 82262Obtain an executor with the `blocking.possibly` property. 82263 82264 82265 constexpr basic_executor_type ``[link boost_asio.reference.io_context__basic_executor_type.require.overload1 require]``( 82266 execution::blocking_t::possibly_t ) const; 82267 `` [''''»''' [link boost_asio.reference.io_context__basic_executor_type.require.overload1 more...]]`` 82268 82269 82270Obtain an executor with the `blocking.never` property. 82271 82272 82273 constexpr basic_executor_type ``[link boost_asio.reference.io_context__basic_executor_type.require.overload2 require]``( 82274 execution::blocking_t::never_t ) const; 82275 `` [''''»''' [link boost_asio.reference.io_context__basic_executor_type.require.overload2 more...]]`` 82276 82277 82278Obtain an executor with the `relationship.fork` property. 82279 82280 82281 constexpr basic_executor_type ``[link boost_asio.reference.io_context__basic_executor_type.require.overload3 require]``( 82282 execution::relationship_t::fork_t ) const; 82283 `` [''''»''' [link boost_asio.reference.io_context__basic_executor_type.require.overload3 more...]]`` 82284 82285 82286Obtain an executor with the `relationship.continuation` property. 82287 82288 82289 constexpr basic_executor_type ``[link boost_asio.reference.io_context__basic_executor_type.require.overload4 require]``( 82290 execution::relationship_t::continuation_t ) const; 82291 `` [''''»''' [link boost_asio.reference.io_context__basic_executor_type.require.overload4 more...]]`` 82292 82293 82294Obtain an executor with the `outstanding_work.tracked` property. 82295 82296 82297 constexpr basic_executor_type< Allocator, unspecified > ``[link boost_asio.reference.io_context__basic_executor_type.require.overload5 require]``( 82298 execution::outstanding_work_t::tracked_t ) const; 82299 `` [''''»''' [link boost_asio.reference.io_context__basic_executor_type.require.overload5 more...]]`` 82300 82301 82302Obtain an executor with the `outstanding_work.untracked` property. 82303 82304 82305 constexpr basic_executor_type< Allocator, unspecified > ``[link boost_asio.reference.io_context__basic_executor_type.require.overload6 require]``( 82306 execution::outstanding_work_t::untracked_t ) const; 82307 `` [''''»''' [link boost_asio.reference.io_context__basic_executor_type.require.overload6 more...]]`` 82308 82309 82310Obtain an executor with the specified `allocator` property. 82311 82312 82313 template< 82314 typename OtherAllocator> 82315 constexpr basic_executor_type< OtherAllocator, Bits > ``[link boost_asio.reference.io_context__basic_executor_type.require.overload7 require]``( 82316 execution::allocator_t< OtherAllocator > a) const; 82317 `` [''''»''' [link boost_asio.reference.io_context__basic_executor_type.require.overload7 more...]]`` 82318 82319 82320Obtain an executor with the default `allocator` property. 82321 82322 82323 constexpr basic_executor_type< std::allocator< void >, Bits > ``[link boost_asio.reference.io_context__basic_executor_type.require.overload8 require]``( 82324 execution::allocator_t< void > ) const; 82325 `` [''''»''' [link boost_asio.reference.io_context__basic_executor_type.require.overload8 more...]]`` 82326 82327 82328[section:overload1 io_context::basic_executor_type::require (1 of 8 overloads)] 82329 82330 82331Obtain an executor with the `blocking.possibly` property. 82332 82333 82334 constexpr basic_executor_type require( 82335 execution::blocking_t::possibly_t ) const; 82336 82337 82338Do not call this function directly. It is intended for use with the [link boost_asio.reference.require `require`] customisation point. 82339 82340For example: 82341 82342 auto ex1 = my_io_context.get_executor(); 82343 auto ex2 = boost::asio::require(ex1, 82344 boost::asio::execution::blocking.possibly); 82345 82346 82347 82348 82349 82350[endsect] 82351 82352 82353 82354[section:overload2 io_context::basic_executor_type::require (2 of 8 overloads)] 82355 82356 82357Obtain an executor with the `blocking.never` property. 82358 82359 82360 constexpr basic_executor_type require( 82361 execution::blocking_t::never_t ) const; 82362 82363 82364Do not call this function directly. It is intended for use with the [link boost_asio.reference.require `require`] customisation point. 82365 82366For example: 82367 82368 auto ex1 = my_io_context.get_executor(); 82369 auto ex2 = boost::asio::require(ex1, 82370 boost::asio::execution::blocking.never); 82371 82372 82373 82374 82375 82376[endsect] 82377 82378 82379 82380[section:overload3 io_context::basic_executor_type::require (3 of 8 overloads)] 82381 82382 82383Obtain an executor with the `relationship.fork` property. 82384 82385 82386 constexpr basic_executor_type require( 82387 execution::relationship_t::fork_t ) const; 82388 82389 82390Do not call this function directly. It is intended for use with the [link boost_asio.reference.require `require`] customisation point. 82391 82392For example: 82393 82394 auto ex1 = my_io_context.get_executor(); 82395 auto ex2 = boost::asio::require(ex1, 82396 boost::asio::execution::relationship.fork); 82397 82398 82399 82400 82401 82402[endsect] 82403 82404 82405 82406[section:overload4 io_context::basic_executor_type::require (4 of 8 overloads)] 82407 82408 82409Obtain an executor with the `relationship.continuation` property. 82410 82411 82412 constexpr basic_executor_type require( 82413 execution::relationship_t::continuation_t ) const; 82414 82415 82416Do not call this function directly. It is intended for use with the [link boost_asio.reference.require `require`] customisation point. 82417 82418For example: 82419 82420 auto ex1 = my_io_context.get_executor(); 82421 auto ex2 = boost::asio::require(ex1, 82422 boost::asio::execution::relationship.continuation); 82423 82424 82425 82426 82427 82428[endsect] 82429 82430 82431 82432[section:overload5 io_context::basic_executor_type::require (5 of 8 overloads)] 82433 82434 82435Obtain an executor with the `outstanding_work.tracked` property. 82436 82437 82438 constexpr basic_executor_type< Allocator, unspecified > require( 82439 execution::outstanding_work_t::tracked_t ) const; 82440 82441 82442Do not call this function directly. It is intended for use with the [link boost_asio.reference.require `require`] customisation point. 82443 82444For example: 82445 82446 auto ex1 = my_io_context.get_executor(); 82447 auto ex2 = boost::asio::require(ex1, 82448 boost::asio::execution::outstanding_work.tracked); 82449 82450 82451 82452 82453 82454[endsect] 82455 82456 82457 82458[section:overload6 io_context::basic_executor_type::require (6 of 8 overloads)] 82459 82460 82461Obtain an executor with the `outstanding_work.untracked` property. 82462 82463 82464 constexpr basic_executor_type< Allocator, unspecified > require( 82465 execution::outstanding_work_t::untracked_t ) const; 82466 82467 82468Do not call this function directly. It is intended for use with the [link boost_asio.reference.require `require`] customisation point. 82469 82470For example: 82471 82472 auto ex1 = my_io_context.get_executor(); 82473 auto ex2 = boost::asio::require(ex1, 82474 boost::asio::execution::outstanding_work.untracked); 82475 82476 82477 82478 82479 82480[endsect] 82481 82482 82483 82484[section:overload7 io_context::basic_executor_type::require (7 of 8 overloads)] 82485 82486 82487Obtain an executor with the specified `allocator` property. 82488 82489 82490 template< 82491 typename OtherAllocator> 82492 constexpr basic_executor_type< OtherAllocator, Bits > require( 82493 execution::allocator_t< OtherAllocator > a) const; 82494 82495 82496Do not call this function directly. It is intended for use with the [link boost_asio.reference.require `require`] customisation point. 82497 82498For example: 82499 82500 auto ex1 = my_io_context.get_executor(); 82501 auto ex2 = boost::asio::require(ex1, 82502 boost::asio::execution::allocator(my_allocator)); 82503 82504 82505 82506 82507 82508[endsect] 82509 82510 82511 82512[section:overload8 io_context::basic_executor_type::require (8 of 8 overloads)] 82513 82514 82515Obtain an executor with the default `allocator` property. 82516 82517 82518 constexpr basic_executor_type< std::allocator< void >, Bits > require( 82519 execution::allocator_t< void > ) const; 82520 82521 82522Do not call this function directly. It is intended for use with the [link boost_asio.reference.require `require`] customisation point. 82523 82524For example: 82525 82526 auto ex1 = my_io_context.get_executor(); 82527 auto ex2 = boost::asio::require(ex1, 82528 boost::asio::execution::allocator); 82529 82530 82531 82532 82533 82534[endsect] 82535 82536 82537[endsect] 82538 82539 82540[section:running_in_this_thread io_context::basic_executor_type::running_in_this_thread] 82541 82542[indexterm2 boost_asio.indexterm.io_context__basic_executor_type.running_in_this_thread..running_in_this_thread..io_context::basic_executor_type] 82543Determine whether the [link boost_asio.reference.io_context `io_context`] is running in the current thread. 82544 82545 82546 bool running_in_this_thread() const; 82547 82548 82549 82550[heading Return Value] 82551 82552`true` if the current thread is running the [link boost_asio.reference.io_context `io_context`]. Otherwise returns `false`. 82553 82554 82555 82556 82557[endsect] 82558 82559 82560 82561[section:_basic_executor_type io_context::basic_executor_type::~basic_executor_type] 82562 82563[indexterm2 boost_asio.indexterm.io_context__basic_executor_type._basic_executor_type..~basic_executor_type..io_context::basic_executor_type] 82564Destructor. 82565 82566 82567 ~basic_executor_type(); 82568 82569 82570 82571[endsect] 82572 82573 82574 82575[endsect] 82576 82577[section:io_context__service io_context::service] 82578 82579[indexterm1 boost_asio.indexterm.io_context__service..io_context::service] 82580 82581 82582Base class for all [link boost_asio.reference.io_context `io_context`] services. 82583 82584 82585 class service 82586 82587 82588[heading Member Functions] 82589[table 82590 [[Name][Description]] 82591 82592 [ 82593 [[link boost_asio.reference.io_context__service.get_io_context [*get_io_context]]] 82594 [Get the io_context object that owns the service. ] 82595 ] 82596 82597] 82598 82599[heading Protected Member Functions] 82600[table 82601 [[Name][Description]] 82602 82603 [ 82604 [[link boost_asio.reference.io_context__service.service [*service]] [constructor]] 82605 [Constructor. ] 82606 ] 82607 82608 [ 82609 [[link boost_asio.reference.io_context__service._service [*~service]] [destructor]] 82610 [Destructor. ] 82611 ] 82612 82613] 82614 82615[heading Requirements] 82616 82617['Header: ][^boost/asio/io_context.hpp] 82618 82619['Convenience header: ][^boost/asio.hpp] 82620 82621 82622[section:get_io_context io_context::service::get_io_context] 82623 82624[indexterm2 boost_asio.indexterm.io_context__service.get_io_context..get_io_context..io_context::service] 82625Get the [link boost_asio.reference.io_context `io_context`] object that owns the service. 82626 82627 82628 boost::asio::io_context & get_io_context(); 82629 82630 82631 82632[endsect] 82633 82634 82635 82636[section:service io_context::service::service] 82637 82638[indexterm2 boost_asio.indexterm.io_context__service.service..service..io_context::service] 82639Constructor. 82640 82641 82642 service( 82643 boost::asio::io_context & owner); 82644 82645 82646 82647[heading Parameters] 82648 82649 82650[variablelist 82651 82652[[owner][The [link boost_asio.reference.io_context `io_context`] object that owns the service. ]] 82653 82654] 82655 82656 82657 82658 82659[endsect] 82660 82661 82662 82663[section:_service io_context::service::~service] 82664 82665[indexterm2 boost_asio.indexterm.io_context__service._service..~service..io_context::service] 82666Destructor. 82667 82668 82669 virtual ~service(); 82670 82671 82672 82673[endsect] 82674 82675 82676 82677[endsect] 82678 82679[section:io_context__strand io_context::strand] 82680 82681[indexterm1 boost_asio.indexterm.io_context__strand..io_context::strand] 82682 82683 82684Provides serialised handler execution. 82685 82686 82687 class strand 82688 82689 82690[heading Member Functions] 82691[table 82692 [[Name][Description]] 82693 82694 [ 82695 [[link boost_asio.reference.io_context__strand.context [*context]]] 82696 [Obtain the underlying execution context. ] 82697 ] 82698 82699 [ 82700 [[link boost_asio.reference.io_context__strand.defer [*defer]]] 82701 [Request the strand to invoke the given function object. ] 82702 ] 82703 82704 [ 82705 [[link boost_asio.reference.io_context__strand.dispatch [*dispatch]]] 82706 [Request the strand to invoke the given function object. 82707 [hr] 82708 (Deprecated: Use boost::asio::dispatch().) Request the strand to invoke the given handler. ] 82709 ] 82710 82711 [ 82712 [[link boost_asio.reference.io_context__strand.on_work_finished [*on_work_finished]]] 82713 [Inform the strand that some work is no longer outstanding. ] 82714 ] 82715 82716 [ 82717 [[link boost_asio.reference.io_context__strand.on_work_started [*on_work_started]]] 82718 [Inform the strand that it has some outstanding work to do. ] 82719 ] 82720 82721 [ 82722 [[link boost_asio.reference.io_context__strand.post [*post]]] 82723 [Request the strand to invoke the given function object. 82724 [hr] 82725 (Deprecated: Use boost::asio::post().) Request the strand to invoke the given handler and return immediately. ] 82726 ] 82727 82728 [ 82729 [[link boost_asio.reference.io_context__strand.running_in_this_thread [*running_in_this_thread]]] 82730 [Determine whether the strand is running in the current thread. ] 82731 ] 82732 82733 [ 82734 [[link boost_asio.reference.io_context__strand.strand [*strand]] [constructor]] 82735 [Constructor. ] 82736 ] 82737 82738 [ 82739 [[link boost_asio.reference.io_context__strand.wrap [*wrap]]] 82740 [(Deprecated: Use boost::asio::bind_executor().) Create a new handler that automatically dispatches the wrapped handler on the strand. ] 82741 ] 82742 82743 [ 82744 [[link boost_asio.reference.io_context__strand._strand [*~strand]] [destructor]] 82745 [Destructor. ] 82746 ] 82747 82748] 82749 82750[heading Friends] 82751[table 82752 [[Name][Description]] 82753 82754 [ 82755 [[link boost_asio.reference.io_context__strand.operator_not__eq_ [*operator!=]]] 82756 [Compare two strands for inequality. ] 82757 ] 82758 82759 [ 82760 [[link boost_asio.reference.io_context__strand.operator_eq__eq_ [*operator==]]] 82761 [Compare two strands for equality. ] 82762 ] 82763 82764] 82765 82766The [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. 82767 82768 82769[heading Order of handler invocation] 82770 82771Given: 82772 82773 82774* a strand object `s` 82775 82776 82777* an object `a` meeting completion handler requirements 82778 82779 82780* an object `a1` which is an arbitrary copy of `a` made by the implementation 82781 82782 82783* an object `b` meeting completion handler requirements 82784 82785 82786* an object `b1` which is an arbitrary copy of `b` made by the implementation 82787 82788if any of the following conditions are true: 82789 82790 82791* `s.post(a)` happens-before `s.post(b)` 82792 82793 82794* `s.post(a)` happens-before `s.dispatch(b)`, where the latter is performed outside the strand 82795 82796 82797* `s.dispatch(a)` happens-before `s.post(b)`, where the former is performed outside the strand 82798 82799 82800* `s.dispatch(a)` happens-before `s.dispatch(b)`, where both are performed outside the strand 82801 82802then `asio_handler_invoke(a1, &a1)` happens-before `asio_handler_invoke(b1, &b1)`. 82803 82804Note that in the following case: 82805 82806 async_op_1(..., s.wrap(a)); 82807 async_op_2(..., s.wrap(b)); 82808 82809 82810the 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. 82811 82812 82813[heading Remarks] 82814 82815The implementation makes no guarantee that handlers posted or dispatched through different `strand` objects will be invoked concurrently. 82816 82817 82818[heading Thread Safety] 82819 82820['Distinct] ['objects:] Safe. 82821 82822['Shared] ['objects:] Safe. 82823 82824 82825 82826 82827[heading Requirements] 82828 82829['Header: ][^boost/asio/io_context_strand.hpp] 82830 82831['Convenience header: ][^boost/asio.hpp] 82832 82833 82834[section:context io_context::strand::context] 82835 82836[indexterm2 boost_asio.indexterm.io_context__strand.context..context..io_context::strand] 82837Obtain the underlying execution context. 82838 82839 82840 boost::asio::io_context & context() const; 82841 82842 82843 82844[endsect] 82845 82846 82847 82848[section:defer io_context::strand::defer] 82849 82850[indexterm2 boost_asio.indexterm.io_context__strand.defer..defer..io_context::strand] 82851Request the strand to invoke the given function object. 82852 82853 82854 template< 82855 typename Function, 82856 typename Allocator> 82857 void defer( 82858 Function && f, 82859 const Allocator & a) const; 82860 82861 82862This 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`]. 82863 82864 82865[heading Parameters] 82866 82867 82868[variablelist 82869 82870[[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: 82871`` 82872 void function(); 82873`` 82874]] 82875 82876[[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]] 82877 82878] 82879 82880 82881 82882 82883[endsect] 82884 82885 82886[section:dispatch io_context::strand::dispatch] 82887 82888[indexterm2 boost_asio.indexterm.io_context__strand.dispatch..dispatch..io_context::strand] 82889Request the strand to invoke the given function object. 82890 82891 82892 template< 82893 typename Function, 82894 typename Allocator> 82895 void ``[link boost_asio.reference.io_context__strand.dispatch.overload1 dispatch]``( 82896 Function && f, 82897 const Allocator & a) const; 82898 `` [''''»''' [link boost_asio.reference.io_context__strand.dispatch.overload1 more...]]`` 82899 82900 82901(Deprecated: Use [link boost_asio.reference.dispatch `dispatch`].) Request the strand to invoke the given handler. 82902 82903 82904 template< 82905 typename ``[link boost_asio.reference.LegacyCompletionHandler LegacyCompletionHandler]``> 82906 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.io_context__strand.dispatch.overload2 dispatch]``( 82907 LegacyCompletionHandler && handler); 82908 `` [''''»''' [link boost_asio.reference.io_context__strand.dispatch.overload2 more...]]`` 82909 82910 82911[section:overload1 io_context::strand::dispatch (1 of 2 overloads)] 82912 82913 82914Request the strand to invoke the given function object. 82915 82916 82917 template< 82918 typename Function, 82919 typename Allocator> 82920 void dispatch( 82921 Function && f, 82922 const Allocator & a) const; 82923 82924 82925This 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. 82926 82927 82928[heading Parameters] 82929 82930 82931[variablelist 82932 82933[[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: 82934`` 82935 void function(); 82936`` 82937]] 82938 82939[[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]] 82940 82941] 82942 82943 82944 82945 82946[endsect] 82947 82948 82949 82950[section:overload2 io_context::strand::dispatch (2 of 2 overloads)] 82951 82952 82953(Deprecated: Use [link boost_asio.reference.dispatch `dispatch`].) Request the strand to invoke the given handler. 82954 82955 82956 template< 82957 typename ``[link boost_asio.reference.LegacyCompletionHandler LegacyCompletionHandler]``> 82958 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` dispatch( 82959 LegacyCompletionHandler && handler); 82960 82961 82962This function is used to ask the strand to execute the given handler. 82963 82964The 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. 82965 82966The 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. 82967 82968 82969[heading Parameters] 82970 82971 82972[variablelist 82973 82974[[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: 82975`` 82976 void handler(); 82977`` 82978]] 82979 82980] 82981 82982 82983 82984 82985[endsect] 82986 82987 82988[endsect] 82989 82990 82991[section:on_work_finished io_context::strand::on_work_finished] 82992 82993[indexterm2 boost_asio.indexterm.io_context__strand.on_work_finished..on_work_finished..io_context::strand] 82994Inform the strand that some work is no longer outstanding. 82995 82996 82997 void on_work_finished() const; 82998 82999 83000The strand delegates this call to its underlying [link boost_asio.reference.io_context `io_context`]. 83001 83002 83003[endsect] 83004 83005 83006 83007[section:on_work_started io_context::strand::on_work_started] 83008 83009[indexterm2 boost_asio.indexterm.io_context__strand.on_work_started..on_work_started..io_context::strand] 83010Inform the strand that it has some outstanding work to do. 83011 83012 83013 void on_work_started() const; 83014 83015 83016The strand delegates this call to its underlying [link boost_asio.reference.io_context `io_context`]. 83017 83018 83019[endsect] 83020 83021 83022 83023[section:operator_not__eq_ io_context::strand::operator!=] 83024 83025[indexterm2 boost_asio.indexterm.io_context__strand.operator_not__eq_..operator!=..io_context::strand] 83026Compare two strands for inequality. 83027 83028 83029 friend bool operator!=( 83030 const strand & a, 83031 const strand & b); 83032 83033 83034Two strands are equal if they refer to the same ordered, non-concurrent state. 83035 83036[heading Requirements] 83037 83038['Header: ][^boost/asio/io_context_strand.hpp] 83039 83040['Convenience header: ][^boost/asio.hpp] 83041 83042 83043[endsect] 83044 83045 83046 83047[section:operator_eq__eq_ io_context::strand::operator==] 83048 83049[indexterm2 boost_asio.indexterm.io_context__strand.operator_eq__eq_..operator==..io_context::strand] 83050Compare two strands for equality. 83051 83052 83053 friend bool operator==( 83054 const strand & a, 83055 const strand & b); 83056 83057 83058Two strands are equal if they refer to the same ordered, non-concurrent state. 83059 83060[heading Requirements] 83061 83062['Header: ][^boost/asio/io_context_strand.hpp] 83063 83064['Convenience header: ][^boost/asio.hpp] 83065 83066 83067[endsect] 83068 83069 83070[section:post io_context::strand::post] 83071 83072[indexterm2 boost_asio.indexterm.io_context__strand.post..post..io_context::strand] 83073Request the strand to invoke the given function object. 83074 83075 83076 template< 83077 typename Function, 83078 typename Allocator> 83079 void ``[link boost_asio.reference.io_context__strand.post.overload1 post]``( 83080 Function && f, 83081 const Allocator & a) const; 83082 `` [''''»''' [link boost_asio.reference.io_context__strand.post.overload1 more...]]`` 83083 83084 83085(Deprecated: Use [link boost_asio.reference.post `post`].) Request the strand to invoke the given handler and return immediately. 83086 83087 83088 template< 83089 typename ``[link boost_asio.reference.LegacyCompletionHandler LegacyCompletionHandler]``> 83090 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.io_context__strand.post.overload2 post]``( 83091 LegacyCompletionHandler && handler); 83092 `` [''''»''' [link boost_asio.reference.io_context__strand.post.overload2 more...]]`` 83093 83094 83095[section:overload1 io_context::strand::post (1 of 2 overloads)] 83096 83097 83098Request the strand to invoke the given function object. 83099 83100 83101 template< 83102 typename Function, 83103 typename Allocator> 83104 void post( 83105 Function && f, 83106 const Allocator & a) const; 83107 83108 83109This 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`]. 83110 83111 83112[heading Parameters] 83113 83114 83115[variablelist 83116 83117[[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: 83118`` 83119 void function(); 83120`` 83121]] 83122 83123[[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]] 83124 83125] 83126 83127 83128 83129 83130[endsect] 83131 83132 83133 83134[section:overload2 io_context::strand::post (2 of 2 overloads)] 83135 83136 83137(Deprecated: Use [link boost_asio.reference.post `post`].) Request the strand to invoke the given handler and return immediately. 83138 83139 83140 template< 83141 typename ``[link boost_asio.reference.LegacyCompletionHandler LegacyCompletionHandler]``> 83142 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` post( 83143 LegacyCompletionHandler && handler); 83144 83145 83146This 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. 83147 83148The 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. 83149 83150 83151[heading Parameters] 83152 83153 83154[variablelist 83155 83156[[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: 83157`` 83158 void handler(); 83159`` 83160]] 83161 83162] 83163 83164 83165 83166 83167[endsect] 83168 83169 83170[endsect] 83171 83172 83173[section:running_in_this_thread io_context::strand::running_in_this_thread] 83174 83175[indexterm2 boost_asio.indexterm.io_context__strand.running_in_this_thread..running_in_this_thread..io_context::strand] 83176Determine whether the strand is running in the current thread. 83177 83178 83179 bool running_in_this_thread() const; 83180 83181 83182 83183[heading Return Value] 83184 83185`true` if the current thread is executing a handler that was submitted to the strand using `post()`, `dispatch()` or `wrap()`. Otherwise returns `false`. 83186 83187 83188 83189 83190[endsect] 83191 83192 83193 83194[section:strand io_context::strand::strand] 83195 83196[indexterm2 boost_asio.indexterm.io_context__strand.strand..strand..io_context::strand] 83197Constructor. 83198 83199 83200 strand( 83201 boost::asio::io_context & io_context); 83202 83203 83204Constructs the strand. 83205 83206 83207[heading Parameters] 83208 83209 83210[variablelist 83211 83212[[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. ]] 83213 83214] 83215 83216 83217 83218 83219[endsect] 83220 83221 83222 83223[section:wrap io_context::strand::wrap] 83224 83225[indexterm2 boost_asio.indexterm.io_context__strand.wrap..wrap..io_context::strand] 83226(Deprecated: Use [link boost_asio.reference.bind_executor `bind_executor`].) Create a new handler that automatically dispatches the wrapped handler on the strand. 83227 83228 83229 template< 83230 typename ``[link boost_asio.reference.Handler Handler]``> 83231 unspecified wrap( 83232 Handler handler); 83233 83234 83235This 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. 83236 83237 83238[heading Parameters] 83239 83240 83241[variablelist 83242 83243[[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: 83244`` 83245 void handler(A1 a1, ... An an); 83246`` 83247]] 83248 83249] 83250 83251 83252[heading Return Value] 83253 83254A function object that, when invoked, passes the wrapped handler to the strand's dispatch function. Given a function object with the signature: 83255 83256 R f(A1 a1, ... An an); 83257 83258 83259If this function object is passed to the wrap function like so: 83260 83261 strand.wrap(f); 83262 83263 83264then the return value is a function object with the signature 83265 83266 void g(A1 a1, ... An an); 83267 83268 83269that, when invoked, executes code equivalent to: 83270 83271 strand.dispatch(boost::bind(f, a1, ... an)); 83272 83273 83274 83275 83276 83277 83278 83279[endsect] 83280 83281 83282 83283[section:_strand io_context::strand::~strand] 83284 83285[indexterm2 boost_asio.indexterm.io_context__strand._strand..~strand..io_context::strand] 83286Destructor. 83287 83288 83289 ~strand(); 83290 83291 83292Destroys a strand. 83293 83294Handlers posted through the strand that have not yet been invoked will still be dispatched in a way that meets the guarantee of non-concurrency. 83295 83296 83297[endsect] 83298 83299 83300 83301[endsect] 83302 83303[section:io_context__work io_context::work] 83304 83305[indexterm1 boost_asio.indexterm.io_context__work..io_context::work] 83306 83307 83308(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. 83309 83310 83311 class work 83312 83313 83314[heading Member Functions] 83315[table 83316 [[Name][Description]] 83317 83318 [ 83319 [[link boost_asio.reference.io_context__work.get_io_context [*get_io_context]]] 83320 [Get the io_context associated with the work. ] 83321 ] 83322 83323 [ 83324 [[link boost_asio.reference.io_context__work.work [*work]] [constructor]] 83325 [Constructor notifies the io_context that work is starting. 83326 [hr] 83327 Copy constructor notifies the io_context that work is starting. ] 83328 ] 83329 83330 [ 83331 [[link boost_asio.reference.io_context__work._work [*~work]] [destructor]] 83332 [Destructor notifies the io_context that the work is complete. ] 83333 ] 83334 83335] 83336 83337The 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. 83338 83339The work class is copy-constructible so that it may be used as a data member in a handler class. It is not assignable. 83340 83341[heading Requirements] 83342 83343['Header: ][^boost/asio/io_context.hpp] 83344 83345['Convenience header: ][^boost/asio.hpp] 83346 83347 83348[section:get_io_context io_context::work::get_io_context] 83349 83350[indexterm2 boost_asio.indexterm.io_context__work.get_io_context..get_io_context..io_context::work] 83351Get the [link boost_asio.reference.io_context `io_context`] associated with the work. 83352 83353 83354 boost::asio::io_context & get_io_context(); 83355 83356 83357 83358[endsect] 83359 83360 83361[section:work io_context::work::work] 83362 83363[indexterm2 boost_asio.indexterm.io_context__work.work..work..io_context::work] 83364Constructor notifies the [link boost_asio.reference.io_context `io_context`] that work is starting. 83365 83366 83367 explicit ``[link boost_asio.reference.io_context__work.work.overload1 work]``( 83368 boost::asio::io_context & io_context); 83369 `` [''''»''' [link boost_asio.reference.io_context__work.work.overload1 more...]]`` 83370 83371 83372Copy constructor notifies the [link boost_asio.reference.io_context `io_context`] that work is starting. 83373 83374 83375 ``[link boost_asio.reference.io_context__work.work.overload2 work]``( 83376 const work & other); 83377 `` [''''»''' [link boost_asio.reference.io_context__work.work.overload2 more...]]`` 83378 83379 83380[section:overload1 io_context::work::work (1 of 2 overloads)] 83381 83382 83383Constructor notifies the [link boost_asio.reference.io_context `io_context`] that work is starting. 83384 83385 83386 work( 83387 boost::asio::io_context & io_context); 83388 83389 83390The 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. 83391 83392 83393[endsect] 83394 83395 83396 83397[section:overload2 io_context::work::work (2 of 2 overloads)] 83398 83399 83400Copy constructor notifies the [link boost_asio.reference.io_context `io_context`] that work is starting. 83401 83402 83403 work( 83404 const work & other); 83405 83406 83407The 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. 83408 83409 83410[endsect] 83411 83412 83413[endsect] 83414 83415 83416[section:_work io_context::work::~work] 83417 83418[indexterm2 boost_asio.indexterm.io_context__work._work..~work..io_context::work] 83419Destructor notifies the [link boost_asio.reference.io_context `io_context`] that the work is complete. 83420 83421 83422 ~work(); 83423 83424 83425The 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. 83426 83427 83428[endsect] 83429 83430 83431 83432[endsect] 83433 83434 83435[section:io_service io_service] 83436 83437[indexterm1 boost_asio.indexterm.io_service..io_service] 83438Typedef for backwards compatibility. 83439 83440 83441 typedef io_context io_service; 83442 83443 83444[heading Types] 83445[table 83446 [[Name][Description]] 83447 83448 [ 83449 83450 [[link boost_asio.reference.io_context__basic_executor_type [*basic_executor_type]]] 83451 [Executor implementation type used to submit functions to an io_context. ] 83452 83453 ] 83454 83455 [ 83456 83457 [[link boost_asio.reference.io_context__service [*service]]] 83458 [Base class for all io_context services. ] 83459 83460 ] 83461 83462 [ 83463 83464 [[link boost_asio.reference.io_context__strand [*strand]]] 83465 [Provides serialised handler execution. ] 83466 83467 ] 83468 83469 [ 83470 83471 [[link boost_asio.reference.io_context__work [*work]]] 83472 [(Deprecated: Use executor_work_guard.) Class to inform the io_context when it has work to do. ] 83473 83474 ] 83475 83476 [ 83477 83478 [[link boost_asio.reference.io_context.count_type [*count_type]]] 83479 [The type used to count the number of handlers executed by the context. ] 83480 83481 ] 83482 83483 [ 83484 83485 [[link boost_asio.reference.io_context.executor_type [*executor_type]]] 83486 [Executor used to submit functions to an io_context. ] 83487 83488 ] 83489 83490 [ 83491 83492 [[link boost_asio.reference.io_context.fork_event [*fork_event]]] 83493 [Fork-related event notifications. ] 83494 83495 ] 83496 83497] 83498 83499[heading Member Functions] 83500[table 83501 [[Name][Description]] 83502 83503 [ 83504 [[link boost_asio.reference.io_context.dispatch [*dispatch]]] 83505 [(Deprecated: Use boost::asio::dispatch().) Request the io_context to invoke the given handler. ] 83506 ] 83507 83508 [ 83509 [[link boost_asio.reference.io_context.get_executor [*get_executor]]] 83510 [Obtains the executor associated with the io_context. ] 83511 ] 83512 83513 [ 83514 [[link boost_asio.reference.io_context.io_context [*io_context]] [constructor]] 83515 [Constructor. ] 83516 ] 83517 83518 [ 83519 [[link boost_asio.reference.io_context.notify_fork [*notify_fork]]] 83520 [Notify the execution_context of a fork-related event. ] 83521 ] 83522 83523 [ 83524 [[link boost_asio.reference.io_context.poll [*poll]]] 83525 [Run the io_context object's event processing loop to execute ready handlers. 83526 [hr] 83527 (Deprecated: Use non-error_code overload.) Run the io_context object's event processing loop to execute ready handlers. ] 83528 ] 83529 83530 [ 83531 [[link boost_asio.reference.io_context.poll_one [*poll_one]]] 83532 [Run the io_context object's event processing loop to execute one ready handler. 83533 [hr] 83534 (Deprecated: Use non-error_code overload.) Run the io_context object's event processing loop to execute one ready handler. ] 83535 ] 83536 83537 [ 83538 [[link boost_asio.reference.io_context.post [*post]]] 83539 [(Deprecated: Use boost::asio::post().) Request the io_context to invoke the given handler and return immediately. ] 83540 ] 83541 83542 [ 83543 [[link boost_asio.reference.io_context.reset [*reset]]] 83544 [(Deprecated: Use restart().) Reset the io_context in preparation for a subsequent run() invocation. ] 83545 ] 83546 83547 [ 83548 [[link boost_asio.reference.io_context.restart [*restart]]] 83549 [Restart the io_context in preparation for a subsequent run() invocation. ] 83550 ] 83551 83552 [ 83553 [[link boost_asio.reference.io_context.run [*run]]] 83554 [Run the io_context object's event processing loop. 83555 [hr] 83556 (Deprecated: Use non-error_code overload.) Run the io_context object's event processing loop. ] 83557 ] 83558 83559 [ 83560 [[link boost_asio.reference.io_context.run_for [*run_for]]] 83561 [Run the io_context object's event processing loop for a specified duration. ] 83562 ] 83563 83564 [ 83565 [[link boost_asio.reference.io_context.run_one [*run_one]]] 83566 [Run the io_context object's event processing loop to execute at most one handler. 83567 [hr] 83568 (Deprecated: Use non-error_code overlaod.) Run the io_context object's event processing loop to execute at most one handler. ] 83569 ] 83570 83571 [ 83572 [[link boost_asio.reference.io_context.run_one_for [*run_one_for]]] 83573 [Run the io_context object's event processing loop for a specified duration to execute at most one handler. ] 83574 ] 83575 83576 [ 83577 [[link boost_asio.reference.io_context.run_one_until [*run_one_until]]] 83578 [Run the io_context object's event processing loop until a specified time to execute at most one handler. ] 83579 ] 83580 83581 [ 83582 [[link boost_asio.reference.io_context.run_until [*run_until]]] 83583 [Run the io_context object's event processing loop until a specified time. ] 83584 ] 83585 83586 [ 83587 [[link boost_asio.reference.io_context.stop [*stop]]] 83588 [Stop the io_context object's event processing loop. ] 83589 ] 83590 83591 [ 83592 [[link boost_asio.reference.io_context.stopped [*stopped]]] 83593 [Determine whether the io_context object has been stopped. ] 83594 ] 83595 83596 [ 83597 [[link boost_asio.reference.io_context.wrap [*wrap]]] 83598 [(Deprecated: Use boost::asio::bind_executor().) Create a new handler that automatically dispatches the wrapped handler on the io_context. ] 83599 ] 83600 83601 [ 83602 [[link boost_asio.reference.io_context._io_context [*~io_context]] [destructor]] 83603 [Destructor. ] 83604 ] 83605 83606] 83607 83608[heading Protected Member Functions] 83609[table 83610 [[Name][Description]] 83611 83612 [ 83613 [[link boost_asio.reference.io_context.destroy [*destroy]]] 83614 [Destroys all services in the context. ] 83615 ] 83616 83617 [ 83618 [[link boost_asio.reference.io_context.shutdown [*shutdown]]] 83619 [Shuts down all services in the context. ] 83620 ] 83621 83622] 83623 83624[heading Friends] 83625[table 83626 [[Name][Description]] 83627 83628 [ 83629 [[link boost_asio.reference.io_context.add_service [*add_service]]] 83630 [(Deprecated: Use make_service().) Add a service object to the execution_context. ] 83631 ] 83632 83633 [ 83634 [[link boost_asio.reference.io_context.has_service [*has_service]]] 83635 [Determine if an execution_context contains a specified service type. ] 83636 ] 83637 83638 [ 83639 [[link boost_asio.reference.io_context.make_service [*make_service]]] 83640 [Creates a service object and adds it to the execution_context. ] 83641 ] 83642 83643 [ 83644 [[link boost_asio.reference.io_context.use_service [*use_service]]] 83645 [ 83646 [hr] 83647 Obtain the service object corresponding to the given type. ] 83648 ] 83649 83650] 83651 83652The [link boost_asio.reference.io_context `io_context`] class provides the core I/O functionality for users of the asynchronous I/O objects, including: 83653 83654 83655* `boost::asio::ip::tcp::socket` 83656 83657* `boost::asio::ip::tcp::acceptor` 83658 83659* `boost::asio::ip::udp::socket` 83660 83661* [link boost_asio.reference.deadline_timer `deadline_timer`]. 83662 83663The [link boost_asio.reference.io_context `io_context`] class also includes facilities intended for developers of custom asynchronous services. 83664 83665 83666[heading Thread Safety] 83667 83668['Distinct] ['objects:] Safe. 83669 83670['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. 83671 83672 83673 83674[heading Synchronous and asynchronous operations] 83675 83676 83677 83678Synchronous 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`]. 83679 83680 83681[heading Effect of exceptions thrown from handlers] 83682 83683 83684 83685If 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. 83686 83687After 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. 83688 83689For example: 83690 83691 83692 83693 boost::asio::io_context io_context; 83694 ... 83695 for (;;) 83696 { 83697 try 83698 { 83699 io_context.run(); 83700 break; // run() exited normally 83701 } 83702 catch (my_exception& e) 83703 { 83704 // Deal with exception as appropriate. 83705 } 83706 } 83707 83708 83709 83710 83711 83712[heading Submitting arbitrary tasks to the io_context] 83713 83714 83715 83716To 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. 83717 83718For example: 83719 83720 83721 83722 void my_task() 83723 { 83724 ... 83725 } 83726 83727 ... 83728 83729 boost::asio::io_context io_context; 83730 83731 // Submit a function to the io_context. 83732 boost::asio::post(io_context, my_task); 83733 83734 // Submit a lambda object to the io_context. 83735 boost::asio::post(io_context, 83736 []() 83737 { 83738 ... 83739 }); 83740 83741 // Run the io_context until it runs out of work. 83742 io_context.run(); 83743 83744 83745 83746 83747 83748[heading Stopping the io_context from running out of work] 83749 83750 83751 83752Some 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 executor that tracks work against the [link boost_asio.reference.io_context `io_context`]: 83753 83754 83755 83756 boost::asio::io_context io_context; 83757 auto work = boost::asio::require(io_context.get_executor(), 83758 boost::asio::execution::outstanding_work.tracked); 83759 ... 83760 83761 83762 83763 83764If using C++03, which lacks automatic variable type deduction, you may compute the return type of the require call: 83765 83766 83767 83768 boost::asio::io_context io_context; 83769 typename boost::asio::require_result< 83770 boost::asio::io_context::executor_type, 83771 boost::asio::exeution::outstanding_work_t::tracked_t> 83772 work = boost::asio::require(io_context.get_executor(), 83773 boost::asio::execution::outstanding_work.tracked); 83774 ... 83775 83776 83777 83778 83779or store the result in the type-erasing executor wrapper, [link boost_asio.reference.any_io_executor `any_io_executor`]: 83780 83781 83782 83783 boost::asio::io_context io_context; 83784 boost::asio::any_io_executor work 83785 = boost::asio::require(io_context.get_executor(), 83786 boost::asio::execution::outstanding_work.tracked); 83787 ... 83788 83789 83790 83791 83792To 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. 83793 83794Alternatively, if the application requires that all operations and handlers be allowed to finish normally, store the work-tracking executor in an [link boost_asio.reference.any_io_executor `any_io_executor`] object, so that it may be explicitly reset. 83795 83796 83797 83798 boost::asio::io_context io_context; 83799 boost::asio::any_io_executor work 83800 = boost::asio::require(io_context.get_executor(), 83801 boost::asio::execution::outstanding_work.tracked); 83802 ... 83803 work = boost::asio::any_io_executor(); // Allow run() to exit. 83804 83805 83806 83807 83808 83809[heading Requirements] 83810 83811['Header: ][^boost/asio/io_service.hpp] 83812 83813['Convenience header: ][^boost/asio.hpp] 83814 83815 83816[endsect] 83817 83818 83819[section:ip__address ip::address] 83820 83821[indexterm1 boost_asio.indexterm.ip__address..ip::address] 83822 83823 83824Implements version-independent IP addresses. 83825 83826 83827 class address 83828 83829 83830[heading Member Functions] 83831[table 83832 [[Name][Description]] 83833 83834 [ 83835 [[link boost_asio.reference.ip__address.address [*address]] [constructor]] 83836 [Default constructor. 83837 [hr] 83838 Construct an address from an IPv4 address. 83839 [hr] 83840 Construct an address from an IPv6 address. 83841 [hr] 83842 Copy constructor. ] 83843 ] 83844 83845 [ 83846 [[link boost_asio.reference.ip__address.from_string [*from_string]] [static]] 83847 [(Deprecated: Use make_address().) Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. ] 83848 ] 83849 83850 [ 83851 [[link boost_asio.reference.ip__address.is_loopback [*is_loopback]]] 83852 [Determine whether the address is a loopback address. ] 83853 ] 83854 83855 [ 83856 [[link boost_asio.reference.ip__address.is_multicast [*is_multicast]]] 83857 [Determine whether the address is a multicast address. ] 83858 ] 83859 83860 [ 83861 [[link boost_asio.reference.ip__address.is_unspecified [*is_unspecified]]] 83862 [Determine whether the address is unspecified. ] 83863 ] 83864 83865 [ 83866 [[link boost_asio.reference.ip__address.is_v4 [*is_v4]]] 83867 [Get whether the address is an IP version 4 address. ] 83868 ] 83869 83870 [ 83871 [[link boost_asio.reference.ip__address.is_v6 [*is_v6]]] 83872 [Get whether the address is an IP version 6 address. ] 83873 ] 83874 83875 [ 83876 [[link boost_asio.reference.ip__address.operator_eq_ [*operator=]]] 83877 [Assign from another address. 83878 [hr] 83879 Assign from an IPv4 address. 83880 [hr] 83881 Assign from an IPv6 address. ] 83882 ] 83883 83884 [ 83885 [[link boost_asio.reference.ip__address.to_string [*to_string]]] 83886 [Get the address as a string. 83887 [hr] 83888 (Deprecated: Use other overload.) Get the address as a string. ] 83889 ] 83890 83891 [ 83892 [[link boost_asio.reference.ip__address.to_v4 [*to_v4]]] 83893 [Get the address as an IP version 4 address. ] 83894 ] 83895 83896 [ 83897 [[link boost_asio.reference.ip__address.to_v6 [*to_v6]]] 83898 [Get the address as an IP version 6 address. ] 83899 ] 83900 83901] 83902 83903[heading Friends] 83904[table 83905 [[Name][Description]] 83906 83907 [ 83908 [[link boost_asio.reference.ip__address.operator_not__eq_ [*operator!=]]] 83909 [Compare two addresses for inequality. ] 83910 ] 83911 83912 [ 83913 [[link boost_asio.reference.ip__address.operator_lt_ [*operator<]]] 83914 [Compare addresses for ordering. ] 83915 ] 83916 83917 [ 83918 [[link boost_asio.reference.ip__address.operator_lt__eq_ [*operator<=]]] 83919 [Compare addresses for ordering. ] 83920 ] 83921 83922 [ 83923 [[link boost_asio.reference.ip__address.operator_eq__eq_ [*operator==]]] 83924 [Compare two addresses for equality. ] 83925 ] 83926 83927 [ 83928 [[link boost_asio.reference.ip__address.operator_gt_ [*operator>]]] 83929 [Compare addresses for ordering. ] 83930 ] 83931 83932 [ 83933 [[link boost_asio.reference.ip__address.operator_gt__eq_ [*operator>=]]] 83934 [Compare addresses for ordering. ] 83935 ] 83936 83937] 83938 83939[heading Related Functions] 83940[table 83941 [[Name][Description]] 83942 83943 [ 83944 [[link boost_asio.reference.ip__address.make_address [*make_address]]] 83945 [Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. ] 83946 ] 83947 83948 [ 83949 [[link boost_asio.reference.ip__address.operator_lt__lt_ [*operator<<]]] 83950 [Output an address as a string. ] 83951 ] 83952 83953] 83954 83955The [link boost_asio.reference.ip__address `ip::address`] class provides the ability to use either IP version 4 or version 6 addresses. 83956 83957 83958[heading Thread Safety] 83959 83960['Distinct] ['objects:] Safe. 83961 83962['Shared] ['objects:] Unsafe. 83963 83964 83965 83966[heading Requirements] 83967 83968['Header: ][^boost/asio/ip/address.hpp] 83969 83970['Convenience header: ][^boost/asio.hpp] 83971 83972[section:address ip::address::address] 83973 83974[indexterm2 boost_asio.indexterm.ip__address.address..address..ip::address] 83975Default constructor. 83976 83977 83978 ``[link boost_asio.reference.ip__address.address.overload1 address]``(); 83979 `` [''''»''' [link boost_asio.reference.ip__address.address.overload1 more...]]`` 83980 83981 83982Construct an address from an IPv4 address. 83983 83984 83985 ``[link boost_asio.reference.ip__address.address.overload2 address]``( 83986 const boost::asio::ip::address_v4 & ipv4_address); 83987 `` [''''»''' [link boost_asio.reference.ip__address.address.overload2 more...]]`` 83988 83989 83990Construct an address from an IPv6 address. 83991 83992 83993 ``[link boost_asio.reference.ip__address.address.overload3 address]``( 83994 const boost::asio::ip::address_v6 & ipv6_address); 83995 `` [''''»''' [link boost_asio.reference.ip__address.address.overload3 more...]]`` 83996 83997 83998Copy constructor. 83999 84000 84001 ``[link boost_asio.reference.ip__address.address.overload4 address]``( 84002 const address & other); 84003 `` [''''»''' [link boost_asio.reference.ip__address.address.overload4 more...]]`` 84004 84005 84006[section:overload1 ip::address::address (1 of 4 overloads)] 84007 84008 84009Default constructor. 84010 84011 84012 address(); 84013 84014 84015 84016[endsect] 84017 84018 84019 84020[section:overload2 ip::address::address (2 of 4 overloads)] 84021 84022 84023Construct an address from an IPv4 address. 84024 84025 84026 address( 84027 const boost::asio::ip::address_v4 & ipv4_address); 84028 84029 84030 84031[endsect] 84032 84033 84034 84035[section:overload3 ip::address::address (3 of 4 overloads)] 84036 84037 84038Construct an address from an IPv6 address. 84039 84040 84041 address( 84042 const boost::asio::ip::address_v6 & ipv6_address); 84043 84044 84045 84046[endsect] 84047 84048 84049 84050[section:overload4 ip::address::address (4 of 4 overloads)] 84051 84052 84053Copy constructor. 84054 84055 84056 address( 84057 const address & other); 84058 84059 84060 84061[endsect] 84062 84063 84064[endsect] 84065 84066[section:from_string ip::address::from_string] 84067 84068[indexterm2 boost_asio.indexterm.ip__address.from_string..from_string..ip::address] 84069(Deprecated: Use `make_address()`.) Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. 84070 84071 84072 static address ``[link boost_asio.reference.ip__address.from_string.overload1 from_string]``( 84073 const char * str); 84074 `` [''''»''' [link boost_asio.reference.ip__address.from_string.overload1 more...]]`` 84075 84076 static address ``[link boost_asio.reference.ip__address.from_string.overload2 from_string]``( 84077 const char * str, 84078 boost::system::error_code & ec); 84079 `` [''''»''' [link boost_asio.reference.ip__address.from_string.overload2 more...]]`` 84080 84081 static address ``[link boost_asio.reference.ip__address.from_string.overload3 from_string]``( 84082 const std::string & str); 84083 `` [''''»''' [link boost_asio.reference.ip__address.from_string.overload3 more...]]`` 84084 84085 static address ``[link boost_asio.reference.ip__address.from_string.overload4 from_string]``( 84086 const std::string & str, 84087 boost::system::error_code & ec); 84088 `` [''''»''' [link boost_asio.reference.ip__address.from_string.overload4 more...]]`` 84089 84090 84091[section:overload1 ip::address::from_string (1 of 4 overloads)] 84092 84093 84094(Deprecated: Use `make_address()`.) Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. 84095 84096 84097 static address from_string( 84098 const char * str); 84099 84100 84101 84102[endsect] 84103 84104 84105 84106[section:overload2 ip::address::from_string (2 of 4 overloads)] 84107 84108 84109(Deprecated: Use `make_address()`.) Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. 84110 84111 84112 static address from_string( 84113 const char * str, 84114 boost::system::error_code & ec); 84115 84116 84117 84118[endsect] 84119 84120 84121 84122[section:overload3 ip::address::from_string (3 of 4 overloads)] 84123 84124 84125(Deprecated: Use `make_address()`.) Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. 84126 84127 84128 static address from_string( 84129 const std::string & str); 84130 84131 84132 84133[endsect] 84134 84135 84136 84137[section:overload4 ip::address::from_string (4 of 4 overloads)] 84138 84139 84140(Deprecated: Use `make_address()`.) Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. 84141 84142 84143 static address from_string( 84144 const std::string & str, 84145 boost::system::error_code & ec); 84146 84147 84148 84149[endsect] 84150 84151 84152[endsect] 84153 84154 84155[section:is_loopback ip::address::is_loopback] 84156 84157[indexterm2 boost_asio.indexterm.ip__address.is_loopback..is_loopback..ip::address] 84158Determine whether the address is a loopback address. 84159 84160 84161 bool is_loopback() const; 84162 84163 84164 84165[endsect] 84166 84167 84168 84169[section:is_multicast ip::address::is_multicast] 84170 84171[indexterm2 boost_asio.indexterm.ip__address.is_multicast..is_multicast..ip::address] 84172Determine whether the address is a multicast address. 84173 84174 84175 bool is_multicast() const; 84176 84177 84178 84179[endsect] 84180 84181 84182 84183[section:is_unspecified ip::address::is_unspecified] 84184 84185[indexterm2 boost_asio.indexterm.ip__address.is_unspecified..is_unspecified..ip::address] 84186Determine whether the address is unspecified. 84187 84188 84189 bool is_unspecified() const; 84190 84191 84192 84193[endsect] 84194 84195 84196 84197[section:is_v4 ip::address::is_v4] 84198 84199[indexterm2 boost_asio.indexterm.ip__address.is_v4..is_v4..ip::address] 84200Get whether the address is an IP version 4 address. 84201 84202 84203 bool is_v4() const; 84204 84205 84206 84207[endsect] 84208 84209 84210 84211[section:is_v6 ip::address::is_v6] 84212 84213[indexterm2 boost_asio.indexterm.ip__address.is_v6..is_v6..ip::address] 84214Get whether the address is an IP version 6 address. 84215 84216 84217 bool is_v6() const; 84218 84219 84220 84221[endsect] 84222 84223 84224[section:make_address ip::address::make_address] 84225 84226[indexterm2 boost_asio.indexterm.ip__address.make_address..make_address..ip::address] 84227Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. 84228 84229 84230 address ``[link boost_asio.reference.ip__address.make_address.overload1 make_address]``( 84231 const char * str); 84232 `` [''''»''' [link boost_asio.reference.ip__address.make_address.overload1 more...]]`` 84233 84234 address ``[link boost_asio.reference.ip__address.make_address.overload2 make_address]``( 84235 const char * str, 84236 boost::system::error_code & ec); 84237 `` [''''»''' [link boost_asio.reference.ip__address.make_address.overload2 more...]]`` 84238 84239 address ``[link boost_asio.reference.ip__address.make_address.overload3 make_address]``( 84240 const std::string & str); 84241 `` [''''»''' [link boost_asio.reference.ip__address.make_address.overload3 more...]]`` 84242 84243 address ``[link boost_asio.reference.ip__address.make_address.overload4 make_address]``( 84244 const std::string & str, 84245 boost::system::error_code & ec); 84246 `` [''''»''' [link boost_asio.reference.ip__address.make_address.overload4 more...]]`` 84247 84248 address ``[link boost_asio.reference.ip__address.make_address.overload5 make_address]``( 84249 string_view str); 84250 `` [''''»''' [link boost_asio.reference.ip__address.make_address.overload5 more...]]`` 84251 84252 address ``[link boost_asio.reference.ip__address.make_address.overload6 make_address]``( 84253 string_view str, 84254 boost::system::error_code & ec); 84255 `` [''''»''' [link boost_asio.reference.ip__address.make_address.overload6 more...]]`` 84256 84257 84258[section:overload1 ip::address::make_address (1 of 6 overloads)] 84259 84260 84261Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. 84262 84263 84264 address make_address( 84265 const char * str); 84266 84267 84268 84269[endsect] 84270 84271 84272 84273[section:overload2 ip::address::make_address (2 of 6 overloads)] 84274 84275 84276Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. 84277 84278 84279 address make_address( 84280 const char * str, 84281 boost::system::error_code & ec); 84282 84283 84284 84285[endsect] 84286 84287 84288 84289[section:overload3 ip::address::make_address (3 of 6 overloads)] 84290 84291 84292Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. 84293 84294 84295 address make_address( 84296 const std::string & str); 84297 84298 84299 84300[endsect] 84301 84302 84303 84304[section:overload4 ip::address::make_address (4 of 6 overloads)] 84305 84306 84307Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. 84308 84309 84310 address make_address( 84311 const std::string & str, 84312 boost::system::error_code & ec); 84313 84314 84315 84316[endsect] 84317 84318 84319 84320[section:overload5 ip::address::make_address (5 of 6 overloads)] 84321 84322 84323Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. 84324 84325 84326 address make_address( 84327 string_view str); 84328 84329 84330 84331[endsect] 84332 84333 84334 84335[section:overload6 ip::address::make_address (6 of 6 overloads)] 84336 84337 84338Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. 84339 84340 84341 address make_address( 84342 string_view str, 84343 boost::system::error_code & ec); 84344 84345 84346 84347[endsect] 84348 84349 84350[endsect] 84351 84352 84353[section:operator_not__eq_ ip::address::operator!=] 84354 84355[indexterm2 boost_asio.indexterm.ip__address.operator_not__eq_..operator!=..ip::address] 84356Compare two addresses for inequality. 84357 84358 84359 friend bool operator!=( 84360 const address & a1, 84361 const address & a2); 84362 84363 84364[heading Requirements] 84365 84366['Header: ][^boost/asio/ip/address.hpp] 84367 84368['Convenience header: ][^boost/asio.hpp] 84369 84370 84371[endsect] 84372 84373 84374 84375[section:operator_lt_ ip::address::operator<] 84376 84377[indexterm2 boost_asio.indexterm.ip__address.operator_lt_..operator<..ip::address] 84378Compare addresses for ordering. 84379 84380 84381 friend bool operator<( 84382 const address & a1, 84383 const address & a2); 84384 84385 84386[heading Requirements] 84387 84388['Header: ][^boost/asio/ip/address.hpp] 84389 84390['Convenience header: ][^boost/asio.hpp] 84391 84392 84393[endsect] 84394 84395 84396 84397[section:operator_lt__lt_ ip::address::operator<<] 84398 84399[indexterm2 boost_asio.indexterm.ip__address.operator_lt__lt_..operator<<..ip::address] 84400Output an address as a string. 84401 84402 84403 template< 84404 typename Elem, 84405 typename Traits> 84406 std::basic_ostream< Elem, Traits > & operator<<( 84407 std::basic_ostream< Elem, Traits > & os, 84408 const address & addr); 84409 84410 84411Used to output a human-readable string for a specified address. 84412 84413 84414[heading Parameters] 84415 84416 84417[variablelist 84418 84419[[os][The output stream to which the string will be written.]] 84420 84421[[addr][The address to be written.]] 84422 84423] 84424 84425 84426[heading Return Value] 84427 84428The output stream. 84429 84430 84431 84432 84433[endsect] 84434 84435 84436 84437[section:operator_lt__eq_ ip::address::operator<=] 84438 84439[indexterm2 boost_asio.indexterm.ip__address.operator_lt__eq_..operator<=..ip::address] 84440Compare addresses for ordering. 84441 84442 84443 friend bool operator<=( 84444 const address & a1, 84445 const address & a2); 84446 84447 84448[heading Requirements] 84449 84450['Header: ][^boost/asio/ip/address.hpp] 84451 84452['Convenience header: ][^boost/asio.hpp] 84453 84454 84455[endsect] 84456 84457 84458[section:operator_eq_ ip::address::operator=] 84459 84460[indexterm2 boost_asio.indexterm.ip__address.operator_eq_..operator=..ip::address] 84461Assign from another address. 84462 84463 84464 address & ``[link boost_asio.reference.ip__address.operator_eq_.overload1 operator=]``( 84465 const address & other); 84466 `` [''''»''' [link boost_asio.reference.ip__address.operator_eq_.overload1 more...]]`` 84467 84468 84469Assign from an IPv4 address. 84470 84471 84472 address & ``[link boost_asio.reference.ip__address.operator_eq_.overload2 operator=]``( 84473 const boost::asio::ip::address_v4 & ipv4_address); 84474 `` [''''»''' [link boost_asio.reference.ip__address.operator_eq_.overload2 more...]]`` 84475 84476 84477Assign from an IPv6 address. 84478 84479 84480 address & ``[link boost_asio.reference.ip__address.operator_eq_.overload3 operator=]``( 84481 const boost::asio::ip::address_v6 & ipv6_address); 84482 `` [''''»''' [link boost_asio.reference.ip__address.operator_eq_.overload3 more...]]`` 84483 84484 84485[section:overload1 ip::address::operator= (1 of 3 overloads)] 84486 84487 84488Assign from another address. 84489 84490 84491 address & operator=( 84492 const address & other); 84493 84494 84495 84496[endsect] 84497 84498 84499 84500[section:overload2 ip::address::operator= (2 of 3 overloads)] 84501 84502 84503Assign from an IPv4 address. 84504 84505 84506 address & operator=( 84507 const boost::asio::ip::address_v4 & ipv4_address); 84508 84509 84510 84511[endsect] 84512 84513 84514 84515[section:overload3 ip::address::operator= (3 of 3 overloads)] 84516 84517 84518Assign from an IPv6 address. 84519 84520 84521 address & operator=( 84522 const boost::asio::ip::address_v6 & ipv6_address); 84523 84524 84525 84526[endsect] 84527 84528 84529[endsect] 84530 84531 84532[section:operator_eq__eq_ ip::address::operator==] 84533 84534[indexterm2 boost_asio.indexterm.ip__address.operator_eq__eq_..operator==..ip::address] 84535Compare two addresses for equality. 84536 84537 84538 friend bool operator==( 84539 const address & a1, 84540 const address & a2); 84541 84542 84543[heading Requirements] 84544 84545['Header: ][^boost/asio/ip/address.hpp] 84546 84547['Convenience header: ][^boost/asio.hpp] 84548 84549 84550[endsect] 84551 84552 84553 84554[section:operator_gt_ ip::address::operator>] 84555 84556[indexterm2 boost_asio.indexterm.ip__address.operator_gt_..operator>..ip::address] 84557Compare addresses for ordering. 84558 84559 84560 friend bool operator>( 84561 const address & a1, 84562 const address & a2); 84563 84564 84565[heading Requirements] 84566 84567['Header: ][^boost/asio/ip/address.hpp] 84568 84569['Convenience header: ][^boost/asio.hpp] 84570 84571 84572[endsect] 84573 84574 84575 84576[section:operator_gt__eq_ ip::address::operator>=] 84577 84578[indexterm2 boost_asio.indexterm.ip__address.operator_gt__eq_..operator>=..ip::address] 84579Compare addresses for ordering. 84580 84581 84582 friend bool operator>=( 84583 const address & a1, 84584 const address & a2); 84585 84586 84587[heading Requirements] 84588 84589['Header: ][^boost/asio/ip/address.hpp] 84590 84591['Convenience header: ][^boost/asio.hpp] 84592 84593 84594[endsect] 84595 84596 84597[section:to_string ip::address::to_string] 84598 84599[indexterm2 boost_asio.indexterm.ip__address.to_string..to_string..ip::address] 84600Get the address as a string. 84601 84602 84603 std::string ``[link boost_asio.reference.ip__address.to_string.overload1 to_string]``() const; 84604 `` [''''»''' [link boost_asio.reference.ip__address.to_string.overload1 more...]]`` 84605 84606 84607(Deprecated: Use other overload.) Get the address as a string. 84608 84609 84610 std::string ``[link boost_asio.reference.ip__address.to_string.overload2 to_string]``( 84611 boost::system::error_code & ec) const; 84612 `` [''''»''' [link boost_asio.reference.ip__address.to_string.overload2 more...]]`` 84613 84614 84615[section:overload1 ip::address::to_string (1 of 2 overloads)] 84616 84617 84618Get the address as a string. 84619 84620 84621 std::string to_string() const; 84622 84623 84624 84625[endsect] 84626 84627 84628 84629[section:overload2 ip::address::to_string (2 of 2 overloads)] 84630 84631 84632(Deprecated: Use other overload.) Get the address as a string. 84633 84634 84635 std::string to_string( 84636 boost::system::error_code & ec) const; 84637 84638 84639 84640[endsect] 84641 84642 84643[endsect] 84644 84645 84646[section:to_v4 ip::address::to_v4] 84647 84648[indexterm2 boost_asio.indexterm.ip__address.to_v4..to_v4..ip::address] 84649Get the address as an IP version 4 address. 84650 84651 84652 boost::asio::ip::address_v4 to_v4() const; 84653 84654 84655 84656[endsect] 84657 84658 84659 84660[section:to_v6 ip::address::to_v6] 84661 84662[indexterm2 boost_asio.indexterm.ip__address.to_v6..to_v6..ip::address] 84663Get the address as an IP version 6 address. 84664 84665 84666 boost::asio::ip::address_v6 to_v6() const; 84667 84668 84669 84670[endsect] 84671 84672 84673 84674[endsect] 84675 84676[section:ip__address_v4 ip::address_v4] 84677 84678[indexterm1 boost_asio.indexterm.ip__address_v4..ip::address_v4] 84679 84680 84681Implements IP version 4 style addresses. 84682 84683 84684 class address_v4 84685 84686 84687[heading Types] 84688[table 84689 [[Name][Description]] 84690 84691 [ 84692 84693 [[link boost_asio.reference.ip__address_v4.bytes_type [*bytes_type]]] 84694 [The type used to represent an address as an array of bytes. ] 84695 84696 ] 84697 84698 [ 84699 84700 [[link boost_asio.reference.ip__address_v4.uint_type [*uint_type]]] 84701 [The type used to represent an address as an unsigned integer. ] 84702 84703 ] 84704 84705] 84706 84707[heading Member Functions] 84708[table 84709 [[Name][Description]] 84710 84711 [ 84712 [[link boost_asio.reference.ip__address_v4.address_v4 [*address_v4]] [constructor]] 84713 [Default constructor. 84714 [hr] 84715 Construct an address from raw bytes. 84716 [hr] 84717 Construct an address from an unsigned integer in host byte order. 84718 [hr] 84719 Copy constructor. ] 84720 ] 84721 84722 [ 84723 [[link boost_asio.reference.ip__address_v4.any [*any]] [static]] 84724 [Obtain an address object that represents any address. ] 84725 ] 84726 84727 [ 84728 [[link boost_asio.reference.ip__address_v4.broadcast [*broadcast]] [static]] 84729 [Obtain an address object that represents the broadcast address. 84730 [hr] 84731 (Deprecated: Use network_v4 class.) Obtain an address object that represents the broadcast address that corresponds to the specified address and netmask. ] 84732 ] 84733 84734 [ 84735 [[link boost_asio.reference.ip__address_v4.from_string [*from_string]] [static]] 84736 [(Deprecated: Use make_address_v4().) Create an address from an IP address string in dotted decimal form. ] 84737 ] 84738 84739 [ 84740 [[link boost_asio.reference.ip__address_v4.is_class_a [*is_class_a]]] 84741 [(Deprecated: Use network_v4 class.) Determine whether the address is a class A address. ] 84742 ] 84743 84744 [ 84745 [[link boost_asio.reference.ip__address_v4.is_class_b [*is_class_b]]] 84746 [(Deprecated: Use network_v4 class.) Determine whether the address is a class B address. ] 84747 ] 84748 84749 [ 84750 [[link boost_asio.reference.ip__address_v4.is_class_c [*is_class_c]]] 84751 [(Deprecated: Use network_v4 class.) Determine whether the address is a class C address. ] 84752 ] 84753 84754 [ 84755 [[link boost_asio.reference.ip__address_v4.is_loopback [*is_loopback]]] 84756 [Determine whether the address is a loopback address. ] 84757 ] 84758 84759 [ 84760 [[link boost_asio.reference.ip__address_v4.is_multicast [*is_multicast]]] 84761 [Determine whether the address is a multicast address. ] 84762 ] 84763 84764 [ 84765 [[link boost_asio.reference.ip__address_v4.is_unspecified [*is_unspecified]]] 84766 [Determine whether the address is unspecified. ] 84767 ] 84768 84769 [ 84770 [[link boost_asio.reference.ip__address_v4.loopback [*loopback]] [static]] 84771 [Obtain an address object that represents the loopback address. ] 84772 ] 84773 84774 [ 84775 [[link boost_asio.reference.ip__address_v4.netmask [*netmask]] [static]] 84776 [(Deprecated: Use network_v4 class.) Obtain the netmask that corresponds to the address, based on its address class. ] 84777 ] 84778 84779 [ 84780 [[link boost_asio.reference.ip__address_v4.operator_eq_ [*operator=]]] 84781 [Assign from another address. ] 84782 ] 84783 84784 [ 84785 [[link boost_asio.reference.ip__address_v4.to_bytes [*to_bytes]]] 84786 [Get the address in bytes, in network byte order. ] 84787 ] 84788 84789 [ 84790 [[link boost_asio.reference.ip__address_v4.to_string [*to_string]]] 84791 [Get the address as a string in dotted decimal format. 84792 [hr] 84793 (Deprecated: Use other overload.) Get the address as a string in dotted decimal format. ] 84794 ] 84795 84796 [ 84797 [[link boost_asio.reference.ip__address_v4.to_uint [*to_uint]]] 84798 [Get the address as an unsigned integer in host byte order. ] 84799 ] 84800 84801 [ 84802 [[link boost_asio.reference.ip__address_v4.to_ulong [*to_ulong]]] 84803 [Get the address as an unsigned long in host byte order. ] 84804 ] 84805 84806] 84807 84808[heading Friends] 84809[table 84810 [[Name][Description]] 84811 84812 [ 84813 [[link boost_asio.reference.ip__address_v4.operator_not__eq_ [*operator!=]]] 84814 [Compare two addresses for inequality. ] 84815 ] 84816 84817 [ 84818 [[link boost_asio.reference.ip__address_v4.operator_lt_ [*operator<]]] 84819 [Compare addresses for ordering. ] 84820 ] 84821 84822 [ 84823 [[link boost_asio.reference.ip__address_v4.operator_lt__eq_ [*operator<=]]] 84824 [Compare addresses for ordering. ] 84825 ] 84826 84827 [ 84828 [[link boost_asio.reference.ip__address_v4.operator_eq__eq_ [*operator==]]] 84829 [Compare two addresses for equality. ] 84830 ] 84831 84832 [ 84833 [[link boost_asio.reference.ip__address_v4.operator_gt_ [*operator>]]] 84834 [Compare addresses for ordering. ] 84835 ] 84836 84837 [ 84838 [[link boost_asio.reference.ip__address_v4.operator_gt__eq_ [*operator>=]]] 84839 [Compare addresses for ordering. ] 84840 ] 84841 84842] 84843 84844[heading Related Functions] 84845[table 84846 [[Name][Description]] 84847 84848 [ 84849 [[link boost_asio.reference.ip__address_v4.make_address_v4 [*make_address_v4]]] 84850 [Create an IPv4 address from raw bytes in network order. 84851 84852 Create an IPv4 address from an unsigned integer in host byte order. 84853 84854 Create an IPv4 address from an IP address string in dotted decimal form. 84855 84856 Create an IPv4 address from a IPv4-mapped IPv6 address. ] 84857 ] 84858 84859 [ 84860 [[link boost_asio.reference.ip__address_v4.make_network_v4 [*make_network_v4]]] 84861 [Create an IPv4 network from an address and prefix length. 84862 84863 Create an IPv4 network from an address and netmask. ] 84864 ] 84865 84866 [ 84867 [[link boost_asio.reference.ip__address_v4.operator_lt__lt_ [*operator<<]]] 84868 [Output an address as a string. 84869 84870 Output a network as a string. ] 84871 ] 84872 84873] 84874 84875The [link boost_asio.reference.ip__address_v4 `ip::address_v4`] class provides the ability to use and manipulate IP version 4 addresses. 84876 84877 84878[heading Thread Safety] 84879 84880['Distinct] ['objects:] Safe. 84881 84882['Shared] ['objects:] Unsafe. 84883 84884 84885 84886[heading Requirements] 84887 84888['Header: ][^boost/asio/ip/address_v4.hpp] 84889 84890['Convenience header: ][^boost/asio.hpp] 84891 84892[section:address_v4 ip::address_v4::address_v4] 84893 84894[indexterm2 boost_asio.indexterm.ip__address_v4.address_v4..address_v4..ip::address_v4] 84895Default constructor. 84896 84897 84898 ``[link boost_asio.reference.ip__address_v4.address_v4.overload1 address_v4]``(); 84899 `` [''''»''' [link boost_asio.reference.ip__address_v4.address_v4.overload1 more...]]`` 84900 84901 84902Construct an address from raw bytes. 84903 84904 84905 explicit ``[link boost_asio.reference.ip__address_v4.address_v4.overload2 address_v4]``( 84906 const bytes_type & bytes); 84907 `` [''''»''' [link boost_asio.reference.ip__address_v4.address_v4.overload2 more...]]`` 84908 84909 84910Construct an address from an unsigned integer in host byte order. 84911 84912 84913 explicit ``[link boost_asio.reference.ip__address_v4.address_v4.overload3 address_v4]``( 84914 uint_type addr); 84915 `` [''''»''' [link boost_asio.reference.ip__address_v4.address_v4.overload3 more...]]`` 84916 84917 84918Copy constructor. 84919 84920 84921 ``[link boost_asio.reference.ip__address_v4.address_v4.overload4 address_v4]``( 84922 const address_v4 & other); 84923 `` [''''»''' [link boost_asio.reference.ip__address_v4.address_v4.overload4 more...]]`` 84924 84925 84926[section:overload1 ip::address_v4::address_v4 (1 of 4 overloads)] 84927 84928 84929Default constructor. 84930 84931 84932 address_v4(); 84933 84934 84935 84936[endsect] 84937 84938 84939 84940[section:overload2 ip::address_v4::address_v4 (2 of 4 overloads)] 84941 84942 84943Construct an address from raw bytes. 84944 84945 84946 address_v4( 84947 const bytes_type & bytes); 84948 84949 84950 84951[endsect] 84952 84953 84954 84955[section:overload3 ip::address_v4::address_v4 (3 of 4 overloads)] 84956 84957 84958Construct an address from an unsigned integer in host byte order. 84959 84960 84961 address_v4( 84962 uint_type addr); 84963 84964 84965 84966[endsect] 84967 84968 84969 84970[section:overload4 ip::address_v4::address_v4 (4 of 4 overloads)] 84971 84972 84973Copy constructor. 84974 84975 84976 address_v4( 84977 const address_v4 & other); 84978 84979 84980 84981[endsect] 84982 84983 84984[endsect] 84985 84986 84987[section:any ip::address_v4::any] 84988 84989[indexterm2 boost_asio.indexterm.ip__address_v4.any..any..ip::address_v4] 84990Obtain an address object that represents any address. 84991 84992 84993 static address_v4 any(); 84994 84995 84996 84997[endsect] 84998 84999 85000[section:broadcast ip::address_v4::broadcast] 85001 85002[indexterm2 boost_asio.indexterm.ip__address_v4.broadcast..broadcast..ip::address_v4] 85003Obtain an address object that represents the broadcast address. 85004 85005 85006 static address_v4 ``[link boost_asio.reference.ip__address_v4.broadcast.overload1 broadcast]``(); 85007 `` [''''»''' [link boost_asio.reference.ip__address_v4.broadcast.overload1 more...]]`` 85008 85009 85010(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. 85011 85012 85013 static address_v4 ``[link boost_asio.reference.ip__address_v4.broadcast.overload2 broadcast]``( 85014 const address_v4 & addr, 85015 const address_v4 & mask); 85016 `` [''''»''' [link boost_asio.reference.ip__address_v4.broadcast.overload2 more...]]`` 85017 85018 85019[section:overload1 ip::address_v4::broadcast (1 of 2 overloads)] 85020 85021 85022Obtain an address object that represents the broadcast address. 85023 85024 85025 static address_v4 broadcast(); 85026 85027 85028 85029[endsect] 85030 85031 85032 85033[section:overload2 ip::address_v4::broadcast (2 of 2 overloads)] 85034 85035 85036(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. 85037 85038 85039 static address_v4 broadcast( 85040 const address_v4 & addr, 85041 const address_v4 & mask); 85042 85043 85044 85045[endsect] 85046 85047 85048[endsect] 85049 85050 85051[section:bytes_type ip::address_v4::bytes_type] 85052 85053[indexterm2 boost_asio.indexterm.ip__address_v4.bytes_type..bytes_type..ip::address_v4] 85054The type used to represent an address as an array of bytes. 85055 85056 85057 typedef array< unsigned char, 4 > bytes_type; 85058 85059 85060 85061 85062[heading Remarks] 85063 85064This type is defined in terms of the C++0x template `std::array` when it is available. Otherwise, it uses `boost:array`. 85065 85066 85067 85068[heading Requirements] 85069 85070['Header: ][^boost/asio/ip/address_v4.hpp] 85071 85072['Convenience header: ][^boost/asio.hpp] 85073 85074 85075[endsect] 85076 85077 85078[section:from_string ip::address_v4::from_string] 85079 85080[indexterm2 boost_asio.indexterm.ip__address_v4.from_string..from_string..ip::address_v4] 85081(Deprecated: Use `make_address_v4()`.) Create an address from an IP address string in dotted decimal form. 85082 85083 85084 static address_v4 ``[link boost_asio.reference.ip__address_v4.from_string.overload1 from_string]``( 85085 const char * str); 85086 `` [''''»''' [link boost_asio.reference.ip__address_v4.from_string.overload1 more...]]`` 85087 85088 static address_v4 ``[link boost_asio.reference.ip__address_v4.from_string.overload2 from_string]``( 85089 const char * str, 85090 boost::system::error_code & ec); 85091 `` [''''»''' [link boost_asio.reference.ip__address_v4.from_string.overload2 more...]]`` 85092 85093 static address_v4 ``[link boost_asio.reference.ip__address_v4.from_string.overload3 from_string]``( 85094 const std::string & str); 85095 `` [''''»''' [link boost_asio.reference.ip__address_v4.from_string.overload3 more...]]`` 85096 85097 static address_v4 ``[link boost_asio.reference.ip__address_v4.from_string.overload4 from_string]``( 85098 const std::string & str, 85099 boost::system::error_code & ec); 85100 `` [''''»''' [link boost_asio.reference.ip__address_v4.from_string.overload4 more...]]`` 85101 85102 85103[section:overload1 ip::address_v4::from_string (1 of 4 overloads)] 85104 85105 85106(Deprecated: Use `make_address_v4()`.) Create an address from an IP address string in dotted decimal form. 85107 85108 85109 static address_v4 from_string( 85110 const char * str); 85111 85112 85113 85114[endsect] 85115 85116 85117 85118[section:overload2 ip::address_v4::from_string (2 of 4 overloads)] 85119 85120 85121(Deprecated: Use `make_address_v4()`.) Create an address from an IP address string in dotted decimal form. 85122 85123 85124 static address_v4 from_string( 85125 const char * str, 85126 boost::system::error_code & ec); 85127 85128 85129 85130[endsect] 85131 85132 85133 85134[section:overload3 ip::address_v4::from_string (3 of 4 overloads)] 85135 85136 85137(Deprecated: Use `make_address_v4()`.) Create an address from an IP address string in dotted decimal form. 85138 85139 85140 static address_v4 from_string( 85141 const std::string & str); 85142 85143 85144 85145[endsect] 85146 85147 85148 85149[section:overload4 ip::address_v4::from_string (4 of 4 overloads)] 85150 85151 85152(Deprecated: Use `make_address_v4()`.) Create an address from an IP address string in dotted decimal form. 85153 85154 85155 static address_v4 from_string( 85156 const std::string & str, 85157 boost::system::error_code & ec); 85158 85159 85160 85161[endsect] 85162 85163 85164[endsect] 85165 85166 85167[section:is_class_a ip::address_v4::is_class_a] 85168 85169[indexterm2 boost_asio.indexterm.ip__address_v4.is_class_a..is_class_a..ip::address_v4] 85170(Deprecated: Use [link boost_asio.reference.ip__network_v4 `ip::network_v4`] class.) Determine whether the address is a class A address. 85171 85172 85173 bool is_class_a() const; 85174 85175 85176 85177[endsect] 85178 85179 85180 85181[section:is_class_b ip::address_v4::is_class_b] 85182 85183[indexterm2 boost_asio.indexterm.ip__address_v4.is_class_b..is_class_b..ip::address_v4] 85184(Deprecated: Use [link boost_asio.reference.ip__network_v4 `ip::network_v4`] class.) Determine whether the address is a class B address. 85185 85186 85187 bool is_class_b() const; 85188 85189 85190 85191[endsect] 85192 85193 85194 85195[section:is_class_c ip::address_v4::is_class_c] 85196 85197[indexterm2 boost_asio.indexterm.ip__address_v4.is_class_c..is_class_c..ip::address_v4] 85198(Deprecated: Use [link boost_asio.reference.ip__network_v4 `ip::network_v4`] class.) Determine whether the address is a class C address. 85199 85200 85201 bool is_class_c() const; 85202 85203 85204 85205[endsect] 85206 85207 85208 85209[section:is_loopback ip::address_v4::is_loopback] 85210 85211[indexterm2 boost_asio.indexterm.ip__address_v4.is_loopback..is_loopback..ip::address_v4] 85212Determine whether the address is a loopback address. 85213 85214 85215 bool is_loopback() const; 85216 85217 85218 85219[endsect] 85220 85221 85222 85223[section:is_multicast ip::address_v4::is_multicast] 85224 85225[indexterm2 boost_asio.indexterm.ip__address_v4.is_multicast..is_multicast..ip::address_v4] 85226Determine whether the address is a multicast address. 85227 85228 85229 bool is_multicast() const; 85230 85231 85232 85233[endsect] 85234 85235 85236 85237[section:is_unspecified ip::address_v4::is_unspecified] 85238 85239[indexterm2 boost_asio.indexterm.ip__address_v4.is_unspecified..is_unspecified..ip::address_v4] 85240Determine whether the address is unspecified. 85241 85242 85243 bool is_unspecified() const; 85244 85245 85246 85247[endsect] 85248 85249 85250 85251[section:loopback ip::address_v4::loopback] 85252 85253[indexterm2 boost_asio.indexterm.ip__address_v4.loopback..loopback..ip::address_v4] 85254Obtain an address object that represents the loopback address. 85255 85256 85257 static address_v4 loopback(); 85258 85259 85260 85261[endsect] 85262 85263 85264[section:make_address_v4 ip::address_v4::make_address_v4] 85265 85266[indexterm2 boost_asio.indexterm.ip__address_v4.make_address_v4..make_address_v4..ip::address_v4] 85267Create an IPv4 address from raw bytes in network order. 85268 85269 85270 address_v4 ``[link boost_asio.reference.ip__address_v4.make_address_v4.overload1 make_address_v4]``( 85271 const address_v4::bytes_type & bytes); 85272 `` [''''»''' [link boost_asio.reference.ip__address_v4.make_address_v4.overload1 more...]]`` 85273 85274 85275Create an IPv4 address from an unsigned integer in host byte order. 85276 85277 85278 address_v4 ``[link boost_asio.reference.ip__address_v4.make_address_v4.overload2 make_address_v4]``( 85279 address_v4::uint_type addr); 85280 `` [''''»''' [link boost_asio.reference.ip__address_v4.make_address_v4.overload2 more...]]`` 85281 85282 85283Create an IPv4 address from an IP address string in dotted decimal form. 85284 85285 85286 address_v4 ``[link boost_asio.reference.ip__address_v4.make_address_v4.overload3 make_address_v4]``( 85287 const char * str); 85288 `` [''''»''' [link boost_asio.reference.ip__address_v4.make_address_v4.overload3 more...]]`` 85289 85290 address_v4 ``[link boost_asio.reference.ip__address_v4.make_address_v4.overload4 make_address_v4]``( 85291 const char * str, 85292 boost::system::error_code & ec); 85293 `` [''''»''' [link boost_asio.reference.ip__address_v4.make_address_v4.overload4 more...]]`` 85294 85295 address_v4 ``[link boost_asio.reference.ip__address_v4.make_address_v4.overload5 make_address_v4]``( 85296 const std::string & str); 85297 `` [''''»''' [link boost_asio.reference.ip__address_v4.make_address_v4.overload5 more...]]`` 85298 85299 address_v4 ``[link boost_asio.reference.ip__address_v4.make_address_v4.overload6 make_address_v4]``( 85300 const std::string & str, 85301 boost::system::error_code & ec); 85302 `` [''''»''' [link boost_asio.reference.ip__address_v4.make_address_v4.overload6 more...]]`` 85303 85304 address_v4 ``[link boost_asio.reference.ip__address_v4.make_address_v4.overload7 make_address_v4]``( 85305 string_view str); 85306 `` [''''»''' [link boost_asio.reference.ip__address_v4.make_address_v4.overload7 more...]]`` 85307 85308 address_v4 ``[link boost_asio.reference.ip__address_v4.make_address_v4.overload8 make_address_v4]``( 85309 string_view str, 85310 boost::system::error_code & ec); 85311 `` [''''»''' [link boost_asio.reference.ip__address_v4.make_address_v4.overload8 more...]]`` 85312 85313 85314Create an IPv4 address from a IPv4-mapped IPv6 address. 85315 85316 85317 address_v4 ``[link boost_asio.reference.ip__address_v4.make_address_v4.overload9 make_address_v4]``( 85318 v4_mapped_t , 85319 const address_v6 & v6_addr); 85320 `` [''''»''' [link boost_asio.reference.ip__address_v4.make_address_v4.overload9 more...]]`` 85321 85322 85323[section:overload1 ip::address_v4::make_address_v4 (1 of 9 overloads)] 85324 85325 85326Create an IPv4 address from raw bytes in network order. 85327 85328 85329 address_v4 make_address_v4( 85330 const address_v4::bytes_type & bytes); 85331 85332 85333 85334[endsect] 85335 85336 85337 85338[section:overload2 ip::address_v4::make_address_v4 (2 of 9 overloads)] 85339 85340 85341Create an IPv4 address from an unsigned integer in host byte order. 85342 85343 85344 address_v4 make_address_v4( 85345 address_v4::uint_type addr); 85346 85347 85348 85349[endsect] 85350 85351 85352 85353[section:overload3 ip::address_v4::make_address_v4 (3 of 9 overloads)] 85354 85355 85356Create an IPv4 address from an IP address string in dotted decimal form. 85357 85358 85359 address_v4 make_address_v4( 85360 const char * str); 85361 85362 85363 85364[endsect] 85365 85366 85367 85368[section:overload4 ip::address_v4::make_address_v4 (4 of 9 overloads)] 85369 85370 85371Create an IPv4 address from an IP address string in dotted decimal form. 85372 85373 85374 address_v4 make_address_v4( 85375 const char * str, 85376 boost::system::error_code & ec); 85377 85378 85379 85380[endsect] 85381 85382 85383 85384[section:overload5 ip::address_v4::make_address_v4 (5 of 9 overloads)] 85385 85386 85387Create an IPv4 address from an IP address string in dotted decimal form. 85388 85389 85390 address_v4 make_address_v4( 85391 const std::string & str); 85392 85393 85394 85395[endsect] 85396 85397 85398 85399[section:overload6 ip::address_v4::make_address_v4 (6 of 9 overloads)] 85400 85401 85402Create an IPv4 address from an IP address string in dotted decimal form. 85403 85404 85405 address_v4 make_address_v4( 85406 const std::string & str, 85407 boost::system::error_code & ec); 85408 85409 85410 85411[endsect] 85412 85413 85414 85415[section:overload7 ip::address_v4::make_address_v4 (7 of 9 overloads)] 85416 85417 85418Create an IPv4 address from an IP address string in dotted decimal form. 85419 85420 85421 address_v4 make_address_v4( 85422 string_view str); 85423 85424 85425 85426[endsect] 85427 85428 85429 85430[section:overload8 ip::address_v4::make_address_v4 (8 of 9 overloads)] 85431 85432 85433Create an IPv4 address from an IP address string in dotted decimal form. 85434 85435 85436 address_v4 make_address_v4( 85437 string_view str, 85438 boost::system::error_code & ec); 85439 85440 85441 85442[endsect] 85443 85444 85445 85446[section:overload9 ip::address_v4::make_address_v4 (9 of 9 overloads)] 85447 85448 85449Create an IPv4 address from a IPv4-mapped IPv6 address. 85450 85451 85452 address_v4 make_address_v4( 85453 v4_mapped_t , 85454 const address_v6 & v6_addr); 85455 85456 85457 85458[endsect] 85459 85460 85461[endsect] 85462 85463[section:make_network_v4 ip::address_v4::make_network_v4] 85464 85465[indexterm2 boost_asio.indexterm.ip__address_v4.make_network_v4..make_network_v4..ip::address_v4] 85466Create an IPv4 network from an address and prefix length. 85467 85468 85469 network_v4 ``[link boost_asio.reference.ip__address_v4.make_network_v4.overload1 make_network_v4]``( 85470 const address_v4 & addr, 85471 unsigned short prefix_len); 85472 `` [''''»''' [link boost_asio.reference.ip__address_v4.make_network_v4.overload1 more...]]`` 85473 85474 85475Create an IPv4 network from an address and netmask. 85476 85477 85478 network_v4 ``[link boost_asio.reference.ip__address_v4.make_network_v4.overload2 make_network_v4]``( 85479 const address_v4 & addr, 85480 const address_v4 & mask); 85481 `` [''''»''' [link boost_asio.reference.ip__address_v4.make_network_v4.overload2 more...]]`` 85482 85483 85484[section:overload1 ip::address_v4::make_network_v4 (1 of 2 overloads)] 85485 85486 85487Create an IPv4 network from an address and prefix length. 85488 85489 85490 network_v4 make_network_v4( 85491 const address_v4 & addr, 85492 unsigned short prefix_len); 85493 85494 85495 85496[endsect] 85497 85498 85499 85500[section:overload2 ip::address_v4::make_network_v4 (2 of 2 overloads)] 85501 85502 85503Create an IPv4 network from an address and netmask. 85504 85505 85506 network_v4 make_network_v4( 85507 const address_v4 & addr, 85508 const address_v4 & mask); 85509 85510 85511 85512[endsect] 85513 85514 85515[endsect] 85516 85517 85518[section:netmask ip::address_v4::netmask] 85519 85520[indexterm2 boost_asio.indexterm.ip__address_v4.netmask..netmask..ip::address_v4] 85521(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. 85522 85523 85524 static address_v4 netmask( 85525 const address_v4 & addr); 85526 85527 85528 85529[endsect] 85530 85531 85532 85533[section:operator_not__eq_ ip::address_v4::operator!=] 85534 85535[indexterm2 boost_asio.indexterm.ip__address_v4.operator_not__eq_..operator!=..ip::address_v4] 85536Compare two addresses for inequality. 85537 85538 85539 friend bool operator!=( 85540 const address_v4 & a1, 85541 const address_v4 & a2); 85542 85543 85544[heading Requirements] 85545 85546['Header: ][^boost/asio/ip/address_v4.hpp] 85547 85548['Convenience header: ][^boost/asio.hpp] 85549 85550 85551[endsect] 85552 85553 85554 85555[section:operator_lt_ ip::address_v4::operator<] 85556 85557[indexterm2 boost_asio.indexterm.ip__address_v4.operator_lt_..operator<..ip::address_v4] 85558Compare addresses for ordering. 85559 85560 85561 friend bool operator<( 85562 const address_v4 & a1, 85563 const address_v4 & a2); 85564 85565 85566[heading Requirements] 85567 85568['Header: ][^boost/asio/ip/address_v4.hpp] 85569 85570['Convenience header: ][^boost/asio.hpp] 85571 85572 85573[endsect] 85574 85575 85576[section:operator_lt__lt_ ip::address_v4::operator<<] 85577 85578[indexterm2 boost_asio.indexterm.ip__address_v4.operator_lt__lt_..operator<<..ip::address_v4] 85579Output an address as a string. 85580 85581 85582 template< 85583 typename Elem, 85584 typename Traits> 85585 std::basic_ostream< Elem, Traits > & ``[link boost_asio.reference.ip__address_v4.operator_lt__lt_.overload1 operator<<]``( 85586 std::basic_ostream< Elem, Traits > & os, 85587 const address_v4 & addr); 85588 `` [''''»''' [link boost_asio.reference.ip__address_v4.operator_lt__lt_.overload1 more...]]`` 85589 85590 85591Output a network as a string. 85592 85593 85594 template< 85595 typename Elem, 85596 typename Traits> 85597 std::basic_ostream< Elem, Traits > & ``[link boost_asio.reference.ip__address_v4.operator_lt__lt_.overload2 operator<<]``( 85598 std::basic_ostream< Elem, Traits > & os, 85599 const network_v4 & net); 85600 `` [''''»''' [link boost_asio.reference.ip__address_v4.operator_lt__lt_.overload2 more...]]`` 85601 85602 85603[section:overload1 ip::address_v4::operator<< (1 of 2 overloads)] 85604 85605 85606Output an address as a string. 85607 85608 85609 template< 85610 typename Elem, 85611 typename Traits> 85612 std::basic_ostream< Elem, Traits > & operator<<( 85613 std::basic_ostream< Elem, Traits > & os, 85614 const address_v4 & addr); 85615 85616 85617Used to output a human-readable string for a specified address. 85618 85619 85620[heading Parameters] 85621 85622 85623[variablelist 85624 85625[[os][The output stream to which the string will be written.]] 85626 85627[[addr][The address to be written.]] 85628 85629] 85630 85631 85632[heading Return Value] 85633 85634The output stream. 85635 85636 85637 85638 85639[endsect] 85640 85641 85642 85643[section:overload2 ip::address_v4::operator<< (2 of 2 overloads)] 85644 85645 85646Output a network as a string. 85647 85648 85649 template< 85650 typename Elem, 85651 typename Traits> 85652 std::basic_ostream< Elem, Traits > & operator<<( 85653 std::basic_ostream< Elem, Traits > & os, 85654 const network_v4 & net); 85655 85656 85657Used to output a human-readable string for a specified network. 85658 85659 85660[heading Parameters] 85661 85662 85663[variablelist 85664 85665[[os][The output stream to which the string will be written.]] 85666 85667[[net][The network to be written.]] 85668 85669] 85670 85671 85672[heading Return Value] 85673 85674The output stream. 85675 85676 85677 85678 85679[endsect] 85680 85681 85682[endsect] 85683 85684 85685[section:operator_lt__eq_ ip::address_v4::operator<=] 85686 85687[indexterm2 boost_asio.indexterm.ip__address_v4.operator_lt__eq_..operator<=..ip::address_v4] 85688Compare addresses for ordering. 85689 85690 85691 friend bool operator<=( 85692 const address_v4 & a1, 85693 const address_v4 & a2); 85694 85695 85696[heading Requirements] 85697 85698['Header: ][^boost/asio/ip/address_v4.hpp] 85699 85700['Convenience header: ][^boost/asio.hpp] 85701 85702 85703[endsect] 85704 85705 85706 85707[section:operator_eq_ ip::address_v4::operator=] 85708 85709[indexterm2 boost_asio.indexterm.ip__address_v4.operator_eq_..operator=..ip::address_v4] 85710Assign from another address. 85711 85712 85713 address_v4 & operator=( 85714 const address_v4 & other); 85715 85716 85717 85718[endsect] 85719 85720 85721 85722[section:operator_eq__eq_ ip::address_v4::operator==] 85723 85724[indexterm2 boost_asio.indexterm.ip__address_v4.operator_eq__eq_..operator==..ip::address_v4] 85725Compare two addresses for equality. 85726 85727 85728 friend bool operator==( 85729 const address_v4 & a1, 85730 const address_v4 & a2); 85731 85732 85733[heading Requirements] 85734 85735['Header: ][^boost/asio/ip/address_v4.hpp] 85736 85737['Convenience header: ][^boost/asio.hpp] 85738 85739 85740[endsect] 85741 85742 85743 85744[section:operator_gt_ ip::address_v4::operator>] 85745 85746[indexterm2 boost_asio.indexterm.ip__address_v4.operator_gt_..operator>..ip::address_v4] 85747Compare addresses for ordering. 85748 85749 85750 friend bool operator>( 85751 const address_v4 & a1, 85752 const address_v4 & a2); 85753 85754 85755[heading Requirements] 85756 85757['Header: ][^boost/asio/ip/address_v4.hpp] 85758 85759['Convenience header: ][^boost/asio.hpp] 85760 85761 85762[endsect] 85763 85764 85765 85766[section:operator_gt__eq_ ip::address_v4::operator>=] 85767 85768[indexterm2 boost_asio.indexterm.ip__address_v4.operator_gt__eq_..operator>=..ip::address_v4] 85769Compare addresses for ordering. 85770 85771 85772 friend bool operator>=( 85773 const address_v4 & a1, 85774 const address_v4 & a2); 85775 85776 85777[heading Requirements] 85778 85779['Header: ][^boost/asio/ip/address_v4.hpp] 85780 85781['Convenience header: ][^boost/asio.hpp] 85782 85783 85784[endsect] 85785 85786 85787 85788[section:to_bytes ip::address_v4::to_bytes] 85789 85790[indexterm2 boost_asio.indexterm.ip__address_v4.to_bytes..to_bytes..ip::address_v4] 85791Get the address in bytes, in network byte order. 85792 85793 85794 bytes_type to_bytes() const; 85795 85796 85797 85798[endsect] 85799 85800 85801[section:to_string ip::address_v4::to_string] 85802 85803[indexterm2 boost_asio.indexterm.ip__address_v4.to_string..to_string..ip::address_v4] 85804Get the address as a string in dotted decimal format. 85805 85806 85807 std::string ``[link boost_asio.reference.ip__address_v4.to_string.overload1 to_string]``() const; 85808 `` [''''»''' [link boost_asio.reference.ip__address_v4.to_string.overload1 more...]]`` 85809 85810 85811(Deprecated: Use other overload.) Get the address as a string in dotted decimal format. 85812 85813 85814 std::string ``[link boost_asio.reference.ip__address_v4.to_string.overload2 to_string]``( 85815 boost::system::error_code & ec) const; 85816 `` [''''»''' [link boost_asio.reference.ip__address_v4.to_string.overload2 more...]]`` 85817 85818 85819[section:overload1 ip::address_v4::to_string (1 of 2 overloads)] 85820 85821 85822Get the address as a string in dotted decimal format. 85823 85824 85825 std::string to_string() const; 85826 85827 85828 85829[endsect] 85830 85831 85832 85833[section:overload2 ip::address_v4::to_string (2 of 2 overloads)] 85834 85835 85836(Deprecated: Use other overload.) Get the address as a string in dotted decimal format. 85837 85838 85839 std::string to_string( 85840 boost::system::error_code & ec) const; 85841 85842 85843 85844[endsect] 85845 85846 85847[endsect] 85848 85849 85850[section:to_uint ip::address_v4::to_uint] 85851 85852[indexterm2 boost_asio.indexterm.ip__address_v4.to_uint..to_uint..ip::address_v4] 85853Get the address as an unsigned integer in host byte order. 85854 85855 85856 uint_type to_uint() const; 85857 85858 85859 85860[endsect] 85861 85862 85863 85864[section:to_ulong ip::address_v4::to_ulong] 85865 85866[indexterm2 boost_asio.indexterm.ip__address_v4.to_ulong..to_ulong..ip::address_v4] 85867Get the address as an unsigned long in host byte order. 85868 85869 85870 unsigned long to_ulong() const; 85871 85872 85873 85874[endsect] 85875 85876 85877 85878[section:uint_type ip::address_v4::uint_type] 85879 85880[indexterm2 boost_asio.indexterm.ip__address_v4.uint_type..uint_type..ip::address_v4] 85881The type used to represent an address as an unsigned integer. 85882 85883 85884 typedef uint_least32_t uint_type; 85885 85886 85887 85888[heading Requirements] 85889 85890['Header: ][^boost/asio/ip/address_v4.hpp] 85891 85892['Convenience header: ][^boost/asio.hpp] 85893 85894 85895[endsect] 85896 85897 85898 85899[endsect] 85900 85901 85902[section:ip__address_v4_iterator ip::address_v4_iterator] 85903 85904[indexterm1 boost_asio.indexterm.ip__address_v4_iterator..ip::address_v4_iterator] 85905An input iterator that can be used for traversing IPv4 addresses. 85906 85907 85908 typedef basic_address_iterator< address_v4 > address_v4_iterator; 85909 85910 85911 85912[heading Requirements] 85913 85914['Header: ][^boost/asio/ip/address_v4_iterator.hpp] 85915 85916['Convenience header: ][^boost/asio.hpp] 85917 85918 85919[endsect] 85920 85921 85922 85923[section:ip__address_v4_range ip::address_v4_range] 85924 85925[indexterm1 boost_asio.indexterm.ip__address_v4_range..ip::address_v4_range] 85926Represents a range of IPv4 addresses. 85927 85928 85929 typedef basic_address_range< address_v4 > address_v4_range; 85930 85931 85932 85933[heading Requirements] 85934 85935['Header: ][^boost/asio/ip/address_v4_range.hpp] 85936 85937['Convenience header: ][^boost/asio.hpp] 85938 85939 85940[endsect] 85941 85942 85943[section:ip__address_v6 ip::address_v6] 85944 85945[indexterm1 boost_asio.indexterm.ip__address_v6..ip::address_v6] 85946 85947 85948Implements IP version 6 style addresses. 85949 85950 85951 class address_v6 85952 85953 85954[heading Types] 85955[table 85956 [[Name][Description]] 85957 85958 [ 85959 85960 [[link boost_asio.reference.ip__address_v6.bytes_type [*bytes_type]]] 85961 [The type used to represent an address as an array of bytes. ] 85962 85963 ] 85964 85965] 85966 85967[heading Member Functions] 85968[table 85969 [[Name][Description]] 85970 85971 [ 85972 [[link boost_asio.reference.ip__address_v6.address_v6 [*address_v6]] [constructor]] 85973 [Default constructor. 85974 [hr] 85975 Construct an address from raw bytes and scope ID. 85976 [hr] 85977 Copy constructor. ] 85978 ] 85979 85980 [ 85981 [[link boost_asio.reference.ip__address_v6.any [*any]] [static]] 85982 [Obtain an address object that represents any address. ] 85983 ] 85984 85985 [ 85986 [[link boost_asio.reference.ip__address_v6.from_string [*from_string]] [static]] 85987 [(Deprecated: Use make_address_v6().) Create an IPv6 address from an IP address string. ] 85988 ] 85989 85990 [ 85991 [[link boost_asio.reference.ip__address_v6.is_link_local [*is_link_local]]] 85992 [Determine whether the address is link local. ] 85993 ] 85994 85995 [ 85996 [[link boost_asio.reference.ip__address_v6.is_loopback [*is_loopback]]] 85997 [Determine whether the address is a loopback address. ] 85998 ] 85999 86000 [ 86001 [[link boost_asio.reference.ip__address_v6.is_multicast [*is_multicast]]] 86002 [Determine whether the address is a multicast address. ] 86003 ] 86004 86005 [ 86006 [[link boost_asio.reference.ip__address_v6.is_multicast_global [*is_multicast_global]]] 86007 [Determine whether the address is a global multicast address. ] 86008 ] 86009 86010 [ 86011 [[link boost_asio.reference.ip__address_v6.is_multicast_link_local [*is_multicast_link_local]]] 86012 [Determine whether the address is a link-local multicast address. ] 86013 ] 86014 86015 [ 86016 [[link boost_asio.reference.ip__address_v6.is_multicast_node_local [*is_multicast_node_local]]] 86017 [Determine whether the address is a node-local multicast address. ] 86018 ] 86019 86020 [ 86021 [[link boost_asio.reference.ip__address_v6.is_multicast_org_local [*is_multicast_org_local]]] 86022 [Determine whether the address is a org-local multicast address. ] 86023 ] 86024 86025 [ 86026 [[link boost_asio.reference.ip__address_v6.is_multicast_site_local [*is_multicast_site_local]]] 86027 [Determine whether the address is a site-local multicast address. ] 86028 ] 86029 86030 [ 86031 [[link boost_asio.reference.ip__address_v6.is_site_local [*is_site_local]]] 86032 [Determine whether the address is site local. ] 86033 ] 86034 86035 [ 86036 [[link boost_asio.reference.ip__address_v6.is_unspecified [*is_unspecified]]] 86037 [Determine whether the address is unspecified. ] 86038 ] 86039 86040 [ 86041 [[link boost_asio.reference.ip__address_v6.is_v4_compatible [*is_v4_compatible]]] 86042 [(Deprecated: No replacement.) Determine whether the address is an IPv4-compatible address. ] 86043 ] 86044 86045 [ 86046 [[link boost_asio.reference.ip__address_v6.is_v4_mapped [*is_v4_mapped]]] 86047 [Determine whether the address is a mapped IPv4 address. ] 86048 ] 86049 86050 [ 86051 [[link boost_asio.reference.ip__address_v6.loopback [*loopback]] [static]] 86052 [Obtain an address object that represents the loopback address. ] 86053 ] 86054 86055 [ 86056 [[link boost_asio.reference.ip__address_v6.operator_eq_ [*operator=]]] 86057 [Assign from another address. ] 86058 ] 86059 86060 [ 86061 [[link boost_asio.reference.ip__address_v6.scope_id [*scope_id]]] 86062 [The scope ID of the address. ] 86063 ] 86064 86065 [ 86066 [[link boost_asio.reference.ip__address_v6.to_bytes [*to_bytes]]] 86067 [Get the address in bytes, in network byte order. ] 86068 ] 86069 86070 [ 86071 [[link boost_asio.reference.ip__address_v6.to_string [*to_string]]] 86072 [Get the address as a string. 86073 [hr] 86074 (Deprecated: Use other overload.) Get the address as a string. ] 86075 ] 86076 86077 [ 86078 [[link boost_asio.reference.ip__address_v6.to_v4 [*to_v4]]] 86079 [(Deprecated: Use make_address_v4().) Converts an IPv4-mapped or IPv4-compatible address to an IPv4 address. ] 86080 ] 86081 86082 [ 86083 [[link boost_asio.reference.ip__address_v6.v4_compatible [*v4_compatible]] [static]] 86084 [(Deprecated: No replacement.) Create an IPv4-compatible IPv6 address. ] 86085 ] 86086 86087 [ 86088 [[link boost_asio.reference.ip__address_v6.v4_mapped [*v4_mapped]] [static]] 86089 [(Deprecated: Use make_address_v6().) Create an IPv4-mapped IPv6 address. ] 86090 ] 86091 86092] 86093 86094[heading Friends] 86095[table 86096 [[Name][Description]] 86097 86098 [ 86099 [[link boost_asio.reference.ip__address_v6.operator_not__eq_ [*operator!=]]] 86100 [Compare two addresses for inequality. ] 86101 ] 86102 86103 [ 86104 [[link boost_asio.reference.ip__address_v6.operator_lt_ [*operator<]]] 86105 [Compare addresses for ordering. ] 86106 ] 86107 86108 [ 86109 [[link boost_asio.reference.ip__address_v6.operator_lt__eq_ [*operator<=]]] 86110 [Compare addresses for ordering. ] 86111 ] 86112 86113 [ 86114 [[link boost_asio.reference.ip__address_v6.operator_eq__eq_ [*operator==]]] 86115 [Compare two addresses for equality. ] 86116 ] 86117 86118 [ 86119 [[link boost_asio.reference.ip__address_v6.operator_gt_ [*operator>]]] 86120 [Compare addresses for ordering. ] 86121 ] 86122 86123 [ 86124 [[link boost_asio.reference.ip__address_v6.operator_gt__eq_ [*operator>=]]] 86125 [Compare addresses for ordering. ] 86126 ] 86127 86128] 86129 86130[heading Related Functions] 86131[table 86132 [[Name][Description]] 86133 86134 [ 86135 [[link boost_asio.reference.ip__address_v6.make_address_v6 [*make_address_v6]]] 86136 [Create an IPv6 address from raw bytes and scope ID. 86137 86138 Create an IPv6 address from an IP address string. 86139 86140 Createan IPv6 address from an IP address string. 86141 86142 Create an IPv4-mapped IPv6 address from an IPv4 address. ] 86143 ] 86144 86145 [ 86146 [[link boost_asio.reference.ip__address_v6.make_network_v6 [*make_network_v6]]] 86147 [Create an IPv6 network from an address and prefix length. ] 86148 ] 86149 86150 [ 86151 [[link boost_asio.reference.ip__address_v6.operator_lt__lt_ [*operator<<]]] 86152 [Output an address as a string. 86153 86154 Output a network as a string. ] 86155 ] 86156 86157] 86158 86159The [link boost_asio.reference.ip__address_v6 `ip::address_v6`] class provides the ability to use and manipulate IP version 6 addresses. 86160 86161 86162[heading Thread Safety] 86163 86164['Distinct] ['objects:] Safe. 86165 86166['Shared] ['objects:] Unsafe. 86167 86168 86169 86170[heading Requirements] 86171 86172['Header: ][^boost/asio/ip/address_v6.hpp] 86173 86174['Convenience header: ][^boost/asio.hpp] 86175 86176[section:address_v6 ip::address_v6::address_v6] 86177 86178[indexterm2 boost_asio.indexterm.ip__address_v6.address_v6..address_v6..ip::address_v6] 86179Default constructor. 86180 86181 86182 ``[link boost_asio.reference.ip__address_v6.address_v6.overload1 address_v6]``(); 86183 `` [''''»''' [link boost_asio.reference.ip__address_v6.address_v6.overload1 more...]]`` 86184 86185 86186Construct an address from raw bytes and scope ID. 86187 86188 86189 explicit ``[link boost_asio.reference.ip__address_v6.address_v6.overload2 address_v6]``( 86190 const bytes_type & bytes, 86191 scope_id_type scope_id = 0); 86192 `` [''''»''' [link boost_asio.reference.ip__address_v6.address_v6.overload2 more...]]`` 86193 86194 86195Copy constructor. 86196 86197 86198 ``[link boost_asio.reference.ip__address_v6.address_v6.overload3 address_v6]``( 86199 const address_v6 & other); 86200 `` [''''»''' [link boost_asio.reference.ip__address_v6.address_v6.overload3 more...]]`` 86201 86202 86203[section:overload1 ip::address_v6::address_v6 (1 of 3 overloads)] 86204 86205 86206Default constructor. 86207 86208 86209 address_v6(); 86210 86211 86212 86213[endsect] 86214 86215 86216 86217[section:overload2 ip::address_v6::address_v6 (2 of 3 overloads)] 86218 86219 86220Construct an address from raw bytes and scope ID. 86221 86222 86223 address_v6( 86224 const bytes_type & bytes, 86225 scope_id_type scope_id = 0); 86226 86227 86228 86229[endsect] 86230 86231 86232 86233[section:overload3 ip::address_v6::address_v6 (3 of 3 overloads)] 86234 86235 86236Copy constructor. 86237 86238 86239 address_v6( 86240 const address_v6 & other); 86241 86242 86243 86244[endsect] 86245 86246 86247[endsect] 86248 86249 86250[section:any ip::address_v6::any] 86251 86252[indexterm2 boost_asio.indexterm.ip__address_v6.any..any..ip::address_v6] 86253Obtain an address object that represents any address. 86254 86255 86256 static address_v6 any(); 86257 86258 86259 86260[endsect] 86261 86262 86263 86264[section:bytes_type ip::address_v6::bytes_type] 86265 86266[indexterm2 boost_asio.indexterm.ip__address_v6.bytes_type..bytes_type..ip::address_v6] 86267The type used to represent an address as an array of bytes. 86268 86269 86270 typedef array< unsigned char, 16 > bytes_type; 86271 86272 86273 86274 86275[heading Remarks] 86276 86277This type is defined in terms of the C++0x template `std::array` when it is available. Otherwise, it uses `boost:array`. 86278 86279 86280 86281[heading Requirements] 86282 86283['Header: ][^boost/asio/ip/address_v6.hpp] 86284 86285['Convenience header: ][^boost/asio.hpp] 86286 86287 86288[endsect] 86289 86290 86291[section:from_string ip::address_v6::from_string] 86292 86293[indexterm2 boost_asio.indexterm.ip__address_v6.from_string..from_string..ip::address_v6] 86294(Deprecated: Use `make_address_v6()`.) Create an IPv6 address from an IP address string. 86295 86296 86297 static address_v6 ``[link boost_asio.reference.ip__address_v6.from_string.overload1 from_string]``( 86298 const char * str); 86299 `` [''''»''' [link boost_asio.reference.ip__address_v6.from_string.overload1 more...]]`` 86300 86301 static address_v6 ``[link boost_asio.reference.ip__address_v6.from_string.overload2 from_string]``( 86302 const char * str, 86303 boost::system::error_code & ec); 86304 `` [''''»''' [link boost_asio.reference.ip__address_v6.from_string.overload2 more...]]`` 86305 86306 static address_v6 ``[link boost_asio.reference.ip__address_v6.from_string.overload3 from_string]``( 86307 const std::string & str); 86308 `` [''''»''' [link boost_asio.reference.ip__address_v6.from_string.overload3 more...]]`` 86309 86310 static address_v6 ``[link boost_asio.reference.ip__address_v6.from_string.overload4 from_string]``( 86311 const std::string & str, 86312 boost::system::error_code & ec); 86313 `` [''''»''' [link boost_asio.reference.ip__address_v6.from_string.overload4 more...]]`` 86314 86315 86316[section:overload1 ip::address_v6::from_string (1 of 4 overloads)] 86317 86318 86319(Deprecated: Use `make_address_v6()`.) Create an IPv6 address from an IP address string. 86320 86321 86322 static address_v6 from_string( 86323 const char * str); 86324 86325 86326 86327[endsect] 86328 86329 86330 86331[section:overload2 ip::address_v6::from_string (2 of 4 overloads)] 86332 86333 86334(Deprecated: Use `make_address_v6()`.) Create an IPv6 address from an IP address string. 86335 86336 86337 static address_v6 from_string( 86338 const char * str, 86339 boost::system::error_code & ec); 86340 86341 86342 86343[endsect] 86344 86345 86346 86347[section:overload3 ip::address_v6::from_string (3 of 4 overloads)] 86348 86349 86350(Deprecated: Use `make_address_v6()`.) Create an IPv6 address from an IP address string. 86351 86352 86353 static address_v6 from_string( 86354 const std::string & str); 86355 86356 86357 86358[endsect] 86359 86360 86361 86362[section:overload4 ip::address_v6::from_string (4 of 4 overloads)] 86363 86364 86365(Deprecated: Use `make_address_v6()`.) Create an IPv6 address from an IP address string. 86366 86367 86368 static address_v6 from_string( 86369 const std::string & str, 86370 boost::system::error_code & ec); 86371 86372 86373 86374[endsect] 86375 86376 86377[endsect] 86378 86379 86380[section:is_link_local ip::address_v6::is_link_local] 86381 86382[indexterm2 boost_asio.indexterm.ip__address_v6.is_link_local..is_link_local..ip::address_v6] 86383Determine whether the address is link local. 86384 86385 86386 bool is_link_local() const; 86387 86388 86389 86390[endsect] 86391 86392 86393 86394[section:is_loopback ip::address_v6::is_loopback] 86395 86396[indexterm2 boost_asio.indexterm.ip__address_v6.is_loopback..is_loopback..ip::address_v6] 86397Determine whether the address is a loopback address. 86398 86399 86400 bool is_loopback() const; 86401 86402 86403 86404[endsect] 86405 86406 86407 86408[section:is_multicast ip::address_v6::is_multicast] 86409 86410[indexterm2 boost_asio.indexterm.ip__address_v6.is_multicast..is_multicast..ip::address_v6] 86411Determine whether the address is a multicast address. 86412 86413 86414 bool is_multicast() const; 86415 86416 86417 86418[endsect] 86419 86420 86421 86422[section:is_multicast_global ip::address_v6::is_multicast_global] 86423 86424[indexterm2 boost_asio.indexterm.ip__address_v6.is_multicast_global..is_multicast_global..ip::address_v6] 86425Determine whether the address is a global multicast address. 86426 86427 86428 bool is_multicast_global() const; 86429 86430 86431 86432[endsect] 86433 86434 86435 86436[section:is_multicast_link_local ip::address_v6::is_multicast_link_local] 86437 86438[indexterm2 boost_asio.indexterm.ip__address_v6.is_multicast_link_local..is_multicast_link_local..ip::address_v6] 86439Determine whether the address is a link-local multicast address. 86440 86441 86442 bool is_multicast_link_local() const; 86443 86444 86445 86446[endsect] 86447 86448 86449 86450[section:is_multicast_node_local ip::address_v6::is_multicast_node_local] 86451 86452[indexterm2 boost_asio.indexterm.ip__address_v6.is_multicast_node_local..is_multicast_node_local..ip::address_v6] 86453Determine whether the address is a node-local multicast address. 86454 86455 86456 bool is_multicast_node_local() const; 86457 86458 86459 86460[endsect] 86461 86462 86463 86464[section:is_multicast_org_local ip::address_v6::is_multicast_org_local] 86465 86466[indexterm2 boost_asio.indexterm.ip__address_v6.is_multicast_org_local..is_multicast_org_local..ip::address_v6] 86467Determine whether the address is a org-local multicast address. 86468 86469 86470 bool is_multicast_org_local() const; 86471 86472 86473 86474[endsect] 86475 86476 86477 86478[section:is_multicast_site_local ip::address_v6::is_multicast_site_local] 86479 86480[indexterm2 boost_asio.indexterm.ip__address_v6.is_multicast_site_local..is_multicast_site_local..ip::address_v6] 86481Determine whether the address is a site-local multicast address. 86482 86483 86484 bool is_multicast_site_local() const; 86485 86486 86487 86488[endsect] 86489 86490 86491 86492[section:is_site_local ip::address_v6::is_site_local] 86493 86494[indexterm2 boost_asio.indexterm.ip__address_v6.is_site_local..is_site_local..ip::address_v6] 86495Determine whether the address is site local. 86496 86497 86498 bool is_site_local() const; 86499 86500 86501 86502[endsect] 86503 86504 86505 86506[section:is_unspecified ip::address_v6::is_unspecified] 86507 86508[indexterm2 boost_asio.indexterm.ip__address_v6.is_unspecified..is_unspecified..ip::address_v6] 86509Determine whether the address is unspecified. 86510 86511 86512 bool is_unspecified() const; 86513 86514 86515 86516[endsect] 86517 86518 86519 86520[section:is_v4_compatible ip::address_v6::is_v4_compatible] 86521 86522[indexterm2 boost_asio.indexterm.ip__address_v6.is_v4_compatible..is_v4_compatible..ip::address_v6] 86523(Deprecated: No replacement.) Determine whether the address is an IPv4-compatible address. 86524 86525 86526 bool is_v4_compatible() const; 86527 86528 86529 86530[endsect] 86531 86532 86533 86534[section:is_v4_mapped ip::address_v6::is_v4_mapped] 86535 86536[indexterm2 boost_asio.indexterm.ip__address_v6.is_v4_mapped..is_v4_mapped..ip::address_v6] 86537Determine whether the address is a mapped IPv4 address. 86538 86539 86540 bool is_v4_mapped() const; 86541 86542 86543 86544[endsect] 86545 86546 86547 86548[section:loopback ip::address_v6::loopback] 86549 86550[indexterm2 boost_asio.indexterm.ip__address_v6.loopback..loopback..ip::address_v6] 86551Obtain an address object that represents the loopback address. 86552 86553 86554 static address_v6 loopback(); 86555 86556 86557 86558[endsect] 86559 86560 86561[section:make_address_v6 ip::address_v6::make_address_v6] 86562 86563[indexterm2 boost_asio.indexterm.ip__address_v6.make_address_v6..make_address_v6..ip::address_v6] 86564Create an IPv6 address from raw bytes and scope ID. 86565 86566 86567 address_v6 ``[link boost_asio.reference.ip__address_v6.make_address_v6.overload1 make_address_v6]``( 86568 const address_v6::bytes_type & bytes, 86569 scope_id_type scope_id = 0); 86570 `` [''''»''' [link boost_asio.reference.ip__address_v6.make_address_v6.overload1 more...]]`` 86571 86572 86573Create an IPv6 address from an IP address string. 86574 86575 86576 address_v6 ``[link boost_asio.reference.ip__address_v6.make_address_v6.overload2 make_address_v6]``( 86577 const char * str); 86578 `` [''''»''' [link boost_asio.reference.ip__address_v6.make_address_v6.overload2 more...]]`` 86579 86580 address_v6 ``[link boost_asio.reference.ip__address_v6.make_address_v6.overload3 make_address_v6]``( 86581 const char * str, 86582 boost::system::error_code & ec); 86583 `` [''''»''' [link boost_asio.reference.ip__address_v6.make_address_v6.overload3 more...]]`` 86584 86585 86586Createan IPv6 address from an IP address string. 86587 86588 86589 address_v6 ``[link boost_asio.reference.ip__address_v6.make_address_v6.overload4 make_address_v6]``( 86590 const std::string & str); 86591 `` [''''»''' [link boost_asio.reference.ip__address_v6.make_address_v6.overload4 more...]]`` 86592 86593 address_v6 ``[link boost_asio.reference.ip__address_v6.make_address_v6.overload5 make_address_v6]``( 86594 const std::string & str, 86595 boost::system::error_code & ec); 86596 `` [''''»''' [link boost_asio.reference.ip__address_v6.make_address_v6.overload5 more...]]`` 86597 86598 address_v6 ``[link boost_asio.reference.ip__address_v6.make_address_v6.overload6 make_address_v6]``( 86599 string_view str); 86600 `` [''''»''' [link boost_asio.reference.ip__address_v6.make_address_v6.overload6 more...]]`` 86601 86602 address_v6 ``[link boost_asio.reference.ip__address_v6.make_address_v6.overload7 make_address_v6]``( 86603 string_view str, 86604 boost::system::error_code & ec); 86605 `` [''''»''' [link boost_asio.reference.ip__address_v6.make_address_v6.overload7 more...]]`` 86606 86607 86608Create an IPv4-mapped IPv6 address from an IPv4 address. 86609 86610 86611 address_v6 ``[link boost_asio.reference.ip__address_v6.make_address_v6.overload8 make_address_v6]``( 86612 v4_mapped_t , 86613 const address_v4 & v4_addr); 86614 `` [''''»''' [link boost_asio.reference.ip__address_v6.make_address_v6.overload8 more...]]`` 86615 86616 86617[section:overload1 ip::address_v6::make_address_v6 (1 of 8 overloads)] 86618 86619 86620Create an IPv6 address from raw bytes and scope ID. 86621 86622 86623 address_v6 make_address_v6( 86624 const address_v6::bytes_type & bytes, 86625 scope_id_type scope_id = 0); 86626 86627 86628 86629[endsect] 86630 86631 86632 86633[section:overload2 ip::address_v6::make_address_v6 (2 of 8 overloads)] 86634 86635 86636Create an IPv6 address from an IP address string. 86637 86638 86639 address_v6 make_address_v6( 86640 const char * str); 86641 86642 86643 86644[endsect] 86645 86646 86647 86648[section:overload3 ip::address_v6::make_address_v6 (3 of 8 overloads)] 86649 86650 86651Create an IPv6 address from an IP address string. 86652 86653 86654 address_v6 make_address_v6( 86655 const char * str, 86656 boost::system::error_code & ec); 86657 86658 86659 86660[endsect] 86661 86662 86663 86664[section:overload4 ip::address_v6::make_address_v6 (4 of 8 overloads)] 86665 86666 86667Createan IPv6 address from an IP address string. 86668 86669 86670 address_v6 make_address_v6( 86671 const std::string & str); 86672 86673 86674 86675[endsect] 86676 86677 86678 86679[section:overload5 ip::address_v6::make_address_v6 (5 of 8 overloads)] 86680 86681 86682Create an IPv6 address from an IP address string. 86683 86684 86685 address_v6 make_address_v6( 86686 const std::string & str, 86687 boost::system::error_code & ec); 86688 86689 86690 86691[endsect] 86692 86693 86694 86695[section:overload6 ip::address_v6::make_address_v6 (6 of 8 overloads)] 86696 86697 86698Create an IPv6 address from an IP address string. 86699 86700 86701 address_v6 make_address_v6( 86702 string_view str); 86703 86704 86705 86706[endsect] 86707 86708 86709 86710[section:overload7 ip::address_v6::make_address_v6 (7 of 8 overloads)] 86711 86712 86713Create an IPv6 address from an IP address string. 86714 86715 86716 address_v6 make_address_v6( 86717 string_view str, 86718 boost::system::error_code & ec); 86719 86720 86721 86722[endsect] 86723 86724 86725 86726[section:overload8 ip::address_v6::make_address_v6 (8 of 8 overloads)] 86727 86728 86729Create an IPv4-mapped IPv6 address from an IPv4 address. 86730 86731 86732 address_v6 make_address_v6( 86733 v4_mapped_t , 86734 const address_v4 & v4_addr); 86735 86736 86737 86738[endsect] 86739 86740 86741[endsect] 86742 86743 86744[section:make_network_v6 ip::address_v6::make_network_v6] 86745 86746[indexterm2 boost_asio.indexterm.ip__address_v6.make_network_v6..make_network_v6..ip::address_v6] 86747Create an IPv6 network from an address and prefix length. 86748 86749 86750 network_v6 make_network_v6( 86751 const address_v6 & addr, 86752 unsigned short prefix_len); 86753 86754 86755 86756[endsect] 86757 86758 86759 86760[section:operator_not__eq_ ip::address_v6::operator!=] 86761 86762[indexterm2 boost_asio.indexterm.ip__address_v6.operator_not__eq_..operator!=..ip::address_v6] 86763Compare two addresses for inequality. 86764 86765 86766 friend bool operator!=( 86767 const address_v6 & a1, 86768 const address_v6 & a2); 86769 86770 86771[heading Requirements] 86772 86773['Header: ][^boost/asio/ip/address_v6.hpp] 86774 86775['Convenience header: ][^boost/asio.hpp] 86776 86777 86778[endsect] 86779 86780 86781 86782[section:operator_lt_ ip::address_v6::operator<] 86783 86784[indexterm2 boost_asio.indexterm.ip__address_v6.operator_lt_..operator<..ip::address_v6] 86785Compare addresses for ordering. 86786 86787 86788 friend bool operator<( 86789 const address_v6 & a1, 86790 const address_v6 & a2); 86791 86792 86793[heading Requirements] 86794 86795['Header: ][^boost/asio/ip/address_v6.hpp] 86796 86797['Convenience header: ][^boost/asio.hpp] 86798 86799 86800[endsect] 86801 86802 86803[section:operator_lt__lt_ ip::address_v6::operator<<] 86804 86805[indexterm2 boost_asio.indexterm.ip__address_v6.operator_lt__lt_..operator<<..ip::address_v6] 86806Output an address as a string. 86807 86808 86809 template< 86810 typename Elem, 86811 typename Traits> 86812 std::basic_ostream< Elem, Traits > & ``[link boost_asio.reference.ip__address_v6.operator_lt__lt_.overload1 operator<<]``( 86813 std::basic_ostream< Elem, Traits > & os, 86814 const address_v6 & addr); 86815 `` [''''»''' [link boost_asio.reference.ip__address_v6.operator_lt__lt_.overload1 more...]]`` 86816 86817 86818Output a network as a string. 86819 86820 86821 template< 86822 typename Elem, 86823 typename Traits> 86824 std::basic_ostream< Elem, Traits > & ``[link boost_asio.reference.ip__address_v6.operator_lt__lt_.overload2 operator<<]``( 86825 std::basic_ostream< Elem, Traits > & os, 86826 const network_v6 & net); 86827 `` [''''»''' [link boost_asio.reference.ip__address_v6.operator_lt__lt_.overload2 more...]]`` 86828 86829 86830[section:overload1 ip::address_v6::operator<< (1 of 2 overloads)] 86831 86832 86833Output an address as a string. 86834 86835 86836 template< 86837 typename Elem, 86838 typename Traits> 86839 std::basic_ostream< Elem, Traits > & operator<<( 86840 std::basic_ostream< Elem, Traits > & os, 86841 const address_v6 & addr); 86842 86843 86844Used to output a human-readable string for a specified address. 86845 86846 86847[heading Parameters] 86848 86849 86850[variablelist 86851 86852[[os][The output stream to which the string will be written.]] 86853 86854[[addr][The address to be written.]] 86855 86856] 86857 86858 86859[heading Return Value] 86860 86861The output stream. 86862 86863 86864 86865 86866[endsect] 86867 86868 86869 86870[section:overload2 ip::address_v6::operator<< (2 of 2 overloads)] 86871 86872 86873Output a network as a string. 86874 86875 86876 template< 86877 typename Elem, 86878 typename Traits> 86879 std::basic_ostream< Elem, Traits > & operator<<( 86880 std::basic_ostream< Elem, Traits > & os, 86881 const network_v6 & net); 86882 86883 86884Used to output a human-readable string for a specified network. 86885 86886 86887[heading Parameters] 86888 86889 86890[variablelist 86891 86892[[os][The output stream to which the string will be written.]] 86893 86894[[net][The network to be written.]] 86895 86896] 86897 86898 86899[heading Return Value] 86900 86901The output stream. 86902 86903 86904 86905 86906[endsect] 86907 86908 86909[endsect] 86910 86911 86912[section:operator_lt__eq_ ip::address_v6::operator<=] 86913 86914[indexterm2 boost_asio.indexterm.ip__address_v6.operator_lt__eq_..operator<=..ip::address_v6] 86915Compare addresses for ordering. 86916 86917 86918 friend bool operator<=( 86919 const address_v6 & a1, 86920 const address_v6 & a2); 86921 86922 86923[heading Requirements] 86924 86925['Header: ][^boost/asio/ip/address_v6.hpp] 86926 86927['Convenience header: ][^boost/asio.hpp] 86928 86929 86930[endsect] 86931 86932 86933 86934[section:operator_eq_ ip::address_v6::operator=] 86935 86936[indexterm2 boost_asio.indexterm.ip__address_v6.operator_eq_..operator=..ip::address_v6] 86937Assign from another address. 86938 86939 86940 address_v6 & operator=( 86941 const address_v6 & other); 86942 86943 86944 86945[endsect] 86946 86947 86948 86949[section:operator_eq__eq_ ip::address_v6::operator==] 86950 86951[indexterm2 boost_asio.indexterm.ip__address_v6.operator_eq__eq_..operator==..ip::address_v6] 86952Compare two addresses for equality. 86953 86954 86955 friend bool operator==( 86956 const address_v6 & a1, 86957 const address_v6 & a2); 86958 86959 86960[heading Requirements] 86961 86962['Header: ][^boost/asio/ip/address_v6.hpp] 86963 86964['Convenience header: ][^boost/asio.hpp] 86965 86966 86967[endsect] 86968 86969 86970 86971[section:operator_gt_ ip::address_v6::operator>] 86972 86973[indexterm2 boost_asio.indexterm.ip__address_v6.operator_gt_..operator>..ip::address_v6] 86974Compare addresses for ordering. 86975 86976 86977 friend bool operator>( 86978 const address_v6 & a1, 86979 const address_v6 & a2); 86980 86981 86982[heading Requirements] 86983 86984['Header: ][^boost/asio/ip/address_v6.hpp] 86985 86986['Convenience header: ][^boost/asio.hpp] 86987 86988 86989[endsect] 86990 86991 86992 86993[section:operator_gt__eq_ ip::address_v6::operator>=] 86994 86995[indexterm2 boost_asio.indexterm.ip__address_v6.operator_gt__eq_..operator>=..ip::address_v6] 86996Compare addresses for ordering. 86997 86998 86999 friend bool operator>=( 87000 const address_v6 & a1, 87001 const address_v6 & a2); 87002 87003 87004[heading Requirements] 87005 87006['Header: ][^boost/asio/ip/address_v6.hpp] 87007 87008['Convenience header: ][^boost/asio.hpp] 87009 87010 87011[endsect] 87012 87013 87014[section:scope_id ip::address_v6::scope_id] 87015 87016[indexterm2 boost_asio.indexterm.ip__address_v6.scope_id..scope_id..ip::address_v6] 87017The scope ID of the address. 87018 87019 87020 scope_id_type ``[link boost_asio.reference.ip__address_v6.scope_id.overload1 scope_id]``() const; 87021 `` [''''»''' [link boost_asio.reference.ip__address_v6.scope_id.overload1 more...]]`` 87022 87023 void ``[link boost_asio.reference.ip__address_v6.scope_id.overload2 scope_id]``( 87024 scope_id_type id); 87025 `` [''''»''' [link boost_asio.reference.ip__address_v6.scope_id.overload2 more...]]`` 87026 87027 87028[section:overload1 ip::address_v6::scope_id (1 of 2 overloads)] 87029 87030 87031The scope ID of the address. 87032 87033 87034 scope_id_type scope_id() const; 87035 87036 87037Returns the scope ID associated with the IPv6 address. 87038 87039 87040[endsect] 87041 87042 87043 87044[section:overload2 ip::address_v6::scope_id (2 of 2 overloads)] 87045 87046 87047The scope ID of the address. 87048 87049 87050 void scope_id( 87051 scope_id_type id); 87052 87053 87054Modifies the scope ID associated with the IPv6 address. 87055 87056 87057[endsect] 87058 87059 87060[endsect] 87061 87062 87063[section:to_bytes ip::address_v6::to_bytes] 87064 87065[indexterm2 boost_asio.indexterm.ip__address_v6.to_bytes..to_bytes..ip::address_v6] 87066Get the address in bytes, in network byte order. 87067 87068 87069 bytes_type to_bytes() const; 87070 87071 87072 87073[endsect] 87074 87075 87076[section:to_string ip::address_v6::to_string] 87077 87078[indexterm2 boost_asio.indexterm.ip__address_v6.to_string..to_string..ip::address_v6] 87079Get the address as a string. 87080 87081 87082 std::string ``[link boost_asio.reference.ip__address_v6.to_string.overload1 to_string]``() const; 87083 `` [''''»''' [link boost_asio.reference.ip__address_v6.to_string.overload1 more...]]`` 87084 87085 87086(Deprecated: Use other overload.) Get the address as a string. 87087 87088 87089 std::string ``[link boost_asio.reference.ip__address_v6.to_string.overload2 to_string]``( 87090 boost::system::error_code & ec) const; 87091 `` [''''»''' [link boost_asio.reference.ip__address_v6.to_string.overload2 more...]]`` 87092 87093 87094[section:overload1 ip::address_v6::to_string (1 of 2 overloads)] 87095 87096 87097Get the address as a string. 87098 87099 87100 std::string to_string() const; 87101 87102 87103 87104[endsect] 87105 87106 87107 87108[section:overload2 ip::address_v6::to_string (2 of 2 overloads)] 87109 87110 87111(Deprecated: Use other overload.) Get the address as a string. 87112 87113 87114 std::string to_string( 87115 boost::system::error_code & ec) const; 87116 87117 87118 87119[endsect] 87120 87121 87122[endsect] 87123 87124 87125[section:to_v4 ip::address_v6::to_v4] 87126 87127[indexterm2 boost_asio.indexterm.ip__address_v6.to_v4..to_v4..ip::address_v6] 87128(Deprecated: Use `make_address_v4()`.) Converts an IPv4-mapped or IPv4-compatible address to an IPv4 address. 87129 87130 87131 address_v4 to_v4() const; 87132 87133 87134 87135[endsect] 87136 87137 87138 87139[section:v4_compatible ip::address_v6::v4_compatible] 87140 87141[indexterm2 boost_asio.indexterm.ip__address_v6.v4_compatible..v4_compatible..ip::address_v6] 87142(Deprecated: No replacement.) Create an IPv4-compatible IPv6 address. 87143 87144 87145 static address_v6 v4_compatible( 87146 const address_v4 & addr); 87147 87148 87149 87150[endsect] 87151 87152 87153 87154[section:v4_mapped ip::address_v6::v4_mapped] 87155 87156[indexterm2 boost_asio.indexterm.ip__address_v6.v4_mapped..v4_mapped..ip::address_v6] 87157(Deprecated: Use `make_address_v6()`.) Create an IPv4-mapped IPv6 address. 87158 87159 87160 static address_v6 v4_mapped( 87161 const address_v4 & addr); 87162 87163 87164 87165[endsect] 87166 87167 87168 87169[endsect] 87170 87171 87172[section:ip__address_v6_iterator ip::address_v6_iterator] 87173 87174[indexterm1 boost_asio.indexterm.ip__address_v6_iterator..ip::address_v6_iterator] 87175An input iterator that can be used for traversing IPv6 addresses. 87176 87177 87178 typedef basic_address_iterator< address_v6 > address_v6_iterator; 87179 87180 87181 87182[heading Requirements] 87183 87184['Header: ][^boost/asio/ip/address_v6_iterator.hpp] 87185 87186['Convenience header: ][^boost/asio.hpp] 87187 87188 87189[endsect] 87190 87191 87192 87193[section:ip__address_v6_range ip::address_v6_range] 87194 87195[indexterm1 boost_asio.indexterm.ip__address_v6_range..ip::address_v6_range] 87196Represents a range of IPv6 addresses. 87197 87198 87199 typedef basic_address_range< address_v6 > address_v6_range; 87200 87201 87202 87203[heading Requirements] 87204 87205['Header: ][^boost/asio/ip/address_v6_range.hpp] 87206 87207['Convenience header: ][^boost/asio.hpp] 87208 87209 87210[endsect] 87211 87212 87213[section:ip__bad_address_cast ip::bad_address_cast] 87214 87215[indexterm1 boost_asio.indexterm.ip__bad_address_cast..ip::bad_address_cast] 87216 87217 87218Thrown to indicate a failed address conversion. 87219 87220 87221 class bad_address_cast 87222 87223 87224[heading Member Functions] 87225[table 87226 [[Name][Description]] 87227 87228 [ 87229 [[link boost_asio.reference.ip__bad_address_cast.bad_address_cast [*bad_address_cast]] [constructor]] 87230 [Default constructor. ] 87231 ] 87232 87233 [ 87234 [[link boost_asio.reference.ip__bad_address_cast.what [*what]]] 87235 [Get the message associated with the exception. ] 87236 ] 87237 87238 [ 87239 [[link boost_asio.reference.ip__bad_address_cast._bad_address_cast [*~bad_address_cast]] [destructor]] 87240 [Destructor. ] 87241 ] 87242 87243] 87244 87245[heading Requirements] 87246 87247['Header: ][^boost/asio/ip/bad_address_cast.hpp] 87248 87249['Convenience header: ][^boost/asio.hpp] 87250 87251 87252[section:bad_address_cast ip::bad_address_cast::bad_address_cast] 87253 87254[indexterm2 boost_asio.indexterm.ip__bad_address_cast.bad_address_cast..bad_address_cast..ip::bad_address_cast] 87255Default constructor. 87256 87257 87258 bad_address_cast(); 87259 87260 87261 87262[endsect] 87263 87264 87265 87266[section:what ip::bad_address_cast::what] 87267 87268[indexterm2 boost_asio.indexterm.ip__bad_address_cast.what..what..ip::bad_address_cast] 87269Get the message associated with the exception. 87270 87271 87272 virtual const char * what() const; 87273 87274 87275 87276[endsect] 87277 87278 87279 87280[section:_bad_address_cast ip::bad_address_cast::~bad_address_cast] 87281 87282[indexterm2 boost_asio.indexterm.ip__bad_address_cast._bad_address_cast..~bad_address_cast..ip::bad_address_cast] 87283Destructor. 87284 87285 87286 virtual ~bad_address_cast(); 87287 87288 87289 87290[endsect] 87291 87292 87293 87294[endsect] 87295 87296[section:ip__basic_address_iterator_lt__address_v4__gt_ ip::basic_address_iterator< address_v4 >] 87297 87298[indexterm1 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_..ip::basic_address_iterator< address_v4 >] 87299 87300 87301An input iterator that can be used for traversing IPv4 addresses. 87302 87303 87304 template<> 87305 class basic_address_iterator< address_v4 > 87306 87307 87308[heading Types] 87309[table 87310 [[Name][Description]] 87311 87312 [ 87313 87314 [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.difference_type [*difference_type]]] 87315 [Distance between two iterators. ] 87316 87317 ] 87318 87319 [ 87320 87321 [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.iterator_category [*iterator_category]]] 87322 [Denotes that the iterator satisfies the input iterator requirements. ] 87323 87324 ] 87325 87326 [ 87327 87328 [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.pointer [*pointer]]] 87329 [The type of a pointer to an element pointed to by the iterator. ] 87330 87331 ] 87332 87333 [ 87334 87335 [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.reference [*reference]]] 87336 [The type of a reference to an element pointed to by the iterator. ] 87337 87338 ] 87339 87340 [ 87341 87342 [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.value_type [*value_type]]] 87343 [The type of the elements pointed to by the iterator. ] 87344 87345 ] 87346 87347] 87348 87349[heading Member Functions] 87350[table 87351 [[Name][Description]] 87352 87353 [ 87354 [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.basic_address_iterator [*basic_address_iterator]]] 87355 [Construct an iterator that points to the specified address. 87356 [hr] 87357 Copy constructor. ] 87358 ] 87359 87360 [ 87361 [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator__star_ [*operator *]]] 87362 [Dereference the iterator. ] 87363 ] 87364 87365 [ 87366 [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_plus__plus_ [*operator++]]] 87367 [Pre-increment operator. 87368 [hr] 87369 Post-increment operator. ] 87370 ] 87371 87372 [ 87373 [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_minus__minus_ [*operator--]]] 87374 [Pre-decrement operator. 87375 [hr] 87376 Post-decrement operator. ] 87377 ] 87378 87379 [ 87380 [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_arrow_ [*operator->]]] 87381 [Dereference the iterator. ] 87382 ] 87383 87384 [ 87385 [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_eq_ [*operator=]]] 87386 [Assignment operator. ] 87387 ] 87388 87389] 87390 87391[heading Friends] 87392[table 87393 [[Name][Description]] 87394 87395 [ 87396 [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_not__eq_ [*operator!=]]] 87397 [Compare two addresses for inequality. ] 87398 ] 87399 87400 [ 87401 [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_eq__eq_ [*operator==]]] 87402 [Compare two addresses for equality. ] 87403 ] 87404 87405] 87406 87407In addition to satisfying the input iterator requirements, this iterator also supports decrement. 87408 87409 87410[heading Thread Safety] 87411 87412['Distinct] ['objects:] Safe. 87413 87414['Shared] ['objects:] Unsafe. 87415 87416 87417 87418[heading Requirements] 87419 87420['Header: ][^boost/asio/ip/address_v4_iterator.hpp] 87421 87422['Convenience header: ][^boost/asio.hpp] 87423 87424[section:basic_address_iterator ip::basic_address_iterator< address_v4 >::basic_address_iterator] 87425 87426[indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.basic_address_iterator..basic_address_iterator..ip::basic_address_iterator< address_v4 >] 87427Construct an iterator that points to the specified address. 87428 87429 87430 ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.basic_address_iterator.overload1 basic_address_iterator]``( 87431 const address_v4 & addr); 87432 `` [''''»''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.basic_address_iterator.overload1 more...]]`` 87433 87434 87435Copy constructor. 87436 87437 87438 ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.basic_address_iterator.overload2 basic_address_iterator]``( 87439 const basic_address_iterator & other); 87440 `` [''''»''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.basic_address_iterator.overload2 more...]]`` 87441 87442 87443[section:overload1 ip::basic_address_iterator< address_v4 >::basic_address_iterator (1 of 2 overloads)] 87444 87445 87446Construct an iterator that points to the specified address. 87447 87448 87449 basic_address_iterator( 87450 const address_v4 & addr); 87451 87452 87453 87454[endsect] 87455 87456 87457 87458[section:overload2 ip::basic_address_iterator< address_v4 >::basic_address_iterator (2 of 2 overloads)] 87459 87460 87461Copy constructor. 87462 87463 87464 basic_address_iterator( 87465 const basic_address_iterator & other); 87466 87467 87468 87469[endsect] 87470 87471 87472[endsect] 87473 87474 87475[section:difference_type ip::basic_address_iterator< address_v4 >::difference_type] 87476 87477[indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.difference_type..difference_type..ip::basic_address_iterator< address_v4 >] 87478Distance between two iterators. 87479 87480 87481 typedef std::ptrdiff_t difference_type; 87482 87483 87484 87485[heading Requirements] 87486 87487['Header: ][^boost/asio/ip/address_v4_iterator.hpp] 87488 87489['Convenience header: ][^boost/asio.hpp] 87490 87491 87492[endsect] 87493 87494 87495 87496[section:iterator_category ip::basic_address_iterator< address_v4 >::iterator_category] 87497 87498[indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.iterator_category..iterator_category..ip::basic_address_iterator< address_v4 >] 87499Denotes that the iterator satisfies the input iterator requirements. 87500 87501 87502 typedef std::input_iterator_tag iterator_category; 87503 87504 87505 87506[heading Requirements] 87507 87508['Header: ][^boost/asio/ip/address_v4_iterator.hpp] 87509 87510['Convenience header: ][^boost/asio.hpp] 87511 87512 87513[endsect] 87514 87515 87516 87517[section:operator__star_ ip::basic_address_iterator< address_v4 >::operator *] 87518 87519[indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.operator__star_..operator *..ip::basic_address_iterator< address_v4 >] 87520Dereference the iterator. 87521 87522 87523 const address_v4 & operator *() const; 87524 87525 87526 87527[endsect] 87528 87529 87530 87531[section:operator_not__eq_ ip::basic_address_iterator< address_v4 >::operator!=] 87532 87533[indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.operator_not__eq_..operator!=..ip::basic_address_iterator< address_v4 >] 87534Compare two addresses for inequality. 87535 87536 87537 friend bool operator!=( 87538 const basic_address_iterator & a, 87539 const basic_address_iterator & b); 87540 87541 87542[heading Requirements] 87543 87544['Header: ][^boost/asio/ip/address_v4_iterator.hpp] 87545 87546['Convenience header: ][^boost/asio.hpp] 87547 87548 87549[endsect] 87550 87551 87552[section:operator_plus__plus_ ip::basic_address_iterator< address_v4 >::operator++] 87553 87554[indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.operator_plus__plus_..operator++..ip::basic_address_iterator< address_v4 >] 87555Pre-increment operator. 87556 87557 87558 basic_address_iterator & ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_plus__plus_.overload1 operator++]``(); 87559 `` [''''»''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_plus__plus_.overload1 more...]]`` 87560 87561 87562Post-increment operator. 87563 87564 87565 basic_address_iterator ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_plus__plus_.overload2 operator++]``( 87566 int ); 87567 `` [''''»''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_plus__plus_.overload2 more...]]`` 87568 87569 87570[section:overload1 ip::basic_address_iterator< address_v4 >::operator++ (1 of 2 overloads)] 87571 87572 87573Pre-increment operator. 87574 87575 87576 basic_address_iterator & operator++(); 87577 87578 87579 87580[endsect] 87581 87582 87583 87584[section:overload2 ip::basic_address_iterator< address_v4 >::operator++ (2 of 2 overloads)] 87585 87586 87587Post-increment operator. 87588 87589 87590 basic_address_iterator operator++( 87591 int ); 87592 87593 87594 87595[endsect] 87596 87597 87598[endsect] 87599 87600[section:operator_minus__minus_ ip::basic_address_iterator< address_v4 >::operator--] 87601 87602[indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.operator_minus__minus_..operator--..ip::basic_address_iterator< address_v4 >] 87603Pre-decrement operator. 87604 87605 87606 basic_address_iterator & ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_minus__minus_.overload1 operator--]``(); 87607 `` [''''»''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_minus__minus_.overload1 more...]]`` 87608 87609 87610Post-decrement operator. 87611 87612 87613 basic_address_iterator ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_minus__minus_.overload2 operator--]``( 87614 int ); 87615 `` [''''»''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_minus__minus_.overload2 more...]]`` 87616 87617 87618[section:overload1 ip::basic_address_iterator< address_v4 >::operator-- (1 of 2 overloads)] 87619 87620 87621Pre-decrement operator. 87622 87623 87624 basic_address_iterator & operator--(); 87625 87626 87627 87628[endsect] 87629 87630 87631 87632[section:overload2 ip::basic_address_iterator< address_v4 >::operator-- (2 of 2 overloads)] 87633 87634 87635Post-decrement operator. 87636 87637 87638 basic_address_iterator operator--( 87639 int ); 87640 87641 87642 87643[endsect] 87644 87645 87646[endsect] 87647 87648 87649[section:operator_arrow_ ip::basic_address_iterator< address_v4 >::operator->] 87650 87651[indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.operator_arrow_..operator->..ip::basic_address_iterator< address_v4 >] 87652Dereference the iterator. 87653 87654 87655 const address_v4 * operator->() const; 87656 87657 87658 87659[endsect] 87660 87661 87662 87663[section:operator_eq_ ip::basic_address_iterator< address_v4 >::operator=] 87664 87665[indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.operator_eq_..operator=..ip::basic_address_iterator< address_v4 >] 87666Assignment operator. 87667 87668 87669 basic_address_iterator & operator=( 87670 const basic_address_iterator & other); 87671 87672 87673 87674[endsect] 87675 87676 87677 87678[section:operator_eq__eq_ ip::basic_address_iterator< address_v4 >::operator==] 87679 87680[indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.operator_eq__eq_..operator==..ip::basic_address_iterator< address_v4 >] 87681Compare two addresses for equality. 87682 87683 87684 friend bool operator==( 87685 const basic_address_iterator & a, 87686 const basic_address_iterator & b); 87687 87688 87689[heading Requirements] 87690 87691['Header: ][^boost/asio/ip/address_v4_iterator.hpp] 87692 87693['Convenience header: ][^boost/asio.hpp] 87694 87695 87696[endsect] 87697 87698 87699 87700[section:pointer ip::basic_address_iterator< address_v4 >::pointer] 87701 87702[indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.pointer..pointer..ip::basic_address_iterator< address_v4 >] 87703The type of a pointer to an element pointed to by the iterator. 87704 87705 87706 typedef const address_v4 * pointer; 87707 87708 87709 87710[heading Requirements] 87711 87712['Header: ][^boost/asio/ip/address_v4_iterator.hpp] 87713 87714['Convenience header: ][^boost/asio.hpp] 87715 87716 87717[endsect] 87718 87719 87720 87721[section:reference ip::basic_address_iterator< address_v4 >::reference] 87722 87723[indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.reference..reference..ip::basic_address_iterator< address_v4 >] 87724The type of a reference to an element pointed to by the iterator. 87725 87726 87727 typedef const address_v4 & reference; 87728 87729 87730[heading Types] 87731[table 87732 [[Name][Description]] 87733 87734 [ 87735 87736 [[link boost_asio.reference.ip__address_v4.bytes_type [*bytes_type]]] 87737 [The type used to represent an address as an array of bytes. ] 87738 87739 ] 87740 87741 [ 87742 87743 [[link boost_asio.reference.ip__address_v4.uint_type [*uint_type]]] 87744 [The type used to represent an address as an unsigned integer. ] 87745 87746 ] 87747 87748] 87749 87750[heading Member Functions] 87751[table 87752 [[Name][Description]] 87753 87754 [ 87755 [[link boost_asio.reference.ip__address_v4.address_v4 [*address_v4]] [constructor]] 87756 [Default constructor. 87757 [hr] 87758 Construct an address from raw bytes. 87759 [hr] 87760 Construct an address from an unsigned integer in host byte order. 87761 [hr] 87762 Copy constructor. ] 87763 ] 87764 87765 [ 87766 [[link boost_asio.reference.ip__address_v4.any [*any]] [static]] 87767 [Obtain an address object that represents any address. ] 87768 ] 87769 87770 [ 87771 [[link boost_asio.reference.ip__address_v4.broadcast [*broadcast]] [static]] 87772 [Obtain an address object that represents the broadcast address. 87773 [hr] 87774 (Deprecated: Use network_v4 class.) Obtain an address object that represents the broadcast address that corresponds to the specified address and netmask. ] 87775 ] 87776 87777 [ 87778 [[link boost_asio.reference.ip__address_v4.from_string [*from_string]] [static]] 87779 [(Deprecated: Use make_address_v4().) Create an address from an IP address string in dotted decimal form. ] 87780 ] 87781 87782 [ 87783 [[link boost_asio.reference.ip__address_v4.is_class_a [*is_class_a]]] 87784 [(Deprecated: Use network_v4 class.) Determine whether the address is a class A address. ] 87785 ] 87786 87787 [ 87788 [[link boost_asio.reference.ip__address_v4.is_class_b [*is_class_b]]] 87789 [(Deprecated: Use network_v4 class.) Determine whether the address is a class B address. ] 87790 ] 87791 87792 [ 87793 [[link boost_asio.reference.ip__address_v4.is_class_c [*is_class_c]]] 87794 [(Deprecated: Use network_v4 class.) Determine whether the address is a class C address. ] 87795 ] 87796 87797 [ 87798 [[link boost_asio.reference.ip__address_v4.is_loopback [*is_loopback]]] 87799 [Determine whether the address is a loopback address. ] 87800 ] 87801 87802 [ 87803 [[link boost_asio.reference.ip__address_v4.is_multicast [*is_multicast]]] 87804 [Determine whether the address is a multicast address. ] 87805 ] 87806 87807 [ 87808 [[link boost_asio.reference.ip__address_v4.is_unspecified [*is_unspecified]]] 87809 [Determine whether the address is unspecified. ] 87810 ] 87811 87812 [ 87813 [[link boost_asio.reference.ip__address_v4.loopback [*loopback]] [static]] 87814 [Obtain an address object that represents the loopback address. ] 87815 ] 87816 87817 [ 87818 [[link boost_asio.reference.ip__address_v4.netmask [*netmask]] [static]] 87819 [(Deprecated: Use network_v4 class.) Obtain the netmask that corresponds to the address, based on its address class. ] 87820 ] 87821 87822 [ 87823 [[link boost_asio.reference.ip__address_v4.operator_eq_ [*operator=]]] 87824 [Assign from another address. ] 87825 ] 87826 87827 [ 87828 [[link boost_asio.reference.ip__address_v4.to_bytes [*to_bytes]]] 87829 [Get the address in bytes, in network byte order. ] 87830 ] 87831 87832 [ 87833 [[link boost_asio.reference.ip__address_v4.to_string [*to_string]]] 87834 [Get the address as a string in dotted decimal format. 87835 [hr] 87836 (Deprecated: Use other overload.) Get the address as a string in dotted decimal format. ] 87837 ] 87838 87839 [ 87840 [[link boost_asio.reference.ip__address_v4.to_uint [*to_uint]]] 87841 [Get the address as an unsigned integer in host byte order. ] 87842 ] 87843 87844 [ 87845 [[link boost_asio.reference.ip__address_v4.to_ulong [*to_ulong]]] 87846 [Get the address as an unsigned long in host byte order. ] 87847 ] 87848 87849] 87850 87851[heading Friends] 87852[table 87853 [[Name][Description]] 87854 87855 [ 87856 [[link boost_asio.reference.ip__address_v4.operator_not__eq_ [*operator!=]]] 87857 [Compare two addresses for inequality. ] 87858 ] 87859 87860 [ 87861 [[link boost_asio.reference.ip__address_v4.operator_lt_ [*operator<]]] 87862 [Compare addresses for ordering. ] 87863 ] 87864 87865 [ 87866 [[link boost_asio.reference.ip__address_v4.operator_lt__eq_ [*operator<=]]] 87867 [Compare addresses for ordering. ] 87868 ] 87869 87870 [ 87871 [[link boost_asio.reference.ip__address_v4.operator_eq__eq_ [*operator==]]] 87872 [Compare two addresses for equality. ] 87873 ] 87874 87875 [ 87876 [[link boost_asio.reference.ip__address_v4.operator_gt_ [*operator>]]] 87877 [Compare addresses for ordering. ] 87878 ] 87879 87880 [ 87881 [[link boost_asio.reference.ip__address_v4.operator_gt__eq_ [*operator>=]]] 87882 [Compare addresses for ordering. ] 87883 ] 87884 87885] 87886 87887[heading Related Functions] 87888[table 87889 [[Name][Description]] 87890 87891 [ 87892 [[link boost_asio.reference.ip__address_v4.make_address_v4 [*make_address_v4]]] 87893 [Create an IPv4 address from raw bytes in network order. 87894 87895 Create an IPv4 address from an unsigned integer in host byte order. 87896 87897 Create an IPv4 address from an IP address string in dotted decimal form. 87898 87899 Create an IPv4 address from a IPv4-mapped IPv6 address. ] 87900 ] 87901 87902 [ 87903 [[link boost_asio.reference.ip__address_v4.make_network_v4 [*make_network_v4]]] 87904 [Create an IPv4 network from an address and prefix length. 87905 87906 Create an IPv4 network from an address and netmask. ] 87907 ] 87908 87909 [ 87910 [[link boost_asio.reference.ip__address_v4.operator_lt__lt_ [*operator<<]]] 87911 [Output an address as a string. 87912 87913 Output a network as a string. ] 87914 ] 87915 87916] 87917 87918The [link boost_asio.reference.ip__address_v4 `ip::address_v4`] class provides the ability to use and manipulate IP version 4 addresses. 87919 87920 87921[heading Thread Safety] 87922 87923['Distinct] ['objects:] Safe. 87924 87925['Shared] ['objects:] Unsafe. 87926 87927 87928 87929 87930[heading Requirements] 87931 87932['Header: ][^boost/asio/ip/address_v4_iterator.hpp] 87933 87934['Convenience header: ][^boost/asio.hpp] 87935 87936 87937[endsect] 87938 87939 87940 87941[section:value_type ip::basic_address_iterator< address_v4 >::value_type] 87942 87943[indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.value_type..value_type..ip::basic_address_iterator< address_v4 >] 87944The type of the elements pointed to by the iterator. 87945 87946 87947 typedef address_v4 value_type; 87948 87949 87950[heading Types] 87951[table 87952 [[Name][Description]] 87953 87954 [ 87955 87956 [[link boost_asio.reference.ip__address_v4.bytes_type [*bytes_type]]] 87957 [The type used to represent an address as an array of bytes. ] 87958 87959 ] 87960 87961 [ 87962 87963 [[link boost_asio.reference.ip__address_v4.uint_type [*uint_type]]] 87964 [The type used to represent an address as an unsigned integer. ] 87965 87966 ] 87967 87968] 87969 87970[heading Member Functions] 87971[table 87972 [[Name][Description]] 87973 87974 [ 87975 [[link boost_asio.reference.ip__address_v4.address_v4 [*address_v4]] [constructor]] 87976 [Default constructor. 87977 [hr] 87978 Construct an address from raw bytes. 87979 [hr] 87980 Construct an address from an unsigned integer in host byte order. 87981 [hr] 87982 Copy constructor. ] 87983 ] 87984 87985 [ 87986 [[link boost_asio.reference.ip__address_v4.any [*any]] [static]] 87987 [Obtain an address object that represents any address. ] 87988 ] 87989 87990 [ 87991 [[link boost_asio.reference.ip__address_v4.broadcast [*broadcast]] [static]] 87992 [Obtain an address object that represents the broadcast address. 87993 [hr] 87994 (Deprecated: Use network_v4 class.) Obtain an address object that represents the broadcast address that corresponds to the specified address and netmask. ] 87995 ] 87996 87997 [ 87998 [[link boost_asio.reference.ip__address_v4.from_string [*from_string]] [static]] 87999 [(Deprecated: Use make_address_v4().) Create an address from an IP address string in dotted decimal form. ] 88000 ] 88001 88002 [ 88003 [[link boost_asio.reference.ip__address_v4.is_class_a [*is_class_a]]] 88004 [(Deprecated: Use network_v4 class.) Determine whether the address is a class A address. ] 88005 ] 88006 88007 [ 88008 [[link boost_asio.reference.ip__address_v4.is_class_b [*is_class_b]]] 88009 [(Deprecated: Use network_v4 class.) Determine whether the address is a class B address. ] 88010 ] 88011 88012 [ 88013 [[link boost_asio.reference.ip__address_v4.is_class_c [*is_class_c]]] 88014 [(Deprecated: Use network_v4 class.) Determine whether the address is a class C address. ] 88015 ] 88016 88017 [ 88018 [[link boost_asio.reference.ip__address_v4.is_loopback [*is_loopback]]] 88019 [Determine whether the address is a loopback address. ] 88020 ] 88021 88022 [ 88023 [[link boost_asio.reference.ip__address_v4.is_multicast [*is_multicast]]] 88024 [Determine whether the address is a multicast address. ] 88025 ] 88026 88027 [ 88028 [[link boost_asio.reference.ip__address_v4.is_unspecified [*is_unspecified]]] 88029 [Determine whether the address is unspecified. ] 88030 ] 88031 88032 [ 88033 [[link boost_asio.reference.ip__address_v4.loopback [*loopback]] [static]] 88034 [Obtain an address object that represents the loopback address. ] 88035 ] 88036 88037 [ 88038 [[link boost_asio.reference.ip__address_v4.netmask [*netmask]] [static]] 88039 [(Deprecated: Use network_v4 class.) Obtain the netmask that corresponds to the address, based on its address class. ] 88040 ] 88041 88042 [ 88043 [[link boost_asio.reference.ip__address_v4.operator_eq_ [*operator=]]] 88044 [Assign from another address. ] 88045 ] 88046 88047 [ 88048 [[link boost_asio.reference.ip__address_v4.to_bytes [*to_bytes]]] 88049 [Get the address in bytes, in network byte order. ] 88050 ] 88051 88052 [ 88053 [[link boost_asio.reference.ip__address_v4.to_string [*to_string]]] 88054 [Get the address as a string in dotted decimal format. 88055 [hr] 88056 (Deprecated: Use other overload.) Get the address as a string in dotted decimal format. ] 88057 ] 88058 88059 [ 88060 [[link boost_asio.reference.ip__address_v4.to_uint [*to_uint]]] 88061 [Get the address as an unsigned integer in host byte order. ] 88062 ] 88063 88064 [ 88065 [[link boost_asio.reference.ip__address_v4.to_ulong [*to_ulong]]] 88066 [Get the address as an unsigned long in host byte order. ] 88067 ] 88068 88069] 88070 88071[heading Friends] 88072[table 88073 [[Name][Description]] 88074 88075 [ 88076 [[link boost_asio.reference.ip__address_v4.operator_not__eq_ [*operator!=]]] 88077 [Compare two addresses for inequality. ] 88078 ] 88079 88080 [ 88081 [[link boost_asio.reference.ip__address_v4.operator_lt_ [*operator<]]] 88082 [Compare addresses for ordering. ] 88083 ] 88084 88085 [ 88086 [[link boost_asio.reference.ip__address_v4.operator_lt__eq_ [*operator<=]]] 88087 [Compare addresses for ordering. ] 88088 ] 88089 88090 [ 88091 [[link boost_asio.reference.ip__address_v4.operator_eq__eq_ [*operator==]]] 88092 [Compare two addresses for equality. ] 88093 ] 88094 88095 [ 88096 [[link boost_asio.reference.ip__address_v4.operator_gt_ [*operator>]]] 88097 [Compare addresses for ordering. ] 88098 ] 88099 88100 [ 88101 [[link boost_asio.reference.ip__address_v4.operator_gt__eq_ [*operator>=]]] 88102 [Compare addresses for ordering. ] 88103 ] 88104 88105] 88106 88107[heading Related Functions] 88108[table 88109 [[Name][Description]] 88110 88111 [ 88112 [[link boost_asio.reference.ip__address_v4.make_address_v4 [*make_address_v4]]] 88113 [Create an IPv4 address from raw bytes in network order. 88114 88115 Create an IPv4 address from an unsigned integer in host byte order. 88116 88117 Create an IPv4 address from an IP address string in dotted decimal form. 88118 88119 Create an IPv4 address from a IPv4-mapped IPv6 address. ] 88120 ] 88121 88122 [ 88123 [[link boost_asio.reference.ip__address_v4.make_network_v4 [*make_network_v4]]] 88124 [Create an IPv4 network from an address and prefix length. 88125 88126 Create an IPv4 network from an address and netmask. ] 88127 ] 88128 88129 [ 88130 [[link boost_asio.reference.ip__address_v4.operator_lt__lt_ [*operator<<]]] 88131 [Output an address as a string. 88132 88133 Output a network as a string. ] 88134 ] 88135 88136] 88137 88138The [link boost_asio.reference.ip__address_v4 `ip::address_v4`] class provides the ability to use and manipulate IP version 4 addresses. 88139 88140 88141[heading Thread Safety] 88142 88143['Distinct] ['objects:] Safe. 88144 88145['Shared] ['objects:] Unsafe. 88146 88147 88148 88149 88150[heading Requirements] 88151 88152['Header: ][^boost/asio/ip/address_v4_iterator.hpp] 88153 88154['Convenience header: ][^boost/asio.hpp] 88155 88156 88157[endsect] 88158 88159 88160 88161[endsect] 88162 88163[section:ip__basic_address_iterator_lt__address_v6__gt_ ip::basic_address_iterator< address_v6 >] 88164 88165[indexterm1 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_..ip::basic_address_iterator< address_v6 >] 88166 88167 88168An input iterator that can be used for traversing IPv6 addresses. 88169 88170 88171 template<> 88172 class basic_address_iterator< address_v6 > 88173 88174 88175[heading Types] 88176[table 88177 [[Name][Description]] 88178 88179 [ 88180 88181 [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.difference_type [*difference_type]]] 88182 [Distance between two iterators. ] 88183 88184 ] 88185 88186 [ 88187 88188 [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.iterator_category [*iterator_category]]] 88189 [Denotes that the iterator satisfies the input iterator requirements. ] 88190 88191 ] 88192 88193 [ 88194 88195 [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.pointer [*pointer]]] 88196 [The type of a pointer to an element pointed to by the iterator. ] 88197 88198 ] 88199 88200 [ 88201 88202 [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.reference [*reference]]] 88203 [The type of a reference to an element pointed to by the iterator. ] 88204 88205 ] 88206 88207 [ 88208 88209 [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.value_type [*value_type]]] 88210 [The type of the elements pointed to by the iterator. ] 88211 88212 ] 88213 88214] 88215 88216[heading Member Functions] 88217[table 88218 [[Name][Description]] 88219 88220 [ 88221 [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.basic_address_iterator [*basic_address_iterator]]] 88222 [Construct an iterator that points to the specified address. 88223 [hr] 88224 Copy constructor. ] 88225 ] 88226 88227 [ 88228 [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator__star_ [*operator *]]] 88229 [Dereference the iterator. ] 88230 ] 88231 88232 [ 88233 [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_plus__plus_ [*operator++]]] 88234 [Pre-increment operator. 88235 [hr] 88236 Post-increment operator. ] 88237 ] 88238 88239 [ 88240 [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_minus__minus_ [*operator--]]] 88241 [Pre-decrement operator. 88242 [hr] 88243 Post-decrement operator. ] 88244 ] 88245 88246 [ 88247 [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_arrow_ [*operator->]]] 88248 [Dereference the iterator. ] 88249 ] 88250 88251 [ 88252 [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_eq_ [*operator=]]] 88253 [Assignment operator. ] 88254 ] 88255 88256] 88257 88258[heading Friends] 88259[table 88260 [[Name][Description]] 88261 88262 [ 88263 [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_not__eq_ [*operator!=]]] 88264 [Compare two addresses for inequality. ] 88265 ] 88266 88267 [ 88268 [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_eq__eq_ [*operator==]]] 88269 [Compare two addresses for equality. ] 88270 ] 88271 88272] 88273 88274In addition to satisfying the input iterator requirements, this iterator also supports decrement. 88275 88276 88277[heading Thread Safety] 88278 88279['Distinct] ['objects:] Safe. 88280 88281['Shared] ['objects:] Unsafe. 88282 88283 88284 88285[heading Requirements] 88286 88287['Header: ][^boost/asio/ip/address_v6_iterator.hpp] 88288 88289['Convenience header: ][^boost/asio.hpp] 88290 88291[section:basic_address_iterator ip::basic_address_iterator< address_v6 >::basic_address_iterator] 88292 88293[indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.basic_address_iterator..basic_address_iterator..ip::basic_address_iterator< address_v6 >] 88294Construct an iterator that points to the specified address. 88295 88296 88297 ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.basic_address_iterator.overload1 basic_address_iterator]``( 88298 const address_v6 & addr); 88299 `` [''''»''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.basic_address_iterator.overload1 more...]]`` 88300 88301 88302Copy constructor. 88303 88304 88305 ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.basic_address_iterator.overload2 basic_address_iterator]``( 88306 const basic_address_iterator & other); 88307 `` [''''»''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.basic_address_iterator.overload2 more...]]`` 88308 88309 88310[section:overload1 ip::basic_address_iterator< address_v6 >::basic_address_iterator (1 of 2 overloads)] 88311 88312 88313Construct an iterator that points to the specified address. 88314 88315 88316 basic_address_iterator( 88317 const address_v6 & addr); 88318 88319 88320 88321[endsect] 88322 88323 88324 88325[section:overload2 ip::basic_address_iterator< address_v6 >::basic_address_iterator (2 of 2 overloads)] 88326 88327 88328Copy constructor. 88329 88330 88331 basic_address_iterator( 88332 const basic_address_iterator & other); 88333 88334 88335 88336[endsect] 88337 88338 88339[endsect] 88340 88341 88342[section:difference_type ip::basic_address_iterator< address_v6 >::difference_type] 88343 88344[indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.difference_type..difference_type..ip::basic_address_iterator< address_v6 >] 88345Distance between two iterators. 88346 88347 88348 typedef std::ptrdiff_t difference_type; 88349 88350 88351 88352[heading Requirements] 88353 88354['Header: ][^boost/asio/ip/address_v6_iterator.hpp] 88355 88356['Convenience header: ][^boost/asio.hpp] 88357 88358 88359[endsect] 88360 88361 88362 88363[section:iterator_category ip::basic_address_iterator< address_v6 >::iterator_category] 88364 88365[indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.iterator_category..iterator_category..ip::basic_address_iterator< address_v6 >] 88366Denotes that the iterator satisfies the input iterator requirements. 88367 88368 88369 typedef std::input_iterator_tag iterator_category; 88370 88371 88372 88373[heading Requirements] 88374 88375['Header: ][^boost/asio/ip/address_v6_iterator.hpp] 88376 88377['Convenience header: ][^boost/asio.hpp] 88378 88379 88380[endsect] 88381 88382 88383 88384[section:operator__star_ ip::basic_address_iterator< address_v6 >::operator *] 88385 88386[indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.operator__star_..operator *..ip::basic_address_iterator< address_v6 >] 88387Dereference the iterator. 88388 88389 88390 const address_v6 & operator *() const; 88391 88392 88393 88394[endsect] 88395 88396 88397 88398[section:operator_not__eq_ ip::basic_address_iterator< address_v6 >::operator!=] 88399 88400[indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.operator_not__eq_..operator!=..ip::basic_address_iterator< address_v6 >] 88401Compare two addresses for inequality. 88402 88403 88404 friend bool operator!=( 88405 const basic_address_iterator & a, 88406 const basic_address_iterator & b); 88407 88408 88409[heading Requirements] 88410 88411['Header: ][^boost/asio/ip/address_v6_iterator.hpp] 88412 88413['Convenience header: ][^boost/asio.hpp] 88414 88415 88416[endsect] 88417 88418 88419[section:operator_plus__plus_ ip::basic_address_iterator< address_v6 >::operator++] 88420 88421[indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.operator_plus__plus_..operator++..ip::basic_address_iterator< address_v6 >] 88422Pre-increment operator. 88423 88424 88425 basic_address_iterator & ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_plus__plus_.overload1 operator++]``(); 88426 `` [''''»''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_plus__plus_.overload1 more...]]`` 88427 88428 88429Post-increment operator. 88430 88431 88432 basic_address_iterator ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_plus__plus_.overload2 operator++]``( 88433 int ); 88434 `` [''''»''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_plus__plus_.overload2 more...]]`` 88435 88436 88437[section:overload1 ip::basic_address_iterator< address_v6 >::operator++ (1 of 2 overloads)] 88438 88439 88440Pre-increment operator. 88441 88442 88443 basic_address_iterator & operator++(); 88444 88445 88446 88447[endsect] 88448 88449 88450 88451[section:overload2 ip::basic_address_iterator< address_v6 >::operator++ (2 of 2 overloads)] 88452 88453 88454Post-increment operator. 88455 88456 88457 basic_address_iterator operator++( 88458 int ); 88459 88460 88461 88462[endsect] 88463 88464 88465[endsect] 88466 88467[section:operator_minus__minus_ ip::basic_address_iterator< address_v6 >::operator--] 88468 88469[indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.operator_minus__minus_..operator--..ip::basic_address_iterator< address_v6 >] 88470Pre-decrement operator. 88471 88472 88473 basic_address_iterator & ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_minus__minus_.overload1 operator--]``(); 88474 `` [''''»''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_minus__minus_.overload1 more...]]`` 88475 88476 88477Post-decrement operator. 88478 88479 88480 basic_address_iterator ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_minus__minus_.overload2 operator--]``( 88481 int ); 88482 `` [''''»''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_minus__minus_.overload2 more...]]`` 88483 88484 88485[section:overload1 ip::basic_address_iterator< address_v6 >::operator-- (1 of 2 overloads)] 88486 88487 88488Pre-decrement operator. 88489 88490 88491 basic_address_iterator & operator--(); 88492 88493 88494 88495[endsect] 88496 88497 88498 88499[section:overload2 ip::basic_address_iterator< address_v6 >::operator-- (2 of 2 overloads)] 88500 88501 88502Post-decrement operator. 88503 88504 88505 basic_address_iterator operator--( 88506 int ); 88507 88508 88509 88510[endsect] 88511 88512 88513[endsect] 88514 88515 88516[section:operator_arrow_ ip::basic_address_iterator< address_v6 >::operator->] 88517 88518[indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.operator_arrow_..operator->..ip::basic_address_iterator< address_v6 >] 88519Dereference the iterator. 88520 88521 88522 const address_v6 * operator->() const; 88523 88524 88525 88526[endsect] 88527 88528 88529 88530[section:operator_eq_ ip::basic_address_iterator< address_v6 >::operator=] 88531 88532[indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.operator_eq_..operator=..ip::basic_address_iterator< address_v6 >] 88533Assignment operator. 88534 88535 88536 basic_address_iterator & operator=( 88537 const basic_address_iterator & other); 88538 88539 88540 88541[endsect] 88542 88543 88544 88545[section:operator_eq__eq_ ip::basic_address_iterator< address_v6 >::operator==] 88546 88547[indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.operator_eq__eq_..operator==..ip::basic_address_iterator< address_v6 >] 88548Compare two addresses for equality. 88549 88550 88551 friend bool operator==( 88552 const basic_address_iterator & a, 88553 const basic_address_iterator & b); 88554 88555 88556[heading Requirements] 88557 88558['Header: ][^boost/asio/ip/address_v6_iterator.hpp] 88559 88560['Convenience header: ][^boost/asio.hpp] 88561 88562 88563[endsect] 88564 88565 88566 88567[section:pointer ip::basic_address_iterator< address_v6 >::pointer] 88568 88569[indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.pointer..pointer..ip::basic_address_iterator< address_v6 >] 88570The type of a pointer to an element pointed to by the iterator. 88571 88572 88573 typedef const address_v6 * pointer; 88574 88575 88576 88577[heading Requirements] 88578 88579['Header: ][^boost/asio/ip/address_v6_iterator.hpp] 88580 88581['Convenience header: ][^boost/asio.hpp] 88582 88583 88584[endsect] 88585 88586 88587 88588[section:reference ip::basic_address_iterator< address_v6 >::reference] 88589 88590[indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.reference..reference..ip::basic_address_iterator< address_v6 >] 88591The type of a reference to an element pointed to by the iterator. 88592 88593 88594 typedef const address_v6 & reference; 88595 88596 88597[heading Types] 88598[table 88599 [[Name][Description]] 88600 88601 [ 88602 88603 [[link boost_asio.reference.ip__address_v6.bytes_type [*bytes_type]]] 88604 [The type used to represent an address as an array of bytes. ] 88605 88606 ] 88607 88608] 88609 88610[heading Member Functions] 88611[table 88612 [[Name][Description]] 88613 88614 [ 88615 [[link boost_asio.reference.ip__address_v6.address_v6 [*address_v6]] [constructor]] 88616 [Default constructor. 88617 [hr] 88618 Construct an address from raw bytes and scope ID. 88619 [hr] 88620 Copy constructor. ] 88621 ] 88622 88623 [ 88624 [[link boost_asio.reference.ip__address_v6.any [*any]] [static]] 88625 [Obtain an address object that represents any address. ] 88626 ] 88627 88628 [ 88629 [[link boost_asio.reference.ip__address_v6.from_string [*from_string]] [static]] 88630 [(Deprecated: Use make_address_v6().) Create an IPv6 address from an IP address string. ] 88631 ] 88632 88633 [ 88634 [[link boost_asio.reference.ip__address_v6.is_link_local [*is_link_local]]] 88635 [Determine whether the address is link local. ] 88636 ] 88637 88638 [ 88639 [[link boost_asio.reference.ip__address_v6.is_loopback [*is_loopback]]] 88640 [Determine whether the address is a loopback address. ] 88641 ] 88642 88643 [ 88644 [[link boost_asio.reference.ip__address_v6.is_multicast [*is_multicast]]] 88645 [Determine whether the address is a multicast address. ] 88646 ] 88647 88648 [ 88649 [[link boost_asio.reference.ip__address_v6.is_multicast_global [*is_multicast_global]]] 88650 [Determine whether the address is a global multicast address. ] 88651 ] 88652 88653 [ 88654 [[link boost_asio.reference.ip__address_v6.is_multicast_link_local [*is_multicast_link_local]]] 88655 [Determine whether the address is a link-local multicast address. ] 88656 ] 88657 88658 [ 88659 [[link boost_asio.reference.ip__address_v6.is_multicast_node_local [*is_multicast_node_local]]] 88660 [Determine whether the address is a node-local multicast address. ] 88661 ] 88662 88663 [ 88664 [[link boost_asio.reference.ip__address_v6.is_multicast_org_local [*is_multicast_org_local]]] 88665 [Determine whether the address is a org-local multicast address. ] 88666 ] 88667 88668 [ 88669 [[link boost_asio.reference.ip__address_v6.is_multicast_site_local [*is_multicast_site_local]]] 88670 [Determine whether the address is a site-local multicast address. ] 88671 ] 88672 88673 [ 88674 [[link boost_asio.reference.ip__address_v6.is_site_local [*is_site_local]]] 88675 [Determine whether the address is site local. ] 88676 ] 88677 88678 [ 88679 [[link boost_asio.reference.ip__address_v6.is_unspecified [*is_unspecified]]] 88680 [Determine whether the address is unspecified. ] 88681 ] 88682 88683 [ 88684 [[link boost_asio.reference.ip__address_v6.is_v4_compatible [*is_v4_compatible]]] 88685 [(Deprecated: No replacement.) Determine whether the address is an IPv4-compatible address. ] 88686 ] 88687 88688 [ 88689 [[link boost_asio.reference.ip__address_v6.is_v4_mapped [*is_v4_mapped]]] 88690 [Determine whether the address is a mapped IPv4 address. ] 88691 ] 88692 88693 [ 88694 [[link boost_asio.reference.ip__address_v6.loopback [*loopback]] [static]] 88695 [Obtain an address object that represents the loopback address. ] 88696 ] 88697 88698 [ 88699 [[link boost_asio.reference.ip__address_v6.operator_eq_ [*operator=]]] 88700 [Assign from another address. ] 88701 ] 88702 88703 [ 88704 [[link boost_asio.reference.ip__address_v6.scope_id [*scope_id]]] 88705 [The scope ID of the address. ] 88706 ] 88707 88708 [ 88709 [[link boost_asio.reference.ip__address_v6.to_bytes [*to_bytes]]] 88710 [Get the address in bytes, in network byte order. ] 88711 ] 88712 88713 [ 88714 [[link boost_asio.reference.ip__address_v6.to_string [*to_string]]] 88715 [Get the address as a string. 88716 [hr] 88717 (Deprecated: Use other overload.) Get the address as a string. ] 88718 ] 88719 88720 [ 88721 [[link boost_asio.reference.ip__address_v6.to_v4 [*to_v4]]] 88722 [(Deprecated: Use make_address_v4().) Converts an IPv4-mapped or IPv4-compatible address to an IPv4 address. ] 88723 ] 88724 88725 [ 88726 [[link boost_asio.reference.ip__address_v6.v4_compatible [*v4_compatible]] [static]] 88727 [(Deprecated: No replacement.) Create an IPv4-compatible IPv6 address. ] 88728 ] 88729 88730 [ 88731 [[link boost_asio.reference.ip__address_v6.v4_mapped [*v4_mapped]] [static]] 88732 [(Deprecated: Use make_address_v6().) Create an IPv4-mapped IPv6 address. ] 88733 ] 88734 88735] 88736 88737[heading Friends] 88738[table 88739 [[Name][Description]] 88740 88741 [ 88742 [[link boost_asio.reference.ip__address_v6.operator_not__eq_ [*operator!=]]] 88743 [Compare two addresses for inequality. ] 88744 ] 88745 88746 [ 88747 [[link boost_asio.reference.ip__address_v6.operator_lt_ [*operator<]]] 88748 [Compare addresses for ordering. ] 88749 ] 88750 88751 [ 88752 [[link boost_asio.reference.ip__address_v6.operator_lt__eq_ [*operator<=]]] 88753 [Compare addresses for ordering. ] 88754 ] 88755 88756 [ 88757 [[link boost_asio.reference.ip__address_v6.operator_eq__eq_ [*operator==]]] 88758 [Compare two addresses for equality. ] 88759 ] 88760 88761 [ 88762 [[link boost_asio.reference.ip__address_v6.operator_gt_ [*operator>]]] 88763 [Compare addresses for ordering. ] 88764 ] 88765 88766 [ 88767 [[link boost_asio.reference.ip__address_v6.operator_gt__eq_ [*operator>=]]] 88768 [Compare addresses for ordering. ] 88769 ] 88770 88771] 88772 88773[heading Related Functions] 88774[table 88775 [[Name][Description]] 88776 88777 [ 88778 [[link boost_asio.reference.ip__address_v6.make_address_v6 [*make_address_v6]]] 88779 [Create an IPv6 address from raw bytes and scope ID. 88780 88781 Create an IPv6 address from an IP address string. 88782 88783 Createan IPv6 address from an IP address string. 88784 88785 Create an IPv4-mapped IPv6 address from an IPv4 address. ] 88786 ] 88787 88788 [ 88789 [[link boost_asio.reference.ip__address_v6.make_network_v6 [*make_network_v6]]] 88790 [Create an IPv6 network from an address and prefix length. ] 88791 ] 88792 88793 [ 88794 [[link boost_asio.reference.ip__address_v6.operator_lt__lt_ [*operator<<]]] 88795 [Output an address as a string. 88796 88797 Output a network as a string. ] 88798 ] 88799 88800] 88801 88802The [link boost_asio.reference.ip__address_v6 `ip::address_v6`] class provides the ability to use and manipulate IP version 6 addresses. 88803 88804 88805[heading Thread Safety] 88806 88807['Distinct] ['objects:] Safe. 88808 88809['Shared] ['objects:] Unsafe. 88810 88811 88812 88813 88814[heading Requirements] 88815 88816['Header: ][^boost/asio/ip/address_v6_iterator.hpp] 88817 88818['Convenience header: ][^boost/asio.hpp] 88819 88820 88821[endsect] 88822 88823 88824 88825[section:value_type ip::basic_address_iterator< address_v6 >::value_type] 88826 88827[indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.value_type..value_type..ip::basic_address_iterator< address_v6 >] 88828The type of the elements pointed to by the iterator. 88829 88830 88831 typedef address_v6 value_type; 88832 88833 88834[heading Types] 88835[table 88836 [[Name][Description]] 88837 88838 [ 88839 88840 [[link boost_asio.reference.ip__address_v6.bytes_type [*bytes_type]]] 88841 [The type used to represent an address as an array of bytes. ] 88842 88843 ] 88844 88845] 88846 88847[heading Member Functions] 88848[table 88849 [[Name][Description]] 88850 88851 [ 88852 [[link boost_asio.reference.ip__address_v6.address_v6 [*address_v6]] [constructor]] 88853 [Default constructor. 88854 [hr] 88855 Construct an address from raw bytes and scope ID. 88856 [hr] 88857 Copy constructor. ] 88858 ] 88859 88860 [ 88861 [[link boost_asio.reference.ip__address_v6.any [*any]] [static]] 88862 [Obtain an address object that represents any address. ] 88863 ] 88864 88865 [ 88866 [[link boost_asio.reference.ip__address_v6.from_string [*from_string]] [static]] 88867 [(Deprecated: Use make_address_v6().) Create an IPv6 address from an IP address string. ] 88868 ] 88869 88870 [ 88871 [[link boost_asio.reference.ip__address_v6.is_link_local [*is_link_local]]] 88872 [Determine whether the address is link local. ] 88873 ] 88874 88875 [ 88876 [[link boost_asio.reference.ip__address_v6.is_loopback [*is_loopback]]] 88877 [Determine whether the address is a loopback address. ] 88878 ] 88879 88880 [ 88881 [[link boost_asio.reference.ip__address_v6.is_multicast [*is_multicast]]] 88882 [Determine whether the address is a multicast address. ] 88883 ] 88884 88885 [ 88886 [[link boost_asio.reference.ip__address_v6.is_multicast_global [*is_multicast_global]]] 88887 [Determine whether the address is a global multicast address. ] 88888 ] 88889 88890 [ 88891 [[link boost_asio.reference.ip__address_v6.is_multicast_link_local [*is_multicast_link_local]]] 88892 [Determine whether the address is a link-local multicast address. ] 88893 ] 88894 88895 [ 88896 [[link boost_asio.reference.ip__address_v6.is_multicast_node_local [*is_multicast_node_local]]] 88897 [Determine whether the address is a node-local multicast address. ] 88898 ] 88899 88900 [ 88901 [[link boost_asio.reference.ip__address_v6.is_multicast_org_local [*is_multicast_org_local]]] 88902 [Determine whether the address is a org-local multicast address. ] 88903 ] 88904 88905 [ 88906 [[link boost_asio.reference.ip__address_v6.is_multicast_site_local [*is_multicast_site_local]]] 88907 [Determine whether the address is a site-local multicast address. ] 88908 ] 88909 88910 [ 88911 [[link boost_asio.reference.ip__address_v6.is_site_local [*is_site_local]]] 88912 [Determine whether the address is site local. ] 88913 ] 88914 88915 [ 88916 [[link boost_asio.reference.ip__address_v6.is_unspecified [*is_unspecified]]] 88917 [Determine whether the address is unspecified. ] 88918 ] 88919 88920 [ 88921 [[link boost_asio.reference.ip__address_v6.is_v4_compatible [*is_v4_compatible]]] 88922 [(Deprecated: No replacement.) Determine whether the address is an IPv4-compatible address. ] 88923 ] 88924 88925 [ 88926 [[link boost_asio.reference.ip__address_v6.is_v4_mapped [*is_v4_mapped]]] 88927 [Determine whether the address is a mapped IPv4 address. ] 88928 ] 88929 88930 [ 88931 [[link boost_asio.reference.ip__address_v6.loopback [*loopback]] [static]] 88932 [Obtain an address object that represents the loopback address. ] 88933 ] 88934 88935 [ 88936 [[link boost_asio.reference.ip__address_v6.operator_eq_ [*operator=]]] 88937 [Assign from another address. ] 88938 ] 88939 88940 [ 88941 [[link boost_asio.reference.ip__address_v6.scope_id [*scope_id]]] 88942 [The scope ID of the address. ] 88943 ] 88944 88945 [ 88946 [[link boost_asio.reference.ip__address_v6.to_bytes [*to_bytes]]] 88947 [Get the address in bytes, in network byte order. ] 88948 ] 88949 88950 [ 88951 [[link boost_asio.reference.ip__address_v6.to_string [*to_string]]] 88952 [Get the address as a string. 88953 [hr] 88954 (Deprecated: Use other overload.) Get the address as a string. ] 88955 ] 88956 88957 [ 88958 [[link boost_asio.reference.ip__address_v6.to_v4 [*to_v4]]] 88959 [(Deprecated: Use make_address_v4().) Converts an IPv4-mapped or IPv4-compatible address to an IPv4 address. ] 88960 ] 88961 88962 [ 88963 [[link boost_asio.reference.ip__address_v6.v4_compatible [*v4_compatible]] [static]] 88964 [(Deprecated: No replacement.) Create an IPv4-compatible IPv6 address. ] 88965 ] 88966 88967 [ 88968 [[link boost_asio.reference.ip__address_v6.v4_mapped [*v4_mapped]] [static]] 88969 [(Deprecated: Use make_address_v6().) Create an IPv4-mapped IPv6 address. ] 88970 ] 88971 88972] 88973 88974[heading Friends] 88975[table 88976 [[Name][Description]] 88977 88978 [ 88979 [[link boost_asio.reference.ip__address_v6.operator_not__eq_ [*operator!=]]] 88980 [Compare two addresses for inequality. ] 88981 ] 88982 88983 [ 88984 [[link boost_asio.reference.ip__address_v6.operator_lt_ [*operator<]]] 88985 [Compare addresses for ordering. ] 88986 ] 88987 88988 [ 88989 [[link boost_asio.reference.ip__address_v6.operator_lt__eq_ [*operator<=]]] 88990 [Compare addresses for ordering. ] 88991 ] 88992 88993 [ 88994 [[link boost_asio.reference.ip__address_v6.operator_eq__eq_ [*operator==]]] 88995 [Compare two addresses for equality. ] 88996 ] 88997 88998 [ 88999 [[link boost_asio.reference.ip__address_v6.operator_gt_ [*operator>]]] 89000 [Compare addresses for ordering. ] 89001 ] 89002 89003 [ 89004 [[link boost_asio.reference.ip__address_v6.operator_gt__eq_ [*operator>=]]] 89005 [Compare addresses for ordering. ] 89006 ] 89007 89008] 89009 89010[heading Related Functions] 89011[table 89012 [[Name][Description]] 89013 89014 [ 89015 [[link boost_asio.reference.ip__address_v6.make_address_v6 [*make_address_v6]]] 89016 [Create an IPv6 address from raw bytes and scope ID. 89017 89018 Create an IPv6 address from an IP address string. 89019 89020 Createan IPv6 address from an IP address string. 89021 89022 Create an IPv4-mapped IPv6 address from an IPv4 address. ] 89023 ] 89024 89025 [ 89026 [[link boost_asio.reference.ip__address_v6.make_network_v6 [*make_network_v6]]] 89027 [Create an IPv6 network from an address and prefix length. ] 89028 ] 89029 89030 [ 89031 [[link boost_asio.reference.ip__address_v6.operator_lt__lt_ [*operator<<]]] 89032 [Output an address as a string. 89033 89034 Output a network as a string. ] 89035 ] 89036 89037] 89038 89039The [link boost_asio.reference.ip__address_v6 `ip::address_v6`] class provides the ability to use and manipulate IP version 6 addresses. 89040 89041 89042[heading Thread Safety] 89043 89044['Distinct] ['objects:] Safe. 89045 89046['Shared] ['objects:] Unsafe. 89047 89048 89049 89050 89051[heading Requirements] 89052 89053['Header: ][^boost/asio/ip/address_v6_iterator.hpp] 89054 89055['Convenience header: ][^boost/asio.hpp] 89056 89057 89058[endsect] 89059 89060 89061 89062[endsect] 89063 89064[section:ip__basic_address_range_lt__address_v4__gt_ ip::basic_address_range< address_v4 >] 89065 89066[indexterm1 boost_asio.indexterm.ip__basic_address_range_lt__address_v4__gt_..ip::basic_address_range< address_v4 >] 89067 89068 89069Represents a range of IPv4 addresses. 89070 89071 89072 template<> 89073 class basic_address_range< address_v4 > 89074 89075 89076[heading Types] 89077[table 89078 [[Name][Description]] 89079 89080 [ 89081 89082 [[link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.iterator [*iterator]]] 89083 [The type of an iterator that points into the range. ] 89084 89085 ] 89086 89087] 89088 89089[heading Member Functions] 89090[table 89091 [[Name][Description]] 89092 89093 [ 89094 [[link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.basic_address_range [*basic_address_range]]] 89095 [Construct an empty range. 89096 [hr] 89097 Construct an range that represents the given range of addresses. 89098 [hr] 89099 Copy constructor. ] 89100 ] 89101 89102 [ 89103 [[link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.begin [*begin]]] 89104 [Obtain an iterator that points to the start of the range. ] 89105 ] 89106 89107 [ 89108 [[link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.empty [*empty]]] 89109 [Determine whether the range is empty. ] 89110 ] 89111 89112 [ 89113 [[link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.end [*end]]] 89114 [Obtain an iterator that points to the end of the range. ] 89115 ] 89116 89117 [ 89118 [[link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.find [*find]]] 89119 [Find an address in the range. ] 89120 ] 89121 89122 [ 89123 [[link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.operator_eq_ [*operator=]]] 89124 [Assignment operator. ] 89125 ] 89126 89127 [ 89128 [[link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.size [*size]]] 89129 [Return the size of the range. ] 89130 ] 89131 89132] 89133 89134 89135[heading Thread Safety] 89136 89137['Distinct] ['objects:] Safe. 89138 89139['Shared] ['objects:] Unsafe. 89140 89141 89142 89143[heading Requirements] 89144 89145['Header: ][^boost/asio/ip/address_v4_range.hpp] 89146 89147['Convenience header: ][^boost/asio.hpp] 89148 89149[section:basic_address_range ip::basic_address_range< address_v4 >::basic_address_range] 89150 89151[indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v4__gt_.basic_address_range..basic_address_range..ip::basic_address_range< address_v4 >] 89152Construct an empty range. 89153 89154 89155 ``[link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.basic_address_range.overload1 basic_address_range]``(); 89156 `` [''''»''' [link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.basic_address_range.overload1 more...]]`` 89157 89158 89159Construct an range that represents the given range of addresses. 89160 89161 89162 explicit ``[link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.basic_address_range.overload2 basic_address_range]``( 89163 const iterator & first, 89164 const iterator & last); 89165 `` [''''»''' [link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.basic_address_range.overload2 more...]]`` 89166 89167 89168Copy constructor. 89169 89170 89171 ``[link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.basic_address_range.overload3 basic_address_range]``( 89172 const basic_address_range & other); 89173 `` [''''»''' [link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.basic_address_range.overload3 more...]]`` 89174 89175 89176[section:overload1 ip::basic_address_range< address_v4 >::basic_address_range (1 of 3 overloads)] 89177 89178 89179Construct an empty range. 89180 89181 89182 basic_address_range(); 89183 89184 89185 89186[endsect] 89187 89188 89189 89190[section:overload2 ip::basic_address_range< address_v4 >::basic_address_range (2 of 3 overloads)] 89191 89192 89193Construct an range that represents the given range of addresses. 89194 89195 89196 basic_address_range( 89197 const iterator & first, 89198 const iterator & last); 89199 89200 89201 89202[endsect] 89203 89204 89205 89206[section:overload3 ip::basic_address_range< address_v4 >::basic_address_range (3 of 3 overloads)] 89207 89208 89209Copy constructor. 89210 89211 89212 basic_address_range( 89213 const basic_address_range & other); 89214 89215 89216 89217[endsect] 89218 89219 89220[endsect] 89221 89222 89223[section:begin ip::basic_address_range< address_v4 >::begin] 89224 89225[indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v4__gt_.begin..begin..ip::basic_address_range< address_v4 >] 89226Obtain an iterator that points to the start of the range. 89227 89228 89229 iterator begin() const; 89230 89231 89232 89233[endsect] 89234 89235 89236 89237[section:empty ip::basic_address_range< address_v4 >::empty] 89238 89239[indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v4__gt_.empty..empty..ip::basic_address_range< address_v4 >] 89240Determine whether the range is empty. 89241 89242 89243 bool empty() const; 89244 89245 89246 89247[endsect] 89248 89249 89250 89251[section:end ip::basic_address_range< address_v4 >::end] 89252 89253[indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v4__gt_.end..end..ip::basic_address_range< address_v4 >] 89254Obtain an iterator that points to the end of the range. 89255 89256 89257 iterator end() const; 89258 89259 89260 89261[endsect] 89262 89263 89264 89265[section:find ip::basic_address_range< address_v4 >::find] 89266 89267[indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v4__gt_.find..find..ip::basic_address_range< address_v4 >] 89268Find an address in the range. 89269 89270 89271 iterator find( 89272 const address_v4 & addr) const; 89273 89274 89275 89276[endsect] 89277 89278 89279 89280[section:iterator ip::basic_address_range< address_v4 >::iterator] 89281 89282[indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v4__gt_.iterator..iterator..ip::basic_address_range< address_v4 >] 89283The type of an iterator that points into the range. 89284 89285 89286 typedef basic_address_iterator< address_v4 > iterator; 89287 89288 89289 89290[heading Requirements] 89291 89292['Header: ][^boost/asio/ip/address_v4_range.hpp] 89293 89294['Convenience header: ][^boost/asio.hpp] 89295 89296 89297[endsect] 89298 89299 89300 89301[section:operator_eq_ ip::basic_address_range< address_v4 >::operator=] 89302 89303[indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v4__gt_.operator_eq_..operator=..ip::basic_address_range< address_v4 >] 89304Assignment operator. 89305 89306 89307 basic_address_range & operator=( 89308 const basic_address_range & other); 89309 89310 89311 89312[endsect] 89313 89314 89315 89316[section:size ip::basic_address_range< address_v4 >::size] 89317 89318[indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v4__gt_.size..size..ip::basic_address_range< address_v4 >] 89319Return the size of the range. 89320 89321 89322 std::size_t size() const; 89323 89324 89325 89326[endsect] 89327 89328 89329 89330[endsect] 89331 89332[section:ip__basic_address_range_lt__address_v6__gt_ ip::basic_address_range< address_v6 >] 89333 89334[indexterm1 boost_asio.indexterm.ip__basic_address_range_lt__address_v6__gt_..ip::basic_address_range< address_v6 >] 89335 89336 89337Represents a range of IPv6 addresses. 89338 89339 89340 template<> 89341 class basic_address_range< address_v6 > 89342 89343 89344[heading Types] 89345[table 89346 [[Name][Description]] 89347 89348 [ 89349 89350 [[link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.iterator [*iterator]]] 89351 [The type of an iterator that points into the range. ] 89352 89353 ] 89354 89355] 89356 89357[heading Member Functions] 89358[table 89359 [[Name][Description]] 89360 89361 [ 89362 [[link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.basic_address_range [*basic_address_range]]] 89363 [Construct an empty range. 89364 [hr] 89365 Construct an range that represents the given range of addresses. 89366 [hr] 89367 Copy constructor. ] 89368 ] 89369 89370 [ 89371 [[link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.begin [*begin]]] 89372 [Obtain an iterator that points to the start of the range. ] 89373 ] 89374 89375 [ 89376 [[link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.empty [*empty]]] 89377 [Determine whether the range is empty. ] 89378 ] 89379 89380 [ 89381 [[link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.end [*end]]] 89382 [Obtain an iterator that points to the end of the range. ] 89383 ] 89384 89385 [ 89386 [[link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.find [*find]]] 89387 [Find an address in the range. ] 89388 ] 89389 89390 [ 89391 [[link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.operator_eq_ [*operator=]]] 89392 [Assignment operator. ] 89393 ] 89394 89395] 89396 89397 89398[heading Thread Safety] 89399 89400['Distinct] ['objects:] Safe. 89401 89402['Shared] ['objects:] Unsafe. 89403 89404 89405 89406[heading Requirements] 89407 89408['Header: ][^boost/asio/ip/address_v6_range.hpp] 89409 89410['Convenience header: ][^boost/asio.hpp] 89411 89412[section:basic_address_range ip::basic_address_range< address_v6 >::basic_address_range] 89413 89414[indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v6__gt_.basic_address_range..basic_address_range..ip::basic_address_range< address_v6 >] 89415Construct an empty range. 89416 89417 89418 ``[link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.basic_address_range.overload1 basic_address_range]``(); 89419 `` [''''»''' [link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.basic_address_range.overload1 more...]]`` 89420 89421 89422Construct an range that represents the given range of addresses. 89423 89424 89425 explicit ``[link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.basic_address_range.overload2 basic_address_range]``( 89426 const iterator & first, 89427 const iterator & last); 89428 `` [''''»''' [link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.basic_address_range.overload2 more...]]`` 89429 89430 89431Copy constructor. 89432 89433 89434 ``[link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.basic_address_range.overload3 basic_address_range]``( 89435 const basic_address_range & other); 89436 `` [''''»''' [link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.basic_address_range.overload3 more...]]`` 89437 89438 89439[section:overload1 ip::basic_address_range< address_v6 >::basic_address_range (1 of 3 overloads)] 89440 89441 89442Construct an empty range. 89443 89444 89445 basic_address_range(); 89446 89447 89448 89449[endsect] 89450 89451 89452 89453[section:overload2 ip::basic_address_range< address_v6 >::basic_address_range (2 of 3 overloads)] 89454 89455 89456Construct an range that represents the given range of addresses. 89457 89458 89459 basic_address_range( 89460 const iterator & first, 89461 const iterator & last); 89462 89463 89464 89465[endsect] 89466 89467 89468 89469[section:overload3 ip::basic_address_range< address_v6 >::basic_address_range (3 of 3 overloads)] 89470 89471 89472Copy constructor. 89473 89474 89475 basic_address_range( 89476 const basic_address_range & other); 89477 89478 89479 89480[endsect] 89481 89482 89483[endsect] 89484 89485 89486[section:begin ip::basic_address_range< address_v6 >::begin] 89487 89488[indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v6__gt_.begin..begin..ip::basic_address_range< address_v6 >] 89489Obtain an iterator that points to the start of the range. 89490 89491 89492 iterator begin() const; 89493 89494 89495 89496[endsect] 89497 89498 89499 89500[section:empty ip::basic_address_range< address_v6 >::empty] 89501 89502[indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v6__gt_.empty..empty..ip::basic_address_range< address_v6 >] 89503Determine whether the range is empty. 89504 89505 89506 bool empty() const; 89507 89508 89509 89510[endsect] 89511 89512 89513 89514[section:end ip::basic_address_range< address_v6 >::end] 89515 89516[indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v6__gt_.end..end..ip::basic_address_range< address_v6 >] 89517Obtain an iterator that points to the end of the range. 89518 89519 89520 iterator end() const; 89521 89522 89523 89524[endsect] 89525 89526 89527 89528[section:find ip::basic_address_range< address_v6 >::find] 89529 89530[indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v6__gt_.find..find..ip::basic_address_range< address_v6 >] 89531Find an address in the range. 89532 89533 89534 iterator find( 89535 const address_v6 & addr) const; 89536 89537 89538 89539[endsect] 89540 89541 89542 89543[section:iterator ip::basic_address_range< address_v6 >::iterator] 89544 89545[indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v6__gt_.iterator..iterator..ip::basic_address_range< address_v6 >] 89546The type of an iterator that points into the range. 89547 89548 89549 typedef basic_address_iterator< address_v6 > iterator; 89550 89551 89552 89553[heading Requirements] 89554 89555['Header: ][^boost/asio/ip/address_v6_range.hpp] 89556 89557['Convenience header: ][^boost/asio.hpp] 89558 89559 89560[endsect] 89561 89562 89563 89564[section:operator_eq_ ip::basic_address_range< address_v6 >::operator=] 89565 89566[indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v6__gt_.operator_eq_..operator=..ip::basic_address_range< address_v6 >] 89567Assignment operator. 89568 89569 89570 basic_address_range & operator=( 89571 const basic_address_range & other); 89572 89573 89574 89575[endsect] 89576 89577 89578 89579[endsect] 89580 89581[section:ip__basic_endpoint ip::basic_endpoint] 89582 89583[indexterm1 boost_asio.indexterm.ip__basic_endpoint..ip::basic_endpoint] 89584 89585 89586Describes an endpoint for a version-independent IP socket. 89587 89588 89589 template< 89590 typename ``[link boost_asio.reference.InternetProtocol InternetProtocol]``> 89591 class basic_endpoint 89592 89593 89594[heading Types] 89595[table 89596 [[Name][Description]] 89597 89598 [ 89599 89600 [[link boost_asio.reference.ip__basic_endpoint.data_type [*data_type]]] 89601 [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ] 89602 89603 ] 89604 89605 [ 89606 89607 [[link boost_asio.reference.ip__basic_endpoint.protocol_type [*protocol_type]]] 89608 [The protocol type associated with the endpoint. ] 89609 89610 ] 89611 89612] 89613 89614[heading Member Functions] 89615[table 89616 [[Name][Description]] 89617 89618 [ 89619 [[link boost_asio.reference.ip__basic_endpoint.address [*address]]] 89620 [Get the IP address associated with the endpoint. 89621 [hr] 89622 Set the IP address associated with the endpoint. ] 89623 ] 89624 89625 [ 89626 [[link boost_asio.reference.ip__basic_endpoint.basic_endpoint [*basic_endpoint]] [constructor]] 89627 [Default constructor. 89628 [hr] 89629 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. 89630 [hr] 89631 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. 89632 [hr] 89633 Copy constructor. 89634 [hr] 89635 Move constructor. ] 89636 ] 89637 89638 [ 89639 [[link boost_asio.reference.ip__basic_endpoint.capacity [*capacity]]] 89640 [Get the capacity of the endpoint in the native type. ] 89641 ] 89642 89643 [ 89644 [[link boost_asio.reference.ip__basic_endpoint.data [*data]]] 89645 [Get the underlying endpoint in the native type. ] 89646 ] 89647 89648 [ 89649 [[link boost_asio.reference.ip__basic_endpoint.operator_eq_ [*operator=]]] 89650 [Assign from another endpoint. 89651 [hr] 89652 Move-assign from another endpoint. ] 89653 ] 89654 89655 [ 89656 [[link boost_asio.reference.ip__basic_endpoint.port [*port]]] 89657 [Get the port associated with the endpoint. The port number is always in the host's byte order. 89658 [hr] 89659 Set the port associated with the endpoint. The port number is always in the host's byte order. ] 89660 ] 89661 89662 [ 89663 [[link boost_asio.reference.ip__basic_endpoint.protocol [*protocol]]] 89664 [The protocol associated with the endpoint. ] 89665 ] 89666 89667 [ 89668 [[link boost_asio.reference.ip__basic_endpoint.resize [*resize]]] 89669 [Set the underlying size of the endpoint in the native type. ] 89670 ] 89671 89672 [ 89673 [[link boost_asio.reference.ip__basic_endpoint.size [*size]]] 89674 [Get the underlying size of the endpoint in the native type. ] 89675 ] 89676 89677] 89678 89679[heading Friends] 89680[table 89681 [[Name][Description]] 89682 89683 [ 89684 [[link boost_asio.reference.ip__basic_endpoint.operator_not__eq_ [*operator!=]]] 89685 [Compare two endpoints for inequality. ] 89686 ] 89687 89688 [ 89689 [[link boost_asio.reference.ip__basic_endpoint.operator_lt_ [*operator<]]] 89690 [Compare endpoints for ordering. ] 89691 ] 89692 89693 [ 89694 [[link boost_asio.reference.ip__basic_endpoint.operator_lt__eq_ [*operator<=]]] 89695 [Compare endpoints for ordering. ] 89696 ] 89697 89698 [ 89699 [[link boost_asio.reference.ip__basic_endpoint.operator_eq__eq_ [*operator==]]] 89700 [Compare two endpoints for equality. ] 89701 ] 89702 89703 [ 89704 [[link boost_asio.reference.ip__basic_endpoint.operator_gt_ [*operator>]]] 89705 [Compare endpoints for ordering. ] 89706 ] 89707 89708 [ 89709 [[link boost_asio.reference.ip__basic_endpoint.operator_gt__eq_ [*operator>=]]] 89710 [Compare endpoints for ordering. ] 89711 ] 89712 89713] 89714 89715[heading Related Functions] 89716[table 89717 [[Name][Description]] 89718 89719 [ 89720 [[link boost_asio.reference.ip__basic_endpoint.operator_lt__lt_ [*operator<<]]] 89721 [Output an endpoint as a string. ] 89722 ] 89723 89724] 89725 89726The [link boost_asio.reference.ip__basic_endpoint `ip::basic_endpoint`] class template describes an endpoint that may be associated with a particular socket. 89727 89728 89729[heading Thread Safety] 89730 89731['Distinct] ['objects:] Safe. 89732 89733['Shared] ['objects:] Unsafe. 89734 89735 89736 89737 89738[heading Requirements] 89739 89740['Header: ][^boost/asio/ip/basic_endpoint.hpp] 89741 89742['Convenience header: ][^boost/asio.hpp] 89743 89744[section:address ip::basic_endpoint::address] 89745 89746[indexterm2 boost_asio.indexterm.ip__basic_endpoint.address..address..ip::basic_endpoint] 89747Get the IP address associated with the endpoint. 89748 89749 89750 boost::asio::ip::address ``[link boost_asio.reference.ip__basic_endpoint.address.overload1 address]``() const; 89751 `` [''''»''' [link boost_asio.reference.ip__basic_endpoint.address.overload1 more...]]`` 89752 89753 89754Set the IP address associated with the endpoint. 89755 89756 89757 void ``[link boost_asio.reference.ip__basic_endpoint.address.overload2 address]``( 89758 const boost::asio::ip::address & addr); 89759 `` [''''»''' [link boost_asio.reference.ip__basic_endpoint.address.overload2 more...]]`` 89760 89761 89762[section:overload1 ip::basic_endpoint::address (1 of 2 overloads)] 89763 89764 89765Get the IP address associated with the endpoint. 89766 89767 89768 boost::asio::ip::address address() const; 89769 89770 89771 89772[endsect] 89773 89774 89775 89776[section:overload2 ip::basic_endpoint::address (2 of 2 overloads)] 89777 89778 89779Set the IP address associated with the endpoint. 89780 89781 89782 void address( 89783 const boost::asio::ip::address & addr); 89784 89785 89786 89787[endsect] 89788 89789 89790[endsect] 89791 89792[section:basic_endpoint ip::basic_endpoint::basic_endpoint] 89793 89794[indexterm2 boost_asio.indexterm.ip__basic_endpoint.basic_endpoint..basic_endpoint..ip::basic_endpoint] 89795Default constructor. 89796 89797 89798 ``[link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload1 basic_endpoint]``(); 89799 `` [''''»''' [link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload1 more...]]`` 89800 89801 89802Construct 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. 89803 89804 89805 ``[link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload2 basic_endpoint]``( 89806 const InternetProtocol & internet_protocol, 89807 port_type port_num); 89808 `` [''''»''' [link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload2 more...]]`` 89809 89810 89811Construct 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. 89812 89813 89814 ``[link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload3 basic_endpoint]``( 89815 const boost::asio::ip::address & addr, 89816 port_type port_num); 89817 `` [''''»''' [link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload3 more...]]`` 89818 89819 89820Copy constructor. 89821 89822 89823 ``[link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload4 basic_endpoint]``( 89824 const basic_endpoint & other); 89825 `` [''''»''' [link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload4 more...]]`` 89826 89827 89828Move constructor. 89829 89830 89831 ``[link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload5 basic_endpoint]``( 89832 basic_endpoint && other); 89833 `` [''''»''' [link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload5 more...]]`` 89834 89835 89836[section:overload1 ip::basic_endpoint::basic_endpoint (1 of 5 overloads)] 89837 89838 89839Default constructor. 89840 89841 89842 basic_endpoint(); 89843 89844 89845 89846[endsect] 89847 89848 89849 89850[section:overload2 ip::basic_endpoint::basic_endpoint (2 of 5 overloads)] 89851 89852 89853Construct 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. 89854 89855 89856 basic_endpoint( 89857 const InternetProtocol & internet_protocol, 89858 port_type port_num); 89859 89860 89861 89862[heading Examples] 89863 89864To initialise an IPv4 TCP endpoint for port 1234, use: 89865 89866 boost::asio::ip::tcp::endpoint ep(boost::asio::ip::tcp::v4(), 1234); 89867 89868 89869 89870 89871To specify an IPv6 UDP endpoint for port 9876, use: 89872 89873 boost::asio::ip::udp::endpoint ep(boost::asio::ip::udp::v6(), 9876); 89874 89875 89876 89877 89878 89879[endsect] 89880 89881 89882 89883[section:overload3 ip::basic_endpoint::basic_endpoint (3 of 5 overloads)] 89884 89885 89886Construct 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. 89887 89888 89889 basic_endpoint( 89890 const boost::asio::ip::address & addr, 89891 port_type port_num); 89892 89893 89894 89895[endsect] 89896 89897 89898 89899[section:overload4 ip::basic_endpoint::basic_endpoint (4 of 5 overloads)] 89900 89901 89902Copy constructor. 89903 89904 89905 basic_endpoint( 89906 const basic_endpoint & other); 89907 89908 89909 89910[endsect] 89911 89912 89913 89914[section:overload5 ip::basic_endpoint::basic_endpoint (5 of 5 overloads)] 89915 89916 89917Move constructor. 89918 89919 89920 basic_endpoint( 89921 basic_endpoint && other); 89922 89923 89924 89925[endsect] 89926 89927 89928[endsect] 89929 89930 89931[section:capacity ip::basic_endpoint::capacity] 89932 89933[indexterm2 boost_asio.indexterm.ip__basic_endpoint.capacity..capacity..ip::basic_endpoint] 89934Get the capacity of the endpoint in the native type. 89935 89936 89937 std::size_t capacity() const; 89938 89939 89940 89941[endsect] 89942 89943 89944[section:data ip::basic_endpoint::data] 89945 89946[indexterm2 boost_asio.indexterm.ip__basic_endpoint.data..data..ip::basic_endpoint] 89947Get the underlying endpoint in the native type. 89948 89949 89950 data_type * ``[link boost_asio.reference.ip__basic_endpoint.data.overload1 data]``(); 89951 `` [''''»''' [link boost_asio.reference.ip__basic_endpoint.data.overload1 more...]]`` 89952 89953 const data_type * ``[link boost_asio.reference.ip__basic_endpoint.data.overload2 data]``() const; 89954 `` [''''»''' [link boost_asio.reference.ip__basic_endpoint.data.overload2 more...]]`` 89955 89956 89957[section:overload1 ip::basic_endpoint::data (1 of 2 overloads)] 89958 89959 89960Get the underlying endpoint in the native type. 89961 89962 89963 data_type * data(); 89964 89965 89966 89967[endsect] 89968 89969 89970 89971[section:overload2 ip::basic_endpoint::data (2 of 2 overloads)] 89972 89973 89974Get the underlying endpoint in the native type. 89975 89976 89977 const data_type * data() const; 89978 89979 89980 89981[endsect] 89982 89983 89984[endsect] 89985 89986 89987[section:data_type ip::basic_endpoint::data_type] 89988 89989[indexterm2 boost_asio.indexterm.ip__basic_endpoint.data_type..data_type..ip::basic_endpoint] 89990The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. 89991 89992 89993 typedef implementation_defined data_type; 89994 89995 89996 89997[heading Requirements] 89998 89999['Header: ][^boost/asio/ip/basic_endpoint.hpp] 90000 90001['Convenience header: ][^boost/asio.hpp] 90002 90003 90004[endsect] 90005 90006 90007 90008[section:operator_not__eq_ ip::basic_endpoint::operator!=] 90009 90010[indexterm2 boost_asio.indexterm.ip__basic_endpoint.operator_not__eq_..operator!=..ip::basic_endpoint] 90011Compare two endpoints for inequality. 90012 90013 90014 friend bool operator!=( 90015 const basic_endpoint< InternetProtocol > & e1, 90016 const basic_endpoint< InternetProtocol > & e2); 90017 90018 90019[heading Requirements] 90020 90021['Header: ][^boost/asio/ip/basic_endpoint.hpp] 90022 90023['Convenience header: ][^boost/asio.hpp] 90024 90025 90026[endsect] 90027 90028 90029 90030[section:operator_lt_ ip::basic_endpoint::operator<] 90031 90032[indexterm2 boost_asio.indexterm.ip__basic_endpoint.operator_lt_..operator<..ip::basic_endpoint] 90033Compare endpoints for ordering. 90034 90035 90036 friend bool operator<( 90037 const basic_endpoint< InternetProtocol > & e1, 90038 const basic_endpoint< InternetProtocol > & e2); 90039 90040 90041[heading Requirements] 90042 90043['Header: ][^boost/asio/ip/basic_endpoint.hpp] 90044 90045['Convenience header: ][^boost/asio.hpp] 90046 90047 90048[endsect] 90049 90050 90051 90052[section:operator_lt__lt_ ip::basic_endpoint::operator<<] 90053 90054[indexterm2 boost_asio.indexterm.ip__basic_endpoint.operator_lt__lt_..operator<<..ip::basic_endpoint] 90055Output an endpoint as a string. 90056 90057 90058 std::basic_ostream< Elem, Traits > & operator<<( 90059 std::basic_ostream< Elem, Traits > & os, 90060 const basic_endpoint< InternetProtocol > & endpoint); 90061 90062 90063Used to output a human-readable string for a specified endpoint. 90064 90065 90066[heading Parameters] 90067 90068 90069[variablelist 90070 90071[[os][The output stream to which the string will be written.]] 90072 90073[[endpoint][The endpoint to be written.]] 90074 90075] 90076 90077 90078[heading Return Value] 90079 90080The output stream. 90081 90082 90083 90084 90085[endsect] 90086 90087 90088 90089[section:operator_lt__eq_ ip::basic_endpoint::operator<=] 90090 90091[indexterm2 boost_asio.indexterm.ip__basic_endpoint.operator_lt__eq_..operator<=..ip::basic_endpoint] 90092Compare endpoints for ordering. 90093 90094 90095 friend bool operator<=( 90096 const basic_endpoint< InternetProtocol > & e1, 90097 const basic_endpoint< InternetProtocol > & e2); 90098 90099 90100[heading Requirements] 90101 90102['Header: ][^boost/asio/ip/basic_endpoint.hpp] 90103 90104['Convenience header: ][^boost/asio.hpp] 90105 90106 90107[endsect] 90108 90109 90110[section:operator_eq_ ip::basic_endpoint::operator=] 90111 90112[indexterm2 boost_asio.indexterm.ip__basic_endpoint.operator_eq_..operator=..ip::basic_endpoint] 90113Assign from another endpoint. 90114 90115 90116 basic_endpoint & ``[link boost_asio.reference.ip__basic_endpoint.operator_eq_.overload1 operator=]``( 90117 const basic_endpoint & other); 90118 `` [''''»''' [link boost_asio.reference.ip__basic_endpoint.operator_eq_.overload1 more...]]`` 90119 90120 90121Move-assign from another endpoint. 90122 90123 90124 basic_endpoint & ``[link boost_asio.reference.ip__basic_endpoint.operator_eq_.overload2 operator=]``( 90125 basic_endpoint && other); 90126 `` [''''»''' [link boost_asio.reference.ip__basic_endpoint.operator_eq_.overload2 more...]]`` 90127 90128 90129[section:overload1 ip::basic_endpoint::operator= (1 of 2 overloads)] 90130 90131 90132Assign from another endpoint. 90133 90134 90135 basic_endpoint & operator=( 90136 const basic_endpoint & other); 90137 90138 90139 90140[endsect] 90141 90142 90143 90144[section:overload2 ip::basic_endpoint::operator= (2 of 2 overloads)] 90145 90146 90147Move-assign from another endpoint. 90148 90149 90150 basic_endpoint & operator=( 90151 basic_endpoint && other); 90152 90153 90154 90155[endsect] 90156 90157 90158[endsect] 90159 90160 90161[section:operator_eq__eq_ ip::basic_endpoint::operator==] 90162 90163[indexterm2 boost_asio.indexterm.ip__basic_endpoint.operator_eq__eq_..operator==..ip::basic_endpoint] 90164Compare two endpoints for equality. 90165 90166 90167 friend bool operator==( 90168 const basic_endpoint< InternetProtocol > & e1, 90169 const basic_endpoint< InternetProtocol > & e2); 90170 90171 90172[heading Requirements] 90173 90174['Header: ][^boost/asio/ip/basic_endpoint.hpp] 90175 90176['Convenience header: ][^boost/asio.hpp] 90177 90178 90179[endsect] 90180 90181 90182 90183[section:operator_gt_ ip::basic_endpoint::operator>] 90184 90185[indexterm2 boost_asio.indexterm.ip__basic_endpoint.operator_gt_..operator>..ip::basic_endpoint] 90186Compare endpoints for ordering. 90187 90188 90189 friend bool operator>( 90190 const basic_endpoint< InternetProtocol > & e1, 90191 const basic_endpoint< InternetProtocol > & e2); 90192 90193 90194[heading Requirements] 90195 90196['Header: ][^boost/asio/ip/basic_endpoint.hpp] 90197 90198['Convenience header: ][^boost/asio.hpp] 90199 90200 90201[endsect] 90202 90203 90204 90205[section:operator_gt__eq_ ip::basic_endpoint::operator>=] 90206 90207[indexterm2 boost_asio.indexterm.ip__basic_endpoint.operator_gt__eq_..operator>=..ip::basic_endpoint] 90208Compare endpoints for ordering. 90209 90210 90211 friend bool operator>=( 90212 const basic_endpoint< InternetProtocol > & e1, 90213 const basic_endpoint< InternetProtocol > & e2); 90214 90215 90216[heading Requirements] 90217 90218['Header: ][^boost/asio/ip/basic_endpoint.hpp] 90219 90220['Convenience header: ][^boost/asio.hpp] 90221 90222 90223[endsect] 90224 90225 90226[section:port ip::basic_endpoint::port] 90227 90228[indexterm2 boost_asio.indexterm.ip__basic_endpoint.port..port..ip::basic_endpoint] 90229Get the port associated with the endpoint. The port number is always in the host's byte order. 90230 90231 90232 port_type ``[link boost_asio.reference.ip__basic_endpoint.port.overload1 port]``() const; 90233 `` [''''»''' [link boost_asio.reference.ip__basic_endpoint.port.overload1 more...]]`` 90234 90235 90236Set the port associated with the endpoint. The port number is always in the host's byte order. 90237 90238 90239 void ``[link boost_asio.reference.ip__basic_endpoint.port.overload2 port]``( 90240 port_type port_num); 90241 `` [''''»''' [link boost_asio.reference.ip__basic_endpoint.port.overload2 more...]]`` 90242 90243 90244[section:overload1 ip::basic_endpoint::port (1 of 2 overloads)] 90245 90246 90247Get the port associated with the endpoint. The port number is always in the host's byte order. 90248 90249 90250 port_type port() const; 90251 90252 90253 90254[endsect] 90255 90256 90257 90258[section:overload2 ip::basic_endpoint::port (2 of 2 overloads)] 90259 90260 90261Set the port associated with the endpoint. The port number is always in the host's byte order. 90262 90263 90264 void port( 90265 port_type port_num); 90266 90267 90268 90269[endsect] 90270 90271 90272[endsect] 90273 90274 90275[section:protocol ip::basic_endpoint::protocol] 90276 90277[indexterm2 boost_asio.indexterm.ip__basic_endpoint.protocol..protocol..ip::basic_endpoint] 90278The protocol associated with the endpoint. 90279 90280 90281 protocol_type protocol() const; 90282 90283 90284 90285[endsect] 90286 90287 90288 90289[section:protocol_type ip::basic_endpoint::protocol_type] 90290 90291[indexterm2 boost_asio.indexterm.ip__basic_endpoint.protocol_type..protocol_type..ip::basic_endpoint] 90292The protocol type associated with the endpoint. 90293 90294 90295 typedef InternetProtocol protocol_type; 90296 90297 90298 90299[heading Requirements] 90300 90301['Header: ][^boost/asio/ip/basic_endpoint.hpp] 90302 90303['Convenience header: ][^boost/asio.hpp] 90304 90305 90306[endsect] 90307 90308 90309 90310[section:resize ip::basic_endpoint::resize] 90311 90312[indexterm2 boost_asio.indexterm.ip__basic_endpoint.resize..resize..ip::basic_endpoint] 90313Set the underlying size of the endpoint in the native type. 90314 90315 90316 void resize( 90317 std::size_t new_size); 90318 90319 90320 90321[endsect] 90322 90323 90324 90325[section:size ip::basic_endpoint::size] 90326 90327[indexterm2 boost_asio.indexterm.ip__basic_endpoint.size..size..ip::basic_endpoint] 90328Get the underlying size of the endpoint in the native type. 90329 90330 90331 std::size_t size() const; 90332 90333 90334 90335[endsect] 90336 90337 90338 90339[endsect] 90340 90341[section:ip__basic_resolver ip::basic_resolver] 90342 90343[indexterm1 boost_asio.indexterm.ip__basic_resolver..ip::basic_resolver] 90344 90345 90346Provides endpoint resolution functionality. 90347 90348 90349 template< 90350 typename ``[link boost_asio.reference.InternetProtocol InternetProtocol]``, 90351 typename ``[link boost_asio.reference.Executor1 Executor]``> 90352 class basic_resolver : 90353 public ip::resolver_base 90354 90355 90356[heading Types] 90357[table 90358 [[Name][Description]] 90359 90360 [ 90361 90362 [[link boost_asio.reference.ip__basic_resolver__rebind_executor [*rebind_executor]]] 90363 [Rebinds the resolver type to another executor. ] 90364 90365 ] 90366 90367 [ 90368 90369 [[link boost_asio.reference.ip__basic_resolver.endpoint_type [*endpoint_type]]] 90370 [The endpoint type. ] 90371 90372 ] 90373 90374 [ 90375 90376 [[link boost_asio.reference.ip__basic_resolver.executor_type [*executor_type]]] 90377 [The type of the executor associated with the object. ] 90378 90379 ] 90380 90381 [ 90382 90383 [[link boost_asio.reference.ip__basic_resolver.flags [*flags]]] 90384 [A bitmask type (C++ Std \[lib.bitmask.types\]). ] 90385 90386 ] 90387 90388 [ 90389 90390 [[link boost_asio.reference.ip__basic_resolver.iterator [*iterator]]] 90391 [(Deprecated.) The iterator type. ] 90392 90393 ] 90394 90395 [ 90396 90397 [[link boost_asio.reference.ip__basic_resolver.protocol_type [*protocol_type]]] 90398 [The protocol type. ] 90399 90400 ] 90401 90402 [ 90403 90404 [[link boost_asio.reference.ip__basic_resolver.query [*query]]] 90405 [(Deprecated.) The query type. ] 90406 90407 ] 90408 90409 [ 90410 90411 [[link boost_asio.reference.ip__basic_resolver.results_type [*results_type]]] 90412 [The results type. ] 90413 90414 ] 90415 90416] 90417 90418[heading Member Functions] 90419[table 90420 [[Name][Description]] 90421 90422 [ 90423 [[link boost_asio.reference.ip__basic_resolver.async_resolve [*async_resolve]]] 90424 [(Deprecated: Use overload with separate host and service parameters.) Asynchronously perform forward resolution of a query to a list of entries. 90425 [hr] 90426 Asynchronously perform forward resolution of a query to a list of entries. 90427 [hr] 90428 Asynchronously perform reverse resolution of an endpoint to a list of entries. ] 90429 ] 90430 90431 [ 90432 [[link boost_asio.reference.ip__basic_resolver.basic_resolver [*basic_resolver]] [constructor]] 90433 [Construct with executor. 90434 [hr] 90435 Construct with execution context. 90436 [hr] 90437 Move-construct a basic_resolver from another. ] 90438 ] 90439 90440 [ 90441 [[link boost_asio.reference.ip__basic_resolver.cancel [*cancel]]] 90442 [Cancel any asynchronous operations that are waiting on the resolver. ] 90443 ] 90444 90445 [ 90446 [[link boost_asio.reference.ip__basic_resolver.get_executor [*get_executor]]] 90447 [Get the executor associated with the object. ] 90448 ] 90449 90450 [ 90451 [[link boost_asio.reference.ip__basic_resolver.operator_eq_ [*operator=]]] 90452 [Move-assign a basic_resolver from another. ] 90453 ] 90454 90455 [ 90456 [[link boost_asio.reference.ip__basic_resolver.resolve [*resolve]]] 90457 [(Deprecated: Use overload with separate host and service parameters.) Perform forward resolution of a query to a list of entries. 90458 [hr] 90459 Perform forward resolution of a query to a list of entries. 90460 [hr] 90461 Perform reverse resolution of an endpoint to a list of entries. ] 90462 ] 90463 90464 [ 90465 [[link boost_asio.reference.ip__basic_resolver._basic_resolver [*~basic_resolver]] [destructor]] 90466 [Destroys the resolver. ] 90467 ] 90468 90469] 90470 90471[heading Data Members] 90472[table 90473 [[Name][Description]] 90474 90475 [ 90476 [[link boost_asio.reference.ip__basic_resolver.address_configured [*address_configured]] [static]] 90477 [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. ] 90478 ] 90479 90480 [ 90481 [[link boost_asio.reference.ip__basic_resolver.all_matching [*all_matching]] [static]] 90482 [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ] 90483 ] 90484 90485 [ 90486 [[link boost_asio.reference.ip__basic_resolver.canonical_name [*canonical_name]] [static]] 90487 [Determine the canonical name of the host specified in the query. ] 90488 ] 90489 90490 [ 90491 [[link boost_asio.reference.ip__basic_resolver.numeric_host [*numeric_host]] [static]] 90492 [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ] 90493 ] 90494 90495 [ 90496 [[link boost_asio.reference.ip__basic_resolver.numeric_service [*numeric_service]] [static]] 90497 [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ] 90498 ] 90499 90500 [ 90501 [[link boost_asio.reference.ip__basic_resolver.passive [*passive]] [static]] 90502 [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ] 90503 ] 90504 90505 [ 90506 [[link boost_asio.reference.ip__basic_resolver.v4_mapped [*v4_mapped]] [static]] 90507 [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ] 90508 ] 90509 90510] 90511 90512The [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] class template provides the ability to resolve a query to a list of endpoints. 90513 90514 90515[heading Thread Safety] 90516 90517['Distinct] ['objects:] Safe. 90518 90519['Shared] ['objects:] Unsafe. 90520 90521 90522 90523[heading Requirements] 90524 90525['Header: ][^boost/asio/ip/basic_resolver.hpp] 90526 90527['Convenience header: ][^boost/asio.hpp] 90528 90529 90530[section:address_configured ip::basic_resolver::address_configured] 90531 90532 90533['Inherited from ip::resolver_base.] 90534 90535[indexterm2 boost_asio.indexterm.ip__basic_resolver.address_configured..address_configured..ip::basic_resolver] 90536Only 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. 90537 90538 90539 static const flags address_configured = implementation_defined; 90540 90541 90542 90543[endsect] 90544 90545 90546 90547[section:all_matching ip::basic_resolver::all_matching] 90548 90549 90550['Inherited from ip::resolver_base.] 90551 90552[indexterm2 boost_asio.indexterm.ip__basic_resolver.all_matching..all_matching..ip::basic_resolver] 90553If used with v4\_mapped, return all matching IPv6 and IPv4 addresses. 90554 90555 90556 static const flags all_matching = implementation_defined; 90557 90558 90559 90560[endsect] 90561 90562 90563[section:async_resolve ip::basic_resolver::async_resolve] 90564 90565[indexterm2 boost_asio.indexterm.ip__basic_resolver.async_resolve..async_resolve..ip::basic_resolver] 90566(Deprecated: Use overload with separate host and service parameters.) Asynchronously perform forward resolution of a query to a list of entries. 90567 90568 90569 template< 90570 typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 90571 ``[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]``( 90572 const query & q, 90573 ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 90574 `` [''''»''' [link boost_asio.reference.ip__basic_resolver.async_resolve.overload1 more...]]`` 90575 90576 90577Asynchronously perform forward resolution of a query to a list of entries. 90578 90579 90580 template< 90581 typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 90582 ``[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]``( 90583 string_view host, 90584 string_view service, 90585 ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 90586 `` [''''»''' [link boost_asio.reference.ip__basic_resolver.async_resolve.overload2 more...]]`` 90587 90588 template< 90589 typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 90590 ``[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]``( 90591 string_view host, 90592 string_view service, 90593 resolver_base::flags resolve_flags, 90594 ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 90595 `` [''''»''' [link boost_asio.reference.ip__basic_resolver.async_resolve.overload3 more...]]`` 90596 90597 template< 90598 typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 90599 ``[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]``( 90600 const protocol_type & protocol, 90601 string_view host, 90602 string_view service, 90603 ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 90604 `` [''''»''' [link boost_asio.reference.ip__basic_resolver.async_resolve.overload4 more...]]`` 90605 90606 template< 90607 typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 90608 ``[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]``( 90609 const protocol_type & protocol, 90610 string_view host, 90611 string_view service, 90612 resolver_base::flags resolve_flags, 90613 ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 90614 `` [''''»''' [link boost_asio.reference.ip__basic_resolver.async_resolve.overload5 more...]]`` 90615 90616 90617Asynchronously perform reverse resolution of an endpoint to a list of entries. 90618 90619 90620 template< 90621 typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 90622 ``[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]``( 90623 const endpoint_type & e, 90624 ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 90625 `` [''''»''' [link boost_asio.reference.ip__basic_resolver.async_resolve.overload6 more...]]`` 90626 90627 90628[section:overload1 ip::basic_resolver::async_resolve (1 of 6 overloads)] 90629 90630 90631(Deprecated: Use overload with separate host and service parameters.) Asynchronously perform forward resolution of a query to a list of entries. 90632 90633 90634 template< 90635 typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 90636 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_resolve( 90637 const query & q, 90638 ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 90639 90640 90641This function is used to asynchronously resolve a query into a list of endpoint entries. 90642 90643 90644[heading Parameters] 90645 90646 90647[variablelist 90648 90649[[q][A query object that determines what endpoints will be returned.]] 90650 90651[[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: 90652`` 90653 void handler( 90654 const boost::system::error_code& error, // Result of operation. 90655 resolver::results_type results // Resolved endpoints as a range. 90656 ); 90657`` 90658Regardless 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`].]] 90659 90660] 90661 90662A successful resolve operation is guaranteed to pass a non-empty range to the handler. 90663 90664 90665[endsect] 90666 90667 90668 90669[section:overload2 ip::basic_resolver::async_resolve (2 of 6 overloads)] 90670 90671 90672Asynchronously perform forward resolution of a query to a list of entries. 90673 90674 90675 template< 90676 typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 90677 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_resolve( 90678 string_view host, 90679 string_view service, 90680 ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 90681 90682 90683This function is used to resolve host and service names into a list of endpoint entries. 90684 90685 90686[heading Parameters] 90687 90688 90689[variablelist 90690 90691[[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.]] 90692 90693[[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.]] 90694 90695[[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: 90696`` 90697 void handler( 90698 const boost::system::error_code& error, // Result of operation. 90699 resolver::results_type results // Resolved endpoints as a range. 90700 ); 90701`` 90702Regardless 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`].]] 90703 90704] 90705 90706A successful resolve operation is guaranteed to pass a non-empty range to the handler. 90707 90708 90709[heading Remarks] 90710 90711On 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). 90712 90713On 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. 90714 90715 90716[endsect] 90717 90718 90719 90720[section:overload3 ip::basic_resolver::async_resolve (3 of 6 overloads)] 90721 90722 90723Asynchronously perform forward resolution of a query to a list of entries. 90724 90725 90726 template< 90727 typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 90728 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_resolve( 90729 string_view host, 90730 string_view service, 90731 resolver_base::flags resolve_flags, 90732 ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 90733 90734 90735This function is used to resolve host and service names into a list of endpoint entries. 90736 90737 90738[heading Parameters] 90739 90740 90741[variablelist 90742 90743[[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.]] 90744 90745[[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.]] 90746 90747[[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.]] 90748 90749[[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: 90750`` 90751 void handler( 90752 const boost::system::error_code& error, // Result of operation. 90753 resolver::results_type results // Resolved endpoints as a range. 90754 ); 90755`` 90756Regardless 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`].]] 90757 90758] 90759 90760A successful resolve operation is guaranteed to pass a non-empty range to the handler. 90761 90762 90763[heading Remarks] 90764 90765On 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). 90766 90767On 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. 90768 90769 90770[endsect] 90771 90772 90773 90774[section:overload4 ip::basic_resolver::async_resolve (4 of 6 overloads)] 90775 90776 90777Asynchronously perform forward resolution of a query to a list of entries. 90778 90779 90780 template< 90781 typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 90782 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_resolve( 90783 const protocol_type & protocol, 90784 string_view host, 90785 string_view service, 90786 ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 90787 90788 90789This function is used to resolve host and service names into a list of endpoint entries. 90790 90791 90792[heading Parameters] 90793 90794 90795[variablelist 90796 90797[[protocol][A protocol object, normally representing either the IPv4 or IPv6 version of an internet protocol.]] 90798 90799[[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.]] 90800 90801[[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.]] 90802 90803[[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: 90804`` 90805 void handler( 90806 const boost::system::error_code& error, // Result of operation. 90807 resolver::results_type results // Resolved endpoints as a range. 90808 ); 90809`` 90810Regardless 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`].]] 90811 90812] 90813 90814A successful resolve operation is guaranteed to pass a non-empty range to the handler. 90815 90816 90817[heading Remarks] 90818 90819On 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). 90820 90821On 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. 90822 90823 90824[endsect] 90825 90826 90827 90828[section:overload5 ip::basic_resolver::async_resolve (5 of 6 overloads)] 90829 90830 90831Asynchronously perform forward resolution of a query to a list of entries. 90832 90833 90834 template< 90835 typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 90836 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_resolve( 90837 const protocol_type & protocol, 90838 string_view host, 90839 string_view service, 90840 resolver_base::flags resolve_flags, 90841 ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 90842 90843 90844This function is used to resolve host and service names into a list of endpoint entries. 90845 90846 90847[heading Parameters] 90848 90849 90850[variablelist 90851 90852[[protocol][A protocol object, normally representing either the IPv4 or IPv6 version of an internet protocol.]] 90853 90854[[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.]] 90855 90856[[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.]] 90857 90858[[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.]] 90859 90860[[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: 90861`` 90862 void handler( 90863 const boost::system::error_code& error, // Result of operation. 90864 resolver::results_type results // Resolved endpoints as a range. 90865 ); 90866`` 90867Regardless 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`].]] 90868 90869] 90870 90871A successful resolve operation is guaranteed to pass a non-empty range to the handler. 90872 90873 90874[heading Remarks] 90875 90876On 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). 90877 90878On 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. 90879 90880 90881[endsect] 90882 90883 90884 90885[section:overload6 ip::basic_resolver::async_resolve (6 of 6 overloads)] 90886 90887 90888Asynchronously perform reverse resolution of an endpoint to a list of entries. 90889 90890 90891 template< 90892 typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 90893 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_resolve( 90894 const endpoint_type & e, 90895 ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 90896 90897 90898This function is used to asynchronously resolve an endpoint into a list of endpoint entries. 90899 90900 90901[heading Parameters] 90902 90903 90904[variablelist 90905 90906[[e][An endpoint object that determines what endpoints will be returned.]] 90907 90908[[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: 90909`` 90910 void handler( 90911 const boost::system::error_code& error, // Result of operation. 90912 resolver::results_type results // Resolved endpoints as a range. 90913 ); 90914`` 90915Regardless 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`].]] 90916 90917] 90918 90919A successful resolve operation is guaranteed to pass a non-empty range to the handler. 90920 90921 90922[endsect] 90923 90924 90925[endsect] 90926 90927[section:basic_resolver ip::basic_resolver::basic_resolver] 90928 90929[indexterm2 boost_asio.indexterm.ip__basic_resolver.basic_resolver..basic_resolver..ip::basic_resolver] 90930Construct with executor. 90931 90932 90933 explicit ``[link boost_asio.reference.ip__basic_resolver.basic_resolver.overload1 basic_resolver]``( 90934 const executor_type & ex); 90935 `` [''''»''' [link boost_asio.reference.ip__basic_resolver.basic_resolver.overload1 more...]]`` 90936 90937 90938Construct with execution context. 90939 90940 90941 template< 90942 typename ExecutionContext> 90943 explicit ``[link boost_asio.reference.ip__basic_resolver.basic_resolver.overload2 basic_resolver]``( 90944 ExecutionContext & context, 90945 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 90946 `` [''''»''' [link boost_asio.reference.ip__basic_resolver.basic_resolver.overload2 more...]]`` 90947 90948 90949Move-construct a [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] from another. 90950 90951 90952 ``[link boost_asio.reference.ip__basic_resolver.basic_resolver.overload3 basic_resolver]``( 90953 basic_resolver && other); 90954 `` [''''»''' [link boost_asio.reference.ip__basic_resolver.basic_resolver.overload3 more...]]`` 90955 90956 template< 90957 typename ``[link boost_asio.reference.Executor1 Executor1]``> 90958 ``[link boost_asio.reference.ip__basic_resolver.basic_resolver.overload4 basic_resolver]``( 90959 basic_resolver< InternetProtocol, Executor1 > && other, 90960 typename constraint< is_convertible< Executor1, Executor >::value >::type = 0); 90961 `` [''''»''' [link boost_asio.reference.ip__basic_resolver.basic_resolver.overload4 more...]]`` 90962 90963 90964[section:overload1 ip::basic_resolver::basic_resolver (1 of 4 overloads)] 90965 90966 90967Construct with executor. 90968 90969 90970 basic_resolver( 90971 const executor_type & ex); 90972 90973 90974This constructor creates a [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`]. 90975 90976 90977[heading Parameters] 90978 90979 90980[variablelist 90981 90982[[ex][The I/O executor that the resolver will use, by default, to dispatch handlers for any asynchronous operations performed on the resolver. ]] 90983 90984] 90985 90986 90987 90988 90989[endsect] 90990 90991 90992 90993[section:overload2 ip::basic_resolver::basic_resolver (2 of 4 overloads)] 90994 90995 90996Construct with execution context. 90997 90998 90999 template< 91000 typename ExecutionContext> 91001 basic_resolver( 91002 ExecutionContext & context, 91003 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 91004 91005 91006This constructor creates a [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`]. 91007 91008 91009[heading Parameters] 91010 91011 91012[variablelist 91013 91014[[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. ]] 91015 91016] 91017 91018 91019 91020 91021[endsect] 91022 91023 91024 91025[section:overload3 ip::basic_resolver::basic_resolver (3 of 4 overloads)] 91026 91027 91028Move-construct a [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] from another. 91029 91030 91031 basic_resolver( 91032 basic_resolver && other); 91033 91034 91035This constructor moves a resolver from one object to another. 91036 91037 91038[heading Parameters] 91039 91040 91041[variablelist 91042 91043[[other][The other [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] object from which the move will occur.]] 91044 91045] 91046 91047 91048[heading Remarks] 91049 91050Following the move, the moved-from object is in the same state as if constructed using the `basic_resolver(const executor_type&) constructor`. 91051 91052 91053 91054 91055[endsect] 91056 91057 91058 91059[section:overload4 ip::basic_resolver::basic_resolver (4 of 4 overloads)] 91060 91061 91062Move-construct a [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] from another. 91063 91064 91065 template< 91066 typename ``[link boost_asio.reference.Executor1 Executor1]``> 91067 basic_resolver( 91068 basic_resolver< InternetProtocol, Executor1 > && other, 91069 typename constraint< is_convertible< Executor1, Executor >::value >::type = 0); 91070 91071 91072This constructor moves a resolver from one object to another. 91073 91074 91075[heading Parameters] 91076 91077 91078[variablelist 91079 91080[[other][The other [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] object from which the move will occur.]] 91081 91082] 91083 91084 91085[heading Remarks] 91086 91087Following the move, the moved-from object is in the same state as if constructed using the `basic_resolver(const executor_type&) constructor`. 91088 91089 91090 91091 91092[endsect] 91093 91094 91095[endsect] 91096 91097 91098[section:cancel ip::basic_resolver::cancel] 91099 91100[indexterm2 boost_asio.indexterm.ip__basic_resolver.cancel..cancel..ip::basic_resolver] 91101Cancel any asynchronous operations that are waiting on the resolver. 91102 91103 91104 void cancel(); 91105 91106 91107This 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. 91108 91109 91110[endsect] 91111 91112 91113 91114[section:canonical_name ip::basic_resolver::canonical_name] 91115 91116 91117['Inherited from ip::resolver_base.] 91118 91119[indexterm2 boost_asio.indexterm.ip__basic_resolver.canonical_name..canonical_name..ip::basic_resolver] 91120Determine the canonical name of the host specified in the query. 91121 91122 91123 static const flags canonical_name = implementation_defined; 91124 91125 91126 91127[endsect] 91128 91129 91130 91131[section:endpoint_type ip::basic_resolver::endpoint_type] 91132 91133[indexterm2 boost_asio.indexterm.ip__basic_resolver.endpoint_type..endpoint_type..ip::basic_resolver] 91134The endpoint type. 91135 91136 91137 typedef InternetProtocol::endpoint endpoint_type; 91138 91139 91140 91141[heading Requirements] 91142 91143['Header: ][^boost/asio/ip/basic_resolver.hpp] 91144 91145['Convenience header: ][^boost/asio.hpp] 91146 91147 91148[endsect] 91149 91150 91151 91152[section:executor_type ip::basic_resolver::executor_type] 91153 91154[indexterm2 boost_asio.indexterm.ip__basic_resolver.executor_type..executor_type..ip::basic_resolver] 91155The type of the executor associated with the object. 91156 91157 91158 typedef Executor executor_type; 91159 91160 91161 91162[heading Requirements] 91163 91164['Header: ][^boost/asio/ip/basic_resolver.hpp] 91165 91166['Convenience header: ][^boost/asio.hpp] 91167 91168 91169[endsect] 91170 91171 91172 91173[section:flags ip::basic_resolver::flags] 91174 91175 91176['Inherited from ip::resolver_base.] 91177 91178[indexterm2 boost_asio.indexterm.ip__basic_resolver.flags..flags..ip::basic_resolver] 91179A bitmask type (C++ Std [lib.bitmask.types]). 91180 91181 91182 typedef unspecified flags; 91183 91184 91185 91186[heading Requirements] 91187 91188['Header: ][^boost/asio/ip/basic_resolver.hpp] 91189 91190['Convenience header: ][^boost/asio.hpp] 91191 91192 91193[endsect] 91194 91195 91196 91197[section:get_executor ip::basic_resolver::get_executor] 91198 91199[indexterm2 boost_asio.indexterm.ip__basic_resolver.get_executor..get_executor..ip::basic_resolver] 91200Get the executor associated with the object. 91201 91202 91203 executor_type get_executor(); 91204 91205 91206 91207[endsect] 91208 91209 91210 91211[section:iterator ip::basic_resolver::iterator] 91212 91213[indexterm2 boost_asio.indexterm.ip__basic_resolver.iterator..iterator..ip::basic_resolver] 91214(Deprecated.) The iterator type. 91215 91216 91217 typedef basic_resolver_iterator< InternetProtocol > iterator; 91218 91219 91220[heading Types] 91221[table 91222 [[Name][Description]] 91223 91224 [ 91225 91226 [[link boost_asio.reference.ip__basic_resolver_iterator.difference_type [*difference_type]]] 91227 [The type used for the distance between two iterators. ] 91228 91229 ] 91230 91231 [ 91232 91233 [[link boost_asio.reference.ip__basic_resolver_iterator.iterator_category [*iterator_category]]] 91234 [The iterator category. ] 91235 91236 ] 91237 91238 [ 91239 91240 [[link boost_asio.reference.ip__basic_resolver_iterator.pointer [*pointer]]] 91241 [The type of the result of applying operator->() to the iterator. ] 91242 91243 ] 91244 91245 [ 91246 91247 [[link boost_asio.reference.ip__basic_resolver_iterator.reference [*reference]]] 91248 [The type of the result of applying operator*() to the iterator. ] 91249 91250 ] 91251 91252 [ 91253 91254 [[link boost_asio.reference.ip__basic_resolver_iterator.value_type [*value_type]]] 91255 [The type of the value pointed to by the iterator. ] 91256 91257 ] 91258 91259] 91260 91261[heading Member Functions] 91262[table 91263 [[Name][Description]] 91264 91265 [ 91266 [[link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator [*basic_resolver_iterator]] [constructor]] 91267 [Default constructor creates an end iterator. 91268 [hr] 91269 Copy constructor. 91270 [hr] 91271 Move constructor. ] 91272 ] 91273 91274 [ 91275 [[link boost_asio.reference.ip__basic_resolver_iterator.operator__star_ [*operator *]]] 91276 [Dereference an iterator. ] 91277 ] 91278 91279 [ 91280 [[link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_ [*operator++]]] 91281 [Increment operator (prefix). 91282 [hr] 91283 Increment operator (postfix). ] 91284 ] 91285 91286 [ 91287 [[link boost_asio.reference.ip__basic_resolver_iterator.operator_arrow_ [*operator->]]] 91288 [Dereference an iterator. ] 91289 ] 91290 91291 [ 91292 [[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq_ [*operator=]]] 91293 [Assignment operator. 91294 [hr] 91295 Move-assignment operator. ] 91296 ] 91297 91298] 91299 91300[heading Protected Member Functions] 91301[table 91302 [[Name][Description]] 91303 91304 [ 91305 [[link boost_asio.reference.ip__basic_resolver_iterator.dereference [*dereference]]] 91306 [] 91307 ] 91308 91309 [ 91310 [[link boost_asio.reference.ip__basic_resolver_iterator.equal [*equal]]] 91311 [] 91312 ] 91313 91314 [ 91315 [[link boost_asio.reference.ip__basic_resolver_iterator.increment [*increment]]] 91316 [] 91317 ] 91318 91319] 91320 91321[heading Protected Data Members] 91322[table 91323 [[Name][Description]] 91324 91325 [ 91326 [[link boost_asio.reference.ip__basic_resolver_iterator.index_ [*index_]]] 91327 [] 91328 ] 91329 91330 [ 91331 [[link boost_asio.reference.ip__basic_resolver_iterator.values_ [*values_]]] 91332 [] 91333 ] 91334 91335] 91336 91337[heading Friends] 91338[table 91339 [[Name][Description]] 91340 91341 [ 91342 [[link boost_asio.reference.ip__basic_resolver_iterator.operator_not__eq_ [*operator!=]]] 91343 [Test two iterators for inequality. ] 91344 ] 91345 91346 [ 91347 [[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq__eq_ [*operator==]]] 91348 [Test two iterators for equality. ] 91349 ] 91350 91351] 91352 91353The [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. 91354 91355The iterator's value\_type, obtained when the iterator is dereferenced, is: 91356 91357 const basic_resolver_entry<InternetProtocol> 91358 91359 91360 91361 91362 91363[heading Thread Safety] 91364 91365['Distinct] ['objects:] Safe. 91366 91367['Shared] ['objects:] Unsafe. 91368 91369 91370 91371 91372[heading Requirements] 91373 91374['Header: ][^boost/asio/ip/basic_resolver.hpp] 91375 91376['Convenience header: ][^boost/asio.hpp] 91377 91378 91379[endsect] 91380 91381 91382 91383[section:numeric_host ip::basic_resolver::numeric_host] 91384 91385 91386['Inherited from ip::resolver_base.] 91387 91388[indexterm2 boost_asio.indexterm.ip__basic_resolver.numeric_host..numeric_host..ip::basic_resolver] 91389Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. 91390 91391 91392 static const flags numeric_host = implementation_defined; 91393 91394 91395 91396[endsect] 91397 91398 91399 91400[section:numeric_service ip::basic_resolver::numeric_service] 91401 91402 91403['Inherited from ip::resolver_base.] 91404 91405[indexterm2 boost_asio.indexterm.ip__basic_resolver.numeric_service..numeric_service..ip::basic_resolver] 91406Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. 91407 91408 91409 static const flags numeric_service = implementation_defined; 91410 91411 91412 91413[endsect] 91414 91415 91416[section:operator_eq_ ip::basic_resolver::operator=] 91417 91418[indexterm2 boost_asio.indexterm.ip__basic_resolver.operator_eq_..operator=..ip::basic_resolver] 91419Move-assign a [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] from another. 91420 91421 91422 basic_resolver & ``[link boost_asio.reference.ip__basic_resolver.operator_eq_.overload1 operator=]``( 91423 basic_resolver && other); 91424 `` [''''»''' [link boost_asio.reference.ip__basic_resolver.operator_eq_.overload1 more...]]`` 91425 91426 template< 91427 typename ``[link boost_asio.reference.Executor1 Executor1]``> 91428 constraint< is_convertible< Executor1, Executor >::value, basic_resolver & >::type ``[link boost_asio.reference.ip__basic_resolver.operator_eq_.overload2 operator=]``( 91429 basic_resolver< InternetProtocol, Executor1 > && other); 91430 `` [''''»''' [link boost_asio.reference.ip__basic_resolver.operator_eq_.overload2 more...]]`` 91431 91432 91433[section:overload1 ip::basic_resolver::operator= (1 of 2 overloads)] 91434 91435 91436Move-assign a [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] from another. 91437 91438 91439 basic_resolver & operator=( 91440 basic_resolver && other); 91441 91442 91443This assignment operator moves a resolver from one object to another. Cancels any outstanding asynchronous operations associated with the target object. 91444 91445 91446[heading Parameters] 91447 91448 91449[variablelist 91450 91451[[other][The other [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] object from which the move will occur.]] 91452 91453] 91454 91455 91456[heading Remarks] 91457 91458Following the move, the moved-from object is in the same state as if constructed using the `basic_resolver(const executor_type&) constructor`. 91459 91460 91461 91462 91463[endsect] 91464 91465 91466 91467[section:overload2 ip::basic_resolver::operator= (2 of 2 overloads)] 91468 91469 91470Move-assign a [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] from another. 91471 91472 91473 template< 91474 typename ``[link boost_asio.reference.Executor1 Executor1]``> 91475 constraint< is_convertible< Executor1, Executor >::value, basic_resolver & >::type operator=( 91476 basic_resolver< InternetProtocol, Executor1 > && other); 91477 91478 91479This assignment operator moves a resolver from one object to another. Cancels any outstanding asynchronous operations associated with the target object. 91480 91481 91482[heading Parameters] 91483 91484 91485[variablelist 91486 91487[[other][The other [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] object from which the move will occur.]] 91488 91489] 91490 91491 91492[heading Remarks] 91493 91494Following the move, the moved-from object is in the same state as if constructed using the `basic_resolver(const executor_type&) constructor`. 91495 91496 91497 91498 91499[endsect] 91500 91501 91502[endsect] 91503 91504 91505[section:passive ip::basic_resolver::passive] 91506 91507 91508['Inherited from ip::resolver_base.] 91509 91510[indexterm2 boost_asio.indexterm.ip__basic_resolver.passive..passive..ip::basic_resolver] 91511Indicate that returned endpoint is intended for use as a locally bound socket endpoint. 91512 91513 91514 static const flags passive = implementation_defined; 91515 91516 91517 91518[endsect] 91519 91520 91521 91522[section:protocol_type ip::basic_resolver::protocol_type] 91523 91524[indexterm2 boost_asio.indexterm.ip__basic_resolver.protocol_type..protocol_type..ip::basic_resolver] 91525The protocol type. 91526 91527 91528 typedef InternetProtocol protocol_type; 91529 91530 91531 91532[heading Requirements] 91533 91534['Header: ][^boost/asio/ip/basic_resolver.hpp] 91535 91536['Convenience header: ][^boost/asio.hpp] 91537 91538 91539[endsect] 91540 91541 91542 91543[section:query ip::basic_resolver::query] 91544 91545[indexterm2 boost_asio.indexterm.ip__basic_resolver.query..query..ip::basic_resolver] 91546(Deprecated.) The query type. 91547 91548 91549 typedef basic_resolver_query< InternetProtocol > query; 91550 91551 91552[heading Types] 91553[table 91554 [[Name][Description]] 91555 91556 [ 91557 91558 [[link boost_asio.reference.ip__basic_resolver_query.flags [*flags]]] 91559 [A bitmask type (C++ Std \[lib.bitmask.types\]). ] 91560 91561 ] 91562 91563 [ 91564 91565 [[link boost_asio.reference.ip__basic_resolver_query.protocol_type [*protocol_type]]] 91566 [The protocol type associated with the endpoint query. ] 91567 91568 ] 91569 91570] 91571 91572[heading Member Functions] 91573[table 91574 [[Name][Description]] 91575 91576 [ 91577 [[link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query [*basic_resolver_query]] [constructor]] 91578 [Construct with specified service name for any protocol. 91579 [hr] 91580 Construct with specified service name for a given protocol. 91581 [hr] 91582 Construct with specified host name and service name for any protocol. 91583 [hr] 91584 Construct with specified host name and service name for a given protocol. ] 91585 ] 91586 91587 [ 91588 [[link boost_asio.reference.ip__basic_resolver_query.hints [*hints]]] 91589 [Get the hints associated with the query. ] 91590 ] 91591 91592 [ 91593 [[link boost_asio.reference.ip__basic_resolver_query.host_name [*host_name]]] 91594 [Get the host name associated with the query. ] 91595 ] 91596 91597 [ 91598 [[link boost_asio.reference.ip__basic_resolver_query.service_name [*service_name]]] 91599 [Get the service name associated with the query. ] 91600 ] 91601 91602] 91603 91604[heading Data Members] 91605[table 91606 [[Name][Description]] 91607 91608 [ 91609 [[link boost_asio.reference.ip__basic_resolver_query.address_configured [*address_configured]] [static]] 91610 [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. ] 91611 ] 91612 91613 [ 91614 [[link boost_asio.reference.ip__basic_resolver_query.all_matching [*all_matching]] [static]] 91615 [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ] 91616 ] 91617 91618 [ 91619 [[link boost_asio.reference.ip__basic_resolver_query.canonical_name [*canonical_name]] [static]] 91620 [Determine the canonical name of the host specified in the query. ] 91621 ] 91622 91623 [ 91624 [[link boost_asio.reference.ip__basic_resolver_query.numeric_host [*numeric_host]] [static]] 91625 [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ] 91626 ] 91627 91628 [ 91629 [[link boost_asio.reference.ip__basic_resolver_query.numeric_service [*numeric_service]] [static]] 91630 [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ] 91631 ] 91632 91633 [ 91634 [[link boost_asio.reference.ip__basic_resolver_query.passive [*passive]] [static]] 91635 [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ] 91636 ] 91637 91638 [ 91639 [[link boost_asio.reference.ip__basic_resolver_query.v4_mapped [*v4_mapped]] [static]] 91640 [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ] 91641 ] 91642 91643] 91644 91645The [link boost_asio.reference.ip__basic_resolver_query `ip::basic_resolver_query`] class template describes a query that can be passed to a resolver. 91646 91647 91648[heading Thread Safety] 91649 91650['Distinct] ['objects:] Safe. 91651 91652['Shared] ['objects:] Unsafe. 91653 91654 91655 91656 91657[heading Requirements] 91658 91659['Header: ][^boost/asio/ip/basic_resolver.hpp] 91660 91661['Convenience header: ][^boost/asio.hpp] 91662 91663 91664[endsect] 91665 91666 91667[section:resolve ip::basic_resolver::resolve] 91668 91669[indexterm2 boost_asio.indexterm.ip__basic_resolver.resolve..resolve..ip::basic_resolver] 91670(Deprecated: Use overload with separate host and service parameters.) Perform forward resolution of a query to a list of entries. 91671 91672 91673 results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload1 resolve]``( 91674 const query & q); 91675 `` [''''»''' [link boost_asio.reference.ip__basic_resolver.resolve.overload1 more...]]`` 91676 91677 results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload2 resolve]``( 91678 const query & q, 91679 boost::system::error_code & ec); 91680 `` [''''»''' [link boost_asio.reference.ip__basic_resolver.resolve.overload2 more...]]`` 91681 91682 91683Perform forward resolution of a query to a list of entries. 91684 91685 91686 results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload3 resolve]``( 91687 string_view host, 91688 string_view service); 91689 `` [''''»''' [link boost_asio.reference.ip__basic_resolver.resolve.overload3 more...]]`` 91690 91691 results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload4 resolve]``( 91692 string_view host, 91693 string_view service, 91694 boost::system::error_code & ec); 91695 `` [''''»''' [link boost_asio.reference.ip__basic_resolver.resolve.overload4 more...]]`` 91696 91697 results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload5 resolve]``( 91698 string_view host, 91699 string_view service, 91700 resolver_base::flags resolve_flags); 91701 `` [''''»''' [link boost_asio.reference.ip__basic_resolver.resolve.overload5 more...]]`` 91702 91703 results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload6 resolve]``( 91704 string_view host, 91705 string_view service, 91706 resolver_base::flags resolve_flags, 91707 boost::system::error_code & ec); 91708 `` [''''»''' [link boost_asio.reference.ip__basic_resolver.resolve.overload6 more...]]`` 91709 91710 results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload7 resolve]``( 91711 const protocol_type & protocol, 91712 string_view host, 91713 string_view service); 91714 `` [''''»''' [link boost_asio.reference.ip__basic_resolver.resolve.overload7 more...]]`` 91715 91716 results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload8 resolve]``( 91717 const protocol_type & protocol, 91718 string_view host, 91719 string_view service, 91720 boost::system::error_code & ec); 91721 `` [''''»''' [link boost_asio.reference.ip__basic_resolver.resolve.overload8 more...]]`` 91722 91723 results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload9 resolve]``( 91724 const protocol_type & protocol, 91725 string_view host, 91726 string_view service, 91727 resolver_base::flags resolve_flags); 91728 `` [''''»''' [link boost_asio.reference.ip__basic_resolver.resolve.overload9 more...]]`` 91729 91730 results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload10 resolve]``( 91731 const protocol_type & protocol, 91732 string_view host, 91733 string_view service, 91734 resolver_base::flags resolve_flags, 91735 boost::system::error_code & ec); 91736 `` [''''»''' [link boost_asio.reference.ip__basic_resolver.resolve.overload10 more...]]`` 91737 91738 91739Perform reverse resolution of an endpoint to a list of entries. 91740 91741 91742 results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload11 resolve]``( 91743 const endpoint_type & e); 91744 `` [''''»''' [link boost_asio.reference.ip__basic_resolver.resolve.overload11 more...]]`` 91745 91746 results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload12 resolve]``( 91747 const endpoint_type & e, 91748 boost::system::error_code & ec); 91749 `` [''''»''' [link boost_asio.reference.ip__basic_resolver.resolve.overload12 more...]]`` 91750 91751 91752[section:overload1 ip::basic_resolver::resolve (1 of 12 overloads)] 91753 91754 91755(Deprecated: Use overload with separate host and service parameters.) Perform forward resolution of a query to a list of entries. 91756 91757 91758 results_type resolve( 91759 const query & q); 91760 91761 91762This function is used to resolve a query into a list of endpoint entries. 91763 91764 91765[heading Parameters] 91766 91767 91768[variablelist 91769 91770[[q][A query object that determines what endpoints will be returned.]] 91771 91772] 91773 91774 91775[heading Return Value] 91776 91777A range object representing the list of endpoint entries. A successful call to this function is guaranteed to return a non-empty range. 91778 91779 91780[heading Exceptions] 91781 91782 91783[variablelist 91784 91785[[boost::system::system_error][Thrown on failure. ]] 91786 91787] 91788 91789 91790 91791 91792[endsect] 91793 91794 91795 91796[section:overload2 ip::basic_resolver::resolve (2 of 12 overloads)] 91797 91798 91799(Deprecated: Use overload with separate host and service parameters.) Perform forward resolution of a query to a list of entries. 91800 91801 91802 results_type resolve( 91803 const query & q, 91804 boost::system::error_code & ec); 91805 91806 91807This function is used to resolve a query into a list of endpoint entries. 91808 91809 91810[heading Parameters] 91811 91812 91813[variablelist 91814 91815[[q][A query object that determines what endpoints will be returned.]] 91816 91817[[ec][Set to indicate what error occurred, if any.]] 91818 91819] 91820 91821 91822[heading Return Value] 91823 91824A 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. 91825 91826 91827 91828 91829[endsect] 91830 91831 91832 91833[section:overload3 ip::basic_resolver::resolve (3 of 12 overloads)] 91834 91835 91836Perform forward resolution of a query to a list of entries. 91837 91838 91839 results_type resolve( 91840 string_view host, 91841 string_view service); 91842 91843 91844This function is used to resolve host and service names into a list of endpoint entries. 91845 91846 91847[heading Parameters] 91848 91849 91850[variablelist 91851 91852[[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.]] 91853 91854[[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.]] 91855 91856] 91857 91858 91859[heading Return Value] 91860 91861A range object representing the list of endpoint entries. A successful call to this function is guaranteed to return a non-empty range. 91862 91863 91864[heading Exceptions] 91865 91866 91867[variablelist 91868 91869[[boost::system::system_error][Thrown on failure.]] 91870 91871] 91872 91873 91874[heading Remarks] 91875 91876On 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). 91877 91878On 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. 91879 91880 91881[endsect] 91882 91883 91884 91885[section:overload4 ip::basic_resolver::resolve (4 of 12 overloads)] 91886 91887 91888Perform forward resolution of a query to a list of entries. 91889 91890 91891 results_type resolve( 91892 string_view host, 91893 string_view service, 91894 boost::system::error_code & ec); 91895 91896 91897This function is used to resolve host and service names into a list of endpoint entries. 91898 91899 91900[heading Parameters] 91901 91902 91903[variablelist 91904 91905[[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.]] 91906 91907[[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.]] 91908 91909[[ec][Set to indicate what error occurred, if any.]] 91910 91911] 91912 91913 91914[heading Return Value] 91915 91916A 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. 91917 91918 91919[heading Remarks] 91920 91921On 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). 91922 91923On 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. 91924 91925 91926[endsect] 91927 91928 91929 91930[section:overload5 ip::basic_resolver::resolve (5 of 12 overloads)] 91931 91932 91933Perform forward resolution of a query to a list of entries. 91934 91935 91936 results_type resolve( 91937 string_view host, 91938 string_view service, 91939 resolver_base::flags resolve_flags); 91940 91941 91942This function is used to resolve host and service names into a list of endpoint entries. 91943 91944 91945[heading Parameters] 91946 91947 91948[variablelist 91949 91950[[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.]] 91951 91952[[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.]] 91953 91954[[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.]] 91955 91956] 91957 91958 91959[heading Return Value] 91960 91961A range object representing the list of endpoint entries. A successful call to this function is guaranteed to return a non-empty range. 91962 91963 91964[heading Exceptions] 91965 91966 91967[variablelist 91968 91969[[boost::system::system_error][Thrown on failure.]] 91970 91971] 91972 91973 91974[heading Remarks] 91975 91976On 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). 91977 91978On 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. 91979 91980 91981[endsect] 91982 91983 91984 91985[section:overload6 ip::basic_resolver::resolve (6 of 12 overloads)] 91986 91987 91988Perform forward resolution of a query to a list of entries. 91989 91990 91991 results_type resolve( 91992 string_view host, 91993 string_view service, 91994 resolver_base::flags resolve_flags, 91995 boost::system::error_code & ec); 91996 91997 91998This function is used to resolve host and service names into a list of endpoint entries. 91999 92000 92001[heading Parameters] 92002 92003 92004[variablelist 92005 92006[[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.]] 92007 92008[[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.]] 92009 92010[[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.]] 92011 92012[[ec][Set to indicate what error occurred, if any.]] 92013 92014] 92015 92016 92017[heading Return Value] 92018 92019A 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. 92020 92021 92022[heading Remarks] 92023 92024On 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). 92025 92026On 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. 92027 92028 92029[endsect] 92030 92031 92032 92033[section:overload7 ip::basic_resolver::resolve (7 of 12 overloads)] 92034 92035 92036Perform forward resolution of a query to a list of entries. 92037 92038 92039 results_type resolve( 92040 const protocol_type & protocol, 92041 string_view host, 92042 string_view service); 92043 92044 92045This function is used to resolve host and service names into a list of endpoint entries. 92046 92047 92048[heading Parameters] 92049 92050 92051[variablelist 92052 92053[[protocol][A protocol object, normally representing either the IPv4 or IPv6 version of an internet protocol.]] 92054 92055[[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.]] 92056 92057[[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.]] 92058 92059] 92060 92061 92062[heading Return Value] 92063 92064A range object representing the list of endpoint entries. A successful call to this function is guaranteed to return a non-empty range. 92065 92066 92067[heading Exceptions] 92068 92069 92070[variablelist 92071 92072[[boost::system::system_error][Thrown on failure.]] 92073 92074] 92075 92076 92077[heading Remarks] 92078 92079On 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). 92080 92081On 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. 92082 92083 92084[endsect] 92085 92086 92087 92088[section:overload8 ip::basic_resolver::resolve (8 of 12 overloads)] 92089 92090 92091Perform forward resolution of a query to a list of entries. 92092 92093 92094 results_type resolve( 92095 const protocol_type & protocol, 92096 string_view host, 92097 string_view service, 92098 boost::system::error_code & ec); 92099 92100 92101This function is used to resolve host and service names into a list of endpoint entries. 92102 92103 92104[heading Parameters] 92105 92106 92107[variablelist 92108 92109[[protocol][A protocol object, normally representing either the IPv4 or IPv6 version of an internet protocol.]] 92110 92111[[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.]] 92112 92113[[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.]] 92114 92115[[ec][Set to indicate what error occurred, if any.]] 92116 92117] 92118 92119 92120[heading Return Value] 92121 92122A 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. 92123 92124 92125[heading Remarks] 92126 92127On 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). 92128 92129On 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. 92130 92131 92132[endsect] 92133 92134 92135 92136[section:overload9 ip::basic_resolver::resolve (9 of 12 overloads)] 92137 92138 92139Perform forward resolution of a query to a list of entries. 92140 92141 92142 results_type resolve( 92143 const protocol_type & protocol, 92144 string_view host, 92145 string_view service, 92146 resolver_base::flags resolve_flags); 92147 92148 92149This function is used to resolve host and service names into a list of endpoint entries. 92150 92151 92152[heading Parameters] 92153 92154 92155[variablelist 92156 92157[[protocol][A protocol object, normally representing either the IPv4 or IPv6 version of an internet protocol.]] 92158 92159[[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.]] 92160 92161[[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.]] 92162 92163[[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.]] 92164 92165] 92166 92167 92168[heading Return Value] 92169 92170A range object representing the list of endpoint entries. A successful call to this function is guaranteed to return a non-empty range. 92171 92172 92173[heading Exceptions] 92174 92175 92176[variablelist 92177 92178[[boost::system::system_error][Thrown on failure.]] 92179 92180] 92181 92182 92183[heading Remarks] 92184 92185On 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). 92186 92187On 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. 92188 92189 92190[endsect] 92191 92192 92193 92194[section:overload10 ip::basic_resolver::resolve (10 of 12 overloads)] 92195 92196 92197Perform forward resolution of a query to a list of entries. 92198 92199 92200 results_type resolve( 92201 const protocol_type & protocol, 92202 string_view host, 92203 string_view service, 92204 resolver_base::flags resolve_flags, 92205 boost::system::error_code & ec); 92206 92207 92208This function is used to resolve host and service names into a list of endpoint entries. 92209 92210 92211[heading Parameters] 92212 92213 92214[variablelist 92215 92216[[protocol][A protocol object, normally representing either the IPv4 or IPv6 version of an internet protocol.]] 92217 92218[[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.]] 92219 92220[[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.]] 92221 92222[[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.]] 92223 92224[[ec][Set to indicate what error occurred, if any.]] 92225 92226] 92227 92228 92229[heading Return Value] 92230 92231A 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. 92232 92233 92234[heading Remarks] 92235 92236On 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). 92237 92238On 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. 92239 92240 92241[endsect] 92242 92243 92244 92245[section:overload11 ip::basic_resolver::resolve (11 of 12 overloads)] 92246 92247 92248Perform reverse resolution of an endpoint to a list of entries. 92249 92250 92251 results_type resolve( 92252 const endpoint_type & e); 92253 92254 92255This function is used to resolve an endpoint into a list of endpoint entries. 92256 92257 92258[heading Parameters] 92259 92260 92261[variablelist 92262 92263[[e][An endpoint object that determines what endpoints will be returned.]] 92264 92265] 92266 92267 92268[heading Return Value] 92269 92270A range object representing the list of endpoint entries. A successful call to this function is guaranteed to return a non-empty range. 92271 92272 92273[heading Exceptions] 92274 92275 92276[variablelist 92277 92278[[boost::system::system_error][Thrown on failure. ]] 92279 92280] 92281 92282 92283 92284 92285[endsect] 92286 92287 92288 92289[section:overload12 ip::basic_resolver::resolve (12 of 12 overloads)] 92290 92291 92292Perform reverse resolution of an endpoint to a list of entries. 92293 92294 92295 results_type resolve( 92296 const endpoint_type & e, 92297 boost::system::error_code & ec); 92298 92299 92300This function is used to resolve an endpoint into a list of endpoint entries. 92301 92302 92303[heading Parameters] 92304 92305 92306[variablelist 92307 92308[[e][An endpoint object that determines what endpoints will be returned.]] 92309 92310[[ec][Set to indicate what error occurred, if any.]] 92311 92312] 92313 92314 92315[heading Return Value] 92316 92317A 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. 92318 92319 92320 92321 92322[endsect] 92323 92324 92325[endsect] 92326 92327 92328[section:results_type ip::basic_resolver::results_type] 92329 92330[indexterm2 boost_asio.indexterm.ip__basic_resolver.results_type..results_type..ip::basic_resolver] 92331The results type. 92332 92333 92334 typedef basic_resolver_results< InternetProtocol > results_type; 92335 92336 92337[heading Types] 92338[table 92339 [[Name][Description]] 92340 92341 [ 92342 92343 [[link boost_asio.reference.ip__basic_resolver_results.const_iterator [*const_iterator]]] 92344 [The type of an iterator into the range. ] 92345 92346 ] 92347 92348 [ 92349 92350 [[link boost_asio.reference.ip__basic_resolver_results.const_reference [*const_reference]]] 92351 [The type of a const reference to a value in the range. ] 92352 92353 ] 92354 92355 [ 92356 92357 [[link boost_asio.reference.ip__basic_resolver_results.difference_type [*difference_type]]] 92358 [Type used to represent the distance between two iterators in the range. ] 92359 92360 ] 92361 92362 [ 92363 92364 [[link boost_asio.reference.ip__basic_resolver_results.endpoint_type [*endpoint_type]]] 92365 [The endpoint type associated with the results. ] 92366 92367 ] 92368 92369 [ 92370 92371 [[link boost_asio.reference.ip__basic_resolver_results.iterator [*iterator]]] 92372 [The type of an iterator into the range. ] 92373 92374 ] 92375 92376 [ 92377 92378 [[link boost_asio.reference.ip__basic_resolver_results.iterator_category [*iterator_category]]] 92379 [The iterator category. ] 92380 92381 ] 92382 92383 [ 92384 92385 [[link boost_asio.reference.ip__basic_resolver_results.pointer [*pointer]]] 92386 [The type of the result of applying operator->() to the iterator. ] 92387 92388 ] 92389 92390 [ 92391 92392 [[link boost_asio.reference.ip__basic_resolver_results.protocol_type [*protocol_type]]] 92393 [The protocol type associated with the results. ] 92394 92395 ] 92396 92397 [ 92398 92399 [[link boost_asio.reference.ip__basic_resolver_results.reference [*reference]]] 92400 [The type of a non-const reference to a value in the range. ] 92401 92402 ] 92403 92404 [ 92405 92406 [[link boost_asio.reference.ip__basic_resolver_results.size_type [*size_type]]] 92407 [Type used to represent a count of the elements in the range. ] 92408 92409 ] 92410 92411 [ 92412 92413 [[link boost_asio.reference.ip__basic_resolver_results.value_type [*value_type]]] 92414 [The type of a value in the results range. ] 92415 92416 ] 92417 92418] 92419 92420[heading Member Functions] 92421[table 92422 [[Name][Description]] 92423 92424 [ 92425 [[link boost_asio.reference.ip__basic_resolver_results.basic_resolver_results [*basic_resolver_results]] [constructor]] 92426 [Default constructor creates an empty range. 92427 [hr] 92428 Copy constructor. 92429 [hr] 92430 Move constructor. ] 92431 ] 92432 92433 [ 92434 [[link boost_asio.reference.ip__basic_resolver_results.begin [*begin]]] 92435 [Obtain a begin iterator for the results range. ] 92436 ] 92437 92438 [ 92439 [[link boost_asio.reference.ip__basic_resolver_results.cbegin [*cbegin]]] 92440 [Obtain a begin iterator for the results range. ] 92441 ] 92442 92443 [ 92444 [[link boost_asio.reference.ip__basic_resolver_results.cend [*cend]]] 92445 [Obtain an end iterator for the results range. ] 92446 ] 92447 92448 [ 92449 [[link boost_asio.reference.ip__basic_resolver_results.empty [*empty]]] 92450 [Determine whether the results range is empty. ] 92451 ] 92452 92453 [ 92454 [[link boost_asio.reference.ip__basic_resolver_results.end [*end]]] 92455 [Obtain an end iterator for the results range. ] 92456 ] 92457 92458 [ 92459 [[link boost_asio.reference.ip__basic_resolver_results.max_size [*max_size]]] 92460 [Get the maximum number of entries permitted in a results range. ] 92461 ] 92462 92463 [ 92464 [[link boost_asio.reference.ip__basic_resolver_results.operator__star_ [*operator *]]] 92465 [Dereference an iterator. ] 92466 ] 92467 92468 [ 92469 [[link boost_asio.reference.ip__basic_resolver_results.operator_plus__plus_ [*operator++]]] 92470 [Increment operator (prefix). 92471 [hr] 92472 Increment operator (postfix). ] 92473 ] 92474 92475 [ 92476 [[link boost_asio.reference.ip__basic_resolver_results.operator_arrow_ [*operator->]]] 92477 [Dereference an iterator. ] 92478 ] 92479 92480 [ 92481 [[link boost_asio.reference.ip__basic_resolver_results.operator_eq_ [*operator=]]] 92482 [Assignment operator. 92483 [hr] 92484 Move-assignment operator. ] 92485 ] 92486 92487 [ 92488 [[link boost_asio.reference.ip__basic_resolver_results.size [*size]]] 92489 [Get the number of entries in the results range. ] 92490 ] 92491 92492 [ 92493 [[link boost_asio.reference.ip__basic_resolver_results.swap [*swap]]] 92494 [Swap the results range with another. ] 92495 ] 92496 92497] 92498 92499[heading Protected Member Functions] 92500[table 92501 [[Name][Description]] 92502 92503 [ 92504 [[link boost_asio.reference.ip__basic_resolver_results.dereference [*dereference]]] 92505 [] 92506 ] 92507 92508 [ 92509 [[link boost_asio.reference.ip__basic_resolver_results.equal [*equal]]] 92510 [] 92511 ] 92512 92513 [ 92514 [[link boost_asio.reference.ip__basic_resolver_results.increment [*increment]]] 92515 [] 92516 ] 92517 92518] 92519 92520[heading Protected Data Members] 92521[table 92522 [[Name][Description]] 92523 92524 [ 92525 [[link boost_asio.reference.ip__basic_resolver_results.index_ [*index_]]] 92526 [] 92527 ] 92528 92529 [ 92530 [[link boost_asio.reference.ip__basic_resolver_results.values_ [*values_]]] 92531 [] 92532 ] 92533 92534] 92535 92536[heading Friends] 92537[table 92538 [[Name][Description]] 92539 92540 [ 92541 [[link boost_asio.reference.ip__basic_resolver_results.operator_not__eq_ [*operator!=]]] 92542 [Test two iterators for inequality. ] 92543 ] 92544 92545 [ 92546 [[link boost_asio.reference.ip__basic_resolver_results.operator_eq__eq_ [*operator==]]] 92547 [Test two iterators for equality. ] 92548 ] 92549 92550] 92551 92552The [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. 92553 92554The iterator's value\_type, obtained when a results iterator is dereferenced, is: 92555 92556 const basic_resolver_entry<InternetProtocol> 92557 92558 92559 92560 92561 92562[heading Remarks] 92563 92564For 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. 92565 92566 92567[heading Thread Safety] 92568 92569['Distinct] ['objects:] Safe. 92570 92571['Shared] ['objects:] Unsafe. 92572 92573 92574 92575 92576[heading Requirements] 92577 92578['Header: ][^boost/asio/ip/basic_resolver.hpp] 92579 92580['Convenience header: ][^boost/asio.hpp] 92581 92582 92583[endsect] 92584 92585 92586 92587[section:v4_mapped ip::basic_resolver::v4_mapped] 92588 92589 92590['Inherited from ip::resolver_base.] 92591 92592[indexterm2 boost_asio.indexterm.ip__basic_resolver.v4_mapped..v4_mapped..ip::basic_resolver] 92593If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. 92594 92595 92596 static const flags v4_mapped = implementation_defined; 92597 92598 92599 92600[endsect] 92601 92602 92603 92604[section:_basic_resolver ip::basic_resolver::~basic_resolver] 92605 92606[indexterm2 boost_asio.indexterm.ip__basic_resolver._basic_resolver..~basic_resolver..ip::basic_resolver] 92607Destroys the resolver. 92608 92609 92610 ~basic_resolver(); 92611 92612 92613This function destroys the resolver, cancelling any outstanding asynchronous wait operations associated with the resolver as if by calling `cancel`. 92614 92615 92616[endsect] 92617 92618 92619 92620[endsect] 92621 92622[section:ip__basic_resolver__rebind_executor ip::basic_resolver::rebind_executor] 92623 92624[indexterm1 boost_asio.indexterm.ip__basic_resolver__rebind_executor..ip::basic_resolver::rebind_executor] 92625 92626 92627Rebinds the resolver type to another executor. 92628 92629 92630 template< 92631 typename ``[link boost_asio.reference.Executor1 Executor1]``> 92632 struct rebind_executor 92633 92634 92635[heading Types] 92636[table 92637 [[Name][Description]] 92638 92639 [ 92640 92641 [[link boost_asio.reference.ip__basic_resolver__rebind_executor.other [*other]]] 92642 [The resolver type when rebound to the specified executor. ] 92643 92644 ] 92645 92646] 92647 92648[heading Requirements] 92649 92650['Header: ][^boost/asio/ip/basic_resolver.hpp] 92651 92652['Convenience header: ][^boost/asio.hpp] 92653 92654 92655[section:other ip::basic_resolver::rebind_executor::other] 92656 92657[indexterm2 boost_asio.indexterm.ip__basic_resolver__rebind_executor.other..other..ip::basic_resolver::rebind_executor] 92658The resolver type when rebound to the specified executor. 92659 92660 92661 typedef basic_resolver< InternetProtocol, Executor1 > other; 92662 92663 92664[heading Types] 92665[table 92666 [[Name][Description]] 92667 92668 [ 92669 92670 [[link boost_asio.reference.ip__basic_resolver__rebind_executor [*rebind_executor]]] 92671 [Rebinds the resolver type to another executor. ] 92672 92673 ] 92674 92675 [ 92676 92677 [[link boost_asio.reference.ip__basic_resolver.endpoint_type [*endpoint_type]]] 92678 [The endpoint type. ] 92679 92680 ] 92681 92682 [ 92683 92684 [[link boost_asio.reference.ip__basic_resolver.executor_type [*executor_type]]] 92685 [The type of the executor associated with the object. ] 92686 92687 ] 92688 92689 [ 92690 92691 [[link boost_asio.reference.ip__basic_resolver.flags [*flags]]] 92692 [A bitmask type (C++ Std \[lib.bitmask.types\]). ] 92693 92694 ] 92695 92696 [ 92697 92698 [[link boost_asio.reference.ip__basic_resolver.iterator [*iterator]]] 92699 [(Deprecated.) The iterator type. ] 92700 92701 ] 92702 92703 [ 92704 92705 [[link boost_asio.reference.ip__basic_resolver.protocol_type [*protocol_type]]] 92706 [The protocol type. ] 92707 92708 ] 92709 92710 [ 92711 92712 [[link boost_asio.reference.ip__basic_resolver.query [*query]]] 92713 [(Deprecated.) The query type. ] 92714 92715 ] 92716 92717 [ 92718 92719 [[link boost_asio.reference.ip__basic_resolver.results_type [*results_type]]] 92720 [The results type. ] 92721 92722 ] 92723 92724] 92725 92726[heading Member Functions] 92727[table 92728 [[Name][Description]] 92729 92730 [ 92731 [[link boost_asio.reference.ip__basic_resolver.async_resolve [*async_resolve]]] 92732 [(Deprecated: Use overload with separate host and service parameters.) Asynchronously perform forward resolution of a query to a list of entries. 92733 [hr] 92734 Asynchronously perform forward resolution of a query to a list of entries. 92735 [hr] 92736 Asynchronously perform reverse resolution of an endpoint to a list of entries. ] 92737 ] 92738 92739 [ 92740 [[link boost_asio.reference.ip__basic_resolver.basic_resolver [*basic_resolver]] [constructor]] 92741 [Construct with executor. 92742 [hr] 92743 Construct with execution context. 92744 [hr] 92745 Move-construct a basic_resolver from another. ] 92746 ] 92747 92748 [ 92749 [[link boost_asio.reference.ip__basic_resolver.cancel [*cancel]]] 92750 [Cancel any asynchronous operations that are waiting on the resolver. ] 92751 ] 92752 92753 [ 92754 [[link boost_asio.reference.ip__basic_resolver.get_executor [*get_executor]]] 92755 [Get the executor associated with the object. ] 92756 ] 92757 92758 [ 92759 [[link boost_asio.reference.ip__basic_resolver.operator_eq_ [*operator=]]] 92760 [Move-assign a basic_resolver from another. ] 92761 ] 92762 92763 [ 92764 [[link boost_asio.reference.ip__basic_resolver.resolve [*resolve]]] 92765 [(Deprecated: Use overload with separate host and service parameters.) Perform forward resolution of a query to a list of entries. 92766 [hr] 92767 Perform forward resolution of a query to a list of entries. 92768 [hr] 92769 Perform reverse resolution of an endpoint to a list of entries. ] 92770 ] 92771 92772 [ 92773 [[link boost_asio.reference.ip__basic_resolver._basic_resolver [*~basic_resolver]] [destructor]] 92774 [Destroys the resolver. ] 92775 ] 92776 92777] 92778 92779[heading Data Members] 92780[table 92781 [[Name][Description]] 92782 92783 [ 92784 [[link boost_asio.reference.ip__basic_resolver.address_configured [*address_configured]] [static]] 92785 [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. ] 92786 ] 92787 92788 [ 92789 [[link boost_asio.reference.ip__basic_resolver.all_matching [*all_matching]] [static]] 92790 [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ] 92791 ] 92792 92793 [ 92794 [[link boost_asio.reference.ip__basic_resolver.canonical_name [*canonical_name]] [static]] 92795 [Determine the canonical name of the host specified in the query. ] 92796 ] 92797 92798 [ 92799 [[link boost_asio.reference.ip__basic_resolver.numeric_host [*numeric_host]] [static]] 92800 [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ] 92801 ] 92802 92803 [ 92804 [[link boost_asio.reference.ip__basic_resolver.numeric_service [*numeric_service]] [static]] 92805 [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ] 92806 ] 92807 92808 [ 92809 [[link boost_asio.reference.ip__basic_resolver.passive [*passive]] [static]] 92810 [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ] 92811 ] 92812 92813 [ 92814 [[link boost_asio.reference.ip__basic_resolver.v4_mapped [*v4_mapped]] [static]] 92815 [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ] 92816 ] 92817 92818] 92819 92820The [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] class template provides the ability to resolve a query to a list of endpoints. 92821 92822 92823[heading Thread Safety] 92824 92825['Distinct] ['objects:] Safe. 92826 92827['Shared] ['objects:] Unsafe. 92828 92829 92830 92831 92832[heading Requirements] 92833 92834['Header: ][^boost/asio/ip/basic_resolver.hpp] 92835 92836['Convenience header: ][^boost/asio.hpp] 92837 92838 92839[endsect] 92840 92841 92842 92843[endsect] 92844 92845[section:ip__basic_resolver_entry ip::basic_resolver_entry] 92846 92847[indexterm1 boost_asio.indexterm.ip__basic_resolver_entry..ip::basic_resolver_entry] 92848 92849 92850An entry produced by a resolver. 92851 92852 92853 template< 92854 typename ``[link boost_asio.reference.InternetProtocol InternetProtocol]``> 92855 class basic_resolver_entry 92856 92857 92858[heading Types] 92859[table 92860 [[Name][Description]] 92861 92862 [ 92863 92864 [[link boost_asio.reference.ip__basic_resolver_entry.endpoint_type [*endpoint_type]]] 92865 [The endpoint type associated with the endpoint entry. ] 92866 92867 ] 92868 92869 [ 92870 92871 [[link boost_asio.reference.ip__basic_resolver_entry.protocol_type [*protocol_type]]] 92872 [The protocol type associated with the endpoint entry. ] 92873 92874 ] 92875 92876] 92877 92878[heading Member Functions] 92879[table 92880 [[Name][Description]] 92881 92882 [ 92883 [[link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry [*basic_resolver_entry]] [constructor]] 92884 [Default constructor. 92885 [hr] 92886 Construct with specified endpoint, host name and service name. ] 92887 ] 92888 92889 [ 92890 [[link boost_asio.reference.ip__basic_resolver_entry.endpoint [*endpoint]]] 92891 [Get the endpoint associated with the entry. ] 92892 ] 92893 92894 [ 92895 [[link boost_asio.reference.ip__basic_resolver_entry.host_name [*host_name]]] 92896 [Get the host name associated with the entry. ] 92897 ] 92898 92899 [ 92900 [[link boost_asio.reference.ip__basic_resolver_entry.operator_endpoint_type [*operator endpoint_type]]] 92901 [Convert to the endpoint associated with the entry. ] 92902 ] 92903 92904 [ 92905 [[link boost_asio.reference.ip__basic_resolver_entry.service_name [*service_name]]] 92906 [Get the service name associated with the entry. ] 92907 ] 92908 92909] 92910 92911The [link boost_asio.reference.ip__basic_resolver_entry `ip::basic_resolver_entry`] class template describes an entry as returned by a resolver. 92912 92913 92914[heading Thread Safety] 92915 92916['Distinct] ['objects:] Safe. 92917 92918['Shared] ['objects:] Unsafe. 92919 92920 92921 92922[heading Requirements] 92923 92924['Header: ][^boost/asio/ip/basic_resolver_entry.hpp] 92925 92926['Convenience header: ][^boost/asio.hpp] 92927 92928[section:basic_resolver_entry ip::basic_resolver_entry::basic_resolver_entry] 92929 92930[indexterm2 boost_asio.indexterm.ip__basic_resolver_entry.basic_resolver_entry..basic_resolver_entry..ip::basic_resolver_entry] 92931Default constructor. 92932 92933 92934 ``[link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry.overload1 basic_resolver_entry]``(); 92935 `` [''''»''' [link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry.overload1 more...]]`` 92936 92937 92938Construct with specified endpoint, host name and service name. 92939 92940 92941 ``[link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry.overload2 basic_resolver_entry]``( 92942 const endpoint_type & ep, 92943 string_view host, 92944 string_view service); 92945 `` [''''»''' [link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry.overload2 more...]]`` 92946 92947 92948[section:overload1 ip::basic_resolver_entry::basic_resolver_entry (1 of 2 overloads)] 92949 92950 92951Default constructor. 92952 92953 92954 basic_resolver_entry(); 92955 92956 92957 92958[endsect] 92959 92960 92961 92962[section:overload2 ip::basic_resolver_entry::basic_resolver_entry (2 of 2 overloads)] 92963 92964 92965Construct with specified endpoint, host name and service name. 92966 92967 92968 basic_resolver_entry( 92969 const endpoint_type & ep, 92970 string_view host, 92971 string_view service); 92972 92973 92974 92975[endsect] 92976 92977 92978[endsect] 92979 92980 92981[section:endpoint ip::basic_resolver_entry::endpoint] 92982 92983[indexterm2 boost_asio.indexterm.ip__basic_resolver_entry.endpoint..endpoint..ip::basic_resolver_entry] 92984Get the endpoint associated with the entry. 92985 92986 92987 endpoint_type endpoint() const; 92988 92989 92990 92991[endsect] 92992 92993 92994 92995[section:endpoint_type ip::basic_resolver_entry::endpoint_type] 92996 92997[indexterm2 boost_asio.indexterm.ip__basic_resolver_entry.endpoint_type..endpoint_type..ip::basic_resolver_entry] 92998The endpoint type associated with the endpoint entry. 92999 93000 93001 typedef InternetProtocol::endpoint endpoint_type; 93002 93003 93004 93005[heading Requirements] 93006 93007['Header: ][^boost/asio/ip/basic_resolver_entry.hpp] 93008 93009['Convenience header: ][^boost/asio.hpp] 93010 93011 93012[endsect] 93013 93014 93015[section:host_name ip::basic_resolver_entry::host_name] 93016 93017[indexterm2 boost_asio.indexterm.ip__basic_resolver_entry.host_name..host_name..ip::basic_resolver_entry] 93018Get the host name associated with the entry. 93019 93020 93021 std::string ``[link boost_asio.reference.ip__basic_resolver_entry.host_name.overload1 host_name]``() const; 93022 `` [''''»''' [link boost_asio.reference.ip__basic_resolver_entry.host_name.overload1 more...]]`` 93023 93024 template< 93025 class Allocator> 93026 std::basic_string< char, std::char_traits< char >, Allocator > ``[link boost_asio.reference.ip__basic_resolver_entry.host_name.overload2 host_name]``( 93027 const Allocator & alloc = Allocator()) const; 93028 `` [''''»''' [link boost_asio.reference.ip__basic_resolver_entry.host_name.overload2 more...]]`` 93029 93030 93031[section:overload1 ip::basic_resolver_entry::host_name (1 of 2 overloads)] 93032 93033 93034Get the host name associated with the entry. 93035 93036 93037 std::string host_name() const; 93038 93039 93040 93041[endsect] 93042 93043 93044 93045[section:overload2 ip::basic_resolver_entry::host_name (2 of 2 overloads)] 93046 93047 93048Get the host name associated with the entry. 93049 93050 93051 template< 93052 class Allocator> 93053 std::basic_string< char, std::char_traits< char >, Allocator > host_name( 93054 const Allocator & alloc = Allocator()) const; 93055 93056 93057 93058[endsect] 93059 93060 93061[endsect] 93062 93063 93064[section:operator_endpoint_type ip::basic_resolver_entry::operator endpoint_type] 93065 93066[indexterm2 boost_asio.indexterm.ip__basic_resolver_entry.operator_endpoint_type..operator endpoint_type..ip::basic_resolver_entry] 93067Convert to the endpoint associated with the entry. 93068 93069 93070 operator endpoint_type() const; 93071 93072 93073 93074[endsect] 93075 93076 93077 93078[section:protocol_type ip::basic_resolver_entry::protocol_type] 93079 93080[indexterm2 boost_asio.indexterm.ip__basic_resolver_entry.protocol_type..protocol_type..ip::basic_resolver_entry] 93081The protocol type associated with the endpoint entry. 93082 93083 93084 typedef InternetProtocol protocol_type; 93085 93086 93087 93088[heading Requirements] 93089 93090['Header: ][^boost/asio/ip/basic_resolver_entry.hpp] 93091 93092['Convenience header: ][^boost/asio.hpp] 93093 93094 93095[endsect] 93096 93097 93098[section:service_name ip::basic_resolver_entry::service_name] 93099 93100[indexterm2 boost_asio.indexterm.ip__basic_resolver_entry.service_name..service_name..ip::basic_resolver_entry] 93101Get the service name associated with the entry. 93102 93103 93104 std::string ``[link boost_asio.reference.ip__basic_resolver_entry.service_name.overload1 service_name]``() const; 93105 `` [''''»''' [link boost_asio.reference.ip__basic_resolver_entry.service_name.overload1 more...]]`` 93106 93107 template< 93108 class Allocator> 93109 std::basic_string< char, std::char_traits< char >, Allocator > ``[link boost_asio.reference.ip__basic_resolver_entry.service_name.overload2 service_name]``( 93110 const Allocator & alloc = Allocator()) const; 93111 `` [''''»''' [link boost_asio.reference.ip__basic_resolver_entry.service_name.overload2 more...]]`` 93112 93113 93114[section:overload1 ip::basic_resolver_entry::service_name (1 of 2 overloads)] 93115 93116 93117Get the service name associated with the entry. 93118 93119 93120 std::string service_name() const; 93121 93122 93123 93124[endsect] 93125 93126 93127 93128[section:overload2 ip::basic_resolver_entry::service_name (2 of 2 overloads)] 93129 93130 93131Get the service name associated with the entry. 93132 93133 93134 template< 93135 class Allocator> 93136 std::basic_string< char, std::char_traits< char >, Allocator > service_name( 93137 const Allocator & alloc = Allocator()) const; 93138 93139 93140 93141[endsect] 93142 93143 93144[endsect] 93145 93146 93147[endsect] 93148 93149[section:ip__basic_resolver_iterator ip::basic_resolver_iterator] 93150 93151[indexterm1 boost_asio.indexterm.ip__basic_resolver_iterator..ip::basic_resolver_iterator] 93152 93153 93154An iterator over the entries produced by a resolver. 93155 93156 93157 template< 93158 typename ``[link boost_asio.reference.InternetProtocol InternetProtocol]``> 93159 class basic_resolver_iterator 93160 93161 93162[heading Types] 93163[table 93164 [[Name][Description]] 93165 93166 [ 93167 93168 [[link boost_asio.reference.ip__basic_resolver_iterator.difference_type [*difference_type]]] 93169 [The type used for the distance between two iterators. ] 93170 93171 ] 93172 93173 [ 93174 93175 [[link boost_asio.reference.ip__basic_resolver_iterator.iterator_category [*iterator_category]]] 93176 [The iterator category. ] 93177 93178 ] 93179 93180 [ 93181 93182 [[link boost_asio.reference.ip__basic_resolver_iterator.pointer [*pointer]]] 93183 [The type of the result of applying operator->() to the iterator. ] 93184 93185 ] 93186 93187 [ 93188 93189 [[link boost_asio.reference.ip__basic_resolver_iterator.reference [*reference]]] 93190 [The type of the result of applying operator*() to the iterator. ] 93191 93192 ] 93193 93194 [ 93195 93196 [[link boost_asio.reference.ip__basic_resolver_iterator.value_type [*value_type]]] 93197 [The type of the value pointed to by the iterator. ] 93198 93199 ] 93200 93201] 93202 93203[heading Member Functions] 93204[table 93205 [[Name][Description]] 93206 93207 [ 93208 [[link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator [*basic_resolver_iterator]] [constructor]] 93209 [Default constructor creates an end iterator. 93210 [hr] 93211 Copy constructor. 93212 [hr] 93213 Move constructor. ] 93214 ] 93215 93216 [ 93217 [[link boost_asio.reference.ip__basic_resolver_iterator.operator__star_ [*operator *]]] 93218 [Dereference an iterator. ] 93219 ] 93220 93221 [ 93222 [[link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_ [*operator++]]] 93223 [Increment operator (prefix). 93224 [hr] 93225 Increment operator (postfix). ] 93226 ] 93227 93228 [ 93229 [[link boost_asio.reference.ip__basic_resolver_iterator.operator_arrow_ [*operator->]]] 93230 [Dereference an iterator. ] 93231 ] 93232 93233 [ 93234 [[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq_ [*operator=]]] 93235 [Assignment operator. 93236 [hr] 93237 Move-assignment operator. ] 93238 ] 93239 93240] 93241 93242[heading Protected Member Functions] 93243[table 93244 [[Name][Description]] 93245 93246 [ 93247 [[link boost_asio.reference.ip__basic_resolver_iterator.dereference [*dereference]]] 93248 [] 93249 ] 93250 93251 [ 93252 [[link boost_asio.reference.ip__basic_resolver_iterator.equal [*equal]]] 93253 [] 93254 ] 93255 93256 [ 93257 [[link boost_asio.reference.ip__basic_resolver_iterator.increment [*increment]]] 93258 [] 93259 ] 93260 93261] 93262 93263[heading Protected Data Members] 93264[table 93265 [[Name][Description]] 93266 93267 [ 93268 [[link boost_asio.reference.ip__basic_resolver_iterator.index_ [*index_]]] 93269 [] 93270 ] 93271 93272 [ 93273 [[link boost_asio.reference.ip__basic_resolver_iterator.values_ [*values_]]] 93274 [] 93275 ] 93276 93277] 93278 93279[heading Friends] 93280[table 93281 [[Name][Description]] 93282 93283 [ 93284 [[link boost_asio.reference.ip__basic_resolver_iterator.operator_not__eq_ [*operator!=]]] 93285 [Test two iterators for inequality. ] 93286 ] 93287 93288 [ 93289 [[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq__eq_ [*operator==]]] 93290 [Test two iterators for equality. ] 93291 ] 93292 93293] 93294 93295The [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. 93296 93297The iterator's value\_type, obtained when the iterator is dereferenced, is: 93298 93299 const basic_resolver_entry<InternetProtocol> 93300 93301 93302 93303 93304 93305[heading Thread Safety] 93306 93307['Distinct] ['objects:] Safe. 93308 93309['Shared] ['objects:] Unsafe. 93310 93311 93312 93313[heading Requirements] 93314 93315['Header: ][^boost/asio/ip/basic_resolver_iterator.hpp] 93316 93317['Convenience header: ][^boost/asio.hpp] 93318 93319[section:basic_resolver_iterator ip::basic_resolver_iterator::basic_resolver_iterator] 93320 93321[indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.basic_resolver_iterator..basic_resolver_iterator..ip::basic_resolver_iterator] 93322Default constructor creates an end iterator. 93323 93324 93325 ``[link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator.overload1 basic_resolver_iterator]``(); 93326 `` [''''»''' [link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator.overload1 more...]]`` 93327 93328 93329Copy constructor. 93330 93331 93332 ``[link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator.overload2 basic_resolver_iterator]``( 93333 const basic_resolver_iterator & other); 93334 `` [''''»''' [link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator.overload2 more...]]`` 93335 93336 93337Move constructor. 93338 93339 93340 ``[link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator.overload3 basic_resolver_iterator]``( 93341 basic_resolver_iterator && other); 93342 `` [''''»''' [link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator.overload3 more...]]`` 93343 93344 93345[section:overload1 ip::basic_resolver_iterator::basic_resolver_iterator (1 of 3 overloads)] 93346 93347 93348Default constructor creates an end iterator. 93349 93350 93351 basic_resolver_iterator(); 93352 93353 93354 93355[endsect] 93356 93357 93358 93359[section:overload2 ip::basic_resolver_iterator::basic_resolver_iterator (2 of 3 overloads)] 93360 93361 93362Copy constructor. 93363 93364 93365 basic_resolver_iterator( 93366 const basic_resolver_iterator & other); 93367 93368 93369 93370[endsect] 93371 93372 93373 93374[section:overload3 ip::basic_resolver_iterator::basic_resolver_iterator (3 of 3 overloads)] 93375 93376 93377Move constructor. 93378 93379 93380 basic_resolver_iterator( 93381 basic_resolver_iterator && other); 93382 93383 93384 93385[endsect] 93386 93387 93388[endsect] 93389 93390 93391[section:dereference ip::basic_resolver_iterator::dereference] 93392 93393[indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.dereference..dereference..ip::basic_resolver_iterator] 93394 93395 const basic_resolver_entry< InternetProtocol > & dereference() const; 93396 93397 93398 93399[endsect] 93400 93401 93402 93403[section:difference_type ip::basic_resolver_iterator::difference_type] 93404 93405[indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.difference_type..difference_type..ip::basic_resolver_iterator] 93406The type used for the distance between two iterators. 93407 93408 93409 typedef std::ptrdiff_t difference_type; 93410 93411 93412 93413[heading Requirements] 93414 93415['Header: ][^boost/asio/ip/basic_resolver_iterator.hpp] 93416 93417['Convenience header: ][^boost/asio.hpp] 93418 93419 93420[endsect] 93421 93422 93423 93424[section:equal ip::basic_resolver_iterator::equal] 93425 93426[indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.equal..equal..ip::basic_resolver_iterator] 93427 93428 bool equal( 93429 const basic_resolver_iterator & other) const; 93430 93431 93432 93433[endsect] 93434 93435 93436 93437[section:increment ip::basic_resolver_iterator::increment] 93438 93439[indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.increment..increment..ip::basic_resolver_iterator] 93440 93441 void increment(); 93442 93443 93444 93445[endsect] 93446 93447 93448 93449[section:index_ ip::basic_resolver_iterator::index_] 93450 93451[indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.index_..index_..ip::basic_resolver_iterator] 93452 93453 std::size_t index_; 93454 93455 93456 93457[endsect] 93458 93459 93460 93461[section:iterator_category ip::basic_resolver_iterator::iterator_category] 93462 93463[indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.iterator_category..iterator_category..ip::basic_resolver_iterator] 93464The iterator category. 93465 93466 93467 typedef std::forward_iterator_tag iterator_category; 93468 93469 93470 93471[heading Requirements] 93472 93473['Header: ][^boost/asio/ip/basic_resolver_iterator.hpp] 93474 93475['Convenience header: ][^boost/asio.hpp] 93476 93477 93478[endsect] 93479 93480 93481 93482[section:operator__star_ ip::basic_resolver_iterator::operator *] 93483 93484[indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.operator__star_..operator *..ip::basic_resolver_iterator] 93485Dereference an iterator. 93486 93487 93488 const basic_resolver_entry< InternetProtocol > & operator *() const; 93489 93490 93491 93492[endsect] 93493 93494 93495 93496[section:operator_not__eq_ ip::basic_resolver_iterator::operator!=] 93497 93498[indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.operator_not__eq_..operator!=..ip::basic_resolver_iterator] 93499Test two iterators for inequality. 93500 93501 93502 friend bool operator!=( 93503 const basic_resolver_iterator & a, 93504 const basic_resolver_iterator & b); 93505 93506 93507[heading Requirements] 93508 93509['Header: ][^boost/asio/ip/basic_resolver_iterator.hpp] 93510 93511['Convenience header: ][^boost/asio.hpp] 93512 93513 93514[endsect] 93515 93516 93517[section:operator_plus__plus_ ip::basic_resolver_iterator::operator++] 93518 93519[indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.operator_plus__plus_..operator++..ip::basic_resolver_iterator] 93520Increment operator (prefix). 93521 93522 93523 basic_resolver_iterator & ``[link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_.overload1 operator++]``(); 93524 `` [''''»''' [link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_.overload1 more...]]`` 93525 93526 93527Increment operator (postfix). 93528 93529 93530 basic_resolver_iterator ``[link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_.overload2 operator++]``( 93531 int ); 93532 `` [''''»''' [link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_.overload2 more...]]`` 93533 93534 93535[section:overload1 ip::basic_resolver_iterator::operator++ (1 of 2 overloads)] 93536 93537 93538Increment operator (prefix). 93539 93540 93541 basic_resolver_iterator & operator++(); 93542 93543 93544 93545[endsect] 93546 93547 93548 93549[section:overload2 ip::basic_resolver_iterator::operator++ (2 of 2 overloads)] 93550 93551 93552Increment operator (postfix). 93553 93554 93555 basic_resolver_iterator operator++( 93556 int ); 93557 93558 93559 93560[endsect] 93561 93562 93563[endsect] 93564 93565 93566[section:operator_arrow_ ip::basic_resolver_iterator::operator->] 93567 93568[indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.operator_arrow_..operator->..ip::basic_resolver_iterator] 93569Dereference an iterator. 93570 93571 93572 const basic_resolver_entry< InternetProtocol > * operator->() const; 93573 93574 93575 93576[endsect] 93577 93578 93579[section:operator_eq_ ip::basic_resolver_iterator::operator=] 93580 93581[indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.operator_eq_..operator=..ip::basic_resolver_iterator] 93582Assignment operator. 93583 93584 93585 basic_resolver_iterator & ``[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq_.overload1 operator=]``( 93586 const basic_resolver_iterator & other); 93587 `` [''''»''' [link boost_asio.reference.ip__basic_resolver_iterator.operator_eq_.overload1 more...]]`` 93588 93589 93590Move-assignment operator. 93591 93592 93593 basic_resolver_iterator & ``[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq_.overload2 operator=]``( 93594 basic_resolver_iterator && other); 93595 `` [''''»''' [link boost_asio.reference.ip__basic_resolver_iterator.operator_eq_.overload2 more...]]`` 93596 93597 93598[section:overload1 ip::basic_resolver_iterator::operator= (1 of 2 overloads)] 93599 93600 93601Assignment operator. 93602 93603 93604 basic_resolver_iterator & operator=( 93605 const basic_resolver_iterator & other); 93606 93607 93608 93609[endsect] 93610 93611 93612 93613[section:overload2 ip::basic_resolver_iterator::operator= (2 of 2 overloads)] 93614 93615 93616Move-assignment operator. 93617 93618 93619 basic_resolver_iterator & operator=( 93620 basic_resolver_iterator && other); 93621 93622 93623 93624[endsect] 93625 93626 93627[endsect] 93628 93629 93630[section:operator_eq__eq_ ip::basic_resolver_iterator::operator==] 93631 93632[indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.operator_eq__eq_..operator==..ip::basic_resolver_iterator] 93633Test two iterators for equality. 93634 93635 93636 friend bool operator==( 93637 const basic_resolver_iterator & a, 93638 const basic_resolver_iterator & b); 93639 93640 93641[heading Requirements] 93642 93643['Header: ][^boost/asio/ip/basic_resolver_iterator.hpp] 93644 93645['Convenience header: ][^boost/asio.hpp] 93646 93647 93648[endsect] 93649 93650 93651 93652[section:pointer ip::basic_resolver_iterator::pointer] 93653 93654[indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.pointer..pointer..ip::basic_resolver_iterator] 93655The type of the result of applying `operator->()` to the iterator. 93656 93657 93658 typedef const basic_resolver_entry< InternetProtocol > * pointer; 93659 93660 93661 93662[heading Requirements] 93663 93664['Header: ][^boost/asio/ip/basic_resolver_iterator.hpp] 93665 93666['Convenience header: ][^boost/asio.hpp] 93667 93668 93669[endsect] 93670 93671 93672 93673[section:reference ip::basic_resolver_iterator::reference] 93674 93675[indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.reference..reference..ip::basic_resolver_iterator] 93676The type of the result of applying `operator*()` to the iterator. 93677 93678 93679 typedef const basic_resolver_entry< InternetProtocol > & reference; 93680 93681 93682[heading Types] 93683[table 93684 [[Name][Description]] 93685 93686 [ 93687 93688 [[link boost_asio.reference.ip__basic_resolver_entry.endpoint_type [*endpoint_type]]] 93689 [The endpoint type associated with the endpoint entry. ] 93690 93691 ] 93692 93693 [ 93694 93695 [[link boost_asio.reference.ip__basic_resolver_entry.protocol_type [*protocol_type]]] 93696 [The protocol type associated with the endpoint entry. ] 93697 93698 ] 93699 93700] 93701 93702[heading Member Functions] 93703[table 93704 [[Name][Description]] 93705 93706 [ 93707 [[link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry [*basic_resolver_entry]] [constructor]] 93708 [Default constructor. 93709 [hr] 93710 Construct with specified endpoint, host name and service name. ] 93711 ] 93712 93713 [ 93714 [[link boost_asio.reference.ip__basic_resolver_entry.endpoint [*endpoint]]] 93715 [Get the endpoint associated with the entry. ] 93716 ] 93717 93718 [ 93719 [[link boost_asio.reference.ip__basic_resolver_entry.host_name [*host_name]]] 93720 [Get the host name associated with the entry. ] 93721 ] 93722 93723 [ 93724 [[link boost_asio.reference.ip__basic_resolver_entry.operator_endpoint_type [*operator endpoint_type]]] 93725 [Convert to the endpoint associated with the entry. ] 93726 ] 93727 93728 [ 93729 [[link boost_asio.reference.ip__basic_resolver_entry.service_name [*service_name]]] 93730 [Get the service name associated with the entry. ] 93731 ] 93732 93733] 93734 93735The [link boost_asio.reference.ip__basic_resolver_entry `ip::basic_resolver_entry`] class template describes an entry as returned by a resolver. 93736 93737 93738[heading Thread Safety] 93739 93740['Distinct] ['objects:] Safe. 93741 93742['Shared] ['objects:] Unsafe. 93743 93744 93745 93746 93747[heading Requirements] 93748 93749['Header: ][^boost/asio/ip/basic_resolver_iterator.hpp] 93750 93751['Convenience header: ][^boost/asio.hpp] 93752 93753 93754[endsect] 93755 93756 93757 93758[section:value_type ip::basic_resolver_iterator::value_type] 93759 93760[indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.value_type..value_type..ip::basic_resolver_iterator] 93761The type of the value pointed to by the iterator. 93762 93763 93764 typedef basic_resolver_entry< InternetProtocol > value_type; 93765 93766 93767[heading Types] 93768[table 93769 [[Name][Description]] 93770 93771 [ 93772 93773 [[link boost_asio.reference.ip__basic_resolver_entry.endpoint_type [*endpoint_type]]] 93774 [The endpoint type associated with the endpoint entry. ] 93775 93776 ] 93777 93778 [ 93779 93780 [[link boost_asio.reference.ip__basic_resolver_entry.protocol_type [*protocol_type]]] 93781 [The protocol type associated with the endpoint entry. ] 93782 93783 ] 93784 93785] 93786 93787[heading Member Functions] 93788[table 93789 [[Name][Description]] 93790 93791 [ 93792 [[link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry [*basic_resolver_entry]] [constructor]] 93793 [Default constructor. 93794 [hr] 93795 Construct with specified endpoint, host name and service name. ] 93796 ] 93797 93798 [ 93799 [[link boost_asio.reference.ip__basic_resolver_entry.endpoint [*endpoint]]] 93800 [Get the endpoint associated with the entry. ] 93801 ] 93802 93803 [ 93804 [[link boost_asio.reference.ip__basic_resolver_entry.host_name [*host_name]]] 93805 [Get the host name associated with the entry. ] 93806 ] 93807 93808 [ 93809 [[link boost_asio.reference.ip__basic_resolver_entry.operator_endpoint_type [*operator endpoint_type]]] 93810 [Convert to the endpoint associated with the entry. ] 93811 ] 93812 93813 [ 93814 [[link boost_asio.reference.ip__basic_resolver_entry.service_name [*service_name]]] 93815 [Get the service name associated with the entry. ] 93816 ] 93817 93818] 93819 93820The [link boost_asio.reference.ip__basic_resolver_entry `ip::basic_resolver_entry`] class template describes an entry as returned by a resolver. 93821 93822 93823[heading Thread Safety] 93824 93825['Distinct] ['objects:] Safe. 93826 93827['Shared] ['objects:] Unsafe. 93828 93829 93830 93831 93832[heading Requirements] 93833 93834['Header: ][^boost/asio/ip/basic_resolver_iterator.hpp] 93835 93836['Convenience header: ][^boost/asio.hpp] 93837 93838 93839[endsect] 93840 93841 93842 93843[section:values_ ip::basic_resolver_iterator::values_] 93844 93845[indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.values_..values_..ip::basic_resolver_iterator] 93846 93847 values_ptr_type values_; 93848 93849 93850 93851[endsect] 93852 93853 93854 93855[endsect] 93856 93857[section:ip__basic_resolver_query ip::basic_resolver_query] 93858 93859[indexterm1 boost_asio.indexterm.ip__basic_resolver_query..ip::basic_resolver_query] 93860 93861 93862An query to be passed to a resolver. 93863 93864 93865 template< 93866 typename ``[link boost_asio.reference.InternetProtocol InternetProtocol]``> 93867 class basic_resolver_query : 93868 public ip::resolver_query_base 93869 93870 93871[heading Types] 93872[table 93873 [[Name][Description]] 93874 93875 [ 93876 93877 [[link boost_asio.reference.ip__basic_resolver_query.flags [*flags]]] 93878 [A bitmask type (C++ Std \[lib.bitmask.types\]). ] 93879 93880 ] 93881 93882 [ 93883 93884 [[link boost_asio.reference.ip__basic_resolver_query.protocol_type [*protocol_type]]] 93885 [The protocol type associated with the endpoint query. ] 93886 93887 ] 93888 93889] 93890 93891[heading Member Functions] 93892[table 93893 [[Name][Description]] 93894 93895 [ 93896 [[link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query [*basic_resolver_query]] [constructor]] 93897 [Construct with specified service name for any protocol. 93898 [hr] 93899 Construct with specified service name for a given protocol. 93900 [hr] 93901 Construct with specified host name and service name for any protocol. 93902 [hr] 93903 Construct with specified host name and service name for a given protocol. ] 93904 ] 93905 93906 [ 93907 [[link boost_asio.reference.ip__basic_resolver_query.hints [*hints]]] 93908 [Get the hints associated with the query. ] 93909 ] 93910 93911 [ 93912 [[link boost_asio.reference.ip__basic_resolver_query.host_name [*host_name]]] 93913 [Get the host name associated with the query. ] 93914 ] 93915 93916 [ 93917 [[link boost_asio.reference.ip__basic_resolver_query.service_name [*service_name]]] 93918 [Get the service name associated with the query. ] 93919 ] 93920 93921] 93922 93923[heading Data Members] 93924[table 93925 [[Name][Description]] 93926 93927 [ 93928 [[link boost_asio.reference.ip__basic_resolver_query.address_configured [*address_configured]] [static]] 93929 [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. ] 93930 ] 93931 93932 [ 93933 [[link boost_asio.reference.ip__basic_resolver_query.all_matching [*all_matching]] [static]] 93934 [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ] 93935 ] 93936 93937 [ 93938 [[link boost_asio.reference.ip__basic_resolver_query.canonical_name [*canonical_name]] [static]] 93939 [Determine the canonical name of the host specified in the query. ] 93940 ] 93941 93942 [ 93943 [[link boost_asio.reference.ip__basic_resolver_query.numeric_host [*numeric_host]] [static]] 93944 [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ] 93945 ] 93946 93947 [ 93948 [[link boost_asio.reference.ip__basic_resolver_query.numeric_service [*numeric_service]] [static]] 93949 [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ] 93950 ] 93951 93952 [ 93953 [[link boost_asio.reference.ip__basic_resolver_query.passive [*passive]] [static]] 93954 [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ] 93955 ] 93956 93957 [ 93958 [[link boost_asio.reference.ip__basic_resolver_query.v4_mapped [*v4_mapped]] [static]] 93959 [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ] 93960 ] 93961 93962] 93963 93964The [link boost_asio.reference.ip__basic_resolver_query `ip::basic_resolver_query`] class template describes a query that can be passed to a resolver. 93965 93966 93967[heading Thread Safety] 93968 93969['Distinct] ['objects:] Safe. 93970 93971['Shared] ['objects:] Unsafe. 93972 93973 93974 93975[heading Requirements] 93976 93977['Header: ][^boost/asio/ip/basic_resolver_query.hpp] 93978 93979['Convenience header: ][^boost/asio.hpp] 93980 93981 93982[section:address_configured ip::basic_resolver_query::address_configured] 93983 93984 93985['Inherited from ip::resolver_base.] 93986 93987[indexterm2 boost_asio.indexterm.ip__basic_resolver_query.address_configured..address_configured..ip::basic_resolver_query] 93988Only 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. 93989 93990 93991 static const flags address_configured = implementation_defined; 93992 93993 93994 93995[endsect] 93996 93997 93998 93999[section:all_matching ip::basic_resolver_query::all_matching] 94000 94001 94002['Inherited from ip::resolver_base.] 94003 94004[indexterm2 boost_asio.indexterm.ip__basic_resolver_query.all_matching..all_matching..ip::basic_resolver_query] 94005If used with v4\_mapped, return all matching IPv6 and IPv4 addresses. 94006 94007 94008 static const flags all_matching = implementation_defined; 94009 94010 94011 94012[endsect] 94013 94014 94015[section:basic_resolver_query ip::basic_resolver_query::basic_resolver_query] 94016 94017[indexterm2 boost_asio.indexterm.ip__basic_resolver_query.basic_resolver_query..basic_resolver_query..ip::basic_resolver_query] 94018Construct with specified service name for any protocol. 94019 94020 94021 ``[link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload1 basic_resolver_query]``( 94022 const std::string & service, 94023 resolver_query_base::flags resolve_flags = passive|address_configured); 94024 `` [''''»''' [link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload1 more...]]`` 94025 94026 94027Construct with specified service name for a given protocol. 94028 94029 94030 ``[link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload2 basic_resolver_query]``( 94031 const protocol_type & protocol, 94032 const std::string & service, 94033 resolver_query_base::flags resolve_flags = passive|address_configured); 94034 `` [''''»''' [link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload2 more...]]`` 94035 94036 94037Construct with specified host name and service name for any protocol. 94038 94039 94040 ``[link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload3 basic_resolver_query]``( 94041 const std::string & host, 94042 const std::string & service, 94043 resolver_query_base::flags resolve_flags = address_configured); 94044 `` [''''»''' [link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload3 more...]]`` 94045 94046 94047Construct with specified host name and service name for a given protocol. 94048 94049 94050 ``[link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload4 basic_resolver_query]``( 94051 const protocol_type & protocol, 94052 const std::string & host, 94053 const std::string & service, 94054 resolver_query_base::flags resolve_flags = address_configured); 94055 `` [''''»''' [link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload4 more...]]`` 94056 94057 94058[section:overload1 ip::basic_resolver_query::basic_resolver_query (1 of 4 overloads)] 94059 94060 94061Construct with specified service name for any protocol. 94062 94063 94064 basic_resolver_query( 94065 const std::string & service, 94066 resolver_query_base::flags resolve_flags = passive|address_configured); 94067 94068 94069This constructor is typically used to perform name resolution for local service binding. 94070 94071 94072[heading Parameters] 94073 94074 94075[variablelist 94076 94077[[service][A string identifying the requested service. This may be a descriptive name or a numeric string corresponding to a port number.]] 94078 94079[[resolve_flags][A set of flags that determine how name resolution should be performed. The default flags are suitable for local service binding.]] 94080 94081] 94082 94083 94084[heading Remarks] 94085 94086On 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. 94087 94088 94089 94090 94091[endsect] 94092 94093 94094 94095[section:overload2 ip::basic_resolver_query::basic_resolver_query (2 of 4 overloads)] 94096 94097 94098Construct with specified service name for a given protocol. 94099 94100 94101 basic_resolver_query( 94102 const protocol_type & protocol, 94103 const std::string & service, 94104 resolver_query_base::flags resolve_flags = passive|address_configured); 94105 94106 94107This constructor is typically used to perform name resolution for local service binding with a specific protocol version. 94108 94109 94110[heading Parameters] 94111 94112 94113[variablelist 94114 94115[[protocol][A protocol object, normally representing either the IPv4 or IPv6 version of an internet protocol.]] 94116 94117[[service][A string identifying the requested service. This may be a descriptive name or a numeric string corresponding to a port number.]] 94118 94119[[resolve_flags][A set of flags that determine how name resolution should be performed. The default flags are suitable for local service binding.]] 94120 94121] 94122 94123 94124[heading Remarks] 94125 94126On 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. 94127 94128 94129 94130 94131[endsect] 94132 94133 94134 94135[section:overload3 ip::basic_resolver_query::basic_resolver_query (3 of 4 overloads)] 94136 94137 94138Construct with specified host name and service name for any protocol. 94139 94140 94141 basic_resolver_query( 94142 const std::string & host, 94143 const std::string & service, 94144 resolver_query_base::flags resolve_flags = address_configured); 94145 94146 94147This constructor is typically used to perform name resolution for communication with remote hosts. 94148 94149 94150[heading Parameters] 94151 94152 94153[variablelist 94154 94155[[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.]] 94156 94157[[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.]] 94158 94159[[resolve_flags][A set of flags that determine how name resolution should be performed. The default flags are suitable for communication with remote hosts.]] 94160 94161] 94162 94163 94164[heading Remarks] 94165 94166On 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). 94167 94168On 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. 94169 94170 94171[endsect] 94172 94173 94174 94175[section:overload4 ip::basic_resolver_query::basic_resolver_query (4 of 4 overloads)] 94176 94177 94178Construct with specified host name and service name for a given protocol. 94179 94180 94181 basic_resolver_query( 94182 const protocol_type & protocol, 94183 const std::string & host, 94184 const std::string & service, 94185 resolver_query_base::flags resolve_flags = address_configured); 94186 94187 94188This constructor is typically used to perform name resolution for communication with remote hosts. 94189 94190 94191[heading Parameters] 94192 94193 94194[variablelist 94195 94196[[protocol][A protocol object, normally representing either the IPv4 or IPv6 version of an internet protocol.]] 94197 94198[[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.]] 94199 94200[[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.]] 94201 94202[[resolve_flags][A set of flags that determine how name resolution should be performed. The default flags are suitable for communication with remote hosts.]] 94203 94204] 94205 94206 94207[heading Remarks] 94208 94209On 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). 94210 94211On 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. 94212 94213 94214[endsect] 94215 94216 94217[endsect] 94218 94219 94220[section:canonical_name ip::basic_resolver_query::canonical_name] 94221 94222 94223['Inherited from ip::resolver_base.] 94224 94225[indexterm2 boost_asio.indexterm.ip__basic_resolver_query.canonical_name..canonical_name..ip::basic_resolver_query] 94226Determine the canonical name of the host specified in the query. 94227 94228 94229 static const flags canonical_name = implementation_defined; 94230 94231 94232 94233[endsect] 94234 94235 94236 94237[section:flags ip::basic_resolver_query::flags] 94238 94239 94240['Inherited from ip::resolver_base.] 94241 94242[indexterm2 boost_asio.indexterm.ip__basic_resolver_query.flags..flags..ip::basic_resolver_query] 94243A bitmask type (C++ Std [lib.bitmask.types]). 94244 94245 94246 typedef unspecified flags; 94247 94248 94249 94250[heading Requirements] 94251 94252['Header: ][^boost/asio/ip/basic_resolver_query.hpp] 94253 94254['Convenience header: ][^boost/asio.hpp] 94255 94256 94257[endsect] 94258 94259 94260 94261[section:hints ip::basic_resolver_query::hints] 94262 94263[indexterm2 boost_asio.indexterm.ip__basic_resolver_query.hints..hints..ip::basic_resolver_query] 94264Get the hints associated with the query. 94265 94266 94267 const boost::asio::detail::addrinfo_type & hints() const; 94268 94269 94270 94271[endsect] 94272 94273 94274 94275[section:host_name ip::basic_resolver_query::host_name] 94276 94277[indexterm2 boost_asio.indexterm.ip__basic_resolver_query.host_name..host_name..ip::basic_resolver_query] 94278Get the host name associated with the query. 94279 94280 94281 std::string host_name() const; 94282 94283 94284 94285[endsect] 94286 94287 94288 94289[section:numeric_host ip::basic_resolver_query::numeric_host] 94290 94291 94292['Inherited from ip::resolver_base.] 94293 94294[indexterm2 boost_asio.indexterm.ip__basic_resolver_query.numeric_host..numeric_host..ip::basic_resolver_query] 94295Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. 94296 94297 94298 static const flags numeric_host = implementation_defined; 94299 94300 94301 94302[endsect] 94303 94304 94305 94306[section:numeric_service ip::basic_resolver_query::numeric_service] 94307 94308 94309['Inherited from ip::resolver_base.] 94310 94311[indexterm2 boost_asio.indexterm.ip__basic_resolver_query.numeric_service..numeric_service..ip::basic_resolver_query] 94312Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. 94313 94314 94315 static const flags numeric_service = implementation_defined; 94316 94317 94318 94319[endsect] 94320 94321 94322 94323[section:passive ip::basic_resolver_query::passive] 94324 94325 94326['Inherited from ip::resolver_base.] 94327 94328[indexterm2 boost_asio.indexterm.ip__basic_resolver_query.passive..passive..ip::basic_resolver_query] 94329Indicate that returned endpoint is intended for use as a locally bound socket endpoint. 94330 94331 94332 static const flags passive = implementation_defined; 94333 94334 94335 94336[endsect] 94337 94338 94339 94340[section:protocol_type ip::basic_resolver_query::protocol_type] 94341 94342[indexterm2 boost_asio.indexterm.ip__basic_resolver_query.protocol_type..protocol_type..ip::basic_resolver_query] 94343The protocol type associated with the endpoint query. 94344 94345 94346 typedef InternetProtocol protocol_type; 94347 94348 94349 94350[heading Requirements] 94351 94352['Header: ][^boost/asio/ip/basic_resolver_query.hpp] 94353 94354['Convenience header: ][^boost/asio.hpp] 94355 94356 94357[endsect] 94358 94359 94360 94361[section:service_name ip::basic_resolver_query::service_name] 94362 94363[indexterm2 boost_asio.indexterm.ip__basic_resolver_query.service_name..service_name..ip::basic_resolver_query] 94364Get the service name associated with the query. 94365 94366 94367 std::string service_name() const; 94368 94369 94370 94371[endsect] 94372 94373 94374 94375[section:v4_mapped ip::basic_resolver_query::v4_mapped] 94376 94377 94378['Inherited from ip::resolver_base.] 94379 94380[indexterm2 boost_asio.indexterm.ip__basic_resolver_query.v4_mapped..v4_mapped..ip::basic_resolver_query] 94381If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. 94382 94383 94384 static const flags v4_mapped = implementation_defined; 94385 94386 94387 94388[endsect] 94389 94390 94391 94392[endsect] 94393 94394[section:ip__basic_resolver_results ip::basic_resolver_results] 94395 94396[indexterm1 boost_asio.indexterm.ip__basic_resolver_results..ip::basic_resolver_results] 94397 94398 94399A range of entries produced by a resolver. 94400 94401 94402 template< 94403 typename ``[link boost_asio.reference.InternetProtocol InternetProtocol]``> 94404 class basic_resolver_results : 94405 public ip::basic_resolver_iterator< InternetProtocol > 94406 94407 94408[heading Types] 94409[table 94410 [[Name][Description]] 94411 94412 [ 94413 94414 [[link boost_asio.reference.ip__basic_resolver_results.const_iterator [*const_iterator]]] 94415 [The type of an iterator into the range. ] 94416 94417 ] 94418 94419 [ 94420 94421 [[link boost_asio.reference.ip__basic_resolver_results.const_reference [*const_reference]]] 94422 [The type of a const reference to a value in the range. ] 94423 94424 ] 94425 94426 [ 94427 94428 [[link boost_asio.reference.ip__basic_resolver_results.difference_type [*difference_type]]] 94429 [Type used to represent the distance between two iterators in the range. ] 94430 94431 ] 94432 94433 [ 94434 94435 [[link boost_asio.reference.ip__basic_resolver_results.endpoint_type [*endpoint_type]]] 94436 [The endpoint type associated with the results. ] 94437 94438 ] 94439 94440 [ 94441 94442 [[link boost_asio.reference.ip__basic_resolver_results.iterator [*iterator]]] 94443 [The type of an iterator into the range. ] 94444 94445 ] 94446 94447 [ 94448 94449 [[link boost_asio.reference.ip__basic_resolver_results.iterator_category [*iterator_category]]] 94450 [The iterator category. ] 94451 94452 ] 94453 94454 [ 94455 94456 [[link boost_asio.reference.ip__basic_resolver_results.pointer [*pointer]]] 94457 [The type of the result of applying operator->() to the iterator. ] 94458 94459 ] 94460 94461 [ 94462 94463 [[link boost_asio.reference.ip__basic_resolver_results.protocol_type [*protocol_type]]] 94464 [The protocol type associated with the results. ] 94465 94466 ] 94467 94468 [ 94469 94470 [[link boost_asio.reference.ip__basic_resolver_results.reference [*reference]]] 94471 [The type of a non-const reference to a value in the range. ] 94472 94473 ] 94474 94475 [ 94476 94477 [[link boost_asio.reference.ip__basic_resolver_results.size_type [*size_type]]] 94478 [Type used to represent a count of the elements in the range. ] 94479 94480 ] 94481 94482 [ 94483 94484 [[link boost_asio.reference.ip__basic_resolver_results.value_type [*value_type]]] 94485 [The type of a value in the results range. ] 94486 94487 ] 94488 94489] 94490 94491[heading Member Functions] 94492[table 94493 [[Name][Description]] 94494 94495 [ 94496 [[link boost_asio.reference.ip__basic_resolver_results.basic_resolver_results [*basic_resolver_results]] [constructor]] 94497 [Default constructor creates an empty range. 94498 [hr] 94499 Copy constructor. 94500 [hr] 94501 Move constructor. ] 94502 ] 94503 94504 [ 94505 [[link boost_asio.reference.ip__basic_resolver_results.begin [*begin]]] 94506 [Obtain a begin iterator for the results range. ] 94507 ] 94508 94509 [ 94510 [[link boost_asio.reference.ip__basic_resolver_results.cbegin [*cbegin]]] 94511 [Obtain a begin iterator for the results range. ] 94512 ] 94513 94514 [ 94515 [[link boost_asio.reference.ip__basic_resolver_results.cend [*cend]]] 94516 [Obtain an end iterator for the results range. ] 94517 ] 94518 94519 [ 94520 [[link boost_asio.reference.ip__basic_resolver_results.empty [*empty]]] 94521 [Determine whether the results range is empty. ] 94522 ] 94523 94524 [ 94525 [[link boost_asio.reference.ip__basic_resolver_results.end [*end]]] 94526 [Obtain an end iterator for the results range. ] 94527 ] 94528 94529 [ 94530 [[link boost_asio.reference.ip__basic_resolver_results.max_size [*max_size]]] 94531 [Get the maximum number of entries permitted in a results range. ] 94532 ] 94533 94534 [ 94535 [[link boost_asio.reference.ip__basic_resolver_results.operator__star_ [*operator *]]] 94536 [Dereference an iterator. ] 94537 ] 94538 94539 [ 94540 [[link boost_asio.reference.ip__basic_resolver_results.operator_plus__plus_ [*operator++]]] 94541 [Increment operator (prefix). 94542 [hr] 94543 Increment operator (postfix). ] 94544 ] 94545 94546 [ 94547 [[link boost_asio.reference.ip__basic_resolver_results.operator_arrow_ [*operator->]]] 94548 [Dereference an iterator. ] 94549 ] 94550 94551 [ 94552 [[link boost_asio.reference.ip__basic_resolver_results.operator_eq_ [*operator=]]] 94553 [Assignment operator. 94554 [hr] 94555 Move-assignment operator. ] 94556 ] 94557 94558 [ 94559 [[link boost_asio.reference.ip__basic_resolver_results.size [*size]]] 94560 [Get the number of entries in the results range. ] 94561 ] 94562 94563 [ 94564 [[link boost_asio.reference.ip__basic_resolver_results.swap [*swap]]] 94565 [Swap the results range with another. ] 94566 ] 94567 94568] 94569 94570[heading Protected Member Functions] 94571[table 94572 [[Name][Description]] 94573 94574 [ 94575 [[link boost_asio.reference.ip__basic_resolver_results.dereference [*dereference]]] 94576 [] 94577 ] 94578 94579 [ 94580 [[link boost_asio.reference.ip__basic_resolver_results.equal [*equal]]] 94581 [] 94582 ] 94583 94584 [ 94585 [[link boost_asio.reference.ip__basic_resolver_results.increment [*increment]]] 94586 [] 94587 ] 94588 94589] 94590 94591[heading Protected Data Members] 94592[table 94593 [[Name][Description]] 94594 94595 [ 94596 [[link boost_asio.reference.ip__basic_resolver_results.index_ [*index_]]] 94597 [] 94598 ] 94599 94600 [ 94601 [[link boost_asio.reference.ip__basic_resolver_results.values_ [*values_]]] 94602 [] 94603 ] 94604 94605] 94606 94607[heading Friends] 94608[table 94609 [[Name][Description]] 94610 94611 [ 94612 [[link boost_asio.reference.ip__basic_resolver_results.operator_not__eq_ [*operator!=]]] 94613 [Test two iterators for inequality. ] 94614 ] 94615 94616 [ 94617 [[link boost_asio.reference.ip__basic_resolver_results.operator_eq__eq_ [*operator==]]] 94618 [Test two iterators for equality. ] 94619 ] 94620 94621] 94622 94623The [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. 94624 94625The iterator's value\_type, obtained when a results iterator is dereferenced, is: 94626 94627 const basic_resolver_entry<InternetProtocol> 94628 94629 94630 94631 94632 94633[heading Remarks] 94634 94635For 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. 94636 94637 94638[heading Thread Safety] 94639 94640['Distinct] ['objects:] Safe. 94641 94642['Shared] ['objects:] Unsafe. 94643 94644 94645 94646[heading Requirements] 94647 94648['Header: ][^boost/asio/ip/basic_resolver_results.hpp] 94649 94650['Convenience header: ][^boost/asio.hpp] 94651 94652[section:basic_resolver_results ip::basic_resolver_results::basic_resolver_results] 94653 94654[indexterm2 boost_asio.indexterm.ip__basic_resolver_results.basic_resolver_results..basic_resolver_results..ip::basic_resolver_results] 94655Default constructor creates an empty range. 94656 94657 94658 ``[link boost_asio.reference.ip__basic_resolver_results.basic_resolver_results.overload1 basic_resolver_results]``(); 94659 `` [''''»''' [link boost_asio.reference.ip__basic_resolver_results.basic_resolver_results.overload1 more...]]`` 94660 94661 94662Copy constructor. 94663 94664 94665 ``[link boost_asio.reference.ip__basic_resolver_results.basic_resolver_results.overload2 basic_resolver_results]``( 94666 const basic_resolver_results & other); 94667 `` [''''»''' [link boost_asio.reference.ip__basic_resolver_results.basic_resolver_results.overload2 more...]]`` 94668 94669 94670Move constructor. 94671 94672 94673 ``[link boost_asio.reference.ip__basic_resolver_results.basic_resolver_results.overload3 basic_resolver_results]``( 94674 basic_resolver_results && other); 94675 `` [''''»''' [link boost_asio.reference.ip__basic_resolver_results.basic_resolver_results.overload3 more...]]`` 94676 94677 94678[section:overload1 ip::basic_resolver_results::basic_resolver_results (1 of 3 overloads)] 94679 94680 94681Default constructor creates an empty range. 94682 94683 94684 basic_resolver_results(); 94685 94686 94687 94688[endsect] 94689 94690 94691 94692[section:overload2 ip::basic_resolver_results::basic_resolver_results (2 of 3 overloads)] 94693 94694 94695Copy constructor. 94696 94697 94698 basic_resolver_results( 94699 const basic_resolver_results & other); 94700 94701 94702 94703[endsect] 94704 94705 94706 94707[section:overload3 ip::basic_resolver_results::basic_resolver_results (3 of 3 overloads)] 94708 94709 94710Move constructor. 94711 94712 94713 basic_resolver_results( 94714 basic_resolver_results && other); 94715 94716 94717 94718[endsect] 94719 94720 94721[endsect] 94722 94723 94724[section:begin ip::basic_resolver_results::begin] 94725 94726[indexterm2 boost_asio.indexterm.ip__basic_resolver_results.begin..begin..ip::basic_resolver_results] 94727Obtain a begin iterator for the results range. 94728 94729 94730 const_iterator begin() const; 94731 94732 94733 94734[endsect] 94735 94736 94737 94738[section:cbegin ip::basic_resolver_results::cbegin] 94739 94740[indexterm2 boost_asio.indexterm.ip__basic_resolver_results.cbegin..cbegin..ip::basic_resolver_results] 94741Obtain a begin iterator for the results range. 94742 94743 94744 const_iterator cbegin() const; 94745 94746 94747 94748[endsect] 94749 94750 94751 94752[section:cend ip::basic_resolver_results::cend] 94753 94754[indexterm2 boost_asio.indexterm.ip__basic_resolver_results.cend..cend..ip::basic_resolver_results] 94755Obtain an end iterator for the results range. 94756 94757 94758 const_iterator cend() const; 94759 94760 94761 94762[endsect] 94763 94764 94765 94766[section:const_iterator ip::basic_resolver_results::const_iterator] 94767 94768[indexterm2 boost_asio.indexterm.ip__basic_resolver_results.const_iterator..const_iterator..ip::basic_resolver_results] 94769The type of an iterator into the range. 94770 94771 94772 typedef basic_resolver_iterator< protocol_type > const_iterator; 94773 94774 94775[heading Types] 94776[table 94777 [[Name][Description]] 94778 94779 [ 94780 94781 [[link boost_asio.reference.ip__basic_resolver_iterator.difference_type [*difference_type]]] 94782 [The type used for the distance between two iterators. ] 94783 94784 ] 94785 94786 [ 94787 94788 [[link boost_asio.reference.ip__basic_resolver_iterator.iterator_category [*iterator_category]]] 94789 [The iterator category. ] 94790 94791 ] 94792 94793 [ 94794 94795 [[link boost_asio.reference.ip__basic_resolver_iterator.pointer [*pointer]]] 94796 [The type of the result of applying operator->() to the iterator. ] 94797 94798 ] 94799 94800 [ 94801 94802 [[link boost_asio.reference.ip__basic_resolver_iterator.reference [*reference]]] 94803 [The type of the result of applying operator*() to the iterator. ] 94804 94805 ] 94806 94807 [ 94808 94809 [[link boost_asio.reference.ip__basic_resolver_iterator.value_type [*value_type]]] 94810 [The type of the value pointed to by the iterator. ] 94811 94812 ] 94813 94814] 94815 94816[heading Member Functions] 94817[table 94818 [[Name][Description]] 94819 94820 [ 94821 [[link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator [*basic_resolver_iterator]] [constructor]] 94822 [Default constructor creates an end iterator. 94823 [hr] 94824 Copy constructor. 94825 [hr] 94826 Move constructor. ] 94827 ] 94828 94829 [ 94830 [[link boost_asio.reference.ip__basic_resolver_iterator.operator__star_ [*operator *]]] 94831 [Dereference an iterator. ] 94832 ] 94833 94834 [ 94835 [[link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_ [*operator++]]] 94836 [Increment operator (prefix). 94837 [hr] 94838 Increment operator (postfix). ] 94839 ] 94840 94841 [ 94842 [[link boost_asio.reference.ip__basic_resolver_iterator.operator_arrow_ [*operator->]]] 94843 [Dereference an iterator. ] 94844 ] 94845 94846 [ 94847 [[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq_ [*operator=]]] 94848 [Assignment operator. 94849 [hr] 94850 Move-assignment operator. ] 94851 ] 94852 94853] 94854 94855[heading Protected Member Functions] 94856[table 94857 [[Name][Description]] 94858 94859 [ 94860 [[link boost_asio.reference.ip__basic_resolver_iterator.dereference [*dereference]]] 94861 [] 94862 ] 94863 94864 [ 94865 [[link boost_asio.reference.ip__basic_resolver_iterator.equal [*equal]]] 94866 [] 94867 ] 94868 94869 [ 94870 [[link boost_asio.reference.ip__basic_resolver_iterator.increment [*increment]]] 94871 [] 94872 ] 94873 94874] 94875 94876[heading Protected Data Members] 94877[table 94878 [[Name][Description]] 94879 94880 [ 94881 [[link boost_asio.reference.ip__basic_resolver_iterator.index_ [*index_]]] 94882 [] 94883 ] 94884 94885 [ 94886 [[link boost_asio.reference.ip__basic_resolver_iterator.values_ [*values_]]] 94887 [] 94888 ] 94889 94890] 94891 94892[heading Friends] 94893[table 94894 [[Name][Description]] 94895 94896 [ 94897 [[link boost_asio.reference.ip__basic_resolver_iterator.operator_not__eq_ [*operator!=]]] 94898 [Test two iterators for inequality. ] 94899 ] 94900 94901 [ 94902 [[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq__eq_ [*operator==]]] 94903 [Test two iterators for equality. ] 94904 ] 94905 94906] 94907 94908The [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. 94909 94910The iterator's value\_type, obtained when the iterator is dereferenced, is: 94911 94912 const basic_resolver_entry<InternetProtocol> 94913 94914 94915 94916 94917 94918[heading Thread Safety] 94919 94920['Distinct] ['objects:] Safe. 94921 94922['Shared] ['objects:] Unsafe. 94923 94924 94925 94926 94927[heading Requirements] 94928 94929['Header: ][^boost/asio/ip/basic_resolver_results.hpp] 94930 94931['Convenience header: ][^boost/asio.hpp] 94932 94933 94934[endsect] 94935 94936 94937 94938[section:const_reference ip::basic_resolver_results::const_reference] 94939 94940[indexterm2 boost_asio.indexterm.ip__basic_resolver_results.const_reference..const_reference..ip::basic_resolver_results] 94941The type of a const reference to a value in the range. 94942 94943 94944 typedef const value_type & const_reference; 94945 94946 94947[heading Types] 94948[table 94949 [[Name][Description]] 94950 94951 [ 94952 94953 [[link boost_asio.reference.ip__basic_resolver_entry.endpoint_type [*endpoint_type]]] 94954 [The endpoint type associated with the endpoint entry. ] 94955 94956 ] 94957 94958 [ 94959 94960 [[link boost_asio.reference.ip__basic_resolver_entry.protocol_type [*protocol_type]]] 94961 [The protocol type associated with the endpoint entry. ] 94962 94963 ] 94964 94965] 94966 94967[heading Member Functions] 94968[table 94969 [[Name][Description]] 94970 94971 [ 94972 [[link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry [*basic_resolver_entry]] [constructor]] 94973 [Default constructor. 94974 [hr] 94975 Construct with specified endpoint, host name and service name. ] 94976 ] 94977 94978 [ 94979 [[link boost_asio.reference.ip__basic_resolver_entry.endpoint [*endpoint]]] 94980 [Get the endpoint associated with the entry. ] 94981 ] 94982 94983 [ 94984 [[link boost_asio.reference.ip__basic_resolver_entry.host_name [*host_name]]] 94985 [Get the host name associated with the entry. ] 94986 ] 94987 94988 [ 94989 [[link boost_asio.reference.ip__basic_resolver_entry.operator_endpoint_type [*operator endpoint_type]]] 94990 [Convert to the endpoint associated with the entry. ] 94991 ] 94992 94993 [ 94994 [[link boost_asio.reference.ip__basic_resolver_entry.service_name [*service_name]]] 94995 [Get the service name associated with the entry. ] 94996 ] 94997 94998] 94999 95000The [link boost_asio.reference.ip__basic_resolver_entry `ip::basic_resolver_entry`] class template describes an entry as returned by a resolver. 95001 95002 95003[heading Thread Safety] 95004 95005['Distinct] ['objects:] Safe. 95006 95007['Shared] ['objects:] Unsafe. 95008 95009 95010 95011 95012[heading Requirements] 95013 95014['Header: ][^boost/asio/ip/basic_resolver_results.hpp] 95015 95016['Convenience header: ][^boost/asio.hpp] 95017 95018 95019[endsect] 95020 95021 95022 95023[section:dereference ip::basic_resolver_results::dereference] 95024 95025 95026['Inherited from ip::basic_resolver.] 95027 95028[indexterm2 boost_asio.indexterm.ip__basic_resolver_results.dereference..dereference..ip::basic_resolver_results] 95029 95030 const basic_resolver_entry< InternetProtocol > & dereference() const; 95031 95032 95033 95034[endsect] 95035 95036 95037 95038[section:difference_type ip::basic_resolver_results::difference_type] 95039 95040[indexterm2 boost_asio.indexterm.ip__basic_resolver_results.difference_type..difference_type..ip::basic_resolver_results] 95041Type used to represent the distance between two iterators in the range. 95042 95043 95044 typedef std::ptrdiff_t difference_type; 95045 95046 95047 95048[heading Requirements] 95049 95050['Header: ][^boost/asio/ip/basic_resolver_results.hpp] 95051 95052['Convenience header: ][^boost/asio.hpp] 95053 95054 95055[endsect] 95056 95057 95058 95059[section:empty ip::basic_resolver_results::empty] 95060 95061[indexterm2 boost_asio.indexterm.ip__basic_resolver_results.empty..empty..ip::basic_resolver_results] 95062Determine whether the results range is empty. 95063 95064 95065 bool empty() const; 95066 95067 95068 95069[endsect] 95070 95071 95072 95073[section:end ip::basic_resolver_results::end] 95074 95075[indexterm2 boost_asio.indexterm.ip__basic_resolver_results.end..end..ip::basic_resolver_results] 95076Obtain an end iterator for the results range. 95077 95078 95079 const_iterator end() const; 95080 95081 95082 95083[endsect] 95084 95085 95086 95087[section:endpoint_type ip::basic_resolver_results::endpoint_type] 95088 95089[indexterm2 boost_asio.indexterm.ip__basic_resolver_results.endpoint_type..endpoint_type..ip::basic_resolver_results] 95090The endpoint type associated with the results. 95091 95092 95093 typedef protocol_type::endpoint endpoint_type; 95094 95095 95096 95097[heading Requirements] 95098 95099['Header: ][^boost/asio/ip/basic_resolver_results.hpp] 95100 95101['Convenience header: ][^boost/asio.hpp] 95102 95103 95104[endsect] 95105 95106 95107 95108[section:equal ip::basic_resolver_results::equal] 95109 95110 95111['Inherited from ip::basic_resolver.] 95112 95113[indexterm2 boost_asio.indexterm.ip__basic_resolver_results.equal..equal..ip::basic_resolver_results] 95114 95115 bool equal( 95116 const basic_resolver_iterator & other) const; 95117 95118 95119 95120[endsect] 95121 95122 95123 95124[section:increment ip::basic_resolver_results::increment] 95125 95126 95127['Inherited from ip::basic_resolver.] 95128 95129[indexterm2 boost_asio.indexterm.ip__basic_resolver_results.increment..increment..ip::basic_resolver_results] 95130 95131 void increment(); 95132 95133 95134 95135[endsect] 95136 95137 95138 95139[section:index_ ip::basic_resolver_results::index_] 95140 95141 95142['Inherited from ip::basic_resolver.] 95143 95144[indexterm2 boost_asio.indexterm.ip__basic_resolver_results.index_..index_..ip::basic_resolver_results] 95145 95146 std::size_t index_; 95147 95148 95149 95150[endsect] 95151 95152 95153 95154[section:iterator ip::basic_resolver_results::iterator] 95155 95156[indexterm2 boost_asio.indexterm.ip__basic_resolver_results.iterator..iterator..ip::basic_resolver_results] 95157The type of an iterator into the range. 95158 95159 95160 typedef const_iterator iterator; 95161 95162 95163[heading Types] 95164[table 95165 [[Name][Description]] 95166 95167 [ 95168 95169 [[link boost_asio.reference.ip__basic_resolver_iterator.difference_type [*difference_type]]] 95170 [The type used for the distance between two iterators. ] 95171 95172 ] 95173 95174 [ 95175 95176 [[link boost_asio.reference.ip__basic_resolver_iterator.iterator_category [*iterator_category]]] 95177 [The iterator category. ] 95178 95179 ] 95180 95181 [ 95182 95183 [[link boost_asio.reference.ip__basic_resolver_iterator.pointer [*pointer]]] 95184 [The type of the result of applying operator->() to the iterator. ] 95185 95186 ] 95187 95188 [ 95189 95190 [[link boost_asio.reference.ip__basic_resolver_iterator.reference [*reference]]] 95191 [The type of the result of applying operator*() to the iterator. ] 95192 95193 ] 95194 95195 [ 95196 95197 [[link boost_asio.reference.ip__basic_resolver_iterator.value_type [*value_type]]] 95198 [The type of the value pointed to by the iterator. ] 95199 95200 ] 95201 95202] 95203 95204[heading Member Functions] 95205[table 95206 [[Name][Description]] 95207 95208 [ 95209 [[link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator [*basic_resolver_iterator]] [constructor]] 95210 [Default constructor creates an end iterator. 95211 [hr] 95212 Copy constructor. 95213 [hr] 95214 Move constructor. ] 95215 ] 95216 95217 [ 95218 [[link boost_asio.reference.ip__basic_resolver_iterator.operator__star_ [*operator *]]] 95219 [Dereference an iterator. ] 95220 ] 95221 95222 [ 95223 [[link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_ [*operator++]]] 95224 [Increment operator (prefix). 95225 [hr] 95226 Increment operator (postfix). ] 95227 ] 95228 95229 [ 95230 [[link boost_asio.reference.ip__basic_resolver_iterator.operator_arrow_ [*operator->]]] 95231 [Dereference an iterator. ] 95232 ] 95233 95234 [ 95235 [[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq_ [*operator=]]] 95236 [Assignment operator. 95237 [hr] 95238 Move-assignment operator. ] 95239 ] 95240 95241] 95242 95243[heading Protected Member Functions] 95244[table 95245 [[Name][Description]] 95246 95247 [ 95248 [[link boost_asio.reference.ip__basic_resolver_iterator.dereference [*dereference]]] 95249 [] 95250 ] 95251 95252 [ 95253 [[link boost_asio.reference.ip__basic_resolver_iterator.equal [*equal]]] 95254 [] 95255 ] 95256 95257 [ 95258 [[link boost_asio.reference.ip__basic_resolver_iterator.increment [*increment]]] 95259 [] 95260 ] 95261 95262] 95263 95264[heading Protected Data Members] 95265[table 95266 [[Name][Description]] 95267 95268 [ 95269 [[link boost_asio.reference.ip__basic_resolver_iterator.index_ [*index_]]] 95270 [] 95271 ] 95272 95273 [ 95274 [[link boost_asio.reference.ip__basic_resolver_iterator.values_ [*values_]]] 95275 [] 95276 ] 95277 95278] 95279 95280[heading Friends] 95281[table 95282 [[Name][Description]] 95283 95284 [ 95285 [[link boost_asio.reference.ip__basic_resolver_iterator.operator_not__eq_ [*operator!=]]] 95286 [Test two iterators for inequality. ] 95287 ] 95288 95289 [ 95290 [[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq__eq_ [*operator==]]] 95291 [Test two iterators for equality. ] 95292 ] 95293 95294] 95295 95296The [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. 95297 95298The iterator's value\_type, obtained when the iterator is dereferenced, is: 95299 95300 const basic_resolver_entry<InternetProtocol> 95301 95302 95303 95304 95305 95306[heading Thread Safety] 95307 95308['Distinct] ['objects:] Safe. 95309 95310['Shared] ['objects:] Unsafe. 95311 95312 95313 95314 95315[heading Requirements] 95316 95317['Header: ][^boost/asio/ip/basic_resolver_results.hpp] 95318 95319['Convenience header: ][^boost/asio.hpp] 95320 95321 95322[endsect] 95323 95324 95325 95326[section:iterator_category ip::basic_resolver_results::iterator_category] 95327 95328 95329['Inherited from ip::basic_resolver.] 95330 95331[indexterm2 boost_asio.indexterm.ip__basic_resolver_results.iterator_category..iterator_category..ip::basic_resolver_results] 95332The iterator category. 95333 95334 95335 typedef std::forward_iterator_tag iterator_category; 95336 95337 95338 95339[heading Requirements] 95340 95341['Header: ][^boost/asio/ip/basic_resolver_results.hpp] 95342 95343['Convenience header: ][^boost/asio.hpp] 95344 95345 95346[endsect] 95347 95348 95349 95350[section:max_size ip::basic_resolver_results::max_size] 95351 95352[indexterm2 boost_asio.indexterm.ip__basic_resolver_results.max_size..max_size..ip::basic_resolver_results] 95353Get the maximum number of entries permitted in a results range. 95354 95355 95356 size_type max_size() const; 95357 95358 95359 95360[endsect] 95361 95362 95363 95364[section:operator__star_ ip::basic_resolver_results::operator *] 95365 95366 95367['Inherited from ip::basic_resolver.] 95368 95369[indexterm2 boost_asio.indexterm.ip__basic_resolver_results.operator__star_..operator *..ip::basic_resolver_results] 95370Dereference an iterator. 95371 95372 95373 const basic_resolver_entry< InternetProtocol > & operator *() const; 95374 95375 95376 95377[endsect] 95378 95379 95380[section:operator_not__eq_ ip::basic_resolver_results::operator!=] 95381 95382[indexterm2 boost_asio.indexterm.ip__basic_resolver_results.operator_not__eq_..operator!=..ip::basic_resolver_results] 95383Test two iterators for inequality. 95384 95385 95386 friend bool ``[link boost_asio.reference.ip__basic_resolver_results.operator_not__eq_.overload1 operator!=]``( 95387 const basic_resolver_results & a, 95388 const basic_resolver_results & b); 95389 `` [''''»''' [link boost_asio.reference.ip__basic_resolver_results.operator_not__eq_.overload1 more...]]`` 95390 95391 friend bool ``[link boost_asio.reference.ip__basic_resolver_results.operator_not__eq_.overload2 operator!=]``( 95392 const basic_resolver_iterator & a, 95393 const basic_resolver_iterator & b); 95394 `` [''''»''' [link boost_asio.reference.ip__basic_resolver_results.operator_not__eq_.overload2 more...]]`` 95395 95396 95397[section:overload1 ip::basic_resolver_results::operator!= (1 of 2 overloads)] 95398 95399 95400Test two iterators for inequality. 95401 95402 95403 friend bool operator!=( 95404 const basic_resolver_results & a, 95405 const basic_resolver_results & b); 95406 95407 95408[heading Requirements] 95409 95410['Header: ][^boost/asio/ip/basic_resolver_results.hpp] 95411 95412['Convenience header: ][^boost/asio.hpp] 95413 95414 95415[endsect] 95416 95417 95418 95419[section:overload2 ip::basic_resolver_results::operator!= (2 of 2 overloads)] 95420 95421 95422['Inherited from ip::basic_resolver.] 95423 95424 95425Test two iterators for inequality. 95426 95427 95428 friend bool operator!=( 95429 const basic_resolver_iterator & a, 95430 const basic_resolver_iterator & b); 95431 95432 95433[heading Requirements] 95434 95435['Header: ][^boost/asio/ip/basic_resolver_results.hpp] 95436 95437['Convenience header: ][^boost/asio.hpp] 95438 95439 95440[endsect] 95441 95442 95443[endsect] 95444 95445[section:operator_plus__plus_ ip::basic_resolver_results::operator++] 95446 95447[indexterm2 boost_asio.indexterm.ip__basic_resolver_results.operator_plus__plus_..operator++..ip::basic_resolver_results] 95448Increment operator (prefix). 95449 95450 95451 basic_resolver_iterator & ``[link boost_asio.reference.ip__basic_resolver_results.operator_plus__plus_.overload1 operator++]``(); 95452 `` [''''»''' [link boost_asio.reference.ip__basic_resolver_results.operator_plus__plus_.overload1 more...]]`` 95453 95454 95455Increment operator (postfix). 95456 95457 95458 basic_resolver_iterator ``[link boost_asio.reference.ip__basic_resolver_results.operator_plus__plus_.overload2 operator++]``( 95459 int ); 95460 `` [''''»''' [link boost_asio.reference.ip__basic_resolver_results.operator_plus__plus_.overload2 more...]]`` 95461 95462 95463[section:overload1 ip::basic_resolver_results::operator++ (1 of 2 overloads)] 95464 95465 95466['Inherited from ip::basic_resolver.] 95467 95468 95469Increment operator (prefix). 95470 95471 95472 basic_resolver_iterator & operator++(); 95473 95474 95475 95476[endsect] 95477 95478 95479 95480[section:overload2 ip::basic_resolver_results::operator++ (2 of 2 overloads)] 95481 95482 95483['Inherited from ip::basic_resolver.] 95484 95485 95486Increment operator (postfix). 95487 95488 95489 basic_resolver_iterator operator++( 95490 int ); 95491 95492 95493 95494[endsect] 95495 95496 95497[endsect] 95498 95499 95500[section:operator_arrow_ ip::basic_resolver_results::operator->] 95501 95502 95503['Inherited from ip::basic_resolver.] 95504 95505[indexterm2 boost_asio.indexterm.ip__basic_resolver_results.operator_arrow_..operator->..ip::basic_resolver_results] 95506Dereference an iterator. 95507 95508 95509 const basic_resolver_entry< InternetProtocol > * operator->() const; 95510 95511 95512 95513[endsect] 95514 95515 95516[section:operator_eq_ ip::basic_resolver_results::operator=] 95517 95518[indexterm2 boost_asio.indexterm.ip__basic_resolver_results.operator_eq_..operator=..ip::basic_resolver_results] 95519Assignment operator. 95520 95521 95522 basic_resolver_results & ``[link boost_asio.reference.ip__basic_resolver_results.operator_eq_.overload1 operator=]``( 95523 const basic_resolver_results & other); 95524 `` [''''»''' [link boost_asio.reference.ip__basic_resolver_results.operator_eq_.overload1 more...]]`` 95525 95526 95527Move-assignment operator. 95528 95529 95530 basic_resolver_results & ``[link boost_asio.reference.ip__basic_resolver_results.operator_eq_.overload2 operator=]``( 95531 basic_resolver_results && other); 95532 `` [''''»''' [link boost_asio.reference.ip__basic_resolver_results.operator_eq_.overload2 more...]]`` 95533 95534 95535[section:overload1 ip::basic_resolver_results::operator= (1 of 2 overloads)] 95536 95537 95538Assignment operator. 95539 95540 95541 basic_resolver_results & operator=( 95542 const basic_resolver_results & other); 95543 95544 95545 95546[endsect] 95547 95548 95549 95550[section:overload2 ip::basic_resolver_results::operator= (2 of 2 overloads)] 95551 95552 95553Move-assignment operator. 95554 95555 95556 basic_resolver_results & operator=( 95557 basic_resolver_results && other); 95558 95559 95560 95561[endsect] 95562 95563 95564[endsect] 95565 95566[section:operator_eq__eq_ ip::basic_resolver_results::operator==] 95567 95568[indexterm2 boost_asio.indexterm.ip__basic_resolver_results.operator_eq__eq_..operator==..ip::basic_resolver_results] 95569Test two iterators for equality. 95570 95571 95572 friend bool ``[link boost_asio.reference.ip__basic_resolver_results.operator_eq__eq_.overload1 operator==]``( 95573 const basic_resolver_results & a, 95574 const basic_resolver_results & b); 95575 `` [''''»''' [link boost_asio.reference.ip__basic_resolver_results.operator_eq__eq_.overload1 more...]]`` 95576 95577 friend bool ``[link boost_asio.reference.ip__basic_resolver_results.operator_eq__eq_.overload2 operator==]``( 95578 const basic_resolver_iterator & a, 95579 const basic_resolver_iterator & b); 95580 `` [''''»''' [link boost_asio.reference.ip__basic_resolver_results.operator_eq__eq_.overload2 more...]]`` 95581 95582 95583[section:overload1 ip::basic_resolver_results::operator== (1 of 2 overloads)] 95584 95585 95586Test two iterators for equality. 95587 95588 95589 friend bool operator==( 95590 const basic_resolver_results & a, 95591 const basic_resolver_results & b); 95592 95593 95594[heading Requirements] 95595 95596['Header: ][^boost/asio/ip/basic_resolver_results.hpp] 95597 95598['Convenience header: ][^boost/asio.hpp] 95599 95600 95601[endsect] 95602 95603 95604 95605[section:overload2 ip::basic_resolver_results::operator== (2 of 2 overloads)] 95606 95607 95608['Inherited from ip::basic_resolver.] 95609 95610 95611Test two iterators for equality. 95612 95613 95614 friend bool operator==( 95615 const basic_resolver_iterator & a, 95616 const basic_resolver_iterator & b); 95617 95618 95619[heading Requirements] 95620 95621['Header: ][^boost/asio/ip/basic_resolver_results.hpp] 95622 95623['Convenience header: ][^boost/asio.hpp] 95624 95625 95626[endsect] 95627 95628 95629[endsect] 95630 95631 95632[section:pointer ip::basic_resolver_results::pointer] 95633 95634 95635['Inherited from ip::basic_resolver.] 95636 95637[indexterm2 boost_asio.indexterm.ip__basic_resolver_results.pointer..pointer..ip::basic_resolver_results] 95638The type of the result of applying `operator->()` to the iterator. 95639 95640 95641 typedef const basic_resolver_entry< InternetProtocol > * pointer; 95642 95643 95644 95645[heading Requirements] 95646 95647['Header: ][^boost/asio/ip/basic_resolver_results.hpp] 95648 95649['Convenience header: ][^boost/asio.hpp] 95650 95651 95652[endsect] 95653 95654 95655 95656[section:protocol_type ip::basic_resolver_results::protocol_type] 95657 95658[indexterm2 boost_asio.indexterm.ip__basic_resolver_results.protocol_type..protocol_type..ip::basic_resolver_results] 95659The protocol type associated with the results. 95660 95661 95662 typedef InternetProtocol protocol_type; 95663 95664 95665 95666[heading Requirements] 95667 95668['Header: ][^boost/asio/ip/basic_resolver_results.hpp] 95669 95670['Convenience header: ][^boost/asio.hpp] 95671 95672 95673[endsect] 95674 95675 95676 95677[section:reference ip::basic_resolver_results::reference] 95678 95679[indexterm2 boost_asio.indexterm.ip__basic_resolver_results.reference..reference..ip::basic_resolver_results] 95680The type of a non-const reference to a value in the range. 95681 95682 95683 typedef value_type & reference; 95684 95685 95686[heading Types] 95687[table 95688 [[Name][Description]] 95689 95690 [ 95691 95692 [[link boost_asio.reference.ip__basic_resolver_entry.endpoint_type [*endpoint_type]]] 95693 [The endpoint type associated with the endpoint entry. ] 95694 95695 ] 95696 95697 [ 95698 95699 [[link boost_asio.reference.ip__basic_resolver_entry.protocol_type [*protocol_type]]] 95700 [The protocol type associated with the endpoint entry. ] 95701 95702 ] 95703 95704] 95705 95706[heading Member Functions] 95707[table 95708 [[Name][Description]] 95709 95710 [ 95711 [[link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry [*basic_resolver_entry]] [constructor]] 95712 [Default constructor. 95713 [hr] 95714 Construct with specified endpoint, host name and service name. ] 95715 ] 95716 95717 [ 95718 [[link boost_asio.reference.ip__basic_resolver_entry.endpoint [*endpoint]]] 95719 [Get the endpoint associated with the entry. ] 95720 ] 95721 95722 [ 95723 [[link boost_asio.reference.ip__basic_resolver_entry.host_name [*host_name]]] 95724 [Get the host name associated with the entry. ] 95725 ] 95726 95727 [ 95728 [[link boost_asio.reference.ip__basic_resolver_entry.operator_endpoint_type [*operator endpoint_type]]] 95729 [Convert to the endpoint associated with the entry. ] 95730 ] 95731 95732 [ 95733 [[link boost_asio.reference.ip__basic_resolver_entry.service_name [*service_name]]] 95734 [Get the service name associated with the entry. ] 95735 ] 95736 95737] 95738 95739The [link boost_asio.reference.ip__basic_resolver_entry `ip::basic_resolver_entry`] class template describes an entry as returned by a resolver. 95740 95741 95742[heading Thread Safety] 95743 95744['Distinct] ['objects:] Safe. 95745 95746['Shared] ['objects:] Unsafe. 95747 95748 95749 95750 95751[heading Requirements] 95752 95753['Header: ][^boost/asio/ip/basic_resolver_results.hpp] 95754 95755['Convenience header: ][^boost/asio.hpp] 95756 95757 95758[endsect] 95759 95760 95761 95762[section:size ip::basic_resolver_results::size] 95763 95764[indexterm2 boost_asio.indexterm.ip__basic_resolver_results.size..size..ip::basic_resolver_results] 95765Get the number of entries in the results range. 95766 95767 95768 size_type size() const; 95769 95770 95771 95772[endsect] 95773 95774 95775 95776[section:size_type ip::basic_resolver_results::size_type] 95777 95778[indexterm2 boost_asio.indexterm.ip__basic_resolver_results.size_type..size_type..ip::basic_resolver_results] 95779Type used to represent a count of the elements in the range. 95780 95781 95782 typedef std::size_t size_type; 95783 95784 95785 95786[heading Requirements] 95787 95788['Header: ][^boost/asio/ip/basic_resolver_results.hpp] 95789 95790['Convenience header: ][^boost/asio.hpp] 95791 95792 95793[endsect] 95794 95795 95796 95797[section:swap ip::basic_resolver_results::swap] 95798 95799[indexterm2 boost_asio.indexterm.ip__basic_resolver_results.swap..swap..ip::basic_resolver_results] 95800Swap the results range with another. 95801 95802 95803 void swap( 95804 basic_resolver_results & that); 95805 95806 95807 95808[endsect] 95809 95810 95811 95812[section:value_type ip::basic_resolver_results::value_type] 95813 95814[indexterm2 boost_asio.indexterm.ip__basic_resolver_results.value_type..value_type..ip::basic_resolver_results] 95815The type of a value in the results range. 95816 95817 95818 typedef basic_resolver_entry< protocol_type > value_type; 95819 95820 95821[heading Types] 95822[table 95823 [[Name][Description]] 95824 95825 [ 95826 95827 [[link boost_asio.reference.ip__basic_resolver_entry.endpoint_type [*endpoint_type]]] 95828 [The endpoint type associated with the endpoint entry. ] 95829 95830 ] 95831 95832 [ 95833 95834 [[link boost_asio.reference.ip__basic_resolver_entry.protocol_type [*protocol_type]]] 95835 [The protocol type associated with the endpoint entry. ] 95836 95837 ] 95838 95839] 95840 95841[heading Member Functions] 95842[table 95843 [[Name][Description]] 95844 95845 [ 95846 [[link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry [*basic_resolver_entry]] [constructor]] 95847 [Default constructor. 95848 [hr] 95849 Construct with specified endpoint, host name and service name. ] 95850 ] 95851 95852 [ 95853 [[link boost_asio.reference.ip__basic_resolver_entry.endpoint [*endpoint]]] 95854 [Get the endpoint associated with the entry. ] 95855 ] 95856 95857 [ 95858 [[link boost_asio.reference.ip__basic_resolver_entry.host_name [*host_name]]] 95859 [Get the host name associated with the entry. ] 95860 ] 95861 95862 [ 95863 [[link boost_asio.reference.ip__basic_resolver_entry.operator_endpoint_type [*operator endpoint_type]]] 95864 [Convert to the endpoint associated with the entry. ] 95865 ] 95866 95867 [ 95868 [[link boost_asio.reference.ip__basic_resolver_entry.service_name [*service_name]]] 95869 [Get the service name associated with the entry. ] 95870 ] 95871 95872] 95873 95874The [link boost_asio.reference.ip__basic_resolver_entry `ip::basic_resolver_entry`] class template describes an entry as returned by a resolver. 95875 95876 95877[heading Thread Safety] 95878 95879['Distinct] ['objects:] Safe. 95880 95881['Shared] ['objects:] Unsafe. 95882 95883 95884 95885 95886[heading Requirements] 95887 95888['Header: ][^boost/asio/ip/basic_resolver_results.hpp] 95889 95890['Convenience header: ][^boost/asio.hpp] 95891 95892 95893[endsect] 95894 95895 95896 95897[section:values_ ip::basic_resolver_results::values_] 95898 95899 95900['Inherited from ip::basic_resolver.] 95901 95902[indexterm2 boost_asio.indexterm.ip__basic_resolver_results.values_..values_..ip::basic_resolver_results] 95903 95904 values_ptr_type values_; 95905 95906 95907 95908[endsect] 95909 95910 95911 95912[endsect] 95913 95914[section:ip__host_name ip::host_name] 95915 95916[indexterm1 boost_asio.indexterm.ip__host_name..ip::host_name] 95917Get the current host name. 95918 95919 std::string ``[link boost_asio.reference.ip__host_name.overload1 host_name]``(); 95920 `` [''''»''' [link boost_asio.reference.ip__host_name.overload1 more...]]`` 95921 95922 std::string ``[link boost_asio.reference.ip__host_name.overload2 host_name]``( 95923 boost::system::error_code & ec); 95924 `` [''''»''' [link boost_asio.reference.ip__host_name.overload2 more...]]`` 95925 95926[heading Requirements] 95927 95928['Header: ][^boost/asio/ip/host_name.hpp] 95929 95930['Convenience header: ][^boost/asio.hpp] 95931 95932 95933[section:overload1 ip::host_name (1 of 2 overloads)] 95934 95935 95936Get the current host name. 95937 95938 95939 std::string host_name(); 95940 95941 95942 95943[endsect] 95944 95945 95946 95947[section:overload2 ip::host_name (2 of 2 overloads)] 95948 95949 95950Get the current host name. 95951 95952 95953 std::string host_name( 95954 boost::system::error_code & ec); 95955 95956 95957 95958[endsect] 95959 95960 95961[endsect] 95962 95963[section:ip__icmp ip::icmp] 95964 95965[indexterm1 boost_asio.indexterm.ip__icmp..ip::icmp] 95966 95967 95968Encapsulates the flags needed for ICMP. 95969 95970 95971 class icmp 95972 95973 95974[heading Types] 95975[table 95976 [[Name][Description]] 95977 95978 [ 95979 95980 [[link boost_asio.reference.ip__icmp.endpoint [*endpoint]]] 95981 [The type of a ICMP endpoint. ] 95982 95983 ] 95984 95985 [ 95986 95987 [[link boost_asio.reference.ip__icmp.resolver [*resolver]]] 95988 [The ICMP resolver type. ] 95989 95990 ] 95991 95992 [ 95993 95994 [[link boost_asio.reference.ip__icmp.socket [*socket]]] 95995 [The ICMP socket type. ] 95996 95997 ] 95998 95999] 96000 96001[heading Member Functions] 96002[table 96003 [[Name][Description]] 96004 96005 [ 96006 [[link boost_asio.reference.ip__icmp.family [*family]]] 96007 [Obtain an identifier for the protocol family. ] 96008 ] 96009 96010 [ 96011 [[link boost_asio.reference.ip__icmp.protocol [*protocol]]] 96012 [Obtain an identifier for the protocol. ] 96013 ] 96014 96015 [ 96016 [[link boost_asio.reference.ip__icmp.type [*type]]] 96017 [Obtain an identifier for the type of the protocol. ] 96018 ] 96019 96020 [ 96021 [[link boost_asio.reference.ip__icmp.v4 [*v4]] [static]] 96022 [Construct to represent the IPv4 ICMP protocol. ] 96023 ] 96024 96025 [ 96026 [[link boost_asio.reference.ip__icmp.v6 [*v6]] [static]] 96027 [Construct to represent the IPv6 ICMP protocol. ] 96028 ] 96029 96030] 96031 96032[heading Friends] 96033[table 96034 [[Name][Description]] 96035 96036 [ 96037 [[link boost_asio.reference.ip__icmp.operator_not__eq_ [*operator!=]]] 96038 [Compare two protocols for inequality. ] 96039 ] 96040 96041 [ 96042 [[link boost_asio.reference.ip__icmp.operator_eq__eq_ [*operator==]]] 96043 [Compare two protocols for equality. ] 96044 ] 96045 96046] 96047 96048The [link boost_asio.reference.ip__icmp `ip::icmp`] class contains flags necessary for ICMP sockets. 96049 96050 96051[heading Thread Safety] 96052 96053['Distinct] ['objects:] Safe. 96054 96055['Shared] ['objects:] Safe. 96056 96057 96058 96059 96060[heading Requirements] 96061 96062['Header: ][^boost/asio/ip/icmp.hpp] 96063 96064['Convenience header: ][^boost/asio.hpp] 96065 96066 96067[section:endpoint ip::icmp::endpoint] 96068 96069[indexterm2 boost_asio.indexterm.ip__icmp.endpoint..endpoint..ip::icmp] 96070The type of a ICMP endpoint. 96071 96072 96073 typedef basic_endpoint< icmp > endpoint; 96074 96075 96076[heading Types] 96077[table 96078 [[Name][Description]] 96079 96080 [ 96081 96082 [[link boost_asio.reference.ip__basic_endpoint.data_type [*data_type]]] 96083 [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ] 96084 96085 ] 96086 96087 [ 96088 96089 [[link boost_asio.reference.ip__basic_endpoint.protocol_type [*protocol_type]]] 96090 [The protocol type associated with the endpoint. ] 96091 96092 ] 96093 96094] 96095 96096[heading Member Functions] 96097[table 96098 [[Name][Description]] 96099 96100 [ 96101 [[link boost_asio.reference.ip__basic_endpoint.address [*address]]] 96102 [Get the IP address associated with the endpoint. 96103 [hr] 96104 Set the IP address associated with the endpoint. ] 96105 ] 96106 96107 [ 96108 [[link boost_asio.reference.ip__basic_endpoint.basic_endpoint [*basic_endpoint]] [constructor]] 96109 [Default constructor. 96110 [hr] 96111 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. 96112 [hr] 96113 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. 96114 [hr] 96115 Copy constructor. 96116 [hr] 96117 Move constructor. ] 96118 ] 96119 96120 [ 96121 [[link boost_asio.reference.ip__basic_endpoint.capacity [*capacity]]] 96122 [Get the capacity of the endpoint in the native type. ] 96123 ] 96124 96125 [ 96126 [[link boost_asio.reference.ip__basic_endpoint.data [*data]]] 96127 [Get the underlying endpoint in the native type. ] 96128 ] 96129 96130 [ 96131 [[link boost_asio.reference.ip__basic_endpoint.operator_eq_ [*operator=]]] 96132 [Assign from another endpoint. 96133 [hr] 96134 Move-assign from another endpoint. ] 96135 ] 96136 96137 [ 96138 [[link boost_asio.reference.ip__basic_endpoint.port [*port]]] 96139 [Get the port associated with the endpoint. The port number is always in the host's byte order. 96140 [hr] 96141 Set the port associated with the endpoint. The port number is always in the host's byte order. ] 96142 ] 96143 96144 [ 96145 [[link boost_asio.reference.ip__basic_endpoint.protocol [*protocol]]] 96146 [The protocol associated with the endpoint. ] 96147 ] 96148 96149 [ 96150 [[link boost_asio.reference.ip__basic_endpoint.resize [*resize]]] 96151 [Set the underlying size of the endpoint in the native type. ] 96152 ] 96153 96154 [ 96155 [[link boost_asio.reference.ip__basic_endpoint.size [*size]]] 96156 [Get the underlying size of the endpoint in the native type. ] 96157 ] 96158 96159] 96160 96161[heading Friends] 96162[table 96163 [[Name][Description]] 96164 96165 [ 96166 [[link boost_asio.reference.ip__basic_endpoint.operator_not__eq_ [*operator!=]]] 96167 [Compare two endpoints for inequality. ] 96168 ] 96169 96170 [ 96171 [[link boost_asio.reference.ip__basic_endpoint.operator_lt_ [*operator<]]] 96172 [Compare endpoints for ordering. ] 96173 ] 96174 96175 [ 96176 [[link boost_asio.reference.ip__basic_endpoint.operator_lt__eq_ [*operator<=]]] 96177 [Compare endpoints for ordering. ] 96178 ] 96179 96180 [ 96181 [[link boost_asio.reference.ip__basic_endpoint.operator_eq__eq_ [*operator==]]] 96182 [Compare two endpoints for equality. ] 96183 ] 96184 96185 [ 96186 [[link boost_asio.reference.ip__basic_endpoint.operator_gt_ [*operator>]]] 96187 [Compare endpoints for ordering. ] 96188 ] 96189 96190 [ 96191 [[link boost_asio.reference.ip__basic_endpoint.operator_gt__eq_ [*operator>=]]] 96192 [Compare endpoints for ordering. ] 96193 ] 96194 96195] 96196 96197[heading Related Functions] 96198[table 96199 [[Name][Description]] 96200 96201 [ 96202 [[link boost_asio.reference.ip__basic_endpoint.operator_lt__lt_ [*operator<<]]] 96203 [Output an endpoint as a string. ] 96204 ] 96205 96206] 96207 96208The [link boost_asio.reference.ip__basic_endpoint `ip::basic_endpoint`] class template describes an endpoint that may be associated with a particular socket. 96209 96210 96211[heading Thread Safety] 96212 96213['Distinct] ['objects:] Safe. 96214 96215['Shared] ['objects:] Unsafe. 96216 96217 96218 96219 96220 96221[heading Requirements] 96222 96223['Header: ][^boost/asio/ip/icmp.hpp] 96224 96225['Convenience header: ][^boost/asio.hpp] 96226 96227 96228[endsect] 96229 96230 96231 96232[section:family ip::icmp::family] 96233 96234[indexterm2 boost_asio.indexterm.ip__icmp.family..family..ip::icmp] 96235Obtain an identifier for the protocol family. 96236 96237 96238 int family() const; 96239 96240 96241 96242[endsect] 96243 96244 96245 96246[section:operator_not__eq_ ip::icmp::operator!=] 96247 96248[indexterm2 boost_asio.indexterm.ip__icmp.operator_not__eq_..operator!=..ip::icmp] 96249Compare two protocols for inequality. 96250 96251 96252 friend bool operator!=( 96253 const icmp & p1, 96254 const icmp & p2); 96255 96256 96257[heading Requirements] 96258 96259['Header: ][^boost/asio/ip/icmp.hpp] 96260 96261['Convenience header: ][^boost/asio.hpp] 96262 96263 96264[endsect] 96265 96266 96267 96268[section:operator_eq__eq_ ip::icmp::operator==] 96269 96270[indexterm2 boost_asio.indexterm.ip__icmp.operator_eq__eq_..operator==..ip::icmp] 96271Compare two protocols for equality. 96272 96273 96274 friend bool operator==( 96275 const icmp & p1, 96276 const icmp & p2); 96277 96278 96279[heading Requirements] 96280 96281['Header: ][^boost/asio/ip/icmp.hpp] 96282 96283['Convenience header: ][^boost/asio.hpp] 96284 96285 96286[endsect] 96287 96288 96289 96290[section:protocol ip::icmp::protocol] 96291 96292[indexterm2 boost_asio.indexterm.ip__icmp.protocol..protocol..ip::icmp] 96293Obtain an identifier for the protocol. 96294 96295 96296 int protocol() const; 96297 96298 96299 96300[endsect] 96301 96302 96303 96304[section:resolver ip::icmp::resolver] 96305 96306[indexterm2 boost_asio.indexterm.ip__icmp.resolver..resolver..ip::icmp] 96307The ICMP resolver type. 96308 96309 96310 typedef basic_resolver< icmp > resolver; 96311 96312 96313[heading Types] 96314[table 96315 [[Name][Description]] 96316 96317 [ 96318 96319 [[link boost_asio.reference.ip__basic_resolver__rebind_executor [*rebind_executor]]] 96320 [Rebinds the resolver type to another executor. ] 96321 96322 ] 96323 96324 [ 96325 96326 [[link boost_asio.reference.ip__basic_resolver.endpoint_type [*endpoint_type]]] 96327 [The endpoint type. ] 96328 96329 ] 96330 96331 [ 96332 96333 [[link boost_asio.reference.ip__basic_resolver.executor_type [*executor_type]]] 96334 [The type of the executor associated with the object. ] 96335 96336 ] 96337 96338 [ 96339 96340 [[link boost_asio.reference.ip__basic_resolver.flags [*flags]]] 96341 [A bitmask type (C++ Std \[lib.bitmask.types\]). ] 96342 96343 ] 96344 96345 [ 96346 96347 [[link boost_asio.reference.ip__basic_resolver.iterator [*iterator]]] 96348 [(Deprecated.) The iterator type. ] 96349 96350 ] 96351 96352 [ 96353 96354 [[link boost_asio.reference.ip__basic_resolver.protocol_type [*protocol_type]]] 96355 [The protocol type. ] 96356 96357 ] 96358 96359 [ 96360 96361 [[link boost_asio.reference.ip__basic_resolver.query [*query]]] 96362 [(Deprecated.) The query type. ] 96363 96364 ] 96365 96366 [ 96367 96368 [[link boost_asio.reference.ip__basic_resolver.results_type [*results_type]]] 96369 [The results type. ] 96370 96371 ] 96372 96373] 96374 96375[heading Member Functions] 96376[table 96377 [[Name][Description]] 96378 96379 [ 96380 [[link boost_asio.reference.ip__basic_resolver.async_resolve [*async_resolve]]] 96381 [(Deprecated: Use overload with separate host and service parameters.) Asynchronously perform forward resolution of a query to a list of entries. 96382 [hr] 96383 Asynchronously perform forward resolution of a query to a list of entries. 96384 [hr] 96385 Asynchronously perform reverse resolution of an endpoint to a list of entries. ] 96386 ] 96387 96388 [ 96389 [[link boost_asio.reference.ip__basic_resolver.basic_resolver [*basic_resolver]] [constructor]] 96390 [Construct with executor. 96391 [hr] 96392 Construct with execution context. 96393 [hr] 96394 Move-construct a basic_resolver from another. ] 96395 ] 96396 96397 [ 96398 [[link boost_asio.reference.ip__basic_resolver.cancel [*cancel]]] 96399 [Cancel any asynchronous operations that are waiting on the resolver. ] 96400 ] 96401 96402 [ 96403 [[link boost_asio.reference.ip__basic_resolver.get_executor [*get_executor]]] 96404 [Get the executor associated with the object. ] 96405 ] 96406 96407 [ 96408 [[link boost_asio.reference.ip__basic_resolver.operator_eq_ [*operator=]]] 96409 [Move-assign a basic_resolver from another. ] 96410 ] 96411 96412 [ 96413 [[link boost_asio.reference.ip__basic_resolver.resolve [*resolve]]] 96414 [(Deprecated: Use overload with separate host and service parameters.) Perform forward resolution of a query to a list of entries. 96415 [hr] 96416 Perform forward resolution of a query to a list of entries. 96417 [hr] 96418 Perform reverse resolution of an endpoint to a list of entries. ] 96419 ] 96420 96421 [ 96422 [[link boost_asio.reference.ip__basic_resolver._basic_resolver [*~basic_resolver]] [destructor]] 96423 [Destroys the resolver. ] 96424 ] 96425 96426] 96427 96428[heading Data Members] 96429[table 96430 [[Name][Description]] 96431 96432 [ 96433 [[link boost_asio.reference.ip__basic_resolver.address_configured [*address_configured]] [static]] 96434 [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. ] 96435 ] 96436 96437 [ 96438 [[link boost_asio.reference.ip__basic_resolver.all_matching [*all_matching]] [static]] 96439 [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ] 96440 ] 96441 96442 [ 96443 [[link boost_asio.reference.ip__basic_resolver.canonical_name [*canonical_name]] [static]] 96444 [Determine the canonical name of the host specified in the query. ] 96445 ] 96446 96447 [ 96448 [[link boost_asio.reference.ip__basic_resolver.numeric_host [*numeric_host]] [static]] 96449 [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ] 96450 ] 96451 96452 [ 96453 [[link boost_asio.reference.ip__basic_resolver.numeric_service [*numeric_service]] [static]] 96454 [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ] 96455 ] 96456 96457 [ 96458 [[link boost_asio.reference.ip__basic_resolver.passive [*passive]] [static]] 96459 [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ] 96460 ] 96461 96462 [ 96463 [[link boost_asio.reference.ip__basic_resolver.v4_mapped [*v4_mapped]] [static]] 96464 [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ] 96465 ] 96466 96467] 96468 96469The [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] class template provides the ability to resolve a query to a list of endpoints. 96470 96471 96472[heading Thread Safety] 96473 96474['Distinct] ['objects:] Safe. 96475 96476['Shared] ['objects:] Unsafe. 96477 96478 96479 96480 96481[heading Requirements] 96482 96483['Header: ][^boost/asio/ip/icmp.hpp] 96484 96485['Convenience header: ][^boost/asio.hpp] 96486 96487 96488[endsect] 96489 96490 96491 96492[section:socket ip::icmp::socket] 96493 96494[indexterm2 boost_asio.indexterm.ip__icmp.socket..socket..ip::icmp] 96495The ICMP socket type. 96496 96497 96498 typedef basic_raw_socket< icmp > socket; 96499 96500 96501[heading Types] 96502[table 96503 [[Name][Description]] 96504 96505 [ 96506 96507 [[link boost_asio.reference.basic_raw_socket__rebind_executor [*rebind_executor]]] 96508 [Rebinds the socket type to another executor. ] 96509 96510 ] 96511 96512 [ 96513 96514 [[link boost_asio.reference.basic_raw_socket.broadcast [*broadcast]]] 96515 [Socket option to permit sending of broadcast messages. ] 96516 96517 ] 96518 96519 [ 96520 96521 [[link boost_asio.reference.basic_raw_socket.bytes_readable [*bytes_readable]]] 96522 [IO control command to get the amount of data that can be read without blocking. ] 96523 96524 ] 96525 96526 [ 96527 96528 [[link boost_asio.reference.basic_raw_socket.debug [*debug]]] 96529 [Socket option to enable socket-level debugging. ] 96530 96531 ] 96532 96533 [ 96534 96535 [[link boost_asio.reference.basic_raw_socket.do_not_route [*do_not_route]]] 96536 [Socket option to prevent routing, use local interfaces only. ] 96537 96538 ] 96539 96540 [ 96541 96542 [[link boost_asio.reference.basic_raw_socket.enable_connection_aborted [*enable_connection_aborted]]] 96543 [Socket option to report aborted connections on accept. ] 96544 96545 ] 96546 96547 [ 96548 96549 [[link boost_asio.reference.basic_raw_socket.endpoint_type [*endpoint_type]]] 96550 [The endpoint type. ] 96551 96552 ] 96553 96554 [ 96555 96556 [[link boost_asio.reference.basic_raw_socket.executor_type [*executor_type]]] 96557 [The type of the executor associated with the object. ] 96558 96559 ] 96560 96561 [ 96562 96563 [[link boost_asio.reference.basic_raw_socket.keep_alive [*keep_alive]]] 96564 [Socket option to send keep-alives. ] 96565 96566 ] 96567 96568 [ 96569 96570 [[link boost_asio.reference.basic_raw_socket.linger [*linger]]] 96571 [Socket option to specify whether the socket lingers on close if unsent data is present. ] 96572 96573 ] 96574 96575 [ 96576 96577 [[link boost_asio.reference.basic_raw_socket.lowest_layer_type [*lowest_layer_type]]] 96578 [A basic_socket is always the lowest layer. ] 96579 96580 ] 96581 96582 [ 96583 96584 [[link boost_asio.reference.basic_raw_socket.message_flags [*message_flags]]] 96585 [Bitmask type for flags that can be passed to send and receive operations. ] 96586 96587 ] 96588 96589 [ 96590 96591 [[link boost_asio.reference.basic_raw_socket.native_handle_type [*native_handle_type]]] 96592 [The native representation of a socket. ] 96593 96594 ] 96595 96596 [ 96597 96598 [[link boost_asio.reference.basic_raw_socket.out_of_band_inline [*out_of_band_inline]]] 96599 [Socket option for putting received out-of-band data inline. ] 96600 96601 ] 96602 96603 [ 96604 96605 [[link boost_asio.reference.basic_raw_socket.protocol_type [*protocol_type]]] 96606 [The protocol type. ] 96607 96608 ] 96609 96610 [ 96611 96612 [[link boost_asio.reference.basic_raw_socket.receive_buffer_size [*receive_buffer_size]]] 96613 [Socket option for the receive buffer size of a socket. ] 96614 96615 ] 96616 96617 [ 96618 96619 [[link boost_asio.reference.basic_raw_socket.receive_low_watermark [*receive_low_watermark]]] 96620 [Socket option for the receive low watermark. ] 96621 96622 ] 96623 96624 [ 96625 96626 [[link boost_asio.reference.basic_raw_socket.reuse_address [*reuse_address]]] 96627 [Socket option to allow the socket to be bound to an address that is already in use. ] 96628 96629 ] 96630 96631 [ 96632 96633 [[link boost_asio.reference.basic_raw_socket.send_buffer_size [*send_buffer_size]]] 96634 [Socket option for the send buffer size of a socket. ] 96635 96636 ] 96637 96638 [ 96639 96640 [[link boost_asio.reference.basic_raw_socket.send_low_watermark [*send_low_watermark]]] 96641 [Socket option for the send low watermark. ] 96642 96643 ] 96644 96645 [ 96646 96647 [[link boost_asio.reference.basic_raw_socket.shutdown_type [*shutdown_type]]] 96648 [Different ways a socket may be shutdown. ] 96649 96650 ] 96651 96652 [ 96653 96654 [[link boost_asio.reference.basic_raw_socket.wait_type [*wait_type]]] 96655 [Wait types. ] 96656 96657 ] 96658 96659] 96660 96661[heading Member Functions] 96662[table 96663 [[Name][Description]] 96664 96665 [ 96666 [[link boost_asio.reference.basic_raw_socket.assign [*assign]]] 96667 [Assign an existing native socket to the socket. ] 96668 ] 96669 96670 [ 96671 [[link boost_asio.reference.basic_raw_socket.async_connect [*async_connect]]] 96672 [Start an asynchronous connect. ] 96673 ] 96674 96675 [ 96676 [[link boost_asio.reference.basic_raw_socket.async_receive [*async_receive]]] 96677 [Start an asynchronous receive on a connected socket. ] 96678 ] 96679 96680 [ 96681 [[link boost_asio.reference.basic_raw_socket.async_receive_from [*async_receive_from]]] 96682 [Start an asynchronous receive. ] 96683 ] 96684 96685 [ 96686 [[link boost_asio.reference.basic_raw_socket.async_send [*async_send]]] 96687 [Start an asynchronous send on a connected socket. ] 96688 ] 96689 96690 [ 96691 [[link boost_asio.reference.basic_raw_socket.async_send_to [*async_send_to]]] 96692 [Start an asynchronous send. ] 96693 ] 96694 96695 [ 96696 [[link boost_asio.reference.basic_raw_socket.async_wait [*async_wait]]] 96697 [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 96698 ] 96699 96700 [ 96701 [[link boost_asio.reference.basic_raw_socket.at_mark [*at_mark]]] 96702 [Determine whether the socket is at the out-of-band data mark. ] 96703 ] 96704 96705 [ 96706 [[link boost_asio.reference.basic_raw_socket.available [*available]]] 96707 [Determine the number of bytes available for reading. ] 96708 ] 96709 96710 [ 96711 [[link boost_asio.reference.basic_raw_socket.basic_raw_socket [*basic_raw_socket]] [constructor]] 96712 [Construct a basic_raw_socket without opening it. 96713 [hr] 96714 Construct and open a basic_raw_socket. 96715 [hr] 96716 Construct a basic_raw_socket, opening it and binding it to the given local endpoint. 96717 [hr] 96718 Construct a basic_raw_socket on an existing native socket. 96719 [hr] 96720 Move-construct a basic_raw_socket from another. 96721 [hr] 96722 Move-construct a basic_raw_socket from a socket of another protocol type. ] 96723 ] 96724 96725 [ 96726 [[link boost_asio.reference.basic_raw_socket.bind [*bind]]] 96727 [Bind the socket to the given local endpoint. ] 96728 ] 96729 96730 [ 96731 [[link boost_asio.reference.basic_raw_socket.cancel [*cancel]]] 96732 [Cancel all asynchronous operations associated with the socket. ] 96733 ] 96734 96735 [ 96736 [[link boost_asio.reference.basic_raw_socket.close [*close]]] 96737 [Close the socket. ] 96738 ] 96739 96740 [ 96741 [[link boost_asio.reference.basic_raw_socket.connect [*connect]]] 96742 [Connect the socket to the specified endpoint. ] 96743 ] 96744 96745 [ 96746 [[link boost_asio.reference.basic_raw_socket.get_executor [*get_executor]]] 96747 [Get the executor associated with the object. ] 96748 ] 96749 96750 [ 96751 [[link boost_asio.reference.basic_raw_socket.get_option [*get_option]]] 96752 [Get an option from the socket. ] 96753 ] 96754 96755 [ 96756 [[link boost_asio.reference.basic_raw_socket.io_control [*io_control]]] 96757 [Perform an IO control command on the socket. ] 96758 ] 96759 96760 [ 96761 [[link boost_asio.reference.basic_raw_socket.is_open [*is_open]]] 96762 [Determine whether the socket is open. ] 96763 ] 96764 96765 [ 96766 [[link boost_asio.reference.basic_raw_socket.local_endpoint [*local_endpoint]]] 96767 [Get the local endpoint of the socket. ] 96768 ] 96769 96770 [ 96771 [[link boost_asio.reference.basic_raw_socket.lowest_layer [*lowest_layer]]] 96772 [Get a reference to the lowest layer. 96773 [hr] 96774 Get a const reference to the lowest layer. ] 96775 ] 96776 96777 [ 96778 [[link boost_asio.reference.basic_raw_socket.native_handle [*native_handle]]] 96779 [Get the native socket representation. ] 96780 ] 96781 96782 [ 96783 [[link boost_asio.reference.basic_raw_socket.native_non_blocking [*native_non_blocking]]] 96784 [Gets the non-blocking mode of the native socket implementation. 96785 [hr] 96786 Sets the non-blocking mode of the native socket implementation. ] 96787 ] 96788 96789 [ 96790 [[link boost_asio.reference.basic_raw_socket.non_blocking [*non_blocking]]] 96791 [Gets the non-blocking mode of the socket. 96792 [hr] 96793 Sets the non-blocking mode of the socket. ] 96794 ] 96795 96796 [ 96797 [[link boost_asio.reference.basic_raw_socket.open [*open]]] 96798 [Open the socket using the specified protocol. ] 96799 ] 96800 96801 [ 96802 [[link boost_asio.reference.basic_raw_socket.operator_eq_ [*operator=]]] 96803 [Move-assign a basic_raw_socket from another. 96804 [hr] 96805 Move-assign a basic_raw_socket from a socket of another protocol type. ] 96806 ] 96807 96808 [ 96809 [[link boost_asio.reference.basic_raw_socket.receive [*receive]]] 96810 [Receive some data on a connected socket. ] 96811 ] 96812 96813 [ 96814 [[link boost_asio.reference.basic_raw_socket.receive_from [*receive_from]]] 96815 [Receive raw data with the endpoint of the sender. ] 96816 ] 96817 96818 [ 96819 [[link boost_asio.reference.basic_raw_socket.release [*release]]] 96820 [Release ownership of the underlying native socket. ] 96821 ] 96822 96823 [ 96824 [[link boost_asio.reference.basic_raw_socket.remote_endpoint [*remote_endpoint]]] 96825 [Get the remote endpoint of the socket. ] 96826 ] 96827 96828 [ 96829 [[link boost_asio.reference.basic_raw_socket.send [*send]]] 96830 [Send some data on a connected socket. ] 96831 ] 96832 96833 [ 96834 [[link boost_asio.reference.basic_raw_socket.send_to [*send_to]]] 96835 [Send raw data to the specified endpoint. ] 96836 ] 96837 96838 [ 96839 [[link boost_asio.reference.basic_raw_socket.set_option [*set_option]]] 96840 [Set an option on the socket. ] 96841 ] 96842 96843 [ 96844 [[link boost_asio.reference.basic_raw_socket.shutdown [*shutdown]]] 96845 [Disable sends or receives on the socket. ] 96846 ] 96847 96848 [ 96849 [[link boost_asio.reference.basic_raw_socket.wait [*wait]]] 96850 [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 96851 ] 96852 96853 [ 96854 [[link boost_asio.reference.basic_raw_socket._basic_raw_socket [*~basic_raw_socket]] [destructor]] 96855 [Destroys the socket. ] 96856 ] 96857 96858] 96859 96860[heading Data Members] 96861[table 96862 [[Name][Description]] 96863 96864 [ 96865 [[link boost_asio.reference.basic_raw_socket.max_connections [*max_connections]] [static]] 96866 [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ] 96867 ] 96868 96869 [ 96870 [[link boost_asio.reference.basic_raw_socket.max_listen_connections [*max_listen_connections]] [static]] 96871 [The maximum length of the queue of pending incoming connections. ] 96872 ] 96873 96874 [ 96875 [[link boost_asio.reference.basic_raw_socket.message_do_not_route [*message_do_not_route]] [static]] 96876 [Specify that the data should not be subject to routing. ] 96877 ] 96878 96879 [ 96880 [[link boost_asio.reference.basic_raw_socket.message_end_of_record [*message_end_of_record]] [static]] 96881 [Specifies that the data marks the end of a record. ] 96882 ] 96883 96884 [ 96885 [[link boost_asio.reference.basic_raw_socket.message_out_of_band [*message_out_of_band]] [static]] 96886 [Process out-of-band data. ] 96887 ] 96888 96889 [ 96890 [[link boost_asio.reference.basic_raw_socket.message_peek [*message_peek]] [static]] 96891 [Peek at incoming data without removing it from the input queue. ] 96892 ] 96893 96894] 96895 96896The [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] class template provides asynchronous and blocking raw-oriented socket functionality. 96897 96898 96899[heading Thread Safety] 96900 96901['Distinct] ['objects:] Safe. 96902 96903['Shared] ['objects:] Unsafe. 96904 96905Synchronous `send`, `send_to`, `receive`, `receive_from`, and `connect` operations are thread safe with respect to each other, if the underlying operating system calls are also thread safe. This means that it is permitted to perform concurrent calls to these synchronous operations on a single socket object. Other synchronous operations, such as `open` or `close`, are not thread safe. 96906 96907 96908[heading Requirements] 96909 96910['Header: ][^boost/asio/ip/icmp.hpp] 96911 96912['Convenience header: ][^boost/asio.hpp] 96913 96914 96915[endsect] 96916 96917 96918 96919[section:type ip::icmp::type] 96920 96921[indexterm2 boost_asio.indexterm.ip__icmp.type..type..ip::icmp] 96922Obtain an identifier for the type of the protocol. 96923 96924 96925 int type() const; 96926 96927 96928 96929[endsect] 96930 96931 96932 96933[section:v4 ip::icmp::v4] 96934 96935[indexterm2 boost_asio.indexterm.ip__icmp.v4..v4..ip::icmp] 96936Construct to represent the IPv4 ICMP protocol. 96937 96938 96939 static icmp v4(); 96940 96941 96942 96943[endsect] 96944 96945 96946 96947[section:v6 ip::icmp::v6] 96948 96949[indexterm2 boost_asio.indexterm.ip__icmp.v6..v6..ip::icmp] 96950Construct to represent the IPv6 ICMP protocol. 96951 96952 96953 static icmp v6(); 96954 96955 96956 96957[endsect] 96958 96959 96960 96961[endsect] 96962 96963 96964[section:ip__multicast__enable_loopback ip::multicast::enable_loopback] 96965 96966[indexterm1 boost_asio.indexterm.ip__multicast__enable_loopback..ip::multicast::enable_loopback] 96967Socket option determining whether outgoing multicast packets will be received on the same socket if it is a member of the multicast group. 96968 96969 96970 typedef implementation_defined enable_loopback; 96971 96972 96973 96974Implements the IPPROTO\_IP/IP\_MULTICAST\_LOOP socket option. 96975 96976 96977[heading Examples] 96978 96979Setting the option: 96980 96981 boost::asio::ip::udp::socket socket(my_context); 96982 ... 96983 boost::asio::ip::multicast::enable_loopback option(true); 96984 socket.set_option(option); 96985 96986 96987 96988 96989 96990Getting the current option value: 96991 96992 boost::asio::ip::udp::socket socket(my_context); 96993 ... 96994 boost::asio::ip::multicast::enable_loopback option; 96995 socket.get_option(option); 96996 bool is_set = option.value(); 96997 96998 96999 97000 97001 97002 97003 97004[heading Requirements] 97005 97006['Header: ][^boost/asio/ip/multicast.hpp] 97007 97008['Convenience header: ][^boost/asio.hpp] 97009 97010 97011[endsect] 97012 97013 97014 97015[section:ip__multicast__hops ip::multicast::hops] 97016 97017[indexterm1 boost_asio.indexterm.ip__multicast__hops..ip::multicast::hops] 97018Socket option for time-to-live associated with outgoing multicast packets. 97019 97020 97021 typedef implementation_defined hops; 97022 97023 97024 97025Implements the IPPROTO\_IP/IP\_MULTICAST\_TTL socket option. 97026 97027 97028[heading Examples] 97029 97030Setting the option: 97031 97032 boost::asio::ip::udp::socket socket(my_context); 97033 ... 97034 boost::asio::ip::multicast::hops option(4); 97035 socket.set_option(option); 97036 97037 97038 97039 97040 97041Getting the current option value: 97042 97043 boost::asio::ip::udp::socket socket(my_context); 97044 ... 97045 boost::asio::ip::multicast::hops option; 97046 socket.get_option(option); 97047 int ttl = option.value(); 97048 97049 97050 97051 97052 97053 97054 97055[heading Requirements] 97056 97057['Header: ][^boost/asio/ip/multicast.hpp] 97058 97059['Convenience header: ][^boost/asio.hpp] 97060 97061 97062[endsect] 97063 97064 97065 97066[section:ip__multicast__join_group ip::multicast::join_group] 97067 97068[indexterm1 boost_asio.indexterm.ip__multicast__join_group..ip::multicast::join_group] 97069Socket option to join a multicast group on a specified interface. 97070 97071 97072 typedef implementation_defined join_group; 97073 97074 97075 97076Implements the IPPROTO\_IP/IP\_ADD\_MEMBERSHIP socket option. 97077 97078 97079[heading Examples] 97080 97081Setting the option to join a multicast group: 97082 97083 boost::asio::ip::udp::socket socket(my_context); 97084 ... 97085 boost::asio::ip::address multicast_address = 97086 boost::asio::ip::address::from_string("225.0.0.1"); 97087 boost::asio::ip::multicast::join_group option(multicast_address); 97088 socket.set_option(option); 97089 97090 97091 97092 97093 97094 97095 97096[heading Requirements] 97097 97098['Header: ][^boost/asio/ip/multicast.hpp] 97099 97100['Convenience header: ][^boost/asio.hpp] 97101 97102 97103[endsect] 97104 97105 97106 97107[section:ip__multicast__leave_group ip::multicast::leave_group] 97108 97109[indexterm1 boost_asio.indexterm.ip__multicast__leave_group..ip::multicast::leave_group] 97110Socket option to leave a multicast group on a specified interface. 97111 97112 97113 typedef implementation_defined leave_group; 97114 97115 97116 97117Implements the IPPROTO\_IP/IP\_DROP\_MEMBERSHIP socket option. 97118 97119 97120[heading Examples] 97121 97122Setting the option to leave a multicast group: 97123 97124 boost::asio::ip::udp::socket socket(my_context); 97125 ... 97126 boost::asio::ip::address multicast_address = 97127 boost::asio::ip::address::from_string("225.0.0.1"); 97128 boost::asio::ip::multicast::leave_group option(multicast_address); 97129 socket.set_option(option); 97130 97131 97132 97133 97134 97135 97136 97137[heading Requirements] 97138 97139['Header: ][^boost/asio/ip/multicast.hpp] 97140 97141['Convenience header: ][^boost/asio.hpp] 97142 97143 97144[endsect] 97145 97146 97147 97148[section:ip__multicast__outbound_interface ip::multicast::outbound_interface] 97149 97150[indexterm1 boost_asio.indexterm.ip__multicast__outbound_interface..ip::multicast::outbound_interface] 97151Socket option for local interface to use for outgoing multicast packets. 97152 97153 97154 typedef implementation_defined outbound_interface; 97155 97156 97157 97158Implements the IPPROTO\_IP/IP\_MULTICAST\_IF socket option. 97159 97160 97161[heading Examples] 97162 97163Setting the option: 97164 97165 boost::asio::ip::udp::socket socket(my_context); 97166 ... 97167 boost::asio::ip::address_v4 local_interface = 97168 boost::asio::ip::address_v4::from_string("1.2.3.4"); 97169 boost::asio::ip::multicast::outbound_interface option(local_interface); 97170 socket.set_option(option); 97171 97172 97173 97174 97175 97176 97177 97178[heading Requirements] 97179 97180['Header: ][^boost/asio/ip/multicast.hpp] 97181 97182['Convenience header: ][^boost/asio.hpp] 97183 97184 97185[endsect] 97186 97187 97188[section:ip__network_v4 ip::network_v4] 97189 97190[indexterm1 boost_asio.indexterm.ip__network_v4..ip::network_v4] 97191 97192 97193Represents an IPv4 network. 97194 97195 97196 class network_v4 97197 97198 97199[heading Member Functions] 97200[table 97201 [[Name][Description]] 97202 97203 [ 97204 [[link boost_asio.reference.ip__network_v4.address [*address]]] 97205 [Obtain the address object specified when the network object was created. ] 97206 ] 97207 97208 [ 97209 [[link boost_asio.reference.ip__network_v4.broadcast [*broadcast]]] 97210 [Obtain an address object that represents the network's broadcast address. ] 97211 ] 97212 97213 [ 97214 [[link boost_asio.reference.ip__network_v4.canonical [*canonical]]] 97215 [Obtain the true network address, omitting any host bits. ] 97216 ] 97217 97218 [ 97219 [[link boost_asio.reference.ip__network_v4.hosts [*hosts]]] 97220 [Obtain an address range corresponding to the hosts in the network. ] 97221 ] 97222 97223 [ 97224 [[link boost_asio.reference.ip__network_v4.is_host [*is_host]]] 97225 [Test if network is a valid host address. ] 97226 ] 97227 97228 [ 97229 [[link boost_asio.reference.ip__network_v4.is_subnet_of [*is_subnet_of]]] 97230 [Test if a network is a real subnet of another network. ] 97231 ] 97232 97233 [ 97234 [[link boost_asio.reference.ip__network_v4.netmask [*netmask]]] 97235 [Obtain the netmask that was specified when the network object was created. ] 97236 ] 97237 97238 [ 97239 [[link boost_asio.reference.ip__network_v4.network [*network]]] 97240 [Obtain an address object that represents the network address. ] 97241 ] 97242 97243 [ 97244 [[link boost_asio.reference.ip__network_v4.network_v4 [*network_v4]] [constructor]] 97245 [Default constructor. 97246 [hr] 97247 Construct a network based on the specified address and prefix length. 97248 [hr] 97249 Construct network based on the specified address and netmask. 97250 [hr] 97251 Copy constructor. ] 97252 ] 97253 97254 [ 97255 [[link boost_asio.reference.ip__network_v4.operator_eq_ [*operator=]]] 97256 [Assign from another network. ] 97257 ] 97258 97259 [ 97260 [[link boost_asio.reference.ip__network_v4.prefix_length [*prefix_length]]] 97261 [Obtain the prefix length that was specified when the network object was created. ] 97262 ] 97263 97264 [ 97265 [[link boost_asio.reference.ip__network_v4.to_string [*to_string]]] 97266 [Get the network as an address in dotted decimal format. ] 97267 ] 97268 97269] 97270 97271[heading Friends] 97272[table 97273 [[Name][Description]] 97274 97275 [ 97276 [[link boost_asio.reference.ip__network_v4.operator_not__eq_ [*operator!=]]] 97277 [Compare two networks for inequality. ] 97278 ] 97279 97280 [ 97281 [[link boost_asio.reference.ip__network_v4.operator_eq__eq_ [*operator==]]] 97282 [Compare two networks for equality. ] 97283 ] 97284 97285] 97286 97287[heading Related Functions] 97288[table 97289 [[Name][Description]] 97290 97291 [ 97292 [[link boost_asio.reference.ip__network_v4.make_network_v4 [*make_network_v4]]] 97293 [Create an IPv4 network from a string containing IP address and prefix length. ] 97294 ] 97295 97296] 97297 97298The [link boost_asio.reference.ip__network_v4 `ip::network_v4`] class provides the ability to use and manipulate IP version 4 networks. 97299 97300 97301[heading Thread Safety] 97302 97303['Distinct] ['objects:] Safe. 97304 97305['Shared] ['objects:] Unsafe. 97306 97307 97308 97309[heading Requirements] 97310 97311['Header: ][^boost/asio/ip/network_v4.hpp] 97312 97313['Convenience header: ][^boost/asio.hpp] 97314 97315 97316[section:address ip::network_v4::address] 97317 97318[indexterm2 boost_asio.indexterm.ip__network_v4.address..address..ip::network_v4] 97319Obtain the address object specified when the network object was created. 97320 97321 97322 address_v4 address() const; 97323 97324 97325 97326[endsect] 97327 97328 97329 97330[section:broadcast ip::network_v4::broadcast] 97331 97332[indexterm2 boost_asio.indexterm.ip__network_v4.broadcast..broadcast..ip::network_v4] 97333Obtain an address object that represents the network's broadcast address. 97334 97335 97336 address_v4 broadcast() const; 97337 97338 97339 97340[endsect] 97341 97342 97343 97344[section:canonical ip::network_v4::canonical] 97345 97346[indexterm2 boost_asio.indexterm.ip__network_v4.canonical..canonical..ip::network_v4] 97347Obtain the true network address, omitting any host bits. 97348 97349 97350 network_v4 canonical() const; 97351 97352 97353 97354[endsect] 97355 97356 97357 97358[section:hosts ip::network_v4::hosts] 97359 97360[indexterm2 boost_asio.indexterm.ip__network_v4.hosts..hosts..ip::network_v4] 97361Obtain an address range corresponding to the hosts in the network. 97362 97363 97364 address_v4_range hosts() const; 97365 97366 97367 97368[endsect] 97369 97370 97371 97372[section:is_host ip::network_v4::is_host] 97373 97374[indexterm2 boost_asio.indexterm.ip__network_v4.is_host..is_host..ip::network_v4] 97375Test if network is a valid host address. 97376 97377 97378 bool is_host() const; 97379 97380 97381 97382[endsect] 97383 97384 97385 97386[section:is_subnet_of ip::network_v4::is_subnet_of] 97387 97388[indexterm2 boost_asio.indexterm.ip__network_v4.is_subnet_of..is_subnet_of..ip::network_v4] 97389Test if a network is a real subnet of another network. 97390 97391 97392 bool is_subnet_of( 97393 const network_v4 & other) const; 97394 97395 97396 97397[endsect] 97398 97399 97400[section:make_network_v4 ip::network_v4::make_network_v4] 97401 97402[indexterm2 boost_asio.indexterm.ip__network_v4.make_network_v4..make_network_v4..ip::network_v4] 97403Create an IPv4 network from a string containing IP address and prefix length. 97404 97405 97406 network_v4 ``[link boost_asio.reference.ip__network_v4.make_network_v4.overload1 make_network_v4]``( 97407 const char * str); 97408 `` [''''»''' [link boost_asio.reference.ip__network_v4.make_network_v4.overload1 more...]]`` 97409 97410 network_v4 ``[link boost_asio.reference.ip__network_v4.make_network_v4.overload2 make_network_v4]``( 97411 const char * str, 97412 boost::system::error_code & ec); 97413 `` [''''»''' [link boost_asio.reference.ip__network_v4.make_network_v4.overload2 more...]]`` 97414 97415 network_v4 ``[link boost_asio.reference.ip__network_v4.make_network_v4.overload3 make_network_v4]``( 97416 const std::string & str); 97417 `` [''''»''' [link boost_asio.reference.ip__network_v4.make_network_v4.overload3 more...]]`` 97418 97419 network_v4 ``[link boost_asio.reference.ip__network_v4.make_network_v4.overload4 make_network_v4]``( 97420 const std::string & str, 97421 boost::system::error_code & ec); 97422 `` [''''»''' [link boost_asio.reference.ip__network_v4.make_network_v4.overload4 more...]]`` 97423 97424 network_v4 ``[link boost_asio.reference.ip__network_v4.make_network_v4.overload5 make_network_v4]``( 97425 string_view str); 97426 `` [''''»''' [link boost_asio.reference.ip__network_v4.make_network_v4.overload5 more...]]`` 97427 97428 network_v4 ``[link boost_asio.reference.ip__network_v4.make_network_v4.overload6 make_network_v4]``( 97429 string_view str, 97430 boost::system::error_code & ec); 97431 `` [''''»''' [link boost_asio.reference.ip__network_v4.make_network_v4.overload6 more...]]`` 97432 97433 97434[section:overload1 ip::network_v4::make_network_v4 (1 of 6 overloads)] 97435 97436 97437Create an IPv4 network from a string containing IP address and prefix length. 97438 97439 97440 network_v4 make_network_v4( 97441 const char * str); 97442 97443 97444 97445[endsect] 97446 97447 97448 97449[section:overload2 ip::network_v4::make_network_v4 (2 of 6 overloads)] 97450 97451 97452Create an IPv4 network from a string containing IP address and prefix length. 97453 97454 97455 network_v4 make_network_v4( 97456 const char * str, 97457 boost::system::error_code & ec); 97458 97459 97460 97461[endsect] 97462 97463 97464 97465[section:overload3 ip::network_v4::make_network_v4 (3 of 6 overloads)] 97466 97467 97468Create an IPv4 network from a string containing IP address and prefix length. 97469 97470 97471 network_v4 make_network_v4( 97472 const std::string & str); 97473 97474 97475 97476[endsect] 97477 97478 97479 97480[section:overload4 ip::network_v4::make_network_v4 (4 of 6 overloads)] 97481 97482 97483Create an IPv4 network from a string containing IP address and prefix length. 97484 97485 97486 network_v4 make_network_v4( 97487 const std::string & str, 97488 boost::system::error_code & ec); 97489 97490 97491 97492[endsect] 97493 97494 97495 97496[section:overload5 ip::network_v4::make_network_v4 (5 of 6 overloads)] 97497 97498 97499Create an IPv4 network from a string containing IP address and prefix length. 97500 97501 97502 network_v4 make_network_v4( 97503 string_view str); 97504 97505 97506 97507[endsect] 97508 97509 97510 97511[section:overload6 ip::network_v4::make_network_v4 (6 of 6 overloads)] 97512 97513 97514Create an IPv4 network from a string containing IP address and prefix length. 97515 97516 97517 network_v4 make_network_v4( 97518 string_view str, 97519 boost::system::error_code & ec); 97520 97521 97522 97523[endsect] 97524 97525 97526[endsect] 97527 97528 97529[section:netmask ip::network_v4::netmask] 97530 97531[indexterm2 boost_asio.indexterm.ip__network_v4.netmask..netmask..ip::network_v4] 97532Obtain the netmask that was specified when the network object was created. 97533 97534 97535 address_v4 netmask() const; 97536 97537 97538 97539[endsect] 97540 97541 97542 97543[section:network ip::network_v4::network] 97544 97545[indexterm2 boost_asio.indexterm.ip__network_v4.network..network..ip::network_v4] 97546Obtain an address object that represents the network address. 97547 97548 97549 address_v4 network() const; 97550 97551 97552 97553[endsect] 97554 97555 97556[section:network_v4 ip::network_v4::network_v4] 97557 97558[indexterm2 boost_asio.indexterm.ip__network_v4.network_v4..network_v4..ip::network_v4] 97559Default constructor. 97560 97561 97562 ``[link boost_asio.reference.ip__network_v4.network_v4.overload1 network_v4]``(); 97563 `` [''''»''' [link boost_asio.reference.ip__network_v4.network_v4.overload1 more...]]`` 97564 97565 97566Construct a network based on the specified address and prefix length. 97567 97568 97569 ``[link boost_asio.reference.ip__network_v4.network_v4.overload2 network_v4]``( 97570 const address_v4 & addr, 97571 unsigned short prefix_len); 97572 `` [''''»''' [link boost_asio.reference.ip__network_v4.network_v4.overload2 more...]]`` 97573 97574 97575Construct network based on the specified address and netmask. 97576 97577 97578 ``[link boost_asio.reference.ip__network_v4.network_v4.overload3 network_v4]``( 97579 const address_v4 & addr, 97580 const address_v4 & mask); 97581 `` [''''»''' [link boost_asio.reference.ip__network_v4.network_v4.overload3 more...]]`` 97582 97583 97584Copy constructor. 97585 97586 97587 ``[link boost_asio.reference.ip__network_v4.network_v4.overload4 network_v4]``( 97588 const network_v4 & other); 97589 `` [''''»''' [link boost_asio.reference.ip__network_v4.network_v4.overload4 more...]]`` 97590 97591 97592[section:overload1 ip::network_v4::network_v4 (1 of 4 overloads)] 97593 97594 97595Default constructor. 97596 97597 97598 network_v4(); 97599 97600 97601 97602[endsect] 97603 97604 97605 97606[section:overload2 ip::network_v4::network_v4 (2 of 4 overloads)] 97607 97608 97609Construct a network based on the specified address and prefix length. 97610 97611 97612 network_v4( 97613 const address_v4 & addr, 97614 unsigned short prefix_len); 97615 97616 97617 97618[endsect] 97619 97620 97621 97622[section:overload3 ip::network_v4::network_v4 (3 of 4 overloads)] 97623 97624 97625Construct network based on the specified address and netmask. 97626 97627 97628 network_v4( 97629 const address_v4 & addr, 97630 const address_v4 & mask); 97631 97632 97633 97634[endsect] 97635 97636 97637 97638[section:overload4 ip::network_v4::network_v4 (4 of 4 overloads)] 97639 97640 97641Copy constructor. 97642 97643 97644 network_v4( 97645 const network_v4 & other); 97646 97647 97648 97649[endsect] 97650 97651 97652[endsect] 97653 97654 97655[section:operator_not__eq_ ip::network_v4::operator!=] 97656 97657[indexterm2 boost_asio.indexterm.ip__network_v4.operator_not__eq_..operator!=..ip::network_v4] 97658Compare two networks for inequality. 97659 97660 97661 friend bool operator!=( 97662 const network_v4 & a, 97663 const network_v4 & b); 97664 97665 97666[heading Requirements] 97667 97668['Header: ][^boost/asio/ip/network_v4.hpp] 97669 97670['Convenience header: ][^boost/asio.hpp] 97671 97672 97673[endsect] 97674 97675 97676 97677[section:operator_eq_ ip::network_v4::operator=] 97678 97679[indexterm2 boost_asio.indexterm.ip__network_v4.operator_eq_..operator=..ip::network_v4] 97680Assign from another network. 97681 97682 97683 network_v4 & operator=( 97684 const network_v4 & other); 97685 97686 97687 97688[endsect] 97689 97690 97691 97692[section:operator_eq__eq_ ip::network_v4::operator==] 97693 97694[indexterm2 boost_asio.indexterm.ip__network_v4.operator_eq__eq_..operator==..ip::network_v4] 97695Compare two networks for equality. 97696 97697 97698 friend bool operator==( 97699 const network_v4 & a, 97700 const network_v4 & b); 97701 97702 97703[heading Requirements] 97704 97705['Header: ][^boost/asio/ip/network_v4.hpp] 97706 97707['Convenience header: ][^boost/asio.hpp] 97708 97709 97710[endsect] 97711 97712 97713 97714[section:prefix_length ip::network_v4::prefix_length] 97715 97716[indexterm2 boost_asio.indexterm.ip__network_v4.prefix_length..prefix_length..ip::network_v4] 97717Obtain the prefix length that was specified when the network object was created. 97718 97719 97720 unsigned short prefix_length() const; 97721 97722 97723 97724[endsect] 97725 97726 97727[section:to_string ip::network_v4::to_string] 97728 97729[indexterm2 boost_asio.indexterm.ip__network_v4.to_string..to_string..ip::network_v4] 97730Get the network as an address in dotted decimal format. 97731 97732 97733 std::string ``[link boost_asio.reference.ip__network_v4.to_string.overload1 to_string]``() const; 97734 `` [''''»''' [link boost_asio.reference.ip__network_v4.to_string.overload1 more...]]`` 97735 97736 std::string ``[link boost_asio.reference.ip__network_v4.to_string.overload2 to_string]``( 97737 boost::system::error_code & ec) const; 97738 `` [''''»''' [link boost_asio.reference.ip__network_v4.to_string.overload2 more...]]`` 97739 97740 97741[section:overload1 ip::network_v4::to_string (1 of 2 overloads)] 97742 97743 97744Get the network as an address in dotted decimal format. 97745 97746 97747 std::string to_string() const; 97748 97749 97750 97751[endsect] 97752 97753 97754 97755[section:overload2 ip::network_v4::to_string (2 of 2 overloads)] 97756 97757 97758Get the network as an address in dotted decimal format. 97759 97760 97761 std::string to_string( 97762 boost::system::error_code & ec) const; 97763 97764 97765 97766[endsect] 97767 97768 97769[endsect] 97770 97771 97772[endsect] 97773 97774[section:ip__network_v6 ip::network_v6] 97775 97776[indexterm1 boost_asio.indexterm.ip__network_v6..ip::network_v6] 97777 97778 97779Represents an IPv6 network. 97780 97781 97782 class network_v6 97783 97784 97785[heading Member Functions] 97786[table 97787 [[Name][Description]] 97788 97789 [ 97790 [[link boost_asio.reference.ip__network_v6.address [*address]]] 97791 [Obtain the address object specified when the network object was created. ] 97792 ] 97793 97794 [ 97795 [[link boost_asio.reference.ip__network_v6.canonical [*canonical]]] 97796 [Obtain the true network address, omitting any host bits. ] 97797 ] 97798 97799 [ 97800 [[link boost_asio.reference.ip__network_v6.hosts [*hosts]]] 97801 [Obtain an address range corresponding to the hosts in the network. ] 97802 ] 97803 97804 [ 97805 [[link boost_asio.reference.ip__network_v6.is_host [*is_host]]] 97806 [Test if network is a valid host address. ] 97807 ] 97808 97809 [ 97810 [[link boost_asio.reference.ip__network_v6.is_subnet_of [*is_subnet_of]]] 97811 [Test if a network is a real subnet of another network. ] 97812 ] 97813 97814 [ 97815 [[link boost_asio.reference.ip__network_v6.network [*network]]] 97816 [Obtain an address object that represents the network address. ] 97817 ] 97818 97819 [ 97820 [[link boost_asio.reference.ip__network_v6.network_v6 [*network_v6]] [constructor]] 97821 [Default constructor. 97822 [hr] 97823 Construct a network based on the specified address and prefix length. 97824 [hr] 97825 Copy constructor. ] 97826 ] 97827 97828 [ 97829 [[link boost_asio.reference.ip__network_v6.operator_eq_ [*operator=]]] 97830 [Assign from another network. ] 97831 ] 97832 97833 [ 97834 [[link boost_asio.reference.ip__network_v6.prefix_length [*prefix_length]]] 97835 [Obtain the prefix length that was specified when the network object was created. ] 97836 ] 97837 97838 [ 97839 [[link boost_asio.reference.ip__network_v6.to_string [*to_string]]] 97840 [Get the network as an address in dotted decimal format. ] 97841 ] 97842 97843] 97844 97845[heading Friends] 97846[table 97847 [[Name][Description]] 97848 97849 [ 97850 [[link boost_asio.reference.ip__network_v6.operator_not__eq_ [*operator!=]]] 97851 [Compare two networks for inequality. ] 97852 ] 97853 97854 [ 97855 [[link boost_asio.reference.ip__network_v6.operator_eq__eq_ [*operator==]]] 97856 [Compare two networks for equality. ] 97857 ] 97858 97859] 97860 97861[heading Related Functions] 97862[table 97863 [[Name][Description]] 97864 97865 [ 97866 [[link boost_asio.reference.ip__network_v6.make_network_v6 [*make_network_v6]]] 97867 [Create an IPv6 network from a string containing IP address and prefix length. ] 97868 ] 97869 97870] 97871 97872The [link boost_asio.reference.ip__network_v6 `ip::network_v6`] class provides the ability to use and manipulate IP version 6 networks. 97873 97874 97875[heading Thread Safety] 97876 97877['Distinct] ['objects:] Safe. 97878 97879['Shared] ['objects:] Unsafe. 97880 97881 97882 97883[heading Requirements] 97884 97885['Header: ][^boost/asio/ip/network_v6.hpp] 97886 97887['Convenience header: ][^boost/asio.hpp] 97888 97889 97890[section:address ip::network_v6::address] 97891 97892[indexterm2 boost_asio.indexterm.ip__network_v6.address..address..ip::network_v6] 97893Obtain the address object specified when the network object was created. 97894 97895 97896 address_v6 address() const; 97897 97898 97899 97900[endsect] 97901 97902 97903 97904[section:canonical ip::network_v6::canonical] 97905 97906[indexterm2 boost_asio.indexterm.ip__network_v6.canonical..canonical..ip::network_v6] 97907Obtain the true network address, omitting any host bits. 97908 97909 97910 network_v6 canonical() const; 97911 97912 97913 97914[endsect] 97915 97916 97917 97918[section:hosts ip::network_v6::hosts] 97919 97920[indexterm2 boost_asio.indexterm.ip__network_v6.hosts..hosts..ip::network_v6] 97921Obtain an address range corresponding to the hosts in the network. 97922 97923 97924 address_v6_range hosts() const; 97925 97926 97927 97928[endsect] 97929 97930 97931 97932[section:is_host ip::network_v6::is_host] 97933 97934[indexterm2 boost_asio.indexterm.ip__network_v6.is_host..is_host..ip::network_v6] 97935Test if network is a valid host address. 97936 97937 97938 bool is_host() const; 97939 97940 97941 97942[endsect] 97943 97944 97945 97946[section:is_subnet_of ip::network_v6::is_subnet_of] 97947 97948[indexterm2 boost_asio.indexterm.ip__network_v6.is_subnet_of..is_subnet_of..ip::network_v6] 97949Test if a network is a real subnet of another network. 97950 97951 97952 bool is_subnet_of( 97953 const network_v6 & other) const; 97954 97955 97956 97957[endsect] 97958 97959 97960[section:make_network_v6 ip::network_v6::make_network_v6] 97961 97962[indexterm2 boost_asio.indexterm.ip__network_v6.make_network_v6..make_network_v6..ip::network_v6] 97963Create an IPv6 network from a string containing IP address and prefix length. 97964 97965 97966 network_v6 ``[link boost_asio.reference.ip__network_v6.make_network_v6.overload1 make_network_v6]``( 97967 const char * str); 97968 `` [''''»''' [link boost_asio.reference.ip__network_v6.make_network_v6.overload1 more...]]`` 97969 97970 network_v6 ``[link boost_asio.reference.ip__network_v6.make_network_v6.overload2 make_network_v6]``( 97971 const char * str, 97972 boost::system::error_code & ec); 97973 `` [''''»''' [link boost_asio.reference.ip__network_v6.make_network_v6.overload2 more...]]`` 97974 97975 network_v6 ``[link boost_asio.reference.ip__network_v6.make_network_v6.overload3 make_network_v6]``( 97976 const std::string & str); 97977 `` [''''»''' [link boost_asio.reference.ip__network_v6.make_network_v6.overload3 more...]]`` 97978 97979 network_v6 ``[link boost_asio.reference.ip__network_v6.make_network_v6.overload4 make_network_v6]``( 97980 const std::string & str, 97981 boost::system::error_code & ec); 97982 `` [''''»''' [link boost_asio.reference.ip__network_v6.make_network_v6.overload4 more...]]`` 97983 97984 network_v6 ``[link boost_asio.reference.ip__network_v6.make_network_v6.overload5 make_network_v6]``( 97985 string_view str); 97986 `` [''''»''' [link boost_asio.reference.ip__network_v6.make_network_v6.overload5 more...]]`` 97987 97988 network_v6 ``[link boost_asio.reference.ip__network_v6.make_network_v6.overload6 make_network_v6]``( 97989 string_view str, 97990 boost::system::error_code & ec); 97991 `` [''''»''' [link boost_asio.reference.ip__network_v6.make_network_v6.overload6 more...]]`` 97992 97993 97994[section:overload1 ip::network_v6::make_network_v6 (1 of 6 overloads)] 97995 97996 97997Create an IPv6 network from a string containing IP address and prefix length. 97998 97999 98000 network_v6 make_network_v6( 98001 const char * str); 98002 98003 98004 98005[endsect] 98006 98007 98008 98009[section:overload2 ip::network_v6::make_network_v6 (2 of 6 overloads)] 98010 98011 98012Create an IPv6 network from a string containing IP address and prefix length. 98013 98014 98015 network_v6 make_network_v6( 98016 const char * str, 98017 boost::system::error_code & ec); 98018 98019 98020 98021[endsect] 98022 98023 98024 98025[section:overload3 ip::network_v6::make_network_v6 (3 of 6 overloads)] 98026 98027 98028Create an IPv6 network from a string containing IP address and prefix length. 98029 98030 98031 network_v6 make_network_v6( 98032 const std::string & str); 98033 98034 98035 98036[endsect] 98037 98038 98039 98040[section:overload4 ip::network_v6::make_network_v6 (4 of 6 overloads)] 98041 98042 98043Create an IPv6 network from a string containing IP address and prefix length. 98044 98045 98046 network_v6 make_network_v6( 98047 const std::string & str, 98048 boost::system::error_code & ec); 98049 98050 98051 98052[endsect] 98053 98054 98055 98056[section:overload5 ip::network_v6::make_network_v6 (5 of 6 overloads)] 98057 98058 98059Create an IPv6 network from a string containing IP address and prefix length. 98060 98061 98062 network_v6 make_network_v6( 98063 string_view str); 98064 98065 98066 98067[endsect] 98068 98069 98070 98071[section:overload6 ip::network_v6::make_network_v6 (6 of 6 overloads)] 98072 98073 98074Create an IPv6 network from a string containing IP address and prefix length. 98075 98076 98077 network_v6 make_network_v6( 98078 string_view str, 98079 boost::system::error_code & ec); 98080 98081 98082 98083[endsect] 98084 98085 98086[endsect] 98087 98088 98089[section:network ip::network_v6::network] 98090 98091[indexterm2 boost_asio.indexterm.ip__network_v6.network..network..ip::network_v6] 98092Obtain an address object that represents the network address. 98093 98094 98095 address_v6 network() const; 98096 98097 98098 98099[endsect] 98100 98101 98102[section:network_v6 ip::network_v6::network_v6] 98103 98104[indexterm2 boost_asio.indexterm.ip__network_v6.network_v6..network_v6..ip::network_v6] 98105Default constructor. 98106 98107 98108 ``[link boost_asio.reference.ip__network_v6.network_v6.overload1 network_v6]``(); 98109 `` [''''»''' [link boost_asio.reference.ip__network_v6.network_v6.overload1 more...]]`` 98110 98111 98112Construct a network based on the specified address and prefix length. 98113 98114 98115 ``[link boost_asio.reference.ip__network_v6.network_v6.overload2 network_v6]``( 98116 const address_v6 & addr, 98117 unsigned short prefix_len); 98118 `` [''''»''' [link boost_asio.reference.ip__network_v6.network_v6.overload2 more...]]`` 98119 98120 98121Copy constructor. 98122 98123 98124 ``[link boost_asio.reference.ip__network_v6.network_v6.overload3 network_v6]``( 98125 const network_v6 & other); 98126 `` [''''»''' [link boost_asio.reference.ip__network_v6.network_v6.overload3 more...]]`` 98127 98128 98129[section:overload1 ip::network_v6::network_v6 (1 of 3 overloads)] 98130 98131 98132Default constructor. 98133 98134 98135 network_v6(); 98136 98137 98138 98139[endsect] 98140 98141 98142 98143[section:overload2 ip::network_v6::network_v6 (2 of 3 overloads)] 98144 98145 98146Construct a network based on the specified address and prefix length. 98147 98148 98149 network_v6( 98150 const address_v6 & addr, 98151 unsigned short prefix_len); 98152 98153 98154 98155[endsect] 98156 98157 98158 98159[section:overload3 ip::network_v6::network_v6 (3 of 3 overloads)] 98160 98161 98162Copy constructor. 98163 98164 98165 network_v6( 98166 const network_v6 & other); 98167 98168 98169 98170[endsect] 98171 98172 98173[endsect] 98174 98175 98176[section:operator_not__eq_ ip::network_v6::operator!=] 98177 98178[indexterm2 boost_asio.indexterm.ip__network_v6.operator_not__eq_..operator!=..ip::network_v6] 98179Compare two networks for inequality. 98180 98181 98182 friend bool operator!=( 98183 const network_v6 & a, 98184 const network_v6 & b); 98185 98186 98187[heading Requirements] 98188 98189['Header: ][^boost/asio/ip/network_v6.hpp] 98190 98191['Convenience header: ][^boost/asio.hpp] 98192 98193 98194[endsect] 98195 98196 98197 98198[section:operator_eq_ ip::network_v6::operator=] 98199 98200[indexterm2 boost_asio.indexterm.ip__network_v6.operator_eq_..operator=..ip::network_v6] 98201Assign from another network. 98202 98203 98204 network_v6 & operator=( 98205 const network_v6 & other); 98206 98207 98208 98209[endsect] 98210 98211 98212 98213[section:operator_eq__eq_ ip::network_v6::operator==] 98214 98215[indexterm2 boost_asio.indexterm.ip__network_v6.operator_eq__eq_..operator==..ip::network_v6] 98216Compare two networks for equality. 98217 98218 98219 friend bool operator==( 98220 const network_v6 & a, 98221 const network_v6 & b); 98222 98223 98224[heading Requirements] 98225 98226['Header: ][^boost/asio/ip/network_v6.hpp] 98227 98228['Convenience header: ][^boost/asio.hpp] 98229 98230 98231[endsect] 98232 98233 98234 98235[section:prefix_length ip::network_v6::prefix_length] 98236 98237[indexterm2 boost_asio.indexterm.ip__network_v6.prefix_length..prefix_length..ip::network_v6] 98238Obtain the prefix length that was specified when the network object was created. 98239 98240 98241 unsigned short prefix_length() const; 98242 98243 98244 98245[endsect] 98246 98247 98248[section:to_string ip::network_v6::to_string] 98249 98250[indexterm2 boost_asio.indexterm.ip__network_v6.to_string..to_string..ip::network_v6] 98251Get the network as an address in dotted decimal format. 98252 98253 98254 std::string ``[link boost_asio.reference.ip__network_v6.to_string.overload1 to_string]``() const; 98255 `` [''''»''' [link boost_asio.reference.ip__network_v6.to_string.overload1 more...]]`` 98256 98257 std::string ``[link boost_asio.reference.ip__network_v6.to_string.overload2 to_string]``( 98258 boost::system::error_code & ec) const; 98259 `` [''''»''' [link boost_asio.reference.ip__network_v6.to_string.overload2 more...]]`` 98260 98261 98262[section:overload1 ip::network_v6::to_string (1 of 2 overloads)] 98263 98264 98265Get the network as an address in dotted decimal format. 98266 98267 98268 std::string to_string() const; 98269 98270 98271 98272[endsect] 98273 98274 98275 98276[section:overload2 ip::network_v6::to_string (2 of 2 overloads)] 98277 98278 98279Get the network as an address in dotted decimal format. 98280 98281 98282 std::string to_string( 98283 boost::system::error_code & ec) const; 98284 98285 98286 98287[endsect] 98288 98289 98290[endsect] 98291 98292 98293[endsect] 98294 98295 98296[section:ip__port_type ip::port_type] 98297 98298[indexterm1 boost_asio.indexterm.ip__port_type..ip::port_type] 98299Type used for storing port numbers. 98300 98301 98302 typedef uint_least16_t port_type; 98303 98304 98305 98306[heading Requirements] 98307 98308['Header: ][^boost/asio/ip/basic_endpoint.hpp] 98309 98310['Convenience header: ][^boost/asio.hpp] 98311 98312 98313[endsect] 98314 98315 98316[section:ip__resolver_base ip::resolver_base] 98317 98318[indexterm1 boost_asio.indexterm.ip__resolver_base..ip::resolver_base] 98319 98320 98321The [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. 98322 98323 98324 class resolver_base 98325 98326 98327[heading Types] 98328[table 98329 [[Name][Description]] 98330 98331 [ 98332 98333 [[link boost_asio.reference.ip__resolver_base.flags [*flags]]] 98334 [A bitmask type (C++ Std \[lib.bitmask.types\]). ] 98335 98336 ] 98337 98338] 98339 98340[heading Protected Member Functions] 98341[table 98342 [[Name][Description]] 98343 98344 [ 98345 [[link boost_asio.reference.ip__resolver_base._resolver_base [*~resolver_base]] [destructor]] 98346 [Protected destructor to prevent deletion through this type. ] 98347 ] 98348 98349] 98350 98351[heading Data Members] 98352[table 98353 [[Name][Description]] 98354 98355 [ 98356 [[link boost_asio.reference.ip__resolver_base.address_configured [*address_configured]] [static]] 98357 [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. ] 98358 ] 98359 98360 [ 98361 [[link boost_asio.reference.ip__resolver_base.all_matching [*all_matching]] [static]] 98362 [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ] 98363 ] 98364 98365 [ 98366 [[link boost_asio.reference.ip__resolver_base.canonical_name [*canonical_name]] [static]] 98367 [Determine the canonical name of the host specified in the query. ] 98368 ] 98369 98370 [ 98371 [[link boost_asio.reference.ip__resolver_base.numeric_host [*numeric_host]] [static]] 98372 [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ] 98373 ] 98374 98375 [ 98376 [[link boost_asio.reference.ip__resolver_base.numeric_service [*numeric_service]] [static]] 98377 [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ] 98378 ] 98379 98380 [ 98381 [[link boost_asio.reference.ip__resolver_base.passive [*passive]] [static]] 98382 [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ] 98383 ] 98384 98385 [ 98386 [[link boost_asio.reference.ip__resolver_base.v4_mapped [*v4_mapped]] [static]] 98387 [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ] 98388 ] 98389 98390] 98391 98392[heading Requirements] 98393 98394['Header: ][^boost/asio/ip/resolver_base.hpp] 98395 98396['Convenience header: ][^boost/asio.hpp] 98397 98398 98399[section:address_configured ip::resolver_base::address_configured] 98400 98401[indexterm2 boost_asio.indexterm.ip__resolver_base.address_configured..address_configured..ip::resolver_base] 98402Only 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. 98403 98404 98405 static const flags address_configured = implementation_defined; 98406 98407 98408 98409[endsect] 98410 98411 98412 98413[section:all_matching ip::resolver_base::all_matching] 98414 98415[indexterm2 boost_asio.indexterm.ip__resolver_base.all_matching..all_matching..ip::resolver_base] 98416If used with v4\_mapped, return all matching IPv6 and IPv4 addresses. 98417 98418 98419 static const flags all_matching = implementation_defined; 98420 98421 98422 98423[endsect] 98424 98425 98426 98427[section:canonical_name ip::resolver_base::canonical_name] 98428 98429[indexterm2 boost_asio.indexterm.ip__resolver_base.canonical_name..canonical_name..ip::resolver_base] 98430Determine the canonical name of the host specified in the query. 98431 98432 98433 static const flags canonical_name = implementation_defined; 98434 98435 98436 98437[endsect] 98438 98439 98440 98441[section:flags ip::resolver_base::flags] 98442 98443[indexterm2 boost_asio.indexterm.ip__resolver_base.flags..flags..ip::resolver_base] 98444A bitmask type (C++ Std [lib.bitmask.types]). 98445 98446 98447 typedef unspecified flags; 98448 98449 98450 98451[heading Requirements] 98452 98453['Header: ][^boost/asio/ip/resolver_base.hpp] 98454 98455['Convenience header: ][^boost/asio.hpp] 98456 98457 98458[endsect] 98459 98460 98461 98462[section:numeric_host ip::resolver_base::numeric_host] 98463 98464[indexterm2 boost_asio.indexterm.ip__resolver_base.numeric_host..numeric_host..ip::resolver_base] 98465Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. 98466 98467 98468 static const flags numeric_host = implementation_defined; 98469 98470 98471 98472[endsect] 98473 98474 98475 98476[section:numeric_service ip::resolver_base::numeric_service] 98477 98478[indexterm2 boost_asio.indexterm.ip__resolver_base.numeric_service..numeric_service..ip::resolver_base] 98479Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. 98480 98481 98482 static const flags numeric_service = implementation_defined; 98483 98484 98485 98486[endsect] 98487 98488 98489 98490[section:passive ip::resolver_base::passive] 98491 98492[indexterm2 boost_asio.indexterm.ip__resolver_base.passive..passive..ip::resolver_base] 98493Indicate that returned endpoint is intended for use as a locally bound socket endpoint. 98494 98495 98496 static const flags passive = implementation_defined; 98497 98498 98499 98500[endsect] 98501 98502 98503 98504[section:v4_mapped ip::resolver_base::v4_mapped] 98505 98506[indexterm2 boost_asio.indexterm.ip__resolver_base.v4_mapped..v4_mapped..ip::resolver_base] 98507If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. 98508 98509 98510 static const flags v4_mapped = implementation_defined; 98511 98512 98513 98514[endsect] 98515 98516 98517 98518[section:_resolver_base ip::resolver_base::~resolver_base] 98519 98520[indexterm2 boost_asio.indexterm.ip__resolver_base._resolver_base..~resolver_base..ip::resolver_base] 98521Protected destructor to prevent deletion through this type. 98522 98523 98524 ~resolver_base(); 98525 98526 98527 98528[endsect] 98529 98530 98531 98532[endsect] 98533 98534[section:ip__resolver_query_base ip::resolver_query_base] 98535 98536[indexterm1 boost_asio.indexterm.ip__resolver_query_base..ip::resolver_query_base] 98537 98538 98539The [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. 98540 98541 98542 class resolver_query_base : 98543 public ip::resolver_base 98544 98545 98546[heading Types] 98547[table 98548 [[Name][Description]] 98549 98550 [ 98551 98552 [[link boost_asio.reference.ip__resolver_query_base.flags [*flags]]] 98553 [A bitmask type (C++ Std \[lib.bitmask.types\]). ] 98554 98555 ] 98556 98557] 98558 98559[heading Protected Member Functions] 98560[table 98561 [[Name][Description]] 98562 98563 [ 98564 [[link boost_asio.reference.ip__resolver_query_base._resolver_query_base [*~resolver_query_base]] [destructor]] 98565 [Protected destructor to prevent deletion through this type. ] 98566 ] 98567 98568] 98569 98570[heading Data Members] 98571[table 98572 [[Name][Description]] 98573 98574 [ 98575 [[link boost_asio.reference.ip__resolver_query_base.address_configured [*address_configured]] [static]] 98576 [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. ] 98577 ] 98578 98579 [ 98580 [[link boost_asio.reference.ip__resolver_query_base.all_matching [*all_matching]] [static]] 98581 [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ] 98582 ] 98583 98584 [ 98585 [[link boost_asio.reference.ip__resolver_query_base.canonical_name [*canonical_name]] [static]] 98586 [Determine the canonical name of the host specified in the query. ] 98587 ] 98588 98589 [ 98590 [[link boost_asio.reference.ip__resolver_query_base.numeric_host [*numeric_host]] [static]] 98591 [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ] 98592 ] 98593 98594 [ 98595 [[link boost_asio.reference.ip__resolver_query_base.numeric_service [*numeric_service]] [static]] 98596 [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ] 98597 ] 98598 98599 [ 98600 [[link boost_asio.reference.ip__resolver_query_base.passive [*passive]] [static]] 98601 [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ] 98602 ] 98603 98604 [ 98605 [[link boost_asio.reference.ip__resolver_query_base.v4_mapped [*v4_mapped]] [static]] 98606 [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ] 98607 ] 98608 98609] 98610 98611[heading Requirements] 98612 98613['Header: ][^boost/asio/ip/resolver_query_base.hpp] 98614 98615['Convenience header: ][^boost/asio.hpp] 98616 98617 98618[section:address_configured ip::resolver_query_base::address_configured] 98619 98620 98621['Inherited from ip::resolver_base.] 98622 98623[indexterm2 boost_asio.indexterm.ip__resolver_query_base.address_configured..address_configured..ip::resolver_query_base] 98624Only 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. 98625 98626 98627 static const flags address_configured = implementation_defined; 98628 98629 98630 98631[endsect] 98632 98633 98634 98635[section:all_matching ip::resolver_query_base::all_matching] 98636 98637 98638['Inherited from ip::resolver_base.] 98639 98640[indexterm2 boost_asio.indexterm.ip__resolver_query_base.all_matching..all_matching..ip::resolver_query_base] 98641If used with v4\_mapped, return all matching IPv6 and IPv4 addresses. 98642 98643 98644 static const flags all_matching = implementation_defined; 98645 98646 98647 98648[endsect] 98649 98650 98651 98652[section:canonical_name ip::resolver_query_base::canonical_name] 98653 98654 98655['Inherited from ip::resolver_base.] 98656 98657[indexterm2 boost_asio.indexterm.ip__resolver_query_base.canonical_name..canonical_name..ip::resolver_query_base] 98658Determine the canonical name of the host specified in the query. 98659 98660 98661 static const flags canonical_name = implementation_defined; 98662 98663 98664 98665[endsect] 98666 98667 98668 98669[section:flags ip::resolver_query_base::flags] 98670 98671 98672['Inherited from ip::resolver_base.] 98673 98674[indexterm2 boost_asio.indexterm.ip__resolver_query_base.flags..flags..ip::resolver_query_base] 98675A bitmask type (C++ Std [lib.bitmask.types]). 98676 98677 98678 typedef unspecified flags; 98679 98680 98681 98682[heading Requirements] 98683 98684['Header: ][^boost/asio/ip/resolver_query_base.hpp] 98685 98686['Convenience header: ][^boost/asio.hpp] 98687 98688 98689[endsect] 98690 98691 98692 98693[section:numeric_host ip::resolver_query_base::numeric_host] 98694 98695 98696['Inherited from ip::resolver_base.] 98697 98698[indexterm2 boost_asio.indexterm.ip__resolver_query_base.numeric_host..numeric_host..ip::resolver_query_base] 98699Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. 98700 98701 98702 static const flags numeric_host = implementation_defined; 98703 98704 98705 98706[endsect] 98707 98708 98709 98710[section:numeric_service ip::resolver_query_base::numeric_service] 98711 98712 98713['Inherited from ip::resolver_base.] 98714 98715[indexterm2 boost_asio.indexterm.ip__resolver_query_base.numeric_service..numeric_service..ip::resolver_query_base] 98716Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. 98717 98718 98719 static const flags numeric_service = implementation_defined; 98720 98721 98722 98723[endsect] 98724 98725 98726 98727[section:passive ip::resolver_query_base::passive] 98728 98729 98730['Inherited from ip::resolver_base.] 98731 98732[indexterm2 boost_asio.indexterm.ip__resolver_query_base.passive..passive..ip::resolver_query_base] 98733Indicate that returned endpoint is intended for use as a locally bound socket endpoint. 98734 98735 98736 static const flags passive = implementation_defined; 98737 98738 98739 98740[endsect] 98741 98742 98743 98744[section:v4_mapped ip::resolver_query_base::v4_mapped] 98745 98746 98747['Inherited from ip::resolver_base.] 98748 98749[indexterm2 boost_asio.indexterm.ip__resolver_query_base.v4_mapped..v4_mapped..ip::resolver_query_base] 98750If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. 98751 98752 98753 static const flags v4_mapped = implementation_defined; 98754 98755 98756 98757[endsect] 98758 98759 98760 98761[section:_resolver_query_base ip::resolver_query_base::~resolver_query_base] 98762 98763[indexterm2 boost_asio.indexterm.ip__resolver_query_base._resolver_query_base..~resolver_query_base..ip::resolver_query_base] 98764Protected destructor to prevent deletion through this type. 98765 98766 98767 ~resolver_query_base(); 98768 98769 98770 98771[endsect] 98772 98773 98774 98775[endsect] 98776 98777 98778[section:ip__scope_id_type ip::scope_id_type] 98779 98780[indexterm1 boost_asio.indexterm.ip__scope_id_type..ip::scope_id_type] 98781Type used for storing IPv6 scope IDs. 98782 98783 98784 typedef uint_least32_t scope_id_type; 98785 98786 98787 98788[heading Requirements] 98789 98790['Header: ][^boost/asio/ip/address_v6.hpp] 98791 98792['Convenience header: ][^boost/asio.hpp] 98793 98794 98795[endsect] 98796 98797 98798[section:ip__tcp ip::tcp] 98799 98800[indexterm1 boost_asio.indexterm.ip__tcp..ip::tcp] 98801 98802 98803Encapsulates the flags needed for TCP. 98804 98805 98806 class tcp 98807 98808 98809[heading Types] 98810[table 98811 [[Name][Description]] 98812 98813 [ 98814 98815 [[link boost_asio.reference.ip__tcp.acceptor [*acceptor]]] 98816 [The TCP acceptor type. ] 98817 98818 ] 98819 98820 [ 98821 98822 [[link boost_asio.reference.ip__tcp.endpoint [*endpoint]]] 98823 [The type of a TCP endpoint. ] 98824 98825 ] 98826 98827 [ 98828 98829 [[link boost_asio.reference.ip__tcp.iostream [*iostream]]] 98830 [The TCP iostream type. ] 98831 98832 ] 98833 98834 [ 98835 98836 [[link boost_asio.reference.ip__tcp.no_delay [*no_delay]]] 98837 [Socket option for disabling the Nagle algorithm. ] 98838 98839 ] 98840 98841 [ 98842 98843 [[link boost_asio.reference.ip__tcp.resolver [*resolver]]] 98844 [The TCP resolver type. ] 98845 98846 ] 98847 98848 [ 98849 98850 [[link boost_asio.reference.ip__tcp.socket [*socket]]] 98851 [The TCP socket type. ] 98852 98853 ] 98854 98855] 98856 98857[heading Member Functions] 98858[table 98859 [[Name][Description]] 98860 98861 [ 98862 [[link boost_asio.reference.ip__tcp.family [*family]]] 98863 [Obtain an identifier for the protocol family. ] 98864 ] 98865 98866 [ 98867 [[link boost_asio.reference.ip__tcp.protocol [*protocol]]] 98868 [Obtain an identifier for the protocol. ] 98869 ] 98870 98871 [ 98872 [[link boost_asio.reference.ip__tcp.type [*type]]] 98873 [Obtain an identifier for the type of the protocol. ] 98874 ] 98875 98876 [ 98877 [[link boost_asio.reference.ip__tcp.v4 [*v4]] [static]] 98878 [Construct to represent the IPv4 TCP protocol. ] 98879 ] 98880 98881 [ 98882 [[link boost_asio.reference.ip__tcp.v6 [*v6]] [static]] 98883 [Construct to represent the IPv6 TCP protocol. ] 98884 ] 98885 98886] 98887 98888[heading Friends] 98889[table 98890 [[Name][Description]] 98891 98892 [ 98893 [[link boost_asio.reference.ip__tcp.operator_not__eq_ [*operator!=]]] 98894 [Compare two protocols for inequality. ] 98895 ] 98896 98897 [ 98898 [[link boost_asio.reference.ip__tcp.operator_eq__eq_ [*operator==]]] 98899 [Compare two protocols for equality. ] 98900 ] 98901 98902] 98903 98904The [link boost_asio.reference.ip__tcp `ip::tcp`] class contains flags necessary for TCP sockets. 98905 98906 98907[heading Thread Safety] 98908 98909['Distinct] ['objects:] Safe. 98910 98911['Shared] ['objects:] Safe. 98912 98913 98914 98915 98916[heading Requirements] 98917 98918['Header: ][^boost/asio/ip/tcp.hpp] 98919 98920['Convenience header: ][^boost/asio.hpp] 98921 98922 98923[section:acceptor ip::tcp::acceptor] 98924 98925[indexterm2 boost_asio.indexterm.ip__tcp.acceptor..acceptor..ip::tcp] 98926The TCP acceptor type. 98927 98928 98929 typedef basic_socket_acceptor< tcp > acceptor; 98930 98931 98932[heading Types] 98933[table 98934 [[Name][Description]] 98935 98936 [ 98937 98938 [[link boost_asio.reference.basic_socket_acceptor__rebind_executor [*rebind_executor]]] 98939 [Rebinds the acceptor type to another executor. ] 98940 98941 ] 98942 98943 [ 98944 98945 [[link boost_asio.reference.basic_socket_acceptor.broadcast [*broadcast]]] 98946 [Socket option to permit sending of broadcast messages. ] 98947 98948 ] 98949 98950 [ 98951 98952 [[link boost_asio.reference.basic_socket_acceptor.bytes_readable [*bytes_readable]]] 98953 [IO control command to get the amount of data that can be read without blocking. ] 98954 98955 ] 98956 98957 [ 98958 98959 [[link boost_asio.reference.basic_socket_acceptor.debug [*debug]]] 98960 [Socket option to enable socket-level debugging. ] 98961 98962 ] 98963 98964 [ 98965 98966 [[link boost_asio.reference.basic_socket_acceptor.do_not_route [*do_not_route]]] 98967 [Socket option to prevent routing, use local interfaces only. ] 98968 98969 ] 98970 98971 [ 98972 98973 [[link boost_asio.reference.basic_socket_acceptor.enable_connection_aborted [*enable_connection_aborted]]] 98974 [Socket option to report aborted connections on accept. ] 98975 98976 ] 98977 98978 [ 98979 98980 [[link boost_asio.reference.basic_socket_acceptor.endpoint_type [*endpoint_type]]] 98981 [The endpoint type. ] 98982 98983 ] 98984 98985 [ 98986 98987 [[link boost_asio.reference.basic_socket_acceptor.executor_type [*executor_type]]] 98988 [The type of the executor associated with the object. ] 98989 98990 ] 98991 98992 [ 98993 98994 [[link boost_asio.reference.basic_socket_acceptor.keep_alive [*keep_alive]]] 98995 [Socket option to send keep-alives. ] 98996 98997 ] 98998 98999 [ 99000 99001 [[link boost_asio.reference.basic_socket_acceptor.linger [*linger]]] 99002 [Socket option to specify whether the socket lingers on close if unsent data is present. ] 99003 99004 ] 99005 99006 [ 99007 99008 [[link boost_asio.reference.basic_socket_acceptor.message_flags [*message_flags]]] 99009 [Bitmask type for flags that can be passed to send and receive operations. ] 99010 99011 ] 99012 99013 [ 99014 99015 [[link boost_asio.reference.basic_socket_acceptor.native_handle_type [*native_handle_type]]] 99016 [The native representation of an acceptor. ] 99017 99018 ] 99019 99020 [ 99021 99022 [[link boost_asio.reference.basic_socket_acceptor.out_of_band_inline [*out_of_band_inline]]] 99023 [Socket option for putting received out-of-band data inline. ] 99024 99025 ] 99026 99027 [ 99028 99029 [[link boost_asio.reference.basic_socket_acceptor.protocol_type [*protocol_type]]] 99030 [The protocol type. ] 99031 99032 ] 99033 99034 [ 99035 99036 [[link boost_asio.reference.basic_socket_acceptor.receive_buffer_size [*receive_buffer_size]]] 99037 [Socket option for the receive buffer size of a socket. ] 99038 99039 ] 99040 99041 [ 99042 99043 [[link boost_asio.reference.basic_socket_acceptor.receive_low_watermark [*receive_low_watermark]]] 99044 [Socket option for the receive low watermark. ] 99045 99046 ] 99047 99048 [ 99049 99050 [[link boost_asio.reference.basic_socket_acceptor.reuse_address [*reuse_address]]] 99051 [Socket option to allow the socket to be bound to an address that is already in use. ] 99052 99053 ] 99054 99055 [ 99056 99057 [[link boost_asio.reference.basic_socket_acceptor.send_buffer_size [*send_buffer_size]]] 99058 [Socket option for the send buffer size of a socket. ] 99059 99060 ] 99061 99062 [ 99063 99064 [[link boost_asio.reference.basic_socket_acceptor.send_low_watermark [*send_low_watermark]]] 99065 [Socket option for the send low watermark. ] 99066 99067 ] 99068 99069 [ 99070 99071 [[link boost_asio.reference.basic_socket_acceptor.shutdown_type [*shutdown_type]]] 99072 [Different ways a socket may be shutdown. ] 99073 99074 ] 99075 99076 [ 99077 99078 [[link boost_asio.reference.basic_socket_acceptor.wait_type [*wait_type]]] 99079 [Wait types. ] 99080 99081 ] 99082 99083] 99084 99085[heading Member Functions] 99086[table 99087 [[Name][Description]] 99088 99089 [ 99090 [[link boost_asio.reference.basic_socket_acceptor.accept [*accept]]] 99091 [Accept a new connection. 99092 [hr] 99093 Accept a new connection and obtain the endpoint of the peer. ] 99094 ] 99095 99096 [ 99097 [[link boost_asio.reference.basic_socket_acceptor.assign [*assign]]] 99098 [Assigns an existing native acceptor to the acceptor. ] 99099 ] 99100 99101 [ 99102 [[link boost_asio.reference.basic_socket_acceptor.async_accept [*async_accept]]] 99103 [Start an asynchronous accept. ] 99104 ] 99105 99106 [ 99107 [[link boost_asio.reference.basic_socket_acceptor.async_wait [*async_wait]]] 99108 [Asynchronously wait for the acceptor to become ready to read, ready to write, or to have pending error conditions. ] 99109 ] 99110 99111 [ 99112 [[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor [*basic_socket_acceptor]] [constructor]] 99113 [Construct an acceptor without opening it. 99114 [hr] 99115 Construct an open acceptor. 99116 [hr] 99117 Construct an acceptor opened on the given endpoint. 99118 [hr] 99119 Construct a basic_socket_acceptor on an existing native acceptor. 99120 [hr] 99121 Move-construct a basic_socket_acceptor from another. 99122 [hr] 99123 Move-construct a basic_socket_acceptor from an acceptor of another protocol type. ] 99124 ] 99125 99126 [ 99127 [[link boost_asio.reference.basic_socket_acceptor.bind [*bind]]] 99128 [Bind the acceptor to the given local endpoint. ] 99129 ] 99130 99131 [ 99132 [[link boost_asio.reference.basic_socket_acceptor.cancel [*cancel]]] 99133 [Cancel all asynchronous operations associated with the acceptor. ] 99134 ] 99135 99136 [ 99137 [[link boost_asio.reference.basic_socket_acceptor.close [*close]]] 99138 [Close the acceptor. ] 99139 ] 99140 99141 [ 99142 [[link boost_asio.reference.basic_socket_acceptor.get_executor [*get_executor]]] 99143 [Get the executor associated with the object. ] 99144 ] 99145 99146 [ 99147 [[link boost_asio.reference.basic_socket_acceptor.get_option [*get_option]]] 99148 [Get an option from the acceptor. ] 99149 ] 99150 99151 [ 99152 [[link boost_asio.reference.basic_socket_acceptor.io_control [*io_control]]] 99153 [Perform an IO control command on the acceptor. ] 99154 ] 99155 99156 [ 99157 [[link boost_asio.reference.basic_socket_acceptor.is_open [*is_open]]] 99158 [Determine whether the acceptor is open. ] 99159 ] 99160 99161 [ 99162 [[link boost_asio.reference.basic_socket_acceptor.listen [*listen]]] 99163 [Place the acceptor into the state where it will listen for new connections. ] 99164 ] 99165 99166 [ 99167 [[link boost_asio.reference.basic_socket_acceptor.local_endpoint [*local_endpoint]]] 99168 [Get the local endpoint of the acceptor. ] 99169 ] 99170 99171 [ 99172 [[link boost_asio.reference.basic_socket_acceptor.native_handle [*native_handle]]] 99173 [Get the native acceptor representation. ] 99174 ] 99175 99176 [ 99177 [[link boost_asio.reference.basic_socket_acceptor.native_non_blocking [*native_non_blocking]]] 99178 [Gets the non-blocking mode of the native acceptor implementation. 99179 [hr] 99180 Sets the non-blocking mode of the native acceptor implementation. ] 99181 ] 99182 99183 [ 99184 [[link boost_asio.reference.basic_socket_acceptor.non_blocking [*non_blocking]]] 99185 [Gets the non-blocking mode of the acceptor. 99186 [hr] 99187 Sets the non-blocking mode of the acceptor. ] 99188 ] 99189 99190 [ 99191 [[link boost_asio.reference.basic_socket_acceptor.open [*open]]] 99192 [Open the acceptor using the specified protocol. ] 99193 ] 99194 99195 [ 99196 [[link boost_asio.reference.basic_socket_acceptor.operator_eq_ [*operator=]]] 99197 [Move-assign a basic_socket_acceptor from another. 99198 [hr] 99199 Move-assign a basic_socket_acceptor from an acceptor of another protocol type. ] 99200 ] 99201 99202 [ 99203 [[link boost_asio.reference.basic_socket_acceptor.release [*release]]] 99204 [Release ownership of the underlying native acceptor. ] 99205 ] 99206 99207 [ 99208 [[link boost_asio.reference.basic_socket_acceptor.set_option [*set_option]]] 99209 [Set an option on the acceptor. ] 99210 ] 99211 99212 [ 99213 [[link boost_asio.reference.basic_socket_acceptor.wait [*wait]]] 99214 [Wait for the acceptor to become ready to read, ready to write, or to have pending error conditions. ] 99215 ] 99216 99217 [ 99218 [[link boost_asio.reference.basic_socket_acceptor._basic_socket_acceptor [*~basic_socket_acceptor]] [destructor]] 99219 [Destroys the acceptor. ] 99220 ] 99221 99222] 99223 99224[heading Data Members] 99225[table 99226 [[Name][Description]] 99227 99228 [ 99229 [[link boost_asio.reference.basic_socket_acceptor.max_connections [*max_connections]] [static]] 99230 [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ] 99231 ] 99232 99233 [ 99234 [[link boost_asio.reference.basic_socket_acceptor.max_listen_connections [*max_listen_connections]] [static]] 99235 [The maximum length of the queue of pending incoming connections. ] 99236 ] 99237 99238 [ 99239 [[link boost_asio.reference.basic_socket_acceptor.message_do_not_route [*message_do_not_route]] [static]] 99240 [Specify that the data should not be subject to routing. ] 99241 ] 99242 99243 [ 99244 [[link boost_asio.reference.basic_socket_acceptor.message_end_of_record [*message_end_of_record]] [static]] 99245 [Specifies that the data marks the end of a record. ] 99246 ] 99247 99248 [ 99249 [[link boost_asio.reference.basic_socket_acceptor.message_out_of_band [*message_out_of_band]] [static]] 99250 [Process out-of-band data. ] 99251 ] 99252 99253 [ 99254 [[link boost_asio.reference.basic_socket_acceptor.message_peek [*message_peek]] [static]] 99255 [Peek at incoming data without removing it from the input queue. ] 99256 ] 99257 99258] 99259 99260The [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] class template is used for accepting new socket connections. 99261 99262 99263[heading Thread Safety] 99264 99265['Distinct] ['objects:] Safe. 99266 99267['Shared] ['objects:] Unsafe. 99268 99269Synchronous `accept` operations are thread safe, if the underlying operating system calls are also thread safe. This means that it is permitted to perform concurrent calls to synchronous `accept` operations on a single socket object. Other synchronous operations, such as `open` or `close`, are not thread safe. 99270 99271 99272[heading Example] 99273 99274Opening a socket acceptor with the SO\_REUSEADDR option enabled: 99275 99276 boost::asio::ip::tcp::acceptor acceptor(my_context); 99277 boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), port); 99278 acceptor.open(endpoint.protocol()); 99279 acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true)); 99280 acceptor.bind(endpoint); 99281 acceptor.listen(); 99282 99283 99284 99285 99286 99287 99288 99289[heading Requirements] 99290 99291['Header: ][^boost/asio/ip/tcp.hpp] 99292 99293['Convenience header: ][^boost/asio.hpp] 99294 99295 99296[endsect] 99297 99298 99299 99300[section:endpoint ip::tcp::endpoint] 99301 99302[indexterm2 boost_asio.indexterm.ip__tcp.endpoint..endpoint..ip::tcp] 99303The type of a TCP endpoint. 99304 99305 99306 typedef basic_endpoint< tcp > endpoint; 99307 99308 99309[heading Types] 99310[table 99311 [[Name][Description]] 99312 99313 [ 99314 99315 [[link boost_asio.reference.ip__basic_endpoint.data_type [*data_type]]] 99316 [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ] 99317 99318 ] 99319 99320 [ 99321 99322 [[link boost_asio.reference.ip__basic_endpoint.protocol_type [*protocol_type]]] 99323 [The protocol type associated with the endpoint. ] 99324 99325 ] 99326 99327] 99328 99329[heading Member Functions] 99330[table 99331 [[Name][Description]] 99332 99333 [ 99334 [[link boost_asio.reference.ip__basic_endpoint.address [*address]]] 99335 [Get the IP address associated with the endpoint. 99336 [hr] 99337 Set the IP address associated with the endpoint. ] 99338 ] 99339 99340 [ 99341 [[link boost_asio.reference.ip__basic_endpoint.basic_endpoint [*basic_endpoint]] [constructor]] 99342 [Default constructor. 99343 [hr] 99344 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. 99345 [hr] 99346 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. 99347 [hr] 99348 Copy constructor. 99349 [hr] 99350 Move constructor. ] 99351 ] 99352 99353 [ 99354 [[link boost_asio.reference.ip__basic_endpoint.capacity [*capacity]]] 99355 [Get the capacity of the endpoint in the native type. ] 99356 ] 99357 99358 [ 99359 [[link boost_asio.reference.ip__basic_endpoint.data [*data]]] 99360 [Get the underlying endpoint in the native type. ] 99361 ] 99362 99363 [ 99364 [[link boost_asio.reference.ip__basic_endpoint.operator_eq_ [*operator=]]] 99365 [Assign from another endpoint. 99366 [hr] 99367 Move-assign from another endpoint. ] 99368 ] 99369 99370 [ 99371 [[link boost_asio.reference.ip__basic_endpoint.port [*port]]] 99372 [Get the port associated with the endpoint. The port number is always in the host's byte order. 99373 [hr] 99374 Set the port associated with the endpoint. The port number is always in the host's byte order. ] 99375 ] 99376 99377 [ 99378 [[link boost_asio.reference.ip__basic_endpoint.protocol [*protocol]]] 99379 [The protocol associated with the endpoint. ] 99380 ] 99381 99382 [ 99383 [[link boost_asio.reference.ip__basic_endpoint.resize [*resize]]] 99384 [Set the underlying size of the endpoint in the native type. ] 99385 ] 99386 99387 [ 99388 [[link boost_asio.reference.ip__basic_endpoint.size [*size]]] 99389 [Get the underlying size of the endpoint in the native type. ] 99390 ] 99391 99392] 99393 99394[heading Friends] 99395[table 99396 [[Name][Description]] 99397 99398 [ 99399 [[link boost_asio.reference.ip__basic_endpoint.operator_not__eq_ [*operator!=]]] 99400 [Compare two endpoints for inequality. ] 99401 ] 99402 99403 [ 99404 [[link boost_asio.reference.ip__basic_endpoint.operator_lt_ [*operator<]]] 99405 [Compare endpoints for ordering. ] 99406 ] 99407 99408 [ 99409 [[link boost_asio.reference.ip__basic_endpoint.operator_lt__eq_ [*operator<=]]] 99410 [Compare endpoints for ordering. ] 99411 ] 99412 99413 [ 99414 [[link boost_asio.reference.ip__basic_endpoint.operator_eq__eq_ [*operator==]]] 99415 [Compare two endpoints for equality. ] 99416 ] 99417 99418 [ 99419 [[link boost_asio.reference.ip__basic_endpoint.operator_gt_ [*operator>]]] 99420 [Compare endpoints for ordering. ] 99421 ] 99422 99423 [ 99424 [[link boost_asio.reference.ip__basic_endpoint.operator_gt__eq_ [*operator>=]]] 99425 [Compare endpoints for ordering. ] 99426 ] 99427 99428] 99429 99430[heading Related Functions] 99431[table 99432 [[Name][Description]] 99433 99434 [ 99435 [[link boost_asio.reference.ip__basic_endpoint.operator_lt__lt_ [*operator<<]]] 99436 [Output an endpoint as a string. ] 99437 ] 99438 99439] 99440 99441The [link boost_asio.reference.ip__basic_endpoint `ip::basic_endpoint`] class template describes an endpoint that may be associated with a particular socket. 99442 99443 99444[heading Thread Safety] 99445 99446['Distinct] ['objects:] Safe. 99447 99448['Shared] ['objects:] Unsafe. 99449 99450 99451 99452 99453 99454[heading Requirements] 99455 99456['Header: ][^boost/asio/ip/tcp.hpp] 99457 99458['Convenience header: ][^boost/asio.hpp] 99459 99460 99461[endsect] 99462 99463 99464 99465[section:family ip::tcp::family] 99466 99467[indexterm2 boost_asio.indexterm.ip__tcp.family..family..ip::tcp] 99468Obtain an identifier for the protocol family. 99469 99470 99471 int family() const; 99472 99473 99474 99475[endsect] 99476 99477 99478 99479[section:iostream ip::tcp::iostream] 99480 99481[indexterm2 boost_asio.indexterm.ip__tcp.iostream..iostream..ip::tcp] 99482The TCP iostream type. 99483 99484 99485 typedef basic_socket_iostream< tcp > iostream; 99486 99487 99488[heading Types] 99489[table 99490 [[Name][Description]] 99491 99492 [ 99493 99494 [[link boost_asio.reference.basic_socket_iostream.clock_type [*clock_type]]] 99495 [The clock type. ] 99496 99497 ] 99498 99499 [ 99500 99501 [[link boost_asio.reference.basic_socket_iostream.duration [*duration]]] 99502 [The duration type. ] 99503 99504 ] 99505 99506 [ 99507 99508 [[link boost_asio.reference.basic_socket_iostream.duration_type [*duration_type]]] 99509 [(Deprecated: Use duration.) The duration type. ] 99510 99511 ] 99512 99513 [ 99514 99515 [[link boost_asio.reference.basic_socket_iostream.endpoint_type [*endpoint_type]]] 99516 [The endpoint type. ] 99517 99518 ] 99519 99520 [ 99521 99522 [[link boost_asio.reference.basic_socket_iostream.protocol_type [*protocol_type]]] 99523 [The protocol type. ] 99524 99525 ] 99526 99527 [ 99528 99529 [[link boost_asio.reference.basic_socket_iostream.time_point [*time_point]]] 99530 [The time type. ] 99531 99532 ] 99533 99534 [ 99535 99536 [[link boost_asio.reference.basic_socket_iostream.time_type [*time_type]]] 99537 [(Deprecated: Use time_point.) The time type. ] 99538 99539 ] 99540 99541] 99542 99543[heading Member Functions] 99544[table 99545 [[Name][Description]] 99546 99547 [ 99548 [[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream [*basic_socket_iostream]] [constructor]] 99549 [Construct a basic_socket_iostream without establishing a connection. 99550 [hr] 99551 Construct a basic_socket_iostream from the supplied socket. 99552 [hr] 99553 Move-construct a basic_socket_iostream from another. 99554 [hr] 99555 Establish a connection to an endpoint corresponding to a resolver query. ] 99556 ] 99557 99558 [ 99559 [[link boost_asio.reference.basic_socket_iostream.close [*close]]] 99560 [Close the connection. ] 99561 ] 99562 99563 [ 99564 [[link boost_asio.reference.basic_socket_iostream.connect [*connect]]] 99565 [Establish a connection to an endpoint corresponding to a resolver query. ] 99566 ] 99567 99568 [ 99569 [[link boost_asio.reference.basic_socket_iostream.error [*error]]] 99570 [Get the last error associated with the stream. ] 99571 ] 99572 99573 [ 99574 [[link boost_asio.reference.basic_socket_iostream.expires_after [*expires_after]]] 99575 [Set the stream's expiry time relative to now. ] 99576 ] 99577 99578 [ 99579 [[link boost_asio.reference.basic_socket_iostream.expires_at [*expires_at]]] 99580 [(Deprecated: Use expiry().) Get the stream's expiry time as an absolute time. 99581 [hr] 99582 Set the stream's expiry time as an absolute time. ] 99583 ] 99584 99585 [ 99586 [[link boost_asio.reference.basic_socket_iostream.expires_from_now [*expires_from_now]]] 99587 [(Deprecated: Use expiry().) Get the stream's expiry time relative to now. 99588 [hr] 99589 (Deprecated: Use expires_after().) Set the stream's expiry time relative to now. ] 99590 ] 99591 99592 [ 99593 [[link boost_asio.reference.basic_socket_iostream.expiry [*expiry]]] 99594 [Get the stream's expiry time as an absolute time. ] 99595 ] 99596 99597 [ 99598 [[link boost_asio.reference.basic_socket_iostream.operator_eq_ [*operator=]]] 99599 [Move-assign a basic_socket_iostream from another. ] 99600 ] 99601 99602 [ 99603 [[link boost_asio.reference.basic_socket_iostream.rdbuf [*rdbuf]]] 99604 [Return a pointer to the underlying streambuf. ] 99605 ] 99606 99607 [ 99608 [[link boost_asio.reference.basic_socket_iostream.socket [*socket]]] 99609 [Get a reference to the underlying socket. ] 99610 ] 99611 99612] 99613 99614 99615[heading Requirements] 99616 99617['Header: ][^boost/asio/ip/tcp.hpp] 99618 99619['Convenience header: ][^boost/asio.hpp] 99620 99621 99622[endsect] 99623 99624 99625 99626[section:no_delay ip::tcp::no_delay] 99627 99628[indexterm2 boost_asio.indexterm.ip__tcp.no_delay..no_delay..ip::tcp] 99629Socket option for disabling the Nagle algorithm. 99630 99631 99632 typedef implementation_defined no_delay; 99633 99634 99635 99636Implements the IPPROTO\_TCP/TCP\_NODELAY socket option. 99637 99638 99639[heading Examples] 99640 99641Setting the option: 99642 99643 boost::asio::ip::tcp::socket socket(my_context); 99644 ... 99645 boost::asio::ip::tcp::no_delay option(true); 99646 socket.set_option(option); 99647 99648 99649 99650 99651 99652Getting the current option value: 99653 99654 boost::asio::ip::tcp::socket socket(my_context); 99655 ... 99656 boost::asio::ip::tcp::no_delay option; 99657 socket.get_option(option); 99658 bool is_set = option.value(); 99659 99660 99661 99662 99663 99664 99665 99666[heading Requirements] 99667 99668['Header: ][^boost/asio/ip/tcp.hpp] 99669 99670['Convenience header: ][^boost/asio.hpp] 99671 99672 99673[endsect] 99674 99675 99676 99677[section:operator_not__eq_ ip::tcp::operator!=] 99678 99679[indexterm2 boost_asio.indexterm.ip__tcp.operator_not__eq_..operator!=..ip::tcp] 99680Compare two protocols for inequality. 99681 99682 99683 friend bool operator!=( 99684 const tcp & p1, 99685 const tcp & p2); 99686 99687 99688[heading Requirements] 99689 99690['Header: ][^boost/asio/ip/tcp.hpp] 99691 99692['Convenience header: ][^boost/asio.hpp] 99693 99694 99695[endsect] 99696 99697 99698 99699[section:operator_eq__eq_ ip::tcp::operator==] 99700 99701[indexterm2 boost_asio.indexterm.ip__tcp.operator_eq__eq_..operator==..ip::tcp] 99702Compare two protocols for equality. 99703 99704 99705 friend bool operator==( 99706 const tcp & p1, 99707 const tcp & p2); 99708 99709 99710[heading Requirements] 99711 99712['Header: ][^boost/asio/ip/tcp.hpp] 99713 99714['Convenience header: ][^boost/asio.hpp] 99715 99716 99717[endsect] 99718 99719 99720 99721[section:protocol ip::tcp::protocol] 99722 99723[indexterm2 boost_asio.indexterm.ip__tcp.protocol..protocol..ip::tcp] 99724Obtain an identifier for the protocol. 99725 99726 99727 int protocol() const; 99728 99729 99730 99731[endsect] 99732 99733 99734 99735[section:resolver ip::tcp::resolver] 99736 99737[indexterm2 boost_asio.indexterm.ip__tcp.resolver..resolver..ip::tcp] 99738The TCP resolver type. 99739 99740 99741 typedef basic_resolver< tcp > resolver; 99742 99743 99744[heading Types] 99745[table 99746 [[Name][Description]] 99747 99748 [ 99749 99750 [[link boost_asio.reference.ip__basic_resolver__rebind_executor [*rebind_executor]]] 99751 [Rebinds the resolver type to another executor. ] 99752 99753 ] 99754 99755 [ 99756 99757 [[link boost_asio.reference.ip__basic_resolver.endpoint_type [*endpoint_type]]] 99758 [The endpoint type. ] 99759 99760 ] 99761 99762 [ 99763 99764 [[link boost_asio.reference.ip__basic_resolver.executor_type [*executor_type]]] 99765 [The type of the executor associated with the object. ] 99766 99767 ] 99768 99769 [ 99770 99771 [[link boost_asio.reference.ip__basic_resolver.flags [*flags]]] 99772 [A bitmask type (C++ Std \[lib.bitmask.types\]). ] 99773 99774 ] 99775 99776 [ 99777 99778 [[link boost_asio.reference.ip__basic_resolver.iterator [*iterator]]] 99779 [(Deprecated.) The iterator type. ] 99780 99781 ] 99782 99783 [ 99784 99785 [[link boost_asio.reference.ip__basic_resolver.protocol_type [*protocol_type]]] 99786 [The protocol type. ] 99787 99788 ] 99789 99790 [ 99791 99792 [[link boost_asio.reference.ip__basic_resolver.query [*query]]] 99793 [(Deprecated.) The query type. ] 99794 99795 ] 99796 99797 [ 99798 99799 [[link boost_asio.reference.ip__basic_resolver.results_type [*results_type]]] 99800 [The results type. ] 99801 99802 ] 99803 99804] 99805 99806[heading Member Functions] 99807[table 99808 [[Name][Description]] 99809 99810 [ 99811 [[link boost_asio.reference.ip__basic_resolver.async_resolve [*async_resolve]]] 99812 [(Deprecated: Use overload with separate host and service parameters.) Asynchronously perform forward resolution of a query to a list of entries. 99813 [hr] 99814 Asynchronously perform forward resolution of a query to a list of entries. 99815 [hr] 99816 Asynchronously perform reverse resolution of an endpoint to a list of entries. ] 99817 ] 99818 99819 [ 99820 [[link boost_asio.reference.ip__basic_resolver.basic_resolver [*basic_resolver]] [constructor]] 99821 [Construct with executor. 99822 [hr] 99823 Construct with execution context. 99824 [hr] 99825 Move-construct a basic_resolver from another. ] 99826 ] 99827 99828 [ 99829 [[link boost_asio.reference.ip__basic_resolver.cancel [*cancel]]] 99830 [Cancel any asynchronous operations that are waiting on the resolver. ] 99831 ] 99832 99833 [ 99834 [[link boost_asio.reference.ip__basic_resolver.get_executor [*get_executor]]] 99835 [Get the executor associated with the object. ] 99836 ] 99837 99838 [ 99839 [[link boost_asio.reference.ip__basic_resolver.operator_eq_ [*operator=]]] 99840 [Move-assign a basic_resolver from another. ] 99841 ] 99842 99843 [ 99844 [[link boost_asio.reference.ip__basic_resolver.resolve [*resolve]]] 99845 [(Deprecated: Use overload with separate host and service parameters.) Perform forward resolution of a query to a list of entries. 99846 [hr] 99847 Perform forward resolution of a query to a list of entries. 99848 [hr] 99849 Perform reverse resolution of an endpoint to a list of entries. ] 99850 ] 99851 99852 [ 99853 [[link boost_asio.reference.ip__basic_resolver._basic_resolver [*~basic_resolver]] [destructor]] 99854 [Destroys the resolver. ] 99855 ] 99856 99857] 99858 99859[heading Data Members] 99860[table 99861 [[Name][Description]] 99862 99863 [ 99864 [[link boost_asio.reference.ip__basic_resolver.address_configured [*address_configured]] [static]] 99865 [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. ] 99866 ] 99867 99868 [ 99869 [[link boost_asio.reference.ip__basic_resolver.all_matching [*all_matching]] [static]] 99870 [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ] 99871 ] 99872 99873 [ 99874 [[link boost_asio.reference.ip__basic_resolver.canonical_name [*canonical_name]] [static]] 99875 [Determine the canonical name of the host specified in the query. ] 99876 ] 99877 99878 [ 99879 [[link boost_asio.reference.ip__basic_resolver.numeric_host [*numeric_host]] [static]] 99880 [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ] 99881 ] 99882 99883 [ 99884 [[link boost_asio.reference.ip__basic_resolver.numeric_service [*numeric_service]] [static]] 99885 [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ] 99886 ] 99887 99888 [ 99889 [[link boost_asio.reference.ip__basic_resolver.passive [*passive]] [static]] 99890 [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ] 99891 ] 99892 99893 [ 99894 [[link boost_asio.reference.ip__basic_resolver.v4_mapped [*v4_mapped]] [static]] 99895 [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ] 99896 ] 99897 99898] 99899 99900The [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] class template provides the ability to resolve a query to a list of endpoints. 99901 99902 99903[heading Thread Safety] 99904 99905['Distinct] ['objects:] Safe. 99906 99907['Shared] ['objects:] Unsafe. 99908 99909 99910 99911 99912[heading Requirements] 99913 99914['Header: ][^boost/asio/ip/tcp.hpp] 99915 99916['Convenience header: ][^boost/asio.hpp] 99917 99918 99919[endsect] 99920 99921 99922 99923[section:socket ip::tcp::socket] 99924 99925[indexterm2 boost_asio.indexterm.ip__tcp.socket..socket..ip::tcp] 99926The TCP socket type. 99927 99928 99929 typedef basic_stream_socket< tcp > socket; 99930 99931 99932[heading Types] 99933[table 99934 [[Name][Description]] 99935 99936 [ 99937 99938 [[link boost_asio.reference.basic_stream_socket__rebind_executor [*rebind_executor]]] 99939 [Rebinds the socket type to another executor. ] 99940 99941 ] 99942 99943 [ 99944 99945 [[link boost_asio.reference.basic_stream_socket.broadcast [*broadcast]]] 99946 [Socket option to permit sending of broadcast messages. ] 99947 99948 ] 99949 99950 [ 99951 99952 [[link boost_asio.reference.basic_stream_socket.bytes_readable [*bytes_readable]]] 99953 [IO control command to get the amount of data that can be read without blocking. ] 99954 99955 ] 99956 99957 [ 99958 99959 [[link boost_asio.reference.basic_stream_socket.debug [*debug]]] 99960 [Socket option to enable socket-level debugging. ] 99961 99962 ] 99963 99964 [ 99965 99966 [[link boost_asio.reference.basic_stream_socket.do_not_route [*do_not_route]]] 99967 [Socket option to prevent routing, use local interfaces only. ] 99968 99969 ] 99970 99971 [ 99972 99973 [[link boost_asio.reference.basic_stream_socket.enable_connection_aborted [*enable_connection_aborted]]] 99974 [Socket option to report aborted connections on accept. ] 99975 99976 ] 99977 99978 [ 99979 99980 [[link boost_asio.reference.basic_stream_socket.endpoint_type [*endpoint_type]]] 99981 [The endpoint type. ] 99982 99983 ] 99984 99985 [ 99986 99987 [[link boost_asio.reference.basic_stream_socket.executor_type [*executor_type]]] 99988 [The type of the executor associated with the object. ] 99989 99990 ] 99991 99992 [ 99993 99994 [[link boost_asio.reference.basic_stream_socket.keep_alive [*keep_alive]]] 99995 [Socket option to send keep-alives. ] 99996 99997 ] 99998 99999 [ 100000 100001 [[link boost_asio.reference.basic_stream_socket.linger [*linger]]] 100002 [Socket option to specify whether the socket lingers on close if unsent data is present. ] 100003 100004 ] 100005 100006 [ 100007 100008 [[link boost_asio.reference.basic_stream_socket.lowest_layer_type [*lowest_layer_type]]] 100009 [A basic_socket is always the lowest layer. ] 100010 100011 ] 100012 100013 [ 100014 100015 [[link boost_asio.reference.basic_stream_socket.message_flags [*message_flags]]] 100016 [Bitmask type for flags that can be passed to send and receive operations. ] 100017 100018 ] 100019 100020 [ 100021 100022 [[link boost_asio.reference.basic_stream_socket.native_handle_type [*native_handle_type]]] 100023 [The native representation of a socket. ] 100024 100025 ] 100026 100027 [ 100028 100029 [[link boost_asio.reference.basic_stream_socket.out_of_band_inline [*out_of_band_inline]]] 100030 [Socket option for putting received out-of-band data inline. ] 100031 100032 ] 100033 100034 [ 100035 100036 [[link boost_asio.reference.basic_stream_socket.protocol_type [*protocol_type]]] 100037 [The protocol type. ] 100038 100039 ] 100040 100041 [ 100042 100043 [[link boost_asio.reference.basic_stream_socket.receive_buffer_size [*receive_buffer_size]]] 100044 [Socket option for the receive buffer size of a socket. ] 100045 100046 ] 100047 100048 [ 100049 100050 [[link boost_asio.reference.basic_stream_socket.receive_low_watermark [*receive_low_watermark]]] 100051 [Socket option for the receive low watermark. ] 100052 100053 ] 100054 100055 [ 100056 100057 [[link boost_asio.reference.basic_stream_socket.reuse_address [*reuse_address]]] 100058 [Socket option to allow the socket to be bound to an address that is already in use. ] 100059 100060 ] 100061 100062 [ 100063 100064 [[link boost_asio.reference.basic_stream_socket.send_buffer_size [*send_buffer_size]]] 100065 [Socket option for the send buffer size of a socket. ] 100066 100067 ] 100068 100069 [ 100070 100071 [[link boost_asio.reference.basic_stream_socket.send_low_watermark [*send_low_watermark]]] 100072 [Socket option for the send low watermark. ] 100073 100074 ] 100075 100076 [ 100077 100078 [[link boost_asio.reference.basic_stream_socket.shutdown_type [*shutdown_type]]] 100079 [Different ways a socket may be shutdown. ] 100080 100081 ] 100082 100083 [ 100084 100085 [[link boost_asio.reference.basic_stream_socket.wait_type [*wait_type]]] 100086 [Wait types. ] 100087 100088 ] 100089 100090] 100091 100092[heading Member Functions] 100093[table 100094 [[Name][Description]] 100095 100096 [ 100097 [[link boost_asio.reference.basic_stream_socket.assign [*assign]]] 100098 [Assign an existing native socket to the socket. ] 100099 ] 100100 100101 [ 100102 [[link boost_asio.reference.basic_stream_socket.async_connect [*async_connect]]] 100103 [Start an asynchronous connect. ] 100104 ] 100105 100106 [ 100107 [[link boost_asio.reference.basic_stream_socket.async_read_some [*async_read_some]]] 100108 [Start an asynchronous read. ] 100109 ] 100110 100111 [ 100112 [[link boost_asio.reference.basic_stream_socket.async_receive [*async_receive]]] 100113 [Start an asynchronous receive. ] 100114 ] 100115 100116 [ 100117 [[link boost_asio.reference.basic_stream_socket.async_send [*async_send]]] 100118 [Start an asynchronous send. ] 100119 ] 100120 100121 [ 100122 [[link boost_asio.reference.basic_stream_socket.async_wait [*async_wait]]] 100123 [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 100124 ] 100125 100126 [ 100127 [[link boost_asio.reference.basic_stream_socket.async_write_some [*async_write_some]]] 100128 [Start an asynchronous write. ] 100129 ] 100130 100131 [ 100132 [[link boost_asio.reference.basic_stream_socket.at_mark [*at_mark]]] 100133 [Determine whether the socket is at the out-of-band data mark. ] 100134 ] 100135 100136 [ 100137 [[link boost_asio.reference.basic_stream_socket.available [*available]]] 100138 [Determine the number of bytes available for reading. ] 100139 ] 100140 100141 [ 100142 [[link boost_asio.reference.basic_stream_socket.basic_stream_socket [*basic_stream_socket]] [constructor]] 100143 [Construct a basic_stream_socket without opening it. 100144 [hr] 100145 Construct and open a basic_stream_socket. 100146 [hr] 100147 Construct a basic_stream_socket, opening it and binding it to the given local endpoint. 100148 [hr] 100149 Construct a basic_stream_socket on an existing native socket. 100150 [hr] 100151 Move-construct a basic_stream_socket from another. 100152 [hr] 100153 Move-construct a basic_stream_socket from a socket of another protocol type. ] 100154 ] 100155 100156 [ 100157 [[link boost_asio.reference.basic_stream_socket.bind [*bind]]] 100158 [Bind the socket to the given local endpoint. ] 100159 ] 100160 100161 [ 100162 [[link boost_asio.reference.basic_stream_socket.cancel [*cancel]]] 100163 [Cancel all asynchronous operations associated with the socket. ] 100164 ] 100165 100166 [ 100167 [[link boost_asio.reference.basic_stream_socket.close [*close]]] 100168 [Close the socket. ] 100169 ] 100170 100171 [ 100172 [[link boost_asio.reference.basic_stream_socket.connect [*connect]]] 100173 [Connect the socket to the specified endpoint. ] 100174 ] 100175 100176 [ 100177 [[link boost_asio.reference.basic_stream_socket.get_executor [*get_executor]]] 100178 [Get the executor associated with the object. ] 100179 ] 100180 100181 [ 100182 [[link boost_asio.reference.basic_stream_socket.get_option [*get_option]]] 100183 [Get an option from the socket. ] 100184 ] 100185 100186 [ 100187 [[link boost_asio.reference.basic_stream_socket.io_control [*io_control]]] 100188 [Perform an IO control command on the socket. ] 100189 ] 100190 100191 [ 100192 [[link boost_asio.reference.basic_stream_socket.is_open [*is_open]]] 100193 [Determine whether the socket is open. ] 100194 ] 100195 100196 [ 100197 [[link boost_asio.reference.basic_stream_socket.local_endpoint [*local_endpoint]]] 100198 [Get the local endpoint of the socket. ] 100199 ] 100200 100201 [ 100202 [[link boost_asio.reference.basic_stream_socket.lowest_layer [*lowest_layer]]] 100203 [Get a reference to the lowest layer. 100204 [hr] 100205 Get a const reference to the lowest layer. ] 100206 ] 100207 100208 [ 100209 [[link boost_asio.reference.basic_stream_socket.native_handle [*native_handle]]] 100210 [Get the native socket representation. ] 100211 ] 100212 100213 [ 100214 [[link boost_asio.reference.basic_stream_socket.native_non_blocking [*native_non_blocking]]] 100215 [Gets the non-blocking mode of the native socket implementation. 100216 [hr] 100217 Sets the non-blocking mode of the native socket implementation. ] 100218 ] 100219 100220 [ 100221 [[link boost_asio.reference.basic_stream_socket.non_blocking [*non_blocking]]] 100222 [Gets the non-blocking mode of the socket. 100223 [hr] 100224 Sets the non-blocking mode of the socket. ] 100225 ] 100226 100227 [ 100228 [[link boost_asio.reference.basic_stream_socket.open [*open]]] 100229 [Open the socket using the specified protocol. ] 100230 ] 100231 100232 [ 100233 [[link boost_asio.reference.basic_stream_socket.operator_eq_ [*operator=]]] 100234 [Move-assign a basic_stream_socket from another. 100235 [hr] 100236 Move-assign a basic_stream_socket from a socket of another protocol type. ] 100237 ] 100238 100239 [ 100240 [[link boost_asio.reference.basic_stream_socket.read_some [*read_some]]] 100241 [Read some data from the socket. ] 100242 ] 100243 100244 [ 100245 [[link boost_asio.reference.basic_stream_socket.receive [*receive]]] 100246 [Receive some data on the socket. 100247 [hr] 100248 Receive some data on a connected socket. ] 100249 ] 100250 100251 [ 100252 [[link boost_asio.reference.basic_stream_socket.release [*release]]] 100253 [Release ownership of the underlying native socket. ] 100254 ] 100255 100256 [ 100257 [[link boost_asio.reference.basic_stream_socket.remote_endpoint [*remote_endpoint]]] 100258 [Get the remote endpoint of the socket. ] 100259 ] 100260 100261 [ 100262 [[link boost_asio.reference.basic_stream_socket.send [*send]]] 100263 [Send some data on the socket. ] 100264 ] 100265 100266 [ 100267 [[link boost_asio.reference.basic_stream_socket.set_option [*set_option]]] 100268 [Set an option on the socket. ] 100269 ] 100270 100271 [ 100272 [[link boost_asio.reference.basic_stream_socket.shutdown [*shutdown]]] 100273 [Disable sends or receives on the socket. ] 100274 ] 100275 100276 [ 100277 [[link boost_asio.reference.basic_stream_socket.wait [*wait]]] 100278 [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 100279 ] 100280 100281 [ 100282 [[link boost_asio.reference.basic_stream_socket.write_some [*write_some]]] 100283 [Write some data to the socket. ] 100284 ] 100285 100286 [ 100287 [[link boost_asio.reference.basic_stream_socket._basic_stream_socket [*~basic_stream_socket]] [destructor]] 100288 [Destroys the socket. ] 100289 ] 100290 100291] 100292 100293[heading Data Members] 100294[table 100295 [[Name][Description]] 100296 100297 [ 100298 [[link boost_asio.reference.basic_stream_socket.max_connections [*max_connections]] [static]] 100299 [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ] 100300 ] 100301 100302 [ 100303 [[link boost_asio.reference.basic_stream_socket.max_listen_connections [*max_listen_connections]] [static]] 100304 [The maximum length of the queue of pending incoming connections. ] 100305 ] 100306 100307 [ 100308 [[link boost_asio.reference.basic_stream_socket.message_do_not_route [*message_do_not_route]] [static]] 100309 [Specify that the data should not be subject to routing. ] 100310 ] 100311 100312 [ 100313 [[link boost_asio.reference.basic_stream_socket.message_end_of_record [*message_end_of_record]] [static]] 100314 [Specifies that the data marks the end of a record. ] 100315 ] 100316 100317 [ 100318 [[link boost_asio.reference.basic_stream_socket.message_out_of_band [*message_out_of_band]] [static]] 100319 [Process out-of-band data. ] 100320 ] 100321 100322 [ 100323 [[link boost_asio.reference.basic_stream_socket.message_peek [*message_peek]] [static]] 100324 [Peek at incoming data without removing it from the input queue. ] 100325 ] 100326 100327] 100328 100329The [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] class template provides asynchronous and blocking stream-oriented socket functionality. 100330 100331 100332[heading Thread Safety] 100333 100334['Distinct] ['objects:] Safe. 100335 100336['Shared] ['objects:] Unsafe. 100337 100338Synchronous `send`, `receive`, and `connect` operations are thread safe with respect to each other, if the underlying operating system calls are also thread safe. This means that it is permitted to perform concurrent calls to these synchronous operations on a single socket object. Other synchronous operations, such as `open` or `close`, are not thread safe. 100339 100340 100341 100342 100343 100344[heading Requirements] 100345 100346['Header: ][^boost/asio/ip/tcp.hpp] 100347 100348['Convenience header: ][^boost/asio.hpp] 100349 100350 100351[endsect] 100352 100353 100354 100355[section:type ip::tcp::type] 100356 100357[indexterm2 boost_asio.indexterm.ip__tcp.type..type..ip::tcp] 100358Obtain an identifier for the type of the protocol. 100359 100360 100361 int type() const; 100362 100363 100364 100365[endsect] 100366 100367 100368 100369[section:v4 ip::tcp::v4] 100370 100371[indexterm2 boost_asio.indexterm.ip__tcp.v4..v4..ip::tcp] 100372Construct to represent the IPv4 TCP protocol. 100373 100374 100375 static tcp v4(); 100376 100377 100378 100379[endsect] 100380 100381 100382 100383[section:v6 ip::tcp::v6] 100384 100385[indexterm2 boost_asio.indexterm.ip__tcp.v6..v6..ip::tcp] 100386Construct to represent the IPv6 TCP protocol. 100387 100388 100389 static tcp v6(); 100390 100391 100392 100393[endsect] 100394 100395 100396 100397[endsect] 100398 100399[section:ip__udp ip::udp] 100400 100401[indexterm1 boost_asio.indexterm.ip__udp..ip::udp] 100402 100403 100404Encapsulates the flags needed for UDP. 100405 100406 100407 class udp 100408 100409 100410[heading Types] 100411[table 100412 [[Name][Description]] 100413 100414 [ 100415 100416 [[link boost_asio.reference.ip__udp.endpoint [*endpoint]]] 100417 [The type of a UDP endpoint. ] 100418 100419 ] 100420 100421 [ 100422 100423 [[link boost_asio.reference.ip__udp.resolver [*resolver]]] 100424 [The UDP resolver type. ] 100425 100426 ] 100427 100428 [ 100429 100430 [[link boost_asio.reference.ip__udp.socket [*socket]]] 100431 [The UDP socket type. ] 100432 100433 ] 100434 100435] 100436 100437[heading Member Functions] 100438[table 100439 [[Name][Description]] 100440 100441 [ 100442 [[link boost_asio.reference.ip__udp.family [*family]]] 100443 [Obtain an identifier for the protocol family. ] 100444 ] 100445 100446 [ 100447 [[link boost_asio.reference.ip__udp.protocol [*protocol]]] 100448 [Obtain an identifier for the protocol. ] 100449 ] 100450 100451 [ 100452 [[link boost_asio.reference.ip__udp.type [*type]]] 100453 [Obtain an identifier for the type of the protocol. ] 100454 ] 100455 100456 [ 100457 [[link boost_asio.reference.ip__udp.v4 [*v4]] [static]] 100458 [Construct to represent the IPv4 UDP protocol. ] 100459 ] 100460 100461 [ 100462 [[link boost_asio.reference.ip__udp.v6 [*v6]] [static]] 100463 [Construct to represent the IPv6 UDP protocol. ] 100464 ] 100465 100466] 100467 100468[heading Friends] 100469[table 100470 [[Name][Description]] 100471 100472 [ 100473 [[link boost_asio.reference.ip__udp.operator_not__eq_ [*operator!=]]] 100474 [Compare two protocols for inequality. ] 100475 ] 100476 100477 [ 100478 [[link boost_asio.reference.ip__udp.operator_eq__eq_ [*operator==]]] 100479 [Compare two protocols for equality. ] 100480 ] 100481 100482] 100483 100484The [link boost_asio.reference.ip__udp `ip::udp`] class contains flags necessary for UDP sockets. 100485 100486 100487[heading Thread Safety] 100488 100489['Distinct] ['objects:] Safe. 100490 100491['Shared] ['objects:] Safe. 100492 100493 100494 100495 100496[heading Requirements] 100497 100498['Header: ][^boost/asio/ip/udp.hpp] 100499 100500['Convenience header: ][^boost/asio.hpp] 100501 100502 100503[section:endpoint ip::udp::endpoint] 100504 100505[indexterm2 boost_asio.indexterm.ip__udp.endpoint..endpoint..ip::udp] 100506The type of a UDP endpoint. 100507 100508 100509 typedef basic_endpoint< udp > endpoint; 100510 100511 100512[heading Types] 100513[table 100514 [[Name][Description]] 100515 100516 [ 100517 100518 [[link boost_asio.reference.ip__basic_endpoint.data_type [*data_type]]] 100519 [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ] 100520 100521 ] 100522 100523 [ 100524 100525 [[link boost_asio.reference.ip__basic_endpoint.protocol_type [*protocol_type]]] 100526 [The protocol type associated with the endpoint. ] 100527 100528 ] 100529 100530] 100531 100532[heading Member Functions] 100533[table 100534 [[Name][Description]] 100535 100536 [ 100537 [[link boost_asio.reference.ip__basic_endpoint.address [*address]]] 100538 [Get the IP address associated with the endpoint. 100539 [hr] 100540 Set the IP address associated with the endpoint. ] 100541 ] 100542 100543 [ 100544 [[link boost_asio.reference.ip__basic_endpoint.basic_endpoint [*basic_endpoint]] [constructor]] 100545 [Default constructor. 100546 [hr] 100547 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. 100548 [hr] 100549 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. 100550 [hr] 100551 Copy constructor. 100552 [hr] 100553 Move constructor. ] 100554 ] 100555 100556 [ 100557 [[link boost_asio.reference.ip__basic_endpoint.capacity [*capacity]]] 100558 [Get the capacity of the endpoint in the native type. ] 100559 ] 100560 100561 [ 100562 [[link boost_asio.reference.ip__basic_endpoint.data [*data]]] 100563 [Get the underlying endpoint in the native type. ] 100564 ] 100565 100566 [ 100567 [[link boost_asio.reference.ip__basic_endpoint.operator_eq_ [*operator=]]] 100568 [Assign from another endpoint. 100569 [hr] 100570 Move-assign from another endpoint. ] 100571 ] 100572 100573 [ 100574 [[link boost_asio.reference.ip__basic_endpoint.port [*port]]] 100575 [Get the port associated with the endpoint. The port number is always in the host's byte order. 100576 [hr] 100577 Set the port associated with the endpoint. The port number is always in the host's byte order. ] 100578 ] 100579 100580 [ 100581 [[link boost_asio.reference.ip__basic_endpoint.protocol [*protocol]]] 100582 [The protocol associated with the endpoint. ] 100583 ] 100584 100585 [ 100586 [[link boost_asio.reference.ip__basic_endpoint.resize [*resize]]] 100587 [Set the underlying size of the endpoint in the native type. ] 100588 ] 100589 100590 [ 100591 [[link boost_asio.reference.ip__basic_endpoint.size [*size]]] 100592 [Get the underlying size of the endpoint in the native type. ] 100593 ] 100594 100595] 100596 100597[heading Friends] 100598[table 100599 [[Name][Description]] 100600 100601 [ 100602 [[link boost_asio.reference.ip__basic_endpoint.operator_not__eq_ [*operator!=]]] 100603 [Compare two endpoints for inequality. ] 100604 ] 100605 100606 [ 100607 [[link boost_asio.reference.ip__basic_endpoint.operator_lt_ [*operator<]]] 100608 [Compare endpoints for ordering. ] 100609 ] 100610 100611 [ 100612 [[link boost_asio.reference.ip__basic_endpoint.operator_lt__eq_ [*operator<=]]] 100613 [Compare endpoints for ordering. ] 100614 ] 100615 100616 [ 100617 [[link boost_asio.reference.ip__basic_endpoint.operator_eq__eq_ [*operator==]]] 100618 [Compare two endpoints for equality. ] 100619 ] 100620 100621 [ 100622 [[link boost_asio.reference.ip__basic_endpoint.operator_gt_ [*operator>]]] 100623 [Compare endpoints for ordering. ] 100624 ] 100625 100626 [ 100627 [[link boost_asio.reference.ip__basic_endpoint.operator_gt__eq_ [*operator>=]]] 100628 [Compare endpoints for ordering. ] 100629 ] 100630 100631] 100632 100633[heading Related Functions] 100634[table 100635 [[Name][Description]] 100636 100637 [ 100638 [[link boost_asio.reference.ip__basic_endpoint.operator_lt__lt_ [*operator<<]]] 100639 [Output an endpoint as a string. ] 100640 ] 100641 100642] 100643 100644The [link boost_asio.reference.ip__basic_endpoint `ip::basic_endpoint`] class template describes an endpoint that may be associated with a particular socket. 100645 100646 100647[heading Thread Safety] 100648 100649['Distinct] ['objects:] Safe. 100650 100651['Shared] ['objects:] Unsafe. 100652 100653 100654 100655 100656 100657[heading Requirements] 100658 100659['Header: ][^boost/asio/ip/udp.hpp] 100660 100661['Convenience header: ][^boost/asio.hpp] 100662 100663 100664[endsect] 100665 100666 100667 100668[section:family ip::udp::family] 100669 100670[indexterm2 boost_asio.indexterm.ip__udp.family..family..ip::udp] 100671Obtain an identifier for the protocol family. 100672 100673 100674 int family() const; 100675 100676 100677 100678[endsect] 100679 100680 100681 100682[section:operator_not__eq_ ip::udp::operator!=] 100683 100684[indexterm2 boost_asio.indexterm.ip__udp.operator_not__eq_..operator!=..ip::udp] 100685Compare two protocols for inequality. 100686 100687 100688 friend bool operator!=( 100689 const udp & p1, 100690 const udp & p2); 100691 100692 100693[heading Requirements] 100694 100695['Header: ][^boost/asio/ip/udp.hpp] 100696 100697['Convenience header: ][^boost/asio.hpp] 100698 100699 100700[endsect] 100701 100702 100703 100704[section:operator_eq__eq_ ip::udp::operator==] 100705 100706[indexterm2 boost_asio.indexterm.ip__udp.operator_eq__eq_..operator==..ip::udp] 100707Compare two protocols for equality. 100708 100709 100710 friend bool operator==( 100711 const udp & p1, 100712 const udp & p2); 100713 100714 100715[heading Requirements] 100716 100717['Header: ][^boost/asio/ip/udp.hpp] 100718 100719['Convenience header: ][^boost/asio.hpp] 100720 100721 100722[endsect] 100723 100724 100725 100726[section:protocol ip::udp::protocol] 100727 100728[indexterm2 boost_asio.indexterm.ip__udp.protocol..protocol..ip::udp] 100729Obtain an identifier for the protocol. 100730 100731 100732 int protocol() const; 100733 100734 100735 100736[endsect] 100737 100738 100739 100740[section:resolver ip::udp::resolver] 100741 100742[indexterm2 boost_asio.indexterm.ip__udp.resolver..resolver..ip::udp] 100743The UDP resolver type. 100744 100745 100746 typedef basic_resolver< udp > resolver; 100747 100748 100749[heading Types] 100750[table 100751 [[Name][Description]] 100752 100753 [ 100754 100755 [[link boost_asio.reference.ip__basic_resolver__rebind_executor [*rebind_executor]]] 100756 [Rebinds the resolver type to another executor. ] 100757 100758 ] 100759 100760 [ 100761 100762 [[link boost_asio.reference.ip__basic_resolver.endpoint_type [*endpoint_type]]] 100763 [The endpoint type. ] 100764 100765 ] 100766 100767 [ 100768 100769 [[link boost_asio.reference.ip__basic_resolver.executor_type [*executor_type]]] 100770 [The type of the executor associated with the object. ] 100771 100772 ] 100773 100774 [ 100775 100776 [[link boost_asio.reference.ip__basic_resolver.flags [*flags]]] 100777 [A bitmask type (C++ Std \[lib.bitmask.types\]). ] 100778 100779 ] 100780 100781 [ 100782 100783 [[link boost_asio.reference.ip__basic_resolver.iterator [*iterator]]] 100784 [(Deprecated.) The iterator type. ] 100785 100786 ] 100787 100788 [ 100789 100790 [[link boost_asio.reference.ip__basic_resolver.protocol_type [*protocol_type]]] 100791 [The protocol type. ] 100792 100793 ] 100794 100795 [ 100796 100797 [[link boost_asio.reference.ip__basic_resolver.query [*query]]] 100798 [(Deprecated.) The query type. ] 100799 100800 ] 100801 100802 [ 100803 100804 [[link boost_asio.reference.ip__basic_resolver.results_type [*results_type]]] 100805 [The results type. ] 100806 100807 ] 100808 100809] 100810 100811[heading Member Functions] 100812[table 100813 [[Name][Description]] 100814 100815 [ 100816 [[link boost_asio.reference.ip__basic_resolver.async_resolve [*async_resolve]]] 100817 [(Deprecated: Use overload with separate host and service parameters.) Asynchronously perform forward resolution of a query to a list of entries. 100818 [hr] 100819 Asynchronously perform forward resolution of a query to a list of entries. 100820 [hr] 100821 Asynchronously perform reverse resolution of an endpoint to a list of entries. ] 100822 ] 100823 100824 [ 100825 [[link boost_asio.reference.ip__basic_resolver.basic_resolver [*basic_resolver]] [constructor]] 100826 [Construct with executor. 100827 [hr] 100828 Construct with execution context. 100829 [hr] 100830 Move-construct a basic_resolver from another. ] 100831 ] 100832 100833 [ 100834 [[link boost_asio.reference.ip__basic_resolver.cancel [*cancel]]] 100835 [Cancel any asynchronous operations that are waiting on the resolver. ] 100836 ] 100837 100838 [ 100839 [[link boost_asio.reference.ip__basic_resolver.get_executor [*get_executor]]] 100840 [Get the executor associated with the object. ] 100841 ] 100842 100843 [ 100844 [[link boost_asio.reference.ip__basic_resolver.operator_eq_ [*operator=]]] 100845 [Move-assign a basic_resolver from another. ] 100846 ] 100847 100848 [ 100849 [[link boost_asio.reference.ip__basic_resolver.resolve [*resolve]]] 100850 [(Deprecated: Use overload with separate host and service parameters.) Perform forward resolution of a query to a list of entries. 100851 [hr] 100852 Perform forward resolution of a query to a list of entries. 100853 [hr] 100854 Perform reverse resolution of an endpoint to a list of entries. ] 100855 ] 100856 100857 [ 100858 [[link boost_asio.reference.ip__basic_resolver._basic_resolver [*~basic_resolver]] [destructor]] 100859 [Destroys the resolver. ] 100860 ] 100861 100862] 100863 100864[heading Data Members] 100865[table 100866 [[Name][Description]] 100867 100868 [ 100869 [[link boost_asio.reference.ip__basic_resolver.address_configured [*address_configured]] [static]] 100870 [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. ] 100871 ] 100872 100873 [ 100874 [[link boost_asio.reference.ip__basic_resolver.all_matching [*all_matching]] [static]] 100875 [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ] 100876 ] 100877 100878 [ 100879 [[link boost_asio.reference.ip__basic_resolver.canonical_name [*canonical_name]] [static]] 100880 [Determine the canonical name of the host specified in the query. ] 100881 ] 100882 100883 [ 100884 [[link boost_asio.reference.ip__basic_resolver.numeric_host [*numeric_host]] [static]] 100885 [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ] 100886 ] 100887 100888 [ 100889 [[link boost_asio.reference.ip__basic_resolver.numeric_service [*numeric_service]] [static]] 100890 [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ] 100891 ] 100892 100893 [ 100894 [[link boost_asio.reference.ip__basic_resolver.passive [*passive]] [static]] 100895 [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ] 100896 ] 100897 100898 [ 100899 [[link boost_asio.reference.ip__basic_resolver.v4_mapped [*v4_mapped]] [static]] 100900 [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ] 100901 ] 100902 100903] 100904 100905The [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] class template provides the ability to resolve a query to a list of endpoints. 100906 100907 100908[heading Thread Safety] 100909 100910['Distinct] ['objects:] Safe. 100911 100912['Shared] ['objects:] Unsafe. 100913 100914 100915 100916 100917[heading Requirements] 100918 100919['Header: ][^boost/asio/ip/udp.hpp] 100920 100921['Convenience header: ][^boost/asio.hpp] 100922 100923 100924[endsect] 100925 100926 100927 100928[section:socket ip::udp::socket] 100929 100930[indexterm2 boost_asio.indexterm.ip__udp.socket..socket..ip::udp] 100931The UDP socket type. 100932 100933 100934 typedef basic_datagram_socket< udp > socket; 100935 100936 100937[heading Types] 100938[table 100939 [[Name][Description]] 100940 100941 [ 100942 100943 [[link boost_asio.reference.basic_datagram_socket__rebind_executor [*rebind_executor]]] 100944 [Rebinds the socket type to another executor. ] 100945 100946 ] 100947 100948 [ 100949 100950 [[link boost_asio.reference.basic_datagram_socket.broadcast [*broadcast]]] 100951 [Socket option to permit sending of broadcast messages. ] 100952 100953 ] 100954 100955 [ 100956 100957 [[link boost_asio.reference.basic_datagram_socket.bytes_readable [*bytes_readable]]] 100958 [IO control command to get the amount of data that can be read without blocking. ] 100959 100960 ] 100961 100962 [ 100963 100964 [[link boost_asio.reference.basic_datagram_socket.debug [*debug]]] 100965 [Socket option to enable socket-level debugging. ] 100966 100967 ] 100968 100969 [ 100970 100971 [[link boost_asio.reference.basic_datagram_socket.do_not_route [*do_not_route]]] 100972 [Socket option to prevent routing, use local interfaces only. ] 100973 100974 ] 100975 100976 [ 100977 100978 [[link boost_asio.reference.basic_datagram_socket.enable_connection_aborted [*enable_connection_aborted]]] 100979 [Socket option to report aborted connections on accept. ] 100980 100981 ] 100982 100983 [ 100984 100985 [[link boost_asio.reference.basic_datagram_socket.endpoint_type [*endpoint_type]]] 100986 [The endpoint type. ] 100987 100988 ] 100989 100990 [ 100991 100992 [[link boost_asio.reference.basic_datagram_socket.executor_type [*executor_type]]] 100993 [The type of the executor associated with the object. ] 100994 100995 ] 100996 100997 [ 100998 100999 [[link boost_asio.reference.basic_datagram_socket.keep_alive [*keep_alive]]] 101000 [Socket option to send keep-alives. ] 101001 101002 ] 101003 101004 [ 101005 101006 [[link boost_asio.reference.basic_datagram_socket.linger [*linger]]] 101007 [Socket option to specify whether the socket lingers on close if unsent data is present. ] 101008 101009 ] 101010 101011 [ 101012 101013 [[link boost_asio.reference.basic_datagram_socket.lowest_layer_type [*lowest_layer_type]]] 101014 [A basic_socket is always the lowest layer. ] 101015 101016 ] 101017 101018 [ 101019 101020 [[link boost_asio.reference.basic_datagram_socket.message_flags [*message_flags]]] 101021 [Bitmask type for flags that can be passed to send and receive operations. ] 101022 101023 ] 101024 101025 [ 101026 101027 [[link boost_asio.reference.basic_datagram_socket.native_handle_type [*native_handle_type]]] 101028 [The native representation of a socket. ] 101029 101030 ] 101031 101032 [ 101033 101034 [[link boost_asio.reference.basic_datagram_socket.out_of_band_inline [*out_of_band_inline]]] 101035 [Socket option for putting received out-of-band data inline. ] 101036 101037 ] 101038 101039 [ 101040 101041 [[link boost_asio.reference.basic_datagram_socket.protocol_type [*protocol_type]]] 101042 [The protocol type. ] 101043 101044 ] 101045 101046 [ 101047 101048 [[link boost_asio.reference.basic_datagram_socket.receive_buffer_size [*receive_buffer_size]]] 101049 [Socket option for the receive buffer size of a socket. ] 101050 101051 ] 101052 101053 [ 101054 101055 [[link boost_asio.reference.basic_datagram_socket.receive_low_watermark [*receive_low_watermark]]] 101056 [Socket option for the receive low watermark. ] 101057 101058 ] 101059 101060 [ 101061 101062 [[link boost_asio.reference.basic_datagram_socket.reuse_address [*reuse_address]]] 101063 [Socket option to allow the socket to be bound to an address that is already in use. ] 101064 101065 ] 101066 101067 [ 101068 101069 [[link boost_asio.reference.basic_datagram_socket.send_buffer_size [*send_buffer_size]]] 101070 [Socket option for the send buffer size of a socket. ] 101071 101072 ] 101073 101074 [ 101075 101076 [[link boost_asio.reference.basic_datagram_socket.send_low_watermark [*send_low_watermark]]] 101077 [Socket option for the send low watermark. ] 101078 101079 ] 101080 101081 [ 101082 101083 [[link boost_asio.reference.basic_datagram_socket.shutdown_type [*shutdown_type]]] 101084 [Different ways a socket may be shutdown. ] 101085 101086 ] 101087 101088 [ 101089 101090 [[link boost_asio.reference.basic_datagram_socket.wait_type [*wait_type]]] 101091 [Wait types. ] 101092 101093 ] 101094 101095] 101096 101097[heading Member Functions] 101098[table 101099 [[Name][Description]] 101100 101101 [ 101102 [[link boost_asio.reference.basic_datagram_socket.assign [*assign]]] 101103 [Assign an existing native socket to the socket. ] 101104 ] 101105 101106 [ 101107 [[link boost_asio.reference.basic_datagram_socket.async_connect [*async_connect]]] 101108 [Start an asynchronous connect. ] 101109 ] 101110 101111 [ 101112 [[link boost_asio.reference.basic_datagram_socket.async_receive [*async_receive]]] 101113 [Start an asynchronous receive on a connected socket. ] 101114 ] 101115 101116 [ 101117 [[link boost_asio.reference.basic_datagram_socket.async_receive_from [*async_receive_from]]] 101118 [Start an asynchronous receive. ] 101119 ] 101120 101121 [ 101122 [[link boost_asio.reference.basic_datagram_socket.async_send [*async_send]]] 101123 [Start an asynchronous send on a connected socket. ] 101124 ] 101125 101126 [ 101127 [[link boost_asio.reference.basic_datagram_socket.async_send_to [*async_send_to]]] 101128 [Start an asynchronous send. ] 101129 ] 101130 101131 [ 101132 [[link boost_asio.reference.basic_datagram_socket.async_wait [*async_wait]]] 101133 [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 101134 ] 101135 101136 [ 101137 [[link boost_asio.reference.basic_datagram_socket.at_mark [*at_mark]]] 101138 [Determine whether the socket is at the out-of-band data mark. ] 101139 ] 101140 101141 [ 101142 [[link boost_asio.reference.basic_datagram_socket.available [*available]]] 101143 [Determine the number of bytes available for reading. ] 101144 ] 101145 101146 [ 101147 [[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket [*basic_datagram_socket]] [constructor]] 101148 [Construct a basic_datagram_socket without opening it. 101149 [hr] 101150 Construct and open a basic_datagram_socket. 101151 [hr] 101152 Construct a basic_datagram_socket, opening it and binding it to the given local endpoint. 101153 [hr] 101154 Construct a basic_datagram_socket on an existing native socket. 101155 [hr] 101156 Move-construct a basic_datagram_socket from another. 101157 [hr] 101158 Move-construct a basic_datagram_socket from a socket of another protocol type. ] 101159 ] 101160 101161 [ 101162 [[link boost_asio.reference.basic_datagram_socket.bind [*bind]]] 101163 [Bind the socket to the given local endpoint. ] 101164 ] 101165 101166 [ 101167 [[link boost_asio.reference.basic_datagram_socket.cancel [*cancel]]] 101168 [Cancel all asynchronous operations associated with the socket. ] 101169 ] 101170 101171 [ 101172 [[link boost_asio.reference.basic_datagram_socket.close [*close]]] 101173 [Close the socket. ] 101174 ] 101175 101176 [ 101177 [[link boost_asio.reference.basic_datagram_socket.connect [*connect]]] 101178 [Connect the socket to the specified endpoint. ] 101179 ] 101180 101181 [ 101182 [[link boost_asio.reference.basic_datagram_socket.get_executor [*get_executor]]] 101183 [Get the executor associated with the object. ] 101184 ] 101185 101186 [ 101187 [[link boost_asio.reference.basic_datagram_socket.get_option [*get_option]]] 101188 [Get an option from the socket. ] 101189 ] 101190 101191 [ 101192 [[link boost_asio.reference.basic_datagram_socket.io_control [*io_control]]] 101193 [Perform an IO control command on the socket. ] 101194 ] 101195 101196 [ 101197 [[link boost_asio.reference.basic_datagram_socket.is_open [*is_open]]] 101198 [Determine whether the socket is open. ] 101199 ] 101200 101201 [ 101202 [[link boost_asio.reference.basic_datagram_socket.local_endpoint [*local_endpoint]]] 101203 [Get the local endpoint of the socket. ] 101204 ] 101205 101206 [ 101207 [[link boost_asio.reference.basic_datagram_socket.lowest_layer [*lowest_layer]]] 101208 [Get a reference to the lowest layer. 101209 [hr] 101210 Get a const reference to the lowest layer. ] 101211 ] 101212 101213 [ 101214 [[link boost_asio.reference.basic_datagram_socket.native_handle [*native_handle]]] 101215 [Get the native socket representation. ] 101216 ] 101217 101218 [ 101219 [[link boost_asio.reference.basic_datagram_socket.native_non_blocking [*native_non_blocking]]] 101220 [Gets the non-blocking mode of the native socket implementation. 101221 [hr] 101222 Sets the non-blocking mode of the native socket implementation. ] 101223 ] 101224 101225 [ 101226 [[link boost_asio.reference.basic_datagram_socket.non_blocking [*non_blocking]]] 101227 [Gets the non-blocking mode of the socket. 101228 [hr] 101229 Sets the non-blocking mode of the socket. ] 101230 ] 101231 101232 [ 101233 [[link boost_asio.reference.basic_datagram_socket.open [*open]]] 101234 [Open the socket using the specified protocol. ] 101235 ] 101236 101237 [ 101238 [[link boost_asio.reference.basic_datagram_socket.operator_eq_ [*operator=]]] 101239 [Move-assign a basic_datagram_socket from another. 101240 [hr] 101241 Move-assign a basic_datagram_socket from a socket of another protocol type. ] 101242 ] 101243 101244 [ 101245 [[link boost_asio.reference.basic_datagram_socket.receive [*receive]]] 101246 [Receive some data on a connected socket. ] 101247 ] 101248 101249 [ 101250 [[link boost_asio.reference.basic_datagram_socket.receive_from [*receive_from]]] 101251 [Receive a datagram with the endpoint of the sender. ] 101252 ] 101253 101254 [ 101255 [[link boost_asio.reference.basic_datagram_socket.release [*release]]] 101256 [Release ownership of the underlying native socket. ] 101257 ] 101258 101259 [ 101260 [[link boost_asio.reference.basic_datagram_socket.remote_endpoint [*remote_endpoint]]] 101261 [Get the remote endpoint of the socket. ] 101262 ] 101263 101264 [ 101265 [[link boost_asio.reference.basic_datagram_socket.send [*send]]] 101266 [Send some data on a connected socket. ] 101267 ] 101268 101269 [ 101270 [[link boost_asio.reference.basic_datagram_socket.send_to [*send_to]]] 101271 [Send a datagram to the specified endpoint. ] 101272 ] 101273 101274 [ 101275 [[link boost_asio.reference.basic_datagram_socket.set_option [*set_option]]] 101276 [Set an option on the socket. ] 101277 ] 101278 101279 [ 101280 [[link boost_asio.reference.basic_datagram_socket.shutdown [*shutdown]]] 101281 [Disable sends or receives on the socket. ] 101282 ] 101283 101284 [ 101285 [[link boost_asio.reference.basic_datagram_socket.wait [*wait]]] 101286 [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 101287 ] 101288 101289 [ 101290 [[link boost_asio.reference.basic_datagram_socket._basic_datagram_socket [*~basic_datagram_socket]] [destructor]] 101291 [Destroys the socket. ] 101292 ] 101293 101294] 101295 101296[heading Data Members] 101297[table 101298 [[Name][Description]] 101299 101300 [ 101301 [[link boost_asio.reference.basic_datagram_socket.max_connections [*max_connections]] [static]] 101302 [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ] 101303 ] 101304 101305 [ 101306 [[link boost_asio.reference.basic_datagram_socket.max_listen_connections [*max_listen_connections]] [static]] 101307 [The maximum length of the queue of pending incoming connections. ] 101308 ] 101309 101310 [ 101311 [[link boost_asio.reference.basic_datagram_socket.message_do_not_route [*message_do_not_route]] [static]] 101312 [Specify that the data should not be subject to routing. ] 101313 ] 101314 101315 [ 101316 [[link boost_asio.reference.basic_datagram_socket.message_end_of_record [*message_end_of_record]] [static]] 101317 [Specifies that the data marks the end of a record. ] 101318 ] 101319 101320 [ 101321 [[link boost_asio.reference.basic_datagram_socket.message_out_of_band [*message_out_of_band]] [static]] 101322 [Process out-of-band data. ] 101323 ] 101324 101325 [ 101326 [[link boost_asio.reference.basic_datagram_socket.message_peek [*message_peek]] [static]] 101327 [Peek at incoming data without removing it from the input queue. ] 101328 ] 101329 101330] 101331 101332The [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] class template provides asynchronous and blocking datagram-oriented socket functionality. 101333 101334 101335[heading Thread Safety] 101336 101337['Distinct] ['objects:] Safe. 101338 101339['Shared] ['objects:] Unsafe. 101340 101341Synchronous `send`, `send_to`, `receive`, `receive_from`, and `connect` operations are thread safe with respect to each other, if the underlying operating system calls are also thread safe. This means that it is permitted to perform concurrent calls to these synchronous operations on a single socket object. Other synchronous operations, such as `open` or `close`, are not thread safe. 101342 101343 101344[heading Requirements] 101345 101346['Header: ][^boost/asio/ip/udp.hpp] 101347 101348['Convenience header: ][^boost/asio.hpp] 101349 101350 101351[endsect] 101352 101353 101354 101355[section:type ip::udp::type] 101356 101357[indexterm2 boost_asio.indexterm.ip__udp.type..type..ip::udp] 101358Obtain an identifier for the type of the protocol. 101359 101360 101361 int type() const; 101362 101363 101364 101365[endsect] 101366 101367 101368 101369[section:v4 ip::udp::v4] 101370 101371[indexterm2 boost_asio.indexterm.ip__udp.v4..v4..ip::udp] 101372Construct to represent the IPv4 UDP protocol. 101373 101374 101375 static udp v4(); 101376 101377 101378 101379[endsect] 101380 101381 101382 101383[section:v6 ip::udp::v6] 101384 101385[indexterm2 boost_asio.indexterm.ip__udp.v6..v6..ip::udp] 101386Construct to represent the IPv6 UDP protocol. 101387 101388 101389 static udp v6(); 101390 101391 101392 101393[endsect] 101394 101395 101396 101397[endsect] 101398 101399 101400[section:ip__unicast__hops ip::unicast::hops] 101401 101402[indexterm1 boost_asio.indexterm.ip__unicast__hops..ip::unicast::hops] 101403Socket option for time-to-live associated with outgoing unicast packets. 101404 101405 101406 typedef implementation_defined hops; 101407 101408 101409 101410Implements the IPPROTO\_IP/IP\_UNICAST\_TTL socket option. 101411 101412 101413[heading Examples] 101414 101415Setting the option: 101416 101417 boost::asio::ip::udp::socket socket(my_context); 101418 ... 101419 boost::asio::ip::unicast::hops option(4); 101420 socket.set_option(option); 101421 101422 101423 101424 101425 101426Getting the current option value: 101427 101428 boost::asio::ip::udp::socket socket(my_context); 101429 ... 101430 boost::asio::ip::unicast::hops option; 101431 socket.get_option(option); 101432 int ttl = option.value(); 101433 101434 101435 101436 101437 101438 101439 101440[heading Requirements] 101441 101442['Header: ][^boost/asio/ip/unicast.hpp] 101443 101444['Convenience header: ][^boost/asio.hpp] 101445 101446 101447[endsect] 101448 101449 101450 101451[section:ip__v4_mapped_t ip::v4_mapped_t] 101452 101453[indexterm1 boost_asio.indexterm.ip__v4_mapped_t..ip::v4_mapped_t] 101454Tag type used for distinguishing overloads that deal in IPv4-mapped IPv6 addresses. 101455 101456 101457 enum v4_mapped_t 101458 101459[indexterm2 boost_asio.indexterm.ip__v4_mapped_t.v4_mapped..v4_mapped..ip::v4_mapped_t] 101460 101461[heading Values] 101462[variablelist 101463 101464 [ 101465 [v4_mapped] 101466 [] 101467 ] 101468 101469] 101470 101471 101472[heading Requirements] 101473 101474['Header: ][^boost/asio/ip/address_v6.hpp] 101475 101476['Convenience header: ][^boost/asio.hpp] 101477 101478 101479[endsect] 101480 101481 101482 101483[section:ip__v6_only ip::v6_only] 101484 101485[indexterm1 boost_asio.indexterm.ip__v6_only..ip::v6_only] 101486Socket option for determining whether an IPv6 socket supports IPv6 communication only. 101487 101488 101489 typedef implementation_defined v6_only; 101490 101491 101492 101493Implements the IPPROTO\_IPV6/IP\_V6ONLY socket option. 101494 101495 101496[heading Examples] 101497 101498Setting the option: 101499 101500 boost::asio::ip::tcp::socket socket(my_context); 101501 ... 101502 boost::asio::ip::v6_only option(true); 101503 socket.set_option(option); 101504 101505 101506 101507 101508 101509Getting the current option value: 101510 101511 boost::asio::ip::tcp::socket socket(my_context); 101512 ... 101513 boost::asio::ip::v6_only option; 101514 socket.get_option(option); 101515 bool v6_only = option.value(); 101516 101517 101518 101519 101520 101521 101522 101523[heading Requirements] 101524 101525['Header: ][^boost/asio/ip/v6_only.hpp] 101526 101527['Convenience header: ][^boost/asio.hpp] 101528 101529 101530[endsect] 101531 101532 101533[section:is_applicable_property is_applicable_property] 101534 101535[indexterm1 boost_asio.indexterm.is_applicable_property..is_applicable_property] 101536 101537 101538 101539 template< 101540 typename T, 101541 typename Property, 101542 typename = void> 101543 struct is_applicable_property 101544 101545 101546[heading Requirements] 101547 101548['Header: ][^boost/asio/is_applicable_property.hpp] 101549 101550['Convenience header: ][^boost/asio.hpp] 101551 101552 101553[endsect] 101554 101555[section:is_const_buffer_sequence is_const_buffer_sequence] 101556 101557[indexterm1 boost_asio.indexterm.is_const_buffer_sequence..is_const_buffer_sequence] 101558 101559 101560Trait to determine whether a type satisfies the ConstBufferSequence requirements. 101561 101562 101563 template< 101564 typename T> 101565 struct is_const_buffer_sequence 101566 101567 101568[heading Requirements] 101569 101570['Header: ][^boost/asio/buffer.hpp] 101571 101572['Convenience header: ][^boost/asio.hpp] 101573 101574 101575[endsect] 101576 101577[section:is_dynamic_buffer is_dynamic_buffer] 101578 101579[indexterm1 boost_asio.indexterm.is_dynamic_buffer..is_dynamic_buffer] 101580 101581 101582Trait to determine whether a type satisfies the DynamicBuffer requirements. 101583 101584 101585 template< 101586 typename T> 101587 struct is_dynamic_buffer 101588 101589 101590If `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. 101591 101592[heading Requirements] 101593 101594['Header: ][^boost/asio/buffer.hpp] 101595 101596['Convenience header: ][^boost/asio.hpp] 101597 101598 101599[endsect] 101600 101601[section:is_dynamic_buffer_v1 is_dynamic_buffer_v1] 101602 101603[indexterm1 boost_asio.indexterm.is_dynamic_buffer_v1..is_dynamic_buffer_v1] 101604 101605 101606Trait to determine whether a type satisfies the DynamicBuffer\_v1 requirements. 101607 101608 101609 template< 101610 typename T> 101611 struct is_dynamic_buffer_v1 101612 101613 101614[heading Requirements] 101615 101616['Header: ][^boost/asio/buffer.hpp] 101617 101618['Convenience header: ][^boost/asio.hpp] 101619 101620 101621[endsect] 101622 101623[section:is_dynamic_buffer_v2 is_dynamic_buffer_v2] 101624 101625[indexterm1 boost_asio.indexterm.is_dynamic_buffer_v2..is_dynamic_buffer_v2] 101626 101627 101628Trait to determine whether a type satisfies the DynamicBuffer\_v2 requirements. 101629 101630 101631 template< 101632 typename T> 101633 struct is_dynamic_buffer_v2 101634 101635 101636[heading Requirements] 101637 101638['Header: ][^boost/asio/buffer.hpp] 101639 101640['Convenience header: ][^boost/asio.hpp] 101641 101642 101643[endsect] 101644 101645[section:is_endpoint_sequence is_endpoint_sequence] 101646 101647[indexterm1 boost_asio.indexterm.is_endpoint_sequence..is_endpoint_sequence] 101648 101649 101650Type trait used to determine whether a type is an endpoint sequence that can be used with with `connect` and `async_connect`. 101651 101652 101653 template< 101654 typename T> 101655 struct is_endpoint_sequence 101656 101657 101658[heading Data Members] 101659[table 101660 [[Name][Description]] 101661 101662 [ 101663 [[link boost_asio.reference.is_endpoint_sequence.value [*value]] [static]] 101664 [The value member is true if the type may be used as an endpoint sequence. ] 101665 ] 101666 101667] 101668 101669[heading Requirements] 101670 101671['Header: ][^boost/asio/connect.hpp] 101672 101673['Convenience header: ][^boost/asio.hpp] 101674 101675 101676[section:value is_endpoint_sequence::value] 101677 101678[indexterm2 boost_asio.indexterm.is_endpoint_sequence.value..value..is_endpoint_sequence] 101679The value member is true if the type may be used as an endpoint sequence. 101680 101681 101682 static const bool value; 101683 101684 101685 101686[endsect] 101687 101688 101689 101690[endsect] 101691 101692[section:is_executor is_executor] 101693 101694[indexterm1 boost_asio.indexterm.is_executor..is_executor] 101695 101696 101697The [link boost_asio.reference.is_executor `is_executor`] trait detects whether a type T meets the Executor type requirements. 101698 101699 101700 template< 101701 typename T> 101702 struct is_executor 101703 101704 101705Class 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`. 101706 101707[heading Requirements] 101708 101709['Header: ][^boost/asio/is_executor.hpp] 101710 101711['Convenience header: ][^boost/asio.hpp] 101712 101713 101714[endsect] 101715 101716[section:is_match_condition is_match_condition] 101717 101718[indexterm1 boost_asio.indexterm.is_match_condition..is_match_condition] 101719 101720 101721Type trait used to determine whether a type can be used as a match condition function with read\_until and async\_read\_until. 101722 101723 101724 template< 101725 typename T> 101726 struct is_match_condition 101727 101728 101729[heading Data Members] 101730[table 101731 [[Name][Description]] 101732 101733 [ 101734 [[link boost_asio.reference.is_match_condition.value [*value]] [static]] 101735 [The value member is true if the type may be used as a match condition. ] 101736 ] 101737 101738] 101739 101740[heading Requirements] 101741 101742['Header: ][^boost/asio/read_until.hpp] 101743 101744['Convenience header: ][^boost/asio.hpp] 101745 101746 101747[section:value is_match_condition::value] 101748 101749[indexterm2 boost_asio.indexterm.is_match_condition.value..value..is_match_condition] 101750The value member is true if the type may be used as a match condition. 101751 101752 101753 static const bool value; 101754 101755 101756 101757[endsect] 101758 101759 101760 101761[endsect] 101762 101763[section:is_mutable_buffer_sequence is_mutable_buffer_sequence] 101764 101765[indexterm1 boost_asio.indexterm.is_mutable_buffer_sequence..is_mutable_buffer_sequence] 101766 101767 101768Trait to determine whether a type satisfies the MutableBufferSequence requirements. 101769 101770 101771 template< 101772 typename T> 101773 struct is_mutable_buffer_sequence 101774 101775 101776[heading Requirements] 101777 101778['Header: ][^boost/asio/buffer.hpp] 101779 101780['Convenience header: ][^boost/asio.hpp] 101781 101782 101783[endsect] 101784 101785[section:is_nothrow_prefer is_nothrow_prefer] 101786 101787[indexterm1 boost_asio.indexterm.is_nothrow_prefer..is_nothrow_prefer] 101788 101789 101790A type trait that determines whether a `prefer` expression will not throw. 101791 101792 101793 template< 101794 typename T, 101795 typename... Properties> 101796 struct is_nothrow_prefer 101797 101798 101799Class template `is_nothrow_prefer` is a trait that is derived from `true_type` if the expression `boost::asio::prefer(std::declval<T>(), std::declval<Properties>()...)` is `noexcept`; otherwise `false_type`. 101800 101801[heading Requirements] 101802 101803['Header: ][^boost/asio/prefer.hpp] 101804 101805['Convenience header: ][^boost/asio.hpp] 101806 101807 101808[endsect] 101809 101810[section:is_nothrow_query is_nothrow_query] 101811 101812[indexterm1 boost_asio.indexterm.is_nothrow_query..is_nothrow_query] 101813 101814 101815A type trait that determines whether a `query` expression will not throw. 101816 101817 101818 template< 101819 typename T, 101820 typename Property> 101821 struct is_nothrow_query 101822 101823 101824Class template `is_nothrow_query` is a trait that is derived from `true_type` if the expression `boost::asio::query(std::declval<T>(), std::declval<Property>())` is `noexcept`; otherwise `false_type`. 101825 101826[heading Requirements] 101827 101828['Header: ][^boost/asio/query.hpp] 101829 101830['Convenience header: ][^boost/asio.hpp] 101831 101832 101833[endsect] 101834 101835[section:is_nothrow_require is_nothrow_require] 101836 101837[indexterm1 boost_asio.indexterm.is_nothrow_require..is_nothrow_require] 101838 101839 101840A type trait that determines whether a `require` expression will not throw. 101841 101842 101843 template< 101844 typename T, 101845 typename... Properties> 101846 struct is_nothrow_require 101847 101848 101849Class template `is_nothrow_require` is a trait that is derived from `true_type` if the expression `boost::asio::require(std::declval<T>(), std::declval<Properties>()...)` is `noexcept`; otherwise `false_type`. 101850 101851[heading Requirements] 101852 101853['Header: ][^boost/asio/require.hpp] 101854 101855['Convenience header: ][^boost/asio.hpp] 101856 101857 101858[endsect] 101859 101860[section:is_nothrow_require_concept is_nothrow_require_concept] 101861 101862[indexterm1 boost_asio.indexterm.is_nothrow_require_concept..is_nothrow_require_concept] 101863 101864 101865A type trait that determines whether a `require_concept` expression will not throw. 101866 101867 101868 template< 101869 typename T, 101870 typename Property> 101871 struct is_nothrow_require_concept 101872 101873 101874Class template `is_nothrow_require_concept` is a trait that is derived from `true_type` if the expression `boost::asio::require_concept(std::declval<T>(), std::declval<Property>())` is `noexcept`; otherwise `false_type`. 101875 101876[heading Requirements] 101877 101878['Header: ][^boost/asio/require_concept.hpp] 101879 101880['Convenience header: ][^boost/asio.hpp] 101881 101882 101883[endsect] 101884 101885[section:is_read_buffered is_read_buffered] 101886 101887[indexterm1 boost_asio.indexterm.is_read_buffered..is_read_buffered] 101888 101889 101890The [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. 101891 101892 101893 template< 101894 typename Stream> 101895 class is_read_buffered 101896 101897 101898[heading Data Members] 101899[table 101900 [[Name][Description]] 101901 101902 [ 101903 [[link boost_asio.reference.is_read_buffered.value [*value]] [static]] 101904 [The value member is true only if the Stream type supports buffering of read data. ] 101905 ] 101906 101907] 101908 101909[heading Requirements] 101910 101911['Header: ][^boost/asio/is_read_buffered.hpp] 101912 101913['Convenience header: ][^boost/asio.hpp] 101914 101915 101916[section:value is_read_buffered::value] 101917 101918[indexterm2 boost_asio.indexterm.is_read_buffered.value..value..is_read_buffered] 101919The value member is true only if the Stream type supports buffering of read data. 101920 101921 101922 static const bool value; 101923 101924 101925 101926[endsect] 101927 101928 101929 101930[endsect] 101931 101932[section:is_write_buffered is_write_buffered] 101933 101934[indexterm1 boost_asio.indexterm.is_write_buffered..is_write_buffered] 101935 101936 101937The [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. 101938 101939 101940 template< 101941 typename Stream> 101942 class is_write_buffered 101943 101944 101945[heading Data Members] 101946[table 101947 [[Name][Description]] 101948 101949 [ 101950 [[link boost_asio.reference.is_write_buffered.value [*value]] [static]] 101951 [The value member is true only if the Stream type supports buffering of written data. ] 101952 ] 101953 101954] 101955 101956[heading Requirements] 101957 101958['Header: ][^boost/asio/is_write_buffered.hpp] 101959 101960['Convenience header: ][^boost/asio.hpp] 101961 101962 101963[section:value is_write_buffered::value] 101964 101965[indexterm2 boost_asio.indexterm.is_write_buffered.value..value..is_write_buffered] 101966The value member is true only if the Stream type supports buffering of written data. 101967 101968 101969 static const bool value; 101970 101971 101972 101973[endsect] 101974 101975 101976 101977[endsect] 101978 101979[section:local__basic_endpoint local::basic_endpoint] 101980 101981[indexterm1 boost_asio.indexterm.local__basic_endpoint..local::basic_endpoint] 101982 101983 101984Describes an endpoint for a UNIX socket. 101985 101986 101987 template< 101988 typename ``[link boost_asio.reference.Protocol Protocol]``> 101989 class basic_endpoint 101990 101991 101992[heading Types] 101993[table 101994 [[Name][Description]] 101995 101996 [ 101997 101998 [[link boost_asio.reference.local__basic_endpoint.data_type [*data_type]]] 101999 [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ] 102000 102001 ] 102002 102003 [ 102004 102005 [[link boost_asio.reference.local__basic_endpoint.protocol_type [*protocol_type]]] 102006 [The protocol type associated with the endpoint. ] 102007 102008 ] 102009 102010] 102011 102012[heading Member Functions] 102013[table 102014 [[Name][Description]] 102015 102016 [ 102017 [[link boost_asio.reference.local__basic_endpoint.basic_endpoint [*basic_endpoint]] [constructor]] 102018 [Default constructor. 102019 [hr] 102020 Construct an endpoint using the specified path name. 102021 [hr] 102022 Copy constructor. ] 102023 ] 102024 102025 [ 102026 [[link boost_asio.reference.local__basic_endpoint.capacity [*capacity]]] 102027 [Get the capacity of the endpoint in the native type. ] 102028 ] 102029 102030 [ 102031 [[link boost_asio.reference.local__basic_endpoint.data [*data]]] 102032 [Get the underlying endpoint in the native type. ] 102033 ] 102034 102035 [ 102036 [[link boost_asio.reference.local__basic_endpoint.operator_eq_ [*operator=]]] 102037 [Assign from another endpoint. ] 102038 ] 102039 102040 [ 102041 [[link boost_asio.reference.local__basic_endpoint.path [*path]]] 102042 [Get the path associated with the endpoint. 102043 [hr] 102044 Set the path associated with the endpoint. ] 102045 ] 102046 102047 [ 102048 [[link boost_asio.reference.local__basic_endpoint.protocol [*protocol]]] 102049 [The protocol associated with the endpoint. ] 102050 ] 102051 102052 [ 102053 [[link boost_asio.reference.local__basic_endpoint.resize [*resize]]] 102054 [Set the underlying size of the endpoint in the native type. ] 102055 ] 102056 102057 [ 102058 [[link boost_asio.reference.local__basic_endpoint.size [*size]]] 102059 [Get the underlying size of the endpoint in the native type. ] 102060 ] 102061 102062] 102063 102064[heading Friends] 102065[table 102066 [[Name][Description]] 102067 102068 [ 102069 [[link boost_asio.reference.local__basic_endpoint.operator_not__eq_ [*operator!=]]] 102070 [Compare two endpoints for inequality. ] 102071 ] 102072 102073 [ 102074 [[link boost_asio.reference.local__basic_endpoint.operator_lt_ [*operator<]]] 102075 [Compare endpoints for ordering. ] 102076 ] 102077 102078 [ 102079 [[link boost_asio.reference.local__basic_endpoint.operator_lt__eq_ [*operator<=]]] 102080 [Compare endpoints for ordering. ] 102081 ] 102082 102083 [ 102084 [[link boost_asio.reference.local__basic_endpoint.operator_eq__eq_ [*operator==]]] 102085 [Compare two endpoints for equality. ] 102086 ] 102087 102088 [ 102089 [[link boost_asio.reference.local__basic_endpoint.operator_gt_ [*operator>]]] 102090 [Compare endpoints for ordering. ] 102091 ] 102092 102093 [ 102094 [[link boost_asio.reference.local__basic_endpoint.operator_gt__eq_ [*operator>=]]] 102095 [Compare endpoints for ordering. ] 102096 ] 102097 102098] 102099 102100[heading Related Functions] 102101[table 102102 [[Name][Description]] 102103 102104 [ 102105 [[link boost_asio.reference.local__basic_endpoint.operator_lt__lt_ [*operator<<]]] 102106 [Output an endpoint as a string. ] 102107 ] 102108 102109] 102110 102111The [link boost_asio.reference.local__basic_endpoint `local::basic_endpoint`] class template describes an endpoint that may be associated with a particular UNIX socket. 102112 102113 102114[heading Thread Safety] 102115 102116['Distinct] ['objects:] Safe. 102117 102118['Shared] ['objects:] Unsafe. 102119 102120 102121 102122 102123[heading Requirements] 102124 102125['Header: ][^boost/asio/local/basic_endpoint.hpp] 102126 102127['Convenience header: ][^boost/asio.hpp] 102128 102129[section:basic_endpoint local::basic_endpoint::basic_endpoint] 102130 102131[indexterm2 boost_asio.indexterm.local__basic_endpoint.basic_endpoint..basic_endpoint..local::basic_endpoint] 102132Default constructor. 102133 102134 102135 ``[link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload1 basic_endpoint]``(); 102136 `` [''''»''' [link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload1 more...]]`` 102137 102138 102139Construct an endpoint using the specified path name. 102140 102141 102142 ``[link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload2 basic_endpoint]``( 102143 const char * path_name); 102144 `` [''''»''' [link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload2 more...]]`` 102145 102146 ``[link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload3 basic_endpoint]``( 102147 const std::string & path_name); 102148 `` [''''»''' [link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload3 more...]]`` 102149 102150 102151Copy constructor. 102152 102153 102154 ``[link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload4 basic_endpoint]``( 102155 const basic_endpoint & other); 102156 `` [''''»''' [link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload4 more...]]`` 102157 102158 102159[section:overload1 local::basic_endpoint::basic_endpoint (1 of 4 overloads)] 102160 102161 102162Default constructor. 102163 102164 102165 basic_endpoint(); 102166 102167 102168 102169[endsect] 102170 102171 102172 102173[section:overload2 local::basic_endpoint::basic_endpoint (2 of 4 overloads)] 102174 102175 102176Construct an endpoint using the specified path name. 102177 102178 102179 basic_endpoint( 102180 const char * path_name); 102181 102182 102183 102184[endsect] 102185 102186 102187 102188[section:overload3 local::basic_endpoint::basic_endpoint (3 of 4 overloads)] 102189 102190 102191Construct an endpoint using the specified path name. 102192 102193 102194 basic_endpoint( 102195 const std::string & path_name); 102196 102197 102198 102199[endsect] 102200 102201 102202 102203[section:overload4 local::basic_endpoint::basic_endpoint (4 of 4 overloads)] 102204 102205 102206Copy constructor. 102207 102208 102209 basic_endpoint( 102210 const basic_endpoint & other); 102211 102212 102213 102214[endsect] 102215 102216 102217[endsect] 102218 102219 102220[section:capacity local::basic_endpoint::capacity] 102221 102222[indexterm2 boost_asio.indexterm.local__basic_endpoint.capacity..capacity..local::basic_endpoint] 102223Get the capacity of the endpoint in the native type. 102224 102225 102226 std::size_t capacity() const; 102227 102228 102229 102230[endsect] 102231 102232 102233[section:data local::basic_endpoint::data] 102234 102235[indexterm2 boost_asio.indexterm.local__basic_endpoint.data..data..local::basic_endpoint] 102236Get the underlying endpoint in the native type. 102237 102238 102239 data_type * ``[link boost_asio.reference.local__basic_endpoint.data.overload1 data]``(); 102240 `` [''''»''' [link boost_asio.reference.local__basic_endpoint.data.overload1 more...]]`` 102241 102242 const data_type * ``[link boost_asio.reference.local__basic_endpoint.data.overload2 data]``() const; 102243 `` [''''»''' [link boost_asio.reference.local__basic_endpoint.data.overload2 more...]]`` 102244 102245 102246[section:overload1 local::basic_endpoint::data (1 of 2 overloads)] 102247 102248 102249Get the underlying endpoint in the native type. 102250 102251 102252 data_type * data(); 102253 102254 102255 102256[endsect] 102257 102258 102259 102260[section:overload2 local::basic_endpoint::data (2 of 2 overloads)] 102261 102262 102263Get the underlying endpoint in the native type. 102264 102265 102266 const data_type * data() const; 102267 102268 102269 102270[endsect] 102271 102272 102273[endsect] 102274 102275 102276[section:data_type local::basic_endpoint::data_type] 102277 102278[indexterm2 boost_asio.indexterm.local__basic_endpoint.data_type..data_type..local::basic_endpoint] 102279The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. 102280 102281 102282 typedef implementation_defined data_type; 102283 102284 102285 102286[heading Requirements] 102287 102288['Header: ][^boost/asio/local/basic_endpoint.hpp] 102289 102290['Convenience header: ][^boost/asio.hpp] 102291 102292 102293[endsect] 102294 102295 102296 102297[section:operator_not__eq_ local::basic_endpoint::operator!=] 102298 102299[indexterm2 boost_asio.indexterm.local__basic_endpoint.operator_not__eq_..operator!=..local::basic_endpoint] 102300Compare two endpoints for inequality. 102301 102302 102303 friend bool operator!=( 102304 const basic_endpoint< Protocol > & e1, 102305 const basic_endpoint< Protocol > & e2); 102306 102307 102308[heading Requirements] 102309 102310['Header: ][^boost/asio/local/basic_endpoint.hpp] 102311 102312['Convenience header: ][^boost/asio.hpp] 102313 102314 102315[endsect] 102316 102317 102318 102319[section:operator_lt_ local::basic_endpoint::operator<] 102320 102321[indexterm2 boost_asio.indexterm.local__basic_endpoint.operator_lt_..operator<..local::basic_endpoint] 102322Compare endpoints for ordering. 102323 102324 102325 friend bool operator<( 102326 const basic_endpoint< Protocol > & e1, 102327 const basic_endpoint< Protocol > & e2); 102328 102329 102330[heading Requirements] 102331 102332['Header: ][^boost/asio/local/basic_endpoint.hpp] 102333 102334['Convenience header: ][^boost/asio.hpp] 102335 102336 102337[endsect] 102338 102339 102340 102341[section:operator_lt__lt_ local::basic_endpoint::operator<<] 102342 102343[indexterm2 boost_asio.indexterm.local__basic_endpoint.operator_lt__lt_..operator<<..local::basic_endpoint] 102344Output an endpoint as a string. 102345 102346 102347 std::basic_ostream< Elem, Traits > & operator<<( 102348 std::basic_ostream< Elem, Traits > & os, 102349 const basic_endpoint< Protocol > & endpoint); 102350 102351 102352Used to output a human-readable string for a specified endpoint. 102353 102354 102355[heading Parameters] 102356 102357 102358[variablelist 102359 102360[[os][The output stream to which the string will be written.]] 102361 102362[[endpoint][The endpoint to be written.]] 102363 102364] 102365 102366 102367[heading Return Value] 102368 102369The output stream. 102370 102371 102372 102373 102374[endsect] 102375 102376 102377 102378[section:operator_lt__eq_ local::basic_endpoint::operator<=] 102379 102380[indexterm2 boost_asio.indexterm.local__basic_endpoint.operator_lt__eq_..operator<=..local::basic_endpoint] 102381Compare endpoints for ordering. 102382 102383 102384 friend bool operator<=( 102385 const basic_endpoint< Protocol > & e1, 102386 const basic_endpoint< Protocol > & e2); 102387 102388 102389[heading Requirements] 102390 102391['Header: ][^boost/asio/local/basic_endpoint.hpp] 102392 102393['Convenience header: ][^boost/asio.hpp] 102394 102395 102396[endsect] 102397 102398 102399 102400[section:operator_eq_ local::basic_endpoint::operator=] 102401 102402[indexterm2 boost_asio.indexterm.local__basic_endpoint.operator_eq_..operator=..local::basic_endpoint] 102403Assign from another endpoint. 102404 102405 102406 basic_endpoint & operator=( 102407 const basic_endpoint & other); 102408 102409 102410 102411[endsect] 102412 102413 102414 102415[section:operator_eq__eq_ local::basic_endpoint::operator==] 102416 102417[indexterm2 boost_asio.indexterm.local__basic_endpoint.operator_eq__eq_..operator==..local::basic_endpoint] 102418Compare two endpoints for equality. 102419 102420 102421 friend bool operator==( 102422 const basic_endpoint< Protocol > & e1, 102423 const basic_endpoint< Protocol > & e2); 102424 102425 102426[heading Requirements] 102427 102428['Header: ][^boost/asio/local/basic_endpoint.hpp] 102429 102430['Convenience header: ][^boost/asio.hpp] 102431 102432 102433[endsect] 102434 102435 102436 102437[section:operator_gt_ local::basic_endpoint::operator>] 102438 102439[indexterm2 boost_asio.indexterm.local__basic_endpoint.operator_gt_..operator>..local::basic_endpoint] 102440Compare endpoints for ordering. 102441 102442 102443 friend bool operator>( 102444 const basic_endpoint< Protocol > & e1, 102445 const basic_endpoint< Protocol > & e2); 102446 102447 102448[heading Requirements] 102449 102450['Header: ][^boost/asio/local/basic_endpoint.hpp] 102451 102452['Convenience header: ][^boost/asio.hpp] 102453 102454 102455[endsect] 102456 102457 102458 102459[section:operator_gt__eq_ local::basic_endpoint::operator>=] 102460 102461[indexterm2 boost_asio.indexterm.local__basic_endpoint.operator_gt__eq_..operator>=..local::basic_endpoint] 102462Compare endpoints for ordering. 102463 102464 102465 friend bool operator>=( 102466 const basic_endpoint< Protocol > & e1, 102467 const basic_endpoint< Protocol > & e2); 102468 102469 102470[heading Requirements] 102471 102472['Header: ][^boost/asio/local/basic_endpoint.hpp] 102473 102474['Convenience header: ][^boost/asio.hpp] 102475 102476 102477[endsect] 102478 102479 102480[section:path local::basic_endpoint::path] 102481 102482[indexterm2 boost_asio.indexterm.local__basic_endpoint.path..path..local::basic_endpoint] 102483Get the path associated with the endpoint. 102484 102485 102486 std::string ``[link boost_asio.reference.local__basic_endpoint.path.overload1 path]``() const; 102487 `` [''''»''' [link boost_asio.reference.local__basic_endpoint.path.overload1 more...]]`` 102488 102489 102490Set the path associated with the endpoint. 102491 102492 102493 void ``[link boost_asio.reference.local__basic_endpoint.path.overload2 path]``( 102494 const char * p); 102495 `` [''''»''' [link boost_asio.reference.local__basic_endpoint.path.overload2 more...]]`` 102496 102497 void ``[link boost_asio.reference.local__basic_endpoint.path.overload3 path]``( 102498 const std::string & p); 102499 `` [''''»''' [link boost_asio.reference.local__basic_endpoint.path.overload3 more...]]`` 102500 102501 102502[section:overload1 local::basic_endpoint::path (1 of 3 overloads)] 102503 102504 102505Get the path associated with the endpoint. 102506 102507 102508 std::string path() const; 102509 102510 102511 102512[endsect] 102513 102514 102515 102516[section:overload2 local::basic_endpoint::path (2 of 3 overloads)] 102517 102518 102519Set the path associated with the endpoint. 102520 102521 102522 void path( 102523 const char * p); 102524 102525 102526 102527[endsect] 102528 102529 102530 102531[section:overload3 local::basic_endpoint::path (3 of 3 overloads)] 102532 102533 102534Set the path associated with the endpoint. 102535 102536 102537 void path( 102538 const std::string & p); 102539 102540 102541 102542[endsect] 102543 102544 102545[endsect] 102546 102547 102548[section:protocol local::basic_endpoint::protocol] 102549 102550[indexterm2 boost_asio.indexterm.local__basic_endpoint.protocol..protocol..local::basic_endpoint] 102551The protocol associated with the endpoint. 102552 102553 102554 protocol_type protocol() const; 102555 102556 102557 102558[endsect] 102559 102560 102561 102562[section:protocol_type local::basic_endpoint::protocol_type] 102563 102564[indexterm2 boost_asio.indexterm.local__basic_endpoint.protocol_type..protocol_type..local::basic_endpoint] 102565The protocol type associated with the endpoint. 102566 102567 102568 typedef Protocol protocol_type; 102569 102570 102571 102572[heading Requirements] 102573 102574['Header: ][^boost/asio/local/basic_endpoint.hpp] 102575 102576['Convenience header: ][^boost/asio.hpp] 102577 102578 102579[endsect] 102580 102581 102582 102583[section:resize local::basic_endpoint::resize] 102584 102585[indexterm2 boost_asio.indexterm.local__basic_endpoint.resize..resize..local::basic_endpoint] 102586Set the underlying size of the endpoint in the native type. 102587 102588 102589 void resize( 102590 std::size_t new_size); 102591 102592 102593 102594[endsect] 102595 102596 102597 102598[section:size local::basic_endpoint::size] 102599 102600[indexterm2 boost_asio.indexterm.local__basic_endpoint.size..size..local::basic_endpoint] 102601Get the underlying size of the endpoint in the native type. 102602 102603 102604 std::size_t size() const; 102605 102606 102607 102608[endsect] 102609 102610 102611 102612[endsect] 102613 102614[section:local__connect_pair local::connect_pair] 102615 102616[indexterm1 boost_asio.indexterm.local__connect_pair..local::connect_pair] 102617Create a pair of connected sockets. 102618 102619 template< 102620 typename ``[link boost_asio.reference.Protocol Protocol]``, 102621 typename ``[link boost_asio.reference.Executor1 Executor1]``, 102622 typename ``[link boost_asio.reference.Executor1 Executor2]``> 102623 void ``[link boost_asio.reference.local__connect_pair.overload1 connect_pair]``( 102624 basic_socket< Protocol, Executor1 > & socket1, 102625 basic_socket< Protocol, Executor2 > & socket2); 102626 `` [''''»''' [link boost_asio.reference.local__connect_pair.overload1 more...]]`` 102627 102628 template< 102629 typename ``[link boost_asio.reference.Protocol Protocol]``, 102630 typename ``[link boost_asio.reference.Executor1 Executor1]``, 102631 typename ``[link boost_asio.reference.Executor1 Executor2]``> 102632 void ``[link boost_asio.reference.local__connect_pair.overload2 connect_pair]``( 102633 basic_socket< Protocol, Executor1 > & socket1, 102634 basic_socket< Protocol, Executor2 > & socket2, 102635 boost::system::error_code & ec); 102636 `` [''''»''' [link boost_asio.reference.local__connect_pair.overload2 more...]]`` 102637 102638[heading Requirements] 102639 102640['Header: ][^boost/asio/local/connect_pair.hpp] 102641 102642['Convenience header: ][^boost/asio.hpp] 102643 102644 102645[section:overload1 local::connect_pair (1 of 2 overloads)] 102646 102647 102648Create a pair of connected sockets. 102649 102650 102651 template< 102652 typename ``[link boost_asio.reference.Protocol Protocol]``, 102653 typename ``[link boost_asio.reference.Executor1 Executor1]``, 102654 typename ``[link boost_asio.reference.Executor1 Executor2]``> 102655 void connect_pair( 102656 basic_socket< Protocol, Executor1 > & socket1, 102657 basic_socket< Protocol, Executor2 > & socket2); 102658 102659 102660 102661[endsect] 102662 102663 102664 102665[section:overload2 local::connect_pair (2 of 2 overloads)] 102666 102667 102668Create a pair of connected sockets. 102669 102670 102671 template< 102672 typename ``[link boost_asio.reference.Protocol Protocol]``, 102673 typename ``[link boost_asio.reference.Executor1 Executor1]``, 102674 typename ``[link boost_asio.reference.Executor1 Executor2]``> 102675 void connect_pair( 102676 basic_socket< Protocol, Executor1 > & socket1, 102677 basic_socket< Protocol, Executor2 > & socket2, 102678 boost::system::error_code & ec); 102679 102680 102681 102682[endsect] 102683 102684 102685[endsect] 102686 102687[section:local__datagram_protocol local::datagram_protocol] 102688 102689[indexterm1 boost_asio.indexterm.local__datagram_protocol..local::datagram_protocol] 102690 102691 102692Encapsulates the flags needed for datagram-oriented UNIX sockets. 102693 102694 102695 class datagram_protocol 102696 102697 102698[heading Types] 102699[table 102700 [[Name][Description]] 102701 102702 [ 102703 102704 [[link boost_asio.reference.local__datagram_protocol.endpoint [*endpoint]]] 102705 [The type of a UNIX domain endpoint. ] 102706 102707 ] 102708 102709 [ 102710 102711 [[link boost_asio.reference.local__datagram_protocol.socket [*socket]]] 102712 [The UNIX domain socket type. ] 102713 102714 ] 102715 102716] 102717 102718[heading Member Functions] 102719[table 102720 [[Name][Description]] 102721 102722 [ 102723 [[link boost_asio.reference.local__datagram_protocol.family [*family]]] 102724 [Obtain an identifier for the protocol family. ] 102725 ] 102726 102727 [ 102728 [[link boost_asio.reference.local__datagram_protocol.protocol [*protocol]]] 102729 [Obtain an identifier for the protocol. ] 102730 ] 102731 102732 [ 102733 [[link boost_asio.reference.local__datagram_protocol.type [*type]]] 102734 [Obtain an identifier for the type of the protocol. ] 102735 ] 102736 102737] 102738 102739The [link boost_asio.reference.local__datagram_protocol `local::datagram_protocol`] class contains flags necessary for datagram-oriented UNIX domain sockets. 102740 102741 102742[heading Thread Safety] 102743 102744['Distinct] ['objects:] Safe. 102745 102746['Shared] ['objects:] Safe. 102747 102748 102749 102750 102751[heading Requirements] 102752 102753['Header: ][^boost/asio/local/datagram_protocol.hpp] 102754 102755['Convenience header: ][^boost/asio.hpp] 102756 102757 102758[section:endpoint local::datagram_protocol::endpoint] 102759 102760[indexterm2 boost_asio.indexterm.local__datagram_protocol.endpoint..endpoint..local::datagram_protocol] 102761The type of a UNIX domain endpoint. 102762 102763 102764 typedef basic_endpoint< datagram_protocol > endpoint; 102765 102766 102767[heading Types] 102768[table 102769 [[Name][Description]] 102770 102771 [ 102772 102773 [[link boost_asio.reference.local__basic_endpoint.data_type [*data_type]]] 102774 [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ] 102775 102776 ] 102777 102778 [ 102779 102780 [[link boost_asio.reference.local__basic_endpoint.protocol_type [*protocol_type]]] 102781 [The protocol type associated with the endpoint. ] 102782 102783 ] 102784 102785] 102786 102787[heading Member Functions] 102788[table 102789 [[Name][Description]] 102790 102791 [ 102792 [[link boost_asio.reference.local__basic_endpoint.basic_endpoint [*basic_endpoint]] [constructor]] 102793 [Default constructor. 102794 [hr] 102795 Construct an endpoint using the specified path name. 102796 [hr] 102797 Copy constructor. ] 102798 ] 102799 102800 [ 102801 [[link boost_asio.reference.local__basic_endpoint.capacity [*capacity]]] 102802 [Get the capacity of the endpoint in the native type. ] 102803 ] 102804 102805 [ 102806 [[link boost_asio.reference.local__basic_endpoint.data [*data]]] 102807 [Get the underlying endpoint in the native type. ] 102808 ] 102809 102810 [ 102811 [[link boost_asio.reference.local__basic_endpoint.operator_eq_ [*operator=]]] 102812 [Assign from another endpoint. ] 102813 ] 102814 102815 [ 102816 [[link boost_asio.reference.local__basic_endpoint.path [*path]]] 102817 [Get the path associated with the endpoint. 102818 [hr] 102819 Set the path associated with the endpoint. ] 102820 ] 102821 102822 [ 102823 [[link boost_asio.reference.local__basic_endpoint.protocol [*protocol]]] 102824 [The protocol associated with the endpoint. ] 102825 ] 102826 102827 [ 102828 [[link boost_asio.reference.local__basic_endpoint.resize [*resize]]] 102829 [Set the underlying size of the endpoint in the native type. ] 102830 ] 102831 102832 [ 102833 [[link boost_asio.reference.local__basic_endpoint.size [*size]]] 102834 [Get the underlying size of the endpoint in the native type. ] 102835 ] 102836 102837] 102838 102839[heading Friends] 102840[table 102841 [[Name][Description]] 102842 102843 [ 102844 [[link boost_asio.reference.local__basic_endpoint.operator_not__eq_ [*operator!=]]] 102845 [Compare two endpoints for inequality. ] 102846 ] 102847 102848 [ 102849 [[link boost_asio.reference.local__basic_endpoint.operator_lt_ [*operator<]]] 102850 [Compare endpoints for ordering. ] 102851 ] 102852 102853 [ 102854 [[link boost_asio.reference.local__basic_endpoint.operator_lt__eq_ [*operator<=]]] 102855 [Compare endpoints for ordering. ] 102856 ] 102857 102858 [ 102859 [[link boost_asio.reference.local__basic_endpoint.operator_eq__eq_ [*operator==]]] 102860 [Compare two endpoints for equality. ] 102861 ] 102862 102863 [ 102864 [[link boost_asio.reference.local__basic_endpoint.operator_gt_ [*operator>]]] 102865 [Compare endpoints for ordering. ] 102866 ] 102867 102868 [ 102869 [[link boost_asio.reference.local__basic_endpoint.operator_gt__eq_ [*operator>=]]] 102870 [Compare endpoints for ordering. ] 102871 ] 102872 102873] 102874 102875[heading Related Functions] 102876[table 102877 [[Name][Description]] 102878 102879 [ 102880 [[link boost_asio.reference.local__basic_endpoint.operator_lt__lt_ [*operator<<]]] 102881 [Output an endpoint as a string. ] 102882 ] 102883 102884] 102885 102886The [link boost_asio.reference.local__basic_endpoint `local::basic_endpoint`] class template describes an endpoint that may be associated with a particular UNIX socket. 102887 102888 102889[heading Thread Safety] 102890 102891['Distinct] ['objects:] Safe. 102892 102893['Shared] ['objects:] Unsafe. 102894 102895 102896 102897 102898 102899[heading Requirements] 102900 102901['Header: ][^boost/asio/local/datagram_protocol.hpp] 102902 102903['Convenience header: ][^boost/asio.hpp] 102904 102905 102906[endsect] 102907 102908 102909 102910[section:family local::datagram_protocol::family] 102911 102912[indexterm2 boost_asio.indexterm.local__datagram_protocol.family..family..local::datagram_protocol] 102913Obtain an identifier for the protocol family. 102914 102915 102916 int family() const; 102917 102918 102919 102920[endsect] 102921 102922 102923 102924[section:protocol local::datagram_protocol::protocol] 102925 102926[indexterm2 boost_asio.indexterm.local__datagram_protocol.protocol..protocol..local::datagram_protocol] 102927Obtain an identifier for the protocol. 102928 102929 102930 int protocol() const; 102931 102932 102933 102934[endsect] 102935 102936 102937 102938[section:socket local::datagram_protocol::socket] 102939 102940[indexterm2 boost_asio.indexterm.local__datagram_protocol.socket..socket..local::datagram_protocol] 102941The UNIX domain socket type. 102942 102943 102944 typedef basic_datagram_socket< datagram_protocol > socket; 102945 102946 102947[heading Types] 102948[table 102949 [[Name][Description]] 102950 102951 [ 102952 102953 [[link boost_asio.reference.basic_datagram_socket__rebind_executor [*rebind_executor]]] 102954 [Rebinds the socket type to another executor. ] 102955 102956 ] 102957 102958 [ 102959 102960 [[link boost_asio.reference.basic_datagram_socket.broadcast [*broadcast]]] 102961 [Socket option to permit sending of broadcast messages. ] 102962 102963 ] 102964 102965 [ 102966 102967 [[link boost_asio.reference.basic_datagram_socket.bytes_readable [*bytes_readable]]] 102968 [IO control command to get the amount of data that can be read without blocking. ] 102969 102970 ] 102971 102972 [ 102973 102974 [[link boost_asio.reference.basic_datagram_socket.debug [*debug]]] 102975 [Socket option to enable socket-level debugging. ] 102976 102977 ] 102978 102979 [ 102980 102981 [[link boost_asio.reference.basic_datagram_socket.do_not_route [*do_not_route]]] 102982 [Socket option to prevent routing, use local interfaces only. ] 102983 102984 ] 102985 102986 [ 102987 102988 [[link boost_asio.reference.basic_datagram_socket.enable_connection_aborted [*enable_connection_aborted]]] 102989 [Socket option to report aborted connections on accept. ] 102990 102991 ] 102992 102993 [ 102994 102995 [[link boost_asio.reference.basic_datagram_socket.endpoint_type [*endpoint_type]]] 102996 [The endpoint type. ] 102997 102998 ] 102999 103000 [ 103001 103002 [[link boost_asio.reference.basic_datagram_socket.executor_type [*executor_type]]] 103003 [The type of the executor associated with the object. ] 103004 103005 ] 103006 103007 [ 103008 103009 [[link boost_asio.reference.basic_datagram_socket.keep_alive [*keep_alive]]] 103010 [Socket option to send keep-alives. ] 103011 103012 ] 103013 103014 [ 103015 103016 [[link boost_asio.reference.basic_datagram_socket.linger [*linger]]] 103017 [Socket option to specify whether the socket lingers on close if unsent data is present. ] 103018 103019 ] 103020 103021 [ 103022 103023 [[link boost_asio.reference.basic_datagram_socket.lowest_layer_type [*lowest_layer_type]]] 103024 [A basic_socket is always the lowest layer. ] 103025 103026 ] 103027 103028 [ 103029 103030 [[link boost_asio.reference.basic_datagram_socket.message_flags [*message_flags]]] 103031 [Bitmask type for flags that can be passed to send and receive operations. ] 103032 103033 ] 103034 103035 [ 103036 103037 [[link boost_asio.reference.basic_datagram_socket.native_handle_type [*native_handle_type]]] 103038 [The native representation of a socket. ] 103039 103040 ] 103041 103042 [ 103043 103044 [[link boost_asio.reference.basic_datagram_socket.out_of_band_inline [*out_of_band_inline]]] 103045 [Socket option for putting received out-of-band data inline. ] 103046 103047 ] 103048 103049 [ 103050 103051 [[link boost_asio.reference.basic_datagram_socket.protocol_type [*protocol_type]]] 103052 [The protocol type. ] 103053 103054 ] 103055 103056 [ 103057 103058 [[link boost_asio.reference.basic_datagram_socket.receive_buffer_size [*receive_buffer_size]]] 103059 [Socket option for the receive buffer size of a socket. ] 103060 103061 ] 103062 103063 [ 103064 103065 [[link boost_asio.reference.basic_datagram_socket.receive_low_watermark [*receive_low_watermark]]] 103066 [Socket option for the receive low watermark. ] 103067 103068 ] 103069 103070 [ 103071 103072 [[link boost_asio.reference.basic_datagram_socket.reuse_address [*reuse_address]]] 103073 [Socket option to allow the socket to be bound to an address that is already in use. ] 103074 103075 ] 103076 103077 [ 103078 103079 [[link boost_asio.reference.basic_datagram_socket.send_buffer_size [*send_buffer_size]]] 103080 [Socket option for the send buffer size of a socket. ] 103081 103082 ] 103083 103084 [ 103085 103086 [[link boost_asio.reference.basic_datagram_socket.send_low_watermark [*send_low_watermark]]] 103087 [Socket option for the send low watermark. ] 103088 103089 ] 103090 103091 [ 103092 103093 [[link boost_asio.reference.basic_datagram_socket.shutdown_type [*shutdown_type]]] 103094 [Different ways a socket may be shutdown. ] 103095 103096 ] 103097 103098 [ 103099 103100 [[link boost_asio.reference.basic_datagram_socket.wait_type [*wait_type]]] 103101 [Wait types. ] 103102 103103 ] 103104 103105] 103106 103107[heading Member Functions] 103108[table 103109 [[Name][Description]] 103110 103111 [ 103112 [[link boost_asio.reference.basic_datagram_socket.assign [*assign]]] 103113 [Assign an existing native socket to the socket. ] 103114 ] 103115 103116 [ 103117 [[link boost_asio.reference.basic_datagram_socket.async_connect [*async_connect]]] 103118 [Start an asynchronous connect. ] 103119 ] 103120 103121 [ 103122 [[link boost_asio.reference.basic_datagram_socket.async_receive [*async_receive]]] 103123 [Start an asynchronous receive on a connected socket. ] 103124 ] 103125 103126 [ 103127 [[link boost_asio.reference.basic_datagram_socket.async_receive_from [*async_receive_from]]] 103128 [Start an asynchronous receive. ] 103129 ] 103130 103131 [ 103132 [[link boost_asio.reference.basic_datagram_socket.async_send [*async_send]]] 103133 [Start an asynchronous send on a connected socket. ] 103134 ] 103135 103136 [ 103137 [[link boost_asio.reference.basic_datagram_socket.async_send_to [*async_send_to]]] 103138 [Start an asynchronous send. ] 103139 ] 103140 103141 [ 103142 [[link boost_asio.reference.basic_datagram_socket.async_wait [*async_wait]]] 103143 [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 103144 ] 103145 103146 [ 103147 [[link boost_asio.reference.basic_datagram_socket.at_mark [*at_mark]]] 103148 [Determine whether the socket is at the out-of-band data mark. ] 103149 ] 103150 103151 [ 103152 [[link boost_asio.reference.basic_datagram_socket.available [*available]]] 103153 [Determine the number of bytes available for reading. ] 103154 ] 103155 103156 [ 103157 [[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket [*basic_datagram_socket]] [constructor]] 103158 [Construct a basic_datagram_socket without opening it. 103159 [hr] 103160 Construct and open a basic_datagram_socket. 103161 [hr] 103162 Construct a basic_datagram_socket, opening it and binding it to the given local endpoint. 103163 [hr] 103164 Construct a basic_datagram_socket on an existing native socket. 103165 [hr] 103166 Move-construct a basic_datagram_socket from another. 103167 [hr] 103168 Move-construct a basic_datagram_socket from a socket of another protocol type. ] 103169 ] 103170 103171 [ 103172 [[link boost_asio.reference.basic_datagram_socket.bind [*bind]]] 103173 [Bind the socket to the given local endpoint. ] 103174 ] 103175 103176 [ 103177 [[link boost_asio.reference.basic_datagram_socket.cancel [*cancel]]] 103178 [Cancel all asynchronous operations associated with the socket. ] 103179 ] 103180 103181 [ 103182 [[link boost_asio.reference.basic_datagram_socket.close [*close]]] 103183 [Close the socket. ] 103184 ] 103185 103186 [ 103187 [[link boost_asio.reference.basic_datagram_socket.connect [*connect]]] 103188 [Connect the socket to the specified endpoint. ] 103189 ] 103190 103191 [ 103192 [[link boost_asio.reference.basic_datagram_socket.get_executor [*get_executor]]] 103193 [Get the executor associated with the object. ] 103194 ] 103195 103196 [ 103197 [[link boost_asio.reference.basic_datagram_socket.get_option [*get_option]]] 103198 [Get an option from the socket. ] 103199 ] 103200 103201 [ 103202 [[link boost_asio.reference.basic_datagram_socket.io_control [*io_control]]] 103203 [Perform an IO control command on the socket. ] 103204 ] 103205 103206 [ 103207 [[link boost_asio.reference.basic_datagram_socket.is_open [*is_open]]] 103208 [Determine whether the socket is open. ] 103209 ] 103210 103211 [ 103212 [[link boost_asio.reference.basic_datagram_socket.local_endpoint [*local_endpoint]]] 103213 [Get the local endpoint of the socket. ] 103214 ] 103215 103216 [ 103217 [[link boost_asio.reference.basic_datagram_socket.lowest_layer [*lowest_layer]]] 103218 [Get a reference to the lowest layer. 103219 [hr] 103220 Get a const reference to the lowest layer. ] 103221 ] 103222 103223 [ 103224 [[link boost_asio.reference.basic_datagram_socket.native_handle [*native_handle]]] 103225 [Get the native socket representation. ] 103226 ] 103227 103228 [ 103229 [[link boost_asio.reference.basic_datagram_socket.native_non_blocking [*native_non_blocking]]] 103230 [Gets the non-blocking mode of the native socket implementation. 103231 [hr] 103232 Sets the non-blocking mode of the native socket implementation. ] 103233 ] 103234 103235 [ 103236 [[link boost_asio.reference.basic_datagram_socket.non_blocking [*non_blocking]]] 103237 [Gets the non-blocking mode of the socket. 103238 [hr] 103239 Sets the non-blocking mode of the socket. ] 103240 ] 103241 103242 [ 103243 [[link boost_asio.reference.basic_datagram_socket.open [*open]]] 103244 [Open the socket using the specified protocol. ] 103245 ] 103246 103247 [ 103248 [[link boost_asio.reference.basic_datagram_socket.operator_eq_ [*operator=]]] 103249 [Move-assign a basic_datagram_socket from another. 103250 [hr] 103251 Move-assign a basic_datagram_socket from a socket of another protocol type. ] 103252 ] 103253 103254 [ 103255 [[link boost_asio.reference.basic_datagram_socket.receive [*receive]]] 103256 [Receive some data on a connected socket. ] 103257 ] 103258 103259 [ 103260 [[link boost_asio.reference.basic_datagram_socket.receive_from [*receive_from]]] 103261 [Receive a datagram with the endpoint of the sender. ] 103262 ] 103263 103264 [ 103265 [[link boost_asio.reference.basic_datagram_socket.release [*release]]] 103266 [Release ownership of the underlying native socket. ] 103267 ] 103268 103269 [ 103270 [[link boost_asio.reference.basic_datagram_socket.remote_endpoint [*remote_endpoint]]] 103271 [Get the remote endpoint of the socket. ] 103272 ] 103273 103274 [ 103275 [[link boost_asio.reference.basic_datagram_socket.send [*send]]] 103276 [Send some data on a connected socket. ] 103277 ] 103278 103279 [ 103280 [[link boost_asio.reference.basic_datagram_socket.send_to [*send_to]]] 103281 [Send a datagram to the specified endpoint. ] 103282 ] 103283 103284 [ 103285 [[link boost_asio.reference.basic_datagram_socket.set_option [*set_option]]] 103286 [Set an option on the socket. ] 103287 ] 103288 103289 [ 103290 [[link boost_asio.reference.basic_datagram_socket.shutdown [*shutdown]]] 103291 [Disable sends or receives on the socket. ] 103292 ] 103293 103294 [ 103295 [[link boost_asio.reference.basic_datagram_socket.wait [*wait]]] 103296 [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 103297 ] 103298 103299 [ 103300 [[link boost_asio.reference.basic_datagram_socket._basic_datagram_socket [*~basic_datagram_socket]] [destructor]] 103301 [Destroys the socket. ] 103302 ] 103303 103304] 103305 103306[heading Data Members] 103307[table 103308 [[Name][Description]] 103309 103310 [ 103311 [[link boost_asio.reference.basic_datagram_socket.max_connections [*max_connections]] [static]] 103312 [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ] 103313 ] 103314 103315 [ 103316 [[link boost_asio.reference.basic_datagram_socket.max_listen_connections [*max_listen_connections]] [static]] 103317 [The maximum length of the queue of pending incoming connections. ] 103318 ] 103319 103320 [ 103321 [[link boost_asio.reference.basic_datagram_socket.message_do_not_route [*message_do_not_route]] [static]] 103322 [Specify that the data should not be subject to routing. ] 103323 ] 103324 103325 [ 103326 [[link boost_asio.reference.basic_datagram_socket.message_end_of_record [*message_end_of_record]] [static]] 103327 [Specifies that the data marks the end of a record. ] 103328 ] 103329 103330 [ 103331 [[link boost_asio.reference.basic_datagram_socket.message_out_of_band [*message_out_of_band]] [static]] 103332 [Process out-of-band data. ] 103333 ] 103334 103335 [ 103336 [[link boost_asio.reference.basic_datagram_socket.message_peek [*message_peek]] [static]] 103337 [Peek at incoming data without removing it from the input queue. ] 103338 ] 103339 103340] 103341 103342The [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] class template provides asynchronous and blocking datagram-oriented socket functionality. 103343 103344 103345[heading Thread Safety] 103346 103347['Distinct] ['objects:] Safe. 103348 103349['Shared] ['objects:] Unsafe. 103350 103351Synchronous `send`, `send_to`, `receive`, `receive_from`, and `connect` operations are thread safe with respect to each other, if the underlying operating system calls are also thread safe. This means that it is permitted to perform concurrent calls to these synchronous operations on a single socket object. Other synchronous operations, such as `open` or `close`, are not thread safe. 103352 103353 103354[heading Requirements] 103355 103356['Header: ][^boost/asio/local/datagram_protocol.hpp] 103357 103358['Convenience header: ][^boost/asio.hpp] 103359 103360 103361[endsect] 103362 103363 103364 103365[section:type local::datagram_protocol::type] 103366 103367[indexterm2 boost_asio.indexterm.local__datagram_protocol.type..type..local::datagram_protocol] 103368Obtain an identifier for the type of the protocol. 103369 103370 103371 int type() const; 103372 103373 103374 103375[endsect] 103376 103377 103378 103379[endsect] 103380 103381[section:local__stream_protocol local::stream_protocol] 103382 103383[indexterm1 boost_asio.indexterm.local__stream_protocol..local::stream_protocol] 103384 103385 103386Encapsulates the flags needed for stream-oriented UNIX sockets. 103387 103388 103389 class stream_protocol 103390 103391 103392[heading Types] 103393[table 103394 [[Name][Description]] 103395 103396 [ 103397 103398 [[link boost_asio.reference.local__stream_protocol.acceptor [*acceptor]]] 103399 [The UNIX domain acceptor type. ] 103400 103401 ] 103402 103403 [ 103404 103405 [[link boost_asio.reference.local__stream_protocol.endpoint [*endpoint]]] 103406 [The type of a UNIX domain endpoint. ] 103407 103408 ] 103409 103410 [ 103411 103412 [[link boost_asio.reference.local__stream_protocol.iostream [*iostream]]] 103413 [The UNIX domain iostream type. ] 103414 103415 ] 103416 103417 [ 103418 103419 [[link boost_asio.reference.local__stream_protocol.socket [*socket]]] 103420 [The UNIX domain socket type. ] 103421 103422 ] 103423 103424] 103425 103426[heading Member Functions] 103427[table 103428 [[Name][Description]] 103429 103430 [ 103431 [[link boost_asio.reference.local__stream_protocol.family [*family]]] 103432 [Obtain an identifier for the protocol family. ] 103433 ] 103434 103435 [ 103436 [[link boost_asio.reference.local__stream_protocol.protocol [*protocol]]] 103437 [Obtain an identifier for the protocol. ] 103438 ] 103439 103440 [ 103441 [[link boost_asio.reference.local__stream_protocol.type [*type]]] 103442 [Obtain an identifier for the type of the protocol. ] 103443 ] 103444 103445] 103446 103447The [link boost_asio.reference.local__stream_protocol `local::stream_protocol`] class contains flags necessary for stream-oriented UNIX domain sockets. 103448 103449 103450[heading Thread Safety] 103451 103452['Distinct] ['objects:] Safe. 103453 103454['Shared] ['objects:] Safe. 103455 103456 103457 103458 103459[heading Requirements] 103460 103461['Header: ][^boost/asio/local/stream_protocol.hpp] 103462 103463['Convenience header: ][^boost/asio.hpp] 103464 103465 103466[section:acceptor local::stream_protocol::acceptor] 103467 103468[indexterm2 boost_asio.indexterm.local__stream_protocol.acceptor..acceptor..local::stream_protocol] 103469The UNIX domain acceptor type. 103470 103471 103472 typedef basic_socket_acceptor< stream_protocol > acceptor; 103473 103474 103475[heading Types] 103476[table 103477 [[Name][Description]] 103478 103479 [ 103480 103481 [[link boost_asio.reference.basic_socket_acceptor__rebind_executor [*rebind_executor]]] 103482 [Rebinds the acceptor type to another executor. ] 103483 103484 ] 103485 103486 [ 103487 103488 [[link boost_asio.reference.basic_socket_acceptor.broadcast [*broadcast]]] 103489 [Socket option to permit sending of broadcast messages. ] 103490 103491 ] 103492 103493 [ 103494 103495 [[link boost_asio.reference.basic_socket_acceptor.bytes_readable [*bytes_readable]]] 103496 [IO control command to get the amount of data that can be read without blocking. ] 103497 103498 ] 103499 103500 [ 103501 103502 [[link boost_asio.reference.basic_socket_acceptor.debug [*debug]]] 103503 [Socket option to enable socket-level debugging. ] 103504 103505 ] 103506 103507 [ 103508 103509 [[link boost_asio.reference.basic_socket_acceptor.do_not_route [*do_not_route]]] 103510 [Socket option to prevent routing, use local interfaces only. ] 103511 103512 ] 103513 103514 [ 103515 103516 [[link boost_asio.reference.basic_socket_acceptor.enable_connection_aborted [*enable_connection_aborted]]] 103517 [Socket option to report aborted connections on accept. ] 103518 103519 ] 103520 103521 [ 103522 103523 [[link boost_asio.reference.basic_socket_acceptor.endpoint_type [*endpoint_type]]] 103524 [The endpoint type. ] 103525 103526 ] 103527 103528 [ 103529 103530 [[link boost_asio.reference.basic_socket_acceptor.executor_type [*executor_type]]] 103531 [The type of the executor associated with the object. ] 103532 103533 ] 103534 103535 [ 103536 103537 [[link boost_asio.reference.basic_socket_acceptor.keep_alive [*keep_alive]]] 103538 [Socket option to send keep-alives. ] 103539 103540 ] 103541 103542 [ 103543 103544 [[link boost_asio.reference.basic_socket_acceptor.linger [*linger]]] 103545 [Socket option to specify whether the socket lingers on close if unsent data is present. ] 103546 103547 ] 103548 103549 [ 103550 103551 [[link boost_asio.reference.basic_socket_acceptor.message_flags [*message_flags]]] 103552 [Bitmask type for flags that can be passed to send and receive operations. ] 103553 103554 ] 103555 103556 [ 103557 103558 [[link boost_asio.reference.basic_socket_acceptor.native_handle_type [*native_handle_type]]] 103559 [The native representation of an acceptor. ] 103560 103561 ] 103562 103563 [ 103564 103565 [[link boost_asio.reference.basic_socket_acceptor.out_of_band_inline [*out_of_band_inline]]] 103566 [Socket option for putting received out-of-band data inline. ] 103567 103568 ] 103569 103570 [ 103571 103572 [[link boost_asio.reference.basic_socket_acceptor.protocol_type [*protocol_type]]] 103573 [The protocol type. ] 103574 103575 ] 103576 103577 [ 103578 103579 [[link boost_asio.reference.basic_socket_acceptor.receive_buffer_size [*receive_buffer_size]]] 103580 [Socket option for the receive buffer size of a socket. ] 103581 103582 ] 103583 103584 [ 103585 103586 [[link boost_asio.reference.basic_socket_acceptor.receive_low_watermark [*receive_low_watermark]]] 103587 [Socket option for the receive low watermark. ] 103588 103589 ] 103590 103591 [ 103592 103593 [[link boost_asio.reference.basic_socket_acceptor.reuse_address [*reuse_address]]] 103594 [Socket option to allow the socket to be bound to an address that is already in use. ] 103595 103596 ] 103597 103598 [ 103599 103600 [[link boost_asio.reference.basic_socket_acceptor.send_buffer_size [*send_buffer_size]]] 103601 [Socket option for the send buffer size of a socket. ] 103602 103603 ] 103604 103605 [ 103606 103607 [[link boost_asio.reference.basic_socket_acceptor.send_low_watermark [*send_low_watermark]]] 103608 [Socket option for the send low watermark. ] 103609 103610 ] 103611 103612 [ 103613 103614 [[link boost_asio.reference.basic_socket_acceptor.shutdown_type [*shutdown_type]]] 103615 [Different ways a socket may be shutdown. ] 103616 103617 ] 103618 103619 [ 103620 103621 [[link boost_asio.reference.basic_socket_acceptor.wait_type [*wait_type]]] 103622 [Wait types. ] 103623 103624 ] 103625 103626] 103627 103628[heading Member Functions] 103629[table 103630 [[Name][Description]] 103631 103632 [ 103633 [[link boost_asio.reference.basic_socket_acceptor.accept [*accept]]] 103634 [Accept a new connection. 103635 [hr] 103636 Accept a new connection and obtain the endpoint of the peer. ] 103637 ] 103638 103639 [ 103640 [[link boost_asio.reference.basic_socket_acceptor.assign [*assign]]] 103641 [Assigns an existing native acceptor to the acceptor. ] 103642 ] 103643 103644 [ 103645 [[link boost_asio.reference.basic_socket_acceptor.async_accept [*async_accept]]] 103646 [Start an asynchronous accept. ] 103647 ] 103648 103649 [ 103650 [[link boost_asio.reference.basic_socket_acceptor.async_wait [*async_wait]]] 103651 [Asynchronously wait for the acceptor to become ready to read, ready to write, or to have pending error conditions. ] 103652 ] 103653 103654 [ 103655 [[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor [*basic_socket_acceptor]] [constructor]] 103656 [Construct an acceptor without opening it. 103657 [hr] 103658 Construct an open acceptor. 103659 [hr] 103660 Construct an acceptor opened on the given endpoint. 103661 [hr] 103662 Construct a basic_socket_acceptor on an existing native acceptor. 103663 [hr] 103664 Move-construct a basic_socket_acceptor from another. 103665 [hr] 103666 Move-construct a basic_socket_acceptor from an acceptor of another protocol type. ] 103667 ] 103668 103669 [ 103670 [[link boost_asio.reference.basic_socket_acceptor.bind [*bind]]] 103671 [Bind the acceptor to the given local endpoint. ] 103672 ] 103673 103674 [ 103675 [[link boost_asio.reference.basic_socket_acceptor.cancel [*cancel]]] 103676 [Cancel all asynchronous operations associated with the acceptor. ] 103677 ] 103678 103679 [ 103680 [[link boost_asio.reference.basic_socket_acceptor.close [*close]]] 103681 [Close the acceptor. ] 103682 ] 103683 103684 [ 103685 [[link boost_asio.reference.basic_socket_acceptor.get_executor [*get_executor]]] 103686 [Get the executor associated with the object. ] 103687 ] 103688 103689 [ 103690 [[link boost_asio.reference.basic_socket_acceptor.get_option [*get_option]]] 103691 [Get an option from the acceptor. ] 103692 ] 103693 103694 [ 103695 [[link boost_asio.reference.basic_socket_acceptor.io_control [*io_control]]] 103696 [Perform an IO control command on the acceptor. ] 103697 ] 103698 103699 [ 103700 [[link boost_asio.reference.basic_socket_acceptor.is_open [*is_open]]] 103701 [Determine whether the acceptor is open. ] 103702 ] 103703 103704 [ 103705 [[link boost_asio.reference.basic_socket_acceptor.listen [*listen]]] 103706 [Place the acceptor into the state where it will listen for new connections. ] 103707 ] 103708 103709 [ 103710 [[link boost_asio.reference.basic_socket_acceptor.local_endpoint [*local_endpoint]]] 103711 [Get the local endpoint of the acceptor. ] 103712 ] 103713 103714 [ 103715 [[link boost_asio.reference.basic_socket_acceptor.native_handle [*native_handle]]] 103716 [Get the native acceptor representation. ] 103717 ] 103718 103719 [ 103720 [[link boost_asio.reference.basic_socket_acceptor.native_non_blocking [*native_non_blocking]]] 103721 [Gets the non-blocking mode of the native acceptor implementation. 103722 [hr] 103723 Sets the non-blocking mode of the native acceptor implementation. ] 103724 ] 103725 103726 [ 103727 [[link boost_asio.reference.basic_socket_acceptor.non_blocking [*non_blocking]]] 103728 [Gets the non-blocking mode of the acceptor. 103729 [hr] 103730 Sets the non-blocking mode of the acceptor. ] 103731 ] 103732 103733 [ 103734 [[link boost_asio.reference.basic_socket_acceptor.open [*open]]] 103735 [Open the acceptor using the specified protocol. ] 103736 ] 103737 103738 [ 103739 [[link boost_asio.reference.basic_socket_acceptor.operator_eq_ [*operator=]]] 103740 [Move-assign a basic_socket_acceptor from another. 103741 [hr] 103742 Move-assign a basic_socket_acceptor from an acceptor of another protocol type. ] 103743 ] 103744 103745 [ 103746 [[link boost_asio.reference.basic_socket_acceptor.release [*release]]] 103747 [Release ownership of the underlying native acceptor. ] 103748 ] 103749 103750 [ 103751 [[link boost_asio.reference.basic_socket_acceptor.set_option [*set_option]]] 103752 [Set an option on the acceptor. ] 103753 ] 103754 103755 [ 103756 [[link boost_asio.reference.basic_socket_acceptor.wait [*wait]]] 103757 [Wait for the acceptor to become ready to read, ready to write, or to have pending error conditions. ] 103758 ] 103759 103760 [ 103761 [[link boost_asio.reference.basic_socket_acceptor._basic_socket_acceptor [*~basic_socket_acceptor]] [destructor]] 103762 [Destroys the acceptor. ] 103763 ] 103764 103765] 103766 103767[heading Data Members] 103768[table 103769 [[Name][Description]] 103770 103771 [ 103772 [[link boost_asio.reference.basic_socket_acceptor.max_connections [*max_connections]] [static]] 103773 [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ] 103774 ] 103775 103776 [ 103777 [[link boost_asio.reference.basic_socket_acceptor.max_listen_connections [*max_listen_connections]] [static]] 103778 [The maximum length of the queue of pending incoming connections. ] 103779 ] 103780 103781 [ 103782 [[link boost_asio.reference.basic_socket_acceptor.message_do_not_route [*message_do_not_route]] [static]] 103783 [Specify that the data should not be subject to routing. ] 103784 ] 103785 103786 [ 103787 [[link boost_asio.reference.basic_socket_acceptor.message_end_of_record [*message_end_of_record]] [static]] 103788 [Specifies that the data marks the end of a record. ] 103789 ] 103790 103791 [ 103792 [[link boost_asio.reference.basic_socket_acceptor.message_out_of_band [*message_out_of_band]] [static]] 103793 [Process out-of-band data. ] 103794 ] 103795 103796 [ 103797 [[link boost_asio.reference.basic_socket_acceptor.message_peek [*message_peek]] [static]] 103798 [Peek at incoming data without removing it from the input queue. ] 103799 ] 103800 103801] 103802 103803The [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] class template is used for accepting new socket connections. 103804 103805 103806[heading Thread Safety] 103807 103808['Distinct] ['objects:] Safe. 103809 103810['Shared] ['objects:] Unsafe. 103811 103812Synchronous `accept` operations are thread safe, if the underlying operating system calls are also thread safe. This means that it is permitted to perform concurrent calls to synchronous `accept` operations on a single socket object. Other synchronous operations, such as `open` or `close`, are not thread safe. 103813 103814 103815[heading Example] 103816 103817Opening a socket acceptor with the SO\_REUSEADDR option enabled: 103818 103819 boost::asio::ip::tcp::acceptor acceptor(my_context); 103820 boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), port); 103821 acceptor.open(endpoint.protocol()); 103822 acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true)); 103823 acceptor.bind(endpoint); 103824 acceptor.listen(); 103825 103826 103827 103828 103829 103830 103831 103832[heading Requirements] 103833 103834['Header: ][^boost/asio/local/stream_protocol.hpp] 103835 103836['Convenience header: ][^boost/asio.hpp] 103837 103838 103839[endsect] 103840 103841 103842 103843[section:endpoint local::stream_protocol::endpoint] 103844 103845[indexterm2 boost_asio.indexterm.local__stream_protocol.endpoint..endpoint..local::stream_protocol] 103846The type of a UNIX domain endpoint. 103847 103848 103849 typedef basic_endpoint< stream_protocol > endpoint; 103850 103851 103852[heading Types] 103853[table 103854 [[Name][Description]] 103855 103856 [ 103857 103858 [[link boost_asio.reference.local__basic_endpoint.data_type [*data_type]]] 103859 [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ] 103860 103861 ] 103862 103863 [ 103864 103865 [[link boost_asio.reference.local__basic_endpoint.protocol_type [*protocol_type]]] 103866 [The protocol type associated with the endpoint. ] 103867 103868 ] 103869 103870] 103871 103872[heading Member Functions] 103873[table 103874 [[Name][Description]] 103875 103876 [ 103877 [[link boost_asio.reference.local__basic_endpoint.basic_endpoint [*basic_endpoint]] [constructor]] 103878 [Default constructor. 103879 [hr] 103880 Construct an endpoint using the specified path name. 103881 [hr] 103882 Copy constructor. ] 103883 ] 103884 103885 [ 103886 [[link boost_asio.reference.local__basic_endpoint.capacity [*capacity]]] 103887 [Get the capacity of the endpoint in the native type. ] 103888 ] 103889 103890 [ 103891 [[link boost_asio.reference.local__basic_endpoint.data [*data]]] 103892 [Get the underlying endpoint in the native type. ] 103893 ] 103894 103895 [ 103896 [[link boost_asio.reference.local__basic_endpoint.operator_eq_ [*operator=]]] 103897 [Assign from another endpoint. ] 103898 ] 103899 103900 [ 103901 [[link boost_asio.reference.local__basic_endpoint.path [*path]]] 103902 [Get the path associated with the endpoint. 103903 [hr] 103904 Set the path associated with the endpoint. ] 103905 ] 103906 103907 [ 103908 [[link boost_asio.reference.local__basic_endpoint.protocol [*protocol]]] 103909 [The protocol associated with the endpoint. ] 103910 ] 103911 103912 [ 103913 [[link boost_asio.reference.local__basic_endpoint.resize [*resize]]] 103914 [Set the underlying size of the endpoint in the native type. ] 103915 ] 103916 103917 [ 103918 [[link boost_asio.reference.local__basic_endpoint.size [*size]]] 103919 [Get the underlying size of the endpoint in the native type. ] 103920 ] 103921 103922] 103923 103924[heading Friends] 103925[table 103926 [[Name][Description]] 103927 103928 [ 103929 [[link boost_asio.reference.local__basic_endpoint.operator_not__eq_ [*operator!=]]] 103930 [Compare two endpoints for inequality. ] 103931 ] 103932 103933 [ 103934 [[link boost_asio.reference.local__basic_endpoint.operator_lt_ [*operator<]]] 103935 [Compare endpoints for ordering. ] 103936 ] 103937 103938 [ 103939 [[link boost_asio.reference.local__basic_endpoint.operator_lt__eq_ [*operator<=]]] 103940 [Compare endpoints for ordering. ] 103941 ] 103942 103943 [ 103944 [[link boost_asio.reference.local__basic_endpoint.operator_eq__eq_ [*operator==]]] 103945 [Compare two endpoints for equality. ] 103946 ] 103947 103948 [ 103949 [[link boost_asio.reference.local__basic_endpoint.operator_gt_ [*operator>]]] 103950 [Compare endpoints for ordering. ] 103951 ] 103952 103953 [ 103954 [[link boost_asio.reference.local__basic_endpoint.operator_gt__eq_ [*operator>=]]] 103955 [Compare endpoints for ordering. ] 103956 ] 103957 103958] 103959 103960[heading Related Functions] 103961[table 103962 [[Name][Description]] 103963 103964 [ 103965 [[link boost_asio.reference.local__basic_endpoint.operator_lt__lt_ [*operator<<]]] 103966 [Output an endpoint as a string. ] 103967 ] 103968 103969] 103970 103971The [link boost_asio.reference.local__basic_endpoint `local::basic_endpoint`] class template describes an endpoint that may be associated with a particular UNIX socket. 103972 103973 103974[heading Thread Safety] 103975 103976['Distinct] ['objects:] Safe. 103977 103978['Shared] ['objects:] Unsafe. 103979 103980 103981 103982 103983 103984[heading Requirements] 103985 103986['Header: ][^boost/asio/local/stream_protocol.hpp] 103987 103988['Convenience header: ][^boost/asio.hpp] 103989 103990 103991[endsect] 103992 103993 103994 103995[section:family local::stream_protocol::family] 103996 103997[indexterm2 boost_asio.indexterm.local__stream_protocol.family..family..local::stream_protocol] 103998Obtain an identifier for the protocol family. 103999 104000 104001 int family() const; 104002 104003 104004 104005[endsect] 104006 104007 104008 104009[section:iostream local::stream_protocol::iostream] 104010 104011[indexterm2 boost_asio.indexterm.local__stream_protocol.iostream..iostream..local::stream_protocol] 104012The UNIX domain iostream type. 104013 104014 104015 typedef basic_socket_iostream< stream_protocol > iostream; 104016 104017 104018[heading Types] 104019[table 104020 [[Name][Description]] 104021 104022 [ 104023 104024 [[link boost_asio.reference.basic_socket_iostream.clock_type [*clock_type]]] 104025 [The clock type. ] 104026 104027 ] 104028 104029 [ 104030 104031 [[link boost_asio.reference.basic_socket_iostream.duration [*duration]]] 104032 [The duration type. ] 104033 104034 ] 104035 104036 [ 104037 104038 [[link boost_asio.reference.basic_socket_iostream.duration_type [*duration_type]]] 104039 [(Deprecated: Use duration.) The duration type. ] 104040 104041 ] 104042 104043 [ 104044 104045 [[link boost_asio.reference.basic_socket_iostream.endpoint_type [*endpoint_type]]] 104046 [The endpoint type. ] 104047 104048 ] 104049 104050 [ 104051 104052 [[link boost_asio.reference.basic_socket_iostream.protocol_type [*protocol_type]]] 104053 [The protocol type. ] 104054 104055 ] 104056 104057 [ 104058 104059 [[link boost_asio.reference.basic_socket_iostream.time_point [*time_point]]] 104060 [The time type. ] 104061 104062 ] 104063 104064 [ 104065 104066 [[link boost_asio.reference.basic_socket_iostream.time_type [*time_type]]] 104067 [(Deprecated: Use time_point.) The time type. ] 104068 104069 ] 104070 104071] 104072 104073[heading Member Functions] 104074[table 104075 [[Name][Description]] 104076 104077 [ 104078 [[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream [*basic_socket_iostream]] [constructor]] 104079 [Construct a basic_socket_iostream without establishing a connection. 104080 [hr] 104081 Construct a basic_socket_iostream from the supplied socket. 104082 [hr] 104083 Move-construct a basic_socket_iostream from another. 104084 [hr] 104085 Establish a connection to an endpoint corresponding to a resolver query. ] 104086 ] 104087 104088 [ 104089 [[link boost_asio.reference.basic_socket_iostream.close [*close]]] 104090 [Close the connection. ] 104091 ] 104092 104093 [ 104094 [[link boost_asio.reference.basic_socket_iostream.connect [*connect]]] 104095 [Establish a connection to an endpoint corresponding to a resolver query. ] 104096 ] 104097 104098 [ 104099 [[link boost_asio.reference.basic_socket_iostream.error [*error]]] 104100 [Get the last error associated with the stream. ] 104101 ] 104102 104103 [ 104104 [[link boost_asio.reference.basic_socket_iostream.expires_after [*expires_after]]] 104105 [Set the stream's expiry time relative to now. ] 104106 ] 104107 104108 [ 104109 [[link boost_asio.reference.basic_socket_iostream.expires_at [*expires_at]]] 104110 [(Deprecated: Use expiry().) Get the stream's expiry time as an absolute time. 104111 [hr] 104112 Set the stream's expiry time as an absolute time. ] 104113 ] 104114 104115 [ 104116 [[link boost_asio.reference.basic_socket_iostream.expires_from_now [*expires_from_now]]] 104117 [(Deprecated: Use expiry().) Get the stream's expiry time relative to now. 104118 [hr] 104119 (Deprecated: Use expires_after().) Set the stream's expiry time relative to now. ] 104120 ] 104121 104122 [ 104123 [[link boost_asio.reference.basic_socket_iostream.expiry [*expiry]]] 104124 [Get the stream's expiry time as an absolute time. ] 104125 ] 104126 104127 [ 104128 [[link boost_asio.reference.basic_socket_iostream.operator_eq_ [*operator=]]] 104129 [Move-assign a basic_socket_iostream from another. ] 104130 ] 104131 104132 [ 104133 [[link boost_asio.reference.basic_socket_iostream.rdbuf [*rdbuf]]] 104134 [Return a pointer to the underlying streambuf. ] 104135 ] 104136 104137 [ 104138 [[link boost_asio.reference.basic_socket_iostream.socket [*socket]]] 104139 [Get a reference to the underlying socket. ] 104140 ] 104141 104142] 104143 104144 104145[heading Requirements] 104146 104147['Header: ][^boost/asio/local/stream_protocol.hpp] 104148 104149['Convenience header: ][^boost/asio.hpp] 104150 104151 104152[endsect] 104153 104154 104155 104156[section:protocol local::stream_protocol::protocol] 104157 104158[indexterm2 boost_asio.indexterm.local__stream_protocol.protocol..protocol..local::stream_protocol] 104159Obtain an identifier for the protocol. 104160 104161 104162 int protocol() const; 104163 104164 104165 104166[endsect] 104167 104168 104169 104170[section:socket local::stream_protocol::socket] 104171 104172[indexterm2 boost_asio.indexterm.local__stream_protocol.socket..socket..local::stream_protocol] 104173The UNIX domain socket type. 104174 104175 104176 typedef basic_stream_socket< stream_protocol > socket; 104177 104178 104179[heading Types] 104180[table 104181 [[Name][Description]] 104182 104183 [ 104184 104185 [[link boost_asio.reference.basic_stream_socket__rebind_executor [*rebind_executor]]] 104186 [Rebinds the socket type to another executor. ] 104187 104188 ] 104189 104190 [ 104191 104192 [[link boost_asio.reference.basic_stream_socket.broadcast [*broadcast]]] 104193 [Socket option to permit sending of broadcast messages. ] 104194 104195 ] 104196 104197 [ 104198 104199 [[link boost_asio.reference.basic_stream_socket.bytes_readable [*bytes_readable]]] 104200 [IO control command to get the amount of data that can be read without blocking. ] 104201 104202 ] 104203 104204 [ 104205 104206 [[link boost_asio.reference.basic_stream_socket.debug [*debug]]] 104207 [Socket option to enable socket-level debugging. ] 104208 104209 ] 104210 104211 [ 104212 104213 [[link boost_asio.reference.basic_stream_socket.do_not_route [*do_not_route]]] 104214 [Socket option to prevent routing, use local interfaces only. ] 104215 104216 ] 104217 104218 [ 104219 104220 [[link boost_asio.reference.basic_stream_socket.enable_connection_aborted [*enable_connection_aborted]]] 104221 [Socket option to report aborted connections on accept. ] 104222 104223 ] 104224 104225 [ 104226 104227 [[link boost_asio.reference.basic_stream_socket.endpoint_type [*endpoint_type]]] 104228 [The endpoint type. ] 104229 104230 ] 104231 104232 [ 104233 104234 [[link boost_asio.reference.basic_stream_socket.executor_type [*executor_type]]] 104235 [The type of the executor associated with the object. ] 104236 104237 ] 104238 104239 [ 104240 104241 [[link boost_asio.reference.basic_stream_socket.keep_alive [*keep_alive]]] 104242 [Socket option to send keep-alives. ] 104243 104244 ] 104245 104246 [ 104247 104248 [[link boost_asio.reference.basic_stream_socket.linger [*linger]]] 104249 [Socket option to specify whether the socket lingers on close if unsent data is present. ] 104250 104251 ] 104252 104253 [ 104254 104255 [[link boost_asio.reference.basic_stream_socket.lowest_layer_type [*lowest_layer_type]]] 104256 [A basic_socket is always the lowest layer. ] 104257 104258 ] 104259 104260 [ 104261 104262 [[link boost_asio.reference.basic_stream_socket.message_flags [*message_flags]]] 104263 [Bitmask type for flags that can be passed to send and receive operations. ] 104264 104265 ] 104266 104267 [ 104268 104269 [[link boost_asio.reference.basic_stream_socket.native_handle_type [*native_handle_type]]] 104270 [The native representation of a socket. ] 104271 104272 ] 104273 104274 [ 104275 104276 [[link boost_asio.reference.basic_stream_socket.out_of_band_inline [*out_of_band_inline]]] 104277 [Socket option for putting received out-of-band data inline. ] 104278 104279 ] 104280 104281 [ 104282 104283 [[link boost_asio.reference.basic_stream_socket.protocol_type [*protocol_type]]] 104284 [The protocol type. ] 104285 104286 ] 104287 104288 [ 104289 104290 [[link boost_asio.reference.basic_stream_socket.receive_buffer_size [*receive_buffer_size]]] 104291 [Socket option for the receive buffer size of a socket. ] 104292 104293 ] 104294 104295 [ 104296 104297 [[link boost_asio.reference.basic_stream_socket.receive_low_watermark [*receive_low_watermark]]] 104298 [Socket option for the receive low watermark. ] 104299 104300 ] 104301 104302 [ 104303 104304 [[link boost_asio.reference.basic_stream_socket.reuse_address [*reuse_address]]] 104305 [Socket option to allow the socket to be bound to an address that is already in use. ] 104306 104307 ] 104308 104309 [ 104310 104311 [[link boost_asio.reference.basic_stream_socket.send_buffer_size [*send_buffer_size]]] 104312 [Socket option for the send buffer size of a socket. ] 104313 104314 ] 104315 104316 [ 104317 104318 [[link boost_asio.reference.basic_stream_socket.send_low_watermark [*send_low_watermark]]] 104319 [Socket option for the send low watermark. ] 104320 104321 ] 104322 104323 [ 104324 104325 [[link boost_asio.reference.basic_stream_socket.shutdown_type [*shutdown_type]]] 104326 [Different ways a socket may be shutdown. ] 104327 104328 ] 104329 104330 [ 104331 104332 [[link boost_asio.reference.basic_stream_socket.wait_type [*wait_type]]] 104333 [Wait types. ] 104334 104335 ] 104336 104337] 104338 104339[heading Member Functions] 104340[table 104341 [[Name][Description]] 104342 104343 [ 104344 [[link boost_asio.reference.basic_stream_socket.assign [*assign]]] 104345 [Assign an existing native socket to the socket. ] 104346 ] 104347 104348 [ 104349 [[link boost_asio.reference.basic_stream_socket.async_connect [*async_connect]]] 104350 [Start an asynchronous connect. ] 104351 ] 104352 104353 [ 104354 [[link boost_asio.reference.basic_stream_socket.async_read_some [*async_read_some]]] 104355 [Start an asynchronous read. ] 104356 ] 104357 104358 [ 104359 [[link boost_asio.reference.basic_stream_socket.async_receive [*async_receive]]] 104360 [Start an asynchronous receive. ] 104361 ] 104362 104363 [ 104364 [[link boost_asio.reference.basic_stream_socket.async_send [*async_send]]] 104365 [Start an asynchronous send. ] 104366 ] 104367 104368 [ 104369 [[link boost_asio.reference.basic_stream_socket.async_wait [*async_wait]]] 104370 [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 104371 ] 104372 104373 [ 104374 [[link boost_asio.reference.basic_stream_socket.async_write_some [*async_write_some]]] 104375 [Start an asynchronous write. ] 104376 ] 104377 104378 [ 104379 [[link boost_asio.reference.basic_stream_socket.at_mark [*at_mark]]] 104380 [Determine whether the socket is at the out-of-band data mark. ] 104381 ] 104382 104383 [ 104384 [[link boost_asio.reference.basic_stream_socket.available [*available]]] 104385 [Determine the number of bytes available for reading. ] 104386 ] 104387 104388 [ 104389 [[link boost_asio.reference.basic_stream_socket.basic_stream_socket [*basic_stream_socket]] [constructor]] 104390 [Construct a basic_stream_socket without opening it. 104391 [hr] 104392 Construct and open a basic_stream_socket. 104393 [hr] 104394 Construct a basic_stream_socket, opening it and binding it to the given local endpoint. 104395 [hr] 104396 Construct a basic_stream_socket on an existing native socket. 104397 [hr] 104398 Move-construct a basic_stream_socket from another. 104399 [hr] 104400 Move-construct a basic_stream_socket from a socket of another protocol type. ] 104401 ] 104402 104403 [ 104404 [[link boost_asio.reference.basic_stream_socket.bind [*bind]]] 104405 [Bind the socket to the given local endpoint. ] 104406 ] 104407 104408 [ 104409 [[link boost_asio.reference.basic_stream_socket.cancel [*cancel]]] 104410 [Cancel all asynchronous operations associated with the socket. ] 104411 ] 104412 104413 [ 104414 [[link boost_asio.reference.basic_stream_socket.close [*close]]] 104415 [Close the socket. ] 104416 ] 104417 104418 [ 104419 [[link boost_asio.reference.basic_stream_socket.connect [*connect]]] 104420 [Connect the socket to the specified endpoint. ] 104421 ] 104422 104423 [ 104424 [[link boost_asio.reference.basic_stream_socket.get_executor [*get_executor]]] 104425 [Get the executor associated with the object. ] 104426 ] 104427 104428 [ 104429 [[link boost_asio.reference.basic_stream_socket.get_option [*get_option]]] 104430 [Get an option from the socket. ] 104431 ] 104432 104433 [ 104434 [[link boost_asio.reference.basic_stream_socket.io_control [*io_control]]] 104435 [Perform an IO control command on the socket. ] 104436 ] 104437 104438 [ 104439 [[link boost_asio.reference.basic_stream_socket.is_open [*is_open]]] 104440 [Determine whether the socket is open. ] 104441 ] 104442 104443 [ 104444 [[link boost_asio.reference.basic_stream_socket.local_endpoint [*local_endpoint]]] 104445 [Get the local endpoint of the socket. ] 104446 ] 104447 104448 [ 104449 [[link boost_asio.reference.basic_stream_socket.lowest_layer [*lowest_layer]]] 104450 [Get a reference to the lowest layer. 104451 [hr] 104452 Get a const reference to the lowest layer. ] 104453 ] 104454 104455 [ 104456 [[link boost_asio.reference.basic_stream_socket.native_handle [*native_handle]]] 104457 [Get the native socket representation. ] 104458 ] 104459 104460 [ 104461 [[link boost_asio.reference.basic_stream_socket.native_non_blocking [*native_non_blocking]]] 104462 [Gets the non-blocking mode of the native socket implementation. 104463 [hr] 104464 Sets the non-blocking mode of the native socket implementation. ] 104465 ] 104466 104467 [ 104468 [[link boost_asio.reference.basic_stream_socket.non_blocking [*non_blocking]]] 104469 [Gets the non-blocking mode of the socket. 104470 [hr] 104471 Sets the non-blocking mode of the socket. ] 104472 ] 104473 104474 [ 104475 [[link boost_asio.reference.basic_stream_socket.open [*open]]] 104476 [Open the socket using the specified protocol. ] 104477 ] 104478 104479 [ 104480 [[link boost_asio.reference.basic_stream_socket.operator_eq_ [*operator=]]] 104481 [Move-assign a basic_stream_socket from another. 104482 [hr] 104483 Move-assign a basic_stream_socket from a socket of another protocol type. ] 104484 ] 104485 104486 [ 104487 [[link boost_asio.reference.basic_stream_socket.read_some [*read_some]]] 104488 [Read some data from the socket. ] 104489 ] 104490 104491 [ 104492 [[link boost_asio.reference.basic_stream_socket.receive [*receive]]] 104493 [Receive some data on the socket. 104494 [hr] 104495 Receive some data on a connected socket. ] 104496 ] 104497 104498 [ 104499 [[link boost_asio.reference.basic_stream_socket.release [*release]]] 104500 [Release ownership of the underlying native socket. ] 104501 ] 104502 104503 [ 104504 [[link boost_asio.reference.basic_stream_socket.remote_endpoint [*remote_endpoint]]] 104505 [Get the remote endpoint of the socket. ] 104506 ] 104507 104508 [ 104509 [[link boost_asio.reference.basic_stream_socket.send [*send]]] 104510 [Send some data on the socket. ] 104511 ] 104512 104513 [ 104514 [[link boost_asio.reference.basic_stream_socket.set_option [*set_option]]] 104515 [Set an option on the socket. ] 104516 ] 104517 104518 [ 104519 [[link boost_asio.reference.basic_stream_socket.shutdown [*shutdown]]] 104520 [Disable sends or receives on the socket. ] 104521 ] 104522 104523 [ 104524 [[link boost_asio.reference.basic_stream_socket.wait [*wait]]] 104525 [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] 104526 ] 104527 104528 [ 104529 [[link boost_asio.reference.basic_stream_socket.write_some [*write_some]]] 104530 [Write some data to the socket. ] 104531 ] 104532 104533 [ 104534 [[link boost_asio.reference.basic_stream_socket._basic_stream_socket [*~basic_stream_socket]] [destructor]] 104535 [Destroys the socket. ] 104536 ] 104537 104538] 104539 104540[heading Data Members] 104541[table 104542 [[Name][Description]] 104543 104544 [ 104545 [[link boost_asio.reference.basic_stream_socket.max_connections [*max_connections]] [static]] 104546 [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ] 104547 ] 104548 104549 [ 104550 [[link boost_asio.reference.basic_stream_socket.max_listen_connections [*max_listen_connections]] [static]] 104551 [The maximum length of the queue of pending incoming connections. ] 104552 ] 104553 104554 [ 104555 [[link boost_asio.reference.basic_stream_socket.message_do_not_route [*message_do_not_route]] [static]] 104556 [Specify that the data should not be subject to routing. ] 104557 ] 104558 104559 [ 104560 [[link boost_asio.reference.basic_stream_socket.message_end_of_record [*message_end_of_record]] [static]] 104561 [Specifies that the data marks the end of a record. ] 104562 ] 104563 104564 [ 104565 [[link boost_asio.reference.basic_stream_socket.message_out_of_band [*message_out_of_band]] [static]] 104566 [Process out-of-band data. ] 104567 ] 104568 104569 [ 104570 [[link boost_asio.reference.basic_stream_socket.message_peek [*message_peek]] [static]] 104571 [Peek at incoming data without removing it from the input queue. ] 104572 ] 104573 104574] 104575 104576The [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] class template provides asynchronous and blocking stream-oriented socket functionality. 104577 104578 104579[heading Thread Safety] 104580 104581['Distinct] ['objects:] Safe. 104582 104583['Shared] ['objects:] Unsafe. 104584 104585Synchronous `send`, `receive`, and `connect` operations are thread safe with respect to each other, if the underlying operating system calls are also thread safe. This means that it is permitted to perform concurrent calls to these synchronous operations on a single socket object. Other synchronous operations, such as `open` or `close`, are not thread safe. 104586 104587 104588 104589 104590 104591[heading Requirements] 104592 104593['Header: ][^boost/asio/local/stream_protocol.hpp] 104594 104595['Convenience header: ][^boost/asio.hpp] 104596 104597 104598[endsect] 104599 104600 104601 104602[section:type local::stream_protocol::type] 104603 104604[indexterm2 boost_asio.indexterm.local__stream_protocol.type..type..local::stream_protocol] 104605Obtain an identifier for the type of the protocol. 104606 104607 104608 int type() const; 104609 104610 104611 104612[endsect] 104613 104614 104615 104616[endsect] 104617 104618[section:make_strand make_strand] 104619 104620[indexterm1 boost_asio.indexterm.make_strand..make_strand] 104621The `boost::asio::make_strand` function creates a [link boost_asio.reference.strand `strand`] object for an executor or execution context. 104622 104623 104624Create a [link boost_asio.reference.strand `strand`] object for an executor. 104625 104626 template< 104627 typename ``[link boost_asio.reference.Executor1 Executor]``> 104628 strand< Executor > ``[link boost_asio.reference.make_strand.overload1 make_strand]``( 104629 const Executor & ex, 104630 typename constraint< is_executor< Executor >::value||execution::is_executor< Executor >::value >::type = 0); 104631 `` [''''»''' [link boost_asio.reference.make_strand.overload1 more...]]`` 104632 104633Create a [link boost_asio.reference.strand `strand`] object for an execution context. 104634 104635 template< 104636 typename ExecutionContext> 104637 strand< typename ExecutionContext::executor_type > ``[link boost_asio.reference.make_strand.overload2 make_strand]``( 104638 ExecutionContext & ctx, 104639 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 104640 `` [''''»''' [link boost_asio.reference.make_strand.overload2 more...]]`` 104641 104642[heading Requirements] 104643 104644['Header: ][^boost/asio/strand.hpp] 104645 104646['Convenience header: ][^boost/asio.hpp] 104647 104648 104649[section:overload1 make_strand (1 of 2 overloads)] 104650 104651 104652Create a [link boost_asio.reference.strand `strand`] object for an executor. 104653 104654 104655 template< 104656 typename ``[link boost_asio.reference.Executor1 Executor]``> 104657 strand< Executor > make_strand( 104658 const Executor & ex, 104659 typename constraint< is_executor< Executor >::value||execution::is_executor< Executor >::value >::type = 0); 104660 104661 104662 104663[endsect] 104664 104665 104666 104667[section:overload2 make_strand (2 of 2 overloads)] 104668 104669 104670Create a [link boost_asio.reference.strand `strand`] object for an execution context. 104671 104672 104673 template< 104674 typename ExecutionContext> 104675 strand< typename ExecutionContext::executor_type > make_strand( 104676 ExecutionContext & ctx, 104677 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 104678 104679 104680 104681[endsect] 104682 104683 104684[endsect] 104685 104686[section:make_work_guard make_work_guard] 104687 104688[indexterm1 boost_asio.indexterm.make_work_guard..make_work_guard] 104689Create an [link boost_asio.reference.executor_work_guard `executor_work_guard`] object. 104690 104691 template< 104692 typename ``[link boost_asio.reference.Executor1 Executor]``> 104693 executor_work_guard< Executor > ``[link boost_asio.reference.make_work_guard.overload1 make_work_guard]``( 104694 const Executor & ex, 104695 typename constraint< is_executor< Executor >::value||execution::is_executor< Executor >::value >::type = 0); 104696 `` [''''»''' [link boost_asio.reference.make_work_guard.overload1 more...]]`` 104697 104698 template< 104699 typename ExecutionContext> 104700 executor_work_guard< typename ExecutionContext::executor_type > ``[link boost_asio.reference.make_work_guard.overload2 make_work_guard]``( 104701 ExecutionContext & ctx, 104702 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 104703 `` [''''»''' [link boost_asio.reference.make_work_guard.overload2 more...]]`` 104704 104705 template< 104706 typename T> 104707 executor_work_guard< typename associated_executor< T >::type > ``[link boost_asio.reference.make_work_guard.overload3 make_work_guard]``( 104708 const T & t, 104709 typename constraint< !is_executor< T >::value >::type = 0, 104710 typename constraint< !execution::is_executor< T >::value >::type = 0, 104711 typename constraint< !is_convertible< T &, execution_context & >::value >::type = 0); 104712 `` [''''»''' [link boost_asio.reference.make_work_guard.overload3 more...]]`` 104713 104714 template< 104715 typename T, 104716 typename ``[link boost_asio.reference.Executor1 Executor]``> 104717 executor_work_guard< typename associated_executor< T, Executor >::type > ``[link boost_asio.reference.make_work_guard.overload4 make_work_guard]``( 104718 const T & t, 104719 const Executor & ex, 104720 typename constraint< is_executor< Executor >::value||execution::is_executor< Executor >::value >::type = 0); 104721 `` [''''»''' [link boost_asio.reference.make_work_guard.overload4 more...]]`` 104722 104723 template< 104724 typename T, 104725 typename ExecutionContext> 104726 executor_work_guard< typename associated_executor< T, typename ExecutionContext::executor_type >::type > ``[link boost_asio.reference.make_work_guard.overload5 make_work_guard]``( 104727 const T & t, 104728 ExecutionContext & ctx, 104729 typename constraint< !is_executor< T >::value >::type = 0, 104730 typename constraint< !execution::is_executor< T >::value >::type = 0, 104731 typename constraint< !is_convertible< T &, execution_context & >::value >::type = 0, 104732 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 104733 `` [''''»''' [link boost_asio.reference.make_work_guard.overload5 more...]]`` 104734 104735[heading Requirements] 104736 104737['Header: ][^boost/asio/executor_work_guard.hpp] 104738 104739['Convenience header: ][^boost/asio.hpp] 104740 104741 104742[section:overload1 make_work_guard (1 of 5 overloads)] 104743 104744 104745Create an [link boost_asio.reference.executor_work_guard `executor_work_guard`] object. 104746 104747 104748 template< 104749 typename ``[link boost_asio.reference.Executor1 Executor]``> 104750 executor_work_guard< Executor > make_work_guard( 104751 const Executor & ex, 104752 typename constraint< is_executor< Executor >::value||execution::is_executor< Executor >::value >::type = 0); 104753 104754 104755 104756[endsect] 104757 104758 104759 104760[section:overload2 make_work_guard (2 of 5 overloads)] 104761 104762 104763Create an [link boost_asio.reference.executor_work_guard `executor_work_guard`] object. 104764 104765 104766 template< 104767 typename ExecutionContext> 104768 executor_work_guard< typename ExecutionContext::executor_type > make_work_guard( 104769 ExecutionContext & ctx, 104770 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 104771 104772 104773 104774[endsect] 104775 104776 104777 104778[section:overload3 make_work_guard (3 of 5 overloads)] 104779 104780 104781Create an [link boost_asio.reference.executor_work_guard `executor_work_guard`] object. 104782 104783 104784 template< 104785 typename T> 104786 executor_work_guard< typename associated_executor< T >::type > make_work_guard( 104787 const T & t, 104788 typename constraint< !is_executor< T >::value >::type = 0, 104789 typename constraint< !execution::is_executor< T >::value >::type = 0, 104790 typename constraint< !is_convertible< T &, execution_context & >::value >::type = 0); 104791 104792 104793 104794[endsect] 104795 104796 104797 104798[section:overload4 make_work_guard (4 of 5 overloads)] 104799 104800 104801Create an [link boost_asio.reference.executor_work_guard `executor_work_guard`] object. 104802 104803 104804 template< 104805 typename T, 104806 typename ``[link boost_asio.reference.Executor1 Executor]``> 104807 executor_work_guard< typename associated_executor< T, Executor >::type > make_work_guard( 104808 const T & t, 104809 const Executor & ex, 104810 typename constraint< is_executor< Executor >::value||execution::is_executor< Executor >::value >::type = 0); 104811 104812 104813 104814[endsect] 104815 104816 104817 104818[section:overload5 make_work_guard (5 of 5 overloads)] 104819 104820 104821Create an [link boost_asio.reference.executor_work_guard `executor_work_guard`] object. 104822 104823 104824 template< 104825 typename T, 104826 typename ExecutionContext> 104827 executor_work_guard< typename associated_executor< T, typename ExecutionContext::executor_type >::type > make_work_guard( 104828 const T & t, 104829 ExecutionContext & ctx, 104830 typename constraint< !is_executor< T >::value >::type = 0, 104831 typename constraint< !execution::is_executor< T >::value >::type = 0, 104832 typename constraint< !is_convertible< T &, execution_context & >::value >::type = 0, 104833 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 104834 104835 104836 104837[endsect] 104838 104839 104840[endsect] 104841 104842[section:multiple_exceptions multiple_exceptions] 104843 104844[indexterm1 boost_asio.indexterm.multiple_exceptions..multiple_exceptions] 104845 104846 104847Exception thrown when there are multiple pending exceptions to rethrow. 104848 104849 104850 class multiple_exceptions : 104851 public std::exception 104852 104853 104854[heading Member Functions] 104855[table 104856 [[Name][Description]] 104857 104858 [ 104859 [[link boost_asio.reference.multiple_exceptions.first_exception [*first_exception]]] 104860 [Obtain a pointer to the first exception. ] 104861 ] 104862 104863 [ 104864 [[link boost_asio.reference.multiple_exceptions.multiple_exceptions [*multiple_exceptions]] [constructor]] 104865 [Constructor. ] 104866 ] 104867 104868 [ 104869 [[link boost_asio.reference.multiple_exceptions.what [*what]]] 104870 [Obtain message associated with exception. ] 104871 ] 104872 104873] 104874 104875[heading Requirements] 104876 104877['Header: ][^boost/asio/multiple_exceptions.hpp] 104878 104879['Convenience header: ][^boost/asio.hpp] 104880 104881 104882[section:first_exception multiple_exceptions::first_exception] 104883 104884[indexterm2 boost_asio.indexterm.multiple_exceptions.first_exception..first_exception..multiple_exceptions] 104885Obtain a pointer to the first exception. 104886 104887 104888 std::exception_ptr first_exception() const; 104889 104890 104891 104892[endsect] 104893 104894 104895 104896[section:multiple_exceptions multiple_exceptions::multiple_exceptions] 104897 104898[indexterm2 boost_asio.indexterm.multiple_exceptions.multiple_exceptions..multiple_exceptions..multiple_exceptions] 104899Constructor. 104900 104901 104902 multiple_exceptions( 104903 std::exception_ptr first); 104904 104905 104906 104907[endsect] 104908 104909 104910 104911[section:what multiple_exceptions::what] 104912 104913[indexterm2 boost_asio.indexterm.multiple_exceptions.what..what..multiple_exceptions] 104914Obtain message associated with exception. 104915 104916 104917 virtual const char * what() const; 104918 104919 104920 104921[endsect] 104922 104923 104924 104925[endsect] 104926 104927[section:mutable_buffer mutable_buffer] 104928 104929[indexterm1 boost_asio.indexterm.mutable_buffer..mutable_buffer] 104930 104931 104932Holds a buffer that can be modified. 104933 104934 104935 class mutable_buffer 104936 104937 104938[heading Member Functions] 104939[table 104940 [[Name][Description]] 104941 104942 [ 104943 [[link boost_asio.reference.mutable_buffer.data [*data]]] 104944 [Get a pointer to the beginning of the memory range. ] 104945 ] 104946 104947 [ 104948 [[link boost_asio.reference.mutable_buffer.mutable_buffer [*mutable_buffer]] [constructor]] 104949 [Construct an empty buffer. 104950 [hr] 104951 Construct a buffer to represent a given memory range. ] 104952 ] 104953 104954 [ 104955 [[link boost_asio.reference.mutable_buffer.operator_plus__eq_ [*operator+=]]] 104956 [Move the start of the buffer by the specified number of bytes. ] 104957 ] 104958 104959 [ 104960 [[link boost_asio.reference.mutable_buffer.size [*size]]] 104961 [Get the size of the memory range. ] 104962 ] 104963 104964] 104965 104966[heading Related Functions] 104967[table 104968 [[Name][Description]] 104969 104970 [ 104971 [[link boost_asio.reference.mutable_buffer.operator_plus_ [*operator+]]] 104972 [Create a new modifiable buffer that is offset from the start of another. ] 104973 ] 104974 104975] 104976 104977The [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. 104978 104979 104980[heading Accessing Buffer Contents] 104981 104982 104983 104984The contents of a buffer may be accessed using the `data()` and `size()` member functions: 104985 104986 104987 104988 boost::asio::mutable_buffer b1 = ...; 104989 std::size_t s1 = b1.size(); 104990 unsigned char* p1 = static_cast<unsigned char*>(b1.data()); 104991 104992 104993 104994 104995The `data()` member function permits violations of type safety, so uses of it in application code should be carefully considered. 104996 104997[heading Requirements] 104998 104999['Header: ][^boost/asio/buffer.hpp] 105000 105001['Convenience header: ][^boost/asio.hpp] 105002 105003 105004[section:data mutable_buffer::data] 105005 105006[indexterm2 boost_asio.indexterm.mutable_buffer.data..data..mutable_buffer] 105007Get a pointer to the beginning of the memory range. 105008 105009 105010 void * data() const; 105011 105012 105013 105014[endsect] 105015 105016 105017[section:mutable_buffer mutable_buffer::mutable_buffer] 105018 105019[indexterm2 boost_asio.indexterm.mutable_buffer.mutable_buffer..mutable_buffer..mutable_buffer] 105020Construct an empty buffer. 105021 105022 105023 ``[link boost_asio.reference.mutable_buffer.mutable_buffer.overload1 mutable_buffer]``(); 105024 `` [''''»''' [link boost_asio.reference.mutable_buffer.mutable_buffer.overload1 more...]]`` 105025 105026 105027Construct a buffer to represent a given memory range. 105028 105029 105030 ``[link boost_asio.reference.mutable_buffer.mutable_buffer.overload2 mutable_buffer]``( 105031 void * data, 105032 std::size_t size); 105033 `` [''''»''' [link boost_asio.reference.mutable_buffer.mutable_buffer.overload2 more...]]`` 105034 105035 105036[section:overload1 mutable_buffer::mutable_buffer (1 of 2 overloads)] 105037 105038 105039Construct an empty buffer. 105040 105041 105042 mutable_buffer(); 105043 105044 105045 105046[endsect] 105047 105048 105049 105050[section:overload2 mutable_buffer::mutable_buffer (2 of 2 overloads)] 105051 105052 105053Construct a buffer to represent a given memory range. 105054 105055 105056 mutable_buffer( 105057 void * data, 105058 std::size_t size); 105059 105060 105061 105062[endsect] 105063 105064 105065[endsect] 105066 105067[section:operator_plus_ mutable_buffer::operator+] 105068 105069[indexterm2 boost_asio.indexterm.mutable_buffer.operator_plus_..operator+..mutable_buffer] 105070Create a new modifiable buffer that is offset from the start of another. 105071 105072 105073 mutable_buffer ``[link boost_asio.reference.mutable_buffer.operator_plus_.overload1 operator+]``( 105074 const mutable_buffer & b, 105075 std::size_t n); 105076 `` [''''»''' [link boost_asio.reference.mutable_buffer.operator_plus_.overload1 more...]]`` 105077 105078 mutable_buffer ``[link boost_asio.reference.mutable_buffer.operator_plus_.overload2 operator+]``( 105079 std::size_t n, 105080 const mutable_buffer & b); 105081 `` [''''»''' [link boost_asio.reference.mutable_buffer.operator_plus_.overload2 more...]]`` 105082 105083 105084[section:overload1 mutable_buffer::operator+ (1 of 2 overloads)] 105085 105086 105087Create a new modifiable buffer that is offset from the start of another. 105088 105089 105090 mutable_buffer operator+( 105091 const mutable_buffer & b, 105092 std::size_t n); 105093 105094 105095 105096[endsect] 105097 105098 105099 105100[section:overload2 mutable_buffer::operator+ (2 of 2 overloads)] 105101 105102 105103Create a new modifiable buffer that is offset from the start of another. 105104 105105 105106 mutable_buffer operator+( 105107 std::size_t n, 105108 const mutable_buffer & b); 105109 105110 105111 105112[endsect] 105113 105114 105115[endsect] 105116 105117 105118[section:operator_plus__eq_ mutable_buffer::operator+=] 105119 105120[indexterm2 boost_asio.indexterm.mutable_buffer.operator_plus__eq_..operator+=..mutable_buffer] 105121Move the start of the buffer by the specified number of bytes. 105122 105123 105124 mutable_buffer & operator+=( 105125 std::size_t n); 105126 105127 105128 105129[endsect] 105130 105131 105132 105133[section:size mutable_buffer::size] 105134 105135[indexterm2 boost_asio.indexterm.mutable_buffer.size..size..mutable_buffer] 105136Get the size of the memory range. 105137 105138 105139 std::size_t size() const; 105140 105141 105142 105143[endsect] 105144 105145 105146 105147[endsect] 105148 105149[section:mutable_buffers_1 mutable_buffers_1] 105150 105151[indexterm1 boost_asio.indexterm.mutable_buffers_1..mutable_buffers_1] 105152 105153 105154(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. 105155 105156 105157 class mutable_buffers_1 : 105158 public mutable_buffer 105159 105160 105161[heading Types] 105162[table 105163 [[Name][Description]] 105164 105165 [ 105166 105167 [[link boost_asio.reference.mutable_buffers_1.const_iterator [*const_iterator]]] 105168 [A random-access iterator type that may be used to read elements. ] 105169 105170 ] 105171 105172 [ 105173 105174 [[link boost_asio.reference.mutable_buffers_1.value_type [*value_type]]] 105175 [The type for each element in the list of buffers. ] 105176 105177 ] 105178 105179] 105180 105181[heading Member Functions] 105182[table 105183 [[Name][Description]] 105184 105185 [ 105186 [[link boost_asio.reference.mutable_buffers_1.begin [*begin]]] 105187 [Get a random-access iterator to the first element. ] 105188 ] 105189 105190 [ 105191 [[link boost_asio.reference.mutable_buffers_1.data [*data]]] 105192 [Get a pointer to the beginning of the memory range. ] 105193 ] 105194 105195 [ 105196 [[link boost_asio.reference.mutable_buffers_1.end [*end]]] 105197 [Get a random-access iterator for one past the last element. ] 105198 ] 105199 105200 [ 105201 [[link boost_asio.reference.mutable_buffers_1.mutable_buffers_1 [*mutable_buffers_1]] [constructor]] 105202 [Construct to represent a given memory range. 105203 [hr] 105204 Construct to represent a single modifiable buffer. ] 105205 ] 105206 105207 [ 105208 [[link boost_asio.reference.mutable_buffers_1.operator_plus__eq_ [*operator+=]]] 105209 [Move the start of the buffer by the specified number of bytes. ] 105210 ] 105211 105212 [ 105213 [[link boost_asio.reference.mutable_buffers_1.size [*size]]] 105214 [Get the size of the memory range. ] 105215 ] 105216 105217] 105218 105219[heading Related Functions] 105220[table 105221 [[Name][Description]] 105222 105223 [ 105224 [[link boost_asio.reference.mutable_buffers_1.operator_plus_ [*operator+]]] 105225 [Create a new modifiable buffer that is offset from the start of another. ] 105226 ] 105227 105228] 105229 105230[heading Requirements] 105231 105232['Header: ][^boost/asio/buffer.hpp] 105233 105234['Convenience header: ][^boost/asio.hpp] 105235 105236 105237[section:begin mutable_buffers_1::begin] 105238 105239[indexterm2 boost_asio.indexterm.mutable_buffers_1.begin..begin..mutable_buffers_1] 105240Get a random-access iterator to the first element. 105241 105242 105243 const_iterator begin() const; 105244 105245 105246 105247[endsect] 105248 105249 105250 105251[section:const_iterator mutable_buffers_1::const_iterator] 105252 105253[indexterm2 boost_asio.indexterm.mutable_buffers_1.const_iterator..const_iterator..mutable_buffers_1] 105254A random-access iterator type that may be used to read elements. 105255 105256 105257 typedef const mutable_buffer * const_iterator; 105258 105259 105260 105261[heading Requirements] 105262 105263['Header: ][^boost/asio/buffer.hpp] 105264 105265['Convenience header: ][^boost/asio.hpp] 105266 105267 105268[endsect] 105269 105270 105271 105272[section:data mutable_buffers_1::data] 105273 105274 105275['Inherited from mutable_buffer.] 105276 105277[indexterm2 boost_asio.indexterm.mutable_buffers_1.data..data..mutable_buffers_1] 105278Get a pointer to the beginning of the memory range. 105279 105280 105281 void * data() const; 105282 105283 105284 105285[endsect] 105286 105287 105288 105289[section:end mutable_buffers_1::end] 105290 105291[indexterm2 boost_asio.indexterm.mutable_buffers_1.end..end..mutable_buffers_1] 105292Get a random-access iterator for one past the last element. 105293 105294 105295 const_iterator end() const; 105296 105297 105298 105299[endsect] 105300 105301 105302[section:mutable_buffers_1 mutable_buffers_1::mutable_buffers_1] 105303 105304[indexterm2 boost_asio.indexterm.mutable_buffers_1.mutable_buffers_1..mutable_buffers_1..mutable_buffers_1] 105305Construct to represent a given memory range. 105306 105307 105308 ``[link boost_asio.reference.mutable_buffers_1.mutable_buffers_1.overload1 mutable_buffers_1]``( 105309 void * data, 105310 std::size_t size); 105311 `` [''''»''' [link boost_asio.reference.mutable_buffers_1.mutable_buffers_1.overload1 more...]]`` 105312 105313 105314Construct to represent a single modifiable buffer. 105315 105316 105317 explicit ``[link boost_asio.reference.mutable_buffers_1.mutable_buffers_1.overload2 mutable_buffers_1]``( 105318 const mutable_buffer & b); 105319 `` [''''»''' [link boost_asio.reference.mutable_buffers_1.mutable_buffers_1.overload2 more...]]`` 105320 105321 105322[section:overload1 mutable_buffers_1::mutable_buffers_1 (1 of 2 overloads)] 105323 105324 105325Construct to represent a given memory range. 105326 105327 105328 mutable_buffers_1( 105329 void * data, 105330 std::size_t size); 105331 105332 105333 105334[endsect] 105335 105336 105337 105338[section:overload2 mutable_buffers_1::mutable_buffers_1 (2 of 2 overloads)] 105339 105340 105341Construct to represent a single modifiable buffer. 105342 105343 105344 mutable_buffers_1( 105345 const mutable_buffer & b); 105346 105347 105348 105349[endsect] 105350 105351 105352[endsect] 105353 105354[section:operator_plus_ mutable_buffers_1::operator+] 105355 105356[indexterm2 boost_asio.indexterm.mutable_buffers_1.operator_plus_..operator+..mutable_buffers_1] 105357Create a new modifiable buffer that is offset from the start of another. 105358 105359 105360 mutable_buffer ``[link boost_asio.reference.mutable_buffers_1.operator_plus_.overload1 operator+]``( 105361 const mutable_buffer & b, 105362 std::size_t n); 105363 `` [''''»''' [link boost_asio.reference.mutable_buffers_1.operator_plus_.overload1 more...]]`` 105364 105365 mutable_buffer ``[link boost_asio.reference.mutable_buffers_1.operator_plus_.overload2 operator+]``( 105366 std::size_t n, 105367 const mutable_buffer & b); 105368 `` [''''»''' [link boost_asio.reference.mutable_buffers_1.operator_plus_.overload2 more...]]`` 105369 105370 105371[section:overload1 mutable_buffers_1::operator+ (1 of 2 overloads)] 105372 105373 105374['Inherited from mutable_buffer.] 105375 105376 105377Create a new modifiable buffer that is offset from the start of another. 105378 105379 105380 mutable_buffer operator+( 105381 const mutable_buffer & b, 105382 std::size_t n); 105383 105384 105385 105386[endsect] 105387 105388 105389 105390[section:overload2 mutable_buffers_1::operator+ (2 of 2 overloads)] 105391 105392 105393['Inherited from mutable_buffer.] 105394 105395 105396Create a new modifiable buffer that is offset from the start of another. 105397 105398 105399 mutable_buffer operator+( 105400 std::size_t n, 105401 const mutable_buffer & b); 105402 105403 105404 105405[endsect] 105406 105407 105408[endsect] 105409 105410 105411[section:operator_plus__eq_ mutable_buffers_1::operator+=] 105412 105413 105414['Inherited from mutable_buffer.] 105415 105416[indexterm2 boost_asio.indexterm.mutable_buffers_1.operator_plus__eq_..operator+=..mutable_buffers_1] 105417Move the start of the buffer by the specified number of bytes. 105418 105419 105420 mutable_buffer & operator+=( 105421 std::size_t n); 105422 105423 105424 105425[endsect] 105426 105427 105428 105429[section:size mutable_buffers_1::size] 105430 105431 105432['Inherited from mutable_buffer.] 105433 105434[indexterm2 boost_asio.indexterm.mutable_buffers_1.size..size..mutable_buffers_1] 105435Get the size of the memory range. 105436 105437 105438 std::size_t size() const; 105439 105440 105441 105442[endsect] 105443 105444 105445 105446[section:value_type mutable_buffers_1::value_type] 105447 105448[indexterm2 boost_asio.indexterm.mutable_buffers_1.value_type..value_type..mutable_buffers_1] 105449The type for each element in the list of buffers. 105450 105451 105452 typedef mutable_buffer value_type; 105453 105454 105455[heading Member Functions] 105456[table 105457 [[Name][Description]] 105458 105459 [ 105460 [[link boost_asio.reference.mutable_buffer.data [*data]]] 105461 [Get a pointer to the beginning of the memory range. ] 105462 ] 105463 105464 [ 105465 [[link boost_asio.reference.mutable_buffer.mutable_buffer [*mutable_buffer]] [constructor]] 105466 [Construct an empty buffer. 105467 [hr] 105468 Construct a buffer to represent a given memory range. ] 105469 ] 105470 105471 [ 105472 [[link boost_asio.reference.mutable_buffer.operator_plus__eq_ [*operator+=]]] 105473 [Move the start of the buffer by the specified number of bytes. ] 105474 ] 105475 105476 [ 105477 [[link boost_asio.reference.mutable_buffer.size [*size]]] 105478 [Get the size of the memory range. ] 105479 ] 105480 105481] 105482 105483[heading Related Functions] 105484[table 105485 [[Name][Description]] 105486 105487 [ 105488 [[link boost_asio.reference.mutable_buffer.operator_plus_ [*operator+]]] 105489 [Create a new modifiable buffer that is offset from the start of another. ] 105490 ] 105491 105492] 105493 105494The [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. 105495 105496 105497[heading Accessing Buffer Contents] 105498 105499 105500 105501The contents of a buffer may be accessed using the `data()` and `size()` member functions: 105502 105503 105504 105505 boost::asio::mutable_buffer b1 = ...; 105506 std::size_t s1 = b1.size(); 105507 unsigned char* p1 = static_cast<unsigned char*>(b1.data()); 105508 105509 105510 105511 105512The `data()` member function permits violations of type safety, so uses of it in application code should be carefully considered. 105513 105514 105515[heading Requirements] 105516 105517['Header: ][^boost/asio/buffer.hpp] 105518 105519['Convenience header: ][^boost/asio.hpp] 105520 105521 105522[endsect] 105523 105524 105525 105526[endsect] 105527 105528[section:null_buffers null_buffers] 105529 105530[indexterm1 boost_asio.indexterm.null_buffers..null_buffers] 105531 105532 105533(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. 105534 105535 105536 class null_buffers 105537 105538 105539[heading Types] 105540[table 105541 [[Name][Description]] 105542 105543 [ 105544 105545 [[link boost_asio.reference.null_buffers.const_iterator [*const_iterator]]] 105546 [A random-access iterator type that may be used to read elements. ] 105547 105548 ] 105549 105550 [ 105551 105552 [[link boost_asio.reference.null_buffers.value_type [*value_type]]] 105553 [The type for each element in the list of buffers. ] 105554 105555 ] 105556 105557] 105558 105559[heading Member Functions] 105560[table 105561 [[Name][Description]] 105562 105563 [ 105564 [[link boost_asio.reference.null_buffers.begin [*begin]]] 105565 [Get a random-access iterator to the first element. ] 105566 ] 105567 105568 [ 105569 [[link boost_asio.reference.null_buffers.end [*end]]] 105570 [Get a random-access iterator for one past the last element. ] 105571 ] 105572 105573] 105574 105575[heading Requirements] 105576 105577['Header: ][^boost/asio/buffer.hpp] 105578 105579['Convenience header: ][^boost/asio.hpp] 105580 105581 105582[section:begin null_buffers::begin] 105583 105584[indexterm2 boost_asio.indexterm.null_buffers.begin..begin..null_buffers] 105585Get a random-access iterator to the first element. 105586 105587 105588 const_iterator begin() const; 105589 105590 105591 105592[endsect] 105593 105594 105595 105596[section:const_iterator null_buffers::const_iterator] 105597 105598[indexterm2 boost_asio.indexterm.null_buffers.const_iterator..const_iterator..null_buffers] 105599A random-access iterator type that may be used to read elements. 105600 105601 105602 typedef const mutable_buffer * const_iterator; 105603 105604 105605 105606[heading Requirements] 105607 105608['Header: ][^boost/asio/buffer.hpp] 105609 105610['Convenience header: ][^boost/asio.hpp] 105611 105612 105613[endsect] 105614 105615 105616 105617[section:end null_buffers::end] 105618 105619[indexterm2 boost_asio.indexterm.null_buffers.end..end..null_buffers] 105620Get a random-access iterator for one past the last element. 105621 105622 105623 const_iterator end() const; 105624 105625 105626 105627[endsect] 105628 105629 105630 105631[section:value_type null_buffers::value_type] 105632 105633[indexterm2 boost_asio.indexterm.null_buffers.value_type..value_type..null_buffers] 105634The type for each element in the list of buffers. 105635 105636 105637 typedef mutable_buffer value_type; 105638 105639 105640[heading Member Functions] 105641[table 105642 [[Name][Description]] 105643 105644 [ 105645 [[link boost_asio.reference.mutable_buffer.data [*data]]] 105646 [Get a pointer to the beginning of the memory range. ] 105647 ] 105648 105649 [ 105650 [[link boost_asio.reference.mutable_buffer.mutable_buffer [*mutable_buffer]] [constructor]] 105651 [Construct an empty buffer. 105652 [hr] 105653 Construct a buffer to represent a given memory range. ] 105654 ] 105655 105656 [ 105657 [[link boost_asio.reference.mutable_buffer.operator_plus__eq_ [*operator+=]]] 105658 [Move the start of the buffer by the specified number of bytes. ] 105659 ] 105660 105661 [ 105662 [[link boost_asio.reference.mutable_buffer.size [*size]]] 105663 [Get the size of the memory range. ] 105664 ] 105665 105666] 105667 105668[heading Related Functions] 105669[table 105670 [[Name][Description]] 105671 105672 [ 105673 [[link boost_asio.reference.mutable_buffer.operator_plus_ [*operator+]]] 105674 [Create a new modifiable buffer that is offset from the start of another. ] 105675 ] 105676 105677] 105678 105679The [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. 105680 105681 105682[heading Accessing Buffer Contents] 105683 105684 105685 105686The contents of a buffer may be accessed using the `data()` and `size()` member functions: 105687 105688 105689 105690 boost::asio::mutable_buffer b1 = ...; 105691 std::size_t s1 = b1.size(); 105692 unsigned char* p1 = static_cast<unsigned char*>(b1.data()); 105693 105694 105695 105696 105697The `data()` member function permits violations of type safety, so uses of it in application code should be carefully considered. 105698 105699 105700[heading Requirements] 105701 105702['Header: ][^boost/asio/buffer.hpp] 105703 105704['Convenience header: ][^boost/asio.hpp] 105705 105706 105707[endsect] 105708 105709 105710 105711[endsect] 105712 105713 105714[section:placeholders__bytes_transferred placeholders::bytes_transferred] 105715 105716[indexterm1 boost_asio.indexterm.placeholders__bytes_transferred..placeholders::bytes_transferred] 105717An 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`. 105718 105719 105720 unspecified bytes_transferred; 105721 105722 105723[heading Requirements] 105724 105725['Header: ][^boost/asio/placeholders.hpp] 105726 105727['Convenience header: ][^boost/asio.hpp] 105728 105729 105730[endsect] 105731 105732 105733 105734[section:placeholders__endpoint placeholders::endpoint] 105735 105736[indexterm1 boost_asio.indexterm.placeholders__endpoint..placeholders::endpoint] 105737An 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`. 105738 105739 105740 unspecified endpoint; 105741 105742 105743[heading Requirements] 105744 105745['Header: ][^boost/asio/placeholders.hpp] 105746 105747['Convenience header: ][^boost/asio.hpp] 105748 105749 105750[endsect] 105751 105752 105753 105754[section:placeholders__error placeholders::error] 105755 105756[indexterm1 boost_asio.indexterm.placeholders__error..placeholders::error] 105757An argument placeholder, for use with boost::bind(), that corresponds to the error argument of a handler for any of the asynchronous functions. 105758 105759 105760 unspecified error; 105761 105762 105763[heading Requirements] 105764 105765['Header: ][^boost/asio/placeholders.hpp] 105766 105767['Convenience header: ][^boost/asio.hpp] 105768 105769 105770[endsect] 105771 105772 105773 105774[section:placeholders__iterator placeholders::iterator] 105775 105776[indexterm1 boost_asio.indexterm.placeholders__iterator..placeholders::iterator] 105777An 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`. 105778 105779 105780 unspecified iterator; 105781 105782 105783[heading Requirements] 105784 105785['Header: ][^boost/asio/placeholders.hpp] 105786 105787['Convenience header: ][^boost/asio.hpp] 105788 105789 105790[endsect] 105791 105792 105793 105794[section:placeholders__results placeholders::results] 105795 105796[indexterm1 boost_asio.indexterm.placeholders__results..placeholders::results] 105797An 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. 105798 105799 105800 unspecified results; 105801 105802 105803[heading Requirements] 105804 105805['Header: ][^boost/asio/placeholders.hpp] 105806 105807['Convenience header: ][^boost/asio.hpp] 105808 105809 105810[endsect] 105811 105812 105813 105814[section:placeholders__signal_number placeholders::signal_number] 105815 105816[indexterm1 boost_asio.indexterm.placeholders__signal_number..placeholders::signal_number] 105817An 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`. 105818 105819 105820 unspecified signal_number; 105821 105822 105823[heading Requirements] 105824 105825['Header: ][^boost/asio/placeholders.hpp] 105826 105827['Convenience header: ][^boost/asio.hpp] 105828 105829 105830[endsect] 105831 105832 105833[section:posix__basic_descriptor posix::basic_descriptor] 105834 105835[indexterm1 boost_asio.indexterm.posix__basic_descriptor..posix::basic_descriptor] 105836 105837 105838Provides POSIX descriptor functionality. 105839 105840 105841 template< 105842 typename ``[link boost_asio.reference.Executor1 Executor]`` = any_io_executor> 105843 class basic_descriptor : 105844 public posix::descriptor_base 105845 105846 105847[heading Types] 105848[table 105849 [[Name][Description]] 105850 105851 [ 105852 105853 [[link boost_asio.reference.posix__basic_descriptor__rebind_executor [*rebind_executor]]] 105854 [Rebinds the descriptor type to another executor. ] 105855 105856 ] 105857 105858 [ 105859 105860 [[link boost_asio.reference.posix__basic_descriptor.bytes_readable [*bytes_readable]]] 105861 [IO control command to get the amount of data that can be read without blocking. ] 105862 105863 ] 105864 105865 [ 105866 105867 [[link boost_asio.reference.posix__basic_descriptor.executor_type [*executor_type]]] 105868 [The type of the executor associated with the object. ] 105869 105870 ] 105871 105872 [ 105873 105874 [[link boost_asio.reference.posix__basic_descriptor.lowest_layer_type [*lowest_layer_type]]] 105875 [A descriptor is always the lowest layer. ] 105876 105877 ] 105878 105879 [ 105880 105881 [[link boost_asio.reference.posix__basic_descriptor.native_handle_type [*native_handle_type]]] 105882 [The native representation of a descriptor. ] 105883 105884 ] 105885 105886 [ 105887 105888 [[link boost_asio.reference.posix__basic_descriptor.wait_type [*wait_type]]] 105889 [Wait types. ] 105890 105891 ] 105892 105893] 105894 105895[heading Member Functions] 105896[table 105897 [[Name][Description]] 105898 105899 [ 105900 [[link boost_asio.reference.posix__basic_descriptor.assign [*assign]]] 105901 [Assign an existing native descriptor to the descriptor. ] 105902 ] 105903 105904 [ 105905 [[link boost_asio.reference.posix__basic_descriptor.async_wait [*async_wait]]] 105906 [Asynchronously wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ] 105907 ] 105908 105909 [ 105910 [[link boost_asio.reference.posix__basic_descriptor.basic_descriptor [*basic_descriptor]] [constructor]] 105911 [Construct a descriptor without opening it. 105912 [hr] 105913 Construct a descriptor on an existing native descriptor. 105914 [hr] 105915 Move-construct a descriptor from another. ] 105916 ] 105917 105918 [ 105919 [[link boost_asio.reference.posix__basic_descriptor.cancel [*cancel]]] 105920 [Cancel all asynchronous operations associated with the descriptor. ] 105921 ] 105922 105923 [ 105924 [[link boost_asio.reference.posix__basic_descriptor.close [*close]]] 105925 [Close the descriptor. ] 105926 ] 105927 105928 [ 105929 [[link boost_asio.reference.posix__basic_descriptor.get_executor [*get_executor]]] 105930 [Get the executor associated with the object. ] 105931 ] 105932 105933 [ 105934 [[link boost_asio.reference.posix__basic_descriptor.io_control [*io_control]]] 105935 [Perform an IO control command on the descriptor. ] 105936 ] 105937 105938 [ 105939 [[link boost_asio.reference.posix__basic_descriptor.is_open [*is_open]]] 105940 [Determine whether the descriptor is open. ] 105941 ] 105942 105943 [ 105944 [[link boost_asio.reference.posix__basic_descriptor.lowest_layer [*lowest_layer]]] 105945 [Get a reference to the lowest layer. 105946 [hr] 105947 Get a const reference to the lowest layer. ] 105948 ] 105949 105950 [ 105951 [[link boost_asio.reference.posix__basic_descriptor.native_handle [*native_handle]]] 105952 [Get the native descriptor representation. ] 105953 ] 105954 105955 [ 105956 [[link boost_asio.reference.posix__basic_descriptor.native_non_blocking [*native_non_blocking]]] 105957 [Gets the non-blocking mode of the native descriptor implementation. 105958 [hr] 105959 Sets the non-blocking mode of the native descriptor implementation. ] 105960 ] 105961 105962 [ 105963 [[link boost_asio.reference.posix__basic_descriptor.non_blocking [*non_blocking]]] 105964 [Gets the non-blocking mode of the descriptor. 105965 [hr] 105966 Sets the non-blocking mode of the descriptor. ] 105967 ] 105968 105969 [ 105970 [[link boost_asio.reference.posix__basic_descriptor.operator_eq_ [*operator=]]] 105971 [Move-assign a descriptor from another. ] 105972 ] 105973 105974 [ 105975 [[link boost_asio.reference.posix__basic_descriptor.release [*release]]] 105976 [Release ownership of the native descriptor implementation. ] 105977 ] 105978 105979 [ 105980 [[link boost_asio.reference.posix__basic_descriptor.wait [*wait]]] 105981 [Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ] 105982 ] 105983 105984] 105985 105986[heading Protected Member Functions] 105987[table 105988 [[Name][Description]] 105989 105990 [ 105991 [[link boost_asio.reference.posix__basic_descriptor._basic_descriptor [*~basic_descriptor]] [destructor]] 105992 [Protected destructor to prevent deletion through this type. ] 105993 ] 105994 105995] 105996 105997The [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] class template provides the ability to wrap a POSIX descriptor. 105998 105999 106000[heading Thread Safety] 106001 106002['Distinct] ['objects:] Safe. 106003 106004['Shared] ['objects:] Unsafe. 106005 106006 106007 106008[heading Requirements] 106009 106010['Header: ][^boost/asio/posix/basic_descriptor.hpp] 106011 106012['Convenience header: ][^boost/asio.hpp] 106013 106014[section:assign posix::basic_descriptor::assign] 106015 106016[indexterm2 boost_asio.indexterm.posix__basic_descriptor.assign..assign..posix::basic_descriptor] 106017Assign an existing native descriptor to the descriptor. 106018 106019 106020 void ``[link boost_asio.reference.posix__basic_descriptor.assign.overload1 assign]``( 106021 const native_handle_type & native_descriptor); 106022 `` [''''»''' [link boost_asio.reference.posix__basic_descriptor.assign.overload1 more...]]`` 106023 106024 void ``[link boost_asio.reference.posix__basic_descriptor.assign.overload2 assign]``( 106025 const native_handle_type & native_descriptor, 106026 boost::system::error_code & ec); 106027 `` [''''»''' [link boost_asio.reference.posix__basic_descriptor.assign.overload2 more...]]`` 106028 106029 106030[section:overload1 posix::basic_descriptor::assign (1 of 2 overloads)] 106031 106032 106033Assign an existing native descriptor to the descriptor. 106034 106035 106036 void assign( 106037 const native_handle_type & native_descriptor); 106038 106039 106040 106041[endsect] 106042 106043 106044 106045[section:overload2 posix::basic_descriptor::assign (2 of 2 overloads)] 106046 106047 106048Assign an existing native descriptor to the descriptor. 106049 106050 106051 void assign( 106052 const native_handle_type & native_descriptor, 106053 boost::system::error_code & ec); 106054 106055 106056 106057[endsect] 106058 106059 106060[endsect] 106061 106062 106063[section:async_wait posix::basic_descriptor::async_wait] 106064 106065[indexterm2 boost_asio.indexterm.posix__basic_descriptor.async_wait..async_wait..posix::basic_descriptor] 106066Asynchronously wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. 106067 106068 106069 template< 106070 typename ``[link boost_asio.reference.WaitHandler WaitHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 106071 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait( 106072 wait_type w, 106073 WaitHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 106074 106075 106076This function is used to perform an asynchronous wait for a descriptor to enter a ready to read, write or error condition state. 106077 106078 106079[heading Parameters] 106080 106081 106082[variablelist 106083 106084[[w][Specifies the desired descriptor state.]] 106085 106086[[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: 106087`` 106088 void handler( 106089 const boost::system::error_code& error // Result of operation 106090 ); 106091`` 106092Regardless 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`].]] 106093 106094] 106095 106096 106097[heading Example] 106098 106099 106100 106101 void wait_handler(const boost::system::error_code& error) 106102 { 106103 if (!error) 106104 { 106105 // Wait succeeded. 106106 } 106107 } 106108 106109 ... 106110 106111 boost::asio::posix::stream_descriptor descriptor(my_context); 106112 ... 106113 descriptor.async_wait( 106114 boost::asio::posix::stream_descriptor::wait_read, 106115 wait_handler); 106116 106117 106118 106119 106120 106121 106122 106123[endsect] 106124 106125 106126[section:basic_descriptor posix::basic_descriptor::basic_descriptor] 106127 106128[indexterm2 boost_asio.indexterm.posix__basic_descriptor.basic_descriptor..basic_descriptor..posix::basic_descriptor] 106129Construct a descriptor without opening it. 106130 106131 106132 explicit ``[link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload1 basic_descriptor]``( 106133 const executor_type & ex); 106134 `` [''''»''' [link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload1 more...]]`` 106135 106136 template< 106137 typename ExecutionContext> 106138 explicit ``[link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload2 basic_descriptor]``( 106139 ExecutionContext & context, 106140 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value, defaulted_constraint >::type = defaulted_constraint()); 106141 `` [''''»''' [link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload2 more...]]`` 106142 106143 106144Construct a descriptor on an existing native descriptor. 106145 106146 106147 ``[link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload3 basic_descriptor]``( 106148 const executor_type & ex, 106149 const native_handle_type & native_descriptor); 106150 `` [''''»''' [link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload3 more...]]`` 106151 106152 template< 106153 typename ExecutionContext> 106154 ``[link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload4 basic_descriptor]``( 106155 ExecutionContext & context, 106156 const native_handle_type & native_descriptor, 106157 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 106158 `` [''''»''' [link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload4 more...]]`` 106159 106160 106161Move-construct a descriptor from another. 106162 106163 106164 ``[link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload5 basic_descriptor]``( 106165 basic_descriptor && other); 106166 `` [''''»''' [link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload5 more...]]`` 106167 106168 106169[section:overload1 posix::basic_descriptor::basic_descriptor (1 of 5 overloads)] 106170 106171 106172Construct a descriptor without opening it. 106173 106174 106175 basic_descriptor( 106176 const executor_type & ex); 106177 106178 106179This constructor creates a descriptor without opening it. 106180 106181 106182[heading Parameters] 106183 106184 106185[variablelist 106186 106187[[ex][The I/O executor that the descriptor will use, by default, to dispatch handlers for any asynchronous operations performed on the descriptor. ]] 106188 106189] 106190 106191 106192 106193 106194[endsect] 106195 106196 106197 106198[section:overload2 posix::basic_descriptor::basic_descriptor (2 of 5 overloads)] 106199 106200 106201Construct a descriptor without opening it. 106202 106203 106204 template< 106205 typename ExecutionContext> 106206 basic_descriptor( 106207 ExecutionContext & context, 106208 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value, defaulted_constraint >::type = defaulted_constraint()); 106209 106210 106211This constructor creates a descriptor without opening it. 106212 106213 106214[heading Parameters] 106215 106216 106217[variablelist 106218 106219[[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. ]] 106220 106221] 106222 106223 106224 106225 106226[endsect] 106227 106228 106229 106230[section:overload3 posix::basic_descriptor::basic_descriptor (3 of 5 overloads)] 106231 106232 106233Construct a descriptor on an existing native descriptor. 106234 106235 106236 basic_descriptor( 106237 const executor_type & ex, 106238 const native_handle_type & native_descriptor); 106239 106240 106241This constructor creates a descriptor object to hold an existing native descriptor. 106242 106243 106244[heading Parameters] 106245 106246 106247[variablelist 106248 106249[[ex][The I/O executor that the descriptor will use, by default, to dispatch handlers for any asynchronous operations performed on the descriptor.]] 106250 106251[[native_descriptor][A native descriptor.]] 106252 106253] 106254 106255 106256[heading Exceptions] 106257 106258 106259[variablelist 106260 106261[[boost::system::system_error][Thrown on failure. ]] 106262 106263] 106264 106265 106266 106267 106268[endsect] 106269 106270 106271 106272[section:overload4 posix::basic_descriptor::basic_descriptor (4 of 5 overloads)] 106273 106274 106275Construct a descriptor on an existing native descriptor. 106276 106277 106278 template< 106279 typename ExecutionContext> 106280 basic_descriptor( 106281 ExecutionContext & context, 106282 const native_handle_type & native_descriptor, 106283 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 106284 106285 106286This constructor creates a descriptor object to hold an existing native descriptor. 106287 106288 106289[heading Parameters] 106290 106291 106292[variablelist 106293 106294[[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.]] 106295 106296[[native_descriptor][A native descriptor.]] 106297 106298] 106299 106300 106301[heading Exceptions] 106302 106303 106304[variablelist 106305 106306[[boost::system::system_error][Thrown on failure. ]] 106307 106308] 106309 106310 106311 106312 106313[endsect] 106314 106315 106316 106317[section:overload5 posix::basic_descriptor::basic_descriptor (5 of 5 overloads)] 106318 106319 106320Move-construct a descriptor from another. 106321 106322 106323 basic_descriptor( 106324 basic_descriptor && other); 106325 106326 106327This constructor moves a descriptor from one object to another. 106328 106329 106330[heading Parameters] 106331 106332 106333[variablelist 106334 106335[[other][The other descriptor object from which the move will occur.]] 106336 106337] 106338 106339 106340[heading Remarks] 106341 106342Following the move, the moved-from object is in the same state as if constructed using the `basic_descriptor(const executor_type&)` constructor. 106343 106344 106345 106346 106347[endsect] 106348 106349 106350[endsect] 106351 106352 106353[section:bytes_readable posix::basic_descriptor::bytes_readable] 106354 106355 106356['Inherited from posix::descriptor_base.] 106357 106358[indexterm2 boost_asio.indexterm.posix__basic_descriptor.bytes_readable..bytes_readable..posix::basic_descriptor] 106359IO control command to get the amount of data that can be read without blocking. 106360 106361 106362 typedef implementation_defined bytes_readable; 106363 106364 106365 106366Implements the FIONREAD IO control command. 106367 106368 106369[heading Example] 106370 106371 106372 106373 boost::asio::posix::stream_descriptor descriptor(my_context); 106374 ... 106375 boost::asio::descriptor_base::bytes_readable command(true); 106376 descriptor.io_control(command); 106377 std::size_t bytes_readable = command.get(); 106378 106379 106380 106381 106382 106383 106384 106385[heading Requirements] 106386 106387['Header: ][^boost/asio/posix/basic_descriptor.hpp] 106388 106389['Convenience header: ][^boost/asio.hpp] 106390 106391 106392[endsect] 106393 106394 106395[section:cancel posix::basic_descriptor::cancel] 106396 106397[indexterm2 boost_asio.indexterm.posix__basic_descriptor.cancel..cancel..posix::basic_descriptor] 106398Cancel all asynchronous operations associated with the descriptor. 106399 106400 106401 void ``[link boost_asio.reference.posix__basic_descriptor.cancel.overload1 cancel]``(); 106402 `` [''''»''' [link boost_asio.reference.posix__basic_descriptor.cancel.overload1 more...]]`` 106403 106404 void ``[link boost_asio.reference.posix__basic_descriptor.cancel.overload2 cancel]``( 106405 boost::system::error_code & ec); 106406 `` [''''»''' [link boost_asio.reference.posix__basic_descriptor.cancel.overload2 more...]]`` 106407 106408 106409[section:overload1 posix::basic_descriptor::cancel (1 of 2 overloads)] 106410 106411 106412Cancel all asynchronous operations associated with the descriptor. 106413 106414 106415 void cancel(); 106416 106417 106418This 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. 106419 106420 106421[heading Exceptions] 106422 106423 106424[variablelist 106425 106426[[boost::system::system_error][Thrown on failure. ]] 106427 106428] 106429 106430 106431 106432 106433[endsect] 106434 106435 106436 106437[section:overload2 posix::basic_descriptor::cancel (2 of 2 overloads)] 106438 106439 106440Cancel all asynchronous operations associated with the descriptor. 106441 106442 106443 void cancel( 106444 boost::system::error_code & ec); 106445 106446 106447This 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. 106448 106449 106450[heading Parameters] 106451 106452 106453[variablelist 106454 106455[[ec][Set to indicate what error occurred, if any. ]] 106456 106457] 106458 106459 106460 106461 106462[endsect] 106463 106464 106465[endsect] 106466 106467[section:close posix::basic_descriptor::close] 106468 106469[indexterm2 boost_asio.indexterm.posix__basic_descriptor.close..close..posix::basic_descriptor] 106470Close the descriptor. 106471 106472 106473 void ``[link boost_asio.reference.posix__basic_descriptor.close.overload1 close]``(); 106474 `` [''''»''' [link boost_asio.reference.posix__basic_descriptor.close.overload1 more...]]`` 106475 106476 void ``[link boost_asio.reference.posix__basic_descriptor.close.overload2 close]``( 106477 boost::system::error_code & ec); 106478 `` [''''»''' [link boost_asio.reference.posix__basic_descriptor.close.overload2 more...]]`` 106479 106480 106481[section:overload1 posix::basic_descriptor::close (1 of 2 overloads)] 106482 106483 106484Close the descriptor. 106485 106486 106487 void close(); 106488 106489 106490This 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. 106491 106492 106493[heading Exceptions] 106494 106495 106496[variablelist 106497 106498[[boost::system::system_error][Thrown on failure. Note that, even if the function indicates an error, the underlying descriptor is closed. ]] 106499 106500] 106501 106502 106503 106504 106505[endsect] 106506 106507 106508 106509[section:overload2 posix::basic_descriptor::close (2 of 2 overloads)] 106510 106511 106512Close the descriptor. 106513 106514 106515 void close( 106516 boost::system::error_code & ec); 106517 106518 106519This 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. 106520 106521 106522[heading Parameters] 106523 106524 106525[variablelist 106526 106527[[ec][Set to indicate what error occurred, if any. Note that, even if the function indicates an error, the underlying descriptor is closed. ]] 106528 106529] 106530 106531 106532 106533 106534[endsect] 106535 106536 106537[endsect] 106538 106539 106540[section:executor_type posix::basic_descriptor::executor_type] 106541 106542[indexterm2 boost_asio.indexterm.posix__basic_descriptor.executor_type..executor_type..posix::basic_descriptor] 106543The type of the executor associated with the object. 106544 106545 106546 typedef Executor executor_type; 106547 106548 106549 106550[heading Requirements] 106551 106552['Header: ][^boost/asio/posix/basic_descriptor.hpp] 106553 106554['Convenience header: ][^boost/asio.hpp] 106555 106556 106557[endsect] 106558 106559 106560 106561[section:get_executor posix::basic_descriptor::get_executor] 106562 106563[indexterm2 boost_asio.indexterm.posix__basic_descriptor.get_executor..get_executor..posix::basic_descriptor] 106564Get the executor associated with the object. 106565 106566 106567 executor_type get_executor(); 106568 106569 106570 106571[endsect] 106572 106573 106574[section:io_control posix::basic_descriptor::io_control] 106575 106576[indexterm2 boost_asio.indexterm.posix__basic_descriptor.io_control..io_control..posix::basic_descriptor] 106577Perform an IO control command on the descriptor. 106578 106579 106580 template< 106581 typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> 106582 void ``[link boost_asio.reference.posix__basic_descriptor.io_control.overload1 io_control]``( 106583 IoControlCommand & command); 106584 `` [''''»''' [link boost_asio.reference.posix__basic_descriptor.io_control.overload1 more...]]`` 106585 106586 template< 106587 typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> 106588 void ``[link boost_asio.reference.posix__basic_descriptor.io_control.overload2 io_control]``( 106589 IoControlCommand & command, 106590 boost::system::error_code & ec); 106591 `` [''''»''' [link boost_asio.reference.posix__basic_descriptor.io_control.overload2 more...]]`` 106592 106593 106594[section:overload1 posix::basic_descriptor::io_control (1 of 2 overloads)] 106595 106596 106597Perform an IO control command on the descriptor. 106598 106599 106600 template< 106601 typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> 106602 void io_control( 106603 IoControlCommand & command); 106604 106605 106606This function is used to execute an IO control command on the descriptor. 106607 106608 106609[heading Parameters] 106610 106611 106612[variablelist 106613 106614[[command][The IO control command to be performed on the descriptor.]] 106615 106616] 106617 106618 106619[heading Exceptions] 106620 106621 106622[variablelist 106623 106624[[boost::system::system_error][Thrown on failure.]] 106625 106626] 106627 106628 106629 106630[heading Example] 106631 106632Getting the number of bytes ready to read: 106633 106634 boost::asio::posix::stream_descriptor descriptor(my_context); 106635 ... 106636 boost::asio::posix::stream_descriptor::bytes_readable command; 106637 descriptor.io_control(command); 106638 std::size_t bytes_readable = command.get(); 106639 106640 106641 106642 106643 106644 106645 106646[endsect] 106647 106648 106649 106650[section:overload2 posix::basic_descriptor::io_control (2 of 2 overloads)] 106651 106652 106653Perform an IO control command on the descriptor. 106654 106655 106656 template< 106657 typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> 106658 void io_control( 106659 IoControlCommand & command, 106660 boost::system::error_code & ec); 106661 106662 106663This function is used to execute an IO control command on the descriptor. 106664 106665 106666[heading Parameters] 106667 106668 106669[variablelist 106670 106671[[command][The IO control command to be performed on the descriptor.]] 106672 106673[[ec][Set to indicate what error occurred, if any.]] 106674 106675] 106676 106677 106678 106679[heading Example] 106680 106681Getting the number of bytes ready to read: 106682 106683 boost::asio::posix::stream_descriptor descriptor(my_context); 106684 ... 106685 boost::asio::posix::stream_descriptor::bytes_readable command; 106686 boost::system::error_code ec; 106687 descriptor.io_control(command, ec); 106688 if (ec) 106689 { 106690 // An error occurred. 106691 } 106692 std::size_t bytes_readable = command.get(); 106693 106694 106695 106696 106697 106698 106699 106700[endsect] 106701 106702 106703[endsect] 106704 106705 106706[section:is_open posix::basic_descriptor::is_open] 106707 106708[indexterm2 boost_asio.indexterm.posix__basic_descriptor.is_open..is_open..posix::basic_descriptor] 106709Determine whether the descriptor is open. 106710 106711 106712 bool is_open() const; 106713 106714 106715 106716[endsect] 106717 106718 106719[section:lowest_layer posix::basic_descriptor::lowest_layer] 106720 106721[indexterm2 boost_asio.indexterm.posix__basic_descriptor.lowest_layer..lowest_layer..posix::basic_descriptor] 106722Get a reference to the lowest layer. 106723 106724 106725 lowest_layer_type & ``[link boost_asio.reference.posix__basic_descriptor.lowest_layer.overload1 lowest_layer]``(); 106726 `` [''''»''' [link boost_asio.reference.posix__basic_descriptor.lowest_layer.overload1 more...]]`` 106727 106728 106729Get a const reference to the lowest layer. 106730 106731 106732 const lowest_layer_type & ``[link boost_asio.reference.posix__basic_descriptor.lowest_layer.overload2 lowest_layer]``() const; 106733 `` [''''»''' [link boost_asio.reference.posix__basic_descriptor.lowest_layer.overload2 more...]]`` 106734 106735 106736[section:overload1 posix::basic_descriptor::lowest_layer (1 of 2 overloads)] 106737 106738 106739Get a reference to the lowest layer. 106740 106741 106742 lowest_layer_type & lowest_layer(); 106743 106744 106745This 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. 106746 106747 106748[heading Return Value] 106749 106750A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 106751 106752 106753 106754 106755[endsect] 106756 106757 106758 106759[section:overload2 posix::basic_descriptor::lowest_layer (2 of 2 overloads)] 106760 106761 106762Get a const reference to the lowest layer. 106763 106764 106765 const lowest_layer_type & lowest_layer() const; 106766 106767 106768This 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. 106769 106770 106771[heading Return Value] 106772 106773A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 106774 106775 106776 106777 106778[endsect] 106779 106780 106781[endsect] 106782 106783 106784[section:lowest_layer_type posix::basic_descriptor::lowest_layer_type] 106785 106786[indexterm2 boost_asio.indexterm.posix__basic_descriptor.lowest_layer_type..lowest_layer_type..posix::basic_descriptor] 106787A descriptor is always the lowest layer. 106788 106789 106790 typedef basic_descriptor lowest_layer_type; 106791 106792 106793[heading Types] 106794[table 106795 [[Name][Description]] 106796 106797 [ 106798 106799 [[link boost_asio.reference.posix__basic_descriptor__rebind_executor [*rebind_executor]]] 106800 [Rebinds the descriptor type to another executor. ] 106801 106802 ] 106803 106804 [ 106805 106806 [[link boost_asio.reference.posix__basic_descriptor.bytes_readable [*bytes_readable]]] 106807 [IO control command to get the amount of data that can be read without blocking. ] 106808 106809 ] 106810 106811 [ 106812 106813 [[link boost_asio.reference.posix__basic_descriptor.executor_type [*executor_type]]] 106814 [The type of the executor associated with the object. ] 106815 106816 ] 106817 106818 [ 106819 106820 [[link boost_asio.reference.posix__basic_descriptor.lowest_layer_type [*lowest_layer_type]]] 106821 [A descriptor is always the lowest layer. ] 106822 106823 ] 106824 106825 [ 106826 106827 [[link boost_asio.reference.posix__basic_descriptor.native_handle_type [*native_handle_type]]] 106828 [The native representation of a descriptor. ] 106829 106830 ] 106831 106832 [ 106833 106834 [[link boost_asio.reference.posix__basic_descriptor.wait_type [*wait_type]]] 106835 [Wait types. ] 106836 106837 ] 106838 106839] 106840 106841[heading Member Functions] 106842[table 106843 [[Name][Description]] 106844 106845 [ 106846 [[link boost_asio.reference.posix__basic_descriptor.assign [*assign]]] 106847 [Assign an existing native descriptor to the descriptor. ] 106848 ] 106849 106850 [ 106851 [[link boost_asio.reference.posix__basic_descriptor.async_wait [*async_wait]]] 106852 [Asynchronously wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ] 106853 ] 106854 106855 [ 106856 [[link boost_asio.reference.posix__basic_descriptor.basic_descriptor [*basic_descriptor]] [constructor]] 106857 [Construct a descriptor without opening it. 106858 [hr] 106859 Construct a descriptor on an existing native descriptor. 106860 [hr] 106861 Move-construct a descriptor from another. ] 106862 ] 106863 106864 [ 106865 [[link boost_asio.reference.posix__basic_descriptor.cancel [*cancel]]] 106866 [Cancel all asynchronous operations associated with the descriptor. ] 106867 ] 106868 106869 [ 106870 [[link boost_asio.reference.posix__basic_descriptor.close [*close]]] 106871 [Close the descriptor. ] 106872 ] 106873 106874 [ 106875 [[link boost_asio.reference.posix__basic_descriptor.get_executor [*get_executor]]] 106876 [Get the executor associated with the object. ] 106877 ] 106878 106879 [ 106880 [[link boost_asio.reference.posix__basic_descriptor.io_control [*io_control]]] 106881 [Perform an IO control command on the descriptor. ] 106882 ] 106883 106884 [ 106885 [[link boost_asio.reference.posix__basic_descriptor.is_open [*is_open]]] 106886 [Determine whether the descriptor is open. ] 106887 ] 106888 106889 [ 106890 [[link boost_asio.reference.posix__basic_descriptor.lowest_layer [*lowest_layer]]] 106891 [Get a reference to the lowest layer. 106892 [hr] 106893 Get a const reference to the lowest layer. ] 106894 ] 106895 106896 [ 106897 [[link boost_asio.reference.posix__basic_descriptor.native_handle [*native_handle]]] 106898 [Get the native descriptor representation. ] 106899 ] 106900 106901 [ 106902 [[link boost_asio.reference.posix__basic_descriptor.native_non_blocking [*native_non_blocking]]] 106903 [Gets the non-blocking mode of the native descriptor implementation. 106904 [hr] 106905 Sets the non-blocking mode of the native descriptor implementation. ] 106906 ] 106907 106908 [ 106909 [[link boost_asio.reference.posix__basic_descriptor.non_blocking [*non_blocking]]] 106910 [Gets the non-blocking mode of the descriptor. 106911 [hr] 106912 Sets the non-blocking mode of the descriptor. ] 106913 ] 106914 106915 [ 106916 [[link boost_asio.reference.posix__basic_descriptor.operator_eq_ [*operator=]]] 106917 [Move-assign a descriptor from another. ] 106918 ] 106919 106920 [ 106921 [[link boost_asio.reference.posix__basic_descriptor.release [*release]]] 106922 [Release ownership of the native descriptor implementation. ] 106923 ] 106924 106925 [ 106926 [[link boost_asio.reference.posix__basic_descriptor.wait [*wait]]] 106927 [Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ] 106928 ] 106929 106930] 106931 106932[heading Protected Member Functions] 106933[table 106934 [[Name][Description]] 106935 106936 [ 106937 [[link boost_asio.reference.posix__basic_descriptor._basic_descriptor [*~basic_descriptor]] [destructor]] 106938 [Protected destructor to prevent deletion through this type. ] 106939 ] 106940 106941] 106942 106943The [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] class template provides the ability to wrap a POSIX descriptor. 106944 106945 106946[heading Thread Safety] 106947 106948['Distinct] ['objects:] Safe. 106949 106950['Shared] ['objects:] Unsafe. 106951 106952 106953 106954 106955[heading Requirements] 106956 106957['Header: ][^boost/asio/posix/basic_descriptor.hpp] 106958 106959['Convenience header: ][^boost/asio.hpp] 106960 106961 106962[endsect] 106963 106964 106965 106966[section:native_handle posix::basic_descriptor::native_handle] 106967 106968[indexterm2 boost_asio.indexterm.posix__basic_descriptor.native_handle..native_handle..posix::basic_descriptor] 106969Get the native descriptor representation. 106970 106971 106972 native_handle_type native_handle(); 106973 106974 106975This 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. 106976 106977 106978[endsect] 106979 106980 106981 106982[section:native_handle_type posix::basic_descriptor::native_handle_type] 106983 106984[indexterm2 boost_asio.indexterm.posix__basic_descriptor.native_handle_type..native_handle_type..posix::basic_descriptor] 106985The native representation of a descriptor. 106986 106987 106988 typedef implementation_defined native_handle_type; 106989 106990 106991 106992[heading Requirements] 106993 106994['Header: ][^boost/asio/posix/basic_descriptor.hpp] 106995 106996['Convenience header: ][^boost/asio.hpp] 106997 106998 106999[endsect] 107000 107001 107002[section:native_non_blocking posix::basic_descriptor::native_non_blocking] 107003 107004[indexterm2 boost_asio.indexterm.posix__basic_descriptor.native_non_blocking..native_non_blocking..posix::basic_descriptor] 107005Gets the non-blocking mode of the native descriptor implementation. 107006 107007 107008 bool ``[link boost_asio.reference.posix__basic_descriptor.native_non_blocking.overload1 native_non_blocking]``() const; 107009 `` [''''»''' [link boost_asio.reference.posix__basic_descriptor.native_non_blocking.overload1 more...]]`` 107010 107011 107012Sets the non-blocking mode of the native descriptor implementation. 107013 107014 107015 void ``[link boost_asio.reference.posix__basic_descriptor.native_non_blocking.overload2 native_non_blocking]``( 107016 bool mode); 107017 `` [''''»''' [link boost_asio.reference.posix__basic_descriptor.native_non_blocking.overload2 more...]]`` 107018 107019 void ``[link boost_asio.reference.posix__basic_descriptor.native_non_blocking.overload3 native_non_blocking]``( 107020 bool mode, 107021 boost::system::error_code & ec); 107022 `` [''''»''' [link boost_asio.reference.posix__basic_descriptor.native_non_blocking.overload3 more...]]`` 107023 107024 107025[section:overload1 posix::basic_descriptor::native_non_blocking (1 of 3 overloads)] 107026 107027 107028Gets the non-blocking mode of the native descriptor implementation. 107029 107030 107031 bool native_non_blocking() const; 107032 107033 107034This 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. 107035 107036 107037[heading Return Value] 107038 107039`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). 107040 107041 107042[heading Remarks] 107043 107044The 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. 107045 107046 107047 107048 107049[endsect] 107050 107051 107052 107053[section:overload2 posix::basic_descriptor::native_non_blocking (2 of 3 overloads)] 107054 107055 107056Sets the non-blocking mode of the native descriptor implementation. 107057 107058 107059 void native_non_blocking( 107060 bool mode); 107061 107062 107063This 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. 107064 107065 107066[heading Parameters] 107067 107068 107069[variablelist 107070 107071[[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).]] 107072 107073] 107074 107075 107076[heading Exceptions] 107077 107078 107079[variablelist 107080 107081[[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. ]] 107082 107083] 107084 107085 107086 107087 107088[endsect] 107089 107090 107091 107092[section:overload3 posix::basic_descriptor::native_non_blocking (3 of 3 overloads)] 107093 107094 107095Sets the non-blocking mode of the native descriptor implementation. 107096 107097 107098 void native_non_blocking( 107099 bool mode, 107100 boost::system::error_code & ec); 107101 107102 107103This 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. 107104 107105 107106[heading Parameters] 107107 107108 107109[variablelist 107110 107111[[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).]] 107112 107113[[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. ]] 107114 107115] 107116 107117 107118 107119 107120[endsect] 107121 107122 107123[endsect] 107124 107125[section:non_blocking posix::basic_descriptor::non_blocking] 107126 107127[indexterm2 boost_asio.indexterm.posix__basic_descriptor.non_blocking..non_blocking..posix::basic_descriptor] 107128Gets the non-blocking mode of the descriptor. 107129 107130 107131 bool ``[link boost_asio.reference.posix__basic_descriptor.non_blocking.overload1 non_blocking]``() const; 107132 `` [''''»''' [link boost_asio.reference.posix__basic_descriptor.non_blocking.overload1 more...]]`` 107133 107134 107135Sets the non-blocking mode of the descriptor. 107136 107137 107138 void ``[link boost_asio.reference.posix__basic_descriptor.non_blocking.overload2 non_blocking]``( 107139 bool mode); 107140 `` [''''»''' [link boost_asio.reference.posix__basic_descriptor.non_blocking.overload2 more...]]`` 107141 107142 void ``[link boost_asio.reference.posix__basic_descriptor.non_blocking.overload3 non_blocking]``( 107143 bool mode, 107144 boost::system::error_code & ec); 107145 `` [''''»''' [link boost_asio.reference.posix__basic_descriptor.non_blocking.overload3 more...]]`` 107146 107147 107148[section:overload1 posix::basic_descriptor::non_blocking (1 of 3 overloads)] 107149 107150 107151Gets the non-blocking mode of the descriptor. 107152 107153 107154 bool non_blocking() const; 107155 107156 107157 107158[heading Return Value] 107159 107160`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. 107161 107162 107163[heading Remarks] 107164 107165The 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`. 107166 107167 107168 107169 107170[endsect] 107171 107172 107173 107174[section:overload2 posix::basic_descriptor::non_blocking (2 of 3 overloads)] 107175 107176 107177Sets the non-blocking mode of the descriptor. 107178 107179 107180 void non_blocking( 107181 bool mode); 107182 107183 107184 107185[heading Parameters] 107186 107187 107188[variablelist 107189 107190[[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.]] 107191 107192] 107193 107194 107195[heading Exceptions] 107196 107197 107198[variablelist 107199 107200[[boost::system::system_error][Thrown on failure.]] 107201 107202] 107203 107204 107205[heading Remarks] 107206 107207The 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`. 107208 107209 107210 107211 107212[endsect] 107213 107214 107215 107216[section:overload3 posix::basic_descriptor::non_blocking (3 of 3 overloads)] 107217 107218 107219Sets the non-blocking mode of the descriptor. 107220 107221 107222 void non_blocking( 107223 bool mode, 107224 boost::system::error_code & ec); 107225 107226 107227 107228[heading Parameters] 107229 107230 107231[variablelist 107232 107233[[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.]] 107234 107235[[ec][Set to indicate what error occurred, if any.]] 107236 107237] 107238 107239 107240[heading Remarks] 107241 107242The 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`. 107243 107244 107245 107246 107247[endsect] 107248 107249 107250[endsect] 107251 107252 107253[section:operator_eq_ posix::basic_descriptor::operator=] 107254 107255[indexterm2 boost_asio.indexterm.posix__basic_descriptor.operator_eq_..operator=..posix::basic_descriptor] 107256Move-assign a descriptor from another. 107257 107258 107259 basic_descriptor & operator=( 107260 basic_descriptor && other); 107261 107262 107263This assignment operator moves a descriptor from one object to another. 107264 107265 107266[heading Parameters] 107267 107268 107269[variablelist 107270 107271[[other][The other descriptor object from which the move will occur.]] 107272 107273] 107274 107275 107276[heading Remarks] 107277 107278Following the move, the moved-from object is in the same state as if constructed using the `basic_descriptor(const executor_type&)` constructor. 107279 107280 107281 107282 107283[endsect] 107284 107285 107286 107287[section:release posix::basic_descriptor::release] 107288 107289[indexterm2 boost_asio.indexterm.posix__basic_descriptor.release..release..posix::basic_descriptor] 107290Release ownership of the native descriptor implementation. 107291 107292 107293 native_handle_type release(); 107294 107295 107296This 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. 107297 107298All 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. 107299 107300 107301[endsect] 107302 107303 107304[section:wait posix::basic_descriptor::wait] 107305 107306[indexterm2 boost_asio.indexterm.posix__basic_descriptor.wait..wait..posix::basic_descriptor] 107307Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. 107308 107309 107310 void ``[link boost_asio.reference.posix__basic_descriptor.wait.overload1 wait]``( 107311 wait_type w); 107312 `` [''''»''' [link boost_asio.reference.posix__basic_descriptor.wait.overload1 more...]]`` 107313 107314 void ``[link boost_asio.reference.posix__basic_descriptor.wait.overload2 wait]``( 107315 wait_type w, 107316 boost::system::error_code & ec); 107317 `` [''''»''' [link boost_asio.reference.posix__basic_descriptor.wait.overload2 more...]]`` 107318 107319 107320[section:overload1 posix::basic_descriptor::wait (1 of 2 overloads)] 107321 107322 107323Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. 107324 107325 107326 void wait( 107327 wait_type w); 107328 107329 107330This function is used to perform a blocking wait for a descriptor to enter a ready to read, write or error condition state. 107331 107332 107333[heading Parameters] 107334 107335 107336[variablelist 107337 107338[[w][Specifies the desired descriptor state.]] 107339 107340] 107341 107342 107343[heading Example] 107344 107345Waiting for a descriptor to become readable. 107346 107347 boost::asio::posix::stream_descriptor descriptor(my_context); 107348 ... 107349 descriptor.wait(boost::asio::posix::stream_descriptor::wait_read); 107350 107351 107352 107353 107354 107355 107356 107357[endsect] 107358 107359 107360 107361[section:overload2 posix::basic_descriptor::wait (2 of 2 overloads)] 107362 107363 107364Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. 107365 107366 107367 void wait( 107368 wait_type w, 107369 boost::system::error_code & ec); 107370 107371 107372This function is used to perform a blocking wait for a descriptor to enter a ready to read, write or error condition state. 107373 107374 107375[heading Parameters] 107376 107377 107378[variablelist 107379 107380[[w][Specifies the desired descriptor state.]] 107381 107382[[ec][Set to indicate what error occurred, if any.]] 107383 107384] 107385 107386 107387[heading Example] 107388 107389Waiting for a descriptor to become readable. 107390 107391 boost::asio::posix::stream_descriptor descriptor(my_context); 107392 ... 107393 boost::system::error_code ec; 107394 descriptor.wait(boost::asio::posix::stream_descriptor::wait_read, ec); 107395 107396 107397 107398 107399 107400 107401 107402[endsect] 107403 107404 107405[endsect] 107406 107407 107408[section:wait_type posix::basic_descriptor::wait_type] 107409 107410 107411['Inherited from posix::descriptor_base.] 107412 107413[indexterm2 boost_asio.indexterm.posix__basic_descriptor.wait_type..wait_type..posix::basic_descriptor] 107414Wait types. 107415 107416 107417 enum wait_type 107418 107419[indexterm2 boost_asio.indexterm.posix__basic_descriptor.wait_type.wait_read..wait_read..posix::basic_descriptor] 107420[indexterm2 boost_asio.indexterm.posix__basic_descriptor.wait_type.wait_write..wait_write..posix::basic_descriptor] 107421[indexterm2 boost_asio.indexterm.posix__basic_descriptor.wait_type.wait_error..wait_error..posix::basic_descriptor] 107422 107423[heading Values] 107424[variablelist 107425 107426 [ 107427 [wait_read] 107428 [Wait for a descriptor to become ready to read. ] 107429 ] 107430 107431 [ 107432 [wait_write] 107433 [Wait for a descriptor to become ready to write. ] 107434 ] 107435 107436 [ 107437 [wait_error] 107438 [Wait for a descriptor to have error conditions pending. ] 107439 ] 107440 107441] 107442 107443 107444For use with `descriptor::wait()` and `descriptor::async_wait()`. 107445 107446 107447[endsect] 107448 107449 107450 107451[section:_basic_descriptor posix::basic_descriptor::~basic_descriptor] 107452 107453[indexterm2 boost_asio.indexterm.posix__basic_descriptor._basic_descriptor..~basic_descriptor..posix::basic_descriptor] 107454Protected destructor to prevent deletion through this type. 107455 107456 107457 ~basic_descriptor(); 107458 107459 107460This function destroys the descriptor, cancelling any outstanding asynchronous wait operations associated with the descriptor as if by calling `cancel`. 107461 107462 107463[endsect] 107464 107465 107466 107467[endsect] 107468 107469[section:posix__basic_descriptor__rebind_executor posix::basic_descriptor::rebind_executor] 107470 107471[indexterm1 boost_asio.indexterm.posix__basic_descriptor__rebind_executor..posix::basic_descriptor::rebind_executor] 107472 107473 107474Rebinds the descriptor type to another executor. 107475 107476 107477 template< 107478 typename ``[link boost_asio.reference.Executor1 Executor1]``> 107479 struct rebind_executor 107480 107481 107482[heading Types] 107483[table 107484 [[Name][Description]] 107485 107486 [ 107487 107488 [[link boost_asio.reference.posix__basic_descriptor__rebind_executor.other [*other]]] 107489 [The descriptor type when rebound to the specified executor. ] 107490 107491 ] 107492 107493] 107494 107495[heading Requirements] 107496 107497['Header: ][^boost/asio/posix/basic_descriptor.hpp] 107498 107499['Convenience header: ][^boost/asio.hpp] 107500 107501 107502[section:other posix::basic_descriptor::rebind_executor::other] 107503 107504[indexterm2 boost_asio.indexterm.posix__basic_descriptor__rebind_executor.other..other..posix::basic_descriptor::rebind_executor] 107505The descriptor type when rebound to the specified executor. 107506 107507 107508 typedef basic_descriptor< Executor1 > other; 107509 107510 107511[heading Types] 107512[table 107513 [[Name][Description]] 107514 107515 [ 107516 107517 [[link boost_asio.reference.posix__basic_descriptor__rebind_executor [*rebind_executor]]] 107518 [Rebinds the descriptor type to another executor. ] 107519 107520 ] 107521 107522 [ 107523 107524 [[link boost_asio.reference.posix__basic_descriptor.bytes_readable [*bytes_readable]]] 107525 [IO control command to get the amount of data that can be read without blocking. ] 107526 107527 ] 107528 107529 [ 107530 107531 [[link boost_asio.reference.posix__basic_descriptor.executor_type [*executor_type]]] 107532 [The type of the executor associated with the object. ] 107533 107534 ] 107535 107536 [ 107537 107538 [[link boost_asio.reference.posix__basic_descriptor.lowest_layer_type [*lowest_layer_type]]] 107539 [A descriptor is always the lowest layer. ] 107540 107541 ] 107542 107543 [ 107544 107545 [[link boost_asio.reference.posix__basic_descriptor.native_handle_type [*native_handle_type]]] 107546 [The native representation of a descriptor. ] 107547 107548 ] 107549 107550 [ 107551 107552 [[link boost_asio.reference.posix__basic_descriptor.wait_type [*wait_type]]] 107553 [Wait types. ] 107554 107555 ] 107556 107557] 107558 107559[heading Member Functions] 107560[table 107561 [[Name][Description]] 107562 107563 [ 107564 [[link boost_asio.reference.posix__basic_descriptor.assign [*assign]]] 107565 [Assign an existing native descriptor to the descriptor. ] 107566 ] 107567 107568 [ 107569 [[link boost_asio.reference.posix__basic_descriptor.async_wait [*async_wait]]] 107570 [Asynchronously wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ] 107571 ] 107572 107573 [ 107574 [[link boost_asio.reference.posix__basic_descriptor.basic_descriptor [*basic_descriptor]] [constructor]] 107575 [Construct a descriptor without opening it. 107576 [hr] 107577 Construct a descriptor on an existing native descriptor. 107578 [hr] 107579 Move-construct a descriptor from another. ] 107580 ] 107581 107582 [ 107583 [[link boost_asio.reference.posix__basic_descriptor.cancel [*cancel]]] 107584 [Cancel all asynchronous operations associated with the descriptor. ] 107585 ] 107586 107587 [ 107588 [[link boost_asio.reference.posix__basic_descriptor.close [*close]]] 107589 [Close the descriptor. ] 107590 ] 107591 107592 [ 107593 [[link boost_asio.reference.posix__basic_descriptor.get_executor [*get_executor]]] 107594 [Get the executor associated with the object. ] 107595 ] 107596 107597 [ 107598 [[link boost_asio.reference.posix__basic_descriptor.io_control [*io_control]]] 107599 [Perform an IO control command on the descriptor. ] 107600 ] 107601 107602 [ 107603 [[link boost_asio.reference.posix__basic_descriptor.is_open [*is_open]]] 107604 [Determine whether the descriptor is open. ] 107605 ] 107606 107607 [ 107608 [[link boost_asio.reference.posix__basic_descriptor.lowest_layer [*lowest_layer]]] 107609 [Get a reference to the lowest layer. 107610 [hr] 107611 Get a const reference to the lowest layer. ] 107612 ] 107613 107614 [ 107615 [[link boost_asio.reference.posix__basic_descriptor.native_handle [*native_handle]]] 107616 [Get the native descriptor representation. ] 107617 ] 107618 107619 [ 107620 [[link boost_asio.reference.posix__basic_descriptor.native_non_blocking [*native_non_blocking]]] 107621 [Gets the non-blocking mode of the native descriptor implementation. 107622 [hr] 107623 Sets the non-blocking mode of the native descriptor implementation. ] 107624 ] 107625 107626 [ 107627 [[link boost_asio.reference.posix__basic_descriptor.non_blocking [*non_blocking]]] 107628 [Gets the non-blocking mode of the descriptor. 107629 [hr] 107630 Sets the non-blocking mode of the descriptor. ] 107631 ] 107632 107633 [ 107634 [[link boost_asio.reference.posix__basic_descriptor.operator_eq_ [*operator=]]] 107635 [Move-assign a descriptor from another. ] 107636 ] 107637 107638 [ 107639 [[link boost_asio.reference.posix__basic_descriptor.release [*release]]] 107640 [Release ownership of the native descriptor implementation. ] 107641 ] 107642 107643 [ 107644 [[link boost_asio.reference.posix__basic_descriptor.wait [*wait]]] 107645 [Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ] 107646 ] 107647 107648] 107649 107650[heading Protected Member Functions] 107651[table 107652 [[Name][Description]] 107653 107654 [ 107655 [[link boost_asio.reference.posix__basic_descriptor._basic_descriptor [*~basic_descriptor]] [destructor]] 107656 [Protected destructor to prevent deletion through this type. ] 107657 ] 107658 107659] 107660 107661The [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] class template provides the ability to wrap a POSIX descriptor. 107662 107663 107664[heading Thread Safety] 107665 107666['Distinct] ['objects:] Safe. 107667 107668['Shared] ['objects:] Unsafe. 107669 107670 107671 107672 107673[heading Requirements] 107674 107675['Header: ][^boost/asio/posix/basic_descriptor.hpp] 107676 107677['Convenience header: ][^boost/asio.hpp] 107678 107679 107680[endsect] 107681 107682 107683 107684[endsect] 107685 107686[section:posix__basic_stream_descriptor posix::basic_stream_descriptor] 107687 107688[indexterm1 boost_asio.indexterm.posix__basic_stream_descriptor..posix::basic_stream_descriptor] 107689 107690 107691Provides stream-oriented descriptor functionality. 107692 107693 107694 template< 107695 typename ``[link boost_asio.reference.Executor1 Executor]`` = any_io_executor> 107696 class basic_stream_descriptor : 107697 public posix::basic_descriptor< Executor > 107698 107699 107700[heading Types] 107701[table 107702 [[Name][Description]] 107703 107704 [ 107705 107706 [[link boost_asio.reference.posix__basic_stream_descriptor__rebind_executor [*rebind_executor]]] 107707 [Rebinds the descriptor type to another executor. ] 107708 107709 ] 107710 107711 [ 107712 107713 [[link boost_asio.reference.posix__basic_stream_descriptor.bytes_readable [*bytes_readable]]] 107714 [IO control command to get the amount of data that can be read without blocking. ] 107715 107716 ] 107717 107718 [ 107719 107720 [[link boost_asio.reference.posix__basic_stream_descriptor.executor_type [*executor_type]]] 107721 [The type of the executor associated with the object. ] 107722 107723 ] 107724 107725 [ 107726 107727 [[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer_type [*lowest_layer_type]]] 107728 [A descriptor is always the lowest layer. ] 107729 107730 ] 107731 107732 [ 107733 107734 [[link boost_asio.reference.posix__basic_stream_descriptor.native_handle_type [*native_handle_type]]] 107735 [The native representation of a descriptor. ] 107736 107737 ] 107738 107739 [ 107740 107741 [[link boost_asio.reference.posix__basic_stream_descriptor.wait_type [*wait_type]]] 107742 [Wait types. ] 107743 107744 ] 107745 107746] 107747 107748[heading Member Functions] 107749[table 107750 [[Name][Description]] 107751 107752 [ 107753 [[link boost_asio.reference.posix__basic_stream_descriptor.assign [*assign]]] 107754 [Assign an existing native descriptor to the descriptor. ] 107755 ] 107756 107757 [ 107758 [[link boost_asio.reference.posix__basic_stream_descriptor.async_read_some [*async_read_some]]] 107759 [Start an asynchronous read. ] 107760 ] 107761 107762 [ 107763 [[link boost_asio.reference.posix__basic_stream_descriptor.async_wait [*async_wait]]] 107764 [Asynchronously wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ] 107765 ] 107766 107767 [ 107768 [[link boost_asio.reference.posix__basic_stream_descriptor.async_write_some [*async_write_some]]] 107769 [Start an asynchronous write. ] 107770 ] 107771 107772 [ 107773 [[link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor [*basic_stream_descriptor]] [constructor]] 107774 [Construct a stream descriptor without opening it. 107775 [hr] 107776 Construct a stream descriptor on an existing native descriptor. 107777 [hr] 107778 Move-construct a stream descriptor from another. ] 107779 ] 107780 107781 [ 107782 [[link boost_asio.reference.posix__basic_stream_descriptor.cancel [*cancel]]] 107783 [Cancel all asynchronous operations associated with the descriptor. ] 107784 ] 107785 107786 [ 107787 [[link boost_asio.reference.posix__basic_stream_descriptor.close [*close]]] 107788 [Close the descriptor. ] 107789 ] 107790 107791 [ 107792 [[link boost_asio.reference.posix__basic_stream_descriptor.get_executor [*get_executor]]] 107793 [Get the executor associated with the object. ] 107794 ] 107795 107796 [ 107797 [[link boost_asio.reference.posix__basic_stream_descriptor.io_control [*io_control]]] 107798 [Perform an IO control command on the descriptor. ] 107799 ] 107800 107801 [ 107802 [[link boost_asio.reference.posix__basic_stream_descriptor.is_open [*is_open]]] 107803 [Determine whether the descriptor is open. ] 107804 ] 107805 107806 [ 107807 [[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer [*lowest_layer]]] 107808 [Get a reference to the lowest layer. 107809 [hr] 107810 Get a const reference to the lowest layer. ] 107811 ] 107812 107813 [ 107814 [[link boost_asio.reference.posix__basic_stream_descriptor.native_handle [*native_handle]]] 107815 [Get the native descriptor representation. ] 107816 ] 107817 107818 [ 107819 [[link boost_asio.reference.posix__basic_stream_descriptor.native_non_blocking [*native_non_blocking]]] 107820 [Gets the non-blocking mode of the native descriptor implementation. 107821 [hr] 107822 Sets the non-blocking mode of the native descriptor implementation. ] 107823 ] 107824 107825 [ 107826 [[link boost_asio.reference.posix__basic_stream_descriptor.non_blocking [*non_blocking]]] 107827 [Gets the non-blocking mode of the descriptor. 107828 [hr] 107829 Sets the non-blocking mode of the descriptor. ] 107830 ] 107831 107832 [ 107833 [[link boost_asio.reference.posix__basic_stream_descriptor.operator_eq_ [*operator=]]] 107834 [Move-assign a stream descriptor from another. ] 107835 ] 107836 107837 [ 107838 [[link boost_asio.reference.posix__basic_stream_descriptor.read_some [*read_some]]] 107839 [Read some data from the descriptor. ] 107840 ] 107841 107842 [ 107843 [[link boost_asio.reference.posix__basic_stream_descriptor.release [*release]]] 107844 [Release ownership of the native descriptor implementation. ] 107845 ] 107846 107847 [ 107848 [[link boost_asio.reference.posix__basic_stream_descriptor.wait [*wait]]] 107849 [Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ] 107850 ] 107851 107852 [ 107853 [[link boost_asio.reference.posix__basic_stream_descriptor.write_some [*write_some]]] 107854 [Write some data to the descriptor. ] 107855 ] 107856 107857] 107858 107859The [link boost_asio.reference.posix__basic_stream_descriptor `posix::basic_stream_descriptor`] class template provides asynchronous and blocking stream-oriented descriptor functionality. 107860 107861 107862[heading Thread Safety] 107863 107864['Distinct] ['objects:] Safe. 107865 107866['Shared] ['objects:] Unsafe. 107867 107868Synchronous `read_some` and `write_some` operations are thread safe with respect to each other, if the underlying operating system calls are also thread safe. This means that it is permitted to perform concurrent calls to these synchronous operations on a single descriptor object. Other synchronous operations, such as `close`, are not thread safe. 107869 107870 107871 107872 107873[heading Requirements] 107874 107875['Header: ][^boost/asio/posix/basic_stream_descriptor.hpp] 107876 107877['Convenience header: ][^boost/asio.hpp] 107878 107879[section:assign posix::basic_stream_descriptor::assign] 107880 107881[indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.assign..assign..posix::basic_stream_descriptor] 107882Assign an existing native descriptor to the descriptor. 107883 107884 107885 void ``[link boost_asio.reference.posix__basic_stream_descriptor.assign.overload1 assign]``( 107886 const native_handle_type & native_descriptor); 107887 `` [''''»''' [link boost_asio.reference.posix__basic_stream_descriptor.assign.overload1 more...]]`` 107888 107889 void ``[link boost_asio.reference.posix__basic_stream_descriptor.assign.overload2 assign]``( 107890 const native_handle_type & native_descriptor, 107891 boost::system::error_code & ec); 107892 `` [''''»''' [link boost_asio.reference.posix__basic_stream_descriptor.assign.overload2 more...]]`` 107893 107894 107895[section:overload1 posix::basic_stream_descriptor::assign (1 of 2 overloads)] 107896 107897 107898['Inherited from posix::basic_descriptor.] 107899 107900 107901Assign an existing native descriptor to the descriptor. 107902 107903 107904 void assign( 107905 const native_handle_type & native_descriptor); 107906 107907 107908 107909[endsect] 107910 107911 107912 107913[section:overload2 posix::basic_stream_descriptor::assign (2 of 2 overloads)] 107914 107915 107916['Inherited from posix::basic_descriptor.] 107917 107918 107919Assign an existing native descriptor to the descriptor. 107920 107921 107922 void assign( 107923 const native_handle_type & native_descriptor, 107924 boost::system::error_code & ec); 107925 107926 107927 107928[endsect] 107929 107930 107931[endsect] 107932 107933 107934[section:async_read_some posix::basic_stream_descriptor::async_read_some] 107935 107936[indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.async_read_some..async_read_some..posix::basic_stream_descriptor] 107937Start an asynchronous read. 107938 107939 107940 template< 107941 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 107942 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 107943 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_some( 107944 const MutableBufferSequence & buffers, 107945 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 107946 107947 107948This function is used to asynchronously read data from the stream descriptor. The function call always returns immediately. 107949 107950 107951[heading Parameters] 107952 107953 107954[variablelist 107955 107956[[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.]] 107957 107958[[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: 107959`` 107960 void handler( 107961 const boost::system::error_code& error, // Result of operation. 107962 std::size_t bytes_transferred // Number of bytes read. 107963 ); 107964`` 107965Regardless 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`].]] 107966 107967] 107968 107969 107970[heading Remarks] 107971 107972The 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. 107973 107974 107975[heading Example] 107976 107977To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 107978 107979 descriptor.async_read_some(boost::asio::buffer(data, size), handler); 107980 107981 107982See 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. 107983 107984 107985 107986 107987[endsect] 107988 107989 107990 107991[section:async_wait posix::basic_stream_descriptor::async_wait] 107992 107993 107994['Inherited from posix::basic_descriptor.] 107995 107996[indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.async_wait..async_wait..posix::basic_stream_descriptor] 107997Asynchronously wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. 107998 107999 108000 template< 108001 typename ``[link boost_asio.reference.WaitHandler WaitHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 108002 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait( 108003 wait_type w, 108004 WaitHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 108005 108006 108007This function is used to perform an asynchronous wait for a descriptor to enter a ready to read, write or error condition state. 108008 108009 108010[heading Parameters] 108011 108012 108013[variablelist 108014 108015[[w][Specifies the desired descriptor state.]] 108016 108017[[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: 108018`` 108019 void handler( 108020 const boost::system::error_code& error // Result of operation 108021 ); 108022`` 108023Regardless 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`].]] 108024 108025] 108026 108027 108028[heading Example] 108029 108030 108031 108032 void wait_handler(const boost::system::error_code& error) 108033 { 108034 if (!error) 108035 { 108036 // Wait succeeded. 108037 } 108038 } 108039 108040 ... 108041 108042 boost::asio::posix::stream_descriptor descriptor(my_context); 108043 ... 108044 descriptor.async_wait( 108045 boost::asio::posix::stream_descriptor::wait_read, 108046 wait_handler); 108047 108048 108049 108050 108051 108052 108053 108054[endsect] 108055 108056 108057 108058[section:async_write_some posix::basic_stream_descriptor::async_write_some] 108059 108060[indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.async_write_some..async_write_some..posix::basic_stream_descriptor] 108061Start an asynchronous write. 108062 108063 108064 template< 108065 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 108066 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 108067 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_some( 108068 const ConstBufferSequence & buffers, 108069 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 108070 108071 108072This function is used to asynchronously write data to the stream descriptor. The function call always returns immediately. 108073 108074 108075[heading Parameters] 108076 108077 108078[variablelist 108079 108080[[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.]] 108081 108082[[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: 108083`` 108084 void handler( 108085 const boost::system::error_code& error, // Result of operation. 108086 std::size_t bytes_transferred // Number of bytes written. 108087 ); 108088`` 108089Regardless 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`].]] 108090 108091] 108092 108093 108094[heading Remarks] 108095 108096The 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. 108097 108098 108099[heading Example] 108100 108101To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 108102 108103 descriptor.async_write_some(boost::asio::buffer(data, size), handler); 108104 108105 108106See 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. 108107 108108 108109 108110 108111[endsect] 108112 108113 108114[section:basic_stream_descriptor posix::basic_stream_descriptor::basic_stream_descriptor] 108115 108116[indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.basic_stream_descriptor..basic_stream_descriptor..posix::basic_stream_descriptor] 108117Construct a stream descriptor without opening it. 108118 108119 108120 explicit ``[link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload1 basic_stream_descriptor]``( 108121 const executor_type & ex); 108122 `` [''''»''' [link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload1 more...]]`` 108123 108124 template< 108125 typename ExecutionContext> 108126 explicit ``[link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload2 basic_stream_descriptor]``( 108127 ExecutionContext & context, 108128 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value, defaulted_constraint >::type = defaulted_constraint()); 108129 `` [''''»''' [link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload2 more...]]`` 108130 108131 108132Construct a stream descriptor on an existing native descriptor. 108133 108134 108135 ``[link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload3 basic_stream_descriptor]``( 108136 const executor_type & ex, 108137 const native_handle_type & native_descriptor); 108138 `` [''''»''' [link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload3 more...]]`` 108139 108140 template< 108141 typename ExecutionContext> 108142 ``[link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload4 basic_stream_descriptor]``( 108143 ExecutionContext & context, 108144 const native_handle_type & native_descriptor, 108145 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 108146 `` [''''»''' [link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload4 more...]]`` 108147 108148 108149Move-construct a stream descriptor from another. 108150 108151 108152 ``[link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload5 basic_stream_descriptor]``( 108153 basic_stream_descriptor && other); 108154 `` [''''»''' [link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload5 more...]]`` 108155 108156 108157[section:overload1 posix::basic_stream_descriptor::basic_stream_descriptor (1 of 5 overloads)] 108158 108159 108160Construct a stream descriptor without opening it. 108161 108162 108163 basic_stream_descriptor( 108164 const executor_type & ex); 108165 108166 108167This 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. 108168 108169 108170[heading Parameters] 108171 108172 108173[variablelist 108174 108175[[ex][The I/O executor that the descriptor will use, by default, to dispatch handlers for any asynchronous operations performed on the descriptor. ]] 108176 108177] 108178 108179 108180 108181 108182[endsect] 108183 108184 108185 108186[section:overload2 posix::basic_stream_descriptor::basic_stream_descriptor (2 of 5 overloads)] 108187 108188 108189Construct a stream descriptor without opening it. 108190 108191 108192 template< 108193 typename ExecutionContext> 108194 basic_stream_descriptor( 108195 ExecutionContext & context, 108196 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value, defaulted_constraint >::type = defaulted_constraint()); 108197 108198 108199This 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. 108200 108201 108202[heading Parameters] 108203 108204 108205[variablelist 108206 108207[[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. ]] 108208 108209] 108210 108211 108212 108213 108214[endsect] 108215 108216 108217 108218[section:overload3 posix::basic_stream_descriptor::basic_stream_descriptor (3 of 5 overloads)] 108219 108220 108221Construct a stream descriptor on an existing native descriptor. 108222 108223 108224 basic_stream_descriptor( 108225 const executor_type & ex, 108226 const native_handle_type & native_descriptor); 108227 108228 108229This constructor creates a stream descriptor object to hold an existing native descriptor. 108230 108231 108232[heading Parameters] 108233 108234 108235[variablelist 108236 108237[[ex][The I/O executor that the descriptor will use, by default, to dispatch handlers for any asynchronous operations performed on the descriptor.]] 108238 108239[[native_descriptor][The new underlying descriptor implementation.]] 108240 108241] 108242 108243 108244[heading Exceptions] 108245 108246 108247[variablelist 108248 108249[[boost::system::system_error][Thrown on failure. ]] 108250 108251] 108252 108253 108254 108255 108256[endsect] 108257 108258 108259 108260[section:overload4 posix::basic_stream_descriptor::basic_stream_descriptor (4 of 5 overloads)] 108261 108262 108263Construct a stream descriptor on an existing native descriptor. 108264 108265 108266 template< 108267 typename ExecutionContext> 108268 basic_stream_descriptor( 108269 ExecutionContext & context, 108270 const native_handle_type & native_descriptor, 108271 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 108272 108273 108274This constructor creates a stream descriptor object to hold an existing native descriptor. 108275 108276 108277[heading Parameters] 108278 108279 108280[variablelist 108281 108282[[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.]] 108283 108284[[native_descriptor][The new underlying descriptor implementation.]] 108285 108286] 108287 108288 108289[heading Exceptions] 108290 108291 108292[variablelist 108293 108294[[boost::system::system_error][Thrown on failure. ]] 108295 108296] 108297 108298 108299 108300 108301[endsect] 108302 108303 108304 108305[section:overload5 posix::basic_stream_descriptor::basic_stream_descriptor (5 of 5 overloads)] 108306 108307 108308Move-construct a stream descriptor from another. 108309 108310 108311 basic_stream_descriptor( 108312 basic_stream_descriptor && other); 108313 108314 108315This constructor moves a stream descriptor from one object to another. 108316 108317 108318[heading Parameters] 108319 108320 108321[variablelist 108322 108323[[other][The other stream descriptor object from which the move will occur.]] 108324 108325] 108326 108327 108328[heading Remarks] 108329 108330Following the move, the moved-from object is in the same state as if constructed using the `basic_stream_descriptor(const executor_type&)` constructor. 108331 108332 108333 108334 108335[endsect] 108336 108337 108338[endsect] 108339 108340 108341[section:bytes_readable posix::basic_stream_descriptor::bytes_readable] 108342 108343 108344['Inherited from posix::descriptor_base.] 108345 108346[indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.bytes_readable..bytes_readable..posix::basic_stream_descriptor] 108347IO control command to get the amount of data that can be read without blocking. 108348 108349 108350 typedef implementation_defined bytes_readable; 108351 108352 108353 108354Implements the FIONREAD IO control command. 108355 108356 108357[heading Example] 108358 108359 108360 108361 boost::asio::posix::stream_descriptor descriptor(my_context); 108362 ... 108363 boost::asio::descriptor_base::bytes_readable command(true); 108364 descriptor.io_control(command); 108365 std::size_t bytes_readable = command.get(); 108366 108367 108368 108369 108370 108371 108372 108373[heading Requirements] 108374 108375['Header: ][^boost/asio/posix/basic_stream_descriptor.hpp] 108376 108377['Convenience header: ][^boost/asio.hpp] 108378 108379 108380[endsect] 108381 108382 108383[section:cancel posix::basic_stream_descriptor::cancel] 108384 108385[indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.cancel..cancel..posix::basic_stream_descriptor] 108386Cancel all asynchronous operations associated with the descriptor. 108387 108388 108389 void ``[link boost_asio.reference.posix__basic_stream_descriptor.cancel.overload1 cancel]``(); 108390 `` [''''»''' [link boost_asio.reference.posix__basic_stream_descriptor.cancel.overload1 more...]]`` 108391 108392 void ``[link boost_asio.reference.posix__basic_stream_descriptor.cancel.overload2 cancel]``( 108393 boost::system::error_code & ec); 108394 `` [''''»''' [link boost_asio.reference.posix__basic_stream_descriptor.cancel.overload2 more...]]`` 108395 108396 108397[section:overload1 posix::basic_stream_descriptor::cancel (1 of 2 overloads)] 108398 108399 108400['Inherited from posix::basic_descriptor.] 108401 108402 108403Cancel all asynchronous operations associated with the descriptor. 108404 108405 108406 void cancel(); 108407 108408 108409This 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. 108410 108411 108412[heading Exceptions] 108413 108414 108415[variablelist 108416 108417[[boost::system::system_error][Thrown on failure. ]] 108418 108419] 108420 108421 108422 108423 108424[endsect] 108425 108426 108427 108428[section:overload2 posix::basic_stream_descriptor::cancel (2 of 2 overloads)] 108429 108430 108431['Inherited from posix::basic_descriptor.] 108432 108433 108434Cancel all asynchronous operations associated with the descriptor. 108435 108436 108437 void cancel( 108438 boost::system::error_code & ec); 108439 108440 108441This 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. 108442 108443 108444[heading Parameters] 108445 108446 108447[variablelist 108448 108449[[ec][Set to indicate what error occurred, if any. ]] 108450 108451] 108452 108453 108454 108455 108456[endsect] 108457 108458 108459[endsect] 108460 108461[section:close posix::basic_stream_descriptor::close] 108462 108463[indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.close..close..posix::basic_stream_descriptor] 108464Close the descriptor. 108465 108466 108467 void ``[link boost_asio.reference.posix__basic_stream_descriptor.close.overload1 close]``(); 108468 `` [''''»''' [link boost_asio.reference.posix__basic_stream_descriptor.close.overload1 more...]]`` 108469 108470 void ``[link boost_asio.reference.posix__basic_stream_descriptor.close.overload2 close]``( 108471 boost::system::error_code & ec); 108472 `` [''''»''' [link boost_asio.reference.posix__basic_stream_descriptor.close.overload2 more...]]`` 108473 108474 108475[section:overload1 posix::basic_stream_descriptor::close (1 of 2 overloads)] 108476 108477 108478['Inherited from posix::basic_descriptor.] 108479 108480 108481Close the descriptor. 108482 108483 108484 void close(); 108485 108486 108487This 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. 108488 108489 108490[heading Exceptions] 108491 108492 108493[variablelist 108494 108495[[boost::system::system_error][Thrown on failure. Note that, even if the function indicates an error, the underlying descriptor is closed. ]] 108496 108497] 108498 108499 108500 108501 108502[endsect] 108503 108504 108505 108506[section:overload2 posix::basic_stream_descriptor::close (2 of 2 overloads)] 108507 108508 108509['Inherited from posix::basic_descriptor.] 108510 108511 108512Close the descriptor. 108513 108514 108515 void close( 108516 boost::system::error_code & ec); 108517 108518 108519This 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. 108520 108521 108522[heading Parameters] 108523 108524 108525[variablelist 108526 108527[[ec][Set to indicate what error occurred, if any. Note that, even if the function indicates an error, the underlying descriptor is closed. ]] 108528 108529] 108530 108531 108532 108533 108534[endsect] 108535 108536 108537[endsect] 108538 108539 108540[section:executor_type posix::basic_stream_descriptor::executor_type] 108541 108542[indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.executor_type..executor_type..posix::basic_stream_descriptor] 108543The type of the executor associated with the object. 108544 108545 108546 typedef Executor executor_type; 108547 108548 108549 108550[heading Requirements] 108551 108552['Header: ][^boost/asio/posix/basic_stream_descriptor.hpp] 108553 108554['Convenience header: ][^boost/asio.hpp] 108555 108556 108557[endsect] 108558 108559 108560 108561[section:get_executor posix::basic_stream_descriptor::get_executor] 108562 108563 108564['Inherited from posix::basic_descriptor.] 108565 108566[indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.get_executor..get_executor..posix::basic_stream_descriptor] 108567Get the executor associated with the object. 108568 108569 108570 executor_type get_executor(); 108571 108572 108573 108574[endsect] 108575 108576 108577[section:io_control posix::basic_stream_descriptor::io_control] 108578 108579[indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.io_control..io_control..posix::basic_stream_descriptor] 108580Perform an IO control command on the descriptor. 108581 108582 108583 template< 108584 typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> 108585 void ``[link boost_asio.reference.posix__basic_stream_descriptor.io_control.overload1 io_control]``( 108586 IoControlCommand & command); 108587 `` [''''»''' [link boost_asio.reference.posix__basic_stream_descriptor.io_control.overload1 more...]]`` 108588 108589 template< 108590 typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> 108591 void ``[link boost_asio.reference.posix__basic_stream_descriptor.io_control.overload2 io_control]``( 108592 IoControlCommand & command, 108593 boost::system::error_code & ec); 108594 `` [''''»''' [link boost_asio.reference.posix__basic_stream_descriptor.io_control.overload2 more...]]`` 108595 108596 108597[section:overload1 posix::basic_stream_descriptor::io_control (1 of 2 overloads)] 108598 108599 108600['Inherited from posix::basic_descriptor.] 108601 108602 108603Perform an IO control command on the descriptor. 108604 108605 108606 template< 108607 typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> 108608 void io_control( 108609 IoControlCommand & command); 108610 108611 108612This function is used to execute an IO control command on the descriptor. 108613 108614 108615[heading Parameters] 108616 108617 108618[variablelist 108619 108620[[command][The IO control command to be performed on the descriptor.]] 108621 108622] 108623 108624 108625[heading Exceptions] 108626 108627 108628[variablelist 108629 108630[[boost::system::system_error][Thrown on failure.]] 108631 108632] 108633 108634 108635 108636[heading Example] 108637 108638Getting the number of bytes ready to read: 108639 108640 boost::asio::posix::stream_descriptor descriptor(my_context); 108641 ... 108642 boost::asio::posix::stream_descriptor::bytes_readable command; 108643 descriptor.io_control(command); 108644 std::size_t bytes_readable = command.get(); 108645 108646 108647 108648 108649 108650 108651 108652[endsect] 108653 108654 108655 108656[section:overload2 posix::basic_stream_descriptor::io_control (2 of 2 overloads)] 108657 108658 108659['Inherited from posix::basic_descriptor.] 108660 108661 108662Perform an IO control command on the descriptor. 108663 108664 108665 template< 108666 typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> 108667 void io_control( 108668 IoControlCommand & command, 108669 boost::system::error_code & ec); 108670 108671 108672This function is used to execute an IO control command on the descriptor. 108673 108674 108675[heading Parameters] 108676 108677 108678[variablelist 108679 108680[[command][The IO control command to be performed on the descriptor.]] 108681 108682[[ec][Set to indicate what error occurred, if any.]] 108683 108684] 108685 108686 108687 108688[heading Example] 108689 108690Getting the number of bytes ready to read: 108691 108692 boost::asio::posix::stream_descriptor descriptor(my_context); 108693 ... 108694 boost::asio::posix::stream_descriptor::bytes_readable command; 108695 boost::system::error_code ec; 108696 descriptor.io_control(command, ec); 108697 if (ec) 108698 { 108699 // An error occurred. 108700 } 108701 std::size_t bytes_readable = command.get(); 108702 108703 108704 108705 108706 108707 108708 108709[endsect] 108710 108711 108712[endsect] 108713 108714 108715[section:is_open posix::basic_stream_descriptor::is_open] 108716 108717 108718['Inherited from posix::basic_descriptor.] 108719 108720[indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.is_open..is_open..posix::basic_stream_descriptor] 108721Determine whether the descriptor is open. 108722 108723 108724 bool is_open() const; 108725 108726 108727 108728[endsect] 108729 108730 108731[section:lowest_layer posix::basic_stream_descriptor::lowest_layer] 108732 108733[indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.lowest_layer..lowest_layer..posix::basic_stream_descriptor] 108734Get a reference to the lowest layer. 108735 108736 108737 lowest_layer_type & ``[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer.overload1 lowest_layer]``(); 108738 `` [''''»''' [link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer.overload1 more...]]`` 108739 108740 108741Get a const reference to the lowest layer. 108742 108743 108744 const lowest_layer_type & ``[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer.overload2 lowest_layer]``() const; 108745 `` [''''»''' [link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer.overload2 more...]]`` 108746 108747 108748[section:overload1 posix::basic_stream_descriptor::lowest_layer (1 of 2 overloads)] 108749 108750 108751['Inherited from posix::basic_descriptor.] 108752 108753 108754Get a reference to the lowest layer. 108755 108756 108757 lowest_layer_type & lowest_layer(); 108758 108759 108760This 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. 108761 108762 108763[heading Return Value] 108764 108765A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 108766 108767 108768 108769 108770[endsect] 108771 108772 108773 108774[section:overload2 posix::basic_stream_descriptor::lowest_layer (2 of 2 overloads)] 108775 108776 108777['Inherited from posix::basic_descriptor.] 108778 108779 108780Get a const reference to the lowest layer. 108781 108782 108783 const lowest_layer_type & lowest_layer() const; 108784 108785 108786This 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. 108787 108788 108789[heading Return Value] 108790 108791A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 108792 108793 108794 108795 108796[endsect] 108797 108798 108799[endsect] 108800 108801 108802[section:lowest_layer_type posix::basic_stream_descriptor::lowest_layer_type] 108803 108804 108805['Inherited from posix::basic_descriptor.] 108806 108807[indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.lowest_layer_type..lowest_layer_type..posix::basic_stream_descriptor] 108808A descriptor is always the lowest layer. 108809 108810 108811 typedef basic_descriptor lowest_layer_type; 108812 108813 108814[heading Types] 108815[table 108816 [[Name][Description]] 108817 108818 [ 108819 108820 [[link boost_asio.reference.posix__basic_descriptor__rebind_executor [*rebind_executor]]] 108821 [Rebinds the descriptor type to another executor. ] 108822 108823 ] 108824 108825 [ 108826 108827 [[link boost_asio.reference.posix__basic_descriptor.bytes_readable [*bytes_readable]]] 108828 [IO control command to get the amount of data that can be read without blocking. ] 108829 108830 ] 108831 108832 [ 108833 108834 [[link boost_asio.reference.posix__basic_descriptor.executor_type [*executor_type]]] 108835 [The type of the executor associated with the object. ] 108836 108837 ] 108838 108839 [ 108840 108841 [[link boost_asio.reference.posix__basic_descriptor.lowest_layer_type [*lowest_layer_type]]] 108842 [A descriptor is always the lowest layer. ] 108843 108844 ] 108845 108846 [ 108847 108848 [[link boost_asio.reference.posix__basic_descriptor.native_handle_type [*native_handle_type]]] 108849 [The native representation of a descriptor. ] 108850 108851 ] 108852 108853 [ 108854 108855 [[link boost_asio.reference.posix__basic_descriptor.wait_type [*wait_type]]] 108856 [Wait types. ] 108857 108858 ] 108859 108860] 108861 108862[heading Member Functions] 108863[table 108864 [[Name][Description]] 108865 108866 [ 108867 [[link boost_asio.reference.posix__basic_descriptor.assign [*assign]]] 108868 [Assign an existing native descriptor to the descriptor. ] 108869 ] 108870 108871 [ 108872 [[link boost_asio.reference.posix__basic_descriptor.async_wait [*async_wait]]] 108873 [Asynchronously wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ] 108874 ] 108875 108876 [ 108877 [[link boost_asio.reference.posix__basic_descriptor.basic_descriptor [*basic_descriptor]] [constructor]] 108878 [Construct a descriptor without opening it. 108879 [hr] 108880 Construct a descriptor on an existing native descriptor. 108881 [hr] 108882 Move-construct a descriptor from another. ] 108883 ] 108884 108885 [ 108886 [[link boost_asio.reference.posix__basic_descriptor.cancel [*cancel]]] 108887 [Cancel all asynchronous operations associated with the descriptor. ] 108888 ] 108889 108890 [ 108891 [[link boost_asio.reference.posix__basic_descriptor.close [*close]]] 108892 [Close the descriptor. ] 108893 ] 108894 108895 [ 108896 [[link boost_asio.reference.posix__basic_descriptor.get_executor [*get_executor]]] 108897 [Get the executor associated with the object. ] 108898 ] 108899 108900 [ 108901 [[link boost_asio.reference.posix__basic_descriptor.io_control [*io_control]]] 108902 [Perform an IO control command on the descriptor. ] 108903 ] 108904 108905 [ 108906 [[link boost_asio.reference.posix__basic_descriptor.is_open [*is_open]]] 108907 [Determine whether the descriptor is open. ] 108908 ] 108909 108910 [ 108911 [[link boost_asio.reference.posix__basic_descriptor.lowest_layer [*lowest_layer]]] 108912 [Get a reference to the lowest layer. 108913 [hr] 108914 Get a const reference to the lowest layer. ] 108915 ] 108916 108917 [ 108918 [[link boost_asio.reference.posix__basic_descriptor.native_handle [*native_handle]]] 108919 [Get the native descriptor representation. ] 108920 ] 108921 108922 [ 108923 [[link boost_asio.reference.posix__basic_descriptor.native_non_blocking [*native_non_blocking]]] 108924 [Gets the non-blocking mode of the native descriptor implementation. 108925 [hr] 108926 Sets the non-blocking mode of the native descriptor implementation. ] 108927 ] 108928 108929 [ 108930 [[link boost_asio.reference.posix__basic_descriptor.non_blocking [*non_blocking]]] 108931 [Gets the non-blocking mode of the descriptor. 108932 [hr] 108933 Sets the non-blocking mode of the descriptor. ] 108934 ] 108935 108936 [ 108937 [[link boost_asio.reference.posix__basic_descriptor.operator_eq_ [*operator=]]] 108938 [Move-assign a descriptor from another. ] 108939 ] 108940 108941 [ 108942 [[link boost_asio.reference.posix__basic_descriptor.release [*release]]] 108943 [Release ownership of the native descriptor implementation. ] 108944 ] 108945 108946 [ 108947 [[link boost_asio.reference.posix__basic_descriptor.wait [*wait]]] 108948 [Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ] 108949 ] 108950 108951] 108952 108953[heading Protected Member Functions] 108954[table 108955 [[Name][Description]] 108956 108957 [ 108958 [[link boost_asio.reference.posix__basic_descriptor._basic_descriptor [*~basic_descriptor]] [destructor]] 108959 [Protected destructor to prevent deletion through this type. ] 108960 ] 108961 108962] 108963 108964The [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] class template provides the ability to wrap a POSIX descriptor. 108965 108966 108967[heading Thread Safety] 108968 108969['Distinct] ['objects:] Safe. 108970 108971['Shared] ['objects:] Unsafe. 108972 108973 108974 108975 108976[heading Requirements] 108977 108978['Header: ][^boost/asio/posix/basic_stream_descriptor.hpp] 108979 108980['Convenience header: ][^boost/asio.hpp] 108981 108982 108983[endsect] 108984 108985 108986 108987[section:native_handle posix::basic_stream_descriptor::native_handle] 108988 108989 108990['Inherited from posix::basic_descriptor.] 108991 108992[indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.native_handle..native_handle..posix::basic_stream_descriptor] 108993Get the native descriptor representation. 108994 108995 108996 native_handle_type native_handle(); 108997 108998 108999This 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. 109000 109001 109002[endsect] 109003 109004 109005 109006[section:native_handle_type posix::basic_stream_descriptor::native_handle_type] 109007 109008[indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.native_handle_type..native_handle_type..posix::basic_stream_descriptor] 109009The native representation of a descriptor. 109010 109011 109012 typedef basic_descriptor< Executor >::native_handle_type native_handle_type; 109013 109014 109015[heading Types] 109016[table 109017 [[Name][Description]] 109018 109019 [ 109020 109021 [[link boost_asio.reference.posix__basic_descriptor__rebind_executor [*rebind_executor]]] 109022 [Rebinds the descriptor type to another executor. ] 109023 109024 ] 109025 109026 [ 109027 109028 [[link boost_asio.reference.posix__basic_descriptor.bytes_readable [*bytes_readable]]] 109029 [IO control command to get the amount of data that can be read without blocking. ] 109030 109031 ] 109032 109033 [ 109034 109035 [[link boost_asio.reference.posix__basic_descriptor.executor_type [*executor_type]]] 109036 [The type of the executor associated with the object. ] 109037 109038 ] 109039 109040 [ 109041 109042 [[link boost_asio.reference.posix__basic_descriptor.lowest_layer_type [*lowest_layer_type]]] 109043 [A descriptor is always the lowest layer. ] 109044 109045 ] 109046 109047 [ 109048 109049 [[link boost_asio.reference.posix__basic_descriptor.native_handle_type [*native_handle_type]]] 109050 [The native representation of a descriptor. ] 109051 109052 ] 109053 109054 [ 109055 109056 [[link boost_asio.reference.posix__basic_descriptor.wait_type [*wait_type]]] 109057 [Wait types. ] 109058 109059 ] 109060 109061] 109062 109063[heading Member Functions] 109064[table 109065 [[Name][Description]] 109066 109067 [ 109068 [[link boost_asio.reference.posix__basic_descriptor.assign [*assign]]] 109069 [Assign an existing native descriptor to the descriptor. ] 109070 ] 109071 109072 [ 109073 [[link boost_asio.reference.posix__basic_descriptor.async_wait [*async_wait]]] 109074 [Asynchronously wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ] 109075 ] 109076 109077 [ 109078 [[link boost_asio.reference.posix__basic_descriptor.basic_descriptor [*basic_descriptor]] [constructor]] 109079 [Construct a descriptor without opening it. 109080 [hr] 109081 Construct a descriptor on an existing native descriptor. 109082 [hr] 109083 Move-construct a descriptor from another. ] 109084 ] 109085 109086 [ 109087 [[link boost_asio.reference.posix__basic_descriptor.cancel [*cancel]]] 109088 [Cancel all asynchronous operations associated with the descriptor. ] 109089 ] 109090 109091 [ 109092 [[link boost_asio.reference.posix__basic_descriptor.close [*close]]] 109093 [Close the descriptor. ] 109094 ] 109095 109096 [ 109097 [[link boost_asio.reference.posix__basic_descriptor.get_executor [*get_executor]]] 109098 [Get the executor associated with the object. ] 109099 ] 109100 109101 [ 109102 [[link boost_asio.reference.posix__basic_descriptor.io_control [*io_control]]] 109103 [Perform an IO control command on the descriptor. ] 109104 ] 109105 109106 [ 109107 [[link boost_asio.reference.posix__basic_descriptor.is_open [*is_open]]] 109108 [Determine whether the descriptor is open. ] 109109 ] 109110 109111 [ 109112 [[link boost_asio.reference.posix__basic_descriptor.lowest_layer [*lowest_layer]]] 109113 [Get a reference to the lowest layer. 109114 [hr] 109115 Get a const reference to the lowest layer. ] 109116 ] 109117 109118 [ 109119 [[link boost_asio.reference.posix__basic_descriptor.native_handle [*native_handle]]] 109120 [Get the native descriptor representation. ] 109121 ] 109122 109123 [ 109124 [[link boost_asio.reference.posix__basic_descriptor.native_non_blocking [*native_non_blocking]]] 109125 [Gets the non-blocking mode of the native descriptor implementation. 109126 [hr] 109127 Sets the non-blocking mode of the native descriptor implementation. ] 109128 ] 109129 109130 [ 109131 [[link boost_asio.reference.posix__basic_descriptor.non_blocking [*non_blocking]]] 109132 [Gets the non-blocking mode of the descriptor. 109133 [hr] 109134 Sets the non-blocking mode of the descriptor. ] 109135 ] 109136 109137 [ 109138 [[link boost_asio.reference.posix__basic_descriptor.operator_eq_ [*operator=]]] 109139 [Move-assign a descriptor from another. ] 109140 ] 109141 109142 [ 109143 [[link boost_asio.reference.posix__basic_descriptor.release [*release]]] 109144 [Release ownership of the native descriptor implementation. ] 109145 ] 109146 109147 [ 109148 [[link boost_asio.reference.posix__basic_descriptor.wait [*wait]]] 109149 [Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ] 109150 ] 109151 109152] 109153 109154[heading Protected Member Functions] 109155[table 109156 [[Name][Description]] 109157 109158 [ 109159 [[link boost_asio.reference.posix__basic_descriptor._basic_descriptor [*~basic_descriptor]] [destructor]] 109160 [Protected destructor to prevent deletion through this type. ] 109161 ] 109162 109163] 109164 109165The [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] class template provides the ability to wrap a POSIX descriptor. 109166 109167 109168[heading Thread Safety] 109169 109170['Distinct] ['objects:] Safe. 109171 109172['Shared] ['objects:] Unsafe. 109173 109174 109175 109176 109177[heading Requirements] 109178 109179['Header: ][^boost/asio/posix/basic_stream_descriptor.hpp] 109180 109181['Convenience header: ][^boost/asio.hpp] 109182 109183 109184[endsect] 109185 109186 109187[section:native_non_blocking posix::basic_stream_descriptor::native_non_blocking] 109188 109189[indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.native_non_blocking..native_non_blocking..posix::basic_stream_descriptor] 109190Gets the non-blocking mode of the native descriptor implementation. 109191 109192 109193 bool ``[link boost_asio.reference.posix__basic_stream_descriptor.native_non_blocking.overload1 native_non_blocking]``() const; 109194 `` [''''»''' [link boost_asio.reference.posix__basic_stream_descriptor.native_non_blocking.overload1 more...]]`` 109195 109196 109197Sets the non-blocking mode of the native descriptor implementation. 109198 109199 109200 void ``[link boost_asio.reference.posix__basic_stream_descriptor.native_non_blocking.overload2 native_non_blocking]``( 109201 bool mode); 109202 `` [''''»''' [link boost_asio.reference.posix__basic_stream_descriptor.native_non_blocking.overload2 more...]]`` 109203 109204 void ``[link boost_asio.reference.posix__basic_stream_descriptor.native_non_blocking.overload3 native_non_blocking]``( 109205 bool mode, 109206 boost::system::error_code & ec); 109207 `` [''''»''' [link boost_asio.reference.posix__basic_stream_descriptor.native_non_blocking.overload3 more...]]`` 109208 109209 109210[section:overload1 posix::basic_stream_descriptor::native_non_blocking (1 of 3 overloads)] 109211 109212 109213['Inherited from posix::basic_descriptor.] 109214 109215 109216Gets the non-blocking mode of the native descriptor implementation. 109217 109218 109219 bool native_non_blocking() const; 109220 109221 109222This 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. 109223 109224 109225[heading Return Value] 109226 109227`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). 109228 109229 109230[heading Remarks] 109231 109232The 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. 109233 109234 109235 109236 109237[endsect] 109238 109239 109240 109241[section:overload2 posix::basic_stream_descriptor::native_non_blocking (2 of 3 overloads)] 109242 109243 109244['Inherited from posix::basic_descriptor.] 109245 109246 109247Sets the non-blocking mode of the native descriptor implementation. 109248 109249 109250 void native_non_blocking( 109251 bool mode); 109252 109253 109254This 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. 109255 109256 109257[heading Parameters] 109258 109259 109260[variablelist 109261 109262[[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).]] 109263 109264] 109265 109266 109267[heading Exceptions] 109268 109269 109270[variablelist 109271 109272[[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. ]] 109273 109274] 109275 109276 109277 109278 109279[endsect] 109280 109281 109282 109283[section:overload3 posix::basic_stream_descriptor::native_non_blocking (3 of 3 overloads)] 109284 109285 109286['Inherited from posix::basic_descriptor.] 109287 109288 109289Sets the non-blocking mode of the native descriptor implementation. 109290 109291 109292 void native_non_blocking( 109293 bool mode, 109294 boost::system::error_code & ec); 109295 109296 109297This 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. 109298 109299 109300[heading Parameters] 109301 109302 109303[variablelist 109304 109305[[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).]] 109306 109307[[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. ]] 109308 109309] 109310 109311 109312 109313 109314[endsect] 109315 109316 109317[endsect] 109318 109319[section:non_blocking posix::basic_stream_descriptor::non_blocking] 109320 109321[indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.non_blocking..non_blocking..posix::basic_stream_descriptor] 109322Gets the non-blocking mode of the descriptor. 109323 109324 109325 bool ``[link boost_asio.reference.posix__basic_stream_descriptor.non_blocking.overload1 non_blocking]``() const; 109326 `` [''''»''' [link boost_asio.reference.posix__basic_stream_descriptor.non_blocking.overload1 more...]]`` 109327 109328 109329Sets the non-blocking mode of the descriptor. 109330 109331 109332 void ``[link boost_asio.reference.posix__basic_stream_descriptor.non_blocking.overload2 non_blocking]``( 109333 bool mode); 109334 `` [''''»''' [link boost_asio.reference.posix__basic_stream_descriptor.non_blocking.overload2 more...]]`` 109335 109336 void ``[link boost_asio.reference.posix__basic_stream_descriptor.non_blocking.overload3 non_blocking]``( 109337 bool mode, 109338 boost::system::error_code & ec); 109339 `` [''''»''' [link boost_asio.reference.posix__basic_stream_descriptor.non_blocking.overload3 more...]]`` 109340 109341 109342[section:overload1 posix::basic_stream_descriptor::non_blocking (1 of 3 overloads)] 109343 109344 109345['Inherited from posix::basic_descriptor.] 109346 109347 109348Gets the non-blocking mode of the descriptor. 109349 109350 109351 bool non_blocking() const; 109352 109353 109354 109355[heading Return Value] 109356 109357`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. 109358 109359 109360[heading Remarks] 109361 109362The 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`. 109363 109364 109365 109366 109367[endsect] 109368 109369 109370 109371[section:overload2 posix::basic_stream_descriptor::non_blocking (2 of 3 overloads)] 109372 109373 109374['Inherited from posix::basic_descriptor.] 109375 109376 109377Sets the non-blocking mode of the descriptor. 109378 109379 109380 void non_blocking( 109381 bool mode); 109382 109383 109384 109385[heading Parameters] 109386 109387 109388[variablelist 109389 109390[[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.]] 109391 109392] 109393 109394 109395[heading Exceptions] 109396 109397 109398[variablelist 109399 109400[[boost::system::system_error][Thrown on failure.]] 109401 109402] 109403 109404 109405[heading Remarks] 109406 109407The 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`. 109408 109409 109410 109411 109412[endsect] 109413 109414 109415 109416[section:overload3 posix::basic_stream_descriptor::non_blocking (3 of 3 overloads)] 109417 109418 109419['Inherited from posix::basic_descriptor.] 109420 109421 109422Sets the non-blocking mode of the descriptor. 109423 109424 109425 void non_blocking( 109426 bool mode, 109427 boost::system::error_code & ec); 109428 109429 109430 109431[heading Parameters] 109432 109433 109434[variablelist 109435 109436[[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.]] 109437 109438[[ec][Set to indicate what error occurred, if any.]] 109439 109440] 109441 109442 109443[heading Remarks] 109444 109445The 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`. 109446 109447 109448 109449 109450[endsect] 109451 109452 109453[endsect] 109454 109455 109456[section:operator_eq_ posix::basic_stream_descriptor::operator=] 109457 109458[indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.operator_eq_..operator=..posix::basic_stream_descriptor] 109459Move-assign a stream descriptor from another. 109460 109461 109462 basic_stream_descriptor & operator=( 109463 basic_stream_descriptor && other); 109464 109465 109466This assignment operator moves a stream descriptor from one object to another. 109467 109468 109469[heading Parameters] 109470 109471 109472[variablelist 109473 109474[[other][The other stream descriptor object from which the move will occur.]] 109475 109476] 109477 109478 109479[heading Remarks] 109480 109481Following the move, the moved-from object is in the same state as if constructed using the `basic_stream_descriptor(const executor_type&)` constructor. 109482 109483 109484 109485 109486[endsect] 109487 109488 109489[section:read_some posix::basic_stream_descriptor::read_some] 109490 109491[indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.read_some..read_some..posix::basic_stream_descriptor] 109492Read some data from the descriptor. 109493 109494 109495 template< 109496 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 109497 std::size_t ``[link boost_asio.reference.posix__basic_stream_descriptor.read_some.overload1 read_some]``( 109498 const MutableBufferSequence & buffers); 109499 `` [''''»''' [link boost_asio.reference.posix__basic_stream_descriptor.read_some.overload1 more...]]`` 109500 109501 template< 109502 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 109503 std::size_t ``[link boost_asio.reference.posix__basic_stream_descriptor.read_some.overload2 read_some]``( 109504 const MutableBufferSequence & buffers, 109505 boost::system::error_code & ec); 109506 `` [''''»''' [link boost_asio.reference.posix__basic_stream_descriptor.read_some.overload2 more...]]`` 109507 109508 109509[section:overload1 posix::basic_stream_descriptor::read_some (1 of 2 overloads)] 109510 109511 109512Read some data from the descriptor. 109513 109514 109515 template< 109516 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 109517 std::size_t read_some( 109518 const MutableBufferSequence & buffers); 109519 109520 109521This 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. 109522 109523 109524[heading Parameters] 109525 109526 109527[variablelist 109528 109529[[buffers][One or more buffers into which the data will be read.]] 109530 109531] 109532 109533 109534[heading Return Value] 109535 109536The number of bytes read. 109537 109538 109539[heading Exceptions] 109540 109541 109542[variablelist 109543 109544[[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]] 109545 109546] 109547 109548 109549[heading Remarks] 109550 109551The 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. 109552 109553 109554[heading Example] 109555 109556To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 109557 109558 descriptor.read_some(boost::asio::buffer(data, size)); 109559 109560 109561See 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. 109562 109563 109564 109565 109566[endsect] 109567 109568 109569 109570[section:overload2 posix::basic_stream_descriptor::read_some (2 of 2 overloads)] 109571 109572 109573Read some data from the descriptor. 109574 109575 109576 template< 109577 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 109578 std::size_t read_some( 109579 const MutableBufferSequence & buffers, 109580 boost::system::error_code & ec); 109581 109582 109583This 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. 109584 109585 109586[heading Parameters] 109587 109588 109589[variablelist 109590 109591[[buffers][One or more buffers into which the data will be read.]] 109592 109593[[ec][Set to indicate what error occurred, if any.]] 109594 109595] 109596 109597 109598[heading Return Value] 109599 109600The number of bytes read. Returns 0 if an error occurred. 109601 109602 109603[heading Remarks] 109604 109605The 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. 109606 109607 109608 109609 109610[endsect] 109611 109612 109613[endsect] 109614 109615 109616[section:release posix::basic_stream_descriptor::release] 109617 109618 109619['Inherited from posix::basic_descriptor.] 109620 109621[indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.release..release..posix::basic_stream_descriptor] 109622Release ownership of the native descriptor implementation. 109623 109624 109625 native_handle_type release(); 109626 109627 109628This 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. 109629 109630All 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. 109631 109632 109633[endsect] 109634 109635 109636[section:wait posix::basic_stream_descriptor::wait] 109637 109638[indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.wait..wait..posix::basic_stream_descriptor] 109639Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. 109640 109641 109642 void ``[link boost_asio.reference.posix__basic_stream_descriptor.wait.overload1 wait]``( 109643 wait_type w); 109644 `` [''''»''' [link boost_asio.reference.posix__basic_stream_descriptor.wait.overload1 more...]]`` 109645 109646 void ``[link boost_asio.reference.posix__basic_stream_descriptor.wait.overload2 wait]``( 109647 wait_type w, 109648 boost::system::error_code & ec); 109649 `` [''''»''' [link boost_asio.reference.posix__basic_stream_descriptor.wait.overload2 more...]]`` 109650 109651 109652[section:overload1 posix::basic_stream_descriptor::wait (1 of 2 overloads)] 109653 109654 109655['Inherited from posix::basic_descriptor.] 109656 109657 109658Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. 109659 109660 109661 void wait( 109662 wait_type w); 109663 109664 109665This function is used to perform a blocking wait for a descriptor to enter a ready to read, write or error condition state. 109666 109667 109668[heading Parameters] 109669 109670 109671[variablelist 109672 109673[[w][Specifies the desired descriptor state.]] 109674 109675] 109676 109677 109678[heading Example] 109679 109680Waiting for a descriptor to become readable. 109681 109682 boost::asio::posix::stream_descriptor descriptor(my_context); 109683 ... 109684 descriptor.wait(boost::asio::posix::stream_descriptor::wait_read); 109685 109686 109687 109688 109689 109690 109691 109692[endsect] 109693 109694 109695 109696[section:overload2 posix::basic_stream_descriptor::wait (2 of 2 overloads)] 109697 109698 109699['Inherited from posix::basic_descriptor.] 109700 109701 109702Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. 109703 109704 109705 void wait( 109706 wait_type w, 109707 boost::system::error_code & ec); 109708 109709 109710This function is used to perform a blocking wait for a descriptor to enter a ready to read, write or error condition state. 109711 109712 109713[heading Parameters] 109714 109715 109716[variablelist 109717 109718[[w][Specifies the desired descriptor state.]] 109719 109720[[ec][Set to indicate what error occurred, if any.]] 109721 109722] 109723 109724 109725[heading Example] 109726 109727Waiting for a descriptor to become readable. 109728 109729 boost::asio::posix::stream_descriptor descriptor(my_context); 109730 ... 109731 boost::system::error_code ec; 109732 descriptor.wait(boost::asio::posix::stream_descriptor::wait_read, ec); 109733 109734 109735 109736 109737 109738 109739 109740[endsect] 109741 109742 109743[endsect] 109744 109745 109746[section:wait_type posix::basic_stream_descriptor::wait_type] 109747 109748 109749['Inherited from posix::descriptor_base.] 109750 109751[indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.wait_type..wait_type..posix::basic_stream_descriptor] 109752Wait types. 109753 109754 109755 enum wait_type 109756 109757[indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.wait_type.wait_read..wait_read..posix::basic_stream_descriptor] 109758[indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.wait_type.wait_write..wait_write..posix::basic_stream_descriptor] 109759[indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.wait_type.wait_error..wait_error..posix::basic_stream_descriptor] 109760 109761[heading Values] 109762[variablelist 109763 109764 [ 109765 [wait_read] 109766 [Wait for a descriptor to become ready to read. ] 109767 ] 109768 109769 [ 109770 [wait_write] 109771 [Wait for a descriptor to become ready to write. ] 109772 ] 109773 109774 [ 109775 [wait_error] 109776 [Wait for a descriptor to have error conditions pending. ] 109777 ] 109778 109779] 109780 109781 109782For use with `descriptor::wait()` and `descriptor::async_wait()`. 109783 109784 109785[endsect] 109786 109787 109788[section:write_some posix::basic_stream_descriptor::write_some] 109789 109790[indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.write_some..write_some..posix::basic_stream_descriptor] 109791Write some data to the descriptor. 109792 109793 109794 template< 109795 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 109796 std::size_t ``[link boost_asio.reference.posix__basic_stream_descriptor.write_some.overload1 write_some]``( 109797 const ConstBufferSequence & buffers); 109798 `` [''''»''' [link boost_asio.reference.posix__basic_stream_descriptor.write_some.overload1 more...]]`` 109799 109800 template< 109801 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 109802 std::size_t ``[link boost_asio.reference.posix__basic_stream_descriptor.write_some.overload2 write_some]``( 109803 const ConstBufferSequence & buffers, 109804 boost::system::error_code & ec); 109805 `` [''''»''' [link boost_asio.reference.posix__basic_stream_descriptor.write_some.overload2 more...]]`` 109806 109807 109808[section:overload1 posix::basic_stream_descriptor::write_some (1 of 2 overloads)] 109809 109810 109811Write some data to the descriptor. 109812 109813 109814 template< 109815 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 109816 std::size_t write_some( 109817 const ConstBufferSequence & buffers); 109818 109819 109820This 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. 109821 109822 109823[heading Parameters] 109824 109825 109826[variablelist 109827 109828[[buffers][One or more data buffers to be written to the descriptor.]] 109829 109830] 109831 109832 109833[heading Return Value] 109834 109835The number of bytes written. 109836 109837 109838[heading Exceptions] 109839 109840 109841[variablelist 109842 109843[[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]] 109844 109845] 109846 109847 109848[heading Remarks] 109849 109850The 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. 109851 109852 109853[heading Example] 109854 109855To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 109856 109857 descriptor.write_some(boost::asio::buffer(data, size)); 109858 109859 109860See 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. 109861 109862 109863 109864 109865[endsect] 109866 109867 109868 109869[section:overload2 posix::basic_stream_descriptor::write_some (2 of 2 overloads)] 109870 109871 109872Write some data to the descriptor. 109873 109874 109875 template< 109876 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 109877 std::size_t write_some( 109878 const ConstBufferSequence & buffers, 109879 boost::system::error_code & ec); 109880 109881 109882This 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. 109883 109884 109885[heading Parameters] 109886 109887 109888[variablelist 109889 109890[[buffers][One or more data buffers to be written to the descriptor.]] 109891 109892[[ec][Set to indicate what error occurred, if any.]] 109893 109894] 109895 109896 109897[heading Return Value] 109898 109899The number of bytes written. Returns 0 if an error occurred. 109900 109901 109902[heading Remarks] 109903 109904The 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. 109905 109906 109907 109908 109909[endsect] 109910 109911 109912[endsect] 109913 109914 109915[endsect] 109916 109917[section:posix__basic_stream_descriptor__rebind_executor posix::basic_stream_descriptor::rebind_executor] 109918 109919[indexterm1 boost_asio.indexterm.posix__basic_stream_descriptor__rebind_executor..posix::basic_stream_descriptor::rebind_executor] 109920 109921 109922Rebinds the descriptor type to another executor. 109923 109924 109925 template< 109926 typename ``[link boost_asio.reference.Executor1 Executor1]``> 109927 struct rebind_executor 109928 109929 109930[heading Types] 109931[table 109932 [[Name][Description]] 109933 109934 [ 109935 109936 [[link boost_asio.reference.posix__basic_stream_descriptor__rebind_executor.other [*other]]] 109937 [The descriptor type when rebound to the specified executor. ] 109938 109939 ] 109940 109941] 109942 109943[heading Requirements] 109944 109945['Header: ][^boost/asio/posix/basic_stream_descriptor.hpp] 109946 109947['Convenience header: ][^boost/asio.hpp] 109948 109949 109950[section:other posix::basic_stream_descriptor::rebind_executor::other] 109951 109952[indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor__rebind_executor.other..other..posix::basic_stream_descriptor::rebind_executor] 109953The descriptor type when rebound to the specified executor. 109954 109955 109956 typedef basic_stream_descriptor< Executor1 > other; 109957 109958 109959[heading Types] 109960[table 109961 [[Name][Description]] 109962 109963 [ 109964 109965 [[link boost_asio.reference.posix__basic_stream_descriptor__rebind_executor [*rebind_executor]]] 109966 [Rebinds the descriptor type to another executor. ] 109967 109968 ] 109969 109970 [ 109971 109972 [[link boost_asio.reference.posix__basic_stream_descriptor.bytes_readable [*bytes_readable]]] 109973 [IO control command to get the amount of data that can be read without blocking. ] 109974 109975 ] 109976 109977 [ 109978 109979 [[link boost_asio.reference.posix__basic_stream_descriptor.executor_type [*executor_type]]] 109980 [The type of the executor associated with the object. ] 109981 109982 ] 109983 109984 [ 109985 109986 [[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer_type [*lowest_layer_type]]] 109987 [A descriptor is always the lowest layer. ] 109988 109989 ] 109990 109991 [ 109992 109993 [[link boost_asio.reference.posix__basic_stream_descriptor.native_handle_type [*native_handle_type]]] 109994 [The native representation of a descriptor. ] 109995 109996 ] 109997 109998 [ 109999 110000 [[link boost_asio.reference.posix__basic_stream_descriptor.wait_type [*wait_type]]] 110001 [Wait types. ] 110002 110003 ] 110004 110005] 110006 110007[heading Member Functions] 110008[table 110009 [[Name][Description]] 110010 110011 [ 110012 [[link boost_asio.reference.posix__basic_stream_descriptor.assign [*assign]]] 110013 [Assign an existing native descriptor to the descriptor. ] 110014 ] 110015 110016 [ 110017 [[link boost_asio.reference.posix__basic_stream_descriptor.async_read_some [*async_read_some]]] 110018 [Start an asynchronous read. ] 110019 ] 110020 110021 [ 110022 [[link boost_asio.reference.posix__basic_stream_descriptor.async_wait [*async_wait]]] 110023 [Asynchronously wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ] 110024 ] 110025 110026 [ 110027 [[link boost_asio.reference.posix__basic_stream_descriptor.async_write_some [*async_write_some]]] 110028 [Start an asynchronous write. ] 110029 ] 110030 110031 [ 110032 [[link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor [*basic_stream_descriptor]] [constructor]] 110033 [Construct a stream descriptor without opening it. 110034 [hr] 110035 Construct a stream descriptor on an existing native descriptor. 110036 [hr] 110037 Move-construct a stream descriptor from another. ] 110038 ] 110039 110040 [ 110041 [[link boost_asio.reference.posix__basic_stream_descriptor.cancel [*cancel]]] 110042 [Cancel all asynchronous operations associated with the descriptor. ] 110043 ] 110044 110045 [ 110046 [[link boost_asio.reference.posix__basic_stream_descriptor.close [*close]]] 110047 [Close the descriptor. ] 110048 ] 110049 110050 [ 110051 [[link boost_asio.reference.posix__basic_stream_descriptor.get_executor [*get_executor]]] 110052 [Get the executor associated with the object. ] 110053 ] 110054 110055 [ 110056 [[link boost_asio.reference.posix__basic_stream_descriptor.io_control [*io_control]]] 110057 [Perform an IO control command on the descriptor. ] 110058 ] 110059 110060 [ 110061 [[link boost_asio.reference.posix__basic_stream_descriptor.is_open [*is_open]]] 110062 [Determine whether the descriptor is open. ] 110063 ] 110064 110065 [ 110066 [[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer [*lowest_layer]]] 110067 [Get a reference to the lowest layer. 110068 [hr] 110069 Get a const reference to the lowest layer. ] 110070 ] 110071 110072 [ 110073 [[link boost_asio.reference.posix__basic_stream_descriptor.native_handle [*native_handle]]] 110074 [Get the native descriptor representation. ] 110075 ] 110076 110077 [ 110078 [[link boost_asio.reference.posix__basic_stream_descriptor.native_non_blocking [*native_non_blocking]]] 110079 [Gets the non-blocking mode of the native descriptor implementation. 110080 [hr] 110081 Sets the non-blocking mode of the native descriptor implementation. ] 110082 ] 110083 110084 [ 110085 [[link boost_asio.reference.posix__basic_stream_descriptor.non_blocking [*non_blocking]]] 110086 [Gets the non-blocking mode of the descriptor. 110087 [hr] 110088 Sets the non-blocking mode of the descriptor. ] 110089 ] 110090 110091 [ 110092 [[link boost_asio.reference.posix__basic_stream_descriptor.operator_eq_ [*operator=]]] 110093 [Move-assign a stream descriptor from another. ] 110094 ] 110095 110096 [ 110097 [[link boost_asio.reference.posix__basic_stream_descriptor.read_some [*read_some]]] 110098 [Read some data from the descriptor. ] 110099 ] 110100 110101 [ 110102 [[link boost_asio.reference.posix__basic_stream_descriptor.release [*release]]] 110103 [Release ownership of the native descriptor implementation. ] 110104 ] 110105 110106 [ 110107 [[link boost_asio.reference.posix__basic_stream_descriptor.wait [*wait]]] 110108 [Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ] 110109 ] 110110 110111 [ 110112 [[link boost_asio.reference.posix__basic_stream_descriptor.write_some [*write_some]]] 110113 [Write some data to the descriptor. ] 110114 ] 110115 110116] 110117 110118The [link boost_asio.reference.posix__basic_stream_descriptor `posix::basic_stream_descriptor`] class template provides asynchronous and blocking stream-oriented descriptor functionality. 110119 110120 110121[heading Thread Safety] 110122 110123['Distinct] ['objects:] Safe. 110124 110125['Shared] ['objects:] Unsafe. 110126 110127Synchronous `read_some` and `write_some` operations are thread safe with respect to each other, if the underlying operating system calls are also thread safe. This means that it is permitted to perform concurrent calls to these synchronous operations on a single descriptor object. Other synchronous operations, such as `close`, are not thread safe. 110128 110129 110130 110131 110132 110133[heading Requirements] 110134 110135['Header: ][^boost/asio/posix/basic_stream_descriptor.hpp] 110136 110137['Convenience header: ][^boost/asio.hpp] 110138 110139 110140[endsect] 110141 110142 110143 110144[endsect] 110145 110146 110147[section:posix__descriptor posix::descriptor] 110148 110149[indexterm1 boost_asio.indexterm.posix__descriptor..posix::descriptor] 110150Typedef for the typical usage of [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`]. 110151 110152 110153 typedef basic_descriptor descriptor; 110154 110155 110156[heading Types] 110157[table 110158 [[Name][Description]] 110159 110160 [ 110161 110162 [[link boost_asio.reference.posix__basic_descriptor__rebind_executor [*rebind_executor]]] 110163 [Rebinds the descriptor type to another executor. ] 110164 110165 ] 110166 110167 [ 110168 110169 [[link boost_asio.reference.posix__basic_descriptor.bytes_readable [*bytes_readable]]] 110170 [IO control command to get the amount of data that can be read without blocking. ] 110171 110172 ] 110173 110174 [ 110175 110176 [[link boost_asio.reference.posix__basic_descriptor.executor_type [*executor_type]]] 110177 [The type of the executor associated with the object. ] 110178 110179 ] 110180 110181 [ 110182 110183 [[link boost_asio.reference.posix__basic_descriptor.lowest_layer_type [*lowest_layer_type]]] 110184 [A descriptor is always the lowest layer. ] 110185 110186 ] 110187 110188 [ 110189 110190 [[link boost_asio.reference.posix__basic_descriptor.native_handle_type [*native_handle_type]]] 110191 [The native representation of a descriptor. ] 110192 110193 ] 110194 110195 [ 110196 110197 [[link boost_asio.reference.posix__basic_descriptor.wait_type [*wait_type]]] 110198 [Wait types. ] 110199 110200 ] 110201 110202] 110203 110204[heading Member Functions] 110205[table 110206 [[Name][Description]] 110207 110208 [ 110209 [[link boost_asio.reference.posix__basic_descriptor.assign [*assign]]] 110210 [Assign an existing native descriptor to the descriptor. ] 110211 ] 110212 110213 [ 110214 [[link boost_asio.reference.posix__basic_descriptor.async_wait [*async_wait]]] 110215 [Asynchronously wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ] 110216 ] 110217 110218 [ 110219 [[link boost_asio.reference.posix__basic_descriptor.basic_descriptor [*basic_descriptor]] [constructor]] 110220 [Construct a descriptor without opening it. 110221 [hr] 110222 Construct a descriptor on an existing native descriptor. 110223 [hr] 110224 Move-construct a descriptor from another. ] 110225 ] 110226 110227 [ 110228 [[link boost_asio.reference.posix__basic_descriptor.cancel [*cancel]]] 110229 [Cancel all asynchronous operations associated with the descriptor. ] 110230 ] 110231 110232 [ 110233 [[link boost_asio.reference.posix__basic_descriptor.close [*close]]] 110234 [Close the descriptor. ] 110235 ] 110236 110237 [ 110238 [[link boost_asio.reference.posix__basic_descriptor.get_executor [*get_executor]]] 110239 [Get the executor associated with the object. ] 110240 ] 110241 110242 [ 110243 [[link boost_asio.reference.posix__basic_descriptor.io_control [*io_control]]] 110244 [Perform an IO control command on the descriptor. ] 110245 ] 110246 110247 [ 110248 [[link boost_asio.reference.posix__basic_descriptor.is_open [*is_open]]] 110249 [Determine whether the descriptor is open. ] 110250 ] 110251 110252 [ 110253 [[link boost_asio.reference.posix__basic_descriptor.lowest_layer [*lowest_layer]]] 110254 [Get a reference to the lowest layer. 110255 [hr] 110256 Get a const reference to the lowest layer. ] 110257 ] 110258 110259 [ 110260 [[link boost_asio.reference.posix__basic_descriptor.native_handle [*native_handle]]] 110261 [Get the native descriptor representation. ] 110262 ] 110263 110264 [ 110265 [[link boost_asio.reference.posix__basic_descriptor.native_non_blocking [*native_non_blocking]]] 110266 [Gets the non-blocking mode of the native descriptor implementation. 110267 [hr] 110268 Sets the non-blocking mode of the native descriptor implementation. ] 110269 ] 110270 110271 [ 110272 [[link boost_asio.reference.posix__basic_descriptor.non_blocking [*non_blocking]]] 110273 [Gets the non-blocking mode of the descriptor. 110274 [hr] 110275 Sets the non-blocking mode of the descriptor. ] 110276 ] 110277 110278 [ 110279 [[link boost_asio.reference.posix__basic_descriptor.operator_eq_ [*operator=]]] 110280 [Move-assign a descriptor from another. ] 110281 ] 110282 110283 [ 110284 [[link boost_asio.reference.posix__basic_descriptor.release [*release]]] 110285 [Release ownership of the native descriptor implementation. ] 110286 ] 110287 110288 [ 110289 [[link boost_asio.reference.posix__basic_descriptor.wait [*wait]]] 110290 [Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ] 110291 ] 110292 110293] 110294 110295[heading Protected Member Functions] 110296[table 110297 [[Name][Description]] 110298 110299 [ 110300 [[link boost_asio.reference.posix__basic_descriptor._basic_descriptor [*~basic_descriptor]] [destructor]] 110301 [Protected destructor to prevent deletion through this type. ] 110302 ] 110303 110304] 110305 110306The [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] class template provides the ability to wrap a POSIX descriptor. 110307 110308 110309[heading Thread Safety] 110310 110311['Distinct] ['objects:] Safe. 110312 110313['Shared] ['objects:] Unsafe. 110314 110315 110316 110317 110318[heading Requirements] 110319 110320['Header: ][^boost/asio/posix/descriptor.hpp] 110321 110322['Convenience header: ][^boost/asio.hpp] 110323 110324 110325[endsect] 110326 110327 110328[section:posix__descriptor_base posix::descriptor_base] 110329 110330[indexterm1 boost_asio.indexterm.posix__descriptor_base..posix::descriptor_base] 110331 110332 110333The [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. 110334 110335 110336 class descriptor_base 110337 110338 110339[heading Types] 110340[table 110341 [[Name][Description]] 110342 110343 [ 110344 110345 [[link boost_asio.reference.posix__descriptor_base.bytes_readable [*bytes_readable]]] 110346 [IO control command to get the amount of data that can be read without blocking. ] 110347 110348 ] 110349 110350 [ 110351 110352 [[link boost_asio.reference.posix__descriptor_base.wait_type [*wait_type]]] 110353 [Wait types. ] 110354 110355 ] 110356 110357] 110358 110359[heading Protected Member Functions] 110360[table 110361 [[Name][Description]] 110362 110363 [ 110364 [[link boost_asio.reference.posix__descriptor_base._descriptor_base [*~descriptor_base]] [destructor]] 110365 [Protected destructor to prevent deletion through this type. ] 110366 ] 110367 110368] 110369 110370[heading Requirements] 110371 110372['Header: ][^boost/asio/posix/descriptor_base.hpp] 110373 110374['Convenience header: ][^boost/asio.hpp] 110375 110376 110377[section:bytes_readable posix::descriptor_base::bytes_readable] 110378 110379[indexterm2 boost_asio.indexterm.posix__descriptor_base.bytes_readable..bytes_readable..posix::descriptor_base] 110380IO control command to get the amount of data that can be read without blocking. 110381 110382 110383 typedef implementation_defined bytes_readable; 110384 110385 110386 110387Implements the FIONREAD IO control command. 110388 110389 110390[heading Example] 110391 110392 110393 110394 boost::asio::posix::stream_descriptor descriptor(my_context); 110395 ... 110396 boost::asio::descriptor_base::bytes_readable command(true); 110397 descriptor.io_control(command); 110398 std::size_t bytes_readable = command.get(); 110399 110400 110401 110402 110403 110404 110405 110406[heading Requirements] 110407 110408['Header: ][^boost/asio/posix/descriptor_base.hpp] 110409 110410['Convenience header: ][^boost/asio.hpp] 110411 110412 110413[endsect] 110414 110415 110416 110417[section:wait_type posix::descriptor_base::wait_type] 110418 110419[indexterm2 boost_asio.indexterm.posix__descriptor_base.wait_type..wait_type..posix::descriptor_base] 110420Wait types. 110421 110422 110423 enum wait_type 110424 110425[indexterm2 boost_asio.indexterm.posix__descriptor_base.wait_type.wait_read..wait_read..posix::descriptor_base] 110426[indexterm2 boost_asio.indexterm.posix__descriptor_base.wait_type.wait_write..wait_write..posix::descriptor_base] 110427[indexterm2 boost_asio.indexterm.posix__descriptor_base.wait_type.wait_error..wait_error..posix::descriptor_base] 110428 110429[heading Values] 110430[variablelist 110431 110432 [ 110433 [wait_read] 110434 [Wait for a descriptor to become ready to read. ] 110435 ] 110436 110437 [ 110438 [wait_write] 110439 [Wait for a descriptor to become ready to write. ] 110440 ] 110441 110442 [ 110443 [wait_error] 110444 [Wait for a descriptor to have error conditions pending. ] 110445 ] 110446 110447] 110448 110449 110450For use with `descriptor::wait()` and `descriptor::async_wait()`. 110451 110452 110453[endsect] 110454 110455 110456 110457[section:_descriptor_base posix::descriptor_base::~descriptor_base] 110458 110459[indexterm2 boost_asio.indexterm.posix__descriptor_base._descriptor_base..~descriptor_base..posix::descriptor_base] 110460Protected destructor to prevent deletion through this type. 110461 110462 110463 ~descriptor_base(); 110464 110465 110466 110467[endsect] 110468 110469 110470 110471[endsect] 110472 110473 110474[section:posix__stream_descriptor posix::stream_descriptor] 110475 110476[indexterm1 boost_asio.indexterm.posix__stream_descriptor..posix::stream_descriptor] 110477Typedef for the typical usage of a stream-oriented descriptor. 110478 110479 110480 typedef basic_stream_descriptor stream_descriptor; 110481 110482 110483[heading Types] 110484[table 110485 [[Name][Description]] 110486 110487 [ 110488 110489 [[link boost_asio.reference.posix__basic_stream_descriptor__rebind_executor [*rebind_executor]]] 110490 [Rebinds the descriptor type to another executor. ] 110491 110492 ] 110493 110494 [ 110495 110496 [[link boost_asio.reference.posix__basic_stream_descriptor.bytes_readable [*bytes_readable]]] 110497 [IO control command to get the amount of data that can be read without blocking. ] 110498 110499 ] 110500 110501 [ 110502 110503 [[link boost_asio.reference.posix__basic_stream_descriptor.executor_type [*executor_type]]] 110504 [The type of the executor associated with the object. ] 110505 110506 ] 110507 110508 [ 110509 110510 [[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer_type [*lowest_layer_type]]] 110511 [A descriptor is always the lowest layer. ] 110512 110513 ] 110514 110515 [ 110516 110517 [[link boost_asio.reference.posix__basic_stream_descriptor.native_handle_type [*native_handle_type]]] 110518 [The native representation of a descriptor. ] 110519 110520 ] 110521 110522 [ 110523 110524 [[link boost_asio.reference.posix__basic_stream_descriptor.wait_type [*wait_type]]] 110525 [Wait types. ] 110526 110527 ] 110528 110529] 110530 110531[heading Member Functions] 110532[table 110533 [[Name][Description]] 110534 110535 [ 110536 [[link boost_asio.reference.posix__basic_stream_descriptor.assign [*assign]]] 110537 [Assign an existing native descriptor to the descriptor. ] 110538 ] 110539 110540 [ 110541 [[link boost_asio.reference.posix__basic_stream_descriptor.async_read_some [*async_read_some]]] 110542 [Start an asynchronous read. ] 110543 ] 110544 110545 [ 110546 [[link boost_asio.reference.posix__basic_stream_descriptor.async_wait [*async_wait]]] 110547 [Asynchronously wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ] 110548 ] 110549 110550 [ 110551 [[link boost_asio.reference.posix__basic_stream_descriptor.async_write_some [*async_write_some]]] 110552 [Start an asynchronous write. ] 110553 ] 110554 110555 [ 110556 [[link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor [*basic_stream_descriptor]] [constructor]] 110557 [Construct a stream descriptor without opening it. 110558 [hr] 110559 Construct a stream descriptor on an existing native descriptor. 110560 [hr] 110561 Move-construct a stream descriptor from another. ] 110562 ] 110563 110564 [ 110565 [[link boost_asio.reference.posix__basic_stream_descriptor.cancel [*cancel]]] 110566 [Cancel all asynchronous operations associated with the descriptor. ] 110567 ] 110568 110569 [ 110570 [[link boost_asio.reference.posix__basic_stream_descriptor.close [*close]]] 110571 [Close the descriptor. ] 110572 ] 110573 110574 [ 110575 [[link boost_asio.reference.posix__basic_stream_descriptor.get_executor [*get_executor]]] 110576 [Get the executor associated with the object. ] 110577 ] 110578 110579 [ 110580 [[link boost_asio.reference.posix__basic_stream_descriptor.io_control [*io_control]]] 110581 [Perform an IO control command on the descriptor. ] 110582 ] 110583 110584 [ 110585 [[link boost_asio.reference.posix__basic_stream_descriptor.is_open [*is_open]]] 110586 [Determine whether the descriptor is open. ] 110587 ] 110588 110589 [ 110590 [[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer [*lowest_layer]]] 110591 [Get a reference to the lowest layer. 110592 [hr] 110593 Get a const reference to the lowest layer. ] 110594 ] 110595 110596 [ 110597 [[link boost_asio.reference.posix__basic_stream_descriptor.native_handle [*native_handle]]] 110598 [Get the native descriptor representation. ] 110599 ] 110600 110601 [ 110602 [[link boost_asio.reference.posix__basic_stream_descriptor.native_non_blocking [*native_non_blocking]]] 110603 [Gets the non-blocking mode of the native descriptor implementation. 110604 [hr] 110605 Sets the non-blocking mode of the native descriptor implementation. ] 110606 ] 110607 110608 [ 110609 [[link boost_asio.reference.posix__basic_stream_descriptor.non_blocking [*non_blocking]]] 110610 [Gets the non-blocking mode of the descriptor. 110611 [hr] 110612 Sets the non-blocking mode of the descriptor. ] 110613 ] 110614 110615 [ 110616 [[link boost_asio.reference.posix__basic_stream_descriptor.operator_eq_ [*operator=]]] 110617 [Move-assign a stream descriptor from another. ] 110618 ] 110619 110620 [ 110621 [[link boost_asio.reference.posix__basic_stream_descriptor.read_some [*read_some]]] 110622 [Read some data from the descriptor. ] 110623 ] 110624 110625 [ 110626 [[link boost_asio.reference.posix__basic_stream_descriptor.release [*release]]] 110627 [Release ownership of the native descriptor implementation. ] 110628 ] 110629 110630 [ 110631 [[link boost_asio.reference.posix__basic_stream_descriptor.wait [*wait]]] 110632 [Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ] 110633 ] 110634 110635 [ 110636 [[link boost_asio.reference.posix__basic_stream_descriptor.write_some [*write_some]]] 110637 [Write some data to the descriptor. ] 110638 ] 110639 110640] 110641 110642The [link boost_asio.reference.posix__basic_stream_descriptor `posix::basic_stream_descriptor`] class template provides asynchronous and blocking stream-oriented descriptor functionality. 110643 110644 110645[heading Thread Safety] 110646 110647['Distinct] ['objects:] Safe. 110648 110649['Shared] ['objects:] Unsafe. 110650 110651Synchronous `read_some` and `write_some` operations are thread safe with respect to each other, if the underlying operating system calls are also thread safe. This means that it is permitted to perform concurrent calls to these synchronous operations on a single descriptor object. Other synchronous operations, such as `close`, are not thread safe. 110652 110653 110654 110655 110656 110657[heading Requirements] 110658 110659['Header: ][^boost/asio/posix/stream_descriptor.hpp] 110660 110661['Convenience header: ][^boost/asio.hpp] 110662 110663 110664[endsect] 110665 110666 110667[section:post post] 110668 110669[indexterm1 boost_asio.indexterm.post..post] 110670Submits a completion token or function object for execution. 110671 110672 template< 110673 typename CompletionToken> 110674 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.post.overload1 post]``( 110675 CompletionToken && token); 110676 `` [''''»''' [link boost_asio.reference.post.overload1 more...]]`` 110677 110678 template< 110679 typename ``[link boost_asio.reference.Executor1 Executor]``, 110680 typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 110681 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.post.overload2 post]``( 110682 const Executor & ex, 110683 CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 110684 typename constraint< execution::is_executor< Executor >::value||is_executor< Executor >::value >::type = 0); 110685 `` [''''»''' [link boost_asio.reference.post.overload2 more...]]`` 110686 110687 template< 110688 typename ExecutionContext, 110689 typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 110690 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.post.overload3 post]``( 110691 ExecutionContext & ctx, 110692 CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 110693 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 110694 `` [''''»''' [link boost_asio.reference.post.overload3 more...]]`` 110695 110696[heading Requirements] 110697 110698['Header: ][^boost/asio/post.hpp] 110699 110700['Convenience header: ][^boost/asio.hpp] 110701 110702 110703[section:overload1 post (1 of 3 overloads)] 110704 110705 110706Submits a completion token or function object for execution. 110707 110708 110709 template< 110710 typename CompletionToken> 110711 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` post( 110712 CompletionToken && token); 110713 110714 110715This 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()`. 110716 110717The 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. 110718 110719This function has the following effects: 110720 110721 110722* Constructs a function object handler of type `Handler`, initialized with `handler(forward<CompletionToken>(token))`. 110723 110724 110725* Constructs an object `result` of type `async_result<Handler>`, initializing the object as `result(handler)`. 110726 110727 110728* Obtains the handler's associated executor object `ex` by performing `get_associated_executor(handler)`. 110729 110730 110731* Obtains the handler's associated allocator object `alloc` by performing `get_associated_allocator(handler)`. 110732 110733 110734* Performs `ex.post(std::move(handler), alloc)`. 110735 110736 110737* Returns `result.get()`. 110738 110739 110740 110741 110742[endsect] 110743 110744 110745 110746[section:overload2 post (2 of 3 overloads)] 110747 110748 110749Submits a completion token or function object for execution. 110750 110751 110752 template< 110753 typename ``[link boost_asio.reference.Executor1 Executor]``, 110754 typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 110755 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` post( 110756 const Executor & ex, 110757 CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 110758 typename constraint< execution::is_executor< Executor >::value||is_executor< Executor >::value >::type = 0); 110759 110760 110761This 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()`. 110762 110763The 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. 110764 110765This function has the following effects: 110766 110767 110768* Constructs a function object handler of type `Handler`, initialized with `handler(forward<CompletionToken>(token))`. 110769 110770 110771* Constructs an object `result` of type `async_result<Handler>`, initializing the object as `result(handler)`. 110772 110773 110774* Obtains the handler's associated executor object `ex1` by performing `get_associated_executor(handler)`. 110775 110776 110777* Creates a work object `w` by performing `make_work(ex1)`. 110778 110779 110780* Obtains the handler's associated allocator object `alloc` by performing `get_associated_allocator(handler)`. 110781 110782 110783* Constructs a function object `f` with a function call operator that performs `ex1.dispatch(std::move(handler), alloc)` followed by `w.reset()`. 110784 110785 110786* Performs `Executor(ex).post(std::move(f), alloc)`. 110787 110788 110789* Returns `result.get()`. 110790 110791 110792 110793 110794[endsect] 110795 110796 110797 110798[section:overload3 post (3 of 3 overloads)] 110799 110800 110801Submits a completion token or function object for execution. 110802 110803 110804 template< 110805 typename ExecutionContext, 110806 typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 110807 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` post( 110808 ExecutionContext & ctx, 110809 CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``, 110810 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 110811 110812 110813 110814[heading Return Value] 110815 110816`post(ctx.get_executor(), forward<CompletionToken>(token))`. 110817 110818 110819 110820 110821[endsect] 110822 110823 110824[endsect] 110825 110826 110827[section:prefer prefer] 110828 110829[indexterm1 boost_asio.indexterm.prefer..prefer] 110830A customisation point that attempts to apply a property to an object. 110831 110832 110833 constexpr unspecified prefer = unspecified; 110834 110835 110836The name `prefer` denotes a customisation point object. The expression `boost::asio::prefer(E, P0, Pn...)` for some subexpressions `E` and `P0`, and where `Pn...` represents `N` subexpressions (where `N` is 0 or more, and with types `T = decay_t<decltype(E)>` and `Prop0 = decay_t<decltype(P0)>`) is expression-equivalent to: 110837 110838 110839* If `is_applicable_property_v<T, Prop0> && Prop0::is_preferable` is not a well-formed constant expression with value `true`, `boost::asio::prefer(E, P0, Pn...)` is ill-formed. 110840 110841 110842* Otherwise, `E` if `N == 0` and the expression `Prop0::template static_query_v<T> == Prop0::value()` is a well-formed constant expression with value `true`. 110843 110844 110845* Otherwise, `(E).require(P0)` if `N == 0` and the expression `(E).require(P0)` is a valid expression. 110846 110847 110848* Otherwise, `require(E, P0)` if `N == 0` and the expression `require(E, P0)` is a valid expression with overload resolution performed in a context that does not include the declaration of the `require` customization point object. 110849 110850 110851* Otherwise, `(E).prefer(P0)` if `N == 0` and the expression `(E).prefer(P0)` is a valid expression. 110852 110853 110854* Otherwise, `prefer(E, P0)` if `N == 0` and the expression `prefer(E, P0)` is a valid expression with overload resolution performed in a context that does not include the declaration of the `prefer` customization point object. 110855 110856 110857* Otherwise, `E` if `N == 0`. 110858 110859 110860* Otherwise, `boost::asio::prefer(boost::asio::prefer(E, P0), Pn...)` if `N > 0` and the expression `boost::asio::prefer(boost::asio::prefer(E, P0), Pn...)` is a valid expression. 110861 110862 110863* Otherwise, `boost::asio::prefer(E, P0, Pn...)` is ill-formed. 110864 110865 110866 110867[heading Requirements] 110868 110869['Header: ][^boost/asio/prefer.hpp] 110870 110871['Convenience header: ][^boost/asio.hpp] 110872 110873 110874[endsect] 110875 110876 110877[section:prefer_result prefer_result] 110878 110879[indexterm1 boost_asio.indexterm.prefer_result..prefer_result] 110880 110881 110882A type trait that determines the result type of a `prefer` expression. 110883 110884 110885 template< 110886 typename T, 110887 typename... Properties> 110888 struct prefer_result 110889 110890 110891[heading Types] 110892[table 110893 [[Name][Description]] 110894 110895 [ 110896 110897 [[link boost_asio.reference.prefer_result.type [*type]]] 110898 [The result of the prefer expression. ] 110899 110900 ] 110901 110902] 110903 110904Class template `prefer_result` is a trait that determines the result type of the expression `boost::asio::prefer(std::declval<T>(), std::declval<Properties>()...)`. 110905 110906[heading Requirements] 110907 110908['Header: ][^boost/asio/prefer.hpp] 110909 110910['Convenience header: ][^boost/asio.hpp] 110911 110912 110913[section:type prefer_result::type] 110914 110915[indexterm2 boost_asio.indexterm.prefer_result.type..type..prefer_result] 110916The result of the `prefer` expression. 110917 110918 110919 typedef automatically_determined type; 110920 110921 110922 110923[heading Requirements] 110924 110925['Header: ][^boost/asio/prefer.hpp] 110926 110927['Convenience header: ][^boost/asio.hpp] 110928 110929 110930[endsect] 110931 110932 110933 110934[endsect] 110935 110936 110937[section:query query] 110938 110939[indexterm1 boost_asio.indexterm.query..query] 110940A customisation point that queries the value of a property. 110941 110942 110943 constexpr unspecified query = unspecified; 110944 110945 110946The name `query` denotes a customization point object. The expression `boost::asio::query(E, P)` for some subexpressions `E` and `P` (with types `T = decay_t<decltype(E)>` and `Prop = decay_t<decltype(P)>`) is expression-equivalent to: 110947 110948 110949* If `is_applicable_property_v<T, Prop>` is not a well-formed constant expression with value `true`, `boost::asio::query(E, P)` is ill-formed. 110950 110951 110952* Otherwise, `Prop::template static_query_v<T>` if the expression `Prop::template static_query_v<T>` is a well-formed constant expression. 110953 110954 110955* Otherwise, `(E).query(P)` if the expression `(E).query(P)` is well-formed. 110956 110957 110958* Otherwise, `query(E, P)` if the expression `query(E, P)` is a valid expression with overload resolution performed in a context that does not include the declaration of the `query` customization point object. 110959 110960 110961* Otherwise, `boost::asio::query(E, P)` is ill-formed. 110962 110963 110964 110965[heading Requirements] 110966 110967['Header: ][^boost/asio/query.hpp] 110968 110969['Convenience header: ][^boost/asio.hpp] 110970 110971 110972[endsect] 110973 110974 110975[section:query_result query_result] 110976 110977[indexterm1 boost_asio.indexterm.query_result..query_result] 110978 110979 110980A type trait that determines the result type of a `query` expression. 110981 110982 110983 template< 110984 typename T, 110985 typename Property> 110986 struct query_result 110987 110988 110989[heading Types] 110990[table 110991 [[Name][Description]] 110992 110993 [ 110994 110995 [[link boost_asio.reference.query_result.type [*type]]] 110996 [The result of the query expression. ] 110997 110998 ] 110999 111000] 111001 111002Class template `query_result` is a trait that determines the result type of the expression `boost::asio::query(std::declval<T>(), std::declval<Property>())`. 111003 111004[heading Requirements] 111005 111006['Header: ][^boost/asio/query.hpp] 111007 111008['Convenience header: ][^boost/asio.hpp] 111009 111010 111011[section:type query_result::type] 111012 111013[indexterm2 boost_asio.indexterm.query_result.type..type..query_result] 111014The result of the `query` expression. 111015 111016 111017 typedef automatically_determined type; 111018 111019 111020 111021[heading Requirements] 111022 111023['Header: ][^boost/asio/query.hpp] 111024 111025['Convenience header: ][^boost/asio.hpp] 111026 111027 111028[endsect] 111029 111030 111031 111032[endsect] 111033 111034[section:read read] 111035 111036[indexterm1 boost_asio.indexterm.read..read] 111037The `read` function is a composed operation that reads a certain amount of data from a stream before returning. 111038 111039 111040Attempt to read a certain amount of data from a stream before returning. 111041 111042 template< 111043 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 111044 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 111045 std::size_t ``[link boost_asio.reference.read.overload1 read]``( 111046 SyncReadStream & s, 111047 const MutableBufferSequence & buffers, 111048 typename constraint< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type = 0); 111049 `` [''''»''' [link boost_asio.reference.read.overload1 more...]]`` 111050 111051 template< 111052 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 111053 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 111054 std::size_t ``[link boost_asio.reference.read.overload2 read]``( 111055 SyncReadStream & s, 111056 const MutableBufferSequence & buffers, 111057 boost::system::error_code & ec, 111058 typename constraint< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type = 0); 111059 `` [''''»''' [link boost_asio.reference.read.overload2 more...]]`` 111060 111061 template< 111062 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 111063 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 111064 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 111065 std::size_t ``[link boost_asio.reference.read.overload3 read]``( 111066 SyncReadStream & s, 111067 const MutableBufferSequence & buffers, 111068 CompletionCondition completion_condition, 111069 typename constraint< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type = 0); 111070 `` [''''»''' [link boost_asio.reference.read.overload3 more...]]`` 111071 111072 template< 111073 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 111074 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 111075 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 111076 std::size_t ``[link boost_asio.reference.read.overload4 read]``( 111077 SyncReadStream & s, 111078 const MutableBufferSequence & buffers, 111079 CompletionCondition completion_condition, 111080 boost::system::error_code & ec, 111081 typename constraint< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type = 0); 111082 `` [''''»''' [link boost_asio.reference.read.overload4 more...]]`` 111083 111084 template< 111085 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 111086 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``> 111087 std::size_t ``[link boost_asio.reference.read.overload5 read]``( 111088 SyncReadStream & s, 111089 DynamicBuffer_v1 && buffers, 111090 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 111091 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 111092 `` [''''»''' [link boost_asio.reference.read.overload5 more...]]`` 111093 111094 template< 111095 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 111096 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``> 111097 std::size_t ``[link boost_asio.reference.read.overload6 read]``( 111098 SyncReadStream & s, 111099 DynamicBuffer_v1 && buffers, 111100 boost::system::error_code & ec, 111101 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 111102 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 111103 `` [''''»''' [link boost_asio.reference.read.overload6 more...]]`` 111104 111105 template< 111106 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 111107 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``, 111108 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 111109 std::size_t ``[link boost_asio.reference.read.overload7 read]``( 111110 SyncReadStream & s, 111111 DynamicBuffer_v1 && buffers, 111112 CompletionCondition completion_condition, 111113 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 111114 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 111115 `` [''''»''' [link boost_asio.reference.read.overload7 more...]]`` 111116 111117 template< 111118 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 111119 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``, 111120 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 111121 std::size_t ``[link boost_asio.reference.read.overload8 read]``( 111122 SyncReadStream & s, 111123 DynamicBuffer_v1 && buffers, 111124 CompletionCondition completion_condition, 111125 boost::system::error_code & ec, 111126 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 111127 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 111128 `` [''''»''' [link boost_asio.reference.read.overload8 more...]]`` 111129 111130 template< 111131 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 111132 typename Allocator> 111133 std::size_t ``[link boost_asio.reference.read.overload9 read]``( 111134 SyncReadStream & s, 111135 basic_streambuf< Allocator > & b); 111136 `` [''''»''' [link boost_asio.reference.read.overload9 more...]]`` 111137 111138 template< 111139 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 111140 typename Allocator> 111141 std::size_t ``[link boost_asio.reference.read.overload10 read]``( 111142 SyncReadStream & s, 111143 basic_streambuf< Allocator > & b, 111144 boost::system::error_code & ec); 111145 `` [''''»''' [link boost_asio.reference.read.overload10 more...]]`` 111146 111147 template< 111148 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 111149 typename Allocator, 111150 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 111151 std::size_t ``[link boost_asio.reference.read.overload11 read]``( 111152 SyncReadStream & s, 111153 basic_streambuf< Allocator > & b, 111154 CompletionCondition completion_condition); 111155 `` [''''»''' [link boost_asio.reference.read.overload11 more...]]`` 111156 111157 template< 111158 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 111159 typename Allocator, 111160 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 111161 std::size_t ``[link boost_asio.reference.read.overload12 read]``( 111162 SyncReadStream & s, 111163 basic_streambuf< Allocator > & b, 111164 CompletionCondition completion_condition, 111165 boost::system::error_code & ec); 111166 `` [''''»''' [link boost_asio.reference.read.overload12 more...]]`` 111167 111168 template< 111169 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 111170 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``> 111171 std::size_t ``[link boost_asio.reference.read.overload13 read]``( 111172 SyncReadStream & s, 111173 DynamicBuffer_v2 buffers, 111174 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 111175 `` [''''»''' [link boost_asio.reference.read.overload13 more...]]`` 111176 111177 template< 111178 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 111179 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``> 111180 std::size_t ``[link boost_asio.reference.read.overload14 read]``( 111181 SyncReadStream & s, 111182 DynamicBuffer_v2 buffers, 111183 boost::system::error_code & ec, 111184 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 111185 `` [''''»''' [link boost_asio.reference.read.overload14 more...]]`` 111186 111187 template< 111188 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 111189 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``, 111190 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 111191 std::size_t ``[link boost_asio.reference.read.overload15 read]``( 111192 SyncReadStream & s, 111193 DynamicBuffer_v2 buffers, 111194 CompletionCondition completion_condition, 111195 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 111196 `` [''''»''' [link boost_asio.reference.read.overload15 more...]]`` 111197 111198 template< 111199 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 111200 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``, 111201 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 111202 std::size_t ``[link boost_asio.reference.read.overload16 read]``( 111203 SyncReadStream & s, 111204 DynamicBuffer_v2 buffers, 111205 CompletionCondition completion_condition, 111206 boost::system::error_code & ec, 111207 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 111208 `` [''''»''' [link boost_asio.reference.read.overload16 more...]]`` 111209 111210[heading Requirements] 111211 111212['Header: ][^boost/asio/read.hpp] 111213 111214['Convenience header: ][^boost/asio.hpp] 111215 111216 111217[section:overload1 read (1 of 16 overloads)] 111218 111219 111220Attempt to read a certain amount of data from a stream before returning. 111221 111222 111223 template< 111224 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 111225 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 111226 std::size_t read( 111227 SyncReadStream & s, 111228 const MutableBufferSequence & buffers, 111229 typename constraint< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type = 0); 111230 111231 111232This 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: 111233 111234 111235* The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes. 111236 111237 111238* An error occurred. 111239 111240This operation is implemented in terms of zero or more calls to the stream's read\_some function. 111241 111242 111243[heading Parameters] 111244 111245 111246[variablelist 111247 111248[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 111249 111250[[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.]] 111251 111252] 111253 111254 111255[heading Return Value] 111256 111257The number of bytes transferred. 111258 111259 111260[heading Exceptions] 111261 111262 111263[variablelist 111264 111265[[boost::system::system_error][Thrown on failure.]] 111266 111267] 111268 111269 111270[heading Example] 111271 111272To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 111273 111274 boost::asio::read(s, boost::asio::buffer(data, size)); 111275 111276 111277See 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. 111278 111279 111280[heading Remarks] 111281 111282This overload is equivalent to calling: 111283 111284 boost::asio::read( 111285 s, buffers, 111286 boost::asio::transfer_all()); 111287 111288 111289 111290 111291 111292 111293 111294[endsect] 111295 111296 111297 111298[section:overload2 read (2 of 16 overloads)] 111299 111300 111301Attempt to read a certain amount of data from a stream before returning. 111302 111303 111304 template< 111305 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 111306 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 111307 std::size_t read( 111308 SyncReadStream & s, 111309 const MutableBufferSequence & buffers, 111310 boost::system::error_code & ec, 111311 typename constraint< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type = 0); 111312 111313 111314This 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: 111315 111316 111317* The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes. 111318 111319 111320* An error occurred. 111321 111322This operation is implemented in terms of zero or more calls to the stream's read\_some function. 111323 111324 111325[heading Parameters] 111326 111327 111328[variablelist 111329 111330[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 111331 111332[[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.]] 111333 111334[[ec][Set to indicate what error occurred, if any.]] 111335 111336] 111337 111338 111339[heading Return Value] 111340 111341The number of bytes transferred. 111342 111343 111344[heading Example] 111345 111346To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 111347 111348 boost::asio::read(s, boost::asio::buffer(data, size), ec); 111349 111350 111351See 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. 111352 111353 111354[heading Remarks] 111355 111356This overload is equivalent to calling: 111357 111358 boost::asio::read( 111359 s, buffers, 111360 boost::asio::transfer_all(), ec); 111361 111362 111363 111364 111365 111366 111367 111368[endsect] 111369 111370 111371 111372[section:overload3 read (3 of 16 overloads)] 111373 111374 111375Attempt to read a certain amount of data from a stream before returning. 111376 111377 111378 template< 111379 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 111380 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 111381 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 111382 std::size_t read( 111383 SyncReadStream & s, 111384 const MutableBufferSequence & buffers, 111385 CompletionCondition completion_condition, 111386 typename constraint< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type = 0); 111387 111388 111389This 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: 111390 111391 111392* The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes. 111393 111394 111395* The completion\_condition function object returns 0. 111396 111397This operation is implemented in terms of zero or more calls to the stream's read\_some function. 111398 111399 111400[heading Parameters] 111401 111402 111403[variablelist 111404 111405[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 111406 111407[[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.]] 111408 111409[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 111410`` 111411 std::size_t completion_condition( 111412 // Result of latest read_some operation. 111413 const boost::system::error_code& error, 111414 111415 // Number of bytes transferred so far. 111416 std::size_t bytes_transferred 111417 ); 111418`` 111419A 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.]] 111420 111421] 111422 111423 111424[heading Return Value] 111425 111426The number of bytes transferred. 111427 111428 111429[heading Exceptions] 111430 111431 111432[variablelist 111433 111434[[boost::system::system_error][Thrown on failure.]] 111435 111436] 111437 111438 111439[heading Example] 111440 111441To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 111442 111443 boost::asio::read(s, boost::asio::buffer(data, size), 111444 boost::asio::transfer_at_least(32)); 111445 111446 111447See 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. 111448 111449 111450 111451 111452[endsect] 111453 111454 111455 111456[section:overload4 read (4 of 16 overloads)] 111457 111458 111459Attempt to read a certain amount of data from a stream before returning. 111460 111461 111462 template< 111463 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 111464 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 111465 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 111466 std::size_t read( 111467 SyncReadStream & s, 111468 const MutableBufferSequence & buffers, 111469 CompletionCondition completion_condition, 111470 boost::system::error_code & ec, 111471 typename constraint< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type = 0); 111472 111473 111474This 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: 111475 111476 111477* The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes. 111478 111479 111480* The completion\_condition function object returns 0. 111481 111482This operation is implemented in terms of zero or more calls to the stream's read\_some function. 111483 111484 111485[heading Parameters] 111486 111487 111488[variablelist 111489 111490[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 111491 111492[[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.]] 111493 111494[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 111495`` 111496 std::size_t completion_condition( 111497 // Result of latest read_some operation. 111498 const boost::system::error_code& error, 111499 111500 // Number of bytes transferred so far. 111501 std::size_t bytes_transferred 111502 ); 111503`` 111504A 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.]] 111505 111506[[ec][Set to indicate what error occurred, if any.]] 111507 111508] 111509 111510 111511[heading Return Value] 111512 111513The number of bytes read. If an error occurs, returns the total number of bytes successfully transferred prior to the error. 111514 111515 111516 111517 111518[endsect] 111519 111520 111521 111522[section:overload5 read (5 of 16 overloads)] 111523 111524 111525Attempt to read a certain amount of data from a stream before returning. 111526 111527 111528 template< 111529 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 111530 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``> 111531 std::size_t read( 111532 SyncReadStream & s, 111533 DynamicBuffer_v1 && buffers, 111534 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 111535 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 111536 111537 111538This 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: 111539 111540 111541* The specified dynamic buffer sequence is full (that is, it has reached maximum size). 111542 111543 111544* An error occurred. 111545 111546This operation is implemented in terms of zero or more calls to the stream's read\_some function. 111547 111548 111549[heading Parameters] 111550 111551 111552[variablelist 111553 111554[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 111555 111556[[buffers][The dynamic buffer sequence into which the data will be read.]] 111557 111558] 111559 111560 111561[heading Return Value] 111562 111563The number of bytes transferred. 111564 111565 111566[heading Exceptions] 111567 111568 111569[variablelist 111570 111571[[boost::system::system_error][Thrown on failure.]] 111572 111573] 111574 111575 111576[heading Remarks] 111577 111578This overload is equivalent to calling: 111579 111580 boost::asio::read( 111581 s, buffers, 111582 boost::asio::transfer_all()); 111583 111584 111585 111586 111587 111588 111589 111590[endsect] 111591 111592 111593 111594[section:overload6 read (6 of 16 overloads)] 111595 111596 111597Attempt to read a certain amount of data from a stream before returning. 111598 111599 111600 template< 111601 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 111602 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``> 111603 std::size_t read( 111604 SyncReadStream & s, 111605 DynamicBuffer_v1 && buffers, 111606 boost::system::error_code & ec, 111607 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 111608 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 111609 111610 111611This 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: 111612 111613 111614* The supplied buffer is full (that is, it has reached maximum size). 111615 111616 111617* An error occurred. 111618 111619This operation is implemented in terms of zero or more calls to the stream's read\_some function. 111620 111621 111622[heading Parameters] 111623 111624 111625[variablelist 111626 111627[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 111628 111629[[buffers][The dynamic buffer sequence into which the data will be read.]] 111630 111631[[ec][Set to indicate what error occurred, if any.]] 111632 111633] 111634 111635 111636[heading Return Value] 111637 111638The number of bytes transferred. 111639 111640 111641[heading Remarks] 111642 111643This overload is equivalent to calling: 111644 111645 boost::asio::read( 111646 s, buffers, 111647 boost::asio::transfer_all(), ec); 111648 111649 111650 111651 111652 111653 111654 111655[endsect] 111656 111657 111658 111659[section:overload7 read (7 of 16 overloads)] 111660 111661 111662Attempt to read a certain amount of data from a stream before returning. 111663 111664 111665 template< 111666 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 111667 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``, 111668 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 111669 std::size_t read( 111670 SyncReadStream & s, 111671 DynamicBuffer_v1 && buffers, 111672 CompletionCondition completion_condition, 111673 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 111674 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 111675 111676 111677This 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: 111678 111679 111680* The specified dynamic buffer sequence is full (that is, it has reached maximum size). 111681 111682 111683* The completion\_condition function object returns 0. 111684 111685This operation is implemented in terms of zero or more calls to the stream's read\_some function. 111686 111687 111688[heading Parameters] 111689 111690 111691[variablelist 111692 111693[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 111694 111695[[buffers][The dynamic buffer sequence into which the data will be read.]] 111696 111697[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 111698`` 111699 std::size_t completion_condition( 111700 // Result of latest read_some operation. 111701 const boost::system::error_code& error, 111702 111703 // Number of bytes transferred so far. 111704 std::size_t bytes_transferred 111705 ); 111706`` 111707A 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.]] 111708 111709] 111710 111711 111712[heading Return Value] 111713 111714The number of bytes transferred. 111715 111716 111717[heading Exceptions] 111718 111719 111720[variablelist 111721 111722[[boost::system::system_error][Thrown on failure. ]] 111723 111724] 111725 111726 111727 111728 111729[endsect] 111730 111731 111732 111733[section:overload8 read (8 of 16 overloads)] 111734 111735 111736Attempt to read a certain amount of data from a stream before returning. 111737 111738 111739 template< 111740 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 111741 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``, 111742 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 111743 std::size_t read( 111744 SyncReadStream & s, 111745 DynamicBuffer_v1 && buffers, 111746 CompletionCondition completion_condition, 111747 boost::system::error_code & ec, 111748 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 111749 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 111750 111751 111752This 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: 111753 111754 111755* The specified dynamic buffer sequence is full (that is, it has reached maximum size). 111756 111757 111758* The completion\_condition function object returns 0. 111759 111760This operation is implemented in terms of zero or more calls to the stream's read\_some function. 111761 111762 111763[heading Parameters] 111764 111765 111766[variablelist 111767 111768[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 111769 111770[[buffers][The dynamic buffer sequence into which the data will be read.]] 111771 111772[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 111773`` 111774 std::size_t completion_condition( 111775 // Result of latest read_some operation. 111776 const boost::system::error_code& error, 111777 111778 // Number of bytes transferred so far. 111779 std::size_t bytes_transferred 111780 ); 111781`` 111782A 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.]] 111783 111784[[ec][Set to indicate what error occurred, if any.]] 111785 111786] 111787 111788 111789[heading Return Value] 111790 111791The number of bytes read. If an error occurs, returns the total number of bytes successfully transferred prior to the error. 111792 111793 111794 111795 111796[endsect] 111797 111798 111799 111800[section:overload9 read (9 of 16 overloads)] 111801 111802 111803Attempt to read a certain amount of data from a stream before returning. 111804 111805 111806 template< 111807 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 111808 typename Allocator> 111809 std::size_t read( 111810 SyncReadStream & s, 111811 basic_streambuf< Allocator > & b); 111812 111813 111814This 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: 111815 111816 111817* The supplied buffer is full (that is, it has reached maximum size). 111818 111819 111820* An error occurred. 111821 111822This operation is implemented in terms of zero or more calls to the stream's read\_some function. 111823 111824 111825[heading Parameters] 111826 111827 111828[variablelist 111829 111830[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 111831 111832[[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]] 111833 111834] 111835 111836 111837[heading Return Value] 111838 111839The number of bytes transferred. 111840 111841 111842[heading Exceptions] 111843 111844 111845[variablelist 111846 111847[[boost::system::system_error][Thrown on failure.]] 111848 111849] 111850 111851 111852[heading Remarks] 111853 111854This overload is equivalent to calling: 111855 111856 boost::asio::read( 111857 s, b, 111858 boost::asio::transfer_all()); 111859 111860 111861 111862 111863 111864 111865 111866[endsect] 111867 111868 111869 111870[section:overload10 read (10 of 16 overloads)] 111871 111872 111873Attempt to read a certain amount of data from a stream before returning. 111874 111875 111876 template< 111877 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 111878 typename Allocator> 111879 std::size_t read( 111880 SyncReadStream & s, 111881 basic_streambuf< Allocator > & b, 111882 boost::system::error_code & ec); 111883 111884 111885This 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: 111886 111887 111888* The supplied buffer is full (that is, it has reached maximum size). 111889 111890 111891* An error occurred. 111892 111893This operation is implemented in terms of zero or more calls to the stream's read\_some function. 111894 111895 111896[heading Parameters] 111897 111898 111899[variablelist 111900 111901[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 111902 111903[[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]] 111904 111905[[ec][Set to indicate what error occurred, if any.]] 111906 111907] 111908 111909 111910[heading Return Value] 111911 111912The number of bytes transferred. 111913 111914 111915[heading Remarks] 111916 111917This overload is equivalent to calling: 111918 111919 boost::asio::read( 111920 s, b, 111921 boost::asio::transfer_all(), ec); 111922 111923 111924 111925 111926 111927 111928 111929[endsect] 111930 111931 111932 111933[section:overload11 read (11 of 16 overloads)] 111934 111935 111936Attempt to read a certain amount of data from a stream before returning. 111937 111938 111939 template< 111940 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 111941 typename Allocator, 111942 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 111943 std::size_t read( 111944 SyncReadStream & s, 111945 basic_streambuf< Allocator > & b, 111946 CompletionCondition completion_condition); 111947 111948 111949This 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: 111950 111951 111952* The supplied buffer is full (that is, it has reached maximum size). 111953 111954 111955* The completion\_condition function object returns 0. 111956 111957This operation is implemented in terms of zero or more calls to the stream's read\_some function. 111958 111959 111960[heading Parameters] 111961 111962 111963[variablelist 111964 111965[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 111966 111967[[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]] 111968 111969[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 111970`` 111971 std::size_t completion_condition( 111972 // Result of latest read_some operation. 111973 const boost::system::error_code& error, 111974 111975 // Number of bytes transferred so far. 111976 std::size_t bytes_transferred 111977 ); 111978`` 111979A 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.]] 111980 111981] 111982 111983 111984[heading Return Value] 111985 111986The number of bytes transferred. 111987 111988 111989[heading Exceptions] 111990 111991 111992[variablelist 111993 111994[[boost::system::system_error][Thrown on failure. ]] 111995 111996] 111997 111998 111999 112000 112001[endsect] 112002 112003 112004 112005[section:overload12 read (12 of 16 overloads)] 112006 112007 112008Attempt to read a certain amount of data from a stream before returning. 112009 112010 112011 template< 112012 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 112013 typename Allocator, 112014 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 112015 std::size_t read( 112016 SyncReadStream & s, 112017 basic_streambuf< Allocator > & b, 112018 CompletionCondition completion_condition, 112019 boost::system::error_code & ec); 112020 112021 112022This 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: 112023 112024 112025* The supplied buffer is full (that is, it has reached maximum size). 112026 112027 112028* The completion\_condition function object returns 0. 112029 112030This operation is implemented in terms of zero or more calls to the stream's read\_some function. 112031 112032 112033[heading Parameters] 112034 112035 112036[variablelist 112037 112038[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 112039 112040[[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]] 112041 112042[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 112043`` 112044 std::size_t completion_condition( 112045 // Result of latest read_some operation. 112046 const boost::system::error_code& error, 112047 112048 // Number of bytes transferred so far. 112049 std::size_t bytes_transferred 112050 ); 112051`` 112052A 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.]] 112053 112054[[ec][Set to indicate what error occurred, if any.]] 112055 112056] 112057 112058 112059[heading Return Value] 112060 112061The number of bytes read. If an error occurs, returns the total number of bytes successfully transferred prior to the error. 112062 112063 112064 112065 112066[endsect] 112067 112068 112069 112070[section:overload13 read (13 of 16 overloads)] 112071 112072 112073Attempt to read a certain amount of data from a stream before returning. 112074 112075 112076 template< 112077 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 112078 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``> 112079 std::size_t read( 112080 SyncReadStream & s, 112081 DynamicBuffer_v2 buffers, 112082 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 112083 112084 112085This 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: 112086 112087 112088* The specified dynamic buffer sequence is full (that is, it has reached maximum size). 112089 112090 112091* An error occurred. 112092 112093This operation is implemented in terms of zero or more calls to the stream's read\_some function. 112094 112095 112096[heading Parameters] 112097 112098 112099[variablelist 112100 112101[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 112102 112103[[buffers][The dynamic buffer sequence into which the data will be read.]] 112104 112105] 112106 112107 112108[heading Return Value] 112109 112110The number of bytes transferred. 112111 112112 112113[heading Exceptions] 112114 112115 112116[variablelist 112117 112118[[boost::system::system_error][Thrown on failure.]] 112119 112120] 112121 112122 112123[heading Remarks] 112124 112125This overload is equivalent to calling: 112126 112127 boost::asio::read( 112128 s, buffers, 112129 boost::asio::transfer_all()); 112130 112131 112132 112133 112134 112135 112136 112137[endsect] 112138 112139 112140 112141[section:overload14 read (14 of 16 overloads)] 112142 112143 112144Attempt to read a certain amount of data from a stream before returning. 112145 112146 112147 template< 112148 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 112149 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``> 112150 std::size_t read( 112151 SyncReadStream & s, 112152 DynamicBuffer_v2 buffers, 112153 boost::system::error_code & ec, 112154 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 112155 112156 112157This 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: 112158 112159 112160* The supplied buffer is full (that is, it has reached maximum size). 112161 112162 112163* An error occurred. 112164 112165This operation is implemented in terms of zero or more calls to the stream's read\_some function. 112166 112167 112168[heading Parameters] 112169 112170 112171[variablelist 112172 112173[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 112174 112175[[buffers][The dynamic buffer sequence into which the data will be read.]] 112176 112177[[ec][Set to indicate what error occurred, if any.]] 112178 112179] 112180 112181 112182[heading Return Value] 112183 112184The number of bytes transferred. 112185 112186 112187[heading Remarks] 112188 112189This overload is equivalent to calling: 112190 112191 boost::asio::read( 112192 s, buffers, 112193 boost::asio::transfer_all(), ec); 112194 112195 112196 112197 112198 112199 112200 112201[endsect] 112202 112203 112204 112205[section:overload15 read (15 of 16 overloads)] 112206 112207 112208Attempt to read a certain amount of data from a stream before returning. 112209 112210 112211 template< 112212 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 112213 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``, 112214 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 112215 std::size_t read( 112216 SyncReadStream & s, 112217 DynamicBuffer_v2 buffers, 112218 CompletionCondition completion_condition, 112219 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 112220 112221 112222This 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: 112223 112224 112225* The specified dynamic buffer sequence is full (that is, it has reached maximum size). 112226 112227 112228* The completion\_condition function object returns 0. 112229 112230This operation is implemented in terms of zero or more calls to the stream's read\_some function. 112231 112232 112233[heading Parameters] 112234 112235 112236[variablelist 112237 112238[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 112239 112240[[buffers][The dynamic buffer sequence into which the data will be read.]] 112241 112242[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 112243`` 112244 std::size_t completion_condition( 112245 // Result of latest read_some operation. 112246 const boost::system::error_code& error, 112247 112248 // Number of bytes transferred so far. 112249 std::size_t bytes_transferred 112250 ); 112251`` 112252A 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.]] 112253 112254] 112255 112256 112257[heading Return Value] 112258 112259The number of bytes transferred. 112260 112261 112262[heading Exceptions] 112263 112264 112265[variablelist 112266 112267[[boost::system::system_error][Thrown on failure. ]] 112268 112269] 112270 112271 112272 112273 112274[endsect] 112275 112276 112277 112278[section:overload16 read (16 of 16 overloads)] 112279 112280 112281Attempt to read a certain amount of data from a stream before returning. 112282 112283 112284 template< 112285 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 112286 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``, 112287 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 112288 std::size_t read( 112289 SyncReadStream & s, 112290 DynamicBuffer_v2 buffers, 112291 CompletionCondition completion_condition, 112292 boost::system::error_code & ec, 112293 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 112294 112295 112296This 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: 112297 112298 112299* The specified dynamic buffer sequence is full (that is, it has reached maximum size). 112300 112301 112302* The completion\_condition function object returns 0. 112303 112304This operation is implemented in terms of zero or more calls to the stream's read\_some function. 112305 112306 112307[heading Parameters] 112308 112309 112310[variablelist 112311 112312[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 112313 112314[[buffers][The dynamic buffer sequence into which the data will be read.]] 112315 112316[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 112317`` 112318 std::size_t completion_condition( 112319 // Result of latest read_some operation. 112320 const boost::system::error_code& error, 112321 112322 // Number of bytes transferred so far. 112323 std::size_t bytes_transferred 112324 ); 112325`` 112326A 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.]] 112327 112328[[ec][Set to indicate what error occurred, if any.]] 112329 112330] 112331 112332 112333[heading Return Value] 112334 112335The number of bytes read. If an error occurs, returns the total number of bytes successfully transferred prior to the error. 112336 112337 112338 112339 112340[endsect] 112341 112342 112343[endsect] 112344 112345[section:read_at read_at] 112346 112347[indexterm1 boost_asio.indexterm.read_at..read_at] 112348The `read_at` function is a composed operation that reads a certain amount of data at the specified offset before returning. 112349 112350 112351Attempt to read a certain amount of data at the specified offset before returning. 112352 112353 template< 112354 typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``, 112355 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 112356 std::size_t ``[link boost_asio.reference.read_at.overload1 read_at]``( 112357 SyncRandomAccessReadDevice & d, 112358 uint64_t offset, 112359 const MutableBufferSequence & buffers); 112360 `` [''''»''' [link boost_asio.reference.read_at.overload1 more...]]`` 112361 112362 template< 112363 typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``, 112364 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 112365 std::size_t ``[link boost_asio.reference.read_at.overload2 read_at]``( 112366 SyncRandomAccessReadDevice & d, 112367 uint64_t offset, 112368 const MutableBufferSequence & buffers, 112369 boost::system::error_code & ec); 112370 `` [''''»''' [link boost_asio.reference.read_at.overload2 more...]]`` 112371 112372 template< 112373 typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``, 112374 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 112375 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 112376 std::size_t ``[link boost_asio.reference.read_at.overload3 read_at]``( 112377 SyncRandomAccessReadDevice & d, 112378 uint64_t offset, 112379 const MutableBufferSequence & buffers, 112380 CompletionCondition completion_condition); 112381 `` [''''»''' [link boost_asio.reference.read_at.overload3 more...]]`` 112382 112383 template< 112384 typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``, 112385 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 112386 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 112387 std::size_t ``[link boost_asio.reference.read_at.overload4 read_at]``( 112388 SyncRandomAccessReadDevice & d, 112389 uint64_t offset, 112390 const MutableBufferSequence & buffers, 112391 CompletionCondition completion_condition, 112392 boost::system::error_code & ec); 112393 `` [''''»''' [link boost_asio.reference.read_at.overload4 more...]]`` 112394 112395 template< 112396 typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``, 112397 typename Allocator> 112398 std::size_t ``[link boost_asio.reference.read_at.overload5 read_at]``( 112399 SyncRandomAccessReadDevice & d, 112400 uint64_t offset, 112401 basic_streambuf< Allocator > & b); 112402 `` [''''»''' [link boost_asio.reference.read_at.overload5 more...]]`` 112403 112404 template< 112405 typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``, 112406 typename Allocator> 112407 std::size_t ``[link boost_asio.reference.read_at.overload6 read_at]``( 112408 SyncRandomAccessReadDevice & d, 112409 uint64_t offset, 112410 basic_streambuf< Allocator > & b, 112411 boost::system::error_code & ec); 112412 `` [''''»''' [link boost_asio.reference.read_at.overload6 more...]]`` 112413 112414 template< 112415 typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``, 112416 typename Allocator, 112417 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 112418 std::size_t ``[link boost_asio.reference.read_at.overload7 read_at]``( 112419 SyncRandomAccessReadDevice & d, 112420 uint64_t offset, 112421 basic_streambuf< Allocator > & b, 112422 CompletionCondition completion_condition); 112423 `` [''''»''' [link boost_asio.reference.read_at.overload7 more...]]`` 112424 112425 template< 112426 typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``, 112427 typename Allocator, 112428 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 112429 std::size_t ``[link boost_asio.reference.read_at.overload8 read_at]``( 112430 SyncRandomAccessReadDevice & d, 112431 uint64_t offset, 112432 basic_streambuf< Allocator > & b, 112433 CompletionCondition completion_condition, 112434 boost::system::error_code & ec); 112435 `` [''''»''' [link boost_asio.reference.read_at.overload8 more...]]`` 112436 112437[heading Requirements] 112438 112439['Header: ][^boost/asio/read_at.hpp] 112440 112441['Convenience header: ][^boost/asio.hpp] 112442 112443 112444[section:overload1 read_at (1 of 8 overloads)] 112445 112446 112447Attempt to read a certain amount of data at the specified offset before returning. 112448 112449 112450 template< 112451 typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``, 112452 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 112453 std::size_t read_at( 112454 SyncRandomAccessReadDevice & d, 112455 uint64_t offset, 112456 const MutableBufferSequence & buffers); 112457 112458 112459This 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: 112460 112461 112462* The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes. 112463 112464 112465* An error occurred. 112466 112467This operation is implemented in terms of zero or more calls to the device's read\_some\_at function. 112468 112469 112470[heading Parameters] 112471 112472 112473[variablelist 112474 112475[[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]] 112476 112477[[offset][The offset at which the data will be read.]] 112478 112479[[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.]] 112480 112481] 112482 112483 112484[heading Return Value] 112485 112486The number of bytes transferred. 112487 112488 112489[heading Exceptions] 112490 112491 112492[variablelist 112493 112494[[boost::system::system_error][Thrown on failure.]] 112495 112496] 112497 112498 112499[heading Example] 112500 112501To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 112502 112503 boost::asio::read_at(d, 42, boost::asio::buffer(data, size)); 112504 112505 112506See 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. 112507 112508 112509[heading Remarks] 112510 112511This overload is equivalent to calling: 112512 112513 boost::asio::read_at( 112514 d, 42, buffers, 112515 boost::asio::transfer_all()); 112516 112517 112518 112519 112520 112521 112522 112523[endsect] 112524 112525 112526 112527[section:overload2 read_at (2 of 8 overloads)] 112528 112529 112530Attempt to read a certain amount of data at the specified offset before returning. 112531 112532 112533 template< 112534 typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``, 112535 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 112536 std::size_t read_at( 112537 SyncRandomAccessReadDevice & d, 112538 uint64_t offset, 112539 const MutableBufferSequence & buffers, 112540 boost::system::error_code & ec); 112541 112542 112543This 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: 112544 112545 112546* The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes. 112547 112548 112549* An error occurred. 112550 112551This operation is implemented in terms of zero or more calls to the device's read\_some\_at function. 112552 112553 112554[heading Parameters] 112555 112556 112557[variablelist 112558 112559[[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]] 112560 112561[[offset][The offset at which the data will be read.]] 112562 112563[[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.]] 112564 112565[[ec][Set to indicate what error occurred, if any.]] 112566 112567] 112568 112569 112570[heading Return Value] 112571 112572The number of bytes transferred. 112573 112574 112575[heading Example] 112576 112577To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 112578 112579 boost::asio::read_at(d, 42, 112580 boost::asio::buffer(data, size), ec); 112581 112582 112583See 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. 112584 112585 112586[heading Remarks] 112587 112588This overload is equivalent to calling: 112589 112590 boost::asio::read_at( 112591 d, 42, buffers, 112592 boost::asio::transfer_all(), ec); 112593 112594 112595 112596 112597 112598 112599 112600[endsect] 112601 112602 112603 112604[section:overload3 read_at (3 of 8 overloads)] 112605 112606 112607Attempt to read a certain amount of data at the specified offset before returning. 112608 112609 112610 template< 112611 typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``, 112612 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 112613 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 112614 std::size_t read_at( 112615 SyncRandomAccessReadDevice & d, 112616 uint64_t offset, 112617 const MutableBufferSequence & buffers, 112618 CompletionCondition completion_condition); 112619 112620 112621This 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: 112622 112623 112624* The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes. 112625 112626 112627* The completion\_condition function object returns 0. 112628 112629This operation is implemented in terms of zero or more calls to the device's read\_some\_at function. 112630 112631 112632[heading Parameters] 112633 112634 112635[variablelist 112636 112637[[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]] 112638 112639[[offset][The offset at which the data will be read.]] 112640 112641[[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.]] 112642 112643[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 112644`` 112645 std::size_t completion_condition( 112646 // Result of latest read_some_at operation. 112647 const boost::system::error_code& error, 112648 112649 // Number of bytes transferred so far. 112650 std::size_t bytes_transferred 112651 ); 112652`` 112653A 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.]] 112654 112655] 112656 112657 112658[heading Return Value] 112659 112660The number of bytes transferred. 112661 112662 112663[heading Exceptions] 112664 112665 112666[variablelist 112667 112668[[boost::system::system_error][Thrown on failure.]] 112669 112670] 112671 112672 112673[heading Example] 112674 112675To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 112676 112677 boost::asio::read_at(d, 42, boost::asio::buffer(data, size), 112678 boost::asio::transfer_at_least(32)); 112679 112680 112681See 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. 112682 112683 112684 112685 112686[endsect] 112687 112688 112689 112690[section:overload4 read_at (4 of 8 overloads)] 112691 112692 112693Attempt to read a certain amount of data at the specified offset before returning. 112694 112695 112696 template< 112697 typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``, 112698 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 112699 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 112700 std::size_t read_at( 112701 SyncRandomAccessReadDevice & d, 112702 uint64_t offset, 112703 const MutableBufferSequence & buffers, 112704 CompletionCondition completion_condition, 112705 boost::system::error_code & ec); 112706 112707 112708This 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: 112709 112710 112711* The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes. 112712 112713 112714* The completion\_condition function object returns 0. 112715 112716This operation is implemented in terms of zero or more calls to the device's read\_some\_at function. 112717 112718 112719[heading Parameters] 112720 112721 112722[variablelist 112723 112724[[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]] 112725 112726[[offset][The offset at which the data will be read.]] 112727 112728[[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.]] 112729 112730[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 112731`` 112732 std::size_t completion_condition( 112733 // Result of latest read_some_at operation. 112734 const boost::system::error_code& error, 112735 112736 // Number of bytes transferred so far. 112737 std::size_t bytes_transferred 112738 ); 112739`` 112740A 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.]] 112741 112742[[ec][Set to indicate what error occurred, if any.]] 112743 112744] 112745 112746 112747[heading Return Value] 112748 112749The number of bytes read. If an error occurs, returns the total number of bytes successfully transferred prior to the error. 112750 112751 112752 112753 112754[endsect] 112755 112756 112757 112758[section:overload5 read_at (5 of 8 overloads)] 112759 112760 112761Attempt to read a certain amount of data at the specified offset before returning. 112762 112763 112764 template< 112765 typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``, 112766 typename Allocator> 112767 std::size_t read_at( 112768 SyncRandomAccessReadDevice & d, 112769 uint64_t offset, 112770 basic_streambuf< Allocator > & b); 112771 112772 112773This 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: 112774 112775 112776* An error occurred. 112777 112778This operation is implemented in terms of zero or more calls to the device's read\_some\_at function. 112779 112780 112781[heading Parameters] 112782 112783 112784[variablelist 112785 112786[[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]] 112787 112788[[offset][The offset at which the data will be read.]] 112789 112790[[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]] 112791 112792] 112793 112794 112795[heading Return Value] 112796 112797The number of bytes transferred. 112798 112799 112800[heading Exceptions] 112801 112802 112803[variablelist 112804 112805[[boost::system::system_error][Thrown on failure.]] 112806 112807] 112808 112809 112810[heading Remarks] 112811 112812This overload is equivalent to calling: 112813 112814 boost::asio::read_at( 112815 d, 42, b, 112816 boost::asio::transfer_all()); 112817 112818 112819 112820 112821 112822 112823 112824[endsect] 112825 112826 112827 112828[section:overload6 read_at (6 of 8 overloads)] 112829 112830 112831Attempt to read a certain amount of data at the specified offset before returning. 112832 112833 112834 template< 112835 typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``, 112836 typename Allocator> 112837 std::size_t read_at( 112838 SyncRandomAccessReadDevice & d, 112839 uint64_t offset, 112840 basic_streambuf< Allocator > & b, 112841 boost::system::error_code & ec); 112842 112843 112844This 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: 112845 112846 112847* An error occurred. 112848 112849This operation is implemented in terms of zero or more calls to the device's read\_some\_at function. 112850 112851 112852[heading Parameters] 112853 112854 112855[variablelist 112856 112857[[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]] 112858 112859[[offset][The offset at which the data will be read.]] 112860 112861[[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]] 112862 112863[[ec][Set to indicate what error occurred, if any.]] 112864 112865] 112866 112867 112868[heading Return Value] 112869 112870The number of bytes transferred. 112871 112872 112873[heading Remarks] 112874 112875This overload is equivalent to calling: 112876 112877 boost::asio::read_at( 112878 d, 42, b, 112879 boost::asio::transfer_all(), ec); 112880 112881 112882 112883 112884 112885 112886 112887[endsect] 112888 112889 112890 112891[section:overload7 read_at (7 of 8 overloads)] 112892 112893 112894Attempt to read a certain amount of data at the specified offset before returning. 112895 112896 112897 template< 112898 typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``, 112899 typename Allocator, 112900 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 112901 std::size_t read_at( 112902 SyncRandomAccessReadDevice & d, 112903 uint64_t offset, 112904 basic_streambuf< Allocator > & b, 112905 CompletionCondition completion_condition); 112906 112907 112908This 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: 112909 112910 112911* The completion\_condition function object returns 0. 112912 112913This operation is implemented in terms of zero or more calls to the device's read\_some\_at function. 112914 112915 112916[heading Parameters] 112917 112918 112919[variablelist 112920 112921[[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]] 112922 112923[[offset][The offset at which the data will be read.]] 112924 112925[[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]] 112926 112927[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 112928`` 112929 std::size_t completion_condition( 112930 // Result of latest read_some_at operation. 112931 const boost::system::error_code& error, 112932 112933 // Number of bytes transferred so far. 112934 std::size_t bytes_transferred 112935 ); 112936`` 112937A 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.]] 112938 112939] 112940 112941 112942[heading Return Value] 112943 112944The number of bytes transferred. 112945 112946 112947[heading Exceptions] 112948 112949 112950[variablelist 112951 112952[[boost::system::system_error][Thrown on failure. ]] 112953 112954] 112955 112956 112957 112958 112959[endsect] 112960 112961 112962 112963[section:overload8 read_at (8 of 8 overloads)] 112964 112965 112966Attempt to read a certain amount of data at the specified offset before returning. 112967 112968 112969 template< 112970 typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``, 112971 typename Allocator, 112972 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 112973 std::size_t read_at( 112974 SyncRandomAccessReadDevice & d, 112975 uint64_t offset, 112976 basic_streambuf< Allocator > & b, 112977 CompletionCondition completion_condition, 112978 boost::system::error_code & ec); 112979 112980 112981This 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: 112982 112983 112984* The completion\_condition function object returns 0. 112985 112986This operation is implemented in terms of zero or more calls to the device's read\_some\_at function. 112987 112988 112989[heading Parameters] 112990 112991 112992[variablelist 112993 112994[[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]] 112995 112996[[offset][The offset at which the data will be read.]] 112997 112998[[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]] 112999 113000[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: 113001`` 113002 std::size_t completion_condition( 113003 // Result of latest read_some_at operation. 113004 const boost::system::error_code& error, 113005 113006 // Number of bytes transferred so far. 113007 std::size_t bytes_transferred 113008 ); 113009`` 113010A 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.]] 113011 113012[[ec][Set to indicate what error occurred, if any.]] 113013 113014] 113015 113016 113017[heading Return Value] 113018 113019The number of bytes read. If an error occurs, returns the total number of bytes successfully transferred prior to the error. 113020 113021 113022 113023 113024[endsect] 113025 113026 113027[endsect] 113028 113029[section:read_until read_until] 113030 113031[indexterm1 boost_asio.indexterm.read_until..read_until] 113032The `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. 113033 113034 113035Read data into a dynamic buffer sequence until it contains a specified delimiter. 113036 113037 template< 113038 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 113039 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``> 113040 std::size_t ``[link boost_asio.reference.read_until.overload1 read_until]``( 113041 SyncReadStream & s, 113042 DynamicBuffer_v1 && buffers, 113043 char delim, 113044 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 113045 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 113046 `` [''''»''' [link boost_asio.reference.read_until.overload1 more...]]`` 113047 113048 template< 113049 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 113050 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``> 113051 std::size_t ``[link boost_asio.reference.read_until.overload2 read_until]``( 113052 SyncReadStream & s, 113053 DynamicBuffer_v1 && buffers, 113054 char delim, 113055 boost::system::error_code & ec, 113056 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 113057 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 113058 `` [''''»''' [link boost_asio.reference.read_until.overload2 more...]]`` 113059 113060 template< 113061 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 113062 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``> 113063 std::size_t ``[link boost_asio.reference.read_until.overload3 read_until]``( 113064 SyncReadStream & s, 113065 DynamicBuffer_v1 && buffers, 113066 string_view delim, 113067 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 113068 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 113069 `` [''''»''' [link boost_asio.reference.read_until.overload3 more...]]`` 113070 113071 template< 113072 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 113073 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``> 113074 std::size_t ``[link boost_asio.reference.read_until.overload4 read_until]``( 113075 SyncReadStream & s, 113076 DynamicBuffer_v1 && buffers, 113077 string_view delim, 113078 boost::system::error_code & ec, 113079 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 113080 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 113081 `` [''''»''' [link boost_asio.reference.read_until.overload4 more...]]`` 113082 113083Read data into a dynamic buffer sequence until some part of the data it contains matches a regular expression. 113084 113085 template< 113086 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 113087 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``> 113088 std::size_t ``[link boost_asio.reference.read_until.overload5 read_until]``( 113089 SyncReadStream & s, 113090 DynamicBuffer_v1 && buffers, 113091 const boost::regex & expr, 113092 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 113093 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 113094 `` [''''»''' [link boost_asio.reference.read_until.overload5 more...]]`` 113095 113096 template< 113097 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 113098 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``> 113099 std::size_t ``[link boost_asio.reference.read_until.overload6 read_until]``( 113100 SyncReadStream & s, 113101 DynamicBuffer_v1 && buffers, 113102 const boost::regex & expr, 113103 boost::system::error_code & ec, 113104 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 113105 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 113106 `` [''''»''' [link boost_asio.reference.read_until.overload6 more...]]`` 113107 113108Read data into a dynamic buffer sequence until a function object indicates a match. 113109 113110 template< 113111 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 113112 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``, 113113 typename MatchCondition> 113114 std::size_t ``[link boost_asio.reference.read_until.overload7 read_until]``( 113115 SyncReadStream & s, 113116 DynamicBuffer_v1 && buffers, 113117 MatchCondition match_condition, 113118 typename constraint< is_match_condition< MatchCondition >::value >::type = 0, 113119 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 113120 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 113121 `` [''''»''' [link boost_asio.reference.read_until.overload7 more...]]`` 113122 113123 template< 113124 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 113125 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``, 113126 typename MatchCondition> 113127 std::size_t ``[link boost_asio.reference.read_until.overload8 read_until]``( 113128 SyncReadStream & s, 113129 DynamicBuffer_v1 && buffers, 113130 MatchCondition match_condition, 113131 boost::system::error_code & ec, 113132 typename constraint< is_match_condition< MatchCondition >::value >::type = 0, 113133 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 113134 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 113135 `` [''''»''' [link boost_asio.reference.read_until.overload8 more...]]`` 113136 113137Read data into a streambuf until it contains a specified delimiter. 113138 113139 template< 113140 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 113141 typename Allocator> 113142 std::size_t ``[link boost_asio.reference.read_until.overload9 read_until]``( 113143 SyncReadStream & s, 113144 boost::asio::basic_streambuf< Allocator > & b, 113145 char delim); 113146 `` [''''»''' [link boost_asio.reference.read_until.overload9 more...]]`` 113147 113148 template< 113149 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 113150 typename Allocator> 113151 std::size_t ``[link boost_asio.reference.read_until.overload10 read_until]``( 113152 SyncReadStream & s, 113153 boost::asio::basic_streambuf< Allocator > & b, 113154 char delim, 113155 boost::system::error_code & ec); 113156 `` [''''»''' [link boost_asio.reference.read_until.overload10 more...]]`` 113157 113158 template< 113159 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 113160 typename Allocator> 113161 std::size_t ``[link boost_asio.reference.read_until.overload11 read_until]``( 113162 SyncReadStream & s, 113163 boost::asio::basic_streambuf< Allocator > & b, 113164 string_view delim); 113165 `` [''''»''' [link boost_asio.reference.read_until.overload11 more...]]`` 113166 113167 template< 113168 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 113169 typename Allocator> 113170 std::size_t ``[link boost_asio.reference.read_until.overload12 read_until]``( 113171 SyncReadStream & s, 113172 boost::asio::basic_streambuf< Allocator > & b, 113173 string_view delim, 113174 boost::system::error_code & ec); 113175 `` [''''»''' [link boost_asio.reference.read_until.overload12 more...]]`` 113176 113177Read data into a streambuf until some part of the data it contains matches a regular expression. 113178 113179 template< 113180 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 113181 typename Allocator> 113182 std::size_t ``[link boost_asio.reference.read_until.overload13 read_until]``( 113183 SyncReadStream & s, 113184 boost::asio::basic_streambuf< Allocator > & b, 113185 const boost::regex & expr); 113186 `` [''''»''' [link boost_asio.reference.read_until.overload13 more...]]`` 113187 113188 template< 113189 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 113190 typename Allocator> 113191 std::size_t ``[link boost_asio.reference.read_until.overload14 read_until]``( 113192 SyncReadStream & s, 113193 boost::asio::basic_streambuf< Allocator > & b, 113194 const boost::regex & expr, 113195 boost::system::error_code & ec); 113196 `` [''''»''' [link boost_asio.reference.read_until.overload14 more...]]`` 113197 113198Read data into a streambuf until a function object indicates a match. 113199 113200 template< 113201 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 113202 typename Allocator, 113203 typename MatchCondition> 113204 std::size_t ``[link boost_asio.reference.read_until.overload15 read_until]``( 113205 SyncReadStream & s, 113206 boost::asio::basic_streambuf< Allocator > & b, 113207 MatchCondition match_condition, 113208 typename constraint< is_match_condition< MatchCondition >::value >::type = 0); 113209 `` [''''»''' [link boost_asio.reference.read_until.overload15 more...]]`` 113210 113211 template< 113212 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 113213 typename Allocator, 113214 typename MatchCondition> 113215 std::size_t ``[link boost_asio.reference.read_until.overload16 read_until]``( 113216 SyncReadStream & s, 113217 boost::asio::basic_streambuf< Allocator > & b, 113218 MatchCondition match_condition, 113219 boost::system::error_code & ec, 113220 typename constraint< is_match_condition< MatchCondition >::value >::type = 0); 113221 `` [''''»''' [link boost_asio.reference.read_until.overload16 more...]]`` 113222 113223Read data into a dynamic buffer sequence until it contains a specified delimiter. 113224 113225 template< 113226 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 113227 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``> 113228 std::size_t ``[link boost_asio.reference.read_until.overload17 read_until]``( 113229 SyncReadStream & s, 113230 DynamicBuffer_v2 buffers, 113231 char delim, 113232 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 113233 `` [''''»''' [link boost_asio.reference.read_until.overload17 more...]]`` 113234 113235 template< 113236 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 113237 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``> 113238 std::size_t ``[link boost_asio.reference.read_until.overload18 read_until]``( 113239 SyncReadStream & s, 113240 DynamicBuffer_v2 buffers, 113241 char delim, 113242 boost::system::error_code & ec, 113243 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 113244 `` [''''»''' [link boost_asio.reference.read_until.overload18 more...]]`` 113245 113246 template< 113247 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 113248 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``> 113249 std::size_t ``[link boost_asio.reference.read_until.overload19 read_until]``( 113250 SyncReadStream & s, 113251 DynamicBuffer_v2 buffers, 113252 string_view delim, 113253 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 113254 `` [''''»''' [link boost_asio.reference.read_until.overload19 more...]]`` 113255 113256 template< 113257 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 113258 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``> 113259 std::size_t ``[link boost_asio.reference.read_until.overload20 read_until]``( 113260 SyncReadStream & s, 113261 DynamicBuffer_v2 buffers, 113262 string_view delim, 113263 boost::system::error_code & ec, 113264 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 113265 `` [''''»''' [link boost_asio.reference.read_until.overload20 more...]]`` 113266 113267Read data into a dynamic buffer sequence until some part of the data it contains matches a regular expression. 113268 113269 template< 113270 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 113271 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``> 113272 std::size_t ``[link boost_asio.reference.read_until.overload21 read_until]``( 113273 SyncReadStream & s, 113274 DynamicBuffer_v2 buffers, 113275 const boost::regex & expr, 113276 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 113277 `` [''''»''' [link boost_asio.reference.read_until.overload21 more...]]`` 113278 113279 template< 113280 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 113281 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``> 113282 std::size_t ``[link boost_asio.reference.read_until.overload22 read_until]``( 113283 SyncReadStream & s, 113284 DynamicBuffer_v2 buffers, 113285 const boost::regex & expr, 113286 boost::system::error_code & ec, 113287 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 113288 `` [''''»''' [link boost_asio.reference.read_until.overload22 more...]]`` 113289 113290Read data into a dynamic buffer sequence until a function object indicates a match. 113291 113292 template< 113293 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 113294 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``, 113295 typename MatchCondition> 113296 std::size_t ``[link boost_asio.reference.read_until.overload23 read_until]``( 113297 SyncReadStream & s, 113298 DynamicBuffer_v2 buffers, 113299 MatchCondition match_condition, 113300 typename constraint< is_match_condition< MatchCondition >::value >::type = 0, 113301 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 113302 `` [''''»''' [link boost_asio.reference.read_until.overload23 more...]]`` 113303 113304 template< 113305 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 113306 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``, 113307 typename MatchCondition> 113308 std::size_t ``[link boost_asio.reference.read_until.overload24 read_until]``( 113309 SyncReadStream & s, 113310 DynamicBuffer_v2 buffers, 113311 MatchCondition match_condition, 113312 boost::system::error_code & ec, 113313 typename constraint< is_match_condition< MatchCondition >::value >::type = 0, 113314 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 113315 `` [''''»''' [link boost_asio.reference.read_until.overload24 more...]]`` 113316 113317[heading Requirements] 113318 113319['Header: ][^boost/asio/read_until.hpp] 113320 113321['Convenience header: ][^boost/asio.hpp] 113322 113323 113324[section:overload1 read_until (1 of 24 overloads)] 113325 113326 113327Read data into a dynamic buffer sequence until it contains a specified delimiter. 113328 113329 113330 template< 113331 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 113332 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``> 113333 std::size_t read_until( 113334 SyncReadStream & s, 113335 DynamicBuffer_v1 && buffers, 113336 char delim, 113337 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 113338 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 113339 113340 113341This 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: 113342 113343 113344* The get area of the dynamic buffer sequence contains the specified delimiter. 113345 113346 113347* An error occurred. 113348 113349This 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. 113350 113351 113352[heading Parameters] 113353 113354 113355[variablelist 113356 113357[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 113358 113359[[buffers][The dynamic buffer sequence into which the data will be read.]] 113360 113361[[delim][The delimiter character.]] 113362 113363] 113364 113365 113366[heading Return Value] 113367 113368The number of bytes in the dynamic buffer sequence's get area up to and including the delimiter. 113369 113370 113371[heading Exceptions] 113372 113373 113374[variablelist 113375 113376[[boost::system::system_error][Thrown on failure.]] 113377 113378] 113379 113380 113381[heading Remarks] 113382 113383After 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. 113384 113385 113386[heading Example] 113387 113388To read data into a `std::string` until a newline is encountered: 113389 113390 std::string data; 113391 std::size_t n = boost::asio::read_until(s, 113392 boost::asio::dynamic_buffer(data), '\n'); 113393 std::string line = data.substr(0, n); 113394 data.erase(0, n); 113395 113396 113397After the `read_until` operation completes successfully, the string `data` contains the delimiter: 113398 113399 { 'a', 'b', ..., 'c', '\n', 'd', 'e', ... } 113400 113401 113402The call to `substr` then extracts the data up to and including the delimiter, so that the string `line` contains: 113403 113404 { 'a', 'b', ..., 'c', '\n' } 113405 113406 113407After the call to `erase`, the remaining data is left in the buffer `b` as follows: 113408 113409 { 'd', 'e', ... } 113410 113411 113412This data may be the start of a new line, to be extracted by a subsequent `read_until` operation. 113413 113414 113415 113416 113417[endsect] 113418 113419 113420 113421[section:overload2 read_until (2 of 24 overloads)] 113422 113423 113424Read data into a dynamic buffer sequence until it contains a specified delimiter. 113425 113426 113427 template< 113428 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 113429 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``> 113430 std::size_t read_until( 113431 SyncReadStream & s, 113432 DynamicBuffer_v1 && buffers, 113433 char delim, 113434 boost::system::error_code & ec, 113435 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 113436 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 113437 113438 113439This 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: 113440 113441 113442* The get area of the dynamic buffer sequence contains the specified delimiter. 113443 113444 113445* An error occurred. 113446 113447This 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. 113448 113449 113450[heading Parameters] 113451 113452 113453[variablelist 113454 113455[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 113456 113457[[buffers][The dynamic buffer sequence into which the data will be read.]] 113458 113459[[delim][The delimiter character.]] 113460 113461[[ec][Set to indicate what error occurred, if any.]] 113462 113463] 113464 113465 113466[heading Return Value] 113467 113468The number of bytes in the dynamic buffer sequence's get area up to and including the delimiter. Returns 0 if an error occurred. 113469 113470 113471[heading Remarks] 113472 113473After 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. 113474 113475 113476 113477 113478[endsect] 113479 113480 113481 113482[section:overload3 read_until (3 of 24 overloads)] 113483 113484 113485Read data into a dynamic buffer sequence until it contains a specified delimiter. 113486 113487 113488 template< 113489 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 113490 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``> 113491 std::size_t read_until( 113492 SyncReadStream & s, 113493 DynamicBuffer_v1 && buffers, 113494 string_view delim, 113495 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 113496 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 113497 113498 113499This 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: 113500 113501 113502* The get area of the dynamic buffer sequence contains the specified delimiter. 113503 113504 113505* An error occurred. 113506 113507This 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. 113508 113509 113510[heading Parameters] 113511 113512 113513[variablelist 113514 113515[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 113516 113517[[buffers][The dynamic buffer sequence into which the data will be read.]] 113518 113519[[delim][The delimiter string.]] 113520 113521] 113522 113523 113524[heading Return Value] 113525 113526The number of bytes in the dynamic buffer sequence's get area up to and including the delimiter. 113527 113528 113529[heading Remarks] 113530 113531After 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. 113532 113533 113534[heading Example] 113535 113536To read data into a `std::string` until a CR-LF sequence is encountered: 113537 113538 std::string data; 113539 std::size_t n = boost::asio::read_until(s, 113540 boost::asio::dynamic_buffer(data), "\r\n"); 113541 std::string line = data.substr(0, n); 113542 data.erase(0, n); 113543 113544 113545After the `read_until` operation completes successfully, the string `data` contains the delimiter: 113546 113547 { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } 113548 113549 113550The call to `substr` then extracts the data up to and including the delimiter, so that the string `line` contains: 113551 113552 { 'a', 'b', ..., 'c', '\r', '\n' } 113553 113554 113555After the call to `erase`, the remaining data is left in the buffer `b` as follows: 113556 113557 { 'd', 'e', ... } 113558 113559 113560This data may be the start of a new line, to be extracted by a subsequent `read_until` operation. 113561 113562 113563 113564 113565[endsect] 113566 113567 113568 113569[section:overload4 read_until (4 of 24 overloads)] 113570 113571 113572Read data into a dynamic buffer sequence until it contains a specified delimiter. 113573 113574 113575 template< 113576 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 113577 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``> 113578 std::size_t read_until( 113579 SyncReadStream & s, 113580 DynamicBuffer_v1 && buffers, 113581 string_view delim, 113582 boost::system::error_code & ec, 113583 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 113584 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 113585 113586 113587This 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: 113588 113589 113590* The get area of the dynamic buffer sequence contains the specified delimiter. 113591 113592 113593* An error occurred. 113594 113595This 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. 113596 113597 113598[heading Parameters] 113599 113600 113601[variablelist 113602 113603[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 113604 113605[[buffers][The dynamic buffer sequence into which the data will be read.]] 113606 113607[[delim][The delimiter string.]] 113608 113609[[ec][Set to indicate what error occurred, if any.]] 113610 113611] 113612 113613 113614[heading Return Value] 113615 113616The number of bytes in the dynamic buffer sequence's get area up to and including the delimiter. Returns 0 if an error occurred. 113617 113618 113619[heading Remarks] 113620 113621After 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. 113622 113623 113624 113625 113626[endsect] 113627 113628 113629 113630[section:overload5 read_until (5 of 24 overloads)] 113631 113632 113633Read data into a dynamic buffer sequence until some part of the data it contains matches a regular expression. 113634 113635 113636 template< 113637 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 113638 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``> 113639 std::size_t read_until( 113640 SyncReadStream & s, 113641 DynamicBuffer_v1 && buffers, 113642 const boost::regex & expr, 113643 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 113644 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 113645 113646 113647This 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: 113648 113649 113650* A substring of the dynamic buffer sequence's get area matches the regular expression. 113651 113652 113653* An error occurred. 113654 113655This 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. 113656 113657 113658[heading Parameters] 113659 113660 113661[variablelist 113662 113663[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 113664 113665[[buffers][A dynamic buffer sequence into which the data will be read.]] 113666 113667[[expr][The regular expression.]] 113668 113669] 113670 113671 113672[heading Return Value] 113673 113674The number of bytes in the dynamic buffer sequence's get area up to and including the substring that matches the regular expression. 113675 113676 113677[heading Exceptions] 113678 113679 113680[variablelist 113681 113682[[boost::system::system_error][Thrown on failure.]] 113683 113684] 113685 113686 113687[heading Remarks] 113688 113689After 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. 113690 113691 113692[heading Example] 113693 113694To read data into a `std::string` until a CR-LF sequence is encountered: 113695 113696 std::string data; 113697 std::size_t n = boost::asio::read_until(s, 113698 boost::asio::dynamic_buffer(data), boost::regex("\r\n")); 113699 std::string line = data.substr(0, n); 113700 data.erase(0, n); 113701 113702 113703After the `read_until` operation completes successfully, the string `data` contains the delimiter: 113704 113705 { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } 113706 113707 113708The call to `substr` then extracts the data up to and including the delimiter, so that the string `line` contains: 113709 113710 { 'a', 'b', ..., 'c', '\r', '\n' } 113711 113712 113713After the call to `erase`, the remaining data is left in the buffer `b` as follows: 113714 113715 { 'd', 'e', ... } 113716 113717 113718This data may be the start of a new line, to be extracted by a subsequent `read_until` operation. 113719 113720 113721 113722 113723[endsect] 113724 113725 113726 113727[section:overload6 read_until (6 of 24 overloads)] 113728 113729 113730Read data into a dynamic buffer sequence until some part of the data it contains matches a regular expression. 113731 113732 113733 template< 113734 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 113735 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``> 113736 std::size_t read_until( 113737 SyncReadStream & s, 113738 DynamicBuffer_v1 && buffers, 113739 const boost::regex & expr, 113740 boost::system::error_code & ec, 113741 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 113742 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 113743 113744 113745This 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: 113746 113747 113748* A substring of the dynamic buffer sequence's get area matches the regular expression. 113749 113750 113751* An error occurred. 113752 113753This 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. 113754 113755 113756[heading Parameters] 113757 113758 113759[variablelist 113760 113761[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 113762 113763[[buffers][A dynamic buffer sequence into which the data will be read.]] 113764 113765[[expr][The regular expression.]] 113766 113767[[ec][Set to indicate what error occurred, if any.]] 113768 113769] 113770 113771 113772[heading Return Value] 113773 113774The 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. 113775 113776 113777[heading Remarks] 113778 113779After 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. 113780 113781 113782 113783 113784[endsect] 113785 113786 113787 113788[section:overload7 read_until (7 of 24 overloads)] 113789 113790 113791Read data into a dynamic buffer sequence until a function object indicates a match. 113792 113793 113794 template< 113795 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 113796 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``, 113797 typename MatchCondition> 113798 std::size_t read_until( 113799 SyncReadStream & s, 113800 DynamicBuffer_v1 && buffers, 113801 MatchCondition match_condition, 113802 typename constraint< is_match_condition< MatchCondition >::value >::type = 0, 113803 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 113804 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 113805 113806 113807This 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: 113808 113809 113810* The match condition function object returns a std::pair where the second element evaluates to true. 113811 113812 113813* An error occurred. 113814 113815This 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. 113816 113817 113818[heading Parameters] 113819 113820 113821[variablelist 113822 113823[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 113824 113825[[buffers][A dynamic buffer sequence into which the data will be read.]] 113826 113827[[match_condition][The function object to be called to determine whether a match exists. The signature of the function object must be: 113828`` 113829 pair<iterator, bool> match_condition(iterator begin, iterator end); 113830`` 113831where `iterator` represents the type: 113832`` 113833 buffers_iterator<typename DynamicBuffer_v1::const_buffers_type> 113834`` 113835The 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.]] 113836 113837] 113838 113839 113840[heading Return Value] 113841 113842The number of bytes in the dynamic\_buffer's get area that have been fully consumed by the match function. 113843 113844 113845[heading Exceptions] 113846 113847 113848[variablelist 113849 113850[[boost::system::system_error][Thrown on failure.]] 113851 113852] 113853 113854 113855[heading Remarks] 113856 113857After 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. 113858 113859The 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. 113860 113861 113862[heading Examples] 113863 113864To read data into a dynamic buffer sequence until whitespace is encountered: 113865 113866 typedef boost::asio::buffers_iterator< 113867 boost::asio::const_buffers_1> iterator; 113868 113869 std::pair<iterator, bool> 113870 match_whitespace(iterator begin, iterator end) 113871 { 113872 iterator i = begin; 113873 while (i != end) 113874 if (std::isspace(*i++)) 113875 return std::make_pair(i, true); 113876 return std::make_pair(i, false); 113877 } 113878 ... 113879 std::string data; 113880 boost::asio::read_until(s, data, match_whitespace); 113881 113882 113883 113884 113885To read data into a `std::string` until a matching character is found: 113886 113887 class match_char 113888 { 113889 public: 113890 explicit match_char(char c) : c_(c) {} 113891 113892 template <typename Iterator> 113893 std::pair<Iterator, bool> operator()( 113894 Iterator begin, Iterator end) const 113895 { 113896 Iterator i = begin; 113897 while (i != end) 113898 if (c_ == *i++) 113899 return std::make_pair(i, true); 113900 return std::make_pair(i, false); 113901 } 113902 113903 private: 113904 char c_; 113905 }; 113906 113907 namespace asio { 113908 template <> struct is_match_condition<match_char> 113909 : public boost::true_type {}; 113910 } // namespace asio 113911 ... 113912 std::string data; 113913 boost::asio::read_until(s, data, match_char('a')); 113914 113915 113916 113917 113918 113919[endsect] 113920 113921 113922 113923[section:overload8 read_until (8 of 24 overloads)] 113924 113925 113926Read data into a dynamic buffer sequence until a function object indicates a match. 113927 113928 113929 template< 113930 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 113931 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``, 113932 typename MatchCondition> 113933 std::size_t read_until( 113934 SyncReadStream & s, 113935 DynamicBuffer_v1 && buffers, 113936 MatchCondition match_condition, 113937 boost::system::error_code & ec, 113938 typename constraint< is_match_condition< MatchCondition >::value >::type = 0, 113939 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 113940 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 113941 113942 113943This 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: 113944 113945 113946* The match condition function object returns a std::pair where the second element evaluates to true. 113947 113948 113949* An error occurred. 113950 113951This 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. 113952 113953 113954[heading Parameters] 113955 113956 113957[variablelist 113958 113959[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 113960 113961[[buffers][A dynamic buffer sequence into which the data will be read.]] 113962 113963[[match_condition][The function object to be called to determine whether a match exists. The signature of the function object must be: 113964`` 113965 pair<iterator, bool> match_condition(iterator begin, iterator end); 113966`` 113967where `iterator` represents the type: 113968`` 113969 buffers_iterator<DynamicBuffer_v1::const_buffers_type> 113970`` 113971The 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.]] 113972 113973[[ec][Set to indicate what error occurred, if any.]] 113974 113975] 113976 113977 113978[heading Return Value] 113979 113980The 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. 113981 113982 113983[heading Remarks] 113984 113985After 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. 113986 113987The 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. 113988 113989 113990 113991 113992[endsect] 113993 113994 113995 113996[section:overload9 read_until (9 of 24 overloads)] 113997 113998 113999Read data into a streambuf until it contains a specified delimiter. 114000 114001 114002 template< 114003 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 114004 typename Allocator> 114005 std::size_t read_until( 114006 SyncReadStream & s, 114007 boost::asio::basic_streambuf< Allocator > & b, 114008 char delim); 114009 114010 114011This 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: 114012 114013 114014* The get area of the streambuf contains the specified delimiter. 114015 114016 114017* An error occurred. 114018 114019This 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. 114020 114021 114022[heading Parameters] 114023 114024 114025[variablelist 114026 114027[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 114028 114029[[b][A streambuf object into which the data will be read.]] 114030 114031[[delim][The delimiter character.]] 114032 114033] 114034 114035 114036[heading Return Value] 114037 114038The number of bytes in the streambuf's get area up to and including the delimiter. 114039 114040 114041[heading Exceptions] 114042 114043 114044[variablelist 114045 114046[[boost::system::system_error][Thrown on failure.]] 114047 114048] 114049 114050 114051[heading Remarks] 114052 114053After 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. 114054 114055 114056[heading Example] 114057 114058To read data into a streambuf until a newline is encountered: 114059 114060 boost::asio::streambuf b; 114061 boost::asio::read_until(s, b, '\n'); 114062 std::istream is(&b); 114063 std::string line; 114064 std::getline(is, line); 114065 114066 114067After the `read_until` operation completes successfully, the buffer `b` contains the delimiter: 114068 114069 { 'a', 'b', ..., 'c', '\n', 'd', 'e', ... } 114070 114071 114072The call to `std::getline` then extracts the data up to and including the newline (which is discarded), so that the string `line` contains: 114073 114074 { 'a', 'b', ..., 'c' } 114075 114076 114077The remaining data is left in the buffer `b` as follows: 114078 114079 { 'd', 'e', ... } 114080 114081 114082This data may be the start of a new line, to be extracted by a subsequent `read_until` operation. 114083 114084 114085 114086 114087[endsect] 114088 114089 114090 114091[section:overload10 read_until (10 of 24 overloads)] 114092 114093 114094Read data into a streambuf until it contains a specified delimiter. 114095 114096 114097 template< 114098 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 114099 typename Allocator> 114100 std::size_t read_until( 114101 SyncReadStream & s, 114102 boost::asio::basic_streambuf< Allocator > & b, 114103 char delim, 114104 boost::system::error_code & ec); 114105 114106 114107This 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: 114108 114109 114110* The get area of the streambuf contains the specified delimiter. 114111 114112 114113* An error occurred. 114114 114115This 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. 114116 114117 114118[heading Parameters] 114119 114120 114121[variablelist 114122 114123[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 114124 114125[[b][A streambuf object into which the data will be read.]] 114126 114127[[delim][The delimiter character.]] 114128 114129[[ec][Set to indicate what error occurred, if any.]] 114130 114131] 114132 114133 114134[heading Return Value] 114135 114136The number of bytes in the streambuf's get area up to and including the delimiter. Returns 0 if an error occurred. 114137 114138 114139[heading Remarks] 114140 114141After 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. 114142 114143 114144 114145 114146[endsect] 114147 114148 114149 114150[section:overload11 read_until (11 of 24 overloads)] 114151 114152 114153Read data into a streambuf until it contains a specified delimiter. 114154 114155 114156 template< 114157 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 114158 typename Allocator> 114159 std::size_t read_until( 114160 SyncReadStream & s, 114161 boost::asio::basic_streambuf< Allocator > & b, 114162 string_view delim); 114163 114164 114165This 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: 114166 114167 114168* The get area of the streambuf contains the specified delimiter. 114169 114170 114171* An error occurred. 114172 114173This 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. 114174 114175 114176[heading Parameters] 114177 114178 114179[variablelist 114180 114181[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 114182 114183[[b][A streambuf object into which the data will be read.]] 114184 114185[[delim][The delimiter string.]] 114186 114187] 114188 114189 114190[heading Return Value] 114191 114192The number of bytes in the streambuf's get area up to and including the delimiter. 114193 114194 114195[heading Exceptions] 114196 114197 114198[variablelist 114199 114200[[boost::system::system_error][Thrown on failure.]] 114201 114202] 114203 114204 114205[heading Remarks] 114206 114207After 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. 114208 114209 114210[heading Example] 114211 114212To read data into a streambuf until a newline is encountered: 114213 114214 boost::asio::streambuf b; 114215 boost::asio::read_until(s, b, "\r\n"); 114216 std::istream is(&b); 114217 std::string line; 114218 std::getline(is, line); 114219 114220 114221After the `read_until` operation completes successfully, the buffer `b` contains the delimiter: 114222 114223 { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } 114224 114225 114226The call to `std::getline` then extracts the data up to and including the newline (which is discarded), so that the string `line` contains: 114227 114228 { 'a', 'b', ..., 'c', '\r' } 114229 114230 114231The remaining data is left in the buffer `b` as follows: 114232 114233 { 'd', 'e', ... } 114234 114235 114236This data may be the start of a new line, to be extracted by a subsequent `read_until` operation. 114237 114238 114239 114240 114241[endsect] 114242 114243 114244 114245[section:overload12 read_until (12 of 24 overloads)] 114246 114247 114248Read data into a streambuf until it contains a specified delimiter. 114249 114250 114251 template< 114252 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 114253 typename Allocator> 114254 std::size_t read_until( 114255 SyncReadStream & s, 114256 boost::asio::basic_streambuf< Allocator > & b, 114257 string_view delim, 114258 boost::system::error_code & ec); 114259 114260 114261This 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: 114262 114263 114264* The get area of the streambuf contains the specified delimiter. 114265 114266 114267* An error occurred. 114268 114269This 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. 114270 114271 114272[heading Parameters] 114273 114274 114275[variablelist 114276 114277[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 114278 114279[[b][A streambuf object into which the data will be read.]] 114280 114281[[delim][The delimiter string.]] 114282 114283[[ec][Set to indicate what error occurred, if any.]] 114284 114285] 114286 114287 114288[heading Return Value] 114289 114290The number of bytes in the streambuf's get area up to and including the delimiter. Returns 0 if an error occurred. 114291 114292 114293[heading Remarks] 114294 114295After 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. 114296 114297 114298 114299 114300[endsect] 114301 114302 114303 114304[section:overload13 read_until (13 of 24 overloads)] 114305 114306 114307Read data into a streambuf until some part of the data it contains matches a regular expression. 114308 114309 114310 template< 114311 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 114312 typename Allocator> 114313 std::size_t read_until( 114314 SyncReadStream & s, 114315 boost::asio::basic_streambuf< Allocator > & b, 114316 const boost::regex & expr); 114317 114318 114319This 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: 114320 114321 114322* A substring of the streambuf's get area matches the regular expression. 114323 114324 114325* An error occurred. 114326 114327This 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. 114328 114329 114330[heading Parameters] 114331 114332 114333[variablelist 114334 114335[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 114336 114337[[b][A streambuf object into which the data will be read.]] 114338 114339[[expr][The regular expression.]] 114340 114341] 114342 114343 114344[heading Return Value] 114345 114346The number of bytes in the streambuf's get area up to and including the substring that matches the regular expression. 114347 114348 114349[heading Exceptions] 114350 114351 114352[variablelist 114353 114354[[boost::system::system_error][Thrown on failure.]] 114355 114356] 114357 114358 114359[heading Remarks] 114360 114361After 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. 114362 114363 114364[heading Example] 114365 114366To read data into a streambuf until a CR-LF sequence is encountered: 114367 114368 boost::asio::streambuf b; 114369 boost::asio::read_until(s, b, boost::regex("\r\n")); 114370 std::istream is(&b); 114371 std::string line; 114372 std::getline(is, line); 114373 114374 114375After the `read_until` operation completes successfully, the buffer `b` contains the data which matched the regular expression: 114376 114377 { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } 114378 114379 114380The call to `std::getline` then extracts the data up to and including the newline (which is discarded), so that the string `line` contains: 114381 114382 { 'a', 'b', ..., 'c', '\r' } 114383 114384 114385The remaining data is left in the buffer `b` as follows: 114386 114387 { 'd', 'e', ... } 114388 114389 114390This data may be the start of a new line, to be extracted by a subsequent `read_until` operation. 114391 114392 114393 114394 114395[endsect] 114396 114397 114398 114399[section:overload14 read_until (14 of 24 overloads)] 114400 114401 114402Read data into a streambuf until some part of the data it contains matches a regular expression. 114403 114404 114405 template< 114406 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 114407 typename Allocator> 114408 std::size_t read_until( 114409 SyncReadStream & s, 114410 boost::asio::basic_streambuf< Allocator > & b, 114411 const boost::regex & expr, 114412 boost::system::error_code & ec); 114413 114414 114415This 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: 114416 114417 114418* A substring of the streambuf's get area matches the regular expression. 114419 114420 114421* An error occurred. 114422 114423This 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. 114424 114425 114426[heading Parameters] 114427 114428 114429[variablelist 114430 114431[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 114432 114433[[b][A streambuf object into which the data will be read.]] 114434 114435[[expr][The regular expression.]] 114436 114437[[ec][Set to indicate what error occurred, if any.]] 114438 114439] 114440 114441 114442[heading Return Value] 114443 114444The 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. 114445 114446 114447[heading Remarks] 114448 114449After 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. 114450 114451 114452 114453 114454[endsect] 114455 114456 114457 114458[section:overload15 read_until (15 of 24 overloads)] 114459 114460 114461Read data into a streambuf until a function object indicates a match. 114462 114463 114464 template< 114465 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 114466 typename Allocator, 114467 typename MatchCondition> 114468 std::size_t read_until( 114469 SyncReadStream & s, 114470 boost::asio::basic_streambuf< Allocator > & b, 114471 MatchCondition match_condition, 114472 typename constraint< is_match_condition< MatchCondition >::value >::type = 0); 114473 114474 114475This 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: 114476 114477 114478* The match condition function object returns a std::pair where the second element evaluates to true. 114479 114480 114481* An error occurred. 114482 114483This 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. 114484 114485 114486[heading Parameters] 114487 114488 114489[variablelist 114490 114491[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 114492 114493[[b][A streambuf object into which the data will be read.]] 114494 114495[[match_condition][The function object to be called to determine whether a match exists. The signature of the function object must be: 114496`` 114497 pair<iterator, bool> match_condition(iterator begin, iterator end); 114498`` 114499where `iterator` represents the type: 114500`` 114501 buffers_iterator<basic_streambuf<Allocator>::const_buffers_type> 114502`` 114503The 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.]] 114504 114505] 114506 114507 114508[heading Return Value] 114509 114510The number of bytes in the streambuf's get area that have been fully consumed by the match function. 114511 114512 114513[heading Exceptions] 114514 114515 114516[variablelist 114517 114518[[boost::system::system_error][Thrown on failure.]] 114519 114520] 114521 114522 114523[heading Remarks] 114524 114525After 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. 114526 114527The 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. 114528 114529 114530[heading Examples] 114531 114532To read data into a streambuf until whitespace is encountered: 114533 114534 typedef boost::asio::buffers_iterator< 114535 boost::asio::streambuf::const_buffers_type> iterator; 114536 114537 std::pair<iterator, bool> 114538 match_whitespace(iterator begin, iterator end) 114539 { 114540 iterator i = begin; 114541 while (i != end) 114542 if (std::isspace(*i++)) 114543 return std::make_pair(i, true); 114544 return std::make_pair(i, false); 114545 } 114546 ... 114547 boost::asio::streambuf b; 114548 boost::asio::read_until(s, b, match_whitespace); 114549 114550 114551 114552 114553To read data into a streambuf until a matching character is found: 114554 114555 class match_char 114556 { 114557 public: 114558 explicit match_char(char c) : c_(c) {} 114559 114560 template <typename Iterator> 114561 std::pair<Iterator, bool> operator()( 114562 Iterator begin, Iterator end) const 114563 { 114564 Iterator i = begin; 114565 while (i != end) 114566 if (c_ == *i++) 114567 return std::make_pair(i, true); 114568 return std::make_pair(i, false); 114569 } 114570 114571 private: 114572 char c_; 114573 }; 114574 114575 namespace asio { 114576 template <> struct is_match_condition<match_char> 114577 : public boost::true_type {}; 114578 } // namespace asio 114579 ... 114580 boost::asio::streambuf b; 114581 boost::asio::read_until(s, b, match_char('a')); 114582 114583 114584 114585 114586 114587[endsect] 114588 114589 114590 114591[section:overload16 read_until (16 of 24 overloads)] 114592 114593 114594Read data into a streambuf until a function object indicates a match. 114595 114596 114597 template< 114598 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 114599 typename Allocator, 114600 typename MatchCondition> 114601 std::size_t read_until( 114602 SyncReadStream & s, 114603 boost::asio::basic_streambuf< Allocator > & b, 114604 MatchCondition match_condition, 114605 boost::system::error_code & ec, 114606 typename constraint< is_match_condition< MatchCondition >::value >::type = 0); 114607 114608 114609This 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: 114610 114611 114612* The match condition function object returns a std::pair where the second element evaluates to true. 114613 114614 114615* An error occurred. 114616 114617This 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. 114618 114619 114620[heading Parameters] 114621 114622 114623[variablelist 114624 114625[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 114626 114627[[b][A streambuf object into which the data will be read.]] 114628 114629[[match_condition][The function object to be called to determine whether a match exists. The signature of the function object must be: 114630`` 114631 pair<iterator, bool> match_condition(iterator begin, iterator end); 114632`` 114633where `iterator` represents the type: 114634`` 114635 buffers_iterator<basic_streambuf<Allocator>::const_buffers_type> 114636`` 114637The 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.]] 114638 114639[[ec][Set to indicate what error occurred, if any.]] 114640 114641] 114642 114643 114644[heading Return Value] 114645 114646The number of bytes in the streambuf's get area that have been fully consumed by the match function. Returns 0 if an error occurred. 114647 114648 114649[heading Remarks] 114650 114651After 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. 114652 114653The 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. 114654 114655 114656 114657 114658[endsect] 114659 114660 114661 114662[section:overload17 read_until (17 of 24 overloads)] 114663 114664 114665Read data into a dynamic buffer sequence until it contains a specified delimiter. 114666 114667 114668 template< 114669 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 114670 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``> 114671 std::size_t read_until( 114672 SyncReadStream & s, 114673 DynamicBuffer_v2 buffers, 114674 char delim, 114675 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 114676 114677 114678This 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: 114679 114680 114681* The get area of the dynamic buffer sequence contains the specified delimiter. 114682 114683 114684* An error occurred. 114685 114686This 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. 114687 114688 114689[heading Parameters] 114690 114691 114692[variablelist 114693 114694[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 114695 114696[[buffers][The dynamic buffer sequence into which the data will be read.]] 114697 114698[[delim][The delimiter character.]] 114699 114700] 114701 114702 114703[heading Return Value] 114704 114705The number of bytes in the dynamic buffer sequence's get area up to and including the delimiter. 114706 114707 114708[heading Exceptions] 114709 114710 114711[variablelist 114712 114713[[boost::system::system_error][Thrown on failure.]] 114714 114715] 114716 114717 114718[heading Remarks] 114719 114720After 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. 114721 114722 114723[heading Example] 114724 114725To read data into a `std::string` until a newline is encountered: 114726 114727 std::string data; 114728 std::size_t n = boost::asio::read_until(s, 114729 boost::asio::dynamic_buffer(data), '\n'); 114730 std::string line = data.substr(0, n); 114731 data.erase(0, n); 114732 114733 114734After the `read_until` operation completes successfully, the string `data` contains the delimiter: 114735 114736 { 'a', 'b', ..., 'c', '\n', 'd', 'e', ... } 114737 114738 114739The call to `substr` then extracts the data up to and including the delimiter, so that the string `line` contains: 114740 114741 { 'a', 'b', ..., 'c', '\n' } 114742 114743 114744After the call to `erase`, the remaining data is left in the buffer `b` as follows: 114745 114746 { 'd', 'e', ... } 114747 114748 114749This data may be the start of a new line, to be extracted by a subsequent `read_until` operation. 114750 114751 114752 114753 114754[endsect] 114755 114756 114757 114758[section:overload18 read_until (18 of 24 overloads)] 114759 114760 114761Read data into a dynamic buffer sequence until it contains a specified delimiter. 114762 114763 114764 template< 114765 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 114766 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``> 114767 std::size_t read_until( 114768 SyncReadStream & s, 114769 DynamicBuffer_v2 buffers, 114770 char delim, 114771 boost::system::error_code & ec, 114772 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 114773 114774 114775This 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: 114776 114777 114778* The get area of the dynamic buffer sequence contains the specified delimiter. 114779 114780 114781* An error occurred. 114782 114783This 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. 114784 114785 114786[heading Parameters] 114787 114788 114789[variablelist 114790 114791[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 114792 114793[[buffers][The dynamic buffer sequence into which the data will be read.]] 114794 114795[[delim][The delimiter character.]] 114796 114797[[ec][Set to indicate what error occurred, if any.]] 114798 114799] 114800 114801 114802[heading Return Value] 114803 114804The number of bytes in the dynamic buffer sequence's get area up to and including the delimiter. Returns 0 if an error occurred. 114805 114806 114807[heading Remarks] 114808 114809After 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. 114810 114811 114812 114813 114814[endsect] 114815 114816 114817 114818[section:overload19 read_until (19 of 24 overloads)] 114819 114820 114821Read data into a dynamic buffer sequence until it contains a specified delimiter. 114822 114823 114824 template< 114825 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 114826 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``> 114827 std::size_t read_until( 114828 SyncReadStream & s, 114829 DynamicBuffer_v2 buffers, 114830 string_view delim, 114831 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 114832 114833 114834This 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: 114835 114836 114837* The get area of the dynamic buffer sequence contains the specified delimiter. 114838 114839 114840* An error occurred. 114841 114842This 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. 114843 114844 114845[heading Parameters] 114846 114847 114848[variablelist 114849 114850[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 114851 114852[[buffers][The dynamic buffer sequence into which the data will be read.]] 114853 114854[[delim][The delimiter string.]] 114855 114856] 114857 114858 114859[heading Return Value] 114860 114861The number of bytes in the dynamic buffer sequence's get area up to and including the delimiter. 114862 114863 114864[heading Remarks] 114865 114866After 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. 114867 114868 114869[heading Example] 114870 114871To read data into a `std::string` until a CR-LF sequence is encountered: 114872 114873 std::string data; 114874 std::size_t n = boost::asio::read_until(s, 114875 boost::asio::dynamic_buffer(data), "\r\n"); 114876 std::string line = data.substr(0, n); 114877 data.erase(0, n); 114878 114879 114880After the `read_until` operation completes successfully, the string `data` contains the delimiter: 114881 114882 { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } 114883 114884 114885The call to `substr` then extracts the data up to and including the delimiter, so that the string `line` contains: 114886 114887 { 'a', 'b', ..., 'c', '\r', '\n' } 114888 114889 114890After the call to `erase`, the remaining data is left in the buffer `b` as follows: 114891 114892 { 'd', 'e', ... } 114893 114894 114895This data may be the start of a new line, to be extracted by a subsequent `read_until` operation. 114896 114897 114898 114899 114900[endsect] 114901 114902 114903 114904[section:overload20 read_until (20 of 24 overloads)] 114905 114906 114907Read data into a dynamic buffer sequence until it contains a specified delimiter. 114908 114909 114910 template< 114911 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 114912 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``> 114913 std::size_t read_until( 114914 SyncReadStream & s, 114915 DynamicBuffer_v2 buffers, 114916 string_view delim, 114917 boost::system::error_code & ec, 114918 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 114919 114920 114921This 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: 114922 114923 114924* The get area of the dynamic buffer sequence contains the specified delimiter. 114925 114926 114927* An error occurred. 114928 114929This 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. 114930 114931 114932[heading Parameters] 114933 114934 114935[variablelist 114936 114937[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 114938 114939[[buffers][The dynamic buffer sequence into which the data will be read.]] 114940 114941[[delim][The delimiter string.]] 114942 114943[[ec][Set to indicate what error occurred, if any.]] 114944 114945] 114946 114947 114948[heading Return Value] 114949 114950The number of bytes in the dynamic buffer sequence's get area up to and including the delimiter. Returns 0 if an error occurred. 114951 114952 114953[heading Remarks] 114954 114955After 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. 114956 114957 114958 114959 114960[endsect] 114961 114962 114963 114964[section:overload21 read_until (21 of 24 overloads)] 114965 114966 114967Read data into a dynamic buffer sequence until some part of the data it contains matches a regular expression. 114968 114969 114970 template< 114971 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 114972 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``> 114973 std::size_t read_until( 114974 SyncReadStream & s, 114975 DynamicBuffer_v2 buffers, 114976 const boost::regex & expr, 114977 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 114978 114979 114980This 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: 114981 114982 114983* A substring of the dynamic buffer sequence's get area matches the regular expression. 114984 114985 114986* An error occurred. 114987 114988This 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. 114989 114990 114991[heading Parameters] 114992 114993 114994[variablelist 114995 114996[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 114997 114998[[buffers][A dynamic buffer sequence into which the data will be read.]] 114999 115000[[expr][The regular expression.]] 115001 115002] 115003 115004 115005[heading Return Value] 115006 115007The number of bytes in the dynamic buffer sequence's get area up to and including the substring that matches the regular expression. 115008 115009 115010[heading Exceptions] 115011 115012 115013[variablelist 115014 115015[[boost::system::system_error][Thrown on failure.]] 115016 115017] 115018 115019 115020[heading Remarks] 115021 115022After 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. 115023 115024 115025[heading Example] 115026 115027To read data into a `std::string` until a CR-LF sequence is encountered: 115028 115029 std::string data; 115030 std::size_t n = boost::asio::read_until(s, 115031 boost::asio::dynamic_buffer(data), boost::regex("\r\n")); 115032 std::string line = data.substr(0, n); 115033 data.erase(0, n); 115034 115035 115036After the `read_until` operation completes successfully, the string `data` contains the delimiter: 115037 115038 { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } 115039 115040 115041The call to `substr` then extracts the data up to and including the delimiter, so that the string `line` contains: 115042 115043 { 'a', 'b', ..., 'c', '\r', '\n' } 115044 115045 115046After the call to `erase`, the remaining data is left in the buffer `b` as follows: 115047 115048 { 'd', 'e', ... } 115049 115050 115051This data may be the start of a new line, to be extracted by a subsequent `read_until` operation. 115052 115053 115054 115055 115056[endsect] 115057 115058 115059 115060[section:overload22 read_until (22 of 24 overloads)] 115061 115062 115063Read data into a dynamic buffer sequence until some part of the data it contains matches a regular expression. 115064 115065 115066 template< 115067 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 115068 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``> 115069 std::size_t read_until( 115070 SyncReadStream & s, 115071 DynamicBuffer_v2 buffers, 115072 const boost::regex & expr, 115073 boost::system::error_code & ec, 115074 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 115075 115076 115077This 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: 115078 115079 115080* A substring of the dynamic buffer sequence's get area matches the regular expression. 115081 115082 115083* An error occurred. 115084 115085This 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. 115086 115087 115088[heading Parameters] 115089 115090 115091[variablelist 115092 115093[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 115094 115095[[buffers][A dynamic buffer sequence into which the data will be read.]] 115096 115097[[expr][The regular expression.]] 115098 115099[[ec][Set to indicate what error occurred, if any.]] 115100 115101] 115102 115103 115104[heading Return Value] 115105 115106The 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. 115107 115108 115109[heading Remarks] 115110 115111After 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. 115112 115113 115114 115115 115116[endsect] 115117 115118 115119 115120[section:overload23 read_until (23 of 24 overloads)] 115121 115122 115123Read data into a dynamic buffer sequence until a function object indicates a match. 115124 115125 115126 template< 115127 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 115128 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``, 115129 typename MatchCondition> 115130 std::size_t read_until( 115131 SyncReadStream & s, 115132 DynamicBuffer_v2 buffers, 115133 MatchCondition match_condition, 115134 typename constraint< is_match_condition< MatchCondition >::value >::type = 0, 115135 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 115136 115137 115138This 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: 115139 115140 115141* The match condition function object returns a std::pair where the second element evaluates to true. 115142 115143 115144* An error occurred. 115145 115146This 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. 115147 115148 115149[heading Parameters] 115150 115151 115152[variablelist 115153 115154[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 115155 115156[[buffers][A dynamic buffer sequence into which the data will be read.]] 115157 115158[[match_condition][The function object to be called to determine whether a match exists. The signature of the function object must be: 115159`` 115160 pair<iterator, bool> match_condition(iterator begin, iterator end); 115161`` 115162where `iterator` represents the type: 115163`` 115164 buffers_iterator<typename DynamicBuffer_v2::const_buffers_type> 115165`` 115166The 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.]] 115167 115168] 115169 115170 115171[heading Return Value] 115172 115173The number of bytes in the dynamic\_buffer's get area that have been fully consumed by the match function. 115174 115175 115176[heading Exceptions] 115177 115178 115179[variablelist 115180 115181[[boost::system::system_error][Thrown on failure.]] 115182 115183] 115184 115185 115186[heading Remarks] 115187 115188After 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. 115189 115190The 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. 115191 115192 115193[heading Examples] 115194 115195To read data into a dynamic buffer sequence until whitespace is encountered: 115196 115197 typedef boost::asio::buffers_iterator< 115198 boost::asio::const_buffers_1> iterator; 115199 115200 std::pair<iterator, bool> 115201 match_whitespace(iterator begin, iterator end) 115202 { 115203 iterator i = begin; 115204 while (i != end) 115205 if (std::isspace(*i++)) 115206 return std::make_pair(i, true); 115207 return std::make_pair(i, false); 115208 } 115209 ... 115210 std::string data; 115211 boost::asio::read_until(s, data, match_whitespace); 115212 115213 115214 115215 115216To read data into a `std::string` until a matching character is found: 115217 115218 class match_char 115219 { 115220 public: 115221 explicit match_char(char c) : c_(c) {} 115222 115223 template <typename Iterator> 115224 std::pair<Iterator, bool> operator()( 115225 Iterator begin, Iterator end) const 115226 { 115227 Iterator i = begin; 115228 while (i != end) 115229 if (c_ == *i++) 115230 return std::make_pair(i, true); 115231 return std::make_pair(i, false); 115232 } 115233 115234 private: 115235 char c_; 115236 }; 115237 115238 namespace asio { 115239 template <> struct is_match_condition<match_char> 115240 : public boost::true_type {}; 115241 } // namespace asio 115242 ... 115243 std::string data; 115244 boost::asio::read_until(s, data, match_char('a')); 115245 115246 115247 115248 115249 115250[endsect] 115251 115252 115253 115254[section:overload24 read_until (24 of 24 overloads)] 115255 115256 115257Read data into a dynamic buffer sequence until a function object indicates a match. 115258 115259 115260 template< 115261 typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``, 115262 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``, 115263 typename MatchCondition> 115264 std::size_t read_until( 115265 SyncReadStream & s, 115266 DynamicBuffer_v2 buffers, 115267 MatchCondition match_condition, 115268 boost::system::error_code & ec, 115269 typename constraint< is_match_condition< MatchCondition >::value >::type = 0, 115270 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 115271 115272 115273This 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: 115274 115275 115276* The match condition function object returns a std::pair where the second element evaluates to true. 115277 115278 115279* An error occurred. 115280 115281This 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. 115282 115283 115284[heading Parameters] 115285 115286 115287[variablelist 115288 115289[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]] 115290 115291[[buffers][A dynamic buffer sequence into which the data will be read.]] 115292 115293[[match_condition][The function object to be called to determine whether a match exists. The signature of the function object must be: 115294`` 115295 pair<iterator, bool> match_condition(iterator begin, iterator end); 115296`` 115297where `iterator` represents the type: 115298`` 115299 buffers_iterator<DynamicBuffer_v2::const_buffers_type> 115300`` 115301The 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.]] 115302 115303[[ec][Set to indicate what error occurred, if any.]] 115304 115305] 115306 115307 115308[heading Return Value] 115309 115310The 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. 115311 115312 115313[heading Remarks] 115314 115315After 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. 115316 115317The 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. 115318 115319 115320 115321 115322[endsect] 115323 115324 115325[endsect] 115326 115327 115328[section:redirect_error redirect_error] 115329 115330[indexterm1 boost_asio.indexterm.redirect_error..redirect_error] 115331Create a completion token to capture error\_code values to a variable. 115332 115333 115334 template< 115335 typename CompletionToken> 115336 redirect_error_t< typename decay< CompletionToken >::type > redirect_error( 115337 CompletionToken && completion_token, 115338 boost::system::error_code & ec); 115339 115340 115341[heading Requirements] 115342 115343['Header: ][^boost/asio/redirect_error.hpp] 115344 115345['Convenience header: ][^boost/asio.hpp] 115346 115347 115348[endsect] 115349 115350 115351[section:redirect_error_t redirect_error_t] 115352 115353[indexterm1 boost_asio.indexterm.redirect_error_t..redirect_error_t] 115354 115355 115356Completion token type used to specify that an error produced by an asynchronous operation is captured to an error\_code variable. 115357 115358 115359 template< 115360 typename CompletionToken> 115361 class redirect_error_t 115362 115363 115364[heading Member Functions] 115365[table 115366 [[Name][Description]] 115367 115368 [ 115369 [[link boost_asio.reference.redirect_error_t.redirect_error_t [*redirect_error_t]] [constructor]] 115370 [Constructor. ] 115371 ] 115372 115373] 115374 115375[heading Data Members] 115376[table 115377 [[Name][Description]] 115378 115379 [ 115380 [[link boost_asio.reference.redirect_error_t.ec_ [*ec_]]] 115381 [] 115382 ] 115383 115384 [ 115385 [[link boost_asio.reference.redirect_error_t.token_ [*token_]]] 115386 [] 115387 ] 115388 115389] 115390 115391The [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. 115392 115393[heading Requirements] 115394 115395['Header: ][^boost/asio/redirect_error.hpp] 115396 115397['Convenience header: ][^boost/asio.hpp] 115398 115399 115400[section:ec_ redirect_error_t::ec_] 115401 115402[indexterm2 boost_asio.indexterm.redirect_error_t.ec_..ec_..redirect_error_t] 115403 115404 boost::system::error_code & ec_; 115405 115406 115407 115408[endsect] 115409 115410 115411 115412[section:redirect_error_t redirect_error_t::redirect_error_t] 115413 115414[indexterm2 boost_asio.indexterm.redirect_error_t.redirect_error_t..redirect_error_t..redirect_error_t] 115415Constructor. 115416 115417 115418 template< 115419 typename T> 115420 redirect_error_t( 115421 T && completion_token, 115422 boost::system::error_code & ec); 115423 115424 115425 115426[endsect] 115427 115428 115429 115430[section:token_ redirect_error_t::token_] 115431 115432[indexterm2 boost_asio.indexterm.redirect_error_t.token_..token_..redirect_error_t] 115433 115434 CompletionToken token_; 115435 115436 115437 115438[endsect] 115439 115440 115441 115442[endsect] 115443 115444 115445[section:require require] 115446 115447[indexterm1 boost_asio.indexterm.require..require] 115448A customisation point that applies a concept-preserving property to an object. 115449 115450 115451 constexpr unspecified require = unspecified; 115452 115453 115454The name `require` denotes a customisation point object. The expression `boost::asio::require(E, P0, Pn...)` for some subexpressions `E` and `P0`, and where `Pn...` represents `N` subexpressions (where `N` is 0 or more, and with types `T = decay_t<decltype(E)>` and `Prop0 = decay_t<decltype(P0)>`) is expression-equivalent to: 115455 115456 115457* If `is_applicable_property_v<T, Prop0> && Prop0::is_requirable` is not a well-formed constant expression with value `true`, `boost::asio::require(E, P0, Pn...)` is ill-formed. 115458 115459 115460* Otherwise, `E` if `N == 0` and the expression `Prop0::template static_query_v<T> == Prop0::value()` is a well-formed constant expression with value `true`. 115461 115462 115463* Otherwise, `(E).require(P0)` if `N == 0` and the expression `(E).require(P0)` is a valid expression. 115464 115465 115466* Otherwise, `require(E, P0)` if `N == 0` and the expression `require(E, P0)` is a valid expression with overload resolution performed in a context that does not include the declaration of the `require` customization point object. 115467 115468 115469* Otherwise, `boost::asio::require(boost::asio::require(E, P0), Pn...)` if `N > 0` and the expression `boost::asio::require(boost::asio::require(E, P0), Pn...)` is a valid expression. 115470 115471 115472* Otherwise, `boost::asio::require(E, P0, Pn...)` is ill-formed. 115473 115474 115475 115476[heading Requirements] 115477 115478['Header: ][^boost/asio/require.hpp] 115479 115480['Convenience header: ][^boost/asio.hpp] 115481 115482 115483[endsect] 115484 115485 115486 115487[section:require_concept require_concept] 115488 115489[indexterm1 boost_asio.indexterm.require_concept..require_concept] 115490A customisation point that applies a concept-enforcing property to an object. 115491 115492 115493 constexpr unspecified require_concept = unspecified; 115494 115495 115496The name `require_concept` denotes a customization point object. The expression `boost::asio::require_concept(E, P)` for some subexpressions `E` and `P` (with types `T = decay_t<decltype(E)>` and `Prop = decay_t<decltype(P)>`) is expression-equivalent to: 115497 115498 115499* If `is_applicable_property_v<T, Prop> && Prop::is_requirable_concept` is not a well-formed constant expression with value `true`, `boost::asio::require_concept(E, P)` is ill-formed. 115500 115501 115502* Otherwise, `E` if the expression `Prop::template static_query_v<T> == Prop::value()` is a well-formed constant expression with value `true`. 115503 115504 115505* Otherwise, `(E).require_concept(P)` if the expression `(E).require_concept(P)` is well-formed. 115506 115507 115508* Otherwise, `require_concept(E, P)` if the expression `require_concept(E, P)` is a valid expression with overload resolution performed in a context that does not include the declaration of the `require_concept` customization point object. 115509 115510 115511* Otherwise, `boost::asio::require_concept(E, P)` is ill-formed. 115512 115513 115514 115515[heading Requirements] 115516 115517['Header: ][^boost/asio/require_concept.hpp] 115518 115519['Convenience header: ][^boost/asio.hpp] 115520 115521 115522[endsect] 115523 115524 115525[section:require_concept_result require_concept_result] 115526 115527[indexterm1 boost_asio.indexterm.require_concept_result..require_concept_result] 115528 115529 115530A type trait that determines the result type of a `require_concept` expression. 115531 115532 115533 template< 115534 typename T, 115535 typename Property> 115536 struct require_concept_result 115537 115538 115539[heading Types] 115540[table 115541 [[Name][Description]] 115542 115543 [ 115544 115545 [[link boost_asio.reference.require_concept_result.type [*type]]] 115546 [The result of the require_concept expression. ] 115547 115548 ] 115549 115550] 115551 115552Class template `require_concept_result` is a trait that determines the result type of the expression `boost::asio::require_concept(std::declval<T>(), std::declval<Property>())`. 115553 115554[heading Requirements] 115555 115556['Header: ][^boost/asio/require_concept.hpp] 115557 115558['Convenience header: ][^boost/asio.hpp] 115559 115560 115561[section:type require_concept_result::type] 115562 115563[indexterm2 boost_asio.indexterm.require_concept_result.type..type..require_concept_result] 115564The result of the `require_concept` expression. 115565 115566 115567 typedef automatically_determined type; 115568 115569 115570 115571[heading Requirements] 115572 115573['Header: ][^boost/asio/require_concept.hpp] 115574 115575['Convenience header: ][^boost/asio.hpp] 115576 115577 115578[endsect] 115579 115580 115581 115582[endsect] 115583 115584[section:require_result require_result] 115585 115586[indexterm1 boost_asio.indexterm.require_result..require_result] 115587 115588 115589A type trait that determines the result type of a `require` expression. 115590 115591 115592 template< 115593 typename T, 115594 typename... Properties> 115595 struct require_result 115596 115597 115598[heading Types] 115599[table 115600 [[Name][Description]] 115601 115602 [ 115603 115604 [[link boost_asio.reference.require_result.type [*type]]] 115605 [The result of the require expression. ] 115606 115607 ] 115608 115609] 115610 115611Class template `require_result` is a trait that determines the result type of the expression `boost::asio::require(std::declval<T>(), std::declval<Properties>()...)`. 115612 115613[heading Requirements] 115614 115615['Header: ][^boost/asio/require.hpp] 115616 115617['Convenience header: ][^boost/asio.hpp] 115618 115619 115620[section:type require_result::type] 115621 115622[indexterm2 boost_asio.indexterm.require_result.type..type..require_result] 115623The result of the `require` expression. 115624 115625 115626 typedef automatically_determined type; 115627 115628 115629 115630[heading Requirements] 115631 115632['Header: ][^boost/asio/require.hpp] 115633 115634['Convenience header: ][^boost/asio.hpp] 115635 115636 115637[endsect] 115638 115639 115640 115641[endsect] 115642 115643 115644[section:resolver_errc__try_again resolver_errc::try_again] 115645 115646[indexterm1 boost_asio.indexterm.resolver_errc__try_again..resolver_errc::try_again] 115647 115648 const error::netdb_errors try_again = error::host_not_found_try_again; 115649 115650 115651[heading Requirements] 115652 115653['Header: ][^boost/asio/error.hpp] 115654 115655['Convenience header: ][^boost/asio.hpp] 115656 115657 115658[endsect] 115659 115660 115661 115662[section:serial_port serial_port] 115663 115664[indexterm1 boost_asio.indexterm.serial_port..serial_port] 115665Typedef for the typical usage of a serial port. 115666 115667 115668 typedef basic_serial_port serial_port; 115669 115670 115671[heading Types] 115672[table 115673 [[Name][Description]] 115674 115675 [ 115676 115677 [[link boost_asio.reference.basic_serial_port__rebind_executor [*rebind_executor]]] 115678 [Rebinds the serial port type to another executor. ] 115679 115680 ] 115681 115682 [ 115683 115684 [[link boost_asio.reference.basic_serial_port.executor_type [*executor_type]]] 115685 [The type of the executor associated with the object. ] 115686 115687 ] 115688 115689 [ 115690 115691 [[link boost_asio.reference.basic_serial_port.lowest_layer_type [*lowest_layer_type]]] 115692 [A basic_basic_serial_port is always the lowest layer. ] 115693 115694 ] 115695 115696 [ 115697 115698 [[link boost_asio.reference.basic_serial_port.native_handle_type [*native_handle_type]]] 115699 [The native representation of a serial port. ] 115700 115701 ] 115702 115703] 115704 115705[heading Member Functions] 115706[table 115707 [[Name][Description]] 115708 115709 [ 115710 [[link boost_asio.reference.basic_serial_port.assign [*assign]]] 115711 [Assign an existing native serial port to the serial port. ] 115712 ] 115713 115714 [ 115715 [[link boost_asio.reference.basic_serial_port.async_read_some [*async_read_some]]] 115716 [Start an asynchronous read. ] 115717 ] 115718 115719 [ 115720 [[link boost_asio.reference.basic_serial_port.async_write_some [*async_write_some]]] 115721 [Start an asynchronous write. ] 115722 ] 115723 115724 [ 115725 [[link boost_asio.reference.basic_serial_port.basic_serial_port [*basic_serial_port]] [constructor]] 115726 [Construct a basic_serial_port without opening it. 115727 [hr] 115728 Construct and open a basic_serial_port. 115729 [hr] 115730 Construct a basic_serial_port on an existing native serial port. 115731 [hr] 115732 Move-construct a basic_serial_port from another. ] 115733 ] 115734 115735 [ 115736 [[link boost_asio.reference.basic_serial_port.cancel [*cancel]]] 115737 [Cancel all asynchronous operations associated with the serial port. ] 115738 ] 115739 115740 [ 115741 [[link boost_asio.reference.basic_serial_port.close [*close]]] 115742 [Close the serial port. ] 115743 ] 115744 115745 [ 115746 [[link boost_asio.reference.basic_serial_port.get_executor [*get_executor]]] 115747 [Get the executor associated with the object. ] 115748 ] 115749 115750 [ 115751 [[link boost_asio.reference.basic_serial_port.get_option [*get_option]]] 115752 [Get an option from the serial port. ] 115753 ] 115754 115755 [ 115756 [[link boost_asio.reference.basic_serial_port.is_open [*is_open]]] 115757 [Determine whether the serial port is open. ] 115758 ] 115759 115760 [ 115761 [[link boost_asio.reference.basic_serial_port.lowest_layer [*lowest_layer]]] 115762 [Get a reference to the lowest layer. 115763 [hr] 115764 Get a const reference to the lowest layer. ] 115765 ] 115766 115767 [ 115768 [[link boost_asio.reference.basic_serial_port.native_handle [*native_handle]]] 115769 [Get the native serial port representation. ] 115770 ] 115771 115772 [ 115773 [[link boost_asio.reference.basic_serial_port.open [*open]]] 115774 [Open the serial port using the specified device name. ] 115775 ] 115776 115777 [ 115778 [[link boost_asio.reference.basic_serial_port.operator_eq_ [*operator=]]] 115779 [Move-assign a basic_serial_port from another. ] 115780 ] 115781 115782 [ 115783 [[link boost_asio.reference.basic_serial_port.read_some [*read_some]]] 115784 [Read some data from the serial port. ] 115785 ] 115786 115787 [ 115788 [[link boost_asio.reference.basic_serial_port.send_break [*send_break]]] 115789 [Send a break sequence to the serial port. ] 115790 ] 115791 115792 [ 115793 [[link boost_asio.reference.basic_serial_port.set_option [*set_option]]] 115794 [Set an option on the serial port. ] 115795 ] 115796 115797 [ 115798 [[link boost_asio.reference.basic_serial_port.write_some [*write_some]]] 115799 [Write some data to the serial port. ] 115800 ] 115801 115802 [ 115803 [[link boost_asio.reference.basic_serial_port._basic_serial_port [*~basic_serial_port]] [destructor]] 115804 [Destroys the serial port. ] 115805 ] 115806 115807] 115808 115809The [link boost_asio.reference.basic_serial_port `basic_serial_port`] class provides a wrapper over serial port functionality. 115810 115811 115812[heading Thread Safety] 115813 115814['Distinct] ['objects:] Safe. 115815 115816['Shared] ['objects:] Unsafe. 115817 115818 115819 115820 115821[heading Requirements] 115822 115823['Header: ][^boost/asio/serial_port.hpp] 115824 115825['Convenience header: ][^boost/asio.hpp] 115826 115827 115828[endsect] 115829 115830 115831[section:serial_port_base serial_port_base] 115832 115833[indexterm1 boost_asio.indexterm.serial_port_base..serial_port_base] 115834 115835 115836The [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. 115837 115838 115839 class serial_port_base 115840 115841 115842[heading Types] 115843[table 115844 [[Name][Description]] 115845 115846 [ 115847 115848 [[link boost_asio.reference.serial_port_base__baud_rate [*baud_rate]]] 115849 [Serial port option to permit changing the baud rate. ] 115850 115851 ] 115852 115853 [ 115854 115855 [[link boost_asio.reference.serial_port_base__character_size [*character_size]]] 115856 [Serial port option to permit changing the character size. ] 115857 115858 ] 115859 115860 [ 115861 115862 [[link boost_asio.reference.serial_port_base__flow_control [*flow_control]]] 115863 [Serial port option to permit changing the flow control. ] 115864 115865 ] 115866 115867 [ 115868 115869 [[link boost_asio.reference.serial_port_base__parity [*parity]]] 115870 [Serial port option to permit changing the parity. ] 115871 115872 ] 115873 115874 [ 115875 115876 [[link boost_asio.reference.serial_port_base__stop_bits [*stop_bits]]] 115877 [Serial port option to permit changing the number of stop bits. ] 115878 115879 ] 115880 115881] 115882 115883[heading Protected Member Functions] 115884[table 115885 [[Name][Description]] 115886 115887 [ 115888 [[link boost_asio.reference.serial_port_base._serial_port_base [*~serial_port_base]] [destructor]] 115889 [Protected destructor to prevent deletion through this type. ] 115890 ] 115891 115892] 115893 115894[heading Requirements] 115895 115896['Header: ][^boost/asio/serial_port_base.hpp] 115897 115898['Convenience header: ][^boost/asio.hpp] 115899 115900 115901[section:_serial_port_base serial_port_base::~serial_port_base] 115902 115903[indexterm2 boost_asio.indexterm.serial_port_base._serial_port_base..~serial_port_base..serial_port_base] 115904Protected destructor to prevent deletion through this type. 115905 115906 115907 ~serial_port_base(); 115908 115909 115910 115911[endsect] 115912 115913 115914 115915[endsect] 115916 115917[section:serial_port_base__baud_rate serial_port_base::baud_rate] 115918 115919[indexterm1 boost_asio.indexterm.serial_port_base__baud_rate..serial_port_base::baud_rate] 115920 115921 115922Serial port option to permit changing the baud rate. 115923 115924 115925 class baud_rate 115926 115927 115928[heading Member Functions] 115929[table 115930 [[Name][Description]] 115931 115932 [ 115933 [[link boost_asio.reference.serial_port_base__baud_rate.baud_rate [*baud_rate]] [constructor]] 115934 [] 115935 ] 115936 115937 [ 115938 [[link boost_asio.reference.serial_port_base__baud_rate.load [*load]]] 115939 [] 115940 ] 115941 115942 [ 115943 [[link boost_asio.reference.serial_port_base__baud_rate.store [*store]]] 115944 [] 115945 ] 115946 115947 [ 115948 [[link boost_asio.reference.serial_port_base__baud_rate.value [*value]]] 115949 [] 115950 ] 115951 115952] 115953 115954Implements changing the baud rate for a given serial port. 115955 115956[heading Requirements] 115957 115958['Header: ][^boost/asio/serial_port_base.hpp] 115959 115960['Convenience header: ][^boost/asio.hpp] 115961 115962 115963[section:baud_rate serial_port_base::baud_rate::baud_rate] 115964 115965[indexterm2 boost_asio.indexterm.serial_port_base__baud_rate.baud_rate..baud_rate..serial_port_base::baud_rate] 115966 115967 baud_rate( 115968 unsigned int rate = 0); 115969 115970 115971 115972[endsect] 115973 115974 115975 115976[section:load serial_port_base::baud_rate::load] 115977 115978[indexterm2 boost_asio.indexterm.serial_port_base__baud_rate.load..load..serial_port_base::baud_rate] 115979 115980 void load( 115981 const BOOST_ASIO_OPTION_STORAGE & storage, 115982 boost::system::error_code & ec); 115983 115984 115985 115986[endsect] 115987 115988 115989 115990[section:store serial_port_base::baud_rate::store] 115991 115992[indexterm2 boost_asio.indexterm.serial_port_base__baud_rate.store..store..serial_port_base::baud_rate] 115993 115994 void store( 115995 BOOST_ASIO_OPTION_STORAGE & storage, 115996 boost::system::error_code & ec) const; 115997 115998 115999 116000[endsect] 116001 116002 116003 116004[section:value serial_port_base::baud_rate::value] 116005 116006[indexterm2 boost_asio.indexterm.serial_port_base__baud_rate.value..value..serial_port_base::baud_rate] 116007 116008 unsigned int value() const; 116009 116010 116011 116012[endsect] 116013 116014 116015 116016[endsect] 116017 116018[section:serial_port_base__character_size serial_port_base::character_size] 116019 116020[indexterm1 boost_asio.indexterm.serial_port_base__character_size..serial_port_base::character_size] 116021 116022 116023Serial port option to permit changing the character size. 116024 116025 116026 class character_size 116027 116028 116029[heading Member Functions] 116030[table 116031 [[Name][Description]] 116032 116033 [ 116034 [[link boost_asio.reference.serial_port_base__character_size.character_size [*character_size]] [constructor]] 116035 [] 116036 ] 116037 116038 [ 116039 [[link boost_asio.reference.serial_port_base__character_size.load [*load]]] 116040 [] 116041 ] 116042 116043 [ 116044 [[link boost_asio.reference.serial_port_base__character_size.store [*store]]] 116045 [] 116046 ] 116047 116048 [ 116049 [[link boost_asio.reference.serial_port_base__character_size.value [*value]]] 116050 [] 116051 ] 116052 116053] 116054 116055Implements changing the character size for a given serial port. 116056 116057[heading Requirements] 116058 116059['Header: ][^boost/asio/serial_port_base.hpp] 116060 116061['Convenience header: ][^boost/asio.hpp] 116062 116063 116064[section:character_size serial_port_base::character_size::character_size] 116065 116066[indexterm2 boost_asio.indexterm.serial_port_base__character_size.character_size..character_size..serial_port_base::character_size] 116067 116068 character_size( 116069 unsigned int t = 8); 116070 116071 116072 116073[endsect] 116074 116075 116076 116077[section:load serial_port_base::character_size::load] 116078 116079[indexterm2 boost_asio.indexterm.serial_port_base__character_size.load..load..serial_port_base::character_size] 116080 116081 void load( 116082 const BOOST_ASIO_OPTION_STORAGE & storage, 116083 boost::system::error_code & ec); 116084 116085 116086 116087[endsect] 116088 116089 116090 116091[section:store serial_port_base::character_size::store] 116092 116093[indexterm2 boost_asio.indexterm.serial_port_base__character_size.store..store..serial_port_base::character_size] 116094 116095 void store( 116096 BOOST_ASIO_OPTION_STORAGE & storage, 116097 boost::system::error_code & ec) const; 116098 116099 116100 116101[endsect] 116102 116103 116104 116105[section:value serial_port_base::character_size::value] 116106 116107[indexterm2 boost_asio.indexterm.serial_port_base__character_size.value..value..serial_port_base::character_size] 116108 116109 unsigned int value() const; 116110 116111 116112 116113[endsect] 116114 116115 116116 116117[endsect] 116118 116119[section:serial_port_base__flow_control serial_port_base::flow_control] 116120 116121[indexterm1 boost_asio.indexterm.serial_port_base__flow_control..serial_port_base::flow_control] 116122 116123 116124Serial port option to permit changing the flow control. 116125 116126 116127 class flow_control 116128 116129 116130[heading Types] 116131[table 116132 [[Name][Description]] 116133 116134 [ 116135 116136 [[link boost_asio.reference.serial_port_base__flow_control.type [*type]]] 116137 [] 116138 116139 ] 116140 116141] 116142 116143[heading Member Functions] 116144[table 116145 [[Name][Description]] 116146 116147 [ 116148 [[link boost_asio.reference.serial_port_base__flow_control.flow_control [*flow_control]] [constructor]] 116149 [] 116150 ] 116151 116152 [ 116153 [[link boost_asio.reference.serial_port_base__flow_control.load [*load]]] 116154 [] 116155 ] 116156 116157 [ 116158 [[link boost_asio.reference.serial_port_base__flow_control.store [*store]]] 116159 [] 116160 ] 116161 116162 [ 116163 [[link boost_asio.reference.serial_port_base__flow_control.value [*value]]] 116164 [] 116165 ] 116166 116167] 116168 116169Implements changing the flow control for a given serial port. 116170 116171[heading Requirements] 116172 116173['Header: ][^boost/asio/serial_port_base.hpp] 116174 116175['Convenience header: ][^boost/asio.hpp] 116176 116177 116178[section:flow_control serial_port_base::flow_control::flow_control] 116179 116180[indexterm2 boost_asio.indexterm.serial_port_base__flow_control.flow_control..flow_control..serial_port_base::flow_control] 116181 116182 flow_control( 116183 type t = none); 116184 116185 116186 116187[endsect] 116188 116189 116190 116191[section:load serial_port_base::flow_control::load] 116192 116193[indexterm2 boost_asio.indexterm.serial_port_base__flow_control.load..load..serial_port_base::flow_control] 116194 116195 void load( 116196 const BOOST_ASIO_OPTION_STORAGE & storage, 116197 boost::system::error_code & ec); 116198 116199 116200 116201[endsect] 116202 116203 116204 116205[section:store serial_port_base::flow_control::store] 116206 116207[indexterm2 boost_asio.indexterm.serial_port_base__flow_control.store..store..serial_port_base::flow_control] 116208 116209 void store( 116210 BOOST_ASIO_OPTION_STORAGE & storage, 116211 boost::system::error_code & ec) const; 116212 116213 116214 116215[endsect] 116216 116217 116218 116219[section:type serial_port_base::flow_control::type] 116220 116221[indexterm2 boost_asio.indexterm.serial_port_base__flow_control.type..type..serial_port_base::flow_control] 116222 116223 enum type 116224 116225[indexterm2 boost_asio.indexterm.serial_port_base__flow_control.type.none..none..serial_port_base::flow_control] 116226[indexterm2 boost_asio.indexterm.serial_port_base__flow_control.type.software..software..serial_port_base::flow_control] 116227[indexterm2 boost_asio.indexterm.serial_port_base__flow_control.type.hardware..hardware..serial_port_base::flow_control] 116228 116229[heading Values] 116230[variablelist 116231 116232 [ 116233 [none] 116234 [] 116235 ] 116236 116237 [ 116238 [software] 116239 [] 116240 ] 116241 116242 [ 116243 [hardware] 116244 [] 116245 ] 116246 116247] 116248 116249 116250 116251[endsect] 116252 116253 116254 116255[section:value serial_port_base::flow_control::value] 116256 116257[indexterm2 boost_asio.indexterm.serial_port_base__flow_control.value..value..serial_port_base::flow_control] 116258 116259 type value() const; 116260 116261 116262 116263[endsect] 116264 116265 116266 116267[endsect] 116268 116269[section:serial_port_base__parity serial_port_base::parity] 116270 116271[indexterm1 boost_asio.indexterm.serial_port_base__parity..serial_port_base::parity] 116272 116273 116274Serial port option to permit changing the parity. 116275 116276 116277 class parity 116278 116279 116280[heading Types] 116281[table 116282 [[Name][Description]] 116283 116284 [ 116285 116286 [[link boost_asio.reference.serial_port_base__parity.type [*type]]] 116287 [] 116288 116289 ] 116290 116291] 116292 116293[heading Member Functions] 116294[table 116295 [[Name][Description]] 116296 116297 [ 116298 [[link boost_asio.reference.serial_port_base__parity.load [*load]]] 116299 [] 116300 ] 116301 116302 [ 116303 [[link boost_asio.reference.serial_port_base__parity.parity [*parity]] [constructor]] 116304 [] 116305 ] 116306 116307 [ 116308 [[link boost_asio.reference.serial_port_base__parity.store [*store]]] 116309 [] 116310 ] 116311 116312 [ 116313 [[link boost_asio.reference.serial_port_base__parity.value [*value]]] 116314 [] 116315 ] 116316 116317] 116318 116319Implements changing the parity for a given serial port. 116320 116321[heading Requirements] 116322 116323['Header: ][^boost/asio/serial_port_base.hpp] 116324 116325['Convenience header: ][^boost/asio.hpp] 116326 116327 116328[section:load serial_port_base::parity::load] 116329 116330[indexterm2 boost_asio.indexterm.serial_port_base__parity.load..load..serial_port_base::parity] 116331 116332 void load( 116333 const BOOST_ASIO_OPTION_STORAGE & storage, 116334 boost::system::error_code & ec); 116335 116336 116337 116338[endsect] 116339 116340 116341 116342[section:parity serial_port_base::parity::parity] 116343 116344[indexterm2 boost_asio.indexterm.serial_port_base__parity.parity..parity..serial_port_base::parity] 116345 116346 parity( 116347 type t = none); 116348 116349 116350 116351[endsect] 116352 116353 116354 116355[section:store serial_port_base::parity::store] 116356 116357[indexterm2 boost_asio.indexterm.serial_port_base__parity.store..store..serial_port_base::parity] 116358 116359 void store( 116360 BOOST_ASIO_OPTION_STORAGE & storage, 116361 boost::system::error_code & ec) const; 116362 116363 116364 116365[endsect] 116366 116367 116368 116369[section:type serial_port_base::parity::type] 116370 116371[indexterm2 boost_asio.indexterm.serial_port_base__parity.type..type..serial_port_base::parity] 116372 116373 enum type 116374 116375[indexterm2 boost_asio.indexterm.serial_port_base__parity.type.none..none..serial_port_base::parity] 116376[indexterm2 boost_asio.indexterm.serial_port_base__parity.type.odd..odd..serial_port_base::parity] 116377[indexterm2 boost_asio.indexterm.serial_port_base__parity.type.even..even..serial_port_base::parity] 116378 116379[heading Values] 116380[variablelist 116381 116382 [ 116383 [none] 116384 [] 116385 ] 116386 116387 [ 116388 [odd] 116389 [] 116390 ] 116391 116392 [ 116393 [even] 116394 [] 116395 ] 116396 116397] 116398 116399 116400 116401[endsect] 116402 116403 116404 116405[section:value serial_port_base::parity::value] 116406 116407[indexterm2 boost_asio.indexterm.serial_port_base__parity.value..value..serial_port_base::parity] 116408 116409 type value() const; 116410 116411 116412 116413[endsect] 116414 116415 116416 116417[endsect] 116418 116419[section:serial_port_base__stop_bits serial_port_base::stop_bits] 116420 116421[indexterm1 boost_asio.indexterm.serial_port_base__stop_bits..serial_port_base::stop_bits] 116422 116423 116424Serial port option to permit changing the number of stop bits. 116425 116426 116427 class stop_bits 116428 116429 116430[heading Types] 116431[table 116432 [[Name][Description]] 116433 116434 [ 116435 116436 [[link boost_asio.reference.serial_port_base__stop_bits.type [*type]]] 116437 [] 116438 116439 ] 116440 116441] 116442 116443[heading Member Functions] 116444[table 116445 [[Name][Description]] 116446 116447 [ 116448 [[link boost_asio.reference.serial_port_base__stop_bits.load [*load]]] 116449 [] 116450 ] 116451 116452 [ 116453 [[link boost_asio.reference.serial_port_base__stop_bits.stop_bits [*stop_bits]] [constructor]] 116454 [] 116455 ] 116456 116457 [ 116458 [[link boost_asio.reference.serial_port_base__stop_bits.store [*store]]] 116459 [] 116460 ] 116461 116462 [ 116463 [[link boost_asio.reference.serial_port_base__stop_bits.value [*value]]] 116464 [] 116465 ] 116466 116467] 116468 116469Implements changing the number of stop bits for a given serial port. 116470 116471[heading Requirements] 116472 116473['Header: ][^boost/asio/serial_port_base.hpp] 116474 116475['Convenience header: ][^boost/asio.hpp] 116476 116477 116478[section:load serial_port_base::stop_bits::load] 116479 116480[indexterm2 boost_asio.indexterm.serial_port_base__stop_bits.load..load..serial_port_base::stop_bits] 116481 116482 void load( 116483 const BOOST_ASIO_OPTION_STORAGE & storage, 116484 boost::system::error_code & ec); 116485 116486 116487 116488[endsect] 116489 116490 116491 116492[section:stop_bits serial_port_base::stop_bits::stop_bits] 116493 116494[indexterm2 boost_asio.indexterm.serial_port_base__stop_bits.stop_bits..stop_bits..serial_port_base::stop_bits] 116495 116496 stop_bits( 116497 type t = one); 116498 116499 116500 116501[endsect] 116502 116503 116504 116505[section:store serial_port_base::stop_bits::store] 116506 116507[indexterm2 boost_asio.indexterm.serial_port_base__stop_bits.store..store..serial_port_base::stop_bits] 116508 116509 void store( 116510 BOOST_ASIO_OPTION_STORAGE & storage, 116511 boost::system::error_code & ec) const; 116512 116513 116514 116515[endsect] 116516 116517 116518 116519[section:type serial_port_base::stop_bits::type] 116520 116521[indexterm2 boost_asio.indexterm.serial_port_base__stop_bits.type..type..serial_port_base::stop_bits] 116522 116523 enum type 116524 116525[indexterm2 boost_asio.indexterm.serial_port_base__stop_bits.type.one..one..serial_port_base::stop_bits] 116526[indexterm2 boost_asio.indexterm.serial_port_base__stop_bits.type.onepointfive..onepointfive..serial_port_base::stop_bits] 116527[indexterm2 boost_asio.indexterm.serial_port_base__stop_bits.type.two..two..serial_port_base::stop_bits] 116528 116529[heading Values] 116530[variablelist 116531 116532 [ 116533 [one] 116534 [] 116535 ] 116536 116537 [ 116538 [onepointfive] 116539 [] 116540 ] 116541 116542 [ 116543 [two] 116544 [] 116545 ] 116546 116547] 116548 116549 116550 116551[endsect] 116552 116553 116554 116555[section:value serial_port_base::stop_bits::value] 116556 116557[indexterm2 boost_asio.indexterm.serial_port_base__stop_bits.value..value..serial_port_base::stop_bits] 116558 116559 type value() const; 116560 116561 116562 116563[endsect] 116564 116565 116566 116567[endsect] 116568 116569[section:service_already_exists service_already_exists] 116570 116571[indexterm1 boost_asio.indexterm.service_already_exists..service_already_exists] 116572 116573 116574Exception thrown when trying to add a duplicate service to an [link boost_asio.reference.execution_context `execution_context`]. 116575 116576 116577 class service_already_exists 116578 116579 116580[heading Member Functions] 116581[table 116582 [[Name][Description]] 116583 116584 [ 116585 [[link boost_asio.reference.service_already_exists.service_already_exists [*service_already_exists]] [constructor]] 116586 [] 116587 ] 116588 116589] 116590 116591[heading Requirements] 116592 116593['Header: ][^boost/asio/execution_context.hpp] 116594 116595['Convenience header: ][^boost/asio/execution.hpp] 116596 116597 116598[section:service_already_exists service_already_exists::service_already_exists] 116599 116600[indexterm2 boost_asio.indexterm.service_already_exists.service_already_exists..service_already_exists..service_already_exists] 116601 116602 service_already_exists(); 116603 116604 116605 116606[endsect] 116607 116608 116609 116610[endsect] 116611 116612 116613[section:signal_set signal_set] 116614 116615[indexterm1 boost_asio.indexterm.signal_set..signal_set] 116616Typedef for the typical usage of a signal set. 116617 116618 116619 typedef basic_signal_set signal_set; 116620 116621 116622[heading Types] 116623[table 116624 [[Name][Description]] 116625 116626 [ 116627 116628 [[link boost_asio.reference.basic_signal_set__rebind_executor [*rebind_executor]]] 116629 [Rebinds the signal set type to another executor. ] 116630 116631 ] 116632 116633 [ 116634 116635 [[link boost_asio.reference.basic_signal_set.executor_type [*executor_type]]] 116636 [The type of the executor associated with the object. ] 116637 116638 ] 116639 116640] 116641 116642[heading Member Functions] 116643[table 116644 [[Name][Description]] 116645 116646 [ 116647 [[link boost_asio.reference.basic_signal_set.add [*add]]] 116648 [Add a signal to a signal_set. ] 116649 ] 116650 116651 [ 116652 [[link boost_asio.reference.basic_signal_set.async_wait [*async_wait]]] 116653 [Start an asynchronous operation to wait for a signal to be delivered. ] 116654 ] 116655 116656 [ 116657 [[link boost_asio.reference.basic_signal_set.basic_signal_set [*basic_signal_set]] [constructor]] 116658 [Construct a signal set without adding any signals. 116659 [hr] 116660 Construct a signal set and add one signal. 116661 [hr] 116662 Construct a signal set and add two signals. 116663 [hr] 116664 Construct a signal set and add three signals. ] 116665 ] 116666 116667 [ 116668 [[link boost_asio.reference.basic_signal_set.cancel [*cancel]]] 116669 [Cancel all operations associated with the signal set. ] 116670 ] 116671 116672 [ 116673 [[link boost_asio.reference.basic_signal_set.clear [*clear]]] 116674 [Remove all signals from a signal_set. ] 116675 ] 116676 116677 [ 116678 [[link boost_asio.reference.basic_signal_set.get_executor [*get_executor]]] 116679 [Get the executor associated with the object. ] 116680 ] 116681 116682 [ 116683 [[link boost_asio.reference.basic_signal_set.remove [*remove]]] 116684 [Remove a signal from a signal_set. ] 116685 ] 116686 116687 [ 116688 [[link boost_asio.reference.basic_signal_set._basic_signal_set [*~basic_signal_set]] [destructor]] 116689 [Destroys the signal set. ] 116690 ] 116691 116692] 116693 116694The [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. 116695 116696 116697[heading Thread Safety] 116698 116699['Distinct] ['objects:] Safe. 116700 116701['Shared] ['objects:] Unsafe. 116702 116703 116704[heading Example] 116705 116706Performing an asynchronous wait: 116707 116708 void handler( 116709 const boost::system::error_code& error, 116710 int signal_number) 116711 { 116712 if (!error) 116713 { 116714 // A signal occurred. 116715 } 116716 } 116717 116718 ... 116719 116720 // Construct a signal set registered for process termination. 116721 boost::asio::signal_set signals(my_context, SIGINT, SIGTERM); 116722 116723 // Start an asynchronous wait for one of the signals to occur. 116724 signals.async_wait(handler); 116725 116726 116727 116728 116729 116730[heading Queueing of signal notifications] 116731 116732 116733 116734If 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. 116735 116736If 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. 116737 116738 116739[heading Multiple registration of signals] 116740 116741 116742 116743The same signal number may be registered with different signal\_set objects. When the signal occurs, one handler is called for each signal\_set object. 116744 116745Note 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()`. 116746 116747 116748[heading Signal masking on POSIX platforms] 116749 116750 116751 116752POSIX 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. 116753 116754 116755[heading Requirements] 116756 116757['Header: ][^boost/asio/signal_set.hpp] 116758 116759['Convenience header: ][^boost/asio.hpp] 116760 116761 116762[endsect] 116763 116764 116765[section:socket_base socket_base] 116766 116767[indexterm1 boost_asio.indexterm.socket_base..socket_base] 116768 116769 116770The [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. 116771 116772 116773 class socket_base 116774 116775 116776[heading Types] 116777[table 116778 [[Name][Description]] 116779 116780 [ 116781 116782 [[link boost_asio.reference.socket_base.broadcast [*broadcast]]] 116783 [Socket option to permit sending of broadcast messages. ] 116784 116785 ] 116786 116787 [ 116788 116789 [[link boost_asio.reference.socket_base.bytes_readable [*bytes_readable]]] 116790 [IO control command to get the amount of data that can be read without blocking. ] 116791 116792 ] 116793 116794 [ 116795 116796 [[link boost_asio.reference.socket_base.debug [*debug]]] 116797 [Socket option to enable socket-level debugging. ] 116798 116799 ] 116800 116801 [ 116802 116803 [[link boost_asio.reference.socket_base.do_not_route [*do_not_route]]] 116804 [Socket option to prevent routing, use local interfaces only. ] 116805 116806 ] 116807 116808 [ 116809 116810 [[link boost_asio.reference.socket_base.enable_connection_aborted [*enable_connection_aborted]]] 116811 [Socket option to report aborted connections on accept. ] 116812 116813 ] 116814 116815 [ 116816 116817 [[link boost_asio.reference.socket_base.keep_alive [*keep_alive]]] 116818 [Socket option to send keep-alives. ] 116819 116820 ] 116821 116822 [ 116823 116824 [[link boost_asio.reference.socket_base.linger [*linger]]] 116825 [Socket option to specify whether the socket lingers on close if unsent data is present. ] 116826 116827 ] 116828 116829 [ 116830 116831 [[link boost_asio.reference.socket_base.message_flags [*message_flags]]] 116832 [Bitmask type for flags that can be passed to send and receive operations. ] 116833 116834 ] 116835 116836 [ 116837 116838 [[link boost_asio.reference.socket_base.out_of_band_inline [*out_of_band_inline]]] 116839 [Socket option for putting received out-of-band data inline. ] 116840 116841 ] 116842 116843 [ 116844 116845 [[link boost_asio.reference.socket_base.receive_buffer_size [*receive_buffer_size]]] 116846 [Socket option for the receive buffer size of a socket. ] 116847 116848 ] 116849 116850 [ 116851 116852 [[link boost_asio.reference.socket_base.receive_low_watermark [*receive_low_watermark]]] 116853 [Socket option for the receive low watermark. ] 116854 116855 ] 116856 116857 [ 116858 116859 [[link boost_asio.reference.socket_base.reuse_address [*reuse_address]]] 116860 [Socket option to allow the socket to be bound to an address that is already in use. ] 116861 116862 ] 116863 116864 [ 116865 116866 [[link boost_asio.reference.socket_base.send_buffer_size [*send_buffer_size]]] 116867 [Socket option for the send buffer size of a socket. ] 116868 116869 ] 116870 116871 [ 116872 116873 [[link boost_asio.reference.socket_base.send_low_watermark [*send_low_watermark]]] 116874 [Socket option for the send low watermark. ] 116875 116876 ] 116877 116878 [ 116879 116880 [[link boost_asio.reference.socket_base.shutdown_type [*shutdown_type]]] 116881 [Different ways a socket may be shutdown. ] 116882 116883 ] 116884 116885 [ 116886 116887 [[link boost_asio.reference.socket_base.wait_type [*wait_type]]] 116888 [Wait types. ] 116889 116890 ] 116891 116892] 116893 116894[heading Protected Member Functions] 116895[table 116896 [[Name][Description]] 116897 116898 [ 116899 [[link boost_asio.reference.socket_base._socket_base [*~socket_base]] [destructor]] 116900 [Protected destructor to prevent deletion through this type. ] 116901 ] 116902 116903] 116904 116905[heading Data Members] 116906[table 116907 [[Name][Description]] 116908 116909 [ 116910 [[link boost_asio.reference.socket_base.max_connections [*max_connections]] [static]] 116911 [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ] 116912 ] 116913 116914 [ 116915 [[link boost_asio.reference.socket_base.max_listen_connections [*max_listen_connections]] [static]] 116916 [The maximum length of the queue of pending incoming connections. ] 116917 ] 116918 116919 [ 116920 [[link boost_asio.reference.socket_base.message_do_not_route [*message_do_not_route]] [static]] 116921 [Specify that the data should not be subject to routing. ] 116922 ] 116923 116924 [ 116925 [[link boost_asio.reference.socket_base.message_end_of_record [*message_end_of_record]] [static]] 116926 [Specifies that the data marks the end of a record. ] 116927 ] 116928 116929 [ 116930 [[link boost_asio.reference.socket_base.message_out_of_band [*message_out_of_band]] [static]] 116931 [Process out-of-band data. ] 116932 ] 116933 116934 [ 116935 [[link boost_asio.reference.socket_base.message_peek [*message_peek]] [static]] 116936 [Peek at incoming data without removing it from the input queue. ] 116937 ] 116938 116939] 116940 116941[heading Requirements] 116942 116943['Header: ][^boost/asio/socket_base.hpp] 116944 116945['Convenience header: ][^boost/asio.hpp] 116946 116947 116948[section:broadcast socket_base::broadcast] 116949 116950[indexterm2 boost_asio.indexterm.socket_base.broadcast..broadcast..socket_base] 116951Socket option to permit sending of broadcast messages. 116952 116953 116954 typedef implementation_defined broadcast; 116955 116956 116957 116958Implements the SOL\_SOCKET/SO\_BROADCAST socket option. 116959 116960 116961[heading Examples] 116962 116963Setting the option: 116964 116965 boost::asio::ip::udp::socket socket(my_context); 116966 ... 116967 boost::asio::socket_base::broadcast option(true); 116968 socket.set_option(option); 116969 116970 116971 116972 116973 116974Getting the current option value: 116975 116976 boost::asio::ip::udp::socket socket(my_context); 116977 ... 116978 boost::asio::socket_base::broadcast option; 116979 socket.get_option(option); 116980 bool is_set = option.value(); 116981 116982 116983 116984 116985 116986 116987 116988[heading Requirements] 116989 116990['Header: ][^boost/asio/socket_base.hpp] 116991 116992['Convenience header: ][^boost/asio.hpp] 116993 116994 116995[endsect] 116996 116997 116998 116999[section:bytes_readable socket_base::bytes_readable] 117000 117001[indexterm2 boost_asio.indexterm.socket_base.bytes_readable..bytes_readable..socket_base] 117002IO control command to get the amount of data that can be read without blocking. 117003 117004 117005 typedef implementation_defined bytes_readable; 117006 117007 117008 117009Implements the FIONREAD IO control command. 117010 117011 117012[heading Example] 117013 117014 117015 117016 boost::asio::ip::tcp::socket socket(my_context); 117017 ... 117018 boost::asio::socket_base::bytes_readable command(true); 117019 socket.io_control(command); 117020 std::size_t bytes_readable = command.get(); 117021 117022 117023 117024 117025 117026 117027 117028[heading Requirements] 117029 117030['Header: ][^boost/asio/socket_base.hpp] 117031 117032['Convenience header: ][^boost/asio.hpp] 117033 117034 117035[endsect] 117036 117037 117038 117039[section:debug socket_base::debug] 117040 117041[indexterm2 boost_asio.indexterm.socket_base.debug..debug..socket_base] 117042Socket option to enable socket-level debugging. 117043 117044 117045 typedef implementation_defined debug; 117046 117047 117048 117049Implements the SOL\_SOCKET/SO\_DEBUG socket option. 117050 117051 117052[heading Examples] 117053 117054Setting the option: 117055 117056 boost::asio::ip::tcp::socket socket(my_context); 117057 ... 117058 boost::asio::socket_base::debug option(true); 117059 socket.set_option(option); 117060 117061 117062 117063 117064 117065Getting the current option value: 117066 117067 boost::asio::ip::tcp::socket socket(my_context); 117068 ... 117069 boost::asio::socket_base::debug option; 117070 socket.get_option(option); 117071 bool is_set = option.value(); 117072 117073 117074 117075 117076 117077 117078 117079[heading Requirements] 117080 117081['Header: ][^boost/asio/socket_base.hpp] 117082 117083['Convenience header: ][^boost/asio.hpp] 117084 117085 117086[endsect] 117087 117088 117089 117090[section:do_not_route socket_base::do_not_route] 117091 117092[indexterm2 boost_asio.indexterm.socket_base.do_not_route..do_not_route..socket_base] 117093Socket option to prevent routing, use local interfaces only. 117094 117095 117096 typedef implementation_defined do_not_route; 117097 117098 117099 117100Implements the SOL\_SOCKET/SO\_DONTROUTE socket option. 117101 117102 117103[heading Examples] 117104 117105Setting the option: 117106 117107 boost::asio::ip::udp::socket socket(my_context); 117108 ... 117109 boost::asio::socket_base::do_not_route option(true); 117110 socket.set_option(option); 117111 117112 117113 117114 117115 117116Getting the current option value: 117117 117118 boost::asio::ip::udp::socket socket(my_context); 117119 ... 117120 boost::asio::socket_base::do_not_route option; 117121 socket.get_option(option); 117122 bool is_set = option.value(); 117123 117124 117125 117126 117127 117128 117129 117130[heading Requirements] 117131 117132['Header: ][^boost/asio/socket_base.hpp] 117133 117134['Convenience header: ][^boost/asio.hpp] 117135 117136 117137[endsect] 117138 117139 117140 117141[section:enable_connection_aborted socket_base::enable_connection_aborted] 117142 117143[indexterm2 boost_asio.indexterm.socket_base.enable_connection_aborted..enable_connection_aborted..socket_base] 117144Socket option to report aborted connections on accept. 117145 117146 117147 typedef implementation_defined enable_connection_aborted; 117148 117149 117150 117151Implements 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. 117152 117153 117154[heading Examples] 117155 117156Setting the option: 117157 117158 boost::asio::ip::tcp::acceptor acceptor(my_context); 117159 ... 117160 boost::asio::socket_base::enable_connection_aborted option(true); 117161 acceptor.set_option(option); 117162 117163 117164 117165 117166 117167Getting the current option value: 117168 117169 boost::asio::ip::tcp::acceptor acceptor(my_context); 117170 ... 117171 boost::asio::socket_base::enable_connection_aborted option; 117172 acceptor.get_option(option); 117173 bool is_set = option.value(); 117174 117175 117176 117177 117178 117179 117180 117181[heading Requirements] 117182 117183['Header: ][^boost/asio/socket_base.hpp] 117184 117185['Convenience header: ][^boost/asio.hpp] 117186 117187 117188[endsect] 117189 117190 117191 117192[section:keep_alive socket_base::keep_alive] 117193 117194[indexterm2 boost_asio.indexterm.socket_base.keep_alive..keep_alive..socket_base] 117195Socket option to send keep-alives. 117196 117197 117198 typedef implementation_defined keep_alive; 117199 117200 117201 117202Implements the SOL\_SOCKET/SO\_KEEPALIVE socket option. 117203 117204 117205[heading Examples] 117206 117207Setting the option: 117208 117209 boost::asio::ip::tcp::socket socket(my_context); 117210 ... 117211 boost::asio::socket_base::keep_alive option(true); 117212 socket.set_option(option); 117213 117214 117215 117216 117217 117218Getting the current option value: 117219 117220 boost::asio::ip::tcp::socket socket(my_context); 117221 ... 117222 boost::asio::socket_base::keep_alive option; 117223 socket.get_option(option); 117224 bool is_set = option.value(); 117225 117226 117227 117228 117229 117230 117231 117232[heading Requirements] 117233 117234['Header: ][^boost/asio/socket_base.hpp] 117235 117236['Convenience header: ][^boost/asio.hpp] 117237 117238 117239[endsect] 117240 117241 117242 117243[section:linger socket_base::linger] 117244 117245[indexterm2 boost_asio.indexterm.socket_base.linger..linger..socket_base] 117246Socket option to specify whether the socket lingers on close if unsent data is present. 117247 117248 117249 typedef implementation_defined linger; 117250 117251 117252 117253Implements the SOL\_SOCKET/SO\_LINGER socket option. 117254 117255 117256[heading Examples] 117257 117258Setting the option: 117259 117260 boost::asio::ip::tcp::socket socket(my_context); 117261 ... 117262 boost::asio::socket_base::linger option(true, 30); 117263 socket.set_option(option); 117264 117265 117266 117267 117268 117269Getting the current option value: 117270 117271 boost::asio::ip::tcp::socket socket(my_context); 117272 ... 117273 boost::asio::socket_base::linger option; 117274 socket.get_option(option); 117275 bool is_set = option.enabled(); 117276 unsigned short timeout = option.timeout(); 117277 117278 117279 117280 117281 117282 117283 117284[heading Requirements] 117285 117286['Header: ][^boost/asio/socket_base.hpp] 117287 117288['Convenience header: ][^boost/asio.hpp] 117289 117290 117291[endsect] 117292 117293 117294 117295[section:max_connections socket_base::max_connections] 117296 117297[indexterm2 boost_asio.indexterm.socket_base.max_connections..max_connections..socket_base] 117298(Deprecated: Use max\_listen\_connections.) The maximum length of the queue of pending incoming connections. 117299 117300 117301 static const int max_connections = implementation_defined; 117302 117303 117304 117305[endsect] 117306 117307 117308 117309[section:max_listen_connections socket_base::max_listen_connections] 117310 117311[indexterm2 boost_asio.indexterm.socket_base.max_listen_connections..max_listen_connections..socket_base] 117312The maximum length of the queue of pending incoming connections. 117313 117314 117315 static const int max_listen_connections = implementation_defined; 117316 117317 117318 117319[endsect] 117320 117321 117322 117323[section:message_do_not_route socket_base::message_do_not_route] 117324 117325[indexterm2 boost_asio.indexterm.socket_base.message_do_not_route..message_do_not_route..socket_base] 117326Specify that the data should not be subject to routing. 117327 117328 117329 static const int message_do_not_route = implementation_defined; 117330 117331 117332 117333[endsect] 117334 117335 117336 117337[section:message_end_of_record socket_base::message_end_of_record] 117338 117339[indexterm2 boost_asio.indexterm.socket_base.message_end_of_record..message_end_of_record..socket_base] 117340Specifies that the data marks the end of a record. 117341 117342 117343 static const int message_end_of_record = implementation_defined; 117344 117345 117346 117347[endsect] 117348 117349 117350 117351[section:message_flags socket_base::message_flags] 117352 117353[indexterm2 boost_asio.indexterm.socket_base.message_flags..message_flags..socket_base] 117354Bitmask type for flags that can be passed to send and receive operations. 117355 117356 117357 typedef int message_flags; 117358 117359 117360 117361[heading Requirements] 117362 117363['Header: ][^boost/asio/socket_base.hpp] 117364 117365['Convenience header: ][^boost/asio.hpp] 117366 117367 117368[endsect] 117369 117370 117371 117372[section:message_out_of_band socket_base::message_out_of_band] 117373 117374[indexterm2 boost_asio.indexterm.socket_base.message_out_of_band..message_out_of_band..socket_base] 117375Process out-of-band data. 117376 117377 117378 static const int message_out_of_band = implementation_defined; 117379 117380 117381 117382[endsect] 117383 117384 117385 117386[section:message_peek socket_base::message_peek] 117387 117388[indexterm2 boost_asio.indexterm.socket_base.message_peek..message_peek..socket_base] 117389Peek at incoming data without removing it from the input queue. 117390 117391 117392 static const int message_peek = implementation_defined; 117393 117394 117395 117396[endsect] 117397 117398 117399 117400[section:out_of_band_inline socket_base::out_of_band_inline] 117401 117402[indexterm2 boost_asio.indexterm.socket_base.out_of_band_inline..out_of_band_inline..socket_base] 117403Socket option for putting received out-of-band data inline. 117404 117405 117406 typedef implementation_defined out_of_band_inline; 117407 117408 117409 117410Implements the SOL\_SOCKET/SO\_OOBINLINE socket option. 117411 117412 117413[heading Examples] 117414 117415Setting the option: 117416 117417 boost::asio::ip::tcp::socket socket(my_context); 117418 ... 117419 boost::asio::socket_base::out_of_band_inline option(true); 117420 socket.set_option(option); 117421 117422 117423 117424 117425 117426Getting the current option value: 117427 117428 boost::asio::ip::tcp::socket socket(my_context); 117429 ... 117430 boost::asio::socket_base::out_of_band_inline option; 117431 socket.get_option(option); 117432 bool value = option.value(); 117433 117434 117435 117436 117437 117438 117439 117440[heading Requirements] 117441 117442['Header: ][^boost/asio/socket_base.hpp] 117443 117444['Convenience header: ][^boost/asio.hpp] 117445 117446 117447[endsect] 117448 117449 117450 117451[section:receive_buffer_size socket_base::receive_buffer_size] 117452 117453[indexterm2 boost_asio.indexterm.socket_base.receive_buffer_size..receive_buffer_size..socket_base] 117454Socket option for the receive buffer size of a socket. 117455 117456 117457 typedef implementation_defined receive_buffer_size; 117458 117459 117460 117461Implements the SOL\_SOCKET/SO\_RCVBUF socket option. 117462 117463 117464[heading Examples] 117465 117466Setting the option: 117467 117468 boost::asio::ip::tcp::socket socket(my_context); 117469 ... 117470 boost::asio::socket_base::receive_buffer_size option(8192); 117471 socket.set_option(option); 117472 117473 117474 117475 117476 117477Getting the current option value: 117478 117479 boost::asio::ip::tcp::socket socket(my_context); 117480 ... 117481 boost::asio::socket_base::receive_buffer_size option; 117482 socket.get_option(option); 117483 int size = option.value(); 117484 117485 117486 117487 117488 117489 117490 117491[heading Requirements] 117492 117493['Header: ][^boost/asio/socket_base.hpp] 117494 117495['Convenience header: ][^boost/asio.hpp] 117496 117497 117498[endsect] 117499 117500 117501 117502[section:receive_low_watermark socket_base::receive_low_watermark] 117503 117504[indexterm2 boost_asio.indexterm.socket_base.receive_low_watermark..receive_low_watermark..socket_base] 117505Socket option for the receive low watermark. 117506 117507 117508 typedef implementation_defined receive_low_watermark; 117509 117510 117511 117512Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option. 117513 117514 117515[heading Examples] 117516 117517Setting the option: 117518 117519 boost::asio::ip::tcp::socket socket(my_context); 117520 ... 117521 boost::asio::socket_base::receive_low_watermark option(1024); 117522 socket.set_option(option); 117523 117524 117525 117526 117527 117528Getting the current option value: 117529 117530 boost::asio::ip::tcp::socket socket(my_context); 117531 ... 117532 boost::asio::socket_base::receive_low_watermark option; 117533 socket.get_option(option); 117534 int size = option.value(); 117535 117536 117537 117538 117539 117540 117541 117542[heading Requirements] 117543 117544['Header: ][^boost/asio/socket_base.hpp] 117545 117546['Convenience header: ][^boost/asio.hpp] 117547 117548 117549[endsect] 117550 117551 117552 117553[section:reuse_address socket_base::reuse_address] 117554 117555[indexterm2 boost_asio.indexterm.socket_base.reuse_address..reuse_address..socket_base] 117556Socket option to allow the socket to be bound to an address that is already in use. 117557 117558 117559 typedef implementation_defined reuse_address; 117560 117561 117562 117563Implements the SOL\_SOCKET/SO\_REUSEADDR socket option. 117564 117565 117566[heading Examples] 117567 117568Setting the option: 117569 117570 boost::asio::ip::tcp::acceptor acceptor(my_context); 117571 ... 117572 boost::asio::socket_base::reuse_address option(true); 117573 acceptor.set_option(option); 117574 117575 117576 117577 117578 117579Getting the current option value: 117580 117581 boost::asio::ip::tcp::acceptor acceptor(my_context); 117582 ... 117583 boost::asio::socket_base::reuse_address option; 117584 acceptor.get_option(option); 117585 bool is_set = option.value(); 117586 117587 117588 117589 117590 117591 117592 117593[heading Requirements] 117594 117595['Header: ][^boost/asio/socket_base.hpp] 117596 117597['Convenience header: ][^boost/asio.hpp] 117598 117599 117600[endsect] 117601 117602 117603 117604[section:send_buffer_size socket_base::send_buffer_size] 117605 117606[indexterm2 boost_asio.indexterm.socket_base.send_buffer_size..send_buffer_size..socket_base] 117607Socket option for the send buffer size of a socket. 117608 117609 117610 typedef implementation_defined send_buffer_size; 117611 117612 117613 117614Implements the SOL\_SOCKET/SO\_SNDBUF socket option. 117615 117616 117617[heading Examples] 117618 117619Setting the option: 117620 117621 boost::asio::ip::tcp::socket socket(my_context); 117622 ... 117623 boost::asio::socket_base::send_buffer_size option(8192); 117624 socket.set_option(option); 117625 117626 117627 117628 117629 117630Getting the current option value: 117631 117632 boost::asio::ip::tcp::socket socket(my_context); 117633 ... 117634 boost::asio::socket_base::send_buffer_size option; 117635 socket.get_option(option); 117636 int size = option.value(); 117637 117638 117639 117640 117641 117642 117643 117644[heading Requirements] 117645 117646['Header: ][^boost/asio/socket_base.hpp] 117647 117648['Convenience header: ][^boost/asio.hpp] 117649 117650 117651[endsect] 117652 117653 117654 117655[section:send_low_watermark socket_base::send_low_watermark] 117656 117657[indexterm2 boost_asio.indexterm.socket_base.send_low_watermark..send_low_watermark..socket_base] 117658Socket option for the send low watermark. 117659 117660 117661 typedef implementation_defined send_low_watermark; 117662 117663 117664 117665Implements the SOL\_SOCKET/SO\_SNDLOWAT socket option. 117666 117667 117668[heading Examples] 117669 117670Setting the option: 117671 117672 boost::asio::ip::tcp::socket socket(my_context); 117673 ... 117674 boost::asio::socket_base::send_low_watermark option(1024); 117675 socket.set_option(option); 117676 117677 117678 117679 117680 117681Getting the current option value: 117682 117683 boost::asio::ip::tcp::socket socket(my_context); 117684 ... 117685 boost::asio::socket_base::send_low_watermark option; 117686 socket.get_option(option); 117687 int size = option.value(); 117688 117689 117690 117691 117692 117693 117694 117695[heading Requirements] 117696 117697['Header: ][^boost/asio/socket_base.hpp] 117698 117699['Convenience header: ][^boost/asio.hpp] 117700 117701 117702[endsect] 117703 117704 117705 117706[section:shutdown_type socket_base::shutdown_type] 117707 117708[indexterm2 boost_asio.indexterm.socket_base.shutdown_type..shutdown_type..socket_base] 117709Different ways a socket may be shutdown. 117710 117711 117712 enum shutdown_type 117713 117714[indexterm2 boost_asio.indexterm.socket_base.shutdown_type.shutdown_receive..shutdown_receive..socket_base] 117715[indexterm2 boost_asio.indexterm.socket_base.shutdown_type.shutdown_send..shutdown_send..socket_base] 117716[indexterm2 boost_asio.indexterm.socket_base.shutdown_type.shutdown_both..shutdown_both..socket_base] 117717 117718[heading Values] 117719[variablelist 117720 117721 [ 117722 [shutdown_receive] 117723 [Shutdown the receive side of the socket. ] 117724 ] 117725 117726 [ 117727 [shutdown_send] 117728 [Shutdown the send side of the socket. ] 117729 ] 117730 117731 [ 117732 [shutdown_both] 117733 [Shutdown both send and receive on the socket. ] 117734 ] 117735 117736] 117737 117738 117739 117740[endsect] 117741 117742 117743 117744[section:wait_type socket_base::wait_type] 117745 117746[indexterm2 boost_asio.indexterm.socket_base.wait_type..wait_type..socket_base] 117747Wait types. 117748 117749 117750 enum wait_type 117751 117752[indexterm2 boost_asio.indexterm.socket_base.wait_type.wait_read..wait_read..socket_base] 117753[indexterm2 boost_asio.indexterm.socket_base.wait_type.wait_write..wait_write..socket_base] 117754[indexterm2 boost_asio.indexterm.socket_base.wait_type.wait_error..wait_error..socket_base] 117755 117756[heading Values] 117757[variablelist 117758 117759 [ 117760 [wait_read] 117761 [Wait for a socket to become ready to read. ] 117762 ] 117763 117764 [ 117765 [wait_write] 117766 [Wait for a socket to become ready to write. ] 117767 ] 117768 117769 [ 117770 [wait_error] 117771 [Wait for a socket to have error conditions pending. ] 117772 ] 117773 117774] 117775 117776 117777For use with `basic_socket::wait()` and `basic_socket::async_wait()`. 117778 117779 117780[endsect] 117781 117782 117783 117784[section:_socket_base socket_base::~socket_base] 117785 117786[indexterm2 boost_asio.indexterm.socket_base._socket_base..~socket_base..socket_base] 117787Protected destructor to prevent deletion through this type. 117788 117789 117790 ~socket_base(); 117791 117792 117793 117794[endsect] 117795 117796 117797 117798[endsect] 117799 117800[section:spawn spawn] 117801 117802[indexterm1 boost_asio.indexterm.spawn..spawn] 117803Start a new stackful coroutine. 117804 117805 117806Start a new stackful coroutine, calling the specified handler when it completes. 117807 117808 template< 117809 typename Function> 117810 void ``[link boost_asio.reference.spawn.overload1 spawn]``( 117811 Function && function, 117812 const boost::coroutines::attributes & attributes = boost::coroutines::attributes()); 117813 `` [''''»''' [link boost_asio.reference.spawn.overload1 more...]]`` 117814 117815 template< 117816 typename ``[link boost_asio.reference.Handler Handler]``, 117817 typename Function> 117818 void ``[link boost_asio.reference.spawn.overload2 spawn]``( 117819 Handler && handler, 117820 Function && function, 117821 const boost::coroutines::attributes & attributes = boost::coroutines::attributes(), 117822 typename constraint< !is_executor< typename decay< Handler >::type >::value &&!execution::is_executor< typename decay< Handler >::type >::value &&!is_convertible< Handler &, execution_context & >::value >::type = 0); 117823 `` [''''»''' [link boost_asio.reference.spawn.overload2 more...]]`` 117824 117825Start a new stackful coroutine, inheriting the execution context of another. 117826 117827 template< 117828 typename ``[link boost_asio.reference.Handler Handler]``, 117829 typename Function> 117830 void ``[link boost_asio.reference.spawn.overload3 spawn]``( 117831 basic_yield_context< Handler > ctx, 117832 Function && function, 117833 const boost::coroutines::attributes & attributes = boost::coroutines::attributes()); 117834 `` [''''»''' [link boost_asio.reference.spawn.overload3 more...]]`` 117835 117836Start a new stackful coroutine that executes on a given executor. 117837 117838 template< 117839 typename Function, 117840 typename ``[link boost_asio.reference.Executor1 Executor]``> 117841 void ``[link boost_asio.reference.spawn.overload4 spawn]``( 117842 const Executor & ex, 117843 Function && function, 117844 const boost::coroutines::attributes & attributes = boost::coroutines::attributes(), 117845 typename constraint< is_executor< Executor >::value||execution::is_executor< Executor >::value >::type = 0); 117846 `` [''''»''' [link boost_asio.reference.spawn.overload4 more...]]`` 117847 117848Start a new stackful coroutine that executes on a given strand. 117849 117850 template< 117851 typename Function, 117852 typename ``[link boost_asio.reference.Executor1 Executor]``> 117853 void ``[link boost_asio.reference.spawn.overload5 spawn]``( 117854 const strand< Executor > & ex, 117855 Function && function, 117856 const boost::coroutines::attributes & attributes = boost::coroutines::attributes()); 117857 `` [''''»''' [link boost_asio.reference.spawn.overload5 more...]]`` 117858 117859Start a new stackful coroutine that executes in the context of a strand. 117860 117861 template< 117862 typename Function> 117863 void ``[link boost_asio.reference.spawn.overload6 spawn]``( 117864 const boost::asio::io_context::strand & s, 117865 Function && function, 117866 const boost::coroutines::attributes & attributes = boost::coroutines::attributes()); 117867 `` [''''»''' [link boost_asio.reference.spawn.overload6 more...]]`` 117868 117869Start a new stackful coroutine that executes on a given execution context. 117870 117871 template< 117872 typename Function, 117873 typename ExecutionContext> 117874 void ``[link boost_asio.reference.spawn.overload7 spawn]``( 117875 ExecutionContext & ctx, 117876 Function && function, 117877 const boost::coroutines::attributes & attributes = boost::coroutines::attributes(), 117878 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 117879 `` [''''»''' [link boost_asio.reference.spawn.overload7 more...]]`` 117880 117881The `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: 117882 117883 117884 117885 boost::asio::spawn(my_strand, do_echo); 117886 117887 // ... 117888 117889 void do_echo(boost::asio::yield_context yield) 117890 { 117891 try 117892 { 117893 char data[128]; 117894 for (;;) 117895 { 117896 std::size_t length = 117897 my_socket.async_read_some( 117898 boost::asio::buffer(data), yield); 117899 117900 boost::asio::async_write(my_socket, 117901 boost::asio::buffer(data, length), yield); 117902 } 117903 } 117904 catch (std::exception& e) 117905 { 117906 // ... 117907 } 117908 } 117909 117910 117911 117912 117913[heading Requirements] 117914 117915['Header: ][^boost/asio/spawn.hpp] 117916 117917['Convenience header: ]None 117918 117919 117920[section:overload1 spawn (1 of 7 overloads)] 117921 117922 117923Start a new stackful coroutine, calling the specified handler when it completes. 117924 117925 117926 template< 117927 typename Function> 117928 void spawn( 117929 Function && function, 117930 const boost::coroutines::attributes & attributes = boost::coroutines::attributes()); 117931 117932 117933This function is used to launch a new coroutine. 117934 117935 117936[heading Parameters] 117937 117938 117939[variablelist 117940 117941[[function][The coroutine function. The function must have the signature: 117942`` 117943 void function(basic_yield_context<Handler> yield); 117944`` 117945]] 117946 117947[[attributes][Boost.Coroutine attributes used to customise the coroutine. ]] 117948 117949] 117950 117951 117952 117953 117954[endsect] 117955 117956 117957 117958[section:overload2 spawn (2 of 7 overloads)] 117959 117960 117961Start a new stackful coroutine, calling the specified handler when it completes. 117962 117963 117964 template< 117965 typename ``[link boost_asio.reference.Handler Handler]``, 117966 typename Function> 117967 void spawn( 117968 Handler && handler, 117969 Function && function, 117970 const boost::coroutines::attributes & attributes = boost::coroutines::attributes(), 117971 typename constraint< !is_executor< typename decay< Handler >::type >::value &&!execution::is_executor< typename decay< Handler >::type >::value &&!is_convertible< Handler &, execution_context & >::value >::type = 0); 117972 117973 117974This function is used to launch a new coroutine. 117975 117976 117977[heading Parameters] 117978 117979 117980[variablelist 117981 117982[[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: 117983`` 117984 void handler(); 117985`` 117986]] 117987 117988[[function][The coroutine function. The function must have the signature: 117989`` 117990 void function(basic_yield_context<Handler> yield); 117991`` 117992]] 117993 117994[[attributes][Boost.Coroutine attributes used to customise the coroutine. ]] 117995 117996] 117997 117998 117999 118000 118001[endsect] 118002 118003 118004 118005[section:overload3 spawn (3 of 7 overloads)] 118006 118007 118008Start a new stackful coroutine, inheriting the execution context of another. 118009 118010 118011 template< 118012 typename ``[link boost_asio.reference.Handler Handler]``, 118013 typename Function> 118014 void spawn( 118015 basic_yield_context< Handler > ctx, 118016 Function && function, 118017 const boost::coroutines::attributes & attributes = boost::coroutines::attributes()); 118018 118019 118020This function is used to launch a new coroutine. 118021 118022 118023[heading Parameters] 118024 118025 118026[variablelist 118027 118028[[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.]] 118029 118030[[function][The coroutine function. The function must have the signature: 118031`` 118032 void function(basic_yield_context<Handler> yield); 118033`` 118034]] 118035 118036[[attributes][Boost.Coroutine attributes used to customise the coroutine. ]] 118037 118038] 118039 118040 118041 118042 118043[endsect] 118044 118045 118046 118047[section:overload4 spawn (4 of 7 overloads)] 118048 118049 118050Start a new stackful coroutine that executes on a given executor. 118051 118052 118053 template< 118054 typename Function, 118055 typename ``[link boost_asio.reference.Executor1 Executor]``> 118056 void spawn( 118057 const Executor & ex, 118058 Function && function, 118059 const boost::coroutines::attributes & attributes = boost::coroutines::attributes(), 118060 typename constraint< is_executor< Executor >::value||execution::is_executor< Executor >::value >::type = 0); 118061 118062 118063This function is used to launch a new coroutine. 118064 118065 118066[heading Parameters] 118067 118068 118069[variablelist 118070 118071[[ex][Identifies the executor that will run the coroutine. The new coroutine is implicitly given its own strand within this executor.]] 118072 118073[[function][The coroutine function. The function must have the signature: 118074`` 118075 void function(yield_context yield); 118076`` 118077]] 118078 118079[[attributes][Boost.Coroutine attributes used to customise the coroutine. ]] 118080 118081] 118082 118083 118084 118085 118086[endsect] 118087 118088 118089 118090[section:overload5 spawn (5 of 7 overloads)] 118091 118092 118093Start a new stackful coroutine that executes on a given strand. 118094 118095 118096 template< 118097 typename Function, 118098 typename ``[link boost_asio.reference.Executor1 Executor]``> 118099 void spawn( 118100 const strand< Executor > & ex, 118101 Function && function, 118102 const boost::coroutines::attributes & attributes = boost::coroutines::attributes()); 118103 118104 118105This function is used to launch a new coroutine. 118106 118107 118108[heading Parameters] 118109 118110 118111[variablelist 118112 118113[[ex][Identifies the strand that will run the coroutine.]] 118114 118115[[function][The coroutine function. The function must have the signature: 118116`` 118117 void function(yield_context yield); 118118`` 118119]] 118120 118121[[attributes][Boost.Coroutine attributes used to customise the coroutine. ]] 118122 118123] 118124 118125 118126 118127 118128[endsect] 118129 118130 118131 118132[section:overload6 spawn (6 of 7 overloads)] 118133 118134 118135Start a new stackful coroutine that executes in the context of a strand. 118136 118137 118138 template< 118139 typename Function> 118140 void spawn( 118141 const boost::asio::io_context::strand & s, 118142 Function && function, 118143 const boost::coroutines::attributes & attributes = boost::coroutines::attributes()); 118144 118145 118146This function is used to launch a new coroutine. 118147 118148 118149[heading Parameters] 118150 118151 118152[variablelist 118153 118154[[s][Identifies a strand. By starting multiple coroutines on the same strand, the implementation ensures that none of those coroutines can execute simultaneously.]] 118155 118156[[function][The coroutine function. The function must have the signature: 118157`` 118158 void function(yield_context yield); 118159`` 118160]] 118161 118162[[attributes][Boost.Coroutine attributes used to customise the coroutine. ]] 118163 118164] 118165 118166 118167 118168 118169[endsect] 118170 118171 118172 118173[section:overload7 spawn (7 of 7 overloads)] 118174 118175 118176Start a new stackful coroutine that executes on a given execution context. 118177 118178 118179 template< 118180 typename Function, 118181 typename ExecutionContext> 118182 void spawn( 118183 ExecutionContext & ctx, 118184 Function && function, 118185 const boost::coroutines::attributes & attributes = boost::coroutines::attributes(), 118186 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 118187 118188 118189This function is used to launch a new coroutine. 118190 118191 118192[heading Parameters] 118193 118194 118195[variablelist 118196 118197[[ctx][Identifies the execution context that will run the coroutine. The new coroutine is implicitly given its own strand within this execution context.]] 118198 118199[[function][The coroutine function. The function must have the signature: 118200`` 118201 void function(yield_context yield); 118202`` 118203]] 118204 118205[[attributes][Boost.Coroutine attributes used to customise the coroutine. ]] 118206 118207] 118208 118209 118210 118211 118212[endsect] 118213 118214 118215[endsect] 118216 118217[section:ssl__context ssl::context] 118218 118219[indexterm1 boost_asio.indexterm.ssl__context..ssl::context] 118220 118221 118222 118223 class context : 118224 public ssl::context_base, 118225 noncopyable 118226 118227 118228[heading Types] 118229[table 118230 [[Name][Description]] 118231 118232 [ 118233 118234 [[link boost_asio.reference.ssl__context.file_format [*file_format]]] 118235 [File format types. ] 118236 118237 ] 118238 118239 [ 118240 118241 [[link boost_asio.reference.ssl__context.method [*method]]] 118242 [Different methods supported by a context. ] 118243 118244 ] 118245 118246 [ 118247 118248 [[link boost_asio.reference.ssl__context.native_handle_type [*native_handle_type]]] 118249 [The native handle type of the SSL context. ] 118250 118251 ] 118252 118253 [ 118254 118255 [[link boost_asio.reference.ssl__context.options [*options]]] 118256 [Bitmask type for SSL options. ] 118257 118258 ] 118259 118260 [ 118261 118262 [[link boost_asio.reference.ssl__context.password_purpose [*password_purpose]]] 118263 [Purpose of PEM password. ] 118264 118265 ] 118266 118267] 118268 118269[heading Member Functions] 118270[table 118271 [[Name][Description]] 118272 118273 [ 118274 [[link boost_asio.reference.ssl__context.add_certificate_authority [*add_certificate_authority]]] 118275 [Add certification authority for performing verification. ] 118276 ] 118277 118278 [ 118279 [[link boost_asio.reference.ssl__context.add_verify_path [*add_verify_path]]] 118280 [Add a directory containing certificate authority files to be used for performing verification. ] 118281 ] 118282 118283 [ 118284 [[link boost_asio.reference.ssl__context.clear_options [*clear_options]]] 118285 [Clear options on the context. ] 118286 ] 118287 118288 [ 118289 [[link boost_asio.reference.ssl__context.context [*context]] [constructor]] 118290 [Constructor. 118291 [hr] 118292 Construct to take ownership of a native handle. 118293 [hr] 118294 Move-construct a context from another. ] 118295 ] 118296 118297 [ 118298 [[link boost_asio.reference.ssl__context.load_verify_file [*load_verify_file]]] 118299 [Load a certification authority file for performing verification. ] 118300 ] 118301 118302 [ 118303 [[link boost_asio.reference.ssl__context.native_handle [*native_handle]]] 118304 [Get the underlying implementation in the native type. ] 118305 ] 118306 118307 [ 118308 [[link boost_asio.reference.ssl__context.operator_eq_ [*operator=]]] 118309 [Move-assign a context from another. ] 118310 ] 118311 118312 [ 118313 [[link boost_asio.reference.ssl__context.set_default_verify_paths [*set_default_verify_paths]]] 118314 [Configures the context to use the default directories for finding certification authority certificates. ] 118315 ] 118316 118317 [ 118318 [[link boost_asio.reference.ssl__context.set_options [*set_options]]] 118319 [Set options on the context. ] 118320 ] 118321 118322 [ 118323 [[link boost_asio.reference.ssl__context.set_password_callback [*set_password_callback]]] 118324 [Set the password callback. ] 118325 ] 118326 118327 [ 118328 [[link boost_asio.reference.ssl__context.set_verify_callback [*set_verify_callback]]] 118329 [Set the callback used to verify peer certificates. ] 118330 ] 118331 118332 [ 118333 [[link boost_asio.reference.ssl__context.set_verify_depth [*set_verify_depth]]] 118334 [Set the peer verification depth. ] 118335 ] 118336 118337 [ 118338 [[link boost_asio.reference.ssl__context.set_verify_mode [*set_verify_mode]]] 118339 [Set the peer verification mode. ] 118340 ] 118341 118342 [ 118343 [[link boost_asio.reference.ssl__context.use_certificate [*use_certificate]]] 118344 [Use a certificate from a memory buffer. ] 118345 ] 118346 118347 [ 118348 [[link boost_asio.reference.ssl__context.use_certificate_chain [*use_certificate_chain]]] 118349 [Use a certificate chain from a memory buffer. ] 118350 ] 118351 118352 [ 118353 [[link boost_asio.reference.ssl__context.use_certificate_chain_file [*use_certificate_chain_file]]] 118354 [Use a certificate chain from a file. ] 118355 ] 118356 118357 [ 118358 [[link boost_asio.reference.ssl__context.use_certificate_file [*use_certificate_file]]] 118359 [Use a certificate from a file. ] 118360 ] 118361 118362 [ 118363 [[link boost_asio.reference.ssl__context.use_private_key [*use_private_key]]] 118364 [Use a private key from a memory buffer. ] 118365 ] 118366 118367 [ 118368 [[link boost_asio.reference.ssl__context.use_private_key_file [*use_private_key_file]]] 118369 [Use a private key from a file. ] 118370 ] 118371 118372 [ 118373 [[link boost_asio.reference.ssl__context.use_rsa_private_key [*use_rsa_private_key]]] 118374 [Use an RSA private key from a memory buffer. ] 118375 ] 118376 118377 [ 118378 [[link boost_asio.reference.ssl__context.use_rsa_private_key_file [*use_rsa_private_key_file]]] 118379 [Use an RSA private key from a file. ] 118380 ] 118381 118382 [ 118383 [[link boost_asio.reference.ssl__context.use_tmp_dh [*use_tmp_dh]]] 118384 [Use the specified memory buffer to obtain the temporary Diffie-Hellman parameters. ] 118385 ] 118386 118387 [ 118388 [[link boost_asio.reference.ssl__context.use_tmp_dh_file [*use_tmp_dh_file]]] 118389 [Use the specified file to obtain the temporary Diffie-Hellman parameters. ] 118390 ] 118391 118392 [ 118393 [[link boost_asio.reference.ssl__context._context [*~context]] [destructor]] 118394 [Destructor. ] 118395 ] 118396 118397] 118398 118399[heading Data Members] 118400[table 118401 [[Name][Description]] 118402 118403 [ 118404 [[link boost_asio.reference.ssl__context.default_workarounds [*default_workarounds]] [static]] 118405 [Implement various bug workarounds. ] 118406 ] 118407 118408 [ 118409 [[link boost_asio.reference.ssl__context.no_compression [*no_compression]] [static]] 118410 [Disable compression. Compression is disabled by default. ] 118411 ] 118412 118413 [ 118414 [[link boost_asio.reference.ssl__context.no_sslv2 [*no_sslv2]] [static]] 118415 [Disable SSL v2. ] 118416 ] 118417 118418 [ 118419 [[link boost_asio.reference.ssl__context.no_sslv3 [*no_sslv3]] [static]] 118420 [Disable SSL v3. ] 118421 ] 118422 118423 [ 118424 [[link boost_asio.reference.ssl__context.no_tlsv1 [*no_tlsv1]] [static]] 118425 [Disable TLS v1. ] 118426 ] 118427 118428 [ 118429 [[link boost_asio.reference.ssl__context.no_tlsv1_1 [*no_tlsv1_1]] [static]] 118430 [Disable TLS v1.1. ] 118431 ] 118432 118433 [ 118434 [[link boost_asio.reference.ssl__context.no_tlsv1_2 [*no_tlsv1_2]] [static]] 118435 [Disable TLS v1.2. ] 118436 ] 118437 118438 [ 118439 [[link boost_asio.reference.ssl__context.no_tlsv1_3 [*no_tlsv1_3]] [static]] 118440 [Disable TLS v1.3. ] 118441 ] 118442 118443 [ 118444 [[link boost_asio.reference.ssl__context.single_dh_use [*single_dh_use]] [static]] 118445 [Always create a new key when using tmp_dh parameters. ] 118446 ] 118447 118448] 118449 118450[heading Requirements] 118451 118452['Header: ][^boost/asio/ssl/context.hpp] 118453 118454['Convenience header: ][^boost/asio/ssl.hpp] 118455 118456[section:add_certificate_authority ssl::context::add_certificate_authority] 118457 118458[indexterm2 boost_asio.indexterm.ssl__context.add_certificate_authority..add_certificate_authority..ssl::context] 118459Add certification authority for performing verification. 118460 118461 118462 void ``[link boost_asio.reference.ssl__context.add_certificate_authority.overload1 add_certificate_authority]``( 118463 const const_buffer & ca); 118464 `` [''''»''' [link boost_asio.reference.ssl__context.add_certificate_authority.overload1 more...]]`` 118465 118466 void ``[link boost_asio.reference.ssl__context.add_certificate_authority.overload2 add_certificate_authority]``( 118467 const const_buffer & ca, 118468 boost::system::error_code & ec); 118469 `` [''''»''' [link boost_asio.reference.ssl__context.add_certificate_authority.overload2 more...]]`` 118470 118471 118472[section:overload1 ssl::context::add_certificate_authority (1 of 2 overloads)] 118473 118474 118475Add certification authority for performing verification. 118476 118477 118478 void add_certificate_authority( 118479 const const_buffer & ca); 118480 118481 118482This function is used to add one trusted certification authority from a memory buffer. 118483 118484 118485[heading Parameters] 118486 118487 118488[variablelist 118489 118490[[ca][The buffer containing the certification authority certificate. The certificate must use the PEM format.]] 118491 118492] 118493 118494 118495[heading Exceptions] 118496 118497 118498[variablelist 118499 118500[[boost::system::system_error][Thrown on failure.]] 118501 118502] 118503 118504 118505[heading Remarks] 118506 118507Calls `SSL_CTX_get_cert_store` and `X509_STORE_add_cert`. 118508 118509 118510 118511 118512[endsect] 118513 118514 118515 118516[section:overload2 ssl::context::add_certificate_authority (2 of 2 overloads)] 118517 118518 118519Add certification authority for performing verification. 118520 118521 118522 void add_certificate_authority( 118523 const const_buffer & ca, 118524 boost::system::error_code & ec); 118525 118526 118527This function is used to add one trusted certification authority from a memory buffer. 118528 118529 118530[heading Parameters] 118531 118532 118533[variablelist 118534 118535[[ca][The buffer containing the certification authority certificate. The certificate must use the PEM format.]] 118536 118537[[ec][Set to indicate what error occurred, if any.]] 118538 118539] 118540 118541 118542[heading Remarks] 118543 118544Calls `SSL_CTX_get_cert_store` and `X509_STORE_add_cert`. 118545 118546 118547 118548 118549[endsect] 118550 118551 118552[endsect] 118553 118554[section:add_verify_path ssl::context::add_verify_path] 118555 118556[indexterm2 boost_asio.indexterm.ssl__context.add_verify_path..add_verify_path..ssl::context] 118557Add a directory containing certificate authority files to be used for performing verification. 118558 118559 118560 void ``[link boost_asio.reference.ssl__context.add_verify_path.overload1 add_verify_path]``( 118561 const std::string & path); 118562 `` [''''»''' [link boost_asio.reference.ssl__context.add_verify_path.overload1 more...]]`` 118563 118564 void ``[link boost_asio.reference.ssl__context.add_verify_path.overload2 add_verify_path]``( 118565 const std::string & path, 118566 boost::system::error_code & ec); 118567 `` [''''»''' [link boost_asio.reference.ssl__context.add_verify_path.overload2 more...]]`` 118568 118569 118570[section:overload1 ssl::context::add_verify_path (1 of 2 overloads)] 118571 118572 118573Add a directory containing certificate authority files to be used for performing verification. 118574 118575 118576 void add_verify_path( 118577 const std::string & path); 118578 118579 118580This 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". 118581 118582 118583[heading Parameters] 118584 118585 118586[variablelist 118587 118588[[path][The name of a directory containing the certificates.]] 118589 118590] 118591 118592 118593[heading Exceptions] 118594 118595 118596[variablelist 118597 118598[[boost::system::system_error][Thrown on failure.]] 118599 118600] 118601 118602 118603[heading Remarks] 118604 118605Calls `SSL_CTX_load_verify_locations`. 118606 118607 118608 118609 118610[endsect] 118611 118612 118613 118614[section:overload2 ssl::context::add_verify_path (2 of 2 overloads)] 118615 118616 118617Add a directory containing certificate authority files to be used for performing verification. 118618 118619 118620 void add_verify_path( 118621 const std::string & path, 118622 boost::system::error_code & ec); 118623 118624 118625This 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". 118626 118627 118628[heading Parameters] 118629 118630 118631[variablelist 118632 118633[[path][The name of a directory containing the certificates.]] 118634 118635[[ec][Set to indicate what error occurred, if any.]] 118636 118637] 118638 118639 118640[heading Remarks] 118641 118642Calls `SSL_CTX_load_verify_locations`. 118643 118644 118645 118646 118647[endsect] 118648 118649 118650[endsect] 118651 118652[section:clear_options ssl::context::clear_options] 118653 118654[indexterm2 boost_asio.indexterm.ssl__context.clear_options..clear_options..ssl::context] 118655Clear options on the context. 118656 118657 118658 void ``[link boost_asio.reference.ssl__context.clear_options.overload1 clear_options]``( 118659 options o); 118660 `` [''''»''' [link boost_asio.reference.ssl__context.clear_options.overload1 more...]]`` 118661 118662 void ``[link boost_asio.reference.ssl__context.clear_options.overload2 clear_options]``( 118663 options o, 118664 boost::system::error_code & ec); 118665 `` [''''»''' [link boost_asio.reference.ssl__context.clear_options.overload2 more...]]`` 118666 118667 118668[section:overload1 ssl::context::clear_options (1 of 2 overloads)] 118669 118670 118671Clear options on the context. 118672 118673 118674 void clear_options( 118675 options o); 118676 118677 118678This function may be used to configure the SSL options used by the context. 118679 118680 118681[heading Parameters] 118682 118683 118684[variablelist 118685 118686[[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.]] 118687 118688] 118689 118690 118691[heading Exceptions] 118692 118693 118694[variablelist 118695 118696[[boost::system::system_error][Thrown on failure.]] 118697 118698] 118699 118700 118701[heading Remarks] 118702 118703Calls `SSL_CTX_clear_options`. 118704 118705 118706 118707 118708[endsect] 118709 118710 118711 118712[section:overload2 ssl::context::clear_options (2 of 2 overloads)] 118713 118714 118715Clear options on the context. 118716 118717 118718 void clear_options( 118719 options o, 118720 boost::system::error_code & ec); 118721 118722 118723This function may be used to configure the SSL options used by the context. 118724 118725 118726[heading Parameters] 118727 118728 118729[variablelist 118730 118731[[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.]] 118732 118733[[ec][Set to indicate what error occurred, if any.]] 118734 118735] 118736 118737 118738[heading Remarks] 118739 118740Calls `SSL_CTX_clear_options`. 118741 118742 118743 118744 118745[endsect] 118746 118747 118748[endsect] 118749 118750[section:context ssl::context::context] 118751 118752[indexterm2 boost_asio.indexterm.ssl__context.context..context..ssl::context] 118753Constructor. 118754 118755 118756 explicit ``[link boost_asio.reference.ssl__context.context.overload1 context]``( 118757 method m); 118758 `` [''''»''' [link boost_asio.reference.ssl__context.context.overload1 more...]]`` 118759 118760 118761Construct to take ownership of a native handle. 118762 118763 118764 explicit ``[link boost_asio.reference.ssl__context.context.overload2 context]``( 118765 native_handle_type native_handle); 118766 `` [''''»''' [link boost_asio.reference.ssl__context.context.overload2 more...]]`` 118767 118768 118769Move-construct a context from another. 118770 118771 118772 ``[link boost_asio.reference.ssl__context.context.overload3 context]``( 118773 context && other); 118774 `` [''''»''' [link boost_asio.reference.ssl__context.context.overload3 more...]]`` 118775 118776 118777[section:overload1 ssl::context::context (1 of 3 overloads)] 118778 118779 118780Constructor. 118781 118782 118783 context( 118784 method m); 118785 118786 118787 118788[endsect] 118789 118790 118791 118792[section:overload2 ssl::context::context (2 of 3 overloads)] 118793 118794 118795Construct to take ownership of a native handle. 118796 118797 118798 context( 118799 native_handle_type native_handle); 118800 118801 118802 118803[endsect] 118804 118805 118806 118807[section:overload3 ssl::context::context (3 of 3 overloads)] 118808 118809 118810Move-construct a context from another. 118811 118812 118813 context( 118814 context && other); 118815 118816 118817This constructor moves an SSL context from one object to another. 118818 118819 118820[heading Parameters] 118821 118822 118823[variablelist 118824 118825[[other][The other context object from which the move will occur.]] 118826 118827] 118828 118829 118830[heading Remarks] 118831 118832Following the move, the following operations only are valid for the moved-from object: 118833* Destruction. 118834 118835* As a target for move-assignment. 118836 118837 118838 118839 118840 118841 118842[endsect] 118843 118844 118845[endsect] 118846 118847 118848[section:default_workarounds ssl::context::default_workarounds] 118849 118850[indexterm2 boost_asio.indexterm.ssl__context.default_workarounds..default_workarounds..ssl::context] 118851Implement various bug workarounds. 118852 118853 118854 static const long default_workarounds = implementation_defined; 118855 118856 118857 118858[endsect] 118859 118860 118861 118862[section:file_format ssl::context::file_format] 118863 118864[indexterm2 boost_asio.indexterm.ssl__context.file_format..file_format..ssl::context] 118865File format types. 118866 118867 118868 enum file_format 118869 118870[indexterm2 boost_asio.indexterm.ssl__context.file_format.asn1..asn1..ssl::context] 118871[indexterm2 boost_asio.indexterm.ssl__context.file_format.pem..pem..ssl::context] 118872 118873[heading Values] 118874[variablelist 118875 118876 [ 118877 [asn1] 118878 [ASN.1 file. ] 118879 ] 118880 118881 [ 118882 [pem] 118883 [PEM file. ] 118884 ] 118885 118886] 118887 118888 118889 118890[endsect] 118891 118892 118893[section:load_verify_file ssl::context::load_verify_file] 118894 118895[indexterm2 boost_asio.indexterm.ssl__context.load_verify_file..load_verify_file..ssl::context] 118896Load a certification authority file for performing verification. 118897 118898 118899 void ``[link boost_asio.reference.ssl__context.load_verify_file.overload1 load_verify_file]``( 118900 const std::string & filename); 118901 `` [''''»''' [link boost_asio.reference.ssl__context.load_verify_file.overload1 more...]]`` 118902 118903 void ``[link boost_asio.reference.ssl__context.load_verify_file.overload2 load_verify_file]``( 118904 const std::string & filename, 118905 boost::system::error_code & ec); 118906 `` [''''»''' [link boost_asio.reference.ssl__context.load_verify_file.overload2 more...]]`` 118907 118908 118909[section:overload1 ssl::context::load_verify_file (1 of 2 overloads)] 118910 118911 118912Load a certification authority file for performing verification. 118913 118914 118915 void load_verify_file( 118916 const std::string & filename); 118917 118918 118919This function is used to load one or more trusted certification authorities from a file. 118920 118921 118922[heading Parameters] 118923 118924 118925[variablelist 118926 118927[[filename][The name of a file containing certification authority certificates in PEM format.]] 118928 118929] 118930 118931 118932[heading Exceptions] 118933 118934 118935[variablelist 118936 118937[[boost::system::system_error][Thrown on failure.]] 118938 118939] 118940 118941 118942[heading Remarks] 118943 118944Calls `SSL_CTX_load_verify_locations`. 118945 118946 118947 118948 118949[endsect] 118950 118951 118952 118953[section:overload2 ssl::context::load_verify_file (2 of 2 overloads)] 118954 118955 118956Load a certification authority file for performing verification. 118957 118958 118959 void load_verify_file( 118960 const std::string & filename, 118961 boost::system::error_code & ec); 118962 118963 118964This function is used to load the certificates for one or more trusted certification authorities from a file. 118965 118966 118967[heading Parameters] 118968 118969 118970[variablelist 118971 118972[[filename][The name of a file containing certification authority certificates in PEM format.]] 118973 118974[[ec][Set to indicate what error occurred, if any.]] 118975 118976] 118977 118978 118979[heading Remarks] 118980 118981Calls `SSL_CTX_load_verify_locations`. 118982 118983 118984 118985 118986[endsect] 118987 118988 118989[endsect] 118990 118991 118992[section:method ssl::context::method] 118993 118994[indexterm2 boost_asio.indexterm.ssl__context.method..method..ssl::context] 118995Different methods supported by a context. 118996 118997 118998 enum method 118999 119000[indexterm2 boost_asio.indexterm.ssl__context.method.sslv2..sslv2..ssl::context] 119001[indexterm2 boost_asio.indexterm.ssl__context.method.sslv2_client..sslv2_client..ssl::context] 119002[indexterm2 boost_asio.indexterm.ssl__context.method.sslv2_server..sslv2_server..ssl::context] 119003[indexterm2 boost_asio.indexterm.ssl__context.method.sslv3..sslv3..ssl::context] 119004[indexterm2 boost_asio.indexterm.ssl__context.method.sslv3_client..sslv3_client..ssl::context] 119005[indexterm2 boost_asio.indexterm.ssl__context.method.sslv3_server..sslv3_server..ssl::context] 119006[indexterm2 boost_asio.indexterm.ssl__context.method.tlsv1..tlsv1..ssl::context] 119007[indexterm2 boost_asio.indexterm.ssl__context.method.tlsv1_client..tlsv1_client..ssl::context] 119008[indexterm2 boost_asio.indexterm.ssl__context.method.tlsv1_server..tlsv1_server..ssl::context] 119009[indexterm2 boost_asio.indexterm.ssl__context.method.sslv23..sslv23..ssl::context] 119010[indexterm2 boost_asio.indexterm.ssl__context.method.sslv23_client..sslv23_client..ssl::context] 119011[indexterm2 boost_asio.indexterm.ssl__context.method.sslv23_server..sslv23_server..ssl::context] 119012[indexterm2 boost_asio.indexterm.ssl__context.method.tlsv11..tlsv11..ssl::context] 119013[indexterm2 boost_asio.indexterm.ssl__context.method.tlsv11_client..tlsv11_client..ssl::context] 119014[indexterm2 boost_asio.indexterm.ssl__context.method.tlsv11_server..tlsv11_server..ssl::context] 119015[indexterm2 boost_asio.indexterm.ssl__context.method.tlsv12..tlsv12..ssl::context] 119016[indexterm2 boost_asio.indexterm.ssl__context.method.tlsv12_client..tlsv12_client..ssl::context] 119017[indexterm2 boost_asio.indexterm.ssl__context.method.tlsv12_server..tlsv12_server..ssl::context] 119018[indexterm2 boost_asio.indexterm.ssl__context.method.tlsv13..tlsv13..ssl::context] 119019[indexterm2 boost_asio.indexterm.ssl__context.method.tlsv13_client..tlsv13_client..ssl::context] 119020[indexterm2 boost_asio.indexterm.ssl__context.method.tlsv13_server..tlsv13_server..ssl::context] 119021[indexterm2 boost_asio.indexterm.ssl__context.method.tls..tls..ssl::context] 119022[indexterm2 boost_asio.indexterm.ssl__context.method.tls_client..tls_client..ssl::context] 119023[indexterm2 boost_asio.indexterm.ssl__context.method.tls_server..tls_server..ssl::context] 119024 119025[heading Values] 119026[variablelist 119027 119028 [ 119029 [sslv2] 119030 [Generic SSL version 2. ] 119031 ] 119032 119033 [ 119034 [sslv2_client] 119035 [SSL version 2 client. ] 119036 ] 119037 119038 [ 119039 [sslv2_server] 119040 [SSL version 2 server. ] 119041 ] 119042 119043 [ 119044 [sslv3] 119045 [Generic SSL version 3. ] 119046 ] 119047 119048 [ 119049 [sslv3_client] 119050 [SSL version 3 client. ] 119051 ] 119052 119053 [ 119054 [sslv3_server] 119055 [SSL version 3 server. ] 119056 ] 119057 119058 [ 119059 [tlsv1] 119060 [Generic TLS version 1. ] 119061 ] 119062 119063 [ 119064 [tlsv1_client] 119065 [TLS version 1 client. ] 119066 ] 119067 119068 [ 119069 [tlsv1_server] 119070 [TLS version 1 server. ] 119071 ] 119072 119073 [ 119074 [sslv23] 119075 [Generic SSL/TLS. ] 119076 ] 119077 119078 [ 119079 [sslv23_client] 119080 [SSL/TLS client. ] 119081 ] 119082 119083 [ 119084 [sslv23_server] 119085 [SSL/TLS server. ] 119086 ] 119087 119088 [ 119089 [tlsv11] 119090 [Generic TLS version 1.1. ] 119091 ] 119092 119093 [ 119094 [tlsv11_client] 119095 [TLS version 1.1 client. ] 119096 ] 119097 119098 [ 119099 [tlsv11_server] 119100 [TLS version 1.1 server. ] 119101 ] 119102 119103 [ 119104 [tlsv12] 119105 [Generic TLS version 1.2. ] 119106 ] 119107 119108 [ 119109 [tlsv12_client] 119110 [TLS version 1.2 client. ] 119111 ] 119112 119113 [ 119114 [tlsv12_server] 119115 [TLS version 1.2 server. ] 119116 ] 119117 119118 [ 119119 [tlsv13] 119120 [Generic TLS version 1.3. ] 119121 ] 119122 119123 [ 119124 [tlsv13_client] 119125 [TLS version 1.3 client. ] 119126 ] 119127 119128 [ 119129 [tlsv13_server] 119130 [TLS version 1.3 server. ] 119131 ] 119132 119133 [ 119134 [tls] 119135 [Generic TLS. ] 119136 ] 119137 119138 [ 119139 [tls_client] 119140 [TLS client. ] 119141 ] 119142 119143 [ 119144 [tls_server] 119145 [TLS server. ] 119146 ] 119147 119148] 119149 119150 119151 119152[endsect] 119153 119154 119155 119156[section:native_handle ssl::context::native_handle] 119157 119158[indexterm2 boost_asio.indexterm.ssl__context.native_handle..native_handle..ssl::context] 119159Get the underlying implementation in the native type. 119160 119161 119162 native_handle_type native_handle(); 119163 119164 119165This 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. 119166 119167 119168[endsect] 119169 119170 119171 119172[section:native_handle_type ssl::context::native_handle_type] 119173 119174[indexterm2 boost_asio.indexterm.ssl__context.native_handle_type..native_handle_type..ssl::context] 119175The native handle type of the SSL context. 119176 119177 119178 typedef SSL_CTX * native_handle_type; 119179 119180 119181 119182[heading Requirements] 119183 119184['Header: ][^boost/asio/ssl/context.hpp] 119185 119186['Convenience header: ][^boost/asio/ssl.hpp] 119187 119188 119189[endsect] 119190 119191 119192 119193[section:no_compression ssl::context::no_compression] 119194 119195[indexterm2 boost_asio.indexterm.ssl__context.no_compression..no_compression..ssl::context] 119196Disable compression. Compression is disabled by default. 119197 119198 119199 static const long no_compression = implementation_defined; 119200 119201 119202 119203[endsect] 119204 119205 119206 119207[section:no_sslv2 ssl::context::no_sslv2] 119208 119209[indexterm2 boost_asio.indexterm.ssl__context.no_sslv2..no_sslv2..ssl::context] 119210Disable SSL v2. 119211 119212 119213 static const long no_sslv2 = implementation_defined; 119214 119215 119216 119217[endsect] 119218 119219 119220 119221[section:no_sslv3 ssl::context::no_sslv3] 119222 119223[indexterm2 boost_asio.indexterm.ssl__context.no_sslv3..no_sslv3..ssl::context] 119224Disable SSL v3. 119225 119226 119227 static const long no_sslv3 = implementation_defined; 119228 119229 119230 119231[endsect] 119232 119233 119234 119235[section:no_tlsv1 ssl::context::no_tlsv1] 119236 119237[indexterm2 boost_asio.indexterm.ssl__context.no_tlsv1..no_tlsv1..ssl::context] 119238Disable TLS v1. 119239 119240 119241 static const long no_tlsv1 = implementation_defined; 119242 119243 119244 119245[endsect] 119246 119247 119248 119249[section:no_tlsv1_1 ssl::context::no_tlsv1_1] 119250 119251[indexterm2 boost_asio.indexterm.ssl__context.no_tlsv1_1..no_tlsv1_1..ssl::context] 119252Disable TLS v1.1. 119253 119254 119255 static const long no_tlsv1_1 = implementation_defined; 119256 119257 119258 119259[endsect] 119260 119261 119262 119263[section:no_tlsv1_2 ssl::context::no_tlsv1_2] 119264 119265[indexterm2 boost_asio.indexterm.ssl__context.no_tlsv1_2..no_tlsv1_2..ssl::context] 119266Disable TLS v1.2. 119267 119268 119269 static const long no_tlsv1_2 = implementation_defined; 119270 119271 119272 119273[endsect] 119274 119275 119276 119277[section:no_tlsv1_3 ssl::context::no_tlsv1_3] 119278 119279[indexterm2 boost_asio.indexterm.ssl__context.no_tlsv1_3..no_tlsv1_3..ssl::context] 119280Disable TLS v1.3. 119281 119282 119283 static const long no_tlsv1_3 = implementation_defined; 119284 119285 119286 119287[endsect] 119288 119289 119290 119291[section:operator_eq_ ssl::context::operator=] 119292 119293[indexterm2 boost_asio.indexterm.ssl__context.operator_eq_..operator=..ssl::context] 119294Move-assign a context from another. 119295 119296 119297 context & operator=( 119298 context && other); 119299 119300 119301This assignment operator moves an SSL context from one object to another. 119302 119303 119304[heading Parameters] 119305 119306 119307[variablelist 119308 119309[[other][The other context object from which the move will occur.]] 119310 119311] 119312 119313 119314[heading Remarks] 119315 119316Following the move, the following operations only are valid for the moved-from object: 119317* Destruction. 119318 119319* As a target for move-assignment. 119320 119321 119322 119323 119324 119325 119326[endsect] 119327 119328 119329 119330[section:options ssl::context::options] 119331 119332[indexterm2 boost_asio.indexterm.ssl__context.options..options..ssl::context] 119333Bitmask type for SSL options. 119334 119335 119336 typedef long options; 119337 119338 119339 119340[heading Requirements] 119341 119342['Header: ][^boost/asio/ssl/context.hpp] 119343 119344['Convenience header: ][^boost/asio/ssl.hpp] 119345 119346 119347[endsect] 119348 119349 119350 119351[section:password_purpose ssl::context::password_purpose] 119352 119353[indexterm2 boost_asio.indexterm.ssl__context.password_purpose..password_purpose..ssl::context] 119354Purpose of PEM password. 119355 119356 119357 enum password_purpose 119358 119359[indexterm2 boost_asio.indexterm.ssl__context.password_purpose.for_reading..for_reading..ssl::context] 119360[indexterm2 boost_asio.indexterm.ssl__context.password_purpose.for_writing..for_writing..ssl::context] 119361 119362[heading Values] 119363[variablelist 119364 119365 [ 119366 [for_reading] 119367 [The password is needed for reading/decryption. ] 119368 ] 119369 119370 [ 119371 [for_writing] 119372 [The password is needed for writing/encryption. ] 119373 ] 119374 119375] 119376 119377 119378 119379[endsect] 119380 119381 119382[section:set_default_verify_paths ssl::context::set_default_verify_paths] 119383 119384[indexterm2 boost_asio.indexterm.ssl__context.set_default_verify_paths..set_default_verify_paths..ssl::context] 119385Configures the context to use the default directories for finding certification authority certificates. 119386 119387 119388 void ``[link boost_asio.reference.ssl__context.set_default_verify_paths.overload1 set_default_verify_paths]``(); 119389 `` [''''»''' [link boost_asio.reference.ssl__context.set_default_verify_paths.overload1 more...]]`` 119390 119391 void ``[link boost_asio.reference.ssl__context.set_default_verify_paths.overload2 set_default_verify_paths]``( 119392 boost::system::error_code & ec); 119393 `` [''''»''' [link boost_asio.reference.ssl__context.set_default_verify_paths.overload2 more...]]`` 119394 119395 119396[section:overload1 ssl::context::set_default_verify_paths (1 of 2 overloads)] 119397 119398 119399Configures the context to use the default directories for finding certification authority certificates. 119400 119401 119402 void set_default_verify_paths(); 119403 119404 119405This function specifies that the context should use the default, system-dependent directories for locating certification authority certificates. 119406 119407 119408[heading Exceptions] 119409 119410 119411[variablelist 119412 119413[[boost::system::system_error][Thrown on failure.]] 119414 119415] 119416 119417 119418[heading Remarks] 119419 119420Calls `SSL_CTX_set_default_verify_paths`. 119421 119422 119423 119424 119425[endsect] 119426 119427 119428 119429[section:overload2 ssl::context::set_default_verify_paths (2 of 2 overloads)] 119430 119431 119432Configures the context to use the default directories for finding certification authority certificates. 119433 119434 119435 void set_default_verify_paths( 119436 boost::system::error_code & ec); 119437 119438 119439This function specifies that the context should use the default, system-dependent directories for locating certification authority certificates. 119440 119441 119442[heading Parameters] 119443 119444 119445[variablelist 119446 119447[[ec][Set to indicate what error occurred, if any.]] 119448 119449] 119450 119451 119452[heading Remarks] 119453 119454Calls `SSL_CTX_set_default_verify_paths`. 119455 119456 119457 119458 119459[endsect] 119460 119461 119462[endsect] 119463 119464[section:set_options ssl::context::set_options] 119465 119466[indexterm2 boost_asio.indexterm.ssl__context.set_options..set_options..ssl::context] 119467Set options on the context. 119468 119469 119470 void ``[link boost_asio.reference.ssl__context.set_options.overload1 set_options]``( 119471 options o); 119472 `` [''''»''' [link boost_asio.reference.ssl__context.set_options.overload1 more...]]`` 119473 119474 void ``[link boost_asio.reference.ssl__context.set_options.overload2 set_options]``( 119475 options o, 119476 boost::system::error_code & ec); 119477 `` [''''»''' [link boost_asio.reference.ssl__context.set_options.overload2 more...]]`` 119478 119479 119480[section:overload1 ssl::context::set_options (1 of 2 overloads)] 119481 119482 119483Set options on the context. 119484 119485 119486 void set_options( 119487 options o); 119488 119489 119490This function may be used to configure the SSL options used by the context. 119491 119492 119493[heading Parameters] 119494 119495 119496[variablelist 119497 119498[[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.]] 119499 119500] 119501 119502 119503[heading Exceptions] 119504 119505 119506[variablelist 119507 119508[[boost::system::system_error][Thrown on failure.]] 119509 119510] 119511 119512 119513[heading Remarks] 119514 119515Calls `SSL_CTX_set_options`. 119516 119517 119518 119519 119520[endsect] 119521 119522 119523 119524[section:overload2 ssl::context::set_options (2 of 2 overloads)] 119525 119526 119527Set options on the context. 119528 119529 119530 void set_options( 119531 options o, 119532 boost::system::error_code & ec); 119533 119534 119535This function may be used to configure the SSL options used by the context. 119536 119537 119538[heading Parameters] 119539 119540 119541[variablelist 119542 119543[[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.]] 119544 119545[[ec][Set to indicate what error occurred, if any.]] 119546 119547] 119548 119549 119550[heading Remarks] 119551 119552Calls `SSL_CTX_set_options`. 119553 119554 119555 119556 119557[endsect] 119558 119559 119560[endsect] 119561 119562[section:set_password_callback ssl::context::set_password_callback] 119563 119564[indexterm2 boost_asio.indexterm.ssl__context.set_password_callback..set_password_callback..ssl::context] 119565Set the password callback. 119566 119567 119568 template< 119569 typename PasswordCallback> 119570 void ``[link boost_asio.reference.ssl__context.set_password_callback.overload1 set_password_callback]``( 119571 PasswordCallback callback); 119572 `` [''''»''' [link boost_asio.reference.ssl__context.set_password_callback.overload1 more...]]`` 119573 119574 template< 119575 typename PasswordCallback> 119576 void ``[link boost_asio.reference.ssl__context.set_password_callback.overload2 set_password_callback]``( 119577 PasswordCallback callback, 119578 boost::system::error_code & ec); 119579 `` [''''»''' [link boost_asio.reference.ssl__context.set_password_callback.overload2 more...]]`` 119580 119581 119582[section:overload1 ssl::context::set_password_callback (1 of 2 overloads)] 119583 119584 119585Set the password callback. 119586 119587 119588 template< 119589 typename PasswordCallback> 119590 void set_password_callback( 119591 PasswordCallback callback); 119592 119593 119594This function is used to specify a callback function to obtain password information about an encrypted key in PEM format. 119595 119596 119597[heading Parameters] 119598 119599 119600[variablelist 119601 119602[[callback][The function object to be used for obtaining the password. The function signature of the handler must be: 119603`` 119604 std::string password_callback( 119605 std::size_t max_length, // The maximum size for a password. 119606 password_purpose purpose // Whether password is for reading or writing. 119607 ); 119608`` 119609The return value of the callback is a string containing the password.]] 119610 119611] 119612 119613 119614[heading Exceptions] 119615 119616 119617[variablelist 119618 119619[[boost::system::system_error][Thrown on failure.]] 119620 119621] 119622 119623 119624[heading Remarks] 119625 119626Calls `SSL_CTX_set_default_passwd_cb`. 119627 119628 119629 119630 119631[endsect] 119632 119633 119634 119635[section:overload2 ssl::context::set_password_callback (2 of 2 overloads)] 119636 119637 119638Set the password callback. 119639 119640 119641 template< 119642 typename PasswordCallback> 119643 void set_password_callback( 119644 PasswordCallback callback, 119645 boost::system::error_code & ec); 119646 119647 119648This function is used to specify a callback function to obtain password information about an encrypted key in PEM format. 119649 119650 119651[heading Parameters] 119652 119653 119654[variablelist 119655 119656[[callback][The function object to be used for obtaining the password. The function signature of the handler must be: 119657`` 119658 std::string password_callback( 119659 std::size_t max_length, // The maximum size for a password. 119660 password_purpose purpose // Whether password is for reading or writing. 119661 ); 119662`` 119663The return value of the callback is a string containing the password.]] 119664 119665[[ec][Set to indicate what error occurred, if any.]] 119666 119667] 119668 119669 119670[heading Remarks] 119671 119672Calls `SSL_CTX_set_default_passwd_cb`. 119673 119674 119675 119676 119677[endsect] 119678 119679 119680[endsect] 119681 119682[section:set_verify_callback ssl::context::set_verify_callback] 119683 119684[indexterm2 boost_asio.indexterm.ssl__context.set_verify_callback..set_verify_callback..ssl::context] 119685Set the callback used to verify peer certificates. 119686 119687 119688 template< 119689 typename VerifyCallback> 119690 void ``[link boost_asio.reference.ssl__context.set_verify_callback.overload1 set_verify_callback]``( 119691 VerifyCallback callback); 119692 `` [''''»''' [link boost_asio.reference.ssl__context.set_verify_callback.overload1 more...]]`` 119693 119694 template< 119695 typename VerifyCallback> 119696 void ``[link boost_asio.reference.ssl__context.set_verify_callback.overload2 set_verify_callback]``( 119697 VerifyCallback callback, 119698 boost::system::error_code & ec); 119699 `` [''''»''' [link boost_asio.reference.ssl__context.set_verify_callback.overload2 more...]]`` 119700 119701 119702[section:overload1 ssl::context::set_verify_callback (1 of 2 overloads)] 119703 119704 119705Set the callback used to verify peer certificates. 119706 119707 119708 template< 119709 typename VerifyCallback> 119710 void set_verify_callback( 119711 VerifyCallback callback); 119712 119713 119714This function is used to specify a callback function that will be called by the implementation when it needs to verify a peer certificate. 119715 119716 119717[heading Parameters] 119718 119719 119720[variablelist 119721 119722[[callback][The function object to be used for verifying a certificate. The function signature of the handler must be: 119723`` 119724 bool verify_callback( 119725 bool preverified, // True if the certificate passed pre-verification. 119726 verify_context& ctx // The peer certificate and other context. 119727 ); 119728`` 119729The return value of the callback is true if the certificate has passed verification, false otherwise.]] 119730 119731] 119732 119733 119734[heading Exceptions] 119735 119736 119737[variablelist 119738 119739[[boost::system::system_error][Thrown on failure.]] 119740 119741] 119742 119743 119744[heading Remarks] 119745 119746Calls `SSL_CTX_set_verify`. 119747 119748 119749 119750 119751[endsect] 119752 119753 119754 119755[section:overload2 ssl::context::set_verify_callback (2 of 2 overloads)] 119756 119757 119758Set the callback used to verify peer certificates. 119759 119760 119761 template< 119762 typename VerifyCallback> 119763 void set_verify_callback( 119764 VerifyCallback callback, 119765 boost::system::error_code & ec); 119766 119767 119768This function is used to specify a callback function that will be called by the implementation when it needs to verify a peer certificate. 119769 119770 119771[heading Parameters] 119772 119773 119774[variablelist 119775 119776[[callback][The function object to be used for verifying a certificate. The function signature of the handler must be: 119777`` 119778 bool verify_callback( 119779 bool preverified, // True if the certificate passed pre-verification. 119780 verify_context& ctx // The peer certificate and other context. 119781 ); 119782`` 119783The return value of the callback is true if the certificate has passed verification, false otherwise.]] 119784 119785[[ec][Set to indicate what error occurred, if any.]] 119786 119787] 119788 119789 119790[heading Remarks] 119791 119792Calls `SSL_CTX_set_verify`. 119793 119794 119795 119796 119797[endsect] 119798 119799 119800[endsect] 119801 119802[section:set_verify_depth ssl::context::set_verify_depth] 119803 119804[indexterm2 boost_asio.indexterm.ssl__context.set_verify_depth..set_verify_depth..ssl::context] 119805Set the peer verification depth. 119806 119807 119808 void ``[link boost_asio.reference.ssl__context.set_verify_depth.overload1 set_verify_depth]``( 119809 int depth); 119810 `` [''''»''' [link boost_asio.reference.ssl__context.set_verify_depth.overload1 more...]]`` 119811 119812 void ``[link boost_asio.reference.ssl__context.set_verify_depth.overload2 set_verify_depth]``( 119813 int depth, 119814 boost::system::error_code & ec); 119815 `` [''''»''' [link boost_asio.reference.ssl__context.set_verify_depth.overload2 more...]]`` 119816 119817 119818[section:overload1 ssl::context::set_verify_depth (1 of 2 overloads)] 119819 119820 119821Set the peer verification depth. 119822 119823 119824 void set_verify_depth( 119825 int depth); 119826 119827 119828This function may be used to configure the maximum verification depth allowed by the context. 119829 119830 119831[heading Parameters] 119832 119833 119834[variablelist 119835 119836[[depth][Maximum depth for the certificate chain verification that shall be allowed.]] 119837 119838] 119839 119840 119841[heading Exceptions] 119842 119843 119844[variablelist 119845 119846[[boost::system::system_error][Thrown on failure.]] 119847 119848] 119849 119850 119851[heading Remarks] 119852 119853Calls `SSL_CTX_set_verify_depth`. 119854 119855 119856 119857 119858[endsect] 119859 119860 119861 119862[section:overload2 ssl::context::set_verify_depth (2 of 2 overloads)] 119863 119864 119865Set the peer verification depth. 119866 119867 119868 void set_verify_depth( 119869 int depth, 119870 boost::system::error_code & ec); 119871 119872 119873This function may be used to configure the maximum verification depth allowed by the context. 119874 119875 119876[heading Parameters] 119877 119878 119879[variablelist 119880 119881[[depth][Maximum depth for the certificate chain verification that shall be allowed.]] 119882 119883[[ec][Set to indicate what error occurred, if any.]] 119884 119885] 119886 119887 119888[heading Remarks] 119889 119890Calls `SSL_CTX_set_verify_depth`. 119891 119892 119893 119894 119895[endsect] 119896 119897 119898[endsect] 119899 119900[section:set_verify_mode ssl::context::set_verify_mode] 119901 119902[indexterm2 boost_asio.indexterm.ssl__context.set_verify_mode..set_verify_mode..ssl::context] 119903Set the peer verification mode. 119904 119905 119906 void ``[link boost_asio.reference.ssl__context.set_verify_mode.overload1 set_verify_mode]``( 119907 verify_mode v); 119908 `` [''''»''' [link boost_asio.reference.ssl__context.set_verify_mode.overload1 more...]]`` 119909 119910 void ``[link boost_asio.reference.ssl__context.set_verify_mode.overload2 set_verify_mode]``( 119911 verify_mode v, 119912 boost::system::error_code & ec); 119913 `` [''''»''' [link boost_asio.reference.ssl__context.set_verify_mode.overload2 more...]]`` 119914 119915 119916[section:overload1 ssl::context::set_verify_mode (1 of 2 overloads)] 119917 119918 119919Set the peer verification mode. 119920 119921 119922 void set_verify_mode( 119923 verify_mode v); 119924 119925 119926This function may be used to configure the peer verification mode used by the context. 119927 119928 119929[heading Parameters] 119930 119931 119932[variablelist 119933 119934[[v][A bitmask of peer verification modes. See [link boost_asio.reference.ssl__verify_mode `ssl::verify_mode`] for available values.]] 119935 119936] 119937 119938 119939[heading Exceptions] 119940 119941 119942[variablelist 119943 119944[[boost::system::system_error][Thrown on failure.]] 119945 119946] 119947 119948 119949[heading Remarks] 119950 119951Calls `SSL_CTX_set_verify`. 119952 119953 119954 119955 119956[endsect] 119957 119958 119959 119960[section:overload2 ssl::context::set_verify_mode (2 of 2 overloads)] 119961 119962 119963Set the peer verification mode. 119964 119965 119966 void set_verify_mode( 119967 verify_mode v, 119968 boost::system::error_code & ec); 119969 119970 119971This function may be used to configure the peer verification mode used by the context. 119972 119973 119974[heading Parameters] 119975 119976 119977[variablelist 119978 119979[[v][A bitmask of peer verification modes. See [link boost_asio.reference.ssl__verify_mode `ssl::verify_mode`] for available values.]] 119980 119981[[ec][Set to indicate what error occurred, if any.]] 119982 119983] 119984 119985 119986[heading Remarks] 119987 119988Calls `SSL_CTX_set_verify`. 119989 119990 119991 119992 119993[endsect] 119994 119995 119996[endsect] 119997 119998 119999[section:single_dh_use ssl::context::single_dh_use] 120000 120001[indexterm2 boost_asio.indexterm.ssl__context.single_dh_use..single_dh_use..ssl::context] 120002Always create a new key when using tmp\_dh parameters. 120003 120004 120005 static const long single_dh_use = implementation_defined; 120006 120007 120008 120009[endsect] 120010 120011 120012[section:use_certificate ssl::context::use_certificate] 120013 120014[indexterm2 boost_asio.indexterm.ssl__context.use_certificate..use_certificate..ssl::context] 120015Use a certificate from a memory buffer. 120016 120017 120018 void ``[link boost_asio.reference.ssl__context.use_certificate.overload1 use_certificate]``( 120019 const const_buffer & certificate, 120020 file_format format); 120021 `` [''''»''' [link boost_asio.reference.ssl__context.use_certificate.overload1 more...]]`` 120022 120023 void ``[link boost_asio.reference.ssl__context.use_certificate.overload2 use_certificate]``( 120024 const const_buffer & certificate, 120025 file_format format, 120026 boost::system::error_code & ec); 120027 `` [''''»''' [link boost_asio.reference.ssl__context.use_certificate.overload2 more...]]`` 120028 120029 120030[section:overload1 ssl::context::use_certificate (1 of 2 overloads)] 120031 120032 120033Use a certificate from a memory buffer. 120034 120035 120036 void use_certificate( 120037 const const_buffer & certificate, 120038 file_format format); 120039 120040 120041This function is used to load a certificate into the context from a buffer. 120042 120043 120044[heading Parameters] 120045 120046 120047[variablelist 120048 120049[[certificate][The buffer containing the certificate.]] 120050 120051[[format][The certificate format (ASN.1 or PEM).]] 120052 120053] 120054 120055 120056[heading Exceptions] 120057 120058 120059[variablelist 120060 120061[[boost::system::system_error][Thrown on failure.]] 120062 120063] 120064 120065 120066[heading Remarks] 120067 120068Calls `SSL_CTX_use_certificate` or SSL\_CTX\_use\_certificate\_ASN1. 120069 120070 120071 120072 120073[endsect] 120074 120075 120076 120077[section:overload2 ssl::context::use_certificate (2 of 2 overloads)] 120078 120079 120080Use a certificate from a memory buffer. 120081 120082 120083 void use_certificate( 120084 const const_buffer & certificate, 120085 file_format format, 120086 boost::system::error_code & ec); 120087 120088 120089This function is used to load a certificate into the context from a buffer. 120090 120091 120092[heading Parameters] 120093 120094 120095[variablelist 120096 120097[[certificate][The buffer containing the certificate.]] 120098 120099[[format][The certificate format (ASN.1 or PEM).]] 120100 120101[[ec][Set to indicate what error occurred, if any.]] 120102 120103] 120104 120105 120106[heading Remarks] 120107 120108Calls `SSL_CTX_use_certificate` or SSL\_CTX\_use\_certificate\_ASN1. 120109 120110 120111 120112 120113[endsect] 120114 120115 120116[endsect] 120117 120118[section:use_certificate_chain ssl::context::use_certificate_chain] 120119 120120[indexterm2 boost_asio.indexterm.ssl__context.use_certificate_chain..use_certificate_chain..ssl::context] 120121Use a certificate chain from a memory buffer. 120122 120123 120124 void ``[link boost_asio.reference.ssl__context.use_certificate_chain.overload1 use_certificate_chain]``( 120125 const const_buffer & chain); 120126 `` [''''»''' [link boost_asio.reference.ssl__context.use_certificate_chain.overload1 more...]]`` 120127 120128 void ``[link boost_asio.reference.ssl__context.use_certificate_chain.overload2 use_certificate_chain]``( 120129 const const_buffer & chain, 120130 boost::system::error_code & ec); 120131 `` [''''»''' [link boost_asio.reference.ssl__context.use_certificate_chain.overload2 more...]]`` 120132 120133 120134[section:overload1 ssl::context::use_certificate_chain (1 of 2 overloads)] 120135 120136 120137Use a certificate chain from a memory buffer. 120138 120139 120140 void use_certificate_chain( 120141 const const_buffer & chain); 120142 120143 120144This function is used to load a certificate chain into the context from a buffer. 120145 120146 120147[heading Parameters] 120148 120149 120150[variablelist 120151 120152[[chain][The buffer containing the certificate chain. The certificate chain must use the PEM format.]] 120153 120154] 120155 120156 120157[heading Exceptions] 120158 120159 120160[variablelist 120161 120162[[boost::system::system_error][Thrown on failure.]] 120163 120164] 120165 120166 120167[heading Remarks] 120168 120169Calls `SSL_CTX_use_certificate` and SSL\_CTX\_add\_extra\_chain\_cert. 120170 120171 120172 120173 120174[endsect] 120175 120176 120177 120178[section:overload2 ssl::context::use_certificate_chain (2 of 2 overloads)] 120179 120180 120181Use a certificate chain from a memory buffer. 120182 120183 120184 void use_certificate_chain( 120185 const const_buffer & chain, 120186 boost::system::error_code & ec); 120187 120188 120189This function is used to load a certificate chain into the context from a buffer. 120190 120191 120192[heading Parameters] 120193 120194 120195[variablelist 120196 120197[[chain][The buffer containing the certificate chain. The certificate chain must use the PEM format.]] 120198 120199[[ec][Set to indicate what error occurred, if any.]] 120200 120201] 120202 120203 120204[heading Remarks] 120205 120206Calls `SSL_CTX_use_certificate` and SSL\_CTX\_add\_extra\_chain\_cert. 120207 120208 120209 120210 120211[endsect] 120212 120213 120214[endsect] 120215 120216[section:use_certificate_chain_file ssl::context::use_certificate_chain_file] 120217 120218[indexterm2 boost_asio.indexterm.ssl__context.use_certificate_chain_file..use_certificate_chain_file..ssl::context] 120219Use a certificate chain from a file. 120220 120221 120222 void ``[link boost_asio.reference.ssl__context.use_certificate_chain_file.overload1 use_certificate_chain_file]``( 120223 const std::string & filename); 120224 `` [''''»''' [link boost_asio.reference.ssl__context.use_certificate_chain_file.overload1 more...]]`` 120225 120226 void ``[link boost_asio.reference.ssl__context.use_certificate_chain_file.overload2 use_certificate_chain_file]``( 120227 const std::string & filename, 120228 boost::system::error_code & ec); 120229 `` [''''»''' [link boost_asio.reference.ssl__context.use_certificate_chain_file.overload2 more...]]`` 120230 120231 120232[section:overload1 ssl::context::use_certificate_chain_file (1 of 2 overloads)] 120233 120234 120235Use a certificate chain from a file. 120236 120237 120238 void use_certificate_chain_file( 120239 const std::string & filename); 120240 120241 120242This function is used to load a certificate chain into the context from a file. 120243 120244 120245[heading Parameters] 120246 120247 120248[variablelist 120249 120250[[filename][The name of the file containing the certificate. The file must use the PEM format.]] 120251 120252] 120253 120254 120255[heading Exceptions] 120256 120257 120258[variablelist 120259 120260[[boost::system::system_error][Thrown on failure.]] 120261 120262] 120263 120264 120265[heading Remarks] 120266 120267Calls `SSL_CTX_use_certificate_chain_file`. 120268 120269 120270 120271 120272[endsect] 120273 120274 120275 120276[section:overload2 ssl::context::use_certificate_chain_file (2 of 2 overloads)] 120277 120278 120279Use a certificate chain from a file. 120280 120281 120282 void use_certificate_chain_file( 120283 const std::string & filename, 120284 boost::system::error_code & ec); 120285 120286 120287This function is used to load a certificate chain into the context from a file. 120288 120289 120290[heading Parameters] 120291 120292 120293[variablelist 120294 120295[[filename][The name of the file containing the certificate. The file must use the PEM format.]] 120296 120297[[ec][Set to indicate what error occurred, if any.]] 120298 120299] 120300 120301 120302[heading Remarks] 120303 120304Calls `SSL_CTX_use_certificate_chain_file`. 120305 120306 120307 120308 120309[endsect] 120310 120311 120312[endsect] 120313 120314[section:use_certificate_file ssl::context::use_certificate_file] 120315 120316[indexterm2 boost_asio.indexterm.ssl__context.use_certificate_file..use_certificate_file..ssl::context] 120317Use a certificate from a file. 120318 120319 120320 void ``[link boost_asio.reference.ssl__context.use_certificate_file.overload1 use_certificate_file]``( 120321 const std::string & filename, 120322 file_format format); 120323 `` [''''»''' [link boost_asio.reference.ssl__context.use_certificate_file.overload1 more...]]`` 120324 120325 void ``[link boost_asio.reference.ssl__context.use_certificate_file.overload2 use_certificate_file]``( 120326 const std::string & filename, 120327 file_format format, 120328 boost::system::error_code & ec); 120329 `` [''''»''' [link boost_asio.reference.ssl__context.use_certificate_file.overload2 more...]]`` 120330 120331 120332[section:overload1 ssl::context::use_certificate_file (1 of 2 overloads)] 120333 120334 120335Use a certificate from a file. 120336 120337 120338 void use_certificate_file( 120339 const std::string & filename, 120340 file_format format); 120341 120342 120343This function is used to load a certificate into the context from a file. 120344 120345 120346[heading Parameters] 120347 120348 120349[variablelist 120350 120351[[filename][The name of the file containing the certificate.]] 120352 120353[[format][The file format (ASN.1 or PEM).]] 120354 120355] 120356 120357 120358[heading Exceptions] 120359 120360 120361[variablelist 120362 120363[[boost::system::system_error][Thrown on failure.]] 120364 120365] 120366 120367 120368[heading Remarks] 120369 120370Calls `SSL_CTX_use_certificate_file`. 120371 120372 120373 120374 120375[endsect] 120376 120377 120378 120379[section:overload2 ssl::context::use_certificate_file (2 of 2 overloads)] 120380 120381 120382Use a certificate from a file. 120383 120384 120385 void use_certificate_file( 120386 const std::string & filename, 120387 file_format format, 120388 boost::system::error_code & ec); 120389 120390 120391This function is used to load a certificate into the context from a file. 120392 120393 120394[heading Parameters] 120395 120396 120397[variablelist 120398 120399[[filename][The name of the file containing the certificate.]] 120400 120401[[format][The file format (ASN.1 or PEM).]] 120402 120403[[ec][Set to indicate what error occurred, if any.]] 120404 120405] 120406 120407 120408[heading Remarks] 120409 120410Calls `SSL_CTX_use_certificate_file`. 120411 120412 120413 120414 120415[endsect] 120416 120417 120418[endsect] 120419 120420[section:use_private_key ssl::context::use_private_key] 120421 120422[indexterm2 boost_asio.indexterm.ssl__context.use_private_key..use_private_key..ssl::context] 120423Use a private key from a memory buffer. 120424 120425 120426 void ``[link boost_asio.reference.ssl__context.use_private_key.overload1 use_private_key]``( 120427 const const_buffer & private_key, 120428 file_format format); 120429 `` [''''»''' [link boost_asio.reference.ssl__context.use_private_key.overload1 more...]]`` 120430 120431 void ``[link boost_asio.reference.ssl__context.use_private_key.overload2 use_private_key]``( 120432 const const_buffer & private_key, 120433 file_format format, 120434 boost::system::error_code & ec); 120435 `` [''''»''' [link boost_asio.reference.ssl__context.use_private_key.overload2 more...]]`` 120436 120437 120438[section:overload1 ssl::context::use_private_key (1 of 2 overloads)] 120439 120440 120441Use a private key from a memory buffer. 120442 120443 120444 void use_private_key( 120445 const const_buffer & private_key, 120446 file_format format); 120447 120448 120449This function is used to load a private key into the context from a buffer. 120450 120451 120452[heading Parameters] 120453 120454 120455[variablelist 120456 120457[[private_key][The buffer containing the private key.]] 120458 120459[[format][The private key format (ASN.1 or PEM).]] 120460 120461] 120462 120463 120464[heading Exceptions] 120465 120466 120467[variablelist 120468 120469[[boost::system::system_error][Thrown on failure.]] 120470 120471] 120472 120473 120474[heading Remarks] 120475 120476Calls `SSL_CTX_use_PrivateKey` or SSL\_CTX\_use\_PrivateKey\_ASN1. 120477 120478 120479 120480 120481[endsect] 120482 120483 120484 120485[section:overload2 ssl::context::use_private_key (2 of 2 overloads)] 120486 120487 120488Use a private key from a memory buffer. 120489 120490 120491 void use_private_key( 120492 const const_buffer & private_key, 120493 file_format format, 120494 boost::system::error_code & ec); 120495 120496 120497This function is used to load a private key into the context from a buffer. 120498 120499 120500[heading Parameters] 120501 120502 120503[variablelist 120504 120505[[private_key][The buffer containing the private key.]] 120506 120507[[format][The private key format (ASN.1 or PEM).]] 120508 120509[[ec][Set to indicate what error occurred, if any.]] 120510 120511] 120512 120513 120514[heading Remarks] 120515 120516Calls `SSL_CTX_use_PrivateKey` or SSL\_CTX\_use\_PrivateKey\_ASN1. 120517 120518 120519 120520 120521[endsect] 120522 120523 120524[endsect] 120525 120526[section:use_private_key_file ssl::context::use_private_key_file] 120527 120528[indexterm2 boost_asio.indexterm.ssl__context.use_private_key_file..use_private_key_file..ssl::context] 120529Use a private key from a file. 120530 120531 120532 void ``[link boost_asio.reference.ssl__context.use_private_key_file.overload1 use_private_key_file]``( 120533 const std::string & filename, 120534 file_format format); 120535 `` [''''»''' [link boost_asio.reference.ssl__context.use_private_key_file.overload1 more...]]`` 120536 120537 void ``[link boost_asio.reference.ssl__context.use_private_key_file.overload2 use_private_key_file]``( 120538 const std::string & filename, 120539 file_format format, 120540 boost::system::error_code & ec); 120541 `` [''''»''' [link boost_asio.reference.ssl__context.use_private_key_file.overload2 more...]]`` 120542 120543 120544[section:overload1 ssl::context::use_private_key_file (1 of 2 overloads)] 120545 120546 120547Use a private key from a file. 120548 120549 120550 void use_private_key_file( 120551 const std::string & filename, 120552 file_format format); 120553 120554 120555This function is used to load a private key into the context from a file. 120556 120557 120558[heading Parameters] 120559 120560 120561[variablelist 120562 120563[[filename][The name of the file containing the private key.]] 120564 120565[[format][The file format (ASN.1 or PEM).]] 120566 120567] 120568 120569 120570[heading Exceptions] 120571 120572 120573[variablelist 120574 120575[[boost::system::system_error][Thrown on failure.]] 120576 120577] 120578 120579 120580[heading Remarks] 120581 120582Calls `SSL_CTX_use_PrivateKey_file`. 120583 120584 120585 120586 120587[endsect] 120588 120589 120590 120591[section:overload2 ssl::context::use_private_key_file (2 of 2 overloads)] 120592 120593 120594Use a private key from a file. 120595 120596 120597 void use_private_key_file( 120598 const std::string & filename, 120599 file_format format, 120600 boost::system::error_code & ec); 120601 120602 120603This function is used to load a private key into the context from a file. 120604 120605 120606[heading Parameters] 120607 120608 120609[variablelist 120610 120611[[filename][The name of the file containing the private key.]] 120612 120613[[format][The file format (ASN.1 or PEM).]] 120614 120615[[ec][Set to indicate what error occurred, if any.]] 120616 120617] 120618 120619 120620[heading Remarks] 120621 120622Calls `SSL_CTX_use_PrivateKey_file`. 120623 120624 120625 120626 120627[endsect] 120628 120629 120630[endsect] 120631 120632[section:use_rsa_private_key ssl::context::use_rsa_private_key] 120633 120634[indexterm2 boost_asio.indexterm.ssl__context.use_rsa_private_key..use_rsa_private_key..ssl::context] 120635Use an RSA private key from a memory buffer. 120636 120637 120638 void ``[link boost_asio.reference.ssl__context.use_rsa_private_key.overload1 use_rsa_private_key]``( 120639 const const_buffer & private_key, 120640 file_format format); 120641 `` [''''»''' [link boost_asio.reference.ssl__context.use_rsa_private_key.overload1 more...]]`` 120642 120643 void ``[link boost_asio.reference.ssl__context.use_rsa_private_key.overload2 use_rsa_private_key]``( 120644 const const_buffer & private_key, 120645 file_format format, 120646 boost::system::error_code & ec); 120647 `` [''''»''' [link boost_asio.reference.ssl__context.use_rsa_private_key.overload2 more...]]`` 120648 120649 120650[section:overload1 ssl::context::use_rsa_private_key (1 of 2 overloads)] 120651 120652 120653Use an RSA private key from a memory buffer. 120654 120655 120656 void use_rsa_private_key( 120657 const const_buffer & private_key, 120658 file_format format); 120659 120660 120661This function is used to load an RSA private key into the context from a buffer. 120662 120663 120664[heading Parameters] 120665 120666 120667[variablelist 120668 120669[[private_key][The buffer containing the RSA private key.]] 120670 120671[[format][The private key format (ASN.1 or PEM).]] 120672 120673] 120674 120675 120676[heading Exceptions] 120677 120678 120679[variablelist 120680 120681[[boost::system::system_error][Thrown on failure.]] 120682 120683] 120684 120685 120686[heading Remarks] 120687 120688Calls `SSL_CTX_use_RSAPrivateKey` or SSL\_CTX\_use\_RSAPrivateKey\_ASN1. 120689 120690 120691 120692 120693[endsect] 120694 120695 120696 120697[section:overload2 ssl::context::use_rsa_private_key (2 of 2 overloads)] 120698 120699 120700Use an RSA private key from a memory buffer. 120701 120702 120703 void use_rsa_private_key( 120704 const const_buffer & private_key, 120705 file_format format, 120706 boost::system::error_code & ec); 120707 120708 120709This function is used to load an RSA private key into the context from a buffer. 120710 120711 120712[heading Parameters] 120713 120714 120715[variablelist 120716 120717[[private_key][The buffer containing the RSA private key.]] 120718 120719[[format][The private key format (ASN.1 or PEM).]] 120720 120721[[ec][Set to indicate what error occurred, if any.]] 120722 120723] 120724 120725 120726[heading Remarks] 120727 120728Calls `SSL_CTX_use_RSAPrivateKey` or SSL\_CTX\_use\_RSAPrivateKey\_ASN1. 120729 120730 120731 120732 120733[endsect] 120734 120735 120736[endsect] 120737 120738[section:use_rsa_private_key_file ssl::context::use_rsa_private_key_file] 120739 120740[indexterm2 boost_asio.indexterm.ssl__context.use_rsa_private_key_file..use_rsa_private_key_file..ssl::context] 120741Use an RSA private key from a file. 120742 120743 120744 void ``[link boost_asio.reference.ssl__context.use_rsa_private_key_file.overload1 use_rsa_private_key_file]``( 120745 const std::string & filename, 120746 file_format format); 120747 `` [''''»''' [link boost_asio.reference.ssl__context.use_rsa_private_key_file.overload1 more...]]`` 120748 120749 void ``[link boost_asio.reference.ssl__context.use_rsa_private_key_file.overload2 use_rsa_private_key_file]``( 120750 const std::string & filename, 120751 file_format format, 120752 boost::system::error_code & ec); 120753 `` [''''»''' [link boost_asio.reference.ssl__context.use_rsa_private_key_file.overload2 more...]]`` 120754 120755 120756[section:overload1 ssl::context::use_rsa_private_key_file (1 of 2 overloads)] 120757 120758 120759Use an RSA private key from a file. 120760 120761 120762 void use_rsa_private_key_file( 120763 const std::string & filename, 120764 file_format format); 120765 120766 120767This function is used to load an RSA private key into the context from a file. 120768 120769 120770[heading Parameters] 120771 120772 120773[variablelist 120774 120775[[filename][The name of the file containing the RSA private key.]] 120776 120777[[format][The file format (ASN.1 or PEM).]] 120778 120779] 120780 120781 120782[heading Exceptions] 120783 120784 120785[variablelist 120786 120787[[boost::system::system_error][Thrown on failure.]] 120788 120789] 120790 120791 120792[heading Remarks] 120793 120794Calls `SSL_CTX_use_RSAPrivateKey_file`. 120795 120796 120797 120798 120799[endsect] 120800 120801 120802 120803[section:overload2 ssl::context::use_rsa_private_key_file (2 of 2 overloads)] 120804 120805 120806Use an RSA private key from a file. 120807 120808 120809 void use_rsa_private_key_file( 120810 const std::string & filename, 120811 file_format format, 120812 boost::system::error_code & ec); 120813 120814 120815This function is used to load an RSA private key into the context from a file. 120816 120817 120818[heading Parameters] 120819 120820 120821[variablelist 120822 120823[[filename][The name of the file containing the RSA private key.]] 120824 120825[[format][The file format (ASN.1 or PEM).]] 120826 120827[[ec][Set to indicate what error occurred, if any.]] 120828 120829] 120830 120831 120832[heading Remarks] 120833 120834Calls `SSL_CTX_use_RSAPrivateKey_file`. 120835 120836 120837 120838 120839[endsect] 120840 120841 120842[endsect] 120843 120844[section:use_tmp_dh ssl::context::use_tmp_dh] 120845 120846[indexterm2 boost_asio.indexterm.ssl__context.use_tmp_dh..use_tmp_dh..ssl::context] 120847Use the specified memory buffer to obtain the temporary Diffie-Hellman parameters. 120848 120849 120850 void ``[link boost_asio.reference.ssl__context.use_tmp_dh.overload1 use_tmp_dh]``( 120851 const const_buffer & dh); 120852 `` [''''»''' [link boost_asio.reference.ssl__context.use_tmp_dh.overload1 more...]]`` 120853 120854 void ``[link boost_asio.reference.ssl__context.use_tmp_dh.overload2 use_tmp_dh]``( 120855 const const_buffer & dh, 120856 boost::system::error_code & ec); 120857 `` [''''»''' [link boost_asio.reference.ssl__context.use_tmp_dh.overload2 more...]]`` 120858 120859 120860[section:overload1 ssl::context::use_tmp_dh (1 of 2 overloads)] 120861 120862 120863Use the specified memory buffer to obtain the temporary Diffie-Hellman parameters. 120864 120865 120866 void use_tmp_dh( 120867 const const_buffer & dh); 120868 120869 120870This function is used to load Diffie-Hellman parameters into the context from a buffer. 120871 120872 120873[heading Parameters] 120874 120875 120876[variablelist 120877 120878[[dh][The memory buffer containing the Diffie-Hellman parameters. The buffer must use the PEM format.]] 120879 120880] 120881 120882 120883[heading Exceptions] 120884 120885 120886[variablelist 120887 120888[[boost::system::system_error][Thrown on failure.]] 120889 120890] 120891 120892 120893[heading Remarks] 120894 120895Calls `SSL_CTX_set_tmp_dh`. 120896 120897 120898 120899 120900[endsect] 120901 120902 120903 120904[section:overload2 ssl::context::use_tmp_dh (2 of 2 overloads)] 120905 120906 120907Use the specified memory buffer to obtain the temporary Diffie-Hellman parameters. 120908 120909 120910 void use_tmp_dh( 120911 const const_buffer & dh, 120912 boost::system::error_code & ec); 120913 120914 120915This function is used to load Diffie-Hellman parameters into the context from a buffer. 120916 120917 120918[heading Parameters] 120919 120920 120921[variablelist 120922 120923[[dh][The memory buffer containing the Diffie-Hellman parameters. The buffer must use the PEM format.]] 120924 120925[[ec][Set to indicate what error occurred, if any.]] 120926 120927] 120928 120929 120930[heading Remarks] 120931 120932Calls `SSL_CTX_set_tmp_dh`. 120933 120934 120935 120936 120937[endsect] 120938 120939 120940[endsect] 120941 120942[section:use_tmp_dh_file ssl::context::use_tmp_dh_file] 120943 120944[indexterm2 boost_asio.indexterm.ssl__context.use_tmp_dh_file..use_tmp_dh_file..ssl::context] 120945Use the specified file to obtain the temporary Diffie-Hellman parameters. 120946 120947 120948 void ``[link boost_asio.reference.ssl__context.use_tmp_dh_file.overload1 use_tmp_dh_file]``( 120949 const std::string & filename); 120950 `` [''''»''' [link boost_asio.reference.ssl__context.use_tmp_dh_file.overload1 more...]]`` 120951 120952 void ``[link boost_asio.reference.ssl__context.use_tmp_dh_file.overload2 use_tmp_dh_file]``( 120953 const std::string & filename, 120954 boost::system::error_code & ec); 120955 `` [''''»''' [link boost_asio.reference.ssl__context.use_tmp_dh_file.overload2 more...]]`` 120956 120957 120958[section:overload1 ssl::context::use_tmp_dh_file (1 of 2 overloads)] 120959 120960 120961Use the specified file to obtain the temporary Diffie-Hellman parameters. 120962 120963 120964 void use_tmp_dh_file( 120965 const std::string & filename); 120966 120967 120968This function is used to load Diffie-Hellman parameters into the context from a file. 120969 120970 120971[heading Parameters] 120972 120973 120974[variablelist 120975 120976[[filename][The name of the file containing the Diffie-Hellman parameters. The file must use the PEM format.]] 120977 120978] 120979 120980 120981[heading Exceptions] 120982 120983 120984[variablelist 120985 120986[[boost::system::system_error][Thrown on failure.]] 120987 120988] 120989 120990 120991[heading Remarks] 120992 120993Calls `SSL_CTX_set_tmp_dh`. 120994 120995 120996 120997 120998[endsect] 120999 121000 121001 121002[section:overload2 ssl::context::use_tmp_dh_file (2 of 2 overloads)] 121003 121004 121005Use the specified file to obtain the temporary Diffie-Hellman parameters. 121006 121007 121008 void use_tmp_dh_file( 121009 const std::string & filename, 121010 boost::system::error_code & ec); 121011 121012 121013This function is used to load Diffie-Hellman parameters into the context from a file. 121014 121015 121016[heading Parameters] 121017 121018 121019[variablelist 121020 121021[[filename][The name of the file containing the Diffie-Hellman parameters. The file must use the PEM format.]] 121022 121023[[ec][Set to indicate what error occurred, if any.]] 121024 121025] 121026 121027 121028[heading Remarks] 121029 121030Calls `SSL_CTX_set_tmp_dh`. 121031 121032 121033 121034 121035[endsect] 121036 121037 121038[endsect] 121039 121040 121041[section:_context ssl::context::~context] 121042 121043[indexterm2 boost_asio.indexterm.ssl__context._context..~context..ssl::context] 121044Destructor. 121045 121046 121047 ~context(); 121048 121049 121050 121051[endsect] 121052 121053 121054 121055[endsect] 121056 121057[section:ssl__context_base ssl::context_base] 121058 121059[indexterm1 boost_asio.indexterm.ssl__context_base..ssl::context_base] 121060 121061 121062The [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. 121063 121064 121065 class context_base 121066 121067 121068[heading Types] 121069[table 121070 [[Name][Description]] 121071 121072 [ 121073 121074 [[link boost_asio.reference.ssl__context_base.file_format [*file_format]]] 121075 [File format types. ] 121076 121077 ] 121078 121079 [ 121080 121081 [[link boost_asio.reference.ssl__context_base.method [*method]]] 121082 [Different methods supported by a context. ] 121083 121084 ] 121085 121086 [ 121087 121088 [[link boost_asio.reference.ssl__context_base.options [*options]]] 121089 [Bitmask type for SSL options. ] 121090 121091 ] 121092 121093 [ 121094 121095 [[link boost_asio.reference.ssl__context_base.password_purpose [*password_purpose]]] 121096 [Purpose of PEM password. ] 121097 121098 ] 121099 121100] 121101 121102[heading Protected Member Functions] 121103[table 121104 [[Name][Description]] 121105 121106 [ 121107 [[link boost_asio.reference.ssl__context_base._context_base [*~context_base]] [destructor]] 121108 [Protected destructor to prevent deletion through this type. ] 121109 ] 121110 121111] 121112 121113[heading Data Members] 121114[table 121115 [[Name][Description]] 121116 121117 [ 121118 [[link boost_asio.reference.ssl__context_base.default_workarounds [*default_workarounds]] [static]] 121119 [Implement various bug workarounds. ] 121120 ] 121121 121122 [ 121123 [[link boost_asio.reference.ssl__context_base.no_compression [*no_compression]] [static]] 121124 [Disable compression. Compression is disabled by default. ] 121125 ] 121126 121127 [ 121128 [[link boost_asio.reference.ssl__context_base.no_sslv2 [*no_sslv2]] [static]] 121129 [Disable SSL v2. ] 121130 ] 121131 121132 [ 121133 [[link boost_asio.reference.ssl__context_base.no_sslv3 [*no_sslv3]] [static]] 121134 [Disable SSL v3. ] 121135 ] 121136 121137 [ 121138 [[link boost_asio.reference.ssl__context_base.no_tlsv1 [*no_tlsv1]] [static]] 121139 [Disable TLS v1. ] 121140 ] 121141 121142 [ 121143 [[link boost_asio.reference.ssl__context_base.no_tlsv1_1 [*no_tlsv1_1]] [static]] 121144 [Disable TLS v1.1. ] 121145 ] 121146 121147 [ 121148 [[link boost_asio.reference.ssl__context_base.no_tlsv1_2 [*no_tlsv1_2]] [static]] 121149 [Disable TLS v1.2. ] 121150 ] 121151 121152 [ 121153 [[link boost_asio.reference.ssl__context_base.no_tlsv1_3 [*no_tlsv1_3]] [static]] 121154 [Disable TLS v1.3. ] 121155 ] 121156 121157 [ 121158 [[link boost_asio.reference.ssl__context_base.single_dh_use [*single_dh_use]] [static]] 121159 [Always create a new key when using tmp_dh parameters. ] 121160 ] 121161 121162] 121163 121164[heading Requirements] 121165 121166['Header: ][^boost/asio/ssl/context_base.hpp] 121167 121168['Convenience header: ][^boost/asio/ssl.hpp] 121169 121170 121171[section:default_workarounds ssl::context_base::default_workarounds] 121172 121173[indexterm2 boost_asio.indexterm.ssl__context_base.default_workarounds..default_workarounds..ssl::context_base] 121174Implement various bug workarounds. 121175 121176 121177 static const long default_workarounds = implementation_defined; 121178 121179 121180 121181[endsect] 121182 121183 121184 121185[section:file_format ssl::context_base::file_format] 121186 121187[indexterm2 boost_asio.indexterm.ssl__context_base.file_format..file_format..ssl::context_base] 121188File format types. 121189 121190 121191 enum file_format 121192 121193[indexterm2 boost_asio.indexterm.ssl__context_base.file_format.asn1..asn1..ssl::context_base] 121194[indexterm2 boost_asio.indexterm.ssl__context_base.file_format.pem..pem..ssl::context_base] 121195 121196[heading Values] 121197[variablelist 121198 121199 [ 121200 [asn1] 121201 [ASN.1 file. ] 121202 ] 121203 121204 [ 121205 [pem] 121206 [PEM file. ] 121207 ] 121208 121209] 121210 121211 121212 121213[endsect] 121214 121215 121216 121217[section:method ssl::context_base::method] 121218 121219[indexterm2 boost_asio.indexterm.ssl__context_base.method..method..ssl::context_base] 121220Different methods supported by a context. 121221 121222 121223 enum method 121224 121225[indexterm2 boost_asio.indexterm.ssl__context_base.method.sslv2..sslv2..ssl::context_base] 121226[indexterm2 boost_asio.indexterm.ssl__context_base.method.sslv2_client..sslv2_client..ssl::context_base] 121227[indexterm2 boost_asio.indexterm.ssl__context_base.method.sslv2_server..sslv2_server..ssl::context_base] 121228[indexterm2 boost_asio.indexterm.ssl__context_base.method.sslv3..sslv3..ssl::context_base] 121229[indexterm2 boost_asio.indexterm.ssl__context_base.method.sslv3_client..sslv3_client..ssl::context_base] 121230[indexterm2 boost_asio.indexterm.ssl__context_base.method.sslv3_server..sslv3_server..ssl::context_base] 121231[indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv1..tlsv1..ssl::context_base] 121232[indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv1_client..tlsv1_client..ssl::context_base] 121233[indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv1_server..tlsv1_server..ssl::context_base] 121234[indexterm2 boost_asio.indexterm.ssl__context_base.method.sslv23..sslv23..ssl::context_base] 121235[indexterm2 boost_asio.indexterm.ssl__context_base.method.sslv23_client..sslv23_client..ssl::context_base] 121236[indexterm2 boost_asio.indexterm.ssl__context_base.method.sslv23_server..sslv23_server..ssl::context_base] 121237[indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv11..tlsv11..ssl::context_base] 121238[indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv11_client..tlsv11_client..ssl::context_base] 121239[indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv11_server..tlsv11_server..ssl::context_base] 121240[indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv12..tlsv12..ssl::context_base] 121241[indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv12_client..tlsv12_client..ssl::context_base] 121242[indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv12_server..tlsv12_server..ssl::context_base] 121243[indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv13..tlsv13..ssl::context_base] 121244[indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv13_client..tlsv13_client..ssl::context_base] 121245[indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv13_server..tlsv13_server..ssl::context_base] 121246[indexterm2 boost_asio.indexterm.ssl__context_base.method.tls..tls..ssl::context_base] 121247[indexterm2 boost_asio.indexterm.ssl__context_base.method.tls_client..tls_client..ssl::context_base] 121248[indexterm2 boost_asio.indexterm.ssl__context_base.method.tls_server..tls_server..ssl::context_base] 121249 121250[heading Values] 121251[variablelist 121252 121253 [ 121254 [sslv2] 121255 [Generic SSL version 2. ] 121256 ] 121257 121258 [ 121259 [sslv2_client] 121260 [SSL version 2 client. ] 121261 ] 121262 121263 [ 121264 [sslv2_server] 121265 [SSL version 2 server. ] 121266 ] 121267 121268 [ 121269 [sslv3] 121270 [Generic SSL version 3. ] 121271 ] 121272 121273 [ 121274 [sslv3_client] 121275 [SSL version 3 client. ] 121276 ] 121277 121278 [ 121279 [sslv3_server] 121280 [SSL version 3 server. ] 121281 ] 121282 121283 [ 121284 [tlsv1] 121285 [Generic TLS version 1. ] 121286 ] 121287 121288 [ 121289 [tlsv1_client] 121290 [TLS version 1 client. ] 121291 ] 121292 121293 [ 121294 [tlsv1_server] 121295 [TLS version 1 server. ] 121296 ] 121297 121298 [ 121299 [sslv23] 121300 [Generic SSL/TLS. ] 121301 ] 121302 121303 [ 121304 [sslv23_client] 121305 [SSL/TLS client. ] 121306 ] 121307 121308 [ 121309 [sslv23_server] 121310 [SSL/TLS server. ] 121311 ] 121312 121313 [ 121314 [tlsv11] 121315 [Generic TLS version 1.1. ] 121316 ] 121317 121318 [ 121319 [tlsv11_client] 121320 [TLS version 1.1 client. ] 121321 ] 121322 121323 [ 121324 [tlsv11_server] 121325 [TLS version 1.1 server. ] 121326 ] 121327 121328 [ 121329 [tlsv12] 121330 [Generic TLS version 1.2. ] 121331 ] 121332 121333 [ 121334 [tlsv12_client] 121335 [TLS version 1.2 client. ] 121336 ] 121337 121338 [ 121339 [tlsv12_server] 121340 [TLS version 1.2 server. ] 121341 ] 121342 121343 [ 121344 [tlsv13] 121345 [Generic TLS version 1.3. ] 121346 ] 121347 121348 [ 121349 [tlsv13_client] 121350 [TLS version 1.3 client. ] 121351 ] 121352 121353 [ 121354 [tlsv13_server] 121355 [TLS version 1.3 server. ] 121356 ] 121357 121358 [ 121359 [tls] 121360 [Generic TLS. ] 121361 ] 121362 121363 [ 121364 [tls_client] 121365 [TLS client. ] 121366 ] 121367 121368 [ 121369 [tls_server] 121370 [TLS server. ] 121371 ] 121372 121373] 121374 121375 121376 121377[endsect] 121378 121379 121380 121381[section:no_compression ssl::context_base::no_compression] 121382 121383[indexterm2 boost_asio.indexterm.ssl__context_base.no_compression..no_compression..ssl::context_base] 121384Disable compression. Compression is disabled by default. 121385 121386 121387 static const long no_compression = implementation_defined; 121388 121389 121390 121391[endsect] 121392 121393 121394 121395[section:no_sslv2 ssl::context_base::no_sslv2] 121396 121397[indexterm2 boost_asio.indexterm.ssl__context_base.no_sslv2..no_sslv2..ssl::context_base] 121398Disable SSL v2. 121399 121400 121401 static const long no_sslv2 = implementation_defined; 121402 121403 121404 121405[endsect] 121406 121407 121408 121409[section:no_sslv3 ssl::context_base::no_sslv3] 121410 121411[indexterm2 boost_asio.indexterm.ssl__context_base.no_sslv3..no_sslv3..ssl::context_base] 121412Disable SSL v3. 121413 121414 121415 static const long no_sslv3 = implementation_defined; 121416 121417 121418 121419[endsect] 121420 121421 121422 121423[section:no_tlsv1 ssl::context_base::no_tlsv1] 121424 121425[indexterm2 boost_asio.indexterm.ssl__context_base.no_tlsv1..no_tlsv1..ssl::context_base] 121426Disable TLS v1. 121427 121428 121429 static const long no_tlsv1 = implementation_defined; 121430 121431 121432 121433[endsect] 121434 121435 121436 121437[section:no_tlsv1_1 ssl::context_base::no_tlsv1_1] 121438 121439[indexterm2 boost_asio.indexterm.ssl__context_base.no_tlsv1_1..no_tlsv1_1..ssl::context_base] 121440Disable TLS v1.1. 121441 121442 121443 static const long no_tlsv1_1 = implementation_defined; 121444 121445 121446 121447[endsect] 121448 121449 121450 121451[section:no_tlsv1_2 ssl::context_base::no_tlsv1_2] 121452 121453[indexterm2 boost_asio.indexterm.ssl__context_base.no_tlsv1_2..no_tlsv1_2..ssl::context_base] 121454Disable TLS v1.2. 121455 121456 121457 static const long no_tlsv1_2 = implementation_defined; 121458 121459 121460 121461[endsect] 121462 121463 121464 121465[section:no_tlsv1_3 ssl::context_base::no_tlsv1_3] 121466 121467[indexterm2 boost_asio.indexterm.ssl__context_base.no_tlsv1_3..no_tlsv1_3..ssl::context_base] 121468Disable TLS v1.3. 121469 121470 121471 static const long no_tlsv1_3 = implementation_defined; 121472 121473 121474 121475[endsect] 121476 121477 121478 121479[section:options ssl::context_base::options] 121480 121481[indexterm2 boost_asio.indexterm.ssl__context_base.options..options..ssl::context_base] 121482Bitmask type for SSL options. 121483 121484 121485 typedef long options; 121486 121487 121488 121489[heading Requirements] 121490 121491['Header: ][^boost/asio/ssl/context_base.hpp] 121492 121493['Convenience header: ][^boost/asio/ssl.hpp] 121494 121495 121496[endsect] 121497 121498 121499 121500[section:password_purpose ssl::context_base::password_purpose] 121501 121502[indexterm2 boost_asio.indexterm.ssl__context_base.password_purpose..password_purpose..ssl::context_base] 121503Purpose of PEM password. 121504 121505 121506 enum password_purpose 121507 121508[indexterm2 boost_asio.indexterm.ssl__context_base.password_purpose.for_reading..for_reading..ssl::context_base] 121509[indexterm2 boost_asio.indexterm.ssl__context_base.password_purpose.for_writing..for_writing..ssl::context_base] 121510 121511[heading Values] 121512[variablelist 121513 121514 [ 121515 [for_reading] 121516 [The password is needed for reading/decryption. ] 121517 ] 121518 121519 [ 121520 [for_writing] 121521 [The password is needed for writing/encryption. ] 121522 ] 121523 121524] 121525 121526 121527 121528[endsect] 121529 121530 121531 121532[section:single_dh_use ssl::context_base::single_dh_use] 121533 121534[indexterm2 boost_asio.indexterm.ssl__context_base.single_dh_use..single_dh_use..ssl::context_base] 121535Always create a new key when using tmp\_dh parameters. 121536 121537 121538 static const long single_dh_use = implementation_defined; 121539 121540 121541 121542[endsect] 121543 121544 121545 121546[section:_context_base ssl::context_base::~context_base] 121547 121548[indexterm2 boost_asio.indexterm.ssl__context_base._context_base..~context_base..ssl::context_base] 121549Protected destructor to prevent deletion through this type. 121550 121551 121552 ~context_base(); 121553 121554 121555 121556[endsect] 121557 121558 121559 121560[endsect] 121561 121562 121563[section:ssl__error__get_stream_category ssl::error::get_stream_category] 121564 121565[indexterm1 boost_asio.indexterm.ssl__error__get_stream_category..ssl::error::get_stream_category] 121566 121567 const boost::system::error_category & get_stream_category(); 121568 121569 121570[heading Requirements] 121571 121572['Header: ][^boost/asio/ssl/error.hpp] 121573 121574['Convenience header: ][^boost/asio/ssl.hpp] 121575 121576 121577[endsect] 121578 121579 121580 121581[section:ssl__error__make_error_code ssl::error::make_error_code] 121582 121583[indexterm1 boost_asio.indexterm.ssl__error__make_error_code..ssl::error::make_error_code] 121584 121585 boost::system::error_code make_error_code( 121586 stream_errors e); 121587 121588 121589[heading Requirements] 121590 121591['Header: ][^boost/asio/ssl/error.hpp] 121592 121593['Convenience header: ][^boost/asio/ssl.hpp] 121594 121595 121596[endsect] 121597 121598 121599 121600[section:ssl__error__stream_category ssl::error::stream_category] 121601 121602[indexterm1 boost_asio.indexterm.ssl__error__stream_category..ssl::error::stream_category] 121603 121604 static const boost::system::error_category & stream_category = boost::asio::ssl::error::get_stream_category(); 121605 121606 121607[heading Requirements] 121608 121609['Header: ][^boost/asio/ssl/error.hpp] 121610 121611['Convenience header: ][^boost/asio/ssl.hpp] 121612 121613 121614[endsect] 121615 121616 121617 121618[section:ssl__error__stream_errors ssl::error::stream_errors] 121619 121620[indexterm1 boost_asio.indexterm.ssl__error__stream_errors..ssl::error::stream_errors] 121621 121622 enum stream_errors 121623 121624[indexterm2 boost_asio.indexterm.ssl__error__stream_errors.stream_truncated..stream_truncated..ssl::error::stream_errors] 121625[indexterm2 boost_asio.indexterm.ssl__error__stream_errors.unspecified_system_error..unspecified_system_error..ssl::error::stream_errors] 121626[indexterm2 boost_asio.indexterm.ssl__error__stream_errors.unexpected_result..unexpected_result..ssl::error::stream_errors] 121627 121628[heading Values] 121629[variablelist 121630 121631 [ 121632 [stream_truncated] 121633 [The underlying stream closed before the ssl stream gracefully shut down. ] 121634 ] 121635 121636 [ 121637 [unspecified_system_error] 121638 [The underlying SSL library returned a system error without providing further information. ] 121639 ] 121640 121641 [ 121642 [unexpected_result] 121643 [The underlying SSL library generated an unexpected result from a function call. ] 121644 ] 121645 121646] 121647 121648 121649[heading Requirements] 121650 121651['Header: ][^boost/asio/ssl/error.hpp] 121652 121653['Convenience header: ][^boost/asio/ssl.hpp] 121654 121655 121656[endsect] 121657 121658 121659[section:ssl__host_name_verification ssl::host_name_verification] 121660 121661[indexterm1 boost_asio.indexterm.ssl__host_name_verification..ssl::host_name_verification] 121662 121663 121664Verifies a certificate against a host\_name according to the rules described in RFC 6125. 121665 121666 121667 class host_name_verification 121668 121669 121670[heading Types] 121671[table 121672 [[Name][Description]] 121673 121674 [ 121675 121676 [[link boost_asio.reference.ssl__host_name_verification.result_type [*result_type]]] 121677 [The type of the function object's result. ] 121678 121679 ] 121680 121681] 121682 121683[heading Member Functions] 121684[table 121685 [[Name][Description]] 121686 121687 [ 121688 [[link boost_asio.reference.ssl__host_name_verification.host_name_verification [*host_name_verification]] [constructor]] 121689 [Constructor. ] 121690 ] 121691 121692 [ 121693 [[link boost_asio.reference.ssl__host_name_verification.operator_lp__rp_ [*operator()]]] 121694 [Perform certificate verification. ] 121695 ] 121696 121697] 121698 121699 121700[heading Example] 121701 121702The following example shows how to synchronously open a secure connection to a given host name: 121703 121704 using boost::asio::ip::tcp; 121705 namespace ssl = boost::asio::ssl; 121706 typedef ssl::stream<tcp::socket> ssl_socket; 121707 121708 // Create a context that uses the default paths for finding CA certificates. 121709 ssl::context ctx(ssl::context::sslv23); 121710 ctx.set_default_verify_paths(); 121711 121712 // Open a socket and connect it to the remote host. 121713 boost::asio::io_context io_context; 121714 ssl_socket sock(io_context, ctx); 121715 tcp::resolver resolver(io_context); 121716 tcp::resolver::query query("host.name", "https"); 121717 boost::asio::connect(sock.lowest_layer(), resolver.resolve(query)); 121718 sock.lowest_layer().set_option(tcp::no_delay(true)); 121719 121720 // Perform SSL handshake and verify the remote host's certificate. 121721 sock.set_verify_mode(ssl::verify_peer); 121722 sock.set_verify_callback(ssl::host_name_verification("host.name")); 121723 sock.handshake(ssl_socket::client); 121724 121725 // ... read and write as normal ... 121726 121727 121728 121729 121730 121731 121732[heading Requirements] 121733 121734['Header: ][^boost/asio/ssl/host_name_verification.hpp] 121735 121736['Convenience header: ][^boost/asio/ssl.hpp] 121737 121738 121739[section:host_name_verification ssl::host_name_verification::host_name_verification] 121740 121741[indexterm2 boost_asio.indexterm.ssl__host_name_verification.host_name_verification..host_name_verification..ssl::host_name_verification] 121742Constructor. 121743 121744 121745 host_name_verification( 121746 const std::string & host); 121747 121748 121749 121750[endsect] 121751 121752 121753 121754[section:operator_lp__rp_ ssl::host_name_verification::operator()] 121755 121756[indexterm2 boost_asio.indexterm.ssl__host_name_verification.operator_lp__rp_..operator()..ssl::host_name_verification] 121757Perform certificate verification. 121758 121759 121760 bool operator()( 121761 bool preverified, 121762 verify_context & ctx) const; 121763 121764 121765 121766[endsect] 121767 121768 121769 121770[section:result_type ssl::host_name_verification::result_type] 121771 121772[indexterm2 boost_asio.indexterm.ssl__host_name_verification.result_type..result_type..ssl::host_name_verification] 121773The type of the function object's result. 121774 121775 121776 typedef bool result_type; 121777 121778 121779 121780[heading Requirements] 121781 121782['Header: ][^boost/asio/ssl/host_name_verification.hpp] 121783 121784['Convenience header: ][^boost/asio/ssl.hpp] 121785 121786 121787[endsect] 121788 121789 121790 121791[endsect] 121792 121793[section:ssl__rfc2818_verification ssl::rfc2818_verification] 121794 121795[indexterm1 boost_asio.indexterm.ssl__rfc2818_verification..ssl::rfc2818_verification] 121796 121797 121798(Deprecated. Use [link boost_asio.reference.ssl__host_name_verification `ssl::host_name_verification`].) Verifies a certificate against a hostname according to the rules described in RFC 2818. 121799 121800 121801 class rfc2818_verification 121802 121803 121804[heading Types] 121805[table 121806 [[Name][Description]] 121807 121808 [ 121809 121810 [[link boost_asio.reference.ssl__rfc2818_verification.result_type [*result_type]]] 121811 [The type of the function object's result. ] 121812 121813 ] 121814 121815] 121816 121817[heading Member Functions] 121818[table 121819 [[Name][Description]] 121820 121821 [ 121822 [[link boost_asio.reference.ssl__rfc2818_verification.operator_lp__rp_ [*operator()]]] 121823 [Perform certificate verification. ] 121824 ] 121825 121826 [ 121827 [[link boost_asio.reference.ssl__rfc2818_verification.rfc2818_verification [*rfc2818_verification]] [constructor]] 121828 [Constructor. ] 121829 ] 121830 121831] 121832 121833 121834[heading Example] 121835 121836The following example shows how to synchronously open a secure connection to a given host name: 121837 121838 using boost::asio::ip::tcp; 121839 namespace ssl = boost::asio::ssl; 121840 typedef ssl::stream<tcp::socket> ssl_socket; 121841 121842 // Create a context that uses the default paths for finding CA certificates. 121843 ssl::context ctx(ssl::context::sslv23); 121844 ctx.set_default_verify_paths(); 121845 121846 // Open a socket and connect it to the remote host. 121847 boost::asio::io_context io_context; 121848 ssl_socket sock(io_context, ctx); 121849 tcp::resolver resolver(io_context); 121850 tcp::resolver::query query("host.name", "https"); 121851 boost::asio::connect(sock.lowest_layer(), resolver.resolve(query)); 121852 sock.lowest_layer().set_option(tcp::no_delay(true)); 121853 121854 // Perform SSL handshake and verify the remote host's certificate. 121855 sock.set_verify_mode(ssl::verify_peer); 121856 sock.set_verify_callback(ssl::rfc2818_verification("host.name")); 121857 sock.handshake(ssl_socket::client); 121858 121859 // ... read and write as normal ... 121860 121861 121862 121863 121864 121865 121866[heading Requirements] 121867 121868['Header: ][^boost/asio/ssl/rfc2818_verification.hpp] 121869 121870['Convenience header: ][^boost/asio/ssl.hpp] 121871 121872 121873[section:operator_lp__rp_ ssl::rfc2818_verification::operator()] 121874 121875[indexterm2 boost_asio.indexterm.ssl__rfc2818_verification.operator_lp__rp_..operator()..ssl::rfc2818_verification] 121876Perform certificate verification. 121877 121878 121879 bool operator()( 121880 bool preverified, 121881 verify_context & ctx) const; 121882 121883 121884 121885[endsect] 121886 121887 121888 121889[section:result_type ssl::rfc2818_verification::result_type] 121890 121891[indexterm2 boost_asio.indexterm.ssl__rfc2818_verification.result_type..result_type..ssl::rfc2818_verification] 121892The type of the function object's result. 121893 121894 121895 typedef bool result_type; 121896 121897 121898 121899[heading Requirements] 121900 121901['Header: ][^boost/asio/ssl/rfc2818_verification.hpp] 121902 121903['Convenience header: ][^boost/asio/ssl.hpp] 121904 121905 121906[endsect] 121907 121908 121909 121910[section:rfc2818_verification ssl::rfc2818_verification::rfc2818_verification] 121911 121912[indexterm2 boost_asio.indexterm.ssl__rfc2818_verification.rfc2818_verification..rfc2818_verification..ssl::rfc2818_verification] 121913Constructor. 121914 121915 121916 rfc2818_verification( 121917 const std::string & host); 121918 121919 121920 121921[endsect] 121922 121923 121924 121925[endsect] 121926 121927[section:ssl__stream ssl::stream] 121928 121929[indexterm1 boost_asio.indexterm.ssl__stream..ssl::stream] 121930 121931 121932Provides stream-oriented functionality using SSL. 121933 121934 121935 template< 121936 typename Stream> 121937 class stream : 121938 public ssl::stream_base, 121939 noncopyable 121940 121941 121942[heading Types] 121943[table 121944 [[Name][Description]] 121945 121946 [ 121947 121948 [[link boost_asio.reference.ssl__stream__impl_struct [*impl_struct]]] 121949 [Structure for use with deprecated impl_type. ] 121950 121951 ] 121952 121953 [ 121954 121955 [[link boost_asio.reference.ssl__stream.executor_type [*executor_type]]] 121956 [The type of the executor associated with the object. ] 121957 121958 ] 121959 121960 [ 121961 121962 [[link boost_asio.reference.ssl__stream.handshake_type [*handshake_type]]] 121963 [Different handshake types. ] 121964 121965 ] 121966 121967 [ 121968 121969 [[link boost_asio.reference.ssl__stream.lowest_layer_type [*lowest_layer_type]]] 121970 [The type of the lowest layer. ] 121971 121972 ] 121973 121974 [ 121975 121976 [[link boost_asio.reference.ssl__stream.native_handle_type [*native_handle_type]]] 121977 [The native handle type of the SSL stream. ] 121978 121979 ] 121980 121981 [ 121982 121983 [[link boost_asio.reference.ssl__stream.next_layer_type [*next_layer_type]]] 121984 [The type of the next layer. ] 121985 121986 ] 121987 121988] 121989 121990[heading Member Functions] 121991[table 121992 [[Name][Description]] 121993 121994 [ 121995 [[link boost_asio.reference.ssl__stream.async_handshake [*async_handshake]]] 121996 [Start an asynchronous SSL handshake. ] 121997 ] 121998 121999 [ 122000 [[link boost_asio.reference.ssl__stream.async_read_some [*async_read_some]]] 122001 [Start an asynchronous read. ] 122002 ] 122003 122004 [ 122005 [[link boost_asio.reference.ssl__stream.async_shutdown [*async_shutdown]]] 122006 [Asynchronously shut down SSL on the stream. ] 122007 ] 122008 122009 [ 122010 [[link boost_asio.reference.ssl__stream.async_write_some [*async_write_some]]] 122011 [Start an asynchronous write. ] 122012 ] 122013 122014 [ 122015 [[link boost_asio.reference.ssl__stream.get_executor [*get_executor]]] 122016 [Get the executor associated with the object. ] 122017 ] 122018 122019 [ 122020 [[link boost_asio.reference.ssl__stream.handshake [*handshake]]] 122021 [Perform SSL handshaking. ] 122022 ] 122023 122024 [ 122025 [[link boost_asio.reference.ssl__stream.lowest_layer [*lowest_layer]]] 122026 [Get a reference to the lowest layer. ] 122027 ] 122028 122029 [ 122030 [[link boost_asio.reference.ssl__stream.native_handle [*native_handle]]] 122031 [Get the underlying implementation in the native type. ] 122032 ] 122033 122034 [ 122035 [[link boost_asio.reference.ssl__stream.next_layer [*next_layer]]] 122036 [Get a reference to the next layer. ] 122037 ] 122038 122039 [ 122040 [[link boost_asio.reference.ssl__stream.read_some [*read_some]]] 122041 [Read some data from the stream. ] 122042 ] 122043 122044 [ 122045 [[link boost_asio.reference.ssl__stream.set_verify_callback [*set_verify_callback]]] 122046 [Set the callback used to verify peer certificates. ] 122047 ] 122048 122049 [ 122050 [[link boost_asio.reference.ssl__stream.set_verify_depth [*set_verify_depth]]] 122051 [Set the peer verification depth. ] 122052 ] 122053 122054 [ 122055 [[link boost_asio.reference.ssl__stream.set_verify_mode [*set_verify_mode]]] 122056 [Set the peer verification mode. ] 122057 ] 122058 122059 [ 122060 [[link boost_asio.reference.ssl__stream.shutdown [*shutdown]]] 122061 [Shut down SSL on the stream. ] 122062 ] 122063 122064 [ 122065 [[link boost_asio.reference.ssl__stream.stream [*stream]] [constructor]] 122066 [Construct a stream. 122067 [hr] 122068 Move-construct a stream from another. ] 122069 ] 122070 122071 [ 122072 [[link boost_asio.reference.ssl__stream.write_some [*write_some]]] 122073 [Write some data to the stream. ] 122074 ] 122075 122076 [ 122077 [[link boost_asio.reference.ssl__stream._stream [*~stream]] [destructor]] 122078 [Destructor. ] 122079 ] 122080 122081] 122082 122083The stream class template provides asynchronous and blocking stream-oriented functionality using SSL. 122084 122085 122086[heading Thread Safety] 122087 122088['Distinct] ['objects:] Safe. 122089 122090['Shared] ['objects:] Unsafe. The application must also ensure that all asynchronous operations are performed within the same implicit or explicit strand. 122091 122092 122093[heading Example] 122094 122095To use the SSL stream template with an `ip::tcp::socket`, you would write: 122096 122097 boost::asio::io_context my_context; 122098 boost::asio::ssl::context ctx(boost::asio::ssl::context::sslv23); 122099 boost::asio::ssl::stream<asio:ip::tcp::socket> sock(my_context, ctx); 122100 122101 122102 122103 122104 122105 122106 122107[heading Requirements] 122108 122109['Header: ][^boost/asio/ssl/stream.hpp] 122110 122111['Convenience header: ][^boost/asio/ssl.hpp] 122112 122113[section:async_handshake ssl::stream::async_handshake] 122114 122115[indexterm2 boost_asio.indexterm.ssl__stream.async_handshake..async_handshake..ssl::stream] 122116Start an asynchronous SSL handshake. 122117 122118 122119 template< 122120 typename ``[link boost_asio.reference.HandshakeHandler HandshakeHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 122121 ``[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]``( 122122 handshake_type type, 122123 HandshakeHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 122124 `` [''''»''' [link boost_asio.reference.ssl__stream.async_handshake.overload1 more...]]`` 122125 122126 template< 122127 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 122128 typename ``[link boost_asio.reference.BufferedHandshakeHandler BufferedHandshakeHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 122129 ``[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]``( 122130 handshake_type type, 122131 const ConstBufferSequence & buffers, 122132 BufferedHandshakeHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 122133 `` [''''»''' [link boost_asio.reference.ssl__stream.async_handshake.overload2 more...]]`` 122134 122135 122136[section:overload1 ssl::stream::async_handshake (1 of 2 overloads)] 122137 122138 122139Start an asynchronous SSL handshake. 122140 122141 122142 template< 122143 typename ``[link boost_asio.reference.HandshakeHandler HandshakeHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 122144 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_handshake( 122145 handshake_type type, 122146 HandshakeHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 122147 122148 122149This function is used to asynchronously perform an SSL handshake on the stream. This function call always returns immediately. 122150 122151 122152[heading Parameters] 122153 122154 122155[variablelist 122156 122157[[type][The type of handshaking to be performed, i.e. as a client or as a server.]] 122158 122159[[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: 122160`` 122161 void handler( 122162 const boost::system::error_code& error // Result of operation. 122163 ); 122164`` 122165]] 122166 122167] 122168 122169 122170 122171 122172[endsect] 122173 122174 122175 122176[section:overload2 ssl::stream::async_handshake (2 of 2 overloads)] 122177 122178 122179Start an asynchronous SSL handshake. 122180 122181 122182 template< 122183 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 122184 typename ``[link boost_asio.reference.BufferedHandshakeHandler BufferedHandshakeHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 122185 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_handshake( 122186 handshake_type type, 122187 const ConstBufferSequence & buffers, 122188 BufferedHandshakeHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 122189 122190 122191This function is used to asynchronously perform an SSL handshake on the stream. This function call always returns immediately. 122192 122193 122194[heading Parameters] 122195 122196 122197[variablelist 122198 122199[[type][The type of handshaking to be performed, i.e. as a client or as a server.]] 122200 122201[[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.]] 122202 122203[[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: 122204`` 122205 void handler( 122206 const boost::system::error_code& error, // Result of operation. 122207 std::size_t bytes_transferred // Amount of buffers used in handshake. 122208 ); 122209`` 122210]] 122211 122212] 122213 122214 122215 122216 122217[endsect] 122218 122219 122220[endsect] 122221 122222 122223[section:async_read_some ssl::stream::async_read_some] 122224 122225[indexterm2 boost_asio.indexterm.ssl__stream.async_read_some..async_read_some..ssl::stream] 122226Start an asynchronous read. 122227 122228 122229 template< 122230 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 122231 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 122232 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_some( 122233 const MutableBufferSequence & buffers, 122234 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 122235 122236 122237This function is used to asynchronously read one or more bytes of data from the stream. The function call always returns immediately. 122238 122239 122240[heading Parameters] 122241 122242 122243[variablelist 122244 122245[[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.]] 122246 122247[[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: 122248`` 122249 void handler( 122250 const boost::system::error_code& error, // Result of operation. 122251 std::size_t bytes_transferred // Number of bytes read. 122252 ); 122253`` 122254]] 122255 122256] 122257 122258 122259[heading Remarks] 122260 122261The 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. 122262 122263 122264 122265 122266[endsect] 122267 122268 122269 122270[section:async_shutdown ssl::stream::async_shutdown] 122271 122272[indexterm2 boost_asio.indexterm.ssl__stream.async_shutdown..async_shutdown..ssl::stream] 122273Asynchronously shut down SSL on the stream. 122274 122275 122276 template< 122277 typename ``[link boost_asio.reference.ShutdownHandler ShutdownHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 122278 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_shutdown( 122279 ShutdownHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 122280 122281 122282This function is used to asynchronously shut down SSL on the stream. This function call always returns immediately. 122283 122284 122285[heading Parameters] 122286 122287 122288[variablelist 122289 122290[[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: 122291`` 122292 void handler( 122293 const boost::system::error_code& error // Result of operation. 122294 ); 122295`` 122296]] 122297 122298] 122299 122300 122301 122302 122303[endsect] 122304 122305 122306 122307[section:async_write_some ssl::stream::async_write_some] 122308 122309[indexterm2 boost_asio.indexterm.ssl__stream.async_write_some..async_write_some..ssl::stream] 122310Start an asynchronous write. 122311 122312 122313 template< 122314 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 122315 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 122316 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_some( 122317 const ConstBufferSequence & buffers, 122318 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 122319 122320 122321This function is used to asynchronously write one or more bytes of data to the stream. The function call always returns immediately. 122322 122323 122324[heading Parameters] 122325 122326 122327[variablelist 122328 122329[[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.]] 122330 122331[[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: 122332`` 122333 void handler( 122334 const boost::system::error_code& error, // Result of operation. 122335 std::size_t bytes_transferred // Number of bytes written. 122336 ); 122337`` 122338]] 122339 122340] 122341 122342 122343[heading Remarks] 122344 122345The 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. 122346 122347 122348 122349 122350[endsect] 122351 122352 122353 122354[section:executor_type ssl::stream::executor_type] 122355 122356[indexterm2 boost_asio.indexterm.ssl__stream.executor_type..executor_type..ssl::stream] 122357The type of the executor associated with the object. 122358 122359 122360 typedef lowest_layer_type::executor_type executor_type; 122361 122362 122363 122364[heading Requirements] 122365 122366['Header: ][^boost/asio/ssl/stream.hpp] 122367 122368['Convenience header: ][^boost/asio/ssl.hpp] 122369 122370 122371[endsect] 122372 122373 122374 122375[section:get_executor ssl::stream::get_executor] 122376 122377[indexterm2 boost_asio.indexterm.ssl__stream.get_executor..get_executor..ssl::stream] 122378Get the executor associated with the object. 122379 122380 122381 executor_type get_executor(); 122382 122383 122384This function may be used to obtain the executor object that the stream uses to dispatch handlers for asynchronous operations. 122385 122386 122387[heading Return Value] 122388 122389A copy of the executor that stream will use to dispatch handlers. 122390 122391 122392 122393 122394[endsect] 122395 122396 122397[section:handshake ssl::stream::handshake] 122398 122399[indexterm2 boost_asio.indexterm.ssl__stream.handshake..handshake..ssl::stream] 122400Perform SSL handshaking. 122401 122402 122403 void ``[link boost_asio.reference.ssl__stream.handshake.overload1 handshake]``( 122404 handshake_type type); 122405 `` [''''»''' [link boost_asio.reference.ssl__stream.handshake.overload1 more...]]`` 122406 122407 void ``[link boost_asio.reference.ssl__stream.handshake.overload2 handshake]``( 122408 handshake_type type, 122409 boost::system::error_code & ec); 122410 `` [''''»''' [link boost_asio.reference.ssl__stream.handshake.overload2 more...]]`` 122411 122412 template< 122413 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 122414 void ``[link boost_asio.reference.ssl__stream.handshake.overload3 handshake]``( 122415 handshake_type type, 122416 const ConstBufferSequence & buffers); 122417 `` [''''»''' [link boost_asio.reference.ssl__stream.handshake.overload3 more...]]`` 122418 122419 template< 122420 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 122421 void ``[link boost_asio.reference.ssl__stream.handshake.overload4 handshake]``( 122422 handshake_type type, 122423 const ConstBufferSequence & buffers, 122424 boost::system::error_code & ec); 122425 `` [''''»''' [link boost_asio.reference.ssl__stream.handshake.overload4 more...]]`` 122426 122427 122428[section:overload1 ssl::stream::handshake (1 of 4 overloads)] 122429 122430 122431Perform SSL handshaking. 122432 122433 122434 void handshake( 122435 handshake_type type); 122436 122437 122438This function is used to perform SSL handshaking on the stream. The function call will block until handshaking is complete or an error occurs. 122439 122440 122441[heading Parameters] 122442 122443 122444[variablelist 122445 122446[[type][The type of handshaking to be performed, i.e. as a client or as a server.]] 122447 122448] 122449 122450 122451[heading Exceptions] 122452 122453 122454[variablelist 122455 122456[[boost::system::system_error][Thrown on failure. ]] 122457 122458] 122459 122460 122461 122462 122463[endsect] 122464 122465 122466 122467[section:overload2 ssl::stream::handshake (2 of 4 overloads)] 122468 122469 122470Perform SSL handshaking. 122471 122472 122473 void handshake( 122474 handshake_type type, 122475 boost::system::error_code & ec); 122476 122477 122478This function is used to perform SSL handshaking on the stream. The function call will block until handshaking is complete or an error occurs. 122479 122480 122481[heading Parameters] 122482 122483 122484[variablelist 122485 122486[[type][The type of handshaking to be performed, i.e. as a client or as a server.]] 122487 122488[[ec][Set to indicate what error occurred, if any. ]] 122489 122490] 122491 122492 122493 122494 122495[endsect] 122496 122497 122498 122499[section:overload3 ssl::stream::handshake (3 of 4 overloads)] 122500 122501 122502Perform SSL handshaking. 122503 122504 122505 template< 122506 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 122507 void handshake( 122508 handshake_type type, 122509 const ConstBufferSequence & buffers); 122510 122511 122512This function is used to perform SSL handshaking on the stream. The function call will block until handshaking is complete or an error occurs. 122513 122514 122515[heading Parameters] 122516 122517 122518[variablelist 122519 122520[[type][The type of handshaking to be performed, i.e. as a client or as a server.]] 122521 122522[[buffers][The buffered data to be reused for the handshake.]] 122523 122524] 122525 122526 122527[heading Exceptions] 122528 122529 122530[variablelist 122531 122532[[boost::system::system_error][Thrown on failure. ]] 122533 122534] 122535 122536 122537 122538 122539[endsect] 122540 122541 122542 122543[section:overload4 ssl::stream::handshake (4 of 4 overloads)] 122544 122545 122546Perform SSL handshaking. 122547 122548 122549 template< 122550 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 122551 void handshake( 122552 handshake_type type, 122553 const ConstBufferSequence & buffers, 122554 boost::system::error_code & ec); 122555 122556 122557This function is used to perform SSL handshaking on the stream. The function call will block until handshaking is complete or an error occurs. 122558 122559 122560[heading Parameters] 122561 122562 122563[variablelist 122564 122565[[type][The type of handshaking to be performed, i.e. as a client or as a server.]] 122566 122567[[buffers][The buffered data to be reused for the handshake.]] 122568 122569[[ec][Set to indicate what error occurred, if any. ]] 122570 122571] 122572 122573 122574 122575 122576[endsect] 122577 122578 122579[endsect] 122580 122581 122582[section:handshake_type ssl::stream::handshake_type] 122583 122584[indexterm2 boost_asio.indexterm.ssl__stream.handshake_type..handshake_type..ssl::stream] 122585Different handshake types. 122586 122587 122588 enum handshake_type 122589 122590[indexterm2 boost_asio.indexterm.ssl__stream.handshake_type.client..client..ssl::stream] 122591[indexterm2 boost_asio.indexterm.ssl__stream.handshake_type.server..server..ssl::stream] 122592 122593[heading Values] 122594[variablelist 122595 122596 [ 122597 [client] 122598 [Perform handshaking as a client. ] 122599 ] 122600 122601 [ 122602 [server] 122603 [Perform handshaking as a server. ] 122604 ] 122605 122606] 122607 122608 122609 122610[endsect] 122611 122612 122613[section:lowest_layer ssl::stream::lowest_layer] 122614 122615[indexterm2 boost_asio.indexterm.ssl__stream.lowest_layer..lowest_layer..ssl::stream] 122616Get a reference to the lowest layer. 122617 122618 122619 lowest_layer_type & ``[link boost_asio.reference.ssl__stream.lowest_layer.overload1 lowest_layer]``(); 122620 `` [''''»''' [link boost_asio.reference.ssl__stream.lowest_layer.overload1 more...]]`` 122621 122622 const lowest_layer_type & ``[link boost_asio.reference.ssl__stream.lowest_layer.overload2 lowest_layer]``() const; 122623 `` [''''»''' [link boost_asio.reference.ssl__stream.lowest_layer.overload2 more...]]`` 122624 122625 122626[section:overload1 ssl::stream::lowest_layer (1 of 2 overloads)] 122627 122628 122629Get a reference to the lowest layer. 122630 122631 122632 lowest_layer_type & lowest_layer(); 122633 122634 122635This function returns a reference to the lowest layer in a stack of stream layers. 122636 122637 122638[heading Return Value] 122639 122640A reference to the lowest layer in the stack of stream layers. Ownership is not transferred to the caller. 122641 122642 122643 122644 122645[endsect] 122646 122647 122648 122649[section:overload2 ssl::stream::lowest_layer (2 of 2 overloads)] 122650 122651 122652Get a reference to the lowest layer. 122653 122654 122655 const lowest_layer_type & lowest_layer() const; 122656 122657 122658This function returns a reference to the lowest layer in a stack of stream layers. 122659 122660 122661[heading Return Value] 122662 122663A reference to the lowest layer in the stack of stream layers. Ownership is not transferred to the caller. 122664 122665 122666 122667 122668[endsect] 122669 122670 122671[endsect] 122672 122673 122674[section:lowest_layer_type ssl::stream::lowest_layer_type] 122675 122676[indexterm2 boost_asio.indexterm.ssl__stream.lowest_layer_type..lowest_layer_type..ssl::stream] 122677The type of the lowest layer. 122678 122679 122680 typedef next_layer_type::lowest_layer_type lowest_layer_type; 122681 122682 122683 122684[heading Requirements] 122685 122686['Header: ][^boost/asio/ssl/stream.hpp] 122687 122688['Convenience header: ][^boost/asio/ssl.hpp] 122689 122690 122691[endsect] 122692 122693 122694 122695[section:native_handle ssl::stream::native_handle] 122696 122697[indexterm2 boost_asio.indexterm.ssl__stream.native_handle..native_handle..ssl::stream] 122698Get the underlying implementation in the native type. 122699 122700 122701 native_handle_type native_handle(); 122702 122703 122704This 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. 122705 122706 122707[heading Example] 122708 122709The `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:` 122710 122711 boost::asio::ssl::stream<asio:ip::tcp::socket> sock(my_context, ctx); 122712 122713 // ... establish connection and perform handshake ... 122714 122715 if (X509* cert = SSL_get_peer_certificate(sock.native_handle())) 122716 { 122717 if (SSL_get_verify_result(sock.native_handle()) == X509_V_OK) 122718 { 122719 // ... 122720 } 122721 } 122722 122723 122724 122725 122726 122727 122728 122729[endsect] 122730 122731 122732 122733[section:native_handle_type ssl::stream::native_handle_type] 122734 122735[indexterm2 boost_asio.indexterm.ssl__stream.native_handle_type..native_handle_type..ssl::stream] 122736The native handle type of the SSL stream. 122737 122738 122739 typedef SSL * native_handle_type; 122740 122741 122742 122743[heading Requirements] 122744 122745['Header: ][^boost/asio/ssl/stream.hpp] 122746 122747['Convenience header: ][^boost/asio/ssl.hpp] 122748 122749 122750[endsect] 122751 122752 122753[section:next_layer ssl::stream::next_layer] 122754 122755[indexterm2 boost_asio.indexterm.ssl__stream.next_layer..next_layer..ssl::stream] 122756Get a reference to the next layer. 122757 122758 122759 const next_layer_type & ``[link boost_asio.reference.ssl__stream.next_layer.overload1 next_layer]``() const; 122760 `` [''''»''' [link boost_asio.reference.ssl__stream.next_layer.overload1 more...]]`` 122761 122762 next_layer_type & ``[link boost_asio.reference.ssl__stream.next_layer.overload2 next_layer]``(); 122763 `` [''''»''' [link boost_asio.reference.ssl__stream.next_layer.overload2 more...]]`` 122764 122765 122766[section:overload1 ssl::stream::next_layer (1 of 2 overloads)] 122767 122768 122769Get a reference to the next layer. 122770 122771 122772 const next_layer_type & next_layer() const; 122773 122774 122775This function returns a reference to the next layer in a stack of stream layers. 122776 122777 122778[heading Return Value] 122779 122780A reference to the next layer in the stack of stream layers. Ownership is not transferred to the caller. 122781 122782 122783 122784 122785[endsect] 122786 122787 122788 122789[section:overload2 ssl::stream::next_layer (2 of 2 overloads)] 122790 122791 122792Get a reference to the next layer. 122793 122794 122795 next_layer_type & next_layer(); 122796 122797 122798This function returns a reference to the next layer in a stack of stream layers. 122799 122800 122801[heading Return Value] 122802 122803A reference to the next layer in the stack of stream layers. Ownership is not transferred to the caller. 122804 122805 122806 122807 122808[endsect] 122809 122810 122811[endsect] 122812 122813 122814[section:next_layer_type ssl::stream::next_layer_type] 122815 122816[indexterm2 boost_asio.indexterm.ssl__stream.next_layer_type..next_layer_type..ssl::stream] 122817The type of the next layer. 122818 122819 122820 typedef remove_reference< Stream >::type next_layer_type; 122821 122822 122823 122824[heading Requirements] 122825 122826['Header: ][^boost/asio/ssl/stream.hpp] 122827 122828['Convenience header: ][^boost/asio/ssl.hpp] 122829 122830 122831[endsect] 122832 122833 122834[section:read_some ssl::stream::read_some] 122835 122836[indexterm2 boost_asio.indexterm.ssl__stream.read_some..read_some..ssl::stream] 122837Read some data from the stream. 122838 122839 122840 template< 122841 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 122842 std::size_t ``[link boost_asio.reference.ssl__stream.read_some.overload1 read_some]``( 122843 const MutableBufferSequence & buffers); 122844 `` [''''»''' [link boost_asio.reference.ssl__stream.read_some.overload1 more...]]`` 122845 122846 template< 122847 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 122848 std::size_t ``[link boost_asio.reference.ssl__stream.read_some.overload2 read_some]``( 122849 const MutableBufferSequence & buffers, 122850 boost::system::error_code & ec); 122851 `` [''''»''' [link boost_asio.reference.ssl__stream.read_some.overload2 more...]]`` 122852 122853 122854[section:overload1 ssl::stream::read_some (1 of 2 overloads)] 122855 122856 122857Read some data from the stream. 122858 122859 122860 template< 122861 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 122862 std::size_t read_some( 122863 const MutableBufferSequence & buffers); 122864 122865 122866This 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. 122867 122868 122869[heading Parameters] 122870 122871 122872[variablelist 122873 122874[[buffers][The buffers into which the data will be read.]] 122875 122876] 122877 122878 122879[heading Return Value] 122880 122881The number of bytes read. 122882 122883 122884[heading Exceptions] 122885 122886 122887[variablelist 122888 122889[[boost::system::system_error][Thrown on failure.]] 122890 122891] 122892 122893 122894[heading Remarks] 122895 122896The 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. 122897 122898 122899 122900 122901[endsect] 122902 122903 122904 122905[section:overload2 ssl::stream::read_some (2 of 2 overloads)] 122906 122907 122908Read some data from the stream. 122909 122910 122911 template< 122912 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 122913 std::size_t read_some( 122914 const MutableBufferSequence & buffers, 122915 boost::system::error_code & ec); 122916 122917 122918This 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. 122919 122920 122921[heading Parameters] 122922 122923 122924[variablelist 122925 122926[[buffers][The buffers into which the data will be read.]] 122927 122928[[ec][Set to indicate what error occurred, if any.]] 122929 122930] 122931 122932 122933[heading Return Value] 122934 122935The number of bytes read. Returns 0 if an error occurred. 122936 122937 122938[heading Remarks] 122939 122940The 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. 122941 122942 122943 122944 122945[endsect] 122946 122947 122948[endsect] 122949 122950[section:set_verify_callback ssl::stream::set_verify_callback] 122951 122952[indexterm2 boost_asio.indexterm.ssl__stream.set_verify_callback..set_verify_callback..ssl::stream] 122953Set the callback used to verify peer certificates. 122954 122955 122956 template< 122957 typename VerifyCallback> 122958 void ``[link boost_asio.reference.ssl__stream.set_verify_callback.overload1 set_verify_callback]``( 122959 VerifyCallback callback); 122960 `` [''''»''' [link boost_asio.reference.ssl__stream.set_verify_callback.overload1 more...]]`` 122961 122962 template< 122963 typename VerifyCallback> 122964 void ``[link boost_asio.reference.ssl__stream.set_verify_callback.overload2 set_verify_callback]``( 122965 VerifyCallback callback, 122966 boost::system::error_code & ec); 122967 `` [''''»''' [link boost_asio.reference.ssl__stream.set_verify_callback.overload2 more...]]`` 122968 122969 122970[section:overload1 ssl::stream::set_verify_callback (1 of 2 overloads)] 122971 122972 122973Set the callback used to verify peer certificates. 122974 122975 122976 template< 122977 typename VerifyCallback> 122978 void set_verify_callback( 122979 VerifyCallback callback); 122980 122981 122982This function is used to specify a callback function that will be called by the implementation when it needs to verify a peer certificate. 122983 122984 122985[heading Parameters] 122986 122987 122988[variablelist 122989 122990[[callback][The function object to be used for verifying a certificate. The function signature of the handler must be: 122991`` 122992 bool verify_callback( 122993 bool preverified, // True if the certificate passed pre-verification. 122994 verify_context& ctx // The peer certificate and other context. 122995 ); 122996`` 122997The return value of the callback is true if the certificate has passed verification, false otherwise.]] 122998 122999] 123000 123001 123002[heading Exceptions] 123003 123004 123005[variablelist 123006 123007[[boost::system::system_error][Thrown on failure.]] 123008 123009] 123010 123011 123012[heading Remarks] 123013 123014Calls `SSL_set_verify`. 123015 123016 123017 123018 123019[endsect] 123020 123021 123022 123023[section:overload2 ssl::stream::set_verify_callback (2 of 2 overloads)] 123024 123025 123026Set the callback used to verify peer certificates. 123027 123028 123029 template< 123030 typename VerifyCallback> 123031 void set_verify_callback( 123032 VerifyCallback callback, 123033 boost::system::error_code & ec); 123034 123035 123036This function is used to specify a callback function that will be called by the implementation when it needs to verify a peer certificate. 123037 123038 123039[heading Parameters] 123040 123041 123042[variablelist 123043 123044[[callback][The function object to be used for verifying a certificate. The function signature of the handler must be: 123045`` 123046 bool verify_callback( 123047 bool preverified, // True if the certificate passed pre-verification. 123048 verify_context& ctx // The peer certificate and other context. 123049 ); 123050`` 123051The return value of the callback is true if the certificate has passed verification, false otherwise.]] 123052 123053[[ec][Set to indicate what error occurred, if any.]] 123054 123055] 123056 123057 123058[heading Remarks] 123059 123060Calls `SSL_set_verify`. 123061 123062 123063 123064 123065[endsect] 123066 123067 123068[endsect] 123069 123070[section:set_verify_depth ssl::stream::set_verify_depth] 123071 123072[indexterm2 boost_asio.indexterm.ssl__stream.set_verify_depth..set_verify_depth..ssl::stream] 123073Set the peer verification depth. 123074 123075 123076 void ``[link boost_asio.reference.ssl__stream.set_verify_depth.overload1 set_verify_depth]``( 123077 int depth); 123078 `` [''''»''' [link boost_asio.reference.ssl__stream.set_verify_depth.overload1 more...]]`` 123079 123080 void ``[link boost_asio.reference.ssl__stream.set_verify_depth.overload2 set_verify_depth]``( 123081 int depth, 123082 boost::system::error_code & ec); 123083 `` [''''»''' [link boost_asio.reference.ssl__stream.set_verify_depth.overload2 more...]]`` 123084 123085 123086[section:overload1 ssl::stream::set_verify_depth (1 of 2 overloads)] 123087 123088 123089Set the peer verification depth. 123090 123091 123092 void set_verify_depth( 123093 int depth); 123094 123095 123096This function may be used to configure the maximum verification depth allowed by the stream. 123097 123098 123099[heading Parameters] 123100 123101 123102[variablelist 123103 123104[[depth][Maximum depth for the certificate chain verification that shall be allowed.]] 123105 123106] 123107 123108 123109[heading Exceptions] 123110 123111 123112[variablelist 123113 123114[[boost::system::system_error][Thrown on failure.]] 123115 123116] 123117 123118 123119[heading Remarks] 123120 123121Calls `SSL_set_verify_depth`. 123122 123123 123124 123125 123126[endsect] 123127 123128 123129 123130[section:overload2 ssl::stream::set_verify_depth (2 of 2 overloads)] 123131 123132 123133Set the peer verification depth. 123134 123135 123136 void set_verify_depth( 123137 int depth, 123138 boost::system::error_code & ec); 123139 123140 123141This function may be used to configure the maximum verification depth allowed by the stream. 123142 123143 123144[heading Parameters] 123145 123146 123147[variablelist 123148 123149[[depth][Maximum depth for the certificate chain verification that shall be allowed.]] 123150 123151[[ec][Set to indicate what error occurred, if any.]] 123152 123153] 123154 123155 123156[heading Remarks] 123157 123158Calls `SSL_set_verify_depth`. 123159 123160 123161 123162 123163[endsect] 123164 123165 123166[endsect] 123167 123168[section:set_verify_mode ssl::stream::set_verify_mode] 123169 123170[indexterm2 boost_asio.indexterm.ssl__stream.set_verify_mode..set_verify_mode..ssl::stream] 123171Set the peer verification mode. 123172 123173 123174 void ``[link boost_asio.reference.ssl__stream.set_verify_mode.overload1 set_verify_mode]``( 123175 verify_mode v); 123176 `` [''''»''' [link boost_asio.reference.ssl__stream.set_verify_mode.overload1 more...]]`` 123177 123178 void ``[link boost_asio.reference.ssl__stream.set_verify_mode.overload2 set_verify_mode]``( 123179 verify_mode v, 123180 boost::system::error_code & ec); 123181 `` [''''»''' [link boost_asio.reference.ssl__stream.set_verify_mode.overload2 more...]]`` 123182 123183 123184[section:overload1 ssl::stream::set_verify_mode (1 of 2 overloads)] 123185 123186 123187Set the peer verification mode. 123188 123189 123190 void set_verify_mode( 123191 verify_mode v); 123192 123193 123194This 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. 123195 123196 123197[heading Parameters] 123198 123199 123200[variablelist 123201 123202[[v][A bitmask of peer verification modes. See [link boost_asio.reference.ssl__verify_mode `ssl::verify_mode`] for available values.]] 123203 123204] 123205 123206 123207[heading Exceptions] 123208 123209 123210[variablelist 123211 123212[[boost::system::system_error][Thrown on failure.]] 123213 123214] 123215 123216 123217[heading Remarks] 123218 123219Calls `SSL_set_verify`. 123220 123221 123222 123223 123224[endsect] 123225 123226 123227 123228[section:overload2 ssl::stream::set_verify_mode (2 of 2 overloads)] 123229 123230 123231Set the peer verification mode. 123232 123233 123234 void set_verify_mode( 123235 verify_mode v, 123236 boost::system::error_code & ec); 123237 123238 123239This 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. 123240 123241 123242[heading Parameters] 123243 123244 123245[variablelist 123246 123247[[v][A bitmask of peer verification modes. See [link boost_asio.reference.ssl__verify_mode `ssl::verify_mode`] for available values.]] 123248 123249[[ec][Set to indicate what error occurred, if any.]] 123250 123251] 123252 123253 123254[heading Remarks] 123255 123256Calls `SSL_set_verify`. 123257 123258 123259 123260 123261[endsect] 123262 123263 123264[endsect] 123265 123266[section:shutdown ssl::stream::shutdown] 123267 123268[indexterm2 boost_asio.indexterm.ssl__stream.shutdown..shutdown..ssl::stream] 123269Shut down SSL on the stream. 123270 123271 123272 void ``[link boost_asio.reference.ssl__stream.shutdown.overload1 shutdown]``(); 123273 `` [''''»''' [link boost_asio.reference.ssl__stream.shutdown.overload1 more...]]`` 123274 123275 void ``[link boost_asio.reference.ssl__stream.shutdown.overload2 shutdown]``( 123276 boost::system::error_code & ec); 123277 `` [''''»''' [link boost_asio.reference.ssl__stream.shutdown.overload2 more...]]`` 123278 123279 123280[section:overload1 ssl::stream::shutdown (1 of 2 overloads)] 123281 123282 123283Shut down SSL on the stream. 123284 123285 123286 void shutdown(); 123287 123288 123289This 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. 123290 123291 123292[heading Exceptions] 123293 123294 123295[variablelist 123296 123297[[boost::system::system_error][Thrown on failure. ]] 123298 123299] 123300 123301 123302 123303 123304[endsect] 123305 123306 123307 123308[section:overload2 ssl::stream::shutdown (2 of 2 overloads)] 123309 123310 123311Shut down SSL on the stream. 123312 123313 123314 void shutdown( 123315 boost::system::error_code & ec); 123316 123317 123318This 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. 123319 123320 123321[heading Parameters] 123322 123323 123324[variablelist 123325 123326[[ec][Set to indicate what error occurred, if any. ]] 123327 123328] 123329 123330 123331 123332 123333[endsect] 123334 123335 123336[endsect] 123337 123338[section:stream ssl::stream::stream] 123339 123340[indexterm2 boost_asio.indexterm.ssl__stream.stream..stream..ssl::stream] 123341Construct a stream. 123342 123343 123344 template< 123345 typename Arg> 123346 ``[link boost_asio.reference.ssl__stream.stream.overload1 stream]``( 123347 Arg && arg, 123348 context & ctx); 123349 `` [''''»''' [link boost_asio.reference.ssl__stream.stream.overload1 more...]]`` 123350 123351 123352Move-construct a stream from another. 123353 123354 123355 ``[link boost_asio.reference.ssl__stream.stream.overload2 stream]``( 123356 stream && other); 123357 `` [''''»''' [link boost_asio.reference.ssl__stream.stream.overload2 more...]]`` 123358 123359 123360[section:overload1 ssl::stream::stream (1 of 2 overloads)] 123361 123362 123363Construct a stream. 123364 123365 123366 template< 123367 typename Arg> 123368 stream( 123369 Arg && arg, 123370 context & ctx); 123371 123372 123373This constructor creates a stream and initialises the underlying stream object. 123374 123375 123376[heading Parameters] 123377 123378 123379[variablelist 123380 123381[[arg][The argument to be passed to initialise the underlying stream.]] 123382 123383[[ctx][The SSL context to be used for the stream. ]] 123384 123385] 123386 123387 123388 123389 123390[endsect] 123391 123392 123393 123394[section:overload2 ssl::stream::stream (2 of 2 overloads)] 123395 123396 123397Move-construct a stream from another. 123398 123399 123400 stream( 123401 stream && other); 123402 123403 123404 123405[heading Parameters] 123406 123407 123408[variablelist 123409 123410[[other][The other stream object from which the move will occur. Must have no outstanding asynchronous operations associated with it. Following the move, `other` has a valid but unspecified state where the only safe operation is destruction. ]] 123411 123412] 123413 123414 123415 123416 123417[endsect] 123418 123419 123420[endsect] 123421 123422[section:write_some ssl::stream::write_some] 123423 123424[indexterm2 boost_asio.indexterm.ssl__stream.write_some..write_some..ssl::stream] 123425Write some data to the stream. 123426 123427 123428 template< 123429 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 123430 std::size_t ``[link boost_asio.reference.ssl__stream.write_some.overload1 write_some]``( 123431 const ConstBufferSequence & buffers); 123432 `` [''''»''' [link boost_asio.reference.ssl__stream.write_some.overload1 more...]]`` 123433 123434 template< 123435 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 123436 std::size_t ``[link boost_asio.reference.ssl__stream.write_some.overload2 write_some]``( 123437 const ConstBufferSequence & buffers, 123438 boost::system::error_code & ec); 123439 `` [''''»''' [link boost_asio.reference.ssl__stream.write_some.overload2 more...]]`` 123440 123441 123442[section:overload1 ssl::stream::write_some (1 of 2 overloads)] 123443 123444 123445Write some data to the stream. 123446 123447 123448 template< 123449 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 123450 std::size_t write_some( 123451 const ConstBufferSequence & buffers); 123452 123453 123454This 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. 123455 123456 123457[heading Parameters] 123458 123459 123460[variablelist 123461 123462[[buffers][The data to be written.]] 123463 123464] 123465 123466 123467[heading Return Value] 123468 123469The number of bytes written. 123470 123471 123472[heading Exceptions] 123473 123474 123475[variablelist 123476 123477[[boost::system::system_error][Thrown on failure.]] 123478 123479] 123480 123481 123482[heading Remarks] 123483 123484The 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. 123485 123486 123487 123488 123489[endsect] 123490 123491 123492 123493[section:overload2 ssl::stream::write_some (2 of 2 overloads)] 123494 123495 123496Write some data to the stream. 123497 123498 123499 template< 123500 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 123501 std::size_t write_some( 123502 const ConstBufferSequence & buffers, 123503 boost::system::error_code & ec); 123504 123505 123506This 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. 123507 123508 123509[heading Parameters] 123510 123511 123512[variablelist 123513 123514[[buffers][The data to be written to the stream.]] 123515 123516[[ec][Set to indicate what error occurred, if any.]] 123517 123518] 123519 123520 123521[heading Return Value] 123522 123523The number of bytes written. Returns 0 if an error occurred. 123524 123525 123526[heading Remarks] 123527 123528The 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. 123529 123530 123531 123532 123533[endsect] 123534 123535 123536[endsect] 123537 123538 123539[section:_stream ssl::stream::~stream] 123540 123541[indexterm2 boost_asio.indexterm.ssl__stream._stream..~stream..ssl::stream] 123542Destructor. 123543 123544 123545 ~stream(); 123546 123547 123548 123549[heading Remarks] 123550 123551A `stream` object must not be destroyed while there are pending asynchronous operations associated with it. 123552 123553 123554 123555 123556[endsect] 123557 123558 123559 123560[endsect] 123561 123562[section:ssl__stream__impl_struct ssl::stream::impl_struct] 123563 123564[indexterm1 boost_asio.indexterm.ssl__stream__impl_struct..ssl::stream::impl_struct] 123565 123566 123567Structure for use with deprecated impl\_type. 123568 123569 123570 struct impl_struct 123571 123572 123573[heading Data Members] 123574[table 123575 [[Name][Description]] 123576 123577 [ 123578 [[link boost_asio.reference.ssl__stream__impl_struct.ssl [*ssl]]] 123579 [] 123580 ] 123581 123582] 123583 123584[heading Requirements] 123585 123586['Header: ][^boost/asio/ssl/stream.hpp] 123587 123588['Convenience header: ][^boost/asio/ssl.hpp] 123589 123590 123591[section:ssl ssl::stream::impl_struct::ssl] 123592 123593[indexterm2 boost_asio.indexterm.ssl__stream__impl_struct.ssl..ssl..ssl::stream::impl_struct] 123594 123595 SSL * ssl; 123596 123597 123598 123599[endsect] 123600 123601 123602 123603[endsect] 123604 123605[section:ssl__stream_base ssl::stream_base] 123606 123607[indexterm1 boost_asio.indexterm.ssl__stream_base..ssl::stream_base] 123608 123609 123610The [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. 123611 123612 123613 class stream_base 123614 123615 123616[heading Types] 123617[table 123618 [[Name][Description]] 123619 123620 [ 123621 123622 [[link boost_asio.reference.ssl__stream_base.handshake_type [*handshake_type]]] 123623 [Different handshake types. ] 123624 123625 ] 123626 123627] 123628 123629[heading Protected Member Functions] 123630[table 123631 [[Name][Description]] 123632 123633 [ 123634 [[link boost_asio.reference.ssl__stream_base._stream_base [*~stream_base]] [destructor]] 123635 [Protected destructor to prevent deletion through this type. ] 123636 ] 123637 123638] 123639 123640[heading Requirements] 123641 123642['Header: ][^boost/asio/ssl/stream_base.hpp] 123643 123644['Convenience header: ][^boost/asio/ssl.hpp] 123645 123646 123647[section:handshake_type ssl::stream_base::handshake_type] 123648 123649[indexterm2 boost_asio.indexterm.ssl__stream_base.handshake_type..handshake_type..ssl::stream_base] 123650Different handshake types. 123651 123652 123653 enum handshake_type 123654 123655[indexterm2 boost_asio.indexterm.ssl__stream_base.handshake_type.client..client..ssl::stream_base] 123656[indexterm2 boost_asio.indexterm.ssl__stream_base.handshake_type.server..server..ssl::stream_base] 123657 123658[heading Values] 123659[variablelist 123660 123661 [ 123662 [client] 123663 [Perform handshaking as a client. ] 123664 ] 123665 123666 [ 123667 [server] 123668 [Perform handshaking as a server. ] 123669 ] 123670 123671] 123672 123673 123674 123675[endsect] 123676 123677 123678 123679[section:_stream_base ssl::stream_base::~stream_base] 123680 123681[indexterm2 boost_asio.indexterm.ssl__stream_base._stream_base..~stream_base..ssl::stream_base] 123682Protected destructor to prevent deletion through this type. 123683 123684 123685 ~stream_base(); 123686 123687 123688 123689[endsect] 123690 123691 123692 123693[endsect] 123694 123695 123696[section:ssl__verify_client_once ssl::verify_client_once] 123697 123698[indexterm1 boost_asio.indexterm.ssl__verify_client_once..ssl::verify_client_once] 123699Do not request client certificate on renegotiation. Ignored unless [link boost_asio.reference.ssl__verify_peer `ssl::verify_peer`] is set. 123700 123701 123702 const int verify_client_once = implementation_defined; 123703 123704 123705[heading Requirements] 123706 123707['Header: ][^boost/asio/ssl/verify_mode.hpp] 123708 123709['Convenience header: ][^boost/asio/ssl.hpp] 123710 123711 123712[endsect] 123713 123714 123715[section:ssl__verify_context ssl::verify_context] 123716 123717[indexterm1 boost_asio.indexterm.ssl__verify_context..ssl::verify_context] 123718 123719 123720A simple wrapper around the X509\_STORE\_CTX type, used during verification of a peer certificate. 123721 123722 123723 class verify_context : 123724 noncopyable 123725 123726 123727[heading Types] 123728[table 123729 [[Name][Description]] 123730 123731 [ 123732 123733 [[link boost_asio.reference.ssl__verify_context.native_handle_type [*native_handle_type]]] 123734 [The native handle type of the verification context. ] 123735 123736 ] 123737 123738] 123739 123740[heading Member Functions] 123741[table 123742 [[Name][Description]] 123743 123744 [ 123745 [[link boost_asio.reference.ssl__verify_context.native_handle [*native_handle]]] 123746 [Get the underlying implementation in the native type. ] 123747 ] 123748 123749 [ 123750 [[link boost_asio.reference.ssl__verify_context.verify_context [*verify_context]] [constructor]] 123751 [Constructor. ] 123752 ] 123753 123754] 123755 123756 123757[heading Remarks] 123758 123759The [link boost_asio.reference.ssl__verify_context `ssl::verify_context`] does not own the underlying X509\_STORE\_CTX object. 123760 123761 123762 123763[heading Requirements] 123764 123765['Header: ][^boost/asio/ssl/verify_context.hpp] 123766 123767['Convenience header: ][^boost/asio/ssl.hpp] 123768 123769 123770[section:native_handle ssl::verify_context::native_handle] 123771 123772[indexterm2 boost_asio.indexterm.ssl__verify_context.native_handle..native_handle..ssl::verify_context] 123773Get the underlying implementation in the native type. 123774 123775 123776 native_handle_type native_handle(); 123777 123778 123779This 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. 123780 123781 123782[endsect] 123783 123784 123785 123786[section:native_handle_type ssl::verify_context::native_handle_type] 123787 123788[indexterm2 boost_asio.indexterm.ssl__verify_context.native_handle_type..native_handle_type..ssl::verify_context] 123789The native handle type of the verification context. 123790 123791 123792 typedef X509_STORE_CTX * native_handle_type; 123793 123794 123795 123796[heading Requirements] 123797 123798['Header: ][^boost/asio/ssl/verify_context.hpp] 123799 123800['Convenience header: ][^boost/asio/ssl.hpp] 123801 123802 123803[endsect] 123804 123805 123806 123807[section:verify_context ssl::verify_context::verify_context] 123808 123809[indexterm2 boost_asio.indexterm.ssl__verify_context.verify_context..verify_context..ssl::verify_context] 123810Constructor. 123811 123812 123813 verify_context( 123814 native_handle_type handle); 123815 123816 123817 123818[endsect] 123819 123820 123821 123822[endsect] 123823 123824 123825[section:ssl__verify_fail_if_no_peer_cert ssl::verify_fail_if_no_peer_cert] 123826 123827[indexterm1 boost_asio.indexterm.ssl__verify_fail_if_no_peer_cert..ssl::verify_fail_if_no_peer_cert] 123828Fail verification if the peer has no certificate. Ignored unless [link boost_asio.reference.ssl__verify_peer `ssl::verify_peer`] is set. 123829 123830 123831 const int verify_fail_if_no_peer_cert = implementation_defined; 123832 123833 123834[heading Requirements] 123835 123836['Header: ][^boost/asio/ssl/verify_mode.hpp] 123837 123838['Convenience header: ][^boost/asio/ssl.hpp] 123839 123840 123841[endsect] 123842 123843 123844 123845[section:ssl__verify_mode ssl::verify_mode] 123846 123847[indexterm1 boost_asio.indexterm.ssl__verify_mode..ssl::verify_mode] 123848Bitmask type for peer verification. 123849 123850 123851 typedef int verify_mode; 123852 123853 123854 123855Possible values are: 123856 123857 123858* [link boost_asio.reference.ssl__verify_none `ssl::verify_none`] 123859 123860* [link boost_asio.reference.ssl__verify_peer `ssl::verify_peer`] 123861 123862* [link boost_asio.reference.ssl__verify_fail_if_no_peer_cert `ssl::verify_fail_if_no_peer_cert`] 123863 123864* [link boost_asio.reference.ssl__verify_client_once `ssl::verify_client_once`] 123865 123866 123867 123868[heading Requirements] 123869 123870['Header: ][^boost/asio/ssl/verify_mode.hpp] 123871 123872['Convenience header: ][^boost/asio/ssl.hpp] 123873 123874 123875[endsect] 123876 123877 123878 123879[section:ssl__verify_none ssl::verify_none] 123880 123881[indexterm1 boost_asio.indexterm.ssl__verify_none..ssl::verify_none] 123882No verification. 123883 123884 123885 const int verify_none = implementation_defined; 123886 123887 123888[heading Requirements] 123889 123890['Header: ][^boost/asio/ssl/verify_mode.hpp] 123891 123892['Convenience header: ][^boost/asio/ssl.hpp] 123893 123894 123895[endsect] 123896 123897 123898 123899[section:ssl__verify_peer ssl::verify_peer] 123900 123901[indexterm1 boost_asio.indexterm.ssl__verify_peer..ssl::verify_peer] 123902Verify the peer. 123903 123904 123905 const int verify_peer = implementation_defined; 123906 123907 123908[heading Requirements] 123909 123910['Header: ][^boost/asio/ssl/verify_mode.hpp] 123911 123912['Convenience header: ][^boost/asio/ssl.hpp] 123913 123914 123915[endsect] 123916 123917 123918 123919[section:static_thread_pool static_thread_pool] 123920 123921[indexterm1 boost_asio.indexterm.static_thread_pool..static_thread_pool] 123922 123923 typedef thread_pool static_thread_pool; 123924 123925 123926[heading Types] 123927[table 123928 [[Name][Description]] 123929 123930 [ 123931 123932 [[link boost_asio.reference.thread_pool__basic_executor_type [*basic_executor_type]]] 123933 [Executor implementation type used to submit functions to a thread pool. ] 123934 123935 ] 123936 123937 [ 123938 123939 [[link boost_asio.reference.thread_pool.executor_type [*executor_type]]] 123940 [Executor used to submit functions to a thread pool. ] 123941 123942 ] 123943 123944 [ 123945 123946 [[link boost_asio.reference.thread_pool.fork_event [*fork_event]]] 123947 [Fork-related event notifications. ] 123948 123949 ] 123950 123951 [ 123952 123953 [[link boost_asio.reference.thread_pool.scheduler_type [*scheduler_type]]] 123954 [Scheduler used to schedule receivers on a thread pool. ] 123955 123956 ] 123957 123958] 123959 123960[heading Member Functions] 123961[table 123962 [[Name][Description]] 123963 123964 [ 123965 [[link boost_asio.reference.thread_pool.attach [*attach]]] 123966 [Attaches the current thread to the pool. ] 123967 ] 123968 123969 [ 123970 [[link boost_asio.reference.thread_pool.executor [*executor]]] 123971 [Obtains the executor associated with the pool. ] 123972 ] 123973 123974 [ 123975 [[link boost_asio.reference.thread_pool.get_executor [*get_executor]]] 123976 [Obtains the executor associated with the pool. ] 123977 ] 123978 123979 [ 123980 [[link boost_asio.reference.thread_pool.join [*join]]] 123981 [Joins the threads. ] 123982 ] 123983 123984 [ 123985 [[link boost_asio.reference.thread_pool.notify_fork [*notify_fork]]] 123986 [Notify the execution_context of a fork-related event. ] 123987 ] 123988 123989 [ 123990 [[link boost_asio.reference.thread_pool.scheduler [*scheduler]]] 123991 [Obtains the scheduler associated with the pool. ] 123992 ] 123993 123994 [ 123995 [[link boost_asio.reference.thread_pool.stop [*stop]]] 123996 [Stops the threads. ] 123997 ] 123998 123999 [ 124000 [[link boost_asio.reference.thread_pool.thread_pool [*thread_pool]] [constructor]] 124001 [Constructs a pool with an automatically determined number of threads. 124002 [hr] 124003 Constructs a pool with a specified number of threads. ] 124004 ] 124005 124006 [ 124007 [[link boost_asio.reference.thread_pool.wait [*wait]]] 124008 [Waits for threads to complete. ] 124009 ] 124010 124011 [ 124012 [[link boost_asio.reference.thread_pool._thread_pool [*~thread_pool]] [destructor]] 124013 [Destructor. ] 124014 ] 124015 124016] 124017 124018[heading Protected Member Functions] 124019[table 124020 [[Name][Description]] 124021 124022 [ 124023 [[link boost_asio.reference.thread_pool.destroy [*destroy]]] 124024 [Destroys all services in the context. ] 124025 ] 124026 124027 [ 124028 [[link boost_asio.reference.thread_pool.shutdown [*shutdown]]] 124029 [Shuts down all services in the context. ] 124030 ] 124031 124032] 124033 124034[heading Friends] 124035[table 124036 [[Name][Description]] 124037 124038 [ 124039 [[link boost_asio.reference.thread_pool.add_service [*add_service]]] 124040 [(Deprecated: Use make_service().) Add a service object to the execution_context. ] 124041 ] 124042 124043 [ 124044 [[link boost_asio.reference.thread_pool.has_service [*has_service]]] 124045 [Determine if an execution_context contains a specified service type. ] 124046 ] 124047 124048 [ 124049 [[link boost_asio.reference.thread_pool.make_service [*make_service]]] 124050 [Creates a service object and adds it to the execution_context. ] 124051 ] 124052 124053 [ 124054 [[link boost_asio.reference.thread_pool.use_service [*use_service]]] 124055 [Obtain the service object corresponding to the given type. ] 124056 ] 124057 124058] 124059 124060The thread pool class is an execution context where functions are permitted to run on one of a fixed number of threads. 124061 124062 124063[heading Submitting tasks to the pool] 124064 124065 124066 124067To submit functions to the 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. 124068 124069For example: 124070 124071 124072 124073 void my_task() 124074 { 124075 ... 124076 } 124077 124078 ... 124079 124080 // Launch the pool with four threads. 124081 boost::asio::thread_pool pool(4); 124082 124083 // Submit a function to the pool. 124084 boost::asio::post(pool, my_task); 124085 124086 // Submit a lambda object to the pool. 124087 boost::asio::post(pool, 124088 []() 124089 { 124090 ... 124091 }); 124092 124093 // Wait for all tasks in the pool to complete. 124094 pool.join(); 124095 124096 124097 124098 124099 124100[heading Requirements] 124101 124102['Header: ][^boost/asio/static_thread_pool.hpp] 124103 124104['Convenience header: ][^boost/asio.hpp] 124105 124106 124107[endsect] 124108 124109 124110 124111[section:steady_timer steady_timer] 124112 124113[indexterm1 boost_asio.indexterm.steady_timer..steady_timer] 124114Typedef for a timer based on the steady clock. 124115 124116 124117 typedef basic_waitable_timer< chrono::steady_clock > steady_timer; 124118 124119 124120[heading Types] 124121[table 124122 [[Name][Description]] 124123 124124 [ 124125 124126 [[link boost_asio.reference.basic_waitable_timer__rebind_executor [*rebind_executor]]] 124127 [Rebinds the timer type to another executor. ] 124128 124129 ] 124130 124131 [ 124132 124133 [[link boost_asio.reference.basic_waitable_timer.clock_type [*clock_type]]] 124134 [The clock type. ] 124135 124136 ] 124137 124138 [ 124139 124140 [[link boost_asio.reference.basic_waitable_timer.duration [*duration]]] 124141 [The duration type of the clock. ] 124142 124143 ] 124144 124145 [ 124146 124147 [[link boost_asio.reference.basic_waitable_timer.executor_type [*executor_type]]] 124148 [The type of the executor associated with the object. ] 124149 124150 ] 124151 124152 [ 124153 124154 [[link boost_asio.reference.basic_waitable_timer.time_point [*time_point]]] 124155 [The time point type of the clock. ] 124156 124157 ] 124158 124159 [ 124160 124161 [[link boost_asio.reference.basic_waitable_timer.traits_type [*traits_type]]] 124162 [The wait traits type. ] 124163 124164 ] 124165 124166] 124167 124168[heading Member Functions] 124169[table 124170 [[Name][Description]] 124171 124172 [ 124173 [[link boost_asio.reference.basic_waitable_timer.async_wait [*async_wait]]] 124174 [Start an asynchronous wait on the timer. ] 124175 ] 124176 124177 [ 124178 [[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer [*basic_waitable_timer]] [constructor]] 124179 [Constructor. 124180 [hr] 124181 Constructor to set a particular expiry time as an absolute time. 124182 [hr] 124183 Constructor to set a particular expiry time relative to now. 124184 [hr] 124185 Move-construct a basic_waitable_timer from another. ] 124186 ] 124187 124188 [ 124189 [[link boost_asio.reference.basic_waitable_timer.cancel [*cancel]]] 124190 [Cancel any asynchronous operations that are waiting on the timer. 124191 [hr] 124192 (Deprecated: Use non-error_code overload.) Cancel any asynchronous operations that are waiting on the timer. ] 124193 ] 124194 124195 [ 124196 [[link boost_asio.reference.basic_waitable_timer.cancel_one [*cancel_one]]] 124197 [Cancels one asynchronous operation that is waiting on the timer. 124198 [hr] 124199 (Deprecated: Use non-error_code overload.) Cancels one asynchronous operation that is waiting on the timer. ] 124200 ] 124201 124202 [ 124203 [[link boost_asio.reference.basic_waitable_timer.expires_after [*expires_after]]] 124204 [Set the timer's expiry time relative to now. ] 124205 ] 124206 124207 [ 124208 [[link boost_asio.reference.basic_waitable_timer.expires_at [*expires_at]]] 124209 [(Deprecated: Use expiry().) Get the timer's expiry time as an absolute time. 124210 [hr] 124211 Set the timer's expiry time as an absolute time. 124212 [hr] 124213 (Deprecated: Use non-error_code overload.) Set the timer's expiry time as an absolute time. ] 124214 ] 124215 124216 [ 124217 [[link boost_asio.reference.basic_waitable_timer.expires_from_now [*expires_from_now]]] 124218 [(Deprecated: Use expiry().) Get the timer's expiry time relative to now. 124219 [hr] 124220 (Deprecated: Use expires_after().) Set the timer's expiry time relative to now. ] 124221 ] 124222 124223 [ 124224 [[link boost_asio.reference.basic_waitable_timer.expiry [*expiry]]] 124225 [Get the timer's expiry time as an absolute time. ] 124226 ] 124227 124228 [ 124229 [[link boost_asio.reference.basic_waitable_timer.get_executor [*get_executor]]] 124230 [Get the executor associated with the object. ] 124231 ] 124232 124233 [ 124234 [[link boost_asio.reference.basic_waitable_timer.operator_eq_ [*operator=]]] 124235 [Move-assign a basic_waitable_timer from another. ] 124236 ] 124237 124238 [ 124239 [[link boost_asio.reference.basic_waitable_timer.wait [*wait]]] 124240 [Perform a blocking wait on the timer. ] 124241 ] 124242 124243 [ 124244 [[link boost_asio.reference.basic_waitable_timer._basic_waitable_timer [*~basic_waitable_timer]] [destructor]] 124245 [Destroys the timer. ] 124246 ] 124247 124248] 124249 124250The [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. 124251 124252A 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. 124253 124254Most 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. 124255 124256 124257[heading Remarks] 124258 124259This waitable timer functionality is for use with the C++11 standard library's `<chrono>` facility, or with the Boost.Chrono library. 124260 124261 124262[heading Thread Safety] 124263 124264['Distinct] ['objects:] Safe. 124265 124266['Shared] ['objects:] Unsafe. 124267 124268 124269[heading Examples] 124270 124271Performing a blocking wait (C++11): 124272 124273 // Construct a timer without setting an expiry time. 124274 boost::asio::steady_timer timer(my_context); 124275 124276 // Set an expiry time relative to now. 124277 timer.expires_after(std::chrono::seconds(5)); 124278 124279 // Wait for the timer to expire. 124280 timer.wait(); 124281 124282 124283 124284 124285 124286Performing an asynchronous wait (C++11): 124287 124288 void handler(const boost::system::error_code& error) 124289 { 124290 if (!error) 124291 { 124292 // Timer expired. 124293 } 124294 } 124295 124296 ... 124297 124298 // Construct a timer with an absolute expiry time. 124299 boost::asio::steady_timer timer(my_context, 124300 std::chrono::steady_clock::now() + std::chrono::seconds(60)); 124301 124302 // Start an asynchronous wait. 124303 timer.async_wait(handler); 124304 124305 124306 124307 124308 124309[heading Changing an active waitable timer's expiry time] 124310 124311 124312 124313Changing 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: 124314 124315 124316 124317 void on_some_event() 124318 { 124319 if (my_timer.expires_after(seconds(5)) > 0) 124320 { 124321 // We managed to cancel the timer. Start new asynchronous wait. 124322 my_timer.async_wait(on_timeout); 124323 } 124324 else 124325 { 124326 // Too late, timer has already expired! 124327 } 124328 } 124329 124330 void on_timeout(const boost::system::error_code& e) 124331 { 124332 if (e != boost::asio::error::operation_aborted) 124333 { 124334 // Timer was not cancelled, take necessary action. 124335 } 124336 } 124337 124338 124339 124340 124341 124342* 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. 124343 124344 124345* If a wait handler is cancelled, the boost::system::error\_code passed to it contains the value `boost::asio::error::operation_aborted`. 124346 124347 124348 124349 124350This 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: 124351 124352 typedef basic_waitable_timer<boost::chrono::steady_clock> timer; 124353 124354 124355 124356 124357[heading Requirements] 124358 124359['Header: ][^boost/asio/steady_timer.hpp] 124360 124361['Convenience header: ][^boost/asio.hpp] 124362 124363 124364[endsect] 124365 124366 124367[section:strand strand] 124368 124369[indexterm1 boost_asio.indexterm.strand..strand] 124370 124371 124372Provides serialised function invocation for any executor type. 124373 124374 124375 template< 124376 typename ``[link boost_asio.reference.Executor1 Executor]``> 124377 class strand 124378 124379 124380[heading Types] 124381[table 124382 [[Name][Description]] 124383 124384 [ 124385 124386 [[link boost_asio.reference.strand.inner_executor_type [*inner_executor_type]]] 124387 [The type of the underlying executor. ] 124388 124389 ] 124390 124391] 124392 124393[heading Member Functions] 124394[table 124395 [[Name][Description]] 124396 124397 [ 124398 [[link boost_asio.reference.strand.context [*context]]] 124399 [Obtain the underlying execution context. ] 124400 ] 124401 124402 [ 124403 [[link boost_asio.reference.strand.defer [*defer]]] 124404 [Request the strand to invoke the given function object. ] 124405 ] 124406 124407 [ 124408 [[link boost_asio.reference.strand.dispatch [*dispatch]]] 124409 [Request the strand to invoke the given function object. ] 124410 ] 124411 124412 [ 124413 [[link boost_asio.reference.strand.execute [*execute]]] 124414 [Request the strand to invoke the given function object. ] 124415 ] 124416 124417 [ 124418 [[link boost_asio.reference.strand.get_inner_executor [*get_inner_executor]]] 124419 [Obtain the underlying executor. ] 124420 ] 124421 124422 [ 124423 [[link boost_asio.reference.strand.on_work_finished [*on_work_finished]]] 124424 [Inform the strand that some work is no longer outstanding. ] 124425 ] 124426 124427 [ 124428 [[link boost_asio.reference.strand.on_work_started [*on_work_started]]] 124429 [Inform the strand that it has some outstanding work to do. ] 124430 ] 124431 124432 [ 124433 [[link boost_asio.reference.strand.operator_eq_ [*operator=]]] 124434 [Assignment operator. 124435 [hr] 124436 Converting assignment operator. 124437 [hr] 124438 Move assignment operator. 124439 [hr] 124440 Converting move assignment operator. ] 124441 ] 124442 124443 [ 124444 [[link boost_asio.reference.strand.post [*post]]] 124445 [Request the strand to invoke the given function object. ] 124446 ] 124447 124448 [ 124449 [[link boost_asio.reference.strand.prefer [*prefer]]] 124450 [Forward a preference to the underlying executor. ] 124451 ] 124452 124453 [ 124454 [[link boost_asio.reference.strand.query [*query]]] 124455 [Forward a query to the underlying executor. ] 124456 ] 124457 124458 [ 124459 [[link boost_asio.reference.strand.require [*require]]] 124460 [Forward a requirement to the underlying executor. ] 124461 ] 124462 124463 [ 124464 [[link boost_asio.reference.strand.running_in_this_thread [*running_in_this_thread]]] 124465 [Determine whether the strand is running in the current thread. ] 124466 ] 124467 124468 [ 124469 [[link boost_asio.reference.strand.strand [*strand]] [constructor]] 124470 [Default constructor. 124471 [hr] 124472 Construct a strand for the specified executor. 124473 [hr] 124474 Copy constructor. 124475 [hr] 124476 Converting constructor. 124477 [hr] 124478 Move constructor. 124479 [hr] 124480 Converting move constructor. ] 124481 ] 124482 124483 [ 124484 [[link boost_asio.reference.strand._strand [*~strand]] [destructor]] 124485 [Destructor. ] 124486 ] 124487 124488] 124489 124490[heading Friends] 124491[table 124492 [[Name][Description]] 124493 124494 [ 124495 [[link boost_asio.reference.strand.operator_not__eq_ [*operator!=]]] 124496 [Compare two strands for inequality. ] 124497 ] 124498 124499 [ 124500 [[link boost_asio.reference.strand.operator_eq__eq_ [*operator==]]] 124501 [Compare two strands for equality. ] 124502 ] 124503 124504] 124505 124506[heading Requirements] 124507 124508['Header: ][^boost/asio/strand.hpp] 124509 124510['Convenience header: ][^boost/asio.hpp] 124511 124512 124513[section:context strand::context] 124514 124515[indexterm2 boost_asio.indexterm.strand.context..context..strand] 124516Obtain the underlying execution context. 124517 124518 124519 execution_context & context() const; 124520 124521 124522 124523[endsect] 124524 124525 124526 124527[section:defer strand::defer] 124528 124529[indexterm2 boost_asio.indexterm.strand.defer..defer..strand] 124530Request the strand to invoke the given function object. 124531 124532 124533 template< 124534 typename Function, 124535 typename Allocator> 124536 void defer( 124537 Function && f, 124538 const Allocator & a) const; 124539 124540 124541This 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. 124542 124543 124544[heading Parameters] 124545 124546 124547[variablelist 124548 124549[[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: 124550`` 124551 void function(); 124552`` 124553]] 124554 124555[[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]] 124556 124557] 124558 124559 124560 124561 124562[endsect] 124563 124564 124565 124566[section:dispatch strand::dispatch] 124567 124568[indexterm2 boost_asio.indexterm.strand.dispatch..dispatch..strand] 124569Request the strand to invoke the given function object. 124570 124571 124572 template< 124573 typename Function, 124574 typename Allocator> 124575 void dispatch( 124576 Function && f, 124577 const Allocator & a) const; 124578 124579 124580This 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. 124581 124582 124583[heading Parameters] 124584 124585 124586[variablelist 124587 124588[[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: 124589`` 124590 void function(); 124591`` 124592]] 124593 124594[[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]] 124595 124596] 124597 124598 124599 124600 124601[endsect] 124602 124603 124604 124605[section:execute strand::execute] 124606 124607[indexterm2 boost_asio.indexterm.strand.execute..execute..strand] 124608Request the strand to invoke the given function object. 124609 124610 124611 template< 124612 typename Function> 124613 constraint< execution::can_execute< const Executor &, Function >::value, void >::type execute( 124614 Function && f) const; 124615 124616 124617Do not call this function directly. It is intended for use with the [link boost_asio.reference.execution__execute `execution::execute`] customisation point. 124618 124619For example: 124620 124621 boost::asio::strand<my_executor_type> ex = ...; 124622 execution::execute(ex, my_function_object); 124623 124624 124625 124626 124627This function is used to ask the strand to execute the given function object on its underlying executor. The function object will be executed according to the properties of the underlying executor. 124628 124629 124630[heading Parameters] 124631 124632 124633[variablelist 124634 124635[[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: 124636`` 124637 void function(); 124638`` 124639]] 124640 124641] 124642 124643 124644 124645 124646[endsect] 124647 124648 124649 124650[section:get_inner_executor strand::get_inner_executor] 124651 124652[indexterm2 boost_asio.indexterm.strand.get_inner_executor..get_inner_executor..strand] 124653Obtain the underlying executor. 124654 124655 124656 inner_executor_type get_inner_executor() const; 124657 124658 124659 124660[endsect] 124661 124662 124663 124664[section:inner_executor_type strand::inner_executor_type] 124665 124666[indexterm2 boost_asio.indexterm.strand.inner_executor_type..inner_executor_type..strand] 124667The type of the underlying executor. 124668 124669 124670 typedef Executor inner_executor_type; 124671 124672 124673 124674[heading Requirements] 124675 124676['Header: ][^boost/asio/strand.hpp] 124677 124678['Convenience header: ][^boost/asio.hpp] 124679 124680 124681[endsect] 124682 124683 124684 124685[section:on_work_finished strand::on_work_finished] 124686 124687[indexterm2 boost_asio.indexterm.strand.on_work_finished..on_work_finished..strand] 124688Inform the strand that some work is no longer outstanding. 124689 124690 124691 void on_work_finished() const; 124692 124693 124694The strand delegates this call to its underlying executor. 124695 124696 124697[endsect] 124698 124699 124700 124701[section:on_work_started strand::on_work_started] 124702 124703[indexterm2 boost_asio.indexterm.strand.on_work_started..on_work_started..strand] 124704Inform the strand that it has some outstanding work to do. 124705 124706 124707 void on_work_started() const; 124708 124709 124710The strand delegates this call to its underlying executor. 124711 124712 124713[endsect] 124714 124715 124716 124717[section:operator_not__eq_ strand::operator!=] 124718 124719[indexterm2 boost_asio.indexterm.strand.operator_not__eq_..operator!=..strand] 124720Compare two strands for inequality. 124721 124722 124723 friend bool operator!=( 124724 const strand & a, 124725 const strand & b); 124726 124727 124728Two strands are equal if they refer to the same ordered, non-concurrent state. 124729 124730[heading Requirements] 124731 124732['Header: ][^boost/asio/strand.hpp] 124733 124734['Convenience header: ][^boost/asio.hpp] 124735 124736 124737[endsect] 124738 124739 124740[section:operator_eq_ strand::operator=] 124741 124742[indexterm2 boost_asio.indexterm.strand.operator_eq_..operator=..strand] 124743Assignment operator. 124744 124745 124746 strand & ``[link boost_asio.reference.strand.operator_eq_.overload1 operator=]``( 124747 const strand & other); 124748 `` [''''»''' [link boost_asio.reference.strand.operator_eq_.overload1 more...]]`` 124749 124750 124751Converting assignment operator. 124752 124753 124754 template< 124755 class ``[link boost_asio.reference.Executor1 OtherExecutor]``> 124756 strand & ``[link boost_asio.reference.strand.operator_eq_.overload2 operator=]``( 124757 const strand< OtherExecutor > & other); 124758 `` [''''»''' [link boost_asio.reference.strand.operator_eq_.overload2 more...]]`` 124759 124760 124761Move assignment operator. 124762 124763 124764 strand & ``[link boost_asio.reference.strand.operator_eq_.overload3 operator=]``( 124765 strand && other); 124766 `` [''''»''' [link boost_asio.reference.strand.operator_eq_.overload3 more...]]`` 124767 124768 124769Converting move assignment operator. 124770 124771 124772 template< 124773 class ``[link boost_asio.reference.Executor1 OtherExecutor]``> 124774 strand & ``[link boost_asio.reference.strand.operator_eq_.overload4 operator=]``( 124775 strand< OtherExecutor > && other); 124776 `` [''''»''' [link boost_asio.reference.strand.operator_eq_.overload4 more...]]`` 124777 124778 124779[section:overload1 strand::operator= (1 of 4 overloads)] 124780 124781 124782Assignment operator. 124783 124784 124785 strand & operator=( 124786 const strand & other); 124787 124788 124789 124790[endsect] 124791 124792 124793 124794[section:overload2 strand::operator= (2 of 4 overloads)] 124795 124796 124797Converting assignment operator. 124798 124799 124800 template< 124801 class ``[link boost_asio.reference.Executor1 OtherExecutor]``> 124802 strand & operator=( 124803 const strand< OtherExecutor > & other); 124804 124805 124806This assignment operator is only valid if the `OtherExecutor` type is convertible to `Executor`. 124807 124808 124809[endsect] 124810 124811 124812 124813[section:overload3 strand::operator= (3 of 4 overloads)] 124814 124815 124816Move assignment operator. 124817 124818 124819 strand & operator=( 124820 strand && other); 124821 124822 124823 124824[endsect] 124825 124826 124827 124828[section:overload4 strand::operator= (4 of 4 overloads)] 124829 124830 124831Converting move assignment operator. 124832 124833 124834 template< 124835 class ``[link boost_asio.reference.Executor1 OtherExecutor]``> 124836 strand & operator=( 124837 strand< OtherExecutor > && other); 124838 124839 124840This assignment operator is only valid if the `OtherExecutor` type is convertible to `Executor`. 124841 124842 124843[endsect] 124844 124845 124846[endsect] 124847 124848 124849[section:operator_eq__eq_ strand::operator==] 124850 124851[indexterm2 boost_asio.indexterm.strand.operator_eq__eq_..operator==..strand] 124852Compare two strands for equality. 124853 124854 124855 friend bool operator==( 124856 const strand & a, 124857 const strand & b); 124858 124859 124860Two strands are equal if they refer to the same ordered, non-concurrent state. 124861 124862[heading Requirements] 124863 124864['Header: ][^boost/asio/strand.hpp] 124865 124866['Convenience header: ][^boost/asio.hpp] 124867 124868 124869[endsect] 124870 124871 124872 124873[section:post strand::post] 124874 124875[indexterm2 boost_asio.indexterm.strand.post..post..strand] 124876Request the strand to invoke the given function object. 124877 124878 124879 template< 124880 typename Function, 124881 typename Allocator> 124882 void post( 124883 Function && f, 124884 const Allocator & a) const; 124885 124886 124887This 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. 124888 124889 124890[heading Parameters] 124891 124892 124893[variablelist 124894 124895[[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: 124896`` 124897 void function(); 124898`` 124899]] 124900 124901[[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]] 124902 124903] 124904 124905 124906 124907 124908[endsect] 124909 124910 124911 124912[section:prefer strand::prefer] 124913 124914[indexterm2 boost_asio.indexterm.strand.prefer..prefer..strand] 124915Forward a preference to the underlying executor. 124916 124917 124918 template< 124919 typename Property> 124920 constraint< can_prefer< const Executor &, Property >::value &&!is_convertible< Property, execution::blocking_t::always_t >::value, strand< typename decay< typename prefer_result< const Executor &, Property >::type >::type > >::type prefer( 124921 const Property & p) const; 124922 124923 124924Do not call this function directly. It is intended for use with the [link boost_asio.reference.prefer `prefer`] customisation point. 124925 124926For example: 124927 124928 boost::asio::strand<my_executor_type> ex1 = ...; 124929 auto ex2 = boost::asio::prefer(ex1, 124930 boost::asio::execution::blocking.never); 124931 124932 124933 124934 124935 124936[endsect] 124937 124938 124939 124940[section:query strand::query] 124941 124942[indexterm2 boost_asio.indexterm.strand.query..query..strand] 124943Forward a query to the underlying executor. 124944 124945 124946 template< 124947 typename Property> 124948 constraint< can_query< const Executor &, Property >::value, typename conditional< is_convertible< Property, execution::blocking_t >::value, execution::blocking_t, typename query_result< const Executor &, Property >::type >::type >::type query( 124949 const Property & p) const; 124950 124951 124952Do not call this function directly. It is intended for use with the [link boost_asio.reference.query `query`] customisation point. 124953 124954For example: 124955 124956 boost::asio::strand<my_executor_type> ex = ...; 124957 if (boost::asio::query(ex, boost::asio::execution::blocking) 124958 == boost::asio::execution::blocking.never) 124959 ... 124960 124961 124962 124963 124964 124965[endsect] 124966 124967 124968 124969[section:require strand::require] 124970 124971[indexterm2 boost_asio.indexterm.strand.require..require..strand] 124972Forward a requirement to the underlying executor. 124973 124974 124975 template< 124976 typename Property> 124977 constraint< can_require< const Executor &, Property >::value &&!is_convertible< Property, execution::blocking_t::always_t >::value, strand< typename decay< typename require_result< const Executor &, Property >::type >::type > >::type require( 124978 const Property & p) const; 124979 124980 124981Do not call this function directly. It is intended for use with the [link boost_asio.reference.require `require`] customisation point. 124982 124983For example: 124984 124985 boost::asio::strand<my_executor_type> ex1 = ...; 124986 auto ex2 = boost::asio::require(ex1, 124987 boost::asio::execution::blocking.never); 124988 124989 124990 124991 124992 124993[endsect] 124994 124995 124996 124997[section:running_in_this_thread strand::running_in_this_thread] 124998 124999[indexterm2 boost_asio.indexterm.strand.running_in_this_thread..running_in_this_thread..strand] 125000Determine whether the strand is running in the current thread. 125001 125002 125003 bool running_in_this_thread() const; 125004 125005 125006 125007[heading Return Value] 125008 125009`true` if the current thread is executing a function that was submitted to the strand using `post()`, `dispatch()` or `defer()`. Otherwise returns `false`. 125010 125011 125012 125013 125014[endsect] 125015 125016 125017[section:strand strand::strand] 125018 125019[indexterm2 boost_asio.indexterm.strand.strand..strand..strand] 125020Default constructor. 125021 125022 125023 ``[link boost_asio.reference.strand.strand.overload1 strand]``(); 125024 `` [''''»''' [link boost_asio.reference.strand.strand.overload1 more...]]`` 125025 125026 125027Construct a strand for the specified executor. 125028 125029 125030 template< 125031 typename ``[link boost_asio.reference.Executor1 Executor1]``> 125032 explicit ``[link boost_asio.reference.strand.strand.overload2 strand]``( 125033 const Executor1 & e, 125034 typename constraint< conditional< !is_same< Executor1, strand >::value, is_convertible< Executor1, Executor >, false_type >::type::value >::type = 0); 125035 `` [''''»''' [link boost_asio.reference.strand.strand.overload2 more...]]`` 125036 125037 125038Copy constructor. 125039 125040 125041 ``[link boost_asio.reference.strand.strand.overload3 strand]``( 125042 const strand & other); 125043 `` [''''»''' [link boost_asio.reference.strand.strand.overload3 more...]]`` 125044 125045 125046Converting constructor. 125047 125048 125049 template< 125050 class ``[link boost_asio.reference.Executor1 OtherExecutor]``> 125051 ``[link boost_asio.reference.strand.strand.overload4 strand]``( 125052 const strand< OtherExecutor > & other); 125053 `` [''''»''' [link boost_asio.reference.strand.strand.overload4 more...]]`` 125054 125055 125056Move constructor. 125057 125058 125059 ``[link boost_asio.reference.strand.strand.overload5 strand]``( 125060 strand && other); 125061 `` [''''»''' [link boost_asio.reference.strand.strand.overload5 more...]]`` 125062 125063 125064Converting move constructor. 125065 125066 125067 template< 125068 class ``[link boost_asio.reference.Executor1 OtherExecutor]``> 125069 ``[link boost_asio.reference.strand.strand.overload6 strand]``( 125070 strand< OtherExecutor > && other); 125071 `` [''''»''' [link boost_asio.reference.strand.strand.overload6 more...]]`` 125072 125073 125074[section:overload1 strand::strand (1 of 6 overloads)] 125075 125076 125077Default constructor. 125078 125079 125080 strand(); 125081 125082 125083This constructor is only valid if the underlying executor type is default constructible. 125084 125085 125086[endsect] 125087 125088 125089 125090[section:overload2 strand::strand (2 of 6 overloads)] 125091 125092 125093Construct a strand for the specified executor. 125094 125095 125096 template< 125097 typename ``[link boost_asio.reference.Executor1 Executor1]``> 125098 strand( 125099 const Executor1 & e, 125100 typename constraint< conditional< !is_same< Executor1, strand >::value, is_convertible< Executor1, Executor >, false_type >::type::value >::type = 0); 125101 125102 125103 125104[endsect] 125105 125106 125107 125108[section:overload3 strand::strand (3 of 6 overloads)] 125109 125110 125111Copy constructor. 125112 125113 125114 strand( 125115 const strand & other); 125116 125117 125118 125119[endsect] 125120 125121 125122 125123[section:overload4 strand::strand (4 of 6 overloads)] 125124 125125 125126Converting constructor. 125127 125128 125129 template< 125130 class ``[link boost_asio.reference.Executor1 OtherExecutor]``> 125131 strand( 125132 const strand< OtherExecutor > & other); 125133 125134 125135This constructor is only valid if the `OtherExecutor` type is convertible to `Executor`. 125136 125137 125138[endsect] 125139 125140 125141 125142[section:overload5 strand::strand (5 of 6 overloads)] 125143 125144 125145Move constructor. 125146 125147 125148 strand( 125149 strand && other); 125150 125151 125152 125153[endsect] 125154 125155 125156 125157[section:overload6 strand::strand (6 of 6 overloads)] 125158 125159 125160Converting move constructor. 125161 125162 125163 template< 125164 class ``[link boost_asio.reference.Executor1 OtherExecutor]``> 125165 strand( 125166 strand< OtherExecutor > && other); 125167 125168 125169This constructor is only valid if the `OtherExecutor` type is convertible to `Executor`. 125170 125171 125172[endsect] 125173 125174 125175[endsect] 125176 125177 125178[section:_strand strand::~strand] 125179 125180[indexterm2 boost_asio.indexterm.strand._strand..~strand..strand] 125181Destructor. 125182 125183 125184 ~strand(); 125185 125186 125187 125188[endsect] 125189 125190 125191 125192[endsect] 125193 125194 125195[section:streambuf streambuf] 125196 125197[indexterm1 boost_asio.indexterm.streambuf..streambuf] 125198Typedef for the typical usage of [link boost_asio.reference.basic_streambuf `basic_streambuf`]. 125199 125200 125201 typedef basic_streambuf streambuf; 125202 125203 125204[heading Types] 125205[table 125206 [[Name][Description]] 125207 125208 [ 125209 125210 [[link boost_asio.reference.basic_streambuf.const_buffers_type [*const_buffers_type]]] 125211 [The type used to represent the input sequence as a list of buffers. ] 125212 125213 ] 125214 125215 [ 125216 125217 [[link boost_asio.reference.basic_streambuf.mutable_buffers_type [*mutable_buffers_type]]] 125218 [The type used to represent the output sequence as a list of buffers. ] 125219 125220 ] 125221 125222] 125223 125224[heading Member Functions] 125225[table 125226 [[Name][Description]] 125227 125228 [ 125229 [[link boost_asio.reference.basic_streambuf.basic_streambuf [*basic_streambuf]] [constructor]] 125230 [Construct a basic_streambuf object. ] 125231 ] 125232 125233 [ 125234 [[link boost_asio.reference.basic_streambuf.capacity [*capacity]]] 125235 [Get the current capacity of the basic_streambuf. ] 125236 ] 125237 125238 [ 125239 [[link boost_asio.reference.basic_streambuf.commit [*commit]]] 125240 [Move characters from the output sequence to the input sequence. ] 125241 ] 125242 125243 [ 125244 [[link boost_asio.reference.basic_streambuf.consume [*consume]]] 125245 [Remove characters from the input sequence. ] 125246 ] 125247 125248 [ 125249 [[link boost_asio.reference.basic_streambuf.data [*data]]] 125250 [Get a list of buffers that represents the input sequence. ] 125251 ] 125252 125253 [ 125254 [[link boost_asio.reference.basic_streambuf.max_size [*max_size]]] 125255 [Get the maximum size of the basic_streambuf. ] 125256 ] 125257 125258 [ 125259 [[link boost_asio.reference.basic_streambuf.prepare [*prepare]]] 125260 [Get a list of buffers that represents the output sequence, with the given size. ] 125261 ] 125262 125263 [ 125264 [[link boost_asio.reference.basic_streambuf.size [*size]]] 125265 [Get the size of the input sequence. ] 125266 ] 125267 125268] 125269 125270[heading Protected Member Functions] 125271[table 125272 [[Name][Description]] 125273 125274 [ 125275 [[link boost_asio.reference.basic_streambuf.overflow [*overflow]]] 125276 [Override std::streambuf behaviour. ] 125277 ] 125278 125279 [ 125280 [[link boost_asio.reference.basic_streambuf.reserve [*reserve]]] 125281 [] 125282 ] 125283 125284 [ 125285 [[link boost_asio.reference.basic_streambuf.underflow [*underflow]]] 125286 [Override std::streambuf behaviour. ] 125287 ] 125288 125289] 125290 125291The `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. 125292 125293The `basic_streambuf` class's public interface is intended to permit the following implementation strategies: 125294 125295 125296* 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. 125297 125298 125299* 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. 125300 125301 125302* 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. 125303 125304The 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: 125305 125306 size() <= max_size() 125307 125308 125309Any member function that would, if successful, cause the invariant to be violated shall throw an exception of class `std::length_error`. 125310 125311The 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. 125312 125313 125314[heading Examples] 125315 125316Writing directly from an streambuf to a socket: 125317 125318 boost::asio::streambuf b; 125319 std::ostream os(&b); 125320 os << "Hello, World!\n"; 125321 125322 // try sending some data in input sequence 125323 size_t n = sock.send(b.data()); 125324 125325 b.consume(n); // sent data is removed from input sequence 125326 125327 125328 125329 125330Reading from a socket directly into a streambuf: 125331 125332 boost::asio::streambuf b; 125333 125334 // reserve 512 bytes in output sequence 125335 boost::asio::streambuf::mutable_buffers_type bufs = b.prepare(512); 125336 125337 size_t n = sock.receive(bufs); 125338 125339 // received data is "committed" from output sequence to input sequence 125340 b.commit(n); 125341 125342 std::istream is(&b); 125343 std::string s; 125344 is >> s; 125345 125346 125347 125348 125349 125350[heading Requirements] 125351 125352['Header: ][^boost/asio/streambuf.hpp] 125353 125354['Convenience header: ][^boost/asio.hpp] 125355 125356 125357[endsect] 125358 125359 125360[section:system_context system_context] 125361 125362[indexterm1 boost_asio.indexterm.system_context..system_context] 125363 125364 125365The executor context for the system executor. 125366 125367 125368 class system_context : 125369 public execution_context 125370 125371 125372[heading Types] 125373[table 125374 [[Name][Description]] 125375 125376 [ 125377 125378 [[link boost_asio.reference.system_context.executor_type [*executor_type]]] 125379 [The executor type associated with the context. ] 125380 125381 ] 125382 125383 [ 125384 125385 [[link boost_asio.reference.system_context.fork_event [*fork_event]]] 125386 [Fork-related event notifications. ] 125387 125388 ] 125389 125390] 125391 125392[heading Member Functions] 125393[table 125394 [[Name][Description]] 125395 125396 [ 125397 [[link boost_asio.reference.system_context.get_executor [*get_executor]]] 125398 [Obtain an executor for the context. ] 125399 ] 125400 125401 [ 125402 [[link boost_asio.reference.system_context.join [*join]]] 125403 [Join all threads in the system thread pool. ] 125404 ] 125405 125406 [ 125407 [[link boost_asio.reference.system_context.notify_fork [*notify_fork]]] 125408 [Notify the execution_context of a fork-related event. ] 125409 ] 125410 125411 [ 125412 [[link boost_asio.reference.system_context.stop [*stop]]] 125413 [Signal all threads in the system thread pool to stop. ] 125414 ] 125415 125416 [ 125417 [[link boost_asio.reference.system_context.stopped [*stopped]]] 125418 [Determine whether the system thread pool has been stopped. ] 125419 ] 125420 125421 [ 125422 [[link boost_asio.reference.system_context._system_context [*~system_context]] [destructor]] 125423 [Destructor shuts down all threads in the system thread pool. ] 125424 ] 125425 125426] 125427 125428[heading Protected Member Functions] 125429[table 125430 [[Name][Description]] 125431 125432 [ 125433 [[link boost_asio.reference.system_context.destroy [*destroy]]] 125434 [Destroys all services in the context. ] 125435 ] 125436 125437 [ 125438 [[link boost_asio.reference.system_context.shutdown [*shutdown]]] 125439 [Shuts down all services in the context. ] 125440 ] 125441 125442] 125443 125444[heading Friends] 125445[table 125446 [[Name][Description]] 125447 125448 [ 125449 [[link boost_asio.reference.system_context.add_service [*add_service]]] 125450 [(Deprecated: Use make_service().) Add a service object to the execution_context. ] 125451 ] 125452 125453 [ 125454 [[link boost_asio.reference.system_context.has_service [*has_service]]] 125455 [Determine if an execution_context contains a specified service type. ] 125456 ] 125457 125458 [ 125459 [[link boost_asio.reference.system_context.make_service [*make_service]]] 125460 [Creates a service object and adds it to the execution_context. ] 125461 ] 125462 125463 [ 125464 [[link boost_asio.reference.system_context.use_service [*use_service]]] 125465 [Obtain the service object corresponding to the given type. ] 125466 ] 125467 125468] 125469 125470[heading Requirements] 125471 125472['Header: ][^boost/asio/system_context.hpp] 125473 125474['Convenience header: ][^boost/asio.hpp] 125475 125476 125477[section:add_service system_context::add_service] 125478 125479 125480['Inherited from execution_context.] 125481 125482[indexterm2 boost_asio.indexterm.system_context.add_service..add_service..system_context] 125483(Deprecated: Use `make_service()`.) Add a service object to the [link boost_asio.reference.execution_context `execution_context`]. 125484 125485 125486 template< 125487 typename ``[link boost_asio.reference.Service Service]``> 125488 friend void add_service( 125489 execution_context & e, 125490 Service * svc); 125491 125492 125493This function is used to add a service to the [link boost_asio.reference.execution_context `execution_context`]. 125494 125495 125496[heading Parameters] 125497 125498 125499[variablelist 125500 125501[[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]] 125502 125503[[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: 125504`` 125505 delete static_cast<execution_context::service*>(svc) 125506`` 125507]] 125508 125509] 125510 125511 125512[heading Exceptions] 125513 125514 125515[variablelist 125516 125517[[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`].]] 125518 125519[[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. ]] 125520 125521] 125522 125523 125524 125525[heading Requirements] 125526 125527['Header: ][^boost/asio/system_context.hpp] 125528 125529['Convenience header: ][^boost/asio.hpp] 125530 125531 125532[endsect] 125533 125534 125535 125536[section:destroy system_context::destroy] 125537 125538 125539['Inherited from execution_context.] 125540 125541[indexterm2 boost_asio.indexterm.system_context.destroy..destroy..system_context] 125542Destroys all services in the context. 125543 125544 125545 void destroy(); 125546 125547 125548This function is implemented as follows: 125549 125550 125551* 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)`. 125552 125553 125554 125555 125556[endsect] 125557 125558 125559 125560[section:executor_type system_context::executor_type] 125561 125562[indexterm2 boost_asio.indexterm.system_context.executor_type..executor_type..system_context] 125563The executor type associated with the context. 125564 125565 125566 typedef basic_system_executor< execution::blocking_t::possibly_t, execution::relationship_t::fork_t, std::allocator< void > > executor_type; 125567 125568 125569[heading Member Functions] 125570[table 125571 [[Name][Description]] 125572 125573 [ 125574 [[link boost_asio.reference.basic_system_executor.basic_system_executor [*basic_system_executor]] [constructor]] 125575 [Default constructor. ] 125576 ] 125577 125578 [ 125579 [[link boost_asio.reference.basic_system_executor.context [*context]]] 125580 [Obtain the underlying execution context. ] 125581 ] 125582 125583 [ 125584 [[link boost_asio.reference.basic_system_executor.defer [*defer]]] 125585 [Request the system executor to invoke the given function object. ] 125586 ] 125587 125588 [ 125589 [[link boost_asio.reference.basic_system_executor.dispatch [*dispatch]]] 125590 [Request the system executor to invoke the given function object. ] 125591 ] 125592 125593 [ 125594 [[link boost_asio.reference.basic_system_executor.execute [*execute]]] 125595 [Execution function. ] 125596 ] 125597 125598 [ 125599 [[link boost_asio.reference.basic_system_executor.on_work_finished [*on_work_finished]]] 125600 [Inform the executor that some work is no longer outstanding. ] 125601 ] 125602 125603 [ 125604 [[link boost_asio.reference.basic_system_executor.on_work_started [*on_work_started]]] 125605 [Inform the executor that it has some outstanding work to do. ] 125606 ] 125607 125608 [ 125609 [[link boost_asio.reference.basic_system_executor.post [*post]]] 125610 [Request the system executor to invoke the given function object. ] 125611 ] 125612 125613 [ 125614 [[link boost_asio.reference.basic_system_executor.query [*query]]] 125615 [Query the current value of the allocator property. 125616 [hr] 125617 Query the occupancy (recommended number of work items) for the system context. ] 125618 ] 125619 125620 [ 125621 [[link boost_asio.reference.basic_system_executor.query__static [*query]] [static]] 125622 [Query the current value of the mapping property. 125623 [hr] 125624 Query the current value of the context property. 125625 [hr] 125626 Query the current value of the blocking property. 125627 [hr] 125628 Query the current value of the relationship property. ] 125629 ] 125630 125631 [ 125632 [[link boost_asio.reference.basic_system_executor.require [*require]]] 125633 [Obtain an executor with the blocking.possibly property. 125634 [hr] 125635 Obtain an executor with the blocking.always property. 125636 [hr] 125637 Obtain an executor with the blocking.never property. 125638 [hr] 125639 Obtain an executor with the relationship.continuation property. 125640 [hr] 125641 Obtain an executor with the relationship.fork property. 125642 [hr] 125643 Obtain an executor with the specified allocator property. 125644 [hr] 125645 Obtain an executor with the default allocator property. ] 125646 ] 125647 125648] 125649 125650[heading Friends] 125651[table 125652 [[Name][Description]] 125653 125654 [ 125655 [[link boost_asio.reference.basic_system_executor.operator_not__eq_ [*operator!=]]] 125656 [Compare two executors for inequality. ] 125657 ] 125658 125659 [ 125660 [[link boost_asio.reference.basic_system_executor.operator_eq__eq_ [*operator==]]] 125661 [Compare two executors for equality. ] 125662 ] 125663 125664] 125665 125666The system executor represents an execution context where functions are permitted to run on arbitrary threads. When the blocking.never property is established, the system executor will schedule the function to run on an unspecified system thread pool. When either blocking.possibly or blocking.always is established, the executor invokes the function immediately. 125667 125668 125669[heading Requirements] 125670 125671['Header: ][^boost/asio/system_context.hpp] 125672 125673['Convenience header: ][^boost/asio.hpp] 125674 125675 125676[endsect] 125677 125678 125679 125680[section:fork_event system_context::fork_event] 125681 125682 125683['Inherited from execution_context.] 125684 125685[indexterm2 boost_asio.indexterm.system_context.fork_event..fork_event..system_context] 125686Fork-related event notifications. 125687 125688 125689 enum fork_event 125690 125691[indexterm2 boost_asio.indexterm.system_context.fork_event.fork_prepare..fork_prepare..system_context] 125692[indexterm2 boost_asio.indexterm.system_context.fork_event.fork_parent..fork_parent..system_context] 125693[indexterm2 boost_asio.indexterm.system_context.fork_event.fork_child..fork_child..system_context] 125694 125695[heading Values] 125696[variablelist 125697 125698 [ 125699 [fork_prepare] 125700 [Notify the context that the process is about to fork. ] 125701 ] 125702 125703 [ 125704 [fork_parent] 125705 [Notify the context that the process has forked and is the parent. ] 125706 ] 125707 125708 [ 125709 [fork_child] 125710 [Notify the context that the process has forked and is the child. ] 125711 ] 125712 125713] 125714 125715 125716 125717[endsect] 125718 125719 125720 125721[section:get_executor system_context::get_executor] 125722 125723[indexterm2 boost_asio.indexterm.system_context.get_executor..get_executor..system_context] 125724Obtain an executor for the context. 125725 125726 125727 executor_type get_executor(); 125728 125729 125730 125731[endsect] 125732 125733 125734 125735[section:has_service system_context::has_service] 125736 125737 125738['Inherited from execution_context.] 125739 125740[indexterm2 boost_asio.indexterm.system_context.has_service..has_service..system_context] 125741Determine if an [link boost_asio.reference.execution_context `execution_context`] contains a specified service type. 125742 125743 125744 template< 125745 typename ``[link boost_asio.reference.Service Service]``> 125746 friend bool has_service( 125747 execution_context & e); 125748 125749 125750This 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. 125751 125752 125753[heading Parameters] 125754 125755 125756[variablelist 125757 125758[[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]] 125759 125760] 125761 125762 125763[heading Return Value] 125764 125765A boolean indicating whether the [link boost_asio.reference.execution_context `execution_context`] contains the service. 125766 125767 125768 125769[heading Requirements] 125770 125771['Header: ][^boost/asio/system_context.hpp] 125772 125773['Convenience header: ][^boost/asio.hpp] 125774 125775 125776[endsect] 125777 125778 125779 125780[section:join system_context::join] 125781 125782[indexterm2 boost_asio.indexterm.system_context.join..join..system_context] 125783Join all threads in the system thread pool. 125784 125785 125786 void join(); 125787 125788 125789 125790[endsect] 125791 125792 125793 125794[section:make_service system_context::make_service] 125795 125796 125797['Inherited from execution_context.] 125798 125799[indexterm2 boost_asio.indexterm.system_context.make_service..make_service..system_context] 125800Creates a service object and adds it to the [link boost_asio.reference.execution_context `execution_context`]. 125801 125802 125803 template< 125804 typename ``[link boost_asio.reference.Service Service]``, 125805 typename... Args> 125806 friend Service & make_service( 125807 execution_context & e, 125808 Args &&... args); 125809 125810 125811This function is used to add a service to the [link boost_asio.reference.execution_context `execution_context`]. 125812 125813 125814[heading Parameters] 125815 125816 125817[variablelist 125818 125819[[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]] 125820 125821[[args][Zero or more arguments to be passed to the service constructor.]] 125822 125823] 125824 125825 125826[heading Exceptions] 125827 125828 125829[variablelist 125830 125831[[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`]. ]] 125832 125833] 125834 125835 125836 125837[heading Requirements] 125838 125839['Header: ][^boost/asio/system_context.hpp] 125840 125841['Convenience header: ][^boost/asio.hpp] 125842 125843 125844[endsect] 125845 125846 125847 125848[section:notify_fork system_context::notify_fork] 125849 125850 125851['Inherited from execution_context.] 125852 125853[indexterm2 boost_asio.indexterm.system_context.notify_fork..notify_fork..system_context] 125854Notify the [link boost_asio.reference.execution_context `execution_context`] of a fork-related event. 125855 125856 125857 void notify_fork( 125858 fork_event event); 125859 125860 125861This 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. 125862 125863This 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. 125864 125865 125866[heading Parameters] 125867 125868 125869[variablelist 125870 125871[[event][A fork-related event.]] 125872 125873] 125874 125875 125876[heading Exceptions] 125877 125878 125879[variablelist 125880 125881[[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.]] 125882 125883] 125884 125885 125886[heading Example] 125887 125888The following code illustrates how to incorporate the `notify_fork()` function: 125889 125890 my_execution_context.notify_fork(execution_context::fork_prepare); 125891 if (fork() == 0) 125892 { 125893 // This is the child process. 125894 my_execution_context.notify_fork(execution_context::fork_child); 125895 } 125896 else 125897 { 125898 // This is the parent process. 125899 my_execution_context.notify_fork(execution_context::fork_parent); 125900 } 125901 125902 125903 125904 125905 125906[heading Remarks] 125907 125908For 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. 125909 125910 125911 125912 125913[endsect] 125914 125915 125916 125917[section:shutdown system_context::shutdown] 125918 125919 125920['Inherited from execution_context.] 125921 125922[indexterm2 boost_asio.indexterm.system_context.shutdown..shutdown..system_context] 125923Shuts down all services in the context. 125924 125925 125926 void shutdown(); 125927 125928 125929This function is implemented as follows: 125930 125931 125932* 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()`. 125933 125934 125935 125936 125937[endsect] 125938 125939 125940 125941[section:stop system_context::stop] 125942 125943[indexterm2 boost_asio.indexterm.system_context.stop..stop..system_context] 125944Signal all threads in the system thread pool to stop. 125945 125946 125947 void stop(); 125948 125949 125950 125951[endsect] 125952 125953 125954 125955[section:stopped system_context::stopped] 125956 125957[indexterm2 boost_asio.indexterm.system_context.stopped..stopped..system_context] 125958Determine whether the system thread pool has been stopped. 125959 125960 125961 bool stopped() const; 125962 125963 125964 125965[endsect] 125966 125967 125968[section:use_service system_context::use_service] 125969 125970[indexterm2 boost_asio.indexterm.system_context.use_service..use_service..system_context] 125971Obtain the service object corresponding to the given type. 125972 125973 125974 template< 125975 typename ``[link boost_asio.reference.Service Service]``> 125976 friend Service & ``[link boost_asio.reference.system_context.use_service.overload1 use_service]``( 125977 execution_context & e); 125978 `` [''''»''' [link boost_asio.reference.system_context.use_service.overload1 more...]]`` 125979 125980 template< 125981 typename ``[link boost_asio.reference.Service Service]``> 125982 friend Service & ``[link boost_asio.reference.system_context.use_service.overload2 use_service]``( 125983 io_context & ioc); 125984 `` [''''»''' [link boost_asio.reference.system_context.use_service.overload2 more...]]`` 125985 125986 125987[section:overload1 system_context::use_service (1 of 2 overloads)] 125988 125989 125990['Inherited from execution_context.] 125991 125992 125993Obtain the service object corresponding to the given type. 125994 125995 125996 template< 125997 typename ``[link boost_asio.reference.Service Service]``> 125998 friend Service & use_service( 125999 execution_context & e); 126000 126001 126002This 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. 126003 126004 126005[heading Parameters] 126006 126007 126008[variablelist 126009 126010[[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]] 126011 126012] 126013 126014 126015[heading Return Value] 126016 126017The service interface implementing the specified service type. Ownership of the service interface is not transferred to the caller. 126018 126019 126020 126021[heading Requirements] 126022 126023['Header: ][^boost/asio/system_context.hpp] 126024 126025['Convenience header: ][^boost/asio.hpp] 126026 126027 126028[endsect] 126029 126030 126031 126032[section:overload2 system_context::use_service (2 of 2 overloads)] 126033 126034 126035['Inherited from execution_context.] 126036 126037 126038Obtain the service object corresponding to the given type. 126039 126040 126041 template< 126042 typename ``[link boost_asio.reference.Service Service]``> 126043 friend Service & use_service( 126044 io_context & ioc); 126045 126046 126047This 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. 126048 126049 126050[heading Parameters] 126051 126052 126053[variablelist 126054 126055[[ioc][The [link boost_asio.reference.io_context `io_context`] object that owns the service.]] 126056 126057] 126058 126059 126060[heading Return Value] 126061 126062The service interface implementing the specified service type. Ownership of the service interface is not transferred to the caller. 126063 126064 126065[heading Remarks] 126066 126067This overload is preserved for backwards compatibility with services that inherit from [link boost_asio.reference.io_context__service `io_context::service`]. 126068 126069 126070 126071[heading Requirements] 126072 126073['Header: ][^boost/asio/system_context.hpp] 126074 126075['Convenience header: ][^boost/asio.hpp] 126076 126077 126078[endsect] 126079 126080 126081[endsect] 126082 126083 126084[section:_system_context system_context::~system_context] 126085 126086[indexterm2 boost_asio.indexterm.system_context._system_context..~system_context..system_context] 126087Destructor shuts down all threads in the system thread pool. 126088 126089 126090 ~system_context(); 126091 126092 126093 126094[endsect] 126095 126096 126097 126098[endsect] 126099 126100 126101[section:system_executor system_executor] 126102 126103[indexterm1 boost_asio.indexterm.system_executor..system_executor] 126104An executor that uses arbitrary threads. 126105 126106 126107 typedef basic_system_executor< execution::blocking_t::possibly_t, execution::relationship_t::fork_t, std::allocator< void > > system_executor; 126108 126109 126110[heading Member Functions] 126111[table 126112 [[Name][Description]] 126113 126114 [ 126115 [[link boost_asio.reference.basic_system_executor.basic_system_executor [*basic_system_executor]] [constructor]] 126116 [Default constructor. ] 126117 ] 126118 126119 [ 126120 [[link boost_asio.reference.basic_system_executor.context [*context]]] 126121 [Obtain the underlying execution context. ] 126122 ] 126123 126124 [ 126125 [[link boost_asio.reference.basic_system_executor.defer [*defer]]] 126126 [Request the system executor to invoke the given function object. ] 126127 ] 126128 126129 [ 126130 [[link boost_asio.reference.basic_system_executor.dispatch [*dispatch]]] 126131 [Request the system executor to invoke the given function object. ] 126132 ] 126133 126134 [ 126135 [[link boost_asio.reference.basic_system_executor.execute [*execute]]] 126136 [Execution function. ] 126137 ] 126138 126139 [ 126140 [[link boost_asio.reference.basic_system_executor.on_work_finished [*on_work_finished]]] 126141 [Inform the executor that some work is no longer outstanding. ] 126142 ] 126143 126144 [ 126145 [[link boost_asio.reference.basic_system_executor.on_work_started [*on_work_started]]] 126146 [Inform the executor that it has some outstanding work to do. ] 126147 ] 126148 126149 [ 126150 [[link boost_asio.reference.basic_system_executor.post [*post]]] 126151 [Request the system executor to invoke the given function object. ] 126152 ] 126153 126154 [ 126155 [[link boost_asio.reference.basic_system_executor.query [*query]]] 126156 [Query the current value of the allocator property. 126157 [hr] 126158 Query the occupancy (recommended number of work items) for the system context. ] 126159 ] 126160 126161 [ 126162 [[link boost_asio.reference.basic_system_executor.query__static [*query]] [static]] 126163 [Query the current value of the mapping property. 126164 [hr] 126165 Query the current value of the context property. 126166 [hr] 126167 Query the current value of the blocking property. 126168 [hr] 126169 Query the current value of the relationship property. ] 126170 ] 126171 126172 [ 126173 [[link boost_asio.reference.basic_system_executor.require [*require]]] 126174 [Obtain an executor with the blocking.possibly property. 126175 [hr] 126176 Obtain an executor with the blocking.always property. 126177 [hr] 126178 Obtain an executor with the blocking.never property. 126179 [hr] 126180 Obtain an executor with the relationship.continuation property. 126181 [hr] 126182 Obtain an executor with the relationship.fork property. 126183 [hr] 126184 Obtain an executor with the specified allocator property. 126185 [hr] 126186 Obtain an executor with the default allocator property. ] 126187 ] 126188 126189] 126190 126191[heading Friends] 126192[table 126193 [[Name][Description]] 126194 126195 [ 126196 [[link boost_asio.reference.basic_system_executor.operator_not__eq_ [*operator!=]]] 126197 [Compare two executors for inequality. ] 126198 ] 126199 126200 [ 126201 [[link boost_asio.reference.basic_system_executor.operator_eq__eq_ [*operator==]]] 126202 [Compare two executors for equality. ] 126203 ] 126204 126205] 126206 126207The system executor represents an execution context where functions are permitted to run on arbitrary threads. When the blocking.never property is established, the system executor will schedule the function to run on an unspecified system thread pool. When either blocking.possibly or blocking.always is established, the executor invokes the function immediately. 126208 126209 126210The system executor represents an execution context where functions are permitted to run on arbitrary threads. When the blocking.never property is established, the system executor will schedule the function to run on an unspecified system thread pool. When either blocking.possibly or blocking.always is established, the executor invokes the function immediately. 126211 126212[heading Requirements] 126213 126214['Header: ][^boost/asio/system_executor.hpp] 126215 126216['Convenience header: ][^boost/asio.hpp] 126217 126218 126219[endsect] 126220 126221 126222 126223[section:system_timer system_timer] 126224 126225[indexterm1 boost_asio.indexterm.system_timer..system_timer] 126226Typedef for a timer based on the system clock. 126227 126228 126229 typedef basic_waitable_timer< chrono::system_clock > system_timer; 126230 126231 126232[heading Types] 126233[table 126234 [[Name][Description]] 126235 126236 [ 126237 126238 [[link boost_asio.reference.basic_waitable_timer__rebind_executor [*rebind_executor]]] 126239 [Rebinds the timer type to another executor. ] 126240 126241 ] 126242 126243 [ 126244 126245 [[link boost_asio.reference.basic_waitable_timer.clock_type [*clock_type]]] 126246 [The clock type. ] 126247 126248 ] 126249 126250 [ 126251 126252 [[link boost_asio.reference.basic_waitable_timer.duration [*duration]]] 126253 [The duration type of the clock. ] 126254 126255 ] 126256 126257 [ 126258 126259 [[link boost_asio.reference.basic_waitable_timer.executor_type [*executor_type]]] 126260 [The type of the executor associated with the object. ] 126261 126262 ] 126263 126264 [ 126265 126266 [[link boost_asio.reference.basic_waitable_timer.time_point [*time_point]]] 126267 [The time point type of the clock. ] 126268 126269 ] 126270 126271 [ 126272 126273 [[link boost_asio.reference.basic_waitable_timer.traits_type [*traits_type]]] 126274 [The wait traits type. ] 126275 126276 ] 126277 126278] 126279 126280[heading Member Functions] 126281[table 126282 [[Name][Description]] 126283 126284 [ 126285 [[link boost_asio.reference.basic_waitable_timer.async_wait [*async_wait]]] 126286 [Start an asynchronous wait on the timer. ] 126287 ] 126288 126289 [ 126290 [[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer [*basic_waitable_timer]] [constructor]] 126291 [Constructor. 126292 [hr] 126293 Constructor to set a particular expiry time as an absolute time. 126294 [hr] 126295 Constructor to set a particular expiry time relative to now. 126296 [hr] 126297 Move-construct a basic_waitable_timer from another. ] 126298 ] 126299 126300 [ 126301 [[link boost_asio.reference.basic_waitable_timer.cancel [*cancel]]] 126302 [Cancel any asynchronous operations that are waiting on the timer. 126303 [hr] 126304 (Deprecated: Use non-error_code overload.) Cancel any asynchronous operations that are waiting on the timer. ] 126305 ] 126306 126307 [ 126308 [[link boost_asio.reference.basic_waitable_timer.cancel_one [*cancel_one]]] 126309 [Cancels one asynchronous operation that is waiting on the timer. 126310 [hr] 126311 (Deprecated: Use non-error_code overload.) Cancels one asynchronous operation that is waiting on the timer. ] 126312 ] 126313 126314 [ 126315 [[link boost_asio.reference.basic_waitable_timer.expires_after [*expires_after]]] 126316 [Set the timer's expiry time relative to now. ] 126317 ] 126318 126319 [ 126320 [[link boost_asio.reference.basic_waitable_timer.expires_at [*expires_at]]] 126321 [(Deprecated: Use expiry().) Get the timer's expiry time as an absolute time. 126322 [hr] 126323 Set the timer's expiry time as an absolute time. 126324 [hr] 126325 (Deprecated: Use non-error_code overload.) Set the timer's expiry time as an absolute time. ] 126326 ] 126327 126328 [ 126329 [[link boost_asio.reference.basic_waitable_timer.expires_from_now [*expires_from_now]]] 126330 [(Deprecated: Use expiry().) Get the timer's expiry time relative to now. 126331 [hr] 126332 (Deprecated: Use expires_after().) Set the timer's expiry time relative to now. ] 126333 ] 126334 126335 [ 126336 [[link boost_asio.reference.basic_waitable_timer.expiry [*expiry]]] 126337 [Get the timer's expiry time as an absolute time. ] 126338 ] 126339 126340 [ 126341 [[link boost_asio.reference.basic_waitable_timer.get_executor [*get_executor]]] 126342 [Get the executor associated with the object. ] 126343 ] 126344 126345 [ 126346 [[link boost_asio.reference.basic_waitable_timer.operator_eq_ [*operator=]]] 126347 [Move-assign a basic_waitable_timer from another. ] 126348 ] 126349 126350 [ 126351 [[link boost_asio.reference.basic_waitable_timer.wait [*wait]]] 126352 [Perform a blocking wait on the timer. ] 126353 ] 126354 126355 [ 126356 [[link boost_asio.reference.basic_waitable_timer._basic_waitable_timer [*~basic_waitable_timer]] [destructor]] 126357 [Destroys the timer. ] 126358 ] 126359 126360] 126361 126362The [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. 126363 126364A 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. 126365 126366Most 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. 126367 126368 126369[heading Remarks] 126370 126371This waitable timer functionality is for use with the C++11 standard library's `<chrono>` facility, or with the Boost.Chrono library. 126372 126373 126374[heading Thread Safety] 126375 126376['Distinct] ['objects:] Safe. 126377 126378['Shared] ['objects:] Unsafe. 126379 126380 126381[heading Examples] 126382 126383Performing a blocking wait (C++11): 126384 126385 // Construct a timer without setting an expiry time. 126386 boost::asio::steady_timer timer(my_context); 126387 126388 // Set an expiry time relative to now. 126389 timer.expires_after(std::chrono::seconds(5)); 126390 126391 // Wait for the timer to expire. 126392 timer.wait(); 126393 126394 126395 126396 126397 126398Performing an asynchronous wait (C++11): 126399 126400 void handler(const boost::system::error_code& error) 126401 { 126402 if (!error) 126403 { 126404 // Timer expired. 126405 } 126406 } 126407 126408 ... 126409 126410 // Construct a timer with an absolute expiry time. 126411 boost::asio::steady_timer timer(my_context, 126412 std::chrono::steady_clock::now() + std::chrono::seconds(60)); 126413 126414 // Start an asynchronous wait. 126415 timer.async_wait(handler); 126416 126417 126418 126419 126420 126421[heading Changing an active waitable timer's expiry time] 126422 126423 126424 126425Changing 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: 126426 126427 126428 126429 void on_some_event() 126430 { 126431 if (my_timer.expires_after(seconds(5)) > 0) 126432 { 126433 // We managed to cancel the timer. Start new asynchronous wait. 126434 my_timer.async_wait(on_timeout); 126435 } 126436 else 126437 { 126438 // Too late, timer has already expired! 126439 } 126440 } 126441 126442 void on_timeout(const boost::system::error_code& e) 126443 { 126444 if (e != boost::asio::error::operation_aborted) 126445 { 126446 // Timer was not cancelled, take necessary action. 126447 } 126448 } 126449 126450 126451 126452 126453 126454* 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. 126455 126456 126457* If a wait handler is cancelled, the boost::system::error\_code passed to it contains the value `boost::asio::error::operation_aborted`. 126458 126459 126460 126461 126462This 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: 126463 126464 typedef basic_waitable_timer<boost::chrono::system_clock> timer; 126465 126466 126467 126468 126469[heading Requirements] 126470 126471['Header: ][^boost/asio/system_timer.hpp] 126472 126473['Convenience header: ][^boost/asio.hpp] 126474 126475 126476[endsect] 126477 126478 126479 126480[section:this_coro__executor this_coro::executor] 126481 126482[indexterm1 boost_asio.indexterm.this_coro__executor..this_coro::executor] 126483Awaitable object that returns the executor of the current coroutine. 126484 126485 126486 constexpr executor_t executor; 126487 126488 126489[heading Requirements] 126490 126491['Header: ][^boost/asio/this_coro.hpp] 126492 126493['Convenience header: ][^boost/asio.hpp] 126494 126495 126496[endsect] 126497 126498 126499[section:this_coro__executor_t this_coro::executor_t] 126500 126501[indexterm1 boost_asio.indexterm.this_coro__executor_t..this_coro::executor_t] 126502 126503 126504Awaitable type that returns the executor of the current coroutine. 126505 126506 126507 struct executor_t 126508 126509 126510[heading Member Functions] 126511[table 126512 [[Name][Description]] 126513 126514 [ 126515 [[link boost_asio.reference.this_coro__executor_t.executor_t [*executor_t]] [constructor]] 126516 [] 126517 ] 126518 126519] 126520 126521[heading Requirements] 126522 126523['Header: ][^boost/asio/this_coro.hpp] 126524 126525['Convenience header: ][^boost/asio.hpp] 126526 126527 126528[section:executor_t this_coro::executor_t::executor_t] 126529 126530[indexterm2 boost_asio.indexterm.this_coro__executor_t.executor_t..executor_t..this_coro::executor_t] 126531 126532 constexpr executor_t(); 126533 126534 126535 126536[endsect] 126537 126538 126539 126540[endsect] 126541 126542[section:thread_pool thread_pool] 126543 126544[indexterm1 boost_asio.indexterm.thread_pool..thread_pool] 126545 126546 126547A simple fixed-size thread pool. 126548 126549 126550 class thread_pool : 126551 public execution_context 126552 126553 126554[heading Types] 126555[table 126556 [[Name][Description]] 126557 126558 [ 126559 126560 [[link boost_asio.reference.thread_pool__basic_executor_type [*basic_executor_type]]] 126561 [Executor implementation type used to submit functions to a thread pool. ] 126562 126563 ] 126564 126565 [ 126566 126567 [[link boost_asio.reference.thread_pool.executor_type [*executor_type]]] 126568 [Executor used to submit functions to a thread pool. ] 126569 126570 ] 126571 126572 [ 126573 126574 [[link boost_asio.reference.thread_pool.fork_event [*fork_event]]] 126575 [Fork-related event notifications. ] 126576 126577 ] 126578 126579 [ 126580 126581 [[link boost_asio.reference.thread_pool.scheduler_type [*scheduler_type]]] 126582 [Scheduler used to schedule receivers on a thread pool. ] 126583 126584 ] 126585 126586] 126587 126588[heading Member Functions] 126589[table 126590 [[Name][Description]] 126591 126592 [ 126593 [[link boost_asio.reference.thread_pool.attach [*attach]]] 126594 [Attaches the current thread to the pool. ] 126595 ] 126596 126597 [ 126598 [[link boost_asio.reference.thread_pool.executor [*executor]]] 126599 [Obtains the executor associated with the pool. ] 126600 ] 126601 126602 [ 126603 [[link boost_asio.reference.thread_pool.get_executor [*get_executor]]] 126604 [Obtains the executor associated with the pool. ] 126605 ] 126606 126607 [ 126608 [[link boost_asio.reference.thread_pool.join [*join]]] 126609 [Joins the threads. ] 126610 ] 126611 126612 [ 126613 [[link boost_asio.reference.thread_pool.notify_fork [*notify_fork]]] 126614 [Notify the execution_context of a fork-related event. ] 126615 ] 126616 126617 [ 126618 [[link boost_asio.reference.thread_pool.scheduler [*scheduler]]] 126619 [Obtains the scheduler associated with the pool. ] 126620 ] 126621 126622 [ 126623 [[link boost_asio.reference.thread_pool.stop [*stop]]] 126624 [Stops the threads. ] 126625 ] 126626 126627 [ 126628 [[link boost_asio.reference.thread_pool.thread_pool [*thread_pool]] [constructor]] 126629 [Constructs a pool with an automatically determined number of threads. 126630 [hr] 126631 Constructs a pool with a specified number of threads. ] 126632 ] 126633 126634 [ 126635 [[link boost_asio.reference.thread_pool.wait [*wait]]] 126636 [Waits for threads to complete. ] 126637 ] 126638 126639 [ 126640 [[link boost_asio.reference.thread_pool._thread_pool [*~thread_pool]] [destructor]] 126641 [Destructor. ] 126642 ] 126643 126644] 126645 126646[heading Protected Member Functions] 126647[table 126648 [[Name][Description]] 126649 126650 [ 126651 [[link boost_asio.reference.thread_pool.destroy [*destroy]]] 126652 [Destroys all services in the context. ] 126653 ] 126654 126655 [ 126656 [[link boost_asio.reference.thread_pool.shutdown [*shutdown]]] 126657 [Shuts down all services in the context. ] 126658 ] 126659 126660] 126661 126662[heading Friends] 126663[table 126664 [[Name][Description]] 126665 126666 [ 126667 [[link boost_asio.reference.thread_pool.add_service [*add_service]]] 126668 [(Deprecated: Use make_service().) Add a service object to the execution_context. ] 126669 ] 126670 126671 [ 126672 [[link boost_asio.reference.thread_pool.has_service [*has_service]]] 126673 [Determine if an execution_context contains a specified service type. ] 126674 ] 126675 126676 [ 126677 [[link boost_asio.reference.thread_pool.make_service [*make_service]]] 126678 [Creates a service object and adds it to the execution_context. ] 126679 ] 126680 126681 [ 126682 [[link boost_asio.reference.thread_pool.use_service [*use_service]]] 126683 [Obtain the service object corresponding to the given type. ] 126684 ] 126685 126686] 126687 126688The thread pool class is an execution context where functions are permitted to run on one of a fixed number of threads. 126689 126690 126691[heading Submitting tasks to the pool] 126692 126693 126694 126695To submit functions to the 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. 126696 126697For example: 126698 126699 126700 126701 void my_task() 126702 { 126703 ... 126704 } 126705 126706 ... 126707 126708 // Launch the pool with four threads. 126709 boost::asio::thread_pool pool(4); 126710 126711 // Submit a function to the pool. 126712 boost::asio::post(pool, my_task); 126713 126714 // Submit a lambda object to the pool. 126715 boost::asio::post(pool, 126716 []() 126717 { 126718 ... 126719 }); 126720 126721 // Wait for all tasks in the pool to complete. 126722 pool.join(); 126723 126724 126725 126726 126727[heading Requirements] 126728 126729['Header: ][^boost/asio/thread_pool.hpp] 126730 126731['Convenience header: ][^boost/asio.hpp] 126732 126733 126734[section:add_service thread_pool::add_service] 126735 126736 126737['Inherited from execution_context.] 126738 126739[indexterm2 boost_asio.indexterm.thread_pool.add_service..add_service..thread_pool] 126740(Deprecated: Use `make_service()`.) Add a service object to the [link boost_asio.reference.execution_context `execution_context`]. 126741 126742 126743 template< 126744 typename ``[link boost_asio.reference.Service Service]``> 126745 friend void add_service( 126746 execution_context & e, 126747 Service * svc); 126748 126749 126750This function is used to add a service to the [link boost_asio.reference.execution_context `execution_context`]. 126751 126752 126753[heading Parameters] 126754 126755 126756[variablelist 126757 126758[[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]] 126759 126760[[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: 126761`` 126762 delete static_cast<execution_context::service*>(svc) 126763`` 126764]] 126765 126766] 126767 126768 126769[heading Exceptions] 126770 126771 126772[variablelist 126773 126774[[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`].]] 126775 126776[[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. ]] 126777 126778] 126779 126780 126781 126782[heading Requirements] 126783 126784['Header: ][^boost/asio/thread_pool.hpp] 126785 126786['Convenience header: ][^boost/asio.hpp] 126787 126788 126789[endsect] 126790 126791 126792 126793[section:attach thread_pool::attach] 126794 126795[indexterm2 boost_asio.indexterm.thread_pool.attach..attach..thread_pool] 126796Attaches the current thread to the pool. 126797 126798 126799 void attach(); 126800 126801 126802This function attaches the current thread to the pool so that it may be used for executing submitted function objects. Blocks the calling thread until the pool is stopped or joined and has no outstanding work. 126803 126804 126805[endsect] 126806 126807 126808 126809[section:destroy thread_pool::destroy] 126810 126811 126812['Inherited from execution_context.] 126813 126814[indexterm2 boost_asio.indexterm.thread_pool.destroy..destroy..thread_pool] 126815Destroys all services in the context. 126816 126817 126818 void destroy(); 126819 126820 126821This function is implemented as follows: 126822 126823 126824* 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)`. 126825 126826 126827 126828 126829[endsect] 126830 126831 126832 126833[section:executor thread_pool::executor] 126834 126835[indexterm2 boost_asio.indexterm.thread_pool.executor..executor..thread_pool] 126836Obtains the executor associated with the pool. 126837 126838 126839 executor_type executor(); 126840 126841 126842 126843[endsect] 126844 126845 126846 126847[section:executor_type thread_pool::executor_type] 126848 126849[indexterm2 boost_asio.indexterm.thread_pool.executor_type..executor_type..thread_pool] 126850Executor used to submit functions to a thread pool. 126851 126852 126853 typedef basic_executor_type< std::allocator< void >, 0 > executor_type; 126854 126855 126856[heading Types] 126857[table 126858 [[Name][Description]] 126859 126860 [ 126861 126862 [[link boost_asio.reference.thread_pool__basic_executor_type.index_type [*index_type]]] 126863 [The bulk execution index type. ] 126864 126865 ] 126866 126867 [ 126868 126869 [[link boost_asio.reference.thread_pool__basic_executor_type.sender_type [*sender_type]]] 126870 [The sender type, when this type is used as a scheduler. ] 126871 126872 ] 126873 126874 [ 126875 126876 [[link boost_asio.reference.thread_pool__basic_executor_type.shape_type [*shape_type]]] 126877 [The bulk execution shape type. ] 126878 126879 ] 126880 126881] 126882 126883[heading Member Functions] 126884[table 126885 [[Name][Description]] 126886 126887 [ 126888 [[link boost_asio.reference.thread_pool__basic_executor_type.basic_executor_type [*basic_executor_type]] [constructor]] 126889 [Copy constructor. 126890 [hr] 126891 Move constructor. ] 126892 ] 126893 126894 [ 126895 [[link boost_asio.reference.thread_pool__basic_executor_type.bulk_execute [*bulk_execute]]] 126896 [Bulk execution function. ] 126897 ] 126898 126899 [ 126900 [[link boost_asio.reference.thread_pool__basic_executor_type.connect [*connect]]] 126901 [Connect function. ] 126902 ] 126903 126904 [ 126905 [[link boost_asio.reference.thread_pool__basic_executor_type.context [*context]]] 126906 [Obtain the underlying execution context. ] 126907 ] 126908 126909 [ 126910 [[link boost_asio.reference.thread_pool__basic_executor_type.defer [*defer]]] 126911 [Request the thread pool to invoke the given function object. ] 126912 ] 126913 126914 [ 126915 [[link boost_asio.reference.thread_pool__basic_executor_type.dispatch [*dispatch]]] 126916 [Request the thread pool to invoke the given function object. ] 126917 ] 126918 126919 [ 126920 [[link boost_asio.reference.thread_pool__basic_executor_type.execute [*execute]]] 126921 [Execution function. ] 126922 ] 126923 126924 [ 126925 [[link boost_asio.reference.thread_pool__basic_executor_type.on_work_finished [*on_work_finished]]] 126926 [Inform the thread pool that some work is no longer outstanding. ] 126927 ] 126928 126929 [ 126930 [[link boost_asio.reference.thread_pool__basic_executor_type.on_work_started [*on_work_started]]] 126931 [Inform the thread pool that it has some outstanding work to do. ] 126932 ] 126933 126934 [ 126935 [[link boost_asio.reference.thread_pool__basic_executor_type.operator_eq_ [*operator=]]] 126936 [Assignment operator. 126937 [hr] 126938 Move assignment operator. ] 126939 ] 126940 126941 [ 126942 [[link boost_asio.reference.thread_pool__basic_executor_type.post [*post]]] 126943 [Request the thread pool to invoke the given function object. ] 126944 ] 126945 126946 [ 126947 [[link boost_asio.reference.thread_pool__basic_executor_type.query [*query]]] 126948 [Query the current value of the context property. 126949 [hr] 126950 Query the current value of the blocking property. 126951 [hr] 126952 Query the current value of the relationship property. 126953 [hr] 126954 Query the current value of the allocator property. 126955 [hr] 126956 Query the occupancy (recommended number of work items) for the pool. ] 126957 ] 126958 126959 [ 126960 [[link boost_asio.reference.thread_pool__basic_executor_type.query__static [*query]] [static]] 126961 [Query the current value of the bulk_guarantee property. 126962 [hr] 126963 Query the current value of the mapping property. 126964 [hr] 126965 Query the current value of the outstanding_work property. ] 126966 ] 126967 126968 [ 126969 [[link boost_asio.reference.thread_pool__basic_executor_type.require [*require]]] 126970 [Obtain an executor with the blocking.possibly property. 126971 [hr] 126972 Obtain an executor with the blocking.always property. 126973 [hr] 126974 Obtain an executor with the blocking.never property. 126975 [hr] 126976 Obtain an executor with the relationship.fork property. 126977 [hr] 126978 Obtain an executor with the relationship.continuation property. 126979 [hr] 126980 Obtain an executor with the outstanding_work.tracked property. 126981 [hr] 126982 Obtain an executor with the outstanding_work.untracked property. 126983 [hr] 126984 Obtain an executor with the specified allocator property. 126985 [hr] 126986 Obtain an executor with the default allocator property. ] 126987 ] 126988 126989 [ 126990 [[link boost_asio.reference.thread_pool__basic_executor_type.running_in_this_thread [*running_in_this_thread]]] 126991 [Determine whether the thread pool is running in the current thread. ] 126992 ] 126993 126994 [ 126995 [[link boost_asio.reference.thread_pool__basic_executor_type.schedule [*schedule]]] 126996 [Schedule function. ] 126997 ] 126998 126999 [ 127000 [[link boost_asio.reference.thread_pool__basic_executor_type._basic_executor_type [*~basic_executor_type]] [destructor]] 127001 [Destructor. ] 127002 ] 127003 127004] 127005 127006[heading Friends] 127007[table 127008 [[Name][Description]] 127009 127010 [ 127011 [[link boost_asio.reference.thread_pool__basic_executor_type.operator_not__eq_ [*operator!=]]] 127012 [Compare two executors for inequality. ] 127013 ] 127014 127015 [ 127016 [[link boost_asio.reference.thread_pool__basic_executor_type.operator_eq__eq_ [*operator==]]] 127017 [Compare two executors for equality. ] 127018 ] 127019 127020] 127021 127022 127023[heading Requirements] 127024 127025['Header: ][^boost/asio/thread_pool.hpp] 127026 127027['Convenience header: ][^boost/asio.hpp] 127028 127029 127030[endsect] 127031 127032 127033 127034[section:fork_event thread_pool::fork_event] 127035 127036 127037['Inherited from execution_context.] 127038 127039[indexterm2 boost_asio.indexterm.thread_pool.fork_event..fork_event..thread_pool] 127040Fork-related event notifications. 127041 127042 127043 enum fork_event 127044 127045[indexterm2 boost_asio.indexterm.thread_pool.fork_event.fork_prepare..fork_prepare..thread_pool] 127046[indexterm2 boost_asio.indexterm.thread_pool.fork_event.fork_parent..fork_parent..thread_pool] 127047[indexterm2 boost_asio.indexterm.thread_pool.fork_event.fork_child..fork_child..thread_pool] 127048 127049[heading Values] 127050[variablelist 127051 127052 [ 127053 [fork_prepare] 127054 [Notify the context that the process is about to fork. ] 127055 ] 127056 127057 [ 127058 [fork_parent] 127059 [Notify the context that the process has forked and is the parent. ] 127060 ] 127061 127062 [ 127063 [fork_child] 127064 [Notify the context that the process has forked and is the child. ] 127065 ] 127066 127067] 127068 127069 127070 127071[endsect] 127072 127073 127074 127075[section:get_executor thread_pool::get_executor] 127076 127077[indexterm2 boost_asio.indexterm.thread_pool.get_executor..get_executor..thread_pool] 127078Obtains the executor associated with the pool. 127079 127080 127081 executor_type get_executor(); 127082 127083 127084 127085[endsect] 127086 127087 127088 127089[section:has_service thread_pool::has_service] 127090 127091 127092['Inherited from execution_context.] 127093 127094[indexterm2 boost_asio.indexterm.thread_pool.has_service..has_service..thread_pool] 127095Determine if an [link boost_asio.reference.execution_context `execution_context`] contains a specified service type. 127096 127097 127098 template< 127099 typename ``[link boost_asio.reference.Service Service]``> 127100 friend bool has_service( 127101 execution_context & e); 127102 127103 127104This 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. 127105 127106 127107[heading Parameters] 127108 127109 127110[variablelist 127111 127112[[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]] 127113 127114] 127115 127116 127117[heading Return Value] 127118 127119A boolean indicating whether the [link boost_asio.reference.execution_context `execution_context`] contains the service. 127120 127121 127122 127123[heading Requirements] 127124 127125['Header: ][^boost/asio/thread_pool.hpp] 127126 127127['Convenience header: ][^boost/asio.hpp] 127128 127129 127130[endsect] 127131 127132 127133 127134[section:join thread_pool::join] 127135 127136[indexterm2 boost_asio.indexterm.thread_pool.join..join..thread_pool] 127137Joins the threads. 127138 127139 127140 void join(); 127141 127142 127143This 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. 127144 127145 127146[endsect] 127147 127148 127149 127150[section:make_service thread_pool::make_service] 127151 127152 127153['Inherited from execution_context.] 127154 127155[indexterm2 boost_asio.indexterm.thread_pool.make_service..make_service..thread_pool] 127156Creates a service object and adds it to the [link boost_asio.reference.execution_context `execution_context`]. 127157 127158 127159 template< 127160 typename ``[link boost_asio.reference.Service Service]``, 127161 typename... Args> 127162 friend Service & make_service( 127163 execution_context & e, 127164 Args &&... args); 127165 127166 127167This function is used to add a service to the [link boost_asio.reference.execution_context `execution_context`]. 127168 127169 127170[heading Parameters] 127171 127172 127173[variablelist 127174 127175[[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]] 127176 127177[[args][Zero or more arguments to be passed to the service constructor.]] 127178 127179] 127180 127181 127182[heading Exceptions] 127183 127184 127185[variablelist 127186 127187[[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`]. ]] 127188 127189] 127190 127191 127192 127193[heading Requirements] 127194 127195['Header: ][^boost/asio/thread_pool.hpp] 127196 127197['Convenience header: ][^boost/asio.hpp] 127198 127199 127200[endsect] 127201 127202 127203 127204[section:notify_fork thread_pool::notify_fork] 127205 127206 127207['Inherited from execution_context.] 127208 127209[indexterm2 boost_asio.indexterm.thread_pool.notify_fork..notify_fork..thread_pool] 127210Notify the [link boost_asio.reference.execution_context `execution_context`] of a fork-related event. 127211 127212 127213 void notify_fork( 127214 fork_event event); 127215 127216 127217This 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. 127218 127219This 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. 127220 127221 127222[heading Parameters] 127223 127224 127225[variablelist 127226 127227[[event][A fork-related event.]] 127228 127229] 127230 127231 127232[heading Exceptions] 127233 127234 127235[variablelist 127236 127237[[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.]] 127238 127239] 127240 127241 127242[heading Example] 127243 127244The following code illustrates how to incorporate the `notify_fork()` function: 127245 127246 my_execution_context.notify_fork(execution_context::fork_prepare); 127247 if (fork() == 0) 127248 { 127249 // This is the child process. 127250 my_execution_context.notify_fork(execution_context::fork_child); 127251 } 127252 else 127253 { 127254 // This is the parent process. 127255 my_execution_context.notify_fork(execution_context::fork_parent); 127256 } 127257 127258 127259 127260 127261 127262[heading Remarks] 127263 127264For 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. 127265 127266 127267 127268 127269[endsect] 127270 127271 127272 127273[section:scheduler thread_pool::scheduler] 127274 127275[indexterm2 boost_asio.indexterm.thread_pool.scheduler..scheduler..thread_pool] 127276Obtains the scheduler associated with the pool. 127277 127278 127279 scheduler_type scheduler(); 127280 127281 127282 127283[endsect] 127284 127285 127286 127287[section:scheduler_type thread_pool::scheduler_type] 127288 127289[indexterm2 boost_asio.indexterm.thread_pool.scheduler_type..scheduler_type..thread_pool] 127290Scheduler used to schedule receivers on a thread pool. 127291 127292 127293 typedef basic_executor_type< std::allocator< void >, 0 > scheduler_type; 127294 127295 127296[heading Types] 127297[table 127298 [[Name][Description]] 127299 127300 [ 127301 127302 [[link boost_asio.reference.thread_pool__basic_executor_type.index_type [*index_type]]] 127303 [The bulk execution index type. ] 127304 127305 ] 127306 127307 [ 127308 127309 [[link boost_asio.reference.thread_pool__basic_executor_type.sender_type [*sender_type]]] 127310 [The sender type, when this type is used as a scheduler. ] 127311 127312 ] 127313 127314 [ 127315 127316 [[link boost_asio.reference.thread_pool__basic_executor_type.shape_type [*shape_type]]] 127317 [The bulk execution shape type. ] 127318 127319 ] 127320 127321] 127322 127323[heading Member Functions] 127324[table 127325 [[Name][Description]] 127326 127327 [ 127328 [[link boost_asio.reference.thread_pool__basic_executor_type.basic_executor_type [*basic_executor_type]] [constructor]] 127329 [Copy constructor. 127330 [hr] 127331 Move constructor. ] 127332 ] 127333 127334 [ 127335 [[link boost_asio.reference.thread_pool__basic_executor_type.bulk_execute [*bulk_execute]]] 127336 [Bulk execution function. ] 127337 ] 127338 127339 [ 127340 [[link boost_asio.reference.thread_pool__basic_executor_type.connect [*connect]]] 127341 [Connect function. ] 127342 ] 127343 127344 [ 127345 [[link boost_asio.reference.thread_pool__basic_executor_type.context [*context]]] 127346 [Obtain the underlying execution context. ] 127347 ] 127348 127349 [ 127350 [[link boost_asio.reference.thread_pool__basic_executor_type.defer [*defer]]] 127351 [Request the thread pool to invoke the given function object. ] 127352 ] 127353 127354 [ 127355 [[link boost_asio.reference.thread_pool__basic_executor_type.dispatch [*dispatch]]] 127356 [Request the thread pool to invoke the given function object. ] 127357 ] 127358 127359 [ 127360 [[link boost_asio.reference.thread_pool__basic_executor_type.execute [*execute]]] 127361 [Execution function. ] 127362 ] 127363 127364 [ 127365 [[link boost_asio.reference.thread_pool__basic_executor_type.on_work_finished [*on_work_finished]]] 127366 [Inform the thread pool that some work is no longer outstanding. ] 127367 ] 127368 127369 [ 127370 [[link boost_asio.reference.thread_pool__basic_executor_type.on_work_started [*on_work_started]]] 127371 [Inform the thread pool that it has some outstanding work to do. ] 127372 ] 127373 127374 [ 127375 [[link boost_asio.reference.thread_pool__basic_executor_type.operator_eq_ [*operator=]]] 127376 [Assignment operator. 127377 [hr] 127378 Move assignment operator. ] 127379 ] 127380 127381 [ 127382 [[link boost_asio.reference.thread_pool__basic_executor_type.post [*post]]] 127383 [Request the thread pool to invoke the given function object. ] 127384 ] 127385 127386 [ 127387 [[link boost_asio.reference.thread_pool__basic_executor_type.query [*query]]] 127388 [Query the current value of the context property. 127389 [hr] 127390 Query the current value of the blocking property. 127391 [hr] 127392 Query the current value of the relationship property. 127393 [hr] 127394 Query the current value of the allocator property. 127395 [hr] 127396 Query the occupancy (recommended number of work items) for the pool. ] 127397 ] 127398 127399 [ 127400 [[link boost_asio.reference.thread_pool__basic_executor_type.query__static [*query]] [static]] 127401 [Query the current value of the bulk_guarantee property. 127402 [hr] 127403 Query the current value of the mapping property. 127404 [hr] 127405 Query the current value of the outstanding_work property. ] 127406 ] 127407 127408 [ 127409 [[link boost_asio.reference.thread_pool__basic_executor_type.require [*require]]] 127410 [Obtain an executor with the blocking.possibly property. 127411 [hr] 127412 Obtain an executor with the blocking.always property. 127413 [hr] 127414 Obtain an executor with the blocking.never property. 127415 [hr] 127416 Obtain an executor with the relationship.fork property. 127417 [hr] 127418 Obtain an executor with the relationship.continuation property. 127419 [hr] 127420 Obtain an executor with the outstanding_work.tracked property. 127421 [hr] 127422 Obtain an executor with the outstanding_work.untracked property. 127423 [hr] 127424 Obtain an executor with the specified allocator property. 127425 [hr] 127426 Obtain an executor with the default allocator property. ] 127427 ] 127428 127429 [ 127430 [[link boost_asio.reference.thread_pool__basic_executor_type.running_in_this_thread [*running_in_this_thread]]] 127431 [Determine whether the thread pool is running in the current thread. ] 127432 ] 127433 127434 [ 127435 [[link boost_asio.reference.thread_pool__basic_executor_type.schedule [*schedule]]] 127436 [Schedule function. ] 127437 ] 127438 127439 [ 127440 [[link boost_asio.reference.thread_pool__basic_executor_type._basic_executor_type [*~basic_executor_type]] [destructor]] 127441 [Destructor. ] 127442 ] 127443 127444] 127445 127446[heading Friends] 127447[table 127448 [[Name][Description]] 127449 127450 [ 127451 [[link boost_asio.reference.thread_pool__basic_executor_type.operator_not__eq_ [*operator!=]]] 127452 [Compare two executors for inequality. ] 127453 ] 127454 127455 [ 127456 [[link boost_asio.reference.thread_pool__basic_executor_type.operator_eq__eq_ [*operator==]]] 127457 [Compare two executors for equality. ] 127458 ] 127459 127460] 127461 127462 127463[heading Requirements] 127464 127465['Header: ][^boost/asio/thread_pool.hpp] 127466 127467['Convenience header: ][^boost/asio.hpp] 127468 127469 127470[endsect] 127471 127472 127473 127474[section:shutdown thread_pool::shutdown] 127475 127476 127477['Inherited from execution_context.] 127478 127479[indexterm2 boost_asio.indexterm.thread_pool.shutdown..shutdown..thread_pool] 127480Shuts down all services in the context. 127481 127482 127483 void shutdown(); 127484 127485 127486This function is implemented as follows: 127487 127488 127489* 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()`. 127490 127491 127492 127493 127494[endsect] 127495 127496 127497 127498[section:stop thread_pool::stop] 127499 127500[indexterm2 boost_asio.indexterm.thread_pool.stop..stop..thread_pool] 127501Stops the threads. 127502 127503 127504 void stop(); 127505 127506 127507This function stops the threads as soon as possible. As a result of calling `stop()`, pending function objects may be never be invoked. 127508 127509 127510[endsect] 127511 127512 127513[section:thread_pool thread_pool::thread_pool] 127514 127515[indexterm2 boost_asio.indexterm.thread_pool.thread_pool..thread_pool..thread_pool] 127516Constructs a pool with an automatically determined number of threads. 127517 127518 127519 ``[link boost_asio.reference.thread_pool.thread_pool.overload1 thread_pool]``(); 127520 `` [''''»''' [link boost_asio.reference.thread_pool.thread_pool.overload1 more...]]`` 127521 127522 127523Constructs a pool with a specified number of threads. 127524 127525 127526 ``[link boost_asio.reference.thread_pool.thread_pool.overload2 thread_pool]``( 127527 std::size_t num_threads); 127528 `` [''''»''' [link boost_asio.reference.thread_pool.thread_pool.overload2 more...]]`` 127529 127530 127531[section:overload1 thread_pool::thread_pool (1 of 2 overloads)] 127532 127533 127534Constructs a pool with an automatically determined number of threads. 127535 127536 127537 thread_pool(); 127538 127539 127540 127541[endsect] 127542 127543 127544 127545[section:overload2 thread_pool::thread_pool (2 of 2 overloads)] 127546 127547 127548Constructs a pool with a specified number of threads. 127549 127550 127551 thread_pool( 127552 std::size_t num_threads); 127553 127554 127555 127556[endsect] 127557 127558 127559[endsect] 127560 127561[section:use_service thread_pool::use_service] 127562 127563[indexterm2 boost_asio.indexterm.thread_pool.use_service..use_service..thread_pool] 127564Obtain the service object corresponding to the given type. 127565 127566 127567 template< 127568 typename ``[link boost_asio.reference.Service Service]``> 127569 friend Service & ``[link boost_asio.reference.thread_pool.use_service.overload1 use_service]``( 127570 execution_context & e); 127571 `` [''''»''' [link boost_asio.reference.thread_pool.use_service.overload1 more...]]`` 127572 127573 template< 127574 typename ``[link boost_asio.reference.Service Service]``> 127575 friend Service & ``[link boost_asio.reference.thread_pool.use_service.overload2 use_service]``( 127576 io_context & ioc); 127577 `` [''''»''' [link boost_asio.reference.thread_pool.use_service.overload2 more...]]`` 127578 127579 127580[section:overload1 thread_pool::use_service (1 of 2 overloads)] 127581 127582 127583['Inherited from execution_context.] 127584 127585 127586Obtain the service object corresponding to the given type. 127587 127588 127589 template< 127590 typename ``[link boost_asio.reference.Service Service]``> 127591 friend Service & use_service( 127592 execution_context & e); 127593 127594 127595This 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. 127596 127597 127598[heading Parameters] 127599 127600 127601[variablelist 127602 127603[[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]] 127604 127605] 127606 127607 127608[heading Return Value] 127609 127610The service interface implementing the specified service type. Ownership of the service interface is not transferred to the caller. 127611 127612 127613 127614[heading Requirements] 127615 127616['Header: ][^boost/asio/thread_pool.hpp] 127617 127618['Convenience header: ][^boost/asio.hpp] 127619 127620 127621[endsect] 127622 127623 127624 127625[section:overload2 thread_pool::use_service (2 of 2 overloads)] 127626 127627 127628['Inherited from execution_context.] 127629 127630 127631Obtain the service object corresponding to the given type. 127632 127633 127634 template< 127635 typename ``[link boost_asio.reference.Service Service]``> 127636 friend Service & use_service( 127637 io_context & ioc); 127638 127639 127640This 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. 127641 127642 127643[heading Parameters] 127644 127645 127646[variablelist 127647 127648[[ioc][The [link boost_asio.reference.io_context `io_context`] object that owns the service.]] 127649 127650] 127651 127652 127653[heading Return Value] 127654 127655The service interface implementing the specified service type. Ownership of the service interface is not transferred to the caller. 127656 127657 127658[heading Remarks] 127659 127660This overload is preserved for backwards compatibility with services that inherit from [link boost_asio.reference.io_context__service `io_context::service`]. 127661 127662 127663 127664[heading Requirements] 127665 127666['Header: ][^boost/asio/thread_pool.hpp] 127667 127668['Convenience header: ][^boost/asio.hpp] 127669 127670 127671[endsect] 127672 127673 127674[endsect] 127675 127676 127677[section:wait thread_pool::wait] 127678 127679[indexterm2 boost_asio.indexterm.thread_pool.wait..wait..thread_pool] 127680Waits for threads to complete. 127681 127682 127683 void wait(); 127684 127685 127686This function blocks until the threads in the pool have completed. If `stop()` is not called prior to `wait()`, the `wait()` call will wait until the pool has no more outstanding work. 127687 127688 127689[endsect] 127690 127691 127692 127693[section:_thread_pool thread_pool::~thread_pool] 127694 127695[indexterm2 boost_asio.indexterm.thread_pool._thread_pool..~thread_pool..thread_pool] 127696Destructor. 127697 127698 127699 ~thread_pool(); 127700 127701 127702Automatically stops and joins the pool, if not explicitly done beforehand. 127703 127704 127705[endsect] 127706 127707 127708 127709[endsect] 127710 127711[section:thread_pool__basic_executor_type thread_pool::basic_executor_type] 127712 127713[indexterm1 boost_asio.indexterm.thread_pool__basic_executor_type..thread_pool::basic_executor_type] 127714 127715 127716Executor implementation type used to submit functions to a thread pool. 127717 127718 127719 template< 127720 typename Allocator, 127721 unsigned int Bits> 127722 class basic_executor_type 127723 127724 127725[heading Types] 127726[table 127727 [[Name][Description]] 127728 127729 [ 127730 127731 [[link boost_asio.reference.thread_pool__basic_executor_type.index_type [*index_type]]] 127732 [The bulk execution index type. ] 127733 127734 ] 127735 127736 [ 127737 127738 [[link boost_asio.reference.thread_pool__basic_executor_type.sender_type [*sender_type]]] 127739 [The sender type, when this type is used as a scheduler. ] 127740 127741 ] 127742 127743 [ 127744 127745 [[link boost_asio.reference.thread_pool__basic_executor_type.shape_type [*shape_type]]] 127746 [The bulk execution shape type. ] 127747 127748 ] 127749 127750] 127751 127752[heading Member Functions] 127753[table 127754 [[Name][Description]] 127755 127756 [ 127757 [[link boost_asio.reference.thread_pool__basic_executor_type.basic_executor_type [*basic_executor_type]] [constructor]] 127758 [Copy constructor. 127759 [hr] 127760 Move constructor. ] 127761 ] 127762 127763 [ 127764 [[link boost_asio.reference.thread_pool__basic_executor_type.bulk_execute [*bulk_execute]]] 127765 [Bulk execution function. ] 127766 ] 127767 127768 [ 127769 [[link boost_asio.reference.thread_pool__basic_executor_type.connect [*connect]]] 127770 [Connect function. ] 127771 ] 127772 127773 [ 127774 [[link boost_asio.reference.thread_pool__basic_executor_type.context [*context]]] 127775 [Obtain the underlying execution context. ] 127776 ] 127777 127778 [ 127779 [[link boost_asio.reference.thread_pool__basic_executor_type.defer [*defer]]] 127780 [Request the thread pool to invoke the given function object. ] 127781 ] 127782 127783 [ 127784 [[link boost_asio.reference.thread_pool__basic_executor_type.dispatch [*dispatch]]] 127785 [Request the thread pool to invoke the given function object. ] 127786 ] 127787 127788 [ 127789 [[link boost_asio.reference.thread_pool__basic_executor_type.execute [*execute]]] 127790 [Execution function. ] 127791 ] 127792 127793 [ 127794 [[link boost_asio.reference.thread_pool__basic_executor_type.on_work_finished [*on_work_finished]]] 127795 [Inform the thread pool that some work is no longer outstanding. ] 127796 ] 127797 127798 [ 127799 [[link boost_asio.reference.thread_pool__basic_executor_type.on_work_started [*on_work_started]]] 127800 [Inform the thread pool that it has some outstanding work to do. ] 127801 ] 127802 127803 [ 127804 [[link boost_asio.reference.thread_pool__basic_executor_type.operator_eq_ [*operator=]]] 127805 [Assignment operator. 127806 [hr] 127807 Move assignment operator. ] 127808 ] 127809 127810 [ 127811 [[link boost_asio.reference.thread_pool__basic_executor_type.post [*post]]] 127812 [Request the thread pool to invoke the given function object. ] 127813 ] 127814 127815 [ 127816 [[link boost_asio.reference.thread_pool__basic_executor_type.query [*query]]] 127817 [Query the current value of the context property. 127818 [hr] 127819 Query the current value of the blocking property. 127820 [hr] 127821 Query the current value of the relationship property. 127822 [hr] 127823 Query the current value of the allocator property. 127824 [hr] 127825 Query the occupancy (recommended number of work items) for the pool. ] 127826 ] 127827 127828 [ 127829 [[link boost_asio.reference.thread_pool__basic_executor_type.query__static [*query]] [static]] 127830 [Query the current value of the bulk_guarantee property. 127831 [hr] 127832 Query the current value of the mapping property. 127833 [hr] 127834 Query the current value of the outstanding_work property. ] 127835 ] 127836 127837 [ 127838 [[link boost_asio.reference.thread_pool__basic_executor_type.require [*require]]] 127839 [Obtain an executor with the blocking.possibly property. 127840 [hr] 127841 Obtain an executor with the blocking.always property. 127842 [hr] 127843 Obtain an executor with the blocking.never property. 127844 [hr] 127845 Obtain an executor with the relationship.fork property. 127846 [hr] 127847 Obtain an executor with the relationship.continuation property. 127848 [hr] 127849 Obtain an executor with the outstanding_work.tracked property. 127850 [hr] 127851 Obtain an executor with the outstanding_work.untracked property. 127852 [hr] 127853 Obtain an executor with the specified allocator property. 127854 [hr] 127855 Obtain an executor with the default allocator property. ] 127856 ] 127857 127858 [ 127859 [[link boost_asio.reference.thread_pool__basic_executor_type.running_in_this_thread [*running_in_this_thread]]] 127860 [Determine whether the thread pool is running in the current thread. ] 127861 ] 127862 127863 [ 127864 [[link boost_asio.reference.thread_pool__basic_executor_type.schedule [*schedule]]] 127865 [Schedule function. ] 127866 ] 127867 127868 [ 127869 [[link boost_asio.reference.thread_pool__basic_executor_type._basic_executor_type [*~basic_executor_type]] [destructor]] 127870 [Destructor. ] 127871 ] 127872 127873] 127874 127875[heading Friends] 127876[table 127877 [[Name][Description]] 127878 127879 [ 127880 [[link boost_asio.reference.thread_pool__basic_executor_type.operator_not__eq_ [*operator!=]]] 127881 [Compare two executors for inequality. ] 127882 ] 127883 127884 [ 127885 [[link boost_asio.reference.thread_pool__basic_executor_type.operator_eq__eq_ [*operator==]]] 127886 [Compare two executors for equality. ] 127887 ] 127888 127889] 127890 127891[heading Requirements] 127892 127893['Header: ][^boost/asio/thread_pool.hpp] 127894 127895['Convenience header: ][^boost/asio.hpp] 127896 127897[section:basic_executor_type thread_pool::basic_executor_type::basic_executor_type] 127898 127899[indexterm2 boost_asio.indexterm.thread_pool__basic_executor_type.basic_executor_type..basic_executor_type..thread_pool::basic_executor_type] 127900Copy constructor. 127901 127902 127903 ``[link boost_asio.reference.thread_pool__basic_executor_type.basic_executor_type.overload1 basic_executor_type]``( 127904 const basic_executor_type & other); 127905 `` [''''»''' [link boost_asio.reference.thread_pool__basic_executor_type.basic_executor_type.overload1 more...]]`` 127906 127907 127908Move constructor. 127909 127910 127911 ``[link boost_asio.reference.thread_pool__basic_executor_type.basic_executor_type.overload2 basic_executor_type]``( 127912 basic_executor_type && other); 127913 `` [''''»''' [link boost_asio.reference.thread_pool__basic_executor_type.basic_executor_type.overload2 more...]]`` 127914 127915 127916[section:overload1 thread_pool::basic_executor_type::basic_executor_type (1 of 2 overloads)] 127917 127918 127919Copy constructor. 127920 127921 127922 basic_executor_type( 127923 const basic_executor_type & other); 127924 127925 127926 127927[endsect] 127928 127929 127930 127931[section:overload2 thread_pool::basic_executor_type::basic_executor_type (2 of 2 overloads)] 127932 127933 127934Move constructor. 127935 127936 127937 basic_executor_type( 127938 basic_executor_type && other); 127939 127940 127941 127942[endsect] 127943 127944 127945[endsect] 127946 127947 127948[section:bulk_execute thread_pool::basic_executor_type::bulk_execute] 127949 127950[indexterm2 boost_asio.indexterm.thread_pool__basic_executor_type.bulk_execute..bulk_execute..thread_pool::basic_executor_type] 127951Bulk execution function. 127952 127953 127954 template< 127955 typename Function> 127956 void bulk_execute( 127957 Function && f, 127958 std::size_t n) const; 127959 127960 127961 127962[endsect] 127963 127964 127965 127966[section:connect thread_pool::basic_executor_type::connect] 127967 127968[indexterm2 boost_asio.indexterm.thread_pool__basic_executor_type.connect..connect..thread_pool::basic_executor_type] 127969Connect function. 127970 127971 127972 template< 127973 typename ``[link boost_asio.reference.Receiver Receiver]``> 127974 unspecified connect( 127975 Receiver && r) const; 127976 127977 127978Do not call this function directly. It is intended for use with the [link boost_asio.reference.execution__connect `execution::connect`] customisation point. 127979 127980 127981[heading Return Value] 127982 127983An object of an unspecified type that satisfies the `operation_state` concept. 127984 127985 127986 127987 127988[endsect] 127989 127990 127991 127992[section:context thread_pool::basic_executor_type::context] 127993 127994[indexterm2 boost_asio.indexterm.thread_pool__basic_executor_type.context..context..thread_pool::basic_executor_type] 127995Obtain the underlying execution context. 127996 127997 127998 thread_pool & context() const; 127999 128000 128001 128002[endsect] 128003 128004 128005 128006[section:defer thread_pool::basic_executor_type::defer] 128007 128008[indexterm2 boost_asio.indexterm.thread_pool__basic_executor_type.defer..defer..thread_pool::basic_executor_type] 128009Request the thread pool to invoke the given function object. 128010 128011 128012 template< 128013 typename Function, 128014 typename OtherAllocator> 128015 void defer( 128016 Function && f, 128017 const OtherAllocator & a) const; 128018 128019 128020This 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. 128021 128022If the current thread belongs to the thread pool, `defer()` will delay scheduling the function object until the current thread returns control to the pool. 128023 128024 128025[heading Parameters] 128026 128027 128028[variablelist 128029 128030[[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: 128031`` 128032 void function(); 128033`` 128034]] 128035 128036[[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]] 128037 128038] 128039 128040 128041 128042 128043[endsect] 128044 128045 128046 128047[section:dispatch thread_pool::basic_executor_type::dispatch] 128048 128049[indexterm2 boost_asio.indexterm.thread_pool__basic_executor_type.dispatch..dispatch..thread_pool::basic_executor_type] 128050Request the thread pool to invoke the given function object. 128051 128052 128053 template< 128054 typename Function, 128055 typename OtherAllocator> 128056 void dispatch( 128057 Function && f, 128058 const OtherAllocator & a) const; 128059 128060 128061This 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. 128062 128063 128064[heading Parameters] 128065 128066 128067[variablelist 128068 128069[[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: 128070`` 128071 void function(); 128072`` 128073]] 128074 128075[[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]] 128076 128077] 128078 128079 128080 128081 128082[endsect] 128083 128084 128085 128086[section:execute thread_pool::basic_executor_type::execute] 128087 128088[indexterm2 boost_asio.indexterm.thread_pool__basic_executor_type.execute..execute..thread_pool::basic_executor_type] 128089Execution function. 128090 128091 128092 template< 128093 typename Function> 128094 void execute( 128095 Function && f) const; 128096 128097 128098Do not call this function directly. It is intended for use with the [link boost_asio.reference.execution__execute `execution::execute`] customisation point. 128099 128100For example: 128101 128102 auto ex = my_thread_pool.executor(); 128103 execution::execute(ex, my_function_object); 128104 128105 128106 128107 128108 128109[endsect] 128110 128111 128112 128113[section:index_type thread_pool::basic_executor_type::index_type] 128114 128115[indexterm2 boost_asio.indexterm.thread_pool__basic_executor_type.index_type..index_type..thread_pool::basic_executor_type] 128116The bulk execution index type. 128117 128118 128119 typedef std::size_t index_type; 128120 128121 128122 128123[heading Requirements] 128124 128125['Header: ][^boost/asio/thread_pool.hpp] 128126 128127['Convenience header: ][^boost/asio.hpp] 128128 128129 128130[endsect] 128131 128132 128133 128134[section:on_work_finished thread_pool::basic_executor_type::on_work_finished] 128135 128136[indexterm2 boost_asio.indexterm.thread_pool__basic_executor_type.on_work_finished..on_work_finished..thread_pool::basic_executor_type] 128137Inform the thread pool that some work is no longer outstanding. 128138 128139 128140 void on_work_finished() const; 128141 128142 128143This 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. 128144 128145 128146[endsect] 128147 128148 128149 128150[section:on_work_started thread_pool::basic_executor_type::on_work_started] 128151 128152[indexterm2 boost_asio.indexterm.thread_pool__basic_executor_type.on_work_started..on_work_started..thread_pool::basic_executor_type] 128153Inform the thread pool that it has some outstanding work to do. 128154 128155 128156 void on_work_started() const; 128157 128158 128159This 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. 128160 128161 128162[endsect] 128163 128164 128165 128166[section:operator_not__eq_ thread_pool::basic_executor_type::operator!=] 128167 128168[indexterm2 boost_asio.indexterm.thread_pool__basic_executor_type.operator_not__eq_..operator!=..thread_pool::basic_executor_type] 128169Compare two executors for inequality. 128170 128171 128172 friend bool operator!=( 128173 const basic_executor_type & a, 128174 const basic_executor_type & b); 128175 128176 128177Two executors are equal if they refer to the same underlying thread pool. 128178 128179[heading Requirements] 128180 128181['Header: ][^boost/asio/thread_pool.hpp] 128182 128183['Convenience header: ][^boost/asio.hpp] 128184 128185 128186[endsect] 128187 128188 128189[section:operator_eq_ thread_pool::basic_executor_type::operator=] 128190 128191[indexterm2 boost_asio.indexterm.thread_pool__basic_executor_type.operator_eq_..operator=..thread_pool::basic_executor_type] 128192Assignment operator. 128193 128194 128195 basic_executor_type & ``[link boost_asio.reference.thread_pool__basic_executor_type.operator_eq_.overload1 operator=]``( 128196 const basic_executor_type & other); 128197 `` [''''»''' [link boost_asio.reference.thread_pool__basic_executor_type.operator_eq_.overload1 more...]]`` 128198 128199 128200Move assignment operator. 128201 128202 128203 basic_executor_type & ``[link boost_asio.reference.thread_pool__basic_executor_type.operator_eq_.overload2 operator=]``( 128204 basic_executor_type && other); 128205 `` [''''»''' [link boost_asio.reference.thread_pool__basic_executor_type.operator_eq_.overload2 more...]]`` 128206 128207 128208[section:overload1 thread_pool::basic_executor_type::operator= (1 of 2 overloads)] 128209 128210 128211Assignment operator. 128212 128213 128214 basic_executor_type & operator=( 128215 const basic_executor_type & other); 128216 128217 128218 128219[endsect] 128220 128221 128222 128223[section:overload2 thread_pool::basic_executor_type::operator= (2 of 2 overloads)] 128224 128225 128226Move assignment operator. 128227 128228 128229 basic_executor_type & operator=( 128230 basic_executor_type && other); 128231 128232 128233 128234[endsect] 128235 128236 128237[endsect] 128238 128239 128240[section:operator_eq__eq_ thread_pool::basic_executor_type::operator==] 128241 128242[indexterm2 boost_asio.indexterm.thread_pool__basic_executor_type.operator_eq__eq_..operator==..thread_pool::basic_executor_type] 128243Compare two executors for equality. 128244 128245 128246 friend bool operator==( 128247 const basic_executor_type & a, 128248 const basic_executor_type & b); 128249 128250 128251Two executors are equal if they refer to the same underlying thread pool. 128252 128253[heading Requirements] 128254 128255['Header: ][^boost/asio/thread_pool.hpp] 128256 128257['Convenience header: ][^boost/asio.hpp] 128258 128259 128260[endsect] 128261 128262 128263 128264[section:post thread_pool::basic_executor_type::post] 128265 128266[indexterm2 boost_asio.indexterm.thread_pool__basic_executor_type.post..post..thread_pool::basic_executor_type] 128267Request the thread pool to invoke the given function object. 128268 128269 128270 template< 128271 typename Function, 128272 typename OtherAllocator> 128273 void post( 128274 Function && f, 128275 const OtherAllocator & a) const; 128276 128277 128278This 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. 128279 128280 128281[heading Parameters] 128282 128283 128284[variablelist 128285 128286[[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: 128287`` 128288 void function(); 128289`` 128290]] 128291 128292[[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]] 128293 128294] 128295 128296 128297 128298 128299[endsect] 128300 128301 128302[section:query thread_pool::basic_executor_type::query] 128303 128304[indexterm2 boost_asio.indexterm.thread_pool__basic_executor_type.query..query..thread_pool::basic_executor_type] 128305Query the current value of the `context` property. 128306 128307 128308 thread_pool & ``[link boost_asio.reference.thread_pool__basic_executor_type.query.overload1 query]``( 128309 execution::context_t ) const; 128310 `` [''''»''' [link boost_asio.reference.thread_pool__basic_executor_type.query.overload1 more...]]`` 128311 128312 128313Query the current value of the `blocking` property. 128314 128315 128316 constexpr execution::blocking_t ``[link boost_asio.reference.thread_pool__basic_executor_type.query.overload2 query]``( 128317 execution::blocking_t ) const; 128318 `` [''''»''' [link boost_asio.reference.thread_pool__basic_executor_type.query.overload2 more...]]`` 128319 128320 128321Query the current value of the `relationship` property. 128322 128323 128324 constexpr execution::relationship_t ``[link boost_asio.reference.thread_pool__basic_executor_type.query.overload3 query]``( 128325 execution::relationship_t ) const; 128326 `` [''''»''' [link boost_asio.reference.thread_pool__basic_executor_type.query.overload3 more...]]`` 128327 128328 128329Query the current value of the `allocator` property. 128330 128331 128332 template< 128333 typename OtherAllocator> 128334 constexpr Allocator ``[link boost_asio.reference.thread_pool__basic_executor_type.query.overload4 query]``( 128335 execution::allocator_t< OtherAllocator > ) const; 128336 `` [''''»''' [link boost_asio.reference.thread_pool__basic_executor_type.query.overload4 more...]]`` 128337 128338 constexpr Allocator ``[link boost_asio.reference.thread_pool__basic_executor_type.query.overload5 query]``( 128339 execution::allocator_t< void > ) const; 128340 `` [''''»''' [link boost_asio.reference.thread_pool__basic_executor_type.query.overload5 more...]]`` 128341 128342 128343Query the occupancy (recommended number of work items) for the pool. 128344 128345 128346 std::size_t ``[link boost_asio.reference.thread_pool__basic_executor_type.query.overload6 query]``( 128347 execution::occupancy_t ) const; 128348 `` [''''»''' [link boost_asio.reference.thread_pool__basic_executor_type.query.overload6 more...]]`` 128349 128350 128351[section:overload1 thread_pool::basic_executor_type::query (1 of 6 overloads)] 128352 128353 128354Query the current value of the `context` property. 128355 128356 128357 thread_pool & query( 128358 execution::context_t ) const; 128359 128360 128361Do not call this function directly. It is intended for use with the [link boost_asio.reference.query `query`] customisation point. 128362 128363For example: 128364 128365 auto ex = my_thread_pool.executor(); 128366 boost::asio::thread_pool& pool = boost::asio::query( 128367 ex, boost::asio::execution::context); 128368 128369 128370 128371 128372 128373[endsect] 128374 128375 128376 128377[section:overload2 thread_pool::basic_executor_type::query (2 of 6 overloads)] 128378 128379 128380Query the current value of the `blocking` property. 128381 128382 128383 constexpr execution::blocking_t query( 128384 execution::blocking_t ) const; 128385 128386 128387Do not call this function directly. It is intended for use with the [link boost_asio.reference.query `query`] customisation point. 128388 128389For example: 128390 128391 auto ex = my_thread_pool.executor(); 128392 if (boost::asio::query(ex, boost::asio::execution::blocking) 128393 == boost::asio::execution::blocking.always) 128394 ... 128395 128396 128397 128398 128399 128400[endsect] 128401 128402 128403 128404[section:overload3 thread_pool::basic_executor_type::query (3 of 6 overloads)] 128405 128406 128407Query the current value of the `relationship` property. 128408 128409 128410 constexpr execution::relationship_t query( 128411 execution::relationship_t ) const; 128412 128413 128414Do not call this function directly. It is intended for use with the [link boost_asio.reference.query `query`] customisation point. 128415 128416For example: 128417 128418 auto ex = my_thread_pool.executor(); 128419 if (boost::asio::query(ex, boost::asio::execution::relationship) 128420 == boost::asio::execution::relationship.continuation) 128421 ... 128422 128423 128424 128425 128426 128427[endsect] 128428 128429 128430 128431[section:overload4 thread_pool::basic_executor_type::query (4 of 6 overloads)] 128432 128433 128434Query the current value of the `allocator` property. 128435 128436 128437 template< 128438 typename OtherAllocator> 128439 constexpr Allocator query( 128440 execution::allocator_t< OtherAllocator > ) const; 128441 128442 128443Do not call this function directly. It is intended for use with the [link boost_asio.reference.query `query`] customisation point. 128444 128445For example: 128446 128447 auto ex = my_thread_pool.executor(); 128448 auto alloc = boost::asio::query(ex, 128449 boost::asio::execution::allocator); 128450 128451 128452 128453 128454 128455[endsect] 128456 128457 128458 128459[section:overload5 thread_pool::basic_executor_type::query (5 of 6 overloads)] 128460 128461 128462Query the current value of the `allocator` property. 128463 128464 128465 constexpr Allocator query( 128466 execution::allocator_t< void > ) const; 128467 128468 128469Do not call this function directly. It is intended for use with the [link boost_asio.reference.query `query`] customisation point. 128470 128471For example: 128472 128473 auto ex = my_thread_pool.executor(); 128474 auto alloc = boost::asio::query(ex, 128475 boost::asio::execution::allocator); 128476 128477 128478 128479 128480 128481[endsect] 128482 128483 128484 128485[section:overload6 thread_pool::basic_executor_type::query (6 of 6 overloads)] 128486 128487 128488Query the occupancy (recommended number of work items) for the pool. 128489 128490 128491 std::size_t query( 128492 execution::occupancy_t ) const; 128493 128494 128495Do not call this function directly. It is intended for use with the [link boost_asio.reference.query `query`] customisation point. 128496 128497For example: 128498 128499 auto ex = my_thread_pool.executor(); 128500 std::size_t occupancy = boost::asio::query( 128501 ex, boost::asio::execution::occupancy); 128502 128503 128504 128505 128506 128507[endsect] 128508 128509 128510[endsect] 128511 128512[section:query__static thread_pool::basic_executor_type::query] 128513 128514[indexterm2 boost_asio.indexterm.thread_pool__basic_executor_type.query__static..query..thread_pool::basic_executor_type] 128515Query the current value of the `bulk_guarantee` property. 128516 128517 128518 static constexpr execution::bulk_guarantee_t ``[link boost_asio.reference.thread_pool__basic_executor_type.query__static.overload1 query]``( 128519 execution::bulk_guarantee_t ); 128520 `` [''''»''' [link boost_asio.reference.thread_pool__basic_executor_type.query__static.overload1 more...]]`` 128521 128522 128523Query the current value of the `mapping` property. 128524 128525 128526 static constexpr execution::mapping_t ``[link boost_asio.reference.thread_pool__basic_executor_type.query__static.overload2 query]``( 128527 execution::mapping_t ); 128528 `` [''''»''' [link boost_asio.reference.thread_pool__basic_executor_type.query__static.overload2 more...]]`` 128529 128530 128531Query the current value of the `outstanding_work` property. 128532 128533 128534 static constexpr execution::outstanding_work_t ``[link boost_asio.reference.thread_pool__basic_executor_type.query__static.overload3 query]``( 128535 execution::outstanding_work_t ); 128536 `` [''''»''' [link boost_asio.reference.thread_pool__basic_executor_type.query__static.overload3 more...]]`` 128537 128538 128539[section:overload1 thread_pool::basic_executor_type::query (1 of 3 overloads)] 128540 128541 128542Query the current value of the `bulk_guarantee` property. 128543 128544 128545 static constexpr execution::bulk_guarantee_t query( 128546 execution::bulk_guarantee_t ); 128547 128548 128549Do not call this function directly. It is intended for use with the [link boost_asio.reference.query `query`] customisation point. 128550 128551For example: 128552 128553 auto ex = my_thread_pool.executor(); 128554 if (boost::asio::query(ex, boost::asio::execution::bulk_guarantee) 128555 == boost::asio::execution::bulk_guarantee.parallel) 128556 ... 128557 128558 128559 128560 128561 128562[endsect] 128563 128564 128565 128566[section:overload2 thread_pool::basic_executor_type::query (2 of 3 overloads)] 128567 128568 128569Query the current value of the `mapping` property. 128570 128571 128572 static constexpr execution::mapping_t query( 128573 execution::mapping_t ); 128574 128575 128576Do not call this function directly. It is intended for use with the [link boost_asio.reference.query `query`] customisation point. 128577 128578For example: 128579 128580 auto ex = my_thread_pool.executor(); 128581 if (boost::asio::query(ex, boost::asio::execution::mapping) 128582 == boost::asio::execution::mapping.thread) 128583 ... 128584 128585 128586 128587 128588 128589[endsect] 128590 128591 128592 128593[section:overload3 thread_pool::basic_executor_type::query (3 of 3 overloads)] 128594 128595 128596Query the current value of the `outstanding_work` property. 128597 128598 128599 static constexpr execution::outstanding_work_t query( 128600 execution::outstanding_work_t ); 128601 128602 128603Do not call this function directly. It is intended for use with the [link boost_asio.reference.query `query`] customisation point. 128604 128605For example: 128606 128607 auto ex = my_thread_pool.executor(); 128608 if (boost::asio::query(ex, boost::asio::execution::outstanding_work) 128609 == boost::asio::execution::outstanding_work.tracked) 128610 ... 128611 128612 128613 128614 128615 128616[endsect] 128617 128618 128619[endsect] 128620 128621[section:require thread_pool::basic_executor_type::require] 128622 128623[indexterm2 boost_asio.indexterm.thread_pool__basic_executor_type.require..require..thread_pool::basic_executor_type] 128624Obtain an executor with the `blocking.possibly` property. 128625 128626 128627 constexpr basic_executor_type< Allocator, unspecified > ``[link boost_asio.reference.thread_pool__basic_executor_type.require.overload1 require]``( 128628 execution::blocking_t::possibly_t ) const; 128629 `` [''''»''' [link boost_asio.reference.thread_pool__basic_executor_type.require.overload1 more...]]`` 128630 128631 128632Obtain an executor with the `blocking.always` property. 128633 128634 128635 constexpr basic_executor_type< Allocator, unspecified > ``[link boost_asio.reference.thread_pool__basic_executor_type.require.overload2 require]``( 128636 execution::blocking_t::always_t ) const; 128637 `` [''''»''' [link boost_asio.reference.thread_pool__basic_executor_type.require.overload2 more...]]`` 128638 128639 128640Obtain an executor with the `blocking.never` property. 128641 128642 128643 constexpr basic_executor_type< Allocator, unspecified > ``[link boost_asio.reference.thread_pool__basic_executor_type.require.overload3 require]``( 128644 execution::blocking_t::never_t ) const; 128645 `` [''''»''' [link boost_asio.reference.thread_pool__basic_executor_type.require.overload3 more...]]`` 128646 128647 128648Obtain an executor with the `relationship.fork` property. 128649 128650 128651 constexpr basic_executor_type ``[link boost_asio.reference.thread_pool__basic_executor_type.require.overload4 require]``( 128652 execution::relationship_t::fork_t ) const; 128653 `` [''''»''' [link boost_asio.reference.thread_pool__basic_executor_type.require.overload4 more...]]`` 128654 128655 128656Obtain an executor with the `relationship.continuation` property. 128657 128658 128659 constexpr basic_executor_type ``[link boost_asio.reference.thread_pool__basic_executor_type.require.overload5 require]``( 128660 execution::relationship_t::continuation_t ) const; 128661 `` [''''»''' [link boost_asio.reference.thread_pool__basic_executor_type.require.overload5 more...]]`` 128662 128663 128664Obtain an executor with the `outstanding_work.tracked` property. 128665 128666 128667 constexpr basic_executor_type< Allocator, unspecified > ``[link boost_asio.reference.thread_pool__basic_executor_type.require.overload6 require]``( 128668 execution::outstanding_work_t::tracked_t ) const; 128669 `` [''''»''' [link boost_asio.reference.thread_pool__basic_executor_type.require.overload6 more...]]`` 128670 128671 128672Obtain an executor with the `outstanding_work.untracked` property. 128673 128674 128675 constexpr basic_executor_type< Allocator, unspecified > ``[link boost_asio.reference.thread_pool__basic_executor_type.require.overload7 require]``( 128676 execution::outstanding_work_t::untracked_t ) const; 128677 `` [''''»''' [link boost_asio.reference.thread_pool__basic_executor_type.require.overload7 more...]]`` 128678 128679 128680Obtain an executor with the specified `allocator` property. 128681 128682 128683 template< 128684 typename OtherAllocator> 128685 constexpr basic_executor_type< OtherAllocator, Bits > ``[link boost_asio.reference.thread_pool__basic_executor_type.require.overload8 require]``( 128686 execution::allocator_t< OtherAllocator > a) const; 128687 `` [''''»''' [link boost_asio.reference.thread_pool__basic_executor_type.require.overload8 more...]]`` 128688 128689 128690Obtain an executor with the default `allocator` property. 128691 128692 128693 constexpr basic_executor_type< std::allocator< void >, Bits > ``[link boost_asio.reference.thread_pool__basic_executor_type.require.overload9 require]``( 128694 execution::allocator_t< void > ) const; 128695 `` [''''»''' [link boost_asio.reference.thread_pool__basic_executor_type.require.overload9 more...]]`` 128696 128697 128698[section:overload1 thread_pool::basic_executor_type::require (1 of 9 overloads)] 128699 128700 128701Obtain an executor with the `blocking.possibly` property. 128702 128703 128704 constexpr basic_executor_type< Allocator, unspecified > require( 128705 execution::blocking_t::possibly_t ) const; 128706 128707 128708Do not call this function directly. It is intended for use with the [link boost_asio.reference.require `require`] customisation point. 128709 128710For example: 128711 128712 auto ex1 = my_thread_pool.executor(); 128713 auto ex2 = boost::asio::require(ex1, 128714 boost::asio::execution::blocking.possibly); 128715 128716 128717 128718 128719 128720[endsect] 128721 128722 128723 128724[section:overload2 thread_pool::basic_executor_type::require (2 of 9 overloads)] 128725 128726 128727Obtain an executor with the `blocking.always` property. 128728 128729 128730 constexpr basic_executor_type< Allocator, unspecified > require( 128731 execution::blocking_t::always_t ) const; 128732 128733 128734Do not call this function directly. It is intended for use with the [link boost_asio.reference.require `require`] customisation point. 128735 128736For example: 128737 128738 auto ex1 = my_thread_pool.executor(); 128739 auto ex2 = boost::asio::require(ex1, 128740 boost::asio::execution::blocking.always); 128741 128742 128743 128744 128745 128746[endsect] 128747 128748 128749 128750[section:overload3 thread_pool::basic_executor_type::require (3 of 9 overloads)] 128751 128752 128753Obtain an executor with the `blocking.never` property. 128754 128755 128756 constexpr basic_executor_type< Allocator, unspecified > require( 128757 execution::blocking_t::never_t ) const; 128758 128759 128760Do not call this function directly. It is intended for use with the [link boost_asio.reference.require `require`] customisation point. 128761 128762For example: 128763 128764 auto ex1 = my_thread_pool.executor(); 128765 auto ex2 = boost::asio::require(ex1, 128766 boost::asio::execution::blocking.never); 128767 128768 128769 128770 128771 128772[endsect] 128773 128774 128775 128776[section:overload4 thread_pool::basic_executor_type::require (4 of 9 overloads)] 128777 128778 128779Obtain an executor with the `relationship.fork` property. 128780 128781 128782 constexpr basic_executor_type require( 128783 execution::relationship_t::fork_t ) const; 128784 128785 128786Do not call this function directly. It is intended for use with the [link boost_asio.reference.require `require`] customisation point. 128787 128788For example: 128789 128790 auto ex1 = my_thread_pool.executor(); 128791 auto ex2 = boost::asio::require(ex1, 128792 boost::asio::execution::relationship.fork); 128793 128794 128795 128796 128797 128798[endsect] 128799 128800 128801 128802[section:overload5 thread_pool::basic_executor_type::require (5 of 9 overloads)] 128803 128804 128805Obtain an executor with the `relationship.continuation` property. 128806 128807 128808 constexpr basic_executor_type require( 128809 execution::relationship_t::continuation_t ) const; 128810 128811 128812Do not call this function directly. It is intended for use with the [link boost_asio.reference.require `require`] customisation point. 128813 128814For example: 128815 128816 auto ex1 = my_thread_pool.executor(); 128817 auto ex2 = boost::asio::require(ex1, 128818 boost::asio::execution::relationship.continuation); 128819 128820 128821 128822 128823 128824[endsect] 128825 128826 128827 128828[section:overload6 thread_pool::basic_executor_type::require (6 of 9 overloads)] 128829 128830 128831Obtain an executor with the `outstanding_work.tracked` property. 128832 128833 128834 constexpr basic_executor_type< Allocator, unspecified > require( 128835 execution::outstanding_work_t::tracked_t ) const; 128836 128837 128838Do not call this function directly. It is intended for use with the [link boost_asio.reference.require `require`] customisation point. 128839 128840For example: 128841 128842 auto ex1 = my_thread_pool.executor(); 128843 auto ex2 = boost::asio::require(ex1, 128844 boost::asio::execution::outstanding_work.tracked); 128845 128846 128847 128848 128849 128850[endsect] 128851 128852 128853 128854[section:overload7 thread_pool::basic_executor_type::require (7 of 9 overloads)] 128855 128856 128857Obtain an executor with the `outstanding_work.untracked` property. 128858 128859 128860 constexpr basic_executor_type< Allocator, unspecified > require( 128861 execution::outstanding_work_t::untracked_t ) const; 128862 128863 128864Do not call this function directly. It is intended for use with the [link boost_asio.reference.require `require`] customisation point. 128865 128866For example: 128867 128868 auto ex1 = my_thread_pool.executor(); 128869 auto ex2 = boost::asio::require(ex1, 128870 boost::asio::execution::outstanding_work.untracked); 128871 128872 128873 128874 128875 128876[endsect] 128877 128878 128879 128880[section:overload8 thread_pool::basic_executor_type::require (8 of 9 overloads)] 128881 128882 128883Obtain an executor with the specified `allocator` property. 128884 128885 128886 template< 128887 typename OtherAllocator> 128888 constexpr basic_executor_type< OtherAllocator, Bits > require( 128889 execution::allocator_t< OtherAllocator > a) const; 128890 128891 128892Do not call this function directly. It is intended for use with the [link boost_asio.reference.require `require`] customisation point. 128893 128894For example: 128895 128896 auto ex1 = my_thread_pool.executor(); 128897 auto ex2 = boost::asio::require(ex1, 128898 boost::asio::execution::allocator(my_allocator)); 128899 128900 128901 128902 128903 128904[endsect] 128905 128906 128907 128908[section:overload9 thread_pool::basic_executor_type::require (9 of 9 overloads)] 128909 128910 128911Obtain an executor with the default `allocator` property. 128912 128913 128914 constexpr basic_executor_type< std::allocator< void >, Bits > require( 128915 execution::allocator_t< void > ) const; 128916 128917 128918Do not call this function directly. It is intended for use with the [link boost_asio.reference.require `require`] customisation point. 128919 128920For example: 128921 128922 auto ex1 = my_thread_pool.executor(); 128923 auto ex2 = boost::asio::require(ex1, 128924 boost::asio::execution::allocator); 128925 128926 128927 128928 128929 128930[endsect] 128931 128932 128933[endsect] 128934 128935 128936[section:running_in_this_thread thread_pool::basic_executor_type::running_in_this_thread] 128937 128938[indexterm2 boost_asio.indexterm.thread_pool__basic_executor_type.running_in_this_thread..running_in_this_thread..thread_pool::basic_executor_type] 128939Determine whether the thread pool is running in the current thread. 128940 128941 128942 bool running_in_this_thread() const; 128943 128944 128945 128946[heading Return Value] 128947 128948`true` if the current thread is running the thread pool. Otherwise returns `false`. 128949 128950 128951 128952 128953[endsect] 128954 128955 128956 128957[section:schedule thread_pool::basic_executor_type::schedule] 128958 128959[indexterm2 boost_asio.indexterm.thread_pool__basic_executor_type.schedule..schedule..thread_pool::basic_executor_type] 128960Schedule function. 128961 128962 128963 sender_type schedule() const; 128964 128965 128966Do not call this function directly. It is intended for use with the [link boost_asio.reference.execution__schedule `execution::schedule`] customisation point. 128967 128968 128969[heading Return Value] 128970 128971An object that satisfies the sender concept. 128972 128973 128974 128975 128976[endsect] 128977 128978 128979 128980[section:sender_type thread_pool::basic_executor_type::sender_type] 128981 128982[indexterm2 boost_asio.indexterm.thread_pool__basic_executor_type.sender_type..sender_type..thread_pool::basic_executor_type] 128983The sender type, when this type is used as a scheduler. 128984 128985 128986 typedef basic_executor_type sender_type; 128987 128988 128989[heading Types] 128990[table 128991 [[Name][Description]] 128992 128993 [ 128994 128995 [[link boost_asio.reference.thread_pool__basic_executor_type.index_type [*index_type]]] 128996 [The bulk execution index type. ] 128997 128998 ] 128999 129000 [ 129001 129002 [[link boost_asio.reference.thread_pool__basic_executor_type.sender_type [*sender_type]]] 129003 [The sender type, when this type is used as a scheduler. ] 129004 129005 ] 129006 129007 [ 129008 129009 [[link boost_asio.reference.thread_pool__basic_executor_type.shape_type [*shape_type]]] 129010 [The bulk execution shape type. ] 129011 129012 ] 129013 129014] 129015 129016[heading Member Functions] 129017[table 129018 [[Name][Description]] 129019 129020 [ 129021 [[link boost_asio.reference.thread_pool__basic_executor_type.basic_executor_type [*basic_executor_type]] [constructor]] 129022 [Copy constructor. 129023 [hr] 129024 Move constructor. ] 129025 ] 129026 129027 [ 129028 [[link boost_asio.reference.thread_pool__basic_executor_type.bulk_execute [*bulk_execute]]] 129029 [Bulk execution function. ] 129030 ] 129031 129032 [ 129033 [[link boost_asio.reference.thread_pool__basic_executor_type.connect [*connect]]] 129034 [Connect function. ] 129035 ] 129036 129037 [ 129038 [[link boost_asio.reference.thread_pool__basic_executor_type.context [*context]]] 129039 [Obtain the underlying execution context. ] 129040 ] 129041 129042 [ 129043 [[link boost_asio.reference.thread_pool__basic_executor_type.defer [*defer]]] 129044 [Request the thread pool to invoke the given function object. ] 129045 ] 129046 129047 [ 129048 [[link boost_asio.reference.thread_pool__basic_executor_type.dispatch [*dispatch]]] 129049 [Request the thread pool to invoke the given function object. ] 129050 ] 129051 129052 [ 129053 [[link boost_asio.reference.thread_pool__basic_executor_type.execute [*execute]]] 129054 [Execution function. ] 129055 ] 129056 129057 [ 129058 [[link boost_asio.reference.thread_pool__basic_executor_type.on_work_finished [*on_work_finished]]] 129059 [Inform the thread pool that some work is no longer outstanding. ] 129060 ] 129061 129062 [ 129063 [[link boost_asio.reference.thread_pool__basic_executor_type.on_work_started [*on_work_started]]] 129064 [Inform the thread pool that it has some outstanding work to do. ] 129065 ] 129066 129067 [ 129068 [[link boost_asio.reference.thread_pool__basic_executor_type.operator_eq_ [*operator=]]] 129069 [Assignment operator. 129070 [hr] 129071 Move assignment operator. ] 129072 ] 129073 129074 [ 129075 [[link boost_asio.reference.thread_pool__basic_executor_type.post [*post]]] 129076 [Request the thread pool to invoke the given function object. ] 129077 ] 129078 129079 [ 129080 [[link boost_asio.reference.thread_pool__basic_executor_type.query [*query]]] 129081 [Query the current value of the context property. 129082 [hr] 129083 Query the current value of the blocking property. 129084 [hr] 129085 Query the current value of the relationship property. 129086 [hr] 129087 Query the current value of the allocator property. 129088 [hr] 129089 Query the occupancy (recommended number of work items) for the pool. ] 129090 ] 129091 129092 [ 129093 [[link boost_asio.reference.thread_pool__basic_executor_type.query__static [*query]] [static]] 129094 [Query the current value of the bulk_guarantee property. 129095 [hr] 129096 Query the current value of the mapping property. 129097 [hr] 129098 Query the current value of the outstanding_work property. ] 129099 ] 129100 129101 [ 129102 [[link boost_asio.reference.thread_pool__basic_executor_type.require [*require]]] 129103 [Obtain an executor with the blocking.possibly property. 129104 [hr] 129105 Obtain an executor with the blocking.always property. 129106 [hr] 129107 Obtain an executor with the blocking.never property. 129108 [hr] 129109 Obtain an executor with the relationship.fork property. 129110 [hr] 129111 Obtain an executor with the relationship.continuation property. 129112 [hr] 129113 Obtain an executor with the outstanding_work.tracked property. 129114 [hr] 129115 Obtain an executor with the outstanding_work.untracked property. 129116 [hr] 129117 Obtain an executor with the specified allocator property. 129118 [hr] 129119 Obtain an executor with the default allocator property. ] 129120 ] 129121 129122 [ 129123 [[link boost_asio.reference.thread_pool__basic_executor_type.running_in_this_thread [*running_in_this_thread]]] 129124 [Determine whether the thread pool is running in the current thread. ] 129125 ] 129126 129127 [ 129128 [[link boost_asio.reference.thread_pool__basic_executor_type.schedule [*schedule]]] 129129 [Schedule function. ] 129130 ] 129131 129132 [ 129133 [[link boost_asio.reference.thread_pool__basic_executor_type._basic_executor_type [*~basic_executor_type]] [destructor]] 129134 [Destructor. ] 129135 ] 129136 129137] 129138 129139[heading Friends] 129140[table 129141 [[Name][Description]] 129142 129143 [ 129144 [[link boost_asio.reference.thread_pool__basic_executor_type.operator_not__eq_ [*operator!=]]] 129145 [Compare two executors for inequality. ] 129146 ] 129147 129148 [ 129149 [[link boost_asio.reference.thread_pool__basic_executor_type.operator_eq__eq_ [*operator==]]] 129150 [Compare two executors for equality. ] 129151 ] 129152 129153] 129154 129155 129156[heading Requirements] 129157 129158['Header: ][^boost/asio/thread_pool.hpp] 129159 129160['Convenience header: ][^boost/asio.hpp] 129161 129162 129163[endsect] 129164 129165 129166 129167[section:shape_type thread_pool::basic_executor_type::shape_type] 129168 129169[indexterm2 boost_asio.indexterm.thread_pool__basic_executor_type.shape_type..shape_type..thread_pool::basic_executor_type] 129170The bulk execution shape type. 129171 129172 129173 typedef std::size_t shape_type; 129174 129175 129176 129177[heading Requirements] 129178 129179['Header: ][^boost/asio/thread_pool.hpp] 129180 129181['Convenience header: ][^boost/asio.hpp] 129182 129183 129184[endsect] 129185 129186 129187 129188[section:_basic_executor_type thread_pool::basic_executor_type::~basic_executor_type] 129189 129190[indexterm2 boost_asio.indexterm.thread_pool__basic_executor_type._basic_executor_type..~basic_executor_type..thread_pool::basic_executor_type] 129191Destructor. 129192 129193 129194 ~basic_executor_type(); 129195 129196 129197 129198[endsect] 129199 129200 129201 129202[endsect] 129203 129204[section:time_traits_lt__ptime__gt_ time_traits< boost::posix_time::ptime >] 129205 129206[indexterm1 boost_asio.indexterm.time_traits_lt__ptime__gt_..time_traits< boost::posix_time::ptime >] 129207 129208 129209Time traits specialised for posix\_time. 129210 129211 129212 template<> 129213 struct time_traits< boost::posix_time::ptime > 129214 129215 129216[heading Types] 129217[table 129218 [[Name][Description]] 129219 129220 [ 129221 129222 [[link boost_asio.reference.time_traits_lt__ptime__gt_.duration_type [*duration_type]]] 129223 [The duration type. ] 129224 129225 ] 129226 129227 [ 129228 129229 [[link boost_asio.reference.time_traits_lt__ptime__gt_.time_type [*time_type]]] 129230 [The time type. ] 129231 129232 ] 129233 129234] 129235 129236[heading Member Functions] 129237[table 129238 [[Name][Description]] 129239 129240 [ 129241 [[link boost_asio.reference.time_traits_lt__ptime__gt_.add [*add]] [static]] 129242 [Add a duration to a time. ] 129243 ] 129244 129245 [ 129246 [[link boost_asio.reference.time_traits_lt__ptime__gt_.less_than [*less_than]] [static]] 129247 [Test whether one time is less than another. ] 129248 ] 129249 129250 [ 129251 [[link boost_asio.reference.time_traits_lt__ptime__gt_.now [*now]] [static]] 129252 [Get the current time. ] 129253 ] 129254 129255 [ 129256 [[link boost_asio.reference.time_traits_lt__ptime__gt_.subtract [*subtract]] [static]] 129257 [Subtract one time from another. ] 129258 ] 129259 129260 [ 129261 [[link boost_asio.reference.time_traits_lt__ptime__gt_.to_posix_duration [*to_posix_duration]] [static]] 129262 [Convert to POSIX duration type. ] 129263 ] 129264 129265] 129266 129267[heading Requirements] 129268 129269['Header: ][^boost/asio/time_traits.hpp] 129270 129271['Convenience header: ][^boost/asio.hpp] 129272 129273 129274[section:add time_traits< boost::posix_time::ptime >::add] 129275 129276[indexterm2 boost_asio.indexterm.time_traits_lt__ptime__gt_.add..add..time_traits< boost::posix_time::ptime >] 129277Add a duration to a time. 129278 129279 129280 static time_type add( 129281 const time_type & t, 129282 const duration_type & d); 129283 129284 129285 129286[endsect] 129287 129288 129289 129290[section:duration_type time_traits< boost::posix_time::ptime >::duration_type] 129291 129292[indexterm2 boost_asio.indexterm.time_traits_lt__ptime__gt_.duration_type..duration_type..time_traits< boost::posix_time::ptime >] 129293The duration type. 129294 129295 129296 typedef boost::posix_time::time_duration duration_type; 129297 129298 129299 129300[heading Requirements] 129301 129302['Header: ][^boost/asio/time_traits.hpp] 129303 129304['Convenience header: ][^boost/asio.hpp] 129305 129306 129307[endsect] 129308 129309 129310 129311[section:less_than time_traits< boost::posix_time::ptime >::less_than] 129312 129313[indexterm2 boost_asio.indexterm.time_traits_lt__ptime__gt_.less_than..less_than..time_traits< boost::posix_time::ptime >] 129314Test whether one time is less than another. 129315 129316 129317 static bool less_than( 129318 const time_type & t1, 129319 const time_type & t2); 129320 129321 129322 129323[endsect] 129324 129325 129326 129327[section:now time_traits< boost::posix_time::ptime >::now] 129328 129329[indexterm2 boost_asio.indexterm.time_traits_lt__ptime__gt_.now..now..time_traits< boost::posix_time::ptime >] 129330Get the current time. 129331 129332 129333 static time_type now(); 129334 129335 129336 129337[endsect] 129338 129339 129340 129341[section:subtract time_traits< boost::posix_time::ptime >::subtract] 129342 129343[indexterm2 boost_asio.indexterm.time_traits_lt__ptime__gt_.subtract..subtract..time_traits< boost::posix_time::ptime >] 129344Subtract one time from another. 129345 129346 129347 static duration_type subtract( 129348 const time_type & t1, 129349 const time_type & t2); 129350 129351 129352 129353[endsect] 129354 129355 129356 129357[section:time_type time_traits< boost::posix_time::ptime >::time_type] 129358 129359[indexterm2 boost_asio.indexterm.time_traits_lt__ptime__gt_.time_type..time_type..time_traits< boost::posix_time::ptime >] 129360The time type. 129361 129362 129363 typedef boost::posix_time::ptime time_type; 129364 129365 129366 129367[heading Requirements] 129368 129369['Header: ][^boost/asio/time_traits.hpp] 129370 129371['Convenience header: ][^boost/asio.hpp] 129372 129373 129374[endsect] 129375 129376 129377 129378[section:to_posix_duration time_traits< boost::posix_time::ptime >::to_posix_duration] 129379 129380[indexterm2 boost_asio.indexterm.time_traits_lt__ptime__gt_.to_posix_duration..to_posix_duration..time_traits< boost::posix_time::ptime >] 129381Convert to POSIX duration type. 129382 129383 129384 static boost::posix_time::time_duration to_posix_duration( 129385 const duration_type & d); 129386 129387 129388 129389[endsect] 129390 129391 129392 129393[endsect] 129394 129395 129396[section:transfer_all transfer_all] 129397 129398[indexterm1 boost_asio.indexterm.transfer_all..transfer_all] 129399Return 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. 129400 129401 129402 unspecified transfer_all(); 129403 129404 129405This function is used to create an object, of unspecified type, that meets CompletionCondition requirements. 129406 129407 129408[heading Example] 129409 129410Reading until a buffer is full: 129411 129412 boost::array<char, 128> buf; 129413 boost::system::error_code ec; 129414 std::size_t n = boost::asio::read( 129415 sock, boost::asio::buffer(buf), 129416 boost::asio::transfer_all(), ec); 129417 if (ec) 129418 { 129419 // An error occurred. 129420 } 129421 else 129422 { 129423 // n == 128 129424 } 129425 129426 129427 129428 129429 129430 129431[heading Requirements] 129432 129433['Header: ][^boost/asio/completion_condition.hpp] 129434 129435['Convenience header: ][^boost/asio.hpp] 129436 129437 129438[endsect] 129439 129440 129441 129442[section:transfer_at_least transfer_at_least] 129443 129444[indexterm1 boost_asio.indexterm.transfer_at_least..transfer_at_least] 129445Return 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. 129446 129447 129448 unspecified transfer_at_least( 129449 std::size_t minimum); 129450 129451 129452This function is used to create an object, of unspecified type, that meets CompletionCondition requirements. 129453 129454 129455[heading Example] 129456 129457Reading until a buffer is full or contains at least 64 bytes: 129458 129459 boost::array<char, 128> buf; 129460 boost::system::error_code ec; 129461 std::size_t n = boost::asio::read( 129462 sock, boost::asio::buffer(buf), 129463 boost::asio::transfer_at_least(64), ec); 129464 if (ec) 129465 { 129466 // An error occurred. 129467 } 129468 else 129469 { 129470 // n >= 64 && n <= 128 129471 } 129472 129473 129474 129475 129476 129477 129478[heading Requirements] 129479 129480['Header: ][^boost/asio/completion_condition.hpp] 129481 129482['Convenience header: ][^boost/asio.hpp] 129483 129484 129485[endsect] 129486 129487 129488 129489[section:transfer_exactly transfer_exactly] 129490 129491[indexterm1 boost_asio.indexterm.transfer_exactly..transfer_exactly] 129492Return 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. 129493 129494 129495 unspecified transfer_exactly( 129496 std::size_t size); 129497 129498 129499This function is used to create an object, of unspecified type, that meets CompletionCondition requirements. 129500 129501 129502[heading Example] 129503 129504Reading until a buffer is full or contains exactly 64 bytes: 129505 129506 boost::array<char, 128> buf; 129507 boost::system::error_code ec; 129508 std::size_t n = boost::asio::read( 129509 sock, boost::asio::buffer(buf), 129510 boost::asio::transfer_exactly(64), ec); 129511 if (ec) 129512 { 129513 // An error occurred. 129514 } 129515 else 129516 { 129517 // n == 64 129518 } 129519 129520 129521 129522 129523 129524 129525[heading Requirements] 129526 129527['Header: ][^boost/asio/completion_condition.hpp] 129528 129529['Convenience header: ][^boost/asio.hpp] 129530 129531 129532[endsect] 129533 129534 129535 129536[section:use_awaitable use_awaitable] 129537 129538[indexterm1 boost_asio.indexterm.use_awaitable..use_awaitable] 129539A completion token object that represents the currently executing coroutine. 129540 129541 129542 constexpr use_awaitable_t use_awaitable; 129543 129544 129545See the documentation for [link boost_asio.reference.use_awaitable_t `use_awaitable_t`] for a usage example. 129546 129547[heading Requirements] 129548 129549['Header: ][^boost/asio/use_awaitable.hpp] 129550 129551['Convenience header: ][^boost/asio.hpp] 129552 129553 129554[endsect] 129555 129556 129557[section:use_awaitable_t use_awaitable_t] 129558 129559[indexterm1 boost_asio.indexterm.use_awaitable_t..use_awaitable_t] 129560 129561 129562A completion token that represents the currently executing coroutine. 129563 129564 129565 template< 129566 typename ``[link boost_asio.reference.Executor1 Executor]`` = any_io_executor> 129567 struct use_awaitable_t 129568 129569 129570[heading Types] 129571[table 129572 [[Name][Description]] 129573 129574 [ 129575 129576 [[link boost_asio.reference.use_awaitable_t__executor_with_default [*executor_with_default]]] 129577 [Adapts an executor to add the use_awaitable_t completion token as the default. ] 129578 129579 ] 129580 129581] 129582 129583[heading Member Functions] 129584[table 129585 [[Name][Description]] 129586 129587 [ 129588 [[link boost_asio.reference.use_awaitable_t.as_default_on [*as_default_on]] [static]] 129589 [Function helper to adapt an I/O object to use use_awaitable_t as its default completion token type. ] 129590 ] 129591 129592 [ 129593 [[link boost_asio.reference.use_awaitable_t.use_awaitable_t [*use_awaitable_t]] [constructor]] 129594 [Default constructor. 129595 [hr] 129596 Constructor used to specify file name, line, and function name. ] 129597 ] 129598 129599] 129600 129601The `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: 129602 129603 129604 129605 awaitable<void> my_coroutine() 129606 { 129607 std::size_t n = co_await my_socket.async_read_some(buffer, use_awaitable); 129608 ... 129609 } 129610 129611 129612 129613 129614When 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. 129615 129616[heading Requirements] 129617 129618['Header: ][^boost/asio/use_awaitable.hpp] 129619 129620['Convenience header: ][^boost/asio.hpp] 129621 129622 129623[section:as_default_on use_awaitable_t::as_default_on] 129624 129625[indexterm2 boost_asio.indexterm.use_awaitable_t.as_default_on..as_default_on..use_awaitable_t] 129626Function helper to adapt an I/O object to use `use_awaitable_t` as its default completion token type. 129627 129628 129629 template< 129630 typename T> 129631 static decay< T >::type::template rebind_executor< executor_with_default< typename decay< T >::type::executor_type > >::other as_default_on( 129632 T && object); 129633 129634 129635 129636[endsect] 129637 129638 129639[section:use_awaitable_t use_awaitable_t::use_awaitable_t] 129640 129641[indexterm2 boost_asio.indexterm.use_awaitable_t.use_awaitable_t..use_awaitable_t..use_awaitable_t] 129642Default constructor. 129643 129644 129645 constexpr ``[link boost_asio.reference.use_awaitable_t.use_awaitable_t.overload1 use_awaitable_t]``(); 129646 `` [''''»''' [link boost_asio.reference.use_awaitable_t.use_awaitable_t.overload1 more...]]`` 129647 129648 129649Constructor used to specify file name, line, and function name. 129650 129651 129652 constexpr ``[link boost_asio.reference.use_awaitable_t.use_awaitable_t.overload2 use_awaitable_t]``( 129653 const char * file_name, 129654 int line, 129655 const char * function_name); 129656 `` [''''»''' [link boost_asio.reference.use_awaitable_t.use_awaitable_t.overload2 more...]]`` 129657 129658 129659[section:overload1 use_awaitable_t::use_awaitable_t (1 of 2 overloads)] 129660 129661 129662Default constructor. 129663 129664 129665 constexpr use_awaitable_t(); 129666 129667 129668 129669[endsect] 129670 129671 129672 129673[section:overload2 use_awaitable_t::use_awaitable_t (2 of 2 overloads)] 129674 129675 129676Constructor used to specify file name, line, and function name. 129677 129678 129679 constexpr use_awaitable_t( 129680 const char * file_name, 129681 int line, 129682 const char * function_name); 129683 129684 129685 129686[endsect] 129687 129688 129689[endsect] 129690 129691 129692[endsect] 129693 129694[section:use_awaitable_t__executor_with_default use_awaitable_t::executor_with_default] 129695 129696[indexterm1 boost_asio.indexterm.use_awaitable_t__executor_with_default..use_awaitable_t::executor_with_default] 129697 129698 129699Adapts an executor to add the `use_awaitable_t` completion token as the default. 129700 129701 129702 template< 129703 typename ``[link boost_asio.reference.Executor1 InnerExecutor]``> 129704 struct executor_with_default 129705 129706 129707[heading Types] 129708[table 129709 [[Name][Description]] 129710 129711 [ 129712 129713 [[link boost_asio.reference.use_awaitable_t__executor_with_default.default_completion_token_type [*default_completion_token_type]]] 129714 [Specify use_awaitable_t as the default completion token type. ] 129715 129716 ] 129717 129718] 129719 129720[heading Member Functions] 129721[table 129722 [[Name][Description]] 129723 129724 [ 129725 [[link boost_asio.reference.use_awaitable_t__executor_with_default.executor_with_default [*executor_with_default]] [constructor]] 129726 [Construct the adapted executor from the inner executor type. 129727 [hr] 129728 Convert the specified executor to the inner executor type, then use that to construct the adapted executor. ] 129729 ] 129730 129731] 129732 129733[heading Requirements] 129734 129735['Header: ][^boost/asio/use_awaitable.hpp] 129736 129737['Convenience header: ][^boost/asio.hpp] 129738 129739 129740[section:default_completion_token_type use_awaitable_t::executor_with_default::default_completion_token_type] 129741 129742[indexterm2 boost_asio.indexterm.use_awaitable_t__executor_with_default.default_completion_token_type..default_completion_token_type..use_awaitable_t::executor_with_default] 129743Specify `use_awaitable_t` as the default completion token type. 129744 129745 129746 typedef use_awaitable_t default_completion_token_type; 129747 129748 129749[heading Types] 129750[table 129751 [[Name][Description]] 129752 129753 [ 129754 129755 [[link boost_asio.reference.use_awaitable_t__executor_with_default [*executor_with_default]]] 129756 [Adapts an executor to add the use_awaitable_t completion token as the default. ] 129757 129758 ] 129759 129760] 129761 129762[heading Member Functions] 129763[table 129764 [[Name][Description]] 129765 129766 [ 129767 [[link boost_asio.reference.use_awaitable_t.as_default_on [*as_default_on]] [static]] 129768 [Function helper to adapt an I/O object to use use_awaitable_t as its default completion token type. ] 129769 ] 129770 129771 [ 129772 [[link boost_asio.reference.use_awaitable_t.use_awaitable_t [*use_awaitable_t]] [constructor]] 129773 [Default constructor. 129774 [hr] 129775 Constructor used to specify file name, line, and function name. ] 129776 ] 129777 129778] 129779 129780The `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: 129781 129782 129783 129784 awaitable<void> my_coroutine() 129785 { 129786 std::size_t n = co_await my_socket.async_read_some(buffer, use_awaitable); 129787 ... 129788 } 129789 129790 129791 129792 129793When 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. 129794 129795 129796[heading Requirements] 129797 129798['Header: ][^boost/asio/use_awaitable.hpp] 129799 129800['Convenience header: ][^boost/asio.hpp] 129801 129802 129803[endsect] 129804 129805 129806[section:executor_with_default use_awaitable_t::executor_with_default::executor_with_default] 129807 129808[indexterm2 boost_asio.indexterm.use_awaitable_t__executor_with_default.executor_with_default..executor_with_default..use_awaitable_t::executor_with_default] 129809Construct the adapted executor from the inner executor type. 129810 129811 129812 ``[link boost_asio.reference.use_awaitable_t__executor_with_default.executor_with_default.overload1 executor_with_default]``( 129813 const InnerExecutor & ex); 129814 `` [''''»''' [link boost_asio.reference.use_awaitable_t__executor_with_default.executor_with_default.overload1 more...]]`` 129815 129816 129817Convert the specified executor to the inner executor type, then use that to construct the adapted executor. 129818 129819 129820 template< 129821 typename ``[link boost_asio.reference.Executor1 OtherExecutor]``> 129822 ``[link boost_asio.reference.use_awaitable_t__executor_with_default.executor_with_default.overload2 executor_with_default]``( 129823 const OtherExecutor & ex, 129824 typename constraint< is_convertible< OtherExecutor, InnerExecutor >::value >::type = 0); 129825 `` [''''»''' [link boost_asio.reference.use_awaitable_t__executor_with_default.executor_with_default.overload2 more...]]`` 129826 129827 129828[section:overload1 use_awaitable_t::executor_with_default::executor_with_default (1 of 2 overloads)] 129829 129830 129831Construct the adapted executor from the inner executor type. 129832 129833 129834 executor_with_default( 129835 const InnerExecutor & ex); 129836 129837 129838 129839[endsect] 129840 129841 129842 129843[section:overload2 use_awaitable_t::executor_with_default::executor_with_default (2 of 2 overloads)] 129844 129845 129846Convert the specified executor to the inner executor type, then use that to construct the adapted executor. 129847 129848 129849 template< 129850 typename ``[link boost_asio.reference.Executor1 OtherExecutor]``> 129851 executor_with_default( 129852 const OtherExecutor & ex, 129853 typename constraint< is_convertible< OtherExecutor, InnerExecutor >::value >::type = 0); 129854 129855 129856 129857[endsect] 129858 129859 129860[endsect] 129861 129862 129863[endsect] 129864 129865 129866[section:use_future use_future] 129867 129868[indexterm1 boost_asio.indexterm.use_future..use_future] 129869A special value, similar to std::nothrow. 129870 129871 129872 constexpr use_future_t use_future; 129873 129874 129875See the documentation for [link boost_asio.reference.use_future_t `use_future_t`] for a usage example. 129876 129877[heading Requirements] 129878 129879['Header: ][^boost/asio/use_future.hpp] 129880 129881['Convenience header: ][^boost/asio.hpp] 129882 129883 129884[endsect] 129885 129886 129887[section:use_future_t use_future_t] 129888 129889[indexterm1 boost_asio.indexterm.use_future_t..use_future_t] 129890 129891 129892Class used to specify that an asynchronous operation should return a future. 129893 129894 129895 template< 129896 typename Allocator = std::allocator<void>> 129897 class use_future_t 129898 129899 129900[heading Types] 129901[table 129902 [[Name][Description]] 129903 129904 [ 129905 129906 [[link boost_asio.reference.use_future_t.allocator_type [*allocator_type]]] 129907 [The allocator type. The allocator is used when constructing the std::promise object for a given asynchronous operation. ] 129908 129909 ] 129910 129911] 129912 129913[heading Member Functions] 129914[table 129915 [[Name][Description]] 129916 129917 [ 129918 [[link boost_asio.reference.use_future_t.get_allocator [*get_allocator]]] 129919 [Obtain allocator. ] 129920 ] 129921 129922 [ 129923 [[link boost_asio.reference.use_future_t.operator_lp__rp_ [*operator()]]] 129924 [Wrap a function object in a packaged task. ] 129925 ] 129926 129927 [ 129928 [[link boost_asio.reference.use_future_t.operator_lb__rb_ [*operator\[\]]]] 129929 [(Deprecated: Use rebind().) Specify an alternate allocator. ] 129930 ] 129931 129932 [ 129933 [[link boost_asio.reference.use_future_t.rebind [*rebind]]] 129934 [Specify an alternate allocator. ] 129935 ] 129936 129937 [ 129938 [[link boost_asio.reference.use_future_t.use_future_t [*use_future_t]] [constructor]] 129939 [Construct using default-constructed allocator. 129940 [hr] 129941 Construct using specified allocator. ] 129942 ] 129943 129944] 129945 129946The [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: 129947 129948 129949 129950 std::future<std::size_t> my_future 129951 = my_socket.async_read_some(my_buffer, boost::asio::use_future); 129952 129953 129954 129955 129956The 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. 129957 129958[heading Requirements] 129959 129960['Header: ][^boost/asio/use_future.hpp] 129961 129962['Convenience header: ][^boost/asio.hpp] 129963 129964 129965[section:allocator_type use_future_t::allocator_type] 129966 129967[indexterm2 boost_asio.indexterm.use_future_t.allocator_type..allocator_type..use_future_t] 129968The allocator type. The allocator is used when constructing the `std::promise` object for a given asynchronous operation. 129969 129970 129971 typedef Allocator allocator_type; 129972 129973 129974 129975[heading Requirements] 129976 129977['Header: ][^boost/asio/use_future.hpp] 129978 129979['Convenience header: ][^boost/asio.hpp] 129980 129981 129982[endsect] 129983 129984 129985 129986[section:get_allocator use_future_t::get_allocator] 129987 129988[indexterm2 boost_asio.indexterm.use_future_t.get_allocator..get_allocator..use_future_t] 129989Obtain allocator. 129990 129991 129992 allocator_type get_allocator() const; 129993 129994 129995 129996[endsect] 129997 129998 129999 130000[section:operator_lp__rp_ use_future_t::operator()] 130001 130002[indexterm2 boost_asio.indexterm.use_future_t.operator_lp__rp_..operator()..use_future_t] 130003Wrap a function object in a packaged task. 130004 130005 130006 template< 130007 typename Function> 130008 unspecified operator()( 130009 Function && f) const; 130010 130011 130012The `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. 130013 130014 130015[heading Example] 130016 130017 130018 130019 130020 130021 std::future<std::size_t> fut = 130022 my_socket.async_read_some(buffer, 130023 use_future([](boost::system::error_code ec, std::size_t n) 130024 { 130025 return ec ? 0 : n; 130026 })); 130027 ... 130028 std::size_t n = fut.get(); 130029 130030 130031 130032 130033 130034[endsect] 130035 130036 130037 130038[section:operator_lb__rb_ use_future_t::operator\[\]] 130039 130040[indexterm2 boost_asio.indexterm.use_future_t.operator_lb__rb_..operator\[\]..use_future_t] 130041(Deprecated: Use `rebind()`.) Specify an alternate allocator. 130042 130043 130044 template< 130045 typename OtherAllocator> 130046 use_future_t< OtherAllocator > operator[]( 130047 const OtherAllocator & allocator) const; 130048 130049 130050 130051[endsect] 130052 130053 130054 130055[section:rebind use_future_t::rebind] 130056 130057[indexterm2 boost_asio.indexterm.use_future_t.rebind..rebind..use_future_t] 130058Specify an alternate allocator. 130059 130060 130061 template< 130062 typename OtherAllocator> 130063 use_future_t< OtherAllocator > rebind( 130064 const OtherAllocator & allocator) const; 130065 130066 130067 130068[endsect] 130069 130070 130071[section:use_future_t use_future_t::use_future_t] 130072 130073[indexterm2 boost_asio.indexterm.use_future_t.use_future_t..use_future_t..use_future_t] 130074Construct using default-constructed allocator. 130075 130076 130077 constexpr ``[link boost_asio.reference.use_future_t.use_future_t.overload1 use_future_t]``(); 130078 `` [''''»''' [link boost_asio.reference.use_future_t.use_future_t.overload1 more...]]`` 130079 130080 130081Construct using specified allocator. 130082 130083 130084 explicit ``[link boost_asio.reference.use_future_t.use_future_t.overload2 use_future_t]``( 130085 const Allocator & allocator); 130086 `` [''''»''' [link boost_asio.reference.use_future_t.use_future_t.overload2 more...]]`` 130087 130088 130089[section:overload1 use_future_t::use_future_t (1 of 2 overloads)] 130090 130091 130092Construct using default-constructed allocator. 130093 130094 130095 constexpr use_future_t(); 130096 130097 130098 130099[endsect] 130100 130101 130102 130103[section:overload2 use_future_t::use_future_t (2 of 2 overloads)] 130104 130105 130106Construct using specified allocator. 130107 130108 130109 use_future_t( 130110 const Allocator & allocator); 130111 130112 130113 130114[endsect] 130115 130116 130117[endsect] 130118 130119 130120[endsect] 130121 130122[section:uses_executor uses_executor] 130123 130124[indexterm1 boost_asio.indexterm.uses_executor..uses_executor] 130125 130126 130127The [link boost_asio.reference.uses_executor `uses_executor`] trait detects whether a type T has an associated executor that is convertible from type Executor. 130128 130129 130130 template< 130131 typename T, 130132 typename ``[link boost_asio.reference.Executor1 Executor]``> 130133 struct uses_executor : 130134 public false_type 130135 130136 130137Meets 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. 130138 130139[heading Requirements] 130140 130141['Header: ][^boost/asio/uses_executor.hpp] 130142 130143['Convenience header: ][^boost/asio.hpp] 130144 130145 130146[endsect] 130147 130148[section:wait_traits wait_traits] 130149 130150[indexterm1 boost_asio.indexterm.wait_traits..wait_traits] 130151 130152 130153Wait traits suitable for use with the [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] class template. 130154 130155 130156 template< 130157 typename Clock> 130158 struct wait_traits 130159 130160 130161[heading Member Functions] 130162[table 130163 [[Name][Description]] 130164 130165 [ 130166 [[link boost_asio.reference.wait_traits.to_wait_duration [*to_wait_duration]] [static]] 130167 [Convert a clock duration into a duration used for waiting. ] 130168 ] 130169 130170] 130171 130172[heading Requirements] 130173 130174['Header: ][^boost/asio/wait_traits.hpp] 130175 130176['Convenience header: ][^boost/asio.hpp] 130177 130178[section:to_wait_duration wait_traits::to_wait_duration] 130179 130180[indexterm2 boost_asio.indexterm.wait_traits.to_wait_duration..to_wait_duration..wait_traits] 130181Convert a clock duration into a duration used for waiting. 130182 130183 130184 static Clock::duration ``[link boost_asio.reference.wait_traits.to_wait_duration.overload1 to_wait_duration]``( 130185 const typename Clock::duration & d); 130186 `` [''''»''' [link boost_asio.reference.wait_traits.to_wait_duration.overload1 more...]]`` 130187 130188 static Clock::duration ``[link boost_asio.reference.wait_traits.to_wait_duration.overload2 to_wait_duration]``( 130189 const typename Clock::time_point & t); 130190 `` [''''»''' [link boost_asio.reference.wait_traits.to_wait_duration.overload2 more...]]`` 130191 130192 130193[section:overload1 wait_traits::to_wait_duration (1 of 2 overloads)] 130194 130195 130196Convert a clock duration into a duration used for waiting. 130197 130198 130199 static Clock::duration to_wait_duration( 130200 const typename Clock::duration & d); 130201 130202 130203 130204[heading Return Value] 130205 130206`d`. 130207 130208 130209 130210 130211[endsect] 130212 130213 130214 130215[section:overload2 wait_traits::to_wait_duration (2 of 2 overloads)] 130216 130217 130218Convert a clock duration into a duration used for waiting. 130219 130220 130221 static Clock::duration to_wait_duration( 130222 const typename Clock::time_point & t); 130223 130224 130225 130226[heading Return Value] 130227 130228`d`. 130229 130230 130231 130232 130233[endsect] 130234 130235 130236[endsect] 130237 130238 130239[endsect] 130240 130241[section:windows__basic_object_handle windows::basic_object_handle] 130242 130243[indexterm1 boost_asio.indexterm.windows__basic_object_handle..windows::basic_object_handle] 130244 130245 130246Provides object-oriented handle functionality. 130247 130248 130249 template< 130250 typename ``[link boost_asio.reference.Executor1 Executor]`` = any_io_executor> 130251 class basic_object_handle 130252 130253 130254[heading Types] 130255[table 130256 [[Name][Description]] 130257 130258 [ 130259 130260 [[link boost_asio.reference.windows__basic_object_handle__rebind_executor [*rebind_executor]]] 130261 [Rebinds the handle type to another executor. ] 130262 130263 ] 130264 130265 [ 130266 130267 [[link boost_asio.reference.windows__basic_object_handle.executor_type [*executor_type]]] 130268 [The type of the executor associated with the object. ] 130269 130270 ] 130271 130272 [ 130273 130274 [[link boost_asio.reference.windows__basic_object_handle.lowest_layer_type [*lowest_layer_type]]] 130275 [An object handle is always the lowest layer. ] 130276 130277 ] 130278 130279 [ 130280 130281 [[link boost_asio.reference.windows__basic_object_handle.native_handle_type [*native_handle_type]]] 130282 [The native representation of a handle. ] 130283 130284 ] 130285 130286] 130287 130288[heading Member Functions] 130289[table 130290 [[Name][Description]] 130291 130292 [ 130293 [[link boost_asio.reference.windows__basic_object_handle.assign [*assign]]] 130294 [Assign an existing native handle to the handle. ] 130295 ] 130296 130297 [ 130298 [[link boost_asio.reference.windows__basic_object_handle.async_wait [*async_wait]]] 130299 [Start an asynchronous wait on the object handle. ] 130300 ] 130301 130302 [ 130303 [[link boost_asio.reference.windows__basic_object_handle.basic_object_handle [*basic_object_handle]] [constructor]] 130304 [Construct an object handle without opening it. 130305 [hr] 130306 Construct an object handle on an existing native handle. 130307 [hr] 130308 Move-construct an object handle from another. ] 130309 ] 130310 130311 [ 130312 [[link boost_asio.reference.windows__basic_object_handle.cancel [*cancel]]] 130313 [Cancel all asynchronous operations associated with the handle. ] 130314 ] 130315 130316 [ 130317 [[link boost_asio.reference.windows__basic_object_handle.close [*close]]] 130318 [Close the handle. ] 130319 ] 130320 130321 [ 130322 [[link boost_asio.reference.windows__basic_object_handle.get_executor [*get_executor]]] 130323 [Get the executor associated with the object. ] 130324 ] 130325 130326 [ 130327 [[link boost_asio.reference.windows__basic_object_handle.is_open [*is_open]]] 130328 [Determine whether the handle is open. ] 130329 ] 130330 130331 [ 130332 [[link boost_asio.reference.windows__basic_object_handle.lowest_layer [*lowest_layer]]] 130333 [Get a reference to the lowest layer. 130334 [hr] 130335 Get a const reference to the lowest layer. ] 130336 ] 130337 130338 [ 130339 [[link boost_asio.reference.windows__basic_object_handle.native_handle [*native_handle]]] 130340 [Get the native handle representation. ] 130341 ] 130342 130343 [ 130344 [[link boost_asio.reference.windows__basic_object_handle.operator_eq_ [*operator=]]] 130345 [Move-assign an object handle from another. ] 130346 ] 130347 130348 [ 130349 [[link boost_asio.reference.windows__basic_object_handle.wait [*wait]]] 130350 [Perform a blocking wait on the object handle. ] 130351 ] 130352 130353] 130354 130355The [link boost_asio.reference.windows__basic_object_handle `windows::basic_object_handle`] class provides asynchronous and blocking object-oriented handle functionality. 130356 130357 130358[heading Thread Safety] 130359 130360['Distinct] ['objects:] Safe. 130361 130362['Shared] ['objects:] Unsafe. 130363 130364 130365 130366[heading Requirements] 130367 130368['Header: ][^boost/asio/windows/basic_object_handle.hpp] 130369 130370['Convenience header: ][^boost/asio.hpp] 130371 130372[section:assign windows::basic_object_handle::assign] 130373 130374[indexterm2 boost_asio.indexterm.windows__basic_object_handle.assign..assign..windows::basic_object_handle] 130375Assign an existing native handle to the handle. 130376 130377 130378 void ``[link boost_asio.reference.windows__basic_object_handle.assign.overload1 assign]``( 130379 const native_handle_type & handle); 130380 `` [''''»''' [link boost_asio.reference.windows__basic_object_handle.assign.overload1 more...]]`` 130381 130382 void ``[link boost_asio.reference.windows__basic_object_handle.assign.overload2 assign]``( 130383 const native_handle_type & handle, 130384 boost::system::error_code & ec); 130385 `` [''''»''' [link boost_asio.reference.windows__basic_object_handle.assign.overload2 more...]]`` 130386 130387 130388[section:overload1 windows::basic_object_handle::assign (1 of 2 overloads)] 130389 130390 130391Assign an existing native handle to the handle. 130392 130393 130394 void assign( 130395 const native_handle_type & handle); 130396 130397 130398 130399[endsect] 130400 130401 130402 130403[section:overload2 windows::basic_object_handle::assign (2 of 2 overloads)] 130404 130405 130406Assign an existing native handle to the handle. 130407 130408 130409 void assign( 130410 const native_handle_type & handle, 130411 boost::system::error_code & ec); 130412 130413 130414 130415[endsect] 130416 130417 130418[endsect] 130419 130420 130421[section:async_wait windows::basic_object_handle::async_wait] 130422 130423[indexterm2 boost_asio.indexterm.windows__basic_object_handle.async_wait..async_wait..windows::basic_object_handle] 130424Start an asynchronous wait on the object handle. 130425 130426 130427 template< 130428 typename ``[link boost_asio.reference.WaitHandler WaitHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 130429 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait( 130430 WaitHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 130431 130432 130433This function is be used to initiate an asynchronous wait against the object handle. It always returns immediately. 130434 130435 130436[heading Parameters] 130437 130438 130439[variablelist 130440 130441[[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: 130442`` 130443 void handler( 130444 const boost::system::error_code& error // Result of operation. 130445 ); 130446`` 130447Regardless 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`]. ]] 130448 130449] 130450 130451 130452 130453 130454[endsect] 130455 130456 130457[section:basic_object_handle windows::basic_object_handle::basic_object_handle] 130458 130459[indexterm2 boost_asio.indexterm.windows__basic_object_handle.basic_object_handle..basic_object_handle..windows::basic_object_handle] 130460Construct an object handle without opening it. 130461 130462 130463 explicit ``[link boost_asio.reference.windows__basic_object_handle.basic_object_handle.overload1 basic_object_handle]``( 130464 const executor_type & ex); 130465 `` [''''»''' [link boost_asio.reference.windows__basic_object_handle.basic_object_handle.overload1 more...]]`` 130466 130467 template< 130468 typename ExecutionContext> 130469 explicit ``[link boost_asio.reference.windows__basic_object_handle.basic_object_handle.overload2 basic_object_handle]``( 130470 ExecutionContext & context, 130471 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value, defaulted_constraint >::type = defaulted_constraint()); 130472 `` [''''»''' [link boost_asio.reference.windows__basic_object_handle.basic_object_handle.overload2 more...]]`` 130473 130474 130475Construct an object handle on an existing native handle. 130476 130477 130478 ``[link boost_asio.reference.windows__basic_object_handle.basic_object_handle.overload3 basic_object_handle]``( 130479 const executor_type & ex, 130480 const native_handle_type & native_handle); 130481 `` [''''»''' [link boost_asio.reference.windows__basic_object_handle.basic_object_handle.overload3 more...]]`` 130482 130483 template< 130484 typename ExecutionContext> 130485 ``[link boost_asio.reference.windows__basic_object_handle.basic_object_handle.overload4 basic_object_handle]``( 130486 ExecutionContext & context, 130487 const native_handle_type & native_handle, 130488 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 130489 `` [''''»''' [link boost_asio.reference.windows__basic_object_handle.basic_object_handle.overload4 more...]]`` 130490 130491 130492Move-construct an object handle from another. 130493 130494 130495 ``[link boost_asio.reference.windows__basic_object_handle.basic_object_handle.overload5 basic_object_handle]``( 130496 basic_object_handle && other); 130497 `` [''''»''' [link boost_asio.reference.windows__basic_object_handle.basic_object_handle.overload5 more...]]`` 130498 130499 130500[section:overload1 windows::basic_object_handle::basic_object_handle (1 of 5 overloads)] 130501 130502 130503Construct an object handle without opening it. 130504 130505 130506 basic_object_handle( 130507 const executor_type & ex); 130508 130509 130510This constructor creates an object handle without opening it. 130511 130512 130513[heading Parameters] 130514 130515 130516[variablelist 130517 130518[[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. ]] 130519 130520] 130521 130522 130523 130524 130525[endsect] 130526 130527 130528 130529[section:overload2 windows::basic_object_handle::basic_object_handle (2 of 5 overloads)] 130530 130531 130532Construct an object handle without opening it. 130533 130534 130535 template< 130536 typename ExecutionContext> 130537 basic_object_handle( 130538 ExecutionContext & context, 130539 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value, defaulted_constraint >::type = defaulted_constraint()); 130540 130541 130542This constructor creates an object handle without opening it. 130543 130544 130545[heading Parameters] 130546 130547 130548[variablelist 130549 130550[[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. ]] 130551 130552] 130553 130554 130555 130556 130557[endsect] 130558 130559 130560 130561[section:overload3 windows::basic_object_handle::basic_object_handle (3 of 5 overloads)] 130562 130563 130564Construct an object handle on an existing native handle. 130565 130566 130567 basic_object_handle( 130568 const executor_type & ex, 130569 const native_handle_type & native_handle); 130570 130571 130572This constructor creates an object handle object to hold an existing native handle. 130573 130574 130575[heading Parameters] 130576 130577 130578[variablelist 130579 130580[[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.]] 130581 130582[[native_handle][The new underlying handle implementation.]] 130583 130584] 130585 130586 130587[heading Exceptions] 130588 130589 130590[variablelist 130591 130592[[boost::system::system_error][Thrown on failure. ]] 130593 130594] 130595 130596 130597 130598 130599[endsect] 130600 130601 130602 130603[section:overload4 windows::basic_object_handle::basic_object_handle (4 of 5 overloads)] 130604 130605 130606Construct an object handle on an existing native handle. 130607 130608 130609 template< 130610 typename ExecutionContext> 130611 basic_object_handle( 130612 ExecutionContext & context, 130613 const native_handle_type & native_handle, 130614 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 130615 130616 130617This constructor creates an object handle object to hold an existing native handle. 130618 130619 130620[heading Parameters] 130621 130622 130623[variablelist 130624 130625[[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.]] 130626 130627[[native_handle][The new underlying handle implementation.]] 130628 130629] 130630 130631 130632[heading Exceptions] 130633 130634 130635[variablelist 130636 130637[[boost::system::system_error][Thrown on failure. ]] 130638 130639] 130640 130641 130642 130643 130644[endsect] 130645 130646 130647 130648[section:overload5 windows::basic_object_handle::basic_object_handle (5 of 5 overloads)] 130649 130650 130651Move-construct an object handle from another. 130652 130653 130654 basic_object_handle( 130655 basic_object_handle && other); 130656 130657 130658This constructor moves an object handle from one object to another. 130659 130660 130661[heading Parameters] 130662 130663 130664[variablelist 130665 130666[[other][The other object handle object from which the move will occur.]] 130667 130668] 130669 130670 130671[heading Remarks] 130672 130673Following the move, the moved-from object is in the same state as if constructed using the `basic_object_handle(const executor_type&)` constructor. 130674 130675 130676 130677 130678[endsect] 130679 130680 130681[endsect] 130682 130683[section:cancel windows::basic_object_handle::cancel] 130684 130685[indexterm2 boost_asio.indexterm.windows__basic_object_handle.cancel..cancel..windows::basic_object_handle] 130686Cancel all asynchronous operations associated with the handle. 130687 130688 130689 void ``[link boost_asio.reference.windows__basic_object_handle.cancel.overload1 cancel]``(); 130690 `` [''''»''' [link boost_asio.reference.windows__basic_object_handle.cancel.overload1 more...]]`` 130691 130692 void ``[link boost_asio.reference.windows__basic_object_handle.cancel.overload2 cancel]``( 130693 boost::system::error_code & ec); 130694 `` [''''»''' [link boost_asio.reference.windows__basic_object_handle.cancel.overload2 more...]]`` 130695 130696 130697[section:overload1 windows::basic_object_handle::cancel (1 of 2 overloads)] 130698 130699 130700Cancel all asynchronous operations associated with the handle. 130701 130702 130703 void cancel(); 130704 130705 130706This 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. 130707 130708 130709[heading Exceptions] 130710 130711 130712[variablelist 130713 130714[[boost::system::system_error][Thrown on failure. ]] 130715 130716] 130717 130718 130719 130720 130721[endsect] 130722 130723 130724 130725[section:overload2 windows::basic_object_handle::cancel (2 of 2 overloads)] 130726 130727 130728Cancel all asynchronous operations associated with the handle. 130729 130730 130731 void cancel( 130732 boost::system::error_code & ec); 130733 130734 130735This 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. 130736 130737 130738[heading Parameters] 130739 130740 130741[variablelist 130742 130743[[ec][Set to indicate what error occurred, if any. ]] 130744 130745] 130746 130747 130748 130749 130750[endsect] 130751 130752 130753[endsect] 130754 130755[section:close windows::basic_object_handle::close] 130756 130757[indexterm2 boost_asio.indexterm.windows__basic_object_handle.close..close..windows::basic_object_handle] 130758Close the handle. 130759 130760 130761 void ``[link boost_asio.reference.windows__basic_object_handle.close.overload1 close]``(); 130762 `` [''''»''' [link boost_asio.reference.windows__basic_object_handle.close.overload1 more...]]`` 130763 130764 void ``[link boost_asio.reference.windows__basic_object_handle.close.overload2 close]``( 130765 boost::system::error_code & ec); 130766 `` [''''»''' [link boost_asio.reference.windows__basic_object_handle.close.overload2 more...]]`` 130767 130768 130769[section:overload1 windows::basic_object_handle::close (1 of 2 overloads)] 130770 130771 130772Close the handle. 130773 130774 130775 void close(); 130776 130777 130778This 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. 130779 130780 130781[heading Exceptions] 130782 130783 130784[variablelist 130785 130786[[boost::system::system_error][Thrown on failure. ]] 130787 130788] 130789 130790 130791 130792 130793[endsect] 130794 130795 130796 130797[section:overload2 windows::basic_object_handle::close (2 of 2 overloads)] 130798 130799 130800Close the handle. 130801 130802 130803 void close( 130804 boost::system::error_code & ec); 130805 130806 130807This 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. 130808 130809 130810[heading Parameters] 130811 130812 130813[variablelist 130814 130815[[ec][Set to indicate what error occurred, if any. ]] 130816 130817] 130818 130819 130820 130821 130822[endsect] 130823 130824 130825[endsect] 130826 130827 130828[section:executor_type windows::basic_object_handle::executor_type] 130829 130830[indexterm2 boost_asio.indexterm.windows__basic_object_handle.executor_type..executor_type..windows::basic_object_handle] 130831The type of the executor associated with the object. 130832 130833 130834 typedef Executor executor_type; 130835 130836 130837 130838[heading Requirements] 130839 130840['Header: ][^boost/asio/windows/basic_object_handle.hpp] 130841 130842['Convenience header: ][^boost/asio.hpp] 130843 130844 130845[endsect] 130846 130847 130848 130849[section:get_executor windows::basic_object_handle::get_executor] 130850 130851[indexterm2 boost_asio.indexterm.windows__basic_object_handle.get_executor..get_executor..windows::basic_object_handle] 130852Get the executor associated with the object. 130853 130854 130855 executor_type get_executor(); 130856 130857 130858 130859[endsect] 130860 130861 130862 130863[section:is_open windows::basic_object_handle::is_open] 130864 130865[indexterm2 boost_asio.indexterm.windows__basic_object_handle.is_open..is_open..windows::basic_object_handle] 130866Determine whether the handle is open. 130867 130868 130869 bool is_open() const; 130870 130871 130872 130873[endsect] 130874 130875 130876[section:lowest_layer windows::basic_object_handle::lowest_layer] 130877 130878[indexterm2 boost_asio.indexterm.windows__basic_object_handle.lowest_layer..lowest_layer..windows::basic_object_handle] 130879Get a reference to the lowest layer. 130880 130881 130882 lowest_layer_type & ``[link boost_asio.reference.windows__basic_object_handle.lowest_layer.overload1 lowest_layer]``(); 130883 `` [''''»''' [link boost_asio.reference.windows__basic_object_handle.lowest_layer.overload1 more...]]`` 130884 130885 130886Get a const reference to the lowest layer. 130887 130888 130889 const lowest_layer_type & ``[link boost_asio.reference.windows__basic_object_handle.lowest_layer.overload2 lowest_layer]``() const; 130890 `` [''''»''' [link boost_asio.reference.windows__basic_object_handle.lowest_layer.overload2 more...]]`` 130891 130892 130893[section:overload1 windows::basic_object_handle::lowest_layer (1 of 2 overloads)] 130894 130895 130896Get a reference to the lowest layer. 130897 130898 130899 lowest_layer_type & lowest_layer(); 130900 130901 130902This 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. 130903 130904 130905[heading Return Value] 130906 130907A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 130908 130909 130910 130911 130912[endsect] 130913 130914 130915 130916[section:overload2 windows::basic_object_handle::lowest_layer (2 of 2 overloads)] 130917 130918 130919Get a const reference to the lowest layer. 130920 130921 130922 const lowest_layer_type & lowest_layer() const; 130923 130924 130925This 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. 130926 130927 130928[heading Return Value] 130929 130930A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 130931 130932 130933 130934 130935[endsect] 130936 130937 130938[endsect] 130939 130940 130941[section:lowest_layer_type windows::basic_object_handle::lowest_layer_type] 130942 130943[indexterm2 boost_asio.indexterm.windows__basic_object_handle.lowest_layer_type..lowest_layer_type..windows::basic_object_handle] 130944An object handle is always the lowest layer. 130945 130946 130947 typedef basic_object_handle lowest_layer_type; 130948 130949 130950[heading Types] 130951[table 130952 [[Name][Description]] 130953 130954 [ 130955 130956 [[link boost_asio.reference.windows__basic_object_handle__rebind_executor [*rebind_executor]]] 130957 [Rebinds the handle type to another executor. ] 130958 130959 ] 130960 130961 [ 130962 130963 [[link boost_asio.reference.windows__basic_object_handle.executor_type [*executor_type]]] 130964 [The type of the executor associated with the object. ] 130965 130966 ] 130967 130968 [ 130969 130970 [[link boost_asio.reference.windows__basic_object_handle.lowest_layer_type [*lowest_layer_type]]] 130971 [An object handle is always the lowest layer. ] 130972 130973 ] 130974 130975 [ 130976 130977 [[link boost_asio.reference.windows__basic_object_handle.native_handle_type [*native_handle_type]]] 130978 [The native representation of a handle. ] 130979 130980 ] 130981 130982] 130983 130984[heading Member Functions] 130985[table 130986 [[Name][Description]] 130987 130988 [ 130989 [[link boost_asio.reference.windows__basic_object_handle.assign [*assign]]] 130990 [Assign an existing native handle to the handle. ] 130991 ] 130992 130993 [ 130994 [[link boost_asio.reference.windows__basic_object_handle.async_wait [*async_wait]]] 130995 [Start an asynchronous wait on the object handle. ] 130996 ] 130997 130998 [ 130999 [[link boost_asio.reference.windows__basic_object_handle.basic_object_handle [*basic_object_handle]] [constructor]] 131000 [Construct an object handle without opening it. 131001 [hr] 131002 Construct an object handle on an existing native handle. 131003 [hr] 131004 Move-construct an object handle from another. ] 131005 ] 131006 131007 [ 131008 [[link boost_asio.reference.windows__basic_object_handle.cancel [*cancel]]] 131009 [Cancel all asynchronous operations associated with the handle. ] 131010 ] 131011 131012 [ 131013 [[link boost_asio.reference.windows__basic_object_handle.close [*close]]] 131014 [Close the handle. ] 131015 ] 131016 131017 [ 131018 [[link boost_asio.reference.windows__basic_object_handle.get_executor [*get_executor]]] 131019 [Get the executor associated with the object. ] 131020 ] 131021 131022 [ 131023 [[link boost_asio.reference.windows__basic_object_handle.is_open [*is_open]]] 131024 [Determine whether the handle is open. ] 131025 ] 131026 131027 [ 131028 [[link boost_asio.reference.windows__basic_object_handle.lowest_layer [*lowest_layer]]] 131029 [Get a reference to the lowest layer. 131030 [hr] 131031 Get a const reference to the lowest layer. ] 131032 ] 131033 131034 [ 131035 [[link boost_asio.reference.windows__basic_object_handle.native_handle [*native_handle]]] 131036 [Get the native handle representation. ] 131037 ] 131038 131039 [ 131040 [[link boost_asio.reference.windows__basic_object_handle.operator_eq_ [*operator=]]] 131041 [Move-assign an object handle from another. ] 131042 ] 131043 131044 [ 131045 [[link boost_asio.reference.windows__basic_object_handle.wait [*wait]]] 131046 [Perform a blocking wait on the object handle. ] 131047 ] 131048 131049] 131050 131051The [link boost_asio.reference.windows__basic_object_handle `windows::basic_object_handle`] class provides asynchronous and blocking object-oriented handle functionality. 131052 131053 131054[heading Thread Safety] 131055 131056['Distinct] ['objects:] Safe. 131057 131058['Shared] ['objects:] Unsafe. 131059 131060 131061 131062 131063[heading Requirements] 131064 131065['Header: ][^boost/asio/windows/basic_object_handle.hpp] 131066 131067['Convenience header: ][^boost/asio.hpp] 131068 131069 131070[endsect] 131071 131072 131073 131074[section:native_handle windows::basic_object_handle::native_handle] 131075 131076[indexterm2 boost_asio.indexterm.windows__basic_object_handle.native_handle..native_handle..windows::basic_object_handle] 131077Get the native handle representation. 131078 131079 131080 native_handle_type native_handle(); 131081 131082 131083This 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. 131084 131085 131086[endsect] 131087 131088 131089 131090[section:native_handle_type windows::basic_object_handle::native_handle_type] 131091 131092[indexterm2 boost_asio.indexterm.windows__basic_object_handle.native_handle_type..native_handle_type..windows::basic_object_handle] 131093The native representation of a handle. 131094 131095 131096 typedef implementation_defined native_handle_type; 131097 131098 131099 131100[heading Requirements] 131101 131102['Header: ][^boost/asio/windows/basic_object_handle.hpp] 131103 131104['Convenience header: ][^boost/asio.hpp] 131105 131106 131107[endsect] 131108 131109 131110 131111[section:operator_eq_ windows::basic_object_handle::operator=] 131112 131113[indexterm2 boost_asio.indexterm.windows__basic_object_handle.operator_eq_..operator=..windows::basic_object_handle] 131114Move-assign an object handle from another. 131115 131116 131117 basic_object_handle & operator=( 131118 basic_object_handle && other); 131119 131120 131121This assignment operator moves an object handle from one object to another. 131122 131123 131124[heading Parameters] 131125 131126 131127[variablelist 131128 131129[[other][The other object handle object from which the move will occur.]] 131130 131131] 131132 131133 131134[heading Remarks] 131135 131136Following the move, the moved-from object is in the same state as if constructed using the `basic_object_handle(const executor_type&)` constructor. 131137 131138 131139 131140 131141[endsect] 131142 131143 131144[section:wait windows::basic_object_handle::wait] 131145 131146[indexterm2 boost_asio.indexterm.windows__basic_object_handle.wait..wait..windows::basic_object_handle] 131147Perform a blocking wait on the object handle. 131148 131149 131150 void ``[link boost_asio.reference.windows__basic_object_handle.wait.overload1 wait]``(); 131151 `` [''''»''' [link boost_asio.reference.windows__basic_object_handle.wait.overload1 more...]]`` 131152 131153 void ``[link boost_asio.reference.windows__basic_object_handle.wait.overload2 wait]``( 131154 boost::system::error_code & ec); 131155 `` [''''»''' [link boost_asio.reference.windows__basic_object_handle.wait.overload2 more...]]`` 131156 131157 131158[section:overload1 windows::basic_object_handle::wait (1 of 2 overloads)] 131159 131160 131161Perform a blocking wait on the object handle. 131162 131163 131164 void wait(); 131165 131166 131167This 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. 131168 131169 131170[heading Exceptions] 131171 131172 131173[variablelist 131174 131175[[boost::system::system_error][Thrown on failure. ]] 131176 131177] 131178 131179 131180 131181 131182[endsect] 131183 131184 131185 131186[section:overload2 windows::basic_object_handle::wait (2 of 2 overloads)] 131187 131188 131189Perform a blocking wait on the object handle. 131190 131191 131192 void wait( 131193 boost::system::error_code & ec); 131194 131195 131196This 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. 131197 131198 131199[heading Parameters] 131200 131201 131202[variablelist 131203 131204[[ec][Set to indicate what error occurred, if any. ]] 131205 131206] 131207 131208 131209 131210 131211[endsect] 131212 131213 131214[endsect] 131215 131216 131217[endsect] 131218 131219[section:windows__basic_object_handle__rebind_executor windows::basic_object_handle::rebind_executor] 131220 131221[indexterm1 boost_asio.indexterm.windows__basic_object_handle__rebind_executor..windows::basic_object_handle::rebind_executor] 131222 131223 131224Rebinds the handle type to another executor. 131225 131226 131227 template< 131228 typename ``[link boost_asio.reference.Executor1 Executor1]``> 131229 struct rebind_executor 131230 131231 131232[heading Types] 131233[table 131234 [[Name][Description]] 131235 131236 [ 131237 131238 [[link boost_asio.reference.windows__basic_object_handle__rebind_executor.other [*other]]] 131239 [The handle type when rebound to the specified executor. ] 131240 131241 ] 131242 131243] 131244 131245[heading Requirements] 131246 131247['Header: ][^boost/asio/windows/basic_object_handle.hpp] 131248 131249['Convenience header: ][^boost/asio.hpp] 131250 131251 131252[section:other windows::basic_object_handle::rebind_executor::other] 131253 131254[indexterm2 boost_asio.indexterm.windows__basic_object_handle__rebind_executor.other..other..windows::basic_object_handle::rebind_executor] 131255The handle type when rebound to the specified executor. 131256 131257 131258 typedef basic_object_handle< Executor1 > other; 131259 131260 131261[heading Types] 131262[table 131263 [[Name][Description]] 131264 131265 [ 131266 131267 [[link boost_asio.reference.windows__basic_object_handle__rebind_executor [*rebind_executor]]] 131268 [Rebinds the handle type to another executor. ] 131269 131270 ] 131271 131272 [ 131273 131274 [[link boost_asio.reference.windows__basic_object_handle.executor_type [*executor_type]]] 131275 [The type of the executor associated with the object. ] 131276 131277 ] 131278 131279 [ 131280 131281 [[link boost_asio.reference.windows__basic_object_handle.lowest_layer_type [*lowest_layer_type]]] 131282 [An object handle is always the lowest layer. ] 131283 131284 ] 131285 131286 [ 131287 131288 [[link boost_asio.reference.windows__basic_object_handle.native_handle_type [*native_handle_type]]] 131289 [The native representation of a handle. ] 131290 131291 ] 131292 131293] 131294 131295[heading Member Functions] 131296[table 131297 [[Name][Description]] 131298 131299 [ 131300 [[link boost_asio.reference.windows__basic_object_handle.assign [*assign]]] 131301 [Assign an existing native handle to the handle. ] 131302 ] 131303 131304 [ 131305 [[link boost_asio.reference.windows__basic_object_handle.async_wait [*async_wait]]] 131306 [Start an asynchronous wait on the object handle. ] 131307 ] 131308 131309 [ 131310 [[link boost_asio.reference.windows__basic_object_handle.basic_object_handle [*basic_object_handle]] [constructor]] 131311 [Construct an object handle without opening it. 131312 [hr] 131313 Construct an object handle on an existing native handle. 131314 [hr] 131315 Move-construct an object handle from another. ] 131316 ] 131317 131318 [ 131319 [[link boost_asio.reference.windows__basic_object_handle.cancel [*cancel]]] 131320 [Cancel all asynchronous operations associated with the handle. ] 131321 ] 131322 131323 [ 131324 [[link boost_asio.reference.windows__basic_object_handle.close [*close]]] 131325 [Close the handle. ] 131326 ] 131327 131328 [ 131329 [[link boost_asio.reference.windows__basic_object_handle.get_executor [*get_executor]]] 131330 [Get the executor associated with the object. ] 131331 ] 131332 131333 [ 131334 [[link boost_asio.reference.windows__basic_object_handle.is_open [*is_open]]] 131335 [Determine whether the handle is open. ] 131336 ] 131337 131338 [ 131339 [[link boost_asio.reference.windows__basic_object_handle.lowest_layer [*lowest_layer]]] 131340 [Get a reference to the lowest layer. 131341 [hr] 131342 Get a const reference to the lowest layer. ] 131343 ] 131344 131345 [ 131346 [[link boost_asio.reference.windows__basic_object_handle.native_handle [*native_handle]]] 131347 [Get the native handle representation. ] 131348 ] 131349 131350 [ 131351 [[link boost_asio.reference.windows__basic_object_handle.operator_eq_ [*operator=]]] 131352 [Move-assign an object handle from another. ] 131353 ] 131354 131355 [ 131356 [[link boost_asio.reference.windows__basic_object_handle.wait [*wait]]] 131357 [Perform a blocking wait on the object handle. ] 131358 ] 131359 131360] 131361 131362The [link boost_asio.reference.windows__basic_object_handle `windows::basic_object_handle`] class provides asynchronous and blocking object-oriented handle functionality. 131363 131364 131365[heading Thread Safety] 131366 131367['Distinct] ['objects:] Safe. 131368 131369['Shared] ['objects:] Unsafe. 131370 131371 131372 131373 131374[heading Requirements] 131375 131376['Header: ][^boost/asio/windows/basic_object_handle.hpp] 131377 131378['Convenience header: ][^boost/asio.hpp] 131379 131380 131381[endsect] 131382 131383 131384 131385[endsect] 131386 131387[section:windows__basic_overlapped_handle windows::basic_overlapped_handle] 131388 131389[indexterm1 boost_asio.indexterm.windows__basic_overlapped_handle..windows::basic_overlapped_handle] 131390 131391 131392Provides Windows handle functionality for objects that support overlapped I/O. 131393 131394 131395 template< 131396 typename ``[link boost_asio.reference.Executor1 Executor]`` = any_io_executor> 131397 class basic_overlapped_handle 131398 131399 131400[heading Types] 131401[table 131402 [[Name][Description]] 131403 131404 [ 131405 131406 [[link boost_asio.reference.windows__basic_overlapped_handle__rebind_executor [*rebind_executor]]] 131407 [Rebinds the handle type to another executor. ] 131408 131409 ] 131410 131411 [ 131412 131413 [[link boost_asio.reference.windows__basic_overlapped_handle.executor_type [*executor_type]]] 131414 [The type of the executor associated with the object. ] 131415 131416 ] 131417 131418 [ 131419 131420 [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer_type [*lowest_layer_type]]] 131421 [An overlapped_handle is always the lowest layer. ] 131422 131423 ] 131424 131425 [ 131426 131427 [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle_type [*native_handle_type]]] 131428 [The native representation of a handle. ] 131429 131430 ] 131431 131432] 131433 131434[heading Member Functions] 131435[table 131436 [[Name][Description]] 131437 131438 [ 131439 [[link boost_asio.reference.windows__basic_overlapped_handle.assign [*assign]]] 131440 [Assign an existing native handle to the handle. ] 131441 ] 131442 131443 [ 131444 [[link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle [*basic_overlapped_handle]] [constructor]] 131445 [Construct an overlapped handle without opening it. 131446 [hr] 131447 Construct an overlapped handle on an existing native handle. 131448 [hr] 131449 Move-construct an overlapped handle from another. ] 131450 ] 131451 131452 [ 131453 [[link boost_asio.reference.windows__basic_overlapped_handle.cancel [*cancel]]] 131454 [Cancel all asynchronous operations associated with the handle. ] 131455 ] 131456 131457 [ 131458 [[link boost_asio.reference.windows__basic_overlapped_handle.close [*close]]] 131459 [Close the handle. ] 131460 ] 131461 131462 [ 131463 [[link boost_asio.reference.windows__basic_overlapped_handle.get_executor [*get_executor]]] 131464 [Get the executor associated with the object. ] 131465 ] 131466 131467 [ 131468 [[link boost_asio.reference.windows__basic_overlapped_handle.is_open [*is_open]]] 131469 [Determine whether the handle is open. ] 131470 ] 131471 131472 [ 131473 [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer [*lowest_layer]]] 131474 [Get a reference to the lowest layer. 131475 [hr] 131476 Get a const reference to the lowest layer. ] 131477 ] 131478 131479 [ 131480 [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle [*native_handle]]] 131481 [Get the native handle representation. ] 131482 ] 131483 131484 [ 131485 [[link boost_asio.reference.windows__basic_overlapped_handle.operator_eq_ [*operator=]]] 131486 [Move-assign an overlapped handle from another. ] 131487 ] 131488 131489] 131490 131491[heading Protected Member Functions] 131492[table 131493 [[Name][Description]] 131494 131495 [ 131496 [[link boost_asio.reference.windows__basic_overlapped_handle._basic_overlapped_handle [*~basic_overlapped_handle]] [destructor]] 131497 [Protected destructor to prevent deletion through this type. ] 131498 ] 131499 131500] 131501 131502The [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. 131503 131504 131505[heading Thread Safety] 131506 131507['Distinct] ['objects:] Safe. 131508 131509['Shared] ['objects:] Unsafe. 131510 131511 131512 131513[heading Requirements] 131514 131515['Header: ][^boost/asio/windows/basic_overlapped_handle.hpp] 131516 131517['Convenience header: ][^boost/asio.hpp] 131518 131519[section:assign windows::basic_overlapped_handle::assign] 131520 131521[indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.assign..assign..windows::basic_overlapped_handle] 131522Assign an existing native handle to the handle. 131523 131524 131525 void ``[link boost_asio.reference.windows__basic_overlapped_handle.assign.overload1 assign]``( 131526 const native_handle_type & handle); 131527 `` [''''»''' [link boost_asio.reference.windows__basic_overlapped_handle.assign.overload1 more...]]`` 131528 131529 void ``[link boost_asio.reference.windows__basic_overlapped_handle.assign.overload2 assign]``( 131530 const native_handle_type & handle, 131531 boost::system::error_code & ec); 131532 `` [''''»''' [link boost_asio.reference.windows__basic_overlapped_handle.assign.overload2 more...]]`` 131533 131534 131535[section:overload1 windows::basic_overlapped_handle::assign (1 of 2 overloads)] 131536 131537 131538Assign an existing native handle to the handle. 131539 131540 131541 void assign( 131542 const native_handle_type & handle); 131543 131544 131545 131546[endsect] 131547 131548 131549 131550[section:overload2 windows::basic_overlapped_handle::assign (2 of 2 overloads)] 131551 131552 131553Assign an existing native handle to the handle. 131554 131555 131556 void assign( 131557 const native_handle_type & handle, 131558 boost::system::error_code & ec); 131559 131560 131561 131562[endsect] 131563 131564 131565[endsect] 131566 131567[section:basic_overlapped_handle windows::basic_overlapped_handle::basic_overlapped_handle] 131568 131569[indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.basic_overlapped_handle..basic_overlapped_handle..windows::basic_overlapped_handle] 131570Construct an overlapped handle without opening it. 131571 131572 131573 explicit ``[link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle.overload1 basic_overlapped_handle]``( 131574 const executor_type & ex); 131575 `` [''''»''' [link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle.overload1 more...]]`` 131576 131577 template< 131578 typename ExecutionContext> 131579 explicit ``[link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle.overload2 basic_overlapped_handle]``( 131580 ExecutionContext & context, 131581 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value, defaulted_constraint >::type = defaulted_constraint()); 131582 `` [''''»''' [link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle.overload2 more...]]`` 131583 131584 131585Construct an overlapped handle on an existing native handle. 131586 131587 131588 ``[link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle.overload3 basic_overlapped_handle]``( 131589 const executor_type & ex, 131590 const native_handle_type & native_handle); 131591 `` [''''»''' [link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle.overload3 more...]]`` 131592 131593 template< 131594 typename ExecutionContext> 131595 ``[link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle.overload4 basic_overlapped_handle]``( 131596 ExecutionContext & context, 131597 const native_handle_type & native_handle, 131598 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 131599 `` [''''»''' [link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle.overload4 more...]]`` 131600 131601 131602Move-construct an overlapped handle from another. 131603 131604 131605 ``[link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle.overload5 basic_overlapped_handle]``( 131606 basic_overlapped_handle && other); 131607 `` [''''»''' [link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle.overload5 more...]]`` 131608 131609 131610[section:overload1 windows::basic_overlapped_handle::basic_overlapped_handle (1 of 5 overloads)] 131611 131612 131613Construct an overlapped handle without opening it. 131614 131615 131616 basic_overlapped_handle( 131617 const executor_type & ex); 131618 131619 131620This constructor creates an overlapped handle without opening it. 131621 131622 131623[heading Parameters] 131624 131625 131626[variablelist 131627 131628[[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. ]] 131629 131630] 131631 131632 131633 131634 131635[endsect] 131636 131637 131638 131639[section:overload2 windows::basic_overlapped_handle::basic_overlapped_handle (2 of 5 overloads)] 131640 131641 131642Construct an overlapped handle without opening it. 131643 131644 131645 template< 131646 typename ExecutionContext> 131647 basic_overlapped_handle( 131648 ExecutionContext & context, 131649 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value, defaulted_constraint >::type = defaulted_constraint()); 131650 131651 131652This constructor creates an overlapped handle without opening it. 131653 131654 131655[heading Parameters] 131656 131657 131658[variablelist 131659 131660[[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. ]] 131661 131662] 131663 131664 131665 131666 131667[endsect] 131668 131669 131670 131671[section:overload3 windows::basic_overlapped_handle::basic_overlapped_handle (3 of 5 overloads)] 131672 131673 131674Construct an overlapped handle on an existing native handle. 131675 131676 131677 basic_overlapped_handle( 131678 const executor_type & ex, 131679 const native_handle_type & native_handle); 131680 131681 131682This constructor creates an overlapped handle object to hold an existing native handle. 131683 131684 131685[heading Parameters] 131686 131687 131688[variablelist 131689 131690[[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.]] 131691 131692[[native_handle][The new underlying handle implementation.]] 131693 131694] 131695 131696 131697[heading Exceptions] 131698 131699 131700[variablelist 131701 131702[[boost::system::system_error][Thrown on failure. ]] 131703 131704] 131705 131706 131707 131708 131709[endsect] 131710 131711 131712 131713[section:overload4 windows::basic_overlapped_handle::basic_overlapped_handle (4 of 5 overloads)] 131714 131715 131716Construct an overlapped handle on an existing native handle. 131717 131718 131719 template< 131720 typename ExecutionContext> 131721 basic_overlapped_handle( 131722 ExecutionContext & context, 131723 const native_handle_type & native_handle, 131724 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 131725 131726 131727This constructor creates an overlapped handle object to hold an existing native handle. 131728 131729 131730[heading Parameters] 131731 131732 131733[variablelist 131734 131735[[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.]] 131736 131737[[native_handle][The new underlying handle implementation.]] 131738 131739] 131740 131741 131742[heading Exceptions] 131743 131744 131745[variablelist 131746 131747[[boost::system::system_error][Thrown on failure. ]] 131748 131749] 131750 131751 131752 131753 131754[endsect] 131755 131756 131757 131758[section:overload5 windows::basic_overlapped_handle::basic_overlapped_handle (5 of 5 overloads)] 131759 131760 131761Move-construct an overlapped handle from another. 131762 131763 131764 basic_overlapped_handle( 131765 basic_overlapped_handle && other); 131766 131767 131768This constructor moves a handle from one object to another. 131769 131770 131771[heading Parameters] 131772 131773 131774[variablelist 131775 131776[[other][The other overlapped handle object from which the move will occur.]] 131777 131778] 131779 131780 131781[heading Remarks] 131782 131783Following the move, the moved-from object is in the same state as if constructed using the `overlapped_handle(const executor_type&)` constructor. 131784 131785 131786 131787 131788[endsect] 131789 131790 131791[endsect] 131792 131793[section:cancel windows::basic_overlapped_handle::cancel] 131794 131795[indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.cancel..cancel..windows::basic_overlapped_handle] 131796Cancel all asynchronous operations associated with the handle. 131797 131798 131799 void ``[link boost_asio.reference.windows__basic_overlapped_handle.cancel.overload1 cancel]``(); 131800 `` [''''»''' [link boost_asio.reference.windows__basic_overlapped_handle.cancel.overload1 more...]]`` 131801 131802 void ``[link boost_asio.reference.windows__basic_overlapped_handle.cancel.overload2 cancel]``( 131803 boost::system::error_code & ec); 131804 `` [''''»''' [link boost_asio.reference.windows__basic_overlapped_handle.cancel.overload2 more...]]`` 131805 131806 131807[section:overload1 windows::basic_overlapped_handle::cancel (1 of 2 overloads)] 131808 131809 131810Cancel all asynchronous operations associated with the handle. 131811 131812 131813 void cancel(); 131814 131815 131816This 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. 131817 131818 131819[heading Exceptions] 131820 131821 131822[variablelist 131823 131824[[boost::system::system_error][Thrown on failure. ]] 131825 131826] 131827 131828 131829 131830 131831[endsect] 131832 131833 131834 131835[section:overload2 windows::basic_overlapped_handle::cancel (2 of 2 overloads)] 131836 131837 131838Cancel all asynchronous operations associated with the handle. 131839 131840 131841 void cancel( 131842 boost::system::error_code & ec); 131843 131844 131845This 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. 131846 131847 131848[heading Parameters] 131849 131850 131851[variablelist 131852 131853[[ec][Set to indicate what error occurred, if any. ]] 131854 131855] 131856 131857 131858 131859 131860[endsect] 131861 131862 131863[endsect] 131864 131865[section:close windows::basic_overlapped_handle::close] 131866 131867[indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.close..close..windows::basic_overlapped_handle] 131868Close the handle. 131869 131870 131871 void ``[link boost_asio.reference.windows__basic_overlapped_handle.close.overload1 close]``(); 131872 `` [''''»''' [link boost_asio.reference.windows__basic_overlapped_handle.close.overload1 more...]]`` 131873 131874 void ``[link boost_asio.reference.windows__basic_overlapped_handle.close.overload2 close]``( 131875 boost::system::error_code & ec); 131876 `` [''''»''' [link boost_asio.reference.windows__basic_overlapped_handle.close.overload2 more...]]`` 131877 131878 131879[section:overload1 windows::basic_overlapped_handle::close (1 of 2 overloads)] 131880 131881 131882Close the handle. 131883 131884 131885 void close(); 131886 131887 131888This 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. 131889 131890 131891[heading Exceptions] 131892 131893 131894[variablelist 131895 131896[[boost::system::system_error][Thrown on failure. ]] 131897 131898] 131899 131900 131901 131902 131903[endsect] 131904 131905 131906 131907[section:overload2 windows::basic_overlapped_handle::close (2 of 2 overloads)] 131908 131909 131910Close the handle. 131911 131912 131913 void close( 131914 boost::system::error_code & ec); 131915 131916 131917This 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. 131918 131919 131920[heading Parameters] 131921 131922 131923[variablelist 131924 131925[[ec][Set to indicate what error occurred, if any. ]] 131926 131927] 131928 131929 131930 131931 131932[endsect] 131933 131934 131935[endsect] 131936 131937 131938[section:executor_type windows::basic_overlapped_handle::executor_type] 131939 131940[indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.executor_type..executor_type..windows::basic_overlapped_handle] 131941The type of the executor associated with the object. 131942 131943 131944 typedef Executor executor_type; 131945 131946 131947 131948[heading Requirements] 131949 131950['Header: ][^boost/asio/windows/basic_overlapped_handle.hpp] 131951 131952['Convenience header: ][^boost/asio.hpp] 131953 131954 131955[endsect] 131956 131957 131958 131959[section:get_executor windows::basic_overlapped_handle::get_executor] 131960 131961[indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.get_executor..get_executor..windows::basic_overlapped_handle] 131962Get the executor associated with the object. 131963 131964 131965 executor_type get_executor(); 131966 131967 131968 131969[endsect] 131970 131971 131972 131973[section:is_open windows::basic_overlapped_handle::is_open] 131974 131975[indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.is_open..is_open..windows::basic_overlapped_handle] 131976Determine whether the handle is open. 131977 131978 131979 bool is_open() const; 131980 131981 131982 131983[endsect] 131984 131985 131986[section:lowest_layer windows::basic_overlapped_handle::lowest_layer] 131987 131988[indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.lowest_layer..lowest_layer..windows::basic_overlapped_handle] 131989Get a reference to the lowest layer. 131990 131991 131992 lowest_layer_type & ``[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer.overload1 lowest_layer]``(); 131993 `` [''''»''' [link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer.overload1 more...]]`` 131994 131995 131996Get a const reference to the lowest layer. 131997 131998 131999 const lowest_layer_type & ``[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer.overload2 lowest_layer]``() const; 132000 `` [''''»''' [link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer.overload2 more...]]`` 132001 132002 132003[section:overload1 windows::basic_overlapped_handle::lowest_layer (1 of 2 overloads)] 132004 132005 132006Get a reference to the lowest layer. 132007 132008 132009 lowest_layer_type & lowest_layer(); 132010 132011 132012This 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. 132013 132014 132015[heading Return Value] 132016 132017A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 132018 132019 132020 132021 132022[endsect] 132023 132024 132025 132026[section:overload2 windows::basic_overlapped_handle::lowest_layer (2 of 2 overloads)] 132027 132028 132029Get a const reference to the lowest layer. 132030 132031 132032 const lowest_layer_type & lowest_layer() const; 132033 132034 132035This 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. 132036 132037 132038[heading Return Value] 132039 132040A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 132041 132042 132043 132044 132045[endsect] 132046 132047 132048[endsect] 132049 132050 132051[section:lowest_layer_type windows::basic_overlapped_handle::lowest_layer_type] 132052 132053[indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.lowest_layer_type..lowest_layer_type..windows::basic_overlapped_handle] 132054An overlapped\_handle is always the lowest layer. 132055 132056 132057 typedef basic_overlapped_handle lowest_layer_type; 132058 132059 132060[heading Types] 132061[table 132062 [[Name][Description]] 132063 132064 [ 132065 132066 [[link boost_asio.reference.windows__basic_overlapped_handle__rebind_executor [*rebind_executor]]] 132067 [Rebinds the handle type to another executor. ] 132068 132069 ] 132070 132071 [ 132072 132073 [[link boost_asio.reference.windows__basic_overlapped_handle.executor_type [*executor_type]]] 132074 [The type of the executor associated with the object. ] 132075 132076 ] 132077 132078 [ 132079 132080 [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer_type [*lowest_layer_type]]] 132081 [An overlapped_handle is always the lowest layer. ] 132082 132083 ] 132084 132085 [ 132086 132087 [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle_type [*native_handle_type]]] 132088 [The native representation of a handle. ] 132089 132090 ] 132091 132092] 132093 132094[heading Member Functions] 132095[table 132096 [[Name][Description]] 132097 132098 [ 132099 [[link boost_asio.reference.windows__basic_overlapped_handle.assign [*assign]]] 132100 [Assign an existing native handle to the handle. ] 132101 ] 132102 132103 [ 132104 [[link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle [*basic_overlapped_handle]] [constructor]] 132105 [Construct an overlapped handle without opening it. 132106 [hr] 132107 Construct an overlapped handle on an existing native handle. 132108 [hr] 132109 Move-construct an overlapped handle from another. ] 132110 ] 132111 132112 [ 132113 [[link boost_asio.reference.windows__basic_overlapped_handle.cancel [*cancel]]] 132114 [Cancel all asynchronous operations associated with the handle. ] 132115 ] 132116 132117 [ 132118 [[link boost_asio.reference.windows__basic_overlapped_handle.close [*close]]] 132119 [Close the handle. ] 132120 ] 132121 132122 [ 132123 [[link boost_asio.reference.windows__basic_overlapped_handle.get_executor [*get_executor]]] 132124 [Get the executor associated with the object. ] 132125 ] 132126 132127 [ 132128 [[link boost_asio.reference.windows__basic_overlapped_handle.is_open [*is_open]]] 132129 [Determine whether the handle is open. ] 132130 ] 132131 132132 [ 132133 [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer [*lowest_layer]]] 132134 [Get a reference to the lowest layer. 132135 [hr] 132136 Get a const reference to the lowest layer. ] 132137 ] 132138 132139 [ 132140 [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle [*native_handle]]] 132141 [Get the native handle representation. ] 132142 ] 132143 132144 [ 132145 [[link boost_asio.reference.windows__basic_overlapped_handle.operator_eq_ [*operator=]]] 132146 [Move-assign an overlapped handle from another. ] 132147 ] 132148 132149] 132150 132151[heading Protected Member Functions] 132152[table 132153 [[Name][Description]] 132154 132155 [ 132156 [[link boost_asio.reference.windows__basic_overlapped_handle._basic_overlapped_handle [*~basic_overlapped_handle]] [destructor]] 132157 [Protected destructor to prevent deletion through this type. ] 132158 ] 132159 132160] 132161 132162The [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. 132163 132164 132165[heading Thread Safety] 132166 132167['Distinct] ['objects:] Safe. 132168 132169['Shared] ['objects:] Unsafe. 132170 132171 132172 132173 132174[heading Requirements] 132175 132176['Header: ][^boost/asio/windows/basic_overlapped_handle.hpp] 132177 132178['Convenience header: ][^boost/asio.hpp] 132179 132180 132181[endsect] 132182 132183 132184 132185[section:native_handle windows::basic_overlapped_handle::native_handle] 132186 132187[indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.native_handle..native_handle..windows::basic_overlapped_handle] 132188Get the native handle representation. 132189 132190 132191 native_handle_type native_handle(); 132192 132193 132194This 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. 132195 132196 132197[endsect] 132198 132199 132200 132201[section:native_handle_type windows::basic_overlapped_handle::native_handle_type] 132202 132203[indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.native_handle_type..native_handle_type..windows::basic_overlapped_handle] 132204The native representation of a handle. 132205 132206 132207 typedef implementation_defined native_handle_type; 132208 132209 132210 132211[heading Requirements] 132212 132213['Header: ][^boost/asio/windows/basic_overlapped_handle.hpp] 132214 132215['Convenience header: ][^boost/asio.hpp] 132216 132217 132218[endsect] 132219 132220 132221 132222[section:operator_eq_ windows::basic_overlapped_handle::operator=] 132223 132224[indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.operator_eq_..operator=..windows::basic_overlapped_handle] 132225Move-assign an overlapped handle from another. 132226 132227 132228 basic_overlapped_handle & operator=( 132229 basic_overlapped_handle && other); 132230 132231 132232This assignment operator moves a handle from one object to another. 132233 132234 132235[heading Parameters] 132236 132237 132238[variablelist 132239 132240[[other][The other overlapped handle object from which the move will occur.]] 132241 132242] 132243 132244 132245[heading Remarks] 132246 132247Following the move, the moved-from object is in the same state as if constructed using the `overlapped_handle(const executor_type&)` constructor. 132248 132249 132250 132251 132252[endsect] 132253 132254 132255 132256[section:_basic_overlapped_handle windows::basic_overlapped_handle::~basic_overlapped_handle] 132257 132258[indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle._basic_overlapped_handle..~basic_overlapped_handle..windows::basic_overlapped_handle] 132259Protected destructor to prevent deletion through this type. 132260 132261 132262 ~basic_overlapped_handle(); 132263 132264 132265This function destroys the handle, cancelling any outstanding asynchronous wait operations associated with the handle as if by calling `cancel`. 132266 132267 132268[endsect] 132269 132270 132271 132272[endsect] 132273 132274[section:windows__basic_overlapped_handle__rebind_executor windows::basic_overlapped_handle::rebind_executor] 132275 132276[indexterm1 boost_asio.indexterm.windows__basic_overlapped_handle__rebind_executor..windows::basic_overlapped_handle::rebind_executor] 132277 132278 132279Rebinds the handle type to another executor. 132280 132281 132282 template< 132283 typename ``[link boost_asio.reference.Executor1 Executor1]``> 132284 struct rebind_executor 132285 132286 132287[heading Types] 132288[table 132289 [[Name][Description]] 132290 132291 [ 132292 132293 [[link boost_asio.reference.windows__basic_overlapped_handle__rebind_executor.other [*other]]] 132294 [The handle type when rebound to the specified executor. ] 132295 132296 ] 132297 132298] 132299 132300[heading Requirements] 132301 132302['Header: ][^boost/asio/windows/basic_overlapped_handle.hpp] 132303 132304['Convenience header: ][^boost/asio.hpp] 132305 132306 132307[section:other windows::basic_overlapped_handle::rebind_executor::other] 132308 132309[indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle__rebind_executor.other..other..windows::basic_overlapped_handle::rebind_executor] 132310The handle type when rebound to the specified executor. 132311 132312 132313 typedef basic_overlapped_handle< Executor1 > other; 132314 132315 132316[heading Types] 132317[table 132318 [[Name][Description]] 132319 132320 [ 132321 132322 [[link boost_asio.reference.windows__basic_overlapped_handle__rebind_executor [*rebind_executor]]] 132323 [Rebinds the handle type to another executor. ] 132324 132325 ] 132326 132327 [ 132328 132329 [[link boost_asio.reference.windows__basic_overlapped_handle.executor_type [*executor_type]]] 132330 [The type of the executor associated with the object. ] 132331 132332 ] 132333 132334 [ 132335 132336 [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer_type [*lowest_layer_type]]] 132337 [An overlapped_handle is always the lowest layer. ] 132338 132339 ] 132340 132341 [ 132342 132343 [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle_type [*native_handle_type]]] 132344 [The native representation of a handle. ] 132345 132346 ] 132347 132348] 132349 132350[heading Member Functions] 132351[table 132352 [[Name][Description]] 132353 132354 [ 132355 [[link boost_asio.reference.windows__basic_overlapped_handle.assign [*assign]]] 132356 [Assign an existing native handle to the handle. ] 132357 ] 132358 132359 [ 132360 [[link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle [*basic_overlapped_handle]] [constructor]] 132361 [Construct an overlapped handle without opening it. 132362 [hr] 132363 Construct an overlapped handle on an existing native handle. 132364 [hr] 132365 Move-construct an overlapped handle from another. ] 132366 ] 132367 132368 [ 132369 [[link boost_asio.reference.windows__basic_overlapped_handle.cancel [*cancel]]] 132370 [Cancel all asynchronous operations associated with the handle. ] 132371 ] 132372 132373 [ 132374 [[link boost_asio.reference.windows__basic_overlapped_handle.close [*close]]] 132375 [Close the handle. ] 132376 ] 132377 132378 [ 132379 [[link boost_asio.reference.windows__basic_overlapped_handle.get_executor [*get_executor]]] 132380 [Get the executor associated with the object. ] 132381 ] 132382 132383 [ 132384 [[link boost_asio.reference.windows__basic_overlapped_handle.is_open [*is_open]]] 132385 [Determine whether the handle is open. ] 132386 ] 132387 132388 [ 132389 [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer [*lowest_layer]]] 132390 [Get a reference to the lowest layer. 132391 [hr] 132392 Get a const reference to the lowest layer. ] 132393 ] 132394 132395 [ 132396 [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle [*native_handle]]] 132397 [Get the native handle representation. ] 132398 ] 132399 132400 [ 132401 [[link boost_asio.reference.windows__basic_overlapped_handle.operator_eq_ [*operator=]]] 132402 [Move-assign an overlapped handle from another. ] 132403 ] 132404 132405] 132406 132407[heading Protected Member Functions] 132408[table 132409 [[Name][Description]] 132410 132411 [ 132412 [[link boost_asio.reference.windows__basic_overlapped_handle._basic_overlapped_handle [*~basic_overlapped_handle]] [destructor]] 132413 [Protected destructor to prevent deletion through this type. ] 132414 ] 132415 132416] 132417 132418The [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. 132419 132420 132421[heading Thread Safety] 132422 132423['Distinct] ['objects:] Safe. 132424 132425['Shared] ['objects:] Unsafe. 132426 132427 132428 132429 132430[heading Requirements] 132431 132432['Header: ][^boost/asio/windows/basic_overlapped_handle.hpp] 132433 132434['Convenience header: ][^boost/asio.hpp] 132435 132436 132437[endsect] 132438 132439 132440 132441[endsect] 132442 132443[section:windows__basic_random_access_handle windows::basic_random_access_handle] 132444 132445[indexterm1 boost_asio.indexterm.windows__basic_random_access_handle..windows::basic_random_access_handle] 132446 132447 132448Provides random-access handle functionality. 132449 132450 132451 template< 132452 typename ``[link boost_asio.reference.Executor1 Executor]`` = any_io_executor> 132453 class basic_random_access_handle : 132454 public windows::basic_overlapped_handle< Executor > 132455 132456 132457[heading Types] 132458[table 132459 [[Name][Description]] 132460 132461 [ 132462 132463 [[link boost_asio.reference.windows__basic_random_access_handle__rebind_executor [*rebind_executor]]] 132464 [Rebinds the handle type to another executor. ] 132465 132466 ] 132467 132468 [ 132469 132470 [[link boost_asio.reference.windows__basic_random_access_handle.executor_type [*executor_type]]] 132471 [The type of the executor associated with the object. ] 132472 132473 ] 132474 132475 [ 132476 132477 [[link boost_asio.reference.windows__basic_random_access_handle.lowest_layer_type [*lowest_layer_type]]] 132478 [An overlapped_handle is always the lowest layer. ] 132479 132480 ] 132481 132482 [ 132483 132484 [[link boost_asio.reference.windows__basic_random_access_handle.native_handle_type [*native_handle_type]]] 132485 [The native representation of a handle. ] 132486 132487 ] 132488 132489] 132490 132491[heading Member Functions] 132492[table 132493 [[Name][Description]] 132494 132495 [ 132496 [[link boost_asio.reference.windows__basic_random_access_handle.assign [*assign]]] 132497 [Assign an existing native handle to the handle. ] 132498 ] 132499 132500 [ 132501 [[link boost_asio.reference.windows__basic_random_access_handle.async_read_some_at [*async_read_some_at]]] 132502 [Start an asynchronous read at the specified offset. ] 132503 ] 132504 132505 [ 132506 [[link boost_asio.reference.windows__basic_random_access_handle.async_write_some_at [*async_write_some_at]]] 132507 [Start an asynchronous write at the specified offset. ] 132508 ] 132509 132510 [ 132511 [[link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle [*basic_random_access_handle]] [constructor]] 132512 [Construct a random-access handle without opening it. 132513 [hr] 132514 Construct a random-access handle on an existing native handle. 132515 [hr] 132516 Move-construct a random-access handle from another. ] 132517 ] 132518 132519 [ 132520 [[link boost_asio.reference.windows__basic_random_access_handle.cancel [*cancel]]] 132521 [Cancel all asynchronous operations associated with the handle. ] 132522 ] 132523 132524 [ 132525 [[link boost_asio.reference.windows__basic_random_access_handle.close [*close]]] 132526 [Close the handle. ] 132527 ] 132528 132529 [ 132530 [[link boost_asio.reference.windows__basic_random_access_handle.get_executor [*get_executor]]] 132531 [Get the executor associated with the object. ] 132532 ] 132533 132534 [ 132535 [[link boost_asio.reference.windows__basic_random_access_handle.is_open [*is_open]]] 132536 [Determine whether the handle is open. ] 132537 ] 132538 132539 [ 132540 [[link boost_asio.reference.windows__basic_random_access_handle.lowest_layer [*lowest_layer]]] 132541 [Get a reference to the lowest layer. 132542 [hr] 132543 Get a const reference to the lowest layer. ] 132544 ] 132545 132546 [ 132547 [[link boost_asio.reference.windows__basic_random_access_handle.native_handle [*native_handle]]] 132548 [Get the native handle representation. ] 132549 ] 132550 132551 [ 132552 [[link boost_asio.reference.windows__basic_random_access_handle.operator_eq_ [*operator=]]] 132553 [Move-assign a random-access handle from another. ] 132554 ] 132555 132556 [ 132557 [[link boost_asio.reference.windows__basic_random_access_handle.read_some_at [*read_some_at]]] 132558 [Read some data from the handle at the specified offset. ] 132559 ] 132560 132561 [ 132562 [[link boost_asio.reference.windows__basic_random_access_handle.write_some_at [*write_some_at]]] 132563 [Write some data to the handle at the specified offset. ] 132564 ] 132565 132566] 132567 132568The [link boost_asio.reference.windows__basic_random_access_handle `windows::basic_random_access_handle`] class provides asynchronous and blocking random-access handle functionality. 132569 132570 132571[heading Thread Safety] 132572 132573['Distinct] ['objects:] Safe. 132574 132575['Shared] ['objects:] Unsafe. 132576 132577 132578 132579[heading Requirements] 132580 132581['Header: ][^boost/asio/windows/basic_random_access_handle.hpp] 132582 132583['Convenience header: ][^boost/asio.hpp] 132584 132585[section:assign windows::basic_random_access_handle::assign] 132586 132587[indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.assign..assign..windows::basic_random_access_handle] 132588Assign an existing native handle to the handle. 132589 132590 132591 void ``[link boost_asio.reference.windows__basic_random_access_handle.assign.overload1 assign]``( 132592 const native_handle_type & handle); 132593 `` [''''»''' [link boost_asio.reference.windows__basic_random_access_handle.assign.overload1 more...]]`` 132594 132595 void ``[link boost_asio.reference.windows__basic_random_access_handle.assign.overload2 assign]``( 132596 const native_handle_type & handle, 132597 boost::system::error_code & ec); 132598 `` [''''»''' [link boost_asio.reference.windows__basic_random_access_handle.assign.overload2 more...]]`` 132599 132600 132601[section:overload1 windows::basic_random_access_handle::assign (1 of 2 overloads)] 132602 132603 132604['Inherited from windows::basic_overlapped_handle.] 132605 132606 132607Assign an existing native handle to the handle. 132608 132609 132610 void assign( 132611 const native_handle_type & handle); 132612 132613 132614 132615[endsect] 132616 132617 132618 132619[section:overload2 windows::basic_random_access_handle::assign (2 of 2 overloads)] 132620 132621 132622['Inherited from windows::basic_overlapped_handle.] 132623 132624 132625Assign an existing native handle to the handle. 132626 132627 132628 void assign( 132629 const native_handle_type & handle, 132630 boost::system::error_code & ec); 132631 132632 132633 132634[endsect] 132635 132636 132637[endsect] 132638 132639 132640[section:async_read_some_at windows::basic_random_access_handle::async_read_some_at] 132641 132642[indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.async_read_some_at..async_read_some_at..windows::basic_random_access_handle] 132643Start an asynchronous read at the specified offset. 132644 132645 132646 template< 132647 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 132648 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 132649 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_some_at( 132650 uint64_t offset, 132651 const MutableBufferSequence & buffers, 132652 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 132653 132654 132655This function is used to asynchronously read data from the random-access handle. The function call always returns immediately. 132656 132657 132658[heading Parameters] 132659 132660 132661[variablelist 132662 132663[[offset][The offset at which the data will be read.]] 132664 132665[[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.]] 132666 132667[[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: 132668`` 132669 void handler( 132670 const boost::system::error_code& error, // Result of operation. 132671 std::size_t bytes_transferred // Number of bytes read. 132672 ); 132673`` 132674Regardless 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`].]] 132675 132676] 132677 132678 132679[heading Remarks] 132680 132681The 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. 132682 132683 132684[heading Example] 132685 132686To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 132687 132688 handle.async_read_some_at(42, boost::asio::buffer(data, size), handler); 132689 132690 132691See 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. 132692 132693 132694 132695 132696[endsect] 132697 132698 132699 132700[section:async_write_some_at windows::basic_random_access_handle::async_write_some_at] 132701 132702[indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.async_write_some_at..async_write_some_at..windows::basic_random_access_handle] 132703Start an asynchronous write at the specified offset. 132704 132705 132706 template< 132707 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 132708 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 132709 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_some_at( 132710 uint64_t offset, 132711 const ConstBufferSequence & buffers, 132712 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 132713 132714 132715This function is used to asynchronously write data to the random-access handle. The function call always returns immediately. 132716 132717 132718[heading Parameters] 132719 132720 132721[variablelist 132722 132723[[offset][The offset at which the data will be written.]] 132724 132725[[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.]] 132726 132727[[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: 132728`` 132729 void handler( 132730 const boost::system::error_code& error, // Result of operation. 132731 std::size_t bytes_transferred // Number of bytes written. 132732 ); 132733`` 132734Regardless 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`].]] 132735 132736] 132737 132738 132739[heading Remarks] 132740 132741The 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. 132742 132743 132744[heading Example] 132745 132746To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 132747 132748 handle.async_write_some_at(42, boost::asio::buffer(data, size), handler); 132749 132750 132751See 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. 132752 132753 132754 132755 132756[endsect] 132757 132758 132759[section:basic_random_access_handle windows::basic_random_access_handle::basic_random_access_handle] 132760 132761[indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.basic_random_access_handle..basic_random_access_handle..windows::basic_random_access_handle] 132762Construct a random-access handle without opening it. 132763 132764 132765 explicit ``[link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle.overload1 basic_random_access_handle]``( 132766 const executor_type & ex); 132767 `` [''''»''' [link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle.overload1 more...]]`` 132768 132769 template< 132770 typename ExecutionContext> 132771 explicit ``[link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle.overload2 basic_random_access_handle]``( 132772 ExecutionContext & context, 132773 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value, defaulted_constraint >::type = defaulted_constraint()); 132774 `` [''''»''' [link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle.overload2 more...]]`` 132775 132776 132777Construct a random-access handle on an existing native handle. 132778 132779 132780 ``[link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle.overload3 basic_random_access_handle]``( 132781 const executor_type & ex, 132782 const native_handle_type & handle); 132783 `` [''''»''' [link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle.overload3 more...]]`` 132784 132785 template< 132786 typename ExecutionContext> 132787 ``[link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle.overload4 basic_random_access_handle]``( 132788 ExecutionContext & context, 132789 const native_handle_type & handle, 132790 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 132791 `` [''''»''' [link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle.overload4 more...]]`` 132792 132793 132794Move-construct a random-access handle from another. 132795 132796 132797 ``[link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle.overload5 basic_random_access_handle]``( 132798 basic_random_access_handle && other); 132799 `` [''''»''' [link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle.overload5 more...]]`` 132800 132801 132802[section:overload1 windows::basic_random_access_handle::basic_random_access_handle (1 of 5 overloads)] 132803 132804 132805Construct a random-access handle without opening it. 132806 132807 132808 basic_random_access_handle( 132809 const executor_type & ex); 132810 132811 132812This constructor creates a random-access handle without opening it. 132813 132814 132815[heading Parameters] 132816 132817 132818[variablelist 132819 132820[[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. ]] 132821 132822] 132823 132824 132825 132826 132827[endsect] 132828 132829 132830 132831[section:overload2 windows::basic_random_access_handle::basic_random_access_handle (2 of 5 overloads)] 132832 132833 132834Construct a random-access handle without opening it. 132835 132836 132837 template< 132838 typename ExecutionContext> 132839 basic_random_access_handle( 132840 ExecutionContext & context, 132841 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value, defaulted_constraint >::type = defaulted_constraint()); 132842 132843 132844This 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. 132845 132846 132847[heading Parameters] 132848 132849 132850[variablelist 132851 132852[[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. ]] 132853 132854] 132855 132856 132857 132858 132859[endsect] 132860 132861 132862 132863[section:overload3 windows::basic_random_access_handle::basic_random_access_handle (3 of 5 overloads)] 132864 132865 132866Construct a random-access handle on an existing native handle. 132867 132868 132869 basic_random_access_handle( 132870 const executor_type & ex, 132871 const native_handle_type & handle); 132872 132873 132874This constructor creates a random-access handle object to hold an existing native handle. 132875 132876 132877[heading Parameters] 132878 132879 132880[variablelist 132881 132882[[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.]] 132883 132884[[handle][The new underlying handle implementation.]] 132885 132886] 132887 132888 132889[heading Exceptions] 132890 132891 132892[variablelist 132893 132894[[boost::system::system_error][Thrown on failure. ]] 132895 132896] 132897 132898 132899 132900 132901[endsect] 132902 132903 132904 132905[section:overload4 windows::basic_random_access_handle::basic_random_access_handle (4 of 5 overloads)] 132906 132907 132908Construct a random-access handle on an existing native handle. 132909 132910 132911 template< 132912 typename ExecutionContext> 132913 basic_random_access_handle( 132914 ExecutionContext & context, 132915 const native_handle_type & handle, 132916 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 132917 132918 132919This constructor creates a random-access handle object to hold an existing native handle. 132920 132921 132922[heading Parameters] 132923 132924 132925[variablelist 132926 132927[[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.]] 132928 132929[[handle][The new underlying handle implementation.]] 132930 132931] 132932 132933 132934[heading Exceptions] 132935 132936 132937[variablelist 132938 132939[[boost::system::system_error][Thrown on failure. ]] 132940 132941] 132942 132943 132944 132945 132946[endsect] 132947 132948 132949 132950[section:overload5 windows::basic_random_access_handle::basic_random_access_handle (5 of 5 overloads)] 132951 132952 132953Move-construct a random-access handle from another. 132954 132955 132956 basic_random_access_handle( 132957 basic_random_access_handle && other); 132958 132959 132960This constructor moves a random-access handle from one object to another. 132961 132962 132963[heading Parameters] 132964 132965 132966[variablelist 132967 132968[[other][The other random-access handle object from which the move will occur.]] 132969 132970] 132971 132972 132973[heading Remarks] 132974 132975Following the move, the moved-from object is in the same state as if constructed using the `basic_random_access_handle(const executor_type&)` constructor. 132976 132977 132978 132979 132980[endsect] 132981 132982 132983[endsect] 132984 132985[section:cancel windows::basic_random_access_handle::cancel] 132986 132987[indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.cancel..cancel..windows::basic_random_access_handle] 132988Cancel all asynchronous operations associated with the handle. 132989 132990 132991 void ``[link boost_asio.reference.windows__basic_random_access_handle.cancel.overload1 cancel]``(); 132992 `` [''''»''' [link boost_asio.reference.windows__basic_random_access_handle.cancel.overload1 more...]]`` 132993 132994 void ``[link boost_asio.reference.windows__basic_random_access_handle.cancel.overload2 cancel]``( 132995 boost::system::error_code & ec); 132996 `` [''''»''' [link boost_asio.reference.windows__basic_random_access_handle.cancel.overload2 more...]]`` 132997 132998 132999[section:overload1 windows::basic_random_access_handle::cancel (1 of 2 overloads)] 133000 133001 133002['Inherited from windows::basic_overlapped_handle.] 133003 133004 133005Cancel all asynchronous operations associated with the handle. 133006 133007 133008 void cancel(); 133009 133010 133011This 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. 133012 133013 133014[heading Exceptions] 133015 133016 133017[variablelist 133018 133019[[boost::system::system_error][Thrown on failure. ]] 133020 133021] 133022 133023 133024 133025 133026[endsect] 133027 133028 133029 133030[section:overload2 windows::basic_random_access_handle::cancel (2 of 2 overloads)] 133031 133032 133033['Inherited from windows::basic_overlapped_handle.] 133034 133035 133036Cancel all asynchronous operations associated with the handle. 133037 133038 133039 void cancel( 133040 boost::system::error_code & ec); 133041 133042 133043This 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. 133044 133045 133046[heading Parameters] 133047 133048 133049[variablelist 133050 133051[[ec][Set to indicate what error occurred, if any. ]] 133052 133053] 133054 133055 133056 133057 133058[endsect] 133059 133060 133061[endsect] 133062 133063[section:close windows::basic_random_access_handle::close] 133064 133065[indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.close..close..windows::basic_random_access_handle] 133066Close the handle. 133067 133068 133069 void ``[link boost_asio.reference.windows__basic_random_access_handle.close.overload1 close]``(); 133070 `` [''''»''' [link boost_asio.reference.windows__basic_random_access_handle.close.overload1 more...]]`` 133071 133072 void ``[link boost_asio.reference.windows__basic_random_access_handle.close.overload2 close]``( 133073 boost::system::error_code & ec); 133074 `` [''''»''' [link boost_asio.reference.windows__basic_random_access_handle.close.overload2 more...]]`` 133075 133076 133077[section:overload1 windows::basic_random_access_handle::close (1 of 2 overloads)] 133078 133079 133080['Inherited from windows::basic_overlapped_handle.] 133081 133082 133083Close the handle. 133084 133085 133086 void close(); 133087 133088 133089This 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. 133090 133091 133092[heading Exceptions] 133093 133094 133095[variablelist 133096 133097[[boost::system::system_error][Thrown on failure. ]] 133098 133099] 133100 133101 133102 133103 133104[endsect] 133105 133106 133107 133108[section:overload2 windows::basic_random_access_handle::close (2 of 2 overloads)] 133109 133110 133111['Inherited from windows::basic_overlapped_handle.] 133112 133113 133114Close the handle. 133115 133116 133117 void close( 133118 boost::system::error_code & ec); 133119 133120 133121This 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. 133122 133123 133124[heading Parameters] 133125 133126 133127[variablelist 133128 133129[[ec][Set to indicate what error occurred, if any. ]] 133130 133131] 133132 133133 133134 133135 133136[endsect] 133137 133138 133139[endsect] 133140 133141 133142[section:executor_type windows::basic_random_access_handle::executor_type] 133143 133144[indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.executor_type..executor_type..windows::basic_random_access_handle] 133145The type of the executor associated with the object. 133146 133147 133148 typedef Executor executor_type; 133149 133150 133151 133152[heading Requirements] 133153 133154['Header: ][^boost/asio/windows/basic_random_access_handle.hpp] 133155 133156['Convenience header: ][^boost/asio.hpp] 133157 133158 133159[endsect] 133160 133161 133162 133163[section:get_executor windows::basic_random_access_handle::get_executor] 133164 133165 133166['Inherited from windows::basic_overlapped_handle.] 133167 133168[indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.get_executor..get_executor..windows::basic_random_access_handle] 133169Get the executor associated with the object. 133170 133171 133172 executor_type get_executor(); 133173 133174 133175 133176[endsect] 133177 133178 133179 133180[section:is_open windows::basic_random_access_handle::is_open] 133181 133182 133183['Inherited from windows::basic_overlapped_handle.] 133184 133185[indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.is_open..is_open..windows::basic_random_access_handle] 133186Determine whether the handle is open. 133187 133188 133189 bool is_open() const; 133190 133191 133192 133193[endsect] 133194 133195 133196[section:lowest_layer windows::basic_random_access_handle::lowest_layer] 133197 133198[indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.lowest_layer..lowest_layer..windows::basic_random_access_handle] 133199Get a reference to the lowest layer. 133200 133201 133202 lowest_layer_type & ``[link boost_asio.reference.windows__basic_random_access_handle.lowest_layer.overload1 lowest_layer]``(); 133203 `` [''''»''' [link boost_asio.reference.windows__basic_random_access_handle.lowest_layer.overload1 more...]]`` 133204 133205 133206Get a const reference to the lowest layer. 133207 133208 133209 const lowest_layer_type & ``[link boost_asio.reference.windows__basic_random_access_handle.lowest_layer.overload2 lowest_layer]``() const; 133210 `` [''''»''' [link boost_asio.reference.windows__basic_random_access_handle.lowest_layer.overload2 more...]]`` 133211 133212 133213[section:overload1 windows::basic_random_access_handle::lowest_layer (1 of 2 overloads)] 133214 133215 133216['Inherited from windows::basic_overlapped_handle.] 133217 133218 133219Get a reference to the lowest layer. 133220 133221 133222 lowest_layer_type & lowest_layer(); 133223 133224 133225This 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. 133226 133227 133228[heading Return Value] 133229 133230A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 133231 133232 133233 133234 133235[endsect] 133236 133237 133238 133239[section:overload2 windows::basic_random_access_handle::lowest_layer (2 of 2 overloads)] 133240 133241 133242['Inherited from windows::basic_overlapped_handle.] 133243 133244 133245Get a const reference to the lowest layer. 133246 133247 133248 const lowest_layer_type & lowest_layer() const; 133249 133250 133251This 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. 133252 133253 133254[heading Return Value] 133255 133256A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 133257 133258 133259 133260 133261[endsect] 133262 133263 133264[endsect] 133265 133266 133267[section:lowest_layer_type windows::basic_random_access_handle::lowest_layer_type] 133268 133269 133270['Inherited from windows::basic_overlapped_handle.] 133271 133272[indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.lowest_layer_type..lowest_layer_type..windows::basic_random_access_handle] 133273An overlapped\_handle is always the lowest layer. 133274 133275 133276 typedef basic_overlapped_handle lowest_layer_type; 133277 133278 133279[heading Types] 133280[table 133281 [[Name][Description]] 133282 133283 [ 133284 133285 [[link boost_asio.reference.windows__basic_overlapped_handle__rebind_executor [*rebind_executor]]] 133286 [Rebinds the handle type to another executor. ] 133287 133288 ] 133289 133290 [ 133291 133292 [[link boost_asio.reference.windows__basic_overlapped_handle.executor_type [*executor_type]]] 133293 [The type of the executor associated with the object. ] 133294 133295 ] 133296 133297 [ 133298 133299 [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer_type [*lowest_layer_type]]] 133300 [An overlapped_handle is always the lowest layer. ] 133301 133302 ] 133303 133304 [ 133305 133306 [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle_type [*native_handle_type]]] 133307 [The native representation of a handle. ] 133308 133309 ] 133310 133311] 133312 133313[heading Member Functions] 133314[table 133315 [[Name][Description]] 133316 133317 [ 133318 [[link boost_asio.reference.windows__basic_overlapped_handle.assign [*assign]]] 133319 [Assign an existing native handle to the handle. ] 133320 ] 133321 133322 [ 133323 [[link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle [*basic_overlapped_handle]] [constructor]] 133324 [Construct an overlapped handle without opening it. 133325 [hr] 133326 Construct an overlapped handle on an existing native handle. 133327 [hr] 133328 Move-construct an overlapped handle from another. ] 133329 ] 133330 133331 [ 133332 [[link boost_asio.reference.windows__basic_overlapped_handle.cancel [*cancel]]] 133333 [Cancel all asynchronous operations associated with the handle. ] 133334 ] 133335 133336 [ 133337 [[link boost_asio.reference.windows__basic_overlapped_handle.close [*close]]] 133338 [Close the handle. ] 133339 ] 133340 133341 [ 133342 [[link boost_asio.reference.windows__basic_overlapped_handle.get_executor [*get_executor]]] 133343 [Get the executor associated with the object. ] 133344 ] 133345 133346 [ 133347 [[link boost_asio.reference.windows__basic_overlapped_handle.is_open [*is_open]]] 133348 [Determine whether the handle is open. ] 133349 ] 133350 133351 [ 133352 [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer [*lowest_layer]]] 133353 [Get a reference to the lowest layer. 133354 [hr] 133355 Get a const reference to the lowest layer. ] 133356 ] 133357 133358 [ 133359 [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle [*native_handle]]] 133360 [Get the native handle representation. ] 133361 ] 133362 133363 [ 133364 [[link boost_asio.reference.windows__basic_overlapped_handle.operator_eq_ [*operator=]]] 133365 [Move-assign an overlapped handle from another. ] 133366 ] 133367 133368] 133369 133370[heading Protected Member Functions] 133371[table 133372 [[Name][Description]] 133373 133374 [ 133375 [[link boost_asio.reference.windows__basic_overlapped_handle._basic_overlapped_handle [*~basic_overlapped_handle]] [destructor]] 133376 [Protected destructor to prevent deletion through this type. ] 133377 ] 133378 133379] 133380 133381The [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. 133382 133383 133384[heading Thread Safety] 133385 133386['Distinct] ['objects:] Safe. 133387 133388['Shared] ['objects:] Unsafe. 133389 133390 133391 133392 133393[heading Requirements] 133394 133395['Header: ][^boost/asio/windows/basic_random_access_handle.hpp] 133396 133397['Convenience header: ][^boost/asio.hpp] 133398 133399 133400[endsect] 133401 133402 133403 133404[section:native_handle windows::basic_random_access_handle::native_handle] 133405 133406 133407['Inherited from windows::basic_overlapped_handle.] 133408 133409[indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.native_handle..native_handle..windows::basic_random_access_handle] 133410Get the native handle representation. 133411 133412 133413 native_handle_type native_handle(); 133414 133415 133416This 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. 133417 133418 133419[endsect] 133420 133421 133422 133423[section:native_handle_type windows::basic_random_access_handle::native_handle_type] 133424 133425[indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.native_handle_type..native_handle_type..windows::basic_random_access_handle] 133426The native representation of a handle. 133427 133428 133429 typedef implementation_defined native_handle_type; 133430 133431 133432 133433[heading Requirements] 133434 133435['Header: ][^boost/asio/windows/basic_random_access_handle.hpp] 133436 133437['Convenience header: ][^boost/asio.hpp] 133438 133439 133440[endsect] 133441 133442 133443 133444[section:operator_eq_ windows::basic_random_access_handle::operator=] 133445 133446[indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.operator_eq_..operator=..windows::basic_random_access_handle] 133447Move-assign a random-access handle from another. 133448 133449 133450 basic_random_access_handle & operator=( 133451 basic_random_access_handle && other); 133452 133453 133454This assignment operator moves a random-access handle from one object to another. 133455 133456 133457[heading Parameters] 133458 133459 133460[variablelist 133461 133462[[other][The other random-access handle object from which the move will occur.]] 133463 133464] 133465 133466 133467[heading Remarks] 133468 133469Following the move, the moved-from object is in the same state as if constructed using the `basic_random_access_handle(const executor_type&)` constructor. 133470 133471 133472 133473 133474[endsect] 133475 133476 133477[section:read_some_at windows::basic_random_access_handle::read_some_at] 133478 133479[indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.read_some_at..read_some_at..windows::basic_random_access_handle] 133480Read some data from the handle at the specified offset. 133481 133482 133483 template< 133484 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 133485 std::size_t ``[link boost_asio.reference.windows__basic_random_access_handle.read_some_at.overload1 read_some_at]``( 133486 uint64_t offset, 133487 const MutableBufferSequence & buffers); 133488 `` [''''»''' [link boost_asio.reference.windows__basic_random_access_handle.read_some_at.overload1 more...]]`` 133489 133490 template< 133491 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 133492 std::size_t ``[link boost_asio.reference.windows__basic_random_access_handle.read_some_at.overload2 read_some_at]``( 133493 uint64_t offset, 133494 const MutableBufferSequence & buffers, 133495 boost::system::error_code & ec); 133496 `` [''''»''' [link boost_asio.reference.windows__basic_random_access_handle.read_some_at.overload2 more...]]`` 133497 133498 133499[section:overload1 windows::basic_random_access_handle::read_some_at (1 of 2 overloads)] 133500 133501 133502Read some data from the handle at the specified offset. 133503 133504 133505 template< 133506 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 133507 std::size_t read_some_at( 133508 uint64_t offset, 133509 const MutableBufferSequence & buffers); 133510 133511 133512This 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. 133513 133514 133515[heading Parameters] 133516 133517 133518[variablelist 133519 133520[[offset][The offset at which the data will be read.]] 133521 133522[[buffers][One or more buffers into which the data will be read.]] 133523 133524] 133525 133526 133527[heading Return Value] 133528 133529The number of bytes read. 133530 133531 133532[heading Exceptions] 133533 133534 133535[variablelist 133536 133537[[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]] 133538 133539] 133540 133541 133542[heading Remarks] 133543 133544The 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. 133545 133546 133547[heading Example] 133548 133549To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 133550 133551 handle.read_some_at(42, boost::asio::buffer(data, size)); 133552 133553 133554See 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. 133555 133556 133557 133558 133559[endsect] 133560 133561 133562 133563[section:overload2 windows::basic_random_access_handle::read_some_at (2 of 2 overloads)] 133564 133565 133566Read some data from the handle at the specified offset. 133567 133568 133569 template< 133570 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 133571 std::size_t read_some_at( 133572 uint64_t offset, 133573 const MutableBufferSequence & buffers, 133574 boost::system::error_code & ec); 133575 133576 133577This 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. 133578 133579 133580[heading Parameters] 133581 133582 133583[variablelist 133584 133585[[offset][The offset at which the data will be read.]] 133586 133587[[buffers][One or more buffers into which the data will be read.]] 133588 133589[[ec][Set to indicate what error occurred, if any.]] 133590 133591] 133592 133593 133594[heading Return Value] 133595 133596The number of bytes read. Returns 0 if an error occurred. 133597 133598 133599[heading Remarks] 133600 133601The 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. 133602 133603 133604 133605 133606[endsect] 133607 133608 133609[endsect] 133610 133611[section:write_some_at windows::basic_random_access_handle::write_some_at] 133612 133613[indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.write_some_at..write_some_at..windows::basic_random_access_handle] 133614Write some data to the handle at the specified offset. 133615 133616 133617 template< 133618 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 133619 std::size_t ``[link boost_asio.reference.windows__basic_random_access_handle.write_some_at.overload1 write_some_at]``( 133620 uint64_t offset, 133621 const ConstBufferSequence & buffers); 133622 `` [''''»''' [link boost_asio.reference.windows__basic_random_access_handle.write_some_at.overload1 more...]]`` 133623 133624 template< 133625 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 133626 std::size_t ``[link boost_asio.reference.windows__basic_random_access_handle.write_some_at.overload2 write_some_at]``( 133627 uint64_t offset, 133628 const ConstBufferSequence & buffers, 133629 boost::system::error_code & ec); 133630 `` [''''»''' [link boost_asio.reference.windows__basic_random_access_handle.write_some_at.overload2 more...]]`` 133631 133632 133633[section:overload1 windows::basic_random_access_handle::write_some_at (1 of 2 overloads)] 133634 133635 133636Write some data to the handle at the specified offset. 133637 133638 133639 template< 133640 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 133641 std::size_t write_some_at( 133642 uint64_t offset, 133643 const ConstBufferSequence & buffers); 133644 133645 133646This 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. 133647 133648 133649[heading Parameters] 133650 133651 133652[variablelist 133653 133654[[offset][The offset at which the data will be written.]] 133655 133656[[buffers][One or more data buffers to be written to the handle.]] 133657 133658] 133659 133660 133661[heading Return Value] 133662 133663The number of bytes written. 133664 133665 133666[heading Exceptions] 133667 133668 133669[variablelist 133670 133671[[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]] 133672 133673] 133674 133675 133676[heading Remarks] 133677 133678The 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. 133679 133680 133681[heading Example] 133682 133683To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 133684 133685 handle.write_some_at(42, boost::asio::buffer(data, size)); 133686 133687 133688See 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. 133689 133690 133691 133692 133693[endsect] 133694 133695 133696 133697[section:overload2 windows::basic_random_access_handle::write_some_at (2 of 2 overloads)] 133698 133699 133700Write some data to the handle at the specified offset. 133701 133702 133703 template< 133704 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 133705 std::size_t write_some_at( 133706 uint64_t offset, 133707 const ConstBufferSequence & buffers, 133708 boost::system::error_code & ec); 133709 133710 133711This 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. 133712 133713 133714[heading Parameters] 133715 133716 133717[variablelist 133718 133719[[offset][The offset at which the data will be written.]] 133720 133721[[buffers][One or more data buffers to be written to the handle.]] 133722 133723[[ec][Set to indicate what error occurred, if any.]] 133724 133725] 133726 133727 133728[heading Return Value] 133729 133730The number of bytes written. Returns 0 if an error occurred. 133731 133732 133733[heading Remarks] 133734 133735The 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. 133736 133737 133738 133739 133740[endsect] 133741 133742 133743[endsect] 133744 133745 133746[endsect] 133747 133748[section:windows__basic_random_access_handle__rebind_executor windows::basic_random_access_handle::rebind_executor] 133749 133750[indexterm1 boost_asio.indexterm.windows__basic_random_access_handle__rebind_executor..windows::basic_random_access_handle::rebind_executor] 133751 133752 133753Rebinds the handle type to another executor. 133754 133755 133756 template< 133757 typename ``[link boost_asio.reference.Executor1 Executor1]``> 133758 struct rebind_executor 133759 133760 133761[heading Types] 133762[table 133763 [[Name][Description]] 133764 133765 [ 133766 133767 [[link boost_asio.reference.windows__basic_random_access_handle__rebind_executor.other [*other]]] 133768 [The handle type when rebound to the specified executor. ] 133769 133770 ] 133771 133772] 133773 133774[heading Requirements] 133775 133776['Header: ][^boost/asio/windows/basic_random_access_handle.hpp] 133777 133778['Convenience header: ][^boost/asio.hpp] 133779 133780 133781[section:other windows::basic_random_access_handle::rebind_executor::other] 133782 133783[indexterm2 boost_asio.indexterm.windows__basic_random_access_handle__rebind_executor.other..other..windows::basic_random_access_handle::rebind_executor] 133784The handle type when rebound to the specified executor. 133785 133786 133787 typedef basic_random_access_handle< Executor1 > other; 133788 133789 133790[heading Types] 133791[table 133792 [[Name][Description]] 133793 133794 [ 133795 133796 [[link boost_asio.reference.windows__basic_random_access_handle__rebind_executor [*rebind_executor]]] 133797 [Rebinds the handle type to another executor. ] 133798 133799 ] 133800 133801 [ 133802 133803 [[link boost_asio.reference.windows__basic_random_access_handle.executor_type [*executor_type]]] 133804 [The type of the executor associated with the object. ] 133805 133806 ] 133807 133808 [ 133809 133810 [[link boost_asio.reference.windows__basic_random_access_handle.lowest_layer_type [*lowest_layer_type]]] 133811 [An overlapped_handle is always the lowest layer. ] 133812 133813 ] 133814 133815 [ 133816 133817 [[link boost_asio.reference.windows__basic_random_access_handle.native_handle_type [*native_handle_type]]] 133818 [The native representation of a handle. ] 133819 133820 ] 133821 133822] 133823 133824[heading Member Functions] 133825[table 133826 [[Name][Description]] 133827 133828 [ 133829 [[link boost_asio.reference.windows__basic_random_access_handle.assign [*assign]]] 133830 [Assign an existing native handle to the handle. ] 133831 ] 133832 133833 [ 133834 [[link boost_asio.reference.windows__basic_random_access_handle.async_read_some_at [*async_read_some_at]]] 133835 [Start an asynchronous read at the specified offset. ] 133836 ] 133837 133838 [ 133839 [[link boost_asio.reference.windows__basic_random_access_handle.async_write_some_at [*async_write_some_at]]] 133840 [Start an asynchronous write at the specified offset. ] 133841 ] 133842 133843 [ 133844 [[link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle [*basic_random_access_handle]] [constructor]] 133845 [Construct a random-access handle without opening it. 133846 [hr] 133847 Construct a random-access handle on an existing native handle. 133848 [hr] 133849 Move-construct a random-access handle from another. ] 133850 ] 133851 133852 [ 133853 [[link boost_asio.reference.windows__basic_random_access_handle.cancel [*cancel]]] 133854 [Cancel all asynchronous operations associated with the handle. ] 133855 ] 133856 133857 [ 133858 [[link boost_asio.reference.windows__basic_random_access_handle.close [*close]]] 133859 [Close the handle. ] 133860 ] 133861 133862 [ 133863 [[link boost_asio.reference.windows__basic_random_access_handle.get_executor [*get_executor]]] 133864 [Get the executor associated with the object. ] 133865 ] 133866 133867 [ 133868 [[link boost_asio.reference.windows__basic_random_access_handle.is_open [*is_open]]] 133869 [Determine whether the handle is open. ] 133870 ] 133871 133872 [ 133873 [[link boost_asio.reference.windows__basic_random_access_handle.lowest_layer [*lowest_layer]]] 133874 [Get a reference to the lowest layer. 133875 [hr] 133876 Get a const reference to the lowest layer. ] 133877 ] 133878 133879 [ 133880 [[link boost_asio.reference.windows__basic_random_access_handle.native_handle [*native_handle]]] 133881 [Get the native handle representation. ] 133882 ] 133883 133884 [ 133885 [[link boost_asio.reference.windows__basic_random_access_handle.operator_eq_ [*operator=]]] 133886 [Move-assign a random-access handle from another. ] 133887 ] 133888 133889 [ 133890 [[link boost_asio.reference.windows__basic_random_access_handle.read_some_at [*read_some_at]]] 133891 [Read some data from the handle at the specified offset. ] 133892 ] 133893 133894 [ 133895 [[link boost_asio.reference.windows__basic_random_access_handle.write_some_at [*write_some_at]]] 133896 [Write some data to the handle at the specified offset. ] 133897 ] 133898 133899] 133900 133901The [link boost_asio.reference.windows__basic_random_access_handle `windows::basic_random_access_handle`] class provides asynchronous and blocking random-access handle functionality. 133902 133903 133904[heading Thread Safety] 133905 133906['Distinct] ['objects:] Safe. 133907 133908['Shared] ['objects:] Unsafe. 133909 133910 133911 133912 133913[heading Requirements] 133914 133915['Header: ][^boost/asio/windows/basic_random_access_handle.hpp] 133916 133917['Convenience header: ][^boost/asio.hpp] 133918 133919 133920[endsect] 133921 133922 133923 133924[endsect] 133925 133926[section:windows__basic_stream_handle windows::basic_stream_handle] 133927 133928[indexterm1 boost_asio.indexterm.windows__basic_stream_handle..windows::basic_stream_handle] 133929 133930 133931Provides stream-oriented handle functionality. 133932 133933 133934 template< 133935 typename ``[link boost_asio.reference.Executor1 Executor]`` = any_io_executor> 133936 class basic_stream_handle : 133937 public windows::basic_overlapped_handle< Executor > 133938 133939 133940[heading Types] 133941[table 133942 [[Name][Description]] 133943 133944 [ 133945 133946 [[link boost_asio.reference.windows__basic_stream_handle__rebind_executor [*rebind_executor]]] 133947 [Rebinds the handle type to another executor. ] 133948 133949 ] 133950 133951 [ 133952 133953 [[link boost_asio.reference.windows__basic_stream_handle.executor_type [*executor_type]]] 133954 [The type of the executor associated with the object. ] 133955 133956 ] 133957 133958 [ 133959 133960 [[link boost_asio.reference.windows__basic_stream_handle.lowest_layer_type [*lowest_layer_type]]] 133961 [An overlapped_handle is always the lowest layer. ] 133962 133963 ] 133964 133965 [ 133966 133967 [[link boost_asio.reference.windows__basic_stream_handle.native_handle_type [*native_handle_type]]] 133968 [The native representation of a handle. ] 133969 133970 ] 133971 133972] 133973 133974[heading Member Functions] 133975[table 133976 [[Name][Description]] 133977 133978 [ 133979 [[link boost_asio.reference.windows__basic_stream_handle.assign [*assign]]] 133980 [Assign an existing native handle to the handle. ] 133981 ] 133982 133983 [ 133984 [[link boost_asio.reference.windows__basic_stream_handle.async_read_some [*async_read_some]]] 133985 [Start an asynchronous read. ] 133986 ] 133987 133988 [ 133989 [[link boost_asio.reference.windows__basic_stream_handle.async_write_some [*async_write_some]]] 133990 [Start an asynchronous write. ] 133991 ] 133992 133993 [ 133994 [[link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle [*basic_stream_handle]] [constructor]] 133995 [Construct a stream handle without opening it. 133996 [hr] 133997 Construct a stream handle on an existing native handle. 133998 [hr] 133999 Move-construct a stream handle from another. ] 134000 ] 134001 134002 [ 134003 [[link boost_asio.reference.windows__basic_stream_handle.cancel [*cancel]]] 134004 [Cancel all asynchronous operations associated with the handle. ] 134005 ] 134006 134007 [ 134008 [[link boost_asio.reference.windows__basic_stream_handle.close [*close]]] 134009 [Close the handle. ] 134010 ] 134011 134012 [ 134013 [[link boost_asio.reference.windows__basic_stream_handle.get_executor [*get_executor]]] 134014 [Get the executor associated with the object. ] 134015 ] 134016 134017 [ 134018 [[link boost_asio.reference.windows__basic_stream_handle.is_open [*is_open]]] 134019 [Determine whether the handle is open. ] 134020 ] 134021 134022 [ 134023 [[link boost_asio.reference.windows__basic_stream_handle.lowest_layer [*lowest_layer]]] 134024 [Get a reference to the lowest layer. 134025 [hr] 134026 Get a const reference to the lowest layer. ] 134027 ] 134028 134029 [ 134030 [[link boost_asio.reference.windows__basic_stream_handle.native_handle [*native_handle]]] 134031 [Get the native handle representation. ] 134032 ] 134033 134034 [ 134035 [[link boost_asio.reference.windows__basic_stream_handle.operator_eq_ [*operator=]]] 134036 [Move-assign a stream handle from another. ] 134037 ] 134038 134039 [ 134040 [[link boost_asio.reference.windows__basic_stream_handle.read_some [*read_some]]] 134041 [Read some data from the handle. ] 134042 ] 134043 134044 [ 134045 [[link boost_asio.reference.windows__basic_stream_handle.write_some [*write_some]]] 134046 [Write some data to the handle. ] 134047 ] 134048 134049] 134050 134051The [link boost_asio.reference.windows__basic_stream_handle `windows::basic_stream_handle`] class provides asynchronous and blocking stream-oriented handle functionality. 134052 134053 134054[heading Thread Safety] 134055 134056['Distinct] ['objects:] Safe. 134057 134058['Shared] ['objects:] Unsafe. 134059 134060 134061 134062 134063[heading Requirements] 134064 134065['Header: ][^boost/asio/windows/basic_stream_handle.hpp] 134066 134067['Convenience header: ][^boost/asio.hpp] 134068 134069[section:assign windows::basic_stream_handle::assign] 134070 134071[indexterm2 boost_asio.indexterm.windows__basic_stream_handle.assign..assign..windows::basic_stream_handle] 134072Assign an existing native handle to the handle. 134073 134074 134075 void ``[link boost_asio.reference.windows__basic_stream_handle.assign.overload1 assign]``( 134076 const native_handle_type & handle); 134077 `` [''''»''' [link boost_asio.reference.windows__basic_stream_handle.assign.overload1 more...]]`` 134078 134079 void ``[link boost_asio.reference.windows__basic_stream_handle.assign.overload2 assign]``( 134080 const native_handle_type & handle, 134081 boost::system::error_code & ec); 134082 `` [''''»''' [link boost_asio.reference.windows__basic_stream_handle.assign.overload2 more...]]`` 134083 134084 134085[section:overload1 windows::basic_stream_handle::assign (1 of 2 overloads)] 134086 134087 134088['Inherited from windows::basic_overlapped_handle.] 134089 134090 134091Assign an existing native handle to the handle. 134092 134093 134094 void assign( 134095 const native_handle_type & handle); 134096 134097 134098 134099[endsect] 134100 134101 134102 134103[section:overload2 windows::basic_stream_handle::assign (2 of 2 overloads)] 134104 134105 134106['Inherited from windows::basic_overlapped_handle.] 134107 134108 134109Assign an existing native handle to the handle. 134110 134111 134112 void assign( 134113 const native_handle_type & handle, 134114 boost::system::error_code & ec); 134115 134116 134117 134118[endsect] 134119 134120 134121[endsect] 134122 134123 134124[section:async_read_some windows::basic_stream_handle::async_read_some] 134125 134126[indexterm2 boost_asio.indexterm.windows__basic_stream_handle.async_read_some..async_read_some..windows::basic_stream_handle] 134127Start an asynchronous read. 134128 134129 134130 template< 134131 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, 134132 typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 134133 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_some( 134134 const MutableBufferSequence & buffers, 134135 ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 134136 134137 134138This function is used to asynchronously read data from the stream handle. The function call always returns immediately. 134139 134140 134141[heading Parameters] 134142 134143 134144[variablelist 134145 134146[[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.]] 134147 134148[[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: 134149`` 134150 void handler( 134151 const boost::system::error_code& error, // Result of operation. 134152 std::size_t bytes_transferred // Number of bytes read. 134153 ); 134154`` 134155Regardless 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`].]] 134156 134157] 134158 134159 134160[heading Remarks] 134161 134162The 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. 134163 134164 134165[heading Example] 134166 134167To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 134168 134169 handle.async_read_some(boost::asio::buffer(data, size), handler); 134170 134171 134172See 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. 134173 134174 134175 134176 134177[endsect] 134178 134179 134180 134181[section:async_write_some windows::basic_stream_handle::async_write_some] 134182 134183[indexterm2 boost_asio.indexterm.windows__basic_stream_handle.async_write_some..async_write_some..windows::basic_stream_handle] 134184Start an asynchronous write. 134185 134186 134187 template< 134188 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 134189 typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``> 134190 ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_some( 134191 const ConstBufferSequence & buffers, 134192 WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``); 134193 134194 134195This function is used to asynchronously write data to the stream handle. The function call always returns immediately. 134196 134197 134198[heading Parameters] 134199 134200 134201[variablelist 134202 134203[[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.]] 134204 134205[[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: 134206`` 134207 void handler( 134208 const boost::system::error_code& error, // Result of operation. 134209 std::size_t bytes_transferred // Number of bytes written. 134210 ); 134211`` 134212Regardless 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`].]] 134213 134214] 134215 134216 134217[heading Remarks] 134218 134219The 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. 134220 134221 134222[heading Example] 134223 134224To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 134225 134226 handle.async_write_some(boost::asio::buffer(data, size), handler); 134227 134228 134229See 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. 134230 134231 134232 134233 134234[endsect] 134235 134236 134237[section:basic_stream_handle windows::basic_stream_handle::basic_stream_handle] 134238 134239[indexterm2 boost_asio.indexterm.windows__basic_stream_handle.basic_stream_handle..basic_stream_handle..windows::basic_stream_handle] 134240Construct a stream handle without opening it. 134241 134242 134243 explicit ``[link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle.overload1 basic_stream_handle]``( 134244 const executor_type & ex); 134245 `` [''''»''' [link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle.overload1 more...]]`` 134246 134247 template< 134248 typename ExecutionContext> 134249 explicit ``[link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle.overload2 basic_stream_handle]``( 134250 ExecutionContext & context, 134251 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value, defaulted_constraint >::type = defaulted_constraint()); 134252 `` [''''»''' [link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle.overload2 more...]]`` 134253 134254 134255Construct a stream handle on an existing native handle. 134256 134257 134258 ``[link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle.overload3 basic_stream_handle]``( 134259 const executor_type & ex, 134260 const native_handle_type & handle); 134261 `` [''''»''' [link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle.overload3 more...]]`` 134262 134263 template< 134264 typename ExecutionContext> 134265 ``[link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle.overload4 basic_stream_handle]``( 134266 ExecutionContext & context, 134267 const native_handle_type & handle, 134268 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 134269 `` [''''»''' [link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle.overload4 more...]]`` 134270 134271 134272Move-construct a stream handle from another. 134273 134274 134275 ``[link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle.overload5 basic_stream_handle]``( 134276 basic_stream_handle && other); 134277 `` [''''»''' [link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle.overload5 more...]]`` 134278 134279 134280[section:overload1 windows::basic_stream_handle::basic_stream_handle (1 of 5 overloads)] 134281 134282 134283Construct a stream handle without opening it. 134284 134285 134286 basic_stream_handle( 134287 const executor_type & ex); 134288 134289 134290This constructor creates a stream handle without opening it. 134291 134292 134293[heading Parameters] 134294 134295 134296[variablelist 134297 134298[[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. ]] 134299 134300] 134301 134302 134303 134304 134305[endsect] 134306 134307 134308 134309[section:overload2 windows::basic_stream_handle::basic_stream_handle (2 of 5 overloads)] 134310 134311 134312Construct a stream handle without opening it. 134313 134314 134315 template< 134316 typename ExecutionContext> 134317 basic_stream_handle( 134318 ExecutionContext & context, 134319 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value, defaulted_constraint >::type = defaulted_constraint()); 134320 134321 134322This 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. 134323 134324 134325[heading Parameters] 134326 134327 134328[variablelist 134329 134330[[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. ]] 134331 134332] 134333 134334 134335 134336 134337[endsect] 134338 134339 134340 134341[section:overload3 windows::basic_stream_handle::basic_stream_handle (3 of 5 overloads)] 134342 134343 134344Construct a stream handle on an existing native handle. 134345 134346 134347 basic_stream_handle( 134348 const executor_type & ex, 134349 const native_handle_type & handle); 134350 134351 134352This constructor creates a stream handle object to hold an existing native handle. 134353 134354 134355[heading Parameters] 134356 134357 134358[variablelist 134359 134360[[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.]] 134361 134362[[handle][The new underlying handle implementation.]] 134363 134364] 134365 134366 134367[heading Exceptions] 134368 134369 134370[variablelist 134371 134372[[boost::system::system_error][Thrown on failure. ]] 134373 134374] 134375 134376 134377 134378 134379[endsect] 134380 134381 134382 134383[section:overload4 windows::basic_stream_handle::basic_stream_handle (4 of 5 overloads)] 134384 134385 134386Construct a stream handle on an existing native handle. 134387 134388 134389 template< 134390 typename ExecutionContext> 134391 basic_stream_handle( 134392 ExecutionContext & context, 134393 const native_handle_type & handle, 134394 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 134395 134396 134397This constructor creates a stream handle object to hold an existing native handle. 134398 134399 134400[heading Parameters] 134401 134402 134403[variablelist 134404 134405[[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.]] 134406 134407[[handle][The new underlying handle implementation.]] 134408 134409] 134410 134411 134412[heading Exceptions] 134413 134414 134415[variablelist 134416 134417[[boost::system::system_error][Thrown on failure. ]] 134418 134419] 134420 134421 134422 134423 134424[endsect] 134425 134426 134427 134428[section:overload5 windows::basic_stream_handle::basic_stream_handle (5 of 5 overloads)] 134429 134430 134431Move-construct a stream handle from another. 134432 134433 134434 basic_stream_handle( 134435 basic_stream_handle && other); 134436 134437 134438This constructor moves a stream handle from one object to another. 134439 134440 134441[heading Parameters] 134442 134443 134444[variablelist 134445 134446[[other][The other stream handle object from which the move will occur.]] 134447 134448] 134449 134450 134451[heading Remarks] 134452 134453Following the move, the moved-from object is in the same state as if constructed using the `basic_stream_handle(const executor_type&)` constructor. 134454 134455 134456 134457 134458[endsect] 134459 134460 134461[endsect] 134462 134463[section:cancel windows::basic_stream_handle::cancel] 134464 134465[indexterm2 boost_asio.indexterm.windows__basic_stream_handle.cancel..cancel..windows::basic_stream_handle] 134466Cancel all asynchronous operations associated with the handle. 134467 134468 134469 void ``[link boost_asio.reference.windows__basic_stream_handle.cancel.overload1 cancel]``(); 134470 `` [''''»''' [link boost_asio.reference.windows__basic_stream_handle.cancel.overload1 more...]]`` 134471 134472 void ``[link boost_asio.reference.windows__basic_stream_handle.cancel.overload2 cancel]``( 134473 boost::system::error_code & ec); 134474 `` [''''»''' [link boost_asio.reference.windows__basic_stream_handle.cancel.overload2 more...]]`` 134475 134476 134477[section:overload1 windows::basic_stream_handle::cancel (1 of 2 overloads)] 134478 134479 134480['Inherited from windows::basic_overlapped_handle.] 134481 134482 134483Cancel all asynchronous operations associated with the handle. 134484 134485 134486 void cancel(); 134487 134488 134489This 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. 134490 134491 134492[heading Exceptions] 134493 134494 134495[variablelist 134496 134497[[boost::system::system_error][Thrown on failure. ]] 134498 134499] 134500 134501 134502 134503 134504[endsect] 134505 134506 134507 134508[section:overload2 windows::basic_stream_handle::cancel (2 of 2 overloads)] 134509 134510 134511['Inherited from windows::basic_overlapped_handle.] 134512 134513 134514Cancel all asynchronous operations associated with the handle. 134515 134516 134517 void cancel( 134518 boost::system::error_code & ec); 134519 134520 134521This 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. 134522 134523 134524[heading Parameters] 134525 134526 134527[variablelist 134528 134529[[ec][Set to indicate what error occurred, if any. ]] 134530 134531] 134532 134533 134534 134535 134536[endsect] 134537 134538 134539[endsect] 134540 134541[section:close windows::basic_stream_handle::close] 134542 134543[indexterm2 boost_asio.indexterm.windows__basic_stream_handle.close..close..windows::basic_stream_handle] 134544Close the handle. 134545 134546 134547 void ``[link boost_asio.reference.windows__basic_stream_handle.close.overload1 close]``(); 134548 `` [''''»''' [link boost_asio.reference.windows__basic_stream_handle.close.overload1 more...]]`` 134549 134550 void ``[link boost_asio.reference.windows__basic_stream_handle.close.overload2 close]``( 134551 boost::system::error_code & ec); 134552 `` [''''»''' [link boost_asio.reference.windows__basic_stream_handle.close.overload2 more...]]`` 134553 134554 134555[section:overload1 windows::basic_stream_handle::close (1 of 2 overloads)] 134556 134557 134558['Inherited from windows::basic_overlapped_handle.] 134559 134560 134561Close the handle. 134562 134563 134564 void close(); 134565 134566 134567This 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. 134568 134569 134570[heading Exceptions] 134571 134572 134573[variablelist 134574 134575[[boost::system::system_error][Thrown on failure. ]] 134576 134577] 134578 134579 134580 134581 134582[endsect] 134583 134584 134585 134586[section:overload2 windows::basic_stream_handle::close (2 of 2 overloads)] 134587 134588 134589['Inherited from windows::basic_overlapped_handle.] 134590 134591 134592Close the handle. 134593 134594 134595 void close( 134596 boost::system::error_code & ec); 134597 134598 134599This 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. 134600 134601 134602[heading Parameters] 134603 134604 134605[variablelist 134606 134607[[ec][Set to indicate what error occurred, if any. ]] 134608 134609] 134610 134611 134612 134613 134614[endsect] 134615 134616 134617[endsect] 134618 134619 134620[section:executor_type windows::basic_stream_handle::executor_type] 134621 134622[indexterm2 boost_asio.indexterm.windows__basic_stream_handle.executor_type..executor_type..windows::basic_stream_handle] 134623The type of the executor associated with the object. 134624 134625 134626 typedef Executor executor_type; 134627 134628 134629 134630[heading Requirements] 134631 134632['Header: ][^boost/asio/windows/basic_stream_handle.hpp] 134633 134634['Convenience header: ][^boost/asio.hpp] 134635 134636 134637[endsect] 134638 134639 134640 134641[section:get_executor windows::basic_stream_handle::get_executor] 134642 134643 134644['Inherited from windows::basic_overlapped_handle.] 134645 134646[indexterm2 boost_asio.indexterm.windows__basic_stream_handle.get_executor..get_executor..windows::basic_stream_handle] 134647Get the executor associated with the object. 134648 134649 134650 executor_type get_executor(); 134651 134652 134653 134654[endsect] 134655 134656 134657 134658[section:is_open windows::basic_stream_handle::is_open] 134659 134660 134661['Inherited from windows::basic_overlapped_handle.] 134662 134663[indexterm2 boost_asio.indexterm.windows__basic_stream_handle.is_open..is_open..windows::basic_stream_handle] 134664Determine whether the handle is open. 134665 134666 134667 bool is_open() const; 134668 134669 134670 134671[endsect] 134672 134673 134674[section:lowest_layer windows::basic_stream_handle::lowest_layer] 134675 134676[indexterm2 boost_asio.indexterm.windows__basic_stream_handle.lowest_layer..lowest_layer..windows::basic_stream_handle] 134677Get a reference to the lowest layer. 134678 134679 134680 lowest_layer_type & ``[link boost_asio.reference.windows__basic_stream_handle.lowest_layer.overload1 lowest_layer]``(); 134681 `` [''''»''' [link boost_asio.reference.windows__basic_stream_handle.lowest_layer.overload1 more...]]`` 134682 134683 134684Get a const reference to the lowest layer. 134685 134686 134687 const lowest_layer_type & ``[link boost_asio.reference.windows__basic_stream_handle.lowest_layer.overload2 lowest_layer]``() const; 134688 `` [''''»''' [link boost_asio.reference.windows__basic_stream_handle.lowest_layer.overload2 more...]]`` 134689 134690 134691[section:overload1 windows::basic_stream_handle::lowest_layer (1 of 2 overloads)] 134692 134693 134694['Inherited from windows::basic_overlapped_handle.] 134695 134696 134697Get a reference to the lowest layer. 134698 134699 134700 lowest_layer_type & lowest_layer(); 134701 134702 134703This 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. 134704 134705 134706[heading Return Value] 134707 134708A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 134709 134710 134711 134712 134713[endsect] 134714 134715 134716 134717[section:overload2 windows::basic_stream_handle::lowest_layer (2 of 2 overloads)] 134718 134719 134720['Inherited from windows::basic_overlapped_handle.] 134721 134722 134723Get a const reference to the lowest layer. 134724 134725 134726 const lowest_layer_type & lowest_layer() const; 134727 134728 134729This 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. 134730 134731 134732[heading Return Value] 134733 134734A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. 134735 134736 134737 134738 134739[endsect] 134740 134741 134742[endsect] 134743 134744 134745[section:lowest_layer_type windows::basic_stream_handle::lowest_layer_type] 134746 134747 134748['Inherited from windows::basic_overlapped_handle.] 134749 134750[indexterm2 boost_asio.indexterm.windows__basic_stream_handle.lowest_layer_type..lowest_layer_type..windows::basic_stream_handle] 134751An overlapped\_handle is always the lowest layer. 134752 134753 134754 typedef basic_overlapped_handle lowest_layer_type; 134755 134756 134757[heading Types] 134758[table 134759 [[Name][Description]] 134760 134761 [ 134762 134763 [[link boost_asio.reference.windows__basic_overlapped_handle__rebind_executor [*rebind_executor]]] 134764 [Rebinds the handle type to another executor. ] 134765 134766 ] 134767 134768 [ 134769 134770 [[link boost_asio.reference.windows__basic_overlapped_handle.executor_type [*executor_type]]] 134771 [The type of the executor associated with the object. ] 134772 134773 ] 134774 134775 [ 134776 134777 [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer_type [*lowest_layer_type]]] 134778 [An overlapped_handle is always the lowest layer. ] 134779 134780 ] 134781 134782 [ 134783 134784 [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle_type [*native_handle_type]]] 134785 [The native representation of a handle. ] 134786 134787 ] 134788 134789] 134790 134791[heading Member Functions] 134792[table 134793 [[Name][Description]] 134794 134795 [ 134796 [[link boost_asio.reference.windows__basic_overlapped_handle.assign [*assign]]] 134797 [Assign an existing native handle to the handle. ] 134798 ] 134799 134800 [ 134801 [[link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle [*basic_overlapped_handle]] [constructor]] 134802 [Construct an overlapped handle without opening it. 134803 [hr] 134804 Construct an overlapped handle on an existing native handle. 134805 [hr] 134806 Move-construct an overlapped handle from another. ] 134807 ] 134808 134809 [ 134810 [[link boost_asio.reference.windows__basic_overlapped_handle.cancel [*cancel]]] 134811 [Cancel all asynchronous operations associated with the handle. ] 134812 ] 134813 134814 [ 134815 [[link boost_asio.reference.windows__basic_overlapped_handle.close [*close]]] 134816 [Close the handle. ] 134817 ] 134818 134819 [ 134820 [[link boost_asio.reference.windows__basic_overlapped_handle.get_executor [*get_executor]]] 134821 [Get the executor associated with the object. ] 134822 ] 134823 134824 [ 134825 [[link boost_asio.reference.windows__basic_overlapped_handle.is_open [*is_open]]] 134826 [Determine whether the handle is open. ] 134827 ] 134828 134829 [ 134830 [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer [*lowest_layer]]] 134831 [Get a reference to the lowest layer. 134832 [hr] 134833 Get a const reference to the lowest layer. ] 134834 ] 134835 134836 [ 134837 [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle [*native_handle]]] 134838 [Get the native handle representation. ] 134839 ] 134840 134841 [ 134842 [[link boost_asio.reference.windows__basic_overlapped_handle.operator_eq_ [*operator=]]] 134843 [Move-assign an overlapped handle from another. ] 134844 ] 134845 134846] 134847 134848[heading Protected Member Functions] 134849[table 134850 [[Name][Description]] 134851 134852 [ 134853 [[link boost_asio.reference.windows__basic_overlapped_handle._basic_overlapped_handle [*~basic_overlapped_handle]] [destructor]] 134854 [Protected destructor to prevent deletion through this type. ] 134855 ] 134856 134857] 134858 134859The [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. 134860 134861 134862[heading Thread Safety] 134863 134864['Distinct] ['objects:] Safe. 134865 134866['Shared] ['objects:] Unsafe. 134867 134868 134869 134870 134871[heading Requirements] 134872 134873['Header: ][^boost/asio/windows/basic_stream_handle.hpp] 134874 134875['Convenience header: ][^boost/asio.hpp] 134876 134877 134878[endsect] 134879 134880 134881 134882[section:native_handle windows::basic_stream_handle::native_handle] 134883 134884 134885['Inherited from windows::basic_overlapped_handle.] 134886 134887[indexterm2 boost_asio.indexterm.windows__basic_stream_handle.native_handle..native_handle..windows::basic_stream_handle] 134888Get the native handle representation. 134889 134890 134891 native_handle_type native_handle(); 134892 134893 134894This 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. 134895 134896 134897[endsect] 134898 134899 134900 134901[section:native_handle_type windows::basic_stream_handle::native_handle_type] 134902 134903[indexterm2 boost_asio.indexterm.windows__basic_stream_handle.native_handle_type..native_handle_type..windows::basic_stream_handle] 134904The native representation of a handle. 134905 134906 134907 typedef implementation_defined native_handle_type; 134908 134909 134910 134911[heading Requirements] 134912 134913['Header: ][^boost/asio/windows/basic_stream_handle.hpp] 134914 134915['Convenience header: ][^boost/asio.hpp] 134916 134917 134918[endsect] 134919 134920 134921 134922[section:operator_eq_ windows::basic_stream_handle::operator=] 134923 134924[indexterm2 boost_asio.indexterm.windows__basic_stream_handle.operator_eq_..operator=..windows::basic_stream_handle] 134925Move-assign a stream handle from another. 134926 134927 134928 basic_stream_handle & operator=( 134929 basic_stream_handle && other); 134930 134931 134932This assignment operator moves a stream handle from one object to another. 134933 134934 134935[heading Parameters] 134936 134937 134938[variablelist 134939 134940[[other][The other stream handle object from which the move will occur.]] 134941 134942] 134943 134944 134945[heading Remarks] 134946 134947Following the move, the moved-from object is in the same state as if constructed using the `basic_stream_handle(const executor_type&)` constructor. 134948 134949 134950 134951 134952[endsect] 134953 134954 134955[section:read_some windows::basic_stream_handle::read_some] 134956 134957[indexterm2 boost_asio.indexterm.windows__basic_stream_handle.read_some..read_some..windows::basic_stream_handle] 134958Read some data from the handle. 134959 134960 134961 template< 134962 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 134963 std::size_t ``[link boost_asio.reference.windows__basic_stream_handle.read_some.overload1 read_some]``( 134964 const MutableBufferSequence & buffers); 134965 `` [''''»''' [link boost_asio.reference.windows__basic_stream_handle.read_some.overload1 more...]]`` 134966 134967 template< 134968 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 134969 std::size_t ``[link boost_asio.reference.windows__basic_stream_handle.read_some.overload2 read_some]``( 134970 const MutableBufferSequence & buffers, 134971 boost::system::error_code & ec); 134972 `` [''''»''' [link boost_asio.reference.windows__basic_stream_handle.read_some.overload2 more...]]`` 134973 134974 134975[section:overload1 windows::basic_stream_handle::read_some (1 of 2 overloads)] 134976 134977 134978Read some data from the handle. 134979 134980 134981 template< 134982 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 134983 std::size_t read_some( 134984 const MutableBufferSequence & buffers); 134985 134986 134987This 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. 134988 134989 134990[heading Parameters] 134991 134992 134993[variablelist 134994 134995[[buffers][One or more buffers into which the data will be read.]] 134996 134997] 134998 134999 135000[heading Return Value] 135001 135002The number of bytes read. 135003 135004 135005[heading Exceptions] 135006 135007 135008[variablelist 135009 135010[[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]] 135011 135012] 135013 135014 135015[heading Remarks] 135016 135017The 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. 135018 135019 135020[heading Example] 135021 135022To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 135023 135024 handle.read_some(boost::asio::buffer(data, size)); 135025 135026 135027See 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. 135028 135029 135030 135031 135032[endsect] 135033 135034 135035 135036[section:overload2 windows::basic_stream_handle::read_some (2 of 2 overloads)] 135037 135038 135039Read some data from the handle. 135040 135041 135042 template< 135043 typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> 135044 std::size_t read_some( 135045 const MutableBufferSequence & buffers, 135046 boost::system::error_code & ec); 135047 135048 135049This 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. 135050 135051 135052[heading Parameters] 135053 135054 135055[variablelist 135056 135057[[buffers][One or more buffers into which the data will be read.]] 135058 135059[[ec][Set to indicate what error occurred, if any.]] 135060 135061] 135062 135063 135064[heading Return Value] 135065 135066The number of bytes read. Returns 0 if an error occurred. 135067 135068 135069[heading Remarks] 135070 135071The 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. 135072 135073 135074 135075 135076[endsect] 135077 135078 135079[endsect] 135080 135081[section:write_some windows::basic_stream_handle::write_some] 135082 135083[indexterm2 boost_asio.indexterm.windows__basic_stream_handle.write_some..write_some..windows::basic_stream_handle] 135084Write some data to the handle. 135085 135086 135087 template< 135088 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 135089 std::size_t ``[link boost_asio.reference.windows__basic_stream_handle.write_some.overload1 write_some]``( 135090 const ConstBufferSequence & buffers); 135091 `` [''''»''' [link boost_asio.reference.windows__basic_stream_handle.write_some.overload1 more...]]`` 135092 135093 template< 135094 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 135095 std::size_t ``[link boost_asio.reference.windows__basic_stream_handle.write_some.overload2 write_some]``( 135096 const ConstBufferSequence & buffers, 135097 boost::system::error_code & ec); 135098 `` [''''»''' [link boost_asio.reference.windows__basic_stream_handle.write_some.overload2 more...]]`` 135099 135100 135101[section:overload1 windows::basic_stream_handle::write_some (1 of 2 overloads)] 135102 135103 135104Write some data to the handle. 135105 135106 135107 template< 135108 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 135109 std::size_t write_some( 135110 const ConstBufferSequence & buffers); 135111 135112 135113This 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. 135114 135115 135116[heading Parameters] 135117 135118 135119[variablelist 135120 135121[[buffers][One or more data buffers to be written to the handle.]] 135122 135123] 135124 135125 135126[heading Return Value] 135127 135128The number of bytes written. 135129 135130 135131[heading Exceptions] 135132 135133 135134[variablelist 135135 135136[[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]] 135137 135138] 135139 135140 135141[heading Remarks] 135142 135143The 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. 135144 135145 135146[heading Example] 135147 135148To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 135149 135150 handle.write_some(boost::asio::buffer(data, size)); 135151 135152 135153See 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. 135154 135155 135156 135157 135158[endsect] 135159 135160 135161 135162[section:overload2 windows::basic_stream_handle::write_some (2 of 2 overloads)] 135163 135164 135165Write some data to the handle. 135166 135167 135168 template< 135169 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 135170 std::size_t write_some( 135171 const ConstBufferSequence & buffers, 135172 boost::system::error_code & ec); 135173 135174 135175This 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. 135176 135177 135178[heading Parameters] 135179 135180 135181[variablelist 135182 135183[[buffers][One or more data buffers to be written to the handle.]] 135184 135185[[ec][Set to indicate what error occurred, if any.]] 135186 135187] 135188 135189 135190[heading Return Value] 135191 135192The number of bytes written. Returns 0 if an error occurred. 135193 135194 135195[heading Remarks] 135196 135197The 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. 135198 135199 135200 135201 135202[endsect] 135203 135204 135205[endsect] 135206 135207 135208[endsect] 135209 135210[section:windows__basic_stream_handle__rebind_executor windows::basic_stream_handle::rebind_executor] 135211 135212[indexterm1 boost_asio.indexterm.windows__basic_stream_handle__rebind_executor..windows::basic_stream_handle::rebind_executor] 135213 135214 135215Rebinds the handle type to another executor. 135216 135217 135218 template< 135219 typename ``[link boost_asio.reference.Executor1 Executor1]``> 135220 struct rebind_executor 135221 135222 135223[heading Types] 135224[table 135225 [[Name][Description]] 135226 135227 [ 135228 135229 [[link boost_asio.reference.windows__basic_stream_handle__rebind_executor.other [*other]]] 135230 [The handle type when rebound to the specified executor. ] 135231 135232 ] 135233 135234] 135235 135236[heading Requirements] 135237 135238['Header: ][^boost/asio/windows/basic_stream_handle.hpp] 135239 135240['Convenience header: ][^boost/asio.hpp] 135241 135242 135243[section:other windows::basic_stream_handle::rebind_executor::other] 135244 135245[indexterm2 boost_asio.indexterm.windows__basic_stream_handle__rebind_executor.other..other..windows::basic_stream_handle::rebind_executor] 135246The handle type when rebound to the specified executor. 135247 135248 135249 typedef basic_stream_handle< Executor1 > other; 135250 135251 135252[heading Types] 135253[table 135254 [[Name][Description]] 135255 135256 [ 135257 135258 [[link boost_asio.reference.windows__basic_stream_handle__rebind_executor [*rebind_executor]]] 135259 [Rebinds the handle type to another executor. ] 135260 135261 ] 135262 135263 [ 135264 135265 [[link boost_asio.reference.windows__basic_stream_handle.executor_type [*executor_type]]] 135266 [The type of the executor associated with the object. ] 135267 135268 ] 135269 135270 [ 135271 135272 [[link boost_asio.reference.windows__basic_stream_handle.lowest_layer_type [*lowest_layer_type]]] 135273 [An overlapped_handle is always the lowest layer. ] 135274 135275 ] 135276 135277 [ 135278 135279 [[link boost_asio.reference.windows__basic_stream_handle.native_handle_type [*native_handle_type]]] 135280 [The native representation of a handle. ] 135281 135282 ] 135283 135284] 135285 135286[heading Member Functions] 135287[table 135288 [[Name][Description]] 135289 135290 [ 135291 [[link boost_asio.reference.windows__basic_stream_handle.assign [*assign]]] 135292 [Assign an existing native handle to the handle. ] 135293 ] 135294 135295 [ 135296 [[link boost_asio.reference.windows__basic_stream_handle.async_read_some [*async_read_some]]] 135297 [Start an asynchronous read. ] 135298 ] 135299 135300 [ 135301 [[link boost_asio.reference.windows__basic_stream_handle.async_write_some [*async_write_some]]] 135302 [Start an asynchronous write. ] 135303 ] 135304 135305 [ 135306 [[link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle [*basic_stream_handle]] [constructor]] 135307 [Construct a stream handle without opening it. 135308 [hr] 135309 Construct a stream handle on an existing native handle. 135310 [hr] 135311 Move-construct a stream handle from another. ] 135312 ] 135313 135314 [ 135315 [[link boost_asio.reference.windows__basic_stream_handle.cancel [*cancel]]] 135316 [Cancel all asynchronous operations associated with the handle. ] 135317 ] 135318 135319 [ 135320 [[link boost_asio.reference.windows__basic_stream_handle.close [*close]]] 135321 [Close the handle. ] 135322 ] 135323 135324 [ 135325 [[link boost_asio.reference.windows__basic_stream_handle.get_executor [*get_executor]]] 135326 [Get the executor associated with the object. ] 135327 ] 135328 135329 [ 135330 [[link boost_asio.reference.windows__basic_stream_handle.is_open [*is_open]]] 135331 [Determine whether the handle is open. ] 135332 ] 135333 135334 [ 135335 [[link boost_asio.reference.windows__basic_stream_handle.lowest_layer [*lowest_layer]]] 135336 [Get a reference to the lowest layer. 135337 [hr] 135338 Get a const reference to the lowest layer. ] 135339 ] 135340 135341 [ 135342 [[link boost_asio.reference.windows__basic_stream_handle.native_handle [*native_handle]]] 135343 [Get the native handle representation. ] 135344 ] 135345 135346 [ 135347 [[link boost_asio.reference.windows__basic_stream_handle.operator_eq_ [*operator=]]] 135348 [Move-assign a stream handle from another. ] 135349 ] 135350 135351 [ 135352 [[link boost_asio.reference.windows__basic_stream_handle.read_some [*read_some]]] 135353 [Read some data from the handle. ] 135354 ] 135355 135356 [ 135357 [[link boost_asio.reference.windows__basic_stream_handle.write_some [*write_some]]] 135358 [Write some data to the handle. ] 135359 ] 135360 135361] 135362 135363The [link boost_asio.reference.windows__basic_stream_handle `windows::basic_stream_handle`] class provides asynchronous and blocking stream-oriented handle functionality. 135364 135365 135366[heading Thread Safety] 135367 135368['Distinct] ['objects:] Safe. 135369 135370['Shared] ['objects:] Unsafe. 135371 135372 135373 135374 135375 135376[heading Requirements] 135377 135378['Header: ][^boost/asio/windows/basic_stream_handle.hpp] 135379 135380['Convenience header: ][^boost/asio.hpp] 135381 135382 135383[endsect] 135384 135385 135386 135387[endsect] 135388 135389 135390[section:windows__object_handle windows::object_handle] 135391 135392[indexterm1 boost_asio.indexterm.windows__object_handle..windows::object_handle] 135393Typedef for the typical usage of an object handle. 135394 135395 135396 typedef basic_object_handle object_handle; 135397 135398 135399[heading Types] 135400[table 135401 [[Name][Description]] 135402 135403 [ 135404 135405 [[link boost_asio.reference.windows__basic_object_handle__rebind_executor [*rebind_executor]]] 135406 [Rebinds the handle type to another executor. ] 135407 135408 ] 135409 135410 [ 135411 135412 [[link boost_asio.reference.windows__basic_object_handle.executor_type [*executor_type]]] 135413 [The type of the executor associated with the object. ] 135414 135415 ] 135416 135417 [ 135418 135419 [[link boost_asio.reference.windows__basic_object_handle.lowest_layer_type [*lowest_layer_type]]] 135420 [An object handle is always the lowest layer. ] 135421 135422 ] 135423 135424 [ 135425 135426 [[link boost_asio.reference.windows__basic_object_handle.native_handle_type [*native_handle_type]]] 135427 [The native representation of a handle. ] 135428 135429 ] 135430 135431] 135432 135433[heading Member Functions] 135434[table 135435 [[Name][Description]] 135436 135437 [ 135438 [[link boost_asio.reference.windows__basic_object_handle.assign [*assign]]] 135439 [Assign an existing native handle to the handle. ] 135440 ] 135441 135442 [ 135443 [[link boost_asio.reference.windows__basic_object_handle.async_wait [*async_wait]]] 135444 [Start an asynchronous wait on the object handle. ] 135445 ] 135446 135447 [ 135448 [[link boost_asio.reference.windows__basic_object_handle.basic_object_handle [*basic_object_handle]] [constructor]] 135449 [Construct an object handle without opening it. 135450 [hr] 135451 Construct an object handle on an existing native handle. 135452 [hr] 135453 Move-construct an object handle from another. ] 135454 ] 135455 135456 [ 135457 [[link boost_asio.reference.windows__basic_object_handle.cancel [*cancel]]] 135458 [Cancel all asynchronous operations associated with the handle. ] 135459 ] 135460 135461 [ 135462 [[link boost_asio.reference.windows__basic_object_handle.close [*close]]] 135463 [Close the handle. ] 135464 ] 135465 135466 [ 135467 [[link boost_asio.reference.windows__basic_object_handle.get_executor [*get_executor]]] 135468 [Get the executor associated with the object. ] 135469 ] 135470 135471 [ 135472 [[link boost_asio.reference.windows__basic_object_handle.is_open [*is_open]]] 135473 [Determine whether the handle is open. ] 135474 ] 135475 135476 [ 135477 [[link boost_asio.reference.windows__basic_object_handle.lowest_layer [*lowest_layer]]] 135478 [Get a reference to the lowest layer. 135479 [hr] 135480 Get a const reference to the lowest layer. ] 135481 ] 135482 135483 [ 135484 [[link boost_asio.reference.windows__basic_object_handle.native_handle [*native_handle]]] 135485 [Get the native handle representation. ] 135486 ] 135487 135488 [ 135489 [[link boost_asio.reference.windows__basic_object_handle.operator_eq_ [*operator=]]] 135490 [Move-assign an object handle from another. ] 135491 ] 135492 135493 [ 135494 [[link boost_asio.reference.windows__basic_object_handle.wait [*wait]]] 135495 [Perform a blocking wait on the object handle. ] 135496 ] 135497 135498] 135499 135500The [link boost_asio.reference.windows__basic_object_handle `windows::basic_object_handle`] class provides asynchronous and blocking object-oriented handle functionality. 135501 135502 135503[heading Thread Safety] 135504 135505['Distinct] ['objects:] Safe. 135506 135507['Shared] ['objects:] Unsafe. 135508 135509 135510 135511 135512[heading Requirements] 135513 135514['Header: ][^boost/asio/windows/object_handle.hpp] 135515 135516['Convenience header: ][^boost/asio.hpp] 135517 135518 135519[endsect] 135520 135521 135522 135523[section:windows__overlapped_handle windows::overlapped_handle] 135524 135525[indexterm1 boost_asio.indexterm.windows__overlapped_handle..windows::overlapped_handle] 135526Typedef for the typical usage of an overlapped handle. 135527 135528 135529 typedef basic_overlapped_handle overlapped_handle; 135530 135531 135532[heading Types] 135533[table 135534 [[Name][Description]] 135535 135536 [ 135537 135538 [[link boost_asio.reference.windows__basic_overlapped_handle__rebind_executor [*rebind_executor]]] 135539 [Rebinds the handle type to another executor. ] 135540 135541 ] 135542 135543 [ 135544 135545 [[link boost_asio.reference.windows__basic_overlapped_handle.executor_type [*executor_type]]] 135546 [The type of the executor associated with the object. ] 135547 135548 ] 135549 135550 [ 135551 135552 [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer_type [*lowest_layer_type]]] 135553 [An overlapped_handle is always the lowest layer. ] 135554 135555 ] 135556 135557 [ 135558 135559 [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle_type [*native_handle_type]]] 135560 [The native representation of a handle. ] 135561 135562 ] 135563 135564] 135565 135566[heading Member Functions] 135567[table 135568 [[Name][Description]] 135569 135570 [ 135571 [[link boost_asio.reference.windows__basic_overlapped_handle.assign [*assign]]] 135572 [Assign an existing native handle to the handle. ] 135573 ] 135574 135575 [ 135576 [[link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle [*basic_overlapped_handle]] [constructor]] 135577 [Construct an overlapped handle without opening it. 135578 [hr] 135579 Construct an overlapped handle on an existing native handle. 135580 [hr] 135581 Move-construct an overlapped handle from another. ] 135582 ] 135583 135584 [ 135585 [[link boost_asio.reference.windows__basic_overlapped_handle.cancel [*cancel]]] 135586 [Cancel all asynchronous operations associated with the handle. ] 135587 ] 135588 135589 [ 135590 [[link boost_asio.reference.windows__basic_overlapped_handle.close [*close]]] 135591 [Close the handle. ] 135592 ] 135593 135594 [ 135595 [[link boost_asio.reference.windows__basic_overlapped_handle.get_executor [*get_executor]]] 135596 [Get the executor associated with the object. ] 135597 ] 135598 135599 [ 135600 [[link boost_asio.reference.windows__basic_overlapped_handle.is_open [*is_open]]] 135601 [Determine whether the handle is open. ] 135602 ] 135603 135604 [ 135605 [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer [*lowest_layer]]] 135606 [Get a reference to the lowest layer. 135607 [hr] 135608 Get a const reference to the lowest layer. ] 135609 ] 135610 135611 [ 135612 [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle [*native_handle]]] 135613 [Get the native handle representation. ] 135614 ] 135615 135616 [ 135617 [[link boost_asio.reference.windows__basic_overlapped_handle.operator_eq_ [*operator=]]] 135618 [Move-assign an overlapped handle from another. ] 135619 ] 135620 135621] 135622 135623[heading Protected Member Functions] 135624[table 135625 [[Name][Description]] 135626 135627 [ 135628 [[link boost_asio.reference.windows__basic_overlapped_handle._basic_overlapped_handle [*~basic_overlapped_handle]] [destructor]] 135629 [Protected destructor to prevent deletion through this type. ] 135630 ] 135631 135632] 135633 135634The [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. 135635 135636 135637[heading Thread Safety] 135638 135639['Distinct] ['objects:] Safe. 135640 135641['Shared] ['objects:] Unsafe. 135642 135643 135644 135645 135646[heading Requirements] 135647 135648['Header: ][^boost/asio/windows/overlapped_handle.hpp] 135649 135650['Convenience header: ][^boost/asio.hpp] 135651 135652 135653[endsect] 135654 135655 135656[section:windows__overlapped_ptr windows::overlapped_ptr] 135657 135658[indexterm1 boost_asio.indexterm.windows__overlapped_ptr..windows::overlapped_ptr] 135659 135660 135661Wraps a handler to create an OVERLAPPED object for use with overlapped I/O. 135662 135663 135664 class overlapped_ptr : 135665 noncopyable 135666 135667 135668[heading Member Functions] 135669[table 135670 [[Name][Description]] 135671 135672 [ 135673 [[link boost_asio.reference.windows__overlapped_ptr.complete [*complete]]] 135674 [Post completion notification for overlapped operation. Releases ownership. ] 135675 ] 135676 135677 [ 135678 [[link boost_asio.reference.windows__overlapped_ptr.get [*get]]] 135679 [Get the contained OVERLAPPED object. ] 135680 ] 135681 135682 [ 135683 [[link boost_asio.reference.windows__overlapped_ptr.overlapped_ptr [*overlapped_ptr]] [constructor]] 135684 [Construct an empty overlapped_ptr. 135685 [hr] 135686 Construct an overlapped_ptr to contain the specified handler. ] 135687 ] 135688 135689 [ 135690 [[link boost_asio.reference.windows__overlapped_ptr.release [*release]]] 135691 [Release ownership of the OVERLAPPED object. ] 135692 ] 135693 135694 [ 135695 [[link boost_asio.reference.windows__overlapped_ptr.reset [*reset]]] 135696 [Reset to empty. 135697 [hr] 135698 Reset to contain the specified handler, freeing any current OVERLAPPED object. ] 135699 ] 135700 135701 [ 135702 [[link boost_asio.reference.windows__overlapped_ptr._overlapped_ptr [*~overlapped_ptr]] [destructor]] 135703 [Destructor automatically frees the OVERLAPPED object unless released. ] 135704 ] 135705 135706] 135707 135708A 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. 135709 135710 135711[heading Thread Safety] 135712 135713['Distinct] ['objects:] Safe. 135714 135715['Shared] ['objects:] Unsafe. 135716 135717 135718 135719[heading Requirements] 135720 135721['Header: ][^boost/asio/windows/overlapped_ptr.hpp] 135722 135723['Convenience header: ][^boost/asio.hpp] 135724 135725 135726[section:complete windows::overlapped_ptr::complete] 135727 135728[indexterm2 boost_asio.indexterm.windows__overlapped_ptr.complete..complete..windows::overlapped_ptr] 135729Post completion notification for overlapped operation. Releases ownership. 135730 135731 135732 void complete( 135733 const boost::system::error_code & ec, 135734 std::size_t bytes_transferred); 135735 135736 135737 135738[endsect] 135739 135740 135741[section:get windows::overlapped_ptr::get] 135742 135743[indexterm2 boost_asio.indexterm.windows__overlapped_ptr.get..get..windows::overlapped_ptr] 135744Get the contained OVERLAPPED object. 135745 135746 135747 OVERLAPPED * ``[link boost_asio.reference.windows__overlapped_ptr.get.overload1 get]``(); 135748 `` [''''»''' [link boost_asio.reference.windows__overlapped_ptr.get.overload1 more...]]`` 135749 135750 const OVERLAPPED * ``[link boost_asio.reference.windows__overlapped_ptr.get.overload2 get]``() const; 135751 `` [''''»''' [link boost_asio.reference.windows__overlapped_ptr.get.overload2 more...]]`` 135752 135753 135754[section:overload1 windows::overlapped_ptr::get (1 of 2 overloads)] 135755 135756 135757Get the contained OVERLAPPED object. 135758 135759 135760 OVERLAPPED * get(); 135761 135762 135763 135764[endsect] 135765 135766 135767 135768[section:overload2 windows::overlapped_ptr::get (2 of 2 overloads)] 135769 135770 135771Get the contained OVERLAPPED object. 135772 135773 135774 const OVERLAPPED * get() const; 135775 135776 135777 135778[endsect] 135779 135780 135781[endsect] 135782 135783[section:overlapped_ptr windows::overlapped_ptr::overlapped_ptr] 135784 135785[indexterm2 boost_asio.indexterm.windows__overlapped_ptr.overlapped_ptr..overlapped_ptr..windows::overlapped_ptr] 135786Construct an empty [link boost_asio.reference.windows__overlapped_ptr `windows::overlapped_ptr`]. 135787 135788 135789 ``[link boost_asio.reference.windows__overlapped_ptr.overlapped_ptr.overload1 overlapped_ptr]``(); 135790 `` [''''»''' [link boost_asio.reference.windows__overlapped_ptr.overlapped_ptr.overload1 more...]]`` 135791 135792 135793Construct an [link boost_asio.reference.windows__overlapped_ptr `windows::overlapped_ptr`] to contain the specified handler. 135794 135795 135796 template< 135797 typename ExecutionContext, 135798 typename ``[link boost_asio.reference.Handler Handler]``> 135799 explicit ``[link boost_asio.reference.windows__overlapped_ptr.overlapped_ptr.overload2 overlapped_ptr]``( 135800 ExecutionContext & context, 135801 Handler && handler, 135802 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 135803 `` [''''»''' [link boost_asio.reference.windows__overlapped_ptr.overlapped_ptr.overload2 more...]]`` 135804 135805 template< 135806 typename ``[link boost_asio.reference.Executor1 Executor]``, 135807 typename ``[link boost_asio.reference.Handler Handler]``> 135808 explicit ``[link boost_asio.reference.windows__overlapped_ptr.overlapped_ptr.overload3 overlapped_ptr]``( 135809 const Executor & ex, 135810 Handler && handler, 135811 typename constraint< execution::is_executor< Executor >::value||is_executor< Executor >::value >::type = 0); 135812 `` [''''»''' [link boost_asio.reference.windows__overlapped_ptr.overlapped_ptr.overload3 more...]]`` 135813 135814 135815[section:overload1 windows::overlapped_ptr::overlapped_ptr (1 of 3 overloads)] 135816 135817 135818Construct an empty [link boost_asio.reference.windows__overlapped_ptr `windows::overlapped_ptr`]. 135819 135820 135821 overlapped_ptr(); 135822 135823 135824 135825[endsect] 135826 135827 135828 135829[section:overload2 windows::overlapped_ptr::overlapped_ptr (2 of 3 overloads)] 135830 135831 135832Construct an [link boost_asio.reference.windows__overlapped_ptr `windows::overlapped_ptr`] to contain the specified handler. 135833 135834 135835 template< 135836 typename ExecutionContext, 135837 typename ``[link boost_asio.reference.Handler Handler]``> 135838 overlapped_ptr( 135839 ExecutionContext & context, 135840 Handler && handler, 135841 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 135842 135843 135844 135845[endsect] 135846 135847 135848 135849[section:overload3 windows::overlapped_ptr::overlapped_ptr (3 of 3 overloads)] 135850 135851 135852Construct an [link boost_asio.reference.windows__overlapped_ptr `windows::overlapped_ptr`] to contain the specified handler. 135853 135854 135855 template< 135856 typename ``[link boost_asio.reference.Executor1 Executor]``, 135857 typename ``[link boost_asio.reference.Handler Handler]``> 135858 overlapped_ptr( 135859 const Executor & ex, 135860 Handler && handler, 135861 typename constraint< execution::is_executor< Executor >::value||is_executor< Executor >::value >::type = 0); 135862 135863 135864 135865[endsect] 135866 135867 135868[endsect] 135869 135870 135871[section:release windows::overlapped_ptr::release] 135872 135873[indexterm2 boost_asio.indexterm.windows__overlapped_ptr.release..release..windows::overlapped_ptr] 135874Release ownership of the OVERLAPPED object. 135875 135876 135877 OVERLAPPED * release(); 135878 135879 135880 135881[endsect] 135882 135883 135884[section:reset windows::overlapped_ptr::reset] 135885 135886[indexterm2 boost_asio.indexterm.windows__overlapped_ptr.reset..reset..windows::overlapped_ptr] 135887Reset to empty. 135888 135889 135890 void ``[link boost_asio.reference.windows__overlapped_ptr.reset.overload1 reset]``(); 135891 `` [''''»''' [link boost_asio.reference.windows__overlapped_ptr.reset.overload1 more...]]`` 135892 135893 135894Reset to contain the specified handler, freeing any current OVERLAPPED object. 135895 135896 135897 template< 135898 typename ExecutionContext, 135899 typename ``[link boost_asio.reference.Handler Handler]``> 135900 void ``[link boost_asio.reference.windows__overlapped_ptr.reset.overload2 reset]``( 135901 ExecutionContext & context, 135902 Handler && handler, 135903 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 135904 `` [''''»''' [link boost_asio.reference.windows__overlapped_ptr.reset.overload2 more...]]`` 135905 135906 template< 135907 typename ``[link boost_asio.reference.Executor1 Executor]``, 135908 typename ``[link boost_asio.reference.Handler Handler]``> 135909 void ``[link boost_asio.reference.windows__overlapped_ptr.reset.overload3 reset]``( 135910 const Executor & ex, 135911 Handler && handler, 135912 typename constraint< execution::is_executor< Executor >::value||is_executor< Executor >::value >::type = 0); 135913 `` [''''»''' [link boost_asio.reference.windows__overlapped_ptr.reset.overload3 more...]]`` 135914 135915 135916[section:overload1 windows::overlapped_ptr::reset (1 of 3 overloads)] 135917 135918 135919Reset to empty. 135920 135921 135922 void reset(); 135923 135924 135925 135926[endsect] 135927 135928 135929 135930[section:overload2 windows::overlapped_ptr::reset (2 of 3 overloads)] 135931 135932 135933Reset to contain the specified handler, freeing any current OVERLAPPED object. 135934 135935 135936 template< 135937 typename ExecutionContext, 135938 typename ``[link boost_asio.reference.Handler Handler]``> 135939 void reset( 135940 ExecutionContext & context, 135941 Handler && handler, 135942 typename constraint< is_convertible< ExecutionContext &, execution_context & >::value >::type = 0); 135943 135944 135945 135946[endsect] 135947 135948 135949 135950[section:overload3 windows::overlapped_ptr::reset (3 of 3 overloads)] 135951 135952 135953Reset to contain the specified handler, freeing any current OVERLAPPED object. 135954 135955 135956 template< 135957 typename ``[link boost_asio.reference.Executor1 Executor]``, 135958 typename ``[link boost_asio.reference.Handler Handler]``> 135959 void reset( 135960 const Executor & ex, 135961 Handler && handler, 135962 typename constraint< execution::is_executor< Executor >::value||is_executor< Executor >::value >::type = 0); 135963 135964 135965 135966[endsect] 135967 135968 135969[endsect] 135970 135971 135972[section:_overlapped_ptr windows::overlapped_ptr::~overlapped_ptr] 135973 135974[indexterm2 boost_asio.indexterm.windows__overlapped_ptr._overlapped_ptr..~overlapped_ptr..windows::overlapped_ptr] 135975Destructor automatically frees the OVERLAPPED object unless released. 135976 135977 135978 ~overlapped_ptr(); 135979 135980 135981 135982[endsect] 135983 135984 135985 135986[endsect] 135987 135988 135989[section:windows__random_access_handle windows::random_access_handle] 135990 135991[indexterm1 boost_asio.indexterm.windows__random_access_handle..windows::random_access_handle] 135992Typedef for the typical usage of a random-access handle. 135993 135994 135995 typedef basic_random_access_handle random_access_handle; 135996 135997 135998[heading Types] 135999[table 136000 [[Name][Description]] 136001 136002 [ 136003 136004 [[link boost_asio.reference.windows__basic_random_access_handle__rebind_executor [*rebind_executor]]] 136005 [Rebinds the handle type to another executor. ] 136006 136007 ] 136008 136009 [ 136010 136011 [[link boost_asio.reference.windows__basic_random_access_handle.executor_type [*executor_type]]] 136012 [The type of the executor associated with the object. ] 136013 136014 ] 136015 136016 [ 136017 136018 [[link boost_asio.reference.windows__basic_random_access_handle.lowest_layer_type [*lowest_layer_type]]] 136019 [An overlapped_handle is always the lowest layer. ] 136020 136021 ] 136022 136023 [ 136024 136025 [[link boost_asio.reference.windows__basic_random_access_handle.native_handle_type [*native_handle_type]]] 136026 [The native representation of a handle. ] 136027 136028 ] 136029 136030] 136031 136032[heading Member Functions] 136033[table 136034 [[Name][Description]] 136035 136036 [ 136037 [[link boost_asio.reference.windows__basic_random_access_handle.assign [*assign]]] 136038 [Assign an existing native handle to the handle. ] 136039 ] 136040 136041 [ 136042 [[link boost_asio.reference.windows__basic_random_access_handle.async_read_some_at [*async_read_some_at]]] 136043 [Start an asynchronous read at the specified offset. ] 136044 ] 136045 136046 [ 136047 [[link boost_asio.reference.windows__basic_random_access_handle.async_write_some_at [*async_write_some_at]]] 136048 [Start an asynchronous write at the specified offset. ] 136049 ] 136050 136051 [ 136052 [[link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle [*basic_random_access_handle]] [constructor]] 136053 [Construct a random-access handle without opening it. 136054 [hr] 136055 Construct a random-access handle on an existing native handle. 136056 [hr] 136057 Move-construct a random-access handle from another. ] 136058 ] 136059 136060 [ 136061 [[link boost_asio.reference.windows__basic_random_access_handle.cancel [*cancel]]] 136062 [Cancel all asynchronous operations associated with the handle. ] 136063 ] 136064 136065 [ 136066 [[link boost_asio.reference.windows__basic_random_access_handle.close [*close]]] 136067 [Close the handle. ] 136068 ] 136069 136070 [ 136071 [[link boost_asio.reference.windows__basic_random_access_handle.get_executor [*get_executor]]] 136072 [Get the executor associated with the object. ] 136073 ] 136074 136075 [ 136076 [[link boost_asio.reference.windows__basic_random_access_handle.is_open [*is_open]]] 136077 [Determine whether the handle is open. ] 136078 ] 136079 136080 [ 136081 [[link boost_asio.reference.windows__basic_random_access_handle.lowest_layer [*lowest_layer]]] 136082 [Get a reference to the lowest layer. 136083 [hr] 136084 Get a const reference to the lowest layer. ] 136085 ] 136086 136087 [ 136088 [[link boost_asio.reference.windows__basic_random_access_handle.native_handle [*native_handle]]] 136089 [Get the native handle representation. ] 136090 ] 136091 136092 [ 136093 [[link boost_asio.reference.windows__basic_random_access_handle.operator_eq_ [*operator=]]] 136094 [Move-assign a random-access handle from another. ] 136095 ] 136096 136097 [ 136098 [[link boost_asio.reference.windows__basic_random_access_handle.read_some_at [*read_some_at]]] 136099 [Read some data from the handle at the specified offset. ] 136100 ] 136101 136102 [ 136103 [[link boost_asio.reference.windows__basic_random_access_handle.write_some_at [*write_some_at]]] 136104 [Write some data to the handle at the specified offset. ] 136105 ] 136106 136107] 136108 136109The [link boost_asio.reference.windows__basic_random_access_handle `windows::basic_random_access_handle`] class provides asynchronous and blocking random-access handle functionality. 136110 136111 136112[heading Thread Safety] 136113 136114['Distinct] ['objects:] Safe. 136115 136116['Shared] ['objects:] Unsafe. 136117 136118 136119 136120 136121[heading Requirements] 136122 136123['Header: ][^boost/asio/windows/random_access_handle.hpp] 136124 136125['Convenience header: ][^boost/asio.hpp] 136126 136127 136128[endsect] 136129 136130 136131 136132[section:windows__stream_handle windows::stream_handle] 136133 136134[indexterm1 boost_asio.indexterm.windows__stream_handle..windows::stream_handle] 136135Typedef for the typical usage of a stream-oriented handle. 136136 136137 136138 typedef basic_stream_handle stream_handle; 136139 136140 136141[heading Types] 136142[table 136143 [[Name][Description]] 136144 136145 [ 136146 136147 [[link boost_asio.reference.windows__basic_stream_handle__rebind_executor [*rebind_executor]]] 136148 [Rebinds the handle type to another executor. ] 136149 136150 ] 136151 136152 [ 136153 136154 [[link boost_asio.reference.windows__basic_stream_handle.executor_type [*executor_type]]] 136155 [The type of the executor associated with the object. ] 136156 136157 ] 136158 136159 [ 136160 136161 [[link boost_asio.reference.windows__basic_stream_handle.lowest_layer_type [*lowest_layer_type]]] 136162 [An overlapped_handle is always the lowest layer. ] 136163 136164 ] 136165 136166 [ 136167 136168 [[link boost_asio.reference.windows__basic_stream_handle.native_handle_type [*native_handle_type]]] 136169 [The native representation of a handle. ] 136170 136171 ] 136172 136173] 136174 136175[heading Member Functions] 136176[table 136177 [[Name][Description]] 136178 136179 [ 136180 [[link boost_asio.reference.windows__basic_stream_handle.assign [*assign]]] 136181 [Assign an existing native handle to the handle. ] 136182 ] 136183 136184 [ 136185 [[link boost_asio.reference.windows__basic_stream_handle.async_read_some [*async_read_some]]] 136186 [Start an asynchronous read. ] 136187 ] 136188 136189 [ 136190 [[link boost_asio.reference.windows__basic_stream_handle.async_write_some [*async_write_some]]] 136191 [Start an asynchronous write. ] 136192 ] 136193 136194 [ 136195 [[link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle [*basic_stream_handle]] [constructor]] 136196 [Construct a stream handle without opening it. 136197 [hr] 136198 Construct a stream handle on an existing native handle. 136199 [hr] 136200 Move-construct a stream handle from another. ] 136201 ] 136202 136203 [ 136204 [[link boost_asio.reference.windows__basic_stream_handle.cancel [*cancel]]] 136205 [Cancel all asynchronous operations associated with the handle. ] 136206 ] 136207 136208 [ 136209 [[link boost_asio.reference.windows__basic_stream_handle.close [*close]]] 136210 [Close the handle. ] 136211 ] 136212 136213 [ 136214 [[link boost_asio.reference.windows__basic_stream_handle.get_executor [*get_executor]]] 136215 [Get the executor associated with the object. ] 136216 ] 136217 136218 [ 136219 [[link boost_asio.reference.windows__basic_stream_handle.is_open [*is_open]]] 136220 [Determine whether the handle is open. ] 136221 ] 136222 136223 [ 136224 [[link boost_asio.reference.windows__basic_stream_handle.lowest_layer [*lowest_layer]]] 136225 [Get a reference to the lowest layer. 136226 [hr] 136227 Get a const reference to the lowest layer. ] 136228 ] 136229 136230 [ 136231 [[link boost_asio.reference.windows__basic_stream_handle.native_handle [*native_handle]]] 136232 [Get the native handle representation. ] 136233 ] 136234 136235 [ 136236 [[link boost_asio.reference.windows__basic_stream_handle.operator_eq_ [*operator=]]] 136237 [Move-assign a stream handle from another. ] 136238 ] 136239 136240 [ 136241 [[link boost_asio.reference.windows__basic_stream_handle.read_some [*read_some]]] 136242 [Read some data from the handle. ] 136243 ] 136244 136245 [ 136246 [[link boost_asio.reference.windows__basic_stream_handle.write_some [*write_some]]] 136247 [Write some data to the handle. ] 136248 ] 136249 136250] 136251 136252The [link boost_asio.reference.windows__basic_stream_handle `windows::basic_stream_handle`] class provides asynchronous and blocking stream-oriented handle functionality. 136253 136254 136255[heading Thread Safety] 136256 136257['Distinct] ['objects:] Safe. 136258 136259['Shared] ['objects:] Unsafe. 136260 136261 136262 136263 136264 136265[heading Requirements] 136266 136267['Header: ][^boost/asio/windows/stream_handle.hpp] 136268 136269['Convenience header: ][^boost/asio.hpp] 136270 136271 136272[endsect] 136273 136274 136275[section:write write] 136276 136277[indexterm1 boost_asio.indexterm.write..write] 136278The `write` function is a composed operation that writes a certain amount of data to a stream before returning. 136279 136280 136281Write all of the supplied data to a stream before returning. 136282 136283 template< 136284 typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``, 136285 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 136286 std::size_t ``[link boost_asio.reference.write.overload1 write]``( 136287 SyncWriteStream & s, 136288 const ConstBufferSequence & buffers, 136289 typename constraint< is_const_buffer_sequence< ConstBufferSequence >::value >::type = 0); 136290 `` [''''»''' [link boost_asio.reference.write.overload1 more...]]`` 136291 136292 template< 136293 typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``, 136294 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 136295 std::size_t ``[link boost_asio.reference.write.overload2 write]``( 136296 SyncWriteStream & s, 136297 const ConstBufferSequence & buffers, 136298 boost::system::error_code & ec, 136299 typename constraint< is_const_buffer_sequence< ConstBufferSequence >::value >::type = 0); 136300 `` [''''»''' [link boost_asio.reference.write.overload2 more...]]`` 136301 136302Write a certain amount of data to a stream before returning. 136303 136304 template< 136305 typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``, 136306 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 136307 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 136308 std::size_t ``[link boost_asio.reference.write.overload3 write]``( 136309 SyncWriteStream & s, 136310 const ConstBufferSequence & buffers, 136311 CompletionCondition completion_condition, 136312 typename constraint< is_const_buffer_sequence< ConstBufferSequence >::value >::type = 0); 136313 `` [''''»''' [link boost_asio.reference.write.overload3 more...]]`` 136314 136315 template< 136316 typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``, 136317 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 136318 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 136319 std::size_t ``[link boost_asio.reference.write.overload4 write]``( 136320 SyncWriteStream & s, 136321 const ConstBufferSequence & buffers, 136322 CompletionCondition completion_condition, 136323 boost::system::error_code & ec, 136324 typename constraint< is_const_buffer_sequence< ConstBufferSequence >::value >::type = 0); 136325 `` [''''»''' [link boost_asio.reference.write.overload4 more...]]`` 136326 136327Write all of the supplied data to a stream before returning. 136328 136329 template< 136330 typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``, 136331 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``> 136332 std::size_t ``[link boost_asio.reference.write.overload5 write]``( 136333 SyncWriteStream & s, 136334 DynamicBuffer_v1 && buffers, 136335 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 136336 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 136337 `` [''''»''' [link boost_asio.reference.write.overload5 more...]]`` 136338 136339 template< 136340 typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``, 136341 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``> 136342 std::size_t ``[link boost_asio.reference.write.overload6 write]``( 136343 SyncWriteStream & s, 136344 DynamicBuffer_v1 && buffers, 136345 boost::system::error_code & ec, 136346 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 136347 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 136348 `` [''''»''' [link boost_asio.reference.write.overload6 more...]]`` 136349 136350Write a certain amount of data to a stream before returning. 136351 136352 template< 136353 typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``, 136354 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``, 136355 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 136356 std::size_t ``[link boost_asio.reference.write.overload7 write]``( 136357 SyncWriteStream & s, 136358 DynamicBuffer_v1 && buffers, 136359 CompletionCondition completion_condition, 136360 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 136361 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 136362 `` [''''»''' [link boost_asio.reference.write.overload7 more...]]`` 136363 136364 template< 136365 typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``, 136366 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``, 136367 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 136368 std::size_t ``[link boost_asio.reference.write.overload8 write]``( 136369 SyncWriteStream & s, 136370 DynamicBuffer_v1 && buffers, 136371 CompletionCondition completion_condition, 136372 boost::system::error_code & ec, 136373 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 136374 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 136375 `` [''''»''' [link boost_asio.reference.write.overload8 more...]]`` 136376 136377Write all of the supplied data to a stream before returning. 136378 136379 template< 136380 typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``, 136381 typename Allocator> 136382 std::size_t ``[link boost_asio.reference.write.overload9 write]``( 136383 SyncWriteStream & s, 136384 basic_streambuf< Allocator > & b); 136385 `` [''''»''' [link boost_asio.reference.write.overload9 more...]]`` 136386 136387 template< 136388 typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``, 136389 typename Allocator> 136390 std::size_t ``[link boost_asio.reference.write.overload10 write]``( 136391 SyncWriteStream & s, 136392 basic_streambuf< Allocator > & b, 136393 boost::system::error_code & ec); 136394 `` [''''»''' [link boost_asio.reference.write.overload10 more...]]`` 136395 136396Write a certain amount of data to a stream before returning. 136397 136398 template< 136399 typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``, 136400 typename Allocator, 136401 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 136402 std::size_t ``[link boost_asio.reference.write.overload11 write]``( 136403 SyncWriteStream & s, 136404 basic_streambuf< Allocator > & b, 136405 CompletionCondition completion_condition); 136406 `` [''''»''' [link boost_asio.reference.write.overload11 more...]]`` 136407 136408 template< 136409 typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``, 136410 typename Allocator, 136411 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 136412 std::size_t ``[link boost_asio.reference.write.overload12 write]``( 136413 SyncWriteStream & s, 136414 basic_streambuf< Allocator > & b, 136415 CompletionCondition completion_condition, 136416 boost::system::error_code & ec); 136417 `` [''''»''' [link boost_asio.reference.write.overload12 more...]]`` 136418 136419Write all of the supplied data to a stream before returning. 136420 136421 template< 136422 typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``, 136423 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``> 136424 std::size_t ``[link boost_asio.reference.write.overload13 write]``( 136425 SyncWriteStream & s, 136426 DynamicBuffer_v2 buffers, 136427 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 136428 `` [''''»''' [link boost_asio.reference.write.overload13 more...]]`` 136429 136430 template< 136431 typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``, 136432 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``> 136433 std::size_t ``[link boost_asio.reference.write.overload14 write]``( 136434 SyncWriteStream & s, 136435 DynamicBuffer_v2 buffers, 136436 boost::system::error_code & ec, 136437 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 136438 `` [''''»''' [link boost_asio.reference.write.overload14 more...]]`` 136439 136440Write a certain amount of data to a stream before returning. 136441 136442 template< 136443 typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``, 136444 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``, 136445 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 136446 std::size_t ``[link boost_asio.reference.write.overload15 write]``( 136447 SyncWriteStream & s, 136448 DynamicBuffer_v2 buffers, 136449 CompletionCondition completion_condition, 136450 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 136451 `` [''''»''' [link boost_asio.reference.write.overload15 more...]]`` 136452 136453 template< 136454 typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``, 136455 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``, 136456 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 136457 std::size_t ``[link boost_asio.reference.write.overload16 write]``( 136458 SyncWriteStream & s, 136459 DynamicBuffer_v2 buffers, 136460 CompletionCondition completion_condition, 136461 boost::system::error_code & ec, 136462 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 136463 `` [''''»''' [link boost_asio.reference.write.overload16 more...]]`` 136464 136465[heading Requirements] 136466 136467['Header: ][^boost/asio/write.hpp] 136468 136469['Convenience header: ][^boost/asio.hpp] 136470 136471 136472[section:overload1 write (1 of 16 overloads)] 136473 136474 136475Write all of the supplied data to a stream before returning. 136476 136477 136478 template< 136479 typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``, 136480 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 136481 std::size_t write( 136482 SyncWriteStream & s, 136483 const ConstBufferSequence & buffers, 136484 typename constraint< is_const_buffer_sequence< ConstBufferSequence >::value >::type = 0); 136485 136486 136487This 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: 136488 136489 136490* 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. 136491 136492 136493* An error occurred. 136494 136495This operation is implemented in terms of zero or more calls to the stream's write\_some function. 136496 136497 136498[heading Parameters] 136499 136500 136501[variablelist 136502 136503[[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]] 136504 136505[[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.]] 136506 136507] 136508 136509 136510[heading Return Value] 136511 136512The number of bytes transferred. 136513 136514 136515[heading Exceptions] 136516 136517 136518[variablelist 136519 136520[[boost::system::system_error][Thrown on failure.]] 136521 136522] 136523 136524 136525[heading Example] 136526 136527To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 136528 136529 boost::asio::write(s, boost::asio::buffer(data, size)); 136530 136531 136532See 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. 136533 136534 136535[heading Remarks] 136536 136537This overload is equivalent to calling: 136538 136539 boost::asio::write( 136540 s, buffers, 136541 boost::asio::transfer_all()); 136542 136543 136544 136545 136546 136547 136548 136549[endsect] 136550 136551 136552 136553[section:overload2 write (2 of 16 overloads)] 136554 136555 136556Write all of the supplied data to a stream before returning. 136557 136558 136559 template< 136560 typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``, 136561 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 136562 std::size_t write( 136563 SyncWriteStream & s, 136564 const ConstBufferSequence & buffers, 136565 boost::system::error_code & ec, 136566 typename constraint< is_const_buffer_sequence< ConstBufferSequence >::value >::type = 0); 136567 136568 136569This 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: 136570 136571 136572* 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. 136573 136574 136575* An error occurred. 136576 136577This operation is implemented in terms of zero or more calls to the stream's write\_some function. 136578 136579 136580[heading Parameters] 136581 136582 136583[variablelist 136584 136585[[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]] 136586 136587[[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.]] 136588 136589[[ec][Set to indicate what error occurred, if any.]] 136590 136591] 136592 136593 136594[heading Return Value] 136595 136596The number of bytes transferred. 136597 136598 136599[heading Example] 136600 136601To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 136602 136603 boost::asio::write(s, boost::asio::buffer(data, size), ec); 136604 136605 136606See 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. 136607 136608 136609[heading Remarks] 136610 136611This overload is equivalent to calling: 136612 136613 boost::asio::write( 136614 s, buffers, 136615 boost::asio::transfer_all(), ec); 136616 136617 136618 136619 136620 136621 136622 136623[endsect] 136624 136625 136626 136627[section:overload3 write (3 of 16 overloads)] 136628 136629 136630Write a certain amount of data to a stream before returning. 136631 136632 136633 template< 136634 typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``, 136635 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 136636 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 136637 std::size_t write( 136638 SyncWriteStream & s, 136639 const ConstBufferSequence & buffers, 136640 CompletionCondition completion_condition, 136641 typename constraint< is_const_buffer_sequence< ConstBufferSequence >::value >::type = 0); 136642 136643 136644This 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: 136645 136646 136647* 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. 136648 136649 136650* The completion\_condition function object returns 0. 136651 136652This operation is implemented in terms of zero or more calls to the stream's write\_some function. 136653 136654 136655[heading Parameters] 136656 136657 136658[variablelist 136659 136660[[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]] 136661 136662[[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.]] 136663 136664[[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 136665`` 136666 std::size_t completion_condition( 136667 // Result of latest write_some operation. 136668 const boost::system::error_code& error, 136669 136670 // Number of bytes transferred so far. 136671 std::size_t bytes_transferred 136672 ); 136673`` 136674A 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.]] 136675 136676] 136677 136678 136679[heading Return Value] 136680 136681The number of bytes transferred. 136682 136683 136684[heading Exceptions] 136685 136686 136687[variablelist 136688 136689[[boost::system::system_error][Thrown on failure.]] 136690 136691] 136692 136693 136694[heading Example] 136695 136696To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 136697 136698 boost::asio::write(s, boost::asio::buffer(data, size), 136699 boost::asio::transfer_at_least(32)); 136700 136701 136702See 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. 136703 136704 136705 136706 136707[endsect] 136708 136709 136710 136711[section:overload4 write (4 of 16 overloads)] 136712 136713 136714Write a certain amount of data to a stream before returning. 136715 136716 136717 template< 136718 typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``, 136719 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 136720 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 136721 std::size_t write( 136722 SyncWriteStream & s, 136723 const ConstBufferSequence & buffers, 136724 CompletionCondition completion_condition, 136725 boost::system::error_code & ec, 136726 typename constraint< is_const_buffer_sequence< ConstBufferSequence >::value >::type = 0); 136727 136728 136729This 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: 136730 136731 136732* 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. 136733 136734 136735* The completion\_condition function object returns 0. 136736 136737This operation is implemented in terms of zero or more calls to the stream's write\_some function. 136738 136739 136740[heading Parameters] 136741 136742 136743[variablelist 136744 136745[[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]] 136746 136747[[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.]] 136748 136749[[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 136750`` 136751 std::size_t completion_condition( 136752 // Result of latest write_some operation. 136753 const boost::system::error_code& error, 136754 136755 // Number of bytes transferred so far. 136756 std::size_t bytes_transferred 136757 ); 136758`` 136759A 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.]] 136760 136761[[ec][Set to indicate what error occurred, if any.]] 136762 136763] 136764 136765 136766[heading Return Value] 136767 136768The number of bytes written. If an error occurs, returns the total number of bytes successfully transferred prior to the error. 136769 136770 136771 136772 136773[endsect] 136774 136775 136776 136777[section:overload5 write (5 of 16 overloads)] 136778 136779 136780Write all of the supplied data to a stream before returning. 136781 136782 136783 template< 136784 typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``, 136785 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``> 136786 std::size_t write( 136787 SyncWriteStream & s, 136788 DynamicBuffer_v1 && buffers, 136789 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 136790 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 136791 136792 136793This 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: 136794 136795 136796* All of the data in the supplied dynamic buffer sequence has been written. 136797 136798 136799* An error occurred. 136800 136801This operation is implemented in terms of zero or more calls to the stream's write\_some function. 136802 136803 136804[heading Parameters] 136805 136806 136807[variablelist 136808 136809[[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]] 136810 136811[[buffers][The dynamic buffer sequence from which data will be written. Successfully written data is automatically consumed from the buffers.]] 136812 136813] 136814 136815 136816[heading Return Value] 136817 136818The number of bytes transferred. 136819 136820 136821[heading Exceptions] 136822 136823 136824[variablelist 136825 136826[[boost::system::system_error][Thrown on failure.]] 136827 136828] 136829 136830 136831[heading Remarks] 136832 136833This overload is equivalent to calling: 136834 136835 boost::asio::write( 136836 s, buffers, 136837 boost::asio::transfer_all()); 136838 136839 136840 136841 136842 136843 136844 136845[endsect] 136846 136847 136848 136849[section:overload6 write (6 of 16 overloads)] 136850 136851 136852Write all of the supplied data to a stream before returning. 136853 136854 136855 template< 136856 typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``, 136857 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``> 136858 std::size_t write( 136859 SyncWriteStream & s, 136860 DynamicBuffer_v1 && buffers, 136861 boost::system::error_code & ec, 136862 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 136863 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 136864 136865 136866This 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: 136867 136868 136869* All of the data in the supplied dynamic buffer sequence has been written. 136870 136871 136872* An error occurred. 136873 136874This operation is implemented in terms of zero or more calls to the stream's write\_some function. 136875 136876 136877[heading Parameters] 136878 136879 136880[variablelist 136881 136882[[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]] 136883 136884[[buffers][The dynamic buffer sequence from which data will be written. Successfully written data is automatically consumed from the buffers.]] 136885 136886[[ec][Set to indicate what error occurred, if any.]] 136887 136888] 136889 136890 136891[heading Return Value] 136892 136893The number of bytes transferred. 136894 136895 136896[heading Remarks] 136897 136898This overload is equivalent to calling: 136899 136900 boost::asio::write( 136901 s, buffers, 136902 boost::asio::transfer_all(), ec); 136903 136904 136905 136906 136907 136908 136909 136910[endsect] 136911 136912 136913 136914[section:overload7 write (7 of 16 overloads)] 136915 136916 136917Write a certain amount of data to a stream before returning. 136918 136919 136920 template< 136921 typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``, 136922 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``, 136923 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 136924 std::size_t write( 136925 SyncWriteStream & s, 136926 DynamicBuffer_v1 && buffers, 136927 CompletionCondition completion_condition, 136928 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 136929 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 136930 136931 136932This 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: 136933 136934 136935* All of the data in the supplied dynamic buffer sequence has been written. 136936 136937 136938* The completion\_condition function object returns 0. 136939 136940This operation is implemented in terms of zero or more calls to the stream's write\_some function. 136941 136942 136943[heading Parameters] 136944 136945 136946[variablelist 136947 136948[[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]] 136949 136950[[buffers][The dynamic buffer sequence from which data will be written. Successfully written data is automatically consumed from the buffers.]] 136951 136952[[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 136953`` 136954 std::size_t completion_condition( 136955 // Result of latest write_some operation. 136956 const boost::system::error_code& error, 136957 136958 // Number of bytes transferred so far. 136959 std::size_t bytes_transferred 136960 ); 136961`` 136962A 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.]] 136963 136964] 136965 136966 136967[heading Return Value] 136968 136969The number of bytes transferred. 136970 136971 136972[heading Exceptions] 136973 136974 136975[variablelist 136976 136977[[boost::system::system_error][Thrown on failure. ]] 136978 136979] 136980 136981 136982 136983 136984[endsect] 136985 136986 136987 136988[section:overload8 write (8 of 16 overloads)] 136989 136990 136991Write a certain amount of data to a stream before returning. 136992 136993 136994 template< 136995 typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``, 136996 typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``, 136997 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 136998 std::size_t write( 136999 SyncWriteStream & s, 137000 DynamicBuffer_v1 && buffers, 137001 CompletionCondition completion_condition, 137002 boost::system::error_code & ec, 137003 typename constraint< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0, 137004 typename constraint< !is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type = 0); 137005 137006 137007This 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: 137008 137009 137010* All of the data in the supplied dynamic buffer sequence has been written. 137011 137012 137013* The completion\_condition function object returns 0. 137014 137015This operation is implemented in terms of zero or more calls to the stream's write\_some function. 137016 137017 137018[heading Parameters] 137019 137020 137021[variablelist 137022 137023[[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]] 137024 137025[[buffers][The dynamic buffer sequence from which data will be written. Successfully written data is automatically consumed from the buffers.]] 137026 137027[[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 137028`` 137029 std::size_t completion_condition( 137030 // Result of latest write_some operation. 137031 const boost::system::error_code& error, 137032 137033 // Number of bytes transferred so far. 137034 std::size_t bytes_transferred 137035 ); 137036`` 137037A 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.]] 137038 137039[[ec][Set to indicate what error occurred, if any.]] 137040 137041] 137042 137043 137044[heading Return Value] 137045 137046The number of bytes written. If an error occurs, returns the total number of bytes successfully transferred prior to the error. 137047 137048 137049 137050 137051[endsect] 137052 137053 137054 137055[section:overload9 write (9 of 16 overloads)] 137056 137057 137058Write all of the supplied data to a stream before returning. 137059 137060 137061 template< 137062 typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``, 137063 typename Allocator> 137064 std::size_t write( 137065 SyncWriteStream & s, 137066 basic_streambuf< Allocator > & b); 137067 137068 137069This 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: 137070 137071 137072* All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written. 137073 137074 137075* An error occurred. 137076 137077This operation is implemented in terms of zero or more calls to the stream's write\_some function. 137078 137079 137080[heading Parameters] 137081 137082 137083[variablelist 137084 137085[[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]] 137086 137087[[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object from which data will be written.]] 137088 137089] 137090 137091 137092[heading Return Value] 137093 137094The number of bytes transferred. 137095 137096 137097[heading Exceptions] 137098 137099 137100[variablelist 137101 137102[[boost::system::system_error][Thrown on failure.]] 137103 137104] 137105 137106 137107[heading Remarks] 137108 137109This overload is equivalent to calling: 137110 137111 boost::asio::write( 137112 s, b, 137113 boost::asio::transfer_all()); 137114 137115 137116 137117 137118 137119 137120 137121[endsect] 137122 137123 137124 137125[section:overload10 write (10 of 16 overloads)] 137126 137127 137128Write all of the supplied data to a stream before returning. 137129 137130 137131 template< 137132 typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``, 137133 typename Allocator> 137134 std::size_t write( 137135 SyncWriteStream & s, 137136 basic_streambuf< Allocator > & b, 137137 boost::system::error_code & ec); 137138 137139 137140This 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: 137141 137142 137143* All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written. 137144 137145 137146* An error occurred. 137147 137148This operation is implemented in terms of zero or more calls to the stream's write\_some function. 137149 137150 137151[heading Parameters] 137152 137153 137154[variablelist 137155 137156[[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]] 137157 137158[[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object from which data will be written.]] 137159 137160[[ec][Set to indicate what error occurred, if any.]] 137161 137162] 137163 137164 137165[heading Return Value] 137166 137167The number of bytes transferred. 137168 137169 137170[heading Remarks] 137171 137172This overload is equivalent to calling: 137173 137174 boost::asio::write( 137175 s, b, 137176 boost::asio::transfer_all(), ec); 137177 137178 137179 137180 137181 137182 137183 137184[endsect] 137185 137186 137187 137188[section:overload11 write (11 of 16 overloads)] 137189 137190 137191Write a certain amount of data to a stream before returning. 137192 137193 137194 template< 137195 typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``, 137196 typename Allocator, 137197 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 137198 std::size_t write( 137199 SyncWriteStream & s, 137200 basic_streambuf< Allocator > & b, 137201 CompletionCondition completion_condition); 137202 137203 137204This 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: 137205 137206 137207* All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written. 137208 137209 137210* The completion\_condition function object returns 0. 137211 137212This operation is implemented in terms of zero or more calls to the stream's write\_some function. 137213 137214 137215[heading Parameters] 137216 137217 137218[variablelist 137219 137220[[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]] 137221 137222[[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object from which data will be written.]] 137223 137224[[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 137225`` 137226 std::size_t completion_condition( 137227 // Result of latest write_some operation. 137228 const boost::system::error_code& error, 137229 137230 // Number of bytes transferred so far. 137231 std::size_t bytes_transferred 137232 ); 137233`` 137234A 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.]] 137235 137236] 137237 137238 137239[heading Return Value] 137240 137241The number of bytes transferred. 137242 137243 137244[heading Exceptions] 137245 137246 137247[variablelist 137248 137249[[boost::system::system_error][Thrown on failure. ]] 137250 137251] 137252 137253 137254 137255 137256[endsect] 137257 137258 137259 137260[section:overload12 write (12 of 16 overloads)] 137261 137262 137263Write a certain amount of data to a stream before returning. 137264 137265 137266 template< 137267 typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``, 137268 typename Allocator, 137269 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 137270 std::size_t write( 137271 SyncWriteStream & s, 137272 basic_streambuf< Allocator > & b, 137273 CompletionCondition completion_condition, 137274 boost::system::error_code & ec); 137275 137276 137277This 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: 137278 137279 137280* All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written. 137281 137282 137283* The completion\_condition function object returns 0. 137284 137285This operation is implemented in terms of zero or more calls to the stream's write\_some function. 137286 137287 137288[heading Parameters] 137289 137290 137291[variablelist 137292 137293[[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]] 137294 137295[[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object from which data will be written.]] 137296 137297[[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 137298`` 137299 std::size_t completion_condition( 137300 // Result of latest write_some operation. 137301 const boost::system::error_code& error, 137302 137303 // Number of bytes transferred so far. 137304 std::size_t bytes_transferred 137305 ); 137306`` 137307A 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.]] 137308 137309[[ec][Set to indicate what error occurred, if any.]] 137310 137311] 137312 137313 137314[heading Return Value] 137315 137316The number of bytes written. If an error occurs, returns the total number of bytes successfully transferred prior to the error. 137317 137318 137319 137320 137321[endsect] 137322 137323 137324 137325[section:overload13 write (13 of 16 overloads)] 137326 137327 137328Write all of the supplied data to a stream before returning. 137329 137330 137331 template< 137332 typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``, 137333 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``> 137334 std::size_t write( 137335 SyncWriteStream & s, 137336 DynamicBuffer_v2 buffers, 137337 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 137338 137339 137340This 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: 137341 137342 137343* All of the data in the supplied dynamic buffer sequence has been written. 137344 137345 137346* An error occurred. 137347 137348This operation is implemented in terms of zero or more calls to the stream's write\_some function. 137349 137350 137351[heading Parameters] 137352 137353 137354[variablelist 137355 137356[[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]] 137357 137358[[buffers][The dynamic buffer sequence from which data will be written. Successfully written data is automatically consumed from the buffers.]] 137359 137360] 137361 137362 137363[heading Return Value] 137364 137365The number of bytes transferred. 137366 137367 137368[heading Exceptions] 137369 137370 137371[variablelist 137372 137373[[boost::system::system_error][Thrown on failure.]] 137374 137375] 137376 137377 137378[heading Remarks] 137379 137380This overload is equivalent to calling: 137381 137382 boost::asio::write( 137383 s, buffers, 137384 boost::asio::transfer_all()); 137385 137386 137387 137388 137389 137390 137391 137392[endsect] 137393 137394 137395 137396[section:overload14 write (14 of 16 overloads)] 137397 137398 137399Write all of the supplied data to a stream before returning. 137400 137401 137402 template< 137403 typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``, 137404 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``> 137405 std::size_t write( 137406 SyncWriteStream & s, 137407 DynamicBuffer_v2 buffers, 137408 boost::system::error_code & ec, 137409 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 137410 137411 137412This 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: 137413 137414 137415* All of the data in the supplied dynamic buffer sequence has been written. 137416 137417 137418* An error occurred. 137419 137420This operation is implemented in terms of zero or more calls to the stream's write\_some function. 137421 137422 137423[heading Parameters] 137424 137425 137426[variablelist 137427 137428[[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]] 137429 137430[[buffers][The dynamic buffer sequence from which data will be written. Successfully written data is automatically consumed from the buffers.]] 137431 137432[[ec][Set to indicate what error occurred, if any.]] 137433 137434] 137435 137436 137437[heading Return Value] 137438 137439The number of bytes transferred. 137440 137441 137442[heading Remarks] 137443 137444This overload is equivalent to calling: 137445 137446 boost::asio::write( 137447 s, buffers, 137448 boost::asio::transfer_all(), ec); 137449 137450 137451 137452 137453 137454 137455 137456[endsect] 137457 137458 137459 137460[section:overload15 write (15 of 16 overloads)] 137461 137462 137463Write a certain amount of data to a stream before returning. 137464 137465 137466 template< 137467 typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``, 137468 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``, 137469 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 137470 std::size_t write( 137471 SyncWriteStream & s, 137472 DynamicBuffer_v2 buffers, 137473 CompletionCondition completion_condition, 137474 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 137475 137476 137477This 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: 137478 137479 137480* All of the data in the supplied dynamic buffer sequence has been written. 137481 137482 137483* The completion\_condition function object returns 0. 137484 137485This operation is implemented in terms of zero or more calls to the stream's write\_some function. 137486 137487 137488[heading Parameters] 137489 137490 137491[variablelist 137492 137493[[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]] 137494 137495[[buffers][The dynamic buffer sequence from which data will be written. Successfully written data is automatically consumed from the buffers.]] 137496 137497[[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 137498`` 137499 std::size_t completion_condition( 137500 // Result of latest write_some operation. 137501 const boost::system::error_code& error, 137502 137503 // Number of bytes transferred so far. 137504 std::size_t bytes_transferred 137505 ); 137506`` 137507A 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.]] 137508 137509] 137510 137511 137512[heading Return Value] 137513 137514The number of bytes transferred. 137515 137516 137517[heading Exceptions] 137518 137519 137520[variablelist 137521 137522[[boost::system::system_error][Thrown on failure. ]] 137523 137524] 137525 137526 137527 137528 137529[endsect] 137530 137531 137532 137533[section:overload16 write (16 of 16 overloads)] 137534 137535 137536Write a certain amount of data to a stream before returning. 137537 137538 137539 template< 137540 typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``, 137541 typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``, 137542 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 137543 std::size_t write( 137544 SyncWriteStream & s, 137545 DynamicBuffer_v2 buffers, 137546 CompletionCondition completion_condition, 137547 boost::system::error_code & ec, 137548 typename constraint< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type = 0); 137549 137550 137551This 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: 137552 137553 137554* All of the data in the supplied dynamic buffer sequence has been written. 137555 137556 137557* The completion\_condition function object returns 0. 137558 137559This operation is implemented in terms of zero or more calls to the stream's write\_some function. 137560 137561 137562[heading Parameters] 137563 137564 137565[variablelist 137566 137567[[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]] 137568 137569[[buffers][The dynamic buffer sequence from which data will be written. Successfully written data is automatically consumed from the buffers.]] 137570 137571[[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 137572`` 137573 std::size_t completion_condition( 137574 // Result of latest write_some operation. 137575 const boost::system::error_code& error, 137576 137577 // Number of bytes transferred so far. 137578 std::size_t bytes_transferred 137579 ); 137580`` 137581A 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.]] 137582 137583[[ec][Set to indicate what error occurred, if any.]] 137584 137585] 137586 137587 137588[heading Return Value] 137589 137590The number of bytes written. If an error occurs, returns the total number of bytes successfully transferred prior to the error. 137591 137592 137593 137594 137595[endsect] 137596 137597 137598[endsect] 137599 137600[section:write_at write_at] 137601 137602[indexterm1 boost_asio.indexterm.write_at..write_at] 137603The `write_at` function is a composed operation that writes a certain amount of data at a specified offset before returning. 137604 137605 137606Write all of the supplied data at the specified offset before returning. 137607 137608 template< 137609 typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``, 137610 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 137611 std::size_t ``[link boost_asio.reference.write_at.overload1 write_at]``( 137612 SyncRandomAccessWriteDevice & d, 137613 uint64_t offset, 137614 const ConstBufferSequence & buffers); 137615 `` [''''»''' [link boost_asio.reference.write_at.overload1 more...]]`` 137616 137617 template< 137618 typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``, 137619 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 137620 std::size_t ``[link boost_asio.reference.write_at.overload2 write_at]``( 137621 SyncRandomAccessWriteDevice & d, 137622 uint64_t offset, 137623 const ConstBufferSequence & buffers, 137624 boost::system::error_code & ec); 137625 `` [''''»''' [link boost_asio.reference.write_at.overload2 more...]]`` 137626 137627Write a certain amount of data at a specified offset before returning. 137628 137629 template< 137630 typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``, 137631 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 137632 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 137633 std::size_t ``[link boost_asio.reference.write_at.overload3 write_at]``( 137634 SyncRandomAccessWriteDevice & d, 137635 uint64_t offset, 137636 const ConstBufferSequence & buffers, 137637 CompletionCondition completion_condition); 137638 `` [''''»''' [link boost_asio.reference.write_at.overload3 more...]]`` 137639 137640 template< 137641 typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``, 137642 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 137643 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 137644 std::size_t ``[link boost_asio.reference.write_at.overload4 write_at]``( 137645 SyncRandomAccessWriteDevice & d, 137646 uint64_t offset, 137647 const ConstBufferSequence & buffers, 137648 CompletionCondition completion_condition, 137649 boost::system::error_code & ec); 137650 `` [''''»''' [link boost_asio.reference.write_at.overload4 more...]]`` 137651 137652Write all of the supplied data at the specified offset before returning. 137653 137654 template< 137655 typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``, 137656 typename Allocator> 137657 std::size_t ``[link boost_asio.reference.write_at.overload5 write_at]``( 137658 SyncRandomAccessWriteDevice & d, 137659 uint64_t offset, 137660 basic_streambuf< Allocator > & b); 137661 `` [''''»''' [link boost_asio.reference.write_at.overload5 more...]]`` 137662 137663 template< 137664 typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``, 137665 typename Allocator> 137666 std::size_t ``[link boost_asio.reference.write_at.overload6 write_at]``( 137667 SyncRandomAccessWriteDevice & d, 137668 uint64_t offset, 137669 basic_streambuf< Allocator > & b, 137670 boost::system::error_code & ec); 137671 `` [''''»''' [link boost_asio.reference.write_at.overload6 more...]]`` 137672 137673Write a certain amount of data at a specified offset before returning. 137674 137675 template< 137676 typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``, 137677 typename Allocator, 137678 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 137679 std::size_t ``[link boost_asio.reference.write_at.overload7 write_at]``( 137680 SyncRandomAccessWriteDevice & d, 137681 uint64_t offset, 137682 basic_streambuf< Allocator > & b, 137683 CompletionCondition completion_condition); 137684 `` [''''»''' [link boost_asio.reference.write_at.overload7 more...]]`` 137685 137686 template< 137687 typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``, 137688 typename Allocator, 137689 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 137690 std::size_t ``[link boost_asio.reference.write_at.overload8 write_at]``( 137691 SyncRandomAccessWriteDevice & d, 137692 uint64_t offset, 137693 basic_streambuf< Allocator > & b, 137694 CompletionCondition completion_condition, 137695 boost::system::error_code & ec); 137696 `` [''''»''' [link boost_asio.reference.write_at.overload8 more...]]`` 137697 137698[heading Requirements] 137699 137700['Header: ][^boost/asio/write_at.hpp] 137701 137702['Convenience header: ][^boost/asio.hpp] 137703 137704 137705[section:overload1 write_at (1 of 8 overloads)] 137706 137707 137708Write all of the supplied data at the specified offset before returning. 137709 137710 137711 template< 137712 typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``, 137713 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 137714 std::size_t write_at( 137715 SyncRandomAccessWriteDevice & d, 137716 uint64_t offset, 137717 const ConstBufferSequence & buffers); 137718 137719 137720This 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: 137721 137722 137723* 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. 137724 137725 137726* An error occurred. 137727 137728This operation is implemented in terms of zero or more calls to the device's write\_some\_at function. 137729 137730 137731[heading Parameters] 137732 137733 137734[variablelist 137735 137736[[d][The device to which the data is to be written. The type must support the SyncRandomAccessWriteDevice concept.]] 137737 137738[[offset][The offset at which the data will be written.]] 137739 137740[[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.]] 137741 137742] 137743 137744 137745[heading Return Value] 137746 137747The number of bytes transferred. 137748 137749 137750[heading Exceptions] 137751 137752 137753[variablelist 137754 137755[[boost::system::system_error][Thrown on failure.]] 137756 137757] 137758 137759 137760[heading Example] 137761 137762To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 137763 137764 boost::asio::write_at(d, 42, boost::asio::buffer(data, size)); 137765 137766 137767See 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. 137768 137769 137770[heading Remarks] 137771 137772This overload is equivalent to calling: 137773 137774 boost::asio::write_at( 137775 d, offset, buffers, 137776 boost::asio::transfer_all()); 137777 137778 137779 137780 137781 137782 137783 137784[endsect] 137785 137786 137787 137788[section:overload2 write_at (2 of 8 overloads)] 137789 137790 137791Write all of the supplied data at the specified offset before returning. 137792 137793 137794 template< 137795 typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``, 137796 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> 137797 std::size_t write_at( 137798 SyncRandomAccessWriteDevice & d, 137799 uint64_t offset, 137800 const ConstBufferSequence & buffers, 137801 boost::system::error_code & ec); 137802 137803 137804This 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: 137805 137806 137807* 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. 137808 137809 137810* An error occurred. 137811 137812This operation is implemented in terms of zero or more calls to the device's write\_some\_at function. 137813 137814 137815[heading Parameters] 137816 137817 137818[variablelist 137819 137820[[d][The device to which the data is to be written. The type must support the SyncRandomAccessWriteDevice concept.]] 137821 137822[[offset][The offset at which the data will be written.]] 137823 137824[[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.]] 137825 137826[[ec][Set to indicate what error occurred, if any.]] 137827 137828] 137829 137830 137831[heading Return Value] 137832 137833The number of bytes transferred. 137834 137835 137836[heading Example] 137837 137838To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 137839 137840 boost::asio::write_at(d, 42, 137841 boost::asio::buffer(data, size), ec); 137842 137843 137844See 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. 137845 137846 137847[heading Remarks] 137848 137849This overload is equivalent to calling: 137850 137851 boost::asio::write_at( 137852 d, offset, buffers, 137853 boost::asio::transfer_all(), ec); 137854 137855 137856 137857 137858 137859 137860 137861[endsect] 137862 137863 137864 137865[section:overload3 write_at (3 of 8 overloads)] 137866 137867 137868Write a certain amount of data at a specified offset before returning. 137869 137870 137871 template< 137872 typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``, 137873 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 137874 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 137875 std::size_t write_at( 137876 SyncRandomAccessWriteDevice & d, 137877 uint64_t offset, 137878 const ConstBufferSequence & buffers, 137879 CompletionCondition completion_condition); 137880 137881 137882This 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: 137883 137884 137885* 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. 137886 137887 137888* The completion\_condition function object returns 0. 137889 137890This operation is implemented in terms of zero or more calls to the device's write\_some\_at function. 137891 137892 137893[heading Parameters] 137894 137895 137896[variablelist 137897 137898[[d][The device to which the data is to be written. The type must support the SyncRandomAccessWriteDevice concept.]] 137899 137900[[offset][The offset at which the data will be written.]] 137901 137902[[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.]] 137903 137904[[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 137905`` 137906 std::size_t completion_condition( 137907 // Result of latest write_some_at operation. 137908 const boost::system::error_code& error, 137909 137910 // Number of bytes transferred so far. 137911 std::size_t bytes_transferred 137912 ); 137913`` 137914A 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.]] 137915 137916] 137917 137918 137919[heading Return Value] 137920 137921The number of bytes transferred. 137922 137923 137924[heading Exceptions] 137925 137926 137927[variablelist 137928 137929[[boost::system::system_error][Thrown on failure.]] 137930 137931] 137932 137933 137934[heading Example] 137935 137936To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: 137937 137938 boost::asio::write_at(d, 42, boost::asio::buffer(data, size), 137939 boost::asio::transfer_at_least(32)); 137940 137941 137942See 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. 137943 137944 137945 137946 137947[endsect] 137948 137949 137950 137951[section:overload4 write_at (4 of 8 overloads)] 137952 137953 137954Write a certain amount of data at a specified offset before returning. 137955 137956 137957 template< 137958 typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``, 137959 typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, 137960 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 137961 std::size_t write_at( 137962 SyncRandomAccessWriteDevice & d, 137963 uint64_t offset, 137964 const ConstBufferSequence & buffers, 137965 CompletionCondition completion_condition, 137966 boost::system::error_code & ec); 137967 137968 137969This 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: 137970 137971 137972* 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. 137973 137974 137975* The completion\_condition function object returns 0. 137976 137977This operation is implemented in terms of zero or more calls to the device's write\_some\_at function. 137978 137979 137980[heading Parameters] 137981 137982 137983[variablelist 137984 137985[[d][The device to which the data is to be written. The type must support the SyncRandomAccessWriteDevice concept.]] 137986 137987[[offset][The offset at which the data will be written.]] 137988 137989[[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.]] 137990 137991[[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 137992`` 137993 std::size_t completion_condition( 137994 // Result of latest write_some_at operation. 137995 const boost::system::error_code& error, 137996 137997 // Number of bytes transferred so far. 137998 std::size_t bytes_transferred 137999 ); 138000`` 138001A 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.]] 138002 138003[[ec][Set to indicate what error occurred, if any.]] 138004 138005] 138006 138007 138008[heading Return Value] 138009 138010The number of bytes written. If an error occurs, returns the total number of bytes successfully transferred prior to the error. 138011 138012 138013 138014 138015[endsect] 138016 138017 138018 138019[section:overload5 write_at (5 of 8 overloads)] 138020 138021 138022Write all of the supplied data at the specified offset before returning. 138023 138024 138025 template< 138026 typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``, 138027 typename Allocator> 138028 std::size_t write_at( 138029 SyncRandomAccessWriteDevice & d, 138030 uint64_t offset, 138031 basic_streambuf< Allocator > & b); 138032 138033 138034This 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: 138035 138036 138037* All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written. 138038 138039 138040* An error occurred. 138041 138042This operation is implemented in terms of zero or more calls to the device's write\_some\_at function. 138043 138044 138045[heading Parameters] 138046 138047 138048[variablelist 138049 138050[[d][The device to which the data is to be written. The type must support the SyncRandomAccessWriteDevice concept.]] 138051 138052[[offset][The offset at which the data will be written.]] 138053 138054[[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object from which data will be written.]] 138055 138056] 138057 138058 138059[heading Return Value] 138060 138061The number of bytes transferred. 138062 138063 138064[heading Exceptions] 138065 138066 138067[variablelist 138068 138069[[boost::system::system_error][Thrown on failure.]] 138070 138071] 138072 138073 138074[heading Remarks] 138075 138076This overload is equivalent to calling: 138077 138078 boost::asio::write_at( 138079 d, 42, b, 138080 boost::asio::transfer_all()); 138081 138082 138083 138084 138085 138086 138087 138088[endsect] 138089 138090 138091 138092[section:overload6 write_at (6 of 8 overloads)] 138093 138094 138095Write all of the supplied data at the specified offset before returning. 138096 138097 138098 template< 138099 typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``, 138100 typename Allocator> 138101 std::size_t write_at( 138102 SyncRandomAccessWriteDevice & d, 138103 uint64_t offset, 138104 basic_streambuf< Allocator > & b, 138105 boost::system::error_code & ec); 138106 138107 138108This 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: 138109 138110 138111* All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written. 138112 138113 138114* An error occurred. 138115 138116This operation is implemented in terms of zero or more calls to the device's write\_some\_at function. 138117 138118 138119[heading Parameters] 138120 138121 138122[variablelist 138123 138124[[d][The device to which the data is to be written. The type must support the SyncRandomAccessWriteDevice concept.]] 138125 138126[[offset][The offset at which the data will be written.]] 138127 138128[[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object from which data will be written.]] 138129 138130[[ec][Set to indicate what error occurred, if any.]] 138131 138132] 138133 138134 138135[heading Return Value] 138136 138137The number of bytes transferred. 138138 138139 138140[heading Remarks] 138141 138142This overload is equivalent to calling: 138143 138144 boost::asio::write_at( 138145 d, 42, b, 138146 boost::asio::transfer_all(), ec); 138147 138148 138149 138150 138151 138152 138153 138154[endsect] 138155 138156 138157 138158[section:overload7 write_at (7 of 8 overloads)] 138159 138160 138161Write a certain amount of data at a specified offset before returning. 138162 138163 138164 template< 138165 typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``, 138166 typename Allocator, 138167 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 138168 std::size_t write_at( 138169 SyncRandomAccessWriteDevice & d, 138170 uint64_t offset, 138171 basic_streambuf< Allocator > & b, 138172 CompletionCondition completion_condition); 138173 138174 138175This 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: 138176 138177 138178* All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written. 138179 138180 138181* The completion\_condition function object returns 0. 138182 138183This operation is implemented in terms of zero or more calls to the device's write\_some\_at function. 138184 138185 138186[heading Parameters] 138187 138188 138189[variablelist 138190 138191[[d][The device to which the data is to be written. The type must support the SyncRandomAccessWriteDevice concept.]] 138192 138193[[offset][The offset at which the data will be written.]] 138194 138195[[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object from which data will be written.]] 138196 138197[[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 138198`` 138199 std::size_t completion_condition( 138200 // Result of latest write_some_at operation. 138201 const boost::system::error_code& error, 138202 138203 // Number of bytes transferred so far. 138204 std::size_t bytes_transferred 138205 ); 138206`` 138207A 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.]] 138208 138209] 138210 138211 138212[heading Return Value] 138213 138214The number of bytes transferred. 138215 138216 138217[heading Exceptions] 138218 138219 138220[variablelist 138221 138222[[boost::system::system_error][Thrown on failure. ]] 138223 138224] 138225 138226 138227 138228 138229[endsect] 138230 138231 138232 138233[section:overload8 write_at (8 of 8 overloads)] 138234 138235 138236Write a certain amount of data at a specified offset before returning. 138237 138238 138239 template< 138240 typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``, 138241 typename Allocator, 138242 typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``> 138243 std::size_t write_at( 138244 SyncRandomAccessWriteDevice & d, 138245 uint64_t offset, 138246 basic_streambuf< Allocator > & b, 138247 CompletionCondition completion_condition, 138248 boost::system::error_code & ec); 138249 138250 138251This 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: 138252 138253 138254* All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written. 138255 138256 138257* The completion\_condition function object returns 0. 138258 138259This operation is implemented in terms of zero or more calls to the device's write\_some\_at function. 138260 138261 138262[heading Parameters] 138263 138264 138265[variablelist 138266 138267[[d][The device to which the data is to be written. The type must support the SyncRandomAccessWriteDevice concept.]] 138268 138269[[offset][The offset at which the data will be written.]] 138270 138271[[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object from which data will be written.]] 138272 138273[[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: 138274`` 138275 std::size_t completion_condition( 138276 // Result of latest write_some_at operation. 138277 const boost::system::error_code& error, 138278 138279 // Number of bytes transferred so far. 138280 std::size_t bytes_transferred 138281 ); 138282`` 138283A 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.]] 138284 138285[[ec][Set to indicate what error occurred, if any.]] 138286 138287] 138288 138289 138290[heading Return Value] 138291 138292The number of bytes written. If an error occurs, returns the total number of bytes successfully transferred prior to the error. 138293 138294 138295 138296 138297[endsect] 138298 138299 138300[endsect] 138301 138302 138303[section:yield_context yield_context] 138304 138305[indexterm1 boost_asio.indexterm.yield_context..yield_context] 138306Context object that represents the currently executing coroutine. 138307 138308 138309 typedef basic_yield_context< unspecified > yield_context; 138310 138311 138312[heading Types] 138313[table 138314 [[Name][Description]] 138315 138316 [ 138317 138318 [[link boost_asio.reference.basic_yield_context.callee_type [*callee_type]]] 138319 [The coroutine callee type, used by the implementation. ] 138320 138321 ] 138322 138323 [ 138324 138325 [[link boost_asio.reference.basic_yield_context.caller_type [*caller_type]]] 138326 [The coroutine caller type, used by the implementation. ] 138327 138328 ] 138329 138330] 138331 138332[heading Member Functions] 138333[table 138334 [[Name][Description]] 138335 138336 [ 138337 [[link boost_asio.reference.basic_yield_context.basic_yield_context [*basic_yield_context]] [constructor]] 138338 [Construct a yield context to represent the specified coroutine. 138339 [hr] 138340 Construct a yield context from another yield context type. ] 138341 ] 138342 138343 [ 138344 [[link boost_asio.reference.basic_yield_context.operator_lb__rb_ [*operator\[\]]]] 138345 [Return a yield context that sets the specified error_code. ] 138346 ] 138347 138348] 138349 138350The [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: 138351 138352 138353 138354 template <typename Handler> 138355 void my_coroutine(basic_yield_context<Handler> yield) 138356 { 138357 ... 138358 std::size_t n = my_socket.async_read_some(buffer, yield); 138359 ... 138360 } 138361 138362 138363 138364 138365The 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. 138366 138367 138368[heading Requirements] 138369 138370['Header: ][^boost/asio/spawn.hpp] 138371 138372['Convenience header: ]None 138373 138374 138375[endsect] 138376 138377 138378[section:is_error_code_enum_lt__addrinfo_errors__gt_ boost::system::is_error_code_enum< boost::asio::error::addrinfo_errors >] 138379 138380[indexterm1 boost_asio.indexterm.is_error_code_enum_lt__addrinfo_errors__gt_..boost::system::is_error_code_enum< boost::asio::error::addrinfo_errors >] 138381 138382 138383 138384 template<> 138385 struct boost::system::is_error_code_enum< boost::asio::error::addrinfo_errors > 138386 138387 138388[heading Data Members] 138389[table 138390 [[Name][Description]] 138391 138392 [ 138393 [[link boost_asio.reference.is_error_code_enum_lt__addrinfo_errors__gt_.value [*value]] [static]] 138394 [] 138395 ] 138396 138397] 138398 138399[heading Requirements] 138400 138401['Header: ][^boost/asio/error.hpp] 138402 138403['Convenience header: ][^boost/asio.hpp] 138404 138405 138406[section:value boost::system::is_error_code_enum< boost::asio::error::addrinfo_errors >::value] 138407 138408[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 >] 138409 138410 static const bool value = true; 138411 138412 138413 138414[endsect] 138415 138416 138417 138418[endsect] 138419 138420[section:is_error_code_enum_lt__basic_errors__gt_ boost::system::is_error_code_enum< boost::asio::error::basic_errors >] 138421 138422[indexterm1 boost_asio.indexterm.is_error_code_enum_lt__basic_errors__gt_..boost::system::is_error_code_enum< boost::asio::error::basic_errors >] 138423 138424 138425 138426 template<> 138427 struct boost::system::is_error_code_enum< boost::asio::error::basic_errors > 138428 138429 138430[heading Data Members] 138431[table 138432 [[Name][Description]] 138433 138434 [ 138435 [[link boost_asio.reference.is_error_code_enum_lt__basic_errors__gt_.value [*value]] [static]] 138436 [] 138437 ] 138438 138439] 138440 138441[heading Requirements] 138442 138443['Header: ][^boost/asio/error.hpp] 138444 138445['Convenience header: ][^boost/asio.hpp] 138446 138447 138448[section:value boost::system::is_error_code_enum< boost::asio::error::basic_errors >::value] 138449 138450[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 >] 138451 138452 static const bool value = true; 138453 138454 138455 138456[endsect] 138457 138458 138459 138460[endsect] 138461 138462[section:is_error_code_enum_lt__misc_errors__gt_ boost::system::is_error_code_enum< boost::asio::error::misc_errors >] 138463 138464[indexterm1 boost_asio.indexterm.is_error_code_enum_lt__misc_errors__gt_..boost::system::is_error_code_enum< boost::asio::error::misc_errors >] 138465 138466 138467 138468 template<> 138469 struct boost::system::is_error_code_enum< boost::asio::error::misc_errors > 138470 138471 138472[heading Data Members] 138473[table 138474 [[Name][Description]] 138475 138476 [ 138477 [[link boost_asio.reference.is_error_code_enum_lt__misc_errors__gt_.value [*value]] [static]] 138478 [] 138479 ] 138480 138481] 138482 138483[heading Requirements] 138484 138485['Header: ][^boost/asio/error.hpp] 138486 138487['Convenience header: ][^boost/asio.hpp] 138488 138489 138490[section:value boost::system::is_error_code_enum< boost::asio::error::misc_errors >::value] 138491 138492[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 >] 138493 138494 static const bool value = true; 138495 138496 138497 138498[endsect] 138499 138500 138501 138502[endsect] 138503 138504[section:is_error_code_enum_lt__netdb_errors__gt_ boost::system::is_error_code_enum< boost::asio::error::netdb_errors >] 138505 138506[indexterm1 boost_asio.indexterm.is_error_code_enum_lt__netdb_errors__gt_..boost::system::is_error_code_enum< boost::asio::error::netdb_errors >] 138507 138508 138509 138510 template<> 138511 struct boost::system::is_error_code_enum< boost::asio::error::netdb_errors > 138512 138513 138514[heading Data Members] 138515[table 138516 [[Name][Description]] 138517 138518 [ 138519 [[link boost_asio.reference.is_error_code_enum_lt__netdb_errors__gt_.value [*value]] [static]] 138520 [] 138521 ] 138522 138523] 138524 138525[heading Requirements] 138526 138527['Header: ][^boost/asio/error.hpp] 138528 138529['Convenience header: ][^boost/asio.hpp] 138530 138531 138532[section:value boost::system::is_error_code_enum< boost::asio::error::netdb_errors >::value] 138533 138534[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 >] 138535 138536 static const bool value = true; 138537 138538 138539 138540[endsect] 138541 138542 138543 138544[endsect] 138545 138546[section:is_error_code_enum_lt__ssl_errors__gt_ boost::system::is_error_code_enum< boost::asio::error::ssl_errors >] 138547 138548[indexterm1 boost_asio.indexterm.is_error_code_enum_lt__ssl_errors__gt_..boost::system::is_error_code_enum< boost::asio::error::ssl_errors >] 138549 138550 138551 138552 template<> 138553 struct boost::system::is_error_code_enum< boost::asio::error::ssl_errors > 138554 138555 138556[heading Data Members] 138557[table 138558 [[Name][Description]] 138559 138560 [ 138561 [[link boost_asio.reference.is_error_code_enum_lt__ssl_errors__gt_.value [*value]] [static]] 138562 [] 138563 ] 138564 138565] 138566 138567[heading Requirements] 138568 138569['Header: ][^boost/asio/ssl/error.hpp] 138570 138571['Convenience header: ][^boost/asio/ssl.hpp] 138572 138573 138574[section:value boost::system::is_error_code_enum< boost::asio::error::ssl_errors >::value] 138575 138576[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 >] 138577 138578 static const bool value = true; 138579 138580 138581 138582[endsect] 138583 138584 138585 138586[endsect] 138587 138588[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 >] 138589 138590[indexterm1 boost_asio.indexterm.is_error_code_enum_lt__boost__asio__ssl__error__stream_errors__gt_..boost::system::is_error_code_enum< boost::asio::ssl::error::stream_errors >] 138591 138592 138593 138594 template<> 138595 struct boost::system::is_error_code_enum< boost::asio::ssl::error::stream_errors > 138596 138597 138598[heading Data Members] 138599[table 138600 [[Name][Description]] 138601 138602 [ 138603 [[link boost_asio.reference.is_error_code_enum_lt__boost__asio__ssl__error__stream_errors__gt_.value [*value]] [static]] 138604 [] 138605 ] 138606 138607] 138608 138609[heading Requirements] 138610 138611['Header: ][^boost/asio/ssl/error.hpp] 138612 138613['Convenience header: ][^boost/asio/ssl.hpp] 138614 138615 138616[section:value boost::system::is_error_code_enum< boost::asio::ssl::error::stream_errors >::value] 138617 138618[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 >] 138619 138620 static const bool value = true; 138621 138622 138623 138624[endsect] 138625 138626 138627 138628[endsect] 138629 138630[endsect] 138631